1 | (function(modules) {
|
2 |
|
3 | var installedModules = {};
|
4 |
|
5 |
|
6 | function __webpack_require__(moduleId) {
|
7 |
|
8 |
|
9 | if(installedModules[moduleId])
|
10 | return installedModules[moduleId].exports;
|
11 |
|
12 |
|
13 | var module = installedModules[moduleId] = {
|
14 | exports: {},
|
15 | id: moduleId,
|
16 | loaded: false
|
17 | };
|
18 |
|
19 |
|
20 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21 |
|
22 |
|
23 | module.loaded = true;
|
24 |
|
25 |
|
26 | return module.exports;
|
27 | }
|
28 |
|
29 |
|
30 |
|
31 | __webpack_require__.m = modules;
|
32 |
|
33 |
|
34 | __webpack_require__.c = installedModules;
|
35 |
|
36 |
|
37 | __webpack_require__.p = "";
|
38 |
|
39 |
|
40 | return __webpack_require__(0);
|
41 | })
|
42 |
|
43 | ([
|
44 |
|
45 | (function(module, exports, __webpack_require__) {
|
46 |
|
47 | 'use strict';
|
48 |
|
49 | var _react = __webpack_require__(1);
|
50 |
|
51 | var _react2 = _interopRequireDefault(_react);
|
52 |
|
53 | var _reactDom = __webpack_require__(2);
|
54 |
|
55 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
56 |
|
57 | var _beeLayout = __webpack_require__(3);
|
58 |
|
59 | var _beePanel = __webpack_require__(9);
|
60 |
|
61 | var _beeDrawer = __webpack_require__(78);
|
62 |
|
63 | var _beeDrawer2 = _interopRequireDefault(_beeDrawer);
|
64 |
|
65 | var _beeClipboard = __webpack_require__(92);
|
66 |
|
67 | var _beeClipboard2 = _interopRequireDefault(_beeClipboard);
|
68 |
|
69 | var _src = __webpack_require__(157);
|
70 |
|
71 | var _src2 = _interopRequireDefault(_src);
|
72 |
|
73 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
74 |
|
75 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
76 |
|
77 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
78 |
|
79 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
80 |
|
81 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
82 |
|
83 | var Demo1 = __webpack_require__(274);var Demo2 = __webpack_require__(275);var Demo3 = __webpack_require__(276);var Demo4 = __webpack_require__(277);var Demo5 = __webpack_require__(278);var Demo6 = __webpack_require__(279);var Demo7 = __webpack_require__(280);var Demo8 = __webpack_require__(281);var Demo9 = __webpack_require__(282);var Demo90 = __webpack_require__(283);var Demo91 = __webpack_require__(284);var Demo92 = __webpack_require__(285);var Demo93 = __webpack_require__(286);var DemoArray = [{ "example": _react2['default'].createElement(Demo1, null), "title": " 基础拖拽", "code": "\n/**\n *\n * @title 基础拖拽\n * @description 将某个元素设置为可拖拽\n *\n */\n\nimport React, { Component } from 'react';\nimport Dnd from \"tinper-bee/lib/Dnd\";\nimport { Button } from 'tinper-bee';\n\nclass Demo1 extends Component {\n\n onStart=()=>{\n console.log('start');\n }\n onStop=()=>{\n console.log('stop');\n }\n render() {\n return (\n <div>\n <Dnd onStart={this.onStart} onStop={this.onStop}>\n <div className=\"demo\">我可随意拖拽</div>\n </Dnd>\n </div>\n\n );\n }\n}\n\n", "desc": " 将某个元素设置为可拖拽", "scss_code": ".demo {\r\n width:167px;\r\n height:32px;\r\n background:rgba(247,249,251,1);\r\n border-radius:3px;\r\n border:1px solid rgba(165,173,186,1);\r\n line-height: 32px;\r\n font-size: 12px;\r\n color: #212121;\r\n text-align: center;\r\n cursor: grab;\r\n &:hover{\r\n background:rgba(235,236,240,1);\r\n border-radius:3px;\r\n }\r\n}\r\n/*拖动状态*/\r\n.react-draggable-transparent-selection{\r\n .demo{\r\n box-shadow:0px 2px 4px 0px rgba(31,37,52,0.3);\r\n opacity:0.8;\r\n cursor: grabbing;\r\n }\r\n}" }, { "example": _react2['default'].createElement(Demo2, null), "title": " 单个元素沿x轴y轴拖拽", "code": "\n/**\n *\n * @title 单个元素沿x轴y轴拖拽\n * @description 设置axis=\"x\"只可以沿着x轴拖拽,同理axis=\"y\"只可以沿着y轴拖拽\n *\n */\n\nimport React, { Component } from 'react';\nimport Dnd from \"tinper-bee/lib/Dnd\";\nimport { Button } from 'tinper-bee';\n\nclass Demo2 extends Component {\n\n onStart=()=>{\n console.log('start');\n }\n onStop=()=>{\n console.log('stop');\n }\n render() {\n return (\n <div>\n <Dnd axis=\"x\" onStart={this.onStart} onStop={this.onStop}>\n <div className=\"demo\">我只可延X轴拖拽</div>\n </Dnd>\n </div>\n\n );\n }\n}\n\n", "desc": " 设置axis=\"x\"只可以沿着x轴拖拽,同理axis=\"y\"只可以沿着y轴拖拽", "scss_code": ".demo {\r\n width:167px;\r\n height:32px;\r\n background:rgba(247,249,251,1);\r\n border-radius:3px;\r\n border:1px solid rgba(165,173,186,1);\r\n line-height: 32px;\r\n font-size: 12px;\r\n color: #212121;\r\n text-align: center;\r\n cursor: grab;\r\n &:hover{\r\n background:rgba(235,236,240,1);\r\n border-radius:3px;\r\n }\r\n}\r\n/*拖动状态*/\r\n.react-draggable-transparent-selection{\r\n .demo{\r\n box-shadow:0px 2px 4px 0px rgba(31,37,52,0.3);\r\n opacity:0.8;\r\n cursor: grabbing;\r\n }\r\n}" }, { "example": _react2['default'].createElement(Demo3, null), "title": " 设置元素不可拖拽", "code": "\r\n/**\r\n *\r\n * @title 设置元素不可拖拽\r\n * @description 设置 onStart 的返回值为false,则不可以拖拽\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\r\n\nimport Dnd from \"tinper-bee/lib/Dnd\";\nimport { Button } from 'tinper-bee';\r\n\r\nclass Demo3 extends Component {\r\n\r\n onStart=()=>{\r\n console.log('start');\r\n return false;\r\n }\r\n onStop=()=>{\r\n console.log('stop');\r\n }\r\n render() {\r\n return (\r\n <div className=\"demo-3\">\r\n <Dnd onStart={this.onStart} onStop={this.onStop}>\r\n <div className=\"demo3 demo\">我不可以拖拽</div>\r\n </Dnd>\r\n </div>\r\n\r\n );\r\n }\r\n}\r\n", "desc": " 设置 onStart 的返回值为false,则不可以拖拽", "scss_code": ".demo-3{\r\n .demo3:hover{\r\n background:rgba(247,249,251,1);\r\n cursor: not-allowed;\r\n }\r\n}" }, { "example": _react2['default'].createElement(Demo4, null), "title": " 单个元素拖拽把手", "code": "/**\r\n *\r\n * @title 单个元素拖拽把手\r\n * @description 设置 handle,值为选择器,例如 '.handle'\r\n * 设置不可拖拽区域 cancel,值为选择器,例如 '.handle'\r\n */\r\n\r\nimport React, { Component } from 'react';\r\n\nimport Dnd from \"tinper-bee/lib/Dnd\";\nimport { Icon } from 'tinper-bee';\r\n\r\nclass Demo4 extends Component {\r\n\r\n onStart=()=>{\r\n console.log('start');\r\n }\r\n onStop=()=>{\r\n console.log('stop');\r\n }\r\n\r\n render() {\r\n return (\r\n <div className=\"demo-4\">\r\n <div>\r\n <Dnd handle=\".handle\" onStart={this.onStart} onStop={this.onStop}>\r\n <div className=\"demo4 demo\">\r\n 需要拖拽把手\r\n <div className=\"handle\"><Icon type=\"uf-move\"></Icon></div>\r\n </div>\r\n </Dnd>\r\n </div>\r\n </div>\r\n\r\n\r\n );\r\n }\r\n}\r\n\r\n", "desc": " 设置 handle,值为选择器,例如 '.handle'", "scss_code": "\r\n.demo-4 .demo4 {\r\n position: relative;\r\n cursor: default;\r\n &:hover{\r\n background:rgba(247,249,251,1);\r\n cursor: default;\r\n }\r\n}\r\n\r\n.demo4 .handle {\r\n position: absolute;\r\n right: -1px;\r\n top: -1px;\r\n height: 32px;\r\n line-height: 30px;\r\n background:rgba(223,225,230,1);\r\n border-radius:0px 3px 3px 0px;\r\n border:1px solid rgba(165,173,186,1);\r\n cursor: grab;\r\n &:hover{\r\n background:rgba(179,186,197,1);\r\n }\r\n}\r\n/*拖动状态*/\r\n.react-draggable-transparent-selection{\r\n .demo4 .handle{\r\n background:rgba(179,186,197,1);\r\n cursor: grabbing;\r\n }\r\n}" }, { "example": _react2['default'].createElement(Demo5, null), "title": " 每次拖拽移动距离", "code": "\r\n/**\r\n *\r\n * @title 每次拖拽移动距离\r\n * @description 设置 grid={[x,y]}\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\r\n\nimport Dnd from \"tinper-bee/lib/Dnd\";\nimport { Button } from 'tinper-bee';\r\n\r\nclass Demo5 extends Component {\r\n\r\n onStart=()=>{\r\n console.log('start');\r\n }\r\n onStop=()=>{\r\n console.log('stop');\r\n }\r\n render() {\r\n return (\r\n <div>\r\n <Dnd grid={[25, 25]} onStart={this.onStart} onStop={this.onStop}>\r\n <div className=\"demo\">我每次拖拽可移动25px</div>\r\n </Dnd>\r\n </div>\r\n\r\n );\r\n }\r\n}\r\n\r\n", "desc": " 设置 grid={[x,y]}", "scss_code": ".demo {\r\n width:167px;\r\n height:32px;\r\n background:rgba(247,249,251,1);\r\n border-radius:3px;\r\n border:1px solid rgba(165,173,186,1);\r\n line-height: 32px;\r\n font-size: 12px;\r\n color: #212121;\r\n text-align: center;\r\n cursor: grab;\r\n &:hover{\r\n background:rgba(235,236,240,1);\r\n border-radius:3px;\r\n }\r\n}\r\n/*拖动状态*/\r\n.react-draggable-transparent-selection{\r\n .demo{\r\n box-shadow:0px 2px 4px 0px rgba(31,37,52,0.3);\r\n opacity:0.8;\r\n cursor: grabbing;\r\n }\r\n}" }, { "example": _react2['default'].createElement(Demo6, null), "title": " 元素拖拽范围", "code": "\r\n/**\r\n *\r\n * @title 元素拖拽范围\r\n * @description 设置上下左右可拖拽范围 bounds={{top: -xxx, left: -xxx, right: xxx, bottom: xx}}\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\r\nimport Dnd from \"tinper-bee/lib/Dnd\";\r\n\r\nclass Demo6 extends Component {\r\n\r\n onStart=()=>{\r\n console.log('start');\r\n }\r\n onStop=()=>{\r\n console.log('stop');\r\n }\r\n render() {\r\n return (\r\n <div className=\"demo6\">\r\n <Dnd bounds={{top: -50, left: -50, right: 50, bottom: 50}} onStart={this.onStart} onStop={this.onStop}>\r\n <div className=\"demo\">我只能再上下左右50px内移动</div>\r\n </Dnd>\r\n </div>\r\n\r\n );\r\n }\r\n}\r\n\r\n", "desc": " 设置上下左右可拖拽范围 bounds={{top: -xxx, left: -xxx, right: xxx, bottom: xx}}", "scss_code": ".demo {\r\n width:167px;\r\n height:32px;\r\n background:rgba(247,249,251,1);\r\n border-radius:3px;\r\n border:1px solid rgba(165,173,186,1);\r\n line-height: 32px;\r\n font-size: 12px;\r\n color: #212121;\r\n text-align: center;\r\n cursor: grab;\r\n &:hover{\r\n background:rgba(235,236,240,1);\r\n border-radius:3px;\r\n }\r\n}\r\n/*拖动状态*/\r\n.react-draggable-transparent-selection{\r\n .demo{\r\n box-shadow:0px 2px 4px 0px rgba(31,37,52,0.3);\r\n opacity:0.8;\r\n cursor: grabbing;\r\n }\r\n}\r\n.demo6{\r\n height: 100px;\r\n}" }, { "example": _react2['default'].createElement(Demo7, null), "title": " 在指定容器中拖拽", "code": "\r\n/**\r\n *\r\n * @title 在指定容器中拖拽\r\n * @description 设置只可以在指定容器中移动\r\n * bounds的也可以设置为选择器,bounds=\".demo8-parent\"意为在class=demo8-parent的容器中移动\r\n */\r\n\r\nimport React, { Component } from 'react';\r\n\nimport Dnd from \"tinper-bee/lib/Dnd\";\nimport { Button } from 'tinper-bee';\r\n\r\nclass Demo7 extends Component {\r\n\r\n onStart=()=>{\r\n console.log('start');\r\n }\r\n onStop=()=>{\r\n console.log('stop');\r\n }\r\n render() {\r\n return (\r\n <div>\r\n <div className=\"demo7-parent\">\r\n <Dnd bounds=\".demo7-parent\" onStart={this.onStart} onStop={this.onStop}>\r\n <div className=\"demo\">我只能在父级元素中移动</div>\r\n </Dnd>\r\n </div>\r\n </div>\r\n\r\n\r\n );\r\n }\r\n}\r\n\r\n", "desc": " 设置只可以在指定容器中移动", "scss_code": ".demo {\r\n width:167px;\r\n height:32px;\r\n background:rgba(247,249,251,1);\r\n border-radius:3px;\r\n border:1px solid rgba(165,173,186,1);\r\n line-height: 32px;\r\n font-size: 12px;\r\n color: #212121;\r\n text-align: center;\r\n cursor: grab;\r\n &:hover{\r\n background:rgba(235,236,240,1);\r\n border-radius:3px;\r\n }\r\n}\r\n/*拖动状态*/\r\n.react-draggable-transparent-selection{\r\n .demo{\r\n box-shadow:0px 2px 4px 0px rgba(31,37,52,0.3);\r\n opacity:0.8;\r\n cursor: grabbing;\r\n }\r\n}\r\n\r\n.demo7-parent {\r\n width: 300px;\r\n height: 200px;\r\n background: rgba(247,249,251,1);\r\n border: 1px solid rgba(235,236,240,1);\r\n position: relative;\r\n}" }, { "example": _react2['default'].createElement(Demo8, null), "title": " 数据集合拖拽列表排序", "code": "/**\n *\n * @title 数据集合拖拽列表排序\n * @description 增加list 可以为 [1,2,3]数组,\n * 也可以为 [{},{}...],需要配置 showKey 。\n * 也可以为 dom集合,见后边示例\n *\n */\n\nimport React, { Component } from 'react';\nimport Dnd from \"tinper-bee/lib/Dnd\";\n\nclass Demo8 extends Component {\n \n onDragStart=(result,list)=>{\n console.log('开始');\n }\n onDragEnd=(result,list)=>{ \n console.log('结束');\n }\n onDragUpdate=(result)=>{\n console.log('update')\n }\n render() {\n let list=[\n {\n name:'第一',\n code:'a'\n },\n {\n name:'第二',\n code:'b'\n },\n {\n name:'第三',\n code:'c'\n },\n {\n name:'第四',\n code:'d'\n },\n {\n name:'第五',\n code:'e'\n },\n ];\n return (\n <Dnd showKey='name' list={list} onDragUpdate={this.onDragUpdate} onStart={this.onDragStart} onStop={this.onDragEnd}/>\n );\n }\n}\n\n", "desc": " 增加list 可以为 [1,2,3]数组,", "scss_code": "" }, { "example": _react2['default'].createElement(Demo9, null), "title": " DOM集合拖拽列表排序", "code": "\r\n/**\r\n *\r\n * @title DOM集合拖拽列表排序\r\n * @description list传dom集合\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\r\nimport Dnd from \"tinper-bee/lib/Dnd\";\r\n\r\nclass Demo9 extends Component {\r\n\r\n onDragStart=(result,list)=>{\r\n console.log('开始');\r\n }\r\n onDragEnd=(result,list)=>{\r\n console.log('结束');\r\n }\r\n render() {\r\n let list=[<div>DOM第一</div>,<div>DOM第二</div>,<div>DOM第三</div>,<div>DOM第四</div>,<div>DOM第五</div>];\r\n return (\r\n <Dnd list={list} onStart={this.onDragStart} onStop={this.onDragEnd} />\r\n );\r\n }\r\n}\r\n\r\n", "desc": " list传dom集合" }, { "example": _react2['default'].createElement(Demo90, null), "title": " 横向拖拽列表排序", "code": "\r\n/**\r\n *\r\n * @title 横向拖拽列表排序\r\n * @description type='horizontal'\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\nimport { } from 'tinper-bee';\r\nimport Dnd from \"tinper-bee/lib/Dnd\";;\r\n\r\nclass Demo90 extends Component {\r\n\r\n render() {\r\n let list=['第一','第二','第三','第四','第五'];\r\n return (\r\n <Dnd list={list} type='horizontal' />\r\n );\r\n }\r\n}\r\n\r\n", "desc": " type='horizontal'" }, { "example": _react2['default'].createElement(Demo91, null), "title": " 两列纵向拖拽", "code": "\r\n/**\r\n *\r\n * @title 两列纵向拖拽\r\n * @description 设置 type='betweenVertical'。 如果不设置高度以及 overflow: scroll; 则高度会自动撑开\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\nimport { } from 'tinper-bee';\r\nimport Dnd from \"tinper-bee/lib/Dnd\";;\r\n\r\nclass Demo90 extends Component {\r\n\r\n render() {\r\n let list1=['第一','第二','第三','第四','第五'];\r\n let list2=['1','2','3','4','5'];\r\n return (\r\n <Dnd className='demo91' list={list1} otherList={list2} type='betweenVertical' />\r\n );\r\n }\r\n}\r\n\r\n", "desc": " 设置 type='betweenVertical'。 如果不设置高度以及 overflow: scroll; 则高度会自动撑开", "scss_code": ".u-drop{\r\n overflow: scroll;\r\n}\r\n.u-drag-between{\r\n height: 300px;\r\n}" }, { "example": _react2['default'].createElement(Demo92, null), "title": " 两列横向拖拽", "code": "\r\n/**\r\n *\r\n * @title 两列横向拖拽\r\n * @description 设置 type='betweenVertical'\r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\nimport { } from 'tinper-bee';\r\nimport Dnd from \"tinper-bee/lib/Dnd\";;\r\n\r\nclass Demo90 extends Component {\r\n onDragStart=(result,list)=>{\r\n console.log('开始');\r\n }\r\n onDragEnd=(result,listObj)=>{\r\n console.log('结束');\r\n console.log(listObj)\r\n }\r\n render() {\r\n let list1=['第一','第二','第三','第四','第五'];\r\n let list2=['1','2','3','4','5'];\r\n return (\r\n <Dnd list={list1} otherList={list2} type='betweenHorizontal' onStart={this.onDragStart} onStop={this.onDragEnd} />\r\n );\r\n }\r\n}\r\n\r\n", "desc": " 设置 type='betweenVertical'", "scss_code": ".u-drop{\r\n overflow: scroll;\r\n}\r\n.u-drag-between-horizontal{\r\n height: 200px;\r\n}" }, { "example": _react2['default'].createElement(Demo93, null), "title": " 网格排序", "code": "\r\n/**\r\n *\r\n * @title 网格排序\r\n * @description \r\n *\r\n */\r\n\r\nimport React, { Component } from 'react';\nimport { } from 'tinper-bee';\r\nimport Dnd from \"tinper-bee/lib/Dnd\";;\r\n\r\nconst GridLayout = Dnd.GridLayout;\r\n\r\nclass Demo93 extends Component {\r\n render() {\r\n let layout = [\r\n {i: 'a', x: 0, y: 0, w: 1, h: 2},\r\n {i: 'b', x: 1, y: 0, w: 3, h: 2},\r\n {i: 'c', x: 4, y: 0, w: 1, h: 2, static: true},\r\n {i: 'd', x: 0, y: 1, w: 1, h: 1},\r\n {i: 'e', x: 2, y: 2, w: 1, h: 2},\r\n {i: 'f', x: 3, y: 3, w: 1, h: 2}\r\n ];\r\n return (\r\n <GridLayout className=\"layout\" layout={layout} cols={6} rowHeight={30} width={500}>\r\n <div key=\"a\">a</div>\r\n <div key=\"b\">b</div>\r\n <div key=\"c\">static</div>\r\n <div key=\"d\">d</div>\r\n <div key=\"e\">e</div>\r\n <div key=\"f\">f</div>\r\n </GridLayout>\r\n );\r\n }\r\n}\r\n\r\n", "desc": " ", "scss_code": ".layout{\r\n background: #f7f9fb;\r\n border: 1px solid #ebecf0;\r\n padding: 12px;\r\n color: #212121;\r\n div{\r\n margin: 4px;\r\n background: white;\r\n border-radius: 3px;\r\n border: 1px solid #a5adba;\r\n padding: 6px 0;\r\n font-size: 12px;\r\n text-align: center;\r\n }\r\n}" }];
|
84 |
|
85 | var Demo = function (_Component) {
|
86 | _inherits(Demo, _Component);
|
87 |
|
88 | function Demo(props) {
|
89 | _classCallCheck(this, Demo);
|
90 |
|
91 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
92 |
|
93 | _this.handleClick = function () {
|
94 | _this.setState({ open: !_this.state.open });
|
95 | };
|
96 |
|
97 | _this.fCloseDrawer = function () {
|
98 | _this.setState({
|
99 | open: false
|
100 | });
|
101 | };
|
102 |
|
103 | _this.state = {
|
104 | open: false
|
105 | };
|
106 | return _this;
|
107 | }
|
108 |
|
109 | Demo.prototype.render = function render() {
|
110 | var _props = this.props,
|
111 | title = _props.title,
|
112 | example = _props.example,
|
113 | code = _props.code,
|
114 | desc = _props.desc,
|
115 | scss_code = _props.scss_code;
|
116 |
|
117 |
|
118 | var header = _react2['default'].createElement(
|
119 | 'div',
|
120 | null,
|
121 | _react2['default'].createElement(
|
122 | 'p',
|
123 | { className: 'component-title' },
|
124 | title
|
125 | ),
|
126 | _react2['default'].createElement(
|
127 | 'p',
|
128 | null,
|
129 | desc
|
130 | ),
|
131 | _react2['default'].createElement(
|
132 | 'span',
|
133 | { className: 'component-code', onClick: this.handleClick },
|
134 | ' \u67E5\u770B\u6E90\u7801 ',
|
135 | _react2['default'].createElement('i', { className: 'uf uf-arrow-right' }),
|
136 | ' '
|
137 | )
|
138 | );
|
139 | return _react2['default'].createElement(
|
140 | _beeLayout.Col,
|
141 | { md: 12, id: title.trim(), className: 'component-demo' },
|
142 | _react2['default'].createElement(
|
143 | _beePanel.Panel,
|
144 | { header: header },
|
145 | example
|
146 | ),
|
147 | _react2['default'].createElement(
|
148 | _beeDrawer2['default'],
|
149 | { className: 'component-drawerc', title: title, show: this.state.open, placement: 'right', onClose: this.fCloseDrawer },
|
150 | _react2['default'].createElement(
|
151 | 'div',
|
152 | { className: 'component-code-copy' },
|
153 | ' JS\u4EE3\u7801',
|
154 | _react2['default'].createElement(_beeClipboard2['default'], { action: 'copy', text: code })
|
155 | ),
|
156 | _react2['default'].createElement(
|
157 | 'pre',
|
158 | { className: 'pre-js' },
|
159 | _react2['default'].createElement(
|
160 | 'code',
|
161 | { className: 'hljs javascript' },
|
162 | code
|
163 | )
|
164 | ),
|
165 | !!scss_code ? _react2['default'].createElement(
|
166 | 'div',
|
167 | { className: 'component-code-copy copy-css' },
|
168 | ' SCSS\u4EE3\u7801',
|
169 | _react2['default'].createElement(_beeClipboard2['default'], { action: 'copy', text: scss_code })
|
170 | ) : null,
|
171 | !!scss_code ? _react2['default'].createElement(
|
172 | 'pre',
|
173 | { className: 'pre-css' },
|
174 | _react2['default'].createElement(
|
175 | 'code',
|
176 | { className: 'hljs css' },
|
177 | scss_code
|
178 | )
|
179 | ) : null
|
180 | )
|
181 | );
|
182 | };
|
183 |
|
184 | return Demo;
|
185 | }(_react.Component);
|
186 |
|
187 | var DemoGroup = function (_Component2) {
|
188 | _inherits(DemoGroup, _Component2);
|
189 |
|
190 | function DemoGroup(props) {
|
191 | _classCallCheck(this, DemoGroup);
|
192 |
|
193 | return _possibleConstructorReturn(this, _Component2.call(this, props));
|
194 | }
|
195 |
|
196 | DemoGroup.prototype.render = function render() {
|
197 | return _react2['default'].createElement(
|
198 | _beeLayout.Row,
|
199 | null,
|
200 | DemoArray.map(function (child, index) {
|
201 |
|
202 | return _react2['default'].createElement(Demo, { example: child.example, title: child.title, code: child.code, scss_code: child.scss_code, desc: child.desc, key: index });
|
203 | })
|
204 | );
|
205 | };
|
206 |
|
207 | return DemoGroup;
|
208 | }(_react.Component);
|
209 |
|
210 | _reactDom2['default'].render(_react2['default'].createElement(DemoGroup, null), document.getElementById('tinperBeeDemo'));
|
211 |
|
212 | }),
|
213 |
|
214 | (function(module, exports) {
|
215 |
|
216 | module.exports = React;
|
217 |
|
218 | }),
|
219 |
|
220 | (function(module, exports) {
|
221 |
|
222 | module.exports = ReactDOM;
|
223 |
|
224 | }),
|
225 |
|
226 | (function(module, exports, __webpack_require__) {
|
227 |
|
228 | 'use strict';
|
229 |
|
230 | Object.defineProperty(exports, "__esModule", {
|
231 | value: true
|
232 | });
|
233 | exports.Con = exports.Row = exports.Col = undefined;
|
234 |
|
235 | var _Col2 = __webpack_require__(4);
|
236 |
|
237 | var _Col3 = _interopRequireDefault(_Col2);
|
238 |
|
239 | var _Row2 = __webpack_require__(7);
|
240 |
|
241 | var _Row3 = _interopRequireDefault(_Row2);
|
242 |
|
243 | var _Layout = __webpack_require__(8);
|
244 |
|
245 | var _Layout2 = _interopRequireDefault(_Layout);
|
246 |
|
247 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
248 |
|
249 | exports.Col = _Col3["default"];
|
250 | exports.Row = _Row3["default"];
|
251 | exports.Con = _Layout2["default"];
|
252 |
|
253 | }),
|
254 |
|
255 | (function(module, exports, __webpack_require__) {
|
256 |
|
257 | 'use strict';
|
258 |
|
259 | Object.defineProperty(exports, "__esModule", {
|
260 | value: true
|
261 | });
|
262 |
|
263 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
264 |
|
265 | var _classnames = __webpack_require__(5);
|
266 |
|
267 | var _classnames2 = _interopRequireDefault(_classnames);
|
268 |
|
269 | var _react = __webpack_require__(1);
|
270 |
|
271 | var _react2 = _interopRequireDefault(_react);
|
272 |
|
273 | var _propTypes = __webpack_require__(6);
|
274 |
|
275 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
276 |
|
277 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
278 |
|
279 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
280 |
|
281 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
282 |
|
283 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
284 |
|
285 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
286 |
|
287 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
288 |
|
289 | var propTypes = {
|
290 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]),
|
291 |
|
292 | |
293 |
|
294 |
|
295 | xs: _propTypes2["default"].number,
|
296 | |
297 |
|
298 |
|
299 | sm: _propTypes2["default"].number,
|
300 | |
301 |
|
302 |
|
303 | md: _propTypes2["default"].number,
|
304 | |
305 |
|
306 |
|
307 | lg: _propTypes2["default"].number,
|
308 | |
309 |
|
310 |
|
311 | xsOffset: _propTypes2["default"].number,
|
312 | |
313 |
|
314 |
|
315 | smOffset: _propTypes2["default"].number,
|
316 | |
317 |
|
318 |
|
319 | mdOffset: _propTypes2["default"].number,
|
320 | |
321 |
|
322 |
|
323 | lgOffset: _propTypes2["default"].number,
|
324 | |
325 |
|
326 |
|
327 | xsPush: _propTypes2["default"].number,
|
328 | |
329 |
|
330 |
|
331 | smPush: _propTypes2["default"].number,
|
332 | |
333 |
|
334 |
|
335 | mdPush: _propTypes2["default"].number,
|
336 | |
337 |
|
338 |
|
339 | lgPush: _propTypes2["default"].number,
|
340 | |
341 |
|
342 |
|
343 | xsPull: _propTypes2["default"].number,
|
344 | |
345 |
|
346 |
|
347 | smPull: _propTypes2["default"].number,
|
348 | |
349 |
|
350 |
|
351 | mdPull: _propTypes2["default"].number,
|
352 | |
353 |
|
354 |
|
355 | lgPull: _propTypes2["default"].number
|
356 | };
|
357 |
|
358 | var defaultProps = {
|
359 | componentClass: 'div',
|
360 | clsPrefix: 'u-col'
|
361 | };
|
362 |
|
363 | var DEVICE_SIZES = ['lg', 'md', 'sm', 'xs'];
|
364 |
|
365 | var Col = function (_Component) {
|
366 | _inherits(Col, _Component);
|
367 |
|
368 | function Col() {
|
369 | _classCallCheck(this, Col);
|
370 |
|
371 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
372 | }
|
373 |
|
374 | Col.prototype.render = function render() {
|
375 | var _props = this.props,
|
376 | Component = _props.componentClass,
|
377 | className = _props.className,
|
378 | clsPrefix = _props.clsPrefix,
|
379 | others = _objectWithoutProperties(_props, ['componentClass', 'className', 'clsPrefix']);
|
380 |
|
381 | var tbClass = [];
|
382 | |
383 |
|
384 |
|
385 |
|
386 | DEVICE_SIZES.forEach(function (size) {
|
387 | function popProp(propSuffix, modifier) {
|
388 | var propName = '' + size + propSuffix;
|
389 | var propValue = others[propName];
|
390 |
|
391 | if (propValue != undefined && propValue != null) {
|
392 | tbClass.push(clsPrefix + '-' + size + modifier + '-' + propValue);
|
393 | }
|
394 |
|
395 | delete others[propName];
|
396 | }
|
397 |
|
398 | popProp('', '');
|
399 | popProp('Offset', '-offset');
|
400 | popProp('Push', '-push');
|
401 | popProp('Pull', '-pull');
|
402 | });
|
403 |
|
404 | return _react2["default"].createElement(
|
405 | Component,
|
406 | _extends({
|
407 | className: (0, _classnames2["default"])(tbClass, className)
|
408 | }, others),
|
409 | this.props.children
|
410 | );
|
411 | };
|
412 |
|
413 | return Col;
|
414 | }(_react.Component);
|
415 |
|
416 | Col.defaultProps = defaultProps;
|
417 | Col.propTypes = propTypes;
|
418 |
|
419 | exports["default"] = Col;
|
420 | module.exports = exports['default'];
|
421 |
|
422 | }),
|
423 |
|
424 | (function(module, exports, __webpack_require__) {
|
425 |
|
426 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; |
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 | (function () {
|
434 | 'use strict';
|
435 |
|
436 | var hasOwn = {}.hasOwnProperty;
|
437 |
|
438 | function classNames () {
|
439 | var classes = [];
|
440 |
|
441 | for (var i = 0; i < arguments.length; i++) {
|
442 | var arg = arguments[i];
|
443 | if (!arg) continue;
|
444 |
|
445 | var argType = typeof arg;
|
446 |
|
447 | if (argType === 'string' || argType === 'number') {
|
448 | classes.push(arg);
|
449 | } else if (Array.isArray(arg) && arg.length) {
|
450 | var inner = classNames.apply(null, arg);
|
451 | if (inner) {
|
452 | classes.push(inner);
|
453 | }
|
454 | } else if (argType === 'object') {
|
455 | for (var key in arg) {
|
456 | if (hasOwn.call(arg, key) && arg[key]) {
|
457 | classes.push(key);
|
458 | }
|
459 | }
|
460 | }
|
461 | }
|
462 |
|
463 | return classes.join(' ');
|
464 | }
|
465 |
|
466 | if (typeof module !== 'undefined' && module.exports) {
|
467 | classNames.default = classNames;
|
468 | module.exports = classNames;
|
469 | } else if (true) {
|
470 |
|
471 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
|
472 | return classNames;
|
473 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
474 | } else {
|
475 | window.classNames = classNames;
|
476 | }
|
477 | }());
|
478 |
|
479 |
|
480 | }),
|
481 |
|
482 | (function(module, exports) {
|
483 |
|
484 | module.exports = PropTypes;
|
485 |
|
486 | }),
|
487 |
|
488 | (function(module, exports, __webpack_require__) {
|
489 |
|
490 | 'use strict';
|
491 |
|
492 | Object.defineProperty(exports, "__esModule", {
|
493 | value: true
|
494 | });
|
495 |
|
496 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
497 |
|
498 | var _classnames = __webpack_require__(5);
|
499 |
|
500 | var _classnames2 = _interopRequireDefault(_classnames);
|
501 |
|
502 | var _react = __webpack_require__(1);
|
503 |
|
504 | var _react2 = _interopRequireDefault(_react);
|
505 |
|
506 | var _propTypes = __webpack_require__(6);
|
507 |
|
508 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
509 |
|
510 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
511 |
|
512 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
513 |
|
514 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
515 |
|
516 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
517 |
|
518 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
519 |
|
520 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
521 |
|
522 | var propTypes = {
|
523 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string])
|
524 | };
|
525 |
|
526 | var defaultProps = {
|
527 | componentClass: 'div',
|
528 | clsPrefix: 'u-row'
|
529 | };
|
530 |
|
531 | var Row = function (_Component) {
|
532 | _inherits(Row, _Component);
|
533 |
|
534 | function Row() {
|
535 | _classCallCheck(this, Row);
|
536 |
|
537 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
538 | }
|
539 |
|
540 | Row.prototype.render = function render() {
|
541 | var _props = this.props,
|
542 | Component = _props.componentClass,
|
543 | clsPrefix = _props.clsPrefix,
|
544 | className = _props.className,
|
545 | others = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
|
546 |
|
547 | var bsclass = '' + clsPrefix;
|
548 |
|
549 | return _react2["default"].createElement(
|
550 | Component,
|
551 | _extends({}, others, {
|
552 | className: (0, _classnames2["default"])(bsclass, className)
|
553 | }),
|
554 | this.props.children
|
555 | );
|
556 | };
|
557 |
|
558 | return Row;
|
559 | }(_react.Component);
|
560 |
|
561 | Row.propTypes = propTypes;
|
562 | Row.defaultProps = defaultProps;
|
563 |
|
564 | exports["default"] = Row;
|
565 | module.exports = exports['default'];
|
566 |
|
567 | }),
|
568 |
|
569 | (function(module, exports, __webpack_require__) {
|
570 |
|
571 | 'use strict';
|
572 |
|
573 | Object.defineProperty(exports, "__esModule", {
|
574 | value: true
|
575 | });
|
576 |
|
577 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
578 |
|
579 | var _classnames = __webpack_require__(5);
|
580 |
|
581 | var _classnames2 = _interopRequireDefault(_classnames);
|
582 |
|
583 | var _react = __webpack_require__(1);
|
584 |
|
585 | var _react2 = _interopRequireDefault(_react);
|
586 |
|
587 | var _propTypes = __webpack_require__(6);
|
588 |
|
589 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
590 |
|
591 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
592 |
|
593 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
594 |
|
595 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
596 |
|
597 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
598 |
|
599 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
600 |
|
601 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
602 |
|
603 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
604 |
|
605 | var propTypes = {
|
606 | |
607 |
|
608 |
|
609 | fluid: _propTypes2["default"].bool,
|
610 | |
611 |
|
612 |
|
613 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string])
|
614 | };
|
615 |
|
616 | var defaultProps = {
|
617 | componentClass: 'div',
|
618 | fluid: false,
|
619 | clsPrefix: 'u-container'
|
620 | };
|
621 |
|
622 | var Con = function (_React$Component) {
|
623 | _inherits(Con, _React$Component);
|
624 |
|
625 | function Con() {
|
626 | _classCallCheck(this, Con);
|
627 |
|
628 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
629 | }
|
630 |
|
631 | Con.prototype.render = function render() {
|
632 | var _tbclass;
|
633 |
|
634 | var _props = this.props,
|
635 | fluid = _props.fluid,
|
636 | Component = _props.componentClass,
|
637 | clsPrefix = _props.clsPrefix,
|
638 | className = _props.className,
|
639 | others = _objectWithoutProperties(_props, ['fluid', 'componentClass', 'clsPrefix', 'className']);
|
640 |
|
641 | var tbclass = (_tbclass = {}, _defineProperty(_tbclass, '' + clsPrefix, !fluid), _defineProperty(_tbclass, clsPrefix + '-fluid', fluid), _tbclass);
|
642 |
|
643 | return _react2["default"].createElement(
|
644 | Component,
|
645 | _extends({}, others, {
|
646 | className: (0, _classnames2["default"])(tbclass, className)
|
647 | }),
|
648 | this.props.children
|
649 | );
|
650 | };
|
651 |
|
652 | return Con;
|
653 | }(_react2["default"].Component);
|
654 |
|
655 | Con.propTypes = propTypes;
|
656 | Con.defaultProps = defaultProps;
|
657 |
|
658 | exports["default"] = Con;
|
659 | module.exports = exports['default'];
|
660 |
|
661 | }),
|
662 |
|
663 | (function(module, exports, __webpack_require__) {
|
664 |
|
665 | 'use strict';
|
666 |
|
667 | Object.defineProperty(exports, "__esModule", {
|
668 | value: true
|
669 | });
|
670 | exports.PanelGroup = exports.Panel = undefined;
|
671 |
|
672 | var _Panel2 = __webpack_require__(10);
|
673 |
|
674 | var _Panel3 = _interopRequireDefault(_Panel2);
|
675 |
|
676 | var _PanelGroup2 = __webpack_require__(77);
|
677 |
|
678 | var _PanelGroup3 = _interopRequireDefault(_PanelGroup2);
|
679 |
|
680 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
681 |
|
682 | exports.Panel = _Panel3["default"];
|
683 | exports.PanelGroup = _PanelGroup3["default"];
|
684 |
|
685 | }),
|
686 |
|
687 | (function(module, exports, __webpack_require__) {
|
688 |
|
689 | 'use strict';
|
690 |
|
691 | Object.defineProperty(exports, "__esModule", {
|
692 | value: true
|
693 | });
|
694 |
|
695 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
696 |
|
697 | var _classnames = __webpack_require__(5);
|
698 |
|
699 | var _classnames2 = _interopRequireDefault(_classnames);
|
700 |
|
701 | var _react = __webpack_require__(1);
|
702 |
|
703 | var _react2 = _interopRequireDefault(_react);
|
704 |
|
705 | var _beeTransition = __webpack_require__(11);
|
706 |
|
707 | var _beeMessage = __webpack_require__(65);
|
708 |
|
709 | var _beeMessage2 = _interopRequireDefault(_beeMessage);
|
710 |
|
711 | var _propTypes = __webpack_require__(6);
|
712 |
|
713 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
714 |
|
715 | var _copyToClipboard = __webpack_require__(75);
|
716 |
|
717 | var _copyToClipboard2 = _interopRequireDefault(_copyToClipboard);
|
718 |
|
719 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
720 |
|
721 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
722 |
|
723 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
724 |
|
725 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
726 |
|
727 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
728 |
|
729 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
730 |
|
731 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
732 |
|
733 | var propTypes = {
|
734 |
|
735 | collapsible: _propTypes2["default"].bool,
|
736 | onSelect: _propTypes2["default"].func,
|
737 |
|
738 | header: _propTypes2["default"].node,
|
739 | headerStyle: _propTypes2["default"].object,
|
740 | id: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
741 | headerContent: _propTypes2["default"].bool,
|
742 |
|
743 | footer: _propTypes2["default"].node,
|
744 | footerStyle: _propTypes2["default"].object,
|
745 |
|
746 | defaultExpanded: _propTypes2["default"].bool,
|
747 |
|
748 | expanded: _propTypes2["default"].bool,
|
749 |
|
750 | eventKey: _propTypes2["default"].any,
|
751 | headerRole: _propTypes2["default"].string,
|
752 | panelRole: _propTypes2["default"].string,
|
753 |
|
754 | colors: _propTypes2["default"].oneOf(['primary', 'accent', 'success', 'info', 'warning', 'danger', 'default', 'bordered']),
|
755 |
|
756 |
|
757 | onEnter: _propTypes2["default"].func,
|
758 | onEntering: _propTypes2["default"].func,
|
759 | onEntered: _propTypes2["default"].func,
|
760 | onExit: _propTypes2["default"].func,
|
761 | onExiting: _propTypes2["default"].func,
|
762 | onExited: _propTypes2["default"].func,
|
763 |
|
764 | copyable: _propTypes2["default"].bool
|
765 | };
|
766 |
|
767 | var defaultProps = {
|
768 | defaultExpanded: false,
|
769 | clsPrefix: "u-panel",
|
770 | colors: "default"
|
771 | };
|
772 |
|
773 | var Panel = function (_React$Component) {
|
774 | _inherits(Panel, _React$Component);
|
775 |
|
776 | function Panel(props, context) {
|
777 | _classCallCheck(this, Panel);
|
778 |
|
779 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
780 |
|
781 | _this.handleClickTitle = _this.handleClickTitle.bind(_this);
|
782 |
|
783 | _this.state = {
|
784 | expanded: _this.props.defaultExpanded
|
785 | };
|
786 | return _this;
|
787 | }
|
788 |
|
789 |
|
790 |
|
791 |
|
792 | Panel.prototype.handleClickTitle = function handleClickTitle(e) {
|
793 |
|
794 | e.persist();
|
795 | e.selected = true;
|
796 |
|
797 | if (this.props.onSelect) {
|
798 | this.props.onSelect(this.props.eventKey, e);
|
799 | } else {
|
800 | e.preventDefault();
|
801 | }
|
802 |
|
803 | if (e.selected) {
|
804 | this.setState({ expanded: !this.state.expanded });
|
805 | }
|
806 | };
|
807 |
|
808 |
|
809 |
|
810 |
|
811 | Panel.prototype.renderHeader = function renderHeader(collapsible, header, id, role, expanded, clsPrefix) {
|
812 | var titleClassName = clsPrefix + '-title';
|
813 |
|
814 | if (!collapsible) {
|
815 | if (!_react2["default"].isValidElement(header)) {
|
816 | return header;
|
817 | }
|
818 |
|
819 | return (0, _react.cloneElement)(header, {
|
820 | className: (0, _classnames2["default"])(header.props.className, titleClassName)
|
821 | });
|
822 | }
|
823 |
|
824 | if (!_react2["default"].isValidElement(header)) {
|
825 | return _react2["default"].createElement(
|
826 | 'h4',
|
827 | { role: 'presentation', className: titleClassName },
|
828 | this.renderAnchor(header, id, role, expanded)
|
829 | );
|
830 | }
|
831 | if (this.props.headerContent) {
|
832 | return (0, _react.cloneElement)(header, {
|
833 | className: (0, _classnames2["default"])(header.props.className, titleClassName)
|
834 | });
|
835 | }
|
836 |
|
837 | return (0, _react.cloneElement)(header, {
|
838 | className: (0, _classnames2["default"])(header.props.className, titleClassName),
|
839 | children: this.renderAnchor(header.props.children, id, role, expanded)
|
840 | });
|
841 | };
|
842 |
|
843 |
|
844 |
|
845 |
|
846 | Panel.prototype.renderAnchor = function renderAnchor(header, id, role, expanded) {
|
847 | return _react2["default"].createElement(
|
848 | 'a',
|
849 | {
|
850 | role: role,
|
851 | href: id && '#' + id,
|
852 | 'aria-controls': id,
|
853 | 'aria-expanded': expanded,
|
854 | 'aria-selected': expanded,
|
855 | className: expanded ? null : 'collapsed'
|
856 | },
|
857 | header
|
858 | );
|
859 | };
|
860 |
|
861 |
|
862 |
|
863 |
|
864 | Panel.prototype.copyDemo = function copyDemo(e) {
|
865 | var panelTarget = e.target.parentNode;
|
866 | var clipBoardContent = panelTarget.firstChild.innerText;
|
867 | (0, _copyToClipboard2["default"])(clipBoardContent);
|
868 | _beeMessage2["default"].create({ content: '复制成功!', color: 'success', duration: 2 });
|
869 | };
|
870 |
|
871 |
|
872 |
|
873 |
|
874 | Panel.prototype.renderCollapsibleBody = function renderCollapsibleBody(id, expanded, role, children, clsPrefix, copyable, animationHooks) {
|
875 | return _react2["default"].createElement(
|
876 | _beeTransition.Collapse,
|
877 | _extends({ 'in': expanded }, animationHooks),
|
878 | _react2["default"].createElement(
|
879 | 'div',
|
880 | {
|
881 | id: id,
|
882 | role: role,
|
883 | className: clsPrefix + '-collapse',
|
884 | 'aria-hidden': !expanded
|
885 | },
|
886 | this.renderBody(children, clsPrefix, copyable)
|
887 | )
|
888 | );
|
889 | };
|
890 |
|
891 |
|
892 |
|
893 |
|
894 | Panel.prototype.renderBody = function renderBody(rawChildren, clsPrefix, copyable) {
|
895 | var self = this;
|
896 | var children = [];
|
897 | var bodyChildren = [];
|
898 |
|
899 | var bodyClassName = clsPrefix + '-body';
|
900 |
|
901 | function maybeAddBody(self) {
|
902 | if (!bodyChildren.length) {
|
903 | return;
|
904 | }
|
905 |
|
906 | children.push(_react2["default"].createElement(
|
907 | 'div',
|
908 | { key: children.length, className: bodyClassName },
|
909 | bodyChildren,
|
910 | copyable && _react2["default"].createElement('i', { className: 'uf uf-files-o', onClick: self.copyDemo })
|
911 | ));
|
912 | bodyChildren = [];
|
913 | }
|
914 |
|
915 |
|
916 | _react2["default"].Children.toArray(rawChildren).forEach(function (child) {
|
917 | if (_react2["default"].isValidElement(child) && child.props.fill) {
|
918 | maybeAddBody(self);
|
919 |
|
920 |
|
921 | children.push((0, _react.cloneElement)(child, { fill: undefined }));
|
922 |
|
923 | return;
|
924 | }
|
925 | bodyChildren.push(child);
|
926 | });
|
927 |
|
928 | maybeAddBody(self);
|
929 |
|
930 | return children;
|
931 | };
|
932 |
|
933 | Panel.prototype.render = function render() {
|
934 | var _props = this.props,
|
935 | collapsible = _props.collapsible,
|
936 | header = _props.header,
|
937 | id = _props.id,
|
938 | footer = _props.footer,
|
939 | propsExpanded = _props.expanded,
|
940 | footerStyle = _props.footerStyle,
|
941 | headerStyle = _props.headerStyle,
|
942 | headerRole = _props.headerRole,
|
943 | panelRole = _props.panelRole,
|
944 | className = _props.className,
|
945 | colors = _props.colors,
|
946 | children = _props.children,
|
947 | onEnter = _props.onEnter,
|
948 | onEntering = _props.onEntering,
|
949 | onEntered = _props.onEntered,
|
950 | clsPrefix = _props.clsPrefix,
|
951 | onExit = _props.onExit,
|
952 | headerContent = _props.headerContent,
|
953 | onExiting = _props.onExiting,
|
954 | onExited = _props.onExited,
|
955 | defaultExpanded = _props.defaultExpanded,
|
956 | eventKey = _props.eventKey,
|
957 | onSelect = _props.onSelect,
|
958 | copyable = _props.copyable,
|
959 | props = _objectWithoutProperties(_props, ['collapsible', 'header', 'id', 'footer', 'expanded', 'footerStyle', 'headerStyle', 'headerRole', 'panelRole', 'className', 'colors', 'children', 'onEnter', 'onEntering', 'onEntered', 'clsPrefix', 'onExit', 'headerContent', 'onExiting', 'onExited', 'defaultExpanded', 'eventKey', 'onSelect', 'copyable']);
|
960 |
|
961 | var expanded = propsExpanded != null ? propsExpanded : this.state.expanded;
|
962 |
|
963 | var classes = {};
|
964 | classes['' + clsPrefix] = true;
|
965 | classes[clsPrefix + '-' + colors] = true;
|
966 |
|
967 | var headerClass = _defineProperty({}, clsPrefix + '-heading', true);
|
968 |
|
969 | copyable === false ? false : true;
|
970 | return _react2["default"].createElement(
|
971 | 'div',
|
972 | _extends({}, props, {
|
973 | className: (0, _classnames2["default"])(className, classes),
|
974 | id: collapsible ? null : id
|
975 | }),
|
976 | header && _react2["default"].createElement(
|
977 | 'div',
|
978 | { className: (0, _classnames2["default"])(headerClass), style: headerStyle, onClick: this.handleClickTitle },
|
979 | this.renderHeader(collapsible, header, id, headerRole, expanded, clsPrefix)
|
980 | ),
|
981 | collapsible ? this.renderCollapsibleBody(id, expanded, panelRole, children, clsPrefix, copyable, { onEnter: onEnter, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited }) : this.renderBody(children, clsPrefix, copyable),
|
982 | footer && _react2["default"].createElement(
|
983 | 'div',
|
984 | { className: clsPrefix + '-footer', style: footerStyle },
|
985 | footer
|
986 | )
|
987 | );
|
988 | };
|
989 |
|
990 | return Panel;
|
991 | }(_react2["default"].Component);
|
992 |
|
993 | Panel.propTypes = propTypes;
|
994 | Panel.defaultProps = defaultProps;
|
995 |
|
996 | exports["default"] = Panel;
|
997 | module.exports = exports['default'];
|
998 |
|
999 | }),
|
1000 |
|
1001 | (function(module, exports, __webpack_require__) {
|
1002 |
|
1003 | 'use strict';
|
1004 |
|
1005 | Object.defineProperty(exports, "__esModule", {
|
1006 | value: true
|
1007 | });
|
1008 | exports.Fade = exports.Collapse = exports.Transition = undefined;
|
1009 |
|
1010 | var _Transition2 = __webpack_require__(12);
|
1011 |
|
1012 | var _Transition3 = _interopRequireDefault(_Transition2);
|
1013 |
|
1014 | var _Collapse2 = __webpack_require__(17);
|
1015 |
|
1016 | var _Collapse3 = _interopRequireDefault(_Collapse2);
|
1017 |
|
1018 | var _Fade2 = __webpack_require__(64);
|
1019 |
|
1020 | var _Fade3 = _interopRequireDefault(_Fade2);
|
1021 |
|
1022 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1023 |
|
1024 | exports.Transition = _Transition3["default"];
|
1025 | exports.Collapse = _Collapse3["default"];
|
1026 | exports.Fade = _Fade3["default"];
|
1027 |
|
1028 | }),
|
1029 |
|
1030 | (function(module, exports, __webpack_require__) {
|
1031 |
|
1032 | 'use strict';
|
1033 |
|
1034 | Object.defineProperty(exports, "__esModule", {
|
1035 | value: true
|
1036 | });
|
1037 | exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined;
|
1038 |
|
1039 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
1040 |
|
1041 | var _react = __webpack_require__(1);
|
1042 |
|
1043 | var _react2 = _interopRequireDefault(_react);
|
1044 |
|
1045 | var _reactDom = __webpack_require__(2);
|
1046 |
|
1047 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
1048 |
|
1049 | var _properties = __webpack_require__(13);
|
1050 |
|
1051 | var _properties2 = _interopRequireDefault(_properties);
|
1052 |
|
1053 | var _on = __webpack_require__(16);
|
1054 |
|
1055 | var _on2 = _interopRequireDefault(_on);
|
1056 |
|
1057 | var _classnames = __webpack_require__(5);
|
1058 |
|
1059 | var _classnames2 = _interopRequireDefault(_classnames);
|
1060 |
|
1061 | var _propTypes = __webpack_require__(6);
|
1062 |
|
1063 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
1064 |
|
1065 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1066 |
|
1067 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
1068 |
|
1069 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
1070 |
|
1071 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1072 |
|
1073 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
1074 |
|
1075 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
1076 |
|
1077 | var transitionEndEvent = _properties2["default"].end;
|
1078 |
|
1079 |
|
1080 | var UNMOUNTED = exports.UNMOUNTED = 0;
|
1081 | var EXITED = exports.EXITED = 1;
|
1082 | var ENTERING = exports.ENTERING = 2;
|
1083 | var ENTERED = exports.ENTERED = 3;
|
1084 | var EXITING = exports.EXITING = 4;
|
1085 |
|
1086 | var propTypes = {
|
1087 | |
1088 |
|
1089 |
|
1090 | "in": _propTypes2["default"].bool,
|
1091 |
|
1092 | |
1093 |
|
1094 |
|
1095 | unmountOnExit: _propTypes2["default"].bool,
|
1096 |
|
1097 | |
1098 |
|
1099 |
|
1100 | transitionAppear: _propTypes2["default"].bool,
|
1101 |
|
1102 | |
1103 |
|
1104 |
|
1105 | timeout: _propTypes2["default"].number,
|
1106 |
|
1107 | |
1108 |
|
1109 |
|
1110 | exitedClassName: _propTypes2["default"].string,
|
1111 | |
1112 |
|
1113 |
|
1114 | exitingClassName: _propTypes2["default"].string,
|
1115 | |
1116 |
|
1117 |
|
1118 | enteredClassName: _propTypes2["default"].string,
|
1119 | |
1120 |
|
1121 |
|
1122 | enteringClassName: _propTypes2["default"].string,
|
1123 |
|
1124 | |
1125 |
|
1126 |
|
1127 | onEnter: _propTypes2["default"].func,
|
1128 | |
1129 |
|
1130 |
|
1131 | onEntering: _propTypes2["default"].func,
|
1132 | |
1133 |
|
1134 |
|
1135 | onEntered: _propTypes2["default"].func,
|
1136 | |
1137 |
|
1138 |
|
1139 | onExit: _propTypes2["default"].func,
|
1140 | |
1141 |
|
1142 |
|
1143 | onExiting: _propTypes2["default"].func,
|
1144 | |
1145 |
|
1146 |
|
1147 | onExited: _propTypes2["default"].func
|
1148 | };
|
1149 |
|
1150 | function noop() {}
|
1151 |
|
1152 | var defaultProps = {
|
1153 | "in": false,
|
1154 | unmountOnExit: false,
|
1155 | transitionAppear: false,
|
1156 | timeout: 5000,
|
1157 | onEnter: noop,
|
1158 | onEntering: noop,
|
1159 | onEntered: noop,
|
1160 | onExit: noop,
|
1161 | onExiting: noop,
|
1162 | onExited: noop
|
1163 | };
|
1164 |
|
1165 | |
1166 |
|
1167 |
|
1168 |
|
1169 | var Transition = function (_Component) {
|
1170 | _inherits(Transition, _Component);
|
1171 |
|
1172 | function Transition(props, context) {
|
1173 | _classCallCheck(this, Transition);
|
1174 |
|
1175 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
1176 |
|
1177 | var initialStatus = void 0;
|
1178 | if (props["in"]) {
|
1179 |
|
1180 | initialStatus = props.transitionAppear ? EXITED : ENTERED;
|
1181 | } else {
|
1182 | initialStatus = props.unmountOnExit ? UNMOUNTED : EXITED;
|
1183 | }
|
1184 | _this.state = { status: initialStatus };
|
1185 |
|
1186 | _this.nextCallback = null;
|
1187 | return _this;
|
1188 | }
|
1189 |
|
1190 | Transition.prototype.componentDidMount = function componentDidMount() {
|
1191 | if (this.props.transitionAppear && this.props["in"]) {
|
1192 | this.performEnter(this.props);
|
1193 | }
|
1194 | };
|
1195 |
|
1196 | Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
1197 | if (nextProps["in"] && this.props.unmountOnExit) {
|
1198 | if (this.state.status === UNMOUNTED) {
|
1199 |
|
1200 | this.setState({ status: EXITED });
|
1201 | }
|
1202 | } else {
|
1203 | this._needsUpdate = true;
|
1204 | }
|
1205 | };
|
1206 |
|
1207 | Transition.prototype.componentDidUpdate = function componentDidUpdate() {
|
1208 | var status = this.state.status;
|
1209 |
|
1210 | if (this.props.unmountOnExit && status === EXITED) {
|
1211 |
|
1212 | if (this.props["in"]) {
|
1213 | this.performEnter(this.props);
|
1214 | } else {
|
1215 | this.setState({ status: UNMOUNTED });
|
1216 | }
|
1217 |
|
1218 | return;
|
1219 | }
|
1220 |
|
1221 |
|
1222 | if (this._needsUpdate) {
|
1223 | this._needsUpdate = false;
|
1224 |
|
1225 | if (this.props["in"]) {
|
1226 | if (status === EXITING) {
|
1227 | this.performEnter(this.props);
|
1228 | } else if (status === EXITED) {
|
1229 | this.performEnter(this.props);
|
1230 | }
|
1231 |
|
1232 | } else {
|
1233 | if (status === ENTERING || status === ENTERED) {
|
1234 | this.performExit(this.props);
|
1235 | }
|
1236 |
|
1237 | }
|
1238 | }
|
1239 | };
|
1240 |
|
1241 | Transition.prototype.componentWillUnmount = function componentWillUnmount() {
|
1242 | this.cancelNextCallback();
|
1243 | };
|
1244 |
|
1245 | Transition.prototype.performEnter = function performEnter(props) {
|
1246 | var _this2 = this;
|
1247 |
|
1248 | this.cancelNextCallback();
|
1249 | var node = _reactDom2["default"].findDOMNode(this);
|
1250 |
|
1251 |
|
1252 | props.onEnter(node);
|
1253 |
|
1254 | this.safeSetState({ status: ENTERING }, function () {
|
1255 | _this2.props.onEntering(node);
|
1256 |
|
1257 | _this2.onTransitionEnd(node, function () {
|
1258 | _this2.safeSetState({ status: ENTERED }, function () {
|
1259 | _this2.props.onEntered(node);
|
1260 | });
|
1261 | });
|
1262 | });
|
1263 | };
|
1264 |
|
1265 | Transition.prototype.performExit = function performExit(props) {
|
1266 | var _this3 = this;
|
1267 |
|
1268 | this.cancelNextCallback();
|
1269 | var node = _reactDom2["default"].findDOMNode(this);
|
1270 |
|
1271 | props.onExit(node);
|
1272 |
|
1273 | this.safeSetState({ status: EXITING }, function () {
|
1274 | _this3.props.onExiting(node);
|
1275 |
|
1276 | _this3.onTransitionEnd(node, function () {
|
1277 | _this3.safeSetState({ status: EXITED }, function () {
|
1278 | _this3.props.onExited(node);
|
1279 | });
|
1280 | });
|
1281 | });
|
1282 | };
|
1283 |
|
1284 | Transition.prototype.cancelNextCallback = function cancelNextCallback() {
|
1285 | if (this.nextCallback !== null) {
|
1286 | this.nextCallback.cancel();
|
1287 | this.nextCallback = null;
|
1288 | }
|
1289 | };
|
1290 |
|
1291 | Transition.prototype.safeSetState = function safeSetState(nextState, callback) {
|
1292 |
|
1293 | this.setState(nextState, this.setNextCallback(callback));
|
1294 | };
|
1295 |
|
1296 | Transition.prototype.setNextCallback = function setNextCallback(callback) {
|
1297 | var _this4 = this;
|
1298 |
|
1299 | var active = true;
|
1300 |
|
1301 | this.nextCallback = function (event) {
|
1302 | if (active) {
|
1303 | active = false;
|
1304 | _this4.nextCallback = null;
|
1305 |
|
1306 | callback(event);
|
1307 | }
|
1308 | };
|
1309 |
|
1310 | this.nextCallback.cancel = function () {
|
1311 | active = false;
|
1312 | };
|
1313 |
|
1314 | return this.nextCallback;
|
1315 | };
|
1316 |
|
1317 | Transition.prototype.onTransitionEnd = function onTransitionEnd(node, handler) {
|
1318 | this.setNextCallback(handler);
|
1319 |
|
1320 | if (node) {
|
1321 | if (transitionEndEvent == undefined) {
|
1322 | this.nextCallback();
|
1323 | } else {
|
1324 | (0, _on2["default"])(node, transitionEndEvent, this.nextCallback);
|
1325 | }
|
1326 | setTimeout(this.nextCallback, this.props.timeout);
|
1327 | } else {
|
1328 | setTimeout(this.nextCallback, 0);
|
1329 | }
|
1330 | };
|
1331 |
|
1332 | Transition.prototype.render = function render() {
|
1333 | var status = this.state.status;
|
1334 | if (status === UNMOUNTED) {
|
1335 | return null;
|
1336 | }
|
1337 |
|
1338 | var _props = this.props,
|
1339 | children = _props.children,
|
1340 | className = _props.className,
|
1341 | childProps = _objectWithoutProperties(_props, ['children', 'className']);
|
1342 |
|
1343 | Object.keys(Transition.propTypes).forEach(function (key) {
|
1344 | return delete childProps[key];
|
1345 | });
|
1346 |
|
1347 | var transitionClassName = void 0;
|
1348 | if (status === EXITED) {
|
1349 | transitionClassName = this.props.exitedClassName;
|
1350 | } else if (status === ENTERING) {
|
1351 | transitionClassName = this.props.enteringClassName;
|
1352 | } else if (status === ENTERED) {
|
1353 | transitionClassName = this.props.enteredClassName;
|
1354 | } else if (status === EXITING) {
|
1355 | transitionClassName = this.props.exitingClassName;
|
1356 | }
|
1357 |
|
1358 | var child = _react2["default"].Children.only(children);
|
1359 | return _react2["default"].cloneElement(child, _extends({}, childProps, {
|
1360 | className: (0, _classnames2["default"])(child.props.className, className, transitionClassName)
|
1361 | }));
|
1362 | };
|
1363 |
|
1364 | return Transition;
|
1365 | }(_react.Component);
|
1366 |
|
1367 | Transition.propTypes = propTypes;
|
1368 |
|
1369 | Transition.defaultProps = defaultProps;
|
1370 |
|
1371 | exports["default"] = Transition;
|
1372 |
|
1373 | }),
|
1374 |
|
1375 | (function(module, exports, __webpack_require__) {
|
1376 |
|
1377 | "use strict";
|
1378 |
|
1379 | var _interopRequireDefault = __webpack_require__(14);
|
1380 |
|
1381 | exports.__esModule = true;
|
1382 | exports.default = exports.animationEnd = exports.animationDelay = exports.animationTiming = exports.animationDuration = exports.animationName = exports.transitionEnd = exports.transitionDuration = exports.transitionDelay = exports.transitionTiming = exports.transitionProperty = exports.transform = void 0;
|
1383 |
|
1384 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
1385 |
|
1386 | var transform = 'transform';
|
1387 | exports.transform = transform;
|
1388 | var prefix, transitionEnd, animationEnd;
|
1389 | exports.animationEnd = animationEnd;
|
1390 | exports.transitionEnd = transitionEnd;
|
1391 | var transitionProperty, transitionDuration, transitionTiming, transitionDelay;
|
1392 | exports.transitionDelay = transitionDelay;
|
1393 | exports.transitionTiming = transitionTiming;
|
1394 | exports.transitionDuration = transitionDuration;
|
1395 | exports.transitionProperty = transitionProperty;
|
1396 | var animationName, animationDuration, animationTiming, animationDelay;
|
1397 | exports.animationDelay = animationDelay;
|
1398 | exports.animationTiming = animationTiming;
|
1399 | exports.animationDuration = animationDuration;
|
1400 | exports.animationName = animationName;
|
1401 |
|
1402 | if (_inDOM.default) {
|
1403 | var _getTransitionPropert = getTransitionProperties();
|
1404 |
|
1405 | prefix = _getTransitionPropert.prefix;
|
1406 | exports.transitionEnd = transitionEnd = _getTransitionPropert.transitionEnd;
|
1407 | exports.animationEnd = animationEnd = _getTransitionPropert.animationEnd;
|
1408 | exports.transform = transform = prefix + "-" + transform;
|
1409 | exports.transitionProperty = transitionProperty = prefix + "-transition-property";
|
1410 | exports.transitionDuration = transitionDuration = prefix + "-transition-duration";
|
1411 | exports.transitionDelay = transitionDelay = prefix + "-transition-delay";
|
1412 | exports.transitionTiming = transitionTiming = prefix + "-transition-timing-function";
|
1413 | exports.animationName = animationName = prefix + "-animation-name";
|
1414 | exports.animationDuration = animationDuration = prefix + "-animation-duration";
|
1415 | exports.animationTiming = animationTiming = prefix + "-animation-delay";
|
1416 | exports.animationDelay = animationDelay = prefix + "-animation-timing-function";
|
1417 | }
|
1418 |
|
1419 | var _default = {
|
1420 | transform: transform,
|
1421 | end: transitionEnd,
|
1422 | property: transitionProperty,
|
1423 | timing: transitionTiming,
|
1424 | delay: transitionDelay,
|
1425 | duration: transitionDuration
|
1426 | };
|
1427 | exports.default = _default;
|
1428 |
|
1429 | function getTransitionProperties() {
|
1430 | var style = document.createElement('div').style;
|
1431 | var vendorMap = {
|
1432 | O: function O(e) {
|
1433 | return "o" + e.toLowerCase();
|
1434 | },
|
1435 | Moz: function Moz(e) {
|
1436 | return e.toLowerCase();
|
1437 | },
|
1438 | Webkit: function Webkit(e) {
|
1439 | return "webkit" + e;
|
1440 | },
|
1441 | ms: function ms(e) {
|
1442 | return "MS" + e;
|
1443 | }
|
1444 | };
|
1445 | var vendors = Object.keys(vendorMap);
|
1446 | var transitionEnd, animationEnd;
|
1447 | var prefix = '';
|
1448 |
|
1449 | for (var i = 0; i < vendors.length; i++) {
|
1450 | var vendor = vendors[i];
|
1451 |
|
1452 | if (vendor + "TransitionProperty" in style) {
|
1453 | prefix = "-" + vendor.toLowerCase();
|
1454 | transitionEnd = vendorMap[vendor]('TransitionEnd');
|
1455 | animationEnd = vendorMap[vendor]('AnimationEnd');
|
1456 | break;
|
1457 | }
|
1458 | }
|
1459 |
|
1460 | if (!transitionEnd && 'transitionProperty' in style) transitionEnd = 'transitionend';
|
1461 | if (!animationEnd && 'animationName' in style) animationEnd = 'animationend';
|
1462 | style = null;
|
1463 | return {
|
1464 | animationEnd: animationEnd,
|
1465 | transitionEnd: transitionEnd,
|
1466 | prefix: prefix
|
1467 | };
|
1468 | }
|
1469 |
|
1470 | }),
|
1471 |
|
1472 | (function(module, exports) {
|
1473 |
|
1474 | function _interopRequireDefault(obj) {
|
1475 | return obj && obj.__esModule ? obj : {
|
1476 | default: obj
|
1477 | };
|
1478 | }
|
1479 |
|
1480 | module.exports = _interopRequireDefault;
|
1481 |
|
1482 | }),
|
1483 |
|
1484 | (function(module, exports) {
|
1485 |
|
1486 | "use strict";
|
1487 |
|
1488 | exports.__esModule = true;
|
1489 | exports.default = void 0;
|
1490 |
|
1491 | var _default = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
1492 |
|
1493 | exports.default = _default;
|
1494 | module.exports = exports["default"];
|
1495 |
|
1496 | }),
|
1497 |
|
1498 | (function(module, exports, __webpack_require__) {
|
1499 |
|
1500 | "use strict";
|
1501 |
|
1502 | var _interopRequireDefault = __webpack_require__(14);
|
1503 |
|
1504 | exports.__esModule = true;
|
1505 | exports.default = void 0;
|
1506 |
|
1507 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
1508 |
|
1509 | var on = function on() {};
|
1510 |
|
1511 | if (_inDOM.default) {
|
1512 | on = function () {
|
1513 | if (document.addEventListener) return function (node, eventName, handler, capture) {
|
1514 | return node.addEventListener(eventName, handler, capture || false);
|
1515 | };else if (document.attachEvent) return function (node, eventName, handler) {
|
1516 | return node.attachEvent('on' + eventName, function (e) {
|
1517 | e = e || window.event;
|
1518 | e.target = e.target || e.srcElement;
|
1519 | e.currentTarget = node;
|
1520 | handler.call(node, e);
|
1521 | });
|
1522 | };
|
1523 | }();
|
1524 | }
|
1525 |
|
1526 | var _default = on;
|
1527 | exports.default = _default;
|
1528 | module.exports = exports["default"];
|
1529 |
|
1530 | }),
|
1531 |
|
1532 | (function(module, exports, __webpack_require__) {
|
1533 |
|
1534 | 'use strict';
|
1535 |
|
1536 | Object.defineProperty(exports, "__esModule", {
|
1537 | value: true
|
1538 | });
|
1539 |
|
1540 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
1541 |
|
1542 | var _classnames = __webpack_require__(5);
|
1543 |
|
1544 | var _classnames2 = _interopRequireDefault(_classnames);
|
1545 |
|
1546 | var _style = __webpack_require__(18);
|
1547 |
|
1548 | var _style2 = _interopRequireDefault(_style);
|
1549 |
|
1550 | var _react = __webpack_require__(1);
|
1551 |
|
1552 | var _react2 = _interopRequireDefault(_react);
|
1553 |
|
1554 | var _propTypes = __webpack_require__(6);
|
1555 |
|
1556 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
1557 |
|
1558 | var _Transition = __webpack_require__(12);
|
1559 |
|
1560 | var _Transition2 = _interopRequireDefault(_Transition);
|
1561 |
|
1562 | var _capitalize = __webpack_require__(26);
|
1563 |
|
1564 | var _capitalize2 = _interopRequireDefault(_capitalize);
|
1565 |
|
1566 | var _tinperBeeCore = __webpack_require__(27);
|
1567 |
|
1568 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1569 |
|
1570 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
1571 |
|
1572 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
1573 |
|
1574 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1575 |
|
1576 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
1577 |
|
1578 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
1579 |
|
1580 | var MARGINS = {
|
1581 | height: ['marginTop', 'marginBottom'],
|
1582 | width: ['marginLeft', 'marginRight']
|
1583 | };
|
1584 |
|
1585 |
|
1586 |
|
1587 | function triggerBrowserReflow(node) {
|
1588 | node.offsetHeight;
|
1589 | }
|
1590 |
|
1591 | function getDimensionValue(dimension, elem) {
|
1592 | var value = elem['offset' + (0, _capitalize2["default"])(dimension)];
|
1593 | var margins = MARGINS[dimension];
|
1594 |
|
1595 | return value + parseInt((0, _style2["default"])(elem, margins[0]), 10) + parseInt((0, _style2["default"])(elem, margins[1]), 10);
|
1596 | }
|
1597 |
|
1598 | var propTypes = {
|
1599 | |
1600 |
|
1601 |
|
1602 | "in": _propTypes2["default"].bool,
|
1603 |
|
1604 | |
1605 |
|
1606 |
|
1607 | unmountOnExit: _propTypes2["default"].bool,
|
1608 |
|
1609 | |
1610 |
|
1611 |
|
1612 |
|
1613 | transitionAppear: _propTypes2["default"].bool,
|
1614 |
|
1615 | |
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 | timeout: _propTypes2["default"].number,
|
1621 |
|
1622 | |
1623 |
|
1624 |
|
1625 | onEnter: _propTypes2["default"].func,
|
1626 | |
1627 |
|
1628 |
|
1629 | onEntering: _propTypes2["default"].func,
|
1630 | |
1631 |
|
1632 |
|
1633 | onEntered: _propTypes2["default"].func,
|
1634 | |
1635 |
|
1636 |
|
1637 | onExit: _propTypes2["default"].func,
|
1638 | |
1639 |
|
1640 |
|
1641 | onExiting: _propTypes2["default"].func,
|
1642 | |
1643 |
|
1644 |
|
1645 | onExited: _propTypes2["default"].func,
|
1646 |
|
1647 | |
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 | dimension: _propTypes2["default"].oneOfType([_propTypes2["default"].oneOf(['height', 'width']), _propTypes2["default"].func]),
|
1655 |
|
1656 | |
1657 |
|
1658 |
|
1659 |
|
1660 |
|
1661 |
|
1662 |
|
1663 | getDimensionValue: _propTypes2["default"].func,
|
1664 |
|
1665 | |
1666 |
|
1667 |
|
1668 | role: _propTypes2["default"].string
|
1669 | };
|
1670 |
|
1671 | var defaultProps = {
|
1672 | "in": false,
|
1673 | timeout: 300,
|
1674 | unmountOnExit: false,
|
1675 | transitionAppear: false,
|
1676 |
|
1677 | dimension: 'height',
|
1678 | getDimensionValue: getDimensionValue
|
1679 | };
|
1680 |
|
1681 | var Collapse = function (_React$Component) {
|
1682 | _inherits(Collapse, _React$Component);
|
1683 |
|
1684 | function Collapse(props, context) {
|
1685 | _classCallCheck(this, Collapse);
|
1686 |
|
1687 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
1688 |
|
1689 | _this.handleEnter = _this.handleEnter.bind(_this);
|
1690 | _this.handleEntering = _this.handleEntering.bind(_this);
|
1691 | _this.handleEntered = _this.handleEntered.bind(_this);
|
1692 | _this.handleExit = _this.handleExit.bind(_this);
|
1693 | _this.handleExiting = _this.handleExiting.bind(_this);
|
1694 | return _this;
|
1695 | }
|
1696 |
|
1697 |
|
1698 |
|
1699 |
|
1700 | Collapse.prototype.handleEnter = function handleEnter(elem) {
|
1701 | var dimension = this._dimension();
|
1702 | elem.style[dimension] = '0';
|
1703 | };
|
1704 |
|
1705 | Collapse.prototype.handleEntering = function handleEntering(elem) {
|
1706 | var dimension = this._dimension();
|
1707 | elem.style[dimension] = this._getScrollDimensionValue(elem, dimension);
|
1708 | };
|
1709 |
|
1710 | Collapse.prototype.handleEntered = function handleEntered(elem) {
|
1711 | var dimension = this._dimension();
|
1712 | elem.style[dimension] = null;
|
1713 | };
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 | Collapse.prototype.handleExit = function handleExit(elem) {
|
1719 | var dimension = this._dimension();
|
1720 | elem.style[dimension] = this.props.getDimensionValue(dimension, elem) + 'px';
|
1721 | triggerBrowserReflow(elem);
|
1722 | };
|
1723 |
|
1724 | Collapse.prototype.handleExiting = function handleExiting(elem) {
|
1725 | var dimension = this._dimension();
|
1726 | elem.style[dimension] = '0';
|
1727 | };
|
1728 |
|
1729 | Collapse.prototype._dimension = function _dimension() {
|
1730 | return typeof this.props.dimension === 'function' ? this.props.dimension() : this.props.dimension;
|
1731 | };
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 | Collapse.prototype._getScrollDimensionValue = function _getScrollDimensionValue(elem, dimension) {
|
1737 | return elem['scroll' + (0, _capitalize2["default"])(dimension)] + 'px';
|
1738 | };
|
1739 |
|
1740 | Collapse.prototype.render = function render() {
|
1741 | var _props = this.props,
|
1742 | onEnter = _props.onEnter,
|
1743 | onEntering = _props.onEntering,
|
1744 | onEntered = _props.onEntered,
|
1745 | onExit = _props.onExit,
|
1746 | onExiting = _props.onExiting,
|
1747 | className = _props.className,
|
1748 | props = _objectWithoutProperties(_props, ['onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'className']);
|
1749 |
|
1750 | delete props.dimension;
|
1751 | delete props.getDimensionValue;
|
1752 |
|
1753 | var handleEnter = (0, _tinperBeeCore.createChainedFunction)(this.handleEnter, onEnter);
|
1754 | var handleEntering = (0, _tinperBeeCore.createChainedFunction)(this.handleEntering, onEntering);
|
1755 | var handleEntered = (0, _tinperBeeCore.createChainedFunction)(this.handleEntered, onEntered);
|
1756 | var handleExit = (0, _tinperBeeCore.createChainedFunction)(this.handleExit, onExit);
|
1757 | var handleExiting = (0, _tinperBeeCore.createChainedFunction)(this.handleExiting, onExiting);
|
1758 |
|
1759 | var classes = {
|
1760 | width: this._dimension() === 'width'
|
1761 | };
|
1762 |
|
1763 | return _react2["default"].createElement(_Transition2["default"], _extends({}, props, {
|
1764 | 'aria-expanded': props.role ? props["in"] : null,
|
1765 | className: (0, _classnames2["default"])(className, classes),
|
1766 | exitedClassName: 'collapse',
|
1767 | exitingClassName: 'collapsing',
|
1768 | enteredClassName: 'collapse in',
|
1769 | enteringClassName: 'collapsing',
|
1770 | onEnter: handleEnter,
|
1771 | onEntering: handleEntering,
|
1772 | onEntered: handleEntered,
|
1773 | onExit: handleExit,
|
1774 | onExiting: handleExiting
|
1775 | }));
|
1776 | };
|
1777 |
|
1778 | return Collapse;
|
1779 | }(_react2["default"].Component);
|
1780 |
|
1781 | Collapse.propTypes = propTypes;
|
1782 | Collapse.defaultProps = defaultProps;
|
1783 |
|
1784 | exports["default"] = Collapse;
|
1785 | module.exports = exports['default'];
|
1786 |
|
1787 | }),
|
1788 |
|
1789 | (function(module, exports, __webpack_require__) {
|
1790 |
|
1791 | "use strict";
|
1792 |
|
1793 | var _interopRequireDefault = __webpack_require__(14);
|
1794 |
|
1795 | exports.__esModule = true;
|
1796 | exports.default = style;
|
1797 |
|
1798 | var _camelizeStyle = _interopRequireDefault(__webpack_require__(19));
|
1799 |
|
1800 | var _hyphenateStyle = _interopRequireDefault(__webpack_require__(21));
|
1801 |
|
1802 | var _getComputedStyle2 = _interopRequireDefault(__webpack_require__(23));
|
1803 |
|
1804 | var _removeStyle = _interopRequireDefault(__webpack_require__(24));
|
1805 |
|
1806 | var _properties = __webpack_require__(13);
|
1807 |
|
1808 | var _isTransform = _interopRequireDefault(__webpack_require__(25));
|
1809 |
|
1810 | function style(node, property, value) {
|
1811 | var css = '';
|
1812 | var transforms = '';
|
1813 | var props = property;
|
1814 |
|
1815 | if (typeof property === 'string') {
|
1816 | if (value === undefined) {
|
1817 | return node.style[(0, _camelizeStyle.default)(property)] || (0, _getComputedStyle2.default)(node).getPropertyValue((0, _hyphenateStyle.default)(property));
|
1818 | } else {
|
1819 | (props = {})[property] = value;
|
1820 | }
|
1821 | }
|
1822 |
|
1823 | Object.keys(props).forEach(function (key) {
|
1824 | var value = props[key];
|
1825 |
|
1826 | if (!value && value !== 0) {
|
1827 | (0, _removeStyle.default)(node, (0, _hyphenateStyle.default)(key));
|
1828 | } else if ((0, _isTransform.default)(key)) {
|
1829 | transforms += key + "(" + value + ") ";
|
1830 | } else {
|
1831 | css += (0, _hyphenateStyle.default)(key) + ": " + value + ";";
|
1832 | }
|
1833 | });
|
1834 |
|
1835 | if (transforms) {
|
1836 | css += _properties.transform + ": " + transforms + ";";
|
1837 | }
|
1838 |
|
1839 | node.style.cssText += ';' + css;
|
1840 | }
|
1841 |
|
1842 | module.exports = exports["default"];
|
1843 |
|
1844 | }),
|
1845 |
|
1846 | (function(module, exports, __webpack_require__) {
|
1847 |
|
1848 | "use strict";
|
1849 |
|
1850 | var _interopRequireDefault = __webpack_require__(14);
|
1851 |
|
1852 | exports.__esModule = true;
|
1853 | exports.default = camelizeStyleName;
|
1854 |
|
1855 | var _camelize = _interopRequireDefault(__webpack_require__(20));
|
1856 |
|
1857 | |
1858 |
|
1859 |
|
1860 |
|
1861 |
|
1862 | var msPattern = /^-ms-/;
|
1863 |
|
1864 | function camelizeStyleName(string) {
|
1865 | return (0, _camelize.default)(string.replace(msPattern, 'ms-'));
|
1866 | }
|
1867 |
|
1868 | module.exports = exports["default"];
|
1869 |
|
1870 | }),
|
1871 |
|
1872 | (function(module, exports) {
|
1873 |
|
1874 | "use strict";
|
1875 |
|
1876 | exports.__esModule = true;
|
1877 | exports.default = camelize;
|
1878 | var rHyphen = /-(.)/g;
|
1879 |
|
1880 | function camelize(string) {
|
1881 | return string.replace(rHyphen, function (_, chr) {
|
1882 | return chr.toUpperCase();
|
1883 | });
|
1884 | }
|
1885 |
|
1886 | module.exports = exports["default"];
|
1887 |
|
1888 | }),
|
1889 |
|
1890 | (function(module, exports, __webpack_require__) {
|
1891 |
|
1892 | "use strict";
|
1893 |
|
1894 | var _interopRequireDefault = __webpack_require__(14);
|
1895 |
|
1896 | exports.__esModule = true;
|
1897 | exports.default = hyphenateStyleName;
|
1898 |
|
1899 | var _hyphenate = _interopRequireDefault(__webpack_require__(22));
|
1900 |
|
1901 | |
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 | var msPattern = /^ms-/;
|
1907 |
|
1908 | function hyphenateStyleName(string) {
|
1909 | return (0, _hyphenate.default)(string).replace(msPattern, '-ms-');
|
1910 | }
|
1911 |
|
1912 | module.exports = exports["default"];
|
1913 |
|
1914 | }),
|
1915 |
|
1916 | (function(module, exports) {
|
1917 |
|
1918 | "use strict";
|
1919 |
|
1920 | exports.__esModule = true;
|
1921 | exports.default = hyphenate;
|
1922 | var rUpper = /([A-Z])/g;
|
1923 |
|
1924 | function hyphenate(string) {
|
1925 | return string.replace(rUpper, '-$1').toLowerCase();
|
1926 | }
|
1927 |
|
1928 | module.exports = exports["default"];
|
1929 |
|
1930 | }),
|
1931 |
|
1932 | (function(module, exports, __webpack_require__) {
|
1933 |
|
1934 | "use strict";
|
1935 |
|
1936 | var _interopRequireDefault = __webpack_require__(14);
|
1937 |
|
1938 | exports.__esModule = true;
|
1939 | exports.default = _getComputedStyle;
|
1940 |
|
1941 | var _camelizeStyle = _interopRequireDefault(__webpack_require__(19));
|
1942 |
|
1943 | var rposition = /^(top|right|bottom|left)$/;
|
1944 | var rnumnonpx = /^([+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/i;
|
1945 |
|
1946 | function _getComputedStyle(node) {
|
1947 | if (!node) throw new TypeError('No Element passed to `getComputedStyle()`');
|
1948 | var doc = node.ownerDocument;
|
1949 | return 'defaultView' in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : {
|
1950 |
|
1951 | getPropertyValue: function getPropertyValue(prop) {
|
1952 | var style = node.style;
|
1953 | prop = (0, _camelizeStyle.default)(prop);
|
1954 | if (prop == 'float') prop = 'styleFloat';
|
1955 | var current = node.currentStyle[prop] || null;
|
1956 | if (current == null && style && style[prop]) current = style[prop];
|
1957 |
|
1958 | if (rnumnonpx.test(current) && !rposition.test(prop)) {
|
1959 |
|
1960 | var left = style.left;
|
1961 | var runStyle = node.runtimeStyle;
|
1962 | var rsLeft = runStyle && runStyle.left;
|
1963 |
|
1964 | if (rsLeft) runStyle.left = node.currentStyle.left;
|
1965 | style.left = prop === 'fontSize' ? '1em' : current;
|
1966 | current = style.pixelLeft + 'px';
|
1967 |
|
1968 | style.left = left;
|
1969 | if (rsLeft) runStyle.left = rsLeft;
|
1970 | }
|
1971 |
|
1972 | return current;
|
1973 | }
|
1974 | };
|
1975 | }
|
1976 |
|
1977 | module.exports = exports["default"];
|
1978 |
|
1979 | }),
|
1980 |
|
1981 | (function(module, exports) {
|
1982 |
|
1983 | "use strict";
|
1984 |
|
1985 | exports.__esModule = true;
|
1986 | exports.default = removeStyle;
|
1987 |
|
1988 | function removeStyle(node, key) {
|
1989 | return 'removeProperty' in node.style ? node.style.removeProperty(key) : node.style.removeAttribute(key);
|
1990 | }
|
1991 |
|
1992 | module.exports = exports["default"];
|
1993 |
|
1994 | }),
|
1995 |
|
1996 | (function(module, exports) {
|
1997 |
|
1998 | "use strict";
|
1999 |
|
2000 | exports.__esModule = true;
|
2001 | exports.default = isTransform;
|
2002 | var supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;
|
2003 |
|
2004 | function isTransform(property) {
|
2005 | return !!(property && supportedTransforms.test(property));
|
2006 | }
|
2007 |
|
2008 | module.exports = exports["default"];
|
2009 |
|
2010 | }),
|
2011 |
|
2012 | (function(module, exports) {
|
2013 |
|
2014 | "use strict";
|
2015 |
|
2016 | Object.defineProperty(exports, "__esModule", {
|
2017 | value: true
|
2018 | });
|
2019 | exports["default"] = capitalize;
|
2020 | function capitalize(string) {
|
2021 | return "" + string.charAt(0).toUpperCase() + string.slice(1);
|
2022 | }
|
2023 | module.exports = exports["default"];
|
2024 |
|
2025 | }),
|
2026 |
|
2027 | (function(module, exports, __webpack_require__) {
|
2028 |
|
2029 | 'use strict';
|
2030 |
|
2031 | exports.__esModule = true;
|
2032 | exports.Align = exports.toArray = exports.cssAnimation = exports.addEventListener = exports.contains = exports.KeyCode = exports.createChainedFunction = exports.splitComponent = exports.isRequiredForA11y = exports.elementType = exports.deprecated = exports.componentOrElement = exports.all = undefined;
|
2033 |
|
2034 | var _all2 = __webpack_require__(28);
|
2035 |
|
2036 | var _all3 = _interopRequireDefault(_all2);
|
2037 |
|
2038 | var _componentOrElement2 = __webpack_require__(30);
|
2039 |
|
2040 | var _componentOrElement3 = _interopRequireDefault(_componentOrElement2);
|
2041 |
|
2042 | var _deprecated2 = __webpack_require__(31);
|
2043 |
|
2044 | var _deprecated3 = _interopRequireDefault(_deprecated2);
|
2045 |
|
2046 | var _elementType2 = __webpack_require__(34);
|
2047 |
|
2048 | var _elementType3 = _interopRequireDefault(_elementType2);
|
2049 |
|
2050 | var _isRequiredForA11y2 = __webpack_require__(35);
|
2051 |
|
2052 | var _isRequiredForA11y3 = _interopRequireDefault(_isRequiredForA11y2);
|
2053 |
|
2054 | var _splitComponent2 = __webpack_require__(36);
|
2055 |
|
2056 | var _splitComponent3 = _interopRequireDefault(_splitComponent2);
|
2057 |
|
2058 | var _createChainedFunction2 = __webpack_require__(37);
|
2059 |
|
2060 | var _createChainedFunction3 = _interopRequireDefault(_createChainedFunction2);
|
2061 |
|
2062 | var _keyCode = __webpack_require__(38);
|
2063 |
|
2064 | var _keyCode2 = _interopRequireDefault(_keyCode);
|
2065 |
|
2066 | var _contains2 = __webpack_require__(39);
|
2067 |
|
2068 | var _contains3 = _interopRequireDefault(_contains2);
|
2069 |
|
2070 | var _addEventListener2 = __webpack_require__(40);
|
2071 |
|
2072 | var _addEventListener3 = _interopRequireDefault(_addEventListener2);
|
2073 |
|
2074 | var _cssAnimation2 = __webpack_require__(45);
|
2075 |
|
2076 | var _cssAnimation3 = _interopRequireDefault(_cssAnimation2);
|
2077 |
|
2078 | var _toArray2 = __webpack_require__(49);
|
2079 |
|
2080 | var _toArray3 = _interopRequireDefault(_toArray2);
|
2081 |
|
2082 | var _Align2 = __webpack_require__(50);
|
2083 |
|
2084 | var _Align3 = _interopRequireDefault(_Align2);
|
2085 |
|
2086 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2087 |
|
2088 | exports.all = _all3.default;
|
2089 | exports.componentOrElement = _componentOrElement3.default;
|
2090 | exports.deprecated = _deprecated3.default;
|
2091 | exports.elementType = _elementType3.default;
|
2092 | exports.isRequiredForA11y = _isRequiredForA11y3.default;
|
2093 | exports.splitComponent = _splitComponent3.default;
|
2094 | exports.createChainedFunction = _createChainedFunction3.default;
|
2095 | exports.KeyCode = _keyCode2.default;
|
2096 | exports.contains = _contains3.default;
|
2097 | exports.addEventListener = _addEventListener3.default;
|
2098 | exports.cssAnimation = _cssAnimation3.default;
|
2099 | exports.toArray = _toArray3.default;
|
2100 |
|
2101 |
|
2102 | exports.Align = _Align3.default;
|
2103 |
|
2104 | }),
|
2105 |
|
2106 | (function(module, exports, __webpack_require__) {
|
2107 |
|
2108 | 'use strict';
|
2109 |
|
2110 | exports.__esModule = true;
|
2111 | exports.default = all;
|
2112 |
|
2113 | var _createChainableTypeChecker = __webpack_require__(29);
|
2114 |
|
2115 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2116 |
|
2117 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2118 |
|
2119 | function all() {
|
2120 | for (var _len = arguments.length, validators = Array(_len), _key = 0; _key < _len; _key++) {
|
2121 | validators[_key] = arguments[_key];
|
2122 | }
|
2123 |
|
2124 | function allPropTypes() {
|
2125 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2126 | args[_key2] = arguments[_key2];
|
2127 | }
|
2128 |
|
2129 | var error = null;
|
2130 |
|
2131 | validators.forEach(function (validator) {
|
2132 | if (error != null) {
|
2133 | return;
|
2134 | }
|
2135 |
|
2136 | var result = validator.apply(undefined, args);
|
2137 | if (result != null) {
|
2138 | error = result;
|
2139 | }
|
2140 | });
|
2141 |
|
2142 | return error;
|
2143 | }
|
2144 |
|
2145 | return (0, _createChainableTypeChecker2.default)(allPropTypes);
|
2146 | } |
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 | }),
|
2152 |
|
2153 | (function(module, exports) {
|
2154 |
|
2155 | 'use strict';
|
2156 |
|
2157 | exports.__esModule = true;
|
2158 | exports.default = createChainableTypeChecker;
|
2159 | |
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 | |
2171 |
|
2172 |
|
2173 |
|
2174 | function createChainableTypeChecker(validate) {
|
2175 | function checkType(isRequired, props, propName, componentName, location, propFullName) {
|
2176 | var componentNameSafe = componentName || '<<anonymous>>';
|
2177 | var propFullNameSafe = propFullName || propName;
|
2178 |
|
2179 | if (props[propName] == null) {
|
2180 | if (isRequired) {
|
2181 | return new Error('Required ' + location + ' `' + propFullNameSafe + '` was not specified ' + ('in `' + componentNameSafe + '`.'));
|
2182 | }
|
2183 |
|
2184 | return null;
|
2185 | }
|
2186 |
|
2187 | for (var _len = arguments.length, args = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) {
|
2188 | args[_key - 6] = arguments[_key];
|
2189 | }
|
2190 |
|
2191 | return validate.apply(undefined, [props, propName, componentNameSafe, location, propFullNameSafe].concat(args));
|
2192 | }
|
2193 |
|
2194 | var chainedCheckType = checkType.bind(null, false);
|
2195 | chainedCheckType.isRequired = checkType.bind(null, true);
|
2196 |
|
2197 | return chainedCheckType;
|
2198 | }
|
2199 |
|
2200 | }),
|
2201 |
|
2202 | (function(module, exports, __webpack_require__) {
|
2203 |
|
2204 | 'use strict';
|
2205 |
|
2206 | exports.__esModule = true;
|
2207 |
|
2208 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 |
|
2214 | var _react = __webpack_require__(1);
|
2215 |
|
2216 | var _react2 = _interopRequireDefault(_react);
|
2217 |
|
2218 | var _createChainableTypeChecker = __webpack_require__(29);
|
2219 |
|
2220 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2221 |
|
2222 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2223 |
|
2224 | function validate(props, propName, componentName, location, propFullName) {
|
2225 | var propValue = props[propName];
|
2226 | var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
|
2227 |
|
2228 | if (_react2.default.isValidElement(propValue)) {
|
2229 | return new Error('Invalid ' + location + ' `' + propFullName + '` of type ReactElement ' + ('supplied to `' + componentName + '`, expected a ReactComponent or a ') + 'DOMElement. You can usually obtain a ReactComponent or DOMElement ' + 'from a ReactElement by attaching a ref to it.');
|
2230 | }
|
2231 |
|
2232 | if ((propType !== 'object' || typeof propValue.render !== 'function') && propValue.nodeType !== 1) {
|
2233 | return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected a ReactComponent or a ') + 'DOMElement.');
|
2234 | }
|
2235 |
|
2236 | return null;
|
2237 | }
|
2238 |
|
2239 | exports.default = (0, _createChainableTypeChecker2.default)(validate);
|
2240 |
|
2241 | }),
|
2242 |
|
2243 | (function(module, exports, __webpack_require__) {
|
2244 |
|
2245 | 'use strict';
|
2246 |
|
2247 | exports.__esModule = true;
|
2248 | exports.default = deprecated;
|
2249 |
|
2250 | var _warning = __webpack_require__(32);
|
2251 |
|
2252 | var _warning2 = _interopRequireDefault(_warning);
|
2253 |
|
2254 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2255 |
|
2256 | var warned = {}; |
2257 |
|
2258 |
|
2259 |
|
2260 | function deprecated(validator, reason) {
|
2261 | return function validate(props, propName, componentName, location, propFullName) {
|
2262 | var componentNameSafe = componentName || '<<anonymous>>';
|
2263 | var propFullNameSafe = propFullName || propName;
|
2264 |
|
2265 | if (props[propName] != null) {
|
2266 | var messageKey = componentName + '.' + propName;
|
2267 |
|
2268 | (0, _warning2.default)(warned[messageKey], 'The ' + location + ' `' + propFullNameSafe + '` of ' + ('`' + componentNameSafe + '` is deprecated. ' + reason + '.'));
|
2269 |
|
2270 | warned[messageKey] = true;
|
2271 | }
|
2272 |
|
2273 | for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
2274 | args[_key - 5] = arguments[_key];
|
2275 | }
|
2276 |
|
2277 | return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
|
2278 | };
|
2279 | }
|
2280 |
|
2281 |
|
2282 | function _resetWarned() {
|
2283 | warned = {};
|
2284 | }
|
2285 |
|
2286 | deprecated._resetWarned = _resetWarned;
|
2287 |
|
2288 |
|
2289 | }),
|
2290 |
|
2291 | (function(module, exports, __webpack_require__) {
|
2292 |
|
2293 | (function(process) { |
2294 |
|
2295 |
|
2296 |
|
2297 |
|
2298 |
|
2299 |
|
2300 |
|
2301 |
|
2302 | 'use strict';
|
2303 |
|
2304 | |
2305 |
|
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 | var warning = function() {};
|
2312 |
|
2313 | if (process.env.NODE_ENV !== 'production') {
|
2314 | warning = function(condition, format, args) {
|
2315 | var len = arguments.length;
|
2316 | args = new Array(len > 2 ? len - 2 : 0);
|
2317 | for (var key = 2; key < len; key++) {
|
2318 | args[key - 2] = arguments[key];
|
2319 | }
|
2320 | if (format === undefined) {
|
2321 | throw new Error(
|
2322 | '`warning(condition, format, ...args)` requires a warning ' +
|
2323 | 'message argument'
|
2324 | );
|
2325 | }
|
2326 |
|
2327 | if (format.length < 10 || (/^[s\W]*$/).test(format)) {
|
2328 | throw new Error(
|
2329 | 'The warning format should be able to uniquely identify this ' +
|
2330 | 'warning. Please, use a more descriptive format than: ' + format
|
2331 | );
|
2332 | }
|
2333 |
|
2334 | if (!condition) {
|
2335 | var argIndex = 0;
|
2336 | var message = 'Warning: ' +
|
2337 | format.replace(/%s/g, function() {
|
2338 | return args[argIndex++];
|
2339 | });
|
2340 | if (typeof console !== 'undefined') {
|
2341 | console.error(message);
|
2342 | }
|
2343 | try {
|
2344 |
|
2345 |
|
2346 | throw new Error(message);
|
2347 | } catch(x) {}
|
2348 | }
|
2349 | };
|
2350 | }
|
2351 |
|
2352 | module.exports = warning;
|
2353 |
|
2354 | }.call(exports, __webpack_require__(33)))
|
2355 |
|
2356 | }),
|
2357 |
|
2358 | (function(module, exports) {
|
2359 |
|
2360 |
|
2361 | var process = module.exports = {};
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 | var cachedSetTimeout;
|
2369 | var cachedClearTimeout;
|
2370 |
|
2371 | function defaultSetTimout() {
|
2372 | throw new Error('setTimeout has not been defined');
|
2373 | }
|
2374 | function defaultClearTimeout () {
|
2375 | throw new Error('clearTimeout has not been defined');
|
2376 | }
|
2377 | (function () {
|
2378 | try {
|
2379 | if (typeof setTimeout === 'function') {
|
2380 | cachedSetTimeout = setTimeout;
|
2381 | } else {
|
2382 | cachedSetTimeout = defaultSetTimout;
|
2383 | }
|
2384 | } catch (e) {
|
2385 | cachedSetTimeout = defaultSetTimout;
|
2386 | }
|
2387 | try {
|
2388 | if (typeof clearTimeout === 'function') {
|
2389 | cachedClearTimeout = clearTimeout;
|
2390 | } else {
|
2391 | cachedClearTimeout = defaultClearTimeout;
|
2392 | }
|
2393 | } catch (e) {
|
2394 | cachedClearTimeout = defaultClearTimeout;
|
2395 | }
|
2396 | } ())
|
2397 | function runTimeout(fun) {
|
2398 | if (cachedSetTimeout === setTimeout) {
|
2399 |
|
2400 | return setTimeout(fun, 0);
|
2401 | }
|
2402 |
|
2403 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
2404 | cachedSetTimeout = setTimeout;
|
2405 | return setTimeout(fun, 0);
|
2406 | }
|
2407 | try {
|
2408 |
|
2409 | return cachedSetTimeout(fun, 0);
|
2410 | } catch(e){
|
2411 | try {
|
2412 |
|
2413 | return cachedSetTimeout.call(null, fun, 0);
|
2414 | } catch(e){
|
2415 |
|
2416 | return cachedSetTimeout.call(this, fun, 0);
|
2417 | }
|
2418 | }
|
2419 |
|
2420 |
|
2421 | }
|
2422 | function runClearTimeout(marker) {
|
2423 | if (cachedClearTimeout === clearTimeout) {
|
2424 |
|
2425 | return clearTimeout(marker);
|
2426 | }
|
2427 |
|
2428 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
2429 | cachedClearTimeout = clearTimeout;
|
2430 | return clearTimeout(marker);
|
2431 | }
|
2432 | try {
|
2433 |
|
2434 | return cachedClearTimeout(marker);
|
2435 | } catch (e){
|
2436 | try {
|
2437 |
|
2438 | return cachedClearTimeout.call(null, marker);
|
2439 | } catch (e){
|
2440 |
|
2441 |
|
2442 | return cachedClearTimeout.call(this, marker);
|
2443 | }
|
2444 | }
|
2445 |
|
2446 |
|
2447 |
|
2448 | }
|
2449 | var queue = [];
|
2450 | var draining = false;
|
2451 | var currentQueue;
|
2452 | var queueIndex = -1;
|
2453 |
|
2454 | function cleanUpNextTick() {
|
2455 | if (!draining || !currentQueue) {
|
2456 | return;
|
2457 | }
|
2458 | draining = false;
|
2459 | if (currentQueue.length) {
|
2460 | queue = currentQueue.concat(queue);
|
2461 | } else {
|
2462 | queueIndex = -1;
|
2463 | }
|
2464 | if (queue.length) {
|
2465 | drainQueue();
|
2466 | }
|
2467 | }
|
2468 |
|
2469 | function drainQueue() {
|
2470 | if (draining) {
|
2471 | return;
|
2472 | }
|
2473 | var timeout = runTimeout(cleanUpNextTick);
|
2474 | draining = true;
|
2475 |
|
2476 | var len = queue.length;
|
2477 | while(len) {
|
2478 | currentQueue = queue;
|
2479 | queue = [];
|
2480 | while (++queueIndex < len) {
|
2481 | if (currentQueue) {
|
2482 | currentQueue[queueIndex].run();
|
2483 | }
|
2484 | }
|
2485 | queueIndex = -1;
|
2486 | len = queue.length;
|
2487 | }
|
2488 | currentQueue = null;
|
2489 | draining = false;
|
2490 | runClearTimeout(timeout);
|
2491 | }
|
2492 |
|
2493 | process.nextTick = function (fun) {
|
2494 | var args = new Array(arguments.length - 1);
|
2495 | if (arguments.length > 1) {
|
2496 | for (var i = 1; i < arguments.length; i++) {
|
2497 | args[i - 1] = arguments[i];
|
2498 | }
|
2499 | }
|
2500 | queue.push(new Item(fun, args));
|
2501 | if (queue.length === 1 && !draining) {
|
2502 | runTimeout(drainQueue);
|
2503 | }
|
2504 | };
|
2505 |
|
2506 |
|
2507 | function Item(fun, array) {
|
2508 | this.fun = fun;
|
2509 | this.array = array;
|
2510 | }
|
2511 | Item.prototype.run = function () {
|
2512 | this.fun.apply(null, this.array);
|
2513 | };
|
2514 | process.title = 'browser';
|
2515 | process.browser = true;
|
2516 | process.env = {};
|
2517 | process.argv = [];
|
2518 | process.version = '';
|
2519 | process.versions = {};
|
2520 |
|
2521 | function noop() {}
|
2522 |
|
2523 | process.on = noop;
|
2524 | process.addListener = noop;
|
2525 | process.once = noop;
|
2526 | process.off = noop;
|
2527 | process.removeListener = noop;
|
2528 | process.removeAllListeners = noop;
|
2529 | process.emit = noop;
|
2530 | process.prependListener = noop;
|
2531 | process.prependOnceListener = noop;
|
2532 |
|
2533 | process.listeners = function (name) { return [] }
|
2534 |
|
2535 | process.binding = function (name) {
|
2536 | throw new Error('process.binding is not supported');
|
2537 | };
|
2538 |
|
2539 | process.cwd = function () { return '/' };
|
2540 | process.chdir = function (dir) {
|
2541 | throw new Error('process.chdir is not supported');
|
2542 | };
|
2543 | process.umask = function() { return 0; };
|
2544 |
|
2545 |
|
2546 | }),
|
2547 |
|
2548 | (function(module, exports, __webpack_require__) {
|
2549 |
|
2550 | 'use strict';
|
2551 |
|
2552 | exports.__esModule = true;
|
2553 |
|
2554 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
2555 |
|
2556 |
|
2557 |
|
2558 |
|
2559 |
|
2560 | var _react = __webpack_require__(1);
|
2561 |
|
2562 | var _react2 = _interopRequireDefault(_react);
|
2563 |
|
2564 | var _createChainableTypeChecker = __webpack_require__(29);
|
2565 |
|
2566 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2567 |
|
2568 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2569 |
|
2570 | function elementType(props, propName, componentName, location, propFullName) {
|
2571 | var propValue = props[propName];
|
2572 | var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
|
2573 |
|
2574 | if (_react2.default.isValidElement(propValue)) {
|
2575 | return new Error('Invalid ' + location + ' `' + propFullName + '` of type ReactElement ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
|
2576 | }
|
2577 |
|
2578 | if (propType !== 'function' && propType !== 'string') {
|
2579 | return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
|
2580 | }
|
2581 |
|
2582 | return null;
|
2583 | }
|
2584 |
|
2585 | exports.default = (0, _createChainableTypeChecker2.default)(elementType);
|
2586 |
|
2587 | }),
|
2588 |
|
2589 | (function(module, exports) {
|
2590 |
|
2591 | 'use strict';
|
2592 |
|
2593 | exports.__esModule = true;
|
2594 | exports.default = isRequiredForA11y;
|
2595 | |
2596 |
|
2597 |
|
2598 |
|
2599 | function isRequiredForA11y(validator) {
|
2600 | return function validate(props, propName, componentName, location, propFullName) {
|
2601 | var componentNameSafe = componentName || '<<anonymous>>';
|
2602 | var propFullNameSafe = propFullName || propName;
|
2603 |
|
2604 | if (props[propName] == null) {
|
2605 | return new Error('The ' + location + ' `' + propFullNameSafe + '` is required to make ' + ('`' + componentNameSafe + '` accessible for users of assistive ') + 'technologies such as screen readers.');
|
2606 | }
|
2607 |
|
2608 | for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
2609 | args[_key - 5] = arguments[_key];
|
2610 | }
|
2611 |
|
2612 | return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
|
2613 | };
|
2614 | }
|
2615 |
|
2616 | }),
|
2617 |
|
2618 | (function(module, exports) {
|
2619 |
|
2620 | "use strict";
|
2621 |
|
2622 | exports.__esModule = true;
|
2623 | exports.default = splitComponentProps;
|
2624 | |
2625 |
|
2626 |
|
2627 |
|
2628 | function _objectEntries(obj) {
|
2629 | var entries = [];
|
2630 | var keys = Object.keys(obj);
|
2631 |
|
2632 | for (var k = 0; k < keys.length; ++k) {
|
2633 | entries.push([keys[k], obj[keys[k]]]);
|
2634 | }return entries;
|
2635 | }
|
2636 |
|
2637 | |
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 | function splitComponentProps(props, Component) {
|
2644 | var componentPropTypes = Component.propTypes;
|
2645 |
|
2646 | var parentProps = {};
|
2647 | var childProps = {};
|
2648 |
|
2649 | _objectEntries(props).forEach(function (_ref) {
|
2650 | var propName = _ref[0],
|
2651 | propValue = _ref[1];
|
2652 |
|
2653 | if (componentPropTypes[propName]) {
|
2654 | parentProps[propName] = propValue;
|
2655 | } else {
|
2656 | childProps[propName] = propValue;
|
2657 | }
|
2658 | });
|
2659 |
|
2660 | return [parentProps, childProps];
|
2661 | }
|
2662 |
|
2663 | }),
|
2664 |
|
2665 | (function(module, exports) {
|
2666 |
|
2667 | 'use strict';
|
2668 |
|
2669 | exports.__esModule = true;
|
2670 | |
2671 |
|
2672 |
|
2673 |
|
2674 | function createChainedFunction() {
|
2675 | for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
|
2676 | funcs[_key] = arguments[_key];
|
2677 | }
|
2678 |
|
2679 | return funcs.filter(function (f) {
|
2680 | return f != null;
|
2681 | }).reduce(function (acc, f) {
|
2682 | if (typeof f !== 'function') {
|
2683 | throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
|
2684 | }
|
2685 |
|
2686 | if (acc === null) {
|
2687 | return f;
|
2688 | }
|
2689 |
|
2690 | return function chainedFunction() {
|
2691 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2692 | args[_key2] = arguments[_key2];
|
2693 | }
|
2694 |
|
2695 | acc.apply(this, args);
|
2696 | f.apply(this, args);
|
2697 | };
|
2698 | }, null);
|
2699 | }
|
2700 | exports.default = createChainedFunction;
|
2701 |
|
2702 | }),
|
2703 |
|
2704 | (function(module, exports) {
|
2705 |
|
2706 | |
2707 |
|
2708 |
|
2709 |
|
2710 | 'use strict';
|
2711 |
|
2712 | |
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 |
|
2718 | var KeyCode = {
|
2719 | |
2720 |
|
2721 |
|
2722 | MAC_ENTER: 3,
|
2723 | |
2724 |
|
2725 |
|
2726 | BACKSPACE: 8,
|
2727 | |
2728 |
|
2729 |
|
2730 | TAB: 9,
|
2731 | |
2732 |
|
2733 |
|
2734 | NUM_CENTER: 12,
|
2735 | |
2736 |
|
2737 |
|
2738 | ENTER: 13,
|
2739 | |
2740 |
|
2741 |
|
2742 | SHIFT: 16,
|
2743 | |
2744 |
|
2745 |
|
2746 | CTRL: 17,
|
2747 | |
2748 |
|
2749 |
|
2750 | ALT: 18,
|
2751 | |
2752 |
|
2753 |
|
2754 | PAUSE: 19,
|
2755 | |
2756 |
|
2757 |
|
2758 | CAPS_LOCK: 20,
|
2759 | |
2760 |
|
2761 |
|
2762 | ESC: 27,
|
2763 | |
2764 |
|
2765 |
|
2766 | SPACE: 32,
|
2767 | |
2768 |
|
2769 |
|
2770 | PAGE_UP: 33,
|
2771 | |
2772 |
|
2773 |
|
2774 | PAGE_DOWN: 34,
|
2775 | |
2776 |
|
2777 |
|
2778 | END: 35,
|
2779 | |
2780 |
|
2781 |
|
2782 | HOME: 36,
|
2783 | |
2784 |
|
2785 |
|
2786 | LEFT: 37,
|
2787 | |
2788 |
|
2789 |
|
2790 | UP: 38,
|
2791 | |
2792 |
|
2793 |
|
2794 | RIGHT: 39,
|
2795 | |
2796 |
|
2797 |
|
2798 | DOWN: 40,
|
2799 | |
2800 |
|
2801 |
|
2802 | PRINT_SCREEN: 44,
|
2803 | |
2804 |
|
2805 |
|
2806 | INSERT: 45,
|
2807 | |
2808 |
|
2809 |
|
2810 | DELETE: 46,
|
2811 | |
2812 |
|
2813 |
|
2814 | ZERO: 48,
|
2815 | |
2816 |
|
2817 |
|
2818 | ONE: 49,
|
2819 | |
2820 |
|
2821 |
|
2822 | TWO: 50,
|
2823 | |
2824 |
|
2825 |
|
2826 | THREE: 51,
|
2827 | |
2828 |
|
2829 |
|
2830 | FOUR: 52,
|
2831 | |
2832 |
|
2833 |
|
2834 | FIVE: 53,
|
2835 | |
2836 |
|
2837 |
|
2838 | SIX: 54,
|
2839 | |
2840 |
|
2841 |
|
2842 | SEVEN: 55,
|
2843 | |
2844 |
|
2845 |
|
2846 | EIGHT: 56,
|
2847 | |
2848 |
|
2849 |
|
2850 | NINE: 57,
|
2851 | |
2852 |
|
2853 |
|
2854 | QUESTION_MARK: 63,
|
2855 | |
2856 |
|
2857 |
|
2858 | A: 65,
|
2859 | |
2860 |
|
2861 |
|
2862 | B: 66,
|
2863 | |
2864 |
|
2865 |
|
2866 | C: 67,
|
2867 | |
2868 |
|
2869 |
|
2870 | D: 68,
|
2871 | |
2872 |
|
2873 |
|
2874 | E: 69,
|
2875 | |
2876 |
|
2877 |
|
2878 | F: 70,
|
2879 | |
2880 |
|
2881 |
|
2882 | G: 71,
|
2883 | |
2884 |
|
2885 |
|
2886 | H: 72,
|
2887 | |
2888 |
|
2889 |
|
2890 | I: 73,
|
2891 | |
2892 |
|
2893 |
|
2894 | J: 74,
|
2895 | |
2896 |
|
2897 |
|
2898 | K: 75,
|
2899 | |
2900 |
|
2901 |
|
2902 | L: 76,
|
2903 | |
2904 |
|
2905 |
|
2906 | M: 77,
|
2907 | |
2908 |
|
2909 |
|
2910 | N: 78,
|
2911 | |
2912 |
|
2913 |
|
2914 | O: 79,
|
2915 | |
2916 |
|
2917 |
|
2918 | P: 80,
|
2919 | |
2920 |
|
2921 |
|
2922 | Q: 81,
|
2923 | |
2924 |
|
2925 |
|
2926 | R: 82,
|
2927 | |
2928 |
|
2929 |
|
2930 | S: 83,
|
2931 | |
2932 |
|
2933 |
|
2934 | T: 84,
|
2935 | |
2936 |
|
2937 |
|
2938 | U: 85,
|
2939 | |
2940 |
|
2941 |
|
2942 | V: 86,
|
2943 | |
2944 |
|
2945 |
|
2946 | W: 87,
|
2947 | |
2948 |
|
2949 |
|
2950 | X: 88,
|
2951 | |
2952 |
|
2953 |
|
2954 | Y: 89,
|
2955 | |
2956 |
|
2957 |
|
2958 | Z: 90,
|
2959 | |
2960 |
|
2961 |
|
2962 | META: 91,
|
2963 | |
2964 |
|
2965 |
|
2966 | WIN_KEY_RIGHT: 92,
|
2967 | |
2968 |
|
2969 |
|
2970 | CONTEXT_MENU: 93,
|
2971 | |
2972 |
|
2973 |
|
2974 | NUM_ZERO: 96,
|
2975 | |
2976 |
|
2977 |
|
2978 | NUM_ONE: 97,
|
2979 | |
2980 |
|
2981 |
|
2982 | NUM_TWO: 98,
|
2983 | |
2984 |
|
2985 |
|
2986 | NUM_THREE: 99,
|
2987 | |
2988 |
|
2989 |
|
2990 | NUM_FOUR: 100,
|
2991 | |
2992 |
|
2993 |
|
2994 | NUM_FIVE: 101,
|
2995 | |
2996 |
|
2997 |
|
2998 | NUM_SIX: 102,
|
2999 | |
3000 |
|
3001 |
|
3002 | NUM_SEVEN: 103,
|
3003 | |
3004 |
|
3005 |
|
3006 | NUM_EIGHT: 104,
|
3007 | |
3008 |
|
3009 |
|
3010 | NUM_NINE: 105,
|
3011 | |
3012 |
|
3013 |
|
3014 | NUM_MULTIPLY: 106,
|
3015 | |
3016 |
|
3017 |
|
3018 | NUM_PLUS: 107,
|
3019 | |
3020 |
|
3021 |
|
3022 | NUM_MINUS: 109,
|
3023 | |
3024 |
|
3025 |
|
3026 | NUM_PERIOD: 110,
|
3027 | |
3028 |
|
3029 |
|
3030 | NUM_DIVISION: 111,
|
3031 | |
3032 |
|
3033 |
|
3034 | F1: 112,
|
3035 | |
3036 |
|
3037 |
|
3038 | F2: 113,
|
3039 | |
3040 |
|
3041 |
|
3042 | F3: 114,
|
3043 | |
3044 |
|
3045 |
|
3046 | F4: 115,
|
3047 | |
3048 |
|
3049 |
|
3050 | F5: 116,
|
3051 | |
3052 |
|
3053 |
|
3054 | F6: 117,
|
3055 | |
3056 |
|
3057 |
|
3058 | F7: 118,
|
3059 | |
3060 |
|
3061 |
|
3062 | F8: 119,
|
3063 | |
3064 |
|
3065 |
|
3066 | F9: 120,
|
3067 | |
3068 |
|
3069 |
|
3070 | F10: 121,
|
3071 | |
3072 |
|
3073 |
|
3074 | F11: 122,
|
3075 | |
3076 |
|
3077 |
|
3078 | F12: 123,
|
3079 | |
3080 |
|
3081 |
|
3082 | NUMLOCK: 144,
|
3083 | |
3084 |
|
3085 |
|
3086 | SEMICOLON: 186,
|
3087 | |
3088 |
|
3089 |
|
3090 | DASH: 189,
|
3091 | |
3092 |
|
3093 |
|
3094 | EQUALS: 187,
|
3095 | |
3096 |
|
3097 |
|
3098 | COMMA: 188,
|
3099 | |
3100 |
|
3101 |
|
3102 | PERIOD: 190,
|
3103 | |
3104 |
|
3105 |
|
3106 | SLASH: 191,
|
3107 | |
3108 |
|
3109 |
|
3110 | APOSTROPHE: 192,
|
3111 | |
3112 |
|
3113 |
|
3114 | SINGLE_QUOTE: 222,
|
3115 | |
3116 |
|
3117 |
|
3118 | OPEN_SQUARE_BRACKET: 219,
|
3119 | |
3120 |
|
3121 |
|
3122 | BACKSLASH: 220,
|
3123 | |
3124 |
|
3125 |
|
3126 | CLOSE_SQUARE_BRACKET: 221,
|
3127 | |
3128 |
|
3129 |
|
3130 | WIN_KEY: 224,
|
3131 | |
3132 |
|
3133 |
|
3134 | MAC_FF_META: 224,
|
3135 | |
3136 |
|
3137 |
|
3138 | WIN_IME: 229
|
3139 | };
|
3140 |
|
3141 | |
3142 |
|
3143 |
|
3144 | KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) {
|
3145 | var keyCode = e.keyCode;
|
3146 | if (e.altKey && !e.ctrlKey || e.metaKey ||
|
3147 |
|
3148 | keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
|
3149 | return false;
|
3150 | }
|
3151 |
|
3152 |
|
3153 |
|
3154 | switch (keyCode) {
|
3155 | case KeyCode.ALT:
|
3156 | case KeyCode.CAPS_LOCK:
|
3157 | case KeyCode.CONTEXT_MENU:
|
3158 | case KeyCode.CTRL:
|
3159 | case KeyCode.DOWN:
|
3160 | case KeyCode.END:
|
3161 | case KeyCode.ESC:
|
3162 | case KeyCode.HOME:
|
3163 | case KeyCode.INSERT:
|
3164 | case KeyCode.LEFT:
|
3165 | case KeyCode.MAC_FF_META:
|
3166 | case KeyCode.META:
|
3167 | case KeyCode.NUMLOCK:
|
3168 | case KeyCode.NUM_CENTER:
|
3169 | case KeyCode.PAGE_DOWN:
|
3170 | case KeyCode.PAGE_UP:
|
3171 | case KeyCode.PAUSE:
|
3172 | case KeyCode.PRINT_SCREEN:
|
3173 | case KeyCode.RIGHT:
|
3174 | case KeyCode.SHIFT:
|
3175 | case KeyCode.UP:
|
3176 | case KeyCode.WIN_KEY:
|
3177 | case KeyCode.WIN_KEY_RIGHT:
|
3178 | return false;
|
3179 | default:
|
3180 | return true;
|
3181 | }
|
3182 | };
|
3183 |
|
3184 | |
3185 |
|
3186 |
|
3187 | KeyCode.isCharacterKey = function isCharacterKey(keyCode) {
|
3188 | if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
|
3189 | return true;
|
3190 | }
|
3191 |
|
3192 | if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
|
3193 | return true;
|
3194 | }
|
3195 |
|
3196 | if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
|
3197 | return true;
|
3198 | }
|
3199 |
|
3200 |
|
3201 | if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {
|
3202 | return true;
|
3203 | }
|
3204 |
|
3205 | switch (keyCode) {
|
3206 | case KeyCode.SPACE:
|
3207 | case KeyCode.QUESTION_MARK:
|
3208 | case KeyCode.NUM_PLUS:
|
3209 | case KeyCode.NUM_MINUS:
|
3210 | case KeyCode.NUM_PERIOD:
|
3211 | case KeyCode.NUM_DIVISION:
|
3212 | case KeyCode.SEMICOLON:
|
3213 | case KeyCode.DASH:
|
3214 | case KeyCode.EQUALS:
|
3215 | case KeyCode.COMMA:
|
3216 | case KeyCode.PERIOD:
|
3217 | case KeyCode.SLASH:
|
3218 | case KeyCode.APOSTROPHE:
|
3219 | case KeyCode.SINGLE_QUOTE:
|
3220 | case KeyCode.OPEN_SQUARE_BRACKET:
|
3221 | case KeyCode.BACKSLASH:
|
3222 | case KeyCode.CLOSE_SQUARE_BRACKET:
|
3223 | return true;
|
3224 | default:
|
3225 | return false;
|
3226 | }
|
3227 | };
|
3228 |
|
3229 | module.exports = KeyCode;
|
3230 |
|
3231 | }),
|
3232 |
|
3233 | (function(module, exports) {
|
3234 |
|
3235 | "use strict";
|
3236 |
|
3237 | exports.__esModule = true;
|
3238 | exports.default = contains;
|
3239 | |
3240 |
|
3241 |
|
3242 |
|
3243 | function contains(root, n) {
|
3244 | var node = n;
|
3245 | while (node) {
|
3246 | if (node === root) {
|
3247 | return true;
|
3248 | }
|
3249 | node = node.parentNode;
|
3250 | }
|
3251 |
|
3252 | return false;
|
3253 | }
|
3254 |
|
3255 | }),
|
3256 |
|
3257 | (function(module, exports, __webpack_require__) {
|
3258 |
|
3259 | 'use strict';
|
3260 |
|
3261 | exports.__esModule = true;
|
3262 | exports.default = addEventListenerWrap;
|
3263 |
|
3264 | var _addDomEventListener = __webpack_require__(41);
|
3265 |
|
3266 | var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener);
|
3267 |
|
3268 | var _reactDom = __webpack_require__(2);
|
3269 |
|
3270 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
3271 |
|
3272 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3273 |
|
3274 | |
3275 |
|
3276 |
|
3277 |
|
3278 | function addEventListenerWrap(target, eventType, cb) {
|
3279 |
|
3280 | var callback = _reactDom2.default.unstable_batchedUpdates ? function run(e) {
|
3281 | _reactDom2.default.unstable_batchedUpdates(cb, e);
|
3282 | } : cb;
|
3283 | return (0, _addDomEventListener2.default)(target, eventType, callback);
|
3284 | }
|
3285 |
|
3286 | }),
|
3287 |
|
3288 | (function(module, exports, __webpack_require__) {
|
3289 |
|
3290 | 'use strict';
|
3291 |
|
3292 | Object.defineProperty(exports, '__esModule', {
|
3293 | value: true
|
3294 | });
|
3295 | exports['default'] = addEventListener;
|
3296 |
|
3297 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
3298 |
|
3299 | var _EventObject = __webpack_require__(42);
|
3300 |
|
3301 | var _EventObject2 = _interopRequireDefault(_EventObject);
|
3302 |
|
3303 | function addEventListener(target, eventType, callback, option) {
|
3304 | function wrapCallback(e) {
|
3305 | var ne = new _EventObject2['default'](e);
|
3306 | callback.call(target, ne);
|
3307 | }
|
3308 |
|
3309 | if (target.addEventListener) {
|
3310 | var _ret = (function () {
|
3311 | var useCapture = false;
|
3312 | if (typeof option === 'object') {
|
3313 | useCapture = option.capture || false;
|
3314 | } else if (typeof option === 'boolean') {
|
3315 | useCapture = option;
|
3316 | }
|
3317 |
|
3318 | target.addEventListener(eventType, wrapCallback, option || false);
|
3319 |
|
3320 | return {
|
3321 | v: {
|
3322 | remove: function remove() {
|
3323 | target.removeEventListener(eventType, wrapCallback, useCapture);
|
3324 | }
|
3325 | }
|
3326 | };
|
3327 | })();
|
3328 |
|
3329 | if (typeof _ret === 'object') return _ret.v;
|
3330 | } else if (target.attachEvent) {
|
3331 | target.attachEvent('on' + eventType, wrapCallback);
|
3332 | return {
|
3333 | remove: function remove() {
|
3334 | target.detachEvent('on' + eventType, wrapCallback);
|
3335 | }
|
3336 | };
|
3337 | }
|
3338 | }
|
3339 |
|
3340 | module.exports = exports['default'];
|
3341 |
|
3342 | }),
|
3343 |
|
3344 | (function(module, exports, __webpack_require__) {
|
3345 |
|
3346 | |
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 | 'use strict';
|
3353 |
|
3354 | Object.defineProperty(exports, '__esModule', {
|
3355 | value: true
|
3356 | });
|
3357 |
|
3358 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
3359 |
|
3360 | var _EventBaseObject = __webpack_require__(43);
|
3361 |
|
3362 | var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject);
|
3363 |
|
3364 | var _objectAssign = __webpack_require__(44);
|
3365 |
|
3366 | var _objectAssign2 = _interopRequireDefault(_objectAssign);
|
3367 |
|
3368 | var TRUE = true;
|
3369 | var FALSE = false;
|
3370 | var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type'];
|
3371 |
|
3372 | function isNullOrUndefined(w) {
|
3373 | return w === null || w === undefined;
|
3374 | }
|
3375 |
|
3376 | var eventNormalizers = [{
|
3377 | reg: /^key/,
|
3378 | props: ['char', 'charCode', 'key', 'keyCode', 'which'],
|
3379 | fix: function fix(event, nativeEvent) {
|
3380 | if (isNullOrUndefined(event.which)) {
|
3381 | event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode;
|
3382 | }
|
3383 |
|
3384 |
|
3385 | if (event.metaKey === undefined) {
|
3386 | event.metaKey = event.ctrlKey;
|
3387 | }
|
3388 | }
|
3389 | }, {
|
3390 | reg: /^touch/,
|
3391 | props: ['touches', 'changedTouches', 'targetTouches']
|
3392 | }, {
|
3393 | reg: /^hashchange$/,
|
3394 | props: ['newURL', 'oldURL']
|
3395 | }, {
|
3396 | reg: /^gesturechange$/i,
|
3397 | props: ['rotation', 'scale']
|
3398 | }, {
|
3399 | reg: /^(mousewheel|DOMMouseScroll)$/,
|
3400 | props: [],
|
3401 | fix: function fix(event, nativeEvent) {
|
3402 | var deltaX = undefined;
|
3403 | var deltaY = undefined;
|
3404 | var delta = undefined;
|
3405 | var wheelDelta = nativeEvent.wheelDelta;
|
3406 | var axis = nativeEvent.axis;
|
3407 | var wheelDeltaY = nativeEvent.wheelDeltaY;
|
3408 | var wheelDeltaX = nativeEvent.wheelDeltaX;
|
3409 | var detail = nativeEvent.detail;
|
3410 |
|
3411 |
|
3412 | if (wheelDelta) {
|
3413 | delta = wheelDelta / 120;
|
3414 | }
|
3415 |
|
3416 |
|
3417 | if (detail) {
|
3418 |
|
3419 | delta = 0 - (detail % 3 === 0 ? detail / 3 : detail);
|
3420 | }
|
3421 |
|
3422 |
|
3423 | if (axis !== undefined) {
|
3424 | if (axis === event.HORIZONTAL_AXIS) {
|
3425 | deltaY = 0;
|
3426 | deltaX = 0 - delta;
|
3427 | } else if (axis === event.VERTICAL_AXIS) {
|
3428 | deltaX = 0;
|
3429 | deltaY = delta;
|
3430 | }
|
3431 | }
|
3432 |
|
3433 |
|
3434 | if (wheelDeltaY !== undefined) {
|
3435 | deltaY = wheelDeltaY / 120;
|
3436 | }
|
3437 | if (wheelDeltaX !== undefined) {
|
3438 | deltaX = -1 * wheelDeltaX / 120;
|
3439 | }
|
3440 |
|
3441 |
|
3442 | if (!deltaX && !deltaY) {
|
3443 | deltaY = delta;
|
3444 | }
|
3445 |
|
3446 | if (deltaX !== undefined) {
|
3447 | |
3448 |
|
3449 |
|
3450 |
|
3451 |
|
3452 | event.deltaX = deltaX;
|
3453 | }
|
3454 |
|
3455 | if (deltaY !== undefined) {
|
3456 | |
3457 |
|
3458 |
|
3459 |
|
3460 |
|
3461 | event.deltaY = deltaY;
|
3462 | }
|
3463 |
|
3464 | if (delta !== undefined) {
|
3465 | |
3466 |
|
3467 |
|
3468 |
|
3469 |
|
3470 | event.delta = delta;
|
3471 | }
|
3472 | }
|
3473 | }, {
|
3474 | reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,
|
3475 | props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'],
|
3476 | fix: function fix(event, nativeEvent) {
|
3477 | var eventDoc = undefined;
|
3478 | var doc = undefined;
|
3479 | var body = undefined;
|
3480 | var target = event.target;
|
3481 | var button = nativeEvent.button;
|
3482 |
|
3483 |
|
3484 | if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) {
|
3485 | eventDoc = target.ownerDocument || document;
|
3486 | doc = eventDoc.documentElement;
|
3487 | body = eventDoc.body;
|
3488 | event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
|
3489 | event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
|
3490 | }
|
3491 |
|
3492 |
|
3493 |
|
3494 | if (!event.which && button !== undefined) {
|
3495 | if (button & 1) {
|
3496 | event.which = 1;
|
3497 | } else if (button & 2) {
|
3498 | event.which = 3;
|
3499 | } else if (button & 4) {
|
3500 | event.which = 2;
|
3501 | } else {
|
3502 | event.which = 0;
|
3503 | }
|
3504 | }
|
3505 |
|
3506 |
|
3507 | if (!event.relatedTarget && event.fromElement) {
|
3508 | event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement;
|
3509 | }
|
3510 |
|
3511 | return event;
|
3512 | }
|
3513 | }];
|
3514 |
|
3515 | function retTrue() {
|
3516 | return TRUE;
|
3517 | }
|
3518 |
|
3519 | function retFalse() {
|
3520 | return FALSE;
|
3521 | }
|
3522 |
|
3523 | function DomEventObject(nativeEvent) {
|
3524 | var type = nativeEvent.type;
|
3525 |
|
3526 | var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean';
|
3527 |
|
3528 | _EventBaseObject2['default'].call(this);
|
3529 |
|
3530 | this.nativeEvent = nativeEvent;
|
3531 |
|
3532 |
|
3533 | var isDefaultPrevented = retFalse;
|
3534 | if ('defaultPrevented' in nativeEvent) {
|
3535 | isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse;
|
3536 | } else if ('getPreventDefault' in nativeEvent) {
|
3537 |
|
3538 | isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse;
|
3539 | } else if ('returnValue' in nativeEvent) {
|
3540 | isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse;
|
3541 | }
|
3542 |
|
3543 | this.isDefaultPrevented = isDefaultPrevented;
|
3544 |
|
3545 | var fixFns = [];
|
3546 | var fixFn = undefined;
|
3547 | var l = undefined;
|
3548 | var prop = undefined;
|
3549 | var props = commonProps.concat();
|
3550 |
|
3551 | eventNormalizers.forEach(function (normalizer) {
|
3552 | if (type.match(normalizer.reg)) {
|
3553 | props = props.concat(normalizer.props);
|
3554 | if (normalizer.fix) {
|
3555 | fixFns.push(normalizer.fix);
|
3556 | }
|
3557 | }
|
3558 | });
|
3559 |
|
3560 | l = props.length;
|
3561 |
|
3562 |
|
3563 | while (l) {
|
3564 | prop = props[--l];
|
3565 | this[prop] = nativeEvent[prop];
|
3566 | }
|
3567 |
|
3568 |
|
3569 | if (!this.target && isNative) {
|
3570 | this.target = nativeEvent.srcElement || document;
|
3571 | }
|
3572 |
|
3573 |
|
3574 | if (this.target && this.target.nodeType === 3) {
|
3575 | this.target = this.target.parentNode;
|
3576 | }
|
3577 |
|
3578 | l = fixFns.length;
|
3579 |
|
3580 | while (l) {
|
3581 | fixFn = fixFns[--l];
|
3582 | fixFn(this, nativeEvent);
|
3583 | }
|
3584 |
|
3585 | this.timeStamp = nativeEvent.timeStamp || Date.now();
|
3586 | }
|
3587 |
|
3588 | var EventBaseObjectProto = _EventBaseObject2['default'].prototype;
|
3589 |
|
3590 | (0, _objectAssign2['default'])(DomEventObject.prototype, EventBaseObjectProto, {
|
3591 | constructor: DomEventObject,
|
3592 |
|
3593 | preventDefault: function preventDefault() {
|
3594 | var e = this.nativeEvent;
|
3595 |
|
3596 |
|
3597 | if (e.preventDefault) {
|
3598 | e.preventDefault();
|
3599 | } else {
|
3600 |
|
3601 | e.returnValue = FALSE;
|
3602 | }
|
3603 |
|
3604 | EventBaseObjectProto.preventDefault.call(this);
|
3605 | },
|
3606 |
|
3607 | stopPropagation: function stopPropagation() {
|
3608 | var e = this.nativeEvent;
|
3609 |
|
3610 |
|
3611 | if (e.stopPropagation) {
|
3612 | e.stopPropagation();
|
3613 | } else {
|
3614 |
|
3615 | e.cancelBubble = TRUE;
|
3616 | }
|
3617 |
|
3618 | EventBaseObjectProto.stopPropagation.call(this);
|
3619 | }
|
3620 | });
|
3621 |
|
3622 | exports['default'] = DomEventObject;
|
3623 | module.exports = exports['default'];
|
3624 |
|
3625 | }),
|
3626 |
|
3627 | (function(module, exports) {
|
3628 |
|
3629 | |
3630 |
|
3631 |
|
3632 |
|
3633 |
|
3634 |
|
3635 | "use strict";
|
3636 |
|
3637 | Object.defineProperty(exports, "__esModule", {
|
3638 | value: true
|
3639 | });
|
3640 | function returnFalse() {
|
3641 | return false;
|
3642 | }
|
3643 |
|
3644 | function returnTrue() {
|
3645 | return true;
|
3646 | }
|
3647 |
|
3648 | function EventBaseObject() {
|
3649 | this.timeStamp = Date.now();
|
3650 | this.target = undefined;
|
3651 | this.currentTarget = undefined;
|
3652 | }
|
3653 |
|
3654 | EventBaseObject.prototype = {
|
3655 | isEventObject: 1,
|
3656 |
|
3657 | constructor: EventBaseObject,
|
3658 |
|
3659 | isDefaultPrevented: returnFalse,
|
3660 |
|
3661 | isPropagationStopped: returnFalse,
|
3662 |
|
3663 | isImmediatePropagationStopped: returnFalse,
|
3664 |
|
3665 | preventDefault: function preventDefault() {
|
3666 | this.isDefaultPrevented = returnTrue;
|
3667 | },
|
3668 |
|
3669 | stopPropagation: function stopPropagation() {
|
3670 | this.isPropagationStopped = returnTrue;
|
3671 | },
|
3672 |
|
3673 | stopImmediatePropagation: function stopImmediatePropagation() {
|
3674 | this.isImmediatePropagationStopped = returnTrue;
|
3675 |
|
3676 |
|
3677 | this.stopPropagation();
|
3678 | },
|
3679 |
|
3680 | halt: function halt(immediate) {
|
3681 | if (immediate) {
|
3682 | this.stopImmediatePropagation();
|
3683 | } else {
|
3684 | this.stopPropagation();
|
3685 | }
|
3686 | this.preventDefault();
|
3687 | }
|
3688 | };
|
3689 |
|
3690 | exports["default"] = EventBaseObject;
|
3691 | module.exports = exports["default"];
|
3692 |
|
3693 | }),
|
3694 |
|
3695 | (function(module, exports) {
|
3696 |
|
3697 | |
3698 |
|
3699 |
|
3700 |
|
3701 |
|
3702 |
|
3703 | 'use strict';
|
3704 |
|
3705 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
3706 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
3707 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
3708 |
|
3709 | function toObject(val) {
|
3710 | if (val === null || val === undefined) {
|
3711 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
3712 | }
|
3713 |
|
3714 | return Object(val);
|
3715 | }
|
3716 |
|
3717 | function shouldUseNative() {
|
3718 | try {
|
3719 | if (!Object.assign) {
|
3720 | return false;
|
3721 | }
|
3722 |
|
3723 |
|
3724 |
|
3725 |
|
3726 | var test1 = new String('abc');
|
3727 | test1[5] = 'de';
|
3728 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
3729 | return false;
|
3730 | }
|
3731 |
|
3732 |
|
3733 | var test2 = {};
|
3734 | for (var i = 0; i < 10; i++) {
|
3735 | test2['_' + String.fromCharCode(i)] = i;
|
3736 | }
|
3737 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
3738 | return test2[n];
|
3739 | });
|
3740 | if (order2.join('') !== '0123456789') {
|
3741 | return false;
|
3742 | }
|
3743 |
|
3744 |
|
3745 | var test3 = {};
|
3746 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
3747 | test3[letter] = letter;
|
3748 | });
|
3749 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
3750 | 'abcdefghijklmnopqrst') {
|
3751 | return false;
|
3752 | }
|
3753 |
|
3754 | return true;
|
3755 | } catch (err) {
|
3756 |
|
3757 | return false;
|
3758 | }
|
3759 | }
|
3760 |
|
3761 | module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
3762 | var from;
|
3763 | var to = toObject(target);
|
3764 | var symbols;
|
3765 |
|
3766 | for (var s = 1; s < arguments.length; s++) {
|
3767 | from = Object(arguments[s]);
|
3768 |
|
3769 | for (var key in from) {
|
3770 | if (hasOwnProperty.call(from, key)) {
|
3771 | to[key] = from[key];
|
3772 | }
|
3773 | }
|
3774 |
|
3775 | if (getOwnPropertySymbols) {
|
3776 | symbols = getOwnPropertySymbols(from);
|
3777 | for (var i = 0; i < symbols.length; i++) {
|
3778 | if (propIsEnumerable.call(from, symbols[i])) {
|
3779 | to[symbols[i]] = from[symbols[i]];
|
3780 | }
|
3781 | }
|
3782 | }
|
3783 | }
|
3784 |
|
3785 | return to;
|
3786 | };
|
3787 |
|
3788 |
|
3789 | }),
|
3790 |
|
3791 | (function(module, exports, __webpack_require__) {
|
3792 |
|
3793 | 'use strict';
|
3794 |
|
3795 | exports.__esModule = true;
|
3796 |
|
3797 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
3798 |
|
3799 |
|
3800 |
|
3801 |
|
3802 |
|
3803 | var _Event = __webpack_require__(46);
|
3804 |
|
3805 | var _Event2 = _interopRequireDefault(_Event);
|
3806 |
|
3807 | var _componentClasses = __webpack_require__(47);
|
3808 |
|
3809 | var _componentClasses2 = _interopRequireDefault(_componentClasses);
|
3810 |
|
3811 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3812 |
|
3813 | var isCssAnimationSupported = _Event2.default.endEvents.length !== 0;
|
3814 |
|
3815 |
|
3816 | var capitalPrefixes = ['Webkit', 'Moz', 'O',
|
3817 |
|
3818 | 'ms'];
|
3819 | var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];
|
3820 |
|
3821 | function getStyleProperty(node, name) {
|
3822 | var style = window.getComputedStyle(node);
|
3823 |
|
3824 | var ret = '';
|
3825 | for (var i = 0; i < prefixes.length; i++) {
|
3826 | ret = style.getPropertyValue(prefixes[i] + name);
|
3827 | if (ret) {
|
3828 | break;
|
3829 | }
|
3830 | }
|
3831 | return ret;
|
3832 | }
|
3833 |
|
3834 | function fixBrowserByTimeout(node) {
|
3835 | if (isCssAnimationSupported) {
|
3836 | var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0;
|
3837 | var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0;
|
3838 | var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0;
|
3839 | var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0;
|
3840 | var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay);
|
3841 |
|
3842 | node.rcEndAnimTimeout = setTimeout(function () {
|
3843 | node.rcEndAnimTimeout = null;
|
3844 | if (node.rcEndListener) {
|
3845 | node.rcEndListener();
|
3846 | }
|
3847 | }, time * 1000 + 200);
|
3848 | }
|
3849 | }
|
3850 |
|
3851 | function clearBrowserBugTimeout(node) {
|
3852 | if (node.rcEndAnimTimeout) {
|
3853 | clearTimeout(node.rcEndAnimTimeout);
|
3854 | node.rcEndAnimTimeout = null;
|
3855 | }
|
3856 | }
|
3857 |
|
3858 | var cssAnimation = function cssAnimation(node, transitionName, endCallback) {
|
3859 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
|
3860 | var className = nameIsObj ? transitionName.name : transitionName;
|
3861 | var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active';
|
3862 | var end = endCallback;
|
3863 | var start = void 0;
|
3864 | var active = void 0;
|
3865 | var nodeClasses = (0, _componentClasses2.default)(node);
|
3866 |
|
3867 | if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') {
|
3868 | end = endCallback.end;
|
3869 | start = endCallback.start;
|
3870 | active = endCallback.active;
|
3871 | }
|
3872 |
|
3873 | if (node.rcEndListener) {
|
3874 | node.rcEndListener();
|
3875 | }
|
3876 |
|
3877 | node.rcEndListener = function (e) {
|
3878 | if (e && e.target !== node) {
|
3879 | return;
|
3880 | }
|
3881 |
|
3882 | if (node.rcAnimTimeout) {
|
3883 | clearTimeout(node.rcAnimTimeout);
|
3884 | node.rcAnimTimeout = null;
|
3885 | }
|
3886 |
|
3887 | clearBrowserBugTimeout(node);
|
3888 |
|
3889 | nodeClasses.remove(className);
|
3890 | nodeClasses.remove(activeClassName);
|
3891 |
|
3892 | _Event2.default.removeEndEventListener(node, node.rcEndListener);
|
3893 | node.rcEndListener = null;
|
3894 |
|
3895 |
|
3896 |
|
3897 | if (end) {
|
3898 | end();
|
3899 | }
|
3900 | };
|
3901 |
|
3902 | _Event2.default.addEndEventListener(node, node.rcEndListener);
|
3903 |
|
3904 | if (start) {
|
3905 | start();
|
3906 | }
|
3907 | nodeClasses.add(className);
|
3908 |
|
3909 | node.rcAnimTimeout = setTimeout(function () {
|
3910 | node.rcAnimTimeout = null;
|
3911 | nodeClasses.add(activeClassName);
|
3912 | if (active) {
|
3913 | setTimeout(active, 0);
|
3914 | }
|
3915 | fixBrowserByTimeout(node);
|
3916 |
|
3917 | }, 30);
|
3918 |
|
3919 | return {
|
3920 | stop: function stop() {
|
3921 | if (node.rcEndListener) {
|
3922 | node.rcEndListener();
|
3923 | }
|
3924 | }
|
3925 | };
|
3926 | };
|
3927 |
|
3928 | cssAnimation.style = function (node, style, callback) {
|
3929 | if (node.rcEndListener) {
|
3930 | node.rcEndListener();
|
3931 | }
|
3932 |
|
3933 | node.rcEndListener = function (e) {
|
3934 | if (e && e.target !== node) {
|
3935 | return;
|
3936 | }
|
3937 |
|
3938 | if (node.rcAnimTimeout) {
|
3939 | clearTimeout(node.rcAnimTimeout);
|
3940 | node.rcAnimTimeout = null;
|
3941 | }
|
3942 |
|
3943 | clearBrowserBugTimeout(node);
|
3944 |
|
3945 | _Event2.default.removeEndEventListener(node, node.rcEndListener);
|
3946 | node.rcEndListener = null;
|
3947 |
|
3948 |
|
3949 |
|
3950 | if (callback) {
|
3951 | callback();
|
3952 | }
|
3953 | };
|
3954 |
|
3955 | _Event2.default.addEndEventListener(node, node.rcEndListener);
|
3956 |
|
3957 | node.rcAnimTimeout = setTimeout(function () {
|
3958 | for (var s in style) {
|
3959 | if (style.hasOwnProperty(s)) {
|
3960 | node.style[s] = style[s];
|
3961 | }
|
3962 | }
|
3963 | node.rcAnimTimeout = null;
|
3964 | fixBrowserByTimeout(node);
|
3965 | }, 0);
|
3966 | };
|
3967 |
|
3968 | cssAnimation.setTransition = function (node, p, value) {
|
3969 | var property = p;
|
3970 | var v = value;
|
3971 | if (value === undefined) {
|
3972 | v = property;
|
3973 | property = '';
|
3974 | }
|
3975 | property = property || '';
|
3976 | capitalPrefixes.forEach(function (prefix) {
|
3977 | node.style[prefix + 'Transition' + property] = v;
|
3978 | });
|
3979 | };
|
3980 |
|
3981 | cssAnimation.isCssAnimationSupported = isCssAnimationSupported;
|
3982 |
|
3983 | exports.default = cssAnimation;
|
3984 |
|
3985 | }),
|
3986 |
|
3987 | (function(module, exports) {
|
3988 |
|
3989 | 'use strict';
|
3990 |
|
3991 | exports.__esModule = true;
|
3992 | |
3993 |
|
3994 |
|
3995 |
|
3996 | var EVENT_NAME_MAP = {
|
3997 | transitionend: {
|
3998 | transition: 'transitionend',
|
3999 | WebkitTransition: 'webkitTransitionEnd',
|
4000 | MozTransition: 'mozTransitionEnd',
|
4001 | OTransition: 'oTransitionEnd',
|
4002 | msTransition: 'MSTransitionEnd'
|
4003 | },
|
4004 |
|
4005 | animationend: {
|
4006 | animation: 'animationend',
|
4007 | WebkitAnimation: 'webkitAnimationEnd',
|
4008 | MozAnimation: 'mozAnimationEnd',
|
4009 | OAnimation: 'oAnimationEnd',
|
4010 | msAnimation: 'MSAnimationEnd'
|
4011 | }
|
4012 | };
|
4013 |
|
4014 | var endEvents = [];
|
4015 |
|
4016 | function detectEvents() {
|
4017 | var testEl = document.createElement('div');
|
4018 | var style = testEl.style;
|
4019 |
|
4020 | if (!('AnimationEvent' in window)) {
|
4021 | delete EVENT_NAME_MAP.animationend.animation;
|
4022 | }
|
4023 |
|
4024 | if (!('TransitionEvent' in window)) {
|
4025 | delete EVENT_NAME_MAP.transitionend.transition;
|
4026 | }
|
4027 |
|
4028 | for (var baseEventName in EVENT_NAME_MAP) {
|
4029 | if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
|
4030 | var baseEvents = EVENT_NAME_MAP[baseEventName];
|
4031 | for (var styleName in baseEvents) {
|
4032 | if (styleName in style) {
|
4033 | endEvents.push(baseEvents[styleName]);
|
4034 | break;
|
4035 | }
|
4036 | }
|
4037 | }
|
4038 | }
|
4039 | }
|
4040 |
|
4041 | if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
4042 | detectEvents();
|
4043 | }
|
4044 |
|
4045 | function addEventListener(node, eventName, eventListener) {
|
4046 | node.addEventListener(eventName, eventListener, false);
|
4047 | }
|
4048 |
|
4049 | function removeEventListener(node, eventName, eventListener) {
|
4050 | node.removeEventListener(eventName, eventListener, false);
|
4051 | }
|
4052 |
|
4053 | var TransitionEvents = {
|
4054 | addEndEventListener: function addEndEventListener(node, eventListener) {
|
4055 | if (endEvents.length === 0) {
|
4056 | window.setTimeout(eventListener, 0);
|
4057 | return;
|
4058 | }
|
4059 | endEvents.forEach(function (endEvent) {
|
4060 | addEventListener(node, endEvent, eventListener);
|
4061 | });
|
4062 | },
|
4063 |
|
4064 |
|
4065 | endEvents: endEvents,
|
4066 |
|
4067 | removeEndEventListener: function removeEndEventListener(node, eventListener) {
|
4068 | if (endEvents.length === 0) {
|
4069 | return;
|
4070 | }
|
4071 | endEvents.forEach(function (endEvent) {
|
4072 | removeEventListener(node, endEvent, eventListener);
|
4073 | });
|
4074 | }
|
4075 | };
|
4076 |
|
4077 | exports.default = TransitionEvents;
|
4078 |
|
4079 | }),
|
4080 |
|
4081 | (function(module, exports, __webpack_require__) {
|
4082 |
|
4083 | |
4084 |
|
4085 |
|
4086 |
|
4087 | try {
|
4088 | var index = __webpack_require__(48);
|
4089 | } catch (err) {
|
4090 | var index = __webpack_require__(48);
|
4091 | }
|
4092 |
|
4093 | |
4094 |
|
4095 |
|
4096 |
|
4097 | var re = /\s+/;
|
4098 |
|
4099 | |
4100 |
|
4101 |
|
4102 |
|
4103 | var toString = Object.prototype.toString;
|
4104 |
|
4105 | |
4106 |
|
4107 |
|
4108 |
|
4109 |
|
4110 |
|
4111 |
|
4112 |
|
4113 | module.exports = function(el){
|
4114 | return new ClassList(el);
|
4115 | };
|
4116 |
|
4117 | |
4118 |
|
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 | function ClassList(el) {
|
4125 | if (!el || !el.nodeType) {
|
4126 | throw new Error('A DOM element reference is required');
|
4127 | }
|
4128 | this.el = el;
|
4129 | this.list = el.classList;
|
4130 | }
|
4131 |
|
4132 | |
4133 |
|
4134 |
|
4135 |
|
4136 |
|
4137 |
|
4138 |
|
4139 |
|
4140 | ClassList.prototype.add = function(name){
|
4141 |
|
4142 | if (this.list) {
|
4143 | this.list.add(name);
|
4144 | return this;
|
4145 | }
|
4146 |
|
4147 |
|
4148 | var arr = this.array();
|
4149 | var i = index(arr, name);
|
4150 | if (!~i) arr.push(name);
|
4151 | this.el.className = arr.join(' ');
|
4152 | return this;
|
4153 | };
|
4154 |
|
4155 | |
4156 |
|
4157 |
|
4158 |
|
4159 |
|
4160 |
|
4161 |
|
4162 |
|
4163 |
|
4164 |
|
4165 | ClassList.prototype.remove = function(name){
|
4166 | if ('[object RegExp]' == toString.call(name)) {
|
4167 | return this.removeMatching(name);
|
4168 | }
|
4169 |
|
4170 |
|
4171 | if (this.list) {
|
4172 | this.list.remove(name);
|
4173 | return this;
|
4174 | }
|
4175 |
|
4176 |
|
4177 | var arr = this.array();
|
4178 | var i = index(arr, name);
|
4179 | if (~i) arr.splice(i, 1);
|
4180 | this.el.className = arr.join(' ');
|
4181 | return this;
|
4182 | };
|
4183 |
|
4184 | |
4185 |
|
4186 |
|
4187 |
|
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 | ClassList.prototype.removeMatching = function(re){
|
4193 | var arr = this.array();
|
4194 | for (var i = 0; i < arr.length; i++) {
|
4195 | if (re.test(arr[i])) {
|
4196 | this.remove(arr[i]);
|
4197 | }
|
4198 | }
|
4199 | return this;
|
4200 | };
|
4201 |
|
4202 | |
4203 |
|
4204 |
|
4205 |
|
4206 |
|
4207 |
|
4208 |
|
4209 |
|
4210 |
|
4211 |
|
4212 |
|
4213 |
|
4214 | ClassList.prototype.toggle = function(name, force){
|
4215 |
|
4216 | if (this.list) {
|
4217 | if ("undefined" !== typeof force) {
|
4218 | if (force !== this.list.toggle(name, force)) {
|
4219 | this.list.toggle(name);
|
4220 | }
|
4221 | } else {
|
4222 | this.list.toggle(name);
|
4223 | }
|
4224 | return this;
|
4225 | }
|
4226 |
|
4227 |
|
4228 | if ("undefined" !== typeof force) {
|
4229 | if (!force) {
|
4230 | this.remove(name);
|
4231 | } else {
|
4232 | this.add(name);
|
4233 | }
|
4234 | } else {
|
4235 | if (this.has(name)) {
|
4236 | this.remove(name);
|
4237 | } else {
|
4238 | this.add(name);
|
4239 | }
|
4240 | }
|
4241 |
|
4242 | return this;
|
4243 | };
|
4244 |
|
4245 | |
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 |
|
4252 | ClassList.prototype.array = function(){
|
4253 | var className = this.el.getAttribute('class') || '';
|
4254 | var str = className.replace(/^\s+|\s+$/g, '');
|
4255 | var arr = str.split(re);
|
4256 | if ('' === arr[0]) arr.shift();
|
4257 | return arr;
|
4258 | };
|
4259 |
|
4260 | |
4261 |
|
4262 |
|
4263 |
|
4264 |
|
4265 |
|
4266 |
|
4267 |
|
4268 | ClassList.prototype.has =
|
4269 | ClassList.prototype.contains = function(name){
|
4270 | return this.list
|
4271 | ? this.list.contains(name)
|
4272 | : !! ~index(this.array(), name);
|
4273 | };
|
4274 |
|
4275 |
|
4276 | }),
|
4277 |
|
4278 | (function(module, exports) {
|
4279 |
|
4280 | module.exports = function(arr, obj){
|
4281 | if (arr.indexOf) return arr.indexOf(obj);
|
4282 | for (var i = 0; i < arr.length; ++i) {
|
4283 | if (arr[i] === obj) return i;
|
4284 | }
|
4285 | return -1;
|
4286 | };
|
4287 |
|
4288 | }),
|
4289 |
|
4290 | (function(module, exports, __webpack_require__) {
|
4291 |
|
4292 | 'use strict';
|
4293 |
|
4294 | exports.__esModule = true;
|
4295 | exports.default = toArray;
|
4296 |
|
4297 | var _react = __webpack_require__(1);
|
4298 |
|
4299 | var _react2 = _interopRequireDefault(_react);
|
4300 |
|
4301 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4302 |
|
4303 | function toArray(children) {
|
4304 | var ret = [];
|
4305 | _react2.default.Children.forEach(children, function (c) {
|
4306 | ret.push(c);
|
4307 | });
|
4308 | return ret;
|
4309 | } |
4310 |
|
4311 |
|
4312 |
|
4313 |
|
4314 | }),
|
4315 |
|
4316 | (function(module, exports, __webpack_require__) {
|
4317 |
|
4318 | 'use strict';
|
4319 |
|
4320 | exports.__esModule = true;
|
4321 |
|
4322 | var _react = __webpack_require__(1);
|
4323 |
|
4324 | var _react2 = _interopRequireDefault(_react);
|
4325 |
|
4326 | var _propTypes = __webpack_require__(6);
|
4327 |
|
4328 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
4329 |
|
4330 | var _reactDom = __webpack_require__(2);
|
4331 |
|
4332 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
4333 |
|
4334 | var _domAlign = __webpack_require__(51);
|
4335 |
|
4336 | var _domAlign2 = _interopRequireDefault(_domAlign);
|
4337 |
|
4338 | var _addEventListener = __webpack_require__(40);
|
4339 |
|
4340 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
4341 |
|
4342 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4343 |
|
4344 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
4345 |
|
4346 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
4347 |
|
4348 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } |
4349 |
|
4350 |
|
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 | function isWindow(obj) {
|
4357 |
|
4358 |
|
4359 | return obj != null && obj == obj.window;
|
4360 | }
|
4361 |
|
4362 | function buffer(fn, ms) {
|
4363 | var timer = void 0;
|
4364 |
|
4365 | function clear() {
|
4366 | if (timer) {
|
4367 | clearTimeout(timer);
|
4368 | timer = null;
|
4369 | }
|
4370 | }
|
4371 |
|
4372 | function bufferFn() {
|
4373 | clear();
|
4374 | timer = setTimeout(fn, ms);
|
4375 | }
|
4376 |
|
4377 | bufferFn.clear = clear;
|
4378 |
|
4379 | return bufferFn;
|
4380 | }
|
4381 |
|
4382 | var propTypes = {
|
4383 | childrenProps: _propTypes2.default.object,
|
4384 | align: _propTypes2.default.object.isRequired,
|
4385 | target: _propTypes2.default.func,
|
4386 | onAlign: _propTypes2.default.func,
|
4387 | monitorBufferTime: _propTypes2.default.number,
|
4388 | monitorWindowResize: _propTypes2.default.bool,
|
4389 | disabled: _propTypes2.default.bool,
|
4390 | children: _propTypes2.default.any
|
4391 | };
|
4392 |
|
4393 | var defaultProps = {
|
4394 | target: function target() {
|
4395 | return window;
|
4396 | },
|
4397 | onAlign: function onAlign() {},
|
4398 |
|
4399 | monitorBufferTime: 50,
|
4400 | monitorWindowResize: false,
|
4401 | disabled: false
|
4402 | };
|
4403 |
|
4404 | var Align = function (_React$Component) {
|
4405 | _inherits(Align, _React$Component);
|
4406 |
|
4407 | function Align(props) {
|
4408 | _classCallCheck(this, Align);
|
4409 |
|
4410 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
4411 |
|
4412 | _initialiseProps.call(_this);
|
4413 |
|
4414 | return _this;
|
4415 | }
|
4416 |
|
4417 | Align.prototype.componentDidMount = function componentDidMount() {
|
4418 | var props = this.props;
|
4419 |
|
4420 | this.forceAlign();
|
4421 | if (!props.disabled && props.monitorWindowResize) {
|
4422 | this.startMonitorWindowResize();
|
4423 | }
|
4424 | };
|
4425 |
|
4426 | Align.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
4427 | var reAlign = false;
|
4428 | var props = this.props;
|
4429 |
|
4430 | if (!props.disabled) {
|
4431 | if (prevProps.disabled || prevProps.align !== props.align) {
|
4432 | reAlign = true;
|
4433 | } else {
|
4434 | var lastTarget = prevProps.target();
|
4435 | var currentTarget = props.target();
|
4436 | if (isWindow(lastTarget) && isWindow(currentTarget)) {
|
4437 | reAlign = false;
|
4438 | } else if (lastTarget !== currentTarget) {
|
4439 | reAlign = true;
|
4440 | }
|
4441 | }
|
4442 | }
|
4443 |
|
4444 | if (reAlign) {
|
4445 | this.forceAlign();
|
4446 | }
|
4447 |
|
4448 | if (props.monitorWindowResize && !props.disabled) {
|
4449 | this.startMonitorWindowResize();
|
4450 | } else {
|
4451 | this.stopMonitorWindowResize();
|
4452 | }
|
4453 | };
|
4454 |
|
4455 | Align.prototype.componentWillUnmount = function componentWillUnmount() {
|
4456 | this.stopMonitorWindowResize();
|
4457 | };
|
4458 |
|
4459 | Align.prototype.render = function render() {
|
4460 | var _props = this.props,
|
4461 | childrenProps = _props.childrenProps,
|
4462 | children = _props.children;
|
4463 |
|
4464 | var child = _react2.default.Children.only(children);
|
4465 | if (childrenProps) {
|
4466 | var newProps = {};
|
4467 | for (var prop in childrenProps) {
|
4468 | if (childrenProps.hasOwnProperty(prop)) {
|
4469 | newProps[prop] = this.props[childrenProps[prop]];
|
4470 | }
|
4471 | }
|
4472 | return _react2.default.cloneElement(child, newProps);
|
4473 | }
|
4474 | return child;
|
4475 | };
|
4476 |
|
4477 | return Align;
|
4478 | }(_react2.default.Component);
|
4479 |
|
4480 | var _initialiseProps = function _initialiseProps() {
|
4481 | var _this2 = this;
|
4482 |
|
4483 | this.startMonitorWindowResize = function () {
|
4484 | if (!_this2.resizeHandler) {
|
4485 | _this2.bufferMonitor = buffer(_this2.forceAlign, _this2.props.monitorBufferTime);
|
4486 | _this2.resizeHandler = (0, _addEventListener2.default)(window, 'resize', _this2.bufferMonitor);
|
4487 | }
|
4488 | };
|
4489 |
|
4490 | this.stopMonitorWindowResize = function () {
|
4491 | if (_this2.resizeHandler) {
|
4492 | _this2.bufferMonitor.clear();
|
4493 | _this2.resizeHandler.remove();
|
4494 | _this2.resizeHandler = null;
|
4495 | }
|
4496 | };
|
4497 |
|
4498 | this.forceAlign = function () {
|
4499 | var props = _this2.props;
|
4500 | if (!props.disabled) {
|
4501 | var source = _reactDom2.default.findDOMNode(_this2);
|
4502 | props.onAlign(source, (0, _domAlign2.default)(source, props.target(), props.align));
|
4503 | }
|
4504 | };
|
4505 | };
|
4506 |
|
4507 | ;
|
4508 |
|
4509 | Align.defaultProps = defaultProps;
|
4510 | Align.propTypes = propTypes;
|
4511 |
|
4512 | exports.default = Align;
|
4513 |
|
4514 | }),
|
4515 |
|
4516 | (function(module, exports, __webpack_require__) {
|
4517 |
|
4518 | 'use strict';
|
4519 |
|
4520 | Object.defineProperty(exports, "__esModule", {
|
4521 | value: true
|
4522 | });
|
4523 | exports.alignPoint = exports.alignElement = undefined;
|
4524 |
|
4525 | var _alignElement = __webpack_require__(52);
|
4526 |
|
4527 | var _alignElement2 = _interopRequireDefault(_alignElement);
|
4528 |
|
4529 | var _alignPoint = __webpack_require__(63);
|
4530 |
|
4531 | var _alignPoint2 = _interopRequireDefault(_alignPoint);
|
4532 |
|
4533 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4534 |
|
4535 | exports.alignElement = _alignElement2['default'];
|
4536 | exports.alignPoint = _alignPoint2['default'];
|
4537 | exports['default'] = _alignElement2['default'];
|
4538 |
|
4539 | }),
|
4540 |
|
4541 | (function(module, exports, __webpack_require__) {
|
4542 |
|
4543 | 'use strict';
|
4544 |
|
4545 | Object.defineProperty(exports, "__esModule", {
|
4546 | value: true
|
4547 | });
|
4548 |
|
4549 | var _align = __webpack_require__(53);
|
4550 |
|
4551 | var _align2 = _interopRequireDefault(_align);
|
4552 |
|
4553 | var _getOffsetParent = __webpack_require__(57);
|
4554 |
|
4555 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
|
4556 |
|
4557 | var _getVisibleRectForElement = __webpack_require__(56);
|
4558 |
|
4559 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
|
4560 |
|
4561 | var _getRegion = __webpack_require__(60);
|
4562 |
|
4563 | var _getRegion2 = _interopRequireDefault(_getRegion);
|
4564 |
|
4565 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4566 |
|
4567 | function isOutOfVisibleRect(target) {
|
4568 | var visibleRect = (0, _getVisibleRectForElement2['default'])(target);
|
4569 | var targetRegion = (0, _getRegion2['default'])(target);
|
4570 |
|
4571 | return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom;
|
4572 | }
|
4573 |
|
4574 | function alignElement(el, refNode, align) {
|
4575 | var target = align.target || refNode;
|
4576 | var refNodeRegion = (0, _getRegion2['default'])(target);
|
4577 |
|
4578 | var isTargetNotOutOfVisible = !isOutOfVisibleRect(target);
|
4579 |
|
4580 | return (0, _align2['default'])(el, refNodeRegion, align, isTargetNotOutOfVisible);
|
4581 | }
|
4582 |
|
4583 | alignElement.__getOffsetParent = _getOffsetParent2['default'];
|
4584 |
|
4585 | alignElement.__getVisibleRectForElement = _getVisibleRectForElement2['default'];
|
4586 |
|
4587 | exports['default'] = alignElement;
|
4588 | module.exports = exports['default'];
|
4589 |
|
4590 | }),
|
4591 |
|
4592 | (function(module, exports, __webpack_require__) {
|
4593 |
|
4594 | 'use strict';
|
4595 |
|
4596 | Object.defineProperty(exports, "__esModule", {
|
4597 | value: true
|
4598 | });
|
4599 |
|
4600 | var _utils = __webpack_require__(54);
|
4601 |
|
4602 | var _utils2 = _interopRequireDefault(_utils);
|
4603 |
|
4604 | var _getVisibleRectForElement = __webpack_require__(56);
|
4605 |
|
4606 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
|
4607 |
|
4608 | var _adjustForViewport = __webpack_require__(59);
|
4609 |
|
4610 | var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport);
|
4611 |
|
4612 | var _getRegion = __webpack_require__(60);
|
4613 |
|
4614 | var _getRegion2 = _interopRequireDefault(_getRegion);
|
4615 |
|
4616 | var _getElFuturePos = __webpack_require__(61);
|
4617 |
|
4618 | var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos);
|
4619 |
|
4620 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4621 |
|
4622 |
|
4623 |
|
4624 | function isFailX(elFuturePos, elRegion, visibleRect) {
|
4625 | return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;
|
4626 | } |
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 | function isFailY(elFuturePos, elRegion, visibleRect) {
|
4632 | return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom;
|
4633 | }
|
4634 |
|
4635 | function isCompleteFailX(elFuturePos, elRegion, visibleRect) {
|
4636 | return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;
|
4637 | }
|
4638 |
|
4639 | function isCompleteFailY(elFuturePos, elRegion, visibleRect) {
|
4640 | return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;
|
4641 | }
|
4642 |
|
4643 | function flip(points, reg, map) {
|
4644 | var ret = [];
|
4645 | _utils2['default'].each(points, function (p) {
|
4646 | ret.push(p.replace(reg, function (m) {
|
4647 | return map[m];
|
4648 | }));
|
4649 | });
|
4650 | return ret;
|
4651 | }
|
4652 |
|
4653 | function flipOffset(offset, index) {
|
4654 | offset[index] = -offset[index];
|
4655 | return offset;
|
4656 | }
|
4657 |
|
4658 | function convertOffset(str, offsetLen) {
|
4659 | var n = void 0;
|
4660 | if (/%$/.test(str)) {
|
4661 | n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen;
|
4662 | } else {
|
4663 | n = parseInt(str, 10);
|
4664 | }
|
4665 | return n || 0;
|
4666 | }
|
4667 |
|
4668 | function normalizeOffset(offset, el) {
|
4669 | offset[0] = convertOffset(offset[0], el.width);
|
4670 | offset[1] = convertOffset(offset[1], el.height);
|
4671 | }
|
4672 |
|
4673 | |
4674 |
|
4675 |
|
4676 |
|
4677 |
|
4678 | function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
4679 | var points = align.points;
|
4680 | var offset = align.offset || [0, 0];
|
4681 | var targetOffset = align.targetOffset || [0, 0];
|
4682 | var overflow = align.overflow;
|
4683 | var source = align.source || el;
|
4684 | offset = [].concat(offset);
|
4685 | targetOffset = [].concat(targetOffset);
|
4686 | overflow = overflow || {};
|
4687 | var newOverflowCfg = {};
|
4688 | var fail = 0;
|
4689 |
|
4690 | var visibleRect = (0, _getVisibleRectForElement2['default'])(source);
|
4691 |
|
4692 | var elRegion = (0, _getRegion2['default'])(source);
|
4693 |
|
4694 | normalizeOffset(offset, elRegion);
|
4695 | normalizeOffset(targetOffset, tgtRegion);
|
4696 |
|
4697 | var elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
|
4698 |
|
4699 | var newElRegion = _utils2['default'].merge(elRegion, elFuturePos);
|
4700 |
|
4701 |
|
4702 | if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTgtRegionVisible) {
|
4703 | if (overflow.adjustX) {
|
4704 |
|
4705 | if (isFailX(elFuturePos, elRegion, visibleRect)) {
|
4706 |
|
4707 | var newPoints = flip(points, /[lr]/ig, {
|
4708 | l: 'r',
|
4709 | r: 'l'
|
4710 | });
|
4711 |
|
4712 | var newOffset = flipOffset(offset, 0);
|
4713 | var newTargetOffset = flipOffset(targetOffset, 0);
|
4714 | var newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, newPoints, newOffset, newTargetOffset);
|
4715 |
|
4716 | if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {
|
4717 | fail = 1;
|
4718 | points = newPoints;
|
4719 | offset = newOffset;
|
4720 | targetOffset = newTargetOffset;
|
4721 | }
|
4722 | }
|
4723 | }
|
4724 |
|
4725 | if (overflow.adjustY) {
|
4726 |
|
4727 | if (isFailY(elFuturePos, elRegion, visibleRect)) {
|
4728 |
|
4729 | var _newPoints = flip(points, /[tb]/ig, {
|
4730 | t: 'b',
|
4731 | b: 't'
|
4732 | });
|
4733 |
|
4734 | var _newOffset = flipOffset(offset, 1);
|
4735 | var _newTargetOffset = flipOffset(targetOffset, 1);
|
4736 | var _newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, _newPoints, _newOffset, _newTargetOffset);
|
4737 |
|
4738 | if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) {
|
4739 | fail = 1;
|
4740 | points = _newPoints;
|
4741 | offset = _newOffset;
|
4742 | targetOffset = _newTargetOffset;
|
4743 | }
|
4744 | }
|
4745 | }
|
4746 |
|
4747 |
|
4748 | if (fail) {
|
4749 | elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
|
4750 | _utils2['default'].mix(newElRegion, elFuturePos);
|
4751 | }
|
4752 | var isStillFailX = isFailX(elFuturePos, elRegion, visibleRect);
|
4753 | var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect);
|
4754 |
|
4755 |
|
4756 | if (isStillFailX || isStillFailY) {
|
4757 | points = align.points;
|
4758 | offset = align.offset || [0, 0];
|
4759 | targetOffset = align.targetOffset || [0, 0];
|
4760 | }
|
4761 |
|
4762 | newOverflowCfg.adjustX = overflow.adjustX && isStillFailX;
|
4763 | newOverflowCfg.adjustY = overflow.adjustY && isStillFailY;
|
4764 |
|
4765 |
|
4766 | if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) {
|
4767 | newElRegion = (0, _adjustForViewport2['default'])(elFuturePos, elRegion, visibleRect, newOverflowCfg);
|
4768 | }
|
4769 | }
|
4770 |
|
4771 |
|
4772 | if (newElRegion.width !== elRegion.width) {
|
4773 | _utils2['default'].css(source, 'width', _utils2['default'].width(source) + newElRegion.width - elRegion.width);
|
4774 | }
|
4775 |
|
4776 | if (newElRegion.height !== elRegion.height) {
|
4777 | _utils2['default'].css(source, 'height', _utils2['default'].height(source) + newElRegion.height - elRegion.height);
|
4778 | }
|
4779 |
|
4780 |
|
4781 |
|
4782 |
|
4783 | _utils2['default'].offset(source, {
|
4784 | left: newElRegion.left,
|
4785 | top: newElRegion.top
|
4786 | }, {
|
4787 | useCssRight: align.useCssRight,
|
4788 | useCssBottom: align.useCssBottom,
|
4789 | useCssTransform: align.useCssTransform,
|
4790 | ignoreShake: align.ignoreShake
|
4791 | });
|
4792 |
|
4793 | return {
|
4794 | points: points,
|
4795 | offset: offset,
|
4796 | targetOffset: targetOffset,
|
4797 | overflow: newOverflowCfg
|
4798 | };
|
4799 | }
|
4800 |
|
4801 | exports['default'] = doAlign;
|
4802 | |
4803 |
|
4804 |
|
4805 |
|
4806 |
|
4807 |
|
4808 |
|
4809 |
|
4810 |
|
4811 | module.exports = exports['default'];
|
4812 |
|
4813 | }),
|
4814 |
|
4815 | (function(module, exports, __webpack_require__) {
|
4816 |
|
4817 | 'use strict';
|
4818 |
|
4819 | Object.defineProperty(exports, "__esModule", {
|
4820 | value: true
|
4821 | });
|
4822 |
|
4823 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
4824 |
|
4825 | var _propertyUtils = __webpack_require__(55);
|
4826 |
|
4827 | var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
|
4828 |
|
4829 | var getComputedStyleX = void 0;
|
4830 |
|
4831 |
|
4832 | function forceRelayout(elem) {
|
4833 | var originalStyle = elem.style.display;
|
4834 | elem.style.display = 'none';
|
4835 | elem.offsetHeight;
|
4836 | elem.style.display = originalStyle;
|
4837 | }
|
4838 |
|
4839 | function css(el, name, v) {
|
4840 | var value = v;
|
4841 | if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
|
4842 | for (var i in name) {
|
4843 | if (name.hasOwnProperty(i)) {
|
4844 | css(el, i, name[i]);
|
4845 | }
|
4846 | }
|
4847 | return undefined;
|
4848 | }
|
4849 | if (typeof value !== 'undefined') {
|
4850 | if (typeof value === 'number') {
|
4851 | value = value + 'px';
|
4852 | }
|
4853 | el.style[name] = value;
|
4854 | return undefined;
|
4855 | }
|
4856 | return getComputedStyleX(el, name);
|
4857 | }
|
4858 |
|
4859 | function getClientPosition(elem) {
|
4860 | var box = void 0;
|
4861 | var x = void 0;
|
4862 | var y = void 0;
|
4863 | var doc = elem.ownerDocument;
|
4864 | var body = doc.body;
|
4865 | var docElem = doc && doc.documentElement;
|
4866 |
|
4867 | box = elem.getBoundingClientRect();
|
4868 |
|
4869 |
|
4870 |
|
4871 |
|
4872 |
|
4873 | x = box.left;
|
4874 | y = box.top;
|
4875 |
|
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 |
|
4884 |
|
4885 |
|
4886 |
|
4887 |
|
4888 |
|
4889 |
|
4890 |
|
4891 |
|
4892 |
|
4893 |
|
4894 |
|
4895 |
|
4896 | x -= docElem.clientLeft || body.clientLeft || 0;
|
4897 | y -= docElem.clientTop || body.clientTop || 0;
|
4898 |
|
4899 | return {
|
4900 | left: x,
|
4901 | top: y
|
4902 | };
|
4903 | }
|
4904 |
|
4905 | function getScroll(w, top) {
|
4906 | var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
|
4907 | var method = 'scroll' + (top ? 'Top' : 'Left');
|
4908 | if (typeof ret !== 'number') {
|
4909 | var d = w.document;
|
4910 |
|
4911 | ret = d.documentElement[method];
|
4912 | if (typeof ret !== 'number') {
|
4913 |
|
4914 | ret = d.body[method];
|
4915 | }
|
4916 | }
|
4917 | return ret;
|
4918 | }
|
4919 |
|
4920 | function getScrollLeft(w) {
|
4921 | return getScroll(w);
|
4922 | }
|
4923 |
|
4924 | function getScrollTop(w) {
|
4925 | return getScroll(w, true);
|
4926 | }
|
4927 |
|
4928 | function getOffset(el) {
|
4929 | var pos = getClientPosition(el);
|
4930 | var doc = el.ownerDocument;
|
4931 | var w = doc.defaultView || doc.parentWindow;
|
4932 | pos.left += getScrollLeft(w);
|
4933 | pos.top += getScrollTop(w);
|
4934 | return pos;
|
4935 | }
|
4936 |
|
4937 | |
4938 |
|
4939 |
|
4940 |
|
4941 | function isWindow(obj) {
|
4942 |
|
4943 |
|
4944 | return obj !== null && obj !== undefined && obj == obj.window;
|
4945 | }
|
4946 |
|
4947 | function getDocument(node) {
|
4948 | if (isWindow(node)) {
|
4949 | return node.document;
|
4950 | }
|
4951 | if (node.nodeType === 9) {
|
4952 | return node;
|
4953 | }
|
4954 | return node.ownerDocument;
|
4955 | }
|
4956 |
|
4957 | function _getComputedStyle(elem, name, cs) {
|
4958 | var computedStyle = cs;
|
4959 | var val = '';
|
4960 | var d = getDocument(elem);
|
4961 | computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null);
|
4962 |
|
4963 |
|
4964 | if (computedStyle) {
|
4965 | val = computedStyle.getPropertyValue(name) || computedStyle[name];
|
4966 | }
|
4967 |
|
4968 | return val;
|
4969 | }
|
4970 |
|
4971 | var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
|
4972 | var RE_POS = /^(top|right|bottom|left)$/;
|
4973 | var CURRENT_STYLE = 'currentStyle';
|
4974 | var RUNTIME_STYLE = 'runtimeStyle';
|
4975 | var LEFT = 'left';
|
4976 | var PX = 'px';
|
4977 |
|
4978 | function _getComputedStyleIE(elem, name) {
|
4979 |
|
4980 |
|
4981 | var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
|
4982 |
|
4983 |
|
4984 |
|
4985 |
|
4986 |
|
4987 |
|
4988 |
|
4989 |
|
4990 |
|
4991 |
|
4992 |
|
4993 | if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
|
4994 |
|
4995 | var style = elem.style;
|
4996 | var left = style[LEFT];
|
4997 | var rsLeft = elem[RUNTIME_STYLE][LEFT];
|
4998 |
|
4999 |
|
5000 | elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
|
5001 |
|
5002 |
|
5003 | style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
|
5004 | ret = style.pixelLeft + PX;
|
5005 |
|
5006 |
|
5007 | style[LEFT] = left;
|
5008 |
|
5009 | elem[RUNTIME_STYLE][LEFT] = rsLeft;
|
5010 | }
|
5011 | return ret === '' ? 'auto' : ret;
|
5012 | }
|
5013 |
|
5014 | if (typeof window !== 'undefined') {
|
5015 | getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
|
5016 | }
|
5017 |
|
5018 | function getOffsetDirection(dir, option) {
|
5019 | if (dir === 'left') {
|
5020 | return option.useCssRight ? 'right' : dir;
|
5021 | }
|
5022 | return option.useCssBottom ? 'bottom' : dir;
|
5023 | }
|
5024 |
|
5025 | function oppositeOffsetDirection(dir) {
|
5026 | if (dir === 'left') {
|
5027 | return 'right';
|
5028 | } else if (dir === 'right') {
|
5029 | return 'left';
|
5030 | } else if (dir === 'top') {
|
5031 | return 'bottom';
|
5032 | } else if (dir === 'bottom') {
|
5033 | return 'top';
|
5034 | }
|
5035 | }
|
5036 |
|
5037 |
|
5038 | function setLeftTop(elem, offset, option) {
|
5039 |
|
5040 | if (css(elem, 'position') === 'static') {
|
5041 | elem.style.position = 'relative';
|
5042 | }
|
5043 | var presetH = -999;
|
5044 | var presetV = -999;
|
5045 | var horizontalProperty = getOffsetDirection('left', option);
|
5046 | var verticalProperty = getOffsetDirection('top', option);
|
5047 | var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
|
5048 | var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);
|
5049 |
|
5050 | if (horizontalProperty !== 'left') {
|
5051 | presetH = 999;
|
5052 | }
|
5053 |
|
5054 | if (verticalProperty !== 'top') {
|
5055 | presetV = 999;
|
5056 | }
|
5057 | var originalTransition = '';
|
5058 | var originalOffset = getOffset(elem);
|
5059 | if ('left' in offset || 'top' in offset) {
|
5060 | originalTransition = (0, _propertyUtils.getTransitionProperty)(elem) || '';
|
5061 | (0, _propertyUtils.setTransitionProperty)(elem, 'none');
|
5062 | }
|
5063 | if ('left' in offset) {
|
5064 | elem.style[oppositeHorizontalProperty] = '';
|
5065 | elem.style[horizontalProperty] = presetH + 'px';
|
5066 | }
|
5067 | if ('top' in offset) {
|
5068 | elem.style[oppositeVerticalProperty] = '';
|
5069 | elem.style[verticalProperty] = presetV + 'px';
|
5070 | }
|
5071 |
|
5072 | forceRelayout(elem);
|
5073 | var old = getOffset(elem);
|
5074 | var originalStyle = {};
|
5075 | for (var key in offset) {
|
5076 | if (offset.hasOwnProperty(key)) {
|
5077 | var dir = getOffsetDirection(key, option);
|
5078 | var preset = key === 'left' ? presetH : presetV;
|
5079 | var off = originalOffset[key] - old[key];
|
5080 | if (dir === key) {
|
5081 | originalStyle[dir] = preset + off;
|
5082 | } else {
|
5083 | originalStyle[dir] = preset - off;
|
5084 | }
|
5085 | }
|
5086 | }
|
5087 | css(elem, originalStyle);
|
5088 |
|
5089 | forceRelayout(elem);
|
5090 | if ('left' in offset || 'top' in offset) {
|
5091 | (0, _propertyUtils.setTransitionProperty)(elem, originalTransition);
|
5092 | }
|
5093 | var ret = {};
|
5094 | for (var _key in offset) {
|
5095 | if (offset.hasOwnProperty(_key)) {
|
5096 | var _dir = getOffsetDirection(_key, option);
|
5097 | var _off = offset[_key] - originalOffset[_key];
|
5098 | if (_key === _dir) {
|
5099 | ret[_dir] = originalStyle[_dir] + _off;
|
5100 | } else {
|
5101 | ret[_dir] = originalStyle[_dir] - _off;
|
5102 | }
|
5103 | }
|
5104 | }
|
5105 | css(elem, ret);
|
5106 | }
|
5107 |
|
5108 | function setTransform(elem, offset) {
|
5109 | var originalOffset = getOffset(elem);
|
5110 | var originalXY = (0, _propertyUtils.getTransformXY)(elem);
|
5111 | var resultXY = { x: originalXY.x, y: originalXY.y };
|
5112 | if ('left' in offset) {
|
5113 | resultXY.x = originalXY.x + offset.left - originalOffset.left;
|
5114 | }
|
5115 | if ('top' in offset) {
|
5116 | resultXY.y = originalXY.y + offset.top - originalOffset.top;
|
5117 | }
|
5118 | (0, _propertyUtils.setTransformXY)(elem, resultXY);
|
5119 | }
|
5120 |
|
5121 | function setOffset(elem, offset, option) {
|
5122 | if (option.ignoreShake) {
|
5123 | var oriOffset = getOffset(elem);
|
5124 |
|
5125 | var oLeft = oriOffset.left.toFixed(0);
|
5126 | var oTop = oriOffset.top.toFixed(0);
|
5127 | var tLeft = offset.left.toFixed(0);
|
5128 | var tTop = offset.top.toFixed(0);
|
5129 |
|
5130 | if (oLeft === tLeft && oTop === tTop) {
|
5131 | return;
|
5132 | }
|
5133 | }
|
5134 |
|
5135 | if (option.useCssRight || option.useCssBottom) {
|
5136 | setLeftTop(elem, offset, option);
|
5137 | } else if (option.useCssTransform && (0, _propertyUtils.getTransformName)() in document.body.style) {
|
5138 | setTransform(elem, offset, option);
|
5139 | } else {
|
5140 | setLeftTop(elem, offset, option);
|
5141 | }
|
5142 | }
|
5143 |
|
5144 | function each(arr, fn) {
|
5145 | for (var i = 0; i < arr.length; i++) {
|
5146 | fn(arr[i]);
|
5147 | }
|
5148 | }
|
5149 |
|
5150 | function isBorderBoxFn(elem) {
|
5151 | return getComputedStyleX(elem, 'boxSizing') === 'border-box';
|
5152 | }
|
5153 |
|
5154 | var BOX_MODELS = ['margin', 'border', 'padding'];
|
5155 | var CONTENT_INDEX = -1;
|
5156 | var PADDING_INDEX = 2;
|
5157 | var BORDER_INDEX = 1;
|
5158 | var MARGIN_INDEX = 0;
|
5159 |
|
5160 | function swap(elem, options, callback) {
|
5161 | var old = {};
|
5162 | var style = elem.style;
|
5163 | var name = void 0;
|
5164 |
|
5165 |
|
5166 | for (name in options) {
|
5167 | if (options.hasOwnProperty(name)) {
|
5168 | old[name] = style[name];
|
5169 | style[name] = options[name];
|
5170 | }
|
5171 | }
|
5172 |
|
5173 | callback.call(elem);
|
5174 |
|
5175 |
|
5176 | for (name in options) {
|
5177 | if (options.hasOwnProperty(name)) {
|
5178 | style[name] = old[name];
|
5179 | }
|
5180 | }
|
5181 | }
|
5182 |
|
5183 | function getPBMWidth(elem, props, which) {
|
5184 | var value = 0;
|
5185 | var prop = void 0;
|
5186 | var j = void 0;
|
5187 | var i = void 0;
|
5188 | for (j = 0; j < props.length; j++) {
|
5189 | prop = props[j];
|
5190 | if (prop) {
|
5191 | for (i = 0; i < which.length; i++) {
|
5192 | var cssProp = void 0;
|
5193 | if (prop === 'border') {
|
5194 | cssProp = '' + prop + which[i] + 'Width';
|
5195 | } else {
|
5196 | cssProp = prop + which[i];
|
5197 | }
|
5198 | value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
|
5199 | }
|
5200 | }
|
5201 | }
|
5202 | return value;
|
5203 | }
|
5204 |
|
5205 | var domUtils = {};
|
5206 |
|
5207 | each(['Width', 'Height'], function (name) {
|
5208 | domUtils['doc' + name] = function (refWin) {
|
5209 | var d = refWin.document;
|
5210 | return Math.max(
|
5211 |
|
5212 |
|
5213 | d.documentElement['scroll' + name],
|
5214 |
|
5215 | d.body['scroll' + name], domUtils['viewport' + name](d));
|
5216 | };
|
5217 |
|
5218 | domUtils['viewport' + name] = function (win) {
|
5219 |
|
5220 | var prop = 'client' + name;
|
5221 | var doc = win.document;
|
5222 | var body = doc.body;
|
5223 | var documentElement = doc.documentElement;
|
5224 | var documentElementProp = documentElement[prop];
|
5225 |
|
5226 |
|
5227 | return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
|
5228 | };
|
5229 | });
|
5230 |
|
5231 | |
5232 |
|
5233 |
|
5234 |
|
5235 |
|
5236 |
|
5237 |
|
5238 |
|
5239 | function getWH(elem, name, ex) {
|
5240 | var extra = ex;
|
5241 | if (isWindow(elem)) {
|
5242 | return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
|
5243 | } else if (elem.nodeType === 9) {
|
5244 | return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
|
5245 | }
|
5246 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
5247 | var borderBoxValue = name === 'width' ? elem.getBoundingClientRect().width : elem.getBoundingClientRect().height;
|
5248 | var computedStyle = getComputedStyleX(elem);
|
5249 | var isBorderBox = isBorderBoxFn(elem, computedStyle);
|
5250 | var cssBoxValue = 0;
|
5251 | if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) {
|
5252 | borderBoxValue = undefined;
|
5253 |
|
5254 | cssBoxValue = getComputedStyleX(elem, name);
|
5255 | if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) {
|
5256 | cssBoxValue = elem.style[name] || 0;
|
5257 | }
|
5258 |
|
5259 | cssBoxValue = parseFloat(cssBoxValue) || 0;
|
5260 | }
|
5261 | if (extra === undefined) {
|
5262 | extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
|
5263 | }
|
5264 | var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
|
5265 | var val = borderBoxValue || cssBoxValue;
|
5266 | if (extra === CONTENT_INDEX) {
|
5267 | if (borderBoxValueOrIsBorderBox) {
|
5268 | return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
|
5269 | }
|
5270 | return cssBoxValue;
|
5271 | } else if (borderBoxValueOrIsBorderBox) {
|
5272 | if (extra === BORDER_INDEX) {
|
5273 | return val;
|
5274 | }
|
5275 | return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle));
|
5276 | }
|
5277 | return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
|
5278 | }
|
5279 |
|
5280 | var cssShow = {
|
5281 | position: 'absolute',
|
5282 | visibility: 'hidden',
|
5283 | display: 'block'
|
5284 | };
|
5285 |
|
5286 |
|
5287 | function getWHIgnoreDisplay() {
|
5288 | for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
5289 | args[_key2] = arguments[_key2];
|
5290 | }
|
5291 |
|
5292 | var val = void 0;
|
5293 | var elem = args[0];
|
5294 |
|
5295 |
|
5296 | if (elem.offsetWidth !== 0) {
|
5297 | val = getWH.apply(undefined, args);
|
5298 | } else {
|
5299 | swap(elem, cssShow, function () {
|
5300 | val = getWH.apply(undefined, args);
|
5301 | });
|
5302 | }
|
5303 | return val;
|
5304 | }
|
5305 |
|
5306 | each(['width', 'height'], function (name) {
|
5307 | var first = name.charAt(0).toUpperCase() + name.slice(1);
|
5308 | domUtils['outer' + first] = function (el, includeMargin) {
|
5309 | return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
|
5310 | };
|
5311 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
5312 |
|
5313 | domUtils[name] = function (elem, v) {
|
5314 | var val = v;
|
5315 | if (val !== undefined) {
|
5316 | if (elem) {
|
5317 | var computedStyle = getComputedStyleX(elem);
|
5318 | var isBorderBox = isBorderBoxFn(elem);
|
5319 | if (isBorderBox) {
|
5320 | val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
|
5321 | }
|
5322 | return css(elem, name, val);
|
5323 | }
|
5324 | return undefined;
|
5325 | }
|
5326 | return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
|
5327 | };
|
5328 | });
|
5329 |
|
5330 | function mix(to, from) {
|
5331 | for (var i in from) {
|
5332 | if (from.hasOwnProperty(i)) {
|
5333 | to[i] = from[i];
|
5334 | }
|
5335 | }
|
5336 | return to;
|
5337 | }
|
5338 |
|
5339 | var utils = {
|
5340 | getWindow: function getWindow(node) {
|
5341 | if (node && node.document && node.setTimeout) {
|
5342 | return node;
|
5343 | }
|
5344 | var doc = node.ownerDocument || node;
|
5345 | return doc.defaultView || doc.parentWindow;
|
5346 | },
|
5347 |
|
5348 | getDocument: getDocument,
|
5349 | offset: function offset(el, value, option) {
|
5350 | if (typeof value !== 'undefined') {
|
5351 | setOffset(el, value, option || {});
|
5352 | } else {
|
5353 | return getOffset(el);
|
5354 | }
|
5355 | },
|
5356 |
|
5357 | isWindow: isWindow,
|
5358 | each: each,
|
5359 | css: css,
|
5360 | clone: function clone(obj) {
|
5361 | var i = void 0;
|
5362 | var ret = {};
|
5363 | for (i in obj) {
|
5364 | if (obj.hasOwnProperty(i)) {
|
5365 | ret[i] = obj[i];
|
5366 | }
|
5367 | }
|
5368 | var overflow = obj.overflow;
|
5369 | if (overflow) {
|
5370 | for (i in obj) {
|
5371 | if (obj.hasOwnProperty(i)) {
|
5372 | ret.overflow[i] = obj.overflow[i];
|
5373 | }
|
5374 | }
|
5375 | }
|
5376 | return ret;
|
5377 | },
|
5378 |
|
5379 | mix: mix,
|
5380 | getWindowScrollLeft: function getWindowScrollLeft(w) {
|
5381 | return getScrollLeft(w);
|
5382 | },
|
5383 | getWindowScrollTop: function getWindowScrollTop(w) {
|
5384 | return getScrollTop(w);
|
5385 | },
|
5386 | merge: function merge() {
|
5387 | var ret = {};
|
5388 |
|
5389 | for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
|
5390 | args[_key3] = arguments[_key3];
|
5391 | }
|
5392 |
|
5393 | for (var i = 0; i < args.length; i++) {
|
5394 | utils.mix(ret, args[i]);
|
5395 | }
|
5396 | return ret;
|
5397 | },
|
5398 |
|
5399 | viewportWidth: 0,
|
5400 | viewportHeight: 0
|
5401 | };
|
5402 |
|
5403 | mix(utils, domUtils);
|
5404 |
|
5405 | exports['default'] = utils;
|
5406 | module.exports = exports['default'];
|
5407 |
|
5408 | }),
|
5409 |
|
5410 | (function(module, exports) {
|
5411 |
|
5412 | 'use strict';
|
5413 |
|
5414 | Object.defineProperty(exports, "__esModule", {
|
5415 | value: true
|
5416 | });
|
5417 | exports.getTransformName = getTransformName;
|
5418 | exports.setTransitionProperty = setTransitionProperty;
|
5419 | exports.getTransitionProperty = getTransitionProperty;
|
5420 | exports.getTransformXY = getTransformXY;
|
5421 | exports.setTransformXY = setTransformXY;
|
5422 | var vendorPrefix = void 0;
|
5423 |
|
5424 | var jsCssMap = {
|
5425 | Webkit: '-webkit-',
|
5426 | Moz: '-moz-',
|
5427 |
|
5428 | ms: '-ms-',
|
5429 | O: '-o-'
|
5430 | };
|
5431 |
|
5432 | function getVendorPrefix() {
|
5433 | if (vendorPrefix !== undefined) {
|
5434 | return vendorPrefix;
|
5435 | }
|
5436 | vendorPrefix = '';
|
5437 | var style = document.createElement('p').style;
|
5438 | var testProp = 'Transform';
|
5439 | for (var key in jsCssMap) {
|
5440 | if (key + testProp in style) {
|
5441 | vendorPrefix = key;
|
5442 | }
|
5443 | }
|
5444 | return vendorPrefix;
|
5445 | }
|
5446 |
|
5447 | function getTransitionName() {
|
5448 | return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty';
|
5449 | }
|
5450 |
|
5451 | function getTransformName() {
|
5452 | return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform';
|
5453 | }
|
5454 |
|
5455 | function setTransitionProperty(node, value) {
|
5456 | var name = getTransitionName();
|
5457 | if (name) {
|
5458 | node.style[name] = value;
|
5459 | if (name !== 'transitionProperty') {
|
5460 | node.style.transitionProperty = value;
|
5461 | }
|
5462 | }
|
5463 | }
|
5464 |
|
5465 | function setTransform(node, value) {
|
5466 | var name = getTransformName();
|
5467 | if (name) {
|
5468 | node.style[name] = value;
|
5469 | if (name !== 'transform') {
|
5470 | node.style.transform = value;
|
5471 | }
|
5472 | }
|
5473 | }
|
5474 |
|
5475 | function getTransitionProperty(node) {
|
5476 | return node.style.transitionProperty || node.style[getTransitionName()];
|
5477 | }
|
5478 |
|
5479 | function getTransformXY(node) {
|
5480 | var style = window.getComputedStyle(node, null);
|
5481 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
5482 | if (transform && transform !== 'none') {
|
5483 | var matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
|
5484 | return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) };
|
5485 | }
|
5486 | return {
|
5487 | x: 0,
|
5488 | y: 0
|
5489 | };
|
5490 | }
|
5491 |
|
5492 | var matrix2d = /matrix\((.*)\)/;
|
5493 | var matrix3d = /matrix3d\((.*)\)/;
|
5494 |
|
5495 | function setTransformXY(node, xy) {
|
5496 | var style = window.getComputedStyle(node, null);
|
5497 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
5498 | if (transform && transform !== 'none') {
|
5499 | var arr = void 0;
|
5500 | var match2d = transform.match(matrix2d);
|
5501 | if (match2d) {
|
5502 | match2d = match2d[1];
|
5503 | arr = match2d.split(',').map(function (item) {
|
5504 | return parseFloat(item, 10);
|
5505 | });
|
5506 | arr[4] = xy.x;
|
5507 | arr[5] = xy.y;
|
5508 | setTransform(node, 'matrix(' + arr.join(',') + ')');
|
5509 | } else {
|
5510 | var match3d = transform.match(matrix3d)[1];
|
5511 | arr = match3d.split(',').map(function (item) {
|
5512 | return parseFloat(item, 10);
|
5513 | });
|
5514 | arr[12] = xy.x;
|
5515 | arr[13] = xy.y;
|
5516 | setTransform(node, 'matrix3d(' + arr.join(',') + ')');
|
5517 | }
|
5518 | } else {
|
5519 | setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)');
|
5520 | }
|
5521 | }
|
5522 |
|
5523 | }),
|
5524 |
|
5525 | (function(module, exports, __webpack_require__) {
|
5526 |
|
5527 | 'use strict';
|
5528 |
|
5529 | Object.defineProperty(exports, "__esModule", {
|
5530 | value: true
|
5531 | });
|
5532 |
|
5533 | var _utils = __webpack_require__(54);
|
5534 |
|
5535 | var _utils2 = _interopRequireDefault(_utils);
|
5536 |
|
5537 | var _getOffsetParent = __webpack_require__(57);
|
5538 |
|
5539 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
|
5540 |
|
5541 | var _isAncestorFixed = __webpack_require__(58);
|
5542 |
|
5543 | var _isAncestorFixed2 = _interopRequireDefault(_isAncestorFixed);
|
5544 |
|
5545 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5546 |
|
5547 | |
5548 |
|
5549 |
|
5550 | function getVisibleRectForElement(element) {
|
5551 | var visibleRect = {
|
5552 | left: 0,
|
5553 | right: Infinity,
|
5554 | top: 0,
|
5555 | bottom: Infinity
|
5556 | };
|
5557 | var el = (0, _getOffsetParent2['default'])(element);
|
5558 | var doc = _utils2['default'].getDocument(element);
|
5559 | var win = doc.defaultView || doc.parentWindow;
|
5560 | var body = doc.body;
|
5561 | var documentElement = doc.documentElement;
|
5562 |
|
5563 |
|
5564 |
|
5565 | while (el) {
|
5566 |
|
5567 | if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) &&
|
5568 |
|
5569 |
|
5570 |
|
5571 | el !== body && el !== documentElement && _utils2['default'].css(el, 'overflow') !== 'visible') {
|
5572 | var pos = _utils2['default'].offset(el);
|
5573 |
|
5574 | pos.left += el.clientLeft;
|
5575 | pos.top += el.clientTop;
|
5576 | visibleRect.top = Math.max(visibleRect.top, pos.top);
|
5577 | visibleRect.right = Math.min(visibleRect.right,
|
5578 |
|
5579 | pos.left + el.clientWidth);
|
5580 | visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight);
|
5581 | visibleRect.left = Math.max(visibleRect.left, pos.left);
|
5582 | } else if (el === body || el === documentElement) {
|
5583 | break;
|
5584 | }
|
5585 | el = (0, _getOffsetParent2['default'])(el);
|
5586 | }
|
5587 |
|
5588 |
|
5589 |
|
5590 |
|
5591 | var originalPosition = null;
|
5592 | if (!_utils2['default'].isWindow(element) && element.nodeType !== 9) {
|
5593 | originalPosition = element.style.position;
|
5594 | var position = _utils2['default'].css(element, 'position');
|
5595 | if (position === 'absolute') {
|
5596 | element.style.position = 'fixed';
|
5597 | }
|
5598 | }
|
5599 |
|
5600 | var scrollX = _utils2['default'].getWindowScrollLeft(win);
|
5601 | var scrollY = _utils2['default'].getWindowScrollTop(win);
|
5602 | var viewportWidth = _utils2['default'].viewportWidth(win);
|
5603 | var viewportHeight = _utils2['default'].viewportHeight(win);
|
5604 | var documentWidth = documentElement.scrollWidth;
|
5605 | var documentHeight = documentElement.scrollHeight;
|
5606 |
|
5607 |
|
5608 | if (element.style) {
|
5609 | element.style.position = originalPosition;
|
5610 | }
|
5611 |
|
5612 | if ((0, _isAncestorFixed2['default'])(element)) {
|
5613 |
|
5614 | visibleRect.left = Math.max(visibleRect.left, scrollX);
|
5615 | visibleRect.top = Math.max(visibleRect.top, scrollY);
|
5616 | visibleRect.right = Math.min(visibleRect.right, scrollX + viewportWidth);
|
5617 | visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + viewportHeight);
|
5618 | } else {
|
5619 |
|
5620 | var maxVisibleWidth = Math.max(documentWidth, scrollX + viewportWidth);
|
5621 | visibleRect.right = Math.min(visibleRect.right, maxVisibleWidth);
|
5622 |
|
5623 | var maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight);
|
5624 | visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight);
|
5625 | }
|
5626 |
|
5627 | return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;
|
5628 | }
|
5629 |
|
5630 | exports['default'] = getVisibleRectForElement;
|
5631 | module.exports = exports['default'];
|
5632 |
|
5633 | }),
|
5634 |
|
5635 | (function(module, exports, __webpack_require__) {
|
5636 |
|
5637 | 'use strict';
|
5638 |
|
5639 | Object.defineProperty(exports, "__esModule", {
|
5640 | value: true
|
5641 | });
|
5642 |
|
5643 | var _utils = __webpack_require__(54);
|
5644 |
|
5645 | var _utils2 = _interopRequireDefault(_utils);
|
5646 |
|
5647 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5648 |
|
5649 | |
5650 |
|
5651 |
|
5652 |
|
5653 | function getOffsetParent(element) {
|
5654 | if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
|
5655 | return null;
|
5656 | }
|
5657 |
|
5658 | |
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 |
|
5664 |
|
5665 |
|
5666 |
|
5667 |
|
5668 |
|
5669 |
|
5670 |
|
5671 |
|
5672 | var doc = _utils2['default'].getDocument(element);
|
5673 | var body = doc.body;
|
5674 | var parent = void 0;
|
5675 | var positionStyle = _utils2['default'].css(element, 'position');
|
5676 | var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute';
|
5677 |
|
5678 | if (!skipStatic) {
|
5679 | return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode;
|
5680 | }
|
5681 |
|
5682 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
|
5683 | positionStyle = _utils2['default'].css(parent, 'position');
|
5684 | if (positionStyle !== 'static') {
|
5685 | return parent;
|
5686 | }
|
5687 | }
|
5688 | return null;
|
5689 | }
|
5690 |
|
5691 | exports['default'] = getOffsetParent;
|
5692 | module.exports = exports['default'];
|
5693 |
|
5694 | }),
|
5695 |
|
5696 | (function(module, exports, __webpack_require__) {
|
5697 |
|
5698 | 'use strict';
|
5699 |
|
5700 | Object.defineProperty(exports, "__esModule", {
|
5701 | value: true
|
5702 | });
|
5703 | exports['default'] = isAncestorFixed;
|
5704 |
|
5705 | var _utils = __webpack_require__(54);
|
5706 |
|
5707 | var _utils2 = _interopRequireDefault(_utils);
|
5708 |
|
5709 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5710 |
|
5711 | function isAncestorFixed(element) {
|
5712 | if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
|
5713 | return false;
|
5714 | }
|
5715 |
|
5716 | var doc = _utils2['default'].getDocument(element);
|
5717 | var body = doc.body;
|
5718 | var parent = null;
|
5719 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
|
5720 | var positionStyle = _utils2['default'].css(parent, 'position');
|
5721 | if (positionStyle === 'fixed') {
|
5722 | return true;
|
5723 | }
|
5724 | }
|
5725 | return false;
|
5726 | }
|
5727 | module.exports = exports['default'];
|
5728 |
|
5729 | }),
|
5730 |
|
5731 | (function(module, exports, __webpack_require__) {
|
5732 |
|
5733 | 'use strict';
|
5734 |
|
5735 | Object.defineProperty(exports, "__esModule", {
|
5736 | value: true
|
5737 | });
|
5738 |
|
5739 | var _utils = __webpack_require__(54);
|
5740 |
|
5741 | var _utils2 = _interopRequireDefault(_utils);
|
5742 |
|
5743 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5744 |
|
5745 | function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {
|
5746 | var pos = _utils2['default'].clone(elFuturePos);
|
5747 | var size = {
|
5748 | width: elRegion.width,
|
5749 | height: elRegion.height
|
5750 | };
|
5751 |
|
5752 | if (overflow.adjustX && pos.left < visibleRect.left) {
|
5753 | pos.left = visibleRect.left;
|
5754 | }
|
5755 |
|
5756 |
|
5757 | if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) {
|
5758 | size.width -= pos.left + size.width - visibleRect.right;
|
5759 | }
|
5760 |
|
5761 |
|
5762 | if (overflow.adjustX && pos.left + size.width > visibleRect.right) {
|
5763 |
|
5764 | pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);
|
5765 | }
|
5766 |
|
5767 |
|
5768 | if (overflow.adjustY && pos.top < visibleRect.top) {
|
5769 | pos.top = visibleRect.top;
|
5770 | }
|
5771 |
|
5772 |
|
5773 | if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) {
|
5774 | size.height -= pos.top + size.height - visibleRect.bottom;
|
5775 | }
|
5776 |
|
5777 |
|
5778 | if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {
|
5779 |
|
5780 | pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);
|
5781 | }
|
5782 |
|
5783 | return _utils2['default'].mix(pos, size);
|
5784 | }
|
5785 |
|
5786 | exports['default'] = adjustForViewport;
|
5787 | module.exports = exports['default'];
|
5788 |
|
5789 | }),
|
5790 |
|
5791 | (function(module, exports, __webpack_require__) {
|
5792 |
|
5793 | 'use strict';
|
5794 |
|
5795 | Object.defineProperty(exports, "__esModule", {
|
5796 | value: true
|
5797 | });
|
5798 |
|
5799 | var _utils = __webpack_require__(54);
|
5800 |
|
5801 | var _utils2 = _interopRequireDefault(_utils);
|
5802 |
|
5803 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5804 |
|
5805 | function getRegion(node) {
|
5806 | var offset = void 0;
|
5807 | var w = void 0;
|
5808 | var h = void 0;
|
5809 | if (!_utils2['default'].isWindow(node) && node.nodeType !== 9) {
|
5810 | offset = _utils2['default'].offset(node);
|
5811 | w = _utils2['default'].outerWidth(node);
|
5812 | h = _utils2['default'].outerHeight(node);
|
5813 | } else {
|
5814 | var win = _utils2['default'].getWindow(node);
|
5815 | offset = {
|
5816 | left: _utils2['default'].getWindowScrollLeft(win),
|
5817 | top: _utils2['default'].getWindowScrollTop(win)
|
5818 | };
|
5819 | w = _utils2['default'].viewportWidth(win);
|
5820 | h = _utils2['default'].viewportHeight(win);
|
5821 | }
|
5822 | offset.width = w;
|
5823 | offset.height = h;
|
5824 | return offset;
|
5825 | }
|
5826 |
|
5827 | exports['default'] = getRegion;
|
5828 | module.exports = exports['default'];
|
5829 |
|
5830 | }),
|
5831 |
|
5832 | (function(module, exports, __webpack_require__) {
|
5833 |
|
5834 | 'use strict';
|
5835 |
|
5836 | Object.defineProperty(exports, "__esModule", {
|
5837 | value: true
|
5838 | });
|
5839 |
|
5840 | var _getAlignOffset = __webpack_require__(62);
|
5841 |
|
5842 | var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset);
|
5843 |
|
5844 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5845 |
|
5846 | function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {
|
5847 | var p1 = (0, _getAlignOffset2['default'])(refNodeRegion, points[1]);
|
5848 | var p2 = (0, _getAlignOffset2['default'])(elRegion, points[0]);
|
5849 | var diff = [p2.left - p1.left, p2.top - p1.top];
|
5850 |
|
5851 | return {
|
5852 | left: elRegion.left - diff[0] + offset[0] - targetOffset[0],
|
5853 | top: elRegion.top - diff[1] + offset[1] - targetOffset[1]
|
5854 | };
|
5855 | }
|
5856 |
|
5857 | exports['default'] = getElFuturePos;
|
5858 | module.exports = exports['default'];
|
5859 |
|
5860 | }),
|
5861 |
|
5862 | (function(module, exports) {
|
5863 |
|
5864 | 'use strict';
|
5865 |
|
5866 | Object.defineProperty(exports, "__esModule", {
|
5867 | value: true
|
5868 | });
|
5869 | |
5870 |
|
5871 |
|
5872 |
|
5873 | function getAlignOffset(region, align) {
|
5874 | var V = align.charAt(0);
|
5875 | var H = align.charAt(1);
|
5876 | var w = region.width;
|
5877 | var h = region.height;
|
5878 |
|
5879 | var x = region.left;
|
5880 | var y = region.top;
|
5881 |
|
5882 | if (V === 'c') {
|
5883 | y += h / 2;
|
5884 | } else if (V === 'b') {
|
5885 | y += h;
|
5886 | }
|
5887 |
|
5888 | if (H === 'c') {
|
5889 | x += w / 2;
|
5890 | } else if (H === 'r') {
|
5891 | x += w;
|
5892 | }
|
5893 |
|
5894 | return {
|
5895 | left: x,
|
5896 | top: y
|
5897 | };
|
5898 | }
|
5899 |
|
5900 | exports['default'] = getAlignOffset;
|
5901 | module.exports = exports['default'];
|
5902 |
|
5903 | }),
|
5904 |
|
5905 | (function(module, exports, __webpack_require__) {
|
5906 |
|
5907 | 'use strict';
|
5908 |
|
5909 | Object.defineProperty(exports, "__esModule", {
|
5910 | value: true
|
5911 | });
|
5912 |
|
5913 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
5914 |
|
5915 | var _utils = __webpack_require__(54);
|
5916 |
|
5917 | var _utils2 = _interopRequireDefault(_utils);
|
5918 |
|
5919 | var _align = __webpack_require__(53);
|
5920 |
|
5921 | var _align2 = _interopRequireDefault(_align);
|
5922 |
|
5923 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5924 |
|
5925 | |
5926 |
|
5927 |
|
5928 |
|
5929 |
|
5930 | function alignPoint(el, tgtPoint, align) {
|
5931 | var pageX = void 0;
|
5932 | var pageY = void 0;
|
5933 |
|
5934 | var doc = _utils2['default'].getDocument(el);
|
5935 | var win = doc.defaultView || doc.parentWindow;
|
5936 |
|
5937 | var scrollX = _utils2['default'].getWindowScrollLeft(win);
|
5938 | var scrollY = _utils2['default'].getWindowScrollTop(win);
|
5939 | var viewportWidth = _utils2['default'].viewportWidth(win);
|
5940 | var viewportHeight = _utils2['default'].viewportHeight(win);
|
5941 |
|
5942 | if ('pageX' in tgtPoint) {
|
5943 | pageX = tgtPoint.pageX;
|
5944 | } else {
|
5945 | pageX = scrollX + tgtPoint.clientX;
|
5946 | }
|
5947 |
|
5948 | if ('pageY' in tgtPoint) {
|
5949 | pageY = tgtPoint.pageY;
|
5950 | } else {
|
5951 | pageY = scrollY + tgtPoint.clientY;
|
5952 | }
|
5953 |
|
5954 | var tgtRegion = {
|
5955 | left: pageX,
|
5956 | top: pageY,
|
5957 | width: 0,
|
5958 | height: 0
|
5959 | };
|
5960 |
|
5961 | var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight;
|
5962 |
|
5963 |
|
5964 | var points = [align.points[0], 'cc'];
|
5965 |
|
5966 | return (0, _align2['default'])(el, tgtRegion, _extends({}, align, { points: points }), pointInView);
|
5967 | }
|
5968 |
|
5969 | exports['default'] = alignPoint;
|
5970 | module.exports = exports['default'];
|
5971 |
|
5972 | }),
|
5973 |
|
5974 | (function(module, exports, __webpack_require__) {
|
5975 |
|
5976 | 'use strict';
|
5977 |
|
5978 | Object.defineProperty(exports, "__esModule", {
|
5979 | value: true
|
5980 | });
|
5981 |
|
5982 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
5983 |
|
5984 | var _classnames = __webpack_require__(5);
|
5985 |
|
5986 | var _classnames2 = _interopRequireDefault(_classnames);
|
5987 |
|
5988 | var _react = __webpack_require__(1);
|
5989 |
|
5990 | var _react2 = _interopRequireDefault(_react);
|
5991 |
|
5992 | var _propTypes = __webpack_require__(6);
|
5993 |
|
5994 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
5995 |
|
5996 | var _Transition = __webpack_require__(12);
|
5997 |
|
5998 | var _Transition2 = _interopRequireDefault(_Transition);
|
5999 |
|
6000 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6001 |
|
6002 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
6003 |
|
6004 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6005 |
|
6006 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
6007 |
|
6008 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
6009 |
|
6010 | var propTypes = {
|
6011 | |
6012 |
|
6013 |
|
6014 | "in": _propTypes2["default"].bool,
|
6015 |
|
6016 | |
6017 |
|
6018 |
|
6019 | unmountOnExit: _propTypes2["default"].bool,
|
6020 |
|
6021 | |
6022 |
|
6023 |
|
6024 |
|
6025 | transitionAppear: _propTypes2["default"].bool,
|
6026 |
|
6027 | |
6028 |
|
6029 |
|
6030 |
|
6031 |
|
6032 | timeout: _propTypes2["default"].number,
|
6033 |
|
6034 | |
6035 |
|
6036 |
|
6037 | onEnter: _propTypes2["default"].func,
|
6038 | |
6039 |
|
6040 |
|
6041 | onEntering: _propTypes2["default"].func,
|
6042 | |
6043 |
|
6044 |
|
6045 | onEntered: _propTypes2["default"].func,
|
6046 | |
6047 |
|
6048 |
|
6049 | onExit: _propTypes2["default"].func,
|
6050 | |
6051 |
|
6052 |
|
6053 | onExiting: _propTypes2["default"].func,
|
6054 | |
6055 |
|
6056 |
|
6057 | onExited: _propTypes2["default"].func
|
6058 | };
|
6059 |
|
6060 | var defaultProps = {
|
6061 | "in": false,
|
6062 | timeout: 300,
|
6063 | unmountOnExit: false,
|
6064 | transitionAppear: false
|
6065 | };
|
6066 |
|
6067 | var Fade = function (_React$Component) {
|
6068 | _inherits(Fade, _React$Component);
|
6069 |
|
6070 | function Fade() {
|
6071 | _classCallCheck(this, Fade);
|
6072 |
|
6073 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
6074 | }
|
6075 |
|
6076 | Fade.prototype.render = function render() {
|
6077 | return _react2["default"].createElement(_Transition2["default"], _extends({}, this.props, {
|
6078 | className: (0, _classnames2["default"])(this.props.className, 'fade'),
|
6079 | enteredClassName: 'in',
|
6080 | enteringClassName: 'in'
|
6081 | }));
|
6082 | };
|
6083 |
|
6084 | return Fade;
|
6085 | }(_react2["default"].Component);
|
6086 |
|
6087 | Fade.propTypes = propTypes;
|
6088 | Fade.defaultProps = defaultProps;
|
6089 |
|
6090 | exports["default"] = Fade;
|
6091 | module.exports = exports['default'];
|
6092 |
|
6093 | }),
|
6094 |
|
6095 | (function(module, exports, __webpack_require__) {
|
6096 |
|
6097 | 'use strict';
|
6098 |
|
6099 | Object.defineProperty(exports, "__esModule", {
|
6100 | value: true
|
6101 | });
|
6102 |
|
6103 | var _Message = __webpack_require__(66);
|
6104 |
|
6105 | var _Message2 = _interopRequireDefault(_Message);
|
6106 |
|
6107 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6108 |
|
6109 | exports["default"] = _Message2["default"];
|
6110 | module.exports = exports['default'];
|
6111 |
|
6112 | }),
|
6113 |
|
6114 | (function(module, exports, __webpack_require__) {
|
6115 |
|
6116 | 'use strict';
|
6117 |
|
6118 | Object.defineProperty(exports, "__esModule", {
|
6119 | value: true
|
6120 | });
|
6121 |
|
6122 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
6123 |
|
6124 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
6125 |
|
6126 | var _react = __webpack_require__(1);
|
6127 |
|
6128 | var _react2 = _interopRequireDefault(_react);
|
6129 |
|
6130 | var _beeNotification = __webpack_require__(67);
|
6131 |
|
6132 | var _beeNotification2 = _interopRequireDefault(_beeNotification);
|
6133 |
|
6134 | var _classnames = __webpack_require__(5);
|
6135 |
|
6136 | var _classnames2 = _interopRequireDefault(_classnames);
|
6137 |
|
6138 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6139 |
|
6140 | var defaultDuration = 1.5;
|
6141 | var defaultTop = 0;
|
6142 | var defaultBottom = 48;
|
6143 | var bottom = 90;
|
6144 | var padding = 30;
|
6145 | var width = 200;
|
6146 | var messageInstance = void 0;
|
6147 | var key = 1;
|
6148 | var clsPrefix = 'u-message';
|
6149 | var noop = function noop() {};
|
6150 |
|
6151 | var positionObj = {
|
6152 | "top": {
|
6153 | messageStyle: {
|
6154 | width: "100%"
|
6155 | },
|
6156 | notificationStyle: {
|
6157 | top: defaultTop,
|
6158 | width: "100%"
|
6159 | },
|
6160 | transitionName: 'top'
|
6161 | },
|
6162 | "bottom": {
|
6163 | messageStyle: {
|
6164 | width: "100%"
|
6165 | },
|
6166 | notificationStyle: {
|
6167 | bottom: defaultBottom,
|
6168 | width: "100%"
|
6169 | },
|
6170 | transitionName: 'bottom'
|
6171 | },
|
6172 | "topRight": {
|
6173 | messageStyle: {
|
6174 | width: width
|
6175 | },
|
6176 | notificationStyle: {
|
6177 | top: padding,
|
6178 | right: padding,
|
6179 | width: width
|
6180 | },
|
6181 | transitionName: 'right'
|
6182 | },
|
6183 | "bottomRight": {
|
6184 | messageStyle: {
|
6185 | width: width
|
6186 | },
|
6187 | notificationStyle: {
|
6188 | bottom: bottom,
|
6189 | right: padding,
|
6190 | width: width
|
6191 | },
|
6192 | transitionName: 'right'
|
6193 | },
|
6194 | "topLeft": {
|
6195 | messageStyle: {
|
6196 | width: width
|
6197 | },
|
6198 | notificationStyle: {
|
6199 | top: padding,
|
6200 | left: padding,
|
6201 | width: width
|
6202 | },
|
6203 | transitionName: 'left'
|
6204 | },
|
6205 | "bottomLeft": {
|
6206 | messageStyle: {
|
6207 | width: width
|
6208 | },
|
6209 | notificationStyle: {
|
6210 | bottom: bottom,
|
6211 | left: padding,
|
6212 | width: width
|
6213 | },
|
6214 | transitionName: 'left'
|
6215 | }
|
6216 | };
|
6217 |
|
6218 | function getMessageInstance() {
|
6219 | var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'top';
|
6220 | var callback = arguments[1];
|
6221 |
|
6222 | if (messageInstance) {
|
6223 | callback(messageInstance);
|
6224 | return;
|
6225 | }
|
6226 | var style = positionObj[position].notificationStyle;
|
6227 | _beeNotification2["default"].newInstance({
|
6228 | clsPrefix: clsPrefix,
|
6229 | transitionName: clsPrefix + '-' + positionObj[position].transitionName,
|
6230 | style: style,
|
6231 | position: ''
|
6232 | }, function (instance) {
|
6233 | messageInstance = instance;
|
6234 | callback(instance);
|
6235 | });
|
6236 | }
|
6237 |
|
6238 | function notice(content, duration, type, onClose, position, style) {
|
6239 | var iconType = {
|
6240 | info: 'uf uf-i-c-2',
|
6241 | success: 'uf uf-correct',
|
6242 | danger: 'uf uf-close-c',
|
6243 | warning: 'uf uf-exc-t',
|
6244 | light: 'uf uf-notification',
|
6245 | dark: 'uf uf-bubble',
|
6246 | news: 'uf uf-bell',
|
6247 | infolight: 'uf uf-i-c-2',
|
6248 | successlight: 'uf uf-correct',
|
6249 | dangerlight: 'uf uf-close-c',
|
6250 | warninglight: 'uf uf-exc-t'
|
6251 | }[type];
|
6252 |
|
6253 | var positionStyle = positionObj[position].messageStyle;
|
6254 |
|
6255 | getMessageInstance(position, function (instance) {
|
6256 | instance.notice({
|
6257 | key: key,
|
6258 | duration: duration,
|
6259 | color: type,
|
6260 | style: _extends({}, positionStyle, style),
|
6261 | content: _react2["default"].createElement(
|
6262 | 'div',
|
6263 | null,
|
6264 | _react2["default"].createElement(
|
6265 | 'div',
|
6266 | { className: clsPrefix + '-notice-description-icon' },
|
6267 | _react2["default"].createElement('i', { className: (0, _classnames2["default"])(iconType) })
|
6268 | ),
|
6269 | _react2["default"].createElement(
|
6270 | 'div',
|
6271 | { className: clsPrefix + '-notice-description-content' },
|
6272 | content
|
6273 | )
|
6274 | ),
|
6275 | onClose: onClose
|
6276 | });
|
6277 | });
|
6278 | return function () {
|
6279 | var target = key++;
|
6280 | return function () {
|
6281 | if (messageInstance) {
|
6282 | messageInstance.removeNotice(target);
|
6283 | }
|
6284 | };
|
6285 | }();
|
6286 | }
|
6287 |
|
6288 | exports["default"] = {
|
6289 | create: function create(obj) {
|
6290 | var content = obj.content || '';
|
6291 | var duration = _typeof(obj.duration) == undefined ? defaultDuration : obj.duration;
|
6292 | var color = obj.color || 'dark';
|
6293 | var onClose = obj.onClose || noop;
|
6294 | var position = obj.position || "top";
|
6295 | var style = obj.style || {};
|
6296 | return notice(content, duration, color, onClose, position, style);
|
6297 | },
|
6298 | config: function config(options) {
|
6299 | if (options.top !== undefined) {
|
6300 | defaultTop = options.top;
|
6301 | }
|
6302 | if (options.duration !== undefined) {
|
6303 | defaultDuration = options.duration;
|
6304 | }
|
6305 | if (options.clsPrefix !== undefined) {
|
6306 | clsPrefix = options.clsPrefix;
|
6307 | }
|
6308 | if (options.defaultBottom !== undefined) {
|
6309 | defaultBottom = options.defaultBottom;
|
6310 | }
|
6311 | if (options.bottom !== undefined) {
|
6312 | bottom = options.bottom;
|
6313 | }
|
6314 | if (options.width !== undefined) {
|
6315 | bottom = options.width;
|
6316 | }
|
6317 | },
|
6318 | destroy: function destroy() {
|
6319 | if (messageInstance) {
|
6320 | messageInstance.destroy();
|
6321 | messageInstance = null;
|
6322 | }
|
6323 | }
|
6324 | };
|
6325 | module.exports = exports['default'];
|
6326 |
|
6327 | }),
|
6328 |
|
6329 | (function(module, exports, __webpack_require__) {
|
6330 |
|
6331 | 'use strict';
|
6332 |
|
6333 | Object.defineProperty(exports, "__esModule", {
|
6334 | value: true
|
6335 | });
|
6336 |
|
6337 | var _Notification = __webpack_require__(68);
|
6338 |
|
6339 | var _Notification2 = _interopRequireDefault(_Notification);
|
6340 |
|
6341 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6342 |
|
6343 | exports["default"] = _Notification2["default"];
|
6344 | module.exports = exports['default'];
|
6345 |
|
6346 | }),
|
6347 |
|
6348 | (function(module, exports, __webpack_require__) {
|
6349 |
|
6350 | 'use strict';
|
6351 |
|
6352 | Object.defineProperty(exports, "__esModule", {
|
6353 | value: true
|
6354 | });
|
6355 |
|
6356 | 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; };
|
6357 |
|
6358 | var _react = __webpack_require__(1);
|
6359 |
|
6360 | var _react2 = _interopRequireDefault(_react);
|
6361 |
|
6362 | var _propTypes = __webpack_require__(6);
|
6363 |
|
6364 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6365 |
|
6366 | var _reactDom = __webpack_require__(2);
|
6367 |
|
6368 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
6369 |
|
6370 | var _beeAnimate = __webpack_require__(69);
|
6371 |
|
6372 | var _beeAnimate2 = _interopRequireDefault(_beeAnimate);
|
6373 |
|
6374 | var _createChainedFunction = __webpack_require__(37);
|
6375 |
|
6376 | var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
|
6377 |
|
6378 | var _classnames = __webpack_require__(5);
|
6379 |
|
6380 | var _classnames2 = _interopRequireDefault(_classnames);
|
6381 |
|
6382 | var _Notice = __webpack_require__(74);
|
6383 |
|
6384 | var _Notice2 = _interopRequireDefault(_Notice);
|
6385 |
|
6386 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6387 |
|
6388 | 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; }
|
6389 |
|
6390 | 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; }
|
6391 |
|
6392 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6393 |
|
6394 | 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; }
|
6395 |
|
6396 | 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); }
|
6397 |
|
6398 | var seed = 0;
|
6399 | var now = Date.now();
|
6400 |
|
6401 | function getUuid() {
|
6402 | return 'uNotification_' + now + '_' + seed++;
|
6403 | }
|
6404 |
|
6405 | var propTypes = {
|
6406 | show: _propTypes2["default"].bool,
|
6407 | clsPrefix: _propTypes2["default"].string,
|
6408 | style: _propTypes2["default"].object,
|
6409 | position: _propTypes2["default"].oneOf(['topRight', 'bottomRight', '']),
|
6410 | transitionName: _propTypes2["default"].string,
|
6411 | animation: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object])
|
6412 | };
|
6413 |
|
6414 | var defaultProps = {
|
6415 | clsPrefix: 'u-notification',
|
6416 | animation: 'fade',
|
6417 | position: 'topRight'
|
6418 | };
|
6419 |
|
6420 | var Notification = function (_Component) {
|
6421 | _inherits(Notification, _Component);
|
6422 |
|
6423 | function Notification(props) {
|
6424 | _classCallCheck(this, Notification);
|
6425 |
|
6426 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
6427 |
|
6428 | _this.state = {
|
6429 | notices: []
|
6430 | };
|
6431 | _this.add = _this.add.bind(_this);
|
6432 | _this.remove = _this.remove.bind(_this);
|
6433 |
|
6434 | return _this;
|
6435 | }
|
6436 |
|
6437 | Notification.prototype.getTransitionName = function getTransitionName() {
|
6438 | var props = this.props;
|
6439 | var transitionName = props.transitionName;
|
6440 | if (!transitionName && props.animation) {
|
6441 | transitionName = props.clsPrefix + '-' + props.animation;
|
6442 | }
|
6443 | return transitionName;
|
6444 | };
|
6445 |
|
6446 | Notification.prototype.add = function add(notice) {
|
6447 | var key = notice.key = notice.key || getUuid();
|
6448 | this.setState(function (previousState) {
|
6449 | var notices = previousState.notices;
|
6450 | if (!notices.filter(function (v) {
|
6451 | return v.key === key;
|
6452 | }).length) {
|
6453 | return {
|
6454 | notices: notices.concat(notice)
|
6455 | };
|
6456 | }
|
6457 | });
|
6458 | };
|
6459 |
|
6460 | Notification.prototype.remove = function remove(key) {
|
6461 | this.setState(function (previousState) {
|
6462 | return {
|
6463 | notices: previousState.notices.filter(function (notice) {
|
6464 | return notice.key !== key;
|
6465 | })
|
6466 | };
|
6467 | });
|
6468 | };
|
6469 |
|
6470 | Notification.prototype.render = function render() {
|
6471 | var _this2 = this,
|
6472 | _classes;
|
6473 |
|
6474 | var _props = this.props,
|
6475 | clsPrefix = _props.clsPrefix,
|
6476 | className = _props.className,
|
6477 | position = _props.position,
|
6478 | style = _props.style;
|
6479 |
|
6480 | var noticeNodes = this.state.notices.map(function (notice) {
|
6481 | var onClose = (0, _createChainedFunction2["default"])(_this2.remove.bind(_this2, notice.key), notice.onClose);
|
6482 | return _react2["default"].createElement(
|
6483 | _Notice2["default"],
|
6484 | _extends({
|
6485 | clsPrefix: clsPrefix
|
6486 | }, notice, {
|
6487 | onClose: onClose
|
6488 | }),
|
6489 | notice.content
|
6490 | );
|
6491 | });
|
6492 | var classes = (_classes = {}, _defineProperty(_classes, clsPrefix, 1), _defineProperty(_classes, className, !!className), _classes);
|
6493 | if (position) {
|
6494 | classes[clsPrefix + '-' + position] = !!position;
|
6495 | }
|
6496 |
|
6497 | return _react2["default"].createElement(
|
6498 | 'div',
|
6499 | { className: (0, _classnames2["default"])(className, classes), style: style },
|
6500 | _react2["default"].createElement(
|
6501 | _beeAnimate2["default"],
|
6502 | { transitionName: this.getTransitionName() },
|
6503 | noticeNodes
|
6504 | )
|
6505 | );
|
6506 | };
|
6507 |
|
6508 | return Notification;
|
6509 | }(_react.Component);
|
6510 |
|
6511 | ;
|
6512 |
|
6513 | Notification.propTypes = propTypes;
|
6514 | Notification.defaultProps = defaultProps;
|
6515 |
|
6516 | Notification.newInstance = function newNotificationInstance(properties, callback) {
|
6517 | if (typeof callback !== 'function') {
|
6518 | console.error('You must introduce callback as the second parameter of Notification.newInstance().');
|
6519 | return;
|
6520 | }
|
6521 | var props = properties || {};
|
6522 | var div = document.createElement('div');
|
6523 | document.body.appendChild(div);
|
6524 |
|
6525 | var called = false;
|
6526 | function ref(notification) {
|
6527 | if (called) {
|
6528 | return;
|
6529 | }
|
6530 | called = true;
|
6531 | callback({
|
6532 | notice: function notice(noticeProps) {
|
6533 | notification.add(noticeProps);
|
6534 | },
|
6535 | removeNotice: function removeNotice(key) {
|
6536 | notification.remove(key);
|
6537 | },
|
6538 |
|
6539 | component: notification,
|
6540 | destroy: function destroy() {
|
6541 | _reactDom2["default"].unmountComponentAtNode(div);
|
6542 | document.body.removeChild(div);
|
6543 | }
|
6544 | });
|
6545 | }
|
6546 | _reactDom2["default"].render(_react2["default"].createElement(Notification, _extends({}, props, { ref: ref })), div);
|
6547 | };
|
6548 |
|
6549 | exports["default"] = Notification;
|
6550 | module.exports = exports['default'];
|
6551 |
|
6552 | }),
|
6553 |
|
6554 | (function(module, exports, __webpack_require__) {
|
6555 |
|
6556 | 'use strict';
|
6557 |
|
6558 | Object.defineProperty(exports, "__esModule", {
|
6559 | value: true
|
6560 | });
|
6561 |
|
6562 | var _Animate = __webpack_require__(70);
|
6563 |
|
6564 | var _Animate2 = _interopRequireDefault(_Animate);
|
6565 |
|
6566 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6567 |
|
6568 | exports["default"] = _Animate2["default"];
|
6569 | module.exports = exports['default'];
|
6570 |
|
6571 | }),
|
6572 |
|
6573 | (function(module, exports, __webpack_require__) {
|
6574 |
|
6575 | 'use strict';
|
6576 |
|
6577 | Object.defineProperty(exports, "__esModule", {
|
6578 | value: true
|
6579 | });
|
6580 |
|
6581 | var _react = __webpack_require__(1);
|
6582 |
|
6583 | var _react2 = _interopRequireDefault(_react);
|
6584 |
|
6585 | var _propTypes = __webpack_require__(6);
|
6586 |
|
6587 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6588 |
|
6589 | var _ChildrenUtils = __webpack_require__(71);
|
6590 |
|
6591 | var _AnimateChild = __webpack_require__(72);
|
6592 |
|
6593 | var _AnimateChild2 = _interopRequireDefault(_AnimateChild);
|
6594 |
|
6595 | var _util = __webpack_require__(73);
|
6596 |
|
6597 | var _util2 = _interopRequireDefault(_util);
|
6598 |
|
6599 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6600 |
|
6601 | 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; }
|
6602 |
|
6603 | 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; }
|
6604 |
|
6605 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6606 |
|
6607 | 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; }
|
6608 |
|
6609 | 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); }
|
6610 |
|
6611 | var defaultKey = 'u_animate_' + Date.now();
|
6612 |
|
6613 |
|
6614 | function getChildrenFromProps(props) {
|
6615 | var children = props.children;
|
6616 | if (_react2["default"].isValidElement(children)) {
|
6617 | if (!children.key) {
|
6618 | return _react2["default"].cloneElement(children, {
|
6619 | key: defaultKey
|
6620 | });
|
6621 | }
|
6622 | }
|
6623 | return children;
|
6624 | }
|
6625 |
|
6626 | function noop() {}
|
6627 |
|
6628 | var propTypes = {
|
6629 | component: _propTypes2["default"].any,
|
6630 | animation: _propTypes2["default"].object,
|
6631 | transitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
|
6632 | transitionEnter: _propTypes2["default"].bool,
|
6633 | transitionAppear: _propTypes2["default"].bool,
|
6634 | exclusive: _propTypes2["default"].bool,
|
6635 | transitionLeave: _propTypes2["default"].bool,
|
6636 | onEnd: _propTypes2["default"].func,
|
6637 | onEnter: _propTypes2["default"].func,
|
6638 | onLeave: _propTypes2["default"].func,
|
6639 | onAppear: _propTypes2["default"].func,
|
6640 | showProp: _propTypes2["default"].string
|
6641 | };
|
6642 |
|
6643 | var defaultProps = {
|
6644 | animation: {},
|
6645 | component: 'span',
|
6646 | transitionEnter: true,
|
6647 | transitionLeave: true,
|
6648 | transitionAppear: false,
|
6649 | onEnd: noop,
|
6650 | onEnter: noop,
|
6651 | onLeave: noop,
|
6652 | onAppear: noop
|
6653 | };
|
6654 |
|
6655 | var Animate = function (_Component) {
|
6656 | _inherits(Animate, _Component);
|
6657 |
|
6658 | function Animate(props) {
|
6659 | _classCallCheck(this, Animate);
|
6660 |
|
6661 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
6662 |
|
6663 | _this.currentlyAnimatingKeys = {};
|
6664 | _this.keysToEnter = [];
|
6665 | _this.keysToLeave = [];
|
6666 | _this.state = {
|
6667 | children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(_this.props))
|
6668 | };
|
6669 |
|
6670 | _this.performEnter = _this.performEnter.bind(_this);
|
6671 | _this.performAppear = _this.performAppear.bind(_this);
|
6672 | _this.handleDoneAdding = _this.handleDoneAdding.bind(_this);
|
6673 | _this.performLeave = _this.performLeave.bind(_this);
|
6674 |
|
6675 | _this.performLeave = _this.performLeave.bind(_this);
|
6676 | _this.handleDoneLeaving = _this.handleDoneLeaving.bind(_this);
|
6677 | _this.isValidChildByKey = _this.isValidChildByKey.bind(_this);
|
6678 | _this.stop = _this.stop.bind(_this);
|
6679 | return _this;
|
6680 | }
|
6681 |
|
6682 | Animate.prototype.componentDidMount = function componentDidMount() {
|
6683 | var _this2 = this;
|
6684 |
|
6685 | this.mounted = true;
|
6686 | var showProp = this.props.showProp;
|
6687 | var children = this.state.children;
|
6688 | if (showProp) {
|
6689 | children = children.filter(function (child) {
|
6690 | return !!child.props[showProp];
|
6691 | });
|
6692 | }
|
6693 | children.forEach(function (child) {
|
6694 | if (child) {
|
6695 | _this2.performAppear(child.key);
|
6696 | }
|
6697 | });
|
6698 | };
|
6699 |
|
6700 | Animate.prototype.componentWillUnmount = function componentWillUnmount() {
|
6701 | this.mounted = false;
|
6702 | };
|
6703 |
|
6704 | Animate.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
6705 | var _this3 = this;
|
6706 |
|
6707 | this.nextProps = nextProps;
|
6708 | var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps));
|
6709 | var props = this.props;
|
6710 |
|
6711 | if (props.exclusive) {
|
6712 | Object.keys(this.currentlyAnimatingKeys).forEach(function (key) {
|
6713 | _this3.stop(key);
|
6714 | });
|
6715 | }
|
6716 | var showProp = props.showProp;
|
6717 | var currentlyAnimatingKeys = this.currentlyAnimatingKeys;
|
6718 |
|
6719 | var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children;
|
6720 |
|
6721 | var newChildren = [];
|
6722 | if (showProp) {
|
6723 | currentChildren.forEach(function (currentChild) {
|
6724 | var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key);
|
6725 | var newChild = void 0;
|
6726 | if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) {
|
6727 | newChild = _react2["default"].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true));
|
6728 | } else {
|
6729 | newChild = nextChild;
|
6730 | }
|
6731 | if (newChild) {
|
6732 | newChildren.push(newChild);
|
6733 | }
|
6734 | });
|
6735 | nextChildren.forEach(function (nextChild) {
|
6736 | if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) {
|
6737 | newChildren.push(nextChild);
|
6738 | }
|
6739 | });
|
6740 | } else {
|
6741 | newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren);
|
6742 | }
|
6743 |
|
6744 |
|
6745 | this.setState({
|
6746 | children: newChildren
|
6747 | });
|
6748 |
|
6749 | nextChildren.forEach(function (child) {
|
6750 | var key = child && child.key;
|
6751 | if (child && currentlyAnimatingKeys[key]) {
|
6752 | return;
|
6753 | }
|
6754 | var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
6755 | if (showProp) {
|
6756 | var showInNext = child.props[showProp];
|
6757 | if (hasPrev) {
|
6758 | var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
6759 | if (!showInNow && showInNext) {
|
6760 | _this3.keysToEnter.push(key);
|
6761 | }
|
6762 | } else if (showInNext) {
|
6763 | _this3.keysToEnter.push(key);
|
6764 | }
|
6765 | } else if (!hasPrev) {
|
6766 | _this3.keysToEnter.push(key);
|
6767 | }
|
6768 | });
|
6769 |
|
6770 | currentChildren.forEach(function (child) {
|
6771 | var key = child && child.key;
|
6772 | if (child && currentlyAnimatingKeys[key]) {
|
6773 | return;
|
6774 | }
|
6775 | var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key);
|
6776 | if (showProp) {
|
6777 | var showInNow = child.props[showProp];
|
6778 | if (hasNext) {
|
6779 | var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp);
|
6780 | if (!showInNext && showInNow) {
|
6781 | _this3.keysToLeave.push(key);
|
6782 | }
|
6783 | } else if (showInNow) {
|
6784 | _this3.keysToLeave.push(key);
|
6785 | }
|
6786 | } else if (!hasNext) {
|
6787 | _this3.keysToLeave.push(key);
|
6788 | }
|
6789 | });
|
6790 | };
|
6791 |
|
6792 | Animate.prototype.componentDidUpdate = function componentDidUpdate() {
|
6793 | var keysToEnter = this.keysToEnter;
|
6794 | this.keysToEnter = [];
|
6795 | keysToEnter.forEach(this.performEnter);
|
6796 | var keysToLeave = this.keysToLeave;
|
6797 | this.keysToLeave = [];
|
6798 | keysToLeave.forEach(this.performLeave);
|
6799 | };
|
6800 |
|
6801 | Animate.prototype.performEnter = function performEnter(key) {
|
6802 |
|
6803 | if (this.refs[key]) {
|
6804 | this.currentlyAnimatingKeys[key] = true;
|
6805 | this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter'));
|
6806 | }
|
6807 | };
|
6808 |
|
6809 | Animate.prototype.performAppear = function performAppear(key) {
|
6810 | if (this.refs[key]) {
|
6811 | this.currentlyAnimatingKeys[key] = true;
|
6812 | this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear'));
|
6813 | }
|
6814 | };
|
6815 |
|
6816 | Animate.prototype.handleDoneAdding = function handleDoneAdding(key, type) {
|
6817 | var props = this.props;
|
6818 | delete this.currentlyAnimatingKeys[key];
|
6819 |
|
6820 | if (props.exclusive && props !== this.nextProps) {
|
6821 | return;
|
6822 | }
|
6823 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
6824 | if (!this.isValidChildByKey(currentChildren, key)) {
|
6825 |
|
6826 | this.performLeave(key);
|
6827 | } else {
|
6828 | if (type === 'appear') {
|
6829 | if (_util2["default"].allowAppearCallback(props)) {
|
6830 | props.onAppear(key);
|
6831 | props.onEnd(key, true);
|
6832 | }
|
6833 | } else {
|
6834 | if (_util2["default"].allowEnterCallback(props)) {
|
6835 | props.onEnter(key);
|
6836 | props.onEnd(key, true);
|
6837 | }
|
6838 | }
|
6839 | }
|
6840 | };
|
6841 |
|
6842 | Animate.prototype.performLeave = function performLeave(key) {
|
6843 |
|
6844 | if (this.refs[key]) {
|
6845 | this.currentlyAnimatingKeys[key] = true;
|
6846 | this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key));
|
6847 | }
|
6848 | };
|
6849 |
|
6850 | Animate.prototype.handleDoneLeaving = function handleDoneLeaving(key) {
|
6851 | var props = this.props;
|
6852 | delete this.currentlyAnimatingKeys[key];
|
6853 |
|
6854 | if (props.exclusive && props !== this.nextProps) {
|
6855 | return;
|
6856 | }
|
6857 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
6858 |
|
6859 | if (this.isValidChildByKey(currentChildren, key)) {
|
6860 | this.performEnter(key);
|
6861 | } else {
|
6862 | var end = function end() {
|
6863 | if (_util2["default"].allowLeaveCallback(props)) {
|
6864 | props.onLeave(key);
|
6865 | props.onEnd(key, false);
|
6866 | }
|
6867 | };
|
6868 |
|
6869 | if (this.mounted && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) {
|
6870 | this.setState({
|
6871 | children: currentChildren
|
6872 | }, end);
|
6873 | } else {
|
6874 | end();
|
6875 | }
|
6876 | }
|
6877 | };
|
6878 |
|
6879 | Animate.prototype.isValidChildByKey = function isValidChildByKey(currentChildren, key) {
|
6880 | var showProp = this.props.showProp;
|
6881 | if (showProp) {
|
6882 | return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
6883 | }
|
6884 | return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
6885 | };
|
6886 |
|
6887 | Animate.prototype.stop = function stop(key) {
|
6888 | delete this.currentlyAnimatingKeys[key];
|
6889 | var component = this.refs[key];
|
6890 | if (component) {
|
6891 | component.stop();
|
6892 | }
|
6893 | };
|
6894 |
|
6895 | Animate.prototype.render = function render() {
|
6896 | var props = this.props;
|
6897 | this.nextProps = props;
|
6898 | var stateChildren = this.state.children;
|
6899 | var children = null;
|
6900 | if (stateChildren) {
|
6901 | children = stateChildren.map(function (child) {
|
6902 | if (child === null || child === undefined) {
|
6903 | return child;
|
6904 | }
|
6905 | if (!child.key) {
|
6906 | throw new Error('must set key for <rc-animate> children');
|
6907 | }
|
6908 | return _react2["default"].createElement(
|
6909 | _AnimateChild2["default"],
|
6910 | {
|
6911 | key: child.key,
|
6912 | ref: child.key,
|
6913 | animation: props.animation,
|
6914 | transitionName: props.transitionName,
|
6915 | transitionEnter: props.transitionEnter,
|
6916 | transitionAppear: props.transitionAppear,
|
6917 | transitionLeave: props.transitionLeave
|
6918 | },
|
6919 | child
|
6920 | );
|
6921 | });
|
6922 | }
|
6923 | var Component = props.component;
|
6924 | if (Component) {
|
6925 | var passedProps = props;
|
6926 | if (typeof Component === 'string') {
|
6927 | passedProps = {
|
6928 | className: props.className,
|
6929 | style: props.style
|
6930 | };
|
6931 | }
|
6932 | return _react2["default"].createElement(
|
6933 | Component,
|
6934 | passedProps,
|
6935 | children
|
6936 | );
|
6937 | }
|
6938 | return children[0] || null;
|
6939 | };
|
6940 |
|
6941 | return Animate;
|
6942 | }(_react.Component);
|
6943 |
|
6944 | ;
|
6945 | Animate.defaultProps = defaultProps;
|
6946 | Animate.propTypes = Animate.propTypes;
|
6947 |
|
6948 | exports["default"] = Animate;
|
6949 | module.exports = exports['default'];
|
6950 |
|
6951 | }),
|
6952 |
|
6953 | (function(module, exports, __webpack_require__) {
|
6954 |
|
6955 | 'use strict';
|
6956 |
|
6957 | Object.defineProperty(exports, "__esModule", {
|
6958 | value: true
|
6959 | });
|
6960 | exports.toArrayChildren = toArrayChildren;
|
6961 | exports.findChildInChildrenByKey = findChildInChildrenByKey;
|
6962 | exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey;
|
6963 | exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey;
|
6964 | exports.isSameChildren = isSameChildren;
|
6965 | exports.mergeChildren = mergeChildren;
|
6966 |
|
6967 | var _react = __webpack_require__(1);
|
6968 |
|
6969 | var _react2 = _interopRequireDefault(_react);
|
6970 |
|
6971 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6972 |
|
6973 | function toArrayChildren(children) {
|
6974 | var ret = [];
|
6975 | _react2["default"].Children.forEach(children, function (child) {
|
6976 | ret.push(child);
|
6977 | });
|
6978 | return ret;
|
6979 | }
|
6980 |
|
6981 | function findChildInChildrenByKey(children, key) {
|
6982 | var ret = null;
|
6983 | if (children) {
|
6984 | children.forEach(function (child) {
|
6985 | if (ret) {
|
6986 | return;
|
6987 | }
|
6988 | if (child && child.key === key) {
|
6989 | ret = child;
|
6990 | }
|
6991 | });
|
6992 | }
|
6993 | return ret;
|
6994 | }
|
6995 |
|
6996 | function findShownChildInChildrenByKey(children, key, showProp) {
|
6997 | var ret = null;
|
6998 | if (children) {
|
6999 | children.forEach(function (child) {
|
7000 | if (child && child.key === key && child.props[showProp]) {
|
7001 | if (ret) {
|
7002 | throw new Error('two child with same key for <rc-animate> children');
|
7003 | }
|
7004 | ret = child;
|
7005 | }
|
7006 | });
|
7007 | }
|
7008 | return ret;
|
7009 | }
|
7010 |
|
7011 | function findHiddenChildInChildrenByKey(children, key, showProp) {
|
7012 | var found = 0;
|
7013 | if (children) {
|
7014 | children.forEach(function (child) {
|
7015 | if (found) {
|
7016 | return;
|
7017 | }
|
7018 | found = child && child.key === key && !child.props[showProp];
|
7019 | });
|
7020 | }
|
7021 | return found;
|
7022 | }
|
7023 |
|
7024 | function isSameChildren(c1, c2, showProp) {
|
7025 | var same = c1.length === c2.length;
|
7026 | if (same) {
|
7027 | c1.forEach(function (child, index) {
|
7028 | var child2 = c2[index];
|
7029 | if (child && child2) {
|
7030 | if (child && !child2 || !child && child2) {
|
7031 | same = false;
|
7032 | } else if (child.key !== child2.key) {
|
7033 | same = false;
|
7034 | } else if (showProp && child.props[showProp] !== child2.props[showProp]) {
|
7035 | same = false;
|
7036 | }
|
7037 | }
|
7038 | });
|
7039 | }
|
7040 | return same;
|
7041 | }
|
7042 |
|
7043 | function mergeChildren(prev, next) {
|
7044 | var ret = [];
|
7045 |
|
7046 |
|
7047 |
|
7048 | var nextChildrenPending = {};
|
7049 | var pendingChildren = [];
|
7050 | prev.forEach(function (child) {
|
7051 | if (child && findChildInChildrenByKey(next, child.key)) {
|
7052 | if (pendingChildren.length) {
|
7053 | nextChildrenPending[child.key] = pendingChildren;
|
7054 | pendingChildren = [];
|
7055 | }
|
7056 | } else {
|
7057 | pendingChildren.push(child);
|
7058 | }
|
7059 | });
|
7060 |
|
7061 | next.forEach(function (child) {
|
7062 | if (child && nextChildrenPending.hasOwnProperty(child.key)) {
|
7063 | ret = ret.concat(nextChildrenPending[child.key]);
|
7064 | }
|
7065 | ret.push(child);
|
7066 | });
|
7067 |
|
7068 | ret = ret.concat(pendingChildren);
|
7069 |
|
7070 | return ret;
|
7071 | }
|
7072 |
|
7073 | }),
|
7074 |
|
7075 | (function(module, exports, __webpack_require__) {
|
7076 |
|
7077 | 'use strict';
|
7078 |
|
7079 | Object.defineProperty(exports, "__esModule", {
|
7080 | value: true
|
7081 | });
|
7082 |
|
7083 | 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; };
|
7084 |
|
7085 | var _react = __webpack_require__(1);
|
7086 |
|
7087 | var _react2 = _interopRequireDefault(_react);
|
7088 |
|
7089 | var _propTypes = __webpack_require__(6);
|
7090 |
|
7091 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7092 |
|
7093 | var _reactDom = __webpack_require__(2);
|
7094 |
|
7095 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7096 |
|
7097 | var _tinperBeeCore = __webpack_require__(27);
|
7098 |
|
7099 | var _util = __webpack_require__(73);
|
7100 |
|
7101 | var _util2 = _interopRequireDefault(_util);
|
7102 |
|
7103 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7104 |
|
7105 | 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; }
|
7106 |
|
7107 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7108 |
|
7109 | 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; }
|
7110 |
|
7111 | 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); }
|
7112 |
|
7113 | var transitionMap = {
|
7114 | enter: 'transitionEnter',
|
7115 | appear: 'transitionAppear',
|
7116 | leave: 'transitionLeave'
|
7117 | };
|
7118 |
|
7119 | var propTypes = {
|
7120 | children: _propTypes2["default"].any
|
7121 | };
|
7122 |
|
7123 | var AnimateChild = function (_Component) {
|
7124 | _inherits(AnimateChild, _Component);
|
7125 |
|
7126 | function AnimateChild(props) {
|
7127 | _classCallCheck(this, AnimateChild);
|
7128 |
|
7129 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
7130 |
|
7131 | _this.transition = _this.transition.bind(_this);
|
7132 | _this.stop = _this.stop.bind(_this);
|
7133 | return _this;
|
7134 | }
|
7135 |
|
7136 | AnimateChild.prototype.componentWillUnmount = function componentWillUnmount() {
|
7137 | this.stop();
|
7138 | };
|
7139 |
|
7140 | AnimateChild.prototype.componentWillEnter = function componentWillEnter(done) {
|
7141 | if (_util2["default"].isEnterSupported(this.props)) {
|
7142 | this.transition('enter', done);
|
7143 | } else {
|
7144 | done();
|
7145 | }
|
7146 | };
|
7147 |
|
7148 | AnimateChild.prototype.componentWillAppear = function componentWillAppear(done) {
|
7149 | if (_util2["default"].isAppearSupported(this.props)) {
|
7150 | this.transition('appear', done);
|
7151 | } else {
|
7152 | done();
|
7153 | }
|
7154 | };
|
7155 |
|
7156 | AnimateChild.prototype.componentWillLeave = function componentWillLeave(done) {
|
7157 | if (_util2["default"].isLeaveSupported(this.props)) {
|
7158 | this.transition('leave', done);
|
7159 | } else {
|
7160 |
|
7161 |
|
7162 |
|
7163 | done();
|
7164 | }
|
7165 | };
|
7166 |
|
7167 | AnimateChild.prototype.transition = function transition(animationType, finishCallback) {
|
7168 | var _this2 = this;
|
7169 |
|
7170 | var node = _reactDom2["default"].findDOMNode(this);
|
7171 | var props = this.props;
|
7172 | var transitionName = props.transitionName;
|
7173 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
|
7174 | this.stop();
|
7175 | var end = function end() {
|
7176 | _this2.stopper = null;
|
7177 | finishCallback();
|
7178 | };
|
7179 | if ((_tinperBeeCore.cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {
|
7180 | var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType;
|
7181 | var activeName = name + '-active';
|
7182 | if (nameIsObj && transitionName[animationType + 'Active']) {
|
7183 | activeName = transitionName[animationType + 'Active'];
|
7184 | }
|
7185 | this.stopper = (0, _tinperBeeCore.cssAnimation)(node, {
|
7186 | name: name,
|
7187 | active: activeName
|
7188 | }, end);
|
7189 | } else {
|
7190 | this.stopper = props.animation[animationType](node, end);
|
7191 | }
|
7192 | };
|
7193 |
|
7194 | AnimateChild.prototype.stop = function stop() {
|
7195 | var stopper = this.stopper;
|
7196 | if (stopper) {
|
7197 | this.stopper = null;
|
7198 | stopper.stop();
|
7199 | }
|
7200 | };
|
7201 |
|
7202 | AnimateChild.prototype.render = function render() {
|
7203 | return this.props.children;
|
7204 | };
|
7205 |
|
7206 | return AnimateChild;
|
7207 | }(_react.Component);
|
7208 |
|
7209 | ;
|
7210 |
|
7211 | AnimateChild.propTypes = propTypes;
|
7212 |
|
7213 | exports["default"] = AnimateChild;
|
7214 | module.exports = exports['default'];
|
7215 |
|
7216 | }),
|
7217 |
|
7218 | (function(module, exports) {
|
7219 |
|
7220 | "use strict";
|
7221 |
|
7222 | Object.defineProperty(exports, "__esModule", {
|
7223 | value: true
|
7224 | });
|
7225 | var util = {
|
7226 | isAppearSupported: function isAppearSupported(props) {
|
7227 | return props.transitionName && props.transitionAppear || props.animation.appear;
|
7228 | },
|
7229 | isEnterSupported: function isEnterSupported(props) {
|
7230 | return props.transitionName && props.transitionEnter || props.animation.enter;
|
7231 | },
|
7232 | isLeaveSupported: function isLeaveSupported(props) {
|
7233 | return props.transitionName && props.transitionLeave || props.animation.leave;
|
7234 | },
|
7235 | allowAppearCallback: function allowAppearCallback(props) {
|
7236 | return props.transitionAppear || props.animation.appear;
|
7237 | },
|
7238 | allowEnterCallback: function allowEnterCallback(props) {
|
7239 | return props.transitionEnter || props.animation.enter;
|
7240 | },
|
7241 | allowLeaveCallback: function allowLeaveCallback(props) {
|
7242 | return props.transitionLeave || props.animation.leave;
|
7243 | }
|
7244 | };
|
7245 | exports["default"] = util;
|
7246 | module.exports = exports["default"];
|
7247 |
|
7248 | }),
|
7249 |
|
7250 | (function(module, exports, __webpack_require__) {
|
7251 |
|
7252 | 'use strict';
|
7253 |
|
7254 | Object.defineProperty(exports, "__esModule", {
|
7255 | value: true
|
7256 | });
|
7257 |
|
7258 | var _react = __webpack_require__(1);
|
7259 |
|
7260 | var _react2 = _interopRequireDefault(_react);
|
7261 |
|
7262 | var _classnames = __webpack_require__(5);
|
7263 |
|
7264 | var _classnames2 = _interopRequireDefault(_classnames);
|
7265 |
|
7266 | var _propTypes = __webpack_require__(6);
|
7267 |
|
7268 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7269 |
|
7270 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7271 |
|
7272 | 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; }
|
7273 |
|
7274 | 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; }
|
7275 |
|
7276 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7277 |
|
7278 | 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; }
|
7279 |
|
7280 | 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); }
|
7281 |
|
7282 | var propTypes = {
|
7283 | duration: _propTypes2["default"].number,
|
7284 | onClose: _propTypes2["default"].func,
|
7285 | children: _propTypes2["default"].any,
|
7286 | color: _propTypes2["default"].oneOf(['info', 'success', 'danger', 'warning', 'light', 'dark', 'news', 'infolight', 'successlight', 'dangerlight', 'warninglight']),
|
7287 | title: _propTypes2["default"].any
|
7288 | };
|
7289 |
|
7290 | function noop() {}
|
7291 |
|
7292 | var defaultProps = {
|
7293 | onEnd: noop,
|
7294 | onClose: noop,
|
7295 | duration: 4.5,
|
7296 | closable: true
|
7297 | };
|
7298 |
|
7299 | var Notice = function (_React$Component) {
|
7300 | _inherits(Notice, _React$Component);
|
7301 |
|
7302 | function Notice(props) {
|
7303 | _classCallCheck(this, Notice);
|
7304 |
|
7305 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
7306 |
|
7307 | _this.clearCloseTimer = _this.clearCloseTimer.bind(_this);
|
7308 | _this.close = _this.close.bind(_this);
|
7309 | return _this;
|
7310 | }
|
7311 |
|
7312 | Notice.prototype.componentDidMount = function componentDidMount() {
|
7313 | var _this2 = this;
|
7314 |
|
7315 | if (this.props.duration) {
|
7316 | this.closeTimer = setTimeout(function () {
|
7317 | _this2.close();
|
7318 | }, this.props.duration * 1000);
|
7319 | }
|
7320 | };
|
7321 |
|
7322 | Notice.prototype.componentWillUnmount = function componentWillUnmount() {
|
7323 | this.clearCloseTimer();
|
7324 | };
|
7325 |
|
7326 | Notice.prototype.clearCloseTimer = function clearCloseTimer() {
|
7327 | if (this.closeTimer) {
|
7328 | clearTimeout(this.closeTimer);
|
7329 | this.closeTimer = null;
|
7330 | }
|
7331 | };
|
7332 |
|
7333 | Notice.prototype.close = function close() {
|
7334 | this.clearCloseTimer();
|
7335 | this.props.onClose();
|
7336 | };
|
7337 |
|
7338 | Notice.prototype.render = function render() {
|
7339 | var _classes;
|
7340 |
|
7341 | var _props = this.props,
|
7342 | closable = _props.closable,
|
7343 | clsPrefix = _props.clsPrefix,
|
7344 | className = _props.className,
|
7345 | style = _props.style,
|
7346 | children = _props.children,
|
7347 | color = _props.color,
|
7348 | title = _props.title;
|
7349 |
|
7350 | var componentClass = clsPrefix + '-notice';
|
7351 | var classes = (_classes = {}, _defineProperty(_classes, '' + componentClass, 1), _defineProperty(_classes, componentClass + '-closable', closable), _defineProperty(_classes, className, !!className), _classes);
|
7352 | if (color) {
|
7353 | classes[componentClass + '-' + color] = true;
|
7354 | }
|
7355 | return _react2["default"].createElement(
|
7356 | 'div',
|
7357 | { className: (0, _classnames2["default"])(classes), style: style, onClick: this.close },
|
7358 | _react2["default"].createElement(
|
7359 | 'div',
|
7360 | { className: componentClass + '-content' },
|
7361 | title && _react2["default"].createElement(
|
7362 | 'div',
|
7363 | { className: componentClass + '-title' },
|
7364 | title
|
7365 | ),
|
7366 | _react2["default"].createElement(
|
7367 | 'div',
|
7368 | { className: componentClass + '-description' },
|
7369 | children
|
7370 | )
|
7371 | ),
|
7372 | closable ? _react2["default"].createElement(
|
7373 | 'a',
|
7374 | { tabIndex: '0', onClick: this.close, className: componentClass + '-close' },
|
7375 | _react2["default"].createElement('span', { className: componentClass + '-close-x' })
|
7376 | ) : null
|
7377 | );
|
7378 | };
|
7379 |
|
7380 | return Notice;
|
7381 | }(_react2["default"].Component);
|
7382 |
|
7383 | ;
|
7384 |
|
7385 | Notice.propTypes = propTypes;
|
7386 | Notice.defaultProps = defaultProps;
|
7387 |
|
7388 | exports["default"] = Notice;
|
7389 | module.exports = exports['default'];
|
7390 |
|
7391 | }),
|
7392 |
|
7393 | (function(module, exports, __webpack_require__) {
|
7394 |
|
7395 | 'use strict';
|
7396 |
|
7397 | var deselectCurrent = __webpack_require__(76);
|
7398 |
|
7399 | var defaultMessage = 'Copy to clipboard: #{key}, Enter';
|
7400 |
|
7401 | function format(message) {
|
7402 | var copyKey = (/mac os x/i.test(navigator.userAgent) ? '⌘' : 'Ctrl') + '+C';
|
7403 | return message.replace(/#{\s*key\s*}/g, copyKey);
|
7404 | }
|
7405 |
|
7406 | function copy(text, options) {
|
7407 | var debug, message, reselectPrevious, range, selection, mark, success = false;
|
7408 | if (!options) { options = {}; }
|
7409 | debug = options.debug || false;
|
7410 | try {
|
7411 | reselectPrevious = deselectCurrent();
|
7412 |
|
7413 | range = document.createRange();
|
7414 | selection = document.getSelection();
|
7415 |
|
7416 | mark = document.createElement('span');
|
7417 | mark.textContent = text;
|
7418 |
|
7419 | mark.style.all = 'unset';
|
7420 |
|
7421 | mark.style.position = 'fixed';
|
7422 | mark.style.top = 0;
|
7423 | mark.style.clip = 'rect(0, 0, 0, 0)';
|
7424 |
|
7425 | mark.style.whiteSpace = 'pre';
|
7426 |
|
7427 | mark.style.webkitUserSelect = 'text';
|
7428 | mark.style.MozUserSelect = 'text';
|
7429 | mark.style.msUserSelect = 'text';
|
7430 | mark.style.userSelect = 'text';
|
7431 |
|
7432 | document.body.appendChild(mark);
|
7433 |
|
7434 | range.selectNode(mark);
|
7435 | selection.addRange(range);
|
7436 |
|
7437 | var successful = document.execCommand('copy');
|
7438 | if (!successful) {
|
7439 | throw new Error('copy command was unsuccessful');
|
7440 | }
|
7441 | success = true;
|
7442 | } catch (err) {
|
7443 | debug && console.error('unable to copy using execCommand: ', err);
|
7444 | debug && console.warn('trying IE specific stuff');
|
7445 | try {
|
7446 | window.clipboardData.setData('text', text);
|
7447 | success = true;
|
7448 | } catch (err) {
|
7449 | debug && console.error('unable to copy using clipboardData: ', err);
|
7450 | debug && console.error('falling back to prompt');
|
7451 | message = format('message' in options ? options.message : defaultMessage);
|
7452 | window.prompt(message, text);
|
7453 | }
|
7454 | } finally {
|
7455 | if (selection) {
|
7456 | if (typeof selection.removeRange == 'function') {
|
7457 | selection.removeRange(range);
|
7458 | } else {
|
7459 | selection.removeAllRanges();
|
7460 | }
|
7461 | }
|
7462 |
|
7463 | if (mark) {
|
7464 | document.body.removeChild(mark);
|
7465 | }
|
7466 | reselectPrevious();
|
7467 | }
|
7468 |
|
7469 | return success;
|
7470 | }
|
7471 |
|
7472 | module.exports = copy;
|
7473 |
|
7474 |
|
7475 | }),
|
7476 |
|
7477 | (function(module, exports) {
|
7478 |
|
7479 |
|
7480 | module.exports = function () {
|
7481 | var selection = document.getSelection();
|
7482 | if (!selection.rangeCount) {
|
7483 | return function () {};
|
7484 | }
|
7485 | var active = document.activeElement;
|
7486 |
|
7487 | var ranges = [];
|
7488 | for (var i = 0; i < selection.rangeCount; i++) {
|
7489 | ranges.push(selection.getRangeAt(i));
|
7490 | }
|
7491 |
|
7492 | switch (active.tagName.toUpperCase()) {
|
7493 | case 'INPUT':
|
7494 | case 'TEXTAREA':
|
7495 | active.blur();
|
7496 | break;
|
7497 |
|
7498 | default:
|
7499 | active = null;
|
7500 | break;
|
7501 | }
|
7502 |
|
7503 | selection.removeAllRanges();
|
7504 | return function () {
|
7505 | selection.type === 'Caret' &&
|
7506 | selection.removeAllRanges();
|
7507 |
|
7508 | if (!selection.rangeCount) {
|
7509 | ranges.forEach(function(range) {
|
7510 | selection.addRange(range);
|
7511 | });
|
7512 | }
|
7513 |
|
7514 | active &&
|
7515 | active.focus();
|
7516 | };
|
7517 | };
|
7518 |
|
7519 |
|
7520 | }),
|
7521 |
|
7522 | (function(module, exports, __webpack_require__) {
|
7523 |
|
7524 | 'use strict';
|
7525 |
|
7526 | Object.defineProperty(exports, "__esModule", {
|
7527 | value: true
|
7528 | });
|
7529 |
|
7530 | 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; };
|
7531 |
|
7532 | var _classnames = __webpack_require__(5);
|
7533 |
|
7534 | var _classnames2 = _interopRequireDefault(_classnames);
|
7535 |
|
7536 | var _react = __webpack_require__(1);
|
7537 |
|
7538 | var _react2 = _interopRequireDefault(_react);
|
7539 |
|
7540 | var _propTypes = __webpack_require__(6);
|
7541 |
|
7542 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7543 |
|
7544 | var _tinperBeeCore = __webpack_require__(27);
|
7545 |
|
7546 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7547 |
|
7548 | 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; }
|
7549 |
|
7550 | 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; }
|
7551 |
|
7552 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7553 |
|
7554 | 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; }
|
7555 |
|
7556 | 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); }
|
7557 |
|
7558 | var propTypes = {
|
7559 |
|
7560 | accordion: _propTypes2["default"].bool,
|
7561 |
|
7562 | activeKey: _propTypes2["default"].any,
|
7563 |
|
7564 | defaultActiveKey: _propTypes2["default"].any,
|
7565 |
|
7566 | onSelect: _propTypes2["default"].func,
|
7567 | role: _propTypes2["default"].string
|
7568 | };
|
7569 |
|
7570 | var defaultProps = {
|
7571 | accordion: false,
|
7572 | clsPrefix: 'u-panel-group'
|
7573 | };
|
7574 |
|
7575 |
|
7576 |
|
7577 | var PanelGroup = function (_React$Component) {
|
7578 | _inherits(PanelGroup, _React$Component);
|
7579 |
|
7580 | function PanelGroup(props, context) {
|
7581 | _classCallCheck(this, PanelGroup);
|
7582 |
|
7583 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
7584 |
|
7585 | _this.handleSelect = _this.handleSelect.bind(_this);
|
7586 |
|
7587 | _this.state = {
|
7588 | activeKey: props.defaultActiveKey
|
7589 | };
|
7590 | return _this;
|
7591 | }
|
7592 |
|
7593 | PanelGroup.prototype.handleSelect = function handleSelect(key, e) {
|
7594 | e.preventDefault();
|
7595 |
|
7596 | if (this.props.onSelect) {
|
7597 | this.props.onSelect(key, e);
|
7598 | }
|
7599 |
|
7600 | if (this.state.activeKey === key) {
|
7601 | key = null;
|
7602 | }
|
7603 |
|
7604 | this.setState({ activeKey: key });
|
7605 | };
|
7606 |
|
7607 | PanelGroup.prototype.render = function render() {
|
7608 | var _this2 = this;
|
7609 |
|
7610 | var _props = this.props,
|
7611 | accordion = _props.accordion,
|
7612 | propsActiveKey = _props.activeKey,
|
7613 | className = _props.className,
|
7614 | children = _props.children,
|
7615 | defaultActiveKey = _props.defaultActiveKey,
|
7616 | onSelect = _props.onSelect,
|
7617 | style = _props.style,
|
7618 | clsPrefix = _props.clsPrefix,
|
7619 | others = _objectWithoutProperties(_props, ['accordion', 'activeKey', 'className', 'children', 'defaultActiveKey', 'onSelect', 'style', 'clsPrefix']);
|
7620 |
|
7621 | var activeKey = void 0;
|
7622 | if (accordion) {
|
7623 | activeKey = propsActiveKey != null ? propsActiveKey : this.state.activeKey;
|
7624 | others.role = others.role || 'tablist';
|
7625 | }
|
7626 |
|
7627 | var classes = {};
|
7628 | classes['' + clsPrefix] = true;
|
7629 |
|
7630 | return _react2["default"].createElement(
|
7631 | 'div',
|
7632 | _extends({}, others, {
|
7633 | className: (0, _classnames2["default"])(className, classes)
|
7634 | }),
|
7635 | _react2["default"].Children.map(children, function (child) {
|
7636 | if (!_react2["default"].isValidElement(child)) {
|
7637 | return child;
|
7638 | }
|
7639 | var childProps = {
|
7640 | style: child.props.style
|
7641 | };
|
7642 |
|
7643 | if (accordion) {
|
7644 | _extends(childProps, {
|
7645 | headerRole: 'tab',
|
7646 | panelRole: 'tabpanel',
|
7647 | collapsible: true,
|
7648 | expanded: child.props.eventKey === activeKey,
|
7649 | onSelect: (0, _tinperBeeCore.createChainedFunction)(_this2.handleSelect, child.props.onSelect)
|
7650 | });
|
7651 | }
|
7652 |
|
7653 | return (0, _react.cloneElement)(child, childProps);
|
7654 | })
|
7655 | );
|
7656 | };
|
7657 |
|
7658 | return PanelGroup;
|
7659 | }(_react2["default"].Component);
|
7660 |
|
7661 | PanelGroup.propTypes = propTypes;
|
7662 | PanelGroup.defaultProps = defaultProps;
|
7663 |
|
7664 | exports["default"] = PanelGroup;
|
7665 | module.exports = exports['default'];
|
7666 |
|
7667 | }),
|
7668 |
|
7669 | (function(module, exports, __webpack_require__) {
|
7670 |
|
7671 | 'use strict';
|
7672 |
|
7673 | Object.defineProperty(exports, "__esModule", {
|
7674 | value: true
|
7675 | });
|
7676 |
|
7677 | var _Drawer = __webpack_require__(79);
|
7678 |
|
7679 | var _Drawer2 = _interopRequireDefault(_Drawer);
|
7680 |
|
7681 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7682 |
|
7683 | exports["default"] = _Drawer2["default"];
|
7684 | module.exports = exports['default'];
|
7685 |
|
7686 | }),
|
7687 |
|
7688 | (function(module, exports, __webpack_require__) {
|
7689 |
|
7690 | 'use strict';
|
7691 |
|
7692 | Object.defineProperty(exports, "__esModule", {
|
7693 | value: true
|
7694 | });
|
7695 |
|
7696 | var _react = __webpack_require__(1);
|
7697 |
|
7698 | var _react2 = _interopRequireDefault(_react);
|
7699 |
|
7700 | var _reactDom = __webpack_require__(2);
|
7701 |
|
7702 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7703 |
|
7704 | var _propTypes = __webpack_require__(6);
|
7705 |
|
7706 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7707 |
|
7708 | var _classnames = __webpack_require__(5);
|
7709 |
|
7710 | var _classnames2 = _interopRequireDefault(_classnames);
|
7711 |
|
7712 | var _common = __webpack_require__(80);
|
7713 |
|
7714 | var _reactTransitionGroup = __webpack_require__(81);
|
7715 |
|
7716 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7717 |
|
7718 | 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; }
|
7719 |
|
7720 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7721 |
|
7722 | 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; }
|
7723 |
|
7724 | 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); }
|
7725 |
|
7726 | var propTypes = {
|
7727 | placement: _propTypes2["default"].oneOf(['left', 'right', 'top', 'bottom']),
|
7728 | hasHeader: _propTypes2["default"].bool,
|
7729 | show: _propTypes2["default"].bool,
|
7730 | title: _propTypes2["default"].string,
|
7731 | className: _propTypes2["default"].string,
|
7732 | showMask: _propTypes2["default"].bool,
|
7733 | maskClosable: _propTypes2["default"].bool,
|
7734 | zIndex: _propTypes2["default"].number,
|
7735 | showClose: _propTypes2["default"].bool,
|
7736 | width: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
7737 | height: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
7738 | destroyOnClose: _propTypes2["default"].bool,
|
7739 | container: _propTypes2["default"].string
|
7740 | };
|
7741 |
|
7742 | var defaultProps = {
|
7743 | placement: 'left',
|
7744 | hasHeader: true,
|
7745 | show: false,
|
7746 | showMask: true,
|
7747 | maskClosable: true,
|
7748 | zIndex: 100000,
|
7749 | showClose: false,
|
7750 | width: 'auto',
|
7751 | height: 'auto',
|
7752 | destroyOnClose: false,
|
7753 | container: 'body'
|
7754 | };
|
7755 |
|
7756 | var DrawerContext = _react2["default"].createContext(null);
|
7757 |
|
7758 | var Drawer = function (_Component) {
|
7759 | _inherits(Drawer, _Component);
|
7760 |
|
7761 | function Drawer(props) {
|
7762 | _classCallCheck(this, Drawer);
|
7763 |
|
7764 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
7765 |
|
7766 | _this.state = {
|
7767 | showDrawer: true,
|
7768 | width: '0',
|
7769 | push: false
|
7770 | };
|
7771 | _this.drawer = null;
|
7772 | _this.parentDrawer = null;
|
7773 | (0, _common.bindAll)(_this, ['fMaskClick', 'fDrawerTransitionEnd', 'renderMask', 'renderClose', 'fCloseClick', 'renderBody', 'renderAll']);
|
7774 | return _this;
|
7775 | }
|
7776 |
|
7777 | Drawer.prototype.componentDidUpdate = function componentDidUpdate(preProps) {
|
7778 |
|
7779 | if (preProps.show != this.props.show && this.parentDrawer) {
|
7780 | if (this.props.show) {
|
7781 | this.parentDrawer.push();
|
7782 | } else {
|
7783 | this.parentDrawer.pull();
|
7784 | }
|
7785 | }
|
7786 | };
|
7787 |
|
7788 | Drawer.prototype.push = function push() {
|
7789 | this.setState({
|
7790 | push: true
|
7791 | });
|
7792 | };
|
7793 |
|
7794 | Drawer.prototype.pull = function pull() {
|
7795 | this.setState({
|
7796 | push: false
|
7797 | });
|
7798 | };
|
7799 |
|
7800 | Drawer.prototype.fMaskClick = function fMaskClick() {
|
7801 | var maskClosable = this.props.maskClosable;
|
7802 |
|
7803 | if (maskClosable) {
|
7804 | var onClose = this.props.onClose;
|
7805 |
|
7806 | onClose && onClose();
|
7807 | }
|
7808 | };
|
7809 |
|
7810 | Drawer.prototype.fCloseClick = function fCloseClick() {
|
7811 | var onClose = this.props.onClose;
|
7812 |
|
7813 | onClose && onClose();
|
7814 | };
|
7815 |
|
7816 | Drawer.prototype.fDrawerTransitionEnd = function fDrawerTransitionEnd(e) {};
|
7817 |
|
7818 | Drawer.prototype.renderMask = function renderMask() {
|
7819 | var _props = this.props,
|
7820 | show = _props.show,
|
7821 | showMask = _props.showMask,
|
7822 | fMaskClick = _props.fMaskClick;
|
7823 |
|
7824 |
|
7825 | var maskStyle = void 0;
|
7826 | if (show) {
|
7827 | maskStyle = {
|
7828 | opacity: 1,
|
7829 | width: '100%'
|
7830 | };
|
7831 | } else {
|
7832 | maskStyle = {
|
7833 | opacity: 0,
|
7834 | width: 0
|
7835 | };
|
7836 | }
|
7837 | return showMask ? _react2["default"].createElement('div', { className: 'drawer-mask', style: maskStyle, onClick: this.fMaskClick }) : null;
|
7838 | };
|
7839 |
|
7840 | Drawer.prototype.renderClose = function renderClose() {
|
7841 | var showClose = this.props.showClose;
|
7842 |
|
7843 | return showClose ? _react2["default"].createElement(
|
7844 | 'i',
|
7845 | { className: 'drawer-close', onClick: this.fCloseClick },
|
7846 | '\xD7'
|
7847 | ) : null;
|
7848 | };
|
7849 |
|
7850 | Drawer.prototype.renderBody = function renderBody() {
|
7851 | var _this2 = this;
|
7852 |
|
7853 | var _props2 = this.props,
|
7854 | destroyOnClose = _props2.destroyOnClose,
|
7855 | show = _props2.show;
|
7856 |
|
7857 | if (destroyOnClose && !show) {
|
7858 | return null;
|
7859 | }
|
7860 | var _props3 = this.props,
|
7861 | hasHeader = _props3.hasHeader,
|
7862 | title = _props3.title,
|
7863 | children = _props3.children,
|
7864 | width = _props3.width,
|
7865 | height = _props3.height,
|
7866 | placement = _props3.placement;
|
7867 | var push = this.state.push;
|
7868 |
|
7869 |
|
7870 | var drawerClass = (0, _classnames2["default"])('drawer', 'drawer-' + placement);
|
7871 |
|
7872 | var translateHideMap = {
|
7873 | left: 'translateX(-100%)',
|
7874 | right: 'translateX(100%)',
|
7875 | top: 'translateY(-100%)',
|
7876 | bottom: 'translateY(100%)'
|
7877 | };
|
7878 | var translateShow = 'translate(0,0)';
|
7879 | if (push) {
|
7880 | var pushNum = 50;
|
7881 | var translateShowMap = {
|
7882 | left: 'translate(' + pushNum + 'px,0)',
|
7883 | right: 'translate(-' + pushNum + 'px,0)',
|
7884 | top: 'translate(0,' + pushNum + 'px)',
|
7885 | bottom: 'translate(0,-' + pushNum + 'px)'
|
7886 | };
|
7887 | translateShow = translateShowMap[placement];
|
7888 | }
|
7889 | var translate = show ? translateShow : translateHideMap[placement];
|
7890 |
|
7891 | if ((0, _common.isNumber)(width)) {
|
7892 | width = width + 'px';
|
7893 | }
|
7894 | if ((0, _common.isNumber)(height)) {
|
7895 | height = height + 'px';
|
7896 | }
|
7897 | if (placement == 'top' || placement == 'bottom') {
|
7898 | if (width == 'auto') {
|
7899 | width = '100%';
|
7900 | }
|
7901 | }
|
7902 | if (placement == 'left' || placement == 'right') {
|
7903 | if (height == 'auto') {
|
7904 | height = '100%';
|
7905 | }
|
7906 | }
|
7907 | var drawerStyle = {
|
7908 | transform: translate,
|
7909 | WebkitTransform: translate,
|
7910 | width: width,
|
7911 | height: height
|
7912 | };
|
7913 | var closer = this.renderClose();
|
7914 | var header = hasHeader ? _react2["default"].createElement(
|
7915 | 'div',
|
7916 | { className: 'drawer-header' },
|
7917 | _react2["default"].createElement(
|
7918 | 'div',
|
7919 | { className: 'drawer-header-title' },
|
7920 | title
|
7921 | )
|
7922 | ) : '';
|
7923 | return _react2["default"].createElement(
|
7924 | DrawerContext.Provider,
|
7925 | { value: this },
|
7926 | _react2["default"].createElement(
|
7927 | 'div',
|
7928 | { ref: function ref(drawer) {
|
7929 | _this2.drawer = drawer;
|
7930 | }, onTransitionEnd: this.fDrawerTransitionEnd, className: drawerClass, style: drawerStyle },
|
7931 | closer,
|
7932 | header,
|
7933 | _react2["default"].createElement(
|
7934 | 'div',
|
7935 | { className: 'drawer-body' },
|
7936 | children
|
7937 | )
|
7938 | )
|
7939 | );
|
7940 | };
|
7941 |
|
7942 | Drawer.prototype.renderAll = function renderAll(value) {
|
7943 | var _props4 = this.props,
|
7944 | show = _props4.show,
|
7945 | className = _props4.className,
|
7946 | zIndex = _props4.zIndex;
|
7947 |
|
7948 |
|
7949 | var drawercClass = (0, _classnames2["default"])('drawerc', className);
|
7950 |
|
7951 | var drawercStyle = { zIndex: zIndex };
|
7952 | if (show) {
|
7953 | drawercStyle.width = '100%';
|
7954 | } else {
|
7955 | drawercStyle.width = 0;
|
7956 | }
|
7957 |
|
7958 | this.parentDrawer = value;
|
7959 |
|
7960 | return _react2["default"].createElement(
|
7961 | 'div',
|
7962 | { className: drawercClass, style: drawercStyle },
|
7963 | this.renderMask(),
|
7964 | this.renderBody()
|
7965 | );
|
7966 | };
|
7967 |
|
7968 | Drawer.prototype.render = function render() {
|
7969 | var container = this.props.container;
|
7970 |
|
7971 | var conDom = document.querySelector(container);
|
7972 |
|
7973 | return _reactDom2["default"].createPortal(_react2["default"].createElement(
|
7974 | DrawerContext.Consumer,
|
7975 | null,
|
7976 | this.renderAll
|
7977 | ), conDom);
|
7978 | };
|
7979 |
|
7980 | return Drawer;
|
7981 | }(_react.Component);
|
7982 |
|
7983 | Drawer.propTypes = propTypes;
|
7984 | Drawer.defaultProps = defaultProps;
|
7985 |
|
7986 | exports["default"] = Drawer;
|
7987 | module.exports = exports['default'];
|
7988 |
|
7989 | }),
|
7990 |
|
7991 | (function(module, exports) {
|
7992 |
|
7993 | 'use strict';
|
7994 |
|
7995 | Object.defineProperty(exports, "__esModule", {
|
7996 | value: true
|
7997 | });
|
7998 | exports.bindAll = bindAll;
|
7999 | exports.type = type;
|
8000 | exports.isNumber = isNumber;
|
8001 | function bindAll(context, arrFunc) {
|
8002 | arrFunc.forEach(function (item) {
|
8003 | context[item] = context[item].bind(context);
|
8004 | });
|
8005 | }
|
8006 |
|
8007 | function type(obj) {
|
8008 | var toString = Object.prototype.toString;
|
8009 | return toString.call(obj);
|
8010 | }
|
8011 |
|
8012 | function isNumber(obj) {
|
8013 | return type(obj) == '[object Number]';
|
8014 | }
|
8015 |
|
8016 | }),
|
8017 |
|
8018 | (function(module, exports, __webpack_require__) {
|
8019 |
|
8020 | "use strict";
|
8021 |
|
8022 | var _CSSTransition = _interopRequireDefault(__webpack_require__(82));
|
8023 |
|
8024 | var _ReplaceTransition = _interopRequireDefault(__webpack_require__(89));
|
8025 |
|
8026 | var _TransitionGroup = _interopRequireDefault(__webpack_require__(90));
|
8027 |
|
8028 | var _Transition = _interopRequireDefault(__webpack_require__(86));
|
8029 |
|
8030 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8031 |
|
8032 | module.exports = {
|
8033 | Transition: _Transition.default,
|
8034 | TransitionGroup: _TransitionGroup.default,
|
8035 | ReplaceTransition: _ReplaceTransition.default,
|
8036 | CSSTransition: _CSSTransition.default
|
8037 | };
|
8038 |
|
8039 | }),
|
8040 |
|
8041 | (function(module, exports, __webpack_require__) {
|
8042 |
|
8043 | (function(process) {"use strict";
|
8044 |
|
8045 | exports.__esModule = true;
|
8046 | exports.default = void 0;
|
8047 |
|
8048 | var PropTypes = _interopRequireWildcard(__webpack_require__(6));
|
8049 |
|
8050 | var _addClass = _interopRequireDefault(__webpack_require__(83));
|
8051 |
|
8052 | var _removeClass = _interopRequireDefault(__webpack_require__(85));
|
8053 |
|
8054 | var _react = _interopRequireDefault(__webpack_require__(1));
|
8055 |
|
8056 | var _Transition = _interopRequireDefault(__webpack_require__(86));
|
8057 |
|
8058 | var _PropTypes = __webpack_require__(88);
|
8059 |
|
8060 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8061 |
|
8062 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
8063 |
|
8064 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
8065 |
|
8066 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
8067 |
|
8068 | var addClass = function addClass(node, classes) {
|
8069 | return node && classes && classes.split(' ').forEach(function (c) {
|
8070 | return (0, _addClass.default)(node, c);
|
8071 | });
|
8072 | };
|
8073 |
|
8074 | var removeClass = function removeClass(node, classes) {
|
8075 | return node && classes && classes.split(' ').forEach(function (c) {
|
8076 | return (0, _removeClass.default)(node, c);
|
8077 | });
|
8078 | };
|
8079 | |
8080 |
|
8081 |
|
8082 |
|
8083 |
|
8084 |
|
8085 |
|
8086 |
|
8087 |
|
8088 |
|
8089 |
|
8090 |
|
8091 |
|
8092 |
|
8093 |
|
8094 | var CSSTransition =
|
8095 |
|
8096 | function (_React$Component) {
|
8097 | _inheritsLoose(CSSTransition, _React$Component);
|
8098 |
|
8099 | function CSSTransition() {
|
8100 | var _this;
|
8101 |
|
8102 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
8103 | args[_key] = arguments[_key];
|
8104 | }
|
8105 |
|
8106 | _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
8107 |
|
8108 | _this.onEnter = function (node, appearing) {
|
8109 | var _this$getClassNames = _this.getClassNames(appearing ? 'appear' : 'enter'),
|
8110 | className = _this$getClassNames.className;
|
8111 |
|
8112 | _this.removeClasses(node, 'exit');
|
8113 |
|
8114 | addClass(node, className);
|
8115 |
|
8116 | if (_this.props.onEnter) {
|
8117 | _this.props.onEnter(node, appearing);
|
8118 | }
|
8119 | };
|
8120 |
|
8121 | _this.onEntering = function (node, appearing) {
|
8122 | var _this$getClassNames2 = _this.getClassNames(appearing ? 'appear' : 'enter'),
|
8123 | activeClassName = _this$getClassNames2.activeClassName;
|
8124 |
|
8125 | _this.reflowAndAddClass(node, activeClassName);
|
8126 |
|
8127 | if (_this.props.onEntering) {
|
8128 | _this.props.onEntering(node, appearing);
|
8129 | }
|
8130 | };
|
8131 |
|
8132 | _this.onEntered = function (node, appearing) {
|
8133 | var _this$getClassNames3 = _this.getClassNames('enter'),
|
8134 | doneClassName = _this$getClassNames3.doneClassName;
|
8135 |
|
8136 | _this.removeClasses(node, appearing ? 'appear' : 'enter');
|
8137 |
|
8138 | addClass(node, doneClassName);
|
8139 |
|
8140 | if (_this.props.onEntered) {
|
8141 | _this.props.onEntered(node, appearing);
|
8142 | }
|
8143 | };
|
8144 |
|
8145 | _this.onExit = function (node) {
|
8146 | var _this$getClassNames4 = _this.getClassNames('exit'),
|
8147 | className = _this$getClassNames4.className;
|
8148 |
|
8149 | _this.removeClasses(node, 'appear');
|
8150 |
|
8151 | _this.removeClasses(node, 'enter');
|
8152 |
|
8153 | addClass(node, className);
|
8154 |
|
8155 | if (_this.props.onExit) {
|
8156 | _this.props.onExit(node);
|
8157 | }
|
8158 | };
|
8159 |
|
8160 | _this.onExiting = function (node) {
|
8161 | var _this$getClassNames5 = _this.getClassNames('exit'),
|
8162 | activeClassName = _this$getClassNames5.activeClassName;
|
8163 |
|
8164 | _this.reflowAndAddClass(node, activeClassName);
|
8165 |
|
8166 | if (_this.props.onExiting) {
|
8167 | _this.props.onExiting(node);
|
8168 | }
|
8169 | };
|
8170 |
|
8171 | _this.onExited = function (node) {
|
8172 | var _this$getClassNames6 = _this.getClassNames('exit'),
|
8173 | doneClassName = _this$getClassNames6.doneClassName;
|
8174 |
|
8175 | _this.removeClasses(node, 'exit');
|
8176 |
|
8177 | addClass(node, doneClassName);
|
8178 |
|
8179 | if (_this.props.onExited) {
|
8180 | _this.props.onExited(node);
|
8181 | }
|
8182 | };
|
8183 |
|
8184 | _this.getClassNames = function (type) {
|
8185 | var classNames = _this.props.classNames;
|
8186 | var className = typeof classNames !== 'string' ? classNames[type] : classNames + '-' + type;
|
8187 | var activeClassName = typeof classNames !== 'string' ? classNames[type + 'Active'] : className + '-active';
|
8188 | var doneClassName = typeof classNames !== 'string' ? classNames[type + 'Done'] : className + '-done';
|
8189 | return {
|
8190 | className: className,
|
8191 | activeClassName: activeClassName,
|
8192 | doneClassName: doneClassName
|
8193 | };
|
8194 | };
|
8195 |
|
8196 | return _this;
|
8197 | }
|
8198 |
|
8199 | var _proto = CSSTransition.prototype;
|
8200 |
|
8201 | _proto.removeClasses = function removeClasses(node, type) {
|
8202 | var _this$getClassNames7 = this.getClassNames(type),
|
8203 | className = _this$getClassNames7.className,
|
8204 | activeClassName = _this$getClassNames7.activeClassName,
|
8205 | doneClassName = _this$getClassNames7.doneClassName;
|
8206 |
|
8207 | className && removeClass(node, className);
|
8208 | activeClassName && removeClass(node, activeClassName);
|
8209 | doneClassName && removeClass(node, doneClassName);
|
8210 | };
|
8211 |
|
8212 | _proto.reflowAndAddClass = function reflowAndAddClass(node, className) {
|
8213 |
|
8214 |
|
8215 | if (className) {
|
8216 |
|
8217 | node && node.scrollTop;
|
8218 |
|
8219 |
|
8220 | addClass(node, className);
|
8221 | }
|
8222 | };
|
8223 |
|
8224 | _proto.render = function render() {
|
8225 | var props = _extends({}, this.props);
|
8226 |
|
8227 | delete props.classNames;
|
8228 | return _react.default.createElement(_Transition.default, _extends({}, props, {
|
8229 | onEnter: this.onEnter,
|
8230 | onEntered: this.onEntered,
|
8231 | onEntering: this.onEntering,
|
8232 | onExit: this.onExit,
|
8233 | onExiting: this.onExiting,
|
8234 | onExited: this.onExited
|
8235 | }));
|
8236 | };
|
8237 |
|
8238 | return CSSTransition;
|
8239 | }(_react.default.Component);
|
8240 |
|
8241 | CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, _Transition.default.propTypes, {
|
8242 | |
8243 |
|
8244 |
|
8245 |
|
8246 |
|
8247 |
|
8248 |
|
8249 |
|
8250 |
|
8251 |
|
8252 |
|
8253 |
|
8254 |
|
8255 |
|
8256 |
|
8257 |
|
8258 |
|
8259 |
|
8260 |
|
8261 |
|
8262 |
|
8263 |
|
8264 |
|
8265 |
|
8266 |
|
8267 |
|
8268 |
|
8269 |
|
8270 |
|
8271 |
|
8272 |
|
8273 |
|
8274 |
|
8275 |
|
8276 |
|
8277 |
|
8278 |
|
8279 |
|
8280 |
|
8281 |
|
8282 |
|
8283 |
|
8284 |
|
8285 |
|
8286 |
|
8287 | classNames: _PropTypes.classNamesShape,
|
8288 |
|
8289 | |
8290 |
|
8291 |
|
8292 |
|
8293 |
|
8294 |
|
8295 | onEnter: PropTypes.func,
|
8296 |
|
8297 | |
8298 |
|
8299 |
|
8300 |
|
8301 |
|
8302 |
|
8303 | onEntering: PropTypes.func,
|
8304 |
|
8305 | |
8306 |
|
8307 |
|
8308 |
|
8309 |
|
8310 |
|
8311 | onEntered: PropTypes.func,
|
8312 |
|
8313 | |
8314 |
|
8315 |
|
8316 |
|
8317 |
|
8318 |
|
8319 | onExit: PropTypes.func,
|
8320 |
|
8321 | |
8322 |
|
8323 |
|
8324 |
|
8325 |
|
8326 | onExiting: PropTypes.func,
|
8327 |
|
8328 | |
8329 |
|
8330 |
|
8331 |
|
8332 |
|
8333 |
|
8334 | onExited: PropTypes.func
|
8335 | }) : {};
|
8336 | var _default = CSSTransition;
|
8337 | exports.default = _default;
|
8338 | module.exports = exports["default"];
|
8339 | }.call(exports, __webpack_require__(33)))
|
8340 |
|
8341 | }),
|
8342 |
|
8343 | (function(module, exports, __webpack_require__) {
|
8344 |
|
8345 | "use strict";
|
8346 |
|
8347 | var _interopRequireDefault = __webpack_require__(14);
|
8348 |
|
8349 | exports.__esModule = true;
|
8350 | exports.default = addClass;
|
8351 |
|
8352 | var _hasClass = _interopRequireDefault(__webpack_require__(84));
|
8353 |
|
8354 | function addClass(element, className) {
|
8355 | if (element.classList) element.classList.add(className);else if (!(0, _hasClass.default)(element, className)) if (typeof element.className === 'string') element.className = element.className + ' ' + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + ' ' + className);
|
8356 | }
|
8357 |
|
8358 | module.exports = exports["default"];
|
8359 |
|
8360 | }),
|
8361 |
|
8362 | (function(module, exports) {
|
8363 |
|
8364 | "use strict";
|
8365 |
|
8366 | exports.__esModule = true;
|
8367 | exports.default = hasClass;
|
8368 |
|
8369 | function hasClass(element, className) {
|
8370 | if (element.classList) return !!className && element.classList.contains(className);else return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
|
8371 | }
|
8372 |
|
8373 | module.exports = exports["default"];
|
8374 |
|
8375 | }),
|
8376 |
|
8377 | (function(module, exports) {
|
8378 |
|
8379 | 'use strict';
|
8380 |
|
8381 | function replaceClassName(origClass, classToRemove) {
|
8382 | return origClass.replace(new RegExp('(^|\\s)' + classToRemove + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
|
8383 | }
|
8384 |
|
8385 | module.exports = function removeClass(element, className) {
|
8386 | if (element.classList) element.classList.remove(className);else if (typeof element.className === 'string') element.className = replaceClassName(element.className, className);else element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
|
8387 | };
|
8388 |
|
8389 | }),
|
8390 |
|
8391 | (function(module, exports, __webpack_require__) {
|
8392 |
|
8393 | (function(process) {"use strict";
|
8394 |
|
8395 | exports.__esModule = true;
|
8396 | exports.default = exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = void 0;
|
8397 |
|
8398 | var PropTypes = _interopRequireWildcard(__webpack_require__(6));
|
8399 |
|
8400 | var _react = _interopRequireDefault(__webpack_require__(1));
|
8401 |
|
8402 | var _reactDom = _interopRequireDefault(__webpack_require__(2));
|
8403 |
|
8404 | var _reactLifecyclesCompat = __webpack_require__(87);
|
8405 |
|
8406 | var _PropTypes = __webpack_require__(88);
|
8407 |
|
8408 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8409 |
|
8410 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
8411 |
|
8412 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
8413 |
|
8414 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
8415 |
|
8416 | var UNMOUNTED = 'unmounted';
|
8417 | exports.UNMOUNTED = UNMOUNTED;
|
8418 | var EXITED = 'exited';
|
8419 | exports.EXITED = EXITED;
|
8420 | var ENTERING = 'entering';
|
8421 | exports.ENTERING = ENTERING;
|
8422 | var ENTERED = 'entered';
|
8423 | exports.ENTERED = ENTERED;
|
8424 | var EXITING = 'exiting';
|
8425 | |
8426 |
|
8427 |
|
8428 |
|
8429 |
|
8430 |
|
8431 |
|
8432 |
|
8433 |
|
8434 |
|
8435 |
|
8436 |
|
8437 |
|
8438 |
|
8439 |
|
8440 |
|
8441 |
|
8442 |
|
8443 |
|
8444 |
|
8445 |
|
8446 |
|
8447 |
|
8448 |
|
8449 |
|
8450 |
|
8451 |
|
8452 |
|
8453 |
|
8454 |
|
8455 |
|
8456 |
|
8457 |
|
8458 |
|
8459 |
|
8460 |
|
8461 |
|
8462 |
|
8463 |
|
8464 |
|
8465 |
|
8466 |
|
8467 |
|
8468 |
|
8469 |
|
8470 |
|
8471 |
|
8472 |
|
8473 |
|
8474 |
|
8475 |
|
8476 |
|
8477 |
|
8478 |
|
8479 |
|
8480 |
|
8481 |
|
8482 |
|
8483 |
|
8484 |
|
8485 |
|
8486 |
|
8487 |
|
8488 |
|
8489 |
|
8490 |
|
8491 |
|
8492 |
|
8493 |
|
8494 |
|
8495 |
|
8496 |
|
8497 |
|
8498 |
|
8499 |
|
8500 |
|
8501 |
|
8502 |
|
8503 |
|
8504 |
|
8505 |
|
8506 |
|
8507 |
|
8508 |
|
8509 |
|
8510 |
|
8511 |
|
8512 |
|
8513 |
|
8514 |
|
8515 |
|
8516 |
|
8517 |
|
8518 |
|
8519 |
|
8520 |
|
8521 | exports.EXITING = EXITING;
|
8522 |
|
8523 | var Transition =
|
8524 |
|
8525 | function (_React$Component) {
|
8526 | _inheritsLoose(Transition, _React$Component);
|
8527 |
|
8528 | function Transition(props, context) {
|
8529 | var _this;
|
8530 |
|
8531 | _this = _React$Component.call(this, props, context) || this;
|
8532 | var parentGroup = context.transitionGroup;
|
8533 |
|
8534 | var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
|
8535 | var initialStatus;
|
8536 | _this.appearStatus = null;
|
8537 |
|
8538 | if (props.in) {
|
8539 | if (appear) {
|
8540 | initialStatus = EXITED;
|
8541 | _this.appearStatus = ENTERING;
|
8542 | } else {
|
8543 | initialStatus = ENTERED;
|
8544 | }
|
8545 | } else {
|
8546 | if (props.unmountOnExit || props.mountOnEnter) {
|
8547 | initialStatus = UNMOUNTED;
|
8548 | } else {
|
8549 | initialStatus = EXITED;
|
8550 | }
|
8551 | }
|
8552 |
|
8553 | _this.state = {
|
8554 | status: initialStatus
|
8555 | };
|
8556 | _this.nextCallback = null;
|
8557 | return _this;
|
8558 | }
|
8559 |
|
8560 | var _proto = Transition.prototype;
|
8561 |
|
8562 | _proto.getChildContext = function getChildContext() {
|
8563 | return {
|
8564 | transitionGroup: null
|
8565 |
|
8566 | };
|
8567 | };
|
8568 |
|
8569 | Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
|
8570 | var nextIn = _ref.in;
|
8571 |
|
8572 | if (nextIn && prevState.status === UNMOUNTED) {
|
8573 | return {
|
8574 | status: EXITED
|
8575 | };
|
8576 | }
|
8577 |
|
8578 | return null;
|
8579 | };
|
8580 |
|
8581 |
|
8582 |
|
8583 |
|
8584 |
|
8585 |
|
8586 |
|
8587 |
|
8588 |
|
8589 |
|
8590 |
|
8591 |
|
8592 |
|
8593 |
|
8594 |
|
8595 |
|
8596 |
|
8597 | _proto.componentDidMount = function componentDidMount() {
|
8598 | this.updateStatus(true, this.appearStatus);
|
8599 | };
|
8600 |
|
8601 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
8602 | var nextStatus = null;
|
8603 |
|
8604 | if (prevProps !== this.props) {
|
8605 | var status = this.state.status;
|
8606 |
|
8607 | if (this.props.in) {
|
8608 | if (status !== ENTERING && status !== ENTERED) {
|
8609 | nextStatus = ENTERING;
|
8610 | }
|
8611 | } else {
|
8612 | if (status === ENTERING || status === ENTERED) {
|
8613 | nextStatus = EXITING;
|
8614 | }
|
8615 | }
|
8616 | }
|
8617 |
|
8618 | this.updateStatus(false, nextStatus);
|
8619 | };
|
8620 |
|
8621 | _proto.componentWillUnmount = function componentWillUnmount() {
|
8622 | this.cancelNextCallback();
|
8623 | };
|
8624 |
|
8625 | _proto.getTimeouts = function getTimeouts() {
|
8626 | var timeout = this.props.timeout;
|
8627 | var exit, enter, appear;
|
8628 | exit = enter = appear = timeout;
|
8629 |
|
8630 | if (timeout != null && typeof timeout !== 'number') {
|
8631 | exit = timeout.exit;
|
8632 | enter = timeout.enter;
|
8633 |
|
8634 | appear = timeout.appear !== undefined ? timeout.appear : enter;
|
8635 | }
|
8636 |
|
8637 | return {
|
8638 | exit: exit,
|
8639 | enter: enter,
|
8640 | appear: appear
|
8641 | };
|
8642 | };
|
8643 |
|
8644 | _proto.updateStatus = function updateStatus(mounting, nextStatus) {
|
8645 | if (mounting === void 0) {
|
8646 | mounting = false;
|
8647 | }
|
8648 |
|
8649 | if (nextStatus !== null) {
|
8650 |
|
8651 | this.cancelNextCallback();
|
8652 |
|
8653 | var node = _reactDom.default.findDOMNode(this);
|
8654 |
|
8655 | if (nextStatus === ENTERING) {
|
8656 | this.performEnter(node, mounting);
|
8657 | } else {
|
8658 | this.performExit(node);
|
8659 | }
|
8660 | } else if (this.props.unmountOnExit && this.state.status === EXITED) {
|
8661 | this.setState({
|
8662 | status: UNMOUNTED
|
8663 | });
|
8664 | }
|
8665 | };
|
8666 |
|
8667 | _proto.performEnter = function performEnter(node, mounting) {
|
8668 | var _this2 = this;
|
8669 |
|
8670 | var enter = this.props.enter;
|
8671 | var appearing = this.context.transitionGroup ? this.context.transitionGroup.isMounting : mounting;
|
8672 | var timeouts = this.getTimeouts();
|
8673 | var enterTimeout = appearing ? timeouts.appear : timeouts.enter;
|
8674 |
|
8675 |
|
8676 | if (!mounting && !enter) {
|
8677 | this.safeSetState({
|
8678 | status: ENTERED
|
8679 | }, function () {
|
8680 | _this2.props.onEntered(node);
|
8681 | });
|
8682 | return;
|
8683 | }
|
8684 |
|
8685 | this.props.onEnter(node, appearing);
|
8686 | this.safeSetState({
|
8687 | status: ENTERING
|
8688 | }, function () {
|
8689 | _this2.props.onEntering(node, appearing);
|
8690 |
|
8691 | _this2.onTransitionEnd(node, enterTimeout, function () {
|
8692 | _this2.safeSetState({
|
8693 | status: ENTERED
|
8694 | }, function () {
|
8695 | _this2.props.onEntered(node, appearing);
|
8696 | });
|
8697 | });
|
8698 | });
|
8699 | };
|
8700 |
|
8701 | _proto.performExit = function performExit(node) {
|
8702 | var _this3 = this;
|
8703 |
|
8704 | var exit = this.props.exit;
|
8705 | var timeouts = this.getTimeouts();
|
8706 |
|
8707 | if (!exit) {
|
8708 | this.safeSetState({
|
8709 | status: EXITED
|
8710 | }, function () {
|
8711 | _this3.props.onExited(node);
|
8712 | });
|
8713 | return;
|
8714 | }
|
8715 |
|
8716 | this.props.onExit(node);
|
8717 | this.safeSetState({
|
8718 | status: EXITING
|
8719 | }, function () {
|
8720 | _this3.props.onExiting(node);
|
8721 |
|
8722 | _this3.onTransitionEnd(node, timeouts.exit, function () {
|
8723 | _this3.safeSetState({
|
8724 | status: EXITED
|
8725 | }, function () {
|
8726 | _this3.props.onExited(node);
|
8727 | });
|
8728 | });
|
8729 | });
|
8730 | };
|
8731 |
|
8732 | _proto.cancelNextCallback = function cancelNextCallback() {
|
8733 | if (this.nextCallback !== null) {
|
8734 | this.nextCallback.cancel();
|
8735 | this.nextCallback = null;
|
8736 | }
|
8737 | };
|
8738 |
|
8739 | _proto.safeSetState = function safeSetState(nextState, callback) {
|
8740 |
|
8741 |
|
8742 |
|
8743 | callback = this.setNextCallback(callback);
|
8744 | this.setState(nextState, callback);
|
8745 | };
|
8746 |
|
8747 | _proto.setNextCallback = function setNextCallback(callback) {
|
8748 | var _this4 = this;
|
8749 |
|
8750 | var active = true;
|
8751 |
|
8752 | this.nextCallback = function (event) {
|
8753 | if (active) {
|
8754 | active = false;
|
8755 | _this4.nextCallback = null;
|
8756 | callback(event);
|
8757 | }
|
8758 | };
|
8759 |
|
8760 | this.nextCallback.cancel = function () {
|
8761 | active = false;
|
8762 | };
|
8763 |
|
8764 | return this.nextCallback;
|
8765 | };
|
8766 |
|
8767 | _proto.onTransitionEnd = function onTransitionEnd(node, timeout, handler) {
|
8768 | this.setNextCallback(handler);
|
8769 | var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
|
8770 |
|
8771 | if (!node || doesNotHaveTimeoutOrListener) {
|
8772 | setTimeout(this.nextCallback, 0);
|
8773 | return;
|
8774 | }
|
8775 |
|
8776 | if (this.props.addEndListener) {
|
8777 | this.props.addEndListener(node, this.nextCallback);
|
8778 | }
|
8779 |
|
8780 | if (timeout != null) {
|
8781 | setTimeout(this.nextCallback, timeout);
|
8782 | }
|
8783 | };
|
8784 |
|
8785 | _proto.render = function render() {
|
8786 | var status = this.state.status;
|
8787 |
|
8788 | if (status === UNMOUNTED) {
|
8789 | return null;
|
8790 | }
|
8791 |
|
8792 | var _this$props = this.props,
|
8793 | children = _this$props.children,
|
8794 | childProps = _objectWithoutPropertiesLoose(_this$props, ["children"]);
|
8795 |
|
8796 |
|
8797 | delete childProps.in;
|
8798 | delete childProps.mountOnEnter;
|
8799 | delete childProps.unmountOnExit;
|
8800 | delete childProps.appear;
|
8801 | delete childProps.enter;
|
8802 | delete childProps.exit;
|
8803 | delete childProps.timeout;
|
8804 | delete childProps.addEndListener;
|
8805 | delete childProps.onEnter;
|
8806 | delete childProps.onEntering;
|
8807 | delete childProps.onEntered;
|
8808 | delete childProps.onExit;
|
8809 | delete childProps.onExiting;
|
8810 | delete childProps.onExited;
|
8811 |
|
8812 | if (typeof children === 'function') {
|
8813 | return children(status, childProps);
|
8814 | }
|
8815 |
|
8816 | var child = _react.default.Children.only(children);
|
8817 |
|
8818 | return _react.default.cloneElement(child, childProps);
|
8819 | };
|
8820 |
|
8821 | return Transition;
|
8822 | }(_react.default.Component);
|
8823 |
|
8824 | Transition.contextTypes = {
|
8825 | transitionGroup: PropTypes.object
|
8826 | };
|
8827 | Transition.childContextTypes = {
|
8828 | transitionGroup: function transitionGroup() {}
|
8829 | };
|
8830 | Transition.propTypes = process.env.NODE_ENV !== "production" ? {
|
8831 | |
8832 |
|
8833 |
|
8834 |
|
8835 |
|
8836 |
|
8837 |
|
8838 |
|
8839 |
|
8840 |
|
8841 |
|
8842 |
|
8843 |
|
8844 |
|
8845 | children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,
|
8846 |
|
8847 | |
8848 |
|
8849 |
|
8850 | in: PropTypes.bool,
|
8851 |
|
8852 | |
8853 |
|
8854 |
|
8855 |
|
8856 |
|
8857 |
|
8858 | mountOnEnter: PropTypes.bool,
|
8859 |
|
8860 | |
8861 |
|
8862 |
|
8863 |
|
8864 | unmountOnExit: PropTypes.bool,
|
8865 |
|
8866 | |
8867 |
|
8868 |
|
8869 |
|
8870 |
|
8871 |
|
8872 |
|
8873 | appear: PropTypes.bool,
|
8874 |
|
8875 | |
8876 |
|
8877 |
|
8878 | enter: PropTypes.bool,
|
8879 |
|
8880 | |
8881 |
|
8882 |
|
8883 | exit: PropTypes.bool,
|
8884 |
|
8885 | |
8886 |
|
8887 |
|
8888 |
|
8889 |
|
8890 |
|
8891 |
|
8892 |
|
8893 |
|
8894 |
|
8895 |
|
8896 |
|
8897 |
|
8898 |
|
8899 |
|
8900 |
|
8901 |
|
8902 |
|
8903 |
|
8904 |
|
8905 |
|
8906 | timeout: function timeout(props) {
|
8907 | var pt = process.env.NODE_ENV !== "production" ? _PropTypes.timeoutsShape : {};;
|
8908 | if (!props.addEndListener) pt = pt.isRequired;
|
8909 |
|
8910 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
8911 | args[_key - 1] = arguments[_key];
|
8912 | }
|
8913 |
|
8914 | return pt.apply(void 0, [props].concat(args));
|
8915 | },
|
8916 |
|
8917 | |
8918 |
|
8919 |
|
8920 |
|
8921 |
|
8922 |
|
8923 |
|
8924 |
|
8925 |
|
8926 |
|
8927 |
|
8928 |
|
8929 | addEndListener: PropTypes.func,
|
8930 |
|
8931 | |
8932 |
|
8933 |
|
8934 |
|
8935 |
|
8936 |
|
8937 | onEnter: PropTypes.func,
|
8938 |
|
8939 | |
8940 |
|
8941 |
|
8942 |
|
8943 |
|
8944 |
|
8945 | onEntering: PropTypes.func,
|
8946 |
|
8947 | |
8948 |
|
8949 |
|
8950 |
|
8951 |
|
8952 |
|
8953 | onEntered: PropTypes.func,
|
8954 |
|
8955 | |
8956 |
|
8957 |
|
8958 |
|
8959 |
|
8960 | onExit: PropTypes.func,
|
8961 |
|
8962 | |
8963 |
|
8964 |
|
8965 |
|
8966 |
|
8967 | onExiting: PropTypes.func,
|
8968 |
|
8969 | |
8970 |
|
8971 |
|
8972 |
|
8973 |
|
8974 | onExited: PropTypes.func
|
8975 |
|
8976 | } : {};
|
8977 |
|
8978 | function noop() {}
|
8979 |
|
8980 | Transition.defaultProps = {
|
8981 | in: false,
|
8982 | mountOnEnter: false,
|
8983 | unmountOnExit: false,
|
8984 | appear: false,
|
8985 | enter: true,
|
8986 | exit: true,
|
8987 | onEnter: noop,
|
8988 | onEntering: noop,
|
8989 | onEntered: noop,
|
8990 | onExit: noop,
|
8991 | onExiting: noop,
|
8992 | onExited: noop
|
8993 | };
|
8994 | Transition.UNMOUNTED = 0;
|
8995 | Transition.EXITED = 1;
|
8996 | Transition.ENTERING = 2;
|
8997 | Transition.ENTERED = 3;
|
8998 | Transition.EXITING = 4;
|
8999 |
|
9000 | var _default = (0, _reactLifecyclesCompat.polyfill)(Transition);
|
9001 |
|
9002 | exports.default = _default;
|
9003 | }.call(exports, __webpack_require__(33)))
|
9004 |
|
9005 | }),
|
9006 |
|
9007 | (function(module, exports) {
|
9008 |
|
9009 | 'use strict';
|
9010 |
|
9011 | Object.defineProperty(exports, '__esModule', { value: true });
|
9012 |
|
9013 | |
9014 |
|
9015 |
|
9016 |
|
9017 |
|
9018 |
|
9019 |
|
9020 | function componentWillMount() {
|
9021 |
|
9022 | var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
|
9023 | if (state !== null && state !== undefined) {
|
9024 | this.setState(state);
|
9025 | }
|
9026 | }
|
9027 |
|
9028 | function componentWillReceiveProps(nextProps) {
|
9029 |
|
9030 |
|
9031 | function updater(prevState) {
|
9032 | var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
|
9033 | return state !== null && state !== undefined ? state : null;
|
9034 | }
|
9035 |
|
9036 | this.setState(updater.bind(this));
|
9037 | }
|
9038 |
|
9039 | function componentWillUpdate(nextProps, nextState) {
|
9040 | try {
|
9041 | var prevProps = this.props;
|
9042 | var prevState = this.state;
|
9043 | this.props = nextProps;
|
9044 | this.state = nextState;
|
9045 | this.__reactInternalSnapshotFlag = true;
|
9046 | this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
|
9047 | prevProps,
|
9048 | prevState
|
9049 | );
|
9050 | } finally {
|
9051 | this.props = prevProps;
|
9052 | this.state = prevState;
|
9053 | }
|
9054 | }
|
9055 |
|
9056 |
|
9057 |
|
9058 | componentWillMount.__suppressDeprecationWarning = true;
|
9059 | componentWillReceiveProps.__suppressDeprecationWarning = true;
|
9060 | componentWillUpdate.__suppressDeprecationWarning = true;
|
9061 |
|
9062 | function polyfill(Component) {
|
9063 | var prototype = Component.prototype;
|
9064 |
|
9065 | if (!prototype || !prototype.isReactComponent) {
|
9066 | throw new Error('Can only polyfill class components');
|
9067 | }
|
9068 |
|
9069 | if (
|
9070 | typeof Component.getDerivedStateFromProps !== 'function' &&
|
9071 | typeof prototype.getSnapshotBeforeUpdate !== 'function'
|
9072 | ) {
|
9073 | return Component;
|
9074 | }
|
9075 |
|
9076 |
|
9077 |
|
9078 |
|
9079 | var foundWillMountName = null;
|
9080 | var foundWillReceivePropsName = null;
|
9081 | var foundWillUpdateName = null;
|
9082 | if (typeof prototype.componentWillMount === 'function') {
|
9083 | foundWillMountName = 'componentWillMount';
|
9084 | } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
|
9085 | foundWillMountName = 'UNSAFE_componentWillMount';
|
9086 | }
|
9087 | if (typeof prototype.componentWillReceiveProps === 'function') {
|
9088 | foundWillReceivePropsName = 'componentWillReceiveProps';
|
9089 | } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
|
9090 | foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
9091 | }
|
9092 | if (typeof prototype.componentWillUpdate === 'function') {
|
9093 | foundWillUpdateName = 'componentWillUpdate';
|
9094 | } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
|
9095 | foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
9096 | }
|
9097 | if (
|
9098 | foundWillMountName !== null ||
|
9099 | foundWillReceivePropsName !== null ||
|
9100 | foundWillUpdateName !== null
|
9101 | ) {
|
9102 | var componentName = Component.displayName || Component.name;
|
9103 | var newApiName =
|
9104 | typeof Component.getDerivedStateFromProps === 'function'
|
9105 | ? 'getDerivedStateFromProps()'
|
9106 | : 'getSnapshotBeforeUpdate()';
|
9107 |
|
9108 | throw Error(
|
9109 | 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
|
9110 | componentName +
|
9111 | ' uses ' +
|
9112 | newApiName +
|
9113 | ' but also contains the following legacy lifecycles:' +
|
9114 | (foundWillMountName !== null ? '\n ' + foundWillMountName : '') +
|
9115 | (foundWillReceivePropsName !== null
|
9116 | ? '\n ' + foundWillReceivePropsName
|
9117 | : '') +
|
9118 | (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') +
|
9119 | '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' +
|
9120 | 'https://fb.me/react-async-component-lifecycle-hooks'
|
9121 | );
|
9122 | }
|
9123 |
|
9124 |
|
9125 |
|
9126 |
|
9127 | if (typeof Component.getDerivedStateFromProps === 'function') {
|
9128 | prototype.componentWillMount = componentWillMount;
|
9129 | prototype.componentWillReceiveProps = componentWillReceiveProps;
|
9130 | }
|
9131 |
|
9132 |
|
9133 |
|
9134 |
|
9135 | if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
|
9136 | if (typeof prototype.componentDidUpdate !== 'function') {
|
9137 | throw new Error(
|
9138 | 'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'
|
9139 | );
|
9140 | }
|
9141 |
|
9142 | prototype.componentWillUpdate = componentWillUpdate;
|
9143 |
|
9144 | var componentDidUpdate = prototype.componentDidUpdate;
|
9145 |
|
9146 | prototype.componentDidUpdate = function componentDidUpdatePolyfill(
|
9147 | prevProps,
|
9148 | prevState,
|
9149 | maybeSnapshot
|
9150 | ) {
|
9151 |
|
9152 |
|
9153 |
|
9154 |
|
9155 |
|
9156 |
|
9157 |
|
9158 |
|
9159 | var snapshot = this.__reactInternalSnapshotFlag
|
9160 | ? this.__reactInternalSnapshot
|
9161 | : maybeSnapshot;
|
9162 |
|
9163 | componentDidUpdate.call(this, prevProps, prevState, snapshot);
|
9164 | };
|
9165 | }
|
9166 |
|
9167 | return Component;
|
9168 | }
|
9169 |
|
9170 | exports.polyfill = polyfill;
|
9171 |
|
9172 |
|
9173 | }),
|
9174 |
|
9175 | (function(module, exports, __webpack_require__) {
|
9176 |
|
9177 | (function(process) {"use strict";
|
9178 |
|
9179 | exports.__esModule = true;
|
9180 | exports.classNamesShape = exports.timeoutsShape = void 0;
|
9181 |
|
9182 | var _propTypes = _interopRequireDefault(__webpack_require__(6));
|
9183 |
|
9184 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9185 |
|
9186 | var timeoutsShape = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
9187 | enter: _propTypes.default.number,
|
9188 | exit: _propTypes.default.number,
|
9189 | appear: _propTypes.default.number
|
9190 | }).isRequired]) : null;
|
9191 | exports.timeoutsShape = timeoutsShape;
|
9192 | var classNamesShape = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({
|
9193 | enter: _propTypes.default.string,
|
9194 | exit: _propTypes.default.string,
|
9195 | active: _propTypes.default.string
|
9196 | }), _propTypes.default.shape({
|
9197 | enter: _propTypes.default.string,
|
9198 | enterDone: _propTypes.default.string,
|
9199 | enterActive: _propTypes.default.string,
|
9200 | exit: _propTypes.default.string,
|
9201 | exitDone: _propTypes.default.string,
|
9202 | exitActive: _propTypes.default.string
|
9203 | })]) : null;
|
9204 | exports.classNamesShape = classNamesShape;
|
9205 | }.call(exports, __webpack_require__(33)))
|
9206 |
|
9207 | }),
|
9208 |
|
9209 | (function(module, exports, __webpack_require__) {
|
9210 |
|
9211 | (function(process) {"use strict";
|
9212 |
|
9213 | exports.__esModule = true;
|
9214 | exports.default = void 0;
|
9215 |
|
9216 | var _propTypes = _interopRequireDefault(__webpack_require__(6));
|
9217 |
|
9218 | var _react = _interopRequireDefault(__webpack_require__(1));
|
9219 |
|
9220 | var _reactDom = __webpack_require__(2);
|
9221 |
|
9222 | var _TransitionGroup = _interopRequireDefault(__webpack_require__(90));
|
9223 |
|
9224 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9225 |
|
9226 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
9227 |
|
9228 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
9229 |
|
9230 | |
9231 |
|
9232 |
|
9233 |
|
9234 |
|
9235 |
|
9236 |
|
9237 |
|
9238 |
|
9239 |
|
9240 |
|
9241 | var ReplaceTransition =
|
9242 |
|
9243 | function (_React$Component) {
|
9244 | _inheritsLoose(ReplaceTransition, _React$Component);
|
9245 |
|
9246 | function ReplaceTransition() {
|
9247 | var _this;
|
9248 |
|
9249 | for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
|
9250 | _args[_key] = arguments[_key];
|
9251 | }
|
9252 |
|
9253 | _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
|
9254 |
|
9255 | _this.handleEnter = function () {
|
9256 | for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
9257 | args[_key2] = arguments[_key2];
|
9258 | }
|
9259 |
|
9260 | return _this.handleLifecycle('onEnter', 0, args);
|
9261 | };
|
9262 |
|
9263 | _this.handleEntering = function () {
|
9264 | for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
9265 | args[_key3] = arguments[_key3];
|
9266 | }
|
9267 |
|
9268 | return _this.handleLifecycle('onEntering', 0, args);
|
9269 | };
|
9270 |
|
9271 | _this.handleEntered = function () {
|
9272 | for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
9273 | args[_key4] = arguments[_key4];
|
9274 | }
|
9275 |
|
9276 | return _this.handleLifecycle('onEntered', 0, args);
|
9277 | };
|
9278 |
|
9279 | _this.handleExit = function () {
|
9280 | for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
9281 | args[_key5] = arguments[_key5];
|
9282 | }
|
9283 |
|
9284 | return _this.handleLifecycle('onExit', 1, args);
|
9285 | };
|
9286 |
|
9287 | _this.handleExiting = function () {
|
9288 | for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
9289 | args[_key6] = arguments[_key6];
|
9290 | }
|
9291 |
|
9292 | return _this.handleLifecycle('onExiting', 1, args);
|
9293 | };
|
9294 |
|
9295 | _this.handleExited = function () {
|
9296 | for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
9297 | args[_key7] = arguments[_key7];
|
9298 | }
|
9299 |
|
9300 | return _this.handleLifecycle('onExited', 1, args);
|
9301 | };
|
9302 |
|
9303 | return _this;
|
9304 | }
|
9305 |
|
9306 | var _proto = ReplaceTransition.prototype;
|
9307 |
|
9308 | _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
|
9309 | var _child$props;
|
9310 |
|
9311 | var children = this.props.children;
|
9312 |
|
9313 | var child = _react.default.Children.toArray(children)[idx];
|
9314 |
|
9315 | if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
|
9316 | if (this.props[handler]) this.props[handler]((0, _reactDom.findDOMNode)(this));
|
9317 | };
|
9318 |
|
9319 | _proto.render = function render() {
|
9320 | var _this$props = this.props,
|
9321 | children = _this$props.children,
|
9322 | inProp = _this$props.in,
|
9323 | props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
|
9324 |
|
9325 | var _React$Children$toArr = _react.default.Children.toArray(children),
|
9326 | first = _React$Children$toArr[0],
|
9327 | second = _React$Children$toArr[1];
|
9328 |
|
9329 | delete props.onEnter;
|
9330 | delete props.onEntering;
|
9331 | delete props.onEntered;
|
9332 | delete props.onExit;
|
9333 | delete props.onExiting;
|
9334 | delete props.onExited;
|
9335 | return _react.default.createElement(_TransitionGroup.default, props, inProp ? _react.default.cloneElement(first, {
|
9336 | key: 'first',
|
9337 | onEnter: this.handleEnter,
|
9338 | onEntering: this.handleEntering,
|
9339 | onEntered: this.handleEntered
|
9340 | }) : _react.default.cloneElement(second, {
|
9341 | key: 'second',
|
9342 | onEnter: this.handleExit,
|
9343 | onEntering: this.handleExiting,
|
9344 | onEntered: this.handleExited
|
9345 | }));
|
9346 | };
|
9347 |
|
9348 | return ReplaceTransition;
|
9349 | }(_react.default.Component);
|
9350 |
|
9351 | ReplaceTransition.propTypes = process.env.NODE_ENV !== "production" ? {
|
9352 | in: _propTypes.default.bool.isRequired,
|
9353 | children: function children(props, propName) {
|
9354 | if (_react.default.Children.count(props[propName]) !== 2) return new Error("\"" + propName + "\" must be exactly two transition components.");
|
9355 | return null;
|
9356 | }
|
9357 | } : {};
|
9358 | var _default = ReplaceTransition;
|
9359 | exports.default = _default;
|
9360 | module.exports = exports["default"];
|
9361 | }.call(exports, __webpack_require__(33)))
|
9362 |
|
9363 | }),
|
9364 |
|
9365 | (function(module, exports, __webpack_require__) {
|
9366 |
|
9367 | (function(process) {"use strict";
|
9368 |
|
9369 | exports.__esModule = true;
|
9370 | exports.default = void 0;
|
9371 |
|
9372 | var _propTypes = _interopRequireDefault(__webpack_require__(6));
|
9373 |
|
9374 | var _react = _interopRequireDefault(__webpack_require__(1));
|
9375 |
|
9376 | var _reactLifecyclesCompat = __webpack_require__(87);
|
9377 |
|
9378 | var _ChildMapping = __webpack_require__(91);
|
9379 |
|
9380 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9381 |
|
9382 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
9383 |
|
9384 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
9385 |
|
9386 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
9387 |
|
9388 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
9389 |
|
9390 | var values = Object.values || function (obj) {
|
9391 | return Object.keys(obj).map(function (k) {
|
9392 | return obj[k];
|
9393 | });
|
9394 | };
|
9395 |
|
9396 | var defaultProps = {
|
9397 | component: 'div',
|
9398 | childFactory: function childFactory(child) {
|
9399 | return child;
|
9400 | }
|
9401 | |
9402 |
|
9403 |
|
9404 |
|
9405 |
|
9406 |
|
9407 |
|
9408 |
|
9409 |
|
9410 |
|
9411 |
|
9412 |
|
9413 |
|
9414 |
|
9415 |
|
9416 | };
|
9417 |
|
9418 | var TransitionGroup =
|
9419 |
|
9420 | function (_React$Component) {
|
9421 | _inheritsLoose(TransitionGroup, _React$Component);
|
9422 |
|
9423 | function TransitionGroup(props, context) {
|
9424 | var _this;
|
9425 |
|
9426 | _this = _React$Component.call(this, props, context) || this;
|
9427 |
|
9428 | var handleExited = _this.handleExited.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
9429 |
|
9430 |
|
9431 | _this.state = {
|
9432 | handleExited: handleExited,
|
9433 | firstRender: true
|
9434 | };
|
9435 | return _this;
|
9436 | }
|
9437 |
|
9438 | var _proto = TransitionGroup.prototype;
|
9439 |
|
9440 | _proto.getChildContext = function getChildContext() {
|
9441 | return {
|
9442 | transitionGroup: {
|
9443 | isMounting: !this.appeared
|
9444 | }
|
9445 | };
|
9446 | };
|
9447 |
|
9448 | _proto.componentDidMount = function componentDidMount() {
|
9449 | this.appeared = true;
|
9450 | this.mounted = true;
|
9451 | };
|
9452 |
|
9453 | _proto.componentWillUnmount = function componentWillUnmount() {
|
9454 | this.mounted = false;
|
9455 | };
|
9456 |
|
9457 | TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
|
9458 | var prevChildMapping = _ref.children,
|
9459 | handleExited = _ref.handleExited,
|
9460 | firstRender = _ref.firstRender;
|
9461 | return {
|
9462 | children: firstRender ? (0, _ChildMapping.getInitialChildMapping)(nextProps, handleExited) : (0, _ChildMapping.getNextChildMapping)(nextProps, prevChildMapping, handleExited),
|
9463 | firstRender: false
|
9464 | };
|
9465 | };
|
9466 |
|
9467 | _proto.handleExited = function handleExited(child, node) {
|
9468 | var currentChildMapping = (0, _ChildMapping.getChildMapping)(this.props.children);
|
9469 | if (child.key in currentChildMapping) return;
|
9470 |
|
9471 | if (child.props.onExited) {
|
9472 | child.props.onExited(node);
|
9473 | }
|
9474 |
|
9475 | if (this.mounted) {
|
9476 | this.setState(function (state) {
|
9477 | var children = _extends({}, state.children);
|
9478 |
|
9479 | delete children[child.key];
|
9480 | return {
|
9481 | children: children
|
9482 | };
|
9483 | });
|
9484 | }
|
9485 | };
|
9486 |
|
9487 | _proto.render = function render() {
|
9488 | var _this$props = this.props,
|
9489 | Component = _this$props.component,
|
9490 | childFactory = _this$props.childFactory,
|
9491 | props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
|
9492 |
|
9493 | var children = values(this.state.children).map(childFactory);
|
9494 | delete props.appear;
|
9495 | delete props.enter;
|
9496 | delete props.exit;
|
9497 |
|
9498 | if (Component === null) {
|
9499 | return children;
|
9500 | }
|
9501 |
|
9502 | return _react.default.createElement(Component, props, children);
|
9503 | };
|
9504 |
|
9505 | return TransitionGroup;
|
9506 | }(_react.default.Component);
|
9507 |
|
9508 | TransitionGroup.childContextTypes = {
|
9509 | transitionGroup: _propTypes.default.object.isRequired
|
9510 | };
|
9511 | TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? {
|
9512 | |
9513 |
|
9514 |
|
9515 |
|
9516 |
|
9517 |
|
9518 |
|
9519 | component: _propTypes.default.any,
|
9520 |
|
9521 | |
9522 |
|
9523 |
|
9524 |
|
9525 |
|
9526 |
|
9527 |
|
9528 |
|
9529 |
|
9530 |
|
9531 |
|
9532 |
|
9533 |
|
9534 | children: _propTypes.default.node,
|
9535 |
|
9536 | |
9537 |
|
9538 |
|
9539 |
|
9540 |
|
9541 | appear: _propTypes.default.bool,
|
9542 |
|
9543 | |
9544 |
|
9545 |
|
9546 |
|
9547 |
|
9548 | enter: _propTypes.default.bool,
|
9549 |
|
9550 | |
9551 |
|
9552 |
|
9553 |
|
9554 |
|
9555 | exit: _propTypes.default.bool,
|
9556 |
|
9557 | |
9558 |
|
9559 |
|
9560 |
|
9561 |
|
9562 |
|
9563 |
|
9564 |
|
9565 |
|
9566 |
|
9567 | childFactory: _propTypes.default.func
|
9568 | } : {};
|
9569 | TransitionGroup.defaultProps = defaultProps;
|
9570 |
|
9571 | var _default = (0, _reactLifecyclesCompat.polyfill)(TransitionGroup);
|
9572 |
|
9573 | exports.default = _default;
|
9574 | module.exports = exports["default"];
|
9575 | }.call(exports, __webpack_require__(33)))
|
9576 |
|
9577 | }),
|
9578 |
|
9579 | (function(module, exports, __webpack_require__) {
|
9580 |
|
9581 | "use strict";
|
9582 |
|
9583 | exports.__esModule = true;
|
9584 | exports.getChildMapping = getChildMapping;
|
9585 | exports.mergeChildMappings = mergeChildMappings;
|
9586 | exports.getInitialChildMapping = getInitialChildMapping;
|
9587 | exports.getNextChildMapping = getNextChildMapping;
|
9588 |
|
9589 | var _react = __webpack_require__(1);
|
9590 |
|
9591 | |
9592 |
|
9593 |
|
9594 |
|
9595 |
|
9596 |
|
9597 | function getChildMapping(children, mapFn) {
|
9598 | var mapper = function mapper(child) {
|
9599 | return mapFn && (0, _react.isValidElement)(child) ? mapFn(child) : child;
|
9600 | };
|
9601 |
|
9602 | var result = Object.create(null);
|
9603 | if (children) _react.Children.map(children, function (c) {
|
9604 | return c;
|
9605 | }).forEach(function (child) {
|
9606 |
|
9607 | result[child.key] = mapper(child);
|
9608 | });
|
9609 | return result;
|
9610 | }
|
9611 | |
9612 |
|
9613 |
|
9614 |
|
9615 |
|
9616 |
|
9617 |
|
9618 |
|
9619 |
|
9620 |
|
9621 |
|
9622 |
|
9623 |
|
9624 |
|
9625 |
|
9626 |
|
9627 |
|
9628 |
|
9629 |
|
9630 | function mergeChildMappings(prev, next) {
|
9631 | prev = prev || {};
|
9632 | next = next || {};
|
9633 |
|
9634 | function getValueForKey(key) {
|
9635 | return key in next ? next[key] : prev[key];
|
9636 | }
|
9637 |
|
9638 |
|
9639 |
|
9640 | var nextKeysPending = Object.create(null);
|
9641 | var pendingKeys = [];
|
9642 |
|
9643 | for (var prevKey in prev) {
|
9644 | if (prevKey in next) {
|
9645 | if (pendingKeys.length) {
|
9646 | nextKeysPending[prevKey] = pendingKeys;
|
9647 | pendingKeys = [];
|
9648 | }
|
9649 | } else {
|
9650 | pendingKeys.push(prevKey);
|
9651 | }
|
9652 | }
|
9653 |
|
9654 | var i;
|
9655 | var childMapping = {};
|
9656 |
|
9657 | for (var nextKey in next) {
|
9658 | if (nextKeysPending[nextKey]) {
|
9659 | for (i = 0; i < nextKeysPending[nextKey].length; i++) {
|
9660 | var pendingNextKey = nextKeysPending[nextKey][i];
|
9661 | childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
|
9662 | }
|
9663 | }
|
9664 |
|
9665 | childMapping[nextKey] = getValueForKey(nextKey);
|
9666 | }
|
9667 |
|
9668 |
|
9669 | for (i = 0; i < pendingKeys.length; i++) {
|
9670 | childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
|
9671 | }
|
9672 |
|
9673 | return childMapping;
|
9674 | }
|
9675 |
|
9676 | function getProp(child, prop, props) {
|
9677 | return props[prop] != null ? props[prop] : child.props[prop];
|
9678 | }
|
9679 |
|
9680 | function getInitialChildMapping(props, onExited) {
|
9681 | return getChildMapping(props.children, function (child) {
|
9682 | return (0, _react.cloneElement)(child, {
|
9683 | onExited: onExited.bind(null, child),
|
9684 | in: true,
|
9685 | appear: getProp(child, 'appear', props),
|
9686 | enter: getProp(child, 'enter', props),
|
9687 | exit: getProp(child, 'exit', props)
|
9688 | });
|
9689 | });
|
9690 | }
|
9691 |
|
9692 | function getNextChildMapping(nextProps, prevChildMapping, onExited) {
|
9693 | var nextChildMapping = getChildMapping(nextProps.children);
|
9694 | var children = mergeChildMappings(prevChildMapping, nextChildMapping);
|
9695 | Object.keys(children).forEach(function (key) {
|
9696 | var child = children[key];
|
9697 | if (!(0, _react.isValidElement)(child)) return;
|
9698 | var hasPrev = key in prevChildMapping;
|
9699 | var hasNext = key in nextChildMapping;
|
9700 | var prevChild = prevChildMapping[key];
|
9701 | var isLeaving = (0, _react.isValidElement)(prevChild) && !prevChild.props.in;
|
9702 |
|
9703 | if (hasNext && (!hasPrev || isLeaving)) {
|
9704 |
|
9705 | children[key] = (0, _react.cloneElement)(child, {
|
9706 | onExited: onExited.bind(null, child),
|
9707 | in: true,
|
9708 | exit: getProp(child, 'exit', nextProps),
|
9709 | enter: getProp(child, 'enter', nextProps)
|
9710 | });
|
9711 | } else if (!hasNext && hasPrev && !isLeaving) {
|
9712 |
|
9713 |
|
9714 | children[key] = (0, _react.cloneElement)(child, {
|
9715 | in: false
|
9716 | });
|
9717 | } else if (hasNext && hasPrev && (0, _react.isValidElement)(prevChild)) {
|
9718 |
|
9719 |
|
9720 |
|
9721 | children[key] = (0, _react.cloneElement)(child, {
|
9722 | onExited: onExited.bind(null, child),
|
9723 | in: prevChild.props.in,
|
9724 | exit: getProp(child, 'exit', nextProps),
|
9725 | enter: getProp(child, 'enter', nextProps)
|
9726 | });
|
9727 | }
|
9728 | });
|
9729 | return children;
|
9730 | }
|
9731 |
|
9732 | }),
|
9733 |
|
9734 | (function(module, exports, __webpack_require__) {
|
9735 |
|
9736 | 'use strict';
|
9737 |
|
9738 | Object.defineProperty(exports, "__esModule", {
|
9739 | value: true
|
9740 | });
|
9741 |
|
9742 | var _Clipboard = __webpack_require__(93);
|
9743 |
|
9744 | var _Clipboard2 = _interopRequireDefault(_Clipboard);
|
9745 |
|
9746 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
9747 |
|
9748 | exports["default"] = _Clipboard2["default"];
|
9749 | module.exports = exports['default'];
|
9750 |
|
9751 | }),
|
9752 |
|
9753 | (function(module, exports, __webpack_require__) {
|
9754 |
|
9755 | 'use strict';
|
9756 |
|
9757 | Object.defineProperty(exports, "__esModule", {
|
9758 | value: true
|
9759 | });
|
9760 |
|
9761 | var _react = __webpack_require__(1);
|
9762 |
|
9763 | var _react2 = _interopRequireDefault(_react);
|
9764 |
|
9765 | var _clipboard = __webpack_require__(94);
|
9766 |
|
9767 | var _clipboard2 = _interopRequireDefault(_clipboard);
|
9768 |
|
9769 | var _classnames = __webpack_require__(5);
|
9770 |
|
9771 | var _classnames2 = _interopRequireDefault(_classnames);
|
9772 |
|
9773 | var _beeIcon = __webpack_require__(102);
|
9774 |
|
9775 | var _beeIcon2 = _interopRequireDefault(_beeIcon);
|
9776 |
|
9777 | var _reactDom = __webpack_require__(2);
|
9778 |
|
9779 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
9780 |
|
9781 | var _beeTooltip = __webpack_require__(104);
|
9782 |
|
9783 | var _beeTooltip2 = _interopRequireDefault(_beeTooltip);
|
9784 |
|
9785 | var _propTypes = __webpack_require__(6);
|
9786 |
|
9787 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
9788 |
|
9789 | var _tool = __webpack_require__(132);
|
9790 |
|
9791 | var _i18n = __webpack_require__(133);
|
9792 |
|
9793 | var _i18n2 = _interopRequireDefault(_i18n);
|
9794 |
|
9795 | var _beeModal = __webpack_require__(134);
|
9796 |
|
9797 | var _beeModal2 = _interopRequireDefault(_beeModal);
|
9798 |
|
9799 | var _beeFormControl = __webpack_require__(153);
|
9800 |
|
9801 | var _beeFormControl2 = _interopRequireDefault(_beeFormControl);
|
9802 |
|
9803 | var _beeButton = __webpack_require__(155);
|
9804 |
|
9805 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
9806 |
|
9807 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
9808 |
|
9809 | 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; }
|
9810 |
|
9811 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
9812 |
|
9813 | 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; }
|
9814 |
|
9815 | 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); }
|
9816 |
|
9817 |
|
9818 |
|
9819 | var propTypes = {
|
9820 | action: _propTypes2["default"].oneOf(['copy', 'cut', null]),
|
9821 | text: _propTypes2["default"].string,
|
9822 | success: _propTypes2["default"].func,
|
9823 | error: _propTypes2["default"].func,
|
9824 | locale: _propTypes2["default"].object
|
9825 | };
|
9826 | var defaultProps = {
|
9827 | action: 'copy',
|
9828 | text: '',
|
9829 | target: '',
|
9830 | success: function success() {},
|
9831 | error: function error() {},
|
9832 | locale: {}
|
9833 | };
|
9834 |
|
9835 | var Clipboard = function (_Component) {
|
9836 | _inherits(Clipboard, _Component);
|
9837 |
|
9838 | function Clipboard(props, context) {
|
9839 | _classCallCheck(this, Clipboard);
|
9840 |
|
9841 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
9842 |
|
9843 | _this.blur = function () {
|
9844 | _this.setState({
|
9845 | currect: false,
|
9846 | ready: false
|
9847 | });
|
9848 | };
|
9849 |
|
9850 | _this.close = function () {
|
9851 | _this.setState({
|
9852 | modalShow: false
|
9853 | });
|
9854 | };
|
9855 |
|
9856 | _this.state = {
|
9857 | currect: false,
|
9858 | html: '',
|
9859 | ready: false,
|
9860 | id: 'id' + Math.round(Math.random() * 1000 + 1) + new Date().getTime(),
|
9861 | modalShow: false
|
9862 | };
|
9863 | return _this;
|
9864 | }
|
9865 |
|
9866 | Clipboard.prototype.componentWillMount = function componentWillMount() {
|
9867 | var self = this;
|
9868 | var _props = this.props,
|
9869 | success = _props.success,
|
9870 | error = _props.error;
|
9871 |
|
9872 |
|
9873 | var id = this.state.id;
|
9874 | var cb = new _clipboard2["default"]('#' + id);
|
9875 | cb.on('success', function (e) {
|
9876 | self.setState({
|
9877 | currect: true,
|
9878 | ready: true
|
9879 | });
|
9880 | e.clearSelection();
|
9881 | if (success instanceof Function) success();
|
9882 | });
|
9883 | cb.on('error', function (e) {
|
9884 | self.setState({
|
9885 | modalShow: true,
|
9886 | html: e.text
|
9887 | });
|
9888 | _reactDom2["default"].findDOMNode(self.refs.text).select();
|
9889 | if (error instanceof Function) error();
|
9890 | });
|
9891 | };
|
9892 |
|
9893 | Clipboard.prototype.render = function render() {
|
9894 | var _props2 = this.props,
|
9895 | action = _props2.action,
|
9896 | text = _props2.text,
|
9897 | target = _props2.target;
|
9898 |
|
9899 | if (text) action = 'copy';
|
9900 |
|
9901 | var locale = (0, _tool.getComponentLocale)(this.props, this.context, 'Clipboard', function () {
|
9902 | return _i18n2["default"];
|
9903 | });
|
9904 | var tootipContent = locale[action];
|
9905 | if (this.state.ready) {
|
9906 | tootipContent = locale[action + 'Ready'];
|
9907 | }
|
9908 |
|
9909 | return _react2["default"].createElement(
|
9910 | _beeTooltip2["default"],
|
9911 | {
|
9912 | positionTop: '20px',
|
9913 | overlay: tootipContent,
|
9914 | placement: 'top' },
|
9915 | _react2["default"].createElement(
|
9916 | 'span',
|
9917 | {
|
9918 | onMouseOut: this.blur,
|
9919 | className: 'u-clipboard',
|
9920 | id: this.state.id,
|
9921 | 'data-clipboard-action': action,
|
9922 | 'data-clipboard-target': target,
|
9923 | 'data-clipboard-text': text },
|
9924 | this.props.children ? this.props.children : _react2["default"].createElement(_beeIcon2["default"], {
|
9925 | className: (0, _classnames2["default"])({
|
9926 | 'uf-correct': this.state.currect,
|
9927 | 'uf-copy': !this.state.currect
|
9928 | })
|
9929 | }),
|
9930 | _react2["default"].createElement(
|
9931 | _beeModal2["default"],
|
9932 | { show: this.state.modalShow, onHide: this.close },
|
9933 | _react2["default"].createElement(
|
9934 | _beeModal2["default"].Header,
|
9935 | { closeButton: true },
|
9936 | _react2["default"].createElement(
|
9937 | _beeModal2["default"].Title,
|
9938 | null,
|
9939 | ' Ctrl+C ',
|
9940 | locale['copyToClipboard'],
|
9941 | ' '
|
9942 | )
|
9943 | ),
|
9944 | _react2["default"].createElement(
|
9945 | _beeModal2["default"].Body,
|
9946 | null,
|
9947 | _react2["default"].createElement(_beeFormControl2["default"], { ref: 'text', type: 'text', readOnly: true, value: this.state.html })
|
9948 | ),
|
9949 | _react2["default"].createElement(
|
9950 | _beeModal2["default"].Footer,
|
9951 | null,
|
9952 | _react2["default"].createElement(
|
9953 | _beeButton2["default"],
|
9954 | { onClick: this.close },
|
9955 | ' ',
|
9956 | locale['close'],
|
9957 | ' '
|
9958 | )
|
9959 | )
|
9960 | )
|
9961 | )
|
9962 | );
|
9963 | };
|
9964 |
|
9965 | return Clipboard;
|
9966 | }(_react.Component);
|
9967 |
|
9968 | ;
|
9969 | Clipboard.propTypes = propTypes;
|
9970 | Clipboard.defaultProps = defaultProps;
|
9971 | exports["default"] = Clipboard;
|
9972 | module.exports = exports['default'];
|
9973 |
|
9974 | }),
|
9975 |
|
9976 | (function(module, exports, __webpack_require__) {
|
9977 |
|
9978 | var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
|
9979 | if (true) {
|
9980 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, __webpack_require__(95), __webpack_require__(97), __webpack_require__(98)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
9981 | } else if (typeof exports !== "undefined") {
|
9982 | factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));
|
9983 | } else {
|
9984 | var mod = {
|
9985 | exports: {}
|
9986 | };
|
9987 | factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);
|
9988 | global.clipboard = mod.exports;
|
9989 | }
|
9990 | })(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
|
9991 | 'use strict';
|
9992 |
|
9993 | var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
|
9994 |
|
9995 | var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
|
9996 |
|
9997 | var _goodListener2 = _interopRequireDefault(_goodListener);
|
9998 |
|
9999 | function _interopRequireDefault(obj) {
|
10000 | return obj && obj.__esModule ? obj : {
|
10001 | default: obj
|
10002 | };
|
10003 | }
|
10004 |
|
10005 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
10006 | return typeof obj;
|
10007 | } : function (obj) {
|
10008 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
10009 | };
|
10010 |
|
10011 | function _classCallCheck(instance, Constructor) {
|
10012 | if (!(instance instanceof Constructor)) {
|
10013 | throw new TypeError("Cannot call a class as a function");
|
10014 | }
|
10015 | }
|
10016 |
|
10017 | var _createClass = function () {
|
10018 | function defineProperties(target, props) {
|
10019 | for (var i = 0; i < props.length; i++) {
|
10020 | var descriptor = props[i];
|
10021 | descriptor.enumerable = descriptor.enumerable || false;
|
10022 | descriptor.configurable = true;
|
10023 | if ("value" in descriptor) descriptor.writable = true;
|
10024 | Object.defineProperty(target, descriptor.key, descriptor);
|
10025 | }
|
10026 | }
|
10027 |
|
10028 | return function (Constructor, protoProps, staticProps) {
|
10029 | if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
10030 | if (staticProps) defineProperties(Constructor, staticProps);
|
10031 | return Constructor;
|
10032 | };
|
10033 | }();
|
10034 |
|
10035 | function _possibleConstructorReturn(self, call) {
|
10036 | if (!self) {
|
10037 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
10038 | }
|
10039 |
|
10040 | return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
10041 | }
|
10042 |
|
10043 | function _inherits(subClass, superClass) {
|
10044 | if (typeof superClass !== "function" && superClass !== null) {
|
10045 | throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
10046 | }
|
10047 |
|
10048 | subClass.prototype = Object.create(superClass && superClass.prototype, {
|
10049 | constructor: {
|
10050 | value: subClass,
|
10051 | enumerable: false,
|
10052 | writable: true,
|
10053 | configurable: true
|
10054 | }
|
10055 | });
|
10056 | if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
10057 | }
|
10058 |
|
10059 | var Clipboard = function (_Emitter) {
|
10060 | _inherits(Clipboard, _Emitter);
|
10061 |
|
10062 | |
10063 |
|
10064 |
|
10065 |
|
10066 | function Clipboard(trigger, options) {
|
10067 | _classCallCheck(this, Clipboard);
|
10068 |
|
10069 | var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
|
10070 |
|
10071 | _this.resolveOptions(options);
|
10072 | _this.listenClick(trigger);
|
10073 | return _this;
|
10074 | }
|
10075 |
|
10076 | |
10077 |
|
10078 |
|
10079 |
|
10080 |
|
10081 |
|
10082 |
|
10083 | _createClass(Clipboard, [{
|
10084 | key: 'resolveOptions',
|
10085 | value: function resolveOptions() {
|
10086 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
10087 |
|
10088 | this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
10089 | this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
10090 | this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
10091 | this.container = _typeof(options.container) === 'object' ? options.container : document.body;
|
10092 | }
|
10093 | }, {
|
10094 | key: 'listenClick',
|
10095 | value: function listenClick(trigger) {
|
10096 | var _this2 = this;
|
10097 |
|
10098 | this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
|
10099 | return _this2.onClick(e);
|
10100 | });
|
10101 | }
|
10102 | }, {
|
10103 | key: 'onClick',
|
10104 | value: function onClick(e) {
|
10105 | var trigger = e.delegateTarget || e.currentTarget;
|
10106 |
|
10107 | if (this.clipboardAction) {
|
10108 | this.clipboardAction = null;
|
10109 | }
|
10110 |
|
10111 | this.clipboardAction = new _clipboardAction2.default({
|
10112 | action: this.action(trigger),
|
10113 | target: this.target(trigger),
|
10114 | text: this.text(trigger),
|
10115 | container: this.container,
|
10116 | trigger: trigger,
|
10117 | emitter: this
|
10118 | });
|
10119 | }
|
10120 | }, {
|
10121 | key: 'defaultAction',
|
10122 | value: function defaultAction(trigger) {
|
10123 | return getAttributeValue('action', trigger);
|
10124 | }
|
10125 | }, {
|
10126 | key: 'defaultTarget',
|
10127 | value: function defaultTarget(trigger) {
|
10128 | var selector = getAttributeValue('target', trigger);
|
10129 |
|
10130 | if (selector) {
|
10131 | return document.querySelector(selector);
|
10132 | }
|
10133 | }
|
10134 | }, {
|
10135 | key: 'defaultText',
|
10136 | value: function defaultText(trigger) {
|
10137 | return getAttributeValue('text', trigger);
|
10138 | }
|
10139 | }, {
|
10140 | key: 'destroy',
|
10141 | value: function destroy() {
|
10142 | this.listener.destroy();
|
10143 |
|
10144 | if (this.clipboardAction) {
|
10145 | this.clipboardAction.destroy();
|
10146 | this.clipboardAction = null;
|
10147 | }
|
10148 | }
|
10149 | }], [{
|
10150 | key: 'isSupported',
|
10151 | value: function isSupported() {
|
10152 | var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
|
10153 |
|
10154 | var actions = typeof action === 'string' ? [action] : action;
|
10155 | var support = !!document.queryCommandSupported;
|
10156 |
|
10157 | actions.forEach(function (action) {
|
10158 | support = support && !!document.queryCommandSupported(action);
|
10159 | });
|
10160 |
|
10161 | return support;
|
10162 | }
|
10163 | }]);
|
10164 |
|
10165 | return Clipboard;
|
10166 | }(_tinyEmitter2.default);
|
10167 |
|
10168 | |
10169 |
|
10170 |
|
10171 |
|
10172 |
|
10173 | function getAttributeValue(suffix, element) {
|
10174 | var attribute = 'data-clipboard-' + suffix;
|
10175 |
|
10176 | if (!element.hasAttribute(attribute)) {
|
10177 | return;
|
10178 | }
|
10179 |
|
10180 | return element.getAttribute(attribute);
|
10181 | }
|
10182 |
|
10183 | module.exports = Clipboard;
|
10184 | });
|
10185 |
|
10186 | }),
|
10187 |
|
10188 | (function(module, exports, __webpack_require__) {
|
10189 |
|
10190 | var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
|
10191 | if (true) {
|
10192 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, __webpack_require__(96)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
10193 | } else if (typeof exports !== "undefined") {
|
10194 | factory(module, require('select'));
|
10195 | } else {
|
10196 | var mod = {
|
10197 | exports: {}
|
10198 | };
|
10199 | factory(mod, global.select);
|
10200 | global.clipboardAction = mod.exports;
|
10201 | }
|
10202 | })(this, function (module, _select) {
|
10203 | 'use strict';
|
10204 |
|
10205 | var _select2 = _interopRequireDefault(_select);
|
10206 |
|
10207 | function _interopRequireDefault(obj) {
|
10208 | return obj && obj.__esModule ? obj : {
|
10209 | default: obj
|
10210 | };
|
10211 | }
|
10212 |
|
10213 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
10214 | return typeof obj;
|
10215 | } : function (obj) {
|
10216 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
10217 | };
|
10218 |
|
10219 | function _classCallCheck(instance, Constructor) {
|
10220 | if (!(instance instanceof Constructor)) {
|
10221 | throw new TypeError("Cannot call a class as a function");
|
10222 | }
|
10223 | }
|
10224 |
|
10225 | var _createClass = function () {
|
10226 | function defineProperties(target, props) {
|
10227 | for (var i = 0; i < props.length; i++) {
|
10228 | var descriptor = props[i];
|
10229 | descriptor.enumerable = descriptor.enumerable || false;
|
10230 | descriptor.configurable = true;
|
10231 | if ("value" in descriptor) descriptor.writable = true;
|
10232 | Object.defineProperty(target, descriptor.key, descriptor);
|
10233 | }
|
10234 | }
|
10235 |
|
10236 | return function (Constructor, protoProps, staticProps) {
|
10237 | if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
10238 | if (staticProps) defineProperties(Constructor, staticProps);
|
10239 | return Constructor;
|
10240 | };
|
10241 | }();
|
10242 |
|
10243 | var ClipboardAction = function () {
|
10244 | |
10245 |
|
10246 |
|
10247 | function ClipboardAction(options) {
|
10248 | _classCallCheck(this, ClipboardAction);
|
10249 |
|
10250 | this.resolveOptions(options);
|
10251 | this.initSelection();
|
10252 | }
|
10253 |
|
10254 | |
10255 |
|
10256 |
|
10257 |
|
10258 |
|
10259 |
|
10260 | _createClass(ClipboardAction, [{
|
10261 | key: 'resolveOptions',
|
10262 | value: function resolveOptions() {
|
10263 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
10264 |
|
10265 | this.action = options.action;
|
10266 | this.container = options.container;
|
10267 | this.emitter = options.emitter;
|
10268 | this.target = options.target;
|
10269 | this.text = options.text;
|
10270 | this.trigger = options.trigger;
|
10271 |
|
10272 | this.selectedText = '';
|
10273 | }
|
10274 | }, {
|
10275 | key: 'initSelection',
|
10276 | value: function initSelection() {
|
10277 | if (this.text) {
|
10278 | this.selectFake();
|
10279 | } else if (this.target) {
|
10280 | this.selectTarget();
|
10281 | }
|
10282 | }
|
10283 | }, {
|
10284 | key: 'selectFake',
|
10285 | value: function selectFake() {
|
10286 | var _this = this;
|
10287 |
|
10288 | var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
|
10289 |
|
10290 | this.removeFake();
|
10291 |
|
10292 | this.fakeHandlerCallback = function () {
|
10293 | return _this.removeFake();
|
10294 | };
|
10295 | this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
|
10296 |
|
10297 | this.fakeElem = document.createElement('textarea');
|
10298 |
|
10299 | this.fakeElem.style.fontSize = '12pt';
|
10300 |
|
10301 | this.fakeElem.style.border = '0';
|
10302 | this.fakeElem.style.padding = '0';
|
10303 | this.fakeElem.style.margin = '0';
|
10304 |
|
10305 | this.fakeElem.style.position = 'absolute';
|
10306 | this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
10307 |
|
10308 | var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
10309 | this.fakeElem.style.top = yPosition + 'px';
|
10310 |
|
10311 | this.fakeElem.setAttribute('readonly', '');
|
10312 | this.fakeElem.value = this.text;
|
10313 |
|
10314 | this.container.appendChild(this.fakeElem);
|
10315 |
|
10316 | this.selectedText = (0, _select2.default)(this.fakeElem);
|
10317 | this.copyText();
|
10318 | }
|
10319 | }, {
|
10320 | key: 'removeFake',
|
10321 | value: function removeFake() {
|
10322 | if (this.fakeHandler) {
|
10323 | this.container.removeEventListener('click', this.fakeHandlerCallback);
|
10324 | this.fakeHandler = null;
|
10325 | this.fakeHandlerCallback = null;
|
10326 | }
|
10327 |
|
10328 | if (this.fakeElem) {
|
10329 | this.container.removeChild(this.fakeElem);
|
10330 | this.fakeElem = null;
|
10331 | }
|
10332 | }
|
10333 | }, {
|
10334 | key: 'selectTarget',
|
10335 | value: function selectTarget() {
|
10336 | this.selectedText = (0, _select2.default)(this.target);
|
10337 | this.copyText();
|
10338 | }
|
10339 | }, {
|
10340 | key: 'copyText',
|
10341 | value: function copyText() {
|
10342 | var succeeded = void 0;
|
10343 |
|
10344 | try {
|
10345 | succeeded = document.execCommand(this.action);
|
10346 | } catch (err) {
|
10347 | succeeded = false;
|
10348 | }
|
10349 |
|
10350 | this.handleResult(succeeded);
|
10351 | }
|
10352 | }, {
|
10353 | key: 'handleResult',
|
10354 | value: function handleResult(succeeded) {
|
10355 | this.emitter.emit(succeeded ? 'success' : 'error', {
|
10356 | action: this.action,
|
10357 | text: this.selectedText,
|
10358 | trigger: this.trigger,
|
10359 | clearSelection: this.clearSelection.bind(this)
|
10360 | });
|
10361 | }
|
10362 | }, {
|
10363 | key: 'clearSelection',
|
10364 | value: function clearSelection() {
|
10365 | if (this.trigger) {
|
10366 | this.trigger.focus();
|
10367 | }
|
10368 |
|
10369 | window.getSelection().removeAllRanges();
|
10370 | }
|
10371 | }, {
|
10372 | key: 'destroy',
|
10373 | value: function destroy() {
|
10374 | this.removeFake();
|
10375 | }
|
10376 | }, {
|
10377 | key: 'action',
|
10378 | set: function set() {
|
10379 | var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
|
10380 |
|
10381 | this._action = action;
|
10382 |
|
10383 | if (this._action !== 'copy' && this._action !== 'cut') {
|
10384 | throw new Error('Invalid "action" value, use either "copy" or "cut"');
|
10385 | }
|
10386 | },
|
10387 | get: function get() {
|
10388 | return this._action;
|
10389 | }
|
10390 | }, {
|
10391 | key: 'target',
|
10392 | set: function set(target) {
|
10393 | if (target !== undefined) {
|
10394 | if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
|
10395 | if (this.action === 'copy' && target.hasAttribute('disabled')) {
|
10396 | throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
|
10397 | }
|
10398 |
|
10399 | if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
|
10400 | throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
|
10401 | }
|
10402 |
|
10403 | this._target = target;
|
10404 | } else {
|
10405 | throw new Error('Invalid "target" value, use a valid Element');
|
10406 | }
|
10407 | }
|
10408 | },
|
10409 | get: function get() {
|
10410 | return this._target;
|
10411 | }
|
10412 | }]);
|
10413 |
|
10414 | return ClipboardAction;
|
10415 | }();
|
10416 |
|
10417 | module.exports = ClipboardAction;
|
10418 | });
|
10419 |
|
10420 | }),
|
10421 |
|
10422 | (function(module, exports) {
|
10423 |
|
10424 | function select(element) {
|
10425 | var selectedText;
|
10426 |
|
10427 | if (element.nodeName === 'SELECT') {
|
10428 | element.focus();
|
10429 |
|
10430 | selectedText = element.value;
|
10431 | }
|
10432 | else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
|
10433 | var isReadOnly = element.hasAttribute('readonly');
|
10434 |
|
10435 | if (!isReadOnly) {
|
10436 | element.setAttribute('readonly', '');
|
10437 | }
|
10438 |
|
10439 | element.select();
|
10440 | element.setSelectionRange(0, element.value.length);
|
10441 |
|
10442 | if (!isReadOnly) {
|
10443 | element.removeAttribute('readonly');
|
10444 | }
|
10445 |
|
10446 | selectedText = element.value;
|
10447 | }
|
10448 | else {
|
10449 | if (element.hasAttribute('contenteditable')) {
|
10450 | element.focus();
|
10451 | }
|
10452 |
|
10453 | var selection = window.getSelection();
|
10454 | var range = document.createRange();
|
10455 |
|
10456 | range.selectNodeContents(element);
|
10457 | selection.removeAllRanges();
|
10458 | selection.addRange(range);
|
10459 |
|
10460 | selectedText = selection.toString();
|
10461 | }
|
10462 |
|
10463 | return selectedText;
|
10464 | }
|
10465 |
|
10466 | module.exports = select;
|
10467 |
|
10468 |
|
10469 | }),
|
10470 |
|
10471 | (function(module, exports) {
|
10472 |
|
10473 | function E () {
|
10474 |
|
10475 |
|
10476 | }
|
10477 |
|
10478 | E.prototype = {
|
10479 | on: function (name, callback, ctx) {
|
10480 | var e = this.e || (this.e = {});
|
10481 |
|
10482 | (e[name] || (e[name] = [])).push({
|
10483 | fn: callback,
|
10484 | ctx: ctx
|
10485 | });
|
10486 |
|
10487 | return this;
|
10488 | },
|
10489 |
|
10490 | once: function (name, callback, ctx) {
|
10491 | var self = this;
|
10492 | function listener () {
|
10493 | self.off(name, listener);
|
10494 | callback.apply(ctx, arguments);
|
10495 | };
|
10496 |
|
10497 | listener._ = callback
|
10498 | return this.on(name, listener, ctx);
|
10499 | },
|
10500 |
|
10501 | emit: function (name) {
|
10502 | var data = [].slice.call(arguments, 1);
|
10503 | var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
10504 | var i = 0;
|
10505 | var len = evtArr.length;
|
10506 |
|
10507 | for (i; i < len; i++) {
|
10508 | evtArr[i].fn.apply(evtArr[i].ctx, data);
|
10509 | }
|
10510 |
|
10511 | return this;
|
10512 | },
|
10513 |
|
10514 | off: function (name, callback) {
|
10515 | var e = this.e || (this.e = {});
|
10516 | var evts = e[name];
|
10517 | var liveEvents = [];
|
10518 |
|
10519 | if (evts && callback) {
|
10520 | for (var i = 0, len = evts.length; i < len; i++) {
|
10521 | if (evts[i].fn !== callback && evts[i].fn._ !== callback)
|
10522 | liveEvents.push(evts[i]);
|
10523 | }
|
10524 | }
|
10525 |
|
10526 |
|
10527 |
|
10528 |
|
10529 |
|
10530 | (liveEvents.length)
|
10531 | ? e[name] = liveEvents
|
10532 | : delete e[name];
|
10533 |
|
10534 | return this;
|
10535 | }
|
10536 | };
|
10537 |
|
10538 | module.exports = E;
|
10539 | module.exports.TinyEmitter = E;
|
10540 |
|
10541 |
|
10542 | }),
|
10543 |
|
10544 | (function(module, exports, __webpack_require__) {
|
10545 |
|
10546 | var is = __webpack_require__(99);
|
10547 | var delegate = __webpack_require__(100);
|
10548 |
|
10549 | |
10550 |
|
10551 |
|
10552 |
|
10553 |
|
10554 |
|
10555 |
|
10556 |
|
10557 |
|
10558 | function listen(target, type, callback) {
|
10559 | if (!target && !type && !callback) {
|
10560 | throw new Error('Missing required arguments');
|
10561 | }
|
10562 |
|
10563 | if (!is.string(type)) {
|
10564 | throw new TypeError('Second argument must be a String');
|
10565 | }
|
10566 |
|
10567 | if (!is.fn(callback)) {
|
10568 | throw new TypeError('Third argument must be a Function');
|
10569 | }
|
10570 |
|
10571 | if (is.node(target)) {
|
10572 | return listenNode(target, type, callback);
|
10573 | }
|
10574 | else if (is.nodeList(target)) {
|
10575 | return listenNodeList(target, type, callback);
|
10576 | }
|
10577 | else if (is.string(target)) {
|
10578 | return listenSelector(target, type, callback);
|
10579 | }
|
10580 | else {
|
10581 | throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
|
10582 | }
|
10583 | }
|
10584 |
|
10585 | |
10586 |
|
10587 |
|
10588 |
|
10589 |
|
10590 |
|
10591 |
|
10592 |
|
10593 |
|
10594 | function listenNode(node, type, callback) {
|
10595 | node.addEventListener(type, callback);
|
10596 |
|
10597 | return {
|
10598 | destroy: function() {
|
10599 | node.removeEventListener(type, callback);
|
10600 | }
|
10601 | }
|
10602 | }
|
10603 |
|
10604 | |
10605 |
|
10606 |
|
10607 |
|
10608 |
|
10609 |
|
10610 |
|
10611 |
|
10612 |
|
10613 | function listenNodeList(nodeList, type, callback) {
|
10614 | Array.prototype.forEach.call(nodeList, function(node) {
|
10615 | node.addEventListener(type, callback);
|
10616 | });
|
10617 |
|
10618 | return {
|
10619 | destroy: function() {
|
10620 | Array.prototype.forEach.call(nodeList, function(node) {
|
10621 | node.removeEventListener(type, callback);
|
10622 | });
|
10623 | }
|
10624 | }
|
10625 | }
|
10626 |
|
10627 | |
10628 |
|
10629 |
|
10630 |
|
10631 |
|
10632 |
|
10633 |
|
10634 |
|
10635 |
|
10636 | function listenSelector(selector, type, callback) {
|
10637 | return delegate(document.body, selector, type, callback);
|
10638 | }
|
10639 |
|
10640 | module.exports = listen;
|
10641 |
|
10642 |
|
10643 | }),
|
10644 |
|
10645 | (function(module, exports) {
|
10646 |
|
10647 | |
10648 |
|
10649 |
|
10650 |
|
10651 |
|
10652 |
|
10653 | exports.node = function(value) {
|
10654 | return value !== undefined
|
10655 | && value instanceof HTMLElement
|
10656 | && value.nodeType === 1;
|
10657 | };
|
10658 |
|
10659 | |
10660 |
|
10661 |
|
10662 |
|
10663 |
|
10664 |
|
10665 | exports.nodeList = function(value) {
|
10666 | var type = Object.prototype.toString.call(value);
|
10667 |
|
10668 | return value !== undefined
|
10669 | && (type === '[object NodeList]' || type === '[object HTMLCollection]')
|
10670 | && ('length' in value)
|
10671 | && (value.length === 0 || exports.node(value[0]));
|
10672 | };
|
10673 |
|
10674 | |
10675 |
|
10676 |
|
10677 |
|
10678 |
|
10679 |
|
10680 | exports.string = function(value) {
|
10681 | return typeof value === 'string'
|
10682 | || value instanceof String;
|
10683 | };
|
10684 |
|
10685 | |
10686 |
|
10687 |
|
10688 |
|
10689 |
|
10690 |
|
10691 | exports.fn = function(value) {
|
10692 | var type = Object.prototype.toString.call(value);
|
10693 |
|
10694 | return type === '[object Function]';
|
10695 | };
|
10696 |
|
10697 |
|
10698 | }),
|
10699 |
|
10700 | (function(module, exports, __webpack_require__) {
|
10701 |
|
10702 | var closest = __webpack_require__(101);
|
10703 |
|
10704 | |
10705 |
|
10706 |
|
10707 |
|
10708 |
|
10709 |
|
10710 |
|
10711 |
|
10712 |
|
10713 |
|
10714 | function _delegate(element, selector, type, callback, useCapture) {
|
10715 | var listenerFn = listener.apply(this, arguments);
|
10716 |
|
10717 | element.addEventListener(type, listenerFn, useCapture);
|
10718 |
|
10719 | return {
|
10720 | destroy: function() {
|
10721 | element.removeEventListener(type, listenerFn, useCapture);
|
10722 | }
|
10723 | }
|
10724 | }
|
10725 |
|
10726 | |
10727 |
|
10728 |
|
10729 |
|
10730 |
|
10731 |
|
10732 |
|
10733 |
|
10734 |
|
10735 |
|
10736 | function delegate(elements, selector, type, callback, useCapture) {
|
10737 |
|
10738 | if (typeof elements.addEventListener === 'function') {
|
10739 | return _delegate.apply(null, arguments);
|
10740 | }
|
10741 |
|
10742 |
|
10743 | if (typeof type === 'function') {
|
10744 |
|
10745 |
|
10746 | return _delegate.bind(null, document).apply(null, arguments);
|
10747 | }
|
10748 |
|
10749 |
|
10750 | if (typeof elements === 'string') {
|
10751 | elements = document.querySelectorAll(elements);
|
10752 | }
|
10753 |
|
10754 |
|
10755 | return Array.prototype.map.call(elements, function (element) {
|
10756 | return _delegate(element, selector, type, callback, useCapture);
|
10757 | });
|
10758 | }
|
10759 |
|
10760 | |
10761 |
|
10762 |
|
10763 |
|
10764 |
|
10765 |
|
10766 |
|
10767 |
|
10768 |
|
10769 | function listener(element, selector, type, callback) {
|
10770 | return function(e) {
|
10771 | e.delegateTarget = closest(e.target, selector);
|
10772 |
|
10773 | if (e.delegateTarget) {
|
10774 | callback.call(element, e);
|
10775 | }
|
10776 | }
|
10777 | }
|
10778 |
|
10779 | module.exports = delegate;
|
10780 |
|
10781 |
|
10782 | }),
|
10783 |
|
10784 | (function(module, exports) {
|
10785 |
|
10786 | var DOCUMENT_NODE_TYPE = 9;
|
10787 |
|
10788 | |
10789 |
|
10790 |
|
10791 | if (typeof Element !== 'undefined' && !Element.prototype.matches) {
|
10792 | var proto = Element.prototype;
|
10793 |
|
10794 | proto.matches = proto.matchesSelector ||
|
10795 | proto.mozMatchesSelector ||
|
10796 | proto.msMatchesSelector ||
|
10797 | proto.oMatchesSelector ||
|
10798 | proto.webkitMatchesSelector;
|
10799 | }
|
10800 |
|
10801 | |
10802 |
|
10803 |
|
10804 |
|
10805 |
|
10806 |
|
10807 |
|
10808 | function closest (element, selector) {
|
10809 | while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
|
10810 | if (typeof element.matches === 'function' &&
|
10811 | element.matches(selector)) {
|
10812 | return element;
|
10813 | }
|
10814 | element = element.parentNode;
|
10815 | }
|
10816 | }
|
10817 |
|
10818 | module.exports = closest;
|
10819 |
|
10820 |
|
10821 | }),
|
10822 |
|
10823 | (function(module, exports, __webpack_require__) {
|
10824 |
|
10825 | 'use strict';
|
10826 |
|
10827 | Object.defineProperty(exports, "__esModule", {
|
10828 | value: true
|
10829 | });
|
10830 |
|
10831 | var _Icon = __webpack_require__(103);
|
10832 |
|
10833 | var _Icon2 = _interopRequireDefault(_Icon);
|
10834 |
|
10835 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10836 |
|
10837 | exports["default"] = _Icon2["default"];
|
10838 | module.exports = exports['default'];
|
10839 |
|
10840 | }),
|
10841 |
|
10842 | (function(module, exports, __webpack_require__) {
|
10843 |
|
10844 | 'use strict';
|
10845 |
|
10846 | Object.defineProperty(exports, "__esModule", {
|
10847 | value: true
|
10848 | });
|
10849 |
|
10850 | 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; };
|
10851 |
|
10852 | var _react = __webpack_require__(1);
|
10853 |
|
10854 | var _react2 = _interopRequireDefault(_react);
|
10855 |
|
10856 | var _classnames = __webpack_require__(5);
|
10857 |
|
10858 | var _classnames2 = _interopRequireDefault(_classnames);
|
10859 |
|
10860 | var _propTypes = __webpack_require__(6);
|
10861 |
|
10862 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
10863 |
|
10864 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10865 |
|
10866 | 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; }
|
10867 |
|
10868 | 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; }
|
10869 |
|
10870 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
10871 |
|
10872 | 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; }
|
10873 |
|
10874 | 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); }
|
10875 |
|
10876 | var propTypes = {
|
10877 | type: _propTypes2["default"].string
|
10878 |
|
10879 | };
|
10880 | |
10881 |
|
10882 |
|
10883 | var defaultProps = {
|
10884 | clsPrefix: 'uf'
|
10885 | };
|
10886 |
|
10887 | var Icon = function (_Component) {
|
10888 | _inherits(Icon, _Component);
|
10889 |
|
10890 | function Icon(props) {
|
10891 | _classCallCheck(this, Icon);
|
10892 |
|
10893 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
10894 | }
|
10895 |
|
10896 | Icon.prototype.render = function render() {
|
10897 | var _props = this.props,
|
10898 | type = _props.type,
|
10899 | className = _props.className,
|
10900 | clsPrefix = _props.clsPrefix,
|
10901 | others = _objectWithoutProperties(_props, ['type', 'className', 'clsPrefix']);
|
10902 |
|
10903 | var clsObj = {};
|
10904 |
|
10905 | var classNames = (0, _classnames2["default"])(clsPrefix, type);
|
10906 |
|
10907 | return _react2["default"].createElement('i', _extends({}, others, { className: (0, _classnames2["default"])(classNames, className) }));
|
10908 | };
|
10909 |
|
10910 | return Icon;
|
10911 | }(_react.Component);
|
10912 |
|
10913 | Icon.defaultProps = defaultProps;
|
10914 | Icon.propTypes = propTypes;
|
10915 |
|
10916 | exports["default"] = Icon;
|
10917 | module.exports = exports['default'];
|
10918 |
|
10919 | }),
|
10920 |
|
10921 | (function(module, exports, __webpack_require__) {
|
10922 |
|
10923 | 'use strict';
|
10924 |
|
10925 | Object.defineProperty(exports, "__esModule", {
|
10926 | value: true
|
10927 | });
|
10928 |
|
10929 | var _Tooltip = __webpack_require__(105);
|
10930 |
|
10931 | var _Tooltip2 = _interopRequireDefault(_Tooltip);
|
10932 |
|
10933 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10934 |
|
10935 | exports["default"] = _Tooltip2["default"];
|
10936 | module.exports = exports['default'];
|
10937 |
|
10938 | }),
|
10939 |
|
10940 | (function(module, exports, __webpack_require__) {
|
10941 |
|
10942 | 'use strict';
|
10943 |
|
10944 | Object.defineProperty(exports, "__esModule", {
|
10945 | value: true
|
10946 | });
|
10947 |
|
10948 | 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; };
|
10949 |
|
10950 | var _classnames = __webpack_require__(5);
|
10951 |
|
10952 | var _classnames2 = _interopRequireDefault(_classnames);
|
10953 |
|
10954 | var _react = __webpack_require__(1);
|
10955 |
|
10956 | var _react2 = _interopRequireDefault(_react);
|
10957 |
|
10958 | var _propTypes = __webpack_require__(6);
|
10959 |
|
10960 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
10961 |
|
10962 | var _OverlayTrigger = __webpack_require__(106);
|
10963 |
|
10964 | var _OverlayTrigger2 = _interopRequireDefault(_OverlayTrigger);
|
10965 |
|
10966 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10967 |
|
10968 | 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; }
|
10969 |
|
10970 | 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; }
|
10971 |
|
10972 | 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; }
|
10973 |
|
10974 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
10975 |
|
10976 | 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; }
|
10977 |
|
10978 | 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); }
|
10979 |
|
10980 | var propTypes = {
|
10981 | |
10982 |
|
10983 |
|
10984 | id: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
10985 | inverse: _propTypes2["default"].bool,
|
10986 | visible: _propTypes2["default"].bool,
|
10987 | onVisibleChange: _propTypes2["default"].func,
|
10988 | |
10989 |
|
10990 |
|
10991 | placement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
10992 |
|
10993 | |
10994 |
|
10995 |
|
10996 | positionTop: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
|
10997 | |
10998 |
|
10999 |
|
11000 | positionLeft: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
|
11001 |
|
11002 | |
11003 |
|
11004 |
|
11005 | arrowOffsetTop: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
|
11006 | |
11007 |
|
11008 |
|
11009 | arrowOffsetLeft: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string])
|
11010 | };
|
11011 |
|
11012 | var defaultProps = {
|
11013 | placement: 'right',
|
11014 | clsPrefix: 'u-tooltip'
|
11015 | };
|
11016 | function OverlayNode(props) {
|
11017 | var className = props.className,
|
11018 | classNames = props.classNames,
|
11019 | style = props.style,
|
11020 | overlay = props.overlay,
|
11021 | arrowOffsetTop = props.arrowOffsetTop,
|
11022 | arrowOffsetLeft = props.arrowOffsetLeft;
|
11023 |
|
11024 | return _react2["default"].createElement(
|
11025 | 'div',
|
11026 | {
|
11027 | className: (0, _classnames2["default"])(className, classNames),
|
11028 | onMouseEnter: props.onMouseEnter,
|
11029 | onMouseLeave: props.onMouseLeave,
|
11030 | style: style
|
11031 | },
|
11032 | overlay ? _react2["default"].createElement('div', { className: 'tooltip-arrow', style: {
|
11033 | top: arrowOffsetTop,
|
11034 | left: arrowOffsetLeft
|
11035 | } }) : '',
|
11036 | overlay ? _react2["default"].createElement(
|
11037 | 'div',
|
11038 | { className: 'tooltip-inner' },
|
11039 | overlay
|
11040 | ) : ''
|
11041 | );
|
11042 | }
|
11043 |
|
11044 | var Tooltip = function (_React$Component) {
|
11045 | _inherits(Tooltip, _React$Component);
|
11046 |
|
11047 | function Tooltip(props) {
|
11048 | _classCallCheck(this, Tooltip);
|
11049 |
|
11050 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
11051 |
|
11052 | _this.onMouseEnter = function () {
|
11053 | _this.setState({
|
11054 | isHoverShow: true
|
11055 | });
|
11056 | };
|
11057 |
|
11058 | _this.onMouseLeave = function () {
|
11059 | _this.setState({
|
11060 | isHoverShow: false
|
11061 | });
|
11062 | };
|
11063 |
|
11064 | var initState = {
|
11065 | isHoverShow: false
|
11066 | };
|
11067 | if ('visible' in props) {
|
11068 | _extends(initState, {
|
11069 | visible: props.visible
|
11070 | });
|
11071 | }
|
11072 | _this.state = initState;
|
11073 | return _this;
|
11074 | }
|
11075 |
|
11076 | Tooltip.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
11077 | var _props = this.props,
|
11078 | visible = _props.visible,
|
11079 | onVisibleChange = _props.onVisibleChange;
|
11080 |
|
11081 | if ('visible' in this.props && prevProps.visible !== visible) {
|
11082 | this.setState({
|
11083 | visible: visible
|
11084 | });
|
11085 | onVisibleChange && onVisibleChange(visible);
|
11086 | }
|
11087 | };
|
11088 |
|
11089 | |
11090 |
|
11091 |
|
11092 |
|
11093 |
|
11094 | |
11095 |
|
11096 |
|
11097 |
|
11098 |
|
11099 | Tooltip.prototype.render = function render() {
|
11100 | var _classes,
|
11101 | _this2 = this;
|
11102 |
|
11103 | var _props2 = this.props,
|
11104 | placement = _props2.placement,
|
11105 | positionTop = _props2.positionTop,
|
11106 | positionLeft = _props2.positionLeft,
|
11107 | arrowOffsetTop = _props2.arrowOffsetTop,
|
11108 | arrowOffsetLeft = _props2.arrowOffsetLeft,
|
11109 | className = _props2.className,
|
11110 | style = _props2.style,
|
11111 | children = _props2.children,
|
11112 | clsPrefix = _props2.clsPrefix,
|
11113 | overlay = _props2.overlay,
|
11114 | inverse = _props2.inverse,
|
11115 | others = _objectWithoutProperties(_props2, ['placement', 'positionTop', 'positionLeft', 'arrowOffsetTop', 'arrowOffsetLeft', 'className', 'style', 'children', 'clsPrefix', 'overlay', 'inverse']);
|
11116 |
|
11117 | var classes = (_classes = {}, _defineProperty(_classes, placement, true), _defineProperty(_classes, 'inverse', inverse), _classes);
|
11118 |
|
11119 | var outerStyle = _extends({
|
11120 | top: positionTop,
|
11121 | left: positionLeft
|
11122 | }, style);
|
11123 |
|
11124 | var arrowStyle = {
|
11125 | top: arrowOffsetTop,
|
11126 | left: arrowOffsetLeft
|
11127 | };
|
11128 |
|
11129 | var classNames = (0, _classnames2["default"])(clsPrefix, classes);
|
11130 |
|
11131 | var overlayNode = _react2["default"].createElement(OverlayNode, {
|
11132 | className: className,
|
11133 | classNames: classNames,
|
11134 | overlay: overlay,
|
11135 | onMouseEnter: this.onMouseEnter,
|
11136 | onMouseLeave: this.onMouseLeave,
|
11137 | style: true,
|
11138 | arrowOffsetTop: true,
|
11139 | arrowOffsetLeft: true
|
11140 | });
|
11141 | return 'visible' in this.props ? _react2["default"].createElement(
|
11142 | _OverlayTrigger2["default"],
|
11143 | _extends({ visible: this.state.visible, ref: function ref(_ref) {
|
11144 | return _this2.trigger = _ref;
|
11145 | }, shouldUpdatePosition: true, placement: placement }, others, { overlay: overlayNode }),
|
11146 | children
|
11147 | ) : _react2["default"].createElement(
|
11148 | _OverlayTrigger2["default"],
|
11149 | _extends({ isHoverShow: this.state.isHoverShow, ref: function ref(_ref2) {
|
11150 | return _this2.trigger = _ref2;
|
11151 | }, shouldUpdatePosition: true, placement: placement }, others, { overlay: overlayNode }),
|
11152 | children
|
11153 | );
|
11154 | };
|
11155 |
|
11156 | return Tooltip;
|
11157 | }(_react2["default"].Component);
|
11158 |
|
11159 | Tooltip.propTypes = propTypes;
|
11160 | Tooltip.defaultProps = defaultProps;
|
11161 |
|
11162 | exports["default"] = Tooltip;
|
11163 | module.exports = exports['default'];
|
11164 |
|
11165 | }),
|
11166 |
|
11167 | (function(module, exports, __webpack_require__) {
|
11168 |
|
11169 | 'use strict';
|
11170 |
|
11171 | Object.defineProperty(exports, "__esModule", {
|
11172 | value: true
|
11173 | });
|
11174 |
|
11175 | 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; };
|
11176 |
|
11177 | var _contains = __webpack_require__(107);
|
11178 |
|
11179 | var _contains2 = _interopRequireDefault(_contains);
|
11180 |
|
11181 | var _react = __webpack_require__(1);
|
11182 |
|
11183 | var _react2 = _interopRequireDefault(_react);
|
11184 |
|
11185 | var _propTypes = __webpack_require__(6);
|
11186 |
|
11187 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
11188 |
|
11189 | var _reactDom = __webpack_require__(2);
|
11190 |
|
11191 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
11192 |
|
11193 | var _warning = __webpack_require__(32);
|
11194 |
|
11195 | var _warning2 = _interopRequireDefault(_warning);
|
11196 |
|
11197 | var _Portal = __webpack_require__(108);
|
11198 |
|
11199 | var _Portal2 = _interopRequireDefault(_Portal);
|
11200 |
|
11201 | var _Overlay = __webpack_require__(112);
|
11202 |
|
11203 | var _Overlay2 = _interopRequireDefault(_Overlay);
|
11204 |
|
11205 | var _createChainedFunction = __webpack_require__(131);
|
11206 |
|
11207 | var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
|
11208 |
|
11209 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11210 |
|
11211 | 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; }
|
11212 |
|
11213 | 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; }
|
11214 |
|
11215 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11216 |
|
11217 | 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; }
|
11218 |
|
11219 | 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); }
|
11220 |
|
11221 | var isReact16 = _reactDom2["default"].createPortal !== undefined;
|
11222 | var createPortal = isReact16 ? _reactDom2["default"].createPortal : _reactDom2["default"].unstable_renderSubtreeIntoContainer;
|
11223 |
|
11224 | |
11225 |
|
11226 |
|
11227 |
|
11228 |
|
11229 |
|
11230 |
|
11231 | function isOneOf(one, of) {
|
11232 | if (Array.isArray(of)) {
|
11233 | return of.indexOf(one) >= 0;
|
11234 | }
|
11235 | return one === of;
|
11236 | }
|
11237 |
|
11238 | var triggerType = _propTypes2["default"].oneOf(['click', 'hover', 'focus']);
|
11239 |
|
11240 | var propTypes = _extends({}, _Portal2["default"].propTypes, _Overlay2["default"].propTypes, {
|
11241 |
|
11242 | |
11243 |
|
11244 |
|
11245 | trigger: _propTypes2["default"].oneOfType([triggerType, _propTypes2["default"].arrayOf(triggerType)]),
|
11246 |
|
11247 | |
11248 |
|
11249 |
|
11250 | delay: _propTypes2["default"].number,
|
11251 | |
11252 |
|
11253 |
|
11254 | delayShow: _propTypes2["default"].number,
|
11255 | |
11256 |
|
11257 |
|
11258 | delayHide: _propTypes2["default"].number,
|
11259 |
|
11260 |
|
11261 | |
11262 |
|
11263 |
|
11264 | defaultOverlayShown: _propTypes2["default"].bool,
|
11265 | visible: _propTypes2["default"].bool,
|
11266 |
|
11267 | |
11268 |
|
11269 |
|
11270 | overlay: _propTypes2["default"].node.isRequired,
|
11271 |
|
11272 | |
11273 |
|
11274 |
|
11275 | onBlur: _propTypes2["default"].func,
|
11276 | |
11277 |
|
11278 |
|
11279 | onClick: _propTypes2["default"].func,
|
11280 | |
11281 |
|
11282 |
|
11283 | onFocus: _propTypes2["default"].func,
|
11284 | |
11285 |
|
11286 |
|
11287 | onMouseOut: _propTypes2["default"].func,
|
11288 | |
11289 |
|
11290 |
|
11291 | onMouseOver: _propTypes2["default"].func,
|
11292 |
|
11293 |
|
11294 | |
11295 |
|
11296 |
|
11297 | target: _propTypes2["default"].oneOf([null]),
|
11298 | |
11299 |
|
11300 |
|
11301 | onHide: _propTypes2["default"].oneOf([null]),
|
11302 | |
11303 |
|
11304 |
|
11305 | show: _propTypes2["default"].oneOf([null])
|
11306 | });
|
11307 |
|
11308 | var defaultProps = {
|
11309 | defaultOverlayShown: false,
|
11310 | trigger: ['hover', 'focus']
|
11311 | };
|
11312 |
|
11313 | var OverlayTrigger = function (_Component) {
|
11314 | _inherits(OverlayTrigger, _Component);
|
11315 |
|
11316 | function OverlayTrigger(props, context) {
|
11317 | _classCallCheck(this, OverlayTrigger);
|
11318 |
|
11319 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
11320 |
|
11321 | _this.handleToggle = _this.handleToggle.bind(_this);
|
11322 | _this.handleDelayedShow = _this.handleDelayedShow.bind(_this);
|
11323 | _this.handleDelayedHide = _this.handleDelayedHide.bind(_this);
|
11324 | _this.handleHide = _this.handleHide.bind(_this);
|
11325 | _this.makeOverlay = _this.makeOverlay.bind(_this);
|
11326 |
|
11327 | _this.handleMouseOver = function (e) {
|
11328 | return _this.handleMouseOverOut(_this.handleDelayedShow, e);
|
11329 | };
|
11330 | _this.handleMouseOut = function (e) {
|
11331 | return _this.handleMouseOverOut(_this.handleDelayedHide, e);
|
11332 | };
|
11333 |
|
11334 | _this._mountNode = null;
|
11335 |
|
11336 | var visible = void 0;
|
11337 | if ('visible' in props) {
|
11338 | visible = !!props.visible;
|
11339 | } else {
|
11340 | visible = !!props.defaultOverlayShown;
|
11341 | }
|
11342 |
|
11343 | _this.state = {
|
11344 | show: visible
|
11345 | };
|
11346 | return _this;
|
11347 | }
|
11348 |
|
11349 | OverlayTrigger.prototype.componentDidMount = function componentDidMount() {
|
11350 | this._mountNode = document.createElement('div');
|
11351 | !isReact16 && this.renderOverlay();
|
11352 | };
|
11353 |
|
11354 | OverlayTrigger.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
11355 | !isReact16 && this.renderOverlay();
|
11356 | if ('visible' in this.props && prevProps.visible !== this.props.visible) {
|
11357 | this.setState({
|
11358 | show: this.props.visible
|
11359 | });
|
11360 | }
|
11361 | if ('isHoverShow' in this.props && prevProps.isHoverShow !== this.props.isHoverShow) {
|
11362 | this.setState({
|
11363 | show: this.props.isHoverShow
|
11364 | });
|
11365 | }
|
11366 | };
|
11367 |
|
11368 | OverlayTrigger.prototype.componentWillUnmount = function componentWillUnmount() {
|
11369 | !isReact16 && _reactDom2["default"].unmountComponentAtNode(this._mountNode);
|
11370 | this._mountNode = null;
|
11371 |
|
11372 | this._hoverShowDelay && clearTimeout(this._hoverShowDelay);
|
11373 | this._hoverShowDelay && clearTimeout(this._hoverHideDelay);
|
11374 | };
|
11375 |
|
11376 | OverlayTrigger.prototype.handleToggle = function handleToggle() {
|
11377 | if (this.state.show) {
|
11378 | this.hide();
|
11379 | } else {
|
11380 | this.show();
|
11381 | }
|
11382 | };
|
11383 |
|
11384 | OverlayTrigger.prototype.handleDelayedShow = function handleDelayedShow() {
|
11385 | var _this2 = this;
|
11386 |
|
11387 | if (this._hoverHideDelay != null) {
|
11388 | clearTimeout(this._hoverHideDelay);
|
11389 | this._hoverHideDelay = null;
|
11390 | return;
|
11391 | }
|
11392 |
|
11393 | if (this.state.show || this._hoverShowDelay != null) {
|
11394 | return;
|
11395 | }
|
11396 |
|
11397 | var delay = this.props.delayShow != null ? this.props.delayShow : this.props.delay;
|
11398 |
|
11399 | if (!delay) {
|
11400 | this.show();
|
11401 | return;
|
11402 | }
|
11403 |
|
11404 | this._hoverShowDelay = setTimeout(function () {
|
11405 | _this2._hoverShowDelay = null;
|
11406 | _this2.show();
|
11407 | }, delay);
|
11408 | };
|
11409 |
|
11410 | OverlayTrigger.prototype.handleDelayedHide = function handleDelayedHide() {
|
11411 | var _this3 = this;
|
11412 |
|
11413 | if (this._hoverShowDelay != null) {
|
11414 | clearTimeout(this._hoverShowDelay);
|
11415 | this._hoverShowDelay = null;
|
11416 | return;
|
11417 | }
|
11418 |
|
11419 | if (!this.state.show || this._hoverHideDelay != null) {
|
11420 | return;
|
11421 | }
|
11422 |
|
11423 | var delay = this.props.delayHide != null ? this.props.delayHide : this.props.delay;
|
11424 |
|
11425 | if (!delay) {
|
11426 | this.hide();
|
11427 | return;
|
11428 | }
|
11429 |
|
11430 | this._hoverHideDelay = setTimeout(function () {
|
11431 | _this3._hoverHideDelay = null;
|
11432 | _this3.hide();
|
11433 | }, delay);
|
11434 | };
|
11435 |
|
11436 |
|
11437 |
|
11438 |
|
11439 |
|
11440 |
|
11441 |
|
11442 | OverlayTrigger.prototype.handleMouseOverOut = function handleMouseOverOut(handler, e) {
|
11443 | var target = e.currentTarget;
|
11444 | var related = e.relatedTarget || e.nativeEvent.toElement;
|
11445 |
|
11446 | if (!related || related !== target && !(0, _contains2["default"])(target, related)) {
|
11447 | handler(e);
|
11448 | }
|
11449 | };
|
11450 |
|
11451 | OverlayTrigger.prototype.handleHide = function handleHide() {
|
11452 | this.hide();
|
11453 | };
|
11454 |
|
11455 | OverlayTrigger.prototype.show = function show() {
|
11456 | this.setState({ show: true });
|
11457 | };
|
11458 |
|
11459 | OverlayTrigger.prototype.hide = function hide() {
|
11460 | this.setState({ show: false });
|
11461 | };
|
11462 |
|
11463 | OverlayTrigger.prototype.makeOverlay = function makeOverlay(overlay, props) {
|
11464 | return _react2["default"].createElement(
|
11465 | _Overlay2["default"],
|
11466 | _extends({}, props, {
|
11467 | show: this.state.show,
|
11468 | onHide: this.handleHide,
|
11469 | target: this
|
11470 | }),
|
11471 | overlay
|
11472 | );
|
11473 | };
|
11474 |
|
11475 | OverlayTrigger.prototype.renderOverlay = function renderOverlay() {
|
11476 | _reactDom2["default"].unstable_renderSubtreeIntoContainer(this, this._overlay, this._mountNode);
|
11477 | };
|
11478 |
|
11479 | OverlayTrigger.prototype.render = function render() {
|
11480 | var _props = this.props,
|
11481 | trigger = _props.trigger,
|
11482 | overlay = _props.overlay,
|
11483 | children = _props.children,
|
11484 | onBlur = _props.onBlur,
|
11485 | onClick = _props.onClick,
|
11486 | onFocus = _props.onFocus,
|
11487 | onMouseOut = _props.onMouseOut,
|
11488 | onMouseOver = _props.onMouseOver,
|
11489 | props = _objectWithoutProperties(_props, ['trigger', 'overlay', 'children', 'onBlur', 'onClick', 'onFocus', 'onMouseOut', 'onMouseOver']);
|
11490 |
|
11491 | delete props.delay;
|
11492 | delete props.delayShow;
|
11493 | delete props.delayHide;
|
11494 | delete props.defaultOverlayShown;
|
11495 |
|
11496 | var child = _react2["default"].Children.only(children);
|
11497 | var childProps = child.props;
|
11498 |
|
11499 | var triggerProps = {
|
11500 | 'aria-describedby': overlay.props.id
|
11501 | };
|
11502 |
|
11503 |
|
11504 |
|
11505 | triggerProps.onClick = (0, _createChainedFunction2["default"])(childProps.onClick, onClick);
|
11506 |
|
11507 | if (isOneOf('click', trigger) && !('visible' in this.props)) {
|
11508 | triggerProps.onClick = (0, _createChainedFunction2["default"])(triggerProps.onClick, this.handleToggle);
|
11509 | }
|
11510 |
|
11511 | if (isOneOf('hover', trigger) && !('visible' in this.props)) {
|
11512 | (0, _warning2["default"])(!(trigger === 'hover'), '[react-bootstrap] Specifying only the `"hover"` trigger limits the ' + 'visibility of the overlay to just mouse users. Consider also ' + 'including the `"focus"` trigger so that touch and keyboard only ' + 'users can see the overlay as well.');
|
11513 |
|
11514 | triggerProps.onMouseOver = (0, _createChainedFunction2["default"])(childProps.onMouseOver, onMouseOver, this.handleMouseOver);
|
11515 | triggerProps.onMouseOut = (0, _createChainedFunction2["default"])(childProps.onMouseOut, onMouseOut, this.handleMouseOut);
|
11516 | }
|
11517 |
|
11518 | if (isOneOf('focus', trigger) && !('visible' in this.props)) {
|
11519 | triggerProps.onFocus = (0, _createChainedFunction2["default"])(childProps.onFocus, onFocus, this.handleDelayedShow);
|
11520 | triggerProps.onBlur = (0, _createChainedFunction2["default"])(childProps.onBlur, onBlur, this.handleDelayedHide);
|
11521 | }
|
11522 |
|
11523 | this._overlay = this.makeOverlay(overlay, props);
|
11524 |
|
11525 | if (!isReact16) {
|
11526 | return (0, _react.cloneElement)(child, triggerProps);
|
11527 | }
|
11528 | triggerProps.key = 'overlay';
|
11529 |
|
11530 | var portal = _react2["default"].createElement(
|
11531 | _Portal2["default"],
|
11532 | {
|
11533 | key: 'portal',
|
11534 | container: props.container },
|
11535 | this._overlay
|
11536 | );
|
11537 |
|
11538 | return [(0, _react.cloneElement)(child, triggerProps), portal];
|
11539 | };
|
11540 |
|
11541 | return OverlayTrigger;
|
11542 | }(_react.Component);
|
11543 |
|
11544 | OverlayTrigger.propTypes = propTypes;
|
11545 | OverlayTrigger.defaultProps = defaultProps;
|
11546 |
|
11547 | exports["default"] = OverlayTrigger;
|
11548 | module.exports = exports['default'];
|
11549 |
|
11550 | }),
|
11551 |
|
11552 | (function(module, exports, __webpack_require__) {
|
11553 |
|
11554 | "use strict";
|
11555 |
|
11556 | var _interopRequireDefault = __webpack_require__(14);
|
11557 |
|
11558 | exports.__esModule = true;
|
11559 | exports.default = void 0;
|
11560 |
|
11561 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
11562 |
|
11563 | var _default = function () {
|
11564 |
|
11565 |
|
11566 | return _inDOM.default ? function (context, node) {
|
11567 | if (context.contains) {
|
11568 | return context.contains(node);
|
11569 | } else if (context.compareDocumentPosition) {
|
11570 | return context === node || !!(context.compareDocumentPosition(node) & 16);
|
11571 | } else {
|
11572 | return fallback(context, node);
|
11573 | }
|
11574 | } : fallback;
|
11575 | }();
|
11576 |
|
11577 | exports.default = _default;
|
11578 |
|
11579 | function fallback(context, node) {
|
11580 | if (node) do {
|
11581 | if (node === context) return true;
|
11582 | } while (node = node.parentNode);
|
11583 | return false;
|
11584 | }
|
11585 |
|
11586 | module.exports = exports["default"];
|
11587 |
|
11588 | }),
|
11589 |
|
11590 | (function(module, exports, __webpack_require__) {
|
11591 |
|
11592 | 'use strict';
|
11593 |
|
11594 | Object.defineProperty(exports, "__esModule", {
|
11595 | value: true
|
11596 | });
|
11597 |
|
11598 | var _react = __webpack_require__(1);
|
11599 |
|
11600 | var _react2 = _interopRequireDefault(_react);
|
11601 |
|
11602 | var _reactDom = __webpack_require__(2);
|
11603 |
|
11604 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
11605 |
|
11606 | var _propTypes = __webpack_require__(6);
|
11607 |
|
11608 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
11609 |
|
11610 | var _ownerDocument = __webpack_require__(109);
|
11611 |
|
11612 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
11613 |
|
11614 | var _getContainer = __webpack_require__(111);
|
11615 |
|
11616 | var _getContainer2 = _interopRequireDefault(_getContainer);
|
11617 |
|
11618 | var _tinperBeeCore = __webpack_require__(27);
|
11619 |
|
11620 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11621 |
|
11622 | 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; }
|
11623 |
|
11624 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11625 |
|
11626 | 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; }
|
11627 |
|
11628 | 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); }
|
11629 |
|
11630 | var isReact16 = _reactDom2["default"].createPortal !== undefined;
|
11631 | var createPortal = isReact16 ? _reactDom2["default"].createPortal : _reactDom2["default"].unstable_renderSubtreeIntoContainer;
|
11632 |
|
11633 | var propTypes = {
|
11634 | |
11635 |
|
11636 |
|
11637 | container: _propTypes2["default"].oneOfType([_tinperBeeCore.componentOrElement, _propTypes2["default"].func])
|
11638 | };
|
11639 |
|
11640 | var defaultProps = {};
|
11641 |
|
11642 | |
11643 |
|
11644 |
|
11645 |
|
11646 | var Portal = function (_Component) {
|
11647 | _inherits(Portal, _Component);
|
11648 |
|
11649 | function Portal(props) {
|
11650 | _classCallCheck(this, Portal);
|
11651 |
|
11652 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
11653 |
|
11654 | _this.getMountNode = _this.getMountNode.bind(_this);
|
11655 | _this.getOverlayDOMNode = _this.getOverlayDOMNode.bind(_this);
|
11656 | _this.mountOverlayTarget = _this.mountOverlayTarget.bind(_this);
|
11657 | _this.unmountOverlayTarget = _this.unmountOverlayTarget.bind(_this);
|
11658 | _this.renderOverlay = _this.renderOverlay.bind(_this);
|
11659 | _this.unrenderOverlay = _this.unrenderOverlay.bind(_this);
|
11660 |
|
11661 | _this.overlayTarget = isReact16 ? document.createElement('div') : null;
|
11662 | return _this;
|
11663 | }
|
11664 |
|
11665 | Portal.prototype.componentDidMount = function componentDidMount() {
|
11666 | if (isReact16) {
|
11667 | this.portalContainerNode = (0, _getContainer2["default"])(this.props.container, (0, _ownerDocument2["default"])(this).body);
|
11668 | this.portalContainerNode.appendChild(this.overlayTarget);
|
11669 | } else {
|
11670 | this.renderOverlay();
|
11671 | }
|
11672 |
|
11673 | this.mounted = true;
|
11674 | };
|
11675 |
|
11676 | Portal.prototype.componentDidUpdate = function componentDidUpdate() {
|
11677 | if (isReact16) {
|
11678 | var overlay = !this.props.children ? null : _react2["default"].Children.only(this.props.children);
|
11679 | if (overlay === null) {
|
11680 | this.unrenderOverlay();
|
11681 | this.unmountOverlayTarget();
|
11682 | } else {}
|
11683 | } else {
|
11684 | this.renderOverlay();
|
11685 | }
|
11686 | };
|
11687 |
|
11688 |
|
11689 |
|
11690 | Portal.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
11691 | if (this.overlayTarget && nextProps.container !== this.props.container) {
|
11692 | this.portalContainerNode.removeChild(this.overlayTarget);
|
11693 | this.portalContainerNode = (0, _getContainer2["default"])(nextProps.container, (0, _ownerDocument2["default"])(this).body);
|
11694 | this.portalContainerNode.appendChild(this.overlayTarget);
|
11695 | }
|
11696 | };
|
11697 |
|
11698 | Portal.prototype.componentWillUnmount = function componentWillUnmount() {
|
11699 | this.unrenderOverlay();
|
11700 | this.unmountOverlayTarget();
|
11701 |
|
11702 | this.mounted = false;
|
11703 | };
|
11704 |
|
11705 | Portal.prototype.getMountNode = function getMountNode() {
|
11706 | return this.overlayTarget;
|
11707 | };
|
11708 |
|
11709 | Portal.prototype.getOverlayDOMNode = function getOverlayDOMNode() {
|
11710 | if (!this.mounted) {
|
11711 | throw new Error('getOverlayDOMNode(): A component must be mounted to have a DOM node.');
|
11712 | }
|
11713 |
|
11714 | if (this.overlayInstance) {
|
11715 | return _reactDom2["default"].findDOMNode(this.overlayInstance);
|
11716 | }
|
11717 |
|
11718 | return null;
|
11719 | };
|
11720 |
|
11721 | |
11722 |
|
11723 |
|
11724 |
|
11725 | Portal.prototype.mountOverlayTarget = function mountOverlayTarget() {
|
11726 | if (!this.overlayTarget) {
|
11727 | this.overlayTarget = document.createElement('div');
|
11728 | this.portalContainerNode = (0, _getContainer2["default"])(this.props.container, (0, _ownerDocument2["default"])(this).body);
|
11729 | this.portalContainerNode.appendChild(this.overlayTarget);
|
11730 | }
|
11731 | };
|
11732 | |
11733 |
|
11734 |
|
11735 |
|
11736 |
|
11737 | Portal.prototype.unmountOverlayTarget = function unmountOverlayTarget() {
|
11738 | if (this.overlayTarget) {
|
11739 | this.portalContainerNode.removeChild(this.overlayTarget);
|
11740 | this.overlayTarget = null;
|
11741 | }
|
11742 | this.portalContainerNode = null;
|
11743 | };
|
11744 | |
11745 |
|
11746 |
|
11747 |
|
11748 |
|
11749 | Portal.prototype.renderOverlay = function renderOverlay() {
|
11750 |
|
11751 | var overlay = !this.props.children ? null : _react2["default"].Children.only(this.props.children);
|
11752 |
|
11753 |
|
11754 | if (overlay !== null) {
|
11755 | this.mountOverlayTarget();
|
11756 | this.overlayInstance = _reactDom2["default"].unstable_renderSubtreeIntoContainer(this, overlay, this.overlayTarget);
|
11757 | } else {
|
11758 |
|
11759 | this.unrenderOverlay();
|
11760 | this.unmountOverlayTarget();
|
11761 | }
|
11762 | };
|
11763 | |
11764 |
|
11765 |
|
11766 |
|
11767 |
|
11768 | Portal.prototype.unrenderOverlay = function unrenderOverlay() {
|
11769 | if (this.overlayTarget) {
|
11770 | !isReact16 && _reactDom2["default"].unmountComponentAtNode(this.overlayTarget);
|
11771 | this.overlayInstance = null;
|
11772 | }
|
11773 | };
|
11774 |
|
11775 | Portal.prototype.render = function render() {
|
11776 | if (!isReact16) {
|
11777 | return null;
|
11778 | }
|
11779 |
|
11780 | var overlay = !this.props.children ? null : _react2["default"].Children.only(this.props.children);
|
11781 |
|
11782 | return _reactDom2["default"].createPortal(overlay, this.overlayTarget);
|
11783 | };
|
11784 |
|
11785 | return Portal;
|
11786 | }(_react.Component);
|
11787 |
|
11788 | ;
|
11789 |
|
11790 | Portal.propTypes = propTypes;
|
11791 | Portal.defaultProps = defaultProps;
|
11792 |
|
11793 | exports["default"] = Portal;
|
11794 | module.exports = exports['default'];
|
11795 |
|
11796 | }),
|
11797 |
|
11798 | (function(module, exports, __webpack_require__) {
|
11799 |
|
11800 | 'use strict';
|
11801 |
|
11802 | Object.defineProperty(exports, "__esModule", {
|
11803 | value: true
|
11804 | });
|
11805 |
|
11806 | exports["default"] = function (componentOrElement) {
|
11807 | return (0, _ownerDocument2["default"])(_reactDom2["default"].findDOMNode(componentOrElement));
|
11808 | };
|
11809 |
|
11810 | var _reactDom = __webpack_require__(2);
|
11811 |
|
11812 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
11813 |
|
11814 | var _ownerDocument = __webpack_require__(110);
|
11815 |
|
11816 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
11817 |
|
11818 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11819 |
|
11820 | module.exports = exports['default'];
|
11821 |
|
11822 | }),
|
11823 |
|
11824 | (function(module, exports) {
|
11825 |
|
11826 | "use strict";
|
11827 |
|
11828 | exports.__esModule = true;
|
11829 | exports.default = ownerDocument;
|
11830 |
|
11831 | function ownerDocument(node) {
|
11832 | return node && node.ownerDocument || document;
|
11833 | }
|
11834 |
|
11835 | module.exports = exports["default"];
|
11836 |
|
11837 | }),
|
11838 |
|
11839 | (function(module, exports, __webpack_require__) {
|
11840 |
|
11841 | 'use strict';
|
11842 |
|
11843 | Object.defineProperty(exports, "__esModule", {
|
11844 | value: true
|
11845 | });
|
11846 | exports["default"] = getContainer;
|
11847 |
|
11848 | var _reactDom = __webpack_require__(2);
|
11849 |
|
11850 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
11851 |
|
11852 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11853 |
|
11854 | |
11855 |
|
11856 |
|
11857 |
|
11858 |
|
11859 |
|
11860 | function getContainer(container, defaultContainer) {
|
11861 | container = typeof container === 'function' ? container() : container;
|
11862 | return _reactDom2["default"].findDOMNode(container) || defaultContainer;
|
11863 | }
|
11864 | module.exports = exports['default'];
|
11865 |
|
11866 | }),
|
11867 |
|
11868 | (function(module, exports, __webpack_require__) {
|
11869 |
|
11870 | 'use strict';
|
11871 |
|
11872 | Object.defineProperty(exports, "__esModule", {
|
11873 | value: true
|
11874 | });
|
11875 |
|
11876 | 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; };
|
11877 |
|
11878 | var _classnames = __webpack_require__(5);
|
11879 |
|
11880 | var _classnames2 = _interopRequireDefault(_classnames);
|
11881 |
|
11882 | var _react = __webpack_require__(1);
|
11883 |
|
11884 | var _react2 = _interopRequireDefault(_react);
|
11885 |
|
11886 | var _propTypes = __webpack_require__(6);
|
11887 |
|
11888 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
11889 |
|
11890 | var _BaseOverlay = __webpack_require__(113);
|
11891 |
|
11892 | var _BaseOverlay2 = _interopRequireDefault(_BaseOverlay);
|
11893 |
|
11894 | var _tinperBeeCore = __webpack_require__(27);
|
11895 |
|
11896 | var _Fade = __webpack_require__(129);
|
11897 |
|
11898 | var _Fade2 = _interopRequireDefault(_Fade);
|
11899 |
|
11900 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11901 |
|
11902 | 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; }
|
11903 |
|
11904 | 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; }
|
11905 |
|
11906 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11907 |
|
11908 | 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; }
|
11909 |
|
11910 | 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); }
|
11911 |
|
11912 | var propTypes = _extends({}, _BaseOverlay2["default"].propTypes, {
|
11913 |
|
11914 | |
11915 |
|
11916 |
|
11917 | show: _propTypes2["default"].bool,
|
11918 | |
11919 |
|
11920 |
|
11921 | rootClose: _propTypes2["default"].bool,
|
11922 | |
11923 |
|
11924 |
|
11925 | onHide: _propTypes2["default"].func,
|
11926 |
|
11927 | |
11928 |
|
11929 |
|
11930 | animation: _propTypes2["default"].oneOfType([_tinperBeeCore.elementType, _propTypes2["default"].func]),
|
11931 |
|
11932 | |
11933 |
|
11934 |
|
11935 | onEnter: _propTypes2["default"].func,
|
11936 |
|
11937 | |
11938 |
|
11939 |
|
11940 | onEntering: _propTypes2["default"].func,
|
11941 |
|
11942 | |
11943 |
|
11944 |
|
11945 | onEntered: _propTypes2["default"].func,
|
11946 |
|
11947 | |
11948 |
|
11949 |
|
11950 | onExit: _propTypes2["default"].func,
|
11951 |
|
11952 | |
11953 |
|
11954 |
|
11955 | onExiting: _propTypes2["default"].func,
|
11956 |
|
11957 | |
11958 |
|
11959 |
|
11960 | onExited: _propTypes2["default"].func,
|
11961 |
|
11962 | |
11963 |
|
11964 |
|
11965 | placement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
11966 |
|
11967 | |
11968 |
|
11969 |
|
11970 | secondPlacement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left'])
|
11971 | });
|
11972 |
|
11973 | var defaultProps = {
|
11974 | animation: _Fade2["default"],
|
11975 | rootClose: false,
|
11976 | show: false,
|
11977 | placement: 'right'
|
11978 | };
|
11979 |
|
11980 | var Overlay = function (_Component) {
|
11981 | _inherits(Overlay, _Component);
|
11982 |
|
11983 | function Overlay() {
|
11984 | _classCallCheck(this, Overlay);
|
11985 |
|
11986 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
11987 | }
|
11988 |
|
11989 | Overlay.prototype.render = function render() {
|
11990 | var _props = this.props,
|
11991 | animation = _props.animation,
|
11992 | children = _props.children,
|
11993 | props = _objectWithoutProperties(_props, ['animation', 'children']);
|
11994 |
|
11995 | var transition = animation === true ? _Fade2["default"] : animation || null;
|
11996 |
|
11997 | var child = void 0;
|
11998 |
|
11999 | if (!transition) {
|
12000 | child = (0, _react.cloneElement)(children, {
|
12001 | className: (0, _classnames2["default"])(children.props.className, 'in')
|
12002 | });
|
12003 | } else {
|
12004 | child = children;
|
12005 | }
|
12006 |
|
12007 | return _react2["default"].createElement(
|
12008 | _BaseOverlay2["default"],
|
12009 | _extends({}, props, {
|
12010 | transition: transition
|
12011 | }),
|
12012 | child
|
12013 | );
|
12014 | };
|
12015 |
|
12016 | return Overlay;
|
12017 | }(_react.Component);
|
12018 |
|
12019 | Overlay.propTypes = propTypes;
|
12020 | Overlay.defaultProps = defaultProps;
|
12021 |
|
12022 | exports["default"] = Overlay;
|
12023 | module.exports = exports['default'];
|
12024 |
|
12025 | }),
|
12026 |
|
12027 | (function(module, exports, __webpack_require__) {
|
12028 |
|
12029 | 'use strict';
|
12030 |
|
12031 | Object.defineProperty(exports, "__esModule", {
|
12032 | value: true
|
12033 | });
|
12034 |
|
12035 | 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; };
|
12036 |
|
12037 | var _react = __webpack_require__(1);
|
12038 |
|
12039 | var _react2 = _interopRequireDefault(_react);
|
12040 |
|
12041 | var _reactDom = __webpack_require__(2);
|
12042 |
|
12043 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
12044 |
|
12045 | var _propTypes = __webpack_require__(6);
|
12046 |
|
12047 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
12048 |
|
12049 | var _Portal = __webpack_require__(108);
|
12050 |
|
12051 | var _Portal2 = _interopRequireDefault(_Portal);
|
12052 |
|
12053 | var _Position = __webpack_require__(114);
|
12054 |
|
12055 | var _Position2 = _interopRequireDefault(_Position);
|
12056 |
|
12057 | var _RootCloseWrapper = __webpack_require__(128);
|
12058 |
|
12059 | var _RootCloseWrapper2 = _interopRequireDefault(_RootCloseWrapper);
|
12060 |
|
12061 | var _tinperBeeCore = __webpack_require__(27);
|
12062 |
|
12063 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12064 |
|
12065 | 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; }
|
12066 |
|
12067 | 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; }
|
12068 |
|
12069 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12070 |
|
12071 | 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; }
|
12072 |
|
12073 | 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); }
|
12074 |
|
12075 | var isReact16 = _reactDom2["default"].createPortal !== undefined;
|
12076 |
|
12077 | var propTypes = _extends({}, _Position2["default"].propTypes, {
|
12078 |
|
12079 | |
12080 |
|
12081 |
|
12082 | show: _propTypes2["default"].bool,
|
12083 |
|
12084 | |
12085 |
|
12086 |
|
12087 | rootClose: _propTypes2["default"].bool,
|
12088 |
|
12089 | |
12090 |
|
12091 |
|
12092 |
|
12093 | onHide: function onHide(props) {
|
12094 | var propType = _propTypes2["default"].func;
|
12095 | if (props.rootClose) {
|
12096 | propType = propType.isRequired;
|
12097 | }
|
12098 |
|
12099 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
12100 | args[_key - 1] = arguments[_key];
|
12101 | }
|
12102 |
|
12103 | return propType.apply(undefined, [props].concat(args));
|
12104 | },
|
12105 |
|
12106 |
|
12107 | |
12108 |
|
12109 |
|
12110 | transition: _propTypes2["default"].oneOfType([_tinperBeeCore.elementType, _propTypes2["default"].func]),
|
12111 |
|
12112 | |
12113 |
|
12114 |
|
12115 | onEnter: _propTypes2["default"].func,
|
12116 |
|
12117 | |
12118 |
|
12119 |
|
12120 | onEntering: _propTypes2["default"].func,
|
12121 |
|
12122 | |
12123 |
|
12124 |
|
12125 | onEntered: _propTypes2["default"].func,
|
12126 |
|
12127 | |
12128 |
|
12129 |
|
12130 | onExit: _propTypes2["default"].func,
|
12131 |
|
12132 | |
12133 |
|
12134 |
|
12135 | onExiting: _propTypes2["default"].func,
|
12136 |
|
12137 | |
12138 |
|
12139 |
|
12140 | onExited: _propTypes2["default"].func
|
12141 | });
|
12142 |
|
12143 | function noop() {}
|
12144 |
|
12145 | var defaultProps = {
|
12146 | show: false,
|
12147 | rootClose: true
|
12148 | };
|
12149 |
|
12150 | |
12151 |
|
12152 |
|
12153 |
|
12154 | var BaseOverlay = function (_Component) {
|
12155 | _inherits(BaseOverlay, _Component);
|
12156 |
|
12157 | function BaseOverlay(props, context) {
|
12158 | _classCallCheck(this, BaseOverlay);
|
12159 |
|
12160 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
12161 |
|
12162 | _this.state = { exited: !props.show };
|
12163 | _this.onHiddenListener = _this.handleHidden.bind(_this);
|
12164 | return _this;
|
12165 | }
|
12166 |
|
12167 | BaseOverlay.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
12168 | if (nextProps.show) {
|
12169 | this.setState({ exited: false });
|
12170 | } else if (!nextProps.transition) {
|
12171 |
|
12172 | this.setState({ exited: true });
|
12173 | }
|
12174 | };
|
12175 |
|
12176 | BaseOverlay.prototype.handleHidden = function handleHidden() {
|
12177 | this.setState({ exited: true });
|
12178 |
|
12179 | if (this.props.onExited) {
|
12180 | var _props;
|
12181 |
|
12182 | (_props = this.props).onExited.apply(_props, arguments);
|
12183 | }
|
12184 | };
|
12185 |
|
12186 | BaseOverlay.prototype.render = function render() {
|
12187 | var _props2 = this.props,
|
12188 | container = _props2.container,
|
12189 | containerPadding = _props2.containerPadding,
|
12190 | target = _props2.target,
|
12191 | placement = _props2.placement,
|
12192 | secondPlacement = _props2.secondPlacement,
|
12193 | shouldUpdatePosition = _props2.shouldUpdatePosition,
|
12194 | rootClose = _props2.rootClose,
|
12195 | positionLeft = _props2.positionLeft,
|
12196 | positionTop = _props2.positionTop,
|
12197 | children = _props2.children,
|
12198 | Transition = _props2.transition,
|
12199 | props = _objectWithoutProperties(_props2, ['container', 'containerPadding', 'target', 'placement', 'secondPlacement', 'shouldUpdatePosition', 'rootClose', 'positionLeft', 'positionTop', 'children', 'transition']);
|
12200 |
|
12201 |
|
12202 |
|
12203 |
|
12204 | var mountOverlay = props.show || Transition && !this.state.exited;
|
12205 | if (!mountOverlay) {
|
12206 |
|
12207 | return null;
|
12208 | }
|
12209 |
|
12210 | var child = children;
|
12211 |
|
12212 |
|
12213 |
|
12214 | child = _react2["default"].createElement(
|
12215 | _Position2["default"],
|
12216 | {
|
12217 | container: container,
|
12218 | containerPadding: containerPadding,
|
12219 | target: target,
|
12220 | positionLeft: positionLeft,
|
12221 | positionTop: positionTop,
|
12222 | placement: placement,
|
12223 | secondPlacement: secondPlacement,
|
12224 | shouldUpdatePosition: shouldUpdatePosition },
|
12225 | child
|
12226 | );
|
12227 |
|
12228 | if (Transition) {
|
12229 | var onExit = props.onExit,
|
12230 | onExiting = props.onExiting,
|
12231 | onEnter = props.onEnter,
|
12232 | onEntering = props.onEntering,
|
12233 | onEntered = props.onEntered;
|
12234 |
|
12235 |
|
12236 |
|
12237 |
|
12238 | child = _react2["default"].createElement(
|
12239 | Transition,
|
12240 | {
|
12241 | 'in': props.show,
|
12242 | transitionAppear: true,
|
12243 | onExit: onExit,
|
12244 | onExiting: onExiting,
|
12245 | onExited: this.onHiddenListener,
|
12246 | onEnter: onEnter,
|
12247 | onEntering: onEntering,
|
12248 | onEntered: onEntered
|
12249 | },
|
12250 | child
|
12251 | );
|
12252 | }
|
12253 |
|
12254 |
|
12255 | if (rootClose) {
|
12256 | child = _react2["default"].createElement(
|
12257 | _RootCloseWrapper2["default"],
|
12258 | { onRootClose: props.onHide },
|
12259 | child
|
12260 | );
|
12261 | }
|
12262 |
|
12263 | if (isReact16) {
|
12264 | return child;
|
12265 | } else {
|
12266 | return _react2["default"].createElement(
|
12267 | _Portal2["default"],
|
12268 | { container: container },
|
12269 | child
|
12270 | );
|
12271 | }
|
12272 | };
|
12273 |
|
12274 | return BaseOverlay;
|
12275 | }(_react.Component);
|
12276 |
|
12277 | BaseOverlay.propTypes = propTypes;
|
12278 | BaseOverlay.defaultProps = defaultProps;
|
12279 |
|
12280 | exports["default"] = BaseOverlay;
|
12281 | module.exports = exports['default'];
|
12282 |
|
12283 | }),
|
12284 |
|
12285 | (function(module, exports, __webpack_require__) {
|
12286 |
|
12287 | 'use strict';
|
12288 |
|
12289 | Object.defineProperty(exports, "__esModule", {
|
12290 | value: true
|
12291 | });
|
12292 |
|
12293 | 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; };
|
12294 |
|
12295 | var _classnames = __webpack_require__(5);
|
12296 |
|
12297 | var _classnames2 = _interopRequireDefault(_classnames);
|
12298 |
|
12299 | var _react = __webpack_require__(1);
|
12300 |
|
12301 | var _react2 = _interopRequireDefault(_react);
|
12302 |
|
12303 | var _propTypes = __webpack_require__(6);
|
12304 |
|
12305 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
12306 |
|
12307 | var _reactDom = __webpack_require__(2);
|
12308 |
|
12309 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
12310 |
|
12311 | var _tinperBeeCore = __webpack_require__(27);
|
12312 |
|
12313 | var _requestAnimationFrame = __webpack_require__(115);
|
12314 |
|
12315 | var _requestAnimationFrame2 = _interopRequireDefault(_requestAnimationFrame);
|
12316 |
|
12317 | var _calculatePosition = __webpack_require__(116);
|
12318 |
|
12319 | var _calculatePosition2 = _interopRequireDefault(_calculatePosition);
|
12320 |
|
12321 | var _getContainer = __webpack_require__(111);
|
12322 |
|
12323 | var _getContainer2 = _interopRequireDefault(_getContainer);
|
12324 |
|
12325 | var _ownerDocument = __webpack_require__(109);
|
12326 |
|
12327 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
12328 |
|
12329 | var _ownerWindow = __webpack_require__(124);
|
12330 |
|
12331 | var _ownerWindow2 = _interopRequireDefault(_ownerWindow);
|
12332 |
|
12333 | var _addEventListener = __webpack_require__(126);
|
12334 |
|
12335 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
12336 |
|
12337 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12338 |
|
12339 | 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; }
|
12340 |
|
12341 | 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; }
|
12342 |
|
12343 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12344 |
|
12345 | 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; }
|
12346 |
|
12347 | 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); }
|
12348 |
|
12349 | var propTypes = {
|
12350 | |
12351 |
|
12352 |
|
12353 | target: _propTypes2["default"].oneOfType([_tinperBeeCore.componentOrElement, _propTypes2["default"].func]),
|
12354 |
|
12355 | |
12356 |
|
12357 |
|
12358 | container: _propTypes2["default"].oneOfType([_tinperBeeCore.componentOrElement, _propTypes2["default"].func]),
|
12359 | |
12360 |
|
12361 |
|
12362 | containerPadding: _propTypes2["default"].number,
|
12363 | |
12364 |
|
12365 |
|
12366 | placement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
12367 |
|
12368 | |
12369 |
|
12370 |
|
12371 | secondPlacement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
12372 |
|
12373 | |
12374 |
|
12375 |
|
12376 | shouldUpdatePosition: _propTypes2["default"].bool
|
12377 | };
|
12378 |
|
12379 | var defaultProps = {
|
12380 | containerPadding: 0,
|
12381 | placement: 'right',
|
12382 | shouldUpdatePosition: false
|
12383 | };
|
12384 |
|
12385 | |
12386 |
|
12387 |
|
12388 |
|
12389 | var Position = function (_Component) {
|
12390 | _inherits(Position, _Component);
|
12391 |
|
12392 | function Position(props, context) {
|
12393 | _classCallCheck(this, Position);
|
12394 |
|
12395 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
12396 |
|
12397 | _this.state = {
|
12398 | positionLeft: 0,
|
12399 | positionTop: 0,
|
12400 | arrowOffsetLeft: null,
|
12401 | arrowOffsetTop: null
|
12402 | };
|
12403 |
|
12404 | _this.needsFlush = false;
|
12405 | _this.lastTarget = null;
|
12406 |
|
12407 | _this.getTarget = _this.getTarget.bind(_this);
|
12408 | _this.maybeUpdatePosition = _this.maybeUpdatePosition.bind(_this);
|
12409 | _this.updatePosition = _this.updatePosition.bind(_this);
|
12410 | _this.onWindowResize = _this.onWindowResize.bind(_this);
|
12411 | return _this;
|
12412 | }
|
12413 |
|
12414 | Position.prototype.componentDidMount = function componentDidMount() {
|
12415 | var _this2 = this;
|
12416 |
|
12417 | this._isMounted = true;
|
12418 |
|
12419 | this._windowResizeListener = (0, _addEventListener2["default"])((0, _ownerWindow2["default"])(this), 'resize', function () {
|
12420 | return _this2.onWindowResize();
|
12421 | });
|
12422 |
|
12423 | this.updatePosition(this.getTarget());
|
12424 | };
|
12425 |
|
12426 | Position.prototype.componentWillReceiveProps = function componentWillReceiveProps() {
|
12427 | this.needsFlush = true;
|
12428 | };
|
12429 |
|
12430 | Position.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
12431 | if (this.needsFlush) {
|
12432 | this.needsFlush = false;
|
12433 |
|
12434 | this.maybeUpdatePosition();
|
12435 | }
|
12436 | };
|
12437 |
|
12438 | Position.prototype.componentWillUnmount = function componentWillUnmount() {
|
12439 | this._isMounted = false;
|
12440 |
|
12441 | if (this._windowResizeListener) {
|
12442 | this._windowResizeListener.remove();
|
12443 | }
|
12444 | };
|
12445 |
|
12446 | |
12447 |
|
12448 |
|
12449 |
|
12450 |
|
12451 | Position.prototype.getTarget = function getTarget() {
|
12452 | var target = this.props.target;
|
12453 |
|
12454 | var targetElement = typeof target === 'function' ? target() : target;
|
12455 | return targetElement && _reactDom2["default"].findDOMNode(targetElement) || null;
|
12456 | };
|
12457 |
|
12458 | |
12459 |
|
12460 |
|
12461 |
|
12462 |
|
12463 | Position.prototype.maybeUpdatePosition = function maybeUpdatePosition(placementChanged) {
|
12464 | var target = this.getTarget();
|
12465 | if (!this.props.shouldUpdatePosition && target === this.lastTarget && !placementChanged) {
|
12466 | return;
|
12467 | }
|
12468 |
|
12469 | this.updatePosition(target);
|
12470 | };
|
12471 |
|
12472 | Position.prototype.onWindowResize = function onWindowResize() {
|
12473 | var _this3 = this;
|
12474 |
|
12475 | (0, _requestAnimationFrame2["default"])(function () {
|
12476 | return _this3.updatePosition(_this3.getTarget());
|
12477 | });
|
12478 | };
|
12479 |
|
12480 | |
12481 |
|
12482 |
|
12483 |
|
12484 | Position.prototype.updatePosition = function updatePosition(target) {
|
12485 | var _props = this.props,
|
12486 | placement = _props.placement,
|
12487 | secondPlacement = _props.secondPlacement;
|
12488 |
|
12489 |
|
12490 | if (!this._isMounted) {
|
12491 | return;
|
12492 | }
|
12493 | this.lastTarget = target;
|
12494 |
|
12495 | if (!target) {
|
12496 | this.setState({
|
12497 | positionLeft: 0,
|
12498 | positionTop: 0,
|
12499 | arrowOffsetLeft: null,
|
12500 | arrowOffsetTop: null
|
12501 | });
|
12502 |
|
12503 | return;
|
12504 | }
|
12505 |
|
12506 | var overlay = _reactDom2["default"].findDOMNode(this);
|
12507 | var container = (0, _getContainer2["default"])(this.props.container, (0, _ownerDocument2["default"])(this).body);
|
12508 |
|
12509 |
|
12510 | if ("secondPlacement" in this.props && secondPlacement) {
|
12511 | var initPosition = (0, _calculatePosition2["default"])(placement, overlay, target, container, this.props.containerPadding);
|
12512 | if (initPosition.inverseArrow) {
|
12513 | var secondPosition = (0, _calculatePosition2["default"])(secondPlacement, overlay, target, container, this.props.containerPadding);
|
12514 |
|
12515 | if (secondPosition.inverseArrow) {
|
12516 | this.setState(_extends({}, initPosition, {
|
12517 | renderPlacement: placement
|
12518 | }));
|
12519 | } else {
|
12520 | this.setState(_extends({}, secondPosition, {
|
12521 | renderPlacement: secondPlacement
|
12522 | }));
|
12523 | }
|
12524 | } else {
|
12525 | this.setState(_extends({}, initPosition, {
|
12526 | renderPlacement: placement
|
12527 | }));
|
12528 | }
|
12529 | } else {
|
12530 | this.setState((0, _calculatePosition2["default"])(placement, overlay, target, container, this.props.containerPadding));
|
12531 | }
|
12532 | };
|
12533 |
|
12534 | Position.prototype.render = function render() {
|
12535 | var _props2 = this.props,
|
12536 | children = _props2.children,
|
12537 | className = _props2.className,
|
12538 | props = _objectWithoutProperties(_props2, ['children', 'className']);
|
12539 |
|
12540 | var _state = this.state,
|
12541 | positionLeft = _state.positionLeft,
|
12542 | positionTop = _state.positionTop,
|
12543 | inverseArrow = _state.inverseArrow,
|
12544 | width = _state.width,
|
12545 | arrowPosition = _objectWithoutProperties(_state, ['positionLeft', 'positionTop', 'inverseArrow', 'width']);
|
12546 |
|
12547 |
|
12548 |
|
12549 |
|
12550 | delete props.target;
|
12551 | delete props.container;
|
12552 | delete props.containerPadding;
|
12553 | delete props.shouldUpdatePosition;
|
12554 |
|
12555 | var child = _react2["default"].Children.only(children);
|
12556 | return (0, _react.cloneElement)(child, _extends({
|
12557 | className: (0, _classnames2["default"])(className, child.props.className, { 'inverse-arrow': inverseArrow })
|
12558 | }, arrowPosition, {
|
12559 | style: _extends({}, child.props.style, {
|
12560 | width: width,
|
12561 | left: positionLeft,
|
12562 | top: positionTop
|
12563 | })
|
12564 | }));
|
12565 | };
|
12566 |
|
12567 | return Position;
|
12568 | }(_react.Component);
|
12569 |
|
12570 | Position.propTypes = propTypes;
|
12571 | Position.defaultProps = defaultProps;
|
12572 |
|
12573 | exports["default"] = Position;
|
12574 | module.exports = exports['default'];
|
12575 |
|
12576 | }),
|
12577 |
|
12578 | (function(module, exports, __webpack_require__) {
|
12579 |
|
12580 | "use strict";
|
12581 |
|
12582 | var _interopRequireDefault = __webpack_require__(14);
|
12583 |
|
12584 | exports.__esModule = true;
|
12585 | exports.default = void 0;
|
12586 |
|
12587 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
12588 |
|
12589 | var vendors = ['', 'webkit', 'moz', 'o', 'ms'];
|
12590 | var cancel = 'clearTimeout';
|
12591 | var raf = fallback;
|
12592 | var compatRaf;
|
12593 |
|
12594 | var getKey = function getKey(vendor, k) {
|
12595 | return vendor + (!vendor ? k : k[0].toUpperCase() + k.substr(1)) + 'AnimationFrame';
|
12596 | };
|
12597 |
|
12598 | if (_inDOM.default) {
|
12599 | vendors.some(function (vendor) {
|
12600 | var rafKey = getKey(vendor, 'request');
|
12601 |
|
12602 | if (rafKey in window) {
|
12603 | cancel = getKey(vendor, 'cancel');
|
12604 | return raf = function raf(cb) {
|
12605 | return window[rafKey](cb);
|
12606 | };
|
12607 | }
|
12608 | });
|
12609 | }
|
12610 |
|
12611 |
|
12612 |
|
12613 | var prev = new Date().getTime();
|
12614 |
|
12615 | function fallback(fn) {
|
12616 | var curr = new Date().getTime(),
|
12617 | ms = Math.max(0, 16 - (curr - prev)),
|
12618 | req = setTimeout(fn, ms);
|
12619 | prev = curr;
|
12620 | return req;
|
12621 | }
|
12622 |
|
12623 | compatRaf = function compatRaf(cb) {
|
12624 | return raf(cb);
|
12625 | };
|
12626 |
|
12627 | compatRaf.cancel = function (id) {
|
12628 | window[cancel] && typeof window[cancel] === 'function' && window[cancel](id);
|
12629 | };
|
12630 |
|
12631 | var _default = compatRaf;
|
12632 | exports.default = _default;
|
12633 | module.exports = exports["default"];
|
12634 |
|
12635 | }),
|
12636 |
|
12637 | (function(module, exports, __webpack_require__) {
|
12638 |
|
12639 | 'use strict';
|
12640 |
|
12641 | Object.defineProperty(exports, "__esModule", {
|
12642 | value: true
|
12643 | });
|
12644 | exports["default"] = calculatePosition;
|
12645 |
|
12646 | var _offset = __webpack_require__(117);
|
12647 |
|
12648 | var _offset2 = _interopRequireDefault(_offset);
|
12649 |
|
12650 | var _position = __webpack_require__(119);
|
12651 |
|
12652 | var _position2 = _interopRequireDefault(_position);
|
12653 |
|
12654 | var _scrollTop = __webpack_require__(122);
|
12655 |
|
12656 | var _scrollTop2 = _interopRequireDefault(_scrollTop);
|
12657 |
|
12658 | var _ownerDocument = __webpack_require__(109);
|
12659 |
|
12660 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
12661 |
|
12662 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12663 |
|
12664 | function getContainerDimensions(containerNode) {
|
12665 | var width = void 0,
|
12666 | height = void 0,
|
12667 | scroll = void 0;
|
12668 |
|
12669 | if (containerNode.tagName === 'BODY') {
|
12670 | width = document.body.scrollWidth;
|
12671 | height = document.body.scrollHeight;
|
12672 |
|
12673 | scroll = (0, _scrollTop2["default"])((0, _ownerDocument2["default"])(containerNode).documentElement) || (0, _scrollTop2["default"])(containerNode);
|
12674 | } else {
|
12675 | var _getOffset = (0, _offset2["default"])(containerNode);
|
12676 |
|
12677 | width = _getOffset.width;
|
12678 | height = _getOffset.height;
|
12679 |
|
12680 | scroll = (0, _scrollTop2["default"])(containerNode);
|
12681 | }
|
12682 |
|
12683 | return { width: width, height: height, scroll: scroll };
|
12684 | }
|
12685 |
|
12686 | function getTopDelta(top, overlayHeight, container, padding) {
|
12687 | var containerDimensions = getContainerDimensions(container);
|
12688 | var containerScroll = containerDimensions.scroll;
|
12689 | var containerHeight = containerDimensions.height;
|
12690 |
|
12691 | var topEdgeOffset = top - padding - containerScroll;
|
12692 | var bottomEdgeOffset = top + padding - containerScroll + overlayHeight;
|
12693 |
|
12694 | if (topEdgeOffset < 0) {
|
12695 | return -topEdgeOffset;
|
12696 | } else if (bottomEdgeOffset > containerHeight) {
|
12697 | return containerHeight - bottomEdgeOffset;
|
12698 | } else {
|
12699 | return 0;
|
12700 | }
|
12701 | }
|
12702 |
|
12703 | function getLeftDelta(left, overlayWidth, container, padding) {
|
12704 | var containerDimensions = getContainerDimensions(container);
|
12705 | var containerWidth = containerDimensions.width;
|
12706 |
|
12707 | var leftEdgeOffset = left - padding;
|
12708 | var rightEdgeOffset = left + padding + overlayWidth;
|
12709 |
|
12710 | if (leftEdgeOffset < 0) {
|
12711 | return -leftEdgeOffset;
|
12712 | } else if (rightEdgeOffset > containerWidth) {
|
12713 | return containerWidth - rightEdgeOffset;
|
12714 | }
|
12715 |
|
12716 | return 0;
|
12717 | }
|
12718 |
|
12719 | function calculatePosition(placement, overlayNode, target, container, padding) {
|
12720 | var childOffset = container.tagName === 'BODY' ? (0, _offset2["default"])(target) : (0, _position2["default"])(target, container);
|
12721 |
|
12722 | var _getOffset2 = (0, _offset2["default"])(overlayNode),
|
12723 | overlayHeight = _getOffset2.height,
|
12724 | overlayWidth = _getOffset2.width;
|
12725 |
|
12726 | var positionLeft = void 0,
|
12727 | positionTop = void 0,
|
12728 | arrowOffsetLeft = void 0,
|
12729 | arrowOffsetTop = void 0,
|
12730 | inverseArrow = void 0;
|
12731 |
|
12732 | if (/^left|^right/.test(placement)) {
|
12733 | positionTop = childOffset.top + (childOffset.height - overlayHeight) / 2;
|
12734 |
|
12735 | if (/left/.test(placement)) {
|
12736 | positionLeft = childOffset.left - overlayWidth;
|
12737 | } else {
|
12738 | positionLeft = childOffset.left + childOffset.width;
|
12739 | }
|
12740 |
|
12741 | if (/Top/.test(placement)) {
|
12742 | positionTop = childOffset.top;
|
12743 | } else if (/Bottom/.test(placement)) {
|
12744 | positionTop = childOffset.top + childOffset.height - overlayHeight;
|
12745 | }
|
12746 |
|
12747 | var topDelta = getTopDelta(positionTop, overlayHeight, container, padding);
|
12748 | var leftDelta = getLeftDelta(positionLeft, overlayWidth, container, padding);
|
12749 |
|
12750 | if (leftDelta > 0) {
|
12751 | inverseArrow = true;
|
12752 | positionLeft = childOffset.left + childOffset.width + 6;
|
12753 | } else if (leftDelta < 0) {
|
12754 | inverseArrow = true;
|
12755 | positionLeft = childOffset.left - overlayWidth - 6;
|
12756 | } else {
|
12757 | positionLeft += leftDelta;
|
12758 | }
|
12759 | positionTop += topDelta;
|
12760 | arrowOffsetTop = 50 * (1 - 2 * topDelta / overlayHeight) + '%';
|
12761 | arrowOffsetLeft = void 0;
|
12762 | } else if (/^top|^bottom/.test(placement)) {
|
12763 | positionLeft = childOffset.left + (childOffset.width - overlayWidth) / 2;
|
12764 |
|
12765 | if (/top/.test(placement)) {
|
12766 | positionTop = childOffset.top - overlayHeight;
|
12767 | } else {
|
12768 | positionTop = childOffset.top + childOffset.height;
|
12769 | }
|
12770 |
|
12771 | if (/Left/.test(placement)) {
|
12772 | positionLeft = childOffset.left;
|
12773 | } else if (/Right/.test(placement)) {
|
12774 | positionLeft = childOffset.left + (childOffset.width - overlayWidth);
|
12775 | }
|
12776 |
|
12777 | var _leftDelta = getLeftDelta(positionLeft, overlayWidth, container, padding);
|
12778 | var _topDelta = getTopDelta(positionTop, overlayHeight, container, padding);
|
12779 | positionLeft += _leftDelta;
|
12780 | arrowOffsetLeft = 50 * (1 - 2 * _leftDelta / overlayWidth) + '%';
|
12781 | arrowOffsetTop = void 0;
|
12782 | if (_topDelta > 0) {
|
12783 | inverseArrow = true;
|
12784 | positionTop = childOffset.top + childOffset.height + 6;
|
12785 | } else if (_topDelta < 0) {
|
12786 | inverseArrow = true;
|
12787 | positionTop = childOffset.top - overlayHeight - 6;
|
12788 | } else {
|
12789 | positionTop += _topDelta;
|
12790 | }
|
12791 |
|
12792 |
|
12793 |
|
12794 |
|
12795 |
|
12796 |
|
12797 |
|
12798 |
|
12799 |
|
12800 |
|
12801 |
|
12802 |
|
12803 | } else {
|
12804 | throw new Error('calcOverlayPosition(): No such placement of "' + placement + '" found.');
|
12805 | }
|
12806 |
|
12807 | return { positionLeft: positionLeft, positionTop: positionTop, arrowOffsetLeft: arrowOffsetLeft, arrowOffsetTop: arrowOffsetTop, inverseArrow: inverseArrow, width: overlayWidth };
|
12808 | }
|
12809 | module.exports = exports['default'];
|
12810 |
|
12811 | }),
|
12812 |
|
12813 | (function(module, exports, __webpack_require__) {
|
12814 |
|
12815 | "use strict";
|
12816 |
|
12817 | var _interopRequireDefault = __webpack_require__(14);
|
12818 |
|
12819 | exports.__esModule = true;
|
12820 | exports.default = offset;
|
12821 |
|
12822 | var _contains = _interopRequireDefault(__webpack_require__(107));
|
12823 |
|
12824 | var _isWindow = _interopRequireDefault(__webpack_require__(118));
|
12825 |
|
12826 | var _ownerDocument = _interopRequireDefault(__webpack_require__(110));
|
12827 |
|
12828 | function offset(node) {
|
12829 | var doc = (0, _ownerDocument.default)(node),
|
12830 | win = (0, _isWindow.default)(doc),
|
12831 | docElem = doc && doc.documentElement,
|
12832 | box = {
|
12833 | top: 0,
|
12834 | left: 0,
|
12835 | height: 0,
|
12836 | width: 0
|
12837 | };
|
12838 | if (!doc) return;
|
12839 |
|
12840 | if (!(0, _contains.default)(docElem, node)) return box;
|
12841 | if (node.getBoundingClientRect !== undefined) box = node.getBoundingClientRect();
|
12842 |
|
12843 | box = {
|
12844 | top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
|
12845 | left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0),
|
12846 | width: (box.width == null ? node.offsetWidth : box.width) || 0,
|
12847 | height: (box.height == null ? node.offsetHeight : box.height) || 0
|
12848 | };
|
12849 | return box;
|
12850 | }
|
12851 |
|
12852 | module.exports = exports["default"];
|
12853 |
|
12854 | }),
|
12855 |
|
12856 | (function(module, exports) {
|
12857 |
|
12858 | "use strict";
|
12859 |
|
12860 | exports.__esModule = true;
|
12861 | exports.default = getWindow;
|
12862 |
|
12863 | function getWindow(node) {
|
12864 | return node === node.window ? node : node.nodeType === 9 ? node.defaultView || node.parentWindow : false;
|
12865 | }
|
12866 |
|
12867 | module.exports = exports["default"];
|
12868 |
|
12869 | }),
|
12870 |
|
12871 | (function(module, exports, __webpack_require__) {
|
12872 |
|
12873 | "use strict";
|
12874 |
|
12875 | var _interopRequireDefault = __webpack_require__(14);
|
12876 |
|
12877 | exports.__esModule = true;
|
12878 | exports.default = position;
|
12879 |
|
12880 | var _extends2 = _interopRequireDefault(__webpack_require__(120));
|
12881 |
|
12882 | var _offset = _interopRequireDefault(__webpack_require__(117));
|
12883 |
|
12884 | var _offsetParent = _interopRequireDefault(__webpack_require__(121));
|
12885 |
|
12886 | var _scrollTop = _interopRequireDefault(__webpack_require__(122));
|
12887 |
|
12888 | var _scrollLeft = _interopRequireDefault(__webpack_require__(123));
|
12889 |
|
12890 | var _style = _interopRequireDefault(__webpack_require__(18));
|
12891 |
|
12892 | function nodeName(node) {
|
12893 | return node.nodeName && node.nodeName.toLowerCase();
|
12894 | }
|
12895 |
|
12896 | function position(node, offsetParent) {
|
12897 | var parentOffset = {
|
12898 | top: 0,
|
12899 | left: 0
|
12900 | },
|
12901 | offset;
|
12902 |
|
12903 |
|
12904 | if ((0, _style.default)(node, 'position') === 'fixed') {
|
12905 | offset = node.getBoundingClientRect();
|
12906 | } else {
|
12907 | offsetParent = offsetParent || (0, _offsetParent.default)(node);
|
12908 | offset = (0, _offset.default)(node);
|
12909 | if (nodeName(offsetParent) !== 'html') parentOffset = (0, _offset.default)(offsetParent);
|
12910 | parentOffset.top += parseInt((0, _style.default)(offsetParent, 'borderTopWidth'), 10) - (0, _scrollTop.default)(offsetParent) || 0;
|
12911 | parentOffset.left += parseInt((0, _style.default)(offsetParent, 'borderLeftWidth'), 10) - (0, _scrollLeft.default)(offsetParent) || 0;
|
12912 | }
|
12913 |
|
12914 |
|
12915 | return (0, _extends2.default)({}, offset, {
|
12916 | top: offset.top - parentOffset.top - (parseInt((0, _style.default)(node, 'marginTop'), 10) || 0),
|
12917 | left: offset.left - parentOffset.left - (parseInt((0, _style.default)(node, 'marginLeft'), 10) || 0)
|
12918 | });
|
12919 | }
|
12920 |
|
12921 | module.exports = exports["default"];
|
12922 |
|
12923 | }),
|
12924 |
|
12925 | (function(module, exports) {
|
12926 |
|
12927 | function _extends() {
|
12928 | module.exports = _extends = Object.assign || function (target) {
|
12929 | for (var i = 1; i < arguments.length; i++) {
|
12930 | var source = arguments[i];
|
12931 |
|
12932 | for (var key in source) {
|
12933 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
12934 | target[key] = source[key];
|
12935 | }
|
12936 | }
|
12937 | }
|
12938 |
|
12939 | return target;
|
12940 | };
|
12941 |
|
12942 | return _extends.apply(this, arguments);
|
12943 | }
|
12944 |
|
12945 | module.exports = _extends;
|
12946 |
|
12947 | }),
|
12948 |
|
12949 | (function(module, exports, __webpack_require__) {
|
12950 |
|
12951 | "use strict";
|
12952 |
|
12953 | var _interopRequireDefault = __webpack_require__(14);
|
12954 |
|
12955 | exports.__esModule = true;
|
12956 | exports.default = offsetParent;
|
12957 |
|
12958 | var _ownerDocument = _interopRequireDefault(__webpack_require__(110));
|
12959 |
|
12960 | var _style = _interopRequireDefault(__webpack_require__(18));
|
12961 |
|
12962 | function nodeName(node) {
|
12963 | return node.nodeName && node.nodeName.toLowerCase();
|
12964 | }
|
12965 |
|
12966 | function offsetParent(node) {
|
12967 | var doc = (0, _ownerDocument.default)(node),
|
12968 | offsetParent = node && node.offsetParent;
|
12969 |
|
12970 | while (offsetParent && nodeName(node) !== 'html' && (0, _style.default)(offsetParent, 'position') === 'static') {
|
12971 | offsetParent = offsetParent.offsetParent;
|
12972 | }
|
12973 |
|
12974 | return offsetParent || doc.documentElement;
|
12975 | }
|
12976 |
|
12977 | module.exports = exports["default"];
|
12978 |
|
12979 | }),
|
12980 |
|
12981 | (function(module, exports, __webpack_require__) {
|
12982 |
|
12983 | "use strict";
|
12984 |
|
12985 | var _interopRequireDefault = __webpack_require__(14);
|
12986 |
|
12987 | exports.__esModule = true;
|
12988 | exports.default = scrollTop;
|
12989 |
|
12990 | var _isWindow = _interopRequireDefault(__webpack_require__(118));
|
12991 |
|
12992 | function scrollTop(node, val) {
|
12993 | var win = (0, _isWindow.default)(node);
|
12994 | if (val === undefined) return win ? 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop : node.scrollTop;
|
12995 | if (win) win.scrollTo('pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft, val);else node.scrollTop = val;
|
12996 | }
|
12997 |
|
12998 | module.exports = exports["default"];
|
12999 |
|
13000 | }),
|
13001 |
|
13002 | (function(module, exports, __webpack_require__) {
|
13003 |
|
13004 | "use strict";
|
13005 |
|
13006 | var _interopRequireDefault = __webpack_require__(14);
|
13007 |
|
13008 | exports.__esModule = true;
|
13009 | exports.default = scrollTop;
|
13010 |
|
13011 | var _isWindow = _interopRequireDefault(__webpack_require__(118));
|
13012 |
|
13013 | function scrollTop(node, val) {
|
13014 | var win = (0, _isWindow.default)(node);
|
13015 | if (val === undefined) return win ? 'pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft : node.scrollLeft;
|
13016 | if (win) win.scrollTo(val, 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop);else node.scrollLeft = val;
|
13017 | }
|
13018 |
|
13019 | module.exports = exports["default"];
|
13020 |
|
13021 | }),
|
13022 |
|
13023 | (function(module, exports, __webpack_require__) {
|
13024 |
|
13025 | 'use strict';
|
13026 |
|
13027 | Object.defineProperty(exports, "__esModule", {
|
13028 | value: true
|
13029 | });
|
13030 |
|
13031 | exports["default"] = function (componentOrElement) {
|
13032 | return (0, _ownerWindow2["default"])(_reactDom2["default"].findDOMNode(componentOrElement));
|
13033 | };
|
13034 |
|
13035 | var _reactDom = __webpack_require__(2);
|
13036 |
|
13037 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
13038 |
|
13039 | var _ownerWindow = __webpack_require__(125);
|
13040 |
|
13041 | var _ownerWindow2 = _interopRequireDefault(_ownerWindow);
|
13042 |
|
13043 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13044 |
|
13045 | module.exports = exports['default'];
|
13046 |
|
13047 | }),
|
13048 |
|
13049 | (function(module, exports, __webpack_require__) {
|
13050 |
|
13051 | "use strict";
|
13052 |
|
13053 | var _interopRequireDefault = __webpack_require__(14);
|
13054 |
|
13055 | exports.__esModule = true;
|
13056 | exports.default = ownerWindow;
|
13057 |
|
13058 | var _ownerDocument = _interopRequireDefault(__webpack_require__(110));
|
13059 |
|
13060 | function ownerWindow(node) {
|
13061 | var doc = (0, _ownerDocument.default)(node);
|
13062 | return doc && doc.defaultView || doc.parentWindow;
|
13063 | }
|
13064 |
|
13065 | module.exports = exports["default"];
|
13066 |
|
13067 | }),
|
13068 |
|
13069 | (function(module, exports, __webpack_require__) {
|
13070 |
|
13071 | 'use strict';
|
13072 |
|
13073 | Object.defineProperty(exports, "__esModule", {
|
13074 | value: true
|
13075 | });
|
13076 |
|
13077 | exports["default"] = function (node, event, handler, capture) {
|
13078 | (0, _on2["default"])(node, event, handler, capture);
|
13079 |
|
13080 | return {
|
13081 | remove: function remove() {
|
13082 | (0, _off2["default"])(node, event, handler, capture);
|
13083 | }
|
13084 | };
|
13085 | };
|
13086 |
|
13087 | var _on = __webpack_require__(16);
|
13088 |
|
13089 | var _on2 = _interopRequireDefault(_on);
|
13090 |
|
13091 | var _off = __webpack_require__(127);
|
13092 |
|
13093 | var _off2 = _interopRequireDefault(_off);
|
13094 |
|
13095 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13096 |
|
13097 | module.exports = exports['default'];
|
13098 |
|
13099 | }),
|
13100 |
|
13101 | (function(module, exports, __webpack_require__) {
|
13102 |
|
13103 | "use strict";
|
13104 |
|
13105 | var _interopRequireDefault = __webpack_require__(14);
|
13106 |
|
13107 | exports.__esModule = true;
|
13108 | exports.default = void 0;
|
13109 |
|
13110 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
13111 |
|
13112 | var off = function off() {};
|
13113 |
|
13114 | if (_inDOM.default) {
|
13115 | off = function () {
|
13116 | if (document.addEventListener) return function (node, eventName, handler, capture) {
|
13117 | return node.removeEventListener(eventName, handler, capture || false);
|
13118 | };else if (document.attachEvent) return function (node, eventName, handler) {
|
13119 | return node.detachEvent('on' + eventName, handler);
|
13120 | };
|
13121 | }();
|
13122 | }
|
13123 |
|
13124 | var _default = off;
|
13125 | exports.default = _default;
|
13126 | module.exports = exports["default"];
|
13127 |
|
13128 | }),
|
13129 |
|
13130 | (function(module, exports, __webpack_require__) {
|
13131 |
|
13132 | 'use strict';
|
13133 |
|
13134 | Object.defineProperty(exports, "__esModule", {
|
13135 | value: true
|
13136 | });
|
13137 |
|
13138 | var _contains = __webpack_require__(107);
|
13139 |
|
13140 | var _contains2 = _interopRequireDefault(_contains);
|
13141 |
|
13142 | var _react = __webpack_require__(1);
|
13143 |
|
13144 | var _react2 = _interopRequireDefault(_react);
|
13145 |
|
13146 | var _propTypes = __webpack_require__(6);
|
13147 |
|
13148 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
13149 |
|
13150 | var _reactDom = __webpack_require__(2);
|
13151 |
|
13152 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
13153 |
|
13154 | var _addEventListener = __webpack_require__(126);
|
13155 |
|
13156 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
13157 |
|
13158 | var _ownerDocument = __webpack_require__(109);
|
13159 |
|
13160 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
13161 |
|
13162 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13163 |
|
13164 | 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; }
|
13165 |
|
13166 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13167 |
|
13168 | 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; }
|
13169 |
|
13170 | 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); }
|
13171 |
|
13172 | var propTypes = {
|
13173 | onRootClose: _propTypes2["default"].func,
|
13174 | children: _propTypes2["default"].element,
|
13175 | |
13176 |
|
13177 |
|
13178 | disabled: _propTypes2["default"].bool,
|
13179 | |
13180 |
|
13181 |
|
13182 | event: _propTypes2["default"].oneOf(['click', 'mousedown'])
|
13183 | };
|
13184 |
|
13185 | var defaultProps = {
|
13186 | event: 'click'
|
13187 | };
|
13188 |
|
13189 | function isLeftClickEvent(event) {
|
13190 | return event.button === 0;
|
13191 | }
|
13192 |
|
13193 | function isModifiedEvent(event) {
|
13194 | return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
13195 | }
|
13196 |
|
13197 | var RootCloseWrapper = function (_Component) {
|
13198 | _inherits(RootCloseWrapper, _Component);
|
13199 |
|
13200 | function RootCloseWrapper(props, context) {
|
13201 | _classCallCheck(this, RootCloseWrapper);
|
13202 |
|
13203 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
13204 |
|
13205 | _this.handleMouseCapture = function (e) {
|
13206 | _this.preventMouseRootClose = isModifiedEvent(e) || !isLeftClickEvent(e) || (0, _contains2["default"])(_reactDom2["default"].findDOMNode(_this), e.target);
|
13207 | };
|
13208 |
|
13209 | _this.handleMouse = function () {
|
13210 | if (!_this.preventMouseRootClose && _this.props.onRootClose) {
|
13211 | _this.props.onRootClose();
|
13212 | }
|
13213 | };
|
13214 |
|
13215 | _this.handleKeyUp = function (e) {
|
13216 | if (e.keyCode === 27 && _this.props.onRootClose) {
|
13217 | _this.props.onRootClose();
|
13218 | }
|
13219 | };
|
13220 |
|
13221 | _this.preventMouseRootClose = false;
|
13222 |
|
13223 | _this.addEventListeners = _this.addEventListeners.bind(_this);
|
13224 | _this.removeEventListeners = _this.removeEventListeners.bind(_this);
|
13225 |
|
13226 | return _this;
|
13227 | }
|
13228 |
|
13229 | RootCloseWrapper.prototype.componentDidMount = function componentDidMount() {
|
13230 | if (!this.props.disabled) {
|
13231 | this.addEventListeners();
|
13232 | }
|
13233 | };
|
13234 |
|
13235 | RootCloseWrapper.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
13236 | if (!this.props.disabled && prevProps.disabled) {
|
13237 | this.addEventListeners();
|
13238 | } else if (this.props.disabled && !prevProps.disabled) {
|
13239 | this.removeEventListeners();
|
13240 | }
|
13241 | };
|
13242 |
|
13243 | RootCloseWrapper.prototype.componentWillUnmount = function componentWillUnmount() {
|
13244 | if (!this.props.disabled) {
|
13245 | this.removeEventListeners();
|
13246 | }
|
13247 | };
|
13248 |
|
13249 | RootCloseWrapper.prototype.addEventListeners = function addEventListeners() {
|
13250 | var event = this.props.event;
|
13251 |
|
13252 | var doc = (0, _ownerDocument2["default"])(this);
|
13253 |
|
13254 |
|
13255 | this.documentMouseCaptureListener = (0, _addEventListener2["default"])(doc, event, this.handleMouseCapture, true);
|
13256 |
|
13257 | this.documentMouseListener = (0, _addEventListener2["default"])(doc, event, this.handleMouse);
|
13258 |
|
13259 | this.documentKeyupListener = (0, _addEventListener2["default"])(doc, 'keyup', this.handleKeyUp);
|
13260 | };
|
13261 |
|
13262 | RootCloseWrapper.prototype.removeEventListeners = function removeEventListeners() {
|
13263 | if (this.documentMouseCaptureListener) {
|
13264 | this.documentMouseCaptureListener.remove();
|
13265 | }
|
13266 |
|
13267 | if (this.documentMouseListener) {
|
13268 | this.documentMouseListener.remove();
|
13269 | }
|
13270 |
|
13271 | if (this.documentKeyupListener) {
|
13272 | this.documentKeyupListener.remove();
|
13273 | }
|
13274 | };
|
13275 |
|
13276 | RootCloseWrapper.prototype.render = function render() {
|
13277 | return this.props.children;
|
13278 | };
|
13279 |
|
13280 | return RootCloseWrapper;
|
13281 | }(_react.Component);
|
13282 |
|
13283 | RootCloseWrapper.propTypes = propTypes;
|
13284 |
|
13285 | RootCloseWrapper.defaultProps = defaultProps;
|
13286 |
|
13287 | exports["default"] = RootCloseWrapper;
|
13288 | module.exports = exports['default'];
|
13289 |
|
13290 | }),
|
13291 |
|
13292 | (function(module, exports, __webpack_require__) {
|
13293 |
|
13294 | 'use strict';
|
13295 |
|
13296 | Object.defineProperty(exports, "__esModule", {
|
13297 | value: true
|
13298 | });
|
13299 |
|
13300 | 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; };
|
13301 |
|
13302 | var _classnames = __webpack_require__(5);
|
13303 |
|
13304 | var _classnames2 = _interopRequireDefault(_classnames);
|
13305 |
|
13306 | var _propTypes = __webpack_require__(6);
|
13307 |
|
13308 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
13309 |
|
13310 | var _react = __webpack_require__(1);
|
13311 |
|
13312 | var _react2 = _interopRequireDefault(_react);
|
13313 |
|
13314 | var _Transition = __webpack_require__(130);
|
13315 |
|
13316 | var _Transition2 = _interopRequireDefault(_Transition);
|
13317 |
|
13318 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13319 |
|
13320 | 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; }
|
13321 |
|
13322 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13323 |
|
13324 | 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; }
|
13325 |
|
13326 | 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); }
|
13327 |
|
13328 | var propTypes = {
|
13329 | |
13330 |
|
13331 |
|
13332 | "in": _propTypes2["default"].bool,
|
13333 |
|
13334 | |
13335 |
|
13336 |
|
13337 | unmountOnExit: _propTypes2["default"].bool,
|
13338 |
|
13339 | |
13340 |
|
13341 |
|
13342 |
|
13343 | transitionAppear: _propTypes2["default"].bool,
|
13344 |
|
13345 | |
13346 |
|
13347 |
|
13348 |
|
13349 |
|
13350 | timeout: _propTypes2["default"].number,
|
13351 |
|
13352 | |
13353 |
|
13354 |
|
13355 | onEnter: _propTypes2["default"].func,
|
13356 | |
13357 |
|
13358 |
|
13359 | onEntering: _propTypes2["default"].func,
|
13360 | |
13361 |
|
13362 |
|
13363 | onEntered: _propTypes2["default"].func,
|
13364 | |
13365 |
|
13366 |
|
13367 | onExit: _propTypes2["default"].func,
|
13368 | |
13369 |
|
13370 |
|
13371 | onExiting: _propTypes2["default"].func,
|
13372 | |
13373 |
|
13374 |
|
13375 | onExited: _propTypes2["default"].func
|
13376 | };
|
13377 |
|
13378 | var defaultProps = {
|
13379 | "in": false,
|
13380 | timeout: 300,
|
13381 | unmountOnExit: false,
|
13382 | transitionAppear: false
|
13383 | };
|
13384 |
|
13385 | var Fade = function (_React$Component) {
|
13386 | _inherits(Fade, _React$Component);
|
13387 |
|
13388 | function Fade() {
|
13389 | _classCallCheck(this, Fade);
|
13390 |
|
13391 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
13392 | }
|
13393 |
|
13394 | Fade.prototype.render = function render() {
|
13395 | return _react2["default"].createElement(_Transition2["default"], _extends({}, this.props, {
|
13396 | className: (0, _classnames2["default"])(this.props.className, 'fade'),
|
13397 | enteredClassName: 'in',
|
13398 | enteringClassName: 'in'
|
13399 | }));
|
13400 | };
|
13401 |
|
13402 | return Fade;
|
13403 | }(_react2["default"].Component);
|
13404 |
|
13405 | Fade.propTypes = propTypes;
|
13406 | Fade.defaultProps = defaultProps;
|
13407 |
|
13408 | exports["default"] = Fade;
|
13409 | module.exports = exports['default'];
|
13410 |
|
13411 | }),
|
13412 |
|
13413 | (function(module, exports, __webpack_require__) {
|
13414 |
|
13415 | 'use strict';
|
13416 |
|
13417 | Object.defineProperty(exports, "__esModule", {
|
13418 | value: true
|
13419 | });
|
13420 | exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined;
|
13421 |
|
13422 | 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; };
|
13423 |
|
13424 | var _react = __webpack_require__(1);
|
13425 |
|
13426 | var _react2 = _interopRequireDefault(_react);
|
13427 |
|
13428 | var _propTypes = __webpack_require__(6);
|
13429 |
|
13430 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
13431 |
|
13432 | var _reactDom = __webpack_require__(2);
|
13433 |
|
13434 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
13435 |
|
13436 | var _properties = __webpack_require__(13);
|
13437 |
|
13438 | var _properties2 = _interopRequireDefault(_properties);
|
13439 |
|
13440 | var _on = __webpack_require__(16);
|
13441 |
|
13442 | var _on2 = _interopRequireDefault(_on);
|
13443 |
|
13444 | var _classnames = __webpack_require__(5);
|
13445 |
|
13446 | var _classnames2 = _interopRequireDefault(_classnames);
|
13447 |
|
13448 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13449 |
|
13450 | 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; }
|
13451 |
|
13452 | 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; }
|
13453 |
|
13454 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13455 |
|
13456 | 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; }
|
13457 |
|
13458 | 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); }
|
13459 |
|
13460 | var transitionEndEvent = _properties2["default"].end;
|
13461 |
|
13462 |
|
13463 | var UNMOUNTED = exports.UNMOUNTED = 0;
|
13464 | var EXITED = exports.EXITED = 1;
|
13465 | var ENTERING = exports.ENTERING = 2;
|
13466 | var ENTERED = exports.ENTERED = 3;
|
13467 | var EXITING = exports.EXITING = 4;
|
13468 |
|
13469 | var propTypes = {
|
13470 | |
13471 |
|
13472 |
|
13473 | "in": _propTypes2["default"].bool,
|
13474 |
|
13475 | |
13476 |
|
13477 |
|
13478 | unmountOnExit: _propTypes2["default"].bool,
|
13479 |
|
13480 | |
13481 |
|
13482 |
|
13483 | transitionAppear: _propTypes2["default"].bool,
|
13484 |
|
13485 | |
13486 |
|
13487 |
|
13488 | timeout: _propTypes2["default"].number,
|
13489 |
|
13490 | |
13491 |
|
13492 |
|
13493 | exitedClassName: _propTypes2["default"].string,
|
13494 | |
13495 |
|
13496 |
|
13497 | exitingClassName: _propTypes2["default"].string,
|
13498 | |
13499 |
|
13500 |
|
13501 | enteredClassName: _propTypes2["default"].string,
|
13502 | |
13503 |
|
13504 |
|
13505 | enteringClassName: _propTypes2["default"].string,
|
13506 |
|
13507 | |
13508 |
|
13509 |
|
13510 | onEnter: _propTypes2["default"].func,
|
13511 | |
13512 |
|
13513 |
|
13514 | onEntering: _propTypes2["default"].func,
|
13515 | |
13516 |
|
13517 |
|
13518 | onEntered: _propTypes2["default"].func,
|
13519 | |
13520 |
|
13521 |
|
13522 | onExit: _propTypes2["default"].func,
|
13523 | |
13524 |
|
13525 |
|
13526 | onExiting: _propTypes2["default"].func,
|
13527 | |
13528 |
|
13529 |
|
13530 | onExited: _propTypes2["default"].func
|
13531 | };
|
13532 |
|
13533 | function noop() {}
|
13534 |
|
13535 | var defaultProps = {
|
13536 | "in": false,
|
13537 | unmountOnExit: false,
|
13538 | transitionAppear: false,
|
13539 | timeout: 5000,
|
13540 | onEnter: noop,
|
13541 | onEntering: noop,
|
13542 | onEntered: noop,
|
13543 | onExit: noop,
|
13544 | onExiting: noop,
|
13545 | onExited: noop
|
13546 | };
|
13547 |
|
13548 | |
13549 |
|
13550 |
|
13551 |
|
13552 | var Transition = function (_Component) {
|
13553 | _inherits(Transition, _Component);
|
13554 |
|
13555 | function Transition(props, context) {
|
13556 | _classCallCheck(this, Transition);
|
13557 |
|
13558 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
13559 |
|
13560 | var initialStatus = void 0;
|
13561 | if (props["in"]) {
|
13562 |
|
13563 | initialStatus = props.transitionAppear ? EXITED : ENTERED;
|
13564 | } else {
|
13565 | initialStatus = props.unmountOnExit ? UNMOUNTED : EXITED;
|
13566 | }
|
13567 | _this.state = { status: initialStatus };
|
13568 |
|
13569 | _this.nextCallback = null;
|
13570 |
|
13571 | _this.performEnter = _this.performEnter.bind(_this);
|
13572 | _this.performExit = _this.performExit.bind(_this);
|
13573 | _this.cancelNextCallback = _this.cancelNextCallback.bind(_this);
|
13574 | _this.onTransitionEnd = _this.onTransitionEnd.bind(_this);
|
13575 | _this.safeSetState = _this.safeSetState.bind(_this);
|
13576 | _this.setNextCallback = _this.setNextCallback.bind(_this);
|
13577 |
|
13578 | return _this;
|
13579 | }
|
13580 |
|
13581 | Transition.prototype.componentDidMount = function componentDidMount() {
|
13582 | if (this.props.transitionAppear && this.props["in"]) {
|
13583 | this.performEnter(this.props);
|
13584 | }
|
13585 | };
|
13586 |
|
13587 | Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
13588 | if (nextProps["in"] && this.props.unmountOnExit) {
|
13589 | if (this.state.status === UNMOUNTED) {
|
13590 |
|
13591 | this.setState({ status: EXITED });
|
13592 | }
|
13593 | } else {
|
13594 | this._needsUpdate = true;
|
13595 | }
|
13596 | };
|
13597 |
|
13598 | Transition.prototype.componentDidUpdate = function componentDidUpdate() {
|
13599 | var status = this.state.status;
|
13600 |
|
13601 | if (this.props.unmountOnExit && status === EXITED) {
|
13602 |
|
13603 | if (this.props["in"]) {
|
13604 | this.performEnter(this.props);
|
13605 | } else {
|
13606 | this.setState({ status: UNMOUNTED });
|
13607 | }
|
13608 |
|
13609 | return;
|
13610 | }
|
13611 |
|
13612 |
|
13613 | if (this._needsUpdate) {
|
13614 | this._needsUpdate = false;
|
13615 |
|
13616 | if (this.props["in"]) {
|
13617 | if (status === EXITING) {
|
13618 | this.performEnter(this.props);
|
13619 | } else if (status === EXITED) {
|
13620 | this.performEnter(this.props);
|
13621 | }
|
13622 |
|
13623 | } else {
|
13624 | if (status === ENTERING || status === ENTERED) {
|
13625 | this.performExit(this.props);
|
13626 | }
|
13627 |
|
13628 | }
|
13629 | }
|
13630 | };
|
13631 |
|
13632 | Transition.prototype.componentWillUnmount = function componentWillUnmount() {
|
13633 | this.cancelNextCallback();
|
13634 | };
|
13635 |
|
13636 | Transition.prototype.performEnter = function performEnter(props) {
|
13637 | var _this2 = this;
|
13638 |
|
13639 | this.cancelNextCallback();
|
13640 | var node = _reactDom2["default"].findDOMNode(this);
|
13641 |
|
13642 |
|
13643 | props.onEnter(node);
|
13644 |
|
13645 | this.safeSetState({ status: ENTERING }, function () {
|
13646 | _this2.props.onEntering(node);
|
13647 |
|
13648 | _this2.onTransitionEnd(node, function () {
|
13649 | _this2.safeSetState({ status: ENTERED }, function () {
|
13650 | _this2.props.onEntered(node);
|
13651 | });
|
13652 | });
|
13653 | });
|
13654 | };
|
13655 |
|
13656 | Transition.prototype.performExit = function performExit(props) {
|
13657 | var _this3 = this;
|
13658 |
|
13659 | this.cancelNextCallback();
|
13660 | var node = _reactDom2["default"].findDOMNode(this);
|
13661 |
|
13662 | props.onExit(node);
|
13663 |
|
13664 | this.safeSetState({ status: EXITING }, function () {
|
13665 | _this3.props.onExiting(node);
|
13666 |
|
13667 | _this3.onTransitionEnd(node, function () {
|
13668 | _this3.safeSetState({ status: EXITED }, function () {
|
13669 | _this3.props.onExited(node);
|
13670 | });
|
13671 | });
|
13672 | });
|
13673 | };
|
13674 |
|
13675 | Transition.prototype.cancelNextCallback = function cancelNextCallback() {
|
13676 | if (this.nextCallback !== null) {
|
13677 | this.nextCallback.cancel();
|
13678 | this.nextCallback = null;
|
13679 | }
|
13680 | };
|
13681 |
|
13682 | Transition.prototype.safeSetState = function safeSetState(nextState, callback) {
|
13683 |
|
13684 | this.setState(nextState, this.setNextCallback(callback));
|
13685 | };
|
13686 |
|
13687 | Transition.prototype.setNextCallback = function setNextCallback(callback) {
|
13688 | var _this4 = this;
|
13689 |
|
13690 | var active = true;
|
13691 |
|
13692 | this.nextCallback = function (event) {
|
13693 | if (active) {
|
13694 | active = false;
|
13695 | _this4.nextCallback = null;
|
13696 |
|
13697 | callback(event);
|
13698 | }
|
13699 | };
|
13700 |
|
13701 | this.nextCallback.cancel = function () {
|
13702 | active = false;
|
13703 | };
|
13704 |
|
13705 | return this.nextCallback;
|
13706 | };
|
13707 |
|
13708 | Transition.prototype.onTransitionEnd = function onTransitionEnd(node, handler) {
|
13709 | this.setNextCallback(handler);
|
13710 |
|
13711 | if (node) {
|
13712 | (0, _on2["default"])(node, transitionEndEvent, this.nextCallback);
|
13713 | setTimeout(this.nextCallback, this.props.timeout);
|
13714 | } else {
|
13715 | setTimeout(this.nextCallback, 0);
|
13716 | }
|
13717 | };
|
13718 |
|
13719 | Transition.prototype.render = function render() {
|
13720 | var status = this.state.status;
|
13721 | if (status === UNMOUNTED) {
|
13722 | return null;
|
13723 | }
|
13724 |
|
13725 | var _props = this.props,
|
13726 | children = _props.children,
|
13727 | className = _props.className,
|
13728 | childProps = _objectWithoutProperties(_props, ['children', 'className']);
|
13729 |
|
13730 | Object.keys(Transition.propTypes).forEach(function (key) {
|
13731 | return delete childProps[key];
|
13732 | });
|
13733 |
|
13734 | var transitionClassName = void 0;
|
13735 | if (status === EXITED) {
|
13736 | transitionClassName = this.props.exitedClassName;
|
13737 | } else if (status === ENTERING) {
|
13738 | transitionClassName = this.props.enteringClassName;
|
13739 | } else if (status === ENTERED) {
|
13740 | transitionClassName = this.props.enteredClassName;
|
13741 | } else if (status === EXITING) {
|
13742 | transitionClassName = this.props.exitingClassName;
|
13743 | }
|
13744 |
|
13745 | var child = _react2["default"].Children.only(children);
|
13746 | return _react2["default"].cloneElement(child, _extends({}, childProps, {
|
13747 | className: (0, _classnames2["default"])(child.props.className, className, transitionClassName)
|
13748 | }));
|
13749 | };
|
13750 |
|
13751 | return Transition;
|
13752 | }(_react.Component);
|
13753 |
|
13754 | Transition.propTypes = propTypes;
|
13755 |
|
13756 | Transition.defaultProps = defaultProps;
|
13757 |
|
13758 | exports["default"] = Transition;
|
13759 |
|
13760 | }),
|
13761 |
|
13762 | (function(module, exports) {
|
13763 |
|
13764 | 'use strict';
|
13765 |
|
13766 | Object.defineProperty(exports, "__esModule", {
|
13767 | value: true
|
13768 | });
|
13769 | |
13770 |
|
13771 |
|
13772 |
|
13773 |
|
13774 |
|
13775 |
|
13776 |
|
13777 |
|
13778 | function createChainedFunction() {
|
13779 | for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
|
13780 | funcs[_key] = arguments[_key];
|
13781 | }
|
13782 |
|
13783 | return funcs.filter(function (f) {
|
13784 | return f != null;
|
13785 | }).reduce(function (acc, f) {
|
13786 | if (typeof f !== 'function') {
|
13787 | throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
|
13788 | }
|
13789 |
|
13790 | if (acc === null) {
|
13791 | return f;
|
13792 | }
|
13793 |
|
13794 | return function chainedFunction() {
|
13795 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
13796 | args[_key2] = arguments[_key2];
|
13797 | }
|
13798 |
|
13799 | acc.apply(this, args);
|
13800 | f.apply(this, args);
|
13801 | };
|
13802 | }, null);
|
13803 | }
|
13804 |
|
13805 | exports["default"] = createChainedFunction;
|
13806 | module.exports = exports['default'];
|
13807 |
|
13808 | }),
|
13809 |
|
13810 | (function(module, exports) {
|
13811 |
|
13812 | 'use strict';
|
13813 |
|
13814 | Object.defineProperty(exports, "__esModule", {
|
13815 | value: true
|
13816 | });
|
13817 |
|
13818 | 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; };
|
13819 |
|
13820 | exports.getComponentLocale = getComponentLocale;
|
13821 | exports.getLocaleCode = getLocaleCode;
|
13822 | function getComponentLocale(props, context, componentName, getDefaultLocale) {
|
13823 | var locale = {};
|
13824 | if (context && context.beeLocale && context.beeLocale[componentName]) {
|
13825 | locale = context.beeLocale[componentName];
|
13826 | } else {
|
13827 | var defaultLocale = getDefaultLocale();
|
13828 |
|
13829 | locale = defaultLocale["default"] || defaultLocale;
|
13830 | }
|
13831 |
|
13832 | var result = _extends({}, locale, props.locale);
|
13833 | if (props.locale) {
|
13834 | result.lang = _extends({}, locale.lang, props.locale.lang);
|
13835 | } else {
|
13836 | result.lang = _extends({}, locale.lang);
|
13837 | }
|
13838 |
|
13839 | return result;
|
13840 | }
|
13841 |
|
13842 | function getLocaleCode(context) {
|
13843 | var localeCode = context.beeLocale && context.beeLocale.lang;
|
13844 |
|
13845 | if (context.beeLocale && context.beeLocale.exist && !localeCode) {
|
13846 | return 'zh-cn';
|
13847 | }
|
13848 | return localeCode;
|
13849 | }
|
13850 |
|
13851 | }),
|
13852 |
|
13853 | (function(module, exports) {
|
13854 |
|
13855 | 'use strict';
|
13856 |
|
13857 | module.exports = {
|
13858 | 'lang': 'zh-cn',
|
13859 | 'copy': '复制',
|
13860 | 'cut': '剪切',
|
13861 | 'copyReady': '已复制',
|
13862 | 'cutReady': '已剪切',
|
13863 | 'copyToClipboard': '复制到剪切板',
|
13864 | 'close': '关闭',
|
13865 |
|
13866 | 'en-us': {
|
13867 | 'copy': 'copy',
|
13868 | 'cut': 'cut',
|
13869 | 'copyReady': 'copied',
|
13870 | 'cutReady': 'cut',
|
13871 | 'copyToClipboard': 'copy to clipboard',
|
13872 | 'close': 'close'
|
13873 | },
|
13874 | 'zh-tw': {
|
13875 | 'copy': '複製',
|
13876 | 'cut': '剪切',
|
13877 | 'copyReady': '已複製',
|
13878 | 'cutReady': '已剪切',
|
13879 | 'copyToClipboard': '複製到剪切板',
|
13880 | 'close': '關閉'
|
13881 | }
|
13882 | };
|
13883 |
|
13884 | }),
|
13885 |
|
13886 | (function(module, exports, __webpack_require__) {
|
13887 |
|
13888 | 'use strict';
|
13889 |
|
13890 | Object.defineProperty(exports, "__esModule", {
|
13891 | value: true
|
13892 | });
|
13893 |
|
13894 | var _Modal = __webpack_require__(135);
|
13895 |
|
13896 | var _Modal2 = _interopRequireDefault(_Modal);
|
13897 |
|
13898 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13899 |
|
13900 | exports["default"] = _Modal2["default"];
|
13901 | module.exports = exports['default'];
|
13902 |
|
13903 | }),
|
13904 |
|
13905 | (function(module, exports, __webpack_require__) {
|
13906 |
|
13907 | 'use strict';
|
13908 |
|
13909 | Object.defineProperty(exports, "__esModule", {
|
13910 | value: true
|
13911 | });
|
13912 |
|
13913 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
13914 |
|
13915 | 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; };
|
13916 |
|
13917 | var _classnames = __webpack_require__(5);
|
13918 |
|
13919 | var _classnames2 = _interopRequireDefault(_classnames);
|
13920 |
|
13921 | var _events = __webpack_require__(136);
|
13922 |
|
13923 | var _events2 = _interopRequireDefault(_events);
|
13924 |
|
13925 | var _ownerDocument = __webpack_require__(110);
|
13926 |
|
13927 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
13928 |
|
13929 | var _inDOM = __webpack_require__(15);
|
13930 |
|
13931 | var _inDOM2 = _interopRequireDefault(_inDOM);
|
13932 |
|
13933 | var _scrollbarSize = __webpack_require__(140);
|
13934 |
|
13935 | var _scrollbarSize2 = _interopRequireDefault(_scrollbarSize);
|
13936 |
|
13937 | var _react = __webpack_require__(1);
|
13938 |
|
13939 | var _react2 = _interopRequireDefault(_react);
|
13940 |
|
13941 | var _reactDom = __webpack_require__(2);
|
13942 |
|
13943 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
13944 |
|
13945 | var _Modal = __webpack_require__(141);
|
13946 |
|
13947 | var _Modal2 = _interopRequireDefault(_Modal);
|
13948 |
|
13949 | var _isOverflowing = __webpack_require__(144);
|
13950 |
|
13951 | var _isOverflowing2 = _interopRequireDefault(_isOverflowing);
|
13952 |
|
13953 | var _tinperBeeCore = __webpack_require__(27);
|
13954 |
|
13955 | var _beeTransition = __webpack_require__(11);
|
13956 |
|
13957 | var _ModalBody = __webpack_require__(148);
|
13958 |
|
13959 | var _ModalBody2 = _interopRequireDefault(_ModalBody);
|
13960 |
|
13961 | var _ModalDialog = __webpack_require__(149);
|
13962 |
|
13963 | var _ModalDialog2 = _interopRequireDefault(_ModalDialog);
|
13964 |
|
13965 | var _ModalFooter = __webpack_require__(150);
|
13966 |
|
13967 | var _ModalFooter2 = _interopRequireDefault(_ModalFooter);
|
13968 |
|
13969 | var _ModalHeader = __webpack_require__(151);
|
13970 |
|
13971 | var _ModalHeader2 = _interopRequireDefault(_ModalHeader);
|
13972 |
|
13973 | var _ModalTitle = __webpack_require__(152);
|
13974 |
|
13975 | var _ModalTitle2 = _interopRequireDefault(_ModalTitle);
|
13976 |
|
13977 | var _propTypes = __webpack_require__(6);
|
13978 |
|
13979 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
13980 |
|
13981 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13982 |
|
13983 | 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; }
|
13984 |
|
13985 | 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; }
|
13986 |
|
13987 | 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; }
|
13988 |
|
13989 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13990 |
|
13991 | 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; }
|
13992 |
|
13993 | 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); }
|
13994 |
|
13995 | var propTypes = _extends({}, _Modal2["default"].propTypes, _ModalDialog2["default"].propTypes, {
|
13996 |
|
13997 | |
13998 |
|
13999 |
|
14000 | backdrop: _propTypes2["default"].oneOf(['static', true, false]),
|
14001 |
|
14002 | |
14003 |
|
14004 |
|
14005 | backdropClosable: _propTypes2["default"].bool,
|
14006 | |
14007 |
|
14008 |
|
14009 | keyboard: _propTypes2["default"].bool,
|
14010 |
|
14011 | |
14012 |
|
14013 |
|
14014 | animation: _propTypes2["default"].bool,
|
14015 |
|
14016 | |
14017 |
|
14018 |
|
14019 | dialogComponentClass: _tinperBeeCore.elementType,
|
14020 |
|
14021 | |
14022 |
|
14023 |
|
14024 | autoFocus: _propTypes2["default"].bool,
|
14025 |
|
14026 | |
14027 |
|
14028 |
|
14029 | enforceFocus: _propTypes2["default"].bool,
|
14030 |
|
14031 | |
14032 |
|
14033 |
|
14034 | show: _propTypes2["default"].bool,
|
14035 |
|
14036 | |
14037 |
|
14038 |
|
14039 | onHide: _propTypes2["default"].func,
|
14040 |
|
14041 | onEnter: _propTypes2["default"].func,
|
14042 |
|
14043 | onEntering: _propTypes2["default"].func,
|
14044 |
|
14045 | onEntered: _propTypes2["default"].func,
|
14046 |
|
14047 | onExit: _propTypes2["default"].func,
|
14048 |
|
14049 | onExiting: _propTypes2["default"].func,
|
14050 |
|
14051 | onExited: _propTypes2["default"].func,
|
14052 |
|
14053 | |
14054 |
|
14055 |
|
14056 | container: _Modal2["default"].propTypes.container,
|
14057 |
|
14058 | |
14059 |
|
14060 |
|
14061 | size: _propTypes2["default"].oneOf(["sm", "lg", "xlg", ""]),
|
14062 | |
14063 |
|
14064 |
|
14065 | width: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string])
|
14066 | });
|
14067 |
|
14068 | var defaultProps = _extends({}, _Modal2["default"].defaultProps, {
|
14069 | backdropClosable: true,
|
14070 | animation: true,
|
14071 | dialogComponentClass: _ModalDialog2["default"],
|
14072 | clsPrefix: 'u-modal'
|
14073 | });
|
14074 |
|
14075 | var childContextTypes = {
|
14076 | $u_modal: _propTypes2["default"].shape({
|
14077 | onHide: _propTypes2["default"].func
|
14078 | })
|
14079 | };
|
14080 |
|
14081 | var Modal = function (_React$Component) {
|
14082 | _inherits(Modal, _React$Component);
|
14083 |
|
14084 | function Modal(props, context) {
|
14085 | _classCallCheck(this, Modal);
|
14086 |
|
14087 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
14088 |
|
14089 | _this.handleEntering = _this.handleEntering.bind(_this);
|
14090 | _this.handleExited = _this.handleExited.bind(_this);
|
14091 | _this.handleWindowResize = _this.handleWindowResize.bind(_this);
|
14092 | _this.handleDialogClick = _this.handleDialogClick.bind(_this);
|
14093 |
|
14094 | _this.state = {
|
14095 | style: {}
|
14096 | };
|
14097 | return _this;
|
14098 | }
|
14099 |
|
14100 | Modal.prototype.getChildContext = function getChildContext() {
|
14101 | return {
|
14102 | $u_modal: {
|
14103 | onHide: this.props.onHide
|
14104 | }
|
14105 | };
|
14106 | };
|
14107 |
|
14108 | Modal.prototype.componentWillUnmount = function componentWillUnmount() {
|
14109 |
|
14110 | this.handleExited();
|
14111 | };
|
14112 |
|
14113 | Modal.prototype.handleEntering = function handleEntering() {
|
14114 |
|
14115 | _events2["default"].on(window, 'resize', this.handleWindowResize);
|
14116 | this.updateStyle();
|
14117 | };
|
14118 |
|
14119 | Modal.prototype.handleExited = function handleExited() {
|
14120 |
|
14121 | _events2["default"].off(window, 'resize', this.handleWindowResize);
|
14122 | };
|
14123 |
|
14124 | Modal.prototype.handleWindowResize = function handleWindowResize() {
|
14125 | this.updateStyle();
|
14126 | };
|
14127 |
|
14128 | Modal.prototype.handleDialogClick = function handleDialogClick(e) {
|
14129 | if (e.target !== e.currentTarget) {
|
14130 | return;
|
14131 | }
|
14132 |
|
14133 | this.props.onHide();
|
14134 | };
|
14135 |
|
14136 | Modal.prototype.updateStyle = function updateStyle() {
|
14137 | if (!_inDOM2["default"] || !this._modal) {
|
14138 | return;
|
14139 | }
|
14140 |
|
14141 | var dialogNode = this._modal.getDialogElement();
|
14142 | var dialogHeight = dialogNode.scrollHeight;
|
14143 |
|
14144 | var document = (0, _ownerDocument2["default"])(dialogNode);
|
14145 | var bodyIsOverflowing = (0, _isOverflowing2["default"])(_reactDom2["default"].findDOMNode(this.props.container || document.body));
|
14146 | var modalIsOverflowing = dialogHeight > document.documentElement.clientHeight;
|
14147 |
|
14148 | this.setState({
|
14149 | style: {
|
14150 | paddingRight: bodyIsOverflowing && !modalIsOverflowing ? (0, _scrollbarSize2["default"])() : undefined,
|
14151 | paddingLeft: !bodyIsOverflowing && modalIsOverflowing ? (0, _scrollbarSize2["default"])() : undefined
|
14152 | }
|
14153 | });
|
14154 | };
|
14155 |
|
14156 | Modal.prototype.render = function render() {
|
14157 | var _this2 = this;
|
14158 |
|
14159 | var _props = this.props,
|
14160 | backdrop = _props.backdrop,
|
14161 | backdropClosable = _props.backdropClosable,
|
14162 | animation = _props.animation,
|
14163 | show = _props.show,
|
14164 | Dialog = _props.dialogComponentClass,
|
14165 | className = _props.className,
|
14166 | clsPrefix = _props.clsPrefix,
|
14167 | _props$style = _props.style,
|
14168 | style = _props$style === undefined ? {} : _props$style,
|
14169 | size = _props.size,
|
14170 | width = _props.width,
|
14171 | children = _props.children,
|
14172 | onEntering = _props.onEntering,
|
14173 | onExited = _props.onExited,
|
14174 | props = _objectWithoutProperties(_props, ['backdrop', 'backdropClosable', 'animation', 'show', 'dialogComponentClass', 'className', 'clsPrefix', 'style', 'size', 'width', 'children', 'onEntering', 'onExited']);
|
14175 |
|
14176 | var _splitComponent = (0, _tinperBeeCore.splitComponent)(props, _Modal2["default"]),
|
14177 | _splitComponent2 = _slicedToArray(_splitComponent, 2),
|
14178 | baseModalProps = _splitComponent2[0],
|
14179 | dialogProps = _splitComponent2[1];
|
14180 |
|
14181 | var inClassName = show && !animation && 'in';
|
14182 |
|
14183 | var backdropClasses = _defineProperty({}, clsPrefix + '-backdrop', true);
|
14184 | var containerClasses = _defineProperty({}, clsPrefix + '-open', true);
|
14185 | if (Number(width)) width += 'px';
|
14186 |
|
14187 | var styleRes = _extends({}, this.state.style, style);
|
14188 | if (width) {
|
14189 | _extends(styleRes, { width: width });
|
14190 | }
|
14191 | return _react2["default"].createElement(
|
14192 | _Modal2["default"],
|
14193 | _extends({}, baseModalProps, {
|
14194 | ref: function ref(c) {
|
14195 | _this2._modal = c;
|
14196 | },
|
14197 | show: show,
|
14198 | onEntering: (0, _tinperBeeCore.createChainedFunction)(onEntering, this.handleEntering),
|
14199 | onExited: (0, _tinperBeeCore.createChainedFunction)(onExited, this.handleExited),
|
14200 | backdrop: backdrop,
|
14201 | backdropClassName: (0, _classnames2["default"])(backdropClasses, inClassName),
|
14202 | containerClassName: (0, _classnames2["default"])(containerClasses),
|
14203 | transition: animation ? _beeTransition.Fade : undefined,
|
14204 | dialogTransitionTimeout: Modal.TRANSITION_DURATION,
|
14205 | backdropTransitionTimeout: Modal.BACKDROP_TRANSITION_DURATION
|
14206 | }),
|
14207 | _react2["default"].createElement(
|
14208 | Dialog,
|
14209 | _extends({}, dialogProps, {
|
14210 | style: styleRes,
|
14211 | className: (0, _classnames2["default"])(className, inClassName),
|
14212 | onClick: backdrop === true && !!backdropClosable ? this.handleDialogClick : null,
|
14213 | size: size
|
14214 | }),
|
14215 | children
|
14216 | )
|
14217 | );
|
14218 | };
|
14219 |
|
14220 | return Modal;
|
14221 | }(_react2["default"].Component);
|
14222 |
|
14223 | Modal.propTypes = propTypes;
|
14224 | Modal.defaultProps = defaultProps;
|
14225 | Modal.childContextTypes = childContextTypes;
|
14226 |
|
14227 | Modal.Body = _ModalBody2["default"];
|
14228 | Modal.Header = _ModalHeader2["default"];
|
14229 | Modal.Title = _ModalTitle2["default"];
|
14230 | Modal.Footer = _ModalFooter2["default"];
|
14231 |
|
14232 | Modal.Dialog = _ModalDialog2["default"];
|
14233 |
|
14234 | Modal.TRANSITION_DURATION = 200000;
|
14235 | Modal.BACKDROP_TRANSITION_DURATION = 10000;
|
14236 |
|
14237 | exports["default"] = Modal;
|
14238 | module.exports = exports['default'];
|
14239 |
|
14240 | }),
|
14241 |
|
14242 | (function(module, exports, __webpack_require__) {
|
14243 |
|
14244 | "use strict";
|
14245 |
|
14246 | var _interopRequireDefault = __webpack_require__(14);
|
14247 |
|
14248 | exports.__esModule = true;
|
14249 | exports.default = void 0;
|
14250 |
|
14251 | var _on = _interopRequireDefault(__webpack_require__(16));
|
14252 |
|
14253 | exports.on = _on.default;
|
14254 |
|
14255 | var _off = _interopRequireDefault(__webpack_require__(127));
|
14256 |
|
14257 | exports.off = _off.default;
|
14258 |
|
14259 | var _filter = _interopRequireDefault(__webpack_require__(137));
|
14260 |
|
14261 | exports.filter = _filter.default;
|
14262 |
|
14263 | var _listen = _interopRequireDefault(__webpack_require__(139));
|
14264 |
|
14265 | exports.listen = _listen.default;
|
14266 | var _default = {
|
14267 | on: _on.default,
|
14268 | off: _off.default,
|
14269 | filter: _filter.default,
|
14270 | listen: _listen.default
|
14271 | };
|
14272 | exports.default = _default;
|
14273 |
|
14274 | }),
|
14275 |
|
14276 | (function(module, exports, __webpack_require__) {
|
14277 |
|
14278 | "use strict";
|
14279 |
|
14280 | var _interopRequireDefault = __webpack_require__(14);
|
14281 |
|
14282 | exports.__esModule = true;
|
14283 | exports.default = filterEvents;
|
14284 |
|
14285 | var _contains = _interopRequireDefault(__webpack_require__(107));
|
14286 |
|
14287 | var _querySelectorAll = _interopRequireDefault(__webpack_require__(138));
|
14288 |
|
14289 | function filterEvents(selector, handler) {
|
14290 | return function filterHandler(e) {
|
14291 | var top = e.currentTarget,
|
14292 | target = e.target,
|
14293 | matches = (0, _querySelectorAll.default)(top, selector);
|
14294 | if (matches.some(function (match) {
|
14295 | return (0, _contains.default)(match, target);
|
14296 | })) handler.call(this, e);
|
14297 | };
|
14298 | }
|
14299 |
|
14300 | module.exports = exports["default"];
|
14301 |
|
14302 | }),
|
14303 |
|
14304 | (function(module, exports) {
|
14305 |
|
14306 | "use strict";
|
14307 |
|
14308 | exports.__esModule = true;
|
14309 | exports.default = qsa;
|
14310 |
|
14311 |
|
14312 |
|
14313 | var simpleSelectorRE = /^[\w-]*$/;
|
14314 | var toArray = Function.prototype.bind.call(Function.prototype.call, [].slice);
|
14315 |
|
14316 | function qsa(element, selector) {
|
14317 | var maybeID = selector[0] === '#',
|
14318 | maybeClass = selector[0] === '.',
|
14319 | nameOnly = maybeID || maybeClass ? selector.slice(1) : selector,
|
14320 | isSimple = simpleSelectorRE.test(nameOnly),
|
14321 | found;
|
14322 |
|
14323 | if (isSimple) {
|
14324 | if (maybeID) {
|
14325 | element = element.getElementById ? element : document;
|
14326 | return (found = element.getElementById(nameOnly)) ? [found] : [];
|
14327 | }
|
14328 |
|
14329 | if (element.getElementsByClassName && maybeClass) return toArray(element.getElementsByClassName(nameOnly));
|
14330 | return toArray(element.getElementsByTagName(selector));
|
14331 | }
|
14332 |
|
14333 | return toArray(element.querySelectorAll(selector));
|
14334 | }
|
14335 |
|
14336 | module.exports = exports["default"];
|
14337 |
|
14338 | }),
|
14339 |
|
14340 | (function(module, exports, __webpack_require__) {
|
14341 |
|
14342 | "use strict";
|
14343 |
|
14344 | var _interopRequireDefault = __webpack_require__(14);
|
14345 |
|
14346 | exports.__esModule = true;
|
14347 | exports.default = void 0;
|
14348 |
|
14349 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
14350 |
|
14351 | var _on = _interopRequireDefault(__webpack_require__(16));
|
14352 |
|
14353 | var _off = _interopRequireDefault(__webpack_require__(127));
|
14354 |
|
14355 | var listen = function listen() {};
|
14356 |
|
14357 | if (_inDOM.default) {
|
14358 | listen = function listen(node, eventName, handler, capture) {
|
14359 | (0, _on.default)(node, eventName, handler, capture);
|
14360 | return function () {
|
14361 | (0, _off.default)(node, eventName, handler, capture);
|
14362 | };
|
14363 | };
|
14364 | }
|
14365 |
|
14366 | var _default = listen;
|
14367 | exports.default = _default;
|
14368 | module.exports = exports["default"];
|
14369 |
|
14370 | }),
|
14371 |
|
14372 | (function(module, exports, __webpack_require__) {
|
14373 |
|
14374 | "use strict";
|
14375 |
|
14376 | var _interopRequireDefault = __webpack_require__(14);
|
14377 |
|
14378 | exports.__esModule = true;
|
14379 | exports.default = scrollbarSize;
|
14380 |
|
14381 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
14382 |
|
14383 | var size;
|
14384 |
|
14385 | function scrollbarSize(recalc) {
|
14386 | if (!size && size !== 0 || recalc) {
|
14387 | if (_inDOM.default) {
|
14388 | var scrollDiv = document.createElement('div');
|
14389 | scrollDiv.style.position = 'absolute';
|
14390 | scrollDiv.style.top = '-9999px';
|
14391 | scrollDiv.style.width = '50px';
|
14392 | scrollDiv.style.height = '50px';
|
14393 | scrollDiv.style.overflow = 'scroll';
|
14394 | document.body.appendChild(scrollDiv);
|
14395 | size = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
14396 | document.body.removeChild(scrollDiv);
|
14397 | }
|
14398 | }
|
14399 |
|
14400 | return size;
|
14401 | }
|
14402 |
|
14403 | module.exports = exports["default"];
|
14404 |
|
14405 | }),
|
14406 |
|
14407 | (function(module, exports, __webpack_require__) {
|
14408 |
|
14409 | 'use strict';
|
14410 |
|
14411 | Object.defineProperty(exports, "__esModule", {
|
14412 | value: true
|
14413 | });
|
14414 |
|
14415 | 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; };
|
14416 |
|
14417 |
|
14418 | var _react = __webpack_require__(1);
|
14419 |
|
14420 | var _react2 = _interopRequireDefault(_react);
|
14421 |
|
14422 | var _propTypes = __webpack_require__(6);
|
14423 |
|
14424 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
14425 |
|
14426 | var _warning = __webpack_require__(32);
|
14427 |
|
14428 | var _warning2 = _interopRequireDefault(_warning);
|
14429 |
|
14430 | var _tinperBeeCore = __webpack_require__(27);
|
14431 |
|
14432 | var _Portal = __webpack_require__(108);
|
14433 |
|
14434 | var _Portal2 = _interopRequireDefault(_Portal);
|
14435 |
|
14436 | var _ModalManager = __webpack_require__(142);
|
14437 |
|
14438 | var _ModalManager2 = _interopRequireDefault(_ModalManager);
|
14439 |
|
14440 | var _ownerDocument = __webpack_require__(109);
|
14441 |
|
14442 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
14443 |
|
14444 | var _addEventListener = __webpack_require__(126);
|
14445 |
|
14446 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
14447 |
|
14448 | var _addFocusListener = __webpack_require__(146);
|
14449 |
|
14450 | var _addFocusListener2 = _interopRequireDefault(_addFocusListener);
|
14451 |
|
14452 | var _inDOM = __webpack_require__(15);
|
14453 |
|
14454 | var _inDOM2 = _interopRequireDefault(_inDOM);
|
14455 |
|
14456 | var _activeElement = __webpack_require__(147);
|
14457 |
|
14458 | var _activeElement2 = _interopRequireDefault(_activeElement);
|
14459 |
|
14460 | var _contains = __webpack_require__(107);
|
14461 |
|
14462 | var _contains2 = _interopRequireDefault(_contains);
|
14463 |
|
14464 | var _getContainer = __webpack_require__(111);
|
14465 |
|
14466 | var _getContainer2 = _interopRequireDefault(_getContainer);
|
14467 |
|
14468 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
14469 |
|
14470 | 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; }
|
14471 |
|
14472 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14473 |
|
14474 | 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; }
|
14475 |
|
14476 | 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); }
|
14477 |
|
14478 | var modalManager = new _ModalManager2["default"]();
|
14479 |
|
14480 | |
14481 |
|
14482 |
|
14483 |
|
14484 | var propTypes = _extends({}, _Portal2["default"].propTypes, {
|
14485 |
|
14486 | |
14487 |
|
14488 |
|
14489 | show: _propTypes2["default"].bool,
|
14490 |
|
14491 | |
14492 |
|
14493 |
|
14494 | container: _propTypes2["default"].oneOfType([_tinperBeeCore.componentOrElement, _propTypes2["default"].func]),
|
14495 |
|
14496 | |
14497 |
|
14498 |
|
14499 | onShow: _propTypes2["default"].func,
|
14500 |
|
14501 | |
14502 |
|
14503 |
|
14504 | onHide: _propTypes2["default"].func,
|
14505 |
|
14506 | |
14507 |
|
14508 |
|
14509 | backdrop: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].oneOf(['static'])]),
|
14510 |
|
14511 | |
14512 |
|
14513 |
|
14514 | renderBackdrop: _propTypes2["default"].func,
|
14515 |
|
14516 | |
14517 |
|
14518 |
|
14519 | onEscapeKeyUp: _propTypes2["default"].func,
|
14520 |
|
14521 | |
14522 |
|
14523 |
|
14524 | onBackdropClick: _propTypes2["default"].func,
|
14525 |
|
14526 | |
14527 |
|
14528 |
|
14529 | backdropStyle: _propTypes2["default"].object,
|
14530 |
|
14531 | |
14532 |
|
14533 |
|
14534 | backdropClassName: _propTypes2["default"].string,
|
14535 |
|
14536 | |
14537 |
|
14538 |
|
14539 | containerClassName: _propTypes2["default"].string,
|
14540 |
|
14541 | |
14542 |
|
14543 |
|
14544 | keyboard: _propTypes2["default"].bool,
|
14545 |
|
14546 | |
14547 |
|
14548 |
|
14549 | transition: _tinperBeeCore.elementType,
|
14550 |
|
14551 | |
14552 |
|
14553 |
|
14554 | dialogTransitionTimeout: _propTypes2["default"].number,
|
14555 |
|
14556 | |
14557 |
|
14558 |
|
14559 | backdropTransitionTimeout: _propTypes2["default"].number,
|
14560 |
|
14561 | |
14562 |
|
14563 |
|
14564 | autoFocus: _propTypes2["default"].bool,
|
14565 |
|
14566 | |
14567 |
|
14568 |
|
14569 | enforceFocus: _propTypes2["default"].bool,
|
14570 |
|
14571 | |
14572 |
|
14573 |
|
14574 | onEnter: _propTypes2["default"].func,
|
14575 |
|
14576 | |
14577 |
|
14578 |
|
14579 | onEntering: _propTypes2["default"].func,
|
14580 |
|
14581 | |
14582 |
|
14583 |
|
14584 | onEntered: _propTypes2["default"].func,
|
14585 |
|
14586 | |
14587 |
|
14588 |
|
14589 | onExit: _propTypes2["default"].func,
|
14590 |
|
14591 | |
14592 |
|
14593 |
|
14594 | onExiting: _propTypes2["default"].func,
|
14595 |
|
14596 | |
14597 |
|
14598 |
|
14599 | onExited: _propTypes2["default"].func,
|
14600 |
|
14601 | |
14602 |
|
14603 |
|
14604 | manager: _propTypes2["default"].object.isRequired
|
14605 | });
|
14606 |
|
14607 | var defaultProps = {
|
14608 | show: false,
|
14609 | backdrop: true,
|
14610 | keyboard: true,
|
14611 | autoFocus: true,
|
14612 | enforceFocus: true,
|
14613 | onHide: function onHide() {},
|
14614 | manager: modalManager,
|
14615 | renderBackdrop: function renderBackdrop(props) {
|
14616 | return _react2["default"].createElement('div', props);
|
14617 | }
|
14618 | };
|
14619 |
|
14620 | var BaseModal = function (_Component) {
|
14621 | _inherits(BaseModal, _Component);
|
14622 |
|
14623 | function BaseModal(props, content) {
|
14624 | _classCallCheck(this, BaseModal);
|
14625 |
|
14626 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
14627 |
|
14628 | _this.state = {
|
14629 | exited: !_this.props.show
|
14630 | };
|
14631 |
|
14632 | _this.onShow = _this.onShow.bind(_this);
|
14633 | _this.onHide = _this.onHide.bind(_this);
|
14634 | _this.setMountNode = _this.setMountNode.bind(_this);
|
14635 | _this.handleHidden = _this.handleHidden.bind(_this);
|
14636 | _this.handleBackdropClick = _this.handleBackdropClick.bind(_this);
|
14637 | _this.handleDocumentKeyUp = _this.handleDocumentKeyUp.bind(_this);
|
14638 | _this.checkForFocus = _this.checkForFocus.bind(_this);
|
14639 | _this.focus = _this.focus.bind(_this);
|
14640 | _this.restoreLastFocus = _this.restoreLastFocus.bind(_this);
|
14641 | _this.enforceFocus = _this.enforceFocus.bind(_this);
|
14642 | _this.getDialogElement = _this.getDialogElement.bind(_this);
|
14643 | _this.isTopModal = _this.isTopModal.bind(_this);
|
14644 | _this.renderBackdrop = _this.renderBackdrop.bind(_this);
|
14645 | return _this;
|
14646 | }
|
14647 |
|
14648 | BaseModal.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
14649 | if (nextProps.show) {
|
14650 | this.setState({ exited: false });
|
14651 | } else if (!nextProps.transition) {
|
14652 |
|
14653 | this.setState({ exited: true });
|
14654 | }
|
14655 | };
|
14656 |
|
14657 | BaseModal.prototype.componentWillUpdate = function componentWillUpdate(nextProps) {
|
14658 | if (!this.props.show && nextProps.show) {
|
14659 | this.checkForFocus();
|
14660 | }
|
14661 | };
|
14662 |
|
14663 | BaseModal.prototype.componentDidMount = function componentDidMount() {
|
14664 | if (this.props.show) {
|
14665 | this.onShow();
|
14666 | }
|
14667 | this.mounted = true;
|
14668 | };
|
14669 |
|
14670 | BaseModal.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
14671 | var transition = this.props.transition;
|
14672 |
|
14673 |
|
14674 | if (prevProps.show && !this.props.show && !transition) {
|
14675 |
|
14676 | this.onHide();
|
14677 | } else if (!prevProps.show && this.props.show) {
|
14678 | this.onShow();
|
14679 | }
|
14680 | };
|
14681 |
|
14682 | BaseModal.prototype.componentWillUnmount = function componentWillUnmount() {
|
14683 | var _props = this.props,
|
14684 | show = _props.show,
|
14685 | transition = _props.transition;
|
14686 |
|
14687 |
|
14688 | if (show || transition && !this.state.exited) {
|
14689 | this.onHide();
|
14690 | }
|
14691 |
|
14692 | this.mounted = false;
|
14693 | };
|
14694 |
|
14695 | BaseModal.prototype.onShow = function onShow() {
|
14696 | var doc = (0, _ownerDocument2["default"])(this);
|
14697 | var container = (0, _getContainer2["default"])(this.props.container, doc.body);
|
14698 |
|
14699 | this.props.manager.add(this, container, this.props.containerClassName);
|
14700 |
|
14701 | this._onDocumentKeyupListener = (0, _addEventListener2["default"])(doc, 'keyup', this.handleDocumentKeyUp);
|
14702 |
|
14703 | this._onFocusinListener = (0, _addFocusListener2["default"])(this.enforceFocus);
|
14704 |
|
14705 | this.focus();
|
14706 |
|
14707 | if (this.props.onShow) {
|
14708 | this.props.onShow();
|
14709 | }
|
14710 | };
|
14711 |
|
14712 | BaseModal.prototype.onHide = function onHide() {
|
14713 | this.props.manager.remove(this);
|
14714 |
|
14715 | this._onDocumentKeyupListener.remove();
|
14716 |
|
14717 | this._onFocusinListener.remove();
|
14718 |
|
14719 | this.restoreLastFocus();
|
14720 | };
|
14721 |
|
14722 | BaseModal.prototype.setMountNode = function setMountNode(ref) {
|
14723 | this.mountNode = ref ? ref.getMountNode() : ref;
|
14724 | };
|
14725 |
|
14726 | BaseModal.prototype.handleHidden = function handleHidden() {
|
14727 | this.setState({ exited: true });
|
14728 | this.onHide();
|
14729 |
|
14730 | if (this.props.onExited) {
|
14731 | var _props2;
|
14732 |
|
14733 | (_props2 = this.props).onExited.apply(_props2, arguments);
|
14734 | }
|
14735 | };
|
14736 |
|
14737 | BaseModal.prototype.handleBackdropClick = function handleBackdropClick(e) {
|
14738 | if (e.target !== e.currentTarget) {
|
14739 | return;
|
14740 | }
|
14741 |
|
14742 | if (this.props.onBackdropClick) {
|
14743 | this.props.onBackdropClick(e);
|
14744 | }
|
14745 |
|
14746 | if (this.props.backdrop === true) {
|
14747 | this.props.onHide();
|
14748 | }
|
14749 | };
|
14750 |
|
14751 | BaseModal.prototype.handleDocumentKeyUp = function handleDocumentKeyUp(e) {
|
14752 | if (this.props.keyboard && e.keyCode === 27 && this.isTopModal()) {
|
14753 | if (this.props.onEscapeKeyUp) {
|
14754 | this.props.onEscapeKeyUp(e);
|
14755 | }
|
14756 | this.props.onHide();
|
14757 | }
|
14758 | };
|
14759 |
|
14760 | BaseModal.prototype.checkForFocus = function checkForFocus() {
|
14761 | if (_inDOM2["default"]) {
|
14762 | this.lastFocus = (0, _activeElement2["default"])();
|
14763 | }
|
14764 | };
|
14765 |
|
14766 | BaseModal.prototype.focus = function focus() {
|
14767 | var autoFocus = this.props.autoFocus;
|
14768 | var modalContent = this.getDialogElement();
|
14769 | var current = (0, _activeElement2["default"])((0, _ownerDocument2["default"])(this));
|
14770 | var focusInModal = current && (0, _contains2["default"])(modalContent, current);
|
14771 |
|
14772 | if (modalContent && autoFocus && !focusInModal) {
|
14773 | this.lastFocus = current;
|
14774 |
|
14775 | if (!modalContent.hasAttribute('tabIndex')) {
|
14776 | modalContent.setAttribute('tabIndex', -1);
|
14777 | (0, _warning2["default"])(false, 'The modal content node does not accept focus. ' + 'For the benefit of assistive technologies, the tabIndex of the node is being set to "-1".');
|
14778 | }
|
14779 |
|
14780 | modalContent.focus();
|
14781 | }
|
14782 | };
|
14783 |
|
14784 | BaseModal.prototype.restoreLastFocus = function restoreLastFocus() {
|
14785 |
|
14786 | if (this.lastFocus && this.lastFocus.focus) {
|
14787 | this.lastFocus.focus();
|
14788 | this.lastFocus = null;
|
14789 | }
|
14790 | };
|
14791 |
|
14792 | BaseModal.prototype.enforceFocus = function enforceFocus() {
|
14793 | var enforceFocus = this.props.enforceFocus;
|
14794 |
|
14795 |
|
14796 | if (!enforceFocus || !this.mounted || !this.isTopModal()) {
|
14797 | return;
|
14798 | }
|
14799 |
|
14800 | var active = (0, _activeElement2["default"])((0, _ownerDocument2["default"])(this));
|
14801 | var modal = this.getDialogElement();
|
14802 |
|
14803 | if (modal && modal !== active && !(0, _contains2["default"])(modal, active)) {
|
14804 | modal.focus();
|
14805 | }
|
14806 | };
|
14807 |
|
14808 |
|
14809 |
|
14810 |
|
14811 | BaseModal.prototype.getDialogElement = function getDialogElement() {
|
14812 | var node = this.refs.modal;
|
14813 | return node && node.lastChild;
|
14814 | };
|
14815 |
|
14816 | BaseModal.prototype.isTopModal = function isTopModal() {
|
14817 | return this.props.manager.isTopModal(this);
|
14818 | };
|
14819 |
|
14820 | BaseModal.prototype.renderBackdrop = function renderBackdrop() {
|
14821 | var _this2 = this;
|
14822 |
|
14823 | var _props3 = this.props,
|
14824 | backdropStyle = _props3.backdropStyle,
|
14825 | backdropClassName = _props3.backdropClassName,
|
14826 | renderBackdrop = _props3.renderBackdrop,
|
14827 | Transition = _props3.transition,
|
14828 | backdropTransitionTimeout = _props3.backdropTransitionTimeout;
|
14829 |
|
14830 |
|
14831 | var backdropRef = function backdropRef(ref) {
|
14832 | return _this2.backdrop = ref;
|
14833 | };
|
14834 |
|
14835 | var backdrop = _react2["default"].createElement('div', {
|
14836 | ref: backdropRef,
|
14837 | style: this.props.backdropStyle,
|
14838 | className: this.props.backdropClassName,
|
14839 | onClick: this.handleBackdropClick
|
14840 | });
|
14841 |
|
14842 | if (Transition) {
|
14843 | backdrop = _react2["default"].createElement(
|
14844 | Transition,
|
14845 | { transitionAppear: true,
|
14846 | 'in': this.props.show,
|
14847 | timeout: backdropTransitionTimeout
|
14848 | },
|
14849 | renderBackdrop({
|
14850 | ref: backdropRef,
|
14851 | style: backdropStyle,
|
14852 | className: backdropClassName,
|
14853 | onClick: this.handleBackdropClick
|
14854 | })
|
14855 | );
|
14856 | }
|
14857 |
|
14858 | return backdrop;
|
14859 | };
|
14860 |
|
14861 | BaseModal.prototype.render = function render() {
|
14862 | var _props4 = this.props,
|
14863 | show = _props4.show,
|
14864 | container = _props4.container,
|
14865 | children = _props4.children,
|
14866 | Transition = _props4.transition,
|
14867 | backdrop = _props4.backdrop,
|
14868 | dialogTransitionTimeout = _props4.dialogTransitionTimeout,
|
14869 | className = _props4.className,
|
14870 | style = _props4.style,
|
14871 | onExit = _props4.onExit,
|
14872 | onExiting = _props4.onExiting,
|
14873 | onEnter = _props4.onEnter,
|
14874 | onEntering = _props4.onEntering,
|
14875 | onEntered = _props4.onEntered;
|
14876 |
|
14877 |
|
14878 | var dialog = _react2["default"].Children.only(children);
|
14879 |
|
14880 | var mountModal = show || Transition && !this.state.exited;
|
14881 | if (!mountModal) {
|
14882 | return null;
|
14883 | }
|
14884 |
|
14885 | var _dialog$props = dialog.props,
|
14886 | role = _dialog$props.role,
|
14887 | tabIndex = _dialog$props.tabIndex;
|
14888 |
|
14889 |
|
14890 | if (role === undefined || tabIndex === undefined) {
|
14891 | dialog = (0, _react.cloneElement)(dialog, {
|
14892 | role: role === undefined ? 'document' : role,
|
14893 | tabIndex: tabIndex == null ? '-1' : tabIndex
|
14894 | });
|
14895 | }
|
14896 |
|
14897 | if (Transition) {
|
14898 | dialog = _react2["default"].createElement(
|
14899 | Transition,
|
14900 | {
|
14901 | transitionAppear: true,
|
14902 | unmountOnExit: true,
|
14903 | 'in': show,
|
14904 | timeout: dialogTransitionTimeout,
|
14905 | onExit: onExit,
|
14906 | onExiting: onExiting,
|
14907 | onExited: this.handleHidden,
|
14908 | onEnter: onEnter,
|
14909 | onEntering: onEntering,
|
14910 | onEntered: onEntered
|
14911 | },
|
14912 | dialog
|
14913 | );
|
14914 | }
|
14915 |
|
14916 | return _react2["default"].createElement(
|
14917 | _Portal2["default"],
|
14918 | {
|
14919 | ref: this.setMountNode,
|
14920 | container: container
|
14921 | },
|
14922 | _react2["default"].createElement(
|
14923 | 'div',
|
14924 | {
|
14925 | ref: 'modal',
|
14926 | role: role || 'dialog',
|
14927 | style: style,
|
14928 | className: className
|
14929 | },
|
14930 | backdrop && this.renderBackdrop(),
|
14931 | dialog
|
14932 | )
|
14933 | );
|
14934 | };
|
14935 |
|
14936 | return BaseModal;
|
14937 | }(_react.Component);
|
14938 |
|
14939 | ;
|
14940 |
|
14941 | BaseModal.Manager = _ModalManager2["default"];
|
14942 |
|
14943 | BaseModal.propTypes = propTypes;
|
14944 | BaseModal.defaultProps = defaultProps;
|
14945 |
|
14946 | exports["default"] = BaseModal;
|
14947 | module.exports = exports['default'];
|
14948 |
|
14949 | }),
|
14950 |
|
14951 | (function(module, exports, __webpack_require__) {
|
14952 |
|
14953 | 'use strict';
|
14954 |
|
14955 | Object.defineProperty(exports, "__esModule", {
|
14956 | value: true
|
14957 | });
|
14958 |
|
14959 | var _style = __webpack_require__(18);
|
14960 |
|
14961 | var _style2 = _interopRequireDefault(_style);
|
14962 |
|
14963 | var _class = __webpack_require__(143);
|
14964 |
|
14965 | var _class2 = _interopRequireDefault(_class);
|
14966 |
|
14967 | var _scrollbarSize = __webpack_require__(140);
|
14968 |
|
14969 | var _scrollbarSize2 = _interopRequireDefault(_scrollbarSize);
|
14970 |
|
14971 | var _isOverflowing = __webpack_require__(144);
|
14972 |
|
14973 | var _isOverflowing2 = _interopRequireDefault(_isOverflowing);
|
14974 |
|
14975 | var _manageAriaHidden = __webpack_require__(145);
|
14976 |
|
14977 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
14978 |
|
14979 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14980 |
|
14981 | function findIndexOf(arr, cb) {
|
14982 | var idx = -1;
|
14983 | arr.some(function (d, i) {
|
14984 | if (cb(d, i)) {
|
14985 | idx = i;
|
14986 | return true;
|
14987 | }
|
14988 | });
|
14989 | return idx;
|
14990 | }
|
14991 |
|
14992 |
|
14993 | function findContainer(data, modal) {
|
14994 | return findIndexOf(data, function (d) {
|
14995 | return d.modals.indexOf(modal) !== -1;
|
14996 | });
|
14997 | }
|
14998 |
|
14999 |
|
15000 | function setContainerStyle(state, container) {
|
15001 | var style = { overflow: 'hidden' };
|
15002 |
|
15003 | state.style = {
|
15004 | overflow: container.style.overflow,
|
15005 | paddingRight: container.style.paddingRight
|
15006 | };
|
15007 |
|
15008 | if (state.overflowing) {
|
15009 |
|
15010 | style.paddingRight = parseInt((0, _style2["default"])(container, 'paddingRight') || 0, 10) + (0, _scrollbarSize2["default"])() + 'px';
|
15011 | }
|
15012 |
|
15013 | (0, _style2["default"])(container, style);
|
15014 | }
|
15015 |
|
15016 | function removeContainerStyle(_ref, container) {
|
15017 | var style = _ref.style;
|
15018 |
|
15019 |
|
15020 | Object.keys(style).forEach(function (key) {
|
15021 | return container.style[key] = style[key];
|
15022 | });
|
15023 | }
|
15024 | |
15025 |
|
15026 |
|
15027 |
|
15028 | var ModalManager = function () {
|
15029 | function ModalManager() {
|
15030 | var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
15031 | _ref2$hideSiblingNode = _ref2.hideSiblingNodes,
|
15032 | hideSiblingNodes = _ref2$hideSiblingNode === undefined ? true : _ref2$hideSiblingNode,
|
15033 | _ref2$handleContainer = _ref2.handleContainerOverflow,
|
15034 | handleContainerOverflow = _ref2$handleContainer === undefined ? true : _ref2$handleContainer;
|
15035 |
|
15036 | _classCallCheck(this, ModalManager);
|
15037 |
|
15038 | this.hideSiblingNodes = hideSiblingNodes;
|
15039 | this.handleContainerOverflow = handleContainerOverflow;
|
15040 | this.modals = [];
|
15041 | this.containers = [];
|
15042 | this.data = [];
|
15043 | }
|
15044 |
|
15045 | ModalManager.prototype.add = function add(modal, container, className) {
|
15046 | var modalIdx = this.modals.indexOf(modal);
|
15047 | var containerIdx = this.containers.indexOf(container);
|
15048 |
|
15049 | if (modalIdx !== -1) {
|
15050 | return modalIdx;
|
15051 | }
|
15052 |
|
15053 | modalIdx = this.modals.length;
|
15054 | this.modals.push(modal);
|
15055 |
|
15056 | if (this.hideSiblingNodes) {
|
15057 | (0, _manageAriaHidden.hideSiblings)(container, modal.mountNode);
|
15058 | }
|
15059 |
|
15060 | if (containerIdx !== -1) {
|
15061 | this.data[containerIdx].modals.push(modal);
|
15062 | return modalIdx;
|
15063 | }
|
15064 |
|
15065 | var data = {
|
15066 | modals: [modal],
|
15067 |
|
15068 | classes: className ? className.split(/\s+/) : [],
|
15069 |
|
15070 | overflowing: (0, _isOverflowing2["default"])(container)
|
15071 | };
|
15072 |
|
15073 | if (this.handleContainerOverflow) {
|
15074 | setContainerStyle(data, container);
|
15075 | }
|
15076 |
|
15077 | data.classes.forEach(_class2["default"].addClass.bind(null, container));
|
15078 |
|
15079 | this.containers.push(container);
|
15080 | this.data.push(data);
|
15081 |
|
15082 | return modalIdx;
|
15083 | };
|
15084 |
|
15085 | ModalManager.prototype.remove = function remove(modal) {
|
15086 | var modalIdx = this.modals.indexOf(modal);
|
15087 |
|
15088 | if (modalIdx === -1) {
|
15089 | return;
|
15090 | }
|
15091 |
|
15092 | var containerIdx = findContainer(this.data, modal);
|
15093 | var data = this.data[containerIdx];
|
15094 | var container = this.containers[containerIdx];
|
15095 |
|
15096 | data.modals.splice(data.modals.indexOf(modal), 1);
|
15097 |
|
15098 | this.modals.splice(modalIdx, 1);
|
15099 |
|
15100 |
|
15101 |
|
15102 | if (data.modals.length === 0) {
|
15103 | data.classes.forEach(_class2["default"].removeClass.bind(null, container));
|
15104 |
|
15105 | if (this.handleContainerOverflow) {
|
15106 | removeContainerStyle(data, container);
|
15107 | }
|
15108 |
|
15109 | if (this.hideSiblingNodes) {
|
15110 | (0, _manageAriaHidden.showSiblings)(container, modal.mountNode);
|
15111 | }
|
15112 | this.containers.splice(containerIdx, 1);
|
15113 | this.data.splice(containerIdx, 1);
|
15114 | } else if (this.hideSiblingNodes) {
|
15115 |
|
15116 | (0, _manageAriaHidden.ariaHidden)(false, data.modals[data.modals.length - 1].mountNode);
|
15117 | }
|
15118 | };
|
15119 |
|
15120 | ModalManager.prototype.isTopModal = function isTopModal(modal) {
|
15121 | return !!this.modals.length && this.modals[this.modals.length - 1] === modal;
|
15122 | };
|
15123 |
|
15124 | return ModalManager;
|
15125 | }();
|
15126 |
|
15127 | exports["default"] = ModalManager;
|
15128 | module.exports = exports['default'];
|
15129 |
|
15130 | }),
|
15131 |
|
15132 | (function(module, exports, __webpack_require__) {
|
15133 |
|
15134 | "use strict";
|
15135 |
|
15136 | var _interopRequireDefault = __webpack_require__(14);
|
15137 |
|
15138 | exports.__esModule = true;
|
15139 | exports.default = void 0;
|
15140 |
|
15141 | var _addClass = _interopRequireDefault(__webpack_require__(83));
|
15142 |
|
15143 | exports.addClass = _addClass.default;
|
15144 |
|
15145 | var _removeClass = _interopRequireDefault(__webpack_require__(85));
|
15146 |
|
15147 | exports.removeClass = _removeClass.default;
|
15148 |
|
15149 | var _hasClass = _interopRequireDefault(__webpack_require__(84));
|
15150 |
|
15151 | exports.hasClass = _hasClass.default;
|
15152 | var _default = {
|
15153 | addClass: _addClass.default,
|
15154 | removeClass: _removeClass.default,
|
15155 | hasClass: _hasClass.default
|
15156 | };
|
15157 | exports.default = _default;
|
15158 |
|
15159 | }),
|
15160 |
|
15161 | (function(module, exports, __webpack_require__) {
|
15162 |
|
15163 | 'use strict';
|
15164 |
|
15165 | Object.defineProperty(exports, "__esModule", {
|
15166 | value: true
|
15167 | });
|
15168 | exports["default"] = isOverflowing;
|
15169 |
|
15170 | var _isWindow = __webpack_require__(118);
|
15171 |
|
15172 | var _isWindow2 = _interopRequireDefault(_isWindow);
|
15173 |
|
15174 | var _ownerDocument = __webpack_require__(110);
|
15175 |
|
15176 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
15177 |
|
15178 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15179 |
|
15180 | function isBody(node) {
|
15181 | return node && node.tagName.toLowerCase() === 'body';
|
15182 | }
|
15183 |
|
15184 | function bodyIsOverflowing(node) {
|
15185 | var doc = (0, _ownerDocument2["default"])(node);
|
15186 | var win = (0, _isWindow2["default"])(doc);
|
15187 | var fullWidth = win.innerWidth;
|
15188 |
|
15189 |
|
15190 | if (!fullWidth) {
|
15191 | var documentElementRect = doc.documentElement.getBoundingClientRect();
|
15192 | fullWidth = documentElementRect.right - Math.abs(documentElementRect.left);
|
15193 | }
|
15194 |
|
15195 | return doc.body.clientWidth < fullWidth;
|
15196 | }
|
15197 |
|
15198 | function isOverflowing(container) {
|
15199 | var win = (0, _isWindow2["default"])(container);
|
15200 |
|
15201 | return win || isBody(container) ? bodyIsOverflowing(container) : container.scrollHeight > container.clientHeight;
|
15202 | }
|
15203 | module.exports = exports['default'];
|
15204 |
|
15205 | }),
|
15206 |
|
15207 | (function(module, exports) {
|
15208 |
|
15209 | 'use strict';
|
15210 |
|
15211 | Object.defineProperty(exports, "__esModule", {
|
15212 | value: true
|
15213 | });
|
15214 | exports.ariaHidden = ariaHidden;
|
15215 | exports.hideSiblings = hideSiblings;
|
15216 | exports.showSiblings = showSiblings;
|
15217 |
|
15218 | var BLACKLIST = ['template', 'script', 'style'];
|
15219 |
|
15220 | var isHidable = function isHidable(_ref) {
|
15221 | var nodeType = _ref.nodeType,
|
15222 | tagName = _ref.tagName;
|
15223 | return nodeType === 1 && BLACKLIST.indexOf(tagName.toLowerCase()) === -1;
|
15224 | };
|
15225 |
|
15226 | var siblings = function siblings(container, mount, cb) {
|
15227 | mount = [].concat(mount);
|
15228 |
|
15229 | [].forEach.call(container.children, function (node) {
|
15230 | if (mount.indexOf(node) === -1 && isHidable(node)) {
|
15231 | cb(node);
|
15232 | }
|
15233 | });
|
15234 | };
|
15235 |
|
15236 | function ariaHidden(show, node) {
|
15237 | if (!node) {
|
15238 | return;
|
15239 | }
|
15240 | if (show) {
|
15241 | node.setAttribute('aria-hidden', 'true');
|
15242 | } else {
|
15243 | node.removeAttribute('aria-hidden');
|
15244 | }
|
15245 | }
|
15246 |
|
15247 | function hideSiblings(container, mountNode) {
|
15248 | siblings(container, mountNode, function (node) {
|
15249 | return ariaHidden(true, node);
|
15250 | });
|
15251 | }
|
15252 |
|
15253 | function showSiblings(container, mountNode) {
|
15254 | siblings(container, mountNode, function (node) {
|
15255 | return ariaHidden(false, node);
|
15256 | });
|
15257 | }
|
15258 |
|
15259 | }),
|
15260 |
|
15261 | (function(module, exports) {
|
15262 |
|
15263 | 'use strict';
|
15264 |
|
15265 | Object.defineProperty(exports, "__esModule", {
|
15266 | value: true
|
15267 | });
|
15268 | exports["default"] = addFocusListener;
|
15269 | |
15270 |
|
15271 |
|
15272 |
|
15273 |
|
15274 |
|
15275 | function addFocusListener(handler) {
|
15276 | var useFocusin = !document.addEventListener;
|
15277 | var remove = void 0;
|
15278 |
|
15279 | if (useFocusin) {
|
15280 | document.attachEvent('onfocusin', handler);
|
15281 | remove = function remove() {
|
15282 | return document.detachEvent('onfocusin', handler);
|
15283 | };
|
15284 | } else {
|
15285 | document.addEventListener('focus', handler, true);
|
15286 | remove = function remove() {
|
15287 | return document.removeEventListener('focus', handler, true);
|
15288 | };
|
15289 | }
|
15290 |
|
15291 | return { remove: remove };
|
15292 | }
|
15293 | module.exports = exports['default'];
|
15294 |
|
15295 | }),
|
15296 |
|
15297 | (function(module, exports, __webpack_require__) {
|
15298 |
|
15299 | "use strict";
|
15300 |
|
15301 | var _interopRequireDefault = __webpack_require__(14);
|
15302 |
|
15303 | exports.__esModule = true;
|
15304 | exports.default = activeElement;
|
15305 |
|
15306 | var _ownerDocument = _interopRequireDefault(__webpack_require__(110));
|
15307 |
|
15308 | function activeElement(doc) {
|
15309 | if (doc === void 0) {
|
15310 | doc = (0, _ownerDocument.default)();
|
15311 | }
|
15312 |
|
15313 | try {
|
15314 | return doc.activeElement;
|
15315 | } catch (e) {
|
15316 |
|
15317 | }
|
15318 | }
|
15319 |
|
15320 | module.exports = exports["default"];
|
15321 |
|
15322 | }),
|
15323 |
|
15324 | (function(module, exports, __webpack_require__) {
|
15325 |
|
15326 | 'use strict';
|
15327 |
|
15328 | Object.defineProperty(exports, "__esModule", {
|
15329 | value: true
|
15330 | });
|
15331 |
|
15332 | 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; };
|
15333 |
|
15334 | var _classnames = __webpack_require__(5);
|
15335 |
|
15336 | var _classnames2 = _interopRequireDefault(_classnames);
|
15337 |
|
15338 | var _react = __webpack_require__(1);
|
15339 |
|
15340 | var _react2 = _interopRequireDefault(_react);
|
15341 |
|
15342 | var _tinperBeeCore = __webpack_require__(27);
|
15343 |
|
15344 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15345 |
|
15346 | 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; }
|
15347 |
|
15348 | 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; }
|
15349 |
|
15350 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15351 |
|
15352 | 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; }
|
15353 |
|
15354 | 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); }
|
15355 |
|
15356 | var propTypes = {
|
15357 | componentClass: _tinperBeeCore.elementType
|
15358 | };
|
15359 |
|
15360 | var defaultProps = {
|
15361 | componentClass: 'div',
|
15362 | clsPrefix: 'u-modal-body'
|
15363 | };
|
15364 |
|
15365 | var ModalBody = function (_React$Component) {
|
15366 | _inherits(ModalBody, _React$Component);
|
15367 |
|
15368 | function ModalBody() {
|
15369 | _classCallCheck(this, ModalBody);
|
15370 |
|
15371 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15372 | }
|
15373 |
|
15374 | ModalBody.prototype.render = function render() {
|
15375 | var _props = this.props,
|
15376 | Component = _props.componentClass,
|
15377 | clsPrefix = _props.clsPrefix,
|
15378 | className = _props.className,
|
15379 | props = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
|
15380 |
|
15381 | var classes = {};
|
15382 | classes['' + clsPrefix] = true;
|
15383 |
|
15384 | return _react2["default"].createElement(Component, _extends({}, props, {
|
15385 | className: (0, _classnames2["default"])(className, classes)
|
15386 | }));
|
15387 | };
|
15388 |
|
15389 | return ModalBody;
|
15390 | }(_react2["default"].Component);
|
15391 |
|
15392 | ModalBody.propTypes = propTypes;
|
15393 | ModalBody.defaultProps = defaultProps;
|
15394 |
|
15395 | exports["default"] = ModalBody;
|
15396 | module.exports = exports['default'];
|
15397 |
|
15398 | }),
|
15399 |
|
15400 | (function(module, exports, __webpack_require__) {
|
15401 |
|
15402 | 'use strict';
|
15403 |
|
15404 | Object.defineProperty(exports, "__esModule", {
|
15405 | value: true
|
15406 | });
|
15407 |
|
15408 | 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; };
|
15409 |
|
15410 | var _classnames = __webpack_require__(5);
|
15411 |
|
15412 | var _classnames2 = _interopRequireDefault(_classnames);
|
15413 |
|
15414 | var _react = __webpack_require__(1);
|
15415 |
|
15416 | var _react2 = _interopRequireDefault(_react);
|
15417 |
|
15418 | var _propTypes = __webpack_require__(6);
|
15419 |
|
15420 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
15421 |
|
15422 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15423 |
|
15424 | 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; }
|
15425 |
|
15426 | 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; }
|
15427 |
|
15428 | 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; }
|
15429 |
|
15430 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15431 |
|
15432 | 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; }
|
15433 |
|
15434 | 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); }
|
15435 |
|
15436 | var propTypes = {
|
15437 | |
15438 |
|
15439 |
|
15440 | dialogClassName: _propTypes2["default"].string,
|
15441 | contentStyle: _propTypes2["default"].object
|
15442 |
|
15443 | };
|
15444 |
|
15445 | var defaultProps = {
|
15446 | clsPrefix: 'u-modal'
|
15447 | };
|
15448 |
|
15449 | var ModalDialog = function (_React$Component) {
|
15450 | _inherits(ModalDialog, _React$Component);
|
15451 |
|
15452 | function ModalDialog() {
|
15453 | _classCallCheck(this, ModalDialog);
|
15454 |
|
15455 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15456 | }
|
15457 |
|
15458 | ModalDialog.prototype.render = function render() {
|
15459 | var _dialogClasses;
|
15460 |
|
15461 | var _props = this.props,
|
15462 | dialogClassName = _props.dialogClassName,
|
15463 | className = _props.className,
|
15464 | clsPrefix = _props.clsPrefix,
|
15465 | size = _props.size,
|
15466 | style = _props.style,
|
15467 | contentStyle = _props.contentStyle,
|
15468 | children = _props.children,
|
15469 | props = _objectWithoutProperties(_props, ['dialogClassName', 'className', 'clsPrefix', 'size', 'style', 'contentStyle', 'children']);
|
15470 |
|
15471 |
|
15472 |
|
15473 |
|
15474 | var uClassName = _defineProperty({}, '' + clsPrefix, true);
|
15475 |
|
15476 | var modalStyle = { display: 'block' };
|
15477 |
|
15478 | var dialogClasses = (_dialogClasses = {}, _defineProperty(_dialogClasses, uClassName, false), _defineProperty(_dialogClasses, clsPrefix + '-dialog', true), _dialogClasses);
|
15479 | if (size) {
|
15480 | dialogClasses[clsPrefix + '-' + size] = true;
|
15481 | }
|
15482 |
|
15483 | return _react2["default"].createElement(
|
15484 | 'div',
|
15485 | _extends({}, props, {
|
15486 | tabIndex: '-1',
|
15487 | role: 'dialog',
|
15488 | style: modalStyle,
|
15489 | className: (0, _classnames2["default"])(className, uClassName)
|
15490 | }),
|
15491 | _react2["default"].createElement(
|
15492 | 'div',
|
15493 | { className: (0, _classnames2["default"])(dialogClassName, dialogClasses), style: style },
|
15494 | _react2["default"].createElement(
|
15495 | 'div',
|
15496 | { style: contentStyle, className: (0, _classnames2["default"])([clsPrefix + '-content']), role: 'document' },
|
15497 | children
|
15498 | )
|
15499 | )
|
15500 | );
|
15501 | };
|
15502 |
|
15503 | return ModalDialog;
|
15504 | }(_react2["default"].Component);
|
15505 |
|
15506 | ModalDialog.propTypes = propTypes;
|
15507 | ModalDialog.defaultProps = defaultProps;
|
15508 |
|
15509 | exports["default"] = ModalDialog;
|
15510 | module.exports = exports['default'];
|
15511 |
|
15512 | }),
|
15513 |
|
15514 | (function(module, exports, __webpack_require__) {
|
15515 |
|
15516 | 'use strict';
|
15517 |
|
15518 | Object.defineProperty(exports, "__esModule", {
|
15519 | value: true
|
15520 | });
|
15521 |
|
15522 | 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; };
|
15523 |
|
15524 | var _classnames = __webpack_require__(5);
|
15525 |
|
15526 | var _classnames2 = _interopRequireDefault(_classnames);
|
15527 |
|
15528 | var _react = __webpack_require__(1);
|
15529 |
|
15530 | var _react2 = _interopRequireDefault(_react);
|
15531 |
|
15532 | var _tinperBeeCore = __webpack_require__(27);
|
15533 |
|
15534 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15535 |
|
15536 | 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; }
|
15537 |
|
15538 | 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; }
|
15539 |
|
15540 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15541 |
|
15542 | 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; }
|
15543 |
|
15544 | 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); }
|
15545 |
|
15546 | var propTypes = {
|
15547 | componentClass: _tinperBeeCore.elementType
|
15548 | };
|
15549 |
|
15550 | var defaultProps = {
|
15551 | componentClass: 'div',
|
15552 | clsPrefix: 'u-modal-footer'
|
15553 | };
|
15554 |
|
15555 | var ModalFooter = function (_React$Component) {
|
15556 | _inherits(ModalFooter, _React$Component);
|
15557 |
|
15558 | function ModalFooter() {
|
15559 | _classCallCheck(this, ModalFooter);
|
15560 |
|
15561 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15562 | }
|
15563 |
|
15564 | ModalFooter.prototype.render = function render() {
|
15565 | var _props = this.props,
|
15566 | Component = _props.componentClass,
|
15567 | clsPrefix = _props.clsPrefix,
|
15568 | className = _props.className,
|
15569 | props = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
|
15570 |
|
15571 | var classes = {};
|
15572 | classes['' + clsPrefix] = true;
|
15573 |
|
15574 | return _react2["default"].createElement(Component, _extends({}, props, {
|
15575 | className: (0, _classnames2["default"])(className, classes)
|
15576 | }));
|
15577 | };
|
15578 |
|
15579 | return ModalFooter;
|
15580 | }(_react2["default"].Component);
|
15581 |
|
15582 | ModalFooter.propTypes = propTypes;
|
15583 | ModalFooter.defaultProps = defaultProps;
|
15584 |
|
15585 | exports["default"] = ModalFooter;
|
15586 | module.exports = exports['default'];
|
15587 |
|
15588 | }),
|
15589 |
|
15590 | (function(module, exports, __webpack_require__) {
|
15591 |
|
15592 | 'use strict';
|
15593 |
|
15594 | Object.defineProperty(exports, "__esModule", {
|
15595 | value: true
|
15596 | });
|
15597 |
|
15598 | 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; };
|
15599 |
|
15600 | var _classnames = __webpack_require__(5);
|
15601 |
|
15602 | var _classnames2 = _interopRequireDefault(_classnames);
|
15603 |
|
15604 | var _react = __webpack_require__(1);
|
15605 |
|
15606 | var _react2 = _interopRequireDefault(_react);
|
15607 |
|
15608 | var _propTypes = __webpack_require__(6);
|
15609 |
|
15610 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
15611 |
|
15612 | var _tinperBeeCore = __webpack_require__(27);
|
15613 |
|
15614 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15615 |
|
15616 | 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; }
|
15617 |
|
15618 | 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; }
|
15619 |
|
15620 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15621 |
|
15622 | 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; }
|
15623 |
|
15624 | 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); }
|
15625 |
|
15626 | var propTypes = {
|
15627 |
|
15628 | |
15629 |
|
15630 |
|
15631 | closeButton: _propTypes2["default"].bool,
|
15632 |
|
15633 | |
15634 |
|
15635 |
|
15636 | onHide: _propTypes2["default"].func
|
15637 | };
|
15638 |
|
15639 | var defaultProps = {
|
15640 | 'aria-label': 'Close',
|
15641 | closeButton: false,
|
15642 | clsPrefix: 'u-modal-header'
|
15643 | };
|
15644 |
|
15645 | var contextTypes = {
|
15646 | $u_modal: _propTypes2["default"].shape({
|
15647 | onHide: _propTypes2["default"].func
|
15648 | })
|
15649 | };
|
15650 |
|
15651 | var ModalHeader = function (_React$Component) {
|
15652 | _inherits(ModalHeader, _React$Component);
|
15653 |
|
15654 | function ModalHeader() {
|
15655 | _classCallCheck(this, ModalHeader);
|
15656 |
|
15657 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15658 | }
|
15659 |
|
15660 | ModalHeader.prototype.render = function render() {
|
15661 | var _props = this.props,
|
15662 | label = _props['aria-label'],
|
15663 | closeButton = _props.closeButton,
|
15664 | onHide = _props.onHide,
|
15665 | className = _props.className,
|
15666 | clsPrefix = _props.clsPrefix,
|
15667 | children = _props.children,
|
15668 | props = _objectWithoutProperties(_props, ['aria-label', 'closeButton', 'onHide', 'className', 'clsPrefix', 'children']);
|
15669 |
|
15670 | var modal = this.context.$u_modal;
|
15671 |
|
15672 | var classes = {};
|
15673 | classes['' + clsPrefix] = true;
|
15674 |
|
15675 | return _react2["default"].createElement(
|
15676 | 'div',
|
15677 | _extends({}, props, {
|
15678 | className: (0, _classnames2["default"])(className, classes)
|
15679 | }),
|
15680 | closeButton && _react2["default"].createElement(
|
15681 | 'button',
|
15682 | {
|
15683 | type: 'button',
|
15684 | className: 'u-close',
|
15685 | 'aria-label': label,
|
15686 | onClick: (0, _tinperBeeCore.createChainedFunction)(modal.onHide, onHide)
|
15687 | },
|
15688 | _react2["default"].createElement(
|
15689 | 'span',
|
15690 | { 'aria-hidden': 'true' },
|
15691 | _react2["default"].createElement('i', { className: 'uf uf-close' })
|
15692 | )
|
15693 | ),
|
15694 | children
|
15695 | );
|
15696 | };
|
15697 |
|
15698 | return ModalHeader;
|
15699 | }(_react2["default"].Component);
|
15700 |
|
15701 | ModalHeader.propTypes = propTypes;
|
15702 | ModalHeader.defaultProps = defaultProps;
|
15703 | ModalHeader.contextTypes = contextTypes;
|
15704 |
|
15705 | exports["default"] = ModalHeader;
|
15706 | module.exports = exports['default'];
|
15707 |
|
15708 | }),
|
15709 |
|
15710 | (function(module, exports, __webpack_require__) {
|
15711 |
|
15712 | 'use strict';
|
15713 |
|
15714 | Object.defineProperty(exports, "__esModule", {
|
15715 | value: true
|
15716 | });
|
15717 |
|
15718 | 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; };
|
15719 |
|
15720 | var _classnames = __webpack_require__(5);
|
15721 |
|
15722 | var _classnames2 = _interopRequireDefault(_classnames);
|
15723 |
|
15724 | var _react = __webpack_require__(1);
|
15725 |
|
15726 | var _react2 = _interopRequireDefault(_react);
|
15727 |
|
15728 | var _tinperBeeCore = __webpack_require__(27);
|
15729 |
|
15730 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15731 |
|
15732 | 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; }
|
15733 |
|
15734 | 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; }
|
15735 |
|
15736 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15737 |
|
15738 | 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; }
|
15739 |
|
15740 | 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); }
|
15741 |
|
15742 | var propTypes = {
|
15743 | componentClass: _tinperBeeCore.elementType
|
15744 | };
|
15745 |
|
15746 | var defaultProps = {
|
15747 | componentClass: 'h4',
|
15748 | clsPrefix: 'u-modal-title'
|
15749 | };
|
15750 |
|
15751 | var ModalTitle = function (_React$Component) {
|
15752 | _inherits(ModalTitle, _React$Component);
|
15753 |
|
15754 | function ModalTitle() {
|
15755 | _classCallCheck(this, ModalTitle);
|
15756 |
|
15757 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15758 | }
|
15759 |
|
15760 | ModalTitle.prototype.render = function render() {
|
15761 | var _props = this.props,
|
15762 | Component = _props.componentClass,
|
15763 | className = _props.className,
|
15764 | clsPrefix = _props.clsPrefix,
|
15765 | props = _objectWithoutProperties(_props, ['componentClass', 'className', 'clsPrefix']);
|
15766 |
|
15767 | var classes = {};
|
15768 | classes['' + clsPrefix] = true;
|
15769 |
|
15770 | return _react2["default"].createElement(Component, _extends({}, props, {
|
15771 | className: (0, _classnames2["default"])(className, classes)
|
15772 | }));
|
15773 | };
|
15774 |
|
15775 | return ModalTitle;
|
15776 | }(_react2["default"].Component);
|
15777 |
|
15778 | ModalTitle.propTypes = propTypes;
|
15779 | ModalTitle.defaultProps = defaultProps;
|
15780 |
|
15781 | exports["default"] = ModalTitle;
|
15782 | module.exports = exports['default'];
|
15783 |
|
15784 | }),
|
15785 |
|
15786 | (function(module, exports, __webpack_require__) {
|
15787 |
|
15788 | 'use strict';
|
15789 |
|
15790 | Object.defineProperty(exports, "__esModule", {
|
15791 | value: true
|
15792 | });
|
15793 |
|
15794 | var _FormControl = __webpack_require__(154);
|
15795 |
|
15796 | var _FormControl2 = _interopRequireDefault(_FormControl);
|
15797 |
|
15798 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15799 |
|
15800 | exports["default"] = _FormControl2["default"];
|
15801 | module.exports = exports['default'];
|
15802 |
|
15803 | }),
|
15804 |
|
15805 | (function(module, exports, __webpack_require__) {
|
15806 |
|
15807 | 'use strict';
|
15808 |
|
15809 | Object.defineProperty(exports, "__esModule", {
|
15810 | value: true
|
15811 | });
|
15812 |
|
15813 | 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; };
|
15814 |
|
15815 | var _react = __webpack_require__(1);
|
15816 |
|
15817 | var _react2 = _interopRequireDefault(_react);
|
15818 |
|
15819 | var _classnames = __webpack_require__(5);
|
15820 |
|
15821 | var _classnames2 = _interopRequireDefault(_classnames);
|
15822 |
|
15823 | var _beeIcon = __webpack_require__(102);
|
15824 |
|
15825 | var _beeIcon2 = _interopRequireDefault(_beeIcon);
|
15826 |
|
15827 | var _propTypes = __webpack_require__(6);
|
15828 |
|
15829 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
15830 |
|
15831 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15832 |
|
15833 | 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; }
|
15834 |
|
15835 | 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; }
|
15836 |
|
15837 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15838 |
|
15839 | 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; }
|
15840 |
|
15841 | 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); }
|
15842 |
|
15843 | var propTypes = {
|
15844 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]),
|
15845 | type: _propTypes2["default"].string,
|
15846 | size: _propTypes2["default"].oneOf(['sm', 'md', 'lg']),
|
15847 | onSearch: _propTypes2["default"].func,
|
15848 | onChange: _propTypes2["default"].func,
|
15849 | onBlur: _propTypes2["default"].func,
|
15850 | showClose: _propTypes2["default"].bool,
|
15851 | focusSelect: _propTypes2["default"].bool
|
15852 | };
|
15853 |
|
15854 | var defaultProps = {
|
15855 | componentClass: 'input',
|
15856 | clsPrefix: 'u-form-control',
|
15857 | type: 'text',
|
15858 | size: 'md'
|
15859 | };
|
15860 |
|
15861 | var FormControl = function (_React$Component) {
|
15862 | _inherits(FormControl, _React$Component);
|
15863 |
|
15864 | function FormControl(props) {
|
15865 | _classCallCheck(this, FormControl);
|
15866 |
|
15867 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
15868 |
|
15869 | _this.handleSearchChange = function (e) {
|
15870 | var onChange = _this.props.onChange;
|
15871 |
|
15872 | var value = _this.input.value;
|
15873 | _this.setState({
|
15874 | value: value,
|
15875 | showSearch: value == null || value === ""
|
15876 | });
|
15877 | if (onChange) {
|
15878 | onChange(value, e);
|
15879 | }
|
15880 | };
|
15881 |
|
15882 | _this.handleChange = function (e) {
|
15883 | var onChange = _this.props.onChange;
|
15884 |
|
15885 | var value = _this.input.value;
|
15886 | _this.setState({
|
15887 | showClose: true
|
15888 | });
|
15889 | if (onChange) {
|
15890 | onChange(value, e);
|
15891 | }
|
15892 | };
|
15893 |
|
15894 | _this.clearValue = function () {
|
15895 | var onChange = _this.props.onChange;
|
15896 |
|
15897 | _this.setState({
|
15898 | showSearch: true,
|
15899 | value: "",
|
15900 | showClose: false
|
15901 | });
|
15902 | if (onChange) {
|
15903 | onChange("");
|
15904 | }
|
15905 | _this.input.focus();
|
15906 | };
|
15907 |
|
15908 | _this.handleKeyDown = function (e) {
|
15909 | var _this$props = _this.props,
|
15910 | onSearch = _this$props.onSearch,
|
15911 | type = _this$props.type;
|
15912 |
|
15913 | if (e.keyCode === 13 && type === "search") {
|
15914 | if (onSearch) {
|
15915 | onSearch(_this.input.value);
|
15916 | }
|
15917 | }
|
15918 | };
|
15919 |
|
15920 | _this.handleSearch = function (e) {
|
15921 | var onSearch = _this.props.onSearch;
|
15922 |
|
15923 | if (onSearch) onSearch(_this.input.value);
|
15924 | };
|
15925 |
|
15926 | _this.handleBlur = function (e) {
|
15927 | var value = _this.state.value;
|
15928 | var onBlur = _this.props.onBlur;
|
15929 |
|
15930 |
|
15931 | if (onBlur) {
|
15932 | onBlur(value, e);
|
15933 | }
|
15934 | };
|
15935 |
|
15936 | _this.handleFocus = function (e) {
|
15937 | var value = _this.state.value;
|
15938 | var onFocus = _this.props.onFocus;
|
15939 |
|
15940 | if (_this.props.focusSelect) {
|
15941 | _this.input.select();
|
15942 | }
|
15943 | if (onFocus) {
|
15944 | onFocus(value, e);
|
15945 | }
|
15946 | };
|
15947 |
|
15948 | _this.renderInput = function () {
|
15949 | var _this$props2 = _this.props,
|
15950 | Component = _this$props2.componentClass,
|
15951 | type = _this$props2.type,
|
15952 | className = _this$props2.className,
|
15953 | size = _this$props2.size,
|
15954 | clsPrefix = _this$props2.clsPrefix,
|
15955 | value = _this$props2.value,
|
15956 | onChange = _this$props2.onChange,
|
15957 | onSearch = _this$props2.onSearch,
|
15958 | onBlur = _this$props2.onBlur,
|
15959 | showClose = _this$props2.showClose,
|
15960 | focusSelect = _this$props2.focusSelect,
|
15961 | others = _objectWithoutProperties(_this$props2, ['componentClass', 'type', 'className', 'size', 'clsPrefix', 'value', 'onChange', 'onSearch', 'onBlur', 'showClose', 'focusSelect']);
|
15962 |
|
15963 |
|
15964 |
|
15965 | var classes = {};
|
15966 | if (size) {
|
15967 | classes['' + size] = true;
|
15968 | }
|
15969 |
|
15970 | var classNames = void 0;
|
15971 | if (type !== 'file') {
|
15972 | classNames = (0, _classnames2["default"])(clsPrefix, classes);
|
15973 | }
|
15974 |
|
15975 | return showClose ? _react2["default"].createElement(
|
15976 | 'div',
|
15977 | { className: (0, _classnames2["default"])(clsPrefix + '-close', clsPrefix + '-affix-wrapper', className) },
|
15978 | _react2["default"].createElement(Component, _extends({}, others, {
|
15979 | type: type,
|
15980 | ref: function ref(el) {
|
15981 | return _this.input = el;
|
15982 | },
|
15983 | value: value,
|
15984 | onChange: _this.handleChange,
|
15985 | onBlur: _this.handleBlur,
|
15986 | onFocus: _this.handleFocus,
|
15987 | className: (0, _classnames2["default"])(className, classNames)
|
15988 | })),
|
15989 | _react2["default"].createElement(
|
15990 | 'div',
|
15991 | { className: clsPrefix + '-suffix' },
|
15992 | _this.state.showClose ? _react2["default"].createElement(_beeIcon2["default"], { onClick: _this.clearValue, type: 'uf-close-c' }) : ''
|
15993 | )
|
15994 | ) : _react2["default"].createElement(Component, _extends({}, others, {
|
15995 | type: type,
|
15996 | ref: function ref(el) {
|
15997 | return _this.input = el;
|
15998 | },
|
15999 | value: value,
|
16000 | onChange: _this.handleChange,
|
16001 | onBlur: _this.handleBlur,
|
16002 | onFocus: _this.handleFocus,
|
16003 | className: (0, _classnames2["default"])(className, classNames)
|
16004 | }));
|
16005 | };
|
16006 |
|
16007 | _this.renderSearch = function () {
|
16008 | var _this$props3 = _this.props,
|
16009 | Component = _this$props3.componentClass,
|
16010 | type = _this$props3.type,
|
16011 | className = _this$props3.className,
|
16012 | size = _this$props3.size,
|
16013 | clsPrefix = _this$props3.clsPrefix,
|
16014 | value = _this$props3.value,
|
16015 | onChange = _this$props3.onChange,
|
16016 | onSearch = _this$props3.onSearch,
|
16017 | onBlur = _this$props3.onBlur,
|
16018 | others = _objectWithoutProperties(_this$props3, ['componentClass', 'type', 'className', 'size', 'clsPrefix', 'value', 'onChange', 'onSearch', 'onBlur']);
|
16019 |
|
16020 |
|
16021 |
|
16022 | var classes = {};
|
16023 | if (size) {
|
16024 | classes['' + size] = true;
|
16025 | }
|
16026 | classes[clsPrefix + '-search'] = true;
|
16027 |
|
16028 | if (type === "search") {
|
16029 | return _react2["default"].createElement(
|
16030 | 'div',
|
16031 | { className: (0, _classnames2["default"])(clsPrefix + '-search', clsPrefix + '-affix-wrapper', className) },
|
16032 | _react2["default"].createElement(Component, _extends({}, others, {
|
16033 | type: type,
|
16034 | ref: function ref(el) {
|
16035 | return _this.input = el;
|
16036 | },
|
16037 | onChange: _this.handleSearchChange,
|
16038 | value: value,
|
16039 | onKeyDown: _this.handleKeyDown,
|
16040 | onBlur: _this.handleBlur,
|
16041 | onFocus: _this.handleFocus,
|
16042 | className: (0, _classnames2["default"])(className, clsPrefix, classes)
|
16043 | })),
|
16044 | _react2["default"].createElement(
|
16045 | 'div',
|
16046 | { className: clsPrefix + '-suffix' },
|
16047 | _react2["default"].createElement(_beeIcon2["default"], { type: 'uf-search', onClick: _this.handleSearch })
|
16048 | )
|
16049 | );
|
16050 | }
|
16051 | };
|
16052 |
|
16053 | _this.state = {
|
16054 | showSearch: !props.value,
|
16055 | value: props.value == null ? "" : props.value,
|
16056 | showClose: false
|
16057 | };
|
16058 | _this.input = {};
|
16059 | return _this;
|
16060 | }
|
16061 |
|
16062 | FormControl.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProp) {
|
16063 | if (nextProp.value !== this.state.value) {
|
16064 | this.setState({ value: nextProp.value });
|
16065 | }
|
16066 | };
|
16067 |
|
16068 | FormControl.prototype.render = function render() {
|
16069 |
|
16070 | if (this.props.type === "search") {
|
16071 | return this.renderSearch();
|
16072 | }
|
16073 |
|
16074 | return this.renderInput();
|
16075 | };
|
16076 |
|
16077 | return FormControl;
|
16078 | }(_react2["default"].Component);
|
16079 |
|
16080 | FormControl.propTypes = propTypes;
|
16081 | FormControl.defaultProps = defaultProps;
|
16082 |
|
16083 | exports["default"] = FormControl;
|
16084 | module.exports = exports['default'];
|
16085 |
|
16086 | }),
|
16087 |
|
16088 | (function(module, exports, __webpack_require__) {
|
16089 |
|
16090 | 'use strict';
|
16091 |
|
16092 | Object.defineProperty(exports, "__esModule", {
|
16093 | value: true
|
16094 | });
|
16095 |
|
16096 | var _Button = __webpack_require__(156);
|
16097 |
|
16098 | var _Button2 = _interopRequireDefault(_Button);
|
16099 |
|
16100 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
16101 |
|
16102 | exports["default"] = _Button2["default"];
|
16103 | module.exports = exports['default'];
|
16104 |
|
16105 | }),
|
16106 |
|
16107 | (function(module, exports, __webpack_require__) {
|
16108 |
|
16109 | 'use strict';
|
16110 |
|
16111 | Object.defineProperty(exports, "__esModule", {
|
16112 | value: true
|
16113 | });
|
16114 |
|
16115 | 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; };
|
16116 |
|
16117 | var _react = __webpack_require__(1);
|
16118 |
|
16119 | var _react2 = _interopRequireDefault(_react);
|
16120 |
|
16121 | var _reactDom = __webpack_require__(2);
|
16122 |
|
16123 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
16124 |
|
16125 | var _propTypes = __webpack_require__(6);
|
16126 |
|
16127 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16128 |
|
16129 | var _classnames = __webpack_require__(5);
|
16130 |
|
16131 | var _classnames2 = _interopRequireDefault(_classnames);
|
16132 |
|
16133 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
16134 |
|
16135 | 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; }
|
16136 |
|
16137 | 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; }
|
16138 |
|
16139 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16140 |
|
16141 | 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; }
|
16142 |
|
16143 | 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); }
|
16144 |
|
16145 | var propTypes = {
|
16146 | |
16147 |
|
16148 |
|
16149 | size: _propTypes2["default"].oneOf(['sm', 'md', 'xg', 'lg']),
|
16150 | |
16151 |
|
16152 |
|
16153 | style: _propTypes2["default"].object,
|
16154 | |
16155 |
|
16156 |
|
16157 | shape: _propTypes2["default"].oneOf(['block', 'round', 'border', 'squared', 'floating', 'pillRight', 'pillLeft', 'icon']),
|
16158 |
|
16159 | bordered: _propTypes2["default"].bool,
|
16160 | |
16161 |
|
16162 |
|
16163 | colors: _propTypes2["default"].oneOf(['primary', 'secondary', 'accent', 'success', 'info', 'warning', 'danger', 'dark', 'light', 'default']),
|
16164 | |
16165 |
|
16166 |
|
16167 |
|
16168 | disabled: _propTypes2["default"].bool,
|
16169 | |
16170 |
|
16171 |
|
16172 |
|
16173 | className: _propTypes2["default"].string,
|
16174 |
|
16175 | |
16176 |
|
16177 |
|
16178 |
|
16179 | htmlType: _propTypes2["default"].oneOf(['submit', 'button', 'reset']),
|
16180 | isSubmit: _propTypes2["default"].bool
|
16181 | };
|
16182 |
|
16183 | var defaultProps = {
|
16184 | disabled: false,
|
16185 | htmlType: 'button',
|
16186 | clsPrefix: 'u-button',
|
16187 | bordered: false,
|
16188 | isSubmit: false
|
16189 | };
|
16190 |
|
16191 | var sizeMap = {
|
16192 | sm: 'sm',
|
16193 | md: 'md',
|
16194 | xg: 'xg',
|
16195 | lg: 'lg'
|
16196 | },
|
16197 | colorsMap = {
|
16198 | primary: 'primary',
|
16199 | secondary: 'secondary',
|
16200 | accent: 'accent',
|
16201 | success: 'success',
|
16202 | info: 'info',
|
16203 | warning: 'warning',
|
16204 | danger: 'danger',
|
16205 | dark: 'dark',
|
16206 | light: 'light'
|
16207 | },
|
16208 | shapeMap = {
|
16209 | block: 'block',
|
16210 | round: 'round',
|
16211 | border: 'border',
|
16212 | squared: 'squared',
|
16213 | floating: 'floating',
|
16214 | pillRight: 'pill-right',
|
16215 | pillLeft: 'pill-left',
|
16216 | icon: 'icon'
|
16217 | };
|
16218 |
|
16219 | var Button = function (_Component) {
|
16220 | _inherits(Button, _Component);
|
16221 |
|
16222 | function Button(props) {
|
16223 | _classCallCheck(this, Button);
|
16224 |
|
16225 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
16226 | }
|
16227 |
|
16228 | Button.prototype.render = function render() {
|
16229 | var _props = this.props,
|
16230 | colors = _props.colors,
|
16231 | shape = _props.shape,
|
16232 | disabled = _props.disabled,
|
16233 | className = _props.className,
|
16234 | size = _props.size,
|
16235 | bordered = _props.bordered,
|
16236 | children = _props.children,
|
16237 | htmlType = _props.htmlType,
|
16238 | clsPrefix = _props.clsPrefix,
|
16239 | isSubmit = _props.isSubmit,
|
16240 | others = _objectWithoutProperties(_props, ['colors', 'shape', 'disabled', 'className', 'size', 'bordered', 'children', 'htmlType', 'clsPrefix', 'isSubmit']);
|
16241 |
|
16242 | var clsObj = {};
|
16243 | if (className) {
|
16244 | clsObj[className] = true;
|
16245 | }
|
16246 | if (sizeMap[size]) {
|
16247 | clsObj[clsPrefix + '-' + sizeMap[size]] = true;
|
16248 | }
|
16249 |
|
16250 | if (shapeMap[shape]) {
|
16251 | clsObj[clsPrefix + '-' + shapeMap[shape]] = true;
|
16252 | }
|
16253 | if (colorsMap[colors]) {
|
16254 | clsObj[clsPrefix + '-' + colorsMap[colors]] = true;
|
16255 | }
|
16256 | if (bordered) {
|
16257 | clsObj[clsPrefix + '-border'] = bordered;
|
16258 | }
|
16259 | var classes = (0, _classnames2["default"])(clsPrefix, clsObj);
|
16260 | return _react2["default"].createElement(
|
16261 | 'button',
|
16262 | _extends({
|
16263 | type: htmlType,
|
16264 | className: classes,
|
16265 | disabled: disabled
|
16266 | }, others),
|
16267 | this.props.children
|
16268 | );
|
16269 | };
|
16270 |
|
16271 | return Button;
|
16272 | }(_react.Component);
|
16273 |
|
16274 | Button.propTypes = propTypes;
|
16275 | Button.defaultProps = defaultProps;
|
16276 |
|
16277 | exports["default"] = Button;
|
16278 | module.exports = exports['default'];
|
16279 |
|
16280 | }),
|
16281 |
|
16282 | (function(module, exports, __webpack_require__) {
|
16283 |
|
16284 | 'use strict';
|
16285 |
|
16286 | Object.defineProperty(exports, "__esModule", {
|
16287 | value: true
|
16288 | });
|
16289 |
|
16290 | var _Dnd = __webpack_require__(158);
|
16291 |
|
16292 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
16293 |
|
16294 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16295 |
|
16296 | exports['default'] = _Dnd2['default'];
|
16297 | module.exports = exports['default'];
|
16298 |
|
16299 | }),
|
16300 |
|
16301 | (function(module, exports, __webpack_require__) {
|
16302 |
|
16303 | 'use strict';
|
16304 |
|
16305 | Object.defineProperty(exports, "__esModule", {
|
16306 | value: true
|
16307 | });
|
16308 |
|
16309 | 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; };
|
16310 |
|
16311 | var _react = __webpack_require__(1);
|
16312 |
|
16313 | var _react2 = _interopRequireDefault(_react);
|
16314 |
|
16315 | var _reactBeautifulDnd = __webpack_require__(159);
|
16316 |
|
16317 | var _reactDraggable = __webpack_require__(257);
|
16318 |
|
16319 | var _reactDraggable2 = _interopRequireDefault(_reactDraggable);
|
16320 |
|
16321 | var _propTypes = __webpack_require__(6);
|
16322 |
|
16323 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16324 |
|
16325 | var _lodash = __webpack_require__(258);
|
16326 |
|
16327 | var _lodash2 = _interopRequireDefault(_lodash);
|
16328 |
|
16329 | var _SortList = __webpack_require__(259);
|
16330 |
|
16331 | var _SortList2 = _interopRequireDefault(_SortList);
|
16332 |
|
16333 | var _Between = __webpack_require__(261);
|
16334 |
|
16335 | var _Between2 = _interopRequireDefault(_Between);
|
16336 |
|
16337 | var _GridLayout = __webpack_require__(262);
|
16338 |
|
16339 | var _GridLayout2 = _interopRequireDefault(_GridLayout);
|
16340 |
|
16341 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16342 |
|
16343 | 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; }
|
16344 |
|
16345 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16346 |
|
16347 | 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; }
|
16348 |
|
16349 | 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); }
|
16350 |
|
16351 | var propTypes = {
|
16352 | onStart: _propTypes2['default'].func,
|
16353 | onDrag: _propTypes2['default'].func,
|
16354 | onStop: _propTypes2['default'].func,
|
16355 | onDragUpdate: _propTypes2['default'].func,
|
16356 | dropClass: _propTypes2['default'].string,
|
16357 | dropOverClass: _propTypes2['default'].string,
|
16358 | dragClass: _propTypes2['default'].string,
|
16359 | dragingClass: _propTypes2['default'].string,
|
16360 | draggedClass: _propTypes2['default'].string,
|
16361 | className: _propTypes2['default'].string,
|
16362 | style: _propTypes2['default'].object,
|
16363 | list: _propTypes2['default'].array,
|
16364 | otherList: _propTypes2['default'].array,
|
16365 | type: _propTypes2['default'].oneOf(['vertical', 'horizontal', 'betweenVertical', 'betweenHorizontal']),
|
16366 | showKey: _propTypes2['default'].string
|
16367 |
|
16368 | };
|
16369 | var defaultProps = {
|
16370 | onStart: function onStart() {},
|
16371 | onDrag: function onDrag() {},
|
16372 | onStop: function onStop() {},
|
16373 | onDragUpdate: function onDragUpdate() {},
|
16374 | list: false,
|
16375 | otherList: [],
|
16376 | dropClass: '',
|
16377 | dropOverClass: '',
|
16378 | dragClass: '',
|
16379 | dragingClass: '',
|
16380 | draggedClass: '',
|
16381 | type: 'vertical'
|
16382 | };
|
16383 |
|
16384 | var Dnd = function (_Component) {
|
16385 | _inherits(Dnd, _Component);
|
16386 |
|
16387 | function Dnd(props) {
|
16388 | _classCallCheck(this, Dnd);
|
16389 |
|
16390 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
16391 |
|
16392 | _this.state = {
|
16393 | items: _this.props.list || []
|
16394 | };
|
16395 | return _this;
|
16396 | }
|
16397 |
|
16398 | Dnd.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
16399 | if (!(0, _lodash2['default'])(this.state.items, nextProps.list)) {
|
16400 | this.setState({
|
16401 | items: nextProps.list
|
16402 | });
|
16403 | }
|
16404 | };
|
16405 |
|
16406 | Dnd.prototype.render = function render() {
|
16407 | var _this2 = this;
|
16408 |
|
16409 | var self = this;
|
16410 | var DndType = function DndType() {
|
16411 | switch (_this2.props.type) {
|
16412 | case 'vertical':
|
16413 | return _react2['default'].createElement(_SortList2['default'], _this2.props);
|
16414 | break;
|
16415 | case 'horizontal':
|
16416 | return _react2['default'].createElement(_SortList2['default'], _this2.props);
|
16417 | break;
|
16418 | case 'betweenVertical':
|
16419 | return _react2['default'].createElement(_Between2['default'], _this2.props);
|
16420 | break;
|
16421 | case 'betweenHorizontal':
|
16422 | return _react2['default'].createElement(_Between2['default'], _this2.props);
|
16423 | break;
|
16424 | default:
|
16425 | return _react2['default'].createElement(_SortList2['default'], _this2.props);
|
16426 | break;
|
16427 | }
|
16428 | };
|
16429 | return _react2['default'].createElement(
|
16430 | 'div',
|
16431 | null,
|
16432 | self.state.items.length ? DndType() : _react2['default'].createElement(
|
16433 | _reactDraggable2['default'],
|
16434 | _extends({ defaultClassName: this.props.dragClass,
|
16435 | defaultClassNameDragging: this.props.dragingClass,
|
16436 | defaultClassNameDragged: this.props.draggedClass
|
16437 | }, this.props),
|
16438 | self.props.children
|
16439 | )
|
16440 | );
|
16441 | };
|
16442 |
|
16443 | return Dnd;
|
16444 | }(_react.Component);
|
16445 |
|
16446 | Dnd.propTypes = propTypes;
|
16447 | Dnd.defaultProps = defaultProps;
|
16448 | Dnd.Drag = _reactDraggable2['default'];
|
16449 | Dnd.DragDropContext = _reactBeautifulDnd.DragDropContext;
|
16450 | Dnd.Droppable = _reactBeautifulDnd.Droppable;
|
16451 | Dnd.Draggable = _reactBeautifulDnd.Draggable;
|
16452 | Dnd.GridLayout = _GridLayout2['default'];
|
16453 | exports['default'] = Dnd;
|
16454 | module.exports = exports['default'];
|
16455 |
|
16456 | }),
|
16457 |
|
16458 | (function(module, exports, __webpack_require__) {
|
16459 |
|
16460 | (function(process) {'use strict';
|
16461 |
|
16462 | Object.defineProperty(exports, '__esModule', { value: true });
|
16463 |
|
16464 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
16465 |
|
16466 | var _extends = _interopDefault(__webpack_require__(160));
|
16467 | var invariant = _interopDefault(__webpack_require__(199));
|
16468 | var cssBoxModel = __webpack_require__(200);
|
16469 | var _Object$keys = _interopDefault(__webpack_require__(201));
|
16470 | var memoizeOne = _interopDefault(__webpack_require__(205));
|
16471 | var redux = __webpack_require__(206);
|
16472 | var _Object$assign = _interopDefault(__webpack_require__(161));
|
16473 | var rafSchd = _interopDefault(__webpack_require__(210));
|
16474 | var _inheritsLoose = _interopDefault(__webpack_require__(211));
|
16475 | var React = __webpack_require__(1);
|
16476 | var React__default = _interopDefault(React);
|
16477 | var PropTypes = _interopDefault(__webpack_require__(6));
|
16478 | var reactRedux = __webpack_require__(218);
|
16479 | var reactMotion = __webpack_require__(243);
|
16480 |
|
16481 | var vertical = {
|
16482 | direction: 'vertical',
|
16483 | line: 'y',
|
16484 | crossAxisLine: 'x',
|
16485 | start: 'top',
|
16486 | end: 'bottom',
|
16487 | size: 'height',
|
16488 | crossAxisStart: 'left',
|
16489 | crossAxisEnd: 'right',
|
16490 | crossAxisSize: 'width'
|
16491 | };
|
16492 | var horizontal = {
|
16493 | direction: 'horizontal',
|
16494 | line: 'x',
|
16495 | crossAxisLine: 'y',
|
16496 | start: 'left',
|
16497 | end: 'right',
|
16498 | size: 'width',
|
16499 | crossAxisStart: 'top',
|
16500 | crossAxisEnd: 'bottom',
|
16501 | crossAxisSize: 'height'
|
16502 | };
|
16503 |
|
16504 | var origin = {
|
16505 | x: 0,
|
16506 | y: 0
|
16507 | };
|
16508 | var add = function add(point1, point2) {
|
16509 | return {
|
16510 | x: point1.x + point2.x,
|
16511 | y: point1.y + point2.y
|
16512 | };
|
16513 | };
|
16514 | var subtract = function subtract(point1, point2) {
|
16515 | return {
|
16516 | x: point1.x - point2.x,
|
16517 | y: point1.y - point2.y
|
16518 | };
|
16519 | };
|
16520 | var isEqual = function isEqual(point1, point2) {
|
16521 | return point1.x === point2.x && point1.y === point2.y;
|
16522 | };
|
16523 | var negate = function negate(point) {
|
16524 | return {
|
16525 | x: point.x !== 0 ? -point.x : 0,
|
16526 | y: point.y !== 0 ? -point.y : 0
|
16527 | };
|
16528 | };
|
16529 | var absolute = function absolute(point) {
|
16530 | return {
|
16531 | x: Math.abs(point.x),
|
16532 | y: Math.abs(point.y)
|
16533 | };
|
16534 | };
|
16535 | var patch = function patch(line, value, otherValue) {
|
16536 | var _ref;
|
16537 |
|
16538 | if (otherValue === void 0) {
|
16539 | otherValue = 0;
|
16540 | }
|
16541 |
|
16542 | return _ref = {}, _ref[line] = value, _ref[line === 'x' ? 'y' : 'x'] = otherValue, _ref;
|
16543 | };
|
16544 | var distance = function distance(point1, point2) {
|
16545 | return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
|
16546 | };
|
16547 | var closest = function closest(target, points) {
|
16548 | return Math.min.apply(Math, points.map(function (point) {
|
16549 | return distance(target, point);
|
16550 | }));
|
16551 | };
|
16552 | var apply = function apply(fn) {
|
16553 | return function (point) {
|
16554 | return {
|
16555 | x: fn(point.x),
|
16556 | y: fn(point.y)
|
16557 | };
|
16558 | };
|
16559 | };
|
16560 |
|
16561 | var offsetByPosition = function offsetByPosition(spacing, point) {
|
16562 | return {
|
16563 | top: spacing.top + point.y,
|
16564 | left: spacing.left + point.x,
|
16565 | bottom: spacing.bottom + point.y,
|
16566 | right: spacing.right + point.x
|
16567 | };
|
16568 | };
|
16569 | var expandByPosition = function expandByPosition(spacing, position) {
|
16570 | return {
|
16571 | top: spacing.top - position.y,
|
16572 | left: spacing.left - position.x,
|
16573 | right: spacing.right + position.x,
|
16574 | bottom: spacing.bottom + position.y
|
16575 | };
|
16576 | };
|
16577 | var getCorners = function getCorners(spacing) {
|
16578 | return [{
|
16579 | x: spacing.left,
|
16580 | y: spacing.top
|
16581 | }, {
|
16582 | x: spacing.right,
|
16583 | y: spacing.top
|
16584 | }, {
|
16585 | x: spacing.left,
|
16586 | y: spacing.bottom
|
16587 | }, {
|
16588 | x: spacing.right,
|
16589 | y: spacing.bottom
|
16590 | }];
|
16591 | };
|
16592 |
|
16593 | var getMaxScroll = (function (_ref) {
|
16594 | var scrollHeight = _ref.scrollHeight,
|
16595 | scrollWidth = _ref.scrollWidth,
|
16596 | height = _ref.height,
|
16597 | width = _ref.width;
|
16598 | var maxScroll = subtract({
|
16599 | x: scrollWidth,
|
16600 | y: scrollHeight
|
16601 | }, {
|
16602 | x: width,
|
16603 | y: height
|
16604 | });
|
16605 | var adjustedMaxScroll = {
|
16606 | x: Math.max(0, maxScroll.x),
|
16607 | y: Math.max(0, maxScroll.y)
|
16608 | };
|
16609 | return adjustedMaxScroll;
|
16610 | });
|
16611 |
|
16612 | var clip = function clip(frame, subject) {
|
16613 | var result = cssBoxModel.getRect({
|
16614 | top: Math.max(subject.top, frame.top),
|
16615 | right: Math.min(subject.right, frame.right),
|
16616 | bottom: Math.min(subject.bottom, frame.bottom),
|
16617 | left: Math.max(subject.left, frame.left)
|
16618 | });
|
16619 |
|
16620 | if (result.width <= 0 || result.height <= 0) {
|
16621 | return null;
|
16622 | }
|
16623 |
|
16624 | return result;
|
16625 | };
|
16626 | var getDroppableDimension = function getDroppableDimension(_ref) {
|
16627 | var descriptor = _ref.descriptor,
|
16628 | isEnabled = _ref.isEnabled,
|
16629 | direction = _ref.direction,
|
16630 | client = _ref.client,
|
16631 | page = _ref.page,
|
16632 | closest$$1 = _ref.closest;
|
16633 |
|
16634 | var scrollable = function () {
|
16635 | if (!closest$$1) {
|
16636 | return null;
|
16637 | }
|
16638 |
|
16639 | var maxScroll = getMaxScroll({
|
16640 | scrollHeight: closest$$1.scrollHeight,
|
16641 | scrollWidth: closest$$1.scrollWidth,
|
16642 | height: closest$$1.client.paddingBox.height,
|
16643 | width: closest$$1.client.paddingBox.width
|
16644 | });
|
16645 | return {
|
16646 | framePageMarginBox: closest$$1.page.marginBox,
|
16647 | shouldClipSubject: closest$$1.shouldClipSubject,
|
16648 | scroll: {
|
16649 | initial: closest$$1.scroll,
|
16650 | current: closest$$1.scroll,
|
16651 | max: maxScroll,
|
16652 | diff: {
|
16653 | value: origin,
|
16654 | displacement: origin
|
16655 | }
|
16656 | }
|
16657 | };
|
16658 | }();
|
16659 |
|
16660 | var subjectPageMarginBox = page.marginBox;
|
16661 | var clippedPageMarginBox = scrollable && scrollable.shouldClipSubject ? clip(scrollable.framePageMarginBox, subjectPageMarginBox) : subjectPageMarginBox;
|
16662 | var viewport = {
|
16663 | closestScrollable: scrollable,
|
16664 | subjectPageMarginBox: subjectPageMarginBox,
|
16665 | clippedPageMarginBox: clippedPageMarginBox
|
16666 | };
|
16667 | var dimension = {
|
16668 | descriptor: descriptor,
|
16669 | axis: direction === 'vertical' ? vertical : horizontal,
|
16670 | isEnabled: isEnabled,
|
16671 | client: client,
|
16672 | page: page,
|
16673 | viewport: viewport
|
16674 | };
|
16675 | return dimension;
|
16676 | };
|
16677 | var scrollDroppable = function scrollDroppable(droppable, newScroll) {
|
16678 | !droppable.viewport.closestScrollable ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
16679 | var scrollable = droppable.viewport.closestScrollable;
|
16680 | var framePageMarginBox = scrollable.framePageMarginBox;
|
16681 | var scrollDiff = subtract(newScroll, scrollable.scroll.initial);
|
16682 | var scrollDisplacement = negate(scrollDiff);
|
16683 | var closestScrollable = {
|
16684 | framePageMarginBox: scrollable.framePageMarginBox,
|
16685 | shouldClipSubject: scrollable.shouldClipSubject,
|
16686 | scroll: {
|
16687 | initial: scrollable.scroll.initial,
|
16688 | current: newScroll,
|
16689 | diff: {
|
16690 | value: scrollDiff,
|
16691 | displacement: scrollDisplacement
|
16692 | },
|
16693 | max: scrollable.scroll.max
|
16694 | }
|
16695 | };
|
16696 | var displacedSubject = offsetByPosition(droppable.viewport.subjectPageMarginBox, scrollDisplacement);
|
16697 | var clippedPageMarginBox = closestScrollable.shouldClipSubject ? clip(framePageMarginBox, displacedSubject) : cssBoxModel.getRect(displacedSubject);
|
16698 | var viewport = {
|
16699 | closestScrollable: closestScrollable,
|
16700 | subjectPageMarginBox: droppable.viewport.subjectPageMarginBox,
|
16701 | clippedPageMarginBox: clippedPageMarginBox
|
16702 | };
|
16703 |
|
16704 | var result = _extends({}, droppable, {
|
16705 | viewport: viewport
|
16706 | });
|
16707 |
|
16708 | return result;
|
16709 | };
|
16710 |
|
16711 | var toDroppableMap = memoizeOne(function (droppables) {
|
16712 | return droppables.reduce(function (previous, current) {
|
16713 | previous[current.descriptor.id] = current;
|
16714 | return previous;
|
16715 | }, {});
|
16716 | });
|
16717 | var toDraggableMap = memoizeOne(function (draggables) {
|
16718 | return draggables.reduce(function (previous, current) {
|
16719 | previous[current.descriptor.id] = current;
|
16720 | return previous;
|
16721 | }, {});
|
16722 | });
|
16723 | var toDroppableList = memoizeOne(function (droppables) {
|
16724 | return _Object$keys(droppables).map(function (id) {
|
16725 | return droppables[id];
|
16726 | });
|
16727 | });
|
16728 | var toDraggableList = memoizeOne(function (draggables) {
|
16729 | return _Object$keys(draggables).map(function (id) {
|
16730 | return draggables[id];
|
16731 | });
|
16732 | });
|
16733 |
|
16734 | var getDraggablesInsideDroppable = memoizeOne(function (droppable, draggables) {
|
16735 | return toDraggableList(draggables).filter(function (draggable) {
|
16736 | return droppable.descriptor.id === draggable.descriptor.droppableId;
|
16737 | }).sort(function (a, b) {
|
16738 | return a.descriptor.index - b.descriptor.index;
|
16739 | });
|
16740 | });
|
16741 |
|
16742 | var isWithin = (function (lowerBound, upperBound) {
|
16743 | return function (value) {
|
16744 | return value <= upperBound && value >= lowerBound;
|
16745 | };
|
16746 | });
|
16747 |
|
16748 | var isPositionInFrame = (function (frame) {
|
16749 | var isWithinVertical = isWithin(frame.top, frame.bottom);
|
16750 | var isWithinHorizontal = isWithin(frame.left, frame.right);
|
16751 | return function (point) {
|
16752 | return isWithinVertical(point.y) && isWithinVertical(point.y) && isWithinHorizontal(point.x) && isWithinHorizontal(point.x);
|
16753 | };
|
16754 | });
|
16755 |
|
16756 | var getRequiredGrowth = memoizeOne(function (draggable, draggables, droppable) {
|
16757 | var getResult = function getResult(existingSpace) {
|
16758 | var requiredSpace = draggable.page.marginBox[droppable.axis.size];
|
16759 |
|
16760 | if (requiredSpace <= existingSpace) {
|
16761 | return null;
|
16762 | }
|
16763 |
|
16764 | var requiredGrowth = patch(droppable.axis.line, requiredSpace - existingSpace);
|
16765 | return requiredGrowth;
|
16766 | };
|
16767 |
|
16768 | var dimensions = getDraggablesInsideDroppable(droppable, draggables);
|
16769 |
|
16770 | if (!dimensions.length) {
|
16771 | var _existingSpace = droppable.page.marginBox[droppable.axis.size];
|
16772 | return getResult(_existingSpace);
|
16773 | }
|
16774 |
|
16775 | var endOfDraggables = dimensions[dimensions.length - 1].page.marginBox[droppable.axis.end];
|
16776 | var endOfDroppable = droppable.page.marginBox[droppable.axis.end];
|
16777 | var existingSpace = endOfDroppable - endOfDraggables;
|
16778 | return getResult(existingSpace);
|
16779 | });
|
16780 | var getWithGrowth = memoizeOne(function (area, growth) {
|
16781 | return cssBoxModel.getRect(expandByPosition(area, growth));
|
16782 | });
|
16783 |
|
16784 | var getClippedRectWithPlaceholder = function getClippedRectWithPlaceholder(_ref) {
|
16785 | var draggable = _ref.draggable,
|
16786 | draggables = _ref.draggables,
|
16787 | droppable = _ref.droppable,
|
16788 | previousDroppableOverId = _ref.previousDroppableOverId;
|
16789 | var isHome = draggable.descriptor.droppableId === droppable.descriptor.id;
|
16790 | var wasOver = Boolean(previousDroppableOverId && previousDroppableOverId === droppable.descriptor.id);
|
16791 | var clippedPageMarginBox = droppable.viewport.clippedPageMarginBox;
|
16792 |
|
16793 | if (!clippedPageMarginBox) {
|
16794 | return clippedPageMarginBox;
|
16795 | }
|
16796 |
|
16797 | if (isHome || !wasOver) {
|
16798 | return clippedPageMarginBox;
|
16799 | }
|
16800 |
|
16801 | var requiredGrowth = getRequiredGrowth(draggable, draggables, droppable);
|
16802 |
|
16803 | if (!requiredGrowth) {
|
16804 | return clippedPageMarginBox;
|
16805 | }
|
16806 |
|
16807 | var subjectWithGrowth = getWithGrowth(clippedPageMarginBox, requiredGrowth);
|
16808 | var closestScrollable = droppable.viewport.closestScrollable;
|
16809 |
|
16810 | if (!closestScrollable) {
|
16811 | return subjectWithGrowth;
|
16812 | }
|
16813 |
|
16814 | if (!closestScrollable.shouldClipSubject) {
|
16815 | return subjectWithGrowth;
|
16816 | }
|
16817 |
|
16818 | return clip(closestScrollable.framePageMarginBox, subjectWithGrowth);
|
16819 | };
|
16820 |
|
16821 | var getDroppableOver = (function (_ref2) {
|
16822 | var target = _ref2.target,
|
16823 | draggable = _ref2.draggable,
|
16824 | draggables = _ref2.draggables,
|
16825 | droppables = _ref2.droppables,
|
16826 | previousDroppableOverId = _ref2.previousDroppableOverId;
|
16827 | var maybe = toDroppableList(droppables).filter(function (droppable) {
|
16828 | return droppable.isEnabled;
|
16829 | }).find(function (droppable) {
|
16830 | var withPlaceholder = getClippedRectWithPlaceholder({
|
16831 | draggable: draggable,
|
16832 | draggables: draggables,
|
16833 | droppable: droppable,
|
16834 | previousDroppableOverId: previousDroppableOverId
|
16835 | });
|
16836 |
|
16837 | if (!withPlaceholder) {
|
16838 | return false;
|
16839 | }
|
16840 |
|
16841 | return isPositionInFrame(withPlaceholder)(target);
|
16842 | });
|
16843 | return maybe ? maybe.descriptor.id : null;
|
16844 | });
|
16845 |
|
16846 | var noMovement = {
|
16847 | displaced: [],
|
16848 | amount: origin,
|
16849 | isBeyondStartPosition: false
|
16850 | };
|
16851 | var noImpact = {
|
16852 | movement: noMovement,
|
16853 | direction: null,
|
16854 | destination: null
|
16855 | };
|
16856 |
|
16857 | var getDisplacementMap = memoizeOne(function (displaced) {
|
16858 | return displaced.reduce(function (map, displacement) {
|
16859 | map[displacement.draggableId] = displacement;
|
16860 | return map;
|
16861 | }, {});
|
16862 | });
|
16863 |
|
16864 | var isPartiallyVisibleThroughFrame = (function (frame) {
|
16865 | var isWithinVertical = isWithin(frame.top, frame.bottom);
|
16866 | var isWithinHorizontal = isWithin(frame.left, frame.right);
|
16867 | return function (subject) {
|
16868 | var isContained = isWithinVertical(subject.top) && isWithinVertical(subject.bottom) && isWithinHorizontal(subject.left) && isWithinHorizontal(subject.right);
|
16869 |
|
16870 | if (isContained) {
|
16871 | return true;
|
16872 | }
|
16873 |
|
16874 | var isPartiallyVisibleVertically = isWithinVertical(subject.top) || isWithinVertical(subject.bottom);
|
16875 | var isPartiallyVisibleHorizontally = isWithinHorizontal(subject.left) || isWithinHorizontal(subject.right);
|
16876 | var isPartiallyContained = isPartiallyVisibleVertically && isPartiallyVisibleHorizontally;
|
16877 |
|
16878 | if (isPartiallyContained) {
|
16879 | return true;
|
16880 | }
|
16881 |
|
16882 | var isBiggerVertically = subject.top < frame.top && subject.bottom > frame.bottom;
|
16883 | var isBiggerHorizontally = subject.left < frame.left && subject.right > frame.right;
|
16884 | var isTargetBiggerThanFrame = isBiggerVertically && isBiggerHorizontally;
|
16885 |
|
16886 | if (isTargetBiggerThanFrame) {
|
16887 | return true;
|
16888 | }
|
16889 |
|
16890 | var isTargetBiggerOnOneAxis = isBiggerVertically && isPartiallyVisibleHorizontally || isBiggerHorizontally && isPartiallyVisibleVertically;
|
16891 | return isTargetBiggerOnOneAxis;
|
16892 | };
|
16893 | });
|
16894 |
|
16895 | var isTotallyVisibleThroughFrame = (function (frame) {
|
16896 | var isWithinVertical = isWithin(frame.top, frame.bottom);
|
16897 | var isWithinHorizontal = isWithin(frame.left, frame.right);
|
16898 | return function (subject) {
|
16899 | var isContained = isWithinVertical(subject.top) && isWithinVertical(subject.bottom) && isWithinHorizontal(subject.left) && isWithinHorizontal(subject.right);
|
16900 | return isContained;
|
16901 | };
|
16902 | });
|
16903 |
|
16904 | var isVisible = function isVisible(_ref) {
|
16905 | var target = _ref.target,
|
16906 | destination = _ref.destination,
|
16907 | viewport = _ref.viewport,
|
16908 | isVisibleThroughFrameFn = _ref.isVisibleThroughFrameFn;
|
16909 | var displacement = destination.viewport.closestScrollable ? destination.viewport.closestScrollable.scroll.diff.displacement : origin;
|
16910 | var withDisplacement = offsetByPosition(target, displacement);
|
16911 |
|
16912 | if (!destination.viewport.clippedPageMarginBox) {
|
16913 | return false;
|
16914 | }
|
16915 |
|
16916 | var isVisibleInDroppable = isVisibleThroughFrameFn(destination.viewport.clippedPageMarginBox)(withDisplacement);
|
16917 | var isVisibleInViewport = isVisibleThroughFrameFn(viewport)(withDisplacement);
|
16918 | return isVisibleInDroppable && isVisibleInViewport;
|
16919 | };
|
16920 |
|
16921 | var isPartiallyVisible = function isPartiallyVisible(_ref2) {
|
16922 | var target = _ref2.target,
|
16923 | destination = _ref2.destination,
|
16924 | viewport = _ref2.viewport;
|
16925 | return isVisible({
|
16926 | target: target,
|
16927 | destination: destination,
|
16928 | viewport: viewport,
|
16929 | isVisibleThroughFrameFn: isPartiallyVisibleThroughFrame
|
16930 | });
|
16931 | };
|
16932 | var isTotallyVisible = function isTotallyVisible(_ref3) {
|
16933 | var target = _ref3.target,
|
16934 | destination = _ref3.destination,
|
16935 | viewport = _ref3.viewport;
|
16936 | return isVisible({
|
16937 | target: target,
|
16938 | destination: destination,
|
16939 | viewport: viewport,
|
16940 | isVisibleThroughFrameFn: isTotallyVisibleThroughFrame
|
16941 | });
|
16942 | };
|
16943 |
|
16944 | var getDisplacement = (function (_ref) {
|
16945 | var draggable = _ref.draggable,
|
16946 | destination = _ref.destination,
|
16947 | previousImpact = _ref.previousImpact,
|
16948 | viewport = _ref.viewport;
|
16949 | var id = draggable.descriptor.id;
|
16950 | var map = getDisplacementMap(previousImpact.movement.displaced);
|
16951 | var isVisible = isPartiallyVisible({
|
16952 | target: draggable.page.marginBox,
|
16953 | destination: destination,
|
16954 | viewport: viewport
|
16955 | });
|
16956 |
|
16957 | var shouldAnimate = function () {
|
16958 | if (!isVisible) {
|
16959 | return false;
|
16960 | }
|
16961 |
|
16962 | var previous = map[id];
|
16963 |
|
16964 | if (!previous) {
|
16965 | return true;
|
16966 | }
|
16967 |
|
16968 | return previous.shouldAnimate;
|
16969 | }();
|
16970 |
|
16971 | var displacement = {
|
16972 | draggableId: id,
|
16973 | isVisible: isVisible,
|
16974 | shouldAnimate: shouldAnimate
|
16975 | };
|
16976 | return displacement;
|
16977 | });
|
16978 |
|
16979 | var withDroppableScroll = (function (droppable, point) {
|
16980 | var closestScrollable = droppable.viewport.closestScrollable;
|
16981 |
|
16982 | if (!closestScrollable) {
|
16983 | return point;
|
16984 | }
|
16985 |
|
16986 | return add(point, closestScrollable.scroll.diff.value);
|
16987 | });
|
16988 |
|
16989 | var inHomeList = (function (_ref) {
|
16990 | var pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
16991 | draggable = _ref.draggable,
|
16992 | home = _ref.home,
|
16993 | insideHome = _ref.insideHome,
|
16994 | previousImpact = _ref.previousImpact,
|
16995 | viewport = _ref.viewport;
|
16996 | var axis = home.axis;
|
16997 | var originalCenter = draggable.page.borderBox.center;
|
16998 | var currentCenter = withDroppableScroll(home, pageBorderBoxCenter);
|
16999 | var isBeyondStartPosition = currentCenter[axis.line] - originalCenter[axis.line] > 0;
|
17000 | var amount = patch(axis.line, draggable.client.marginBox[axis.size]);
|
17001 | var displaced = insideHome.filter(function (child) {
|
17002 | if (child === draggable) {
|
17003 | return false;
|
17004 | }
|
17005 |
|
17006 | var borderBox = child.page.borderBox;
|
17007 |
|
17008 | if (isBeyondStartPosition) {
|
17009 | if (borderBox.center[axis.line] < originalCenter[axis.line]) {
|
17010 | return false;
|
17011 | }
|
17012 |
|
17013 | return currentCenter[axis.line] > borderBox[axis.start];
|
17014 | }
|
17015 |
|
17016 | if (originalCenter[axis.line] < borderBox.center[axis.line]) {
|
17017 | return false;
|
17018 | }
|
17019 |
|
17020 | return currentCenter[axis.line] < borderBox[axis.end];
|
17021 | }).map(function (dimension) {
|
17022 | return getDisplacement({
|
17023 | draggable: dimension,
|
17024 | destination: home,
|
17025 | previousImpact: previousImpact,
|
17026 | viewport: viewport.frame
|
17027 | });
|
17028 | });
|
17029 | var ordered = isBeyondStartPosition ? displaced.reverse() : displaced;
|
17030 |
|
17031 | var index = function () {
|
17032 | var startIndex = draggable.descriptor.index;
|
17033 | var length = ordered.length;
|
17034 |
|
17035 | if (!length) {
|
17036 | return startIndex;
|
17037 | }
|
17038 |
|
17039 | if (isBeyondStartPosition) {
|
17040 | return startIndex + length;
|
17041 | }
|
17042 |
|
17043 | return startIndex - length;
|
17044 | }();
|
17045 |
|
17046 | var movement = {
|
17047 | amount: amount,
|
17048 | displaced: ordered,
|
17049 | isBeyondStartPosition: isBeyondStartPosition
|
17050 | };
|
17051 | var impact = {
|
17052 | movement: movement,
|
17053 | direction: axis.direction,
|
17054 | destination: {
|
17055 | droppableId: home.descriptor.id,
|
17056 | index: index
|
17057 | }
|
17058 | };
|
17059 | return impact;
|
17060 | });
|
17061 |
|
17062 | var inForeignList = (function (_ref) {
|
17063 | var pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
17064 | draggable = _ref.draggable,
|
17065 | destination = _ref.destination,
|
17066 | insideDestination = _ref.insideDestination,
|
17067 | previousImpact = _ref.previousImpact,
|
17068 | viewport = _ref.viewport;
|
17069 | var axis = destination.axis;
|
17070 | var currentCenter = withDroppableScroll(destination, pageBorderBoxCenter);
|
17071 | var displaced = insideDestination.filter(function (child) {
|
17072 | var threshold = child.page.borderBox[axis.end];
|
17073 | return threshold > currentCenter[axis.line];
|
17074 | }).map(function (dimension) {
|
17075 | return getDisplacement({
|
17076 | draggable: dimension,
|
17077 | destination: destination,
|
17078 | previousImpact: previousImpact,
|
17079 | viewport: viewport.frame
|
17080 | });
|
17081 | });
|
17082 | var newIndex = insideDestination.length - displaced.length;
|
17083 | var movement = {
|
17084 | amount: patch(axis.line, draggable.page.marginBox[axis.size]),
|
17085 | displaced: displaced,
|
17086 | isBeyondStartPosition: false
|
17087 | };
|
17088 | var impact = {
|
17089 | movement: movement,
|
17090 | direction: axis.direction,
|
17091 | destination: {
|
17092 | droppableId: destination.descriptor.id,
|
17093 | index: newIndex
|
17094 | }
|
17095 | };
|
17096 | return impact;
|
17097 | });
|
17098 |
|
17099 | var getDragImpact = (function (_ref) {
|
17100 | var pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
17101 | draggable = _ref.draggable,
|
17102 | draggables = _ref.draggables,
|
17103 | droppables = _ref.droppables,
|
17104 | previousImpact = _ref.previousImpact,
|
17105 | viewport = _ref.viewport;
|
17106 | var previousDroppableOverId = previousImpact.destination && previousImpact.destination.droppableId;
|
17107 | var destinationId = getDroppableOver({
|
17108 | target: pageBorderBoxCenter,
|
17109 | draggable: draggable,
|
17110 | draggables: draggables,
|
17111 | droppables: droppables,
|
17112 | previousDroppableOverId: previousDroppableOverId
|
17113 | });
|
17114 |
|
17115 | if (!destinationId) {
|
17116 | return noImpact;
|
17117 | }
|
17118 |
|
17119 | var destination = droppables[destinationId];
|
17120 |
|
17121 | if (!destination.isEnabled) {
|
17122 | return noImpact;
|
17123 | }
|
17124 |
|
17125 | var home = droppables[draggable.descriptor.droppableId];
|
17126 | var isWithinHomeDroppable = home.descriptor.id === destinationId;
|
17127 | var insideDestination = getDraggablesInsideDroppable(destination, draggables);
|
17128 |
|
17129 | if (isWithinHomeDroppable) {
|
17130 | return inHomeList({
|
17131 | pageBorderBoxCenter: pageBorderBoxCenter,
|
17132 | draggable: draggable,
|
17133 | home: home,
|
17134 | insideHome: insideDestination,
|
17135 | previousImpact: previousImpact || noImpact,
|
17136 | viewport: viewport
|
17137 | });
|
17138 | }
|
17139 |
|
17140 | return inForeignList({
|
17141 | pageBorderBoxCenter: pageBorderBoxCenter,
|
17142 | draggable: draggable,
|
17143 | destination: destination,
|
17144 | insideDestination: insideDestination,
|
17145 | previousImpact: previousImpact || noImpact,
|
17146 | viewport: viewport
|
17147 | });
|
17148 | });
|
17149 |
|
17150 | var getHomeLocation = (function (critical) {
|
17151 | return {
|
17152 | index: critical.draggable.index,
|
17153 | droppableId: critical.droppable.id
|
17154 | };
|
17155 | });
|
17156 |
|
17157 | var getSafeClipped = function getSafeClipped(droppable) {
|
17158 | var rect = droppable.viewport.clippedPageMarginBox;
|
17159 | !rect ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get clipped area from droppable') : invariant(false) : void 0;
|
17160 | return rect;
|
17161 | };
|
17162 |
|
17163 | var getBestCrossAxisDroppable = (function (_ref) {
|
17164 | var isMovingForward = _ref.isMovingForward,
|
17165 | pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
17166 | source = _ref.source,
|
17167 | droppables = _ref.droppables,
|
17168 | viewport = _ref.viewport;
|
17169 | var sourceClipped = source.viewport.clippedPageMarginBox;
|
17170 |
|
17171 | if (!sourceClipped) {
|
17172 | return null;
|
17173 | }
|
17174 |
|
17175 | var axis = source.axis;
|
17176 | var isBetweenSourceClipped = isWithin(sourceClipped[axis.start], sourceClipped[axis.end]);
|
17177 | var candidates = toDroppableList(droppables).filter(function (droppable) {
|
17178 | return droppable !== source;
|
17179 | }).filter(function (droppable) {
|
17180 | return droppable.isEnabled;
|
17181 | }).filter(function (droppable) {
|
17182 | var clippedPageMarginBox = droppable.viewport.clippedPageMarginBox;
|
17183 |
|
17184 | if (!clippedPageMarginBox) {
|
17185 | return false;
|
17186 | }
|
17187 |
|
17188 | return isPartiallyVisibleThroughFrame(viewport.frame)(clippedPageMarginBox);
|
17189 | }).filter(function (droppable) {
|
17190 | var targetClipped = getSafeClipped(droppable);
|
17191 |
|
17192 | if (isMovingForward) {
|
17193 | return sourceClipped[axis.crossAxisEnd] < targetClipped[axis.crossAxisEnd];
|
17194 | }
|
17195 |
|
17196 | return targetClipped[axis.crossAxisStart] < sourceClipped[axis.crossAxisStart];
|
17197 | }).filter(function (droppable) {
|
17198 | var targetClipped = getSafeClipped(droppable);
|
17199 | var isBetweenDestinationClipped = isWithin(targetClipped[axis.start], targetClipped[axis.end]);
|
17200 | return isBetweenSourceClipped(targetClipped[axis.start]) || isBetweenSourceClipped(targetClipped[axis.end]) || isBetweenDestinationClipped(sourceClipped[axis.start]) || isBetweenDestinationClipped(sourceClipped[axis.end]);
|
17201 | }).sort(function (a, b) {
|
17202 | var first = getSafeClipped(a)[axis.crossAxisStart];
|
17203 | var second = getSafeClipped(b)[axis.crossAxisStart];
|
17204 |
|
17205 | if (isMovingForward) {
|
17206 | return first - second;
|
17207 | }
|
17208 |
|
17209 | return second - first;
|
17210 | }).filter(function (droppable, index, array) {
|
17211 | return getSafeClipped(droppable)[axis.crossAxisStart] === getSafeClipped(array[0])[axis.crossAxisStart];
|
17212 | });
|
17213 |
|
17214 | if (!candidates.length) {
|
17215 | return null;
|
17216 | }
|
17217 |
|
17218 | if (candidates.length === 1) {
|
17219 | return candidates[0];
|
17220 | }
|
17221 |
|
17222 | var contains = candidates.filter(function (droppable) {
|
17223 | var isWithinDroppable = isWithin(getSafeClipped(droppable)[axis.start], getSafeClipped(droppable)[axis.end]);
|
17224 | return isWithinDroppable(pageBorderBoxCenter[axis.line]);
|
17225 | });
|
17226 |
|
17227 | if (contains.length === 1) {
|
17228 | return contains[0];
|
17229 | }
|
17230 |
|
17231 | if (contains.length > 1) {
|
17232 | return contains.sort(function (a, b) {
|
17233 | return getSafeClipped(a)[axis.start] - getSafeClipped(b)[axis.start];
|
17234 | })[0];
|
17235 | }
|
17236 |
|
17237 | return candidates.sort(function (a, b) {
|
17238 | var first = closest(pageBorderBoxCenter, getCorners(getSafeClipped(a)));
|
17239 | var second = closest(pageBorderBoxCenter, getCorners(getSafeClipped(b)));
|
17240 |
|
17241 | if (first !== second) {
|
17242 | return first - second;
|
17243 | }
|
17244 |
|
17245 | return getSafeClipped(a)[axis.start] - getSafeClipped(b)[axis.start];
|
17246 | })[0];
|
17247 | });
|
17248 |
|
17249 | var withDroppableDisplacement = (function (droppable, point) {
|
17250 | var closestScrollable = droppable.viewport.closestScrollable;
|
17251 |
|
17252 | if (!closestScrollable) {
|
17253 | return point;
|
17254 | }
|
17255 |
|
17256 | return add(point, closestScrollable.scroll.diff.displacement);
|
17257 | });
|
17258 |
|
17259 | var getClosestDraggable = (function (_ref) {
|
17260 | var axis = _ref.axis,
|
17261 | viewport = _ref.viewport,
|
17262 | pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
17263 | destination = _ref.destination,
|
17264 | insideDestination = _ref.insideDestination;
|
17265 |
|
17266 | if (!insideDestination.length) {
|
17267 | return null;
|
17268 | }
|
17269 |
|
17270 | var result = insideDestination.filter(function (draggable) {
|
17271 | return isTotallyVisible({
|
17272 | target: draggable.page.borderBox,
|
17273 | destination: destination,
|
17274 | viewport: viewport.frame
|
17275 | });
|
17276 | }).sort(function (a, b) {
|
17277 | var distanceToA = distance(pageBorderBoxCenter, withDroppableDisplacement(destination, a.page.borderBox.center));
|
17278 | var distanceToB = distance(pageBorderBoxCenter, withDroppableDisplacement(destination, b.page.borderBox.center));
|
17279 |
|
17280 | if (distanceToA < distanceToB) {
|
17281 | return -1;
|
17282 | }
|
17283 |
|
17284 | if (distanceToB < distanceToA) {
|
17285 | return 1;
|
17286 | }
|
17287 |
|
17288 | return a.page.borderBox[axis.start] - b.page.borderBox[axis.start];
|
17289 | });
|
17290 | return result.length ? result[0] : null;
|
17291 | });
|
17292 |
|
17293 | var moveToEdge = (function (_ref) {
|
17294 | var source = _ref.source,
|
17295 | sourceEdge = _ref.sourceEdge,
|
17296 | destination = _ref.destination,
|
17297 | destinationEdge = _ref.destinationEdge,
|
17298 | destinationAxis = _ref.destinationAxis;
|
17299 |
|
17300 | var getCorner = function getCorner(area) {
|
17301 | return patch(destinationAxis.line, area[destinationAxis[destinationEdge]], area[destinationAxis.crossAxisStart]);
|
17302 | };
|
17303 |
|
17304 | var corner = getCorner(destination);
|
17305 | var centerDiff = absolute(subtract(source.center, getCorner(source)));
|
17306 | var signed = patch(destinationAxis.line, (sourceEdge === 'end' ? -1 : 1) * centerDiff[destinationAxis.line], centerDiff[destinationAxis.crossAxisLine]);
|
17307 | return add(corner, signed);
|
17308 | });
|
17309 |
|
17310 | var toHomeList = (function (_ref) {
|
17311 | var amount = _ref.amount,
|
17312 | homeIndex = _ref.homeIndex,
|
17313 | movingRelativeTo = _ref.movingRelativeTo,
|
17314 | insideDestination = _ref.insideDestination,
|
17315 | draggable = _ref.draggable,
|
17316 | destination = _ref.destination,
|
17317 | previousImpact = _ref.previousImpact,
|
17318 | viewport = _ref.viewport;
|
17319 | var axis = destination.axis;
|
17320 | var targetIndex = insideDestination.indexOf(movingRelativeTo);
|
17321 | !(targetIndex !== -1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Unable to find target in destination droppable') : invariant(false) : void 0;
|
17322 |
|
17323 | if (targetIndex === homeIndex) {
|
17324 | var _newCenter = draggable.page.borderBox.center;
|
17325 | var _newImpact = {
|
17326 | movement: {
|
17327 | displaced: [],
|
17328 | amount: amount,
|
17329 | isBeyondStartPosition: false
|
17330 | },
|
17331 | direction: destination.axis.direction,
|
17332 | destination: {
|
17333 | droppableId: destination.descriptor.id,
|
17334 | index: homeIndex
|
17335 | }
|
17336 | };
|
17337 | return {
|
17338 | pageBorderBoxCenter: withDroppableDisplacement(destination, _newCenter),
|
17339 | impact: _newImpact
|
17340 | };
|
17341 | }
|
17342 |
|
17343 | var isMovingPastOriginalIndex = targetIndex > homeIndex;
|
17344 | var edge = isMovingPastOriginalIndex ? 'end' : 'start';
|
17345 | var newCenter = moveToEdge({
|
17346 | source: draggable.page.borderBox,
|
17347 | sourceEdge: edge,
|
17348 | destination: isMovingPastOriginalIndex ? movingRelativeTo.page.borderBox : movingRelativeTo.page.marginBox,
|
17349 | destinationEdge: edge,
|
17350 | destinationAxis: axis
|
17351 | });
|
17352 |
|
17353 | var modified = function () {
|
17354 | if (!isMovingPastOriginalIndex) {
|
17355 | return insideDestination.slice(targetIndex, homeIndex);
|
17356 | }
|
17357 |
|
17358 | var from = homeIndex + 1;
|
17359 | var to = targetIndex + 1;
|
17360 | return insideDestination.slice(from, to).reverse();
|
17361 | }();
|
17362 |
|
17363 | var displaced = modified.map(function (dimension) {
|
17364 | return getDisplacement({
|
17365 | draggable: dimension,
|
17366 | destination: destination,
|
17367 | previousImpact: previousImpact,
|
17368 | viewport: viewport.frame
|
17369 | });
|
17370 | });
|
17371 | var newImpact = {
|
17372 | movement: {
|
17373 | displaced: displaced,
|
17374 | amount: amount,
|
17375 | isBeyondStartPosition: isMovingPastOriginalIndex
|
17376 | },
|
17377 | direction: axis.direction,
|
17378 | destination: {
|
17379 | droppableId: destination.descriptor.id,
|
17380 | index: targetIndex
|
17381 | }
|
17382 | };
|
17383 | return {
|
17384 | pageBorderBoxCenter: withDroppableDisplacement(destination, newCenter),
|
17385 | impact: newImpact
|
17386 | };
|
17387 | });
|
17388 |
|
17389 | var toForeignList = (function (_ref) {
|
17390 | var amount = _ref.amount,
|
17391 | pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
17392 | movingRelativeTo = _ref.movingRelativeTo,
|
17393 | insideDestination = _ref.insideDestination,
|
17394 | draggable = _ref.draggable,
|
17395 | destination = _ref.destination,
|
17396 | previousImpact = _ref.previousImpact,
|
17397 | viewport = _ref.viewport;
|
17398 | var axis = destination.axis;
|
17399 | var isGoingBeforeTarget = Boolean(movingRelativeTo && pageBorderBoxCenter[destination.axis.line] < movingRelativeTo.page.borderBox.center[destination.axis.line]);
|
17400 |
|
17401 | if (!movingRelativeTo) {
|
17402 | var _newCenter = moveToEdge({
|
17403 | source: draggable.page.borderBox,
|
17404 | sourceEdge: 'start',
|
17405 | destination: destination.page.contentBox,
|
17406 | destinationEdge: 'start',
|
17407 | destinationAxis: axis
|
17408 | });
|
17409 |
|
17410 | var _newImpact = {
|
17411 | movement: {
|
17412 | displaced: [],
|
17413 | amount: amount,
|
17414 | isBeyondStartPosition: false
|
17415 | },
|
17416 | direction: axis.direction,
|
17417 | destination: {
|
17418 | droppableId: destination.descriptor.id,
|
17419 | index: 0
|
17420 | }
|
17421 | };
|
17422 | return {
|
17423 | pageBorderBoxCenter: withDroppableDisplacement(destination, _newCenter),
|
17424 | impact: _newImpact
|
17425 | };
|
17426 | }
|
17427 |
|
17428 | var targetIndex = insideDestination.indexOf(movingRelativeTo);
|
17429 | !(targetIndex !== -1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'The target was not found within its droppable') : invariant(false) : void 0;
|
17430 | var proposedIndex = isGoingBeforeTarget ? targetIndex : targetIndex + 1;
|
17431 | var newCenter = moveToEdge({
|
17432 | source: draggable.page.borderBox,
|
17433 | sourceEdge: 'start',
|
17434 | destination: movingRelativeTo.page.marginBox,
|
17435 | destinationEdge: isGoingBeforeTarget ? 'start' : 'end',
|
17436 | destinationAxis: axis
|
17437 | });
|
17438 | var displaced = insideDestination.slice(proposedIndex, insideDestination.length).map(function (dimension) {
|
17439 | return getDisplacement({
|
17440 | draggable: dimension,
|
17441 | destination: destination,
|
17442 | viewport: viewport.frame,
|
17443 | previousImpact: previousImpact
|
17444 | });
|
17445 | });
|
17446 | var newImpact = {
|
17447 | movement: {
|
17448 | displaced: displaced,
|
17449 | amount: amount,
|
17450 | isBeyondStartPosition: false
|
17451 | },
|
17452 | direction: axis.direction,
|
17453 | destination: {
|
17454 | droppableId: destination.descriptor.id,
|
17455 | index: proposedIndex
|
17456 | }
|
17457 | };
|
17458 | return {
|
17459 | pageBorderBoxCenter: withDroppableDisplacement(destination, newCenter),
|
17460 | impact: newImpact
|
17461 | };
|
17462 | });
|
17463 |
|
17464 | var moveToNewDroppable = (function (_ref) {
|
17465 | var pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
17466 | destination = _ref.destination,
|
17467 | insideDestination = _ref.insideDestination,
|
17468 | draggable = _ref.draggable,
|
17469 | movingRelativeTo = _ref.movingRelativeTo,
|
17470 | home = _ref.home,
|
17471 | previousImpact = _ref.previousImpact,
|
17472 | viewport = _ref.viewport;
|
17473 | var amount = patch(destination.axis.line, draggable.client.marginBox[destination.axis.size]);
|
17474 |
|
17475 | if (destination.descriptor.id === draggable.descriptor.droppableId) {
|
17476 | !movingRelativeTo ? process.env.NODE_ENV !== "production" ? invariant(false, 'There will always be a target in the original list') : invariant(false) : void 0;
|
17477 | return toHomeList({
|
17478 | amount: amount,
|
17479 | homeIndex: home.index,
|
17480 | movingRelativeTo: movingRelativeTo,
|
17481 | insideDestination: insideDestination,
|
17482 | draggable: draggable,
|
17483 | destination: destination,
|
17484 | previousImpact: previousImpact,
|
17485 | viewport: viewport
|
17486 | });
|
17487 | }
|
17488 |
|
17489 | return toForeignList({
|
17490 | amount: amount,
|
17491 | pageBorderBoxCenter: pageBorderBoxCenter,
|
17492 | movingRelativeTo: movingRelativeTo,
|
17493 | insideDestination: insideDestination,
|
17494 | draggable: draggable,
|
17495 | destination: destination,
|
17496 | previousImpact: previousImpact,
|
17497 | viewport: viewport
|
17498 | });
|
17499 | });
|
17500 |
|
17501 | var moveCrossAxis = (function (_ref) {
|
17502 | var isMovingForward = _ref.isMovingForward,
|
17503 | pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
17504 | draggableId = _ref.draggableId,
|
17505 | droppableId = _ref.droppableId,
|
17506 | home = _ref.home,
|
17507 | draggables = _ref.draggables,
|
17508 | droppables = _ref.droppables,
|
17509 | previousImpact = _ref.previousImpact,
|
17510 | viewport = _ref.viewport;
|
17511 | var draggable = draggables[draggableId];
|
17512 | var source = droppables[droppableId];
|
17513 | var destination = getBestCrossAxisDroppable({
|
17514 | isMovingForward: isMovingForward,
|
17515 | pageBorderBoxCenter: pageBorderBoxCenter,
|
17516 | source: source,
|
17517 | droppables: droppables,
|
17518 | viewport: viewport
|
17519 | });
|
17520 |
|
17521 | if (!destination) {
|
17522 | return null;
|
17523 | }
|
17524 |
|
17525 | var insideDestination = getDraggablesInsideDroppable(destination, draggables);
|
17526 | var movingRelativeTo = getClosestDraggable({
|
17527 | axis: destination.axis,
|
17528 | pageBorderBoxCenter: pageBorderBoxCenter,
|
17529 | destination: destination,
|
17530 | insideDestination: insideDestination,
|
17531 | viewport: viewport
|
17532 | });
|
17533 |
|
17534 | if (insideDestination.length && !movingRelativeTo) {
|
17535 | return null;
|
17536 | }
|
17537 |
|
17538 | return moveToNewDroppable({
|
17539 | pageBorderBoxCenter: pageBorderBoxCenter,
|
17540 | destination: destination,
|
17541 | draggable: draggable,
|
17542 | movingRelativeTo: movingRelativeTo,
|
17543 | insideDestination: insideDestination,
|
17544 | home: home,
|
17545 | previousImpact: previousImpact || noImpact,
|
17546 | viewport: viewport
|
17547 | });
|
17548 | });
|
17549 |
|
17550 | var isTotallyVisibleInNewLocation = (function (_ref) {
|
17551 | var draggable = _ref.draggable,
|
17552 | destination = _ref.destination,
|
17553 | newPageBorderBoxCenter = _ref.newPageBorderBoxCenter,
|
17554 | viewport = _ref.viewport;
|
17555 | var diff = subtract(newPageBorderBoxCenter, draggable.page.borderBox.center);
|
17556 | var shifted = offsetByPosition(draggable.page.borderBox, diff);
|
17557 | return isTotallyVisible({
|
17558 | target: shifted,
|
17559 | destination: destination,
|
17560 | viewport: viewport
|
17561 | });
|
17562 | });
|
17563 |
|
17564 | var withFirstAdded = function withFirstAdded(_ref) {
|
17565 | var add = _ref.add,
|
17566 | previousImpact = _ref.previousImpact,
|
17567 | droppable = _ref.droppable,
|
17568 | draggables = _ref.draggables,
|
17569 | viewport = _ref.viewport;
|
17570 | var newDisplacement = {
|
17571 | draggableId: add,
|
17572 | isVisible: true,
|
17573 | shouldAnimate: true
|
17574 | };
|
17575 | var added = [newDisplacement].concat(previousImpact.movement.displaced);
|
17576 | var withUpdatedVisibility = added.map(function (current) {
|
17577 | if (current === newDisplacement) {
|
17578 | return current;
|
17579 | }
|
17580 |
|
17581 | var updated = getDisplacement({
|
17582 | draggable: draggables[current.draggableId],
|
17583 | destination: droppable,
|
17584 | previousImpact: previousImpact,
|
17585 | viewport: viewport.frame
|
17586 | });
|
17587 | return updated;
|
17588 | });
|
17589 | return withUpdatedVisibility;
|
17590 | };
|
17591 |
|
17592 | var forceVisibleDisplacement = function forceVisibleDisplacement(current) {
|
17593 | if (current.isVisible) {
|
17594 | return current;
|
17595 | }
|
17596 |
|
17597 | return {
|
17598 | draggableId: current.draggableId,
|
17599 | isVisible: true,
|
17600 | shouldAnimate: false
|
17601 | };
|
17602 | };
|
17603 |
|
17604 | var withFirstRemoved = function withFirstRemoved(_ref2) {
|
17605 | var dragging = _ref2.dragging,
|
17606 | isVisibleInNewLocation = _ref2.isVisibleInNewLocation,
|
17607 | previousImpact = _ref2.previousImpact,
|
17608 | droppable = _ref2.droppable,
|
17609 | draggables = _ref2.draggables;
|
17610 | var last = previousImpact.movement.displaced;
|
17611 | !last.length ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot remove displacement from empty list') : invariant(false) : void 0;
|
17612 | var withFirstRestored = last.slice(1, last.length);
|
17613 |
|
17614 | if (!withFirstRestored.length) {
|
17615 | return withFirstRestored;
|
17616 | }
|
17617 |
|
17618 | if (isVisibleInNewLocation) {
|
17619 | return withFirstRestored;
|
17620 | }
|
17621 |
|
17622 | var axis = droppable.axis;
|
17623 | var sizeOfRestored = draggables[last[0].draggableId].page.marginBox[axis.size];
|
17624 | var sizeOfDragging = draggables[dragging].page.marginBox[axis.size];
|
17625 | var buffer = sizeOfRestored + sizeOfDragging;
|
17626 | var withUpdatedVisibility = withFirstRestored.map(function (displacement, index) {
|
17627 | if (index === 0) {
|
17628 | return forceVisibleDisplacement(displacement);
|
17629 | }
|
17630 |
|
17631 | if (buffer > 0) {
|
17632 | var current = draggables[displacement.draggableId];
|
17633 | var size = current.page.marginBox[axis.size];
|
17634 | buffer -= size;
|
17635 | return forceVisibleDisplacement(displacement);
|
17636 | }
|
17637 |
|
17638 | return {
|
17639 | draggableId: displacement.draggableId,
|
17640 | isVisible: false,
|
17641 | shouldAnimate: false
|
17642 | };
|
17643 | });
|
17644 | return withUpdatedVisibility;
|
17645 | };
|
17646 |
|
17647 | var inHomeList$1 = (function (_ref) {
|
17648 | var isMovingForward = _ref.isMovingForward,
|
17649 | draggableId = _ref.draggableId,
|
17650 | previousPageBorderBoxCenter = _ref.previousPageBorderBoxCenter,
|
17651 | previousImpact = _ref.previousImpact,
|
17652 | droppable = _ref.droppable,
|
17653 | draggables = _ref.draggables,
|
17654 | viewport = _ref.viewport;
|
17655 | var location = previousImpact.destination;
|
17656 | !location ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot move to next index in home list when there is no previous destination') : invariant(false) : void 0;
|
17657 | var draggable = draggables[draggableId];
|
17658 | var axis = droppable.axis;
|
17659 | var insideDroppable = getDraggablesInsideDroppable(droppable, draggables);
|
17660 | var startIndex = draggable.descriptor.index;
|
17661 | var currentIndex = location.index;
|
17662 | var proposedIndex = isMovingForward ? currentIndex + 1 : currentIndex - 1;
|
17663 |
|
17664 | if (proposedIndex > insideDroppable.length - 1) {
|
17665 | return null;
|
17666 | }
|
17667 |
|
17668 | if (proposedIndex < 0) {
|
17669 | return null;
|
17670 | }
|
17671 |
|
17672 | var destination = insideDroppable[proposedIndex];
|
17673 | var isMovingTowardStart = isMovingForward && proposedIndex <= startIndex || !isMovingForward && proposedIndex >= startIndex;
|
17674 |
|
17675 | var edge = function () {
|
17676 | if (!isMovingTowardStart) {
|
17677 | return isMovingForward ? 'end' : 'start';
|
17678 | }
|
17679 |
|
17680 | return isMovingForward ? 'start' : 'end';
|
17681 | }();
|
17682 |
|
17683 | var newPageBorderBoxCenter = moveToEdge({
|
17684 | source: draggable.page.borderBox,
|
17685 | sourceEdge: edge,
|
17686 | destination: destination.page.borderBox,
|
17687 | destinationEdge: edge,
|
17688 | destinationAxis: droppable.axis
|
17689 | });
|
17690 | var isVisibleInNewLocation = isTotallyVisibleInNewLocation({
|
17691 | draggable: draggable,
|
17692 | destination: droppable,
|
17693 | newPageBorderBoxCenter: newPageBorderBoxCenter,
|
17694 | viewport: viewport.frame
|
17695 | });
|
17696 | var displaced = isMovingTowardStart ? withFirstRemoved({
|
17697 | dragging: draggableId,
|
17698 | isVisibleInNewLocation: isVisibleInNewLocation,
|
17699 | previousImpact: previousImpact,
|
17700 | droppable: droppable,
|
17701 | draggables: draggables
|
17702 | }) : withFirstAdded({
|
17703 | add: destination.descriptor.id,
|
17704 | previousImpact: previousImpact,
|
17705 | droppable: droppable,
|
17706 | draggables: draggables,
|
17707 | viewport: viewport
|
17708 | });
|
17709 | var newImpact = {
|
17710 | movement: {
|
17711 | displaced: displaced,
|
17712 | amount: patch(axis.line, draggable.page.marginBox[axis.size]),
|
17713 | isBeyondStartPosition: proposedIndex > startIndex
|
17714 | },
|
17715 | destination: {
|
17716 | droppableId: droppable.descriptor.id,
|
17717 | index: proposedIndex
|
17718 | },
|
17719 | direction: droppable.axis.direction
|
17720 | };
|
17721 |
|
17722 | if (isVisibleInNewLocation) {
|
17723 | return {
|
17724 | pageBorderBoxCenter: withDroppableDisplacement(droppable, newPageBorderBoxCenter),
|
17725 | impact: newImpact,
|
17726 | scrollJumpRequest: null
|
17727 | };
|
17728 | }
|
17729 |
|
17730 | var distance$$1 = subtract(newPageBorderBoxCenter, previousPageBorderBoxCenter);
|
17731 | var distanceWithScroll = withDroppableDisplacement(droppable, distance$$1);
|
17732 | return {
|
17733 | pageBorderBoxCenter: previousPageBorderBoxCenter,
|
17734 | impact: newImpact,
|
17735 | scrollJumpRequest: distanceWithScroll
|
17736 | };
|
17737 | });
|
17738 |
|
17739 | var inForeignList$1 = (function (_ref) {
|
17740 | var isMovingForward = _ref.isMovingForward,
|
17741 | draggableId = _ref.draggableId,
|
17742 | previousImpact = _ref.previousImpact,
|
17743 | previousPageBorderBoxCenter = _ref.previousPageBorderBoxCenter,
|
17744 | droppable = _ref.droppable,
|
17745 | draggables = _ref.draggables,
|
17746 | viewport = _ref.viewport;
|
17747 | !previousImpact.destination ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot move to next index where there is no previous destination') : invariant(false) : void 0;
|
17748 | var location = previousImpact.destination;
|
17749 | var draggable = draggables[draggableId];
|
17750 | var axis = droppable.axis;
|
17751 | var insideForeignDroppable = getDraggablesInsideDroppable(droppable, draggables);
|
17752 | var currentIndex = location.index;
|
17753 | var proposedIndex = isMovingForward ? currentIndex + 1 : currentIndex - 1;
|
17754 | var lastIndex = insideForeignDroppable.length - 1;
|
17755 |
|
17756 | if (proposedIndex > insideForeignDroppable.length) {
|
17757 | return null;
|
17758 | }
|
17759 |
|
17760 | if (proposedIndex < 0) {
|
17761 | return null;
|
17762 | }
|
17763 |
|
17764 | var movingRelativeTo = insideForeignDroppable[Math.min(proposedIndex, lastIndex)];
|
17765 | var isMovingPastLastIndex = proposedIndex > lastIndex;
|
17766 | var sourceEdge = 'start';
|
17767 |
|
17768 | var destinationEdge = function () {
|
17769 | if (isMovingPastLastIndex) {
|
17770 | return 'end';
|
17771 | }
|
17772 |
|
17773 | return 'start';
|
17774 | }();
|
17775 |
|
17776 | var newPageBorderBoxCenter = moveToEdge({
|
17777 | source: draggable.page.borderBox,
|
17778 | sourceEdge: sourceEdge,
|
17779 | destination: movingRelativeTo.page.marginBox,
|
17780 | destinationEdge: destinationEdge,
|
17781 | destinationAxis: droppable.axis
|
17782 | });
|
17783 | var isVisibleInNewLocation = isTotallyVisibleInNewLocation({
|
17784 | draggable: draggable,
|
17785 | destination: droppable,
|
17786 | newPageBorderBoxCenter: newPageBorderBoxCenter,
|
17787 | viewport: viewport.frame
|
17788 | });
|
17789 |
|
17790 | var displaced = function () {
|
17791 | if (isMovingForward) {
|
17792 | return withFirstRemoved({
|
17793 | dragging: draggableId,
|
17794 | isVisibleInNewLocation: isVisibleInNewLocation,
|
17795 | previousImpact: previousImpact,
|
17796 | droppable: droppable,
|
17797 | draggables: draggables
|
17798 | });
|
17799 | }
|
17800 |
|
17801 | return withFirstAdded({
|
17802 | add: movingRelativeTo.descriptor.id,
|
17803 | previousImpact: previousImpact,
|
17804 | droppable: droppable,
|
17805 | draggables: draggables,
|
17806 | viewport: viewport
|
17807 | });
|
17808 | }();
|
17809 |
|
17810 | var newImpact = {
|
17811 | movement: {
|
17812 | displaced: displaced,
|
17813 | amount: patch(axis.line, draggable.page.marginBox[axis.size]),
|
17814 | isBeyondStartPosition: false
|
17815 | },
|
17816 | destination: {
|
17817 | droppableId: droppable.descriptor.id,
|
17818 | index: proposedIndex
|
17819 | },
|
17820 | direction: droppable.axis.direction
|
17821 | };
|
17822 |
|
17823 | if (isVisibleInNewLocation) {
|
17824 | return {
|
17825 | pageBorderBoxCenter: withDroppableDisplacement(droppable, newPageBorderBoxCenter),
|
17826 | impact: newImpact,
|
17827 | scrollJumpRequest: null
|
17828 | };
|
17829 | }
|
17830 |
|
17831 | var distanceMoving = subtract(newPageBorderBoxCenter, previousPageBorderBoxCenter);
|
17832 | var distanceWithScroll = withDroppableDisplacement(droppable, distanceMoving);
|
17833 | return {
|
17834 | pageBorderBoxCenter: previousPageBorderBoxCenter,
|
17835 | impact: newImpact,
|
17836 | scrollJumpRequest: distanceWithScroll
|
17837 | };
|
17838 | });
|
17839 |
|
17840 | var moveToNextIndex = (function (args) {
|
17841 | var draggableId = args.draggableId,
|
17842 | draggables = args.draggables,
|
17843 | droppable = args.droppable;
|
17844 | var draggable = draggables[draggableId];
|
17845 | var isInHomeList = draggable.descriptor.droppableId === droppable.descriptor.id;
|
17846 |
|
17847 | if (!droppable.isEnabled) {
|
17848 | return null;
|
17849 | }
|
17850 |
|
17851 | if (isInHomeList) {
|
17852 | return inHomeList$1(args);
|
17853 | }
|
17854 |
|
17855 | return inForeignList$1(args);
|
17856 | });
|
17857 |
|
17858 | var getClientSelection = function getClientSelection(pageBorderBoxCenter, currentScroll) {
|
17859 | return subtract(pageBorderBoxCenter, currentScroll);
|
17860 | };
|
17861 |
|
17862 | var moveInDirection = (function (_ref) {
|
17863 | var state = _ref.state,
|
17864 | type = _ref.type;
|
17865 |
|
17866 | var _ref2 = function () {
|
17867 | if (state.impact.destination) {
|
17868 | return {
|
17869 | droppable: state.dimensions.droppables[state.impact.destination.droppableId],
|
17870 | isMainAxisMovementAllowed: true
|
17871 | };
|
17872 | }
|
17873 |
|
17874 | return {
|
17875 | droppable: state.dimensions.droppables[state.critical.droppable.id],
|
17876 | isMainAxisMovementAllowed: false
|
17877 | };
|
17878 | }(),
|
17879 | droppable = _ref2.droppable,
|
17880 | isMainAxisMovementAllowed = _ref2.isMainAxisMovementAllowed;
|
17881 |
|
17882 | var direction = droppable.axis.direction;
|
17883 | var isMovingOnMainAxis = direction === 'vertical' && (type === 'MOVE_UP' || type === 'MOVE_DOWN') || direction === 'horizontal' && (type === 'MOVE_LEFT' || type === 'MOVE_RIGHT');
|
17884 |
|
17885 | if (isMovingOnMainAxis && !isMainAxisMovementAllowed) {
|
17886 | return null;
|
17887 | }
|
17888 |
|
17889 | var isMovingForward = type === 'MOVE_DOWN' || type === 'MOVE_RIGHT';
|
17890 |
|
17891 | if (isMovingOnMainAxis) {
|
17892 | var _result = moveToNextIndex({
|
17893 | isMovingForward: isMovingForward,
|
17894 | draggableId: state.critical.draggable.id,
|
17895 | droppable: droppable,
|
17896 | draggables: state.dimensions.draggables,
|
17897 | previousPageBorderBoxCenter: state.current.page.borderBoxCenter,
|
17898 | previousImpact: state.impact,
|
17899 | viewport: state.viewport
|
17900 | });
|
17901 |
|
17902 | if (!_result) {
|
17903 | return null;
|
17904 | }
|
17905 |
|
17906 | return {
|
17907 | impact: _result.impact,
|
17908 | clientSelection: getClientSelection(_result.pageBorderBoxCenter, state.viewport.scroll.current),
|
17909 | scrollJumpRequest: _result.scrollJumpRequest
|
17910 | };
|
17911 | }
|
17912 |
|
17913 | var home = getHomeLocation(state.critical);
|
17914 | var result = moveCrossAxis({
|
17915 | isMovingForward: isMovingForward,
|
17916 | pageBorderBoxCenter: state.current.page.borderBoxCenter,
|
17917 | draggableId: state.critical.draggable.id,
|
17918 | droppableId: droppable.descriptor.id,
|
17919 | home: home,
|
17920 | draggables: state.dimensions.draggables,
|
17921 | droppables: state.dimensions.droppables,
|
17922 | previousImpact: state.impact,
|
17923 | viewport: state.viewport
|
17924 | });
|
17925 |
|
17926 | if (!result) {
|
17927 | return null;
|
17928 | }
|
17929 |
|
17930 | return {
|
17931 | clientSelection: getClientSelection(result.pageBorderBoxCenter, state.viewport.scroll.current),
|
17932 | impact: result.impact,
|
17933 | scrollJumpRequest: null
|
17934 | };
|
17935 | });
|
17936 |
|
17937 | var scrollViewport = (function (viewport, newScroll) {
|
17938 | var diff = subtract(newScroll, viewport.scroll.initial);
|
17939 | var displacement = negate(diff);
|
17940 | var frame = cssBoxModel.getRect({
|
17941 | top: newScroll.y,
|
17942 | bottom: newScroll.y + viewport.frame.height,
|
17943 | left: newScroll.x,
|
17944 | right: newScroll.x + viewport.frame.width
|
17945 | });
|
17946 | var updated = {
|
17947 | frame: frame,
|
17948 | scroll: {
|
17949 | initial: viewport.scroll.initial,
|
17950 | max: viewport.scroll.max,
|
17951 | current: newScroll,
|
17952 | diff: {
|
17953 | value: diff,
|
17954 | displacement: displacement
|
17955 | }
|
17956 | }
|
17957 | };
|
17958 | return updated;
|
17959 | });
|
17960 |
|
17961 | var getHomeImpact = (function (critical, dimensions) {
|
17962 | var home = dimensions.droppables[critical.droppable.id];
|
17963 | var axis = home.axis;
|
17964 | var draggable = dimensions.draggables[critical.draggable.id];
|
17965 | return {
|
17966 | movement: {
|
17967 | displaced: [],
|
17968 | isBeyondStartPosition: false,
|
17969 | amount: patch(axis.line, draggable.client.marginBox[axis.size])
|
17970 | },
|
17971 | direction: axis.direction,
|
17972 | destination: getHomeLocation(critical)
|
17973 | };
|
17974 | });
|
17975 |
|
17976 | var getPageItemPositions = (function (client, windowScroll) {
|
17977 | return {
|
17978 | selection: add(client.selection, windowScroll),
|
17979 | borderBoxCenter: add(client.borderBoxCenter, windowScroll),
|
17980 | offset: add(client.offset, windowScroll)
|
17981 | };
|
17982 | });
|
17983 |
|
17984 | function isMovementAllowed(state) {
|
17985 | return state.phase === 'DRAGGING' || state.phase === 'COLLECTING';
|
17986 | }
|
17987 |
|
17988 | var idle = {
|
17989 | phase: 'IDLE'
|
17990 | };
|
17991 | var preparing = {
|
17992 | phase: 'PREPARING'
|
17993 | };
|
17994 |
|
17995 | var moveWithPositionUpdates = function moveWithPositionUpdates(_ref) {
|
17996 | var state = _ref.state,
|
17997 | clientSelection = _ref.clientSelection,
|
17998 | shouldAnimate = _ref.shouldAnimate,
|
17999 | viewport = _ref.viewport,
|
18000 | impact = _ref.impact,
|
18001 | scrollJumpRequest = _ref.scrollJumpRequest;
|
18002 | var newViewport = viewport || state.viewport;
|
18003 | var currentWindowScroll = newViewport.scroll.current;
|
18004 |
|
18005 | var client = function () {
|
18006 | var offset = subtract(clientSelection, state.initial.client.selection);
|
18007 | return {
|
18008 | offset: offset,
|
18009 | selection: clientSelection,
|
18010 | borderBoxCenter: add(state.initial.client.borderBoxCenter, offset)
|
18011 | };
|
18012 | }();
|
18013 |
|
18014 | var page = getPageItemPositions(client, currentWindowScroll);
|
18015 | var current = {
|
18016 | client: client,
|
18017 | page: page
|
18018 | };
|
18019 |
|
18020 | if (state.phase === 'COLLECTING') {
|
18021 | return _extends({
|
18022 | phase: 'COLLECTING'
|
18023 | }, state, {
|
18024 | current: current
|
18025 | });
|
18026 | }
|
18027 |
|
18028 | var newImpact = impact || getDragImpact({
|
18029 | pageBorderBoxCenter: page.borderBoxCenter,
|
18030 | draggable: state.dimensions.draggables[state.critical.draggable.id],
|
18031 | draggables: state.dimensions.draggables,
|
18032 | droppables: state.dimensions.droppables,
|
18033 | previousImpact: state.impact,
|
18034 | viewport: newViewport
|
18035 | });
|
18036 |
|
18037 | var result = _extends({}, state, {
|
18038 | current: current,
|
18039 | shouldAnimate: shouldAnimate,
|
18040 | impact: newImpact,
|
18041 | scrollJumpRequest: scrollJumpRequest || null,
|
18042 | viewport: newViewport
|
18043 | });
|
18044 |
|
18045 | return result;
|
18046 | };
|
18047 |
|
18048 | var reducer = (function (state, action) {
|
18049 | if (state === void 0) {
|
18050 | state = idle;
|
18051 | }
|
18052 |
|
18053 | if (action.type === 'CLEAN') {
|
18054 | return idle;
|
18055 | }
|
18056 |
|
18057 | if (action.type === 'PREPARE') {
|
18058 | return preparing;
|
18059 | }
|
18060 |
|
18061 | if (action.type === 'INITIAL_PUBLISH') {
|
18062 | !(state.phase === 'PREPARING') ? process.env.NODE_ENV !== "production" ? invariant(false, 'INITIAL_PUBLISH must come after a PREPARING phase') : invariant(false) : void 0;
|
18063 | var _action$payload = action.payload,
|
18064 | critical = _action$payload.critical,
|
18065 | client = _action$payload.client,
|
18066 | viewport = _action$payload.viewport,
|
18067 | dimensions = _action$payload.dimensions,
|
18068 | autoScrollMode = _action$payload.autoScrollMode;
|
18069 | var initial = {
|
18070 | client: client,
|
18071 | page: {
|
18072 | selection: add(client.selection, viewport.scroll.initial),
|
18073 | borderBoxCenter: add(client.selection, viewport.scroll.initial),
|
18074 | offset: origin
|
18075 | }
|
18076 | };
|
18077 | var result = {
|
18078 | phase: 'DRAGGING',
|
18079 | isDragging: true,
|
18080 | critical: critical,
|
18081 | autoScrollMode: autoScrollMode,
|
18082 | dimensions: dimensions,
|
18083 | initial: initial,
|
18084 | current: initial,
|
18085 | impact: getHomeImpact(critical, dimensions),
|
18086 | viewport: viewport,
|
18087 | scrollJumpRequest: null,
|
18088 | shouldAnimate: false
|
18089 | };
|
18090 | return result;
|
18091 | }
|
18092 |
|
18093 | if (action.type === 'COLLECTION_STARTING') {
|
18094 | var _extends2;
|
18095 |
|
18096 | if (state.phase === 'COLLECTING' || state.phase === 'DROP_PENDING') {
|
18097 | return state;
|
18098 | }
|
18099 |
|
18100 | !(state.phase === 'DRAGGING') ? process.env.NODE_ENV !== "production" ? invariant(false, "Collection cannot start from phase " + state.phase) : invariant(false) : void 0;
|
18101 |
|
18102 | var _result = _extends({
|
18103 | phase: 'COLLECTING'
|
18104 | }, state, (_extends2 = {}, _extends2["phase"] = 'COLLECTING', _extends2));
|
18105 |
|
18106 | return _result;
|
18107 | }
|
18108 |
|
18109 | if (action.type === 'PUBLISH') {
|
18110 | !(state.phase === 'COLLECTING' || state.phase === 'DROP_PENDING') ? process.env.NODE_ENV !== "production" ? invariant(false, "Unexpected " + action.type + " received in phase " + state.phase) : invariant(false) : void 0;
|
18111 | process.env.NODE_ENV !== "production" ? invariant(false, "Dynamic additions and removals of Draggable and Droppable components\n is currently not supported. But will be soon!") : invariant(false);
|
18112 | }
|
18113 |
|
18114 | if (action.type === 'MOVE') {
|
18115 | if (state.phase === 'PREPARING') {
|
18116 | return state;
|
18117 | }
|
18118 |
|
18119 | if (state.phase === 'DROP_PENDING') {
|
18120 | return state;
|
18121 | }
|
18122 |
|
18123 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false, action.type + " not permitted in phase " + state.phase) : invariant(false) : void 0;
|
18124 | var _action$payload2 = action.payload,
|
18125 | _client = _action$payload2.client,
|
18126 | shouldAnimate = _action$payload2.shouldAnimate;
|
18127 |
|
18128 | if (state.shouldAnimate === shouldAnimate && isEqual(_client, state.current.client.selection)) {
|
18129 | return state;
|
18130 | }
|
18131 |
|
18132 | var impact = state.autoScrollMode === 'JUMP' ? state.impact : null;
|
18133 | return moveWithPositionUpdates({
|
18134 | state: state,
|
18135 | clientSelection: _client,
|
18136 | impact: impact,
|
18137 | shouldAnimate: shouldAnimate
|
18138 | });
|
18139 | }
|
18140 |
|
18141 | if (action.type === 'UPDATE_DROPPABLE_SCROLL') {
|
18142 | var _extends3, _extends4;
|
18143 |
|
18144 | if (state.phase === 'PREPARING') {
|
18145 | return state;
|
18146 | }
|
18147 |
|
18148 | if (state.phase === 'DROP_PENDING') {
|
18149 | return state;
|
18150 | }
|
18151 |
|
18152 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false, action.type + " not permitted in phase " + state.phase) : invariant(false) : void 0;
|
18153 | var _action$payload3 = action.payload,
|
18154 | id = _action$payload3.id,
|
18155 | offset = _action$payload3.offset;
|
18156 | var target = state.dimensions.droppables[id];
|
18157 |
|
18158 | if (!target) {
|
18159 | return state;
|
18160 | }
|
18161 |
|
18162 | var updated = scrollDroppable(target, offset);
|
18163 |
|
18164 | var _dimensions = _extends({}, state.dimensions, {
|
18165 | droppables: _extends({}, state.dimensions.droppables, (_extends3 = {}, _extends3[id] = updated, _extends3))
|
18166 | });
|
18167 |
|
18168 | var _impact = function () {
|
18169 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
18170 |
|
18171 | if (state.autoScrollMode === 'JUMP') {
|
18172 | return state.impact;
|
18173 | }
|
18174 |
|
18175 | return getDragImpact({
|
18176 | pageBorderBoxCenter: state.current.page.borderBoxCenter,
|
18177 | draggable: _dimensions.draggables[state.critical.draggable.id],
|
18178 | draggables: _dimensions.draggables,
|
18179 | droppables: _dimensions.droppables,
|
18180 | previousImpact: state.impact,
|
18181 | viewport: state.viewport
|
18182 | });
|
18183 | }();
|
18184 |
|
18185 | return _extends({
|
18186 | phase: 'DRAGGING'
|
18187 | }, state, (_extends4 = {}, _extends4["phase"] = state.phase, _extends4.impact = _impact, _extends4.dimensions = _dimensions, _extends4.scrollJumpRequest = null, _extends4));
|
18188 | }
|
18189 |
|
18190 | if (action.type === 'UPDATE_DROPPABLE_IS_ENABLED') {
|
18191 | var _extends5, _extends6;
|
18192 |
|
18193 | if (state.phase === 'DROP_PENDING') {
|
18194 | return state;
|
18195 | }
|
18196 |
|
18197 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false, "Attempting to move in an unsupported phase " + state.phase) : invariant(false) : void 0;
|
18198 | var _action$payload4 = action.payload,
|
18199 | _id = _action$payload4.id,
|
18200 | isEnabled = _action$payload4.isEnabled;
|
18201 | var _target = state.dimensions.droppables[_id];
|
18202 | !_target ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot find Droppable[id: " + _id + "] to toggle its enabled state") : invariant(false) : void 0;
|
18203 | !(_target.isEnabled !== isEnabled) ? process.env.NODE_ENV !== "production" ? invariant(false, "Trying to set droppable isEnabled to " + String(isEnabled) + "\n but it is already " + String(_target.isEnabled)) : invariant(false) : void 0;
|
18204 |
|
18205 | var _updated = _extends({}, _target, {
|
18206 | isEnabled: isEnabled
|
18207 | });
|
18208 |
|
18209 | var _dimensions2 = _extends({}, state.dimensions, {
|
18210 | droppables: _extends({}, state.dimensions.droppables, (_extends5 = {}, _extends5[_id] = _updated, _extends5))
|
18211 | });
|
18212 |
|
18213 | var _impact2 = getDragImpact({
|
18214 | pageBorderBoxCenter: state.current.page.borderBoxCenter,
|
18215 | draggable: _dimensions2.draggables[state.critical.draggable.id],
|
18216 | draggables: _dimensions2.draggables,
|
18217 | droppables: _dimensions2.droppables,
|
18218 | previousImpact: state.impact,
|
18219 | viewport: state.viewport
|
18220 | });
|
18221 |
|
18222 | return _extends({
|
18223 | phase: 'DRAGGING'
|
18224 | }, state, (_extends6 = {}, _extends6["phase"] = state.phase, _extends6.impact = _impact2, _extends6.dimensions = _dimensions2, _extends6));
|
18225 | }
|
18226 |
|
18227 | if (action.type === 'MOVE_BY_WINDOW_SCROLL') {
|
18228 | if (state.phase === 'PREPARING') {
|
18229 | return state;
|
18230 | }
|
18231 |
|
18232 | if (state.phase === 'DROP_PENDING' || state.phase === 'DROP_ANIMATING') {
|
18233 | return state;
|
18234 | }
|
18235 |
|
18236 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot move by window in phase " + state.phase) : invariant(false) : void 0;
|
18237 | var newScroll = action.payload.scroll;
|
18238 |
|
18239 | if (isEqual(state.viewport.scroll.current, newScroll)) {
|
18240 | return state;
|
18241 | }
|
18242 |
|
18243 | var isJumpScrolling = state.autoScrollMode === 'JUMP';
|
18244 |
|
18245 | var _impact3 = isJumpScrolling ? state.impact : null;
|
18246 |
|
18247 | var _viewport = scrollViewport(state.viewport, newScroll);
|
18248 |
|
18249 | return moveWithPositionUpdates({
|
18250 | state: state,
|
18251 | clientSelection: state.current.client.selection,
|
18252 | viewport: _viewport,
|
18253 | shouldAnimate: false,
|
18254 | impact: _impact3
|
18255 | });
|
18256 | }
|
18257 |
|
18258 | if (action.type === 'UPDATE_VIEWPORT_MAX_SCROLL') {
|
18259 | var _extends7;
|
18260 |
|
18261 | !state.isDragging ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot update the max viewport scroll if not dragging') : invariant(false) : void 0;
|
18262 | var existing = state.viewport;
|
18263 |
|
18264 | var _viewport2 = _extends({}, existing, {
|
18265 | scroll: _extends({}, existing.scroll, {
|
18266 | max: action.payload
|
18267 | })
|
18268 | });
|
18269 |
|
18270 | return _extends({
|
18271 | phase: 'DRAGGING'
|
18272 | }, state, (_extends7 = {}, _extends7["phase"] = state.phase, _extends7.viewport = _viewport2, _extends7));
|
18273 | }
|
18274 |
|
18275 | if (action.type === 'MOVE_UP' || action.type === 'MOVE_DOWN' || action.type === 'MOVE_LEFT' || action.type === 'MOVE_RIGHT') {
|
18276 | if (state.phase === 'PREPARING') {
|
18277 | return state;
|
18278 | }
|
18279 |
|
18280 | if (state.phase === 'COLLECTING' || state.phase === 'DROP_PENDING') {
|
18281 | return state;
|
18282 | }
|
18283 |
|
18284 | !(state.phase === 'DRAGGING') ? process.env.NODE_ENV !== "production" ? invariant(false, action.type + " received while not in DRAGGING phase") : invariant(false) : void 0;
|
18285 |
|
18286 | var _result2 = moveInDirection({
|
18287 | state: state,
|
18288 | type: action.type
|
18289 | });
|
18290 |
|
18291 | if (!_result2) {
|
18292 | return state;
|
18293 | }
|
18294 |
|
18295 | return moveWithPositionUpdates({
|
18296 | state: state,
|
18297 | impact: _result2.impact,
|
18298 | clientSelection: _result2.clientSelection,
|
18299 | shouldAnimate: true,
|
18300 | scrollJumpRequest: _result2.scrollJumpRequest
|
18301 | });
|
18302 | }
|
18303 |
|
18304 | if (action.type === 'DROP_PENDING') {
|
18305 | var _extends8;
|
18306 |
|
18307 | var reason = action.payload.reason;
|
18308 | !(state.phase === 'COLLECTING') ? process.env.NODE_ENV !== "production" ? invariant(false, 'Can only move into the DROP_PENDING phase from the COLLECTING phase') : invariant(false) : void 0;
|
18309 |
|
18310 | var newState = _extends({
|
18311 | phase: 'DROP_PENDING'
|
18312 | }, state, (_extends8 = {}, _extends8["phase"] = 'DROP_PENDING', _extends8.isWaiting = true, _extends8.reason = reason, _extends8));
|
18313 |
|
18314 | return newState;
|
18315 | }
|
18316 |
|
18317 | if (action.type === 'DROP_ANIMATE') {
|
18318 | var pending = action.payload;
|
18319 | !(state.phase === 'DRAGGING' || state.phase === 'DROP_PENDING') ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot animate drop from phase " + state.phase) : invariant(false) : void 0;
|
18320 | var _result3 = {
|
18321 | phase: 'DROP_ANIMATING',
|
18322 | pending: pending,
|
18323 | dimensions: state.dimensions
|
18324 | };
|
18325 | return _result3;
|
18326 | }
|
18327 |
|
18328 | if (action.type === 'DROP_COMPLETE') {
|
18329 | return idle;
|
18330 | }
|
18331 |
|
18332 | return state;
|
18333 | });
|
18334 |
|
18335 | var lift = function lift(args) {
|
18336 | return {
|
18337 | type: 'LIFT',
|
18338 | payload: args
|
18339 | };
|
18340 | };
|
18341 | var initialPublish = function initialPublish(args) {
|
18342 | return {
|
18343 | type: 'INITIAL_PUBLISH',
|
18344 | payload: args
|
18345 | };
|
18346 | };
|
18347 | var publish = function publish(args) {
|
18348 | return {
|
18349 | type: 'PUBLISH',
|
18350 | payload: args
|
18351 | };
|
18352 | };
|
18353 | var collectionStarting = function collectionStarting() {
|
18354 | return {
|
18355 | type: 'COLLECTION_STARTING',
|
18356 | payload: null
|
18357 | };
|
18358 | };
|
18359 | var updateDroppableScroll = function updateDroppableScroll(args) {
|
18360 | return {
|
18361 | type: 'UPDATE_DROPPABLE_SCROLL',
|
18362 | payload: args
|
18363 | };
|
18364 | };
|
18365 | var updateDroppableIsEnabled = function updateDroppableIsEnabled(args) {
|
18366 | return {
|
18367 | type: 'UPDATE_DROPPABLE_IS_ENABLED',
|
18368 | payload: args
|
18369 | };
|
18370 | };
|
18371 | var move = function move(args) {
|
18372 | return {
|
18373 | type: 'MOVE',
|
18374 | payload: args
|
18375 | };
|
18376 | };
|
18377 | var moveByWindowScroll = function moveByWindowScroll(args) {
|
18378 | return {
|
18379 | type: 'MOVE_BY_WINDOW_SCROLL',
|
18380 | payload: args
|
18381 | };
|
18382 | };
|
18383 | var updateViewportMaxScroll = function updateViewportMaxScroll(max) {
|
18384 | return {
|
18385 | type: 'UPDATE_VIEWPORT_MAX_SCROLL',
|
18386 | payload: max
|
18387 | };
|
18388 | };
|
18389 | var moveUp = function moveUp() {
|
18390 | return {
|
18391 | type: 'MOVE_UP',
|
18392 | payload: null
|
18393 | };
|
18394 | };
|
18395 | var moveDown = function moveDown() {
|
18396 | return {
|
18397 | type: 'MOVE_DOWN',
|
18398 | payload: null
|
18399 | };
|
18400 | };
|
18401 | var moveRight = function moveRight() {
|
18402 | return {
|
18403 | type: 'MOVE_RIGHT',
|
18404 | payload: null
|
18405 | };
|
18406 | };
|
18407 | var moveLeft = function moveLeft() {
|
18408 | return {
|
18409 | type: 'MOVE_LEFT',
|
18410 | payload: null
|
18411 | };
|
18412 | };
|
18413 | var clean = function clean() {
|
18414 | return {
|
18415 | type: 'CLEAN',
|
18416 | payload: null
|
18417 | };
|
18418 | };
|
18419 | var prepare = function prepare() {
|
18420 | return {
|
18421 | type: 'PREPARE',
|
18422 | payload: null
|
18423 | };
|
18424 | };
|
18425 | var animateDrop = function animateDrop(pending) {
|
18426 | return {
|
18427 | type: 'DROP_ANIMATE',
|
18428 | payload: pending
|
18429 | };
|
18430 | };
|
18431 | var completeDrop = function completeDrop(result) {
|
18432 | return {
|
18433 | type: 'DROP_COMPLETE',
|
18434 | payload: result
|
18435 | };
|
18436 | };
|
18437 | var drop = function drop(args) {
|
18438 | return {
|
18439 | type: 'DROP',
|
18440 | payload: args
|
18441 | };
|
18442 | };
|
18443 | var dropPending = function dropPending(args) {
|
18444 | return {
|
18445 | type: 'DROP_PENDING',
|
18446 | payload: args
|
18447 | };
|
18448 | };
|
18449 | var dropAnimationFinished = function dropAnimationFinished() {
|
18450 | return {
|
18451 | type: 'DROP_ANIMATION_FINISHED',
|
18452 | payload: null
|
18453 | };
|
18454 | };
|
18455 |
|
18456 | var lift$1 = (function (getMarshal) {
|
18457 | var timeoutId = null;
|
18458 |
|
18459 | var tryAbortCriticalCollection = function tryAbortCriticalCollection() {
|
18460 | if (timeoutId == null) {
|
18461 | return;
|
18462 | }
|
18463 |
|
18464 | clearTimeout(timeoutId);
|
18465 | timeoutId = null;
|
18466 | };
|
18467 |
|
18468 | return function (_ref) {
|
18469 | var getState = _ref.getState,
|
18470 | dispatch = _ref.dispatch;
|
18471 | return function (next) {
|
18472 | return function (action) {
|
18473 | if (action.type === 'CLEAN') {
|
18474 | tryAbortCriticalCollection();
|
18475 | next(action);
|
18476 | return;
|
18477 | }
|
18478 |
|
18479 | if (action.type !== 'LIFT') {
|
18480 | next(action);
|
18481 | return;
|
18482 | }
|
18483 |
|
18484 | !!timeoutId ? process.env.NODE_ENV !== "production" ? invariant(false, 'There should not be a pending complete lift phase when a lift action is fired') : invariant(false) : void 0;
|
18485 | var marshal = getMarshal();
|
18486 | var _action$payload = action.payload,
|
18487 | id = _action$payload.id,
|
18488 | client = _action$payload.client,
|
18489 | autoScrollMode = _action$payload.autoScrollMode,
|
18490 | viewport = _action$payload.viewport;
|
18491 | var initial = getState();
|
18492 |
|
18493 | if (initial.phase === 'DROP_ANIMATING') {
|
18494 | dispatch(completeDrop(initial.pending.result));
|
18495 | }
|
18496 |
|
18497 | var postFlushState = getState();
|
18498 | !(postFlushState.phase === 'IDLE') ? process.env.NODE_ENV !== "production" ? invariant(false, 'Incorrect phase to start a drag') : invariant(false) : void 0;
|
18499 | dispatch(prepare());
|
18500 | timeoutId = setTimeout(function () {
|
18501 | timeoutId = null;
|
18502 | var state = getState();
|
18503 | !(state.phase === 'PREPARING') ? process.env.NODE_ENV !== "production" ? invariant(false, 'Invalid phase for completing lift') : invariant(false) : void 0;
|
18504 | var scrollOptions = {
|
18505 | shouldPublishImmediately: autoScrollMode === 'JUMP'
|
18506 | };
|
18507 | var request = {
|
18508 | draggableId: id,
|
18509 | scrollOptions: scrollOptions
|
18510 | };
|
18511 |
|
18512 | var _marshal$startPublish = marshal.startPublishing(request, viewport.scroll.current),
|
18513 | critical = _marshal$startPublish.critical,
|
18514 | dimensions = _marshal$startPublish.dimensions;
|
18515 |
|
18516 | dispatch(initialPublish({
|
18517 | critical: critical,
|
18518 | dimensions: dimensions,
|
18519 | client: client,
|
18520 | autoScrollMode: autoScrollMode,
|
18521 | viewport: viewport
|
18522 | }));
|
18523 | });
|
18524 | };
|
18525 | };
|
18526 | };
|
18527 | });
|
18528 |
|
18529 | var style = (function (marshal) {
|
18530 | return function () {
|
18531 | return function (next) {
|
18532 | return function (action) {
|
18533 | if (action.type === 'INITIAL_PUBLISH') {
|
18534 | marshal.dragging();
|
18535 | }
|
18536 |
|
18537 | if (action.type === 'COLLECTION_STARTING') {
|
18538 | marshal.collecting();
|
18539 | }
|
18540 |
|
18541 | if (action.type === 'PUBLISH') {
|
18542 | marshal.dragging();
|
18543 | }
|
18544 |
|
18545 | if (action.type === 'DROP_ANIMATE') {
|
18546 | marshal.dropping(action.payload.result.reason);
|
18547 | }
|
18548 |
|
18549 | if (action.type === 'CLEAN' || action.type === 'DROP_COMPLETE') {
|
18550 | marshal.resting();
|
18551 | }
|
18552 |
|
18553 | next(action);
|
18554 | };
|
18555 | };
|
18556 | };
|
18557 | });
|
18558 |
|
18559 | var getNewHomeClientBorderBoxCenter = (function (_ref) {
|
18560 | var movement = _ref.movement,
|
18561 | draggable = _ref.draggable,
|
18562 | draggables = _ref.draggables,
|
18563 | destination = _ref.destination;
|
18564 | var originalCenter = draggable.client.borderBox.center;
|
18565 |
|
18566 | if (destination == null) {
|
18567 | return originalCenter;
|
18568 | }
|
18569 |
|
18570 | var displaced = movement.displaced,
|
18571 | isBeyondStartPosition = movement.isBeyondStartPosition;
|
18572 | var axis = destination.axis;
|
18573 | var isWithinHomeDroppable = destination.descriptor.id === draggable.descriptor.droppableId;
|
18574 |
|
18575 | if (isWithinHomeDroppable && !displaced.length) {
|
18576 | return originalCenter;
|
18577 | }
|
18578 |
|
18579 | var draggablesInDestination = getDraggablesInsideDroppable(destination, draggables);
|
18580 |
|
18581 | var movingRelativeTo = function () {
|
18582 | if (isWithinHomeDroppable) {
|
18583 | return draggables[displaced[0].draggableId].client.borderBox;
|
18584 | }
|
18585 |
|
18586 | if (displaced.length) {
|
18587 | return draggables[displaced[0].draggableId].client.borderBox;
|
18588 | }
|
18589 |
|
18590 | if (draggablesInDestination.length) {
|
18591 | return draggablesInDestination[draggablesInDestination.length - 1].client.marginBox;
|
18592 | }
|
18593 |
|
18594 | return destination.client.contentBox;
|
18595 | }();
|
18596 |
|
18597 | var _ref2 = function () {
|
18598 | if (isWithinHomeDroppable) {
|
18599 | if (isBeyondStartPosition) {
|
18600 | return {
|
18601 | sourceEdge: 'end',
|
18602 | destinationEdge: 'end'
|
18603 | };
|
18604 | }
|
18605 |
|
18606 | return {
|
18607 | sourceEdge: 'start',
|
18608 | destinationEdge: 'start'
|
18609 | };
|
18610 | }
|
18611 |
|
18612 | if (!displaced.length && draggablesInDestination.length) {
|
18613 | return {
|
18614 | sourceEdge: 'start',
|
18615 | destinationEdge: 'end'
|
18616 | };
|
18617 | }
|
18618 |
|
18619 | return {
|
18620 | sourceEdge: 'start',
|
18621 | destinationEdge: 'start'
|
18622 | };
|
18623 | }(),
|
18624 | sourceEdge = _ref2.sourceEdge,
|
18625 | destinationEdge = _ref2.destinationEdge;
|
18626 |
|
18627 | var source = draggable.client.borderBox;
|
18628 | var targetCenter = moveToEdge({
|
18629 | source: source,
|
18630 | sourceEdge: sourceEdge,
|
18631 | destination: movingRelativeTo,
|
18632 | destinationEdge: destinationEdge,
|
18633 | destinationAxis: axis
|
18634 | });
|
18635 | return targetCenter;
|
18636 | });
|
18637 |
|
18638 | var getScrollDisplacement = function getScrollDisplacement(droppable, viewport) {
|
18639 | return withDroppableDisplacement(droppable, viewport.scroll.diff.displacement);
|
18640 | };
|
18641 |
|
18642 | var drop$1 = (function (_ref) {
|
18643 | var getState = _ref.getState,
|
18644 | dispatch = _ref.dispatch;
|
18645 | return function (next) {
|
18646 | return function (action) {
|
18647 | if (action.type !== 'DROP') {
|
18648 | next(action);
|
18649 | return;
|
18650 | }
|
18651 |
|
18652 | var state = getState();
|
18653 | var reason = action.payload.reason;
|
18654 |
|
18655 | if (state.phase === 'COLLECTING') {
|
18656 | dispatch(dropPending({
|
18657 | reason: reason
|
18658 | }));
|
18659 | return;
|
18660 | }
|
18661 |
|
18662 | if (state.phase === 'PREPARING') {
|
18663 | dispatch(clean());
|
18664 | return;
|
18665 | }
|
18666 |
|
18667 | if (state.phase === 'IDLE') {
|
18668 | return;
|
18669 | }
|
18670 |
|
18671 | var isWaitingForDrop = state.phase === 'DROP_PENDING' && state.isWaiting;
|
18672 | !!isWaitingForDrop ? process.env.NODE_ENV !== "production" ? invariant(false, 'A DROP action occurred while DROP_PENDING and still waiting') : invariant(false) : void 0;
|
18673 | !(state.phase === 'DRAGGING' || state.phase === 'DROP_PENDING') ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot drop in phase: " + state.phase) : invariant(false) : void 0;
|
18674 | var critical = state.critical;
|
18675 | var dimensions = state.dimensions;
|
18676 | var impact = reason === 'DROP' ? state.impact : noImpact;
|
18677 | var home = dimensions.droppables[state.critical.droppable.id];
|
18678 | var draggable = dimensions.draggables[state.critical.draggable.id];
|
18679 | var droppable = impact && impact.destination ? dimensions.droppables[impact.destination.droppableId] : null;
|
18680 | var source = {
|
18681 | index: critical.draggable.index,
|
18682 | droppableId: critical.droppable.id
|
18683 | };
|
18684 | var destination = reason === 'DROP' ? impact.destination : null;
|
18685 | var result = {
|
18686 | draggableId: draggable.descriptor.id,
|
18687 | type: home.descriptor.type,
|
18688 | source: source,
|
18689 | destination: destination,
|
18690 | reason: reason
|
18691 | };
|
18692 |
|
18693 | var clientOffset = function () {
|
18694 | if (reason === 'CANCEL') {
|
18695 | return origin;
|
18696 | }
|
18697 |
|
18698 | var newBorderBoxClientCenter = getNewHomeClientBorderBoxCenter({
|
18699 | movement: impact.movement,
|
18700 | draggable: draggable,
|
18701 | draggables: dimensions.draggables,
|
18702 | destination: droppable
|
18703 | });
|
18704 | return subtract(newBorderBoxClientCenter, draggable.client.borderBox.center);
|
18705 | }();
|
18706 |
|
18707 | var newHomeOffset = add(clientOffset, getScrollDisplacement(droppable || home, state.viewport));
|
18708 | var isAnimationRequired = !isEqual(state.current.client.offset, newHomeOffset);
|
18709 | var pending = {
|
18710 | newHomeOffset: newHomeOffset,
|
18711 | result: result,
|
18712 | impact: impact
|
18713 | };
|
18714 |
|
18715 | if (isAnimationRequired) {
|
18716 | dispatch(animateDrop(pending));
|
18717 | return;
|
18718 | }
|
18719 |
|
18720 | dispatch(completeDrop(result));
|
18721 | };
|
18722 | };
|
18723 | });
|
18724 |
|
18725 | var onDragStart = function onDragStart(start) {
|
18726 | return "\n You have lifted an item in position " + (start.source.index + 1) + ".\n Use the arrow keys to move, space bar to drop, and escape to cancel.\n";
|
18727 | };
|
18728 |
|
18729 | var onDragUpdate = function onDragUpdate(update) {
|
18730 | if (!update.destination) {
|
18731 | return 'You are currently not dragging over a droppable area';
|
18732 | }
|
18733 |
|
18734 | if (update.source.droppableId === update.destination.droppableId) {
|
18735 | return "You have moved the item to position " + (update.destination.index + 1);
|
18736 | }
|
18737 |
|
18738 | return "\n You have moved the item from list " + update.source.droppableId + " in position " + (update.source.index + 1) + "\n to list " + update.destination.droppableId + " in position " + (update.destination.index + 1) + "\n ";
|
18739 | };
|
18740 |
|
18741 | var onDragEnd = function onDragEnd(result) {
|
18742 | if (result.reason === 'CANCEL') {
|
18743 | return "\n Movement cancelled.\n The item has returned to its starting position of " + (result.source.index + 1) + "\n ";
|
18744 | }
|
18745 |
|
18746 | if (!result.destination) {
|
18747 | return "\n The item has been dropped while not over a droppable location.\n The item has returned to its starting position of " + (result.source.index + 1) + "\n ";
|
18748 | }
|
18749 |
|
18750 | if (result.source.droppableId === result.destination.droppableId) {
|
18751 | if (result.source.index === result.destination.index) {
|
18752 | return "\n You have dropped the item.\n It has been dropped on its starting position of " + (result.source.index + 1) + "\n ";
|
18753 | }
|
18754 |
|
18755 | return "\n You have dropped the item.\n It has moved from position " + (result.source.index + 1) + " to " + (result.destination.index + 1) + "\n ";
|
18756 | }
|
18757 |
|
18758 | return "\n You have dropped the item.\n It has moved from position " + (result.source.index + 1) + " in list " + result.source.droppableId + "\n to position " + (result.destination.index + 1) + " in list " + result.destination.droppableId + "\n ";
|
18759 | };
|
18760 |
|
18761 | var preset = {
|
18762 | onDragStart: onDragStart,
|
18763 | onDragUpdate: onDragUpdate,
|
18764 | onDragEnd: onDragEnd
|
18765 | };
|
18766 |
|
18767 | var records = {};
|
18768 | var flag = '__react-beautiful-dnd-debug-timings-hook__';
|
18769 |
|
18770 | var isTimingsEnabled = function isTimingsEnabled() {
|
18771 | return Boolean(window[flag]);
|
18772 | };
|
18773 |
|
18774 | var start = function start(key) {
|
18775 | if (process.env.NODE_ENV !== 'production') {
|
18776 | if (!isTimingsEnabled()) {
|
18777 | return;
|
18778 | }
|
18779 |
|
18780 | var now = performance.now();
|
18781 | records[key] = now;
|
18782 | }
|
18783 | };
|
18784 | var finish = function finish(key) {
|
18785 | if (process.env.NODE_ENV !== 'production') {
|
18786 | if (!isTimingsEnabled()) {
|
18787 | return;
|
18788 | }
|
18789 |
|
18790 | var now = performance.now();
|
18791 | var previous = records[key];
|
18792 | !previous ? process.env.NODE_ENV !== "production" ? invariant(false, 'cannot finish timing as no previous time found') : invariant(false) : void 0;
|
18793 | var result = now - previous;
|
18794 | var rounded = result.toFixed(2);
|
18795 |
|
18796 | var style = function () {
|
18797 | if (result < 12) {
|
18798 | return {
|
18799 | textColor: 'green',
|
18800 | symbol: '✅'
|
18801 | };
|
18802 | }
|
18803 |
|
18804 | if (result < 40) {
|
18805 | return {
|
18806 | textColor: 'orange',
|
18807 | symbol: '⚠️'
|
18808 | };
|
18809 | }
|
18810 |
|
18811 | return {
|
18812 | textColor: 'red',
|
18813 | symbol: '❌'
|
18814 | };
|
18815 | }();
|
18816 |
|
18817 | console.log(style.symbol + " %cTiming %c" + rounded + " %cms %c" + key, 'color: blue; font-weight: bold; ', "color: " + style.textColor + "; font-size: 1.1em;", 'color: grey;', 'color: purple; font-weight: bold;');
|
18818 | }
|
18819 | };
|
18820 |
|
18821 | var withTimings = function withTimings(key, fn) {
|
18822 | start(key);
|
18823 | fn();
|
18824 | finish(key);
|
18825 | };
|
18826 |
|
18827 | var areLocationsEqual = function areLocationsEqual(first, second) {
|
18828 | if (first == null && second == null) {
|
18829 | return true;
|
18830 | }
|
18831 |
|
18832 | if (first == null || second == null) {
|
18833 | return false;
|
18834 | }
|
18835 |
|
18836 | return first.droppableId === second.droppableId && first.index === second.index;
|
18837 | };
|
18838 |
|
18839 | var isCriticalEqual = function isCriticalEqual(first, second) {
|
18840 | if (first === second) {
|
18841 | return true;
|
18842 | }
|
18843 |
|
18844 | var isDraggableEqual = first.draggable.id === second.draggable.id && first.draggable.droppableId === second.draggable.droppableId && first.draggable.type === second.draggable.type && first.draggable.index === second.draggable.index;
|
18845 | var isDroppableEqual = first.droppable.id === second.droppable.id && first.droppable.type === second.droppable.type;
|
18846 | return isDraggableEqual && isDroppableEqual;
|
18847 | };
|
18848 |
|
18849 | var getExpiringAnnounce = function getExpiringAnnounce(announce) {
|
18850 | var wasCalled = false;
|
18851 | var isExpired = false;
|
18852 | setTimeout(function () {
|
18853 | isExpired = true;
|
18854 | });
|
18855 |
|
18856 | var result = function result(message) {
|
18857 | if (wasCalled) {
|
18858 | if (process.env.NODE_ENV !== 'production') {
|
18859 | console.warn('Announcement already made. Not making a second announcement');
|
18860 | }
|
18861 |
|
18862 | return;
|
18863 | }
|
18864 |
|
18865 | if (isExpired) {
|
18866 | if (process.env.NODE_ENV !== 'production') {
|
18867 | console.warn("\n Announcements cannot be made asynchronously.\n Default message has already been announced.\n ");
|
18868 | }
|
18869 |
|
18870 | return;
|
18871 | }
|
18872 |
|
18873 | wasCalled = true;
|
18874 | announce(message);
|
18875 | };
|
18876 |
|
18877 | result.wasCalled = function () {
|
18878 | return wasCalled;
|
18879 | };
|
18880 |
|
18881 | return result;
|
18882 | };
|
18883 |
|
18884 | var getDragStart = function getDragStart(critical) {
|
18885 | return {
|
18886 | draggableId: critical.draggable.id,
|
18887 | type: critical.droppable.type,
|
18888 | source: {
|
18889 | droppableId: critical.droppable.id,
|
18890 | index: critical.draggable.index
|
18891 | }
|
18892 | };
|
18893 | };
|
18894 |
|
18895 | var hooks = (function (getHooks, announce) {
|
18896 | var execute = function execute(hook, data, getDefaultMessage) {
|
18897 | if (!hook) {
|
18898 | announce(getDefaultMessage(data));
|
18899 | return;
|
18900 | }
|
18901 |
|
18902 | var willExpire = getExpiringAnnounce(announce);
|
18903 | var provided = {
|
18904 | announce: willExpire
|
18905 | };
|
18906 | hook(data, provided);
|
18907 |
|
18908 | if (!willExpire.wasCalled()) {
|
18909 | announce(getDefaultMessage(data));
|
18910 | }
|
18911 | };
|
18912 |
|
18913 | var publisher = function () {
|
18914 | var lastLocation = null;
|
18915 | var lastCritical = null;
|
18916 | var _isDragStartPublished = false;
|
18917 |
|
18918 | var beforeStart = function beforeStart(critical) {
|
18919 | !!_isDragStartPublished ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot fire onBeforeDragStart as a drag start has already been published') : invariant(false) : void 0;
|
18920 | withTimings('onBeforeDragStart', function () {
|
18921 | var fn = getHooks().onBeforeDragStart;
|
18922 |
|
18923 | if (fn) {
|
18924 | fn(getDragStart(critical));
|
18925 | }
|
18926 | });
|
18927 | };
|
18928 |
|
18929 | var start$$1 = function start$$1(critical) {
|
18930 | !!_isDragStartPublished ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot fire onBeforeDragStart as a drag start has already been published') : invariant(false) : void 0;
|
18931 | var data = getDragStart(critical);
|
18932 | lastCritical = critical;
|
18933 | lastLocation = data.source;
|
18934 | _isDragStartPublished = true;
|
18935 | withTimings('onDragStart', function () {
|
18936 | return execute(getHooks().onDragStart, data, preset.onDragStart);
|
18937 | });
|
18938 | };
|
18939 |
|
18940 | var move = function move(critical, location) {
|
18941 | !(_isDragStartPublished && lastCritical) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot fire onDragMove when onDragStart has not been called') : invariant(false) : void 0;
|
18942 | var hasCriticalChanged = !isCriticalEqual(critical, lastCritical);
|
18943 |
|
18944 | if (hasCriticalChanged) {
|
18945 | lastCritical = critical;
|
18946 | }
|
18947 |
|
18948 | var hasLocationChanged = !areLocationsEqual(lastLocation, location);
|
18949 |
|
18950 | if (hasLocationChanged) {
|
18951 | lastLocation = location;
|
18952 | }
|
18953 |
|
18954 | if (!hasCriticalChanged && !hasLocationChanged) {
|
18955 | return;
|
18956 | }
|
18957 |
|
18958 | var data = _extends({}, getDragStart(critical), {
|
18959 | destination: location
|
18960 | });
|
18961 |
|
18962 | withTimings('onDragUpdate', function () {
|
18963 | return execute(getHooks().onDragUpdate, data, preset.onDragUpdate);
|
18964 | });
|
18965 | };
|
18966 |
|
18967 | var drop = function drop(result) {
|
18968 | !_isDragStartPublished ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot fire onDragEnd when there is no matching onDragStart') : invariant(false) : void 0;
|
18969 | _isDragStartPublished = false;
|
18970 | lastLocation = null;
|
18971 | lastCritical = null;
|
18972 | withTimings('onDragEnd', function () {
|
18973 | return execute(getHooks().onDragEnd, result, preset.onDragEnd);
|
18974 | });
|
18975 | };
|
18976 |
|
18977 | var abort = function abort() {
|
18978 | !(_isDragStartPublished && lastCritical) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot cancel when onDragStart not fired') : invariant(false) : void 0;
|
18979 |
|
18980 | var result = _extends({}, getDragStart(lastCritical), {
|
18981 | destination: null,
|
18982 | reason: 'CANCEL'
|
18983 | });
|
18984 |
|
18985 | drop(result);
|
18986 | };
|
18987 |
|
18988 | return {
|
18989 | beforeStart: beforeStart,
|
18990 | start: start$$1,
|
18991 | move: move,
|
18992 | drop: drop,
|
18993 | abort: abort,
|
18994 | isDragStartPublished: function isDragStartPublished() {
|
18995 | return _isDragStartPublished;
|
18996 | }
|
18997 | };
|
18998 | }();
|
18999 |
|
19000 | return function (store) {
|
19001 | return function (next) {
|
19002 | return function (action) {
|
19003 | if (action.type === 'INITIAL_PUBLISH') {
|
19004 | var critical = action.payload.critical;
|
19005 | publisher.beforeStart(critical);
|
19006 | next(action);
|
19007 | publisher.start(critical);
|
19008 | return;
|
19009 | }
|
19010 |
|
19011 | next(action);
|
19012 |
|
19013 | if (action.type === 'DROP_COMPLETE') {
|
19014 | var result = action.payload;
|
19015 | publisher.drop(result);
|
19016 | return;
|
19017 | }
|
19018 |
|
19019 | if (action.type === 'CLEAN') {
|
19020 | if (publisher.isDragStartPublished()) {
|
19021 | publisher.abort();
|
19022 | }
|
19023 |
|
19024 | return;
|
19025 | }
|
19026 |
|
19027 | if (!publisher.isDragStartPublished()) {
|
19028 | return;
|
19029 | }
|
19030 |
|
19031 | var state = store.getState();
|
19032 |
|
19033 | if (state.phase === 'DRAGGING') {
|
19034 | publisher.move(state.critical, state.impact.destination);
|
19035 | }
|
19036 | };
|
19037 | };
|
19038 | };
|
19039 | });
|
19040 |
|
19041 | var dropAnimationFinish = (function (store) {
|
19042 | return function (next) {
|
19043 | return function (action) {
|
19044 | if (action.type !== 'DROP_ANIMATION_FINISHED') {
|
19045 | next(action);
|
19046 | return;
|
19047 | }
|
19048 |
|
19049 | var state = store.getState();
|
19050 | !(state.phase === 'DROP_ANIMATING') ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot finish a drop animating when no drop is occurring') : invariant(false) : void 0;
|
19051 | store.dispatch(completeDrop(state.pending.result));
|
19052 | };
|
19053 | };
|
19054 | });
|
19055 |
|
19056 | var dimensionMarshalStopper = (function (getMarshal) {
|
19057 | return function () {
|
19058 | return function (next) {
|
19059 | return function (action) {
|
19060 | if (action.type === 'DROP_COMPLETE' || action.type === 'CLEAN' || action.type === 'DROP_ANIMATE') {
|
19061 | var marshal = getMarshal();
|
19062 | marshal.stopPublishing();
|
19063 | }
|
19064 |
|
19065 | next(action);
|
19066 | };
|
19067 | };
|
19068 | };
|
19069 | });
|
19070 |
|
19071 | var shouldCancel = function shouldCancel(action) {
|
19072 | return action.type === 'CANCEL' || action.type === 'DROP_ANIMATE' || action.type === 'DROP' || action.type === 'DROP_COMPLETE' || action.type === 'COLLECTION_STARTING';
|
19073 | };
|
19074 |
|
19075 | var autoScroll = (function (getScroller) {
|
19076 | return function (store) {
|
19077 | return function (next) {
|
19078 | return function (action) {
|
19079 | if (shouldCancel(action)) {
|
19080 | getScroller().cancel();
|
19081 | next(action);
|
19082 | return;
|
19083 | }
|
19084 |
|
19085 | next(action);
|
19086 | var state = store.getState();
|
19087 |
|
19088 | if (state.phase !== 'DRAGGING') {
|
19089 | return;
|
19090 | }
|
19091 |
|
19092 | if (state.autoScrollMode === 'FLUID') {
|
19093 | getScroller().fluidScroll(state);
|
19094 | return;
|
19095 | }
|
19096 |
|
19097 | if (!state.scrollJumpRequest) {
|
19098 | return;
|
19099 | }
|
19100 |
|
19101 | getScroller().jumpScroll(state);
|
19102 | };
|
19103 | };
|
19104 | };
|
19105 | });
|
19106 |
|
19107 | var shouldCheckOnAction = function shouldCheckOnAction(action) {
|
19108 | return action.type === 'MOVE' || action.type === 'MOVE_UP' || action.type === 'MOVE_RIGHT' || action.type === 'MOVE_DOWN' || action.type === 'MOVE_LEFT' || action.type === 'MOVE_BY_WINDOW_SCROLL';
|
19109 | };
|
19110 |
|
19111 | var hasDroppableOverChanged = function hasDroppableOverChanged(previous, current) {
|
19112 | if (!previous) {
|
19113 | return Boolean(current);
|
19114 | }
|
19115 |
|
19116 | if (!current) {
|
19117 | return Boolean(previous);
|
19118 | }
|
19119 |
|
19120 | return previous.droppableId !== current.droppableId;
|
19121 | };
|
19122 |
|
19123 | var getNewMaxScroll = function getNewMaxScroll(previous, current, action) {
|
19124 | if (!shouldCheckOnAction(action)) {
|
19125 | return null;
|
19126 | }
|
19127 |
|
19128 | if (!isMovementAllowed(previous) || !isMovementAllowed(current)) {
|
19129 | return null;
|
19130 | }
|
19131 |
|
19132 | if (!hasDroppableOverChanged(previous.impact.destination, current.impact.destination)) {
|
19133 | return null;
|
19134 | }
|
19135 |
|
19136 | var viewport = current.viewport;
|
19137 | var doc = document.documentElement;
|
19138 | !doc ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not find document.documentElement') : invariant(false) : void 0;
|
19139 | var maxScroll = getMaxScroll({
|
19140 | scrollHeight: doc.scrollHeight,
|
19141 | scrollWidth: doc.scrollWidth,
|
19142 | width: viewport.frame.width,
|
19143 | height: viewport.frame.height
|
19144 | });
|
19145 |
|
19146 | if (isEqual(maxScroll, viewport.scroll.max)) {
|
19147 | return null;
|
19148 | }
|
19149 |
|
19150 | return maxScroll;
|
19151 | };
|
19152 |
|
19153 | var maxScrollUpdater = (function (store) {
|
19154 | return function (next) {
|
19155 | return function (action) {
|
19156 | var previous = store.getState();
|
19157 | next(action);
|
19158 | var current = store.getState();
|
19159 | var maxScroll = getNewMaxScroll(previous, current, action);
|
19160 |
|
19161 | if (maxScroll) {
|
19162 | next(updateViewportMaxScroll(maxScroll));
|
19163 | }
|
19164 | };
|
19165 | };
|
19166 | });
|
19167 |
|
19168 | var composeEnhancers = typeof window === 'object' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : redux.compose;
|
19169 | var createStore = (function (_ref) {
|
19170 | var getDimensionMarshal = _ref.getDimensionMarshal,
|
19171 | styleMarshal = _ref.styleMarshal,
|
19172 | getHooks = _ref.getHooks,
|
19173 | announce = _ref.announce,
|
19174 | getScroller = _ref.getScroller;
|
19175 | return redux.createStore(reducer, composeEnhancers(redux.applyMiddleware(style(styleMarshal), dimensionMarshalStopper(getDimensionMarshal), lift$1(getDimensionMarshal), drop$1, dropAnimationFinish, maxScrollUpdater, autoScroll(getScroller), hooks(getHooks, announce))));
|
19176 | });
|
19177 |
|
19178 | var getEmptyMap = function getEmptyMap() {
|
19179 | return {
|
19180 | draggables: {},
|
19181 | droppables: {}
|
19182 | };
|
19183 | };
|
19184 |
|
19185 | var timingKey = 'Publish collection from DOM';
|
19186 | var createPublisher = (function (_ref) {
|
19187 | var getProvided = _ref.getProvided,
|
19188 | callbacks = _ref.callbacks;
|
19189 |
|
19190 | var advancedUsageWarning = function () {
|
19191 | if (process.env.NODE_ENV === 'production') {
|
19192 | return function () {};
|
19193 | }
|
19194 |
|
19195 | var hasAnnounced = false;
|
19196 | return function () {
|
19197 | if (hasAnnounced) {
|
19198 | return;
|
19199 | }
|
19200 |
|
19201 | hasAnnounced = true;
|
19202 |
|
19203 | if (process.env.NODE_ENV === 'production') {
|
19204 | return;
|
19205 | }
|
19206 |
|
19207 | console.warn("\n Advanced usage warning: you are adding or removing a dimension during a drag\n This an advanced feature used to support dynamic interactions such as lazy loading lists.\n\n Keep in mind the following restrictions:\n\n - Draggable's can only be added to Droppable's that are scroll containers\n - Adding a Droppable cannot impact the placement of other Droppables\n (it cannot push a Droppable on the page)\n\n (This warning will be stripped in production builds)\n ".trim());
|
19208 | };
|
19209 | }();
|
19210 |
|
19211 | var additions = getEmptyMap();
|
19212 | var removals = getEmptyMap();
|
19213 | var frameId = null;
|
19214 |
|
19215 | var reset = function reset() {
|
19216 | additions = getEmptyMap();
|
19217 | removals = getEmptyMap();
|
19218 | };
|
19219 |
|
19220 | var collect = function collect() {
|
19221 | advancedUsageWarning();
|
19222 |
|
19223 | if (frameId) {
|
19224 | return;
|
19225 | }
|
19226 |
|
19227 | frameId = requestAnimationFrame(function () {
|
19228 | frameId = null;
|
19229 | callbacks.collectionStarting();
|
19230 | start(timingKey);
|
19231 |
|
19232 | var _getProvided = getProvided(),
|
19233 | entries = _getProvided.entries,
|
19234 | collection = _getProvided.collection;
|
19235 |
|
19236 | var windowScroll = collection.initialWindowScroll;
|
19237 |
|
19238 | var draggables = _Object$keys(additions.draggables).map(function (id) {
|
19239 | return entries.draggables[id].getDimension(windowScroll);
|
19240 | });
|
19241 |
|
19242 | var droppables = _Object$keys(additions.droppables).map(function (id) {
|
19243 | return entries.droppables[id].callbacks.getDimensionAndWatchScroll(windowScroll, collection.scrollOptions);
|
19244 | });
|
19245 |
|
19246 | var result = {
|
19247 | additions: {
|
19248 | draggables: draggables,
|
19249 | droppables: droppables
|
19250 | },
|
19251 | removals: {
|
19252 | draggables: _Object$keys(removals.draggables),
|
19253 | droppables: _Object$keys(removals.droppables)
|
19254 | }
|
19255 | };
|
19256 | reset();
|
19257 | finish(timingKey);
|
19258 | callbacks.publish(result);
|
19259 | });
|
19260 | };
|
19261 |
|
19262 | var addDraggable = function addDraggable(id) {
|
19263 | additions.draggables[id] = true;
|
19264 |
|
19265 | if (removals.draggables[id]) {
|
19266 | delete removals.draggables[id];
|
19267 | }
|
19268 |
|
19269 | collect();
|
19270 | };
|
19271 |
|
19272 | var removeDraggable = function removeDraggable(id) {
|
19273 | removals.draggables[id] = true;
|
19274 |
|
19275 | if (additions.draggables[id]) {
|
19276 | delete additions.draggables[id];
|
19277 | }
|
19278 |
|
19279 | collect();
|
19280 | };
|
19281 |
|
19282 | var addDroppable = function addDroppable(id) {
|
19283 | additions.droppables[id] = true;
|
19284 |
|
19285 | if (removals.droppables[id]) {
|
19286 | delete removals.droppables[id];
|
19287 | }
|
19288 |
|
19289 | collect();
|
19290 | };
|
19291 |
|
19292 | var removeDroppable = function removeDroppable(id) {
|
19293 | removals.droppables[id] = true;
|
19294 |
|
19295 | if (additions.droppables[id]) {
|
19296 | delete additions.droppables[id];
|
19297 | }
|
19298 |
|
19299 | collect();
|
19300 | };
|
19301 |
|
19302 | var stop = function stop() {
|
19303 | if (!frameId) {
|
19304 | return;
|
19305 | }
|
19306 |
|
19307 | cancelAnimationFrame(frameId);
|
19308 | frameId = null;
|
19309 | reset();
|
19310 | };
|
19311 |
|
19312 | return {
|
19313 | addDraggable: addDraggable,
|
19314 | removeDraggable: removeDraggable,
|
19315 | addDroppable: addDroppable,
|
19316 | removeDroppable: removeDroppable,
|
19317 | stop: stop
|
19318 | };
|
19319 | });
|
19320 |
|
19321 | var createDimensionMarshal = (function (callbacks) {
|
19322 | var entries = {
|
19323 | droppables: {},
|
19324 | draggables: {}
|
19325 | };
|
19326 | var collection = null;
|
19327 | var publisher = createPublisher({
|
19328 | callbacks: {
|
19329 | publish: callbacks.publish,
|
19330 | collectionStarting: callbacks.collectionStarting
|
19331 | },
|
19332 | getProvided: function getProvided() {
|
19333 | !collection ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get scroll options when there is no collection') : invariant(false) : void 0;
|
19334 | return {
|
19335 | entries: entries,
|
19336 | collection: collection
|
19337 | };
|
19338 | }
|
19339 | });
|
19340 |
|
19341 | var registerDraggable = function registerDraggable(descriptor, getDimension) {
|
19342 | var entry = {
|
19343 | descriptor: descriptor,
|
19344 | getDimension: getDimension
|
19345 | };
|
19346 | entries.draggables[descriptor.id] = entry;
|
19347 |
|
19348 | if (!collection) {
|
19349 | return;
|
19350 | }
|
19351 |
|
19352 | if (collection.critical.draggable.type !== descriptor.type) {
|
19353 | return;
|
19354 | }
|
19355 |
|
19356 | publisher.addDraggable(descriptor.id);
|
19357 | };
|
19358 |
|
19359 | var updateDraggable = function updateDraggable(previous, descriptor, getDimension) {
|
19360 | !entries.draggables[previous.id] ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot update draggable registration as no previous registration was found') : invariant(false) : void 0;
|
19361 | delete entries.draggables[previous.id];
|
19362 | var entry = {
|
19363 | descriptor: descriptor,
|
19364 | getDimension: getDimension
|
19365 | };
|
19366 | entries.draggables[descriptor.id] = entry;
|
19367 | };
|
19368 |
|
19369 | var unregisterDraggable = function unregisterDraggable(descriptor) {
|
19370 | var entry = entries.draggables[descriptor.id];
|
19371 | !entry ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot unregister Draggable with id " + descriptor.id + " as it is not registered") : invariant(false) : void 0;
|
19372 |
|
19373 | if (entry.descriptor !== descriptor) {
|
19374 | return;
|
19375 | }
|
19376 |
|
19377 | delete entries.draggables[descriptor.id];
|
19378 |
|
19379 | if (!collection) {
|
19380 | return;
|
19381 | }
|
19382 |
|
19383 | !(collection.critical.draggable.id !== descriptor.id) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot remove the dragging item during a drag') : invariant(false) : void 0;
|
19384 |
|
19385 | if (descriptor.type !== collection.critical.draggable.type) {
|
19386 | return;
|
19387 | }
|
19388 |
|
19389 | publisher.removeDraggable(descriptor.id);
|
19390 | };
|
19391 |
|
19392 | var registerDroppable = function registerDroppable(descriptor, droppableCallbacks) {
|
19393 | var id = descriptor.id;
|
19394 | entries.droppables[id] = {
|
19395 | descriptor: descriptor,
|
19396 | callbacks: droppableCallbacks
|
19397 | };
|
19398 |
|
19399 | if (!collection) {
|
19400 | return;
|
19401 | }
|
19402 |
|
19403 | if (descriptor.type !== collection.critical.droppable.type) {
|
19404 | return;
|
19405 | }
|
19406 |
|
19407 | publisher.addDroppable(id);
|
19408 | };
|
19409 |
|
19410 | var updateDroppable = function updateDroppable(previous, descriptor, droppableCallbacks) {
|
19411 | !entries.droppables[previous.id] ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot update droppable registration as no previous registration was found') : invariant(false) : void 0;
|
19412 | delete entries.droppables[previous.id];
|
19413 | var entry = {
|
19414 | descriptor: descriptor,
|
19415 | callbacks: droppableCallbacks
|
19416 | };
|
19417 | entries.droppables[descriptor.id] = entry;
|
19418 |
|
19419 | if (collection) {
|
19420 | process.env.NODE_ENV !== "production" ? invariant(false, 'You are not able to update the id or type of a droppable during a drag') : invariant(false);
|
19421 | }
|
19422 | };
|
19423 |
|
19424 | var unregisterDroppable = function unregisterDroppable(descriptor) {
|
19425 | var entry = entries.droppables[descriptor.id];
|
19426 | !entry ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot unregister Droppable with id " + descriptor.id + " as as it is not registered") : invariant(false) : void 0;
|
19427 |
|
19428 | if (entry.descriptor !== descriptor) {
|
19429 | return;
|
19430 | }
|
19431 |
|
19432 | delete entries.droppables[descriptor.id];
|
19433 |
|
19434 | if (!collection) {
|
19435 | return;
|
19436 | }
|
19437 |
|
19438 | !(collection.critical.droppable.id !== descriptor.id) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot remove the home Droppable during a drag') : invariant(false) : void 0;
|
19439 |
|
19440 | if (collection.critical.droppable.type !== descriptor.type) {
|
19441 | return;
|
19442 | }
|
19443 |
|
19444 | publisher.removeDroppable(descriptor.id);
|
19445 | };
|
19446 |
|
19447 | var updateDroppableIsEnabled = function updateDroppableIsEnabled(id, isEnabled) {
|
19448 | !entries.droppables[id] ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot update the scroll on Droppable " + id + " as it is not registered") : invariant(false) : void 0;
|
19449 |
|
19450 | if (!collection) {
|
19451 | return;
|
19452 | }
|
19453 |
|
19454 | callbacks.updateDroppableIsEnabled({
|
19455 | id: id,
|
19456 | isEnabled: isEnabled
|
19457 | });
|
19458 | };
|
19459 |
|
19460 | var updateDroppableScroll = function updateDroppableScroll(id, newScroll) {
|
19461 | !entries.droppables[id] ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot update the scroll on Droppable " + id + " as it is not registered") : invariant(false) : void 0;
|
19462 |
|
19463 | if (!collection) {
|
19464 | return;
|
19465 | }
|
19466 |
|
19467 | callbacks.updateDroppableScroll({
|
19468 | id: id,
|
19469 | offset: newScroll
|
19470 | });
|
19471 | };
|
19472 |
|
19473 | var scrollDroppable = function scrollDroppable(id, change) {
|
19474 | var entry = entries.droppables[id];
|
19475 | !entry ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot scroll Droppable " + id + " as it is not registered") : invariant(false) : void 0;
|
19476 |
|
19477 | if (!collection) {
|
19478 | return;
|
19479 | }
|
19480 |
|
19481 | entry.callbacks.scroll(change);
|
19482 | };
|
19483 |
|
19484 | var getInitialPublish = function getInitialPublish(args) {
|
19485 | var critical = args.critical,
|
19486 | scrollOptions = args.scrollOptions,
|
19487 | windowScroll = args.initialWindowScroll;
|
19488 | var timingKey = 'Initial collection from DOM';
|
19489 | start(timingKey);
|
19490 | var home = critical.droppable;
|
19491 |
|
19492 | var droppables = _Object$keys(entries.droppables).map(function (id) {
|
19493 | return entries.droppables[id];
|
19494 | }).filter(function (entry) {
|
19495 | return entry.descriptor.type === home.type;
|
19496 | }).map(function (entry) {
|
19497 | return entry.callbacks.getDimensionAndWatchScroll(windowScroll, scrollOptions);
|
19498 | }).reduce(function (previous, dimension) {
|
19499 | previous[dimension.descriptor.id] = dimension;
|
19500 | return previous;
|
19501 | }, {});
|
19502 |
|
19503 | var draggables = _Object$keys(entries.draggables).map(function (id) {
|
19504 | return entries.draggables[id];
|
19505 | }).filter(function (entry) {
|
19506 | return entry.descriptor.type === critical.draggable.type;
|
19507 | }).map(function (entry) {
|
19508 | return entry.getDimension(windowScroll);
|
19509 | }).reduce(function (previous, dimension) {
|
19510 | previous[dimension.descriptor.id] = dimension;
|
19511 | return previous;
|
19512 | }, {});
|
19513 |
|
19514 | finish(timingKey);
|
19515 | var dimensions = {
|
19516 | draggables: draggables,
|
19517 | droppables: droppables
|
19518 | };
|
19519 | var result = {
|
19520 | dimensions: dimensions,
|
19521 | critical: critical
|
19522 | };
|
19523 | return result;
|
19524 | };
|
19525 |
|
19526 | var stopPublishing = function stopPublishing() {
|
19527 | if (!collection) {
|
19528 | return;
|
19529 | }
|
19530 |
|
19531 | publisher.stop();
|
19532 | var home = collection.critical.droppable;
|
19533 |
|
19534 | _Object$keys(entries.droppables).filter(function (id) {
|
19535 | return entries.droppables[id].descriptor.type === home.type;
|
19536 | }).forEach(function (id) {
|
19537 | return entries.droppables[id].callbacks.unwatchScroll();
|
19538 | });
|
19539 |
|
19540 | collection = null;
|
19541 | };
|
19542 |
|
19543 | var startPublishing = function startPublishing(request, windowScroll) {
|
19544 | !!collection ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot start capturing critical dimensions as there is already a collection') : invariant(false) : void 0;
|
19545 | var entry = entries.draggables[request.draggableId];
|
19546 | !entry ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot find critical draggable entry') : invariant(false) : void 0;
|
19547 | var home = entries.droppables[entry.descriptor.droppableId];
|
19548 | !home ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot find critical droppable entry') : invariant(false) : void 0;
|
19549 | var critical = {
|
19550 | draggable: entry.descriptor,
|
19551 | droppable: home.descriptor
|
19552 | };
|
19553 | collection = {
|
19554 | scrollOptions: request.scrollOptions,
|
19555 | critical: critical,
|
19556 | initialWindowScroll: windowScroll
|
19557 | };
|
19558 | return getInitialPublish(collection);
|
19559 | };
|
19560 |
|
19561 | var marshal = {
|
19562 | registerDraggable: registerDraggable,
|
19563 | updateDraggable: updateDraggable,
|
19564 | unregisterDraggable: unregisterDraggable,
|
19565 | registerDroppable: registerDroppable,
|
19566 | updateDroppable: updateDroppable,
|
19567 | unregisterDroppable: unregisterDroppable,
|
19568 | updateDroppableIsEnabled: updateDroppableIsEnabled,
|
19569 | scrollDroppable: scrollDroppable,
|
19570 | updateDroppableScroll: updateDroppableScroll,
|
19571 | startPublishing: startPublishing,
|
19572 | stopPublishing: stopPublishing
|
19573 | };
|
19574 | return marshal;
|
19575 | });
|
19576 |
|
19577 | var physics = function () {
|
19578 | var base = {
|
19579 | stiffness: 1000,
|
19580 | damping: 60,
|
19581 | precision: 0.99
|
19582 | };
|
19583 |
|
19584 | var standard = _extends({}, base);
|
19585 |
|
19586 | var fast = _extends({}, base, {
|
19587 | stiffness: base.stiffness * 2
|
19588 | });
|
19589 |
|
19590 | return {
|
19591 | standard: standard,
|
19592 | fast: fast
|
19593 | };
|
19594 | }();
|
19595 | var css = {
|
19596 | outOfTheWay: 'transform 0.2s cubic-bezier(0.2, 0, 0, 1)'
|
19597 | };
|
19598 |
|
19599 | var prefix = 'data-react-beautiful-dnd';
|
19600 | var dragHandle = prefix + "-drag-handle";
|
19601 | var draggable = prefix + "-draggable";
|
19602 | var droppable = prefix + "-droppable";
|
19603 |
|
19604 | var getStyles = (function (styleContext) {
|
19605 | var dragHandleSelector = "[" + dragHandle + "=\"" + styleContext + "\"]";
|
19606 | var draggableSelector = "[" + draggable + "=\"" + styleContext + "\"]";
|
19607 | var droppableSelector = "[" + droppable + "=\"" + styleContext + "\"]";
|
19608 | var dragHandleStyles = {
|
19609 | base: "\n " + dragHandleSelector + " {\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n }\n ",
|
19610 | grabCursor: "\n " + dragHandleSelector + " {\n cursor: -webkit-grab;\n cursor: grab;\n }\n ",
|
19611 | blockPointerEvents: "\n " + dragHandleSelector + " {\n pointer-events: none;\n }\n "
|
19612 | };
|
19613 | var draggableStyles = {
|
19614 | animateMovement: "\n " + draggableSelector + " {\n transition: " + css.outOfTheWay + ";\n }\n "
|
19615 | };
|
19616 | var droppableStyles = {
|
19617 | base: "\n " + droppableSelector + " {\n overflow-anchor: none;\n }\n "
|
19618 | };
|
19619 | var bodyStyles = {
|
19620 | whileActiveDragging: "\n body {\n cursor: grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n }\n "
|
19621 | };
|
19622 | var base = [dragHandleStyles.base, droppableStyles.base];
|
19623 | var resting = base.concat([dragHandleStyles.grabCursor]);
|
19624 | var collecting = base.concat([dragHandleStyles.blockPointerEvents, bodyStyles.whileActiveDragging]);
|
19625 | var dragging = collecting.concat([draggableStyles.animateMovement]);
|
19626 | var dropAnimating = base.concat([dragHandleStyles.grabCursor, draggableStyles.animateMovement]);
|
19627 | var userCancel = base.concat([draggableStyles.animateMovement]);
|
19628 | return {
|
19629 | resting: resting.join(''),
|
19630 | dragging: dragging.join(''),
|
19631 | dropAnimating: dropAnimating.join(''),
|
19632 | collecting: collecting.join(''),
|
19633 | userCancel: userCancel.join('')
|
19634 | };
|
19635 | });
|
19636 |
|
19637 | var count = 0;
|
19638 | var resetStyleContext = function resetStyleContext() {
|
19639 | count = 0;
|
19640 | };
|
19641 |
|
19642 | var getHead = function getHead() {
|
19643 | var head = document.querySelector('head');
|
19644 | !head ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot find the head to append a style to') : invariant(false) : void 0;
|
19645 | return head;
|
19646 | };
|
19647 |
|
19648 | var createStyleMarshal = (function () {
|
19649 | var context = "" + count++;
|
19650 | var styles = getStyles(context);
|
19651 | var el = null;
|
19652 | var setStyle = memoizeOne(function (proposed) {
|
19653 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot set style of style tag if not mounted') : invariant(false) : void 0;
|
19654 | el.innerHTML = proposed;
|
19655 | });
|
19656 |
|
19657 | var mount = function mount() {
|
19658 | !!el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Style marshal already mounted') : invariant(false) : void 0;
|
19659 | el = document.createElement('style');
|
19660 | el.type = 'text/css';
|
19661 | el.setAttribute(prefix, context);
|
19662 | getHead().appendChild(el);
|
19663 | setStyle(styles.resting);
|
19664 | };
|
19665 |
|
19666 | var collecting = function collecting() {
|
19667 | return setStyle(styles.collecting);
|
19668 | };
|
19669 |
|
19670 | var dragging = function dragging() {
|
19671 | return setStyle(styles.dragging);
|
19672 | };
|
19673 |
|
19674 | var dropping = function dropping(reason) {
|
19675 | if (reason === 'DROP') {
|
19676 | setStyle(styles.dropAnimating);
|
19677 | return;
|
19678 | }
|
19679 |
|
19680 | setStyle(styles.userCancel);
|
19681 | };
|
19682 |
|
19683 | var resting = function resting() {
|
19684 | return setStyle(styles.resting);
|
19685 | };
|
19686 |
|
19687 | var unmount = function unmount() {
|
19688 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot unmount style marshal as it is already unmounted') : invariant(false) : void 0;
|
19689 | getHead().removeChild(el);
|
19690 | el = null;
|
19691 | };
|
19692 |
|
19693 | var marshal = {
|
19694 | collecting: collecting,
|
19695 | dragging: dragging,
|
19696 | dropping: dropping,
|
19697 | resting: resting,
|
19698 | styleContext: context,
|
19699 | mount: mount,
|
19700 | unmount: unmount
|
19701 | };
|
19702 | return marshal;
|
19703 | });
|
19704 |
|
19705 | var canStartDrag = (function (state, id) {
|
19706 | if (state.phase === 'IDLE') {
|
19707 | return true;
|
19708 | }
|
19709 |
|
19710 | if (state.phase !== 'DROP_ANIMATING') {
|
19711 | return false;
|
19712 | }
|
19713 |
|
19714 | if (state.pending.result.draggableId === id) {
|
19715 | return false;
|
19716 | }
|
19717 |
|
19718 | return state.pending.result.reason === 'DROP';
|
19719 | });
|
19720 |
|
19721 | var scrollWindow = (function (change) {
|
19722 | window.scrollBy(change.x, change.y);
|
19723 | });
|
19724 |
|
19725 | var count$1 = 0;
|
19726 | var visuallyHidden = {
|
19727 | position: 'absolute',
|
19728 | width: '1px',
|
19729 | height: '1px',
|
19730 | margin: '-1px',
|
19731 | border: '0',
|
19732 | padding: '0',
|
19733 | overflow: 'hidden',
|
19734 | clip: 'rect(0 0 0 0)',
|
19735 | 'clip-path': 'inset(100%)'
|
19736 | };
|
19737 |
|
19738 | var getBody = function getBody() {
|
19739 | !document.body ? process.env.NODE_ENV !== "production" ? invariant(false, 'Announcer cannot find document.body') : invariant(false) : void 0;
|
19740 | return document.body;
|
19741 | };
|
19742 |
|
19743 | var createAnnouncer = (function () {
|
19744 | var id = "react-beautiful-dnd-announcement-" + count$1++;
|
19745 | var el = null;
|
19746 |
|
19747 | var announce = function announce(message) {
|
19748 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot announce to unmounted node') : invariant(false) : void 0;
|
19749 | el.textContent = message;
|
19750 | };
|
19751 |
|
19752 | var mount = function mount() {
|
19753 | !!el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Announcer already mounted') : invariant(false) : void 0;
|
19754 | el = document.createElement('div');
|
19755 | el.id = id;
|
19756 | el.setAttribute('aria-live', 'assertive');
|
19757 | el.setAttribute('role', 'log');
|
19758 | el.setAttribute('aria-atomic', 'true');
|
19759 |
|
19760 | _Object$assign(el.style, visuallyHidden);
|
19761 |
|
19762 | getBody().appendChild(el);
|
19763 | };
|
19764 |
|
19765 | var unmount = function unmount() {
|
19766 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Will not unmount annoucer as it is already unmounted') : invariant(false) : void 0;
|
19767 | getBody().removeChild(el);
|
19768 | el = null;
|
19769 | };
|
19770 |
|
19771 | var announcer = {
|
19772 | announce: announce,
|
19773 | id: id,
|
19774 | mount: mount,
|
19775 | unmount: unmount
|
19776 | };
|
19777 | return announcer;
|
19778 | });
|
19779 |
|
19780 | var getScrollableDroppables = memoizeOne(function (droppables) {
|
19781 | return toDroppableList(droppables).filter(function (droppable) {
|
19782 | if (!droppable.isEnabled) {
|
19783 | return false;
|
19784 | }
|
19785 |
|
19786 | if (!droppable.viewport.closestScrollable) {
|
19787 | return false;
|
19788 | }
|
19789 |
|
19790 | return true;
|
19791 | });
|
19792 | });
|
19793 |
|
19794 | var getScrollableDroppableOver = function getScrollableDroppableOver(target, droppables) {
|
19795 | var maybe = getScrollableDroppables(droppables).find(function (droppable) {
|
19796 | !droppable.viewport.closestScrollable ? process.env.NODE_ENV !== "production" ? invariant(false, 'Invalid result') : invariant(false) : void 0;
|
19797 | return isPositionInFrame(droppable.viewport.closestScrollable.framePageMarginBox)(target);
|
19798 | });
|
19799 | return maybe;
|
19800 | };
|
19801 |
|
19802 | var getBestScrollableDroppable = (function (_ref) {
|
19803 | var center = _ref.center,
|
19804 | destination = _ref.destination,
|
19805 | droppables = _ref.droppables;
|
19806 |
|
19807 | if (destination) {
|
19808 | var _dimension = droppables[destination.droppableId];
|
19809 |
|
19810 | if (!_dimension.viewport.closestScrollable) {
|
19811 | return null;
|
19812 | }
|
19813 |
|
19814 | return _dimension;
|
19815 | }
|
19816 |
|
19817 | var dimension = getScrollableDroppableOver(center, droppables);
|
19818 | return dimension;
|
19819 | });
|
19820 |
|
19821 | var smallestSigned = apply(function (value) {
|
19822 | if (value === 0) {
|
19823 | return 0;
|
19824 | }
|
19825 |
|
19826 | return value > 0 ? 1 : -1;
|
19827 | });
|
19828 | var getOverlap = function () {
|
19829 | var getRemainder = function getRemainder(target, max) {
|
19830 | if (target < 0) {
|
19831 | return target;
|
19832 | }
|
19833 |
|
19834 | if (target > max) {
|
19835 | return target - max;
|
19836 | }
|
19837 |
|
19838 | return 0;
|
19839 | };
|
19840 |
|
19841 | return function (_ref) {
|
19842 | var current = _ref.current,
|
19843 | max = _ref.max,
|
19844 | change = _ref.change;
|
19845 | var targetScroll = add(current, change);
|
19846 | var overlap = {
|
19847 | x: getRemainder(targetScroll.x, max.x),
|
19848 | y: getRemainder(targetScroll.y, max.y)
|
19849 | };
|
19850 |
|
19851 | if (isEqual(overlap, origin)) {
|
19852 | return null;
|
19853 | }
|
19854 |
|
19855 | return overlap;
|
19856 | };
|
19857 | }();
|
19858 | var canPartiallyScroll = function canPartiallyScroll(_ref2) {
|
19859 | var rawMax = _ref2.max,
|
19860 | current = _ref2.current,
|
19861 | change = _ref2.change;
|
19862 | var max = {
|
19863 | x: Math.max(current.x, rawMax.x),
|
19864 | y: Math.max(current.y, rawMax.y)
|
19865 | };
|
19866 | var smallestChange = smallestSigned(change);
|
19867 | var overlap = getOverlap({
|
19868 | max: max,
|
19869 | current: current,
|
19870 | change: smallestChange
|
19871 | });
|
19872 |
|
19873 | if (!overlap) {
|
19874 | return true;
|
19875 | }
|
19876 |
|
19877 | if (smallestChange.x !== 0 && overlap.x === 0) {
|
19878 | return true;
|
19879 | }
|
19880 |
|
19881 | if (smallestChange.y !== 0 && overlap.y === 0) {
|
19882 | return true;
|
19883 | }
|
19884 |
|
19885 | return false;
|
19886 | };
|
19887 | var canScrollWindow = function canScrollWindow(viewport, change) {
|
19888 | return canPartiallyScroll({
|
19889 | current: viewport.scroll.current,
|
19890 | max: viewport.scroll.max,
|
19891 | change: change
|
19892 | });
|
19893 | };
|
19894 | var getWindowOverlap = function getWindowOverlap(viewport, change) {
|
19895 | if (!canScrollWindow(viewport, change)) {
|
19896 | return null;
|
19897 | }
|
19898 |
|
19899 | var max = viewport.scroll.max;
|
19900 | var current = viewport.scroll.current;
|
19901 | return getOverlap({
|
19902 | current: current,
|
19903 | max: max,
|
19904 | change: change
|
19905 | });
|
19906 | };
|
19907 | var canScrollDroppable = function canScrollDroppable(droppable, change) {
|
19908 | var closest$$1 = droppable.viewport.closestScrollable;
|
19909 |
|
19910 | if (!closest$$1) {
|
19911 | return false;
|
19912 | }
|
19913 |
|
19914 | return canPartiallyScroll({
|
19915 | current: closest$$1.scroll.current,
|
19916 | max: closest$$1.scroll.max,
|
19917 | change: change
|
19918 | });
|
19919 | };
|
19920 | var getDroppableOverlap = function getDroppableOverlap(droppable, change) {
|
19921 | var closest$$1 = droppable.viewport.closestScrollable;
|
19922 |
|
19923 | if (!closest$$1) {
|
19924 | return null;
|
19925 | }
|
19926 |
|
19927 | if (!canScrollDroppable(droppable, change)) {
|
19928 | return null;
|
19929 | }
|
19930 |
|
19931 | return getOverlap({
|
19932 | current: closest$$1.scroll.current,
|
19933 | max: closest$$1.scroll.max,
|
19934 | change: change
|
19935 | });
|
19936 | };
|
19937 |
|
19938 | var config = {
|
19939 | startFrom: 0.25,
|
19940 | maxSpeedAt: 0.05,
|
19941 | maxScrollSpeed: 28,
|
19942 | ease: function ease(percentage) {
|
19943 | return Math.pow(percentage, 2);
|
19944 | }
|
19945 | };
|
19946 | var clean$1 = apply(function (value) {
|
19947 | return value === 0 ? 0 : value;
|
19948 | });
|
19949 | var getPixelThresholds = function getPixelThresholds(container, axis) {
|
19950 | var startFrom = container[axis.size] * config.startFrom;
|
19951 | var maxSpeedAt = container[axis.size] * config.maxSpeedAt;
|
19952 | var accelerationPlane = startFrom - maxSpeedAt;
|
19953 | var thresholds = {
|
19954 | startFrom: startFrom,
|
19955 | maxSpeedAt: maxSpeedAt,
|
19956 | accelerationPlane: accelerationPlane
|
19957 | };
|
19958 | return thresholds;
|
19959 | };
|
19960 |
|
19961 | var getSpeed = function getSpeed(distance$$1, thresholds) {
|
19962 | if (distance$$1 >= thresholds.startFrom) {
|
19963 | return 0;
|
19964 | }
|
19965 |
|
19966 | if (distance$$1 <= thresholds.maxSpeedAt) {
|
19967 | return config.maxScrollSpeed;
|
19968 | }
|
19969 |
|
19970 | var distancePastStart = thresholds.startFrom - distance$$1;
|
19971 | var percentage = distancePastStart / thresholds.accelerationPlane;
|
19972 | var transformed = config.ease(percentage);
|
19973 | var speed = config.maxScrollSpeed * transformed;
|
19974 | return speed;
|
19975 | };
|
19976 |
|
19977 | var adjustForSizeLimits = function adjustForSizeLimits(_ref) {
|
19978 | var container = _ref.container,
|
19979 | subject = _ref.subject,
|
19980 | proposedScroll = _ref.proposedScroll;
|
19981 | var isTooBigVertically = subject.height > container.height;
|
19982 | var isTooBigHorizontally = subject.width > container.width;
|
19983 |
|
19984 | if (!isTooBigHorizontally && !isTooBigVertically) {
|
19985 | return proposedScroll;
|
19986 | }
|
19987 |
|
19988 | if (isTooBigHorizontally && isTooBigVertically) {
|
19989 | return null;
|
19990 | }
|
19991 |
|
19992 | return {
|
19993 | x: isTooBigHorizontally ? 0 : proposedScroll.x,
|
19994 | y: isTooBigVertically ? 0 : proposedScroll.y
|
19995 | };
|
19996 | };
|
19997 |
|
19998 | var getRequiredScroll = function getRequiredScroll(_ref2) {
|
19999 | var container = _ref2.container,
|
20000 | subject = _ref2.subject,
|
20001 | center = _ref2.center;
|
20002 | var distance$$1 = {
|
20003 | top: center.y - container.top,
|
20004 | right: container.right - center.x,
|
20005 | bottom: container.bottom - center.y,
|
20006 | left: center.x - container.left
|
20007 | };
|
20008 |
|
20009 | var y = function () {
|
20010 | var thresholds = getPixelThresholds(container, vertical);
|
20011 | var isCloserToBottom = distance$$1.bottom < distance$$1.top;
|
20012 |
|
20013 | if (isCloserToBottom) {
|
20014 | return getSpeed(distance$$1.bottom, thresholds);
|
20015 | }
|
20016 |
|
20017 | return -1 * getSpeed(distance$$1.top, thresholds);
|
20018 | }();
|
20019 |
|
20020 | var x = function () {
|
20021 | var thresholds = getPixelThresholds(container, horizontal);
|
20022 | var isCloserToRight = distance$$1.right < distance$$1.left;
|
20023 |
|
20024 | if (isCloserToRight) {
|
20025 | return getSpeed(distance$$1.right, thresholds);
|
20026 | }
|
20027 |
|
20028 | return -1 * getSpeed(distance$$1.left, thresholds);
|
20029 | }();
|
20030 |
|
20031 | var required = clean$1({
|
20032 | x: x,
|
20033 | y: y
|
20034 | });
|
20035 |
|
20036 | if (isEqual(required, origin)) {
|
20037 | return null;
|
20038 | }
|
20039 |
|
20040 | var limited = adjustForSizeLimits({
|
20041 | container: container,
|
20042 | subject: subject,
|
20043 | proposedScroll: required
|
20044 | });
|
20045 |
|
20046 | if (!limited) {
|
20047 | return null;
|
20048 | }
|
20049 |
|
20050 | return isEqual(limited, origin) ? null : limited;
|
20051 | };
|
20052 |
|
20053 | var withPlaceholder = function withPlaceholder(droppable, draggable) {
|
20054 | var closest$$1 = droppable.viewport.closestScrollable;
|
20055 |
|
20056 | if (!closest$$1) {
|
20057 | return null;
|
20058 | }
|
20059 |
|
20060 | var isOverHome = droppable.descriptor.id === draggable.descriptor.droppableId;
|
20061 | var max = closest$$1.scroll.max;
|
20062 | var current = closest$$1.scroll.current;
|
20063 |
|
20064 | if (isOverHome) {
|
20065 | return {
|
20066 | max: max,
|
20067 | current: current
|
20068 | };
|
20069 | }
|
20070 |
|
20071 | var spaceForPlaceholder = patch(droppable.axis.line, draggable.placeholder.client.borderBox[droppable.axis.size]);
|
20072 | var newMax = add(max, spaceForPlaceholder);
|
20073 | var newCurrent = {
|
20074 | x: Math.min(current.x, newMax.x),
|
20075 | y: Math.min(current.y, newMax.y)
|
20076 | };
|
20077 | return {
|
20078 | max: newMax,
|
20079 | current: newCurrent
|
20080 | };
|
20081 | };
|
20082 |
|
20083 | var createFluidScroller = (function (_ref3) {
|
20084 | var scrollWindow = _ref3.scrollWindow,
|
20085 | scrollDroppable = _ref3.scrollDroppable;
|
20086 | var scheduleWindowScroll = rafSchd(scrollWindow);
|
20087 | var scheduleDroppableScroll = rafSchd(scrollDroppable);
|
20088 |
|
20089 | var scroller = function scroller(state) {
|
20090 | var center = state.current.page.borderBoxCenter;
|
20091 | var draggable = state.dimensions.draggables[state.critical.draggable.id];
|
20092 | var subject = draggable.page.marginBox;
|
20093 | var viewport = state.viewport;
|
20094 | var requiredWindowScroll = getRequiredScroll({
|
20095 | container: viewport.frame,
|
20096 | subject: subject,
|
20097 | center: center
|
20098 | });
|
20099 |
|
20100 | if (requiredWindowScroll && canScrollWindow(viewport, requiredWindowScroll)) {
|
20101 | scheduleWindowScroll(requiredWindowScroll);
|
20102 | return;
|
20103 | }
|
20104 |
|
20105 | var droppable = getBestScrollableDroppable({
|
20106 | center: center,
|
20107 | destination: state.impact.destination,
|
20108 | droppables: state.dimensions.droppables
|
20109 | });
|
20110 |
|
20111 | if (!droppable) {
|
20112 | return;
|
20113 | }
|
20114 |
|
20115 | var closestScrollable = droppable.viewport.closestScrollable;
|
20116 |
|
20117 | if (!closestScrollable) {
|
20118 | return;
|
20119 | }
|
20120 |
|
20121 | var requiredFrameScroll = getRequiredScroll({
|
20122 | container: closestScrollable.framePageMarginBox,
|
20123 | subject: subject,
|
20124 | center: center
|
20125 | });
|
20126 |
|
20127 | if (!requiredFrameScroll) {
|
20128 | return;
|
20129 | }
|
20130 |
|
20131 | var result = withPlaceholder(droppable, draggable);
|
20132 |
|
20133 | if (!result) {
|
20134 | return;
|
20135 | }
|
20136 |
|
20137 | var closest$$1 = droppable.viewport.closestScrollable;
|
20138 |
|
20139 | if (!closest$$1) {
|
20140 | return;
|
20141 | }
|
20142 |
|
20143 | var canScrollDroppable$$1 = canPartiallyScroll({
|
20144 | current: result.current,
|
20145 | max: result.max,
|
20146 | change: requiredFrameScroll
|
20147 | });
|
20148 |
|
20149 | if (canScrollDroppable$$1) {
|
20150 | scheduleDroppableScroll(droppable.descriptor.id, requiredFrameScroll);
|
20151 | }
|
20152 | };
|
20153 |
|
20154 | scroller.cancel = function () {
|
20155 | scheduleWindowScroll.cancel();
|
20156 | scheduleDroppableScroll.cancel();
|
20157 | };
|
20158 |
|
20159 | return scroller;
|
20160 | });
|
20161 |
|
20162 | var createJumpScroller = (function (_ref) {
|
20163 | var move = _ref.move,
|
20164 | scrollDroppable = _ref.scrollDroppable,
|
20165 | scrollWindow = _ref.scrollWindow;
|
20166 |
|
20167 | var moveByOffset = function moveByOffset(state, offset) {
|
20168 | var client = add(state.current.client.selection, offset);
|
20169 | move({
|
20170 | client: client,
|
20171 | shouldAnimate: true
|
20172 | });
|
20173 | };
|
20174 |
|
20175 | var scrollDroppableAsMuchAsItCan = function scrollDroppableAsMuchAsItCan(droppable, change) {
|
20176 | if (!canScrollDroppable(droppable, change)) {
|
20177 | return change;
|
20178 | }
|
20179 |
|
20180 | var overlap = getDroppableOverlap(droppable, change);
|
20181 |
|
20182 | if (!overlap) {
|
20183 | scrollDroppable(droppable.descriptor.id, change);
|
20184 | return null;
|
20185 | }
|
20186 |
|
20187 | var whatTheDroppableCanScroll = subtract(change, overlap);
|
20188 | scrollDroppable(droppable.descriptor.id, whatTheDroppableCanScroll);
|
20189 | var remainder = subtract(change, whatTheDroppableCanScroll);
|
20190 | return remainder;
|
20191 | };
|
20192 |
|
20193 | var scrollWindowAsMuchAsItCan = function scrollWindowAsMuchAsItCan(viewport, change) {
|
20194 | if (!canScrollWindow(viewport, change)) {
|
20195 | return change;
|
20196 | }
|
20197 |
|
20198 | var overlap = getWindowOverlap(viewport, change);
|
20199 |
|
20200 | if (!overlap) {
|
20201 | scrollWindow(change);
|
20202 | return null;
|
20203 | }
|
20204 |
|
20205 | var whatTheWindowCanScroll = subtract(change, overlap);
|
20206 | scrollWindow(whatTheWindowCanScroll);
|
20207 | var remainder = subtract(change, whatTheWindowCanScroll);
|
20208 | return remainder;
|
20209 | };
|
20210 |
|
20211 | var jumpScroller = function jumpScroller(state) {
|
20212 | var request = state.scrollJumpRequest;
|
20213 |
|
20214 | if (!request) {
|
20215 | return;
|
20216 | }
|
20217 |
|
20218 | var destination = state.impact.destination;
|
20219 | !destination ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot perform a jump scroll when there is no destination') : invariant(false) : void 0;
|
20220 | var droppableRemainder = scrollDroppableAsMuchAsItCan(state.dimensions.droppables[destination.droppableId], request);
|
20221 |
|
20222 | if (!droppableRemainder) {
|
20223 | return;
|
20224 | }
|
20225 |
|
20226 | var viewport = state.viewport;
|
20227 | var windowRemainder = scrollWindowAsMuchAsItCan(viewport, droppableRemainder);
|
20228 |
|
20229 | if (!windowRemainder) {
|
20230 | return;
|
20231 | }
|
20232 |
|
20233 | moveByOffset(state, windowRemainder);
|
20234 | };
|
20235 |
|
20236 | return jumpScroller;
|
20237 | });
|
20238 |
|
20239 | var createAutoScroller = (function (_ref) {
|
20240 | var scrollDroppable = _ref.scrollDroppable,
|
20241 | scrollWindow = _ref.scrollWindow,
|
20242 | move = _ref.move;
|
20243 | var fluidScroll = createFluidScroller({
|
20244 | scrollWindow: scrollWindow,
|
20245 | scrollDroppable: scrollDroppable
|
20246 | });
|
20247 | var jumpScroll = createJumpScroller({
|
20248 | move: move,
|
20249 | scrollWindow: scrollWindow,
|
20250 | scrollDroppable: scrollDroppable
|
20251 | });
|
20252 | var marshal = {
|
20253 | cancel: fluidScroll.cancel,
|
20254 | fluidScroll: fluidScroll,
|
20255 | jumpScroll: jumpScroll
|
20256 | };
|
20257 | return marshal;
|
20258 | });
|
20259 |
|
20260 | var prefix$1 = function prefix(key) {
|
20261 | return "private-react-beautiful-dnd-key-do-not-use-" + key;
|
20262 | };
|
20263 |
|
20264 | var storeKey = prefix$1('store');
|
20265 | var droppableIdKey = prefix$1('droppable-id');
|
20266 | var droppableTypeKey = prefix$1('droppable-type');
|
20267 | var dimensionMarshalKey = prefix$1('dimension-marshal');
|
20268 | var styleContextKey = prefix$1('style-context');
|
20269 | var canLiftContextKey = prefix$1('can-lift');
|
20270 |
|
20271 | var _DragDropContext$chil;
|
20272 | var resetServerContext = function resetServerContext() {
|
20273 | resetStyleContext();
|
20274 | };
|
20275 |
|
20276 | var printFatalDevError = function printFatalDevError(error) {
|
20277 | if (process.env.NODE_ENV === 'production') {
|
20278 | return;
|
20279 | }
|
20280 |
|
20281 | console.warn("\n An error has occurred while a drag is occurring.\n Any existing drag will be cancelled.\n\n Raw error:\n ");
|
20282 | console.error(error);
|
20283 | };
|
20284 |
|
20285 | var DragDropContext = function (_React$Component) {
|
20286 | _inheritsLoose(DragDropContext, _React$Component);
|
20287 |
|
20288 | function DragDropContext(props, context) {
|
20289 | var _this;
|
20290 |
|
20291 | _this = _React$Component.call(this, props, context) || this;
|
20292 | _this.store = void 0;
|
20293 | _this.dimensionMarshal = void 0;
|
20294 | _this.styleMarshal = void 0;
|
20295 | _this.autoScroller = void 0;
|
20296 | _this.announcer = void 0;
|
20297 | _this.unsubscribe = void 0;
|
20298 |
|
20299 | _this.canLift = function (id) {
|
20300 | return canStartDrag(_this.store.getState(), id);
|
20301 | };
|
20302 |
|
20303 | _this.onFatalError = function (error) {
|
20304 | printFatalDevError(error);
|
20305 |
|
20306 | var state = _this.store.getState();
|
20307 |
|
20308 | if (state.phase !== 'IDLE') {
|
20309 | _this.store.dispatch(clean());
|
20310 | }
|
20311 | };
|
20312 |
|
20313 | _this.onWindowError = function (error) {
|
20314 | return _this.onFatalError(error);
|
20315 | };
|
20316 |
|
20317 | _this.announcer = createAnnouncer();
|
20318 | _this.styleMarshal = createStyleMarshal();
|
20319 | _this.store = createStore({
|
20320 | getDimensionMarshal: function getDimensionMarshal() {
|
20321 | return _this.dimensionMarshal;
|
20322 | },
|
20323 | styleMarshal: _this.styleMarshal,
|
20324 | getHooks: function getHooks() {
|
20325 | return {
|
20326 | onBeforeDragStart: _this.props.onBeforeDragStart,
|
20327 | onDragStart: _this.props.onDragStart,
|
20328 | onDragEnd: _this.props.onDragEnd,
|
20329 | onDragUpdate: _this.props.onDragUpdate
|
20330 | };
|
20331 | },
|
20332 | announce: _this.announcer.announce,
|
20333 | getScroller: function getScroller() {
|
20334 | return _this.autoScroller;
|
20335 | }
|
20336 | });
|
20337 | var callbacks = redux.bindActionCreators({
|
20338 | collectionStarting: collectionStarting,
|
20339 | publish: publish,
|
20340 | updateDroppableScroll: updateDroppableScroll,
|
20341 | updateDroppableIsEnabled: updateDroppableIsEnabled
|
20342 | }, _this.store.dispatch);
|
20343 | _this.dimensionMarshal = createDimensionMarshal(callbacks);
|
20344 | _this.autoScroller = createAutoScroller(_extends({
|
20345 | scrollWindow: scrollWindow,
|
20346 | scrollDroppable: _this.dimensionMarshal.scrollDroppable
|
20347 | }, redux.bindActionCreators({
|
20348 | move: move
|
20349 | }, _this.store.dispatch)));
|
20350 | return _this;
|
20351 | }
|
20352 |
|
20353 | var _proto = DragDropContext.prototype;
|
20354 |
|
20355 | _proto.getChildContext = function getChildContext() {
|
20356 | var _ref;
|
20357 |
|
20358 | return _ref = {}, _ref[storeKey] = this.store, _ref[dimensionMarshalKey] = this.dimensionMarshal, _ref[styleContextKey] = this.styleMarshal.styleContext, _ref[canLiftContextKey] = this.canLift, _ref;
|
20359 | };
|
20360 |
|
20361 | _proto.componentDidMount = function componentDidMount() {
|
20362 | window.addEventListener('error', this.onWindowError);
|
20363 | this.styleMarshal.mount();
|
20364 | this.announcer.mount();
|
20365 | };
|
20366 |
|
20367 | _proto.componentDidCatch = function componentDidCatch(error) {
|
20368 | this.onFatalError(error);
|
20369 |
|
20370 | if (error.message.indexOf('Invariant failed') !== -1) {
|
20371 | this.setState({});
|
20372 | return;
|
20373 | }
|
20374 |
|
20375 | throw error;
|
20376 | };
|
20377 |
|
20378 | _proto.componentWillUnmount = function componentWillUnmount() {
|
20379 | window.removeEventListener('error', this.onWindowError);
|
20380 | var state = this.store.getState();
|
20381 |
|
20382 | if (state.phase !== 'IDLE') {
|
20383 | this.store.dispatch(clean());
|
20384 | }
|
20385 |
|
20386 | this.styleMarshal.unmount();
|
20387 | this.announcer.unmount();
|
20388 | };
|
20389 |
|
20390 | _proto.render = function render() {
|
20391 | return this.props.children;
|
20392 | };
|
20393 |
|
20394 | return DragDropContext;
|
20395 | }(React__default.Component);
|
20396 |
|
20397 | DragDropContext.childContextTypes = (_DragDropContext$chil = {}, _DragDropContext$chil[storeKey] = PropTypes.shape({
|
20398 | dispatch: PropTypes.func.isRequired,
|
20399 | subscribe: PropTypes.func.isRequired,
|
20400 | getState: PropTypes.func.isRequired
|
20401 | }).isRequired, _DragDropContext$chil[dimensionMarshalKey] = PropTypes.object.isRequired, _DragDropContext$chil[styleContextKey] = PropTypes.string.isRequired, _DragDropContext$chil[canLiftContextKey] = PropTypes.func.isRequired, _DragDropContext$chil);
|
20402 |
|
20403 | var isScrollable = function isScrollable() {
|
20404 | for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
20405 | values[_key] = arguments[_key];
|
20406 | }
|
20407 |
|
20408 | return values.some(function (value) {
|
20409 | return value === 'auto' || value === 'scroll';
|
20410 | });
|
20411 | };
|
20412 |
|
20413 | var isElementScrollable = function isElementScrollable(el) {
|
20414 | var style = window.getComputedStyle(el);
|
20415 | return isScrollable(style.overflow, style.overflowY, style.overflowX);
|
20416 | };
|
20417 |
|
20418 | var getClosestScrollable = function getClosestScrollable(el) {
|
20419 | if (el == null) {
|
20420 | return null;
|
20421 | }
|
20422 |
|
20423 | if (!isElementScrollable(el)) {
|
20424 | return getClosestScrollable(el.parentElement);
|
20425 | }
|
20426 |
|
20427 | return el;
|
20428 | };
|
20429 |
|
20430 | var _DroppableDimensionPu;
|
20431 |
|
20432 | var getScroll = function getScroll(el) {
|
20433 | return {
|
20434 | x: el.scrollLeft,
|
20435 | y: el.scrollTop
|
20436 | };
|
20437 | };
|
20438 |
|
20439 | var checkForNestedScrollContainers = function checkForNestedScrollContainers(scrollable) {
|
20440 | if (process.env.NODE_ENV === 'production') {
|
20441 | return;
|
20442 | }
|
20443 |
|
20444 | if (!scrollable) {
|
20445 | return;
|
20446 | }
|
20447 |
|
20448 | var anotherScrollParent = getClosestScrollable(scrollable.parentElement);
|
20449 |
|
20450 | if (!anotherScrollParent) {
|
20451 | return;
|
20452 | }
|
20453 |
|
20454 | console.warn("\n Droppable: unsupported nested scroll container detected.\n A Droppable can only have one scroll parent (which can be itself)\n Nested scroll containers are currently not supported.\n\n We hope to support nested scroll containers soon: https://github.com/atlassian/react-beautiful-dnd/issues/131\n ");
|
20455 | };
|
20456 |
|
20457 | var listenerOptions = {
|
20458 | passive: true
|
20459 | };
|
20460 |
|
20461 | var DroppableDimensionPublisher = function (_React$Component) {
|
20462 | _inheritsLoose(DroppableDimensionPublisher, _React$Component);
|
20463 |
|
20464 | function DroppableDimensionPublisher(props, context) {
|
20465 | var _this;
|
20466 |
|
20467 | _this = _React$Component.call(this, props, context) || this;
|
20468 | _this.watchingScroll = null;
|
20469 | _this.callbacks = void 0;
|
20470 | _this.publishedDescriptor = null;
|
20471 |
|
20472 | _this.getClosestScroll = function () {
|
20473 | if (!_this.watchingScroll) {
|
20474 | return origin;
|
20475 | }
|
20476 |
|
20477 | return getScroll(_this.watchingScroll.closestScrollable);
|
20478 | };
|
20479 |
|
20480 | _this.memoizedUpdateScroll = memoizeOne(function (x, y) {
|
20481 | !_this.publishedDescriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot update scroll on unpublished droppable') : invariant(false) : void 0;
|
20482 | var newScroll = {
|
20483 | x: x,
|
20484 | y: y
|
20485 | };
|
20486 | var marshal = _this.context[dimensionMarshalKey];
|
20487 | marshal.updateDroppableScroll(_this.publishedDescriptor.id, newScroll);
|
20488 | });
|
20489 |
|
20490 | _this.updateScroll = function () {
|
20491 | var offset = _this.getClosestScroll();
|
20492 |
|
20493 | _this.memoizedUpdateScroll(offset.x, offset.y);
|
20494 | };
|
20495 |
|
20496 | _this.scheduleScrollUpdate = rafSchd(_this.updateScroll);
|
20497 |
|
20498 | _this.onClosestScroll = function () {
|
20499 | !_this.watchingScroll ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not find scroll options while scrolling') : invariant(false) : void 0;
|
20500 | var options = _this.watchingScroll.options;
|
20501 |
|
20502 | if (options.shouldPublishImmediately) {
|
20503 | _this.updateScroll();
|
20504 |
|
20505 | return;
|
20506 | }
|
20507 |
|
20508 | _this.scheduleScrollUpdate();
|
20509 | };
|
20510 |
|
20511 | _this.scroll = function (change) {
|
20512 | !_this.watchingScroll ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot scroll a droppable with no closest scrollable') : invariant(false) : void 0;
|
20513 | var closestScrollable = _this.watchingScroll.closestScrollable;
|
20514 | closestScrollable.scrollTop += change.y;
|
20515 | closestScrollable.scrollLeft += change.x;
|
20516 | };
|
20517 |
|
20518 | _this.watchScroll = function (closestScrollable, options) {
|
20519 | !!_this.watchingScroll ? process.env.NODE_ENV !== "production" ? invariant(false, 'Droppable cannot watch scroll as it is already watching scroll') : invariant(false) : void 0;
|
20520 |
|
20521 | if (!closestScrollable) {
|
20522 | return;
|
20523 | }
|
20524 |
|
20525 | _this.watchingScroll = {
|
20526 | options: options,
|
20527 | closestScrollable: closestScrollable
|
20528 | };
|
20529 | closestScrollable.addEventListener('scroll', _this.onClosestScroll, listenerOptions);
|
20530 | };
|
20531 |
|
20532 | _this.unwatchScroll = function () {
|
20533 | var watching = _this.watchingScroll;
|
20534 |
|
20535 | if (!watching) {
|
20536 | return;
|
20537 | }
|
20538 |
|
20539 | _this.scheduleScrollUpdate.cancel();
|
20540 |
|
20541 | watching.closestScrollable.removeEventListener('scroll', _this.onClosestScroll, listenerOptions);
|
20542 | _this.watchingScroll = null;
|
20543 | };
|
20544 |
|
20545 | _this.getMemoizedDescriptor = memoizeOne(function (id, type) {
|
20546 | return {
|
20547 | id: id,
|
20548 | type: type
|
20549 | };
|
20550 | });
|
20551 |
|
20552 | _this.publish = function () {
|
20553 | var marshal = _this.context[dimensionMarshalKey];
|
20554 |
|
20555 | var descriptor = _this.getMemoizedDescriptor(_this.props.droppableId, _this.props.type);
|
20556 |
|
20557 | if (!_this.publishedDescriptor) {
|
20558 | marshal.registerDroppable(descriptor, _this.callbacks);
|
20559 | _this.publishedDescriptor = descriptor;
|
20560 | return;
|
20561 | }
|
20562 |
|
20563 | if (_this.publishedDescriptor === descriptor) {
|
20564 | return;
|
20565 | }
|
20566 |
|
20567 | marshal.updateDroppable(_this.publishedDescriptor, descriptor, _this.callbacks);
|
20568 | _this.publishedDescriptor = descriptor;
|
20569 | };
|
20570 |
|
20571 | _this.unpublish = function () {
|
20572 | !_this.publishedDescriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot unpublish descriptor when none is published') : invariant(false) : void 0;
|
20573 | var marshal = _this.context[dimensionMarshalKey];
|
20574 | marshal.unregisterDroppable(_this.publishedDescriptor);
|
20575 | _this.publishedDescriptor = null;
|
20576 | };
|
20577 |
|
20578 | _this.getDimensionAndWatchScroll = function (windowScroll, options) {
|
20579 | var _this$props = _this.props,
|
20580 | direction = _this$props.direction,
|
20581 | ignoreContainerClipping = _this$props.ignoreContainerClipping,
|
20582 | isDropDisabled = _this$props.isDropDisabled,
|
20583 | getDroppableRef = _this$props.getDroppableRef;
|
20584 | var targetRef = getDroppableRef();
|
20585 | var descriptor = _this.publishedDescriptor;
|
20586 | !targetRef ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot calculate a dimension when not attached to the DOM') : invariant(false) : void 0;
|
20587 | !descriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get dimension for unpublished droppable') : invariant(false) : void 0;
|
20588 | var scrollableRef = getClosestScrollable(targetRef);
|
20589 | checkForNestedScrollContainers(scrollableRef);
|
20590 |
|
20591 | _this.watchScroll(scrollableRef, options);
|
20592 |
|
20593 | var client = function () {
|
20594 | var base = cssBoxModel.getBox(targetRef);
|
20595 |
|
20596 | if (!scrollableRef) {
|
20597 | return base;
|
20598 | }
|
20599 |
|
20600 | if (targetRef !== scrollableRef) {
|
20601 | return base;
|
20602 | }
|
20603 |
|
20604 | var top = base.paddingBox.top - scrollableRef.scrollTop;
|
20605 | var left = base.paddingBox.left - scrollableRef.scrollLeft;
|
20606 | var bottom = top + scrollableRef.scrollHeight;
|
20607 | var right = left + scrollableRef.scrollWidth;
|
20608 | var paddingBox = {
|
20609 | top: top,
|
20610 | right: right,
|
20611 | bottom: bottom,
|
20612 | left: left
|
20613 | };
|
20614 | var borderBox = {
|
20615 | top: paddingBox.top - base.border.top,
|
20616 | right: paddingBox.right + base.border.right,
|
20617 | bottom: paddingBox.bottom + base.border.bottom,
|
20618 | left: paddingBox.left - base.border.left
|
20619 | };
|
20620 | return cssBoxModel.createBox({
|
20621 | borderBox: borderBox,
|
20622 | margin: base.margin,
|
20623 | border: base.border,
|
20624 | padding: base.padding
|
20625 | });
|
20626 | }();
|
20627 |
|
20628 | var page = cssBoxModel.withScroll(client, windowScroll);
|
20629 |
|
20630 | var closest$$1 = function () {
|
20631 | if (!scrollableRef) {
|
20632 | return null;
|
20633 | }
|
20634 |
|
20635 | var frameClient = cssBoxModel.getBox(scrollableRef);
|
20636 | return {
|
20637 | client: frameClient,
|
20638 | page: cssBoxModel.withScroll(frameClient),
|
20639 | scrollHeight: scrollableRef.scrollHeight,
|
20640 | scrollWidth: scrollableRef.scrollWidth,
|
20641 | scroll: getScroll(scrollableRef),
|
20642 | shouldClipSubject: !ignoreContainerClipping
|
20643 | };
|
20644 | }();
|
20645 |
|
20646 | return getDroppableDimension({
|
20647 | descriptor: descriptor,
|
20648 | isEnabled: !isDropDisabled,
|
20649 | direction: direction,
|
20650 | client: client,
|
20651 | page: page,
|
20652 | closest: closest$$1
|
20653 | });
|
20654 | };
|
20655 |
|
20656 | var callbacks = {
|
20657 | getDimensionAndWatchScroll: _this.getDimensionAndWatchScroll,
|
20658 | unwatchScroll: _this.unwatchScroll,
|
20659 | scroll: _this.scroll
|
20660 | };
|
20661 | _this.callbacks = callbacks;
|
20662 | return _this;
|
20663 | }
|
20664 |
|
20665 | var _proto = DroppableDimensionPublisher.prototype;
|
20666 |
|
20667 | _proto.componentDidMount = function componentDidMount() {
|
20668 | this.publish();
|
20669 | };
|
20670 |
|
20671 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
20672 | this.publish();
|
20673 |
|
20674 | if (this.props.isDropDisabled === prevProps.isDropDisabled) {
|
20675 | return;
|
20676 | }
|
20677 |
|
20678 | var marshal = this.context[dimensionMarshalKey];
|
20679 | marshal.updateDroppableIsEnabled(this.props.droppableId, !this.props.isDropDisabled);
|
20680 | };
|
20681 |
|
20682 | _proto.componentWillUnmount = function componentWillUnmount() {
|
20683 | if (this.watchingScroll) {
|
20684 | if (process.env.NODE_ENV !== 'production') {
|
20685 | console.warn('Unmounting droppable while it was watching scroll');
|
20686 | }
|
20687 |
|
20688 | this.unwatchScroll();
|
20689 | }
|
20690 |
|
20691 | this.unpublish();
|
20692 | };
|
20693 |
|
20694 | _proto.render = function render() {
|
20695 | return this.props.children;
|
20696 | };
|
20697 |
|
20698 | return DroppableDimensionPublisher;
|
20699 | }(React__default.Component);
|
20700 |
|
20701 | DroppableDimensionPublisher.contextTypes = (_DroppableDimensionPu = {}, _DroppableDimensionPu[dimensionMarshalKey] = PropTypes.object.isRequired, _DroppableDimensionPu);
|
20702 |
|
20703 | var Placeholder = function (_PureComponent) {
|
20704 | _inheritsLoose(Placeholder, _PureComponent);
|
20705 |
|
20706 | function Placeholder() {
|
20707 | return _PureComponent.apply(this, arguments) || this;
|
20708 | }
|
20709 |
|
20710 | var _proto = Placeholder.prototype;
|
20711 |
|
20712 | _proto.componentDidMount = function componentDidMount() {
|
20713 | if (this.props.onMount) {
|
20714 | this.props.onMount();
|
20715 | }
|
20716 | };
|
20717 |
|
20718 | _proto.componentWillUnmount = function componentWillUnmount() {
|
20719 | if (this.props.onUnmount) {
|
20720 | this.props.onUnmount();
|
20721 | }
|
20722 | };
|
20723 |
|
20724 | _proto.render = function render() {
|
20725 | var placeholder = this.props.placeholder;
|
20726 | var client = placeholder.client,
|
20727 | display = placeholder.display,
|
20728 | tagName = placeholder.tagName;
|
20729 | var style = {
|
20730 | display: display,
|
20731 | boxSizing: 'border-box',
|
20732 | width: client.borderBox.width,
|
20733 | height: client.borderBox.height,
|
20734 | marginTop: client.margin.top,
|
20735 | marginRight: client.margin.right,
|
20736 | marginBottom: client.margin.bottom,
|
20737 | marginLeft: client.margin.left,
|
20738 | flexShrink: '0',
|
20739 | flexGrow: '0',
|
20740 | pointerEvents: 'none'
|
20741 | };
|
20742 | return React__default.createElement(tagName, {
|
20743 | style: style
|
20744 | });
|
20745 | };
|
20746 |
|
20747 | return Placeholder;
|
20748 | }(React.PureComponent);
|
20749 |
|
20750 | var throwIfRefIsInvalid = (function (ref) {
|
20751 | !(ref && ref instanceof HTMLElement) ? process.env.NODE_ENV !== "production" ? invariant(false, "\n provided.innerRef has not been provided with a HTMLElement.\n\n You can find a guide on using the innerRef callback functions at:\n https://github.com/atlassian/react-beautiful-dnd/blob/master/docs/guides/using-inner-ref.md\n ") : invariant(false) : void 0;
|
20752 | });
|
20753 |
|
20754 | var _Droppable$contextTyp, _Droppable$childConte;
|
20755 |
|
20756 | var Droppable = function (_Component) {
|
20757 | _inheritsLoose(Droppable, _Component);
|
20758 |
|
20759 | function Droppable(props, context) {
|
20760 | var _this;
|
20761 |
|
20762 | _this = _Component.call(this, props, context) || this;
|
20763 | _this.styleContext = void 0;
|
20764 | _this.ref = null;
|
20765 | _this.isPlaceholderMounted = false;
|
20766 |
|
20767 | _this.onPlaceholderMount = function () {
|
20768 | _this.isPlaceholderMounted = true;
|
20769 | };
|
20770 |
|
20771 | _this.onPlaceholderUnmount = function () {
|
20772 | _this.isPlaceholderMounted = false;
|
20773 | };
|
20774 |
|
20775 | _this.setRef = function (ref) {
|
20776 | if (ref === null) {
|
20777 | return;
|
20778 | }
|
20779 |
|
20780 | if (ref === _this.ref) {
|
20781 | return;
|
20782 | }
|
20783 |
|
20784 | _this.ref = ref;
|
20785 | throwIfRefIsInvalid(ref);
|
20786 | };
|
20787 |
|
20788 | _this.getDroppableRef = function () {
|
20789 | return _this.ref;
|
20790 | };
|
20791 |
|
20792 | _this.styleContext = context[styleContextKey];
|
20793 | return _this;
|
20794 | }
|
20795 |
|
20796 | var _proto = Droppable.prototype;
|
20797 |
|
20798 | _proto.getChildContext = function getChildContext() {
|
20799 | var _value;
|
20800 |
|
20801 | var value = (_value = {}, _value[droppableIdKey] = this.props.droppableId, _value[droppableTypeKey] = this.props.type, _value);
|
20802 | return value;
|
20803 | };
|
20804 |
|
20805 | _proto.componentDidMount = function componentDidMount() {
|
20806 | throwIfRefIsInvalid(this.ref);
|
20807 | this.warnIfPlaceholderNotMounted();
|
20808 | };
|
20809 |
|
20810 | _proto.componentDidUpdate = function componentDidUpdate() {
|
20811 | this.warnIfPlaceholderNotMounted();
|
20812 | };
|
20813 |
|
20814 | _proto.warnIfPlaceholderNotMounted = function warnIfPlaceholderNotMounted() {
|
20815 | if (process.env.NODE_ENV === 'production') {
|
20816 | return;
|
20817 | }
|
20818 |
|
20819 | if (!this.props.placeholder) {
|
20820 | return;
|
20821 | }
|
20822 |
|
20823 | if (this.isPlaceholderMounted) {
|
20824 | return;
|
20825 | }
|
20826 |
|
20827 | console.warn("\n Droppable setup issue: DroppableProvided > placeholder could not be found.\n Please be sure to add the {provided.placeholder} Node as a child of your Droppable\n\n More information: https://github.com/atlassian/react-beautiful-dnd#1-provided-droppableprovided\n ");
|
20828 | };
|
20829 |
|
20830 | _proto.getPlaceholder = function getPlaceholder() {
|
20831 | if (!this.props.placeholder) {
|
20832 | return null;
|
20833 | }
|
20834 |
|
20835 | return React__default.createElement(Placeholder, {
|
20836 | placeholder: this.props.placeholder,
|
20837 | onMount: this.onPlaceholderMount,
|
20838 | onUnmount: this.onPlaceholderUnmount
|
20839 | });
|
20840 | };
|
20841 |
|
20842 | _proto.render = function render() {
|
20843 | var _this$props = this.props,
|
20844 | children = _this$props.children,
|
20845 | direction = _this$props.direction,
|
20846 | droppableId = _this$props.droppableId,
|
20847 | ignoreContainerClipping = _this$props.ignoreContainerClipping,
|
20848 | isDraggingOver = _this$props.isDraggingOver,
|
20849 | isDropDisabled = _this$props.isDropDisabled,
|
20850 | draggingOverWith = _this$props.draggingOverWith,
|
20851 | type = _this$props.type;
|
20852 | var provided = {
|
20853 | innerRef: this.setRef,
|
20854 | placeholder: this.getPlaceholder(),
|
20855 | droppableProps: {
|
20856 | 'data-react-beautiful-dnd-droppable': this.styleContext
|
20857 | }
|
20858 | };
|
20859 | var snapshot = {
|
20860 | isDraggingOver: isDraggingOver,
|
20861 | draggingOverWith: draggingOverWith
|
20862 | };
|
20863 | return React__default.createElement(DroppableDimensionPublisher, {
|
20864 | droppableId: droppableId,
|
20865 | type: type,
|
20866 | direction: direction,
|
20867 | ignoreContainerClipping: ignoreContainerClipping,
|
20868 | isDropDisabled: isDropDisabled,
|
20869 | getDroppableRef: this.getDroppableRef
|
20870 | }, children(provided, snapshot));
|
20871 | };
|
20872 |
|
20873 | return Droppable;
|
20874 | }(React.Component);
|
20875 |
|
20876 | Droppable.contextTypes = (_Droppable$contextTyp = {}, _Droppable$contextTyp[styleContextKey] = PropTypes.string.isRequired, _Droppable$contextTyp);
|
20877 | Droppable.childContextTypes = (_Droppable$childConte = {}, _Droppable$childConte[droppableIdKey] = PropTypes.string.isRequired, _Droppable$childConte[droppableTypeKey] = PropTypes.string.isRequired, _Droppable$childConte);
|
20878 |
|
20879 | var isStrictEqual = (function (a, b) {
|
20880 | return a === b;
|
20881 | });
|
20882 |
|
20883 | var makeMapStateToProps = function makeMapStateToProps() {
|
20884 | var getIsDraggingOver = function getIsDraggingOver(id, destination) {
|
20885 | if (!destination) {
|
20886 | return false;
|
20887 | }
|
20888 |
|
20889 | return destination.droppableId === id;
|
20890 | };
|
20891 |
|
20892 | var shouldUsePlaceholder = function shouldUsePlaceholder(id, descriptor, destination) {
|
20893 | if (!destination) {
|
20894 | return false;
|
20895 | }
|
20896 |
|
20897 | if (id === descriptor.droppableId) {
|
20898 | return false;
|
20899 | }
|
20900 |
|
20901 | return id === destination.droppableId;
|
20902 | };
|
20903 |
|
20904 | var getMapProps = memoizeOne(function (isDraggingOver, draggingOverWith, placeholder) {
|
20905 | return {
|
20906 | isDraggingOver: isDraggingOver,
|
20907 | draggingOverWith: draggingOverWith,
|
20908 | placeholder: placeholder
|
20909 | };
|
20910 | });
|
20911 |
|
20912 | var getDefault = function getDefault() {
|
20913 | return getMapProps(false, null, null);
|
20914 | };
|
20915 |
|
20916 | var selector = function selector(state, ownProps) {
|
20917 | if (ownProps.isDropDisabled) {
|
20918 | return getDefault();
|
20919 | }
|
20920 |
|
20921 | var id = ownProps.droppableId;
|
20922 |
|
20923 | if (state.isDragging) {
|
20924 | var destination = state.impact.destination;
|
20925 | var isDraggingOver = getIsDraggingOver(id, destination);
|
20926 | var draggableId = state.critical.draggable.id;
|
20927 | var draggingOverWith = isDraggingOver ? draggableId : null;
|
20928 | var draggable = state.dimensions.draggables[draggableId];
|
20929 | var placeholder = shouldUsePlaceholder(id, draggable.descriptor, destination) ? draggable.placeholder : null;
|
20930 | return getMapProps(isDraggingOver, draggingOverWith, placeholder);
|
20931 | }
|
20932 |
|
20933 | if (state.phase === 'DROP_ANIMATING') {
|
20934 | var _destination = state.pending.impact.destination;
|
20935 |
|
20936 | var _isDraggingOver = getIsDraggingOver(id, _destination);
|
20937 |
|
20938 | var _draggableId = state.pending.result.draggableId;
|
20939 |
|
20940 | var _draggingOverWith = _isDraggingOver ? _draggableId : null;
|
20941 |
|
20942 | var _draggable = state.dimensions.draggables[_draggableId];
|
20943 |
|
20944 | var _placeholder = shouldUsePlaceholder(id, _draggable.descriptor, _destination) ? _draggable.placeholder : null;
|
20945 |
|
20946 | return getMapProps(_isDraggingOver, _draggingOverWith, _placeholder);
|
20947 | }
|
20948 |
|
20949 | return getDefault();
|
20950 | };
|
20951 |
|
20952 | return selector;
|
20953 | };
|
20954 | var connectedDroppable = reactRedux.connect(makeMapStateToProps, null, null, {
|
20955 | storeKey: storeKey,
|
20956 | pure: true,
|
20957 | areStatePropsEqual: isStrictEqual
|
20958 | })(Droppable);
|
20959 | connectedDroppable.defaultProps = {
|
20960 | type: 'DEFAULT',
|
20961 | isDropDisabled: false,
|
20962 | direction: 'vertical',
|
20963 | ignoreContainerClipping: false
|
20964 | };
|
20965 |
|
20966 | var _DraggableDimensionPu;
|
20967 |
|
20968 | var DraggableDimensionPublisher = function (_Component) {
|
20969 | _inheritsLoose(DraggableDimensionPublisher, _Component);
|
20970 |
|
20971 | function DraggableDimensionPublisher() {
|
20972 | var _this;
|
20973 |
|
20974 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
20975 | args[_key] = arguments[_key];
|
20976 | }
|
20977 |
|
20978 | _this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
20979 | _this.publishedDescriptor = null;
|
20980 | _this.getMemoizedDescriptor = memoizeOne(function (id, index, droppableId, type) {
|
20981 | return {
|
20982 | id: id,
|
20983 | index: index,
|
20984 | droppableId: droppableId,
|
20985 | type: type
|
20986 | };
|
20987 | });
|
20988 |
|
20989 | _this.publish = function () {
|
20990 | var marshal = _this.context[dimensionMarshalKey];
|
20991 |
|
20992 | var descriptor = _this.getMemoizedDescriptor(_this.props.draggableId, _this.props.index, _this.props.droppableId, _this.props.type);
|
20993 |
|
20994 | if (!_this.publishedDescriptor) {
|
20995 | marshal.registerDraggable(descriptor, _this.getDimension);
|
20996 | _this.publishedDescriptor = descriptor;
|
20997 | return;
|
20998 | }
|
20999 |
|
21000 | if (descriptor === _this.publishedDescriptor) {
|
21001 | return;
|
21002 | }
|
21003 |
|
21004 | marshal.updateDraggable(_this.publishedDescriptor, descriptor, _this.getDimension);
|
21005 | _this.publishedDescriptor = descriptor;
|
21006 | };
|
21007 |
|
21008 | _this.unpublish = function () {
|
21009 | !_this.publishedDescriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot unpublish descriptor when none is published') : invariant(false) : void 0;
|
21010 | var marshal = _this.context[dimensionMarshalKey];
|
21011 | marshal.unregisterDraggable(_this.publishedDescriptor);
|
21012 | _this.publishedDescriptor = null;
|
21013 | };
|
21014 |
|
21015 | _this.getDimension = function (windowScroll) {
|
21016 | var targetRef = _this.props.getDraggableRef();
|
21017 |
|
21018 | var descriptor = _this.publishedDescriptor;
|
21019 | !targetRef ? process.env.NODE_ENV !== "production" ? invariant(false, 'DraggableDimensionPublisher cannot calculate a dimension when not attached to the DOM') : invariant(false) : void 0;
|
21020 | !descriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get dimension for unpublished draggable') : invariant(false) : void 0;
|
21021 | var computedStyles = window.getComputedStyle(targetRef);
|
21022 | var borderBox = targetRef.getBoundingClientRect();
|
21023 | var client = cssBoxModel.calculateBox(borderBox, computedStyles);
|
21024 | var page = cssBoxModel.withScroll(client, windowScroll);
|
21025 | var placeholder = {
|
21026 | client: client,
|
21027 | tagName: targetRef.tagName.toLowerCase(),
|
21028 | display: computedStyles.display
|
21029 | };
|
21030 | var dimension = {
|
21031 | descriptor: descriptor,
|
21032 | placeholder: placeholder,
|
21033 | client: client,
|
21034 | page: page
|
21035 | };
|
21036 | return dimension;
|
21037 | };
|
21038 |
|
21039 | return _this;
|
21040 | }
|
21041 |
|
21042 | var _proto = DraggableDimensionPublisher.prototype;
|
21043 |
|
21044 | _proto.componentDidMount = function componentDidMount() {
|
21045 | this.publish();
|
21046 | };
|
21047 |
|
21048 | _proto.componentDidUpdate = function componentDidUpdate() {
|
21049 | this.publish();
|
21050 | };
|
21051 |
|
21052 | _proto.componentWillUnmount = function componentWillUnmount() {
|
21053 | this.unpublish();
|
21054 | };
|
21055 |
|
21056 | _proto.render = function render() {
|
21057 | return this.props.children;
|
21058 | };
|
21059 |
|
21060 | return DraggableDimensionPublisher;
|
21061 | }(React.Component);
|
21062 |
|
21063 | DraggableDimensionPublisher.contextTypes = (_DraggableDimensionPu = {}, _DraggableDimensionPu[dimensionMarshalKey] = PropTypes.object.isRequired, _DraggableDimensionPu);
|
21064 |
|
21065 | var DoubleRenderBlocker = function (_React$Component) {
|
21066 | _inheritsLoose(DoubleRenderBlocker, _React$Component);
|
21067 |
|
21068 | function DoubleRenderBlocker() {
|
21069 | return _React$Component.apply(this, arguments) || this;
|
21070 | }
|
21071 |
|
21072 | var _proto = DoubleRenderBlocker.prototype;
|
21073 |
|
21074 | _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
21075 | if (isEqual(origin, nextProps.change)) {
|
21076 | return true;
|
21077 | }
|
21078 |
|
21079 | if (isEqual(this.props.change, nextProps.change)) {
|
21080 | return false;
|
21081 | }
|
21082 |
|
21083 | return true;
|
21084 | };
|
21085 |
|
21086 | _proto.render = function render() {
|
21087 | return this.props.children(this.props.change);
|
21088 | };
|
21089 |
|
21090 | return DoubleRenderBlocker;
|
21091 | }(React__default.Component);
|
21092 |
|
21093 | var Moveable = function (_Component) {
|
21094 | _inheritsLoose(Moveable, _Component);
|
21095 |
|
21096 | function Moveable() {
|
21097 | return _Component.apply(this, arguments) || this;
|
21098 | }
|
21099 |
|
21100 | var _proto2 = Moveable.prototype;
|
21101 |
|
21102 | _proto2.getFinal = function getFinal() {
|
21103 | var destination = this.props.destination;
|
21104 | var speed = this.props.speed;
|
21105 |
|
21106 | if (speed === 'INSTANT') {
|
21107 | return destination;
|
21108 | }
|
21109 |
|
21110 | var config = speed === 'FAST' ? physics.fast : physics.standard;
|
21111 | return {
|
21112 | x: reactMotion.spring(destination.x, config),
|
21113 | y: reactMotion.spring(destination.y, config)
|
21114 | };
|
21115 | };
|
21116 |
|
21117 | _proto2.render = function render() {
|
21118 | var _this = this;
|
21119 |
|
21120 | var final = this.getFinal();
|
21121 | return React__default.createElement(reactMotion.Motion, {
|
21122 | defaultStyle: origin,
|
21123 | style: final,
|
21124 | onRest: this.props.onMoveEnd
|
21125 | }, function (current) {
|
21126 | var _this$props = _this.props,
|
21127 | speed = _this$props.speed,
|
21128 | destination = _this$props.destination,
|
21129 | children = _this$props.children;
|
21130 | var target = speed === 'INSTANT' ? destination : current;
|
21131 | return React__default.createElement(DoubleRenderBlocker, {
|
21132 | change: target
|
21133 | }, children);
|
21134 | });
|
21135 | };
|
21136 |
|
21137 | return Moveable;
|
21138 | }(React.Component);
|
21139 |
|
21140 | Moveable.defaultProps = {
|
21141 | destination: origin
|
21142 | };
|
21143 |
|
21144 | var getWindowFromRef = (function (ref) {
|
21145 | return ref ? ref.ownerDocument.defaultView : window;
|
21146 | });
|
21147 |
|
21148 | var selector = "[" + dragHandle + "]";
|
21149 |
|
21150 | var isSVG = function isSVG(el) {
|
21151 | if (typeof SVGElement === 'undefined') {
|
21152 | return false;
|
21153 | }
|
21154 |
|
21155 | return el instanceof SVGElement;
|
21156 | };
|
21157 |
|
21158 | var throwIfSVG = function throwIfSVG(el) {
|
21159 | !!isSVG(el) ? process.env.NODE_ENV !== "production" ? invariant(false, "A drag handle cannot be an SVGElement: it has inconsistent focus support.\n\n More information: https://github.com/atlassian/react-beautiful-dnd/tree/master/docs/guides/dragging-svgs.md") : invariant(false) : void 0;
|
21160 | };
|
21161 |
|
21162 | var getDragHandleRef = function getDragHandleRef(draggableRef) {
|
21163 | if (draggableRef.hasAttribute(dragHandle)) {
|
21164 | throwIfSVG(draggableRef);
|
21165 | return draggableRef;
|
21166 | }
|
21167 |
|
21168 | var el = draggableRef.querySelector(selector);
|
21169 | throwIfSVG(draggableRef);
|
21170 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, "\n Cannot find drag handle element inside of Draggable.\n Please be sure to apply the {...provided.dragHandleProps} to your Draggable\n\n More information: https://github.com/atlassian/react-beautiful-dnd#draggable\n ") : invariant(false) : void 0;
|
21171 | !(el instanceof HTMLElement) ? process.env.NODE_ENV !== "production" ? invariant(false, 'A drag handle must be a HTMLElement') : invariant(false) : void 0;
|
21172 | return el;
|
21173 | };
|
21174 |
|
21175 | var retainingFocusFor = null;
|
21176 | var listenerOptions$1 = {
|
21177 | capture: true
|
21178 | };
|
21179 |
|
21180 | var clearRetentionOnFocusChange = function () {
|
21181 | var isBound = false;
|
21182 |
|
21183 | var bind = function bind() {
|
21184 | if (isBound) {
|
21185 | return;
|
21186 | }
|
21187 |
|
21188 | isBound = true;
|
21189 | window.addEventListener('focus', onWindowFocusChange, listenerOptions$1);
|
21190 | };
|
21191 |
|
21192 | var unbind = function unbind() {
|
21193 | if (!isBound) {
|
21194 | return;
|
21195 | }
|
21196 |
|
21197 | isBound = false;
|
21198 | window.removeEventListener('focus', onWindowFocusChange, listenerOptions$1);
|
21199 | };
|
21200 |
|
21201 | var onWindowFocusChange = function onWindowFocusChange() {
|
21202 | unbind();
|
21203 | retainingFocusFor = null;
|
21204 | };
|
21205 |
|
21206 | var result = function result() {
|
21207 | return bind();
|
21208 | };
|
21209 |
|
21210 | result.cancel = function () {
|
21211 | return unbind();
|
21212 | };
|
21213 |
|
21214 | return result;
|
21215 | }();
|
21216 |
|
21217 | var retain = function retain(id) {
|
21218 | retainingFocusFor = id;
|
21219 | clearRetentionOnFocusChange();
|
21220 | };
|
21221 |
|
21222 | var tryRestoreFocus = function tryRestoreFocus(id, draggableRef) {
|
21223 | if (!retainingFocusFor) {
|
21224 | return;
|
21225 | }
|
21226 |
|
21227 | if (id !== retainingFocusFor) {
|
21228 | return;
|
21229 | }
|
21230 |
|
21231 | retainingFocusFor = null;
|
21232 | clearRetentionOnFocusChange.cancel();
|
21233 | var dragHandleRef = getDragHandleRef(draggableRef);
|
21234 |
|
21235 | if (!dragHandleRef) {
|
21236 | console.warn('Could not find drag handle in the DOM to focus on it');
|
21237 | return;
|
21238 | }
|
21239 |
|
21240 | dragHandleRef.focus();
|
21241 | };
|
21242 |
|
21243 | var retainer = {
|
21244 | retain: retain,
|
21245 | tryRestoreFocus: tryRestoreFocus
|
21246 | };
|
21247 |
|
21248 | var interactiveTagNames = {
|
21249 | input: true,
|
21250 | button: true,
|
21251 | textarea: true,
|
21252 | select: true,
|
21253 | option: true,
|
21254 | optgroup: true,
|
21255 | video: true,
|
21256 | audio: true
|
21257 | };
|
21258 |
|
21259 | var isAnInteractiveElement = function isAnInteractiveElement(parent, current) {
|
21260 | if (current == null) {
|
21261 | return false;
|
21262 | }
|
21263 |
|
21264 | var hasAnInteractiveTag = Boolean(interactiveTagNames[current.tagName.toLowerCase()]);
|
21265 |
|
21266 | if (hasAnInteractiveTag) {
|
21267 | return true;
|
21268 | }
|
21269 |
|
21270 | var attribute = current.getAttribute('contenteditable');
|
21271 |
|
21272 | if (attribute === 'true' || attribute === '') {
|
21273 | return true;
|
21274 | }
|
21275 |
|
21276 | if (current === parent) {
|
21277 | return false;
|
21278 | }
|
21279 |
|
21280 | return isAnInteractiveElement(parent, current.parentElement);
|
21281 | };
|
21282 |
|
21283 | var shouldAllowDraggingFromTarget = (function (event, props) {
|
21284 | if (props.canDragInteractiveElements) {
|
21285 | return true;
|
21286 | }
|
21287 |
|
21288 | var target = event.target,
|
21289 | currentTarget = event.currentTarget;
|
21290 |
|
21291 | if (!(target instanceof Element) || !(currentTarget instanceof Element)) {
|
21292 | return true;
|
21293 | }
|
21294 |
|
21295 | return !isAnInteractiveElement(currentTarget, target);
|
21296 | });
|
21297 |
|
21298 | var createScheduler = (function (callbacks) {
|
21299 | var memoizedMove = memoizeOne(function (x, y) {
|
21300 | var point = {
|
21301 | x: x,
|
21302 | y: y
|
21303 | };
|
21304 | callbacks.onMove(point);
|
21305 | });
|
21306 | var move = rafSchd(function (point) {
|
21307 | return memoizedMove(point.x, point.y);
|
21308 | });
|
21309 | var moveUp = rafSchd(callbacks.onMoveUp);
|
21310 | var moveDown = rafSchd(callbacks.onMoveDown);
|
21311 | var moveRight = rafSchd(callbacks.onMoveRight);
|
21312 | var moveLeft = rafSchd(callbacks.onMoveLeft);
|
21313 | var windowScrollMove = rafSchd(callbacks.onWindowScroll);
|
21314 |
|
21315 | var cancel = function cancel() {
|
21316 | move.cancel();
|
21317 | moveUp.cancel();
|
21318 | moveDown.cancel();
|
21319 | moveRight.cancel();
|
21320 | moveLeft.cancel();
|
21321 | windowScrollMove.cancel();
|
21322 | };
|
21323 |
|
21324 | return {
|
21325 | move: move,
|
21326 | moveUp: moveUp,
|
21327 | moveDown: moveDown,
|
21328 | moveRight: moveRight,
|
21329 | moveLeft: moveLeft,
|
21330 | windowScrollMove: windowScrollMove,
|
21331 | cancel: cancel
|
21332 | };
|
21333 | });
|
21334 |
|
21335 | var sloppyClickThreshold = 5;
|
21336 | var isSloppyClickThresholdExceeded = (function (original, current) {
|
21337 | return Math.abs(current.x - original.x) >= sloppyClickThreshold || Math.abs(current.y - original.y) >= sloppyClickThreshold;
|
21338 | });
|
21339 |
|
21340 | var tab = 9;
|
21341 | var enter = 13;
|
21342 | var escape = 27;
|
21343 | var space = 32;
|
21344 | var pageUp = 33;
|
21345 | var pageDown = 34;
|
21346 | var end = 35;
|
21347 | var home = 36;
|
21348 | var arrowLeft = 37;
|
21349 | var arrowUp = 38;
|
21350 | var arrowRight = 39;
|
21351 | var arrowDown = 40;
|
21352 |
|
21353 | var _preventedKeys;
|
21354 | var preventedKeys = (_preventedKeys = {}, _preventedKeys[enter] = true, _preventedKeys[tab] = true, _preventedKeys);
|
21355 | var preventStandardKeyEvents = (function (event) {
|
21356 | if (preventedKeys[event.keyCode]) {
|
21357 | event.preventDefault();
|
21358 | }
|
21359 | });
|
21360 |
|
21361 | var getOptions = function getOptions(shared, fromBinding) {
|
21362 | return _extends({}, shared, fromBinding);
|
21363 | };
|
21364 |
|
21365 | var bindEvents = function bindEvents(el, bindings, sharedOptions) {
|
21366 | bindings.forEach(function (binding) {
|
21367 | var options = getOptions(sharedOptions, binding.options);
|
21368 | el.addEventListener(binding.eventName, binding.fn, options);
|
21369 | });
|
21370 | };
|
21371 | var unbindEvents = function unbindEvents(el, bindings, sharedOptions) {
|
21372 | bindings.forEach(function (binding) {
|
21373 | var options = getOptions(sharedOptions, binding.options);
|
21374 | el.removeEventListener(binding.eventName, binding.fn, options);
|
21375 | });
|
21376 | };
|
21377 |
|
21378 | var sharedOptions = {
|
21379 | capture: true
|
21380 | };
|
21381 | var createPostDragEventPreventer = (function (getWindow) {
|
21382 | var isBound = false;
|
21383 |
|
21384 | var bind = function bind() {
|
21385 | if (isBound) {
|
21386 | return;
|
21387 | }
|
21388 |
|
21389 | isBound = true;
|
21390 | bindEvents(getWindow(), pointerEvents, sharedOptions);
|
21391 | };
|
21392 |
|
21393 | var unbind = function unbind() {
|
21394 | if (!isBound) {
|
21395 | return;
|
21396 | }
|
21397 |
|
21398 | isBound = false;
|
21399 | unbindEvents(getWindow(), pointerEvents, sharedOptions);
|
21400 | };
|
21401 |
|
21402 | var pointerEvents = [{
|
21403 | eventName: 'click',
|
21404 | fn: function fn(event) {
|
21405 | event.preventDefault();
|
21406 | unbind();
|
21407 | }
|
21408 | }, {
|
21409 | eventName: 'mousedown',
|
21410 | fn: unbind
|
21411 | }, {
|
21412 | eventName: 'touchstart',
|
21413 | fn: unbind
|
21414 | }];
|
21415 |
|
21416 | var preventNext = function preventNext() {
|
21417 | if (isBound) {
|
21418 | unbind();
|
21419 | }
|
21420 |
|
21421 | bind();
|
21422 | };
|
21423 |
|
21424 | var preventer = {
|
21425 | preventNext: preventNext,
|
21426 | abort: unbind
|
21427 | };
|
21428 | return preventer;
|
21429 | });
|
21430 |
|
21431 | var createEventMarshal = (function () {
|
21432 | var isMouseDownHandled = false;
|
21433 |
|
21434 | var handle = function handle() {
|
21435 | !!isMouseDownHandled ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot handle mouse down as it is already handled') : invariant(false) : void 0;
|
21436 | isMouseDownHandled = true;
|
21437 | };
|
21438 |
|
21439 | var isHandled = function isHandled() {
|
21440 | return isMouseDownHandled;
|
21441 | };
|
21442 |
|
21443 | var reset = function reset() {
|
21444 | isMouseDownHandled = false;
|
21445 | };
|
21446 |
|
21447 | return {
|
21448 | handle: handle,
|
21449 | isHandled: isHandled,
|
21450 | reset: reset
|
21451 | };
|
21452 | });
|
21453 |
|
21454 | var supportedEventName = function () {
|
21455 | var base = 'visibilitychange';
|
21456 |
|
21457 | if (typeof document === 'undefined') {
|
21458 | return base;
|
21459 | }
|
21460 |
|
21461 | var candidates = [base, "ms" + base, "webkit" + base, "moz" + base, "o" + base];
|
21462 | var supported = candidates.find(function (eventName) {
|
21463 | return "on" + eventName in document;
|
21464 | });
|
21465 | return supported || base;
|
21466 | }();
|
21467 |
|
21468 | var primaryButton = 0;
|
21469 |
|
21470 | var noop = function noop() {};
|
21471 |
|
21472 | var mouseDownMarshal = createEventMarshal();
|
21473 | var createMouseSensor = (function (_ref) {
|
21474 | var callbacks = _ref.callbacks,
|
21475 | getWindow = _ref.getWindow,
|
21476 | canStartCapturing = _ref.canStartCapturing;
|
21477 | var state = {
|
21478 | isDragging: false,
|
21479 | pending: null
|
21480 | };
|
21481 |
|
21482 | var setState = function setState(newState) {
|
21483 | state = newState;
|
21484 | };
|
21485 |
|
21486 | var isDragging = function isDragging() {
|
21487 | return state.isDragging;
|
21488 | };
|
21489 |
|
21490 | var isCapturing = function isCapturing() {
|
21491 | return Boolean(state.pending || state.isDragging);
|
21492 | };
|
21493 |
|
21494 | var schedule = createScheduler(callbacks);
|
21495 | var postDragEventPreventer = createPostDragEventPreventer(getWindow);
|
21496 |
|
21497 | var startDragging = function startDragging(fn) {
|
21498 | if (fn === void 0) {
|
21499 | fn = noop;
|
21500 | }
|
21501 |
|
21502 | setState({
|
21503 | pending: null,
|
21504 | isDragging: true
|
21505 | });
|
21506 | fn();
|
21507 | };
|
21508 |
|
21509 | var stopDragging = function stopDragging(fn, shouldBlockClick) {
|
21510 | if (fn === void 0) {
|
21511 | fn = noop;
|
21512 | }
|
21513 |
|
21514 | if (shouldBlockClick === void 0) {
|
21515 | shouldBlockClick = true;
|
21516 | }
|
21517 |
|
21518 | schedule.cancel();
|
21519 | unbindWindowEvents();
|
21520 | mouseDownMarshal.reset();
|
21521 |
|
21522 | if (shouldBlockClick) {
|
21523 | postDragEventPreventer.preventNext();
|
21524 | }
|
21525 |
|
21526 | setState({
|
21527 | isDragging: false,
|
21528 | pending: null
|
21529 | });
|
21530 | fn();
|
21531 | };
|
21532 |
|
21533 | var startPendingDrag = function startPendingDrag(point) {
|
21534 | setState({
|
21535 | pending: point,
|
21536 | isDragging: false
|
21537 | });
|
21538 | bindWindowEvents();
|
21539 | };
|
21540 |
|
21541 | var stopPendingDrag = function stopPendingDrag() {
|
21542 | stopDragging(noop, false);
|
21543 | };
|
21544 |
|
21545 | var kill = function kill(fn) {
|
21546 | if (fn === void 0) {
|
21547 | fn = noop;
|
21548 | }
|
21549 |
|
21550 | if (state.pending) {
|
21551 | stopPendingDrag();
|
21552 | return;
|
21553 | }
|
21554 |
|
21555 | stopDragging(fn);
|
21556 | };
|
21557 |
|
21558 | var unmount = function unmount() {
|
21559 | kill();
|
21560 | postDragEventPreventer.abort();
|
21561 | };
|
21562 |
|
21563 | var cancel = function cancel() {
|
21564 | kill(callbacks.onCancel);
|
21565 | };
|
21566 |
|
21567 | var windowBindings = [{
|
21568 | eventName: 'mousemove',
|
21569 | fn: function fn(event) {
|
21570 | var button = event.button,
|
21571 | clientX = event.clientX,
|
21572 | clientY = event.clientY;
|
21573 |
|
21574 | if (button !== primaryButton) {
|
21575 | return;
|
21576 | }
|
21577 |
|
21578 | var point = {
|
21579 | x: clientX,
|
21580 | y: clientY
|
21581 | };
|
21582 |
|
21583 | if (state.isDragging) {
|
21584 | event.preventDefault();
|
21585 | schedule.move(point);
|
21586 | return;
|
21587 | }
|
21588 |
|
21589 | if (!state.pending) {
|
21590 | kill();
|
21591 | process.env.NODE_ENV !== "production" ? invariant(false, 'Expected there to be a pending drag') : invariant(false);
|
21592 | }
|
21593 |
|
21594 | if (!isSloppyClickThresholdExceeded(state.pending, point)) {
|
21595 | return;
|
21596 | }
|
21597 |
|
21598 | event.preventDefault();
|
21599 | startDragging(function () {
|
21600 | return callbacks.onLift({
|
21601 | clientSelection: point,
|
21602 | autoScrollMode: 'FLUID'
|
21603 | });
|
21604 | });
|
21605 | }
|
21606 | }, {
|
21607 | eventName: 'mouseup',
|
21608 | fn: function fn(event) {
|
21609 | if (state.pending) {
|
21610 | stopPendingDrag();
|
21611 | return;
|
21612 | }
|
21613 |
|
21614 | event.preventDefault();
|
21615 | stopDragging(callbacks.onDrop);
|
21616 | }
|
21617 | }, {
|
21618 | eventName: 'mousedown',
|
21619 | fn: function fn(event) {
|
21620 | if (state.isDragging) {
|
21621 | event.preventDefault();
|
21622 | }
|
21623 |
|
21624 | stopDragging(callbacks.onCancel);
|
21625 | }
|
21626 | }, {
|
21627 | eventName: 'keydown',
|
21628 | fn: function fn(event) {
|
21629 | if (!state.isDragging) {
|
21630 | cancel();
|
21631 | return;
|
21632 | }
|
21633 |
|
21634 | if (event.keyCode === escape) {
|
21635 | event.preventDefault();
|
21636 | cancel();
|
21637 | return;
|
21638 | }
|
21639 |
|
21640 | preventStandardKeyEvents(event);
|
21641 | }
|
21642 | }, {
|
21643 | eventName: 'resize',
|
21644 | fn: cancel
|
21645 | }, {
|
21646 | eventName: 'scroll',
|
21647 | options: {
|
21648 | passive: true,
|
21649 | capture: false
|
21650 | },
|
21651 | fn: function fn() {
|
21652 | if (state.pending) {
|
21653 | stopPendingDrag();
|
21654 | return;
|
21655 | }
|
21656 |
|
21657 | schedule.windowScrollMove();
|
21658 | }
|
21659 | }, {
|
21660 | eventName: 'webkitmouseforcechanged',
|
21661 | fn: function fn(event) {
|
21662 | if (event.webkitForce == null || MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN == null) {
|
21663 | if (process.env.NODE_ENV !== 'production') {
|
21664 | console.warn('handling a mouse force changed event when it is not supported');
|
21665 | }
|
21666 |
|
21667 | return;
|
21668 | }
|
21669 |
|
21670 | var forcePressThreshold = MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN;
|
21671 | var isForcePressing = event.webkitForce >= forcePressThreshold;
|
21672 |
|
21673 | if (isForcePressing) {
|
21674 | cancel();
|
21675 | }
|
21676 | }
|
21677 | }, {
|
21678 | eventName: supportedEventName,
|
21679 | fn: cancel
|
21680 | }];
|
21681 |
|
21682 | var bindWindowEvents = function bindWindowEvents() {
|
21683 | var win = getWindow();
|
21684 | bindEvents(win, windowBindings, {
|
21685 | capture: true
|
21686 | });
|
21687 | };
|
21688 |
|
21689 | var unbindWindowEvents = function unbindWindowEvents() {
|
21690 | var win = getWindow();
|
21691 | unbindEvents(win, windowBindings, {
|
21692 | capture: true
|
21693 | });
|
21694 | };
|
21695 |
|
21696 | var onMouseDown = function onMouseDown(event) {
|
21697 | if (mouseDownMarshal.isHandled()) {
|
21698 | return;
|
21699 | }
|
21700 |
|
21701 | !!isCapturing() ? process.env.NODE_ENV !== "production" ? invariant(false, 'Should not be able to perform a mouse down while a drag or pending drag is occurring') : invariant(false) : void 0;
|
21702 |
|
21703 | if (!canStartCapturing(event)) {
|
21704 | return;
|
21705 | }
|
21706 |
|
21707 | if (event.button !== primaryButton) {
|
21708 | return;
|
21709 | }
|
21710 |
|
21711 | if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) {
|
21712 | return;
|
21713 | }
|
21714 |
|
21715 | mouseDownMarshal.handle();
|
21716 | event.preventDefault();
|
21717 | var point = {
|
21718 | x: event.clientX,
|
21719 | y: event.clientY
|
21720 | };
|
21721 | startPendingDrag(point);
|
21722 | };
|
21723 |
|
21724 | var sensor = {
|
21725 | onMouseDown: onMouseDown,
|
21726 | kill: kill,
|
21727 | isCapturing: isCapturing,
|
21728 | isDragging: isDragging,
|
21729 | unmount: unmount
|
21730 | };
|
21731 | return sensor;
|
21732 | });
|
21733 |
|
21734 | var getBorderBoxCenterPosition = (function (el) {
|
21735 | return cssBoxModel.getRect(el.getBoundingClientRect()).center;
|
21736 | });
|
21737 |
|
21738 | var _scrollJumpKeys;
|
21739 | var scrollJumpKeys = (_scrollJumpKeys = {}, _scrollJumpKeys[pageDown] = true, _scrollJumpKeys[pageUp] = true, _scrollJumpKeys[home] = true, _scrollJumpKeys[end] = true, _scrollJumpKeys);
|
21740 |
|
21741 | var noop$1 = function noop() {};
|
21742 |
|
21743 | var createKeyboardSensor = (function (_ref) {
|
21744 | var callbacks = _ref.callbacks,
|
21745 | getWindow = _ref.getWindow,
|
21746 | getDraggableRef = _ref.getDraggableRef,
|
21747 | canStartCapturing = _ref.canStartCapturing;
|
21748 | var state = {
|
21749 | isDragging: false
|
21750 | };
|
21751 |
|
21752 | var setState = function setState(newState) {
|
21753 | state = newState;
|
21754 | };
|
21755 |
|
21756 | var startDragging = function startDragging(fn) {
|
21757 | if (fn === void 0) {
|
21758 | fn = noop$1;
|
21759 | }
|
21760 |
|
21761 | setState({
|
21762 | isDragging: true
|
21763 | });
|
21764 | bindWindowEvents();
|
21765 | fn();
|
21766 | };
|
21767 |
|
21768 | var stopDragging = function stopDragging(fn) {
|
21769 | if (fn === void 0) {
|
21770 | fn = noop$1;
|
21771 | }
|
21772 |
|
21773 | schedule.cancel();
|
21774 | unbindWindowEvents();
|
21775 | setState({
|
21776 | isDragging: false
|
21777 | });
|
21778 | fn();
|
21779 | };
|
21780 |
|
21781 | var kill = function kill() {
|
21782 | return stopDragging();
|
21783 | };
|
21784 |
|
21785 | var cancel = function cancel() {
|
21786 | stopDragging(callbacks.onCancel);
|
21787 | };
|
21788 |
|
21789 | var isDragging = function isDragging() {
|
21790 | return state.isDragging;
|
21791 | };
|
21792 |
|
21793 | var schedule = createScheduler(callbacks);
|
21794 |
|
21795 | var onKeyDown = function onKeyDown(event) {
|
21796 | if (!isDragging()) {
|
21797 | if (event.defaultPrevented) {
|
21798 | return;
|
21799 | }
|
21800 |
|
21801 | if (!canStartCapturing(event)) {
|
21802 | return;
|
21803 | }
|
21804 |
|
21805 | if (event.keyCode !== space) {
|
21806 | return;
|
21807 | }
|
21808 |
|
21809 | var ref = getDraggableRef();
|
21810 | !ref ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot start a keyboard drag without a draggable ref') : invariant(false) : void 0;
|
21811 | var center = getBorderBoxCenterPosition(ref);
|
21812 | event.preventDefault();
|
21813 | startDragging(function () {
|
21814 | return callbacks.onLift({
|
21815 | clientSelection: center,
|
21816 | autoScrollMode: 'JUMP'
|
21817 | });
|
21818 | });
|
21819 | return;
|
21820 | }
|
21821 |
|
21822 | if (event.keyCode === escape) {
|
21823 | event.preventDefault();
|
21824 | cancel();
|
21825 | return;
|
21826 | }
|
21827 |
|
21828 | if (event.keyCode === space) {
|
21829 | event.preventDefault();
|
21830 | stopDragging(callbacks.onDrop);
|
21831 | return;
|
21832 | }
|
21833 |
|
21834 | if (event.keyCode === arrowDown) {
|
21835 | event.preventDefault();
|
21836 | schedule.moveDown();
|
21837 | return;
|
21838 | }
|
21839 |
|
21840 | if (event.keyCode === arrowUp) {
|
21841 | event.preventDefault();
|
21842 | schedule.moveUp();
|
21843 | return;
|
21844 | }
|
21845 |
|
21846 | if (event.keyCode === arrowRight) {
|
21847 | event.preventDefault();
|
21848 | schedule.moveRight();
|
21849 | return;
|
21850 | }
|
21851 |
|
21852 | if (event.keyCode === arrowLeft) {
|
21853 | event.preventDefault();
|
21854 | schedule.moveLeft();
|
21855 | return;
|
21856 | }
|
21857 |
|
21858 | if (scrollJumpKeys[event.keyCode]) {
|
21859 | event.preventDefault();
|
21860 | return;
|
21861 | }
|
21862 |
|
21863 | preventStandardKeyEvents(event);
|
21864 | };
|
21865 |
|
21866 | var windowBindings = [{
|
21867 | eventName: 'mousedown',
|
21868 | fn: cancel
|
21869 | }, {
|
21870 | eventName: 'mouseup',
|
21871 | fn: cancel
|
21872 | }, {
|
21873 | eventName: 'click',
|
21874 | fn: cancel
|
21875 | }, {
|
21876 | eventName: 'touchstart',
|
21877 | fn: cancel
|
21878 | }, {
|
21879 | eventName: 'resize',
|
21880 | fn: cancel
|
21881 | }, {
|
21882 | eventName: 'wheel',
|
21883 | fn: cancel
|
21884 | }, {
|
21885 | eventName: 'scroll',
|
21886 | options: {
|
21887 | capture: false
|
21888 | },
|
21889 | fn: callbacks.onWindowScroll
|
21890 | }, {
|
21891 | eventName: supportedEventName,
|
21892 | fn: cancel
|
21893 | }];
|
21894 |
|
21895 | var bindWindowEvents = function bindWindowEvents() {
|
21896 | bindEvents(getWindow(), windowBindings, {
|
21897 | capture: true
|
21898 | });
|
21899 | };
|
21900 |
|
21901 | var unbindWindowEvents = function unbindWindowEvents() {
|
21902 | unbindEvents(getWindow(), windowBindings, {
|
21903 | capture: true
|
21904 | });
|
21905 | };
|
21906 |
|
21907 | var sensor = {
|
21908 | onKeyDown: onKeyDown,
|
21909 | kill: kill,
|
21910 | isDragging: isDragging,
|
21911 | isCapturing: isDragging,
|
21912 | unmount: kill
|
21913 | };
|
21914 | return sensor;
|
21915 | });
|
21916 |
|
21917 | var timeForLongPress = 150;
|
21918 | var forcePressThreshold = 0.15;
|
21919 | var touchStartMarshal = createEventMarshal();
|
21920 |
|
21921 | var noop$2 = function noop() {};
|
21922 |
|
21923 | var webkitHack = function () {
|
21924 | var stub = {
|
21925 | preventTouchMove: noop$2,
|
21926 | releaseTouchMove: noop$2
|
21927 | };
|
21928 |
|
21929 | if (typeof window === 'undefined') {
|
21930 | return stub;
|
21931 | }
|
21932 |
|
21933 | if (!('ontouchstart' in window)) {
|
21934 | return stub;
|
21935 | }
|
21936 |
|
21937 | var isBlocking = false;
|
21938 | window.addEventListener('touchmove', function (event) {
|
21939 | if (!isBlocking) {
|
21940 | return;
|
21941 | }
|
21942 |
|
21943 | if (event.defaultPrevented) {
|
21944 | return;
|
21945 | }
|
21946 |
|
21947 | event.preventDefault();
|
21948 | }, {
|
21949 | passive: false,
|
21950 | capture: false
|
21951 | });
|
21952 |
|
21953 | var preventTouchMove = function preventTouchMove() {
|
21954 | isBlocking = true;
|
21955 | };
|
21956 |
|
21957 | var releaseTouchMove = function releaseTouchMove() {
|
21958 | isBlocking = false;
|
21959 | };
|
21960 |
|
21961 | return {
|
21962 | preventTouchMove: preventTouchMove,
|
21963 | releaseTouchMove: releaseTouchMove
|
21964 | };
|
21965 | }();
|
21966 |
|
21967 | var initial = {
|
21968 | isDragging: false,
|
21969 | pending: null,
|
21970 | hasMoved: false,
|
21971 | longPressTimerId: null
|
21972 | };
|
21973 | var createTouchSensor = (function (_ref) {
|
21974 | var callbacks = _ref.callbacks,
|
21975 | getWindow = _ref.getWindow,
|
21976 | canStartCapturing = _ref.canStartCapturing;
|
21977 | var state = initial;
|
21978 |
|
21979 | var setState = function setState(partial) {
|
21980 | state = _extends({}, state, partial);
|
21981 | };
|
21982 |
|
21983 | var isDragging = function isDragging() {
|
21984 | return state.isDragging;
|
21985 | };
|
21986 |
|
21987 | var isCapturing = function isCapturing() {
|
21988 | return Boolean(state.pending || state.isDragging || state.longPressTimerId);
|
21989 | };
|
21990 |
|
21991 | var schedule = createScheduler(callbacks);
|
21992 | var postDragEventPreventer = createPostDragEventPreventer(getWindow);
|
21993 |
|
21994 | var startDragging = function startDragging() {
|
21995 | var pending = state.pending;
|
21996 |
|
21997 | if (!pending) {
|
21998 | kill();
|
21999 | process.env.NODE_ENV !== "production" ? invariant(false, 'cannot start a touch drag without a pending position') : invariant(false);
|
22000 | }
|
22001 |
|
22002 | setState({
|
22003 | isDragging: true,
|
22004 | hasMoved: false,
|
22005 | pending: null,
|
22006 | longPressTimerId: null
|
22007 | });
|
22008 | callbacks.onLift({
|
22009 | clientSelection: pending,
|
22010 | autoScrollMode: 'FLUID'
|
22011 | });
|
22012 | };
|
22013 |
|
22014 | var stopDragging = function stopDragging(fn) {
|
22015 | if (fn === void 0) {
|
22016 | fn = noop$2;
|
22017 | }
|
22018 |
|
22019 | schedule.cancel();
|
22020 | touchStartMarshal.reset();
|
22021 | webkitHack.releaseTouchMove();
|
22022 | unbindWindowEvents();
|
22023 | postDragEventPreventer.preventNext();
|
22024 | setState(initial);
|
22025 | fn();
|
22026 | };
|
22027 |
|
22028 | var startPendingDrag = function startPendingDrag(event) {
|
22029 | var touch = event.touches[0];
|
22030 | var clientX = touch.clientX,
|
22031 | clientY = touch.clientY;
|
22032 | var point = {
|
22033 | x: clientX,
|
22034 | y: clientY
|
22035 | };
|
22036 | var longPressTimerId = setTimeout(startDragging, timeForLongPress);
|
22037 | setState({
|
22038 | longPressTimerId: longPressTimerId,
|
22039 | pending: point,
|
22040 | isDragging: false,
|
22041 | hasMoved: false
|
22042 | });
|
22043 | bindWindowEvents();
|
22044 | };
|
22045 |
|
22046 | var stopPendingDrag = function stopPendingDrag() {
|
22047 | if (state.longPressTimerId) {
|
22048 | clearTimeout(state.longPressTimerId);
|
22049 | }
|
22050 |
|
22051 | schedule.cancel();
|
22052 | touchStartMarshal.reset();
|
22053 | webkitHack.releaseTouchMove();
|
22054 | unbindWindowEvents();
|
22055 | setState(initial);
|
22056 | };
|
22057 |
|
22058 | var kill = function kill(fn) {
|
22059 | if (fn === void 0) {
|
22060 | fn = noop$2;
|
22061 | }
|
22062 |
|
22063 | if (state.pending) {
|
22064 | stopPendingDrag();
|
22065 | return;
|
22066 | }
|
22067 |
|
22068 | stopDragging(fn);
|
22069 | };
|
22070 |
|
22071 | var unmount = function unmount() {
|
22072 | kill();
|
22073 | postDragEventPreventer.abort();
|
22074 | };
|
22075 |
|
22076 | var cancel = function cancel() {
|
22077 | kill(callbacks.onCancel);
|
22078 | };
|
22079 |
|
22080 | var windowBindings = [{
|
22081 | eventName: 'touchmove',
|
22082 | options: {
|
22083 | passive: false
|
22084 | },
|
22085 | fn: function fn(event) {
|
22086 | if (!state.isDragging) {
|
22087 | stopPendingDrag();
|
22088 | return;
|
22089 | }
|
22090 |
|
22091 | if (!state.hasMoved) {
|
22092 | setState({
|
22093 | hasMoved: true
|
22094 | });
|
22095 | }
|
22096 |
|
22097 | var _event$touches$ = event.touches[0],
|
22098 | clientX = _event$touches$.clientX,
|
22099 | clientY = _event$touches$.clientY;
|
22100 | var point = {
|
22101 | x: clientX,
|
22102 | y: clientY
|
22103 | };
|
22104 | event.preventDefault();
|
22105 | schedule.move(point);
|
22106 | }
|
22107 | }, {
|
22108 | eventName: 'touchend',
|
22109 | fn: function fn(event) {
|
22110 | if (!state.isDragging) {
|
22111 | stopPendingDrag();
|
22112 | return;
|
22113 | }
|
22114 |
|
22115 | event.preventDefault();
|
22116 | stopDragging(callbacks.onDrop);
|
22117 | }
|
22118 | }, {
|
22119 | eventName: 'touchcancel',
|
22120 | fn: function fn(event) {
|
22121 | if (!state.isDragging) {
|
22122 | stopPendingDrag();
|
22123 | return;
|
22124 | }
|
22125 |
|
22126 | event.preventDefault();
|
22127 | stopDragging(callbacks.onCancel);
|
22128 | }
|
22129 | }, {
|
22130 | eventName: 'touchstart',
|
22131 | fn: cancel
|
22132 | }, {
|
22133 | eventName: 'orientationchange',
|
22134 | fn: cancel
|
22135 | }, {
|
22136 | eventName: 'resize',
|
22137 | fn: cancel
|
22138 | }, {
|
22139 | eventName: 'scroll',
|
22140 | options: {
|
22141 | passive: true,
|
22142 | capture: false
|
22143 | },
|
22144 | fn: function fn() {
|
22145 | if (state.pending) {
|
22146 | stopPendingDrag();
|
22147 | return;
|
22148 | }
|
22149 |
|
22150 | schedule.windowScrollMove();
|
22151 | }
|
22152 | }, {
|
22153 | eventName: 'contextmenu',
|
22154 | fn: function fn(event) {
|
22155 | event.preventDefault();
|
22156 | }
|
22157 | }, {
|
22158 | eventName: 'keydown',
|
22159 | fn: function fn(event) {
|
22160 | if (!state.isDragging) {
|
22161 | cancel();
|
22162 | return;
|
22163 | }
|
22164 |
|
22165 | if (event.keyCode === escape) {
|
22166 | event.preventDefault();
|
22167 | }
|
22168 |
|
22169 | cancel();
|
22170 | }
|
22171 | }, {
|
22172 | eventName: 'touchforcechange',
|
22173 | fn: function fn(event) {
|
22174 | if (state.hasMoved) {
|
22175 | event.preventDefault();
|
22176 | return;
|
22177 | }
|
22178 |
|
22179 | var touch = event.touches[0];
|
22180 |
|
22181 | if (touch.force >= forcePressThreshold) {
|
22182 | cancel();
|
22183 | }
|
22184 | }
|
22185 | }, {
|
22186 | eventName: supportedEventName,
|
22187 | fn: cancel
|
22188 | }];
|
22189 |
|
22190 | var bindWindowEvents = function bindWindowEvents() {
|
22191 | bindEvents(getWindow(), windowBindings, {
|
22192 | capture: true
|
22193 | });
|
22194 | };
|
22195 |
|
22196 | var unbindWindowEvents = function unbindWindowEvents() {
|
22197 | unbindEvents(getWindow(), windowBindings, {
|
22198 | capture: true
|
22199 | });
|
22200 | };
|
22201 |
|
22202 | var onTouchStart = function onTouchStart(event) {
|
22203 | if (touchStartMarshal.isHandled()) {
|
22204 | return;
|
22205 | }
|
22206 |
|
22207 | !!isCapturing() ? process.env.NODE_ENV !== "production" ? invariant(false, 'Should not be able to perform a touch start while a drag or pending drag is occurring') : invariant(false) : void 0;
|
22208 |
|
22209 | if (!canStartCapturing(event)) {
|
22210 | return;
|
22211 | }
|
22212 |
|
22213 | touchStartMarshal.handle();
|
22214 | webkitHack.preventTouchMove();
|
22215 | startPendingDrag(event);
|
22216 | };
|
22217 |
|
22218 | var sensor = {
|
22219 | onTouchStart: onTouchStart,
|
22220 | kill: kill,
|
22221 | isCapturing: isCapturing,
|
22222 | isDragging: isDragging,
|
22223 | unmount: unmount
|
22224 | };
|
22225 | return sensor;
|
22226 | });
|
22227 |
|
22228 | var _DragHandle$contextTy;
|
22229 |
|
22230 | var preventHtml5Dnd = function preventHtml5Dnd(event) {
|
22231 | event.preventDefault();
|
22232 | };
|
22233 |
|
22234 | var DragHandle = function (_Component) {
|
22235 | _inheritsLoose(DragHandle, _Component);
|
22236 |
|
22237 | function DragHandle(props, context) {
|
22238 | var _this;
|
22239 |
|
22240 | _this = _Component.call(this, props, context) || this;
|
22241 | _this.mouseSensor = void 0;
|
22242 | _this.keyboardSensor = void 0;
|
22243 | _this.touchSensor = void 0;
|
22244 | _this.sensors = void 0;
|
22245 | _this.styleContext = void 0;
|
22246 | _this.canLift = void 0;
|
22247 | _this.isFocused = false;
|
22248 | _this.lastDraggableRef = void 0;
|
22249 |
|
22250 | _this.onFocus = function () {
|
22251 | _this.isFocused = true;
|
22252 | };
|
22253 |
|
22254 | _this.onBlur = function () {
|
22255 | _this.isFocused = false;
|
22256 | };
|
22257 |
|
22258 | _this.onKeyDown = function (event) {
|
22259 | if (_this.mouseSensor.isCapturing() || _this.touchSensor.isCapturing()) {
|
22260 | return;
|
22261 | }
|
22262 |
|
22263 | _this.keyboardSensor.onKeyDown(event);
|
22264 | };
|
22265 |
|
22266 | _this.onMouseDown = function (event) {
|
22267 | if (_this.keyboardSensor.isCapturing() || _this.mouseSensor.isCapturing()) {
|
22268 | return;
|
22269 | }
|
22270 |
|
22271 | _this.mouseSensor.onMouseDown(event);
|
22272 | };
|
22273 |
|
22274 | _this.onTouchStart = function (event) {
|
22275 | if (_this.mouseSensor.isCapturing() || _this.keyboardSensor.isCapturing()) {
|
22276 | return;
|
22277 | }
|
22278 |
|
22279 | _this.touchSensor.onTouchStart(event);
|
22280 | };
|
22281 |
|
22282 | _this.canStartCapturing = function (event) {
|
22283 | if (_this.isAnySensorCapturing()) {
|
22284 | return false;
|
22285 | }
|
22286 |
|
22287 | if (!_this.canLift(_this.props.draggableId)) {
|
22288 | return false;
|
22289 | }
|
22290 |
|
22291 | return shouldAllowDraggingFromTarget(event, _this.props);
|
22292 | };
|
22293 |
|
22294 | _this.isAnySensorCapturing = function () {
|
22295 | return _this.sensors.some(function (sensor) {
|
22296 | return sensor.isCapturing();
|
22297 | });
|
22298 | };
|
22299 |
|
22300 | _this.getProvided = memoizeOne(function (isEnabled) {
|
22301 | if (!isEnabled) {
|
22302 | return null;
|
22303 | }
|
22304 |
|
22305 | var provided = {
|
22306 | onMouseDown: _this.onMouseDown,
|
22307 | onKeyDown: _this.onKeyDown,
|
22308 | onTouchStart: _this.onTouchStart,
|
22309 | onFocus: _this.onFocus,
|
22310 | onBlur: _this.onBlur,
|
22311 | tabIndex: 0,
|
22312 | 'data-react-beautiful-dnd-drag-handle': _this.styleContext,
|
22313 | 'aria-roledescription': 'Draggable item. Press space bar to lift',
|
22314 | draggable: false,
|
22315 | onDragStart: preventHtml5Dnd
|
22316 | };
|
22317 | return provided;
|
22318 | });
|
22319 |
|
22320 | var getWindow = function getWindow() {
|
22321 | return getWindowFromRef(_this.props.getDraggableRef());
|
22322 | };
|
22323 |
|
22324 | var args = {
|
22325 | callbacks: _this.props.callbacks,
|
22326 | getDraggableRef: _this.props.getDraggableRef,
|
22327 | getWindow: getWindow,
|
22328 | canStartCapturing: _this.canStartCapturing
|
22329 | };
|
22330 | _this.mouseSensor = createMouseSensor(args);
|
22331 | _this.keyboardSensor = createKeyboardSensor(args);
|
22332 | _this.touchSensor = createTouchSensor(args);
|
22333 | _this.sensors = [_this.mouseSensor, _this.keyboardSensor, _this.touchSensor];
|
22334 | _this.styleContext = context[styleContextKey];
|
22335 | _this.canLift = context[canLiftContextKey];
|
22336 | return _this;
|
22337 | }
|
22338 |
|
22339 | var _proto = DragHandle.prototype;
|
22340 |
|
22341 | _proto.componentDidMount = function componentDidMount() {
|
22342 | var draggableRef = this.props.getDraggableRef();
|
22343 | this.lastDraggableRef = draggableRef;
|
22344 | !draggableRef ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get draggable ref from drag handle') : invariant(false) : void 0;
|
22345 |
|
22346 | if (!this.props.isEnabled) {
|
22347 | return;
|
22348 | }
|
22349 |
|
22350 | var dragHandleRef = getDragHandleRef(draggableRef);
|
22351 | retainer.tryRestoreFocus(this.props.draggableId, dragHandleRef);
|
22352 | };
|
22353 |
|
22354 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
22355 | var _this2 = this;
|
22356 |
|
22357 | var ref = this.props.getDraggableRef();
|
22358 |
|
22359 | if (ref !== this.lastDraggableRef) {
|
22360 | this.lastDraggableRef = ref;
|
22361 |
|
22362 | if (!ref || !this.isFocused) {
|
22363 | return;
|
22364 | }
|
22365 |
|
22366 | if (!this.props.isEnabled) {
|
22367 | return;
|
22368 | }
|
22369 |
|
22370 | getDragHandleRef(ref).focus();
|
22371 | }
|
22372 |
|
22373 | var isCapturing = this.isAnySensorCapturing();
|
22374 |
|
22375 | if (!isCapturing) {
|
22376 | return;
|
22377 | }
|
22378 |
|
22379 | var isDragStopping = prevProps.isDragging && !this.props.isDragging;
|
22380 |
|
22381 | if (isDragStopping) {
|
22382 | this.sensors.forEach(function (sensor) {
|
22383 | if (sensor.isCapturing()) {
|
22384 | sensor.kill();
|
22385 | }
|
22386 | });
|
22387 | }
|
22388 |
|
22389 | if (this.props.isEnabled) {
|
22390 | return;
|
22391 | }
|
22392 |
|
22393 | this.sensors.forEach(function (sensor) {
|
22394 | if (!sensor.isCapturing()) {
|
22395 | return;
|
22396 | }
|
22397 |
|
22398 | var wasDragging = sensor.isDragging();
|
22399 | sensor.kill();
|
22400 |
|
22401 | if (wasDragging) {
|
22402 | if (process.env.NODE_ENV !== 'production') {
|
22403 | console.warn('You have disabled dragging on a Draggable while it was dragging. The drag has been cancelled');
|
22404 | }
|
22405 |
|
22406 | _this2.props.callbacks.onCancel();
|
22407 | }
|
22408 | });
|
22409 | };
|
22410 |
|
22411 | _proto.componentWillUnmount = function componentWillUnmount() {
|
22412 | var _this3 = this;
|
22413 |
|
22414 | this.sensors.forEach(function (sensor) {
|
22415 | var wasDragging = sensor.isDragging();
|
22416 | sensor.unmount();
|
22417 |
|
22418 | if (wasDragging) {
|
22419 | _this3.props.callbacks.onCancel();
|
22420 | }
|
22421 | });
|
22422 |
|
22423 | var shouldRetainFocus = function () {
|
22424 | if (!_this3.props.isEnabled) {
|
22425 | return false;
|
22426 | }
|
22427 |
|
22428 | if (!_this3.isFocused) {
|
22429 | return false;
|
22430 | }
|
22431 |
|
22432 | return _this3.props.isDragging || _this3.props.isDropAnimating;
|
22433 | }();
|
22434 |
|
22435 | if (shouldRetainFocus) {
|
22436 | retainer.retain(this.props.draggableId);
|
22437 | }
|
22438 | };
|
22439 |
|
22440 | _proto.render = function render() {
|
22441 | var _this$props = this.props,
|
22442 | children = _this$props.children,
|
22443 | isEnabled = _this$props.isEnabled;
|
22444 | return children(this.getProvided(isEnabled));
|
22445 | };
|
22446 |
|
22447 | return DragHandle;
|
22448 | }(React.Component);
|
22449 |
|
22450 | DragHandle.contextTypes = (_DragHandle$contextTy = {}, _DragHandle$contextTy[styleContextKey] = PropTypes.string.isRequired, _DragHandle$contextTy[canLiftContextKey] = PropTypes.func.isRequired, _DragHandle$contextTy);
|
22451 |
|
22452 | var getWindowScroll = (function () {
|
22453 | return {
|
22454 | x: window.pageXOffset,
|
22455 | y: window.pageYOffset
|
22456 | };
|
22457 | });
|
22458 |
|
22459 | var getViewport = (function () {
|
22460 | var scroll = getWindowScroll();
|
22461 | var top = scroll.y;
|
22462 | var left = scroll.x;
|
22463 | var doc = document.documentElement;
|
22464 | !doc ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not find document.documentElement') : invariant(false) : void 0;
|
22465 | var width = doc.clientWidth;
|
22466 | var height = doc.clientHeight;
|
22467 | var right = left + width;
|
22468 | var bottom = top + height;
|
22469 | var frame = cssBoxModel.getRect({
|
22470 | top: top,
|
22471 | left: left,
|
22472 | right: right,
|
22473 | bottom: bottom
|
22474 | });
|
22475 | var maxScroll = getMaxScroll({
|
22476 | scrollHeight: doc.scrollHeight,
|
22477 | scrollWidth: doc.scrollWidth,
|
22478 | width: frame.width,
|
22479 | height: frame.height
|
22480 | });
|
22481 | var viewport = {
|
22482 | frame: frame,
|
22483 | scroll: {
|
22484 | initial: scroll,
|
22485 | current: scroll,
|
22486 | max: maxScroll,
|
22487 | diff: {
|
22488 | value: origin,
|
22489 | displacement: origin
|
22490 | }
|
22491 | }
|
22492 | };
|
22493 | return viewport;
|
22494 | });
|
22495 |
|
22496 | var _Draggable$contextTyp;
|
22497 | var zIndexOptions = {
|
22498 | dragging: 5000,
|
22499 | dropAnimating: 4500
|
22500 | };
|
22501 |
|
22502 | var getTranslate = function getTranslate(offset) {
|
22503 | if (isEqual(offset, origin)) {
|
22504 | return null;
|
22505 | }
|
22506 |
|
22507 | return "translate(" + offset.x + "px, " + offset.y + "px)";
|
22508 | };
|
22509 |
|
22510 | var getSpeed$1 = function getSpeed(isDragging, shouldAnimateDragMovement, isDropAnimating) {
|
22511 | if (isDropAnimating) {
|
22512 | return 'STANDARD';
|
22513 | }
|
22514 |
|
22515 | if (isDragging && shouldAnimateDragMovement) {
|
22516 | return 'FAST';
|
22517 | }
|
22518 |
|
22519 | return 'INSTANT';
|
22520 | };
|
22521 |
|
22522 | var Draggable = function (_Component) {
|
22523 | _inheritsLoose(Draggable, _Component);
|
22524 |
|
22525 | function Draggable(props, context) {
|
22526 | var _this;
|
22527 |
|
22528 | _this = _Component.call(this, props, context) || this;
|
22529 | _this.callbacks = void 0;
|
22530 | _this.styleContext = void 0;
|
22531 | _this.ref = null;
|
22532 |
|
22533 | _this.onMoveEnd = function () {
|
22534 | if (_this.props.isDropAnimating) {
|
22535 | _this.props.dropAnimationFinished();
|
22536 | }
|
22537 | };
|
22538 |
|
22539 | _this.onLift = function (options) {
|
22540 | start('LIFT');
|
22541 | var ref = _this.ref;
|
22542 | !ref ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
22543 | !!_this.props.isDragDisabled ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot lift a Draggable when it is disabled') : invariant(false) : void 0;
|
22544 | var clientSelection = options.clientSelection,
|
22545 | autoScrollMode = options.autoScrollMode;
|
22546 | var _this$props = _this.props,
|
22547 | lift = _this$props.lift,
|
22548 | draggableId = _this$props.draggableId;
|
22549 | var client = {
|
22550 | selection: clientSelection,
|
22551 | borderBoxCenter: getBorderBoxCenterPosition(ref),
|
22552 | offset: origin
|
22553 | };
|
22554 | lift({
|
22555 | id: draggableId,
|
22556 | client: client,
|
22557 | autoScrollMode: autoScrollMode,
|
22558 | viewport: getViewport()
|
22559 | });
|
22560 | finish('LIFT');
|
22561 | };
|
22562 |
|
22563 | _this.setRef = function (ref) {
|
22564 | if (ref === null) {
|
22565 | return;
|
22566 | }
|
22567 |
|
22568 | if (ref === _this.ref) {
|
22569 | return;
|
22570 | }
|
22571 |
|
22572 | _this.ref = ref;
|
22573 | throwIfRefIsInvalid(ref);
|
22574 | };
|
22575 |
|
22576 | _this.getDraggableRef = function () {
|
22577 | return _this.ref;
|
22578 | };
|
22579 |
|
22580 | _this.getDraggingStyle = memoizeOne(function (change, dimension, isDropAnimating) {
|
22581 | var box = dimension.client;
|
22582 | var style = {
|
22583 | position: 'fixed',
|
22584 | top: box.marginBox.top,
|
22585 | left: box.marginBox.left,
|
22586 | boxSizing: 'border-box',
|
22587 | width: box.borderBox.width,
|
22588 | height: box.borderBox.height,
|
22589 | transition: 'none',
|
22590 | zIndex: isDropAnimating ? zIndexOptions.dropAnimating : zIndexOptions.dragging,
|
22591 | transform: getTranslate(change),
|
22592 | pointerEvents: 'none'
|
22593 | };
|
22594 | return style;
|
22595 | });
|
22596 | _this.getNotDraggingStyle = memoizeOne(function (current, shouldAnimateDisplacement) {
|
22597 | var style = {
|
22598 | transform: getTranslate(current),
|
22599 | transition: shouldAnimateDisplacement ? null : 'none'
|
22600 | };
|
22601 | return style;
|
22602 | });
|
22603 | _this.getProvided = memoizeOne(function (change, isDragging, isDropAnimating, shouldAnimateDisplacement, dimension, dragHandleProps) {
|
22604 | var useDraggingStyle = isDragging || isDropAnimating;
|
22605 |
|
22606 | var draggableStyle = function () {
|
22607 | if (!useDraggingStyle) {
|
22608 | return _this.getNotDraggingStyle(change, shouldAnimateDisplacement);
|
22609 | }
|
22610 |
|
22611 | !dimension ? process.env.NODE_ENV !== "production" ? invariant(false, 'draggable dimension required for dragging') : invariant(false) : void 0;
|
22612 | return _this.getDraggingStyle(change, dimension, isDropAnimating);
|
22613 | }();
|
22614 |
|
22615 | var provided = {
|
22616 | innerRef: _this.setRef,
|
22617 | draggableProps: {
|
22618 | 'data-react-beautiful-dnd-draggable': _this.styleContext,
|
22619 | style: draggableStyle
|
22620 | },
|
22621 | dragHandleProps: dragHandleProps
|
22622 | };
|
22623 | return provided;
|
22624 | });
|
22625 | _this.getSnapshot = memoizeOne(function (isDragging, isDropAnimating, draggingOver) {
|
22626 | return {
|
22627 | isDragging: isDragging || isDropAnimating,
|
22628 | isDropAnimating: isDropAnimating,
|
22629 | draggingOver: draggingOver
|
22630 | };
|
22631 | });
|
22632 |
|
22633 | _this.renderChildren = function (change, dragHandleProps) {
|
22634 | var _this$props2 = _this.props,
|
22635 | isDragging = _this$props2.isDragging,
|
22636 | isDropAnimating = _this$props2.isDropAnimating,
|
22637 | dimension = _this$props2.dimension,
|
22638 | draggingOver = _this$props2.draggingOver,
|
22639 | shouldAnimateDisplacement = _this$props2.shouldAnimateDisplacement,
|
22640 | children = _this$props2.children;
|
22641 | var child = children(_this.getProvided(change, isDragging, isDropAnimating, shouldAnimateDisplacement, dimension, dragHandleProps), _this.getSnapshot(isDragging, isDropAnimating, draggingOver));
|
22642 | var isDraggingOrDropping = isDragging || isDropAnimating;
|
22643 |
|
22644 | var placeholder = function () {
|
22645 | if (!isDraggingOrDropping) {
|
22646 | return null;
|
22647 | }
|
22648 |
|
22649 | !dimension ? process.env.NODE_ENV !== "production" ? invariant(false, 'Draggable: Dimension is required for dragging') : invariant(false) : void 0;
|
22650 | return React__default.createElement(Placeholder, {
|
22651 | placeholder: dimension.placeholder
|
22652 | });
|
22653 | }();
|
22654 |
|
22655 | return React__default.createElement(React.Fragment, null, child, placeholder);
|
22656 | };
|
22657 |
|
22658 | var callbacks = {
|
22659 | onLift: _this.onLift,
|
22660 | onMove: function onMove(clientSelection) {
|
22661 | return props.move({
|
22662 | client: clientSelection,
|
22663 | shouldAnimate: false
|
22664 | });
|
22665 | },
|
22666 | onDrop: function onDrop() {
|
22667 | return props.drop({
|
22668 | reason: 'DROP'
|
22669 | });
|
22670 | },
|
22671 | onCancel: function onCancel() {
|
22672 | return props.drop({
|
22673 | reason: 'CANCEL'
|
22674 | });
|
22675 | },
|
22676 | onMoveUp: props.moveUp,
|
22677 | onMoveDown: props.moveDown,
|
22678 | onMoveRight: props.moveRight,
|
22679 | onMoveLeft: props.moveLeft,
|
22680 | onWindowScroll: function onWindowScroll() {
|
22681 | return props.moveByWindowScroll({
|
22682 | scroll: getWindowScroll()
|
22683 | });
|
22684 | }
|
22685 | };
|
22686 | _this.callbacks = callbacks;
|
22687 | _this.styleContext = context[styleContextKey];
|
22688 | return _this;
|
22689 | }
|
22690 |
|
22691 | var _proto = Draggable.prototype;
|
22692 |
|
22693 | _proto.componentWillUnmount = function componentWillUnmount() {
|
22694 | this.ref = null;
|
22695 | };
|
22696 |
|
22697 | _proto.render = function render() {
|
22698 | var _this2 = this;
|
22699 |
|
22700 | var _this$props3 = this.props,
|
22701 | draggableId = _this$props3.draggableId,
|
22702 | index = _this$props3.index,
|
22703 | offset = _this$props3.offset,
|
22704 | isDragging = _this$props3.isDragging,
|
22705 | isDropAnimating = _this$props3.isDropAnimating,
|
22706 | isDragDisabled = _this$props3.isDragDisabled,
|
22707 | shouldAnimateDragMovement = _this$props3.shouldAnimateDragMovement,
|
22708 | disableInteractiveElementBlocking = _this$props3.disableInteractiveElementBlocking;
|
22709 | var droppableId = this.context[droppableIdKey];
|
22710 | var type = this.context[droppableTypeKey];
|
22711 | var speed = getSpeed$1(isDragging, shouldAnimateDragMovement, isDropAnimating);
|
22712 | return React__default.createElement(DraggableDimensionPublisher, {
|
22713 | key: draggableId,
|
22714 | draggableId: draggableId,
|
22715 | droppableId: droppableId,
|
22716 | type: type,
|
22717 | index: index,
|
22718 | getDraggableRef: this.getDraggableRef
|
22719 | }, React__default.createElement(Moveable, {
|
22720 | speed: speed,
|
22721 | destination: offset,
|
22722 | onMoveEnd: this.onMoveEnd
|
22723 | }, function (change) {
|
22724 | return React__default.createElement(DragHandle, {
|
22725 | draggableId: draggableId,
|
22726 | isDragging: isDragging,
|
22727 | isDropAnimating: isDropAnimating,
|
22728 | isEnabled: !isDragDisabled,
|
22729 | callbacks: _this2.callbacks,
|
22730 | getDraggableRef: _this2.getDraggableRef,
|
22731 | canDragInteractiveElements: disableInteractiveElementBlocking
|
22732 | }, function (dragHandleProps) {
|
22733 | return _this2.renderChildren(change, dragHandleProps);
|
22734 | });
|
22735 | }));
|
22736 | };
|
22737 |
|
22738 | return Draggable;
|
22739 | }(React.Component);
|
22740 |
|
22741 | Draggable.contextTypes = (_Draggable$contextTyp = {}, _Draggable$contextTyp[droppableIdKey] = PropTypes.string.isRequired, _Draggable$contextTyp[droppableTypeKey] = PropTypes.string.isRequired, _Draggable$contextTyp[styleContextKey] = PropTypes.string.isRequired, _Draggable$contextTyp);
|
22742 |
|
22743 | var defaultMapProps = {
|
22744 | isDropAnimating: false,
|
22745 | isDragging: false,
|
22746 | offset: origin,
|
22747 | shouldAnimateDragMovement: false,
|
22748 | shouldAnimateDisplacement: true,
|
22749 | dimension: null,
|
22750 | draggingOver: null
|
22751 | };
|
22752 | var makeMapStateToProps$1 = function makeMapStateToProps() {
|
22753 | var memoizedOffset = memoizeOne(function (x, y) {
|
22754 | return {
|
22755 | x: x,
|
22756 | y: y
|
22757 | };
|
22758 | });
|
22759 | var getNotDraggingProps = memoizeOne(function (offset, shouldAnimateDisplacement) {
|
22760 | return {
|
22761 | isDropAnimating: false,
|
22762 | isDragging: false,
|
22763 | offset: offset,
|
22764 | shouldAnimateDisplacement: shouldAnimateDisplacement,
|
22765 | shouldAnimateDragMovement: false,
|
22766 | dimension: null,
|
22767 | draggingOver: null
|
22768 | };
|
22769 | });
|
22770 | var getDraggingProps = memoizeOne(function (offset, shouldAnimateDragMovement, dimension, draggingOver) {
|
22771 | return {
|
22772 | isDragging: true,
|
22773 | isDropAnimating: false,
|
22774 | shouldAnimateDisplacement: false,
|
22775 | offset: offset,
|
22776 | shouldAnimateDragMovement: shouldAnimateDragMovement,
|
22777 | dimension: dimension,
|
22778 | draggingOver: draggingOver
|
22779 | };
|
22780 | });
|
22781 |
|
22782 | var getOutOfTheWayMovement = function getOutOfTheWayMovement(id, movement) {
|
22783 | var map = getDisplacementMap(movement.displaced);
|
22784 | var displacement = map[id];
|
22785 |
|
22786 | if (!displacement) {
|
22787 | return null;
|
22788 | }
|
22789 |
|
22790 | if (!displacement.isVisible) {
|
22791 | return null;
|
22792 | }
|
22793 |
|
22794 | var amount = movement.isBeyondStartPosition ? negate(movement.amount) : movement.amount;
|
22795 | return getNotDraggingProps(memoizedOffset(amount.x, amount.y), displacement.shouldAnimate);
|
22796 | };
|
22797 |
|
22798 | var draggingSelector = function draggingSelector(state, ownProps) {
|
22799 | if (state.isDragging) {
|
22800 | if (state.critical.draggable.id !== ownProps.draggableId) {
|
22801 | return null;
|
22802 | }
|
22803 |
|
22804 | var offset = state.current.client.offset;
|
22805 | var dimension = state.dimensions.draggables[ownProps.draggableId];
|
22806 | var shouldAnimateDragMovement = state.shouldAnimate;
|
22807 | var draggingOver = state.impact.destination ? state.impact.destination.droppableId : null;
|
22808 | return getDraggingProps(memoizedOffset(offset.x, offset.y), shouldAnimateDragMovement, dimension, draggingOver);
|
22809 | }
|
22810 |
|
22811 | if (state.phase === 'DROP_ANIMATING') {
|
22812 | var pending = state.pending;
|
22813 |
|
22814 | if (pending.result.draggableId !== ownProps.draggableId) {
|
22815 | return null;
|
22816 | }
|
22817 |
|
22818 | var _draggingOver = pending.result.destination ? pending.result.destination.droppableId : null;
|
22819 |
|
22820 | return {
|
22821 | isDragging: false,
|
22822 | isDropAnimating: true,
|
22823 | offset: pending.newHomeOffset,
|
22824 | dimension: state.dimensions.draggables[ownProps.draggableId],
|
22825 | draggingOver: _draggingOver,
|
22826 | shouldAnimateDragMovement: false,
|
22827 | shouldAnimateDisplacement: false
|
22828 | };
|
22829 | }
|
22830 |
|
22831 | return null;
|
22832 | };
|
22833 |
|
22834 | var movingOutOfTheWaySelector = function movingOutOfTheWaySelector(state, ownProps) {
|
22835 | if (state.isDragging) {
|
22836 | if (state.critical.draggable.id === ownProps.draggableId) {
|
22837 | return null;
|
22838 | }
|
22839 |
|
22840 | return getOutOfTheWayMovement(ownProps.draggableId, state.impact.movement);
|
22841 | }
|
22842 |
|
22843 | if (state.phase === 'DROP_ANIMATING') {
|
22844 | if (state.pending.result.draggableId === ownProps.draggableId) {
|
22845 | return null;
|
22846 | }
|
22847 |
|
22848 | return getOutOfTheWayMovement(ownProps.draggableId, state.pending.impact.movement);
|
22849 | }
|
22850 |
|
22851 | return null;
|
22852 | };
|
22853 |
|
22854 | var selector = function selector(state, ownProps) {
|
22855 | var dragging = draggingSelector(state, ownProps);
|
22856 |
|
22857 | if (dragging) {
|
22858 | return dragging;
|
22859 | }
|
22860 |
|
22861 | var movingOutOfTheWay = movingOutOfTheWaySelector(state, ownProps);
|
22862 |
|
22863 | if (movingOutOfTheWay) {
|
22864 | return movingOutOfTheWay;
|
22865 | }
|
22866 |
|
22867 | return defaultMapProps;
|
22868 | };
|
22869 |
|
22870 | return selector;
|
22871 | };
|
22872 | var mapDispatchToProps = {
|
22873 | lift: lift,
|
22874 | move: move,
|
22875 | moveUp: moveUp,
|
22876 | moveDown: moveDown,
|
22877 | moveLeft: moveLeft,
|
22878 | moveRight: moveRight,
|
22879 | moveByWindowScroll: moveByWindowScroll,
|
22880 | drop: drop,
|
22881 | dropAnimationFinished: dropAnimationFinished
|
22882 | };
|
22883 | var ConnectedDraggable = reactRedux.connect(makeMapStateToProps$1, mapDispatchToProps, null, {
|
22884 | storeKey: storeKey,
|
22885 | pure: true,
|
22886 | areStatePropsEqual: isStrictEqual
|
22887 | })(Draggable);
|
22888 | ConnectedDraggable.defaultProps = {
|
22889 | isDragDisabled: false,
|
22890 | disableInteractiveElementBlocking: false
|
22891 | };
|
22892 |
|
22893 | exports.DragDropContext = DragDropContext;
|
22894 | exports.Droppable = connectedDroppable;
|
22895 | exports.Draggable = ConnectedDraggable;
|
22896 | exports.resetServerContext = resetServerContext;
|
22897 |
|
22898 | }.call(exports, __webpack_require__(33)))
|
22899 |
|
22900 | }),
|
22901 |
|
22902 | (function(module, exports, __webpack_require__) {
|
22903 |
|
22904 | var _Object$assign = __webpack_require__(161);
|
22905 |
|
22906 | function _extends() {
|
22907 | module.exports = _extends = _Object$assign || function (target) {
|
22908 | for (var i = 1; i < arguments.length; i++) {
|
22909 | var source = arguments[i];
|
22910 |
|
22911 | for (var key in source) {
|
22912 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
22913 | target[key] = source[key];
|
22914 | }
|
22915 | }
|
22916 | }
|
22917 |
|
22918 | return target;
|
22919 | };
|
22920 |
|
22921 | return _extends.apply(this, arguments);
|
22922 | }
|
22923 |
|
22924 | module.exports = _extends;
|
22925 |
|
22926 | }),
|
22927 |
|
22928 | (function(module, exports, __webpack_require__) {
|
22929 |
|
22930 | module.exports = __webpack_require__(162);
|
22931 |
|
22932 | }),
|
22933 |
|
22934 | (function(module, exports, __webpack_require__) {
|
22935 |
|
22936 | __webpack_require__(163);
|
22937 | module.exports = __webpack_require__(166).Object.assign;
|
22938 |
|
22939 |
|
22940 | }),
|
22941 |
|
22942 | (function(module, exports, __webpack_require__) {
|
22943 |
|
22944 |
|
22945 | var $export = __webpack_require__(164);
|
22946 |
|
22947 | $export($export.S + $export.F, 'Object', { assign: __webpack_require__(180) });
|
22948 |
|
22949 |
|
22950 | }),
|
22951 |
|
22952 | (function(module, exports, __webpack_require__) {
|
22953 |
|
22954 | var global = __webpack_require__(165);
|
22955 | var core = __webpack_require__(166);
|
22956 | var ctx = __webpack_require__(167);
|
22957 | var hide = __webpack_require__(169);
|
22958 | var has = __webpack_require__(179);
|
22959 | var PROTOTYPE = 'prototype';
|
22960 |
|
22961 | var $export = function (type, name, source) {
|
22962 | var IS_FORCED = type & $export.F;
|
22963 | var IS_GLOBAL = type & $export.G;
|
22964 | var IS_STATIC = type & $export.S;
|
22965 | var IS_PROTO = type & $export.P;
|
22966 | var IS_BIND = type & $export.B;
|
22967 | var IS_WRAP = type & $export.W;
|
22968 | var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
|
22969 | var expProto = exports[PROTOTYPE];
|
22970 | var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
|
22971 | var key, own, out;
|
22972 | if (IS_GLOBAL) source = name;
|
22973 | for (key in source) {
|
22974 |
|
22975 | own = !IS_FORCED && target && target[key] !== undefined;
|
22976 | if (own && has(exports, key)) continue;
|
22977 |
|
22978 | out = own ? target[key] : source[key];
|
22979 |
|
22980 | exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
|
22981 |
|
22982 | : IS_BIND && own ? ctx(out, global)
|
22983 |
|
22984 | : IS_WRAP && target[key] == out ? (function (C) {
|
22985 | var F = function (a, b, c) {
|
22986 | if (this instanceof C) {
|
22987 | switch (arguments.length) {
|
22988 | case 0: return new C();
|
22989 | case 1: return new C(a);
|
22990 | case 2: return new C(a, b);
|
22991 | } return new C(a, b, c);
|
22992 | } return C.apply(this, arguments);
|
22993 | };
|
22994 | F[PROTOTYPE] = C[PROTOTYPE];
|
22995 | return F;
|
22996 |
|
22997 | })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
|
22998 |
|
22999 | if (IS_PROTO) {
|
23000 | (exports.virtual || (exports.virtual = {}))[key] = out;
|
23001 |
|
23002 | if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
|
23003 | }
|
23004 | }
|
23005 | };
|
23006 |
|
23007 | $export.F = 1;
|
23008 | $export.G = 2;
|
23009 | $export.S = 4;
|
23010 | $export.P = 8;
|
23011 | $export.B = 16;
|
23012 | $export.W = 32;
|
23013 | $export.U = 64;
|
23014 | $export.R = 128;
|
23015 | module.exports = $export;
|
23016 |
|
23017 |
|
23018 | }),
|
23019 |
|
23020 | (function(module, exports) {
|
23021 |
|
23022 |
|
23023 | var global = module.exports = typeof window != 'undefined' && window.Math == Math
|
23024 | ? window : typeof self != 'undefined' && self.Math == Math ? self
|
23025 |
|
23026 | : Function('return this')();
|
23027 | if (typeof __g == 'number') __g = global;
|
23028 |
|
23029 |
|
23030 | }),
|
23031 |
|
23032 | (function(module, exports) {
|
23033 |
|
23034 | var core = module.exports = { version: '2.5.7' };
|
23035 | if (typeof __e == 'number') __e = core;
|
23036 |
|
23037 |
|
23038 | }),
|
23039 |
|
23040 | (function(module, exports, __webpack_require__) {
|
23041 |
|
23042 |
|
23043 | var aFunction = __webpack_require__(168);
|
23044 | module.exports = function (fn, that, length) {
|
23045 | aFunction(fn);
|
23046 | if (that === undefined) return fn;
|
23047 | switch (length) {
|
23048 | case 1: return function (a) {
|
23049 | return fn.call(that, a);
|
23050 | };
|
23051 | case 2: return function (a, b) {
|
23052 | return fn.call(that, a, b);
|
23053 | };
|
23054 | case 3: return function (a, b, c) {
|
23055 | return fn.call(that, a, b, c);
|
23056 | };
|
23057 | }
|
23058 | return function (/* ...args */) {
|
23059 | return fn.apply(that, arguments);
|
23060 | };
|
23061 | };
|
23062 |
|
23063 |
|
23064 | }),
|
23065 |
|
23066 | (function(module, exports) {
|
23067 |
|
23068 | module.exports = function (it) {
|
23069 | if (typeof it != 'function') throw TypeError(it + ' is not a function!');
|
23070 | return it;
|
23071 | };
|
23072 |
|
23073 |
|
23074 | }),
|
23075 |
|
23076 | (function(module, exports, __webpack_require__) {
|
23077 |
|
23078 | var dP = __webpack_require__(170);
|
23079 | var createDesc = __webpack_require__(178);
|
23080 | module.exports = __webpack_require__(174) ? function (object, key, value) {
|
23081 | return dP.f(object, key, createDesc(1, value));
|
23082 | } : function (object, key, value) {
|
23083 | object[key] = value;
|
23084 | return object;
|
23085 | };
|
23086 |
|
23087 |
|
23088 | }),
|
23089 |
|
23090 | (function(module, exports, __webpack_require__) {
|
23091 |
|
23092 | var anObject = __webpack_require__(171);
|
23093 | var IE8_DOM_DEFINE = __webpack_require__(173);
|
23094 | var toPrimitive = __webpack_require__(177);
|
23095 | var dP = Object.defineProperty;
|
23096 |
|
23097 | exports.f = __webpack_require__(174) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
|
23098 | anObject(O);
|
23099 | P = toPrimitive(P, true);
|
23100 | anObject(Attributes);
|
23101 | if (IE8_DOM_DEFINE) try {
|
23102 | return dP(O, P, Attributes);
|
23103 | } catch (e) { }
|
23104 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
|
23105 | if ('value' in Attributes) O[P] = Attributes.value;
|
23106 | return O;
|
23107 | };
|
23108 |
|
23109 |
|
23110 | }),
|
23111 |
|
23112 | (function(module, exports, __webpack_require__) {
|
23113 |
|
23114 | var isObject = __webpack_require__(172);
|
23115 | module.exports = function (it) {
|
23116 | if (!isObject(it)) throw TypeError(it + ' is not an object!');
|
23117 | return it;
|
23118 | };
|
23119 |
|
23120 |
|
23121 | }),
|
23122 |
|
23123 | (function(module, exports) {
|
23124 |
|
23125 | module.exports = function (it) {
|
23126 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
23127 | };
|
23128 |
|
23129 |
|
23130 | }),
|
23131 |
|
23132 | (function(module, exports, __webpack_require__) {
|
23133 |
|
23134 | module.exports = !__webpack_require__(174) && !__webpack_require__(175)(function () {
|
23135 | return Object.defineProperty(__webpack_require__(176)('div'), 'a', { get: function () { return 7; } }).a != 7;
|
23136 | });
|
23137 |
|
23138 |
|
23139 | }),
|
23140 |
|
23141 | (function(module, exports, __webpack_require__) {
|
23142 |
|
23143 |
|
23144 | module.exports = !__webpack_require__(175)(function () {
|
23145 | return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
23146 | });
|
23147 |
|
23148 |
|
23149 | }),
|
23150 |
|
23151 | (function(module, exports) {
|
23152 |
|
23153 | module.exports = function (exec) {
|
23154 | try {
|
23155 | return !!exec();
|
23156 | } catch (e) {
|
23157 | return true;
|
23158 | }
|
23159 | };
|
23160 |
|
23161 |
|
23162 | }),
|
23163 |
|
23164 | (function(module, exports, __webpack_require__) {
|
23165 |
|
23166 | var isObject = __webpack_require__(172);
|
23167 | var document = __webpack_require__(165).document;
|
23168 |
|
23169 | var is = isObject(document) && isObject(document.createElement);
|
23170 | module.exports = function (it) {
|
23171 | return is ? document.createElement(it) : {};
|
23172 | };
|
23173 |
|
23174 |
|
23175 | }),
|
23176 |
|
23177 | (function(module, exports, __webpack_require__) {
|
23178 |
|
23179 |
|
23180 | var isObject = __webpack_require__(172);
|
23181 |
|
23182 |
|
23183 | module.exports = function (it, S) {
|
23184 | if (!isObject(it)) return it;
|
23185 | var fn, val;
|
23186 | if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
23187 | if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
|
23188 | if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
23189 | throw TypeError("Can't convert object to primitive value");
|
23190 | };
|
23191 |
|
23192 |
|
23193 | }),
|
23194 |
|
23195 | (function(module, exports) {
|
23196 |
|
23197 | module.exports = function (bitmap, value) {
|
23198 | return {
|
23199 | enumerable: !(bitmap & 1),
|
23200 | configurable: !(bitmap & 2),
|
23201 | writable: !(bitmap & 4),
|
23202 | value: value
|
23203 | };
|
23204 | };
|
23205 |
|
23206 |
|
23207 | }),
|
23208 |
|
23209 | (function(module, exports) {
|
23210 |
|
23211 | var hasOwnProperty = {}.hasOwnProperty;
|
23212 | module.exports = function (it, key) {
|
23213 | return hasOwnProperty.call(it, key);
|
23214 | };
|
23215 |
|
23216 |
|
23217 | }),
|
23218 |
|
23219 | (function(module, exports, __webpack_require__) {
|
23220 |
|
23221 | 'use strict';
|
23222 |
|
23223 | var getKeys = __webpack_require__(181);
|
23224 | var gOPS = __webpack_require__(196);
|
23225 | var pIE = __webpack_require__(197);
|
23226 | var toObject = __webpack_require__(198);
|
23227 | var IObject = __webpack_require__(184);
|
23228 | var $assign = Object.assign;
|
23229 |
|
23230 |
|
23231 | module.exports = !$assign || __webpack_require__(175)(function () {
|
23232 | var A = {};
|
23233 | var B = {};
|
23234 |
|
23235 | var S = Symbol();
|
23236 | var K = 'abcdefghijklmnopqrst';
|
23237 | A[S] = 7;
|
23238 | K.split('').forEach(function (k) { B[k] = k; });
|
23239 | return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
23240 | }) ? function assign(target, source) {
|
23241 | var T = toObject(target);
|
23242 | var aLen = arguments.length;
|
23243 | var index = 1;
|
23244 | var getSymbols = gOPS.f;
|
23245 | var isEnum = pIE.f;
|
23246 | while (aLen > index) {
|
23247 | var S = IObject(arguments[index++]);
|
23248 | var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
|
23249 | var length = keys.length;
|
23250 | var j = 0;
|
23251 | var key;
|
23252 | while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
|
23253 | } return T;
|
23254 | } : $assign;
|
23255 |
|
23256 |
|
23257 | }),
|
23258 |
|
23259 | (function(module, exports, __webpack_require__) {
|
23260 |
|
23261 |
|
23262 | var $keys = __webpack_require__(182);
|
23263 | var enumBugKeys = __webpack_require__(195);
|
23264 |
|
23265 | module.exports = Object.keys || function keys(O) {
|
23266 | return $keys(O, enumBugKeys);
|
23267 | };
|
23268 |
|
23269 |
|
23270 | }),
|
23271 |
|
23272 | (function(module, exports, __webpack_require__) {
|
23273 |
|
23274 | var has = __webpack_require__(179);
|
23275 | var toIObject = __webpack_require__(183);
|
23276 | var arrayIndexOf = __webpack_require__(187)(false);
|
23277 | var IE_PROTO = __webpack_require__(191)('IE_PROTO');
|
23278 |
|
23279 | module.exports = function (object, names) {
|
23280 | var O = toIObject(object);
|
23281 | var i = 0;
|
23282 | var result = [];
|
23283 | var key;
|
23284 | for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
|
23285 |
|
23286 | while (names.length > i) if (has(O, key = names[i++])) {
|
23287 | ~arrayIndexOf(result, key) || result.push(key);
|
23288 | }
|
23289 | return result;
|
23290 | };
|
23291 |
|
23292 |
|
23293 | }),
|
23294 |
|
23295 | (function(module, exports, __webpack_require__) {
|
23296 |
|
23297 |
|
23298 | var IObject = __webpack_require__(184);
|
23299 | var defined = __webpack_require__(186);
|
23300 | module.exports = function (it) {
|
23301 | return IObject(defined(it));
|
23302 | };
|
23303 |
|
23304 |
|
23305 | }),
|
23306 |
|
23307 | (function(module, exports, __webpack_require__) {
|
23308 |
|
23309 |
|
23310 | var cof = __webpack_require__(185);
|
23311 |
|
23312 | module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
|
23313 | return cof(it) == 'String' ? it.split('') : Object(it);
|
23314 | };
|
23315 |
|
23316 |
|
23317 | }),
|
23318 |
|
23319 | (function(module, exports) {
|
23320 |
|
23321 | var toString = {}.toString;
|
23322 |
|
23323 | module.exports = function (it) {
|
23324 | return toString.call(it).slice(8, -1);
|
23325 | };
|
23326 |
|
23327 |
|
23328 | }),
|
23329 |
|
23330 | (function(module, exports) {
|
23331 |
|
23332 |
|
23333 | module.exports = function (it) {
|
23334 | if (it == undefined) throw TypeError("Can't call method on " + it);
|
23335 | return it;
|
23336 | };
|
23337 |
|
23338 |
|
23339 | }),
|
23340 |
|
23341 | (function(module, exports, __webpack_require__) {
|
23342 |
|
23343 |
|
23344 |
|
23345 | var toIObject = __webpack_require__(183);
|
23346 | var toLength = __webpack_require__(188);
|
23347 | var toAbsoluteIndex = __webpack_require__(190);
|
23348 | module.exports = function (IS_INCLUDES) {
|
23349 | return function ($this, el, fromIndex) {
|
23350 | var O = toIObject($this);
|
23351 | var length = toLength(O.length);
|
23352 | var index = toAbsoluteIndex(fromIndex, length);
|
23353 | var value;
|
23354 |
|
23355 |
|
23356 | if (IS_INCLUDES && el != el) while (length > index) {
|
23357 | value = O[index++];
|
23358 |
|
23359 | if (value != value) return true;
|
23360 |
|
23361 | } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
|
23362 | if (O[index] === el) return IS_INCLUDES || index || 0;
|
23363 | } return !IS_INCLUDES && -1;
|
23364 | };
|
23365 | };
|
23366 |
|
23367 |
|
23368 | }),
|
23369 |
|
23370 | (function(module, exports, __webpack_require__) {
|
23371 |
|
23372 |
|
23373 | var toInteger = __webpack_require__(189);
|
23374 | var min = Math.min;
|
23375 | module.exports = function (it) {
|
23376 | return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0;
|
23377 | };
|
23378 |
|
23379 |
|
23380 | }),
|
23381 |
|
23382 | (function(module, exports) {
|
23383 |
|
23384 |
|
23385 | var ceil = Math.ceil;
|
23386 | var floor = Math.floor;
|
23387 | module.exports = function (it) {
|
23388 | return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
23389 | };
|
23390 |
|
23391 |
|
23392 | }),
|
23393 |
|
23394 | (function(module, exports, __webpack_require__) {
|
23395 |
|
23396 | var toInteger = __webpack_require__(189);
|
23397 | var max = Math.max;
|
23398 | var min = Math.min;
|
23399 | module.exports = function (index, length) {
|
23400 | index = toInteger(index);
|
23401 | return index < 0 ? max(index + length, 0) : min(index, length);
|
23402 | };
|
23403 |
|
23404 |
|
23405 | }),
|
23406 |
|
23407 | (function(module, exports, __webpack_require__) {
|
23408 |
|
23409 | var shared = __webpack_require__(192)('keys');
|
23410 | var uid = __webpack_require__(194);
|
23411 | module.exports = function (key) {
|
23412 | return shared[key] || (shared[key] = uid(key));
|
23413 | };
|
23414 |
|
23415 |
|
23416 | }),
|
23417 |
|
23418 | (function(module, exports, __webpack_require__) {
|
23419 |
|
23420 | var core = __webpack_require__(166);
|
23421 | var global = __webpack_require__(165);
|
23422 | var SHARED = '__core-js_shared__';
|
23423 | var store = global[SHARED] || (global[SHARED] = {});
|
23424 |
|
23425 | (module.exports = function (key, value) {
|
23426 | return store[key] || (store[key] = value !== undefined ? value : {});
|
23427 | })('versions', []).push({
|
23428 | version: core.version,
|
23429 | mode: __webpack_require__(193) ? 'pure' : 'global',
|
23430 | copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
|
23431 | });
|
23432 |
|
23433 |
|
23434 | }),
|
23435 |
|
23436 | (function(module, exports) {
|
23437 |
|
23438 | module.exports = true;
|
23439 |
|
23440 |
|
23441 | }),
|
23442 |
|
23443 | (function(module, exports) {
|
23444 |
|
23445 | var id = 0;
|
23446 | var px = Math.random();
|
23447 | module.exports = function (key) {
|
23448 | return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
23449 | };
|
23450 |
|
23451 |
|
23452 | }),
|
23453 |
|
23454 | (function(module, exports) {
|
23455 |
|
23456 |
|
23457 | module.exports = (
|
23458 | 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
|
23459 | ).split(',');
|
23460 |
|
23461 |
|
23462 | }),
|
23463 |
|
23464 | (function(module, exports) {
|
23465 |
|
23466 | exports.f = Object.getOwnPropertySymbols;
|
23467 |
|
23468 |
|
23469 | }),
|
23470 |
|
23471 | (function(module, exports) {
|
23472 |
|
23473 | exports.f = {}.propertyIsEnumerable;
|
23474 |
|
23475 |
|
23476 | }),
|
23477 |
|
23478 | (function(module, exports, __webpack_require__) {
|
23479 |
|
23480 |
|
23481 | var defined = __webpack_require__(186);
|
23482 | module.exports = function (it) {
|
23483 | return Object(defined(it));
|
23484 | };
|
23485 |
|
23486 |
|
23487 | }),
|
23488 |
|
23489 | (function(module, exports, __webpack_require__) {
|
23490 |
|
23491 | (function(process) {'use strict';
|
23492 |
|
23493 | var isProduction = process.env.NODE_ENV === 'production';
|
23494 | var prefix = 'Invariant failed';
|
23495 | function invariant(condition, message) {
|
23496 | if (condition) {
|
23497 | return;
|
23498 | }
|
23499 |
|
23500 | if (isProduction) {
|
23501 | throw new Error(prefix);
|
23502 | } else {
|
23503 | throw new Error(prefix + ": " + (message || ''));
|
23504 | }
|
23505 | }
|
23506 |
|
23507 | module.exports = invariant;
|
23508 |
|
23509 | }.call(exports, __webpack_require__(33)))
|
23510 |
|
23511 | }),
|
23512 |
|
23513 | (function(module, exports, __webpack_require__) {
|
23514 |
|
23515 | (function(process) {'use strict';
|
23516 |
|
23517 | Object.defineProperty(exports, '__esModule', { value: true });
|
23518 |
|
23519 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
23520 |
|
23521 | var invariant = _interopDefault(__webpack_require__(199));
|
23522 |
|
23523 | var getRect = function getRect(_ref) {
|
23524 | var top = _ref.top,
|
23525 | right = _ref.right,
|
23526 | bottom = _ref.bottom,
|
23527 | left = _ref.left;
|
23528 | var width = right - left;
|
23529 | var height = bottom - top;
|
23530 | var rect = {
|
23531 | top: top,
|
23532 | right: right,
|
23533 | bottom: bottom,
|
23534 | left: left,
|
23535 | width: width,
|
23536 | height: height,
|
23537 | x: left,
|
23538 | y: top,
|
23539 | center: {
|
23540 | x: (right + left) / 2,
|
23541 | y: (bottom + top) / 2
|
23542 | }
|
23543 | };
|
23544 | return rect;
|
23545 | };
|
23546 | var expand = function expand(target, expandBy) {
|
23547 | return {
|
23548 | top: target.top - expandBy.top,
|
23549 | left: target.left - expandBy.left,
|
23550 | bottom: target.bottom + expandBy.bottom,
|
23551 | right: target.right + expandBy.right
|
23552 | };
|
23553 | };
|
23554 | var shrink = function shrink(target, shrinkBy) {
|
23555 | return {
|
23556 | top: target.top + shrinkBy.top,
|
23557 | left: target.left + shrinkBy.left,
|
23558 | bottom: target.bottom - shrinkBy.bottom,
|
23559 | right: target.right - shrinkBy.right
|
23560 | };
|
23561 | };
|
23562 |
|
23563 | var shift = function shift(target, shiftBy) {
|
23564 | return {
|
23565 | top: target.top + shiftBy.y,
|
23566 | left: target.left + shiftBy.x,
|
23567 | bottom: target.bottom + shiftBy.y,
|
23568 | right: target.right + shiftBy.x
|
23569 | };
|
23570 | };
|
23571 |
|
23572 | var noSpacing = {
|
23573 | top: 0,
|
23574 | right: 0,
|
23575 | bottom: 0,
|
23576 | left: 0
|
23577 | };
|
23578 | var createBox = function createBox(_ref2) {
|
23579 | var borderBox = _ref2.borderBox,
|
23580 | _ref2$margin = _ref2.margin,
|
23581 | margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin,
|
23582 | _ref2$border = _ref2.border,
|
23583 | border = _ref2$border === void 0 ? noSpacing : _ref2$border,
|
23584 | _ref2$padding = _ref2.padding,
|
23585 | padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
|
23586 | var marginBox = getRect(expand(borderBox, margin));
|
23587 | var paddingBox = getRect(shrink(borderBox, border));
|
23588 | var contentBox = getRect(shrink(paddingBox, padding));
|
23589 | return {
|
23590 | marginBox: marginBox,
|
23591 | borderBox: getRect(borderBox),
|
23592 | paddingBox: paddingBox,
|
23593 | contentBox: contentBox,
|
23594 | margin: margin,
|
23595 | border: border,
|
23596 | padding: padding
|
23597 | };
|
23598 | };
|
23599 |
|
23600 | var parse = function parse(raw) {
|
23601 | var value = raw.slice(0, -2);
|
23602 | var suffix = raw.slice(-2);
|
23603 |
|
23604 | if (suffix !== 'px') {
|
23605 | return 0;
|
23606 | }
|
23607 |
|
23608 | var result = Number(value);
|
23609 | !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
|
23610 | return result;
|
23611 | };
|
23612 |
|
23613 | var getWindowScroll = function getWindowScroll() {
|
23614 | return {
|
23615 | x: window.pageXOffset,
|
23616 | y: window.pageYOffset
|
23617 | };
|
23618 | };
|
23619 |
|
23620 | var offset = function offset(original, change) {
|
23621 | var borderBox = original.borderBox,
|
23622 | border = original.border,
|
23623 | margin = original.margin,
|
23624 | padding = original.padding;
|
23625 | var shifted = shift(borderBox, change);
|
23626 | return createBox({
|
23627 | borderBox: shifted,
|
23628 | border: border,
|
23629 | margin: margin,
|
23630 | padding: padding
|
23631 | });
|
23632 | };
|
23633 | var withScroll = function withScroll(original, scroll) {
|
23634 | if (scroll === void 0) {
|
23635 | scroll = getWindowScroll();
|
23636 | }
|
23637 |
|
23638 | return offset(original, scroll);
|
23639 | };
|
23640 | var calculateBox = function calculateBox(borderBox, styles) {
|
23641 | var margin = {
|
23642 | top: parse(styles.marginTop),
|
23643 | right: parse(styles.marginRight),
|
23644 | bottom: parse(styles.marginBottom),
|
23645 | left: parse(styles.marginLeft)
|
23646 | };
|
23647 | var padding = {
|
23648 | top: parse(styles.paddingTop),
|
23649 | right: parse(styles.paddingRight),
|
23650 | bottom: parse(styles.paddingBottom),
|
23651 | left: parse(styles.paddingLeft)
|
23652 | };
|
23653 | var border = {
|
23654 | top: parse(styles.borderTopWidth),
|
23655 | right: parse(styles.borderRightWidth),
|
23656 | bottom: parse(styles.borderBottomWidth),
|
23657 | left: parse(styles.borderLeftWidth)
|
23658 | };
|
23659 | return createBox({
|
23660 | borderBox: borderBox,
|
23661 | margin: margin,
|
23662 | padding: padding,
|
23663 | border: border
|
23664 | });
|
23665 | };
|
23666 | var getBox = function getBox(el) {
|
23667 | var borderBox = el.getBoundingClientRect();
|
23668 | var styles = window.getComputedStyle(el);
|
23669 | return calculateBox(borderBox, styles);
|
23670 | };
|
23671 |
|
23672 | exports.calculateBox = calculateBox;
|
23673 | exports.createBox = createBox;
|
23674 | exports.expand = expand;
|
23675 | exports.getBox = getBox;
|
23676 | exports.getRect = getRect;
|
23677 | exports.offset = offset;
|
23678 | exports.shrink = shrink;
|
23679 | exports.withScroll = withScroll;
|
23680 |
|
23681 | }.call(exports, __webpack_require__(33)))
|
23682 |
|
23683 | }),
|
23684 |
|
23685 | (function(module, exports, __webpack_require__) {
|
23686 |
|
23687 | module.exports = __webpack_require__(202);
|
23688 |
|
23689 | }),
|
23690 |
|
23691 | (function(module, exports, __webpack_require__) {
|
23692 |
|
23693 | __webpack_require__(203);
|
23694 | module.exports = __webpack_require__(166).Object.keys;
|
23695 |
|
23696 |
|
23697 | }),
|
23698 |
|
23699 | (function(module, exports, __webpack_require__) {
|
23700 |
|
23701 |
|
23702 | var toObject = __webpack_require__(198);
|
23703 | var $keys = __webpack_require__(181);
|
23704 |
|
23705 | __webpack_require__(204)('keys', function () {
|
23706 | return function keys(it) {
|
23707 | return $keys(toObject(it));
|
23708 | };
|
23709 | });
|
23710 |
|
23711 |
|
23712 | }),
|
23713 |
|
23714 | (function(module, exports, __webpack_require__) {
|
23715 |
|
23716 |
|
23717 | var $export = __webpack_require__(164);
|
23718 | var core = __webpack_require__(166);
|
23719 | var fails = __webpack_require__(175);
|
23720 | module.exports = function (KEY, exec) {
|
23721 | var fn = (core.Object || {})[KEY] || Object[KEY];
|
23722 | var exp = {};
|
23723 | exp[KEY] = exec(fn);
|
23724 | $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
|
23725 | };
|
23726 |
|
23727 |
|
23728 | }),
|
23729 |
|
23730 | (function(module, exports) {
|
23731 |
|
23732 | 'use strict';
|
23733 |
|
23734 | var simpleIsEqual = function simpleIsEqual(a, b) {
|
23735 | return a === b;
|
23736 | };
|
23737 |
|
23738 | function index (resultFn, isEqual) {
|
23739 | if (isEqual === void 0) {
|
23740 | isEqual = simpleIsEqual;
|
23741 | }
|
23742 |
|
23743 | var lastThis;
|
23744 | var lastArgs = [];
|
23745 | var lastResult;
|
23746 | var calledOnce = false;
|
23747 |
|
23748 | var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) {
|
23749 | return isEqual(newArg, lastArgs[index]);
|
23750 | };
|
23751 |
|
23752 | var result = function result() {
|
23753 | for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {
|
23754 | newArgs[_key] = arguments[_key];
|
23755 | }
|
23756 |
|
23757 | if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {
|
23758 | return lastResult;
|
23759 | }
|
23760 |
|
23761 | lastResult = resultFn.apply(this, newArgs);
|
23762 | calledOnce = true;
|
23763 | lastThis = this;
|
23764 | lastArgs = newArgs;
|
23765 | return lastResult;
|
23766 | };
|
23767 |
|
23768 | return result;
|
23769 | }
|
23770 |
|
23771 | module.exports = index;
|
23772 |
|
23773 |
|
23774 | }),
|
23775 |
|
23776 | (function(module, exports, __webpack_require__) {
|
23777 |
|
23778 | (function(process) {'use strict';
|
23779 |
|
23780 | Object.defineProperty(exports, '__esModule', { value: true });
|
23781 |
|
23782 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
23783 |
|
23784 | var $$observable = _interopDefault(__webpack_require__(207));
|
23785 |
|
23786 | |
23787 |
|
23788 |
|
23789 |
|
23790 |
|
23791 |
|
23792 | var randomString = function randomString() {
|
23793 | return Math.random().toString(36).substring(7).split('').join('.');
|
23794 | };
|
23795 |
|
23796 | var ActionTypes = {
|
23797 | INIT: "@@redux/INIT" + randomString(),
|
23798 | REPLACE: "@@redux/REPLACE" + randomString(),
|
23799 | PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
23800 | return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
23801 | }
|
23802 | };
|
23803 |
|
23804 | |
23805 |
|
23806 |
|
23807 |
|
23808 | function isPlainObject(obj) {
|
23809 | if (typeof obj !== 'object' || obj === null) return false;
|
23810 | var proto = obj;
|
23811 |
|
23812 | while (Object.getPrototypeOf(proto) !== null) {
|
23813 | proto = Object.getPrototypeOf(proto);
|
23814 | }
|
23815 |
|
23816 | return Object.getPrototypeOf(obj) === proto;
|
23817 | }
|
23818 |
|
23819 | |
23820 |
|
23821 |
|
23822 |
|
23823 |
|
23824 |
|
23825 |
|
23826 |
|
23827 |
|
23828 |
|
23829 |
|
23830 |
|
23831 |
|
23832 |
|
23833 |
|
23834 |
|
23835 |
|
23836 |
|
23837 |
|
23838 |
|
23839 |
|
23840 |
|
23841 |
|
23842 |
|
23843 |
|
23844 |
|
23845 | function createStore(reducer, preloadedState, enhancer) {
|
23846 | var _ref2;
|
23847 |
|
23848 | if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
|
23849 | throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function.');
|
23850 | }
|
23851 |
|
23852 | if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
|
23853 | enhancer = preloadedState;
|
23854 | preloadedState = undefined;
|
23855 | }
|
23856 |
|
23857 | if (typeof enhancer !== 'undefined') {
|
23858 | if (typeof enhancer !== 'function') {
|
23859 | throw new Error('Expected the enhancer to be a function.');
|
23860 | }
|
23861 |
|
23862 | return enhancer(createStore)(reducer, preloadedState);
|
23863 | }
|
23864 |
|
23865 | if (typeof reducer !== 'function') {
|
23866 | throw new Error('Expected the reducer to be a function.');
|
23867 | }
|
23868 |
|
23869 | var currentReducer = reducer;
|
23870 | var currentState = preloadedState;
|
23871 | var currentListeners = [];
|
23872 | var nextListeners = currentListeners;
|
23873 | var isDispatching = false;
|
23874 | |
23875 |
|
23876 |
|
23877 |
|
23878 |
|
23879 |
|
23880 |
|
23881 |
|
23882 | function ensureCanMutateNextListeners() {
|
23883 | if (nextListeners === currentListeners) {
|
23884 | nextListeners = currentListeners.slice();
|
23885 | }
|
23886 | }
|
23887 | |
23888 |
|
23889 |
|
23890 |
|
23891 |
|
23892 |
|
23893 |
|
23894 | function getState() {
|
23895 | if (isDispatching) {
|
23896 | throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
|
23897 | }
|
23898 |
|
23899 | return currentState;
|
23900 | }
|
23901 | |
23902 |
|
23903 |
|
23904 |
|
23905 |
|
23906 |
|
23907 |
|
23908 |
|
23909 |
|
23910 |
|
23911 |
|
23912 |
|
23913 |
|
23914 |
|
23915 |
|
23916 |
|
23917 |
|
23918 |
|
23919 |
|
23920 |
|
23921 |
|
23922 |
|
23923 |
|
23924 |
|
23925 |
|
23926 | function subscribe(listener) {
|
23927 | if (typeof listener !== 'function') {
|
23928 | throw new Error('Expected the listener to be a function.');
|
23929 | }
|
23930 |
|
23931 | if (isDispatching) {
|
23932 | throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');
|
23933 | }
|
23934 |
|
23935 | var isSubscribed = true;
|
23936 | ensureCanMutateNextListeners();
|
23937 | nextListeners.push(listener);
|
23938 | return function unsubscribe() {
|
23939 | if (!isSubscribed) {
|
23940 | return;
|
23941 | }
|
23942 |
|
23943 | if (isDispatching) {
|
23944 | throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');
|
23945 | }
|
23946 |
|
23947 | isSubscribed = false;
|
23948 | ensureCanMutateNextListeners();
|
23949 | var index = nextListeners.indexOf(listener);
|
23950 | nextListeners.splice(index, 1);
|
23951 | };
|
23952 | }
|
23953 | |
23954 |
|
23955 |
|
23956 |
|
23957 |
|
23958 |
|
23959 |
|
23960 |
|
23961 |
|
23962 |
|
23963 |
|
23964 |
|
23965 |
|
23966 |
|
23967 |
|
23968 |
|
23969 |
|
23970 |
|
23971 |
|
23972 |
|
23973 |
|
23974 |
|
23975 |
|
23976 |
|
23977 |
|
23978 |
|
23979 |
|
23980 | function dispatch(action) {
|
23981 | if (!isPlainObject(action)) {
|
23982 | throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
|
23983 | }
|
23984 |
|
23985 | if (typeof action.type === 'undefined') {
|
23986 | throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
|
23987 | }
|
23988 |
|
23989 | if (isDispatching) {
|
23990 | throw new Error('Reducers may not dispatch actions.');
|
23991 | }
|
23992 |
|
23993 | try {
|
23994 | isDispatching = true;
|
23995 | currentState = currentReducer(currentState, action);
|
23996 | } finally {
|
23997 | isDispatching = false;
|
23998 | }
|
23999 |
|
24000 | var listeners = currentListeners = nextListeners;
|
24001 |
|
24002 | for (var i = 0; i < listeners.length; i++) {
|
24003 | var listener = listeners[i];
|
24004 | listener();
|
24005 | }
|
24006 |
|
24007 | return action;
|
24008 | }
|
24009 | |
24010 |
|
24011 |
|
24012 |
|
24013 |
|
24014 |
|
24015 |
|
24016 |
|
24017 |
|
24018 |
|
24019 |
|
24020 |
|
24021 | function replaceReducer(nextReducer) {
|
24022 | if (typeof nextReducer !== 'function') {
|
24023 | throw new Error('Expected the nextReducer to be a function.');
|
24024 | }
|
24025 |
|
24026 | currentReducer = nextReducer;
|
24027 |
|
24028 |
|
24029 |
|
24030 |
|
24031 | dispatch({
|
24032 | type: ActionTypes.REPLACE
|
24033 | });
|
24034 | }
|
24035 | |
24036 |
|
24037 |
|
24038 |
|
24039 |
|
24040 |
|
24041 |
|
24042 |
|
24043 | function observable() {
|
24044 | var _ref;
|
24045 |
|
24046 | var outerSubscribe = subscribe;
|
24047 | return _ref = {
|
24048 | |
24049 |
|
24050 |
|
24051 |
|
24052 |
|
24053 |
|
24054 |
|
24055 |
|
24056 | subscribe: function subscribe(observer) {
|
24057 | if (typeof observer !== 'object' || observer === null) {
|
24058 | throw new TypeError('Expected the observer to be an object.');
|
24059 | }
|
24060 |
|
24061 | function observeState() {
|
24062 | if (observer.next) {
|
24063 | observer.next(getState());
|
24064 | }
|
24065 | }
|
24066 |
|
24067 | observeState();
|
24068 | var unsubscribe = outerSubscribe(observeState);
|
24069 | return {
|
24070 | unsubscribe: unsubscribe
|
24071 | };
|
24072 | }
|
24073 | }, _ref[$$observable] = function () {
|
24074 | return this;
|
24075 | }, _ref;
|
24076 | }
|
24077 |
|
24078 |
|
24079 |
|
24080 |
|
24081 | dispatch({
|
24082 | type: ActionTypes.INIT
|
24083 | });
|
24084 | return _ref2 = {
|
24085 | dispatch: dispatch,
|
24086 | subscribe: subscribe,
|
24087 | getState: getState,
|
24088 | replaceReducer: replaceReducer
|
24089 | }, _ref2[$$observable] = observable, _ref2;
|
24090 | }
|
24091 |
|
24092 | |
24093 |
|
24094 |
|
24095 |
|
24096 |
|
24097 |
|
24098 | function warning(message) {
|
24099 |
|
24100 | if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
24101 | console.error(message);
|
24102 | }
|
24103 |
|
24104 |
|
24105 |
|
24106 | try {
|
24107 |
|
24108 |
|
24109 |
|
24110 | throw new Error(message);
|
24111 | } catch (e) {}
|
24112 |
|
24113 | }
|
24114 |
|
24115 | function getUndefinedStateErrorMessage(key, action) {
|
24116 | var actionType = action && action.type;
|
24117 | var actionDescription = actionType && "action \"" + String(actionType) + "\"" || 'an action';
|
24118 | return "Given " + actionDescription + ", reducer \"" + key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined.";
|
24119 | }
|
24120 |
|
24121 | function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
24122 | var reducerKeys = Object.keys(reducers);
|
24123 | var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
|
24124 |
|
24125 | if (reducerKeys.length === 0) {
|
24126 | return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
|
24127 | }
|
24128 |
|
24129 | if (!isPlainObject(inputState)) {
|
24130 | return "The " + argumentName + " has unexpected type of \"" + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
|
24131 | }
|
24132 |
|
24133 | var unexpectedKeys = Object.keys(inputState).filter(function (key) {
|
24134 | return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
|
24135 | });
|
24136 | unexpectedKeys.forEach(function (key) {
|
24137 | unexpectedKeyCache[key] = true;
|
24138 | });
|
24139 | if (action && action.type === ActionTypes.REPLACE) return;
|
24140 |
|
24141 | if (unexpectedKeys.length > 0) {
|
24142 | return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored.");
|
24143 | }
|
24144 | }
|
24145 |
|
24146 | function assertReducerShape(reducers) {
|
24147 | Object.keys(reducers).forEach(function (key) {
|
24148 | var reducer = reducers[key];
|
24149 | var initialState = reducer(undefined, {
|
24150 | type: ActionTypes.INIT
|
24151 | });
|
24152 |
|
24153 | if (typeof initialState === 'undefined') {
|
24154 | throw new Error("Reducer \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined.");
|
24155 | }
|
24156 |
|
24157 | if (typeof reducer(undefined, {
|
24158 | type: ActionTypes.PROBE_UNKNOWN_ACTION()
|
24159 | }) === 'undefined') {
|
24160 | throw new Error("Reducer \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle " + ActionTypes.INIT + " or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null.");
|
24161 | }
|
24162 | });
|
24163 | }
|
24164 | |
24165 |
|
24166 |
|
24167 |
|
24168 |
|
24169 |
|
24170 |
|
24171 |
|
24172 |
|
24173 |
|
24174 |
|
24175 |
|
24176 |
|
24177 |
|
24178 |
|
24179 |
|
24180 |
|
24181 |
|
24182 | function combineReducers(reducers) {
|
24183 | var reducerKeys = Object.keys(reducers);
|
24184 | var finalReducers = {};
|
24185 |
|
24186 | for (var i = 0; i < reducerKeys.length; i++) {
|
24187 | var key = reducerKeys[i];
|
24188 |
|
24189 | if (process.env.NODE_ENV !== 'production') {
|
24190 | if (typeof reducers[key] === 'undefined') {
|
24191 | warning("No reducer provided for key \"" + key + "\"");
|
24192 | }
|
24193 | }
|
24194 |
|
24195 | if (typeof reducers[key] === 'function') {
|
24196 | finalReducers[key] = reducers[key];
|
24197 | }
|
24198 | }
|
24199 |
|
24200 | var finalReducerKeys = Object.keys(finalReducers);
|
24201 |
|
24202 |
|
24203 | var unexpectedKeyCache;
|
24204 |
|
24205 | if (process.env.NODE_ENV !== 'production') {
|
24206 | unexpectedKeyCache = {};
|
24207 | }
|
24208 |
|
24209 | var shapeAssertionError;
|
24210 |
|
24211 | try {
|
24212 | assertReducerShape(finalReducers);
|
24213 | } catch (e) {
|
24214 | shapeAssertionError = e;
|
24215 | }
|
24216 |
|
24217 | return function combination(state, action) {
|
24218 | if (state === void 0) {
|
24219 | state = {};
|
24220 | }
|
24221 |
|
24222 | if (shapeAssertionError) {
|
24223 | throw shapeAssertionError;
|
24224 | }
|
24225 |
|
24226 | if (process.env.NODE_ENV !== 'production') {
|
24227 | var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
24228 |
|
24229 | if (warningMessage) {
|
24230 | warning(warningMessage);
|
24231 | }
|
24232 | }
|
24233 |
|
24234 | var hasChanged = false;
|
24235 | var nextState = {};
|
24236 |
|
24237 | for (var _i = 0; _i < finalReducerKeys.length; _i++) {
|
24238 | var _key = finalReducerKeys[_i];
|
24239 | var reducer = finalReducers[_key];
|
24240 | var previousStateForKey = state[_key];
|
24241 | var nextStateForKey = reducer(previousStateForKey, action);
|
24242 |
|
24243 | if (typeof nextStateForKey === 'undefined') {
|
24244 | var errorMessage = getUndefinedStateErrorMessage(_key, action);
|
24245 | throw new Error(errorMessage);
|
24246 | }
|
24247 |
|
24248 | nextState[_key] = nextStateForKey;
|
24249 | hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
24250 | }
|
24251 |
|
24252 | return hasChanged ? nextState : state;
|
24253 | };
|
24254 | }
|
24255 |
|
24256 | function bindActionCreator(actionCreator, dispatch) {
|
24257 | return function () {
|
24258 | return dispatch(actionCreator.apply(this, arguments));
|
24259 | };
|
24260 | }
|
24261 | |
24262 |
|
24263 |
|
24264 |
|
24265 |
|
24266 |
|
24267 |
|
24268 |
|
24269 |
|
24270 |
|
24271 |
|
24272 |
|
24273 |
|
24274 |
|
24275 |
|
24276 |
|
24277 |
|
24278 |
|
24279 |
|
24280 |
|
24281 |
|
24282 |
|
24283 |
|
24284 | function bindActionCreators(actionCreators, dispatch) {
|
24285 | if (typeof actionCreators === 'function') {
|
24286 | return bindActionCreator(actionCreators, dispatch);
|
24287 | }
|
24288 |
|
24289 | if (typeof actionCreators !== 'object' || actionCreators === null) {
|
24290 | throw new Error("bindActionCreators expected an object or a function, instead received " + (actionCreators === null ? 'null' : typeof actionCreators) + ". " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
|
24291 | }
|
24292 |
|
24293 | var boundActionCreators = {};
|
24294 |
|
24295 | for (var key in actionCreators) {
|
24296 | var actionCreator = actionCreators[key];
|
24297 |
|
24298 | if (typeof actionCreator === 'function') {
|
24299 | boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
|
24300 | }
|
24301 | }
|
24302 |
|
24303 | return boundActionCreators;
|
24304 | }
|
24305 |
|
24306 | function _defineProperty(obj, key, value) {
|
24307 | if (key in obj) {
|
24308 | Object.defineProperty(obj, key, {
|
24309 | value: value,
|
24310 | enumerable: true,
|
24311 | configurable: true,
|
24312 | writable: true
|
24313 | });
|
24314 | } else {
|
24315 | obj[key] = value;
|
24316 | }
|
24317 |
|
24318 | return obj;
|
24319 | }
|
24320 |
|
24321 | function ownKeys(object, enumerableOnly) {
|
24322 | var keys = Object.keys(object);
|
24323 |
|
24324 | if (Object.getOwnPropertySymbols) {
|
24325 | keys.push.apply(keys, Object.getOwnPropertySymbols(object));
|
24326 | }
|
24327 |
|
24328 | if (enumerableOnly) keys = keys.filter(function (sym) {
|
24329 | return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
24330 | });
|
24331 | return keys;
|
24332 | }
|
24333 |
|
24334 | function _objectSpread2(target) {
|
24335 | for (var i = 1; i < arguments.length; i++) {
|
24336 | var source = arguments[i] != null ? arguments[i] : {};
|
24337 |
|
24338 | if (i % 2) {
|
24339 | ownKeys(source, true).forEach(function (key) {
|
24340 | _defineProperty(target, key, source[key]);
|
24341 | });
|
24342 | } else if (Object.getOwnPropertyDescriptors) {
|
24343 | Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
24344 | } else {
|
24345 | ownKeys(source).forEach(function (key) {
|
24346 | Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
24347 | });
|
24348 | }
|
24349 | }
|
24350 |
|
24351 | return target;
|
24352 | }
|
24353 |
|
24354 | |
24355 |
|
24356 |
|
24357 |
|
24358 |
|
24359 |
|
24360 |
|
24361 |
|
24362 |
|
24363 |
|
24364 | function compose() {
|
24365 | for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
24366 | funcs[_key] = arguments[_key];
|
24367 | }
|
24368 |
|
24369 | if (funcs.length === 0) {
|
24370 | return function (arg) {
|
24371 | return arg;
|
24372 | };
|
24373 | }
|
24374 |
|
24375 | if (funcs.length === 1) {
|
24376 | return funcs[0];
|
24377 | }
|
24378 |
|
24379 | return funcs.reduce(function (a, b) {
|
24380 | return function () {
|
24381 | return a(b.apply(void 0, arguments));
|
24382 | };
|
24383 | });
|
24384 | }
|
24385 |
|
24386 | |
24387 |
|
24388 |
|
24389 |
|
24390 |
|
24391 |
|
24392 |
|
24393 |
|
24394 |
|
24395 |
|
24396 |
|
24397 |
|
24398 |
|
24399 |
|
24400 |
|
24401 |
|
24402 |
|
24403 | function applyMiddleware() {
|
24404 | for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
|
24405 | middlewares[_key] = arguments[_key];
|
24406 | }
|
24407 |
|
24408 | return function (createStore) {
|
24409 | return function () {
|
24410 | var store = createStore.apply(void 0, arguments);
|
24411 |
|
24412 | var _dispatch = function dispatch() {
|
24413 | throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
|
24414 | };
|
24415 |
|
24416 | var middlewareAPI = {
|
24417 | getState: store.getState,
|
24418 | dispatch: function dispatch() {
|
24419 | return _dispatch.apply(void 0, arguments);
|
24420 | }
|
24421 | };
|
24422 | var chain = middlewares.map(function (middleware) {
|
24423 | return middleware(middlewareAPI);
|
24424 | });
|
24425 | _dispatch = compose.apply(void 0, chain)(store.dispatch);
|
24426 | return _objectSpread2({}, store, {
|
24427 | dispatch: _dispatch
|
24428 | });
|
24429 | };
|
24430 | };
|
24431 | }
|
24432 |
|
24433 | |
24434 |
|
24435 |
|
24436 |
|
24437 |
|
24438 | function isCrushed() {}
|
24439 |
|
24440 | if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
|
24441 | warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');
|
24442 | }
|
24443 |
|
24444 | exports.__DO_NOT_USE__ActionTypes = ActionTypes;
|
24445 | exports.applyMiddleware = applyMiddleware;
|
24446 | exports.bindActionCreators = bindActionCreators;
|
24447 | exports.combineReducers = combineReducers;
|
24448 | exports.compose = compose;
|
24449 | exports.createStore = createStore;
|
24450 |
|
24451 | }.call(exports, __webpack_require__(33)))
|
24452 |
|
24453 | }),
|
24454 |
|
24455 | (function(module, exports, __webpack_require__) {
|
24456 |
|
24457 | (function(global, module) {'use strict';
|
24458 |
|
24459 | Object.defineProperty(exports, "__esModule", {
|
24460 | value: true
|
24461 | });
|
24462 |
|
24463 | var _ponyfill = __webpack_require__(209);
|
24464 |
|
24465 | var _ponyfill2 = _interopRequireDefault(_ponyfill);
|
24466 |
|
24467 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24468 |
|
24469 | var root;
|
24470 |
|
24471 |
|
24472 | if (typeof self !== 'undefined') {
|
24473 | root = self;
|
24474 | } else if (typeof window !== 'undefined') {
|
24475 | root = window;
|
24476 | } else if (typeof global !== 'undefined') {
|
24477 | root = global;
|
24478 | } else if (true) {
|
24479 | root = module;
|
24480 | } else {
|
24481 | root = Function('return this')();
|
24482 | }
|
24483 |
|
24484 | var result = (0, _ponyfill2['default'])(root);
|
24485 | exports['default'] = result;
|
24486 | }.call(exports, (function() { return this; }()), __webpack_require__(208)(module)))
|
24487 |
|
24488 | }),
|
24489 |
|
24490 | (function(module, exports) {
|
24491 |
|
24492 | module.exports = function(module) {
|
24493 | if(!module.webpackPolyfill) {
|
24494 | module.deprecate = function() {};
|
24495 | module.paths = [];
|
24496 |
|
24497 | module.children = [];
|
24498 | module.webpackPolyfill = 1;
|
24499 | }
|
24500 | return module;
|
24501 | }
|
24502 |
|
24503 |
|
24504 | }),
|
24505 |
|
24506 | (function(module, exports) {
|
24507 |
|
24508 | 'use strict';
|
24509 |
|
24510 | Object.defineProperty(exports, "__esModule", {
|
24511 | value: true
|
24512 | });
|
24513 | exports['default'] = symbolObservablePonyfill;
|
24514 | function symbolObservablePonyfill(root) {
|
24515 | var result;
|
24516 | var _Symbol = root.Symbol;
|
24517 |
|
24518 | if (typeof _Symbol === 'function') {
|
24519 | if (_Symbol.observable) {
|
24520 | result = _Symbol.observable;
|
24521 | } else {
|
24522 | result = _Symbol('observable');
|
24523 | _Symbol.observable = result;
|
24524 | }
|
24525 | } else {
|
24526 | result = '@@observable';
|
24527 | }
|
24528 |
|
24529 | return result;
|
24530 | };
|
24531 |
|
24532 | }),
|
24533 |
|
24534 | (function(module, exports) {
|
24535 |
|
24536 | 'use strict';
|
24537 |
|
24538 | var rafSchd = function rafSchd(fn) {
|
24539 | var lastArgs = [];
|
24540 | var frameId = null;
|
24541 |
|
24542 | var wrapperFn = function wrapperFn() {
|
24543 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
24544 | args[_key] = arguments[_key];
|
24545 | }
|
24546 |
|
24547 | lastArgs = args;
|
24548 |
|
24549 | if (frameId) {
|
24550 | return;
|
24551 | }
|
24552 |
|
24553 | frameId = requestAnimationFrame(function () {
|
24554 | frameId = null;
|
24555 | fn.apply(void 0, lastArgs);
|
24556 | });
|
24557 | };
|
24558 |
|
24559 | wrapperFn.cancel = function () {
|
24560 | if (!frameId) {
|
24561 | return;
|
24562 | }
|
24563 |
|
24564 | cancelAnimationFrame(frameId);
|
24565 | frameId = null;
|
24566 | };
|
24567 |
|
24568 | return wrapperFn;
|
24569 | };
|
24570 |
|
24571 | module.exports = rafSchd;
|
24572 |
|
24573 |
|
24574 | }),
|
24575 |
|
24576 | (function(module, exports, __webpack_require__) {
|
24577 |
|
24578 | var _Object$create = __webpack_require__(212);
|
24579 |
|
24580 | function _inheritsLoose(subClass, superClass) {
|
24581 | subClass.prototype = _Object$create(superClass.prototype);
|
24582 | subClass.prototype.constructor = subClass;
|
24583 | subClass.__proto__ = superClass;
|
24584 | }
|
24585 |
|
24586 | module.exports = _inheritsLoose;
|
24587 |
|
24588 | }),
|
24589 |
|
24590 | (function(module, exports, __webpack_require__) {
|
24591 |
|
24592 | module.exports = __webpack_require__(213);
|
24593 |
|
24594 | }),
|
24595 |
|
24596 | (function(module, exports, __webpack_require__) {
|
24597 |
|
24598 | __webpack_require__(214);
|
24599 | var $Object = __webpack_require__(166).Object;
|
24600 | module.exports = function create(P, D) {
|
24601 | return $Object.create(P, D);
|
24602 | };
|
24603 |
|
24604 |
|
24605 | }),
|
24606 |
|
24607 | (function(module, exports, __webpack_require__) {
|
24608 |
|
24609 | var $export = __webpack_require__(164);
|
24610 |
|
24611 | $export($export.S, 'Object', { create: __webpack_require__(215) });
|
24612 |
|
24613 |
|
24614 | }),
|
24615 |
|
24616 | (function(module, exports, __webpack_require__) {
|
24617 |
|
24618 |
|
24619 | var anObject = __webpack_require__(171);
|
24620 | var dPs = __webpack_require__(216);
|
24621 | var enumBugKeys = __webpack_require__(195);
|
24622 | var IE_PROTO = __webpack_require__(191)('IE_PROTO');
|
24623 | var Empty = function () { };
|
24624 | var PROTOTYPE = 'prototype';
|
24625 |
|
24626 |
|
24627 | var createDict = function () {
|
24628 |
|
24629 | var iframe = __webpack_require__(176)('iframe');
|
24630 | var i = enumBugKeys.length;
|
24631 | var lt = '<';
|
24632 | var gt = '>';
|
24633 | var iframeDocument;
|
24634 | iframe.style.display = 'none';
|
24635 | __webpack_require__(217).appendChild(iframe);
|
24636 | iframe.src = 'javascript:';
|
24637 |
|
24638 |
|
24639 | iframeDocument = iframe.contentWindow.document;
|
24640 | iframeDocument.open();
|
24641 | iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
|
24642 | iframeDocument.close();
|
24643 | createDict = iframeDocument.F;
|
24644 | while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
|
24645 | return createDict();
|
24646 | };
|
24647 |
|
24648 | module.exports = Object.create || function create(O, Properties) {
|
24649 | var result;
|
24650 | if (O !== null) {
|
24651 | Empty[PROTOTYPE] = anObject(O);
|
24652 | result = new Empty();
|
24653 | Empty[PROTOTYPE] = null;
|
24654 |
|
24655 | result[IE_PROTO] = O;
|
24656 | } else result = createDict();
|
24657 | return Properties === undefined ? result : dPs(result, Properties);
|
24658 | };
|
24659 |
|
24660 |
|
24661 | }),
|
24662 |
|
24663 | (function(module, exports, __webpack_require__) {
|
24664 |
|
24665 | var dP = __webpack_require__(170);
|
24666 | var anObject = __webpack_require__(171);
|
24667 | var getKeys = __webpack_require__(181);
|
24668 |
|
24669 | module.exports = __webpack_require__(174) ? Object.defineProperties : function defineProperties(O, Properties) {
|
24670 | anObject(O);
|
24671 | var keys = getKeys(Properties);
|
24672 | var length = keys.length;
|
24673 | var i = 0;
|
24674 | var P;
|
24675 | while (length > i) dP.f(O, P = keys[i++], Properties[P]);
|
24676 | return O;
|
24677 | };
|
24678 |
|
24679 |
|
24680 | }),
|
24681 |
|
24682 | (function(module, exports, __webpack_require__) {
|
24683 |
|
24684 | var document = __webpack_require__(165).document;
|
24685 | module.exports = document && document.documentElement;
|
24686 |
|
24687 |
|
24688 | }),
|
24689 |
|
24690 | (function(module, exports, __webpack_require__) {
|
24691 |
|
24692 | "use strict";
|
24693 |
|
24694 | var _interopRequireDefault = __webpack_require__(14);
|
24695 |
|
24696 | var _interopRequireWildcard = __webpack_require__(219);
|
24697 |
|
24698 | exports.__esModule = true;
|
24699 |
|
24700 | var _Provider = _interopRequireWildcard(__webpack_require__(220));
|
24701 |
|
24702 | exports.Provider = _Provider.default;
|
24703 | exports.createProvider = _Provider.createProvider;
|
24704 |
|
24705 | var _connectAdvanced = _interopRequireDefault(__webpack_require__(224));
|
24706 |
|
24707 | exports.connectAdvanced = _connectAdvanced.default;
|
24708 |
|
24709 | var _connect = _interopRequireDefault(__webpack_require__(233));
|
24710 |
|
24711 | exports.connect = _connect.default;
|
24712 |
|
24713 | }),
|
24714 |
|
24715 | (function(module, exports) {
|
24716 |
|
24717 | function _interopRequireWildcard(obj) {
|
24718 | if (obj && obj.__esModule) {
|
24719 | return obj;
|
24720 | } else {
|
24721 | var newObj = {};
|
24722 |
|
24723 | if (obj != null) {
|
24724 | for (var key in obj) {
|
24725 | if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
24726 | var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
24727 |
|
24728 | if (desc.get || desc.set) {
|
24729 | Object.defineProperty(newObj, key, desc);
|
24730 | } else {
|
24731 | newObj[key] = obj[key];
|
24732 | }
|
24733 | }
|
24734 | }
|
24735 | }
|
24736 |
|
24737 | newObj.default = obj;
|
24738 | return newObj;
|
24739 | }
|
24740 | }
|
24741 |
|
24742 | module.exports = _interopRequireWildcard;
|
24743 |
|
24744 | }),
|
24745 |
|
24746 | (function(module, exports, __webpack_require__) {
|
24747 |
|
24748 | (function(process) {"use strict";
|
24749 |
|
24750 | var _interopRequireDefault = __webpack_require__(14);
|
24751 |
|
24752 | exports.__esModule = true;
|
24753 | exports.createProvider = createProvider;
|
24754 | exports.default = void 0;
|
24755 |
|
24756 | var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(221));
|
24757 |
|
24758 | var _react = __webpack_require__(1);
|
24759 |
|
24760 | var _propTypes = _interopRequireDefault(__webpack_require__(6));
|
24761 |
|
24762 | var _PropTypes = __webpack_require__(222);
|
24763 |
|
24764 | var _warning = _interopRequireDefault(__webpack_require__(223));
|
24765 |
|
24766 | var didWarnAboutReceivingStore = false;
|
24767 |
|
24768 | function warnAboutReceivingStore() {
|
24769 | if (didWarnAboutReceivingStore) {
|
24770 | return;
|
24771 | }
|
24772 |
|
24773 | didWarnAboutReceivingStore = true;
|
24774 | (0, _warning.default)('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reduxjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
|
24775 | }
|
24776 |
|
24777 | function createProvider(storeKey) {
|
24778 | var _Provider$childContex;
|
24779 |
|
24780 | if (storeKey === void 0) {
|
24781 | storeKey = 'store';
|
24782 | }
|
24783 |
|
24784 | var subscriptionKey = storeKey + "Subscription";
|
24785 |
|
24786 | var Provider =
|
24787 |
|
24788 | function (_Component) {
|
24789 | (0, _inheritsLoose2.default)(Provider, _Component);
|
24790 | var _proto = Provider.prototype;
|
24791 |
|
24792 | _proto.getChildContext = function getChildContext() {
|
24793 | var _ref;
|
24794 |
|
24795 | return _ref = {}, _ref[storeKey] = this[storeKey], _ref[subscriptionKey] = null, _ref;
|
24796 | };
|
24797 |
|
24798 | function Provider(props, context) {
|
24799 | var _this;
|
24800 |
|
24801 | _this = _Component.call(this, props, context) || this;
|
24802 | _this[storeKey] = props.store;
|
24803 | return _this;
|
24804 | }
|
24805 |
|
24806 | _proto.render = function render() {
|
24807 | return _react.Children.only(this.props.children);
|
24808 | };
|
24809 |
|
24810 | return Provider;
|
24811 | }(_react.Component);
|
24812 |
|
24813 | if (process.env.NODE_ENV !== 'production') {
|
24814 | Provider.prototype.componentWillReceiveProps = function (nextProps) {
|
24815 | if (this[storeKey] !== nextProps.store) {
|
24816 | warnAboutReceivingStore();
|
24817 | }
|
24818 | };
|
24819 | }
|
24820 |
|
24821 | Provider.propTypes = {
|
24822 | store: _PropTypes.storeShape.isRequired,
|
24823 | children: _propTypes.default.element.isRequired
|
24824 | };
|
24825 | Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[storeKey] = _PropTypes.storeShape.isRequired, _Provider$childContex[subscriptionKey] = _PropTypes.subscriptionShape, _Provider$childContex);
|
24826 | return Provider;
|
24827 | }
|
24828 |
|
24829 | var _default = createProvider();
|
24830 |
|
24831 | exports.default = _default;
|
24832 | }.call(exports, __webpack_require__(33)))
|
24833 |
|
24834 | }),
|
24835 |
|
24836 | (function(module, exports) {
|
24837 |
|
24838 | function _inheritsLoose(subClass, superClass) {
|
24839 | subClass.prototype = Object.create(superClass.prototype);
|
24840 | subClass.prototype.constructor = subClass;
|
24841 | subClass.__proto__ = superClass;
|
24842 | }
|
24843 |
|
24844 | module.exports = _inheritsLoose;
|
24845 |
|
24846 | }),
|
24847 |
|
24848 | (function(module, exports, __webpack_require__) {
|
24849 |
|
24850 | "use strict";
|
24851 |
|
24852 | var _interopRequireDefault = __webpack_require__(14);
|
24853 |
|
24854 | exports.__esModule = true;
|
24855 | exports.storeShape = exports.subscriptionShape = void 0;
|
24856 |
|
24857 | var _propTypes = _interopRequireDefault(__webpack_require__(6));
|
24858 |
|
24859 | var subscriptionShape = _propTypes.default.shape({
|
24860 | trySubscribe: _propTypes.default.func.isRequired,
|
24861 | tryUnsubscribe: _propTypes.default.func.isRequired,
|
24862 | notifyNestedSubs: _propTypes.default.func.isRequired,
|
24863 | isSubscribed: _propTypes.default.func.isRequired
|
24864 | });
|
24865 |
|
24866 | exports.subscriptionShape = subscriptionShape;
|
24867 |
|
24868 | var storeShape = _propTypes.default.shape({
|
24869 | subscribe: _propTypes.default.func.isRequired,
|
24870 | dispatch: _propTypes.default.func.isRequired,
|
24871 | getState: _propTypes.default.func.isRequired
|
24872 | });
|
24873 |
|
24874 | exports.storeShape = storeShape;
|
24875 |
|
24876 | }),
|
24877 |
|
24878 | (function(module, exports) {
|
24879 |
|
24880 | "use strict";
|
24881 |
|
24882 | exports.__esModule = true;
|
24883 | exports.default = warning;
|
24884 |
|
24885 | |
24886 |
|
24887 |
|
24888 |
|
24889 |
|
24890 |
|
24891 | function warning(message) {
|
24892 |
|
24893 | if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
24894 | console.error(message);
|
24895 | }
|
24896 |
|
24897 |
|
24898 |
|
24899 | try {
|
24900 |
|
24901 |
|
24902 |
|
24903 | throw new Error(message);
|
24904 |
|
24905 | } catch (e) {}
|
24906 |
|
24907 |
|
24908 | }
|
24909 |
|
24910 | }),
|
24911 |
|
24912 | (function(module, exports, __webpack_require__) {
|
24913 |
|
24914 | (function(process) {"use strict";
|
24915 |
|
24916 | var _interopRequireDefault = __webpack_require__(14);
|
24917 |
|
24918 | exports.__esModule = true;
|
24919 | exports.default = connectAdvanced;
|
24920 |
|
24921 | var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(221));
|
24922 |
|
24923 | var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(225));
|
24924 |
|
24925 | var _extends2 = _interopRequireDefault(__webpack_require__(120));
|
24926 |
|
24927 | var _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(226));
|
24928 |
|
24929 | var _hoistNonReactStatics = _interopRequireDefault(__webpack_require__(227));
|
24930 |
|
24931 | var _invariant = _interopRequireDefault(__webpack_require__(231));
|
24932 |
|
24933 | var _react = __webpack_require__(1);
|
24934 |
|
24935 | var _reactIs = __webpack_require__(228);
|
24936 |
|
24937 | var _Subscription = _interopRequireDefault(__webpack_require__(232));
|
24938 |
|
24939 | var _PropTypes = __webpack_require__(222);
|
24940 |
|
24941 | var hotReloadingVersion = 0;
|
24942 | var dummyState = {};
|
24943 |
|
24944 | function noop() {}
|
24945 |
|
24946 | function makeSelectorStateful(sourceSelector, store) {
|
24947 |
|
24948 | var selector = {
|
24949 | run: function runComponentSelector(props) {
|
24950 | try {
|
24951 | var nextProps = sourceSelector(store.getState(), props);
|
24952 |
|
24953 | if (nextProps !== selector.props || selector.error) {
|
24954 | selector.shouldComponentUpdate = true;
|
24955 | selector.props = nextProps;
|
24956 | selector.error = null;
|
24957 | }
|
24958 | } catch (error) {
|
24959 | selector.shouldComponentUpdate = true;
|
24960 | selector.error = error;
|
24961 | }
|
24962 | }
|
24963 | };
|
24964 | return selector;
|
24965 | }
|
24966 |
|
24967 | function connectAdvanced(
|
24968 | /*
|
24969 | selectorFactory is a func that is responsible for returning the selector function used to
|
24970 | compute new props from state, props, and dispatch. For example:
|
24971 | export default connectAdvanced((dispatch, options) => (state, props) => ({
|
24972 | thing: state.things[props.thingId],
|
24973 | saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)),
|
24974 | }))(YourComponent)
|
24975 | Access to dispatch is provided to the factory so selectorFactories can bind actionCreators
|
24976 | outside of their selector as an optimization. Options passed to connectAdvanced are passed to
|
24977 | the selectorFactory, along with displayName and WrappedComponent, as the second argument.
|
24978 | Note that selectorFactory is responsible for all caching/memoization of inbound and outbound
|
24979 | props. Do not use connectAdvanced directly without memoizing results between calls to your
|
24980 | selector, otherwise the Connect component will re-render on every state or props change.
|
24981 | */
|
24982 | selectorFactory, // options object:
|
24983 | _ref) {
|
24984 | var _contextTypes, _childContextTypes;
|
24985 |
|
24986 | if (_ref === void 0) {
|
24987 | _ref = {};
|
24988 | }
|
24989 |
|
24990 | var _ref2 = _ref,
|
24991 | _ref2$getDisplayName = _ref2.getDisplayName,
|
24992 | getDisplayName = _ref2$getDisplayName === void 0 ? function (name) {
|
24993 | return "ConnectAdvanced(" + name + ")";
|
24994 | } : _ref2$getDisplayName,
|
24995 | _ref2$methodName = _ref2.methodName,
|
24996 | methodName = _ref2$methodName === void 0 ? 'connectAdvanced' : _ref2$methodName,
|
24997 | _ref2$renderCountProp = _ref2.renderCountProp,
|
24998 | renderCountProp = _ref2$renderCountProp === void 0 ? undefined : _ref2$renderCountProp,
|
24999 | _ref2$shouldHandleSta = _ref2.shouldHandleStateChanges,
|
25000 | shouldHandleStateChanges = _ref2$shouldHandleSta === void 0 ? true : _ref2$shouldHandleSta,
|
25001 | _ref2$storeKey = _ref2.storeKey,
|
25002 | storeKey = _ref2$storeKey === void 0 ? 'store' : _ref2$storeKey,
|
25003 | _ref2$withRef = _ref2.withRef,
|
25004 | withRef = _ref2$withRef === void 0 ? false : _ref2$withRef,
|
25005 | connectOptions = (0, _objectWithoutPropertiesLoose2.default)(_ref2, ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef"]);
|
25006 | var subscriptionKey = storeKey + 'Subscription';
|
25007 | var version = hotReloadingVersion++;
|
25008 | var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = _PropTypes.storeShape, _contextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _contextTypes);
|
25009 | var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _childContextTypes);
|
25010 | return function wrapWithConnect(WrappedComponent) {
|
25011 | (0, _invariant.default)((0, _reactIs.isValidElementType)(WrappedComponent), "You must pass a component to the function returned by " + (methodName + ". Instead received " + JSON.stringify(WrappedComponent)));
|
25012 | var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
25013 | var displayName = getDisplayName(wrappedComponentName);
|
25014 | var selectorFactoryOptions = (0, _extends2.default)({}, connectOptions, {
|
25015 | getDisplayName: getDisplayName,
|
25016 | methodName: methodName,
|
25017 | renderCountProp: renderCountProp,
|
25018 | shouldHandleStateChanges: shouldHandleStateChanges,
|
25019 | storeKey: storeKey,
|
25020 | withRef: withRef,
|
25021 | displayName: displayName,
|
25022 | wrappedComponentName: wrappedComponentName,
|
25023 | WrappedComponent: WrappedComponent
|
25024 |
|
25025 |
|
25026 |
|
25027 | });
|
25028 |
|
25029 | var Connect =
|
25030 |
|
25031 | function (_Component) {
|
25032 | (0, _inheritsLoose2.default)(Connect, _Component);
|
25033 |
|
25034 | function Connect(props, context) {
|
25035 | var _this;
|
25036 |
|
25037 | _this = _Component.call(this, props, context) || this;
|
25038 | _this.version = version;
|
25039 | _this.state = {};
|
25040 | _this.renderCount = 0;
|
25041 | _this.store = props[storeKey] || context[storeKey];
|
25042 | _this.propsMode = Boolean(props[storeKey]);
|
25043 | _this.setWrappedInstance = _this.setWrappedInstance.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
25044 | (0, _invariant.default)(_this.store, "Could not find \"" + storeKey + "\" in either the context or props of " + ("\"" + displayName + "\". Either wrap the root component in a <Provider>, ") + ("or explicitly pass \"" + storeKey + "\" as a prop to \"" + displayName + "\"."));
|
25045 |
|
25046 | _this.initSelector();
|
25047 |
|
25048 | _this.initSubscription();
|
25049 |
|
25050 | return _this;
|
25051 | }
|
25052 |
|
25053 | var _proto = Connect.prototype;
|
25054 |
|
25055 | _proto.getChildContext = function getChildContext() {
|
25056 | var _ref3;
|
25057 |
|
25058 |
|
25059 |
|
25060 |
|
25061 |
|
25062 | var subscription = this.propsMode ? null : this.subscription;
|
25063 | return _ref3 = {}, _ref3[subscriptionKey] = subscription || this.context[subscriptionKey], _ref3;
|
25064 | };
|
25065 |
|
25066 | _proto.componentDidMount = function componentDidMount() {
|
25067 | if (!shouldHandleStateChanges) return;
|
25068 |
|
25069 |
|
25070 |
|
25071 |
|
25072 |
|
25073 |
|
25074 | this.subscription.trySubscribe();
|
25075 | this.selector.run(this.props);
|
25076 | if (this.selector.shouldComponentUpdate) this.forceUpdate();
|
25077 | };
|
25078 |
|
25079 | _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
25080 | this.selector.run(nextProps);
|
25081 | };
|
25082 |
|
25083 | _proto.shouldComponentUpdate = function shouldComponentUpdate() {
|
25084 | return this.selector.shouldComponentUpdate;
|
25085 | };
|
25086 |
|
25087 | _proto.componentWillUnmount = function componentWillUnmount() {
|
25088 | if (this.subscription) this.subscription.tryUnsubscribe();
|
25089 | this.subscription = null;
|
25090 | this.notifyNestedSubs = noop;
|
25091 | this.store = null;
|
25092 | this.selector.run = noop;
|
25093 | this.selector.shouldComponentUpdate = false;
|
25094 | };
|
25095 |
|
25096 | _proto.getWrappedInstance = function getWrappedInstance() {
|
25097 | (0, _invariant.default)(withRef, "To access the wrapped instance, you need to specify " + ("{ withRef: true } in the options argument of the " + methodName + "() call."));
|
25098 | return this.wrappedInstance;
|
25099 | };
|
25100 |
|
25101 | _proto.setWrappedInstance = function setWrappedInstance(ref) {
|
25102 | this.wrappedInstance = ref;
|
25103 | };
|
25104 |
|
25105 | _proto.initSelector = function initSelector() {
|
25106 | var sourceSelector = selectorFactory(this.store.dispatch, selectorFactoryOptions);
|
25107 | this.selector = makeSelectorStateful(sourceSelector, this.store);
|
25108 | this.selector.run(this.props);
|
25109 | };
|
25110 |
|
25111 | _proto.initSubscription = function initSubscription() {
|
25112 | if (!shouldHandleStateChanges) return;
|
25113 |
|
25114 |
|
25115 | var parentSub = (this.propsMode ? this.props : this.context)[subscriptionKey];
|
25116 | this.subscription = new _Subscription.default(this.store, parentSub, this.onStateChange.bind(this));
|
25117 |
|
25118 |
|
25119 |
|
25120 |
|
25121 |
|
25122 |
|
25123 | this.notifyNestedSubs = this.subscription.notifyNestedSubs.bind(this.subscription);
|
25124 | };
|
25125 |
|
25126 | _proto.onStateChange = function onStateChange() {
|
25127 | this.selector.run(this.props);
|
25128 |
|
25129 | if (!this.selector.shouldComponentUpdate) {
|
25130 | this.notifyNestedSubs();
|
25131 | } else {
|
25132 | this.componentDidUpdate = this.notifyNestedSubsOnComponentDidUpdate;
|
25133 | this.setState(dummyState);
|
25134 | }
|
25135 | };
|
25136 |
|
25137 | _proto.notifyNestedSubsOnComponentDidUpdate = function notifyNestedSubsOnComponentDidUpdate() {
|
25138 |
|
25139 |
|
25140 |
|
25141 |
|
25142 |
|
25143 | this.componentDidUpdate = undefined;
|
25144 | this.notifyNestedSubs();
|
25145 | };
|
25146 |
|
25147 | _proto.isSubscribed = function isSubscribed() {
|
25148 | return Boolean(this.subscription) && this.subscription.isSubscribed();
|
25149 | };
|
25150 |
|
25151 | _proto.addExtraProps = function addExtraProps(props) {
|
25152 | if (!withRef && !renderCountProp && !(this.propsMode && this.subscription)) return props;
|
25153 |
|
25154 |
|
25155 |
|
25156 |
|
25157 | var withExtras = (0, _extends2.default)({}, props);
|
25158 | if (withRef) withExtras.ref = this.setWrappedInstance;
|
25159 | if (renderCountProp) withExtras[renderCountProp] = this.renderCount++;
|
25160 | if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription;
|
25161 | return withExtras;
|
25162 | };
|
25163 |
|
25164 | _proto.render = function render() {
|
25165 | var selector = this.selector;
|
25166 | selector.shouldComponentUpdate = false;
|
25167 |
|
25168 | if (selector.error) {
|
25169 | throw selector.error;
|
25170 | } else {
|
25171 | return (0, _react.createElement)(WrappedComponent, this.addExtraProps(selector.props));
|
25172 | }
|
25173 | };
|
25174 |
|
25175 | return Connect;
|
25176 | }(_react.Component);
|
25177 |
|
25178 |
|
25179 |
|
25180 | Connect.WrappedComponent = WrappedComponent;
|
25181 | Connect.displayName = displayName;
|
25182 | Connect.childContextTypes = childContextTypes;
|
25183 | Connect.contextTypes = contextTypes;
|
25184 | Connect.propTypes = contextTypes;
|
25185 |
|
25186 | if (process.env.NODE_ENV !== 'production') {
|
25187 | Connect.prototype.componentWillUpdate = function componentWillUpdate() {
|
25188 | var _this2 = this;
|
25189 |
|
25190 |
|
25191 | if (this.version !== version) {
|
25192 | this.version = version;
|
25193 | this.initSelector();
|
25194 |
|
25195 |
|
25196 |
|
25197 |
|
25198 |
|
25199 | var oldListeners = [];
|
25200 |
|
25201 | if (this.subscription) {
|
25202 | oldListeners = this.subscription.listeners.get();
|
25203 | this.subscription.tryUnsubscribe();
|
25204 | }
|
25205 |
|
25206 | this.initSubscription();
|
25207 |
|
25208 | if (shouldHandleStateChanges) {
|
25209 | this.subscription.trySubscribe();
|
25210 | oldListeners.forEach(function (listener) {
|
25211 | return _this2.subscription.listeners.subscribe(listener);
|
25212 | });
|
25213 | }
|
25214 | }
|
25215 | };
|
25216 | }
|
25217 |
|
25218 | return (0, _hoistNonReactStatics.default)(Connect, WrappedComponent);
|
25219 | };
|
25220 | }
|
25221 | }.call(exports, __webpack_require__(33)))
|
25222 |
|
25223 | }),
|
25224 |
|
25225 | (function(module, exports) {
|
25226 |
|
25227 | function _assertThisInitialized(self) {
|
25228 | if (self === void 0) {
|
25229 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
25230 | }
|
25231 |
|
25232 | return self;
|
25233 | }
|
25234 |
|
25235 | module.exports = _assertThisInitialized;
|
25236 |
|
25237 | }),
|
25238 |
|
25239 | (function(module, exports) {
|
25240 |
|
25241 | function _objectWithoutPropertiesLoose(source, excluded) {
|
25242 | if (source == null) return {};
|
25243 | var target = {};
|
25244 | var sourceKeys = Object.keys(source);
|
25245 | var key, i;
|
25246 |
|
25247 | for (i = 0; i < sourceKeys.length; i++) {
|
25248 | key = sourceKeys[i];
|
25249 | if (excluded.indexOf(key) >= 0) continue;
|
25250 | target[key] = source[key];
|
25251 | }
|
25252 |
|
25253 | return target;
|
25254 | }
|
25255 |
|
25256 | module.exports = _objectWithoutPropertiesLoose;
|
25257 |
|
25258 | }),
|
25259 |
|
25260 | (function(module, exports, __webpack_require__) {
|
25261 |
|
25262 | 'use strict';
|
25263 |
|
25264 | |
25265 |
|
25266 |
|
25267 |
|
25268 | var ReactIs = __webpack_require__(228);
|
25269 | var REACT_STATICS = {
|
25270 | childContextTypes: true,
|
25271 | contextType: true,
|
25272 | contextTypes: true,
|
25273 | defaultProps: true,
|
25274 | displayName: true,
|
25275 | getDefaultProps: true,
|
25276 | getDerivedStateFromError: true,
|
25277 | getDerivedStateFromProps: true,
|
25278 | mixins: true,
|
25279 | propTypes: true,
|
25280 | type: true
|
25281 | };
|
25282 |
|
25283 | var KNOWN_STATICS = {
|
25284 | name: true,
|
25285 | length: true,
|
25286 | prototype: true,
|
25287 | caller: true,
|
25288 | callee: true,
|
25289 | arguments: true,
|
25290 | arity: true
|
25291 | };
|
25292 |
|
25293 | var FORWARD_REF_STATICS = {
|
25294 | '$$typeof': true,
|
25295 | render: true,
|
25296 | defaultProps: true,
|
25297 | displayName: true,
|
25298 | propTypes: true
|
25299 | };
|
25300 |
|
25301 | var MEMO_STATICS = {
|
25302 | '$$typeof': true,
|
25303 | compare: true,
|
25304 | defaultProps: true,
|
25305 | displayName: true,
|
25306 | propTypes: true,
|
25307 | type: true
|
25308 | };
|
25309 |
|
25310 | var TYPE_STATICS = {};
|
25311 | TYPE_STATICS[ReactIs.ForwardRef] = FORWARD_REF_STATICS;
|
25312 |
|
25313 | function getStatics(component) {
|
25314 | if (ReactIs.isMemo(component)) {
|
25315 | return MEMO_STATICS;
|
25316 | }
|
25317 | return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
|
25318 | }
|
25319 |
|
25320 | var defineProperty = Object.defineProperty;
|
25321 | var getOwnPropertyNames = Object.getOwnPropertyNames;
|
25322 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
25323 | var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
25324 | var getPrototypeOf = Object.getPrototypeOf;
|
25325 | var objectPrototype = Object.prototype;
|
25326 |
|
25327 | function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
25328 | if (typeof sourceComponent !== 'string') {
|
25329 |
|
25330 |
|
25331 | if (objectPrototype) {
|
25332 | var inheritedComponent = getPrototypeOf(sourceComponent);
|
25333 | if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
25334 | hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
25335 | }
|
25336 | }
|
25337 |
|
25338 | var keys = getOwnPropertyNames(sourceComponent);
|
25339 |
|
25340 | if (getOwnPropertySymbols) {
|
25341 | keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
25342 | }
|
25343 |
|
25344 | var targetStatics = getStatics(targetComponent);
|
25345 | var sourceStatics = getStatics(sourceComponent);
|
25346 |
|
25347 | for (var i = 0; i < keys.length; ++i) {
|
25348 | var key = keys[i];
|
25349 | if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
25350 | var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
25351 | try {
|
25352 |
|
25353 | defineProperty(targetComponent, key, descriptor);
|
25354 | } catch (e) {}
|
25355 | }
|
25356 | }
|
25357 |
|
25358 | return targetComponent;
|
25359 | }
|
25360 |
|
25361 | return targetComponent;
|
25362 | }
|
25363 |
|
25364 | module.exports = hoistNonReactStatics;
|
25365 |
|
25366 |
|
25367 | }),
|
25368 |
|
25369 | (function(module, exports, __webpack_require__) {
|
25370 |
|
25371 | (function(process) {'use strict';
|
25372 |
|
25373 | if (process.env.NODE_ENV === 'production') {
|
25374 | module.exports = __webpack_require__(229);
|
25375 | } else {
|
25376 | module.exports = __webpack_require__(230);
|
25377 | }
|
25378 |
|
25379 | }.call(exports, __webpack_require__(33)))
|
25380 |
|
25381 | }),
|
25382 |
|
25383 | (function(module, exports) {
|
25384 |
|
25385 | |
25386 |
|
25387 |
|
25388 |
|
25389 |
|
25390 |
|
25391 |
|
25392 |
|
25393 |
|
25394 | 'use strict';Object.defineProperty(exports,"__esModule",{value:!0});
|
25395 | var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.suspense_list"):
|
25396 | 60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.fundamental"):60117,w=b?Symbol.for("react.responder"):60118;function x(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return u}}case t:case r:case d:return u}}}function y(a){return x(a)===m}exports.typeOf=x;exports.AsyncMode=l;
|
25397 | exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;
|
25398 | exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===v||a.$$typeof===w)};exports.isAsyncMode=function(a){return y(a)||x(a)===l};exports.isConcurrentMode=y;exports.isContextConsumer=function(a){return x(a)===k};exports.isContextProvider=function(a){return x(a)===h};
|
25399 | exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return x(a)===n};exports.isFragment=function(a){return x(a)===e};exports.isLazy=function(a){return x(a)===t};exports.isMemo=function(a){return x(a)===r};exports.isPortal=function(a){return x(a)===d};exports.isProfiler=function(a){return x(a)===g};exports.isStrictMode=function(a){return x(a)===f};exports.isSuspense=function(a){return x(a)===p};
|
25400 |
|
25401 |
|
25402 | }),
|
25403 |
|
25404 | (function(module, exports, __webpack_require__) {
|
25405 |
|
25406 | (function(process) { |
25407 |
|
25408 |
|
25409 |
|
25410 |
|
25411 |
|
25412 |
|
25413 |
|
25414 |
|
25415 | 'use strict';
|
25416 |
|
25417 |
|
25418 |
|
25419 | if (process.env.NODE_ENV !== "production") {
|
25420 | (function() {
|
25421 | 'use strict';
|
25422 |
|
25423 | Object.defineProperty(exports, '__esModule', { value: true });
|
25424 |
|
25425 |
|
25426 |
|
25427 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
25428 |
|
25429 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
25430 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
25431 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
25432 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
25433 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
25434 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
25435 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
25436 |
|
25437 |
|
25438 | var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
25439 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
25440 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
25441 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
25442 | var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
25443 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
25444 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
25445 | var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
25446 | var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
25447 |
|
25448 | function isValidElementType(type) {
|
25449 | return typeof type === 'string' || typeof type === 'function' ||
|
25450 |
|
25451 | type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE);
|
25452 | }
|
25453 |
|
25454 | |
25455 |
|
25456 |
|
25457 |
|
25458 |
|
25459 |
|
25460 |
|
25461 |
|
25462 |
|
25463 |
|
25464 |
|
25465 |
|
25466 |
|
25467 |
|
25468 | var lowPriorityWarning = function () {};
|
25469 |
|
25470 | {
|
25471 | var printWarning = function (format) {
|
25472 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
25473 | args[_key - 1] = arguments[_key];
|
25474 | }
|
25475 |
|
25476 | var argIndex = 0;
|
25477 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
25478 | return args[argIndex++];
|
25479 | });
|
25480 | if (typeof console !== 'undefined') {
|
25481 | console.warn(message);
|
25482 | }
|
25483 | try {
|
25484 |
|
25485 |
|
25486 |
|
25487 | throw new Error(message);
|
25488 | } catch (x) {}
|
25489 | };
|
25490 |
|
25491 | lowPriorityWarning = function (condition, format) {
|
25492 | if (format === undefined) {
|
25493 | throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
25494 | }
|
25495 | if (!condition) {
|
25496 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
25497 | args[_key2 - 2] = arguments[_key2];
|
25498 | }
|
25499 |
|
25500 | printWarning.apply(undefined, [format].concat(args));
|
25501 | }
|
25502 | };
|
25503 | }
|
25504 |
|
25505 | var lowPriorityWarning$1 = lowPriorityWarning;
|
25506 |
|
25507 | function typeOf(object) {
|
25508 | if (typeof object === 'object' && object !== null) {
|
25509 | var $$typeof = object.$$typeof;
|
25510 | switch ($$typeof) {
|
25511 | case REACT_ELEMENT_TYPE:
|
25512 | var type = object.type;
|
25513 |
|
25514 | switch (type) {
|
25515 | case REACT_ASYNC_MODE_TYPE:
|
25516 | case REACT_CONCURRENT_MODE_TYPE:
|
25517 | case REACT_FRAGMENT_TYPE:
|
25518 | case REACT_PROFILER_TYPE:
|
25519 | case REACT_STRICT_MODE_TYPE:
|
25520 | case REACT_SUSPENSE_TYPE:
|
25521 | return type;
|
25522 | default:
|
25523 | var $$typeofType = type && type.$$typeof;
|
25524 |
|
25525 | switch ($$typeofType) {
|
25526 | case REACT_CONTEXT_TYPE:
|
25527 | case REACT_FORWARD_REF_TYPE:
|
25528 | case REACT_PROVIDER_TYPE:
|
25529 | return $$typeofType;
|
25530 | default:
|
25531 | return $$typeof;
|
25532 | }
|
25533 | }
|
25534 | case REACT_LAZY_TYPE:
|
25535 | case REACT_MEMO_TYPE:
|
25536 | case REACT_PORTAL_TYPE:
|
25537 | return $$typeof;
|
25538 | }
|
25539 | }
|
25540 |
|
25541 | return undefined;
|
25542 | }
|
25543 |
|
25544 |
|
25545 | var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
25546 | var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
25547 | var ContextConsumer = REACT_CONTEXT_TYPE;
|
25548 | var ContextProvider = REACT_PROVIDER_TYPE;
|
25549 | var Element = REACT_ELEMENT_TYPE;
|
25550 | var ForwardRef = REACT_FORWARD_REF_TYPE;
|
25551 | var Fragment = REACT_FRAGMENT_TYPE;
|
25552 | var Lazy = REACT_LAZY_TYPE;
|
25553 | var Memo = REACT_MEMO_TYPE;
|
25554 | var Portal = REACT_PORTAL_TYPE;
|
25555 | var Profiler = REACT_PROFILER_TYPE;
|
25556 | var StrictMode = REACT_STRICT_MODE_TYPE;
|
25557 | var Suspense = REACT_SUSPENSE_TYPE;
|
25558 |
|
25559 | var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
25560 |
|
25561 |
|
25562 | function isAsyncMode(object) {
|
25563 | {
|
25564 | if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
25565 | hasWarnedAboutDeprecatedIsAsyncMode = true;
|
25566 | lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
25567 | }
|
25568 | }
|
25569 | return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
25570 | }
|
25571 | function isConcurrentMode(object) {
|
25572 | return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
25573 | }
|
25574 | function isContextConsumer(object) {
|
25575 | return typeOf(object) === REACT_CONTEXT_TYPE;
|
25576 | }
|
25577 | function isContextProvider(object) {
|
25578 | return typeOf(object) === REACT_PROVIDER_TYPE;
|
25579 | }
|
25580 | function isElement(object) {
|
25581 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
25582 | }
|
25583 | function isForwardRef(object) {
|
25584 | return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
25585 | }
|
25586 | function isFragment(object) {
|
25587 | return typeOf(object) === REACT_FRAGMENT_TYPE;
|
25588 | }
|
25589 | function isLazy(object) {
|
25590 | return typeOf(object) === REACT_LAZY_TYPE;
|
25591 | }
|
25592 | function isMemo(object) {
|
25593 | return typeOf(object) === REACT_MEMO_TYPE;
|
25594 | }
|
25595 | function isPortal(object) {
|
25596 | return typeOf(object) === REACT_PORTAL_TYPE;
|
25597 | }
|
25598 | function isProfiler(object) {
|
25599 | return typeOf(object) === REACT_PROFILER_TYPE;
|
25600 | }
|
25601 | function isStrictMode(object) {
|
25602 | return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
25603 | }
|
25604 | function isSuspense(object) {
|
25605 | return typeOf(object) === REACT_SUSPENSE_TYPE;
|
25606 | }
|
25607 |
|
25608 | exports.typeOf = typeOf;
|
25609 | exports.AsyncMode = AsyncMode;
|
25610 | exports.ConcurrentMode = ConcurrentMode;
|
25611 | exports.ContextConsumer = ContextConsumer;
|
25612 | exports.ContextProvider = ContextProvider;
|
25613 | exports.Element = Element;
|
25614 | exports.ForwardRef = ForwardRef;
|
25615 | exports.Fragment = Fragment;
|
25616 | exports.Lazy = Lazy;
|
25617 | exports.Memo = Memo;
|
25618 | exports.Portal = Portal;
|
25619 | exports.Profiler = Profiler;
|
25620 | exports.StrictMode = StrictMode;
|
25621 | exports.Suspense = Suspense;
|
25622 | exports.isValidElementType = isValidElementType;
|
25623 | exports.isAsyncMode = isAsyncMode;
|
25624 | exports.isConcurrentMode = isConcurrentMode;
|
25625 | exports.isContextConsumer = isContextConsumer;
|
25626 | exports.isContextProvider = isContextProvider;
|
25627 | exports.isElement = isElement;
|
25628 | exports.isForwardRef = isForwardRef;
|
25629 | exports.isFragment = isFragment;
|
25630 | exports.isLazy = isLazy;
|
25631 | exports.isMemo = isMemo;
|
25632 | exports.isPortal = isPortal;
|
25633 | exports.isProfiler = isProfiler;
|
25634 | exports.isStrictMode = isStrictMode;
|
25635 | exports.isSuspense = isSuspense;
|
25636 | })();
|
25637 | }
|
25638 |
|
25639 | }.call(exports, __webpack_require__(33)))
|
25640 |
|
25641 | }),
|
25642 |
|
25643 | (function(module, exports, __webpack_require__) {
|
25644 |
|
25645 | (function(process) { |
25646 |
|
25647 |
|
25648 |
|
25649 |
|
25650 |
|
25651 |
|
25652 | 'use strict';
|
25653 |
|
25654 | |
25655 |
|
25656 |
|
25657 |
|
25658 |
|
25659 |
|
25660 |
|
25661 |
|
25662 |
|
25663 |
|
25664 |
|
25665 | var invariant = function(condition, format, a, b, c, d, e, f) {
|
25666 | if (process.env.NODE_ENV !== 'production') {
|
25667 | if (format === undefined) {
|
25668 | throw new Error('invariant requires an error message argument');
|
25669 | }
|
25670 | }
|
25671 |
|
25672 | if (!condition) {
|
25673 | var error;
|
25674 | if (format === undefined) {
|
25675 | error = new Error(
|
25676 | 'Minified exception occurred; use the non-minified dev environment ' +
|
25677 | 'for the full error message and additional helpful warnings.'
|
25678 | );
|
25679 | } else {
|
25680 | var args = [a, b, c, d, e, f];
|
25681 | var argIndex = 0;
|
25682 | error = new Error(
|
25683 | format.replace(/%s/g, function() { return args[argIndex++]; })
|
25684 | );
|
25685 | error.name = 'Invariant Violation';
|
25686 | }
|
25687 |
|
25688 | error.framesToPop = 1;
|
25689 | throw error;
|
25690 | }
|
25691 | };
|
25692 |
|
25693 | module.exports = invariant;
|
25694 |
|
25695 | }.call(exports, __webpack_require__(33)))
|
25696 |
|
25697 | }),
|
25698 |
|
25699 | (function(module, exports) {
|
25700 |
|
25701 | "use strict";
|
25702 |
|
25703 | exports.__esModule = true;
|
25704 | exports.default = void 0;
|
25705 |
|
25706 |
|
25707 |
|
25708 | var CLEARED = null;
|
25709 | var nullListeners = {
|
25710 | notify: function notify() {}
|
25711 | };
|
25712 |
|
25713 | function createListenerCollection() {
|
25714 |
|
25715 |
|
25716 | var current = [];
|
25717 | var next = [];
|
25718 | return {
|
25719 | clear: function clear() {
|
25720 | next = CLEARED;
|
25721 | current = CLEARED;
|
25722 | },
|
25723 | notify: function notify() {
|
25724 | var listeners = current = next;
|
25725 |
|
25726 | for (var i = 0; i < listeners.length; i++) {
|
25727 | listeners[i]();
|
25728 | }
|
25729 | },
|
25730 | get: function get() {
|
25731 | return next;
|
25732 | },
|
25733 | subscribe: function subscribe(listener) {
|
25734 | var isSubscribed = true;
|
25735 | if (next === current) next = current.slice();
|
25736 | next.push(listener);
|
25737 | return function unsubscribe() {
|
25738 | if (!isSubscribed || current === CLEARED) return;
|
25739 | isSubscribed = false;
|
25740 | if (next === current) next = current.slice();
|
25741 | next.splice(next.indexOf(listener), 1);
|
25742 | };
|
25743 | }
|
25744 | };
|
25745 | }
|
25746 |
|
25747 | var Subscription =
|
25748 |
|
25749 | function () {
|
25750 | function Subscription(store, parentSub, onStateChange) {
|
25751 | this.store = store;
|
25752 | this.parentSub = parentSub;
|
25753 | this.onStateChange = onStateChange;
|
25754 | this.unsubscribe = null;
|
25755 | this.listeners = nullListeners;
|
25756 | }
|
25757 |
|
25758 | var _proto = Subscription.prototype;
|
25759 |
|
25760 | _proto.addNestedSub = function addNestedSub(listener) {
|
25761 | this.trySubscribe();
|
25762 | return this.listeners.subscribe(listener);
|
25763 | };
|
25764 |
|
25765 | _proto.notifyNestedSubs = function notifyNestedSubs() {
|
25766 | this.listeners.notify();
|
25767 | };
|
25768 |
|
25769 | _proto.isSubscribed = function isSubscribed() {
|
25770 | return Boolean(this.unsubscribe);
|
25771 | };
|
25772 |
|
25773 | _proto.trySubscribe = function trySubscribe() {
|
25774 | if (!this.unsubscribe) {
|
25775 | this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);
|
25776 | this.listeners = createListenerCollection();
|
25777 | }
|
25778 | };
|
25779 |
|
25780 | _proto.tryUnsubscribe = function tryUnsubscribe() {
|
25781 | if (this.unsubscribe) {
|
25782 | this.unsubscribe();
|
25783 | this.unsubscribe = null;
|
25784 | this.listeners.clear();
|
25785 | this.listeners = nullListeners;
|
25786 | }
|
25787 | };
|
25788 |
|
25789 | return Subscription;
|
25790 | }();
|
25791 |
|
25792 | exports.default = Subscription;
|
25793 |
|
25794 | }),
|
25795 |
|
25796 | (function(module, exports, __webpack_require__) {
|
25797 |
|
25798 | "use strict";
|
25799 |
|
25800 | var _interopRequireDefault = __webpack_require__(14);
|
25801 |
|
25802 | exports.__esModule = true;
|
25803 | exports.createConnect = createConnect;
|
25804 | exports.default = void 0;
|
25805 |
|
25806 | var _extends2 = _interopRequireDefault(__webpack_require__(120));
|
25807 |
|
25808 | var _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(226));
|
25809 |
|
25810 | var _connectAdvanced = _interopRequireDefault(__webpack_require__(224));
|
25811 |
|
25812 | var _shallowEqual = _interopRequireDefault(__webpack_require__(234));
|
25813 |
|
25814 | var _mapDispatchToProps = _interopRequireDefault(__webpack_require__(235));
|
25815 |
|
25816 | var _mapStateToProps = _interopRequireDefault(__webpack_require__(239));
|
25817 |
|
25818 | var _mergeProps = _interopRequireDefault(__webpack_require__(240));
|
25819 |
|
25820 | var _selectorFactory = _interopRequireDefault(__webpack_require__(241));
|
25821 |
|
25822 | |
25823 |
|
25824 |
|
25825 |
|
25826 |
|
25827 |
|
25828 |
|
25829 |
|
25830 |
|
25831 |
|
25832 |
|
25833 |
|
25834 |
|
25835 |
|
25836 |
|
25837 |
|
25838 | function match(arg, factories, name) {
|
25839 | for (var i = factories.length - 1; i >= 0; i--) {
|
25840 | var result = factories[i](arg);
|
25841 | if (result) return result;
|
25842 | }
|
25843 |
|
25844 | return function (dispatch, options) {
|
25845 | throw new Error("Invalid value of type " + typeof arg + " for " + name + " argument when connecting component " + options.wrappedComponentName + ".");
|
25846 | };
|
25847 | }
|
25848 |
|
25849 | function strictEqual(a, b) {
|
25850 | return a === b;
|
25851 | }
|
25852 |
|
25853 |
|
25854 |
|
25855 | function createConnect(_temp) {
|
25856 | var _ref = _temp === void 0 ? {} : _temp,
|
25857 | _ref$connectHOC = _ref.connectHOC,
|
25858 | connectHOC = _ref$connectHOC === void 0 ? _connectAdvanced.default : _ref$connectHOC,
|
25859 | _ref$mapStateToPropsF = _ref.mapStateToPropsFactories,
|
25860 | mapStateToPropsFactories = _ref$mapStateToPropsF === void 0 ? _mapStateToProps.default : _ref$mapStateToPropsF,
|
25861 | _ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories,
|
25862 | mapDispatchToPropsFactories = _ref$mapDispatchToPro === void 0 ? _mapDispatchToProps.default : _ref$mapDispatchToPro,
|
25863 | _ref$mergePropsFactor = _ref.mergePropsFactories,
|
25864 | mergePropsFactories = _ref$mergePropsFactor === void 0 ? _mergeProps.default : _ref$mergePropsFactor,
|
25865 | _ref$selectorFactory = _ref.selectorFactory,
|
25866 | selectorFactory = _ref$selectorFactory === void 0 ? _selectorFactory.default : _ref$selectorFactory;
|
25867 |
|
25868 | return function connect(mapStateToProps, mapDispatchToProps, mergeProps, _ref2) {
|
25869 | if (_ref2 === void 0) {
|
25870 | _ref2 = {};
|
25871 | }
|
25872 |
|
25873 | var _ref3 = _ref2,
|
25874 | _ref3$pure = _ref3.pure,
|
25875 | pure = _ref3$pure === void 0 ? true : _ref3$pure,
|
25876 | _ref3$areStatesEqual = _ref3.areStatesEqual,
|
25877 | areStatesEqual = _ref3$areStatesEqual === void 0 ? strictEqual : _ref3$areStatesEqual,
|
25878 | _ref3$areOwnPropsEqua = _ref3.areOwnPropsEqual,
|
25879 | areOwnPropsEqual = _ref3$areOwnPropsEqua === void 0 ? _shallowEqual.default : _ref3$areOwnPropsEqua,
|
25880 | _ref3$areStatePropsEq = _ref3.areStatePropsEqual,
|
25881 | areStatePropsEqual = _ref3$areStatePropsEq === void 0 ? _shallowEqual.default : _ref3$areStatePropsEq,
|
25882 | _ref3$areMergedPropsE = _ref3.areMergedPropsEqual,
|
25883 | areMergedPropsEqual = _ref3$areMergedPropsE === void 0 ? _shallowEqual.default : _ref3$areMergedPropsE,
|
25884 | extraOptions = (0, _objectWithoutPropertiesLoose2.default)(_ref3, ["pure", "areStatesEqual", "areOwnPropsEqual", "areStatePropsEqual", "areMergedPropsEqual"]);
|
25885 | var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps');
|
25886 | var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps');
|
25887 | var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps');
|
25888 | return connectHOC(selectorFactory, (0, _extends2.default)({
|
25889 |
|
25890 | methodName: 'connect',
|
25891 |
|
25892 | getDisplayName: function getDisplayName(name) {
|
25893 | return "Connect(" + name + ")";
|
25894 | },
|
25895 |
|
25896 | shouldHandleStateChanges: Boolean(mapStateToProps),
|
25897 |
|
25898 | initMapStateToProps: initMapStateToProps,
|
25899 | initMapDispatchToProps: initMapDispatchToProps,
|
25900 | initMergeProps: initMergeProps,
|
25901 | pure: pure,
|
25902 | areStatesEqual: areStatesEqual,
|
25903 | areOwnPropsEqual: areOwnPropsEqual,
|
25904 | areStatePropsEqual: areStatePropsEqual,
|
25905 | areMergedPropsEqual: areMergedPropsEqual
|
25906 | }, extraOptions));
|
25907 | };
|
25908 | }
|
25909 |
|
25910 | var _default = createConnect();
|
25911 |
|
25912 | exports.default = _default;
|
25913 |
|
25914 | }),
|
25915 |
|
25916 | (function(module, exports) {
|
25917 |
|
25918 | "use strict";
|
25919 |
|
25920 | exports.__esModule = true;
|
25921 | exports.default = shallowEqual;
|
25922 | var hasOwn = Object.prototype.hasOwnProperty;
|
25923 |
|
25924 | function is(x, y) {
|
25925 | if (x === y) {
|
25926 | return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
25927 | } else {
|
25928 | return x !== x && y !== y;
|
25929 | }
|
25930 | }
|
25931 |
|
25932 | function shallowEqual(objA, objB) {
|
25933 | if (is(objA, objB)) return true;
|
25934 |
|
25935 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
25936 | return false;
|
25937 | }
|
25938 |
|
25939 | var keysA = Object.keys(objA);
|
25940 | var keysB = Object.keys(objB);
|
25941 | if (keysA.length !== keysB.length) return false;
|
25942 |
|
25943 | for (var i = 0; i < keysA.length; i++) {
|
25944 | if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
|
25945 | return false;
|
25946 | }
|
25947 | }
|
25948 |
|
25949 | return true;
|
25950 | }
|
25951 |
|
25952 | }),
|
25953 |
|
25954 | (function(module, exports, __webpack_require__) {
|
25955 |
|
25956 | "use strict";
|
25957 |
|
25958 | exports.__esModule = true;
|
25959 | exports.whenMapDispatchToPropsIsFunction = whenMapDispatchToPropsIsFunction;
|
25960 | exports.whenMapDispatchToPropsIsMissing = whenMapDispatchToPropsIsMissing;
|
25961 | exports.whenMapDispatchToPropsIsObject = whenMapDispatchToPropsIsObject;
|
25962 | exports.default = void 0;
|
25963 |
|
25964 | var _redux = __webpack_require__(206);
|
25965 |
|
25966 | var _wrapMapToProps = __webpack_require__(236);
|
25967 |
|
25968 | function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {
|
25969 | return typeof mapDispatchToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapDispatchToProps, 'mapDispatchToProps') : undefined;
|
25970 | }
|
25971 |
|
25972 | function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {
|
25973 | return !mapDispatchToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) {
|
25974 | return {
|
25975 | dispatch: dispatch
|
25976 | };
|
25977 | }) : undefined;
|
25978 | }
|
25979 |
|
25980 | function whenMapDispatchToPropsIsObject(mapDispatchToProps) {
|
25981 | return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) {
|
25982 | return (0, _redux.bindActionCreators)(mapDispatchToProps, dispatch);
|
25983 | }) : undefined;
|
25984 | }
|
25985 |
|
25986 | var _default = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];
|
25987 | exports.default = _default;
|
25988 |
|
25989 | }),
|
25990 |
|
25991 | (function(module, exports, __webpack_require__) {
|
25992 |
|
25993 | (function(process) {"use strict";
|
25994 |
|
25995 | var _interopRequireDefault = __webpack_require__(14);
|
25996 |
|
25997 | exports.__esModule = true;
|
25998 | exports.wrapMapToPropsConstant = wrapMapToPropsConstant;
|
25999 | exports.getDependsOnOwnProps = getDependsOnOwnProps;
|
26000 | exports.wrapMapToPropsFunc = wrapMapToPropsFunc;
|
26001 |
|
26002 | var _verifyPlainObject = _interopRequireDefault(__webpack_require__(237));
|
26003 |
|
26004 | function wrapMapToPropsConstant(getConstant) {
|
26005 | return function initConstantSelector(dispatch, options) {
|
26006 | var constant = getConstant(dispatch, options);
|
26007 |
|
26008 | function constantSelector() {
|
26009 | return constant;
|
26010 | }
|
26011 |
|
26012 | constantSelector.dependsOnOwnProps = false;
|
26013 | return constantSelector;
|
26014 | };
|
26015 | }
|
26016 |
|
26017 |
|
26018 |
|
26019 |
|
26020 |
|
26021 |
|
26022 |
|
26023 |
|
26024 | function getDependsOnOwnProps(mapToProps) {
|
26025 | return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1;
|
26026 | }
|
26027 |
|
26028 |
|
26029 |
|
26030 |
|
26031 |
|
26032 |
|
26033 |
|
26034 |
|
26035 |
|
26036 |
|
26037 |
|
26038 |
|
26039 |
|
26040 | function wrapMapToPropsFunc(mapToProps, methodName) {
|
26041 | return function initProxySelector(dispatch, _ref) {
|
26042 | var displayName = _ref.displayName;
|
26043 |
|
26044 | var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) {
|
26045 | return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch);
|
26046 | };
|
26047 |
|
26048 |
|
26049 | proxy.dependsOnOwnProps = true;
|
26050 |
|
26051 | proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
|
26052 | proxy.mapToProps = mapToProps;
|
26053 | proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
|
26054 | var props = proxy(stateOrDispatch, ownProps);
|
26055 |
|
26056 | if (typeof props === 'function') {
|
26057 | proxy.mapToProps = props;
|
26058 | proxy.dependsOnOwnProps = getDependsOnOwnProps(props);
|
26059 | props = proxy(stateOrDispatch, ownProps);
|
26060 | }
|
26061 |
|
26062 | if (process.env.NODE_ENV !== 'production') (0, _verifyPlainObject.default)(props, displayName, methodName);
|
26063 | return props;
|
26064 | };
|
26065 |
|
26066 | return proxy;
|
26067 | };
|
26068 | }
|
26069 | }.call(exports, __webpack_require__(33)))
|
26070 |
|
26071 | }),
|
26072 |
|
26073 | (function(module, exports, __webpack_require__) {
|
26074 |
|
26075 | "use strict";
|
26076 |
|
26077 | var _interopRequireDefault = __webpack_require__(14);
|
26078 |
|
26079 | exports.__esModule = true;
|
26080 | exports.default = verifyPlainObject;
|
26081 |
|
26082 | var _isPlainObject = _interopRequireDefault(__webpack_require__(238));
|
26083 |
|
26084 | var _warning = _interopRequireDefault(__webpack_require__(223));
|
26085 |
|
26086 | function verifyPlainObject(value, displayName, methodName) {
|
26087 | if (!(0, _isPlainObject.default)(value)) {
|
26088 | (0, _warning.default)(methodName + "() in " + displayName + " must return a plain object. Instead received " + value + ".");
|
26089 | }
|
26090 | }
|
26091 |
|
26092 | }),
|
26093 |
|
26094 | (function(module, exports) {
|
26095 |
|
26096 | "use strict";
|
26097 |
|
26098 | exports.__esModule = true;
|
26099 | exports.default = isPlainObject;
|
26100 |
|
26101 | |
26102 |
|
26103 |
|
26104 |
|
26105 | function isPlainObject(obj) {
|
26106 | if (typeof obj !== 'object' || obj === null) return false;
|
26107 | var proto = Object.getPrototypeOf(obj);
|
26108 | if (proto === null) return true;
|
26109 | var baseProto = proto;
|
26110 |
|
26111 | while (Object.getPrototypeOf(baseProto) !== null) {
|
26112 | baseProto = Object.getPrototypeOf(baseProto);
|
26113 | }
|
26114 |
|
26115 | return proto === baseProto;
|
26116 | }
|
26117 |
|
26118 | }),
|
26119 |
|
26120 | (function(module, exports, __webpack_require__) {
|
26121 |
|
26122 | "use strict";
|
26123 |
|
26124 | exports.__esModule = true;
|
26125 | exports.whenMapStateToPropsIsFunction = whenMapStateToPropsIsFunction;
|
26126 | exports.whenMapStateToPropsIsMissing = whenMapStateToPropsIsMissing;
|
26127 | exports.default = void 0;
|
26128 |
|
26129 | var _wrapMapToProps = __webpack_require__(236);
|
26130 |
|
26131 | function whenMapStateToPropsIsFunction(mapStateToProps) {
|
26132 | return typeof mapStateToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapStateToProps, 'mapStateToProps') : undefined;
|
26133 | }
|
26134 |
|
26135 | function whenMapStateToPropsIsMissing(mapStateToProps) {
|
26136 | return !mapStateToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function () {
|
26137 | return {};
|
26138 | }) : undefined;
|
26139 | }
|
26140 |
|
26141 | var _default = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing];
|
26142 | exports.default = _default;
|
26143 |
|
26144 | }),
|
26145 |
|
26146 | (function(module, exports, __webpack_require__) {
|
26147 |
|
26148 | (function(process) {"use strict";
|
26149 |
|
26150 | var _interopRequireDefault = __webpack_require__(14);
|
26151 |
|
26152 | exports.__esModule = true;
|
26153 | exports.defaultMergeProps = defaultMergeProps;
|
26154 | exports.wrapMergePropsFunc = wrapMergePropsFunc;
|
26155 | exports.whenMergePropsIsFunction = whenMergePropsIsFunction;
|
26156 | exports.whenMergePropsIsOmitted = whenMergePropsIsOmitted;
|
26157 | exports.default = void 0;
|
26158 |
|
26159 | var _extends2 = _interopRequireDefault(__webpack_require__(120));
|
26160 |
|
26161 | var _verifyPlainObject = _interopRequireDefault(__webpack_require__(237));
|
26162 |
|
26163 | function defaultMergeProps(stateProps, dispatchProps, ownProps) {
|
26164 | return (0, _extends2.default)({}, ownProps, stateProps, dispatchProps);
|
26165 | }
|
26166 |
|
26167 | function wrapMergePropsFunc(mergeProps) {
|
26168 | return function initMergePropsProxy(dispatch, _ref) {
|
26169 | var displayName = _ref.displayName,
|
26170 | pure = _ref.pure,
|
26171 | areMergedPropsEqual = _ref.areMergedPropsEqual;
|
26172 | var hasRunOnce = false;
|
26173 | var mergedProps;
|
26174 | return function mergePropsProxy(stateProps, dispatchProps, ownProps) {
|
26175 | var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
26176 |
|
26177 | if (hasRunOnce) {
|
26178 | if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps;
|
26179 | } else {
|
26180 | hasRunOnce = true;
|
26181 | mergedProps = nextMergedProps;
|
26182 | if (process.env.NODE_ENV !== 'production') (0, _verifyPlainObject.default)(mergedProps, displayName, 'mergeProps');
|
26183 | }
|
26184 |
|
26185 | return mergedProps;
|
26186 | };
|
26187 | };
|
26188 | }
|
26189 |
|
26190 | function whenMergePropsIsFunction(mergeProps) {
|
26191 | return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined;
|
26192 | }
|
26193 |
|
26194 | function whenMergePropsIsOmitted(mergeProps) {
|
26195 | return !mergeProps ? function () {
|
26196 | return defaultMergeProps;
|
26197 | } : undefined;
|
26198 | }
|
26199 |
|
26200 | var _default = [whenMergePropsIsFunction, whenMergePropsIsOmitted];
|
26201 | exports.default = _default;
|
26202 | }.call(exports, __webpack_require__(33)))
|
26203 |
|
26204 | }),
|
26205 |
|
26206 | (function(module, exports, __webpack_require__) {
|
26207 |
|
26208 | (function(process) {"use strict";
|
26209 |
|
26210 | var _interopRequireDefault = __webpack_require__(14);
|
26211 |
|
26212 | exports.__esModule = true;
|
26213 | exports.impureFinalPropsSelectorFactory = impureFinalPropsSelectorFactory;
|
26214 | exports.pureFinalPropsSelectorFactory = pureFinalPropsSelectorFactory;
|
26215 | exports.default = finalPropsSelectorFactory;
|
26216 |
|
26217 | var _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(226));
|
26218 |
|
26219 | var _verifySubselectors = _interopRequireDefault(__webpack_require__(242));
|
26220 |
|
26221 | function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {
|
26222 | return function impureFinalPropsSelector(state, ownProps) {
|
26223 | return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps);
|
26224 | };
|
26225 | }
|
26226 |
|
26227 | function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) {
|
26228 | var areStatesEqual = _ref.areStatesEqual,
|
26229 | areOwnPropsEqual = _ref.areOwnPropsEqual,
|
26230 | areStatePropsEqual = _ref.areStatePropsEqual;
|
26231 | var hasRunAtLeastOnce = false;
|
26232 | var state;
|
26233 | var ownProps;
|
26234 | var stateProps;
|
26235 | var dispatchProps;
|
26236 | var mergedProps;
|
26237 |
|
26238 | function handleFirstCall(firstState, firstOwnProps) {
|
26239 | state = firstState;
|
26240 | ownProps = firstOwnProps;
|
26241 | stateProps = mapStateToProps(state, ownProps);
|
26242 | dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
26243 | mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
26244 | hasRunAtLeastOnce = true;
|
26245 | return mergedProps;
|
26246 | }
|
26247 |
|
26248 | function handleNewPropsAndNewState() {
|
26249 | stateProps = mapStateToProps(state, ownProps);
|
26250 | if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
26251 | mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
26252 | return mergedProps;
|
26253 | }
|
26254 |
|
26255 | function handleNewProps() {
|
26256 | if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps);
|
26257 | if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
26258 | mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
26259 | return mergedProps;
|
26260 | }
|
26261 |
|
26262 | function handleNewState() {
|
26263 | var nextStateProps = mapStateToProps(state, ownProps);
|
26264 | var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps);
|
26265 | stateProps = nextStateProps;
|
26266 | if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
26267 | return mergedProps;
|
26268 | }
|
26269 |
|
26270 | function handleSubsequentCalls(nextState, nextOwnProps) {
|
26271 | var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps);
|
26272 | var stateChanged = !areStatesEqual(nextState, state);
|
26273 | state = nextState;
|
26274 | ownProps = nextOwnProps;
|
26275 | if (propsChanged && stateChanged) return handleNewPropsAndNewState();
|
26276 | if (propsChanged) return handleNewProps();
|
26277 | if (stateChanged) return handleNewState();
|
26278 | return mergedProps;
|
26279 | }
|
26280 |
|
26281 | return function pureFinalPropsSelector(nextState, nextOwnProps) {
|
26282 | return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps);
|
26283 | };
|
26284 | }
|
26285 |
|
26286 |
|
26287 |
|
26288 |
|
26289 |
|
26290 |
|
26291 | function finalPropsSelectorFactory(dispatch, _ref2) {
|
26292 | var initMapStateToProps = _ref2.initMapStateToProps,
|
26293 | initMapDispatchToProps = _ref2.initMapDispatchToProps,
|
26294 | initMergeProps = _ref2.initMergeProps,
|
26295 | options = (0, _objectWithoutPropertiesLoose2.default)(_ref2, ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"]);
|
26296 | var mapStateToProps = initMapStateToProps(dispatch, options);
|
26297 | var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
|
26298 | var mergeProps = initMergeProps(dispatch, options);
|
26299 |
|
26300 | if (process.env.NODE_ENV !== 'production') {
|
26301 | (0, _verifySubselectors.default)(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName);
|
26302 | }
|
26303 |
|
26304 | var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory;
|
26305 | return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
|
26306 | }
|
26307 | }.call(exports, __webpack_require__(33)))
|
26308 |
|
26309 | }),
|
26310 |
|
26311 | (function(module, exports, __webpack_require__) {
|
26312 |
|
26313 | "use strict";
|
26314 |
|
26315 | var _interopRequireDefault = __webpack_require__(14);
|
26316 |
|
26317 | exports.__esModule = true;
|
26318 | exports.default = verifySubselectors;
|
26319 |
|
26320 | var _warning = _interopRequireDefault(__webpack_require__(223));
|
26321 |
|
26322 | function verify(selector, methodName, displayName) {
|
26323 | if (!selector) {
|
26324 | throw new Error("Unexpected value for " + methodName + " in " + displayName + ".");
|
26325 | } else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') {
|
26326 | if (!selector.hasOwnProperty('dependsOnOwnProps')) {
|
26327 | (0, _warning.default)("The selector for " + methodName + " of " + displayName + " did not specify a value for dependsOnOwnProps.");
|
26328 | }
|
26329 | }
|
26330 | }
|
26331 |
|
26332 | function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) {
|
26333 | verify(mapStateToProps, 'mapStateToProps', displayName);
|
26334 | verify(mapDispatchToProps, 'mapDispatchToProps', displayName);
|
26335 | verify(mergeProps, 'mergeProps', displayName);
|
26336 | }
|
26337 |
|
26338 | }),
|
26339 |
|
26340 | (function(module, exports, __webpack_require__) {
|
26341 |
|
26342 | 'use strict';
|
26343 |
|
26344 | exports.__esModule = true;
|
26345 |
|
26346 | function _interopRequire(obj) { return obj && obj.__esModule ? obj['default'] : obj; }
|
26347 |
|
26348 | var _Motion = __webpack_require__(244);
|
26349 |
|
26350 | exports.Motion = _interopRequire(_Motion);
|
26351 |
|
26352 | var _StaggeredMotion = __webpack_require__(251);
|
26353 |
|
26354 | exports.StaggeredMotion = _interopRequire(_StaggeredMotion);
|
26355 |
|
26356 | var _TransitionMotion = __webpack_require__(252);
|
26357 |
|
26358 | exports.TransitionMotion = _interopRequire(_TransitionMotion);
|
26359 |
|
26360 | var _spring = __webpack_require__(254);
|
26361 |
|
26362 | exports.spring = _interopRequire(_spring);
|
26363 |
|
26364 | var _presets = __webpack_require__(255);
|
26365 |
|
26366 | exports.presets = _interopRequire(_presets);
|
26367 |
|
26368 | var _stripStyle = __webpack_require__(246);
|
26369 |
|
26370 | exports.stripStyle = _interopRequire(_stripStyle);
|
26371 |
|
26372 |
|
26373 |
|
26374 | var _reorderKeys = __webpack_require__(256);
|
26375 |
|
26376 | exports.reorderKeys = _interopRequire(_reorderKeys);
|
26377 |
|
26378 | }),
|
26379 |
|
26380 | (function(module, exports, __webpack_require__) {
|
26381 |
|
26382 | 'use strict';
|
26383 |
|
26384 | exports.__esModule = true;
|
26385 |
|
26386 | 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; };
|
26387 |
|
26388 | var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
26389 |
|
26390 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
26391 |
|
26392 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
26393 |
|
26394 | 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; }
|
26395 |
|
26396 | var _mapToZero = __webpack_require__(245);
|
26397 |
|
26398 | var _mapToZero2 = _interopRequireDefault(_mapToZero);
|
26399 |
|
26400 | var _stripStyle = __webpack_require__(246);
|
26401 |
|
26402 | var _stripStyle2 = _interopRequireDefault(_stripStyle);
|
26403 |
|
26404 | var _stepper3 = __webpack_require__(247);
|
26405 |
|
26406 | var _stepper4 = _interopRequireDefault(_stepper3);
|
26407 |
|
26408 | var _performanceNow = __webpack_require__(248);
|
26409 |
|
26410 | var _performanceNow2 = _interopRequireDefault(_performanceNow);
|
26411 |
|
26412 | var _raf = __webpack_require__(249);
|
26413 |
|
26414 | var _raf2 = _interopRequireDefault(_raf);
|
26415 |
|
26416 | var _shouldStopAnimation = __webpack_require__(250);
|
26417 |
|
26418 | var _shouldStopAnimation2 = _interopRequireDefault(_shouldStopAnimation);
|
26419 |
|
26420 | var _react = __webpack_require__(1);
|
26421 |
|
26422 | var _react2 = _interopRequireDefault(_react);
|
26423 |
|
26424 | var _propTypes = __webpack_require__(6);
|
26425 |
|
26426 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
26427 |
|
26428 | var msPerFrame = 1000 / 60;
|
26429 |
|
26430 | var Motion = (function (_React$Component) {
|
26431 | _inherits(Motion, _React$Component);
|
26432 |
|
26433 | _createClass(Motion, null, [{
|
26434 | key: 'propTypes',
|
26435 | value: {
|
26436 |
|
26437 | defaultStyle: _propTypes2['default'].objectOf(_propTypes2['default'].number),
|
26438 | style: _propTypes2['default'].objectOf(_propTypes2['default'].oneOfType([_propTypes2['default'].number, _propTypes2['default'].object])).isRequired,
|
26439 | children: _propTypes2['default'].func.isRequired,
|
26440 | onRest: _propTypes2['default'].func
|
26441 | },
|
26442 | enumerable: true
|
26443 | }]);
|
26444 |
|
26445 | function Motion(props) {
|
26446 | var _this = this;
|
26447 |
|
26448 | _classCallCheck(this, Motion);
|
26449 |
|
26450 | _React$Component.call(this, props);
|
26451 | this.wasAnimating = false;
|
26452 | this.animationID = null;
|
26453 | this.prevTime = 0;
|
26454 | this.accumulatedTime = 0;
|
26455 | this.unreadPropStyle = null;
|
26456 |
|
26457 | this.clearUnreadPropStyle = function (destStyle) {
|
26458 | var dirty = false;
|
26459 | var _state = _this.state;
|
26460 | var currentStyle = _state.currentStyle;
|
26461 | var currentVelocity = _state.currentVelocity;
|
26462 | var lastIdealStyle = _state.lastIdealStyle;
|
26463 | var lastIdealVelocity = _state.lastIdealVelocity;
|
26464 |
|
26465 | for (var key in destStyle) {
|
26466 | if (!Object.prototype.hasOwnProperty.call(destStyle, key)) {
|
26467 | continue;
|
26468 | }
|
26469 |
|
26470 | var styleValue = destStyle[key];
|
26471 | if (typeof styleValue === 'number') {
|
26472 | if (!dirty) {
|
26473 | dirty = true;
|
26474 | currentStyle = _extends({}, currentStyle);
|
26475 | currentVelocity = _extends({}, currentVelocity);
|
26476 | lastIdealStyle = _extends({}, lastIdealStyle);
|
26477 | lastIdealVelocity = _extends({}, lastIdealVelocity);
|
26478 | }
|
26479 |
|
26480 | currentStyle[key] = styleValue;
|
26481 | currentVelocity[key] = 0;
|
26482 | lastIdealStyle[key] = styleValue;
|
26483 | lastIdealVelocity[key] = 0;
|
26484 | }
|
26485 | }
|
26486 |
|
26487 | if (dirty) {
|
26488 | _this.setState({ currentStyle: currentStyle, currentVelocity: currentVelocity, lastIdealStyle: lastIdealStyle, lastIdealVelocity: lastIdealVelocity });
|
26489 | }
|
26490 | };
|
26491 |
|
26492 | this.startAnimationIfNecessary = function () {
|
26493 |
|
26494 |
|
26495 | _this.animationID = _raf2['default'](function (timestamp) {
|
26496 |
|
26497 | var propsStyle = _this.props.style;
|
26498 | if (_shouldStopAnimation2['default'](_this.state.currentStyle, propsStyle, _this.state.currentVelocity)) {
|
26499 | if (_this.wasAnimating && _this.props.onRest) {
|
26500 | _this.props.onRest();
|
26501 | }
|
26502 |
|
26503 |
|
26504 | _this.animationID = null;
|
26505 | _this.wasAnimating = false;
|
26506 | _this.accumulatedTime = 0;
|
26507 | return;
|
26508 | }
|
26509 |
|
26510 | _this.wasAnimating = true;
|
26511 |
|
26512 | var currentTime = timestamp || _performanceNow2['default']();
|
26513 | var timeDelta = currentTime - _this.prevTime;
|
26514 | _this.prevTime = currentTime;
|
26515 | _this.accumulatedTime = _this.accumulatedTime + timeDelta;
|
26516 |
|
26517 | if (_this.accumulatedTime > msPerFrame * 10) {
|
26518 | _this.accumulatedTime = 0;
|
26519 | }
|
26520 |
|
26521 | if (_this.accumulatedTime === 0) {
|
26522 |
|
26523 | _this.animationID = null;
|
26524 | _this.startAnimationIfNecessary();
|
26525 | return;
|
26526 | }
|
26527 |
|
26528 | var currentFrameCompletion = (_this.accumulatedTime - Math.floor(_this.accumulatedTime / msPerFrame) * msPerFrame) / msPerFrame;
|
26529 | var framesToCatchUp = Math.floor(_this.accumulatedTime / msPerFrame);
|
26530 |
|
26531 | var newLastIdealStyle = {};
|
26532 | var newLastIdealVelocity = {};
|
26533 | var newCurrentStyle = {};
|
26534 | var newCurrentVelocity = {};
|
26535 |
|
26536 | for (var key in propsStyle) {
|
26537 | if (!Object.prototype.hasOwnProperty.call(propsStyle, key)) {
|
26538 | continue;
|
26539 | }
|
26540 |
|
26541 | var styleValue = propsStyle[key];
|
26542 | if (typeof styleValue === 'number') {
|
26543 | newCurrentStyle[key] = styleValue;
|
26544 | newCurrentVelocity[key] = 0;
|
26545 | newLastIdealStyle[key] = styleValue;
|
26546 | newLastIdealVelocity[key] = 0;
|
26547 | } else {
|
26548 | var newLastIdealStyleValue = _this.state.lastIdealStyle[key];
|
26549 | var newLastIdealVelocityValue = _this.state.lastIdealVelocity[key];
|
26550 | for (var i = 0; i < framesToCatchUp; i++) {
|
26551 | var _stepper = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
26552 |
|
26553 | newLastIdealStyleValue = _stepper[0];
|
26554 | newLastIdealVelocityValue = _stepper[1];
|
26555 | }
|
26556 |
|
26557 | var _stepper2 = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
26558 |
|
26559 | var nextIdealX = _stepper2[0];
|
26560 | var nextIdealV = _stepper2[1];
|
26561 |
|
26562 | newCurrentStyle[key] = newLastIdealStyleValue + (nextIdealX - newLastIdealStyleValue) * currentFrameCompletion;
|
26563 | newCurrentVelocity[key] = newLastIdealVelocityValue + (nextIdealV - newLastIdealVelocityValue) * currentFrameCompletion;
|
26564 | newLastIdealStyle[key] = newLastIdealStyleValue;
|
26565 | newLastIdealVelocity[key] = newLastIdealVelocityValue;
|
26566 | }
|
26567 | }
|
26568 |
|
26569 | _this.animationID = null;
|
26570 |
|
26571 | _this.accumulatedTime -= framesToCatchUp * msPerFrame;
|
26572 |
|
26573 | _this.setState({
|
26574 | currentStyle: newCurrentStyle,
|
26575 | currentVelocity: newCurrentVelocity,
|
26576 | lastIdealStyle: newLastIdealStyle,
|
26577 | lastIdealVelocity: newLastIdealVelocity
|
26578 | });
|
26579 |
|
26580 | _this.unreadPropStyle = null;
|
26581 |
|
26582 | _this.startAnimationIfNecessary();
|
26583 | });
|
26584 | };
|
26585 |
|
26586 | this.state = this.defaultState();
|
26587 | }
|
26588 |
|
26589 | Motion.prototype.defaultState = function defaultState() {
|
26590 | var _props = this.props;
|
26591 | var defaultStyle = _props.defaultStyle;
|
26592 | var style = _props.style;
|
26593 |
|
26594 | var currentStyle = defaultStyle || _stripStyle2['default'](style);
|
26595 | var currentVelocity = _mapToZero2['default'](currentStyle);
|
26596 | return {
|
26597 | currentStyle: currentStyle,
|
26598 | currentVelocity: currentVelocity,
|
26599 | lastIdealStyle: currentStyle,
|
26600 | lastIdealVelocity: currentVelocity
|
26601 | };
|
26602 | };
|
26603 |
|
26604 |
|
26605 |
|
26606 |
|
26607 |
|
26608 |
|
26609 |
|
26610 | Motion.prototype.componentDidMount = function componentDidMount() {
|
26611 | this.prevTime = _performanceNow2['default']();
|
26612 | this.startAnimationIfNecessary();
|
26613 | };
|
26614 |
|
26615 | Motion.prototype.componentWillReceiveProps = function componentWillReceiveProps(props) {
|
26616 | if (this.unreadPropStyle != null) {
|
26617 |
|
26618 | this.clearUnreadPropStyle(this.unreadPropStyle);
|
26619 | }
|
26620 |
|
26621 | this.unreadPropStyle = props.style;
|
26622 | if (this.animationID == null) {
|
26623 | this.prevTime = _performanceNow2['default']();
|
26624 | this.startAnimationIfNecessary();
|
26625 | }
|
26626 | };
|
26627 |
|
26628 | Motion.prototype.componentWillUnmount = function componentWillUnmount() {
|
26629 | if (this.animationID != null) {
|
26630 | _raf2['default'].cancel(this.animationID);
|
26631 | this.animationID = null;
|
26632 | }
|
26633 | };
|
26634 |
|
26635 | Motion.prototype.render = function render() {
|
26636 | var renderedChildren = this.props.children(this.state.currentStyle);
|
26637 | return renderedChildren && _react2['default'].Children.only(renderedChildren);
|
26638 | };
|
26639 |
|
26640 | return Motion;
|
26641 | })(_react2['default'].Component);
|
26642 |
|
26643 | exports['default'] = Motion;
|
26644 | module.exports = exports['default'];
|
26645 |
|
26646 |
|
26647 |
|
26648 |
|
26649 |
|
26650 | }),
|
26651 |
|
26652 | (function(module, exports) {
|
26653 |
|
26654 |
|
26655 |
|
26656 |
|
26657 | 'use strict';
|
26658 |
|
26659 | exports.__esModule = true;
|
26660 | exports['default'] = mapToZero;
|
26661 |
|
26662 | function mapToZero(obj) {
|
26663 | var ret = {};
|
26664 | for (var key in obj) {
|
26665 | if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
26666 | ret[key] = 0;
|
26667 | }
|
26668 | }
|
26669 | return ret;
|
26670 | }
|
26671 |
|
26672 | module.exports = exports['default'];
|
26673 |
|
26674 | }),
|
26675 |
|
26676 | (function(module, exports) {
|
26677 |
|
26678 |
|
26679 |
|
26680 |
|
26681 |
|
26682 | 'use strict';
|
26683 |
|
26684 | exports.__esModule = true;
|
26685 | exports['default'] = stripStyle;
|
26686 |
|
26687 | function stripStyle(style) {
|
26688 | var ret = {};
|
26689 | for (var key in style) {
|
26690 | if (!Object.prototype.hasOwnProperty.call(style, key)) {
|
26691 | continue;
|
26692 | }
|
26693 | ret[key] = typeof style[key] === 'number' ? style[key] : style[key].val;
|
26694 | }
|
26695 | return ret;
|
26696 | }
|
26697 |
|
26698 | module.exports = exports['default'];
|
26699 |
|
26700 | }),
|
26701 |
|
26702 | (function(module, exports) {
|
26703 |
|
26704 |
|
26705 |
|
26706 |
|
26707 |
|
26708 |
|
26709 | "use strict";
|
26710 |
|
26711 | exports.__esModule = true;
|
26712 | exports["default"] = stepper;
|
26713 |
|
26714 | var reusedTuple = [0, 0];
|
26715 |
|
26716 | function stepper(secondPerFrame, x, v, destX, k, b, precision) {
|
26717 |
|
26718 |
|
26719 |
|
26720 |
|
26721 | var Fspring = -k * (x - destX);
|
26722 |
|
26723 |
|
26724 | var Fdamper = -b * v;
|
26725 |
|
26726 |
|
26727 |
|
26728 |
|
26729 | var a = Fspring + Fdamper;
|
26730 |
|
26731 | var newV = v + a * secondPerFrame;
|
26732 | var newX = x + newV * secondPerFrame;
|
26733 |
|
26734 | if (Math.abs(newV) < precision && Math.abs(newX - destX) < precision) {
|
26735 | reusedTuple[0] = destX;
|
26736 | reusedTuple[1] = 0;
|
26737 | return reusedTuple;
|
26738 | }
|
26739 |
|
26740 | reusedTuple[0] = newX;
|
26741 | reusedTuple[1] = newV;
|
26742 | return reusedTuple;
|
26743 | }
|
26744 |
|
26745 | module.exports = exports["default"];
|
26746 |
|
26747 |
|
26748 | }),
|
26749 |
|
26750 | (function(module, exports, __webpack_require__) {
|
26751 |
|
26752 | (function(process) {
|
26753 | (function() {
|
26754 | var getNanoSeconds, hrtime, loadTime;
|
26755 |
|
26756 | if ((typeof performance !== "undefined" && performance !== null) && performance.now) {
|
26757 | module.exports = function() {
|
26758 | return performance.now();
|
26759 | };
|
26760 | } else if ((typeof process !== "undefined" && process !== null) && process.hrtime) {
|
26761 | module.exports = function() {
|
26762 | return (getNanoSeconds() - loadTime) / 1e6;
|
26763 | };
|
26764 | hrtime = process.hrtime;
|
26765 | getNanoSeconds = function() {
|
26766 | var hr;
|
26767 | hr = hrtime();
|
26768 | return hr[0] * 1e9 + hr[1];
|
26769 | };
|
26770 | loadTime = getNanoSeconds();
|
26771 | } else if (Date.now) {
|
26772 | module.exports = function() {
|
26773 | return Date.now() - loadTime;
|
26774 | };
|
26775 | loadTime = Date.now();
|
26776 | } else {
|
26777 | module.exports = function() {
|
26778 | return new Date().getTime() - loadTime;
|
26779 | };
|
26780 | loadTime = new Date().getTime();
|
26781 | }
|
26782 |
|
26783 | }).call(this);
|
26784 |
|
26785 | }.call(exports, __webpack_require__(33)))
|
26786 |
|
26787 | }),
|
26788 |
|
26789 | (function(module, exports, __webpack_require__) {
|
26790 |
|
26791 | (function(global) {var now = __webpack_require__(248)
|
26792 | , root = typeof window === 'undefined' ? global : window
|
26793 | , vendors = ['moz', 'webkit']
|
26794 | , suffix = 'AnimationFrame'
|
26795 | , raf = root['request' + suffix]
|
26796 | , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]
|
26797 |
|
26798 | for(var i = 0; !raf && i < vendors.length; i++) {
|
26799 | raf = root[vendors[i] + 'Request' + suffix]
|
26800 | caf = root[vendors[i] + 'Cancel' + suffix]
|
26801 | || root[vendors[i] + 'CancelRequest' + suffix]
|
26802 | }
|
26803 |
|
26804 |
|
26805 | if(!raf || !caf) {
|
26806 | var last = 0
|
26807 | , id = 0
|
26808 | , queue = []
|
26809 | , frameDuration = 1000 / 60
|
26810 |
|
26811 | raf = function(callback) {
|
26812 | if(queue.length === 0) {
|
26813 | var _now = now()
|
26814 | , next = Math.max(0, frameDuration - (_now - last))
|
26815 | last = next + _now
|
26816 | setTimeout(function() {
|
26817 | var cp = queue.slice(0)
|
26818 |
|
26819 |
|
26820 |
|
26821 | queue.length = 0
|
26822 | for(var i = 0; i < cp.length; i++) {
|
26823 | if(!cp[i].cancelled) {
|
26824 | try{
|
26825 | cp[i].callback(last)
|
26826 | } catch(e) {
|
26827 | setTimeout(function() { throw e }, 0)
|
26828 | }
|
26829 | }
|
26830 | }
|
26831 | }, Math.round(next))
|
26832 | }
|
26833 | queue.push({
|
26834 | handle: ++id,
|
26835 | callback: callback,
|
26836 | cancelled: false
|
26837 | })
|
26838 | return id
|
26839 | }
|
26840 |
|
26841 | caf = function(handle) {
|
26842 | for(var i = 0; i < queue.length; i++) {
|
26843 | if(queue[i].handle === handle) {
|
26844 | queue[i].cancelled = true
|
26845 | }
|
26846 | }
|
26847 | }
|
26848 | }
|
26849 |
|
26850 | module.exports = function(fn) {
|
26851 |
|
26852 |
|
26853 |
|
26854 | return raf.call(root, fn)
|
26855 | }
|
26856 | module.exports.cancel = function() {
|
26857 | caf.apply(root, arguments)
|
26858 | }
|
26859 | module.exports.polyfill = function(object) {
|
26860 | if (!object) {
|
26861 | object = root;
|
26862 | }
|
26863 | object.requestAnimationFrame = raf
|
26864 | object.cancelAnimationFrame = caf
|
26865 | }
|
26866 |
|
26867 | }.call(exports, (function() { return this; }())))
|
26868 |
|
26869 | }),
|
26870 |
|
26871 | (function(module, exports) {
|
26872 |
|
26873 |
|
26874 |
|
26875 |
|
26876 |
|
26877 | 'use strict';
|
26878 |
|
26879 | exports.__esModule = true;
|
26880 | exports['default'] = shouldStopAnimation;
|
26881 |
|
26882 | function shouldStopAnimation(currentStyle, style, currentVelocity) {
|
26883 | for (var key in style) {
|
26884 | if (!Object.prototype.hasOwnProperty.call(style, key)) {
|
26885 | continue;
|
26886 | }
|
26887 |
|
26888 | if (currentVelocity[key] !== 0) {
|
26889 | return false;
|
26890 | }
|
26891 |
|
26892 | var styleValue = typeof style[key] === 'number' ? style[key] : style[key].val;
|
26893 |
|
26894 |
|
26895 | if (currentStyle[key] !== styleValue) {
|
26896 | return false;
|
26897 | }
|
26898 | }
|
26899 |
|
26900 | return true;
|
26901 | }
|
26902 |
|
26903 | module.exports = exports['default'];
|
26904 |
|
26905 | }),
|
26906 |
|
26907 | (function(module, exports, __webpack_require__) {
|
26908 |
|
26909 | 'use strict';
|
26910 |
|
26911 | exports.__esModule = true;
|
26912 |
|
26913 | 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; };
|
26914 |
|
26915 | var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
26916 |
|
26917 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
26918 |
|
26919 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
26920 |
|
26921 | 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; }
|
26922 |
|
26923 | var _mapToZero = __webpack_require__(245);
|
26924 |
|
26925 | var _mapToZero2 = _interopRequireDefault(_mapToZero);
|
26926 |
|
26927 | var _stripStyle = __webpack_require__(246);
|
26928 |
|
26929 | var _stripStyle2 = _interopRequireDefault(_stripStyle);
|
26930 |
|
26931 | var _stepper3 = __webpack_require__(247);
|
26932 |
|
26933 | var _stepper4 = _interopRequireDefault(_stepper3);
|
26934 |
|
26935 | var _performanceNow = __webpack_require__(248);
|
26936 |
|
26937 | var _performanceNow2 = _interopRequireDefault(_performanceNow);
|
26938 |
|
26939 | var _raf = __webpack_require__(249);
|
26940 |
|
26941 | var _raf2 = _interopRequireDefault(_raf);
|
26942 |
|
26943 | var _shouldStopAnimation = __webpack_require__(250);
|
26944 |
|
26945 | var _shouldStopAnimation2 = _interopRequireDefault(_shouldStopAnimation);
|
26946 |
|
26947 | var _react = __webpack_require__(1);
|
26948 |
|
26949 | var _react2 = _interopRequireDefault(_react);
|
26950 |
|
26951 | var _propTypes = __webpack_require__(6);
|
26952 |
|
26953 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
26954 |
|
26955 | var msPerFrame = 1000 / 60;
|
26956 |
|
26957 | function shouldStopAnimationAll(currentStyles, styles, currentVelocities) {
|
26958 | for (var i = 0; i < currentStyles.length; i++) {
|
26959 | if (!_shouldStopAnimation2['default'](currentStyles[i], styles[i], currentVelocities[i])) {
|
26960 | return false;
|
26961 | }
|
26962 | }
|
26963 | return true;
|
26964 | }
|
26965 |
|
26966 | var StaggeredMotion = (function (_React$Component) {
|
26967 | _inherits(StaggeredMotion, _React$Component);
|
26968 |
|
26969 | _createClass(StaggeredMotion, null, [{
|
26970 | key: 'propTypes',
|
26971 | value: {
|
26972 |
|
26973 | defaultStyles: _propTypes2['default'].arrayOf(_propTypes2['default'].objectOf(_propTypes2['default'].number)),
|
26974 | styles: _propTypes2['default'].func.isRequired,
|
26975 | children: _propTypes2['default'].func.isRequired
|
26976 | },
|
26977 | enumerable: true
|
26978 | }]);
|
26979 |
|
26980 | function StaggeredMotion(props) {
|
26981 | var _this = this;
|
26982 |
|
26983 | _classCallCheck(this, StaggeredMotion);
|
26984 |
|
26985 | _React$Component.call(this, props);
|
26986 | this.animationID = null;
|
26987 | this.prevTime = 0;
|
26988 | this.accumulatedTime = 0;
|
26989 | this.unreadPropStyles = null;
|
26990 |
|
26991 | this.clearUnreadPropStyle = function (unreadPropStyles) {
|
26992 | var _state = _this.state;
|
26993 | var currentStyles = _state.currentStyles;
|
26994 | var currentVelocities = _state.currentVelocities;
|
26995 | var lastIdealStyles = _state.lastIdealStyles;
|
26996 | var lastIdealVelocities = _state.lastIdealVelocities;
|
26997 |
|
26998 | var someDirty = false;
|
26999 | for (var i = 0; i < unreadPropStyles.length; i++) {
|
27000 | var unreadPropStyle = unreadPropStyles[i];
|
27001 | var dirty = false;
|
27002 |
|
27003 | for (var key in unreadPropStyle) {
|
27004 | if (!Object.prototype.hasOwnProperty.call(unreadPropStyle, key)) {
|
27005 | continue;
|
27006 | }
|
27007 |
|
27008 | var styleValue = unreadPropStyle[key];
|
27009 | if (typeof styleValue === 'number') {
|
27010 | if (!dirty) {
|
27011 | dirty = true;
|
27012 | someDirty = true;
|
27013 | currentStyles[i] = _extends({}, currentStyles[i]);
|
27014 | currentVelocities[i] = _extends({}, currentVelocities[i]);
|
27015 | lastIdealStyles[i] = _extends({}, lastIdealStyles[i]);
|
27016 | lastIdealVelocities[i] = _extends({}, lastIdealVelocities[i]);
|
27017 | }
|
27018 | currentStyles[i][key] = styleValue;
|
27019 | currentVelocities[i][key] = 0;
|
27020 | lastIdealStyles[i][key] = styleValue;
|
27021 | lastIdealVelocities[i][key] = 0;
|
27022 | }
|
27023 | }
|
27024 | }
|
27025 |
|
27026 | if (someDirty) {
|
27027 | _this.setState({ currentStyles: currentStyles, currentVelocities: currentVelocities, lastIdealStyles: lastIdealStyles, lastIdealVelocities: lastIdealVelocities });
|
27028 | }
|
27029 | };
|
27030 |
|
27031 | this.startAnimationIfNecessary = function () {
|
27032 |
|
27033 |
|
27034 | _this.animationID = _raf2['default'](function (timestamp) {
|
27035 | var destStyles = _this.props.styles(_this.state.lastIdealStyles);
|
27036 |
|
27037 |
|
27038 | if (shouldStopAnimationAll(_this.state.currentStyles, destStyles, _this.state.currentVelocities)) {
|
27039 |
|
27040 | _this.animationID = null;
|
27041 | _this.accumulatedTime = 0;
|
27042 | return;
|
27043 | }
|
27044 |
|
27045 | var currentTime = timestamp || _performanceNow2['default']();
|
27046 | var timeDelta = currentTime - _this.prevTime;
|
27047 | _this.prevTime = currentTime;
|
27048 | _this.accumulatedTime = _this.accumulatedTime + timeDelta;
|
27049 |
|
27050 | if (_this.accumulatedTime > msPerFrame * 10) {
|
27051 | _this.accumulatedTime = 0;
|
27052 | }
|
27053 |
|
27054 | if (_this.accumulatedTime === 0) {
|
27055 |
|
27056 | _this.animationID = null;
|
27057 | _this.startAnimationIfNecessary();
|
27058 | return;
|
27059 | }
|
27060 |
|
27061 | var currentFrameCompletion = (_this.accumulatedTime - Math.floor(_this.accumulatedTime / msPerFrame) * msPerFrame) / msPerFrame;
|
27062 | var framesToCatchUp = Math.floor(_this.accumulatedTime / msPerFrame);
|
27063 |
|
27064 | var newLastIdealStyles = [];
|
27065 | var newLastIdealVelocities = [];
|
27066 | var newCurrentStyles = [];
|
27067 | var newCurrentVelocities = [];
|
27068 |
|
27069 | for (var i = 0; i < destStyles.length; i++) {
|
27070 | var destStyle = destStyles[i];
|
27071 | var newCurrentStyle = {};
|
27072 | var newCurrentVelocity = {};
|
27073 | var newLastIdealStyle = {};
|
27074 | var newLastIdealVelocity = {};
|
27075 |
|
27076 | for (var key in destStyle) {
|
27077 | if (!Object.prototype.hasOwnProperty.call(destStyle, key)) {
|
27078 | continue;
|
27079 | }
|
27080 |
|
27081 | var styleValue = destStyle[key];
|
27082 | if (typeof styleValue === 'number') {
|
27083 | newCurrentStyle[key] = styleValue;
|
27084 | newCurrentVelocity[key] = 0;
|
27085 | newLastIdealStyle[key] = styleValue;
|
27086 | newLastIdealVelocity[key] = 0;
|
27087 | } else {
|
27088 | var newLastIdealStyleValue = _this.state.lastIdealStyles[i][key];
|
27089 | var newLastIdealVelocityValue = _this.state.lastIdealVelocities[i][key];
|
27090 | for (var j = 0; j < framesToCatchUp; j++) {
|
27091 | var _stepper = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
27092 |
|
27093 | newLastIdealStyleValue = _stepper[0];
|
27094 | newLastIdealVelocityValue = _stepper[1];
|
27095 | }
|
27096 |
|
27097 | var _stepper2 = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
27098 |
|
27099 | var nextIdealX = _stepper2[0];
|
27100 | var nextIdealV = _stepper2[1];
|
27101 |
|
27102 | newCurrentStyle[key] = newLastIdealStyleValue + (nextIdealX - newLastIdealStyleValue) * currentFrameCompletion;
|
27103 | newCurrentVelocity[key] = newLastIdealVelocityValue + (nextIdealV - newLastIdealVelocityValue) * currentFrameCompletion;
|
27104 | newLastIdealStyle[key] = newLastIdealStyleValue;
|
27105 | newLastIdealVelocity[key] = newLastIdealVelocityValue;
|
27106 | }
|
27107 | }
|
27108 |
|
27109 | newCurrentStyles[i] = newCurrentStyle;
|
27110 | newCurrentVelocities[i] = newCurrentVelocity;
|
27111 | newLastIdealStyles[i] = newLastIdealStyle;
|
27112 | newLastIdealVelocities[i] = newLastIdealVelocity;
|
27113 | }
|
27114 |
|
27115 | _this.animationID = null;
|
27116 |
|
27117 | _this.accumulatedTime -= framesToCatchUp * msPerFrame;
|
27118 |
|
27119 | _this.setState({
|
27120 | currentStyles: newCurrentStyles,
|
27121 | currentVelocities: newCurrentVelocities,
|
27122 | lastIdealStyles: newLastIdealStyles,
|
27123 | lastIdealVelocities: newLastIdealVelocities
|
27124 | });
|
27125 |
|
27126 | _this.unreadPropStyles = null;
|
27127 |
|
27128 | _this.startAnimationIfNecessary();
|
27129 | });
|
27130 | };
|
27131 |
|
27132 | this.state = this.defaultState();
|
27133 | }
|
27134 |
|
27135 | StaggeredMotion.prototype.defaultState = function defaultState() {
|
27136 | var _props = this.props;
|
27137 | var defaultStyles = _props.defaultStyles;
|
27138 | var styles = _props.styles;
|
27139 |
|
27140 | var currentStyles = defaultStyles || styles().map(_stripStyle2['default']);
|
27141 | var currentVelocities = currentStyles.map(function (currentStyle) {
|
27142 | return _mapToZero2['default'](currentStyle);
|
27143 | });
|
27144 | return {
|
27145 | currentStyles: currentStyles,
|
27146 | currentVelocities: currentVelocities,
|
27147 | lastIdealStyles: currentStyles,
|
27148 | lastIdealVelocities: currentVelocities
|
27149 | };
|
27150 | };
|
27151 |
|
27152 | StaggeredMotion.prototype.componentDidMount = function componentDidMount() {
|
27153 | this.prevTime = _performanceNow2['default']();
|
27154 | this.startAnimationIfNecessary();
|
27155 | };
|
27156 |
|
27157 | StaggeredMotion.prototype.componentWillReceiveProps = function componentWillReceiveProps(props) {
|
27158 | if (this.unreadPropStyles != null) {
|
27159 |
|
27160 | this.clearUnreadPropStyle(this.unreadPropStyles);
|
27161 | }
|
27162 |
|
27163 | this.unreadPropStyles = props.styles(this.state.lastIdealStyles);
|
27164 | if (this.animationID == null) {
|
27165 | this.prevTime = _performanceNow2['default']();
|
27166 | this.startAnimationIfNecessary();
|
27167 | }
|
27168 | };
|
27169 |
|
27170 | StaggeredMotion.prototype.componentWillUnmount = function componentWillUnmount() {
|
27171 | if (this.animationID != null) {
|
27172 | _raf2['default'].cancel(this.animationID);
|
27173 | this.animationID = null;
|
27174 | }
|
27175 | };
|
27176 |
|
27177 | StaggeredMotion.prototype.render = function render() {
|
27178 | var renderedChildren = this.props.children(this.state.currentStyles);
|
27179 | return renderedChildren && _react2['default'].Children.only(renderedChildren);
|
27180 | };
|
27181 |
|
27182 | return StaggeredMotion;
|
27183 | })(_react2['default'].Component);
|
27184 |
|
27185 | exports['default'] = StaggeredMotion;
|
27186 | module.exports = exports['default'];
|
27187 |
|
27188 |
|
27189 |
|
27190 |
|
27191 |
|
27192 |
|
27193 |
|
27194 |
|
27195 |
|
27196 |
|
27197 |
|
27198 | }),
|
27199 |
|
27200 | (function(module, exports, __webpack_require__) {
|
27201 |
|
27202 | 'use strict';
|
27203 |
|
27204 | exports.__esModule = true;
|
27205 |
|
27206 | 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; };
|
27207 |
|
27208 | var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
27209 |
|
27210 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
27211 |
|
27212 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
27213 |
|
27214 | 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; }
|
27215 |
|
27216 | var _mapToZero = __webpack_require__(245);
|
27217 |
|
27218 | var _mapToZero2 = _interopRequireDefault(_mapToZero);
|
27219 |
|
27220 | var _stripStyle = __webpack_require__(246);
|
27221 |
|
27222 | var _stripStyle2 = _interopRequireDefault(_stripStyle);
|
27223 |
|
27224 | var _stepper3 = __webpack_require__(247);
|
27225 |
|
27226 | var _stepper4 = _interopRequireDefault(_stepper3);
|
27227 |
|
27228 | var _mergeDiff = __webpack_require__(253);
|
27229 |
|
27230 | var _mergeDiff2 = _interopRequireDefault(_mergeDiff);
|
27231 |
|
27232 | var _performanceNow = __webpack_require__(248);
|
27233 |
|
27234 | var _performanceNow2 = _interopRequireDefault(_performanceNow);
|
27235 |
|
27236 | var _raf = __webpack_require__(249);
|
27237 |
|
27238 | var _raf2 = _interopRequireDefault(_raf);
|
27239 |
|
27240 | var _shouldStopAnimation = __webpack_require__(250);
|
27241 |
|
27242 | var _shouldStopAnimation2 = _interopRequireDefault(_shouldStopAnimation);
|
27243 |
|
27244 | var _react = __webpack_require__(1);
|
27245 |
|
27246 | var _react2 = _interopRequireDefault(_react);
|
27247 |
|
27248 | var _propTypes = __webpack_require__(6);
|
27249 |
|
27250 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
27251 |
|
27252 | var msPerFrame = 1000 / 60;
|
27253 |
|
27254 |
|
27255 |
|
27256 |
|
27257 |
|
27258 |
|
27259 |
|
27260 |
|
27261 | function rehydrateStyles(mergedPropsStyles, unreadPropStyles, plainStyles) {
|
27262 |
|
27263 |
|
27264 | var cUnreadPropStyles = unreadPropStyles;
|
27265 | if (cUnreadPropStyles == null) {
|
27266 | return mergedPropsStyles.map(function (mergedPropsStyle, i) {
|
27267 | return {
|
27268 | key: mergedPropsStyle.key,
|
27269 | data: mergedPropsStyle.data,
|
27270 | style: plainStyles[i]
|
27271 | };
|
27272 | });
|
27273 | }
|
27274 | return mergedPropsStyles.map(function (mergedPropsStyle, i) {
|
27275 | for (var j = 0; j < cUnreadPropStyles.length; j++) {
|
27276 | if (cUnreadPropStyles[j].key === mergedPropsStyle.key) {
|
27277 | return {
|
27278 | key: cUnreadPropStyles[j].key,
|
27279 | data: cUnreadPropStyles[j].data,
|
27280 | style: plainStyles[i]
|
27281 | };
|
27282 | }
|
27283 | }
|
27284 | return { key: mergedPropsStyle.key, data: mergedPropsStyle.data, style: plainStyles[i] };
|
27285 | });
|
27286 | }
|
27287 |
|
27288 | function shouldStopAnimationAll(currentStyles, destStyles, currentVelocities, mergedPropsStyles) {
|
27289 | if (mergedPropsStyles.length !== destStyles.length) {
|
27290 | return false;
|
27291 | }
|
27292 |
|
27293 | for (var i = 0; i < mergedPropsStyles.length; i++) {
|
27294 | if (mergedPropsStyles[i].key !== destStyles[i].key) {
|
27295 | return false;
|
27296 | }
|
27297 | }
|
27298 |
|
27299 |
|
27300 |
|
27301 |
|
27302 | for (var i = 0; i < mergedPropsStyles.length; i++) {
|
27303 | if (!_shouldStopAnimation2['default'](currentStyles[i], destStyles[i].style, currentVelocities[i])) {
|
27304 | return false;
|
27305 | }
|
27306 | }
|
27307 |
|
27308 | return true;
|
27309 | }
|
27310 |
|
27311 |
|
27312 |
|
27313 |
|
27314 |
|
27315 |
|
27316 |
|
27317 |
|
27318 |
|
27319 |
|
27320 |
|
27321 |
|
27322 |
|
27323 |
|
27324 |
|
27325 |
|
27326 | function mergeAndSync(willEnter, willLeave, didLeave, oldMergedPropsStyles, destStyles, oldCurrentStyles, oldCurrentVelocities, oldLastIdealStyles, oldLastIdealVelocities) {
|
27327 | var newMergedPropsStyles = _mergeDiff2['default'](oldMergedPropsStyles, destStyles, function (oldIndex, oldMergedPropsStyle) {
|
27328 | var leavingStyle = willLeave(oldMergedPropsStyle);
|
27329 | if (leavingStyle == null) {
|
27330 | didLeave({ key: oldMergedPropsStyle.key, data: oldMergedPropsStyle.data });
|
27331 | return null;
|
27332 | }
|
27333 | if (_shouldStopAnimation2['default'](oldCurrentStyles[oldIndex], leavingStyle, oldCurrentVelocities[oldIndex])) {
|
27334 | didLeave({ key: oldMergedPropsStyle.key, data: oldMergedPropsStyle.data });
|
27335 | return null;
|
27336 | }
|
27337 | return { key: oldMergedPropsStyle.key, data: oldMergedPropsStyle.data, style: leavingStyle };
|
27338 | });
|
27339 |
|
27340 | var newCurrentStyles = [];
|
27341 | var newCurrentVelocities = [];
|
27342 | var newLastIdealStyles = [];
|
27343 | var newLastIdealVelocities = [];
|
27344 | for (var i = 0; i < newMergedPropsStyles.length; i++) {
|
27345 | var newMergedPropsStyleCell = newMergedPropsStyles[i];
|
27346 | var foundOldIndex = null;
|
27347 | for (var j = 0; j < oldMergedPropsStyles.length; j++) {
|
27348 | if (oldMergedPropsStyles[j].key === newMergedPropsStyleCell.key) {
|
27349 | foundOldIndex = j;
|
27350 | break;
|
27351 | }
|
27352 | }
|
27353 |
|
27354 | if (foundOldIndex == null) {
|
27355 | var plainStyle = willEnter(newMergedPropsStyleCell);
|
27356 | newCurrentStyles[i] = plainStyle;
|
27357 | newLastIdealStyles[i] = plainStyle;
|
27358 |
|
27359 | var velocity = _mapToZero2['default'](newMergedPropsStyleCell.style);
|
27360 | newCurrentVelocities[i] = velocity;
|
27361 | newLastIdealVelocities[i] = velocity;
|
27362 | } else {
|
27363 | newCurrentStyles[i] = oldCurrentStyles[foundOldIndex];
|
27364 | newLastIdealStyles[i] = oldLastIdealStyles[foundOldIndex];
|
27365 | newCurrentVelocities[i] = oldCurrentVelocities[foundOldIndex];
|
27366 | newLastIdealVelocities[i] = oldLastIdealVelocities[foundOldIndex];
|
27367 | }
|
27368 | }
|
27369 |
|
27370 | return [newMergedPropsStyles, newCurrentStyles, newCurrentVelocities, newLastIdealStyles, newLastIdealVelocities];
|
27371 | }
|
27372 |
|
27373 | var TransitionMotion = (function (_React$Component) {
|
27374 | _inherits(TransitionMotion, _React$Component);
|
27375 |
|
27376 | _createClass(TransitionMotion, null, [{
|
27377 | key: 'propTypes',
|
27378 | value: {
|
27379 | defaultStyles: _propTypes2['default'].arrayOf(_propTypes2['default'].shape({
|
27380 | key: _propTypes2['default'].string.isRequired,
|
27381 | data: _propTypes2['default'].any,
|
27382 | style: _propTypes2['default'].objectOf(_propTypes2['default'].number).isRequired
|
27383 | })),
|
27384 | styles: _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].arrayOf(_propTypes2['default'].shape({
|
27385 | key: _propTypes2['default'].string.isRequired,
|
27386 | data: _propTypes2['default'].any,
|
27387 | style: _propTypes2['default'].objectOf(_propTypes2['default'].oneOfType([_propTypes2['default'].number, _propTypes2['default'].object])).isRequired
|
27388 | }))]).isRequired,
|
27389 | children: _propTypes2['default'].func.isRequired,
|
27390 | willEnter: _propTypes2['default'].func,
|
27391 | willLeave: _propTypes2['default'].func,
|
27392 | didLeave: _propTypes2['default'].func
|
27393 | },
|
27394 | enumerable: true
|
27395 | }, {
|
27396 | key: 'defaultProps',
|
27397 | value: {
|
27398 | willEnter: function willEnter(styleThatEntered) {
|
27399 | return _stripStyle2['default'](styleThatEntered.style);
|
27400 | },
|
27401 |
|
27402 |
|
27403 | willLeave: function willLeave() {
|
27404 | return null;
|
27405 | },
|
27406 | didLeave: function didLeave() {}
|
27407 | },
|
27408 | enumerable: true
|
27409 | }]);
|
27410 |
|
27411 | function TransitionMotion(props) {
|
27412 | var _this = this;
|
27413 |
|
27414 | _classCallCheck(this, TransitionMotion);
|
27415 |
|
27416 | _React$Component.call(this, props);
|
27417 | this.unmounting = false;
|
27418 | this.animationID = null;
|
27419 | this.prevTime = 0;
|
27420 | this.accumulatedTime = 0;
|
27421 | this.unreadPropStyles = null;
|
27422 |
|
27423 | this.clearUnreadPropStyle = function (unreadPropStyles) {
|
27424 | var _mergeAndSync = mergeAndSync(_this.props.willEnter, _this.props.willLeave, _this.props.didLeave, _this.state.mergedPropsStyles, unreadPropStyles, _this.state.currentStyles, _this.state.currentVelocities, _this.state.lastIdealStyles, _this.state.lastIdealVelocities);
|
27425 |
|
27426 | var mergedPropsStyles = _mergeAndSync[0];
|
27427 | var currentStyles = _mergeAndSync[1];
|
27428 | var currentVelocities = _mergeAndSync[2];
|
27429 | var lastIdealStyles = _mergeAndSync[3];
|
27430 | var lastIdealVelocities = _mergeAndSync[4];
|
27431 |
|
27432 | for (var i = 0; i < unreadPropStyles.length; i++) {
|
27433 | var unreadPropStyle = unreadPropStyles[i].style;
|
27434 | var dirty = false;
|
27435 |
|
27436 | for (var key in unreadPropStyle) {
|
27437 | if (!Object.prototype.hasOwnProperty.call(unreadPropStyle, key)) {
|
27438 | continue;
|
27439 | }
|
27440 |
|
27441 | var styleValue = unreadPropStyle[key];
|
27442 | if (typeof styleValue === 'number') {
|
27443 | if (!dirty) {
|
27444 | dirty = true;
|
27445 | currentStyles[i] = _extends({}, currentStyles[i]);
|
27446 | currentVelocities[i] = _extends({}, currentVelocities[i]);
|
27447 | lastIdealStyles[i] = _extends({}, lastIdealStyles[i]);
|
27448 | lastIdealVelocities[i] = _extends({}, lastIdealVelocities[i]);
|
27449 | mergedPropsStyles[i] = {
|
27450 | key: mergedPropsStyles[i].key,
|
27451 | data: mergedPropsStyles[i].data,
|
27452 | style: _extends({}, mergedPropsStyles[i].style)
|
27453 | };
|
27454 | }
|
27455 | currentStyles[i][key] = styleValue;
|
27456 | currentVelocities[i][key] = 0;
|
27457 | lastIdealStyles[i][key] = styleValue;
|
27458 | lastIdealVelocities[i][key] = 0;
|
27459 | mergedPropsStyles[i].style[key] = styleValue;
|
27460 | }
|
27461 | }
|
27462 | }
|
27463 |
|
27464 |
|
27465 |
|
27466 |
|
27467 | _this.setState({
|
27468 | currentStyles: currentStyles,
|
27469 | currentVelocities: currentVelocities,
|
27470 | mergedPropsStyles: mergedPropsStyles,
|
27471 | lastIdealStyles: lastIdealStyles,
|
27472 | lastIdealVelocities: lastIdealVelocities
|
27473 | });
|
27474 | };
|
27475 |
|
27476 | this.startAnimationIfNecessary = function () {
|
27477 | if (_this.unmounting) {
|
27478 | return;
|
27479 | }
|
27480 |
|
27481 |
|
27482 |
|
27483 | _this.animationID = _raf2['default'](function (timestamp) {
|
27484 |
|
27485 |
|
27486 |
|
27487 |
|
27488 |
|
27489 | if (_this.unmounting) {
|
27490 | return;
|
27491 | }
|
27492 |
|
27493 | var propStyles = _this.props.styles;
|
27494 | var destStyles = typeof propStyles === 'function' ? propStyles(rehydrateStyles(_this.state.mergedPropsStyles, _this.unreadPropStyles, _this.state.lastIdealStyles)) : propStyles;
|
27495 |
|
27496 |
|
27497 | if (shouldStopAnimationAll(_this.state.currentStyles, destStyles, _this.state.currentVelocities, _this.state.mergedPropsStyles)) {
|
27498 |
|
27499 | _this.animationID = null;
|
27500 | _this.accumulatedTime = 0;
|
27501 | return;
|
27502 | }
|
27503 |
|
27504 | var currentTime = timestamp || _performanceNow2['default']();
|
27505 | var timeDelta = currentTime - _this.prevTime;
|
27506 | _this.prevTime = currentTime;
|
27507 | _this.accumulatedTime = _this.accumulatedTime + timeDelta;
|
27508 |
|
27509 | if (_this.accumulatedTime > msPerFrame * 10) {
|
27510 | _this.accumulatedTime = 0;
|
27511 | }
|
27512 |
|
27513 | if (_this.accumulatedTime === 0) {
|
27514 |
|
27515 | _this.animationID = null;
|
27516 | _this.startAnimationIfNecessary();
|
27517 | return;
|
27518 | }
|
27519 |
|
27520 | var currentFrameCompletion = (_this.accumulatedTime - Math.floor(_this.accumulatedTime / msPerFrame) * msPerFrame) / msPerFrame;
|
27521 | var framesToCatchUp = Math.floor(_this.accumulatedTime / msPerFrame);
|
27522 |
|
27523 | var _mergeAndSync2 = mergeAndSync(_this.props.willEnter, _this.props.willLeave, _this.props.didLeave, _this.state.mergedPropsStyles, destStyles, _this.state.currentStyles, _this.state.currentVelocities, _this.state.lastIdealStyles, _this.state.lastIdealVelocities);
|
27524 |
|
27525 | var newMergedPropsStyles = _mergeAndSync2[0];
|
27526 | var newCurrentStyles = _mergeAndSync2[1];
|
27527 | var newCurrentVelocities = _mergeAndSync2[2];
|
27528 | var newLastIdealStyles = _mergeAndSync2[3];
|
27529 | var newLastIdealVelocities = _mergeAndSync2[4];
|
27530 |
|
27531 | for (var i = 0; i < newMergedPropsStyles.length; i++) {
|
27532 | var newMergedPropsStyle = newMergedPropsStyles[i].style;
|
27533 | var newCurrentStyle = {};
|
27534 | var newCurrentVelocity = {};
|
27535 | var newLastIdealStyle = {};
|
27536 | var newLastIdealVelocity = {};
|
27537 |
|
27538 | for (var key in newMergedPropsStyle) {
|
27539 | if (!Object.prototype.hasOwnProperty.call(newMergedPropsStyle, key)) {
|
27540 | continue;
|
27541 | }
|
27542 |
|
27543 | var styleValue = newMergedPropsStyle[key];
|
27544 | if (typeof styleValue === 'number') {
|
27545 | newCurrentStyle[key] = styleValue;
|
27546 | newCurrentVelocity[key] = 0;
|
27547 | newLastIdealStyle[key] = styleValue;
|
27548 | newLastIdealVelocity[key] = 0;
|
27549 | } else {
|
27550 | var newLastIdealStyleValue = newLastIdealStyles[i][key];
|
27551 | var newLastIdealVelocityValue = newLastIdealVelocities[i][key];
|
27552 | for (var j = 0; j < framesToCatchUp; j++) {
|
27553 | var _stepper = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
27554 |
|
27555 | newLastIdealStyleValue = _stepper[0];
|
27556 | newLastIdealVelocityValue = _stepper[1];
|
27557 | }
|
27558 |
|
27559 | var _stepper2 = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
27560 |
|
27561 | var nextIdealX = _stepper2[0];
|
27562 | var nextIdealV = _stepper2[1];
|
27563 |
|
27564 | newCurrentStyle[key] = newLastIdealStyleValue + (nextIdealX - newLastIdealStyleValue) * currentFrameCompletion;
|
27565 | newCurrentVelocity[key] = newLastIdealVelocityValue + (nextIdealV - newLastIdealVelocityValue) * currentFrameCompletion;
|
27566 | newLastIdealStyle[key] = newLastIdealStyleValue;
|
27567 | newLastIdealVelocity[key] = newLastIdealVelocityValue;
|
27568 | }
|
27569 | }
|
27570 |
|
27571 | newLastIdealStyles[i] = newLastIdealStyle;
|
27572 | newLastIdealVelocities[i] = newLastIdealVelocity;
|
27573 | newCurrentStyles[i] = newCurrentStyle;
|
27574 | newCurrentVelocities[i] = newCurrentVelocity;
|
27575 | }
|
27576 |
|
27577 | _this.animationID = null;
|
27578 |
|
27579 | _this.accumulatedTime -= framesToCatchUp * msPerFrame;
|
27580 |
|
27581 | _this.setState({
|
27582 | currentStyles: newCurrentStyles,
|
27583 | currentVelocities: newCurrentVelocities,
|
27584 | lastIdealStyles: newLastIdealStyles,
|
27585 | lastIdealVelocities: newLastIdealVelocities,
|
27586 | mergedPropsStyles: newMergedPropsStyles
|
27587 | });
|
27588 |
|
27589 | _this.unreadPropStyles = null;
|
27590 |
|
27591 | _this.startAnimationIfNecessary();
|
27592 | });
|
27593 | };
|
27594 |
|
27595 | this.state = this.defaultState();
|
27596 | }
|
27597 |
|
27598 | TransitionMotion.prototype.defaultState = function defaultState() {
|
27599 | var _props = this.props;
|
27600 | var defaultStyles = _props.defaultStyles;
|
27601 | var styles = _props.styles;
|
27602 | var willEnter = _props.willEnter;
|
27603 | var willLeave = _props.willLeave;
|
27604 | var didLeave = _props.didLeave;
|
27605 |
|
27606 | var destStyles = typeof styles === 'function' ? styles(defaultStyles) : styles;
|
27607 |
|
27608 |
|
27609 |
|
27610 |
|
27611 |
|
27612 | var oldMergedPropsStyles = undefined;
|
27613 | if (defaultStyles == null) {
|
27614 | oldMergedPropsStyles = destStyles;
|
27615 | } else {
|
27616 | oldMergedPropsStyles = defaultStyles.map(function (defaultStyleCell) {
|
27617 |
|
27618 | for (var i = 0; i < destStyles.length; i++) {
|
27619 | if (destStyles[i].key === defaultStyleCell.key) {
|
27620 | return destStyles[i];
|
27621 | }
|
27622 | }
|
27623 | return defaultStyleCell;
|
27624 | });
|
27625 | }
|
27626 | var oldCurrentStyles = defaultStyles == null ? destStyles.map(function (s) {
|
27627 | return _stripStyle2['default'](s.style);
|
27628 | }) : defaultStyles.map(function (s) {
|
27629 | return _stripStyle2['default'](s.style);
|
27630 | });
|
27631 | var oldCurrentVelocities = defaultStyles == null ? destStyles.map(function (s) {
|
27632 | return _mapToZero2['default'](s.style);
|
27633 | }) : defaultStyles.map(function (s) {
|
27634 | return _mapToZero2['default'](s.style);
|
27635 | });
|
27636 |
|
27637 | var _mergeAndSync3 = mergeAndSync(
|
27638 |
|
27639 |
|
27640 |
|
27641 | willEnter, willLeave, didLeave, oldMergedPropsStyles, destStyles, oldCurrentStyles, oldCurrentVelocities, oldCurrentStyles,
|
27642 | oldCurrentVelocities);
|
27643 |
|
27644 | var mergedPropsStyles = _mergeAndSync3[0];
|
27645 | var currentStyles = _mergeAndSync3[1];
|
27646 | var currentVelocities = _mergeAndSync3[2];
|
27647 | var lastIdealStyles = _mergeAndSync3[3];
|
27648 | var lastIdealVelocities = _mergeAndSync3[4];
|
27649 |
|
27650 |
|
27651 | return {
|
27652 | currentStyles: currentStyles,
|
27653 | currentVelocities: currentVelocities,
|
27654 | lastIdealStyles: lastIdealStyles,
|
27655 | lastIdealVelocities: lastIdealVelocities,
|
27656 | mergedPropsStyles: mergedPropsStyles
|
27657 | };
|
27658 | };
|
27659 |
|
27660 |
|
27661 |
|
27662 |
|
27663 |
|
27664 | TransitionMotion.prototype.componentDidMount = function componentDidMount() {
|
27665 | this.prevTime = _performanceNow2['default']();
|
27666 | this.startAnimationIfNecessary();
|
27667 | };
|
27668 |
|
27669 | TransitionMotion.prototype.componentWillReceiveProps = function componentWillReceiveProps(props) {
|
27670 | if (this.unreadPropStyles) {
|
27671 |
|
27672 | this.clearUnreadPropStyle(this.unreadPropStyles);
|
27673 | }
|
27674 |
|
27675 | var styles = props.styles;
|
27676 | if (typeof styles === 'function') {
|
27677 | this.unreadPropStyles = styles(rehydrateStyles(this.state.mergedPropsStyles, this.unreadPropStyles, this.state.lastIdealStyles));
|
27678 | } else {
|
27679 | this.unreadPropStyles = styles;
|
27680 | }
|
27681 |
|
27682 | if (this.animationID == null) {
|
27683 | this.prevTime = _performanceNow2['default']();
|
27684 | this.startAnimationIfNecessary();
|
27685 | }
|
27686 | };
|
27687 |
|
27688 | TransitionMotion.prototype.componentWillUnmount = function componentWillUnmount() {
|
27689 | this.unmounting = true;
|
27690 | if (this.animationID != null) {
|
27691 | _raf2['default'].cancel(this.animationID);
|
27692 | this.animationID = null;
|
27693 | }
|
27694 | };
|
27695 |
|
27696 | TransitionMotion.prototype.render = function render() {
|
27697 | var hydratedStyles = rehydrateStyles(this.state.mergedPropsStyles, this.unreadPropStyles, this.state.currentStyles);
|
27698 | var renderedChildren = this.props.children(hydratedStyles);
|
27699 | return renderedChildren && _react2['default'].Children.only(renderedChildren);
|
27700 | };
|
27701 |
|
27702 | return TransitionMotion;
|
27703 | })(_react2['default'].Component);
|
27704 |
|
27705 | exports['default'] = TransitionMotion;
|
27706 | module.exports = exports['default'];
|
27707 |
|
27708 |
|
27709 |
|
27710 |
|
27711 |
|
27712 |
|
27713 |
|
27714 |
|
27715 |
|
27716 |
|
27717 |
|
27718 |
|
27719 |
|
27720 |
|
27721 |
|
27722 |
|
27723 |
|
27724 |
|
27725 | }),
|
27726 |
|
27727 | (function(module, exports) {
|
27728 |
|
27729 |
|
27730 |
|
27731 |
|
27732 |
|
27733 |
|
27734 |
|
27735 |
|
27736 |
|
27737 |
|
27738 |
|
27739 |
|
27740 |
|
27741 |
|
27742 |
|
27743 |
|
27744 |
|
27745 |
|
27746 |
|
27747 | 'use strict';
|
27748 |
|
27749 | exports.__esModule = true;
|
27750 | exports['default'] = mergeDiff;
|
27751 |
|
27752 | function mergeDiff(prev, next, onRemove) {
|
27753 |
|
27754 |
|
27755 |
|
27756 | var prevKeyIndex = {};
|
27757 | for (var i = 0; i < prev.length; i++) {
|
27758 | prevKeyIndex[prev[i].key] = i;
|
27759 | }
|
27760 | var nextKeyIndex = {};
|
27761 | for (var i = 0; i < next.length; i++) {
|
27762 | nextKeyIndex[next[i].key] = i;
|
27763 | }
|
27764 |
|
27765 |
|
27766 |
|
27767 |
|
27768 | var ret = [];
|
27769 | for (var i = 0; i < next.length; i++) {
|
27770 | ret[i] = next[i];
|
27771 | }
|
27772 | for (var i = 0; i < prev.length; i++) {
|
27773 | if (!Object.prototype.hasOwnProperty.call(nextKeyIndex, prev[i].key)) {
|
27774 |
|
27775 |
|
27776 | var fill = onRemove(i, prev[i]);
|
27777 | if (fill != null) {
|
27778 | ret.push(fill);
|
27779 | }
|
27780 | }
|
27781 | }
|
27782 |
|
27783 |
|
27784 | return ret.sort(function (a, b) {
|
27785 | var nextOrderA = nextKeyIndex[a.key];
|
27786 | var nextOrderB = nextKeyIndex[b.key];
|
27787 | var prevOrderA = prevKeyIndex[a.key];
|
27788 | var prevOrderB = prevKeyIndex[b.key];
|
27789 |
|
27790 | if (nextOrderA != null && nextOrderB != null) {
|
27791 |
|
27792 | return nextKeyIndex[a.key] - nextKeyIndex[b.key];
|
27793 | } else if (prevOrderA != null && prevOrderB != null) {
|
27794 |
|
27795 | return prevKeyIndex[a.key] - prevKeyIndex[b.key];
|
27796 | } else if (nextOrderA != null) {
|
27797 |
|
27798 |
|
27799 |
|
27800 |
|
27801 |
|
27802 |
|
27803 | for (var i = 0; i < next.length; i++) {
|
27804 | var pivot = next[i].key;
|
27805 | if (!Object.prototype.hasOwnProperty.call(prevKeyIndex, pivot)) {
|
27806 | continue;
|
27807 | }
|
27808 |
|
27809 | if (nextOrderA < nextKeyIndex[pivot] && prevOrderB > prevKeyIndex[pivot]) {
|
27810 | return -1;
|
27811 | } else if (nextOrderA > nextKeyIndex[pivot] && prevOrderB < prevKeyIndex[pivot]) {
|
27812 | return 1;
|
27813 | }
|
27814 | }
|
27815 |
|
27816 | return 1;
|
27817 | }
|
27818 |
|
27819 | for (var i = 0; i < next.length; i++) {
|
27820 | var pivot = next[i].key;
|
27821 | if (!Object.prototype.hasOwnProperty.call(prevKeyIndex, pivot)) {
|
27822 | continue;
|
27823 | }
|
27824 | if (nextOrderB < nextKeyIndex[pivot] && prevOrderA > prevKeyIndex[pivot]) {
|
27825 | return 1;
|
27826 | } else if (nextOrderB > nextKeyIndex[pivot] && prevOrderA < prevKeyIndex[pivot]) {
|
27827 | return -1;
|
27828 | }
|
27829 | }
|
27830 |
|
27831 | return -1;
|
27832 | });
|
27833 | }
|
27834 |
|
27835 | module.exports = exports['default'];
|
27836 |
|
27837 |
|
27838 | }),
|
27839 |
|
27840 | (function(module, exports, __webpack_require__) {
|
27841 |
|
27842 | 'use strict';
|
27843 |
|
27844 | exports.__esModule = true;
|
27845 |
|
27846 | 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; };
|
27847 |
|
27848 | exports['default'] = spring;
|
27849 |
|
27850 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
27851 |
|
27852 | var _presets = __webpack_require__(255);
|
27853 |
|
27854 | var _presets2 = _interopRequireDefault(_presets);
|
27855 |
|
27856 | var defaultConfig = _extends({}, _presets2['default'].noWobble, {
|
27857 | precision: 0.01
|
27858 | });
|
27859 |
|
27860 | function spring(val, config) {
|
27861 | return _extends({}, defaultConfig, config, { val: val });
|
27862 | }
|
27863 |
|
27864 | module.exports = exports['default'];
|
27865 |
|
27866 | }),
|
27867 |
|
27868 | (function(module, exports) {
|
27869 |
|
27870 | "use strict";
|
27871 |
|
27872 | exports.__esModule = true;
|
27873 | exports["default"] = {
|
27874 | noWobble: { stiffness: 170, damping: 26 },
|
27875 | gentle: { stiffness: 120, damping: 14 },
|
27876 | wobbly: { stiffness: 180, damping: 12 },
|
27877 | stiff: { stiffness: 210, damping: 20 }
|
27878 | };
|
27879 | module.exports = exports["default"];
|
27880 |
|
27881 | }),
|
27882 |
|
27883 | (function(module, exports, __webpack_require__) {
|
27884 |
|
27885 | (function(process) {'use strict';
|
27886 |
|
27887 | exports.__esModule = true;
|
27888 | exports['default'] = reorderKeys;
|
27889 |
|
27890 | var hasWarned = false;
|
27891 |
|
27892 | function reorderKeys() {
|
27893 | if (process.env.NODE_ENV === 'development') {
|
27894 | if (!hasWarned) {
|
27895 | hasWarned = true;
|
27896 | console.error('`reorderKeys` has been removed, since it is no longer needed for TransitionMotion\'s new styles array API.');
|
27897 | }
|
27898 | }
|
27899 | }
|
27900 |
|
27901 | module.exports = exports['default'];
|
27902 | }.call(exports, __webpack_require__(33)))
|
27903 |
|
27904 | }),
|
27905 |
|
27906 | (function(module, exports, __webpack_require__) {
|
27907 |
|
27908 | (function webpackUniversalModuleDefinition(root, factory) {
|
27909 | if(true)
|
27910 | module.exports = factory(__webpack_require__(2), __webpack_require__(1));
|
27911 | else if(typeof define === 'function' && define.amd)
|
27912 | define(["react-dom", "react"], factory);
|
27913 | else if(typeof exports === 'object')
|
27914 | exports["ReactDraggable"] = factory(require("react-dom"), require("react"));
|
27915 | else
|
27916 | root["ReactDraggable"] = factory(root["ReactDOM"], root["React"]);
|
27917 | })(this, function(__WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_6__) {
|
27918 | return (function(modules) {
|
27919 |
|
27920 | var installedModules = {};
|
27921 |
|
27922 |
|
27923 | function __webpack_require__(moduleId) {
|
27924 |
|
27925 |
|
27926 | if(installedModules[moduleId]) {
|
27927 | return installedModules[moduleId].exports;
|
27928 | }
|
27929 |
|
27930 | var module = installedModules[moduleId] = {
|
27931 | i: moduleId,
|
27932 | l: false,
|
27933 | exports: {}
|
27934 | };
|
27935 |
|
27936 |
|
27937 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
27938 |
|
27939 |
|
27940 | module.l = true;
|
27941 |
|
27942 |
|
27943 | return module.exports;
|
27944 | }
|
27945 |
|
27946 |
|
27947 |
|
27948 | __webpack_require__.m = modules;
|
27949 |
|
27950 |
|
27951 | __webpack_require__.c = installedModules;
|
27952 |
|
27953 |
|
27954 | __webpack_require__.d = function(exports, name, getter) {
|
27955 | if(!__webpack_require__.o(exports, name)) {
|
27956 | Object.defineProperty(exports, name, {
|
27957 | configurable: false,
|
27958 | enumerable: true,
|
27959 | get: getter
|
27960 | /******/ });
|
27961 | /******/ }
|
27962 | /******/ };
|
27963 | /******/
|
27964 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
27965 | /******/ __webpack_require__.n = function(module) {
|
27966 | var getter = module && module.__esModule ?
|
27967 | function getDefault() { return module['default']; } :
|
27968 | function getModuleExports() { return module; };
|
27969 | __webpack_require__.d(getter, 'a', getter);
|
27970 | return getter;
|
27971 | };
|
27972 |
|
27973 |
|
27974 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
27975 |
|
27976 |
|
27977 | __webpack_require__.p = "";
|
27978 |
|
27979 |
|
27980 | return __webpack_require__(__webpack_require__.s = 12);
|
27981 | })
|
27982 |
|
27983 | ([
|
27984 |
|
27985 | (function(module, exports, __webpack_require__) {
|
27986 |
|
27987 | "use strict";
|
27988 |
|
27989 |
|
27990 | Object.defineProperty(exports, "__esModule", {
|
27991 | value: true
|
27992 | });
|
27993 | exports.findInArray = findInArray;
|
27994 | exports.isFunction = isFunction;
|
27995 | exports.isNum = isNum;
|
27996 | exports.int = int;
|
27997 | exports.dontSetMe = dontSetMe;
|
27998 |
|
27999 |
|
28000 | function findInArray(array /*: Array<any> | TouchList*/, callback /*: Function*/) /*: any*/ {
|
28001 | for (var i = 0, length = array.length; i < length; i++) {
|
28002 | if (callback.apply(callback, [array[i], i, array])) return array[i];
|
28003 | }
|
28004 | }
|
28005 |
|
28006 | function isFunction(func /*: any*/) /*: boolean*/ {
|
28007 | return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';
|
28008 | }
|
28009 |
|
28010 | function isNum(num /*: any*/) /*: boolean*/ {
|
28011 | return typeof num === 'number' && !isNaN(num);
|
28012 | }
|
28013 |
|
28014 | function int(a /*: string*/) /*: number*/ {
|
28015 | return parseInt(a, 10);
|
28016 | }
|
28017 |
|
28018 | function dontSetMe(props /*: Object*/, propName /*: string*/, componentName /*: string*/) {
|
28019 | if (props[propName]) {
|
28020 | return new Error('Invalid prop ' + propName + ' passed to ' + componentName + ' - do not set this, set it on the child.');
|
28021 | }
|
28022 | }
|
28023 |
|
28024 | }),
|
28025 |
|
28026 | (function(module, exports, __webpack_require__) {
|
28027 |
|
28028 | "use strict";
|
28029 |
|
28030 |
|
28031 | |
28032 |
|
28033 |
|
28034 |
|
28035 |
|
28036 |
|
28037 |
|
28038 |
|
28039 |
|
28040 | function makeEmptyFunction(arg) {
|
28041 | return function () {
|
28042 | return arg;
|
28043 | };
|
28044 | }
|
28045 |
|
28046 | |
28047 |
|
28048 |
|
28049 |
|
28050 |
|
28051 | var emptyFunction = function emptyFunction() {};
|
28052 |
|
28053 | emptyFunction.thatReturns = makeEmptyFunction;
|
28054 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
28055 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
28056 | emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
28057 | emptyFunction.thatReturnsThis = function () {
|
28058 | return this;
|
28059 | };
|
28060 | emptyFunction.thatReturnsArgument = function (arg) {
|
28061 | return arg;
|
28062 | };
|
28063 |
|
28064 | module.exports = emptyFunction;
|
28065 |
|
28066 | }),
|
28067 |
|
28068 | (function(module, exports, __webpack_require__) {
|
28069 |
|
28070 | "use strict";
|
28071 | |
28072 |
|
28073 |
|
28074 |
|
28075 |
|
28076 |
|
28077 |
|
28078 |
|
28079 |
|
28080 |
|
28081 | |
28082 |
|
28083 |
|
28084 |
|
28085 |
|
28086 |
|
28087 |
|
28088 |
|
28089 |
|
28090 |
|
28091 |
|
28092 | var validateFormat = function validateFormat(format) {};
|
28093 |
|
28094 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
28095 | validateFormat = function validateFormat(format) {
|
28096 | if (format === undefined) {
|
28097 | throw new Error('invariant requires an error message argument');
|
28098 | }
|
28099 | };
|
28100 | }
|
28101 |
|
28102 | function invariant(condition, format, a, b, c, d, e, f) {
|
28103 | validateFormat(format);
|
28104 |
|
28105 | if (!condition) {
|
28106 | var error;
|
28107 | if (format === undefined) {
|
28108 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
28109 | } else {
|
28110 | var args = [a, b, c, d, e, f];
|
28111 | var argIndex = 0;
|
28112 | error = new Error(format.replace(/%s/g, function () {
|
28113 | return args[argIndex++];
|
28114 | }));
|
28115 | error.name = 'Invariant Violation';
|
28116 | }
|
28117 |
|
28118 | error.framesToPop = 1;
|
28119 | throw error;
|
28120 | }
|
28121 | }
|
28122 |
|
28123 | module.exports = invariant;
|
28124 |
|
28125 | }),
|
28126 |
|
28127 | (function(module, exports, __webpack_require__) {
|
28128 |
|
28129 | "use strict";
|
28130 | |
28131 |
|
28132 |
|
28133 |
|
28134 |
|
28135 |
|
28136 |
|
28137 |
|
28138 |
|
28139 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
28140 |
|
28141 | module.exports = ReactPropTypesSecret;
|
28142 |
|
28143 |
|
28144 | }),
|
28145 |
|
28146 | (function(module, exports) {
|
28147 |
|
28148 | module.exports = __WEBPACK_EXTERNAL_MODULE_4__;
|
28149 |
|
28150 | }),
|
28151 |
|
28152 | (function(module, exports, __webpack_require__) {
|
28153 |
|
28154 | "use strict";
|
28155 |
|
28156 |
|
28157 | Object.defineProperty(exports, "__esModule", {
|
28158 | value: true
|
28159 | });
|
28160 |
|
28161 | 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; };
|
28162 |
|
28163 | exports.matchesSelector = matchesSelector;
|
28164 | exports.matchesSelectorAndParentsTo = matchesSelectorAndParentsTo;
|
28165 | exports.addEvent = addEvent;
|
28166 | exports.removeEvent = removeEvent;
|
28167 | exports.outerHeight = outerHeight;
|
28168 | exports.outerWidth = outerWidth;
|
28169 | exports.innerHeight = innerHeight;
|
28170 | exports.innerWidth = innerWidth;
|
28171 | exports.offsetXYFromParent = offsetXYFromParent;
|
28172 | exports.createCSSTransform = createCSSTransform;
|
28173 | exports.createSVGTransform = createSVGTransform;
|
28174 | exports.getTouch = getTouch;
|
28175 | exports.getTouchIdentifier = getTouchIdentifier;
|
28176 | exports.addUserSelectStyles = addUserSelectStyles;
|
28177 | exports.removeUserSelectStyles = removeUserSelectStyles;
|
28178 | exports.styleHacks = styleHacks;
|
28179 | exports.addClassName = addClassName;
|
28180 | exports.removeClassName = removeClassName;
|
28181 |
|
28182 | var _shims = __webpack_require__(0);
|
28183 |
|
28184 | var _getPrefix = __webpack_require__(19);
|
28185 |
|
28186 | var _getPrefix2 = _interopRequireDefault(_getPrefix);
|
28187 |
|
28188 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
28189 |
|
28190 | 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; }
|
28191 |
|
28192 |
|
28193 |
|
28194 |
|
28195 | var matchesSelectorFunc = '';
|
28196 | function matchesSelector(el /*: Node*/, selector /*: string*/) /*: boolean*/ {
|
28197 | if (!matchesSelectorFunc) {
|
28198 | matchesSelectorFunc = (0, _shims.findInArray)(['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'], function (method) {
|
28199 |
|
28200 | return (0, _shims.isFunction)(el[method]);
|
28201 | });
|
28202 | }
|
28203 |
|
28204 |
|
28205 |
|
28206 | if (!(0, _shims.isFunction)(el[matchesSelectorFunc])) return false;
|
28207 |
|
28208 |
|
28209 | return el[matchesSelectorFunc](selector);
|
28210 | }
|
28211 |
|
28212 |
|
28213 | function matchesSelectorAndParentsTo(el /*: Node*/, selector /*: string*/, baseNode /*: Node*/) /*: boolean*/ {
|
28214 | var node = el;
|
28215 | do {
|
28216 | if (matchesSelector(node, selector)) return true;
|
28217 | if (node === baseNode) return false;
|
28218 | node = node.parentNode;
|
28219 | } while (node);
|
28220 |
|
28221 | return false;
|
28222 | }
|
28223 |
|
28224 | function addEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ {
|
28225 | if (!el) {
|
28226 | return;
|
28227 | }
|
28228 | if (el.attachEvent) {
|
28229 | el.attachEvent('on' + event, handler);
|
28230 | } else if (el.addEventListener) {
|
28231 | el.addEventListener(event, handler, true);
|
28232 | } else {
|
28233 |
|
28234 | el['on' + event] = handler;
|
28235 | }
|
28236 | }
|
28237 |
|
28238 | function removeEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ {
|
28239 | if (!el) {
|
28240 | return;
|
28241 | }
|
28242 | if (el.detachEvent) {
|
28243 | el.detachEvent('on' + event, handler);
|
28244 | } else if (el.removeEventListener) {
|
28245 | el.removeEventListener(event, handler, true);
|
28246 | } else {
|
28247 |
|
28248 | el['on' + event] = null;
|
28249 | }
|
28250 | }
|
28251 |
|
28252 | function outerHeight(node /*: HTMLElement*/) /*: number*/ {
|
28253 |
|
28254 |
|
28255 | var height = node.clientHeight;
|
28256 | var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
28257 | height += (0, _shims.int)(computedStyle.borderTopWidth);
|
28258 | height += (0, _shims.int)(computedStyle.borderBottomWidth);
|
28259 | return height;
|
28260 | }
|
28261 |
|
28262 | function outerWidth(node /*: HTMLElement*/) /*: number*/ {
|
28263 |
|
28264 |
|
28265 | var width = node.clientWidth;
|
28266 | var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
28267 | width += (0, _shims.int)(computedStyle.borderLeftWidth);
|
28268 | width += (0, _shims.int)(computedStyle.borderRightWidth);
|
28269 | return width;
|
28270 | }
|
28271 | function innerHeight(node /*: HTMLElement*/) /*: number*/ {
|
28272 | var height = node.clientHeight;
|
28273 | var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
28274 | height -= (0, _shims.int)(computedStyle.paddingTop);
|
28275 | height -= (0, _shims.int)(computedStyle.paddingBottom);
|
28276 | return height;
|
28277 | }
|
28278 |
|
28279 | function innerWidth(node /*: HTMLElement*/) /*: number*/ {
|
28280 | var width = node.clientWidth;
|
28281 | var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
28282 | width -= (0, _shims.int)(computedStyle.paddingLeft);
|
28283 | width -= (0, _shims.int)(computedStyle.paddingRight);
|
28284 | return width;
|
28285 | }
|
28286 |
|
28287 |
|
28288 | function offsetXYFromParent(evt /*: {clientX: number, clientY: number}*/, offsetParent /*: HTMLElement*/) /*: ControlPosition*/ {
|
28289 | var isBody = offsetParent === offsetParent.ownerDocument.body;
|
28290 | var offsetParentRect = isBody ? { left: 0, top: 0 } : offsetParent.getBoundingClientRect();
|
28291 |
|
28292 | var x = evt.clientX + offsetParent.scrollLeft - offsetParentRect.left;
|
28293 | var y = evt.clientY + offsetParent.scrollTop - offsetParentRect.top;
|
28294 |
|
28295 | return { x: x, y: y };
|
28296 | }
|
28297 |
|
28298 | function createCSSTransform(_ref) /*: Object*/ {
|
28299 | var x = _ref.x,
|
28300 | y = _ref.y;
|
28301 |
|
28302 |
|
28303 | return _defineProperty({}, (0, _getPrefix.browserPrefixToKey)('transform', _getPrefix2.default), 'translate(' + x + 'px,' + y + 'px)');
|
28304 | }
|
28305 |
|
28306 | function createSVGTransform(_ref3) /*: string*/ {
|
28307 | var x = _ref3.x,
|
28308 | y = _ref3.y;
|
28309 |
|
28310 | return 'translate(' + x + ',' + y + ')';
|
28311 | }
|
28312 |
|
28313 | function getTouch(e /*: MouseTouchEvent*/, identifier /*: number*/) /*: ?{clientX: number, clientY: number}*/ {
|
28314 | return e.targetTouches && (0, _shims.findInArray)(e.targetTouches, function (t) {
|
28315 | return identifier === t.identifier;
|
28316 | }) || e.changedTouches && (0, _shims.findInArray)(e.changedTouches, function (t) {
|
28317 | return identifier === t.identifier;
|
28318 | });
|
28319 | }
|
28320 |
|
28321 | function getTouchIdentifier(e /*: MouseTouchEvent*/) /*: ?number*/ {
|
28322 | if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier;
|
28323 | if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier;
|
28324 | }
|
28325 |
|
28326 |
|
28327 |
|
28328 |
|
28329 |
|
28330 |
|
28331 | function addUserSelectStyles(doc /*: ?Document*/) {
|
28332 | if (!doc) return;
|
28333 | var styleEl = doc.getElementById('react-draggable-style-el');
|
28334 | if (!styleEl) {
|
28335 | styleEl = doc.createElement('style');
|
28336 | styleEl.type = 'text/css';
|
28337 | styleEl.id = 'react-draggable-style-el';
|
28338 | styleEl.innerHTML = '.react-draggable-transparent-selection *::-moz-selection {background: transparent;}\n';
|
28339 | styleEl.innerHTML += '.react-draggable-transparent-selection *::selection {background: transparent;}\n';
|
28340 | doc.getElementsByTagName('head')[0].appendChild(styleEl);
|
28341 | }
|
28342 | if (doc.body) addClassName(doc.body, 'react-draggable-transparent-selection');
|
28343 | }
|
28344 |
|
28345 | function removeUserSelectStyles(doc /*: ?Document*/) {
|
28346 | try {
|
28347 | if (doc && doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection');
|
28348 | window.getSelection().removeAllRanges();
|
28349 | } catch (e) {
|
28350 |
|
28351 | }
|
28352 | }
|
28353 |
|
28354 | function styleHacks() /*: Object*/ {
|
28355 | var childStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
28356 |
|
28357 |
|
28358 |
|
28359 | return _extends({
|
28360 | touchAction: 'none'
|
28361 | }, childStyle);
|
28362 | }
|
28363 |
|
28364 | function addClassName(el /*: HTMLElement*/, className /*: string*/) {
|
28365 | if (el.classList) {
|
28366 | el.classList.add(className);
|
28367 | } else {
|
28368 | if (!el.className.match(new RegExp('(?:^|\\s)' + className + '(?!\\S)'))) {
|
28369 | el.className += ' ' + className;
|
28370 | }
|
28371 | }
|
28372 | }
|
28373 |
|
28374 | function removeClassName(el /*: HTMLElement*/, className /*: string*/) {
|
28375 | if (el.classList) {
|
28376 | el.classList.remove(className);
|
28377 | } else {
|
28378 | el.className = el.className.replace(new RegExp('(?:^|\\s)' + className + '(?!\\S)', 'g'), '');
|
28379 | }
|
28380 | }
|
28381 |
|
28382 | }),
|
28383 |
|
28384 | (function(module, exports) {
|
28385 |
|
28386 | module.exports = __WEBPACK_EXTERNAL_MODULE_6__;
|
28387 |
|
28388 | }),
|
28389 |
|
28390 | (function(module, exports, __webpack_require__) {
|
28391 |
|
28392 | |
28393 |
|
28394 |
|
28395 |
|
28396 |
|
28397 |
|
28398 |
|
28399 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
28400 | var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
|
28401 | Symbol.for &&
|
28402 | Symbol.for('react.element')) ||
|
28403 | 0xeac7;
|
28404 |
|
28405 | var isValidElement = function(object) {
|
28406 | return typeof object === 'object' &&
|
28407 | object !== null &&
|
28408 | object.$$typeof === REACT_ELEMENT_TYPE;
|
28409 | };
|
28410 |
|
28411 |
|
28412 |
|
28413 | var throwOnDirectAccess = true;
|
28414 | module.exports = __webpack_require__(14)(isValidElement, throwOnDirectAccess);
|
28415 | } else {
|
28416 |
|
28417 |
|
28418 | module.exports = __webpack_require__(17)();
|
28419 | }
|
28420 |
|
28421 |
|
28422 | }),
|
28423 |
|
28424 | (function(module, exports, __webpack_require__) {
|
28425 |
|
28426 | "use strict";
|
28427 | |
28428 |
|
28429 |
|
28430 |
|
28431 |
|
28432 |
|
28433 |
|
28434 |
|
28435 |
|
28436 |
|
28437 | var emptyFunction = __webpack_require__(1);
|
28438 |
|
28439 | |
28440 |
|
28441 |
|
28442 |
|
28443 |
|
28444 |
|
28445 |
|
28446 | var warning = emptyFunction;
|
28447 |
|
28448 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
28449 | var printWarning = function printWarning(format) {
|
28450 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
28451 | args[_key - 1] = arguments[_key];
|
28452 | }
|
28453 |
|
28454 | var argIndex = 0;
|
28455 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
28456 | return args[argIndex++];
|
28457 | });
|
28458 | if (typeof console !== 'undefined') {
|
28459 | console.error(message);
|
28460 | }
|
28461 | try {
|
28462 |
|
28463 |
|
28464 |
|
28465 | throw new Error(message);
|
28466 | } catch (x) {}
|
28467 | };
|
28468 |
|
28469 | warning = function warning(condition, format) {
|
28470 | if (format === undefined) {
|
28471 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
28472 | }
|
28473 |
|
28474 | if (format.indexOf('Failed Composite propType: ') === 0) {
|
28475 | return;
|
28476 | }
|
28477 |
|
28478 | if (!condition) {
|
28479 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
28480 | args[_key2 - 2] = arguments[_key2];
|
28481 | }
|
28482 |
|
28483 | printWarning.apply(undefined, [format].concat(args));
|
28484 | }
|
28485 | };
|
28486 | }
|
28487 |
|
28488 | module.exports = warning;
|
28489 |
|
28490 | }),
|
28491 |
|
28492 | (function(module, exports, __webpack_require__) {
|
28493 |
|
28494 | "use strict";
|
28495 |
|
28496 |
|
28497 | Object.defineProperty(exports, "__esModule", {
|
28498 | value: true
|
28499 | });
|
28500 | exports.getBoundPosition = getBoundPosition;
|
28501 | exports.snapToGrid = snapToGrid;
|
28502 | exports.canDragX = canDragX;
|
28503 | exports.canDragY = canDragY;
|
28504 | exports.getControlPosition = getControlPosition;
|
28505 | exports.createCoreData = createCoreData;
|
28506 | exports.createDraggableData = createDraggableData;
|
28507 |
|
28508 | var _shims = __webpack_require__(0);
|
28509 |
|
28510 | var _reactDom = __webpack_require__(4);
|
28511 |
|
28512 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
28513 |
|
28514 | var _domFns = __webpack_require__(5);
|
28515 |
|
28516 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
28517 |
|
28518 |
|
28519 |
|
28520 |
|
28521 | function getBoundPosition(draggable /*: Draggable*/, x /*: number*/, y /*: number*/) /*: [number, number]*/ {
|
28522 |
|
28523 | if (!draggable.props.bounds) return [x, y];
|
28524 |
|
28525 |
|
28526 | var bounds = draggable.props.bounds;
|
28527 |
|
28528 | bounds = typeof bounds === 'string' ? bounds : cloneBounds(bounds);
|
28529 | var node = findDOMNode(draggable);
|
28530 |
|
28531 | if (typeof bounds === 'string') {
|
28532 | var ownerDocument = node.ownerDocument;
|
28533 |
|
28534 | var ownerWindow = ownerDocument.defaultView;
|
28535 | var boundNode = void 0;
|
28536 | if (bounds === 'parent') {
|
28537 | boundNode = node.parentNode;
|
28538 | } else {
|
28539 | boundNode = ownerDocument.querySelector(bounds);
|
28540 | }
|
28541 | if (!(boundNode instanceof HTMLElement)) {
|
28542 | throw new Error('Bounds selector "' + bounds + '" could not find an element.');
|
28543 | }
|
28544 | var nodeStyle = ownerWindow.getComputedStyle(node);
|
28545 | var boundNodeStyle = ownerWindow.getComputedStyle(boundNode);
|
28546 |
|
28547 | bounds = {
|
28548 | left: -node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingLeft) + (0, _shims.int)(nodeStyle.marginLeft),
|
28549 | top: -node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingTop) + (0, _shims.int)(nodeStyle.marginTop),
|
28550 | right: (0, _domFns.innerWidth)(boundNode) - (0, _domFns.outerWidth)(node) - node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingRight) - (0, _shims.int)(nodeStyle.marginRight),
|
28551 | bottom: (0, _domFns.innerHeight)(boundNode) - (0, _domFns.outerHeight)(node) - node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingBottom) - (0, _shims.int)(nodeStyle.marginBottom)
|
28552 | };
|
28553 | }
|
28554 |
|
28555 |
|
28556 | if ((0, _shims.isNum)(bounds.right)) x = Math.min(x, bounds.right);
|
28557 | if ((0, _shims.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom);
|
28558 |
|
28559 |
|
28560 | if ((0, _shims.isNum)(bounds.left)) x = Math.max(x, bounds.left);
|
28561 | if ((0, _shims.isNum)(bounds.top)) y = Math.max(y, bounds.top);
|
28562 |
|
28563 | return [x, y];
|
28564 | }
|
28565 |
|
28566 | function snapToGrid(grid /*: [number, number]*/, pendingX /*: number*/, pendingY /*: number*/) /*: [number, number]*/ {
|
28567 | var x = Math.round(pendingX / grid[0]) * grid[0];
|
28568 | var y = Math.round(pendingY / grid[1]) * grid[1];
|
28569 | return [x, y];
|
28570 | }
|
28571 |
|
28572 | function canDragX(draggable /*: Draggable*/) /*: boolean*/ {
|
28573 | return draggable.props.axis === 'both' || draggable.props.axis === 'x';
|
28574 | }
|
28575 |
|
28576 | function canDragY(draggable /*: Draggable*/) /*: boolean*/ {
|
28577 | return draggable.props.axis === 'both' || draggable.props.axis === 'y';
|
28578 | }
|
28579 |
|
28580 |
|
28581 | function getControlPosition(e /*: MouseTouchEvent*/, touchIdentifier /*: ?number*/, draggableCore /*: DraggableCore*/) /*: ?ControlPosition*/ {
|
28582 | var touchObj = typeof touchIdentifier === 'number' ? (0, _domFns.getTouch)(e, touchIdentifier) : null;
|
28583 | if (typeof touchIdentifier === 'number' && !touchObj) return null;
|
28584 | var node = findDOMNode(draggableCore);
|
28585 |
|
28586 | var offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;
|
28587 | return (0, _domFns.offsetXYFromParent)(touchObj || e, offsetParent);
|
28588 | }
|
28589 |
|
28590 |
|
28591 | function createCoreData(draggable /*: DraggableCore*/, x /*: number*/, y /*: number*/) /*: DraggableData*/ {
|
28592 | var state = draggable.state;
|
28593 | var isStart = !(0, _shims.isNum)(state.lastX);
|
28594 | var node = findDOMNode(draggable);
|
28595 |
|
28596 | if (isStart) {
|
28597 |
|
28598 | return {
|
28599 | node: node,
|
28600 | deltaX: 0, deltaY: 0,
|
28601 | lastX: x, lastY: y,
|
28602 | x: x, y: y
|
28603 | };
|
28604 | } else {
|
28605 |
|
28606 | return {
|
28607 | node: node,
|
28608 | deltaX: x - state.lastX, deltaY: y - state.lastY,
|
28609 | lastX: state.lastX, lastY: state.lastY,
|
28610 | x: x, y: y
|
28611 | };
|
28612 | }
|
28613 | }
|
28614 |
|
28615 |
|
28616 | function createDraggableData(draggable /*: Draggable*/, coreData /*: DraggableData*/) /*: DraggableData*/ {
|
28617 | return {
|
28618 | node: coreData.node,
|
28619 | x: draggable.state.x + coreData.deltaX,
|
28620 | y: draggable.state.y + coreData.deltaY,
|
28621 | deltaX: coreData.deltaX,
|
28622 | deltaY: coreData.deltaY,
|
28623 | lastX: draggable.state.x,
|
28624 | lastY: draggable.state.y
|
28625 | };
|
28626 | }
|
28627 |
|
28628 |
|
28629 | function cloneBounds(bounds /*: Bounds*/) /*: Bounds*/ {
|
28630 | return {
|
28631 | left: bounds.left,
|
28632 | top: bounds.top,
|
28633 | right: bounds.right,
|
28634 | bottom: bounds.bottom
|
28635 | };
|
28636 | }
|
28637 |
|
28638 | function findDOMNode(draggable /*: Draggable | DraggableCore*/) /*: HTMLElement*/ {
|
28639 | var node = _reactDom2.default.findDOMNode(draggable);
|
28640 | if (!node) {
|
28641 | throw new Error('<DraggableCore>: Unmounted during event!');
|
28642 | }
|
28643 |
|
28644 | return node;
|
28645 | }
|
28646 |
|
28647 | }),
|
28648 |
|
28649 | (function(module, exports, __webpack_require__) {
|
28650 |
|
28651 | "use strict";
|
28652 | (function(process) {
|
28653 |
|
28654 | Object.defineProperty(exports, "__esModule", {
|
28655 | value: true
|
28656 | });
|
28657 |
|
28658 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
28659 |
|
28660 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
28661 |
|
28662 | var _react = __webpack_require__(6);
|
28663 |
|
28664 | var _react2 = _interopRequireDefault(_react);
|
28665 |
|
28666 | var _propTypes = __webpack_require__(7);
|
28667 |
|
28668 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
28669 |
|
28670 | var _reactDom = __webpack_require__(4);
|
28671 |
|
28672 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
28673 |
|
28674 | var _domFns = __webpack_require__(5);
|
28675 |
|
28676 | var _positionFns = __webpack_require__(9);
|
28677 |
|
28678 | var _shims = __webpack_require__(0);
|
28679 |
|
28680 | var _log = __webpack_require__(11);
|
28681 |
|
28682 | var _log2 = _interopRequireDefault(_log);
|
28683 |
|
28684 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
28685 |
|
28686 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
28687 |
|
28688 | 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; }
|
28689 |
|
28690 | 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; }
|
28691 |
|
28692 |
|
28693 |
|
28694 |
|
28695 |
|
28696 |
|
28697 | var eventsFor = {
|
28698 | touch: {
|
28699 | start: 'touchstart',
|
28700 | move: 'touchmove',
|
28701 | stop: 'touchend'
|
28702 | },
|
28703 | mouse: {
|
28704 | start: 'mousedown',
|
28705 | move: 'mousemove',
|
28706 | stop: 'mouseup'
|
28707 | }
|
28708 | };
|
28709 |
|
28710 |
|
28711 | var dragEventFor = eventsFor.mouse;
|
28712 |
|
28713 | |
28714 |
|
28715 |
|
28716 |
|
28717 |
|
28718 |
|
28719 | |
28720 |
|
28721 |
|
28722 |
|
28723 |
|
28724 |
|
28725 | |
28726 |
|
28727 |
|
28728 |
|
28729 |
|
28730 |
|
28731 |
|
28732 |
|
28733 |
|
28734 |
|
28735 |
|
28736 |
|
28737 |
|
28738 |
|
28739 |
|
28740 |
|
28741 |
|
28742 | |
28743 |
|
28744 |
|
28745 |
|
28746 |
|
28747 |
|
28748 |
|
28749 |
|
28750 |
|
28751 |
|
28752 |
|
28753 |
|
28754 |
|
28755 |
|
28756 |
|
28757 | var DraggableCore = function (_React$Component) {
|
28758 | _inherits(DraggableCore, _React$Component);
|
28759 |
|
28760 | function DraggableCore() {
|
28761 | var _ref;
|
28762 |
|
28763 | var _temp, _this, _ret;
|
28764 |
|
28765 | _classCallCheck(this, DraggableCore);
|
28766 |
|
28767 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
28768 | args[_key] = arguments[_key];
|
28769 | }
|
28770 |
|
28771 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = DraggableCore.__proto__ || Object.getPrototypeOf(DraggableCore)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
28772 | dragging: false,
|
28773 |
|
28774 | lastX: NaN, lastY: NaN,
|
28775 | touchIdentifier: null
|
28776 | }, _this.handleDragStart = function (e) {
|
28777 |
|
28778 | _this.props.onMouseDown(e);
|
28779 |
|
28780 |
|
28781 | if (!_this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false;
|
28782 |
|
28783 |
|
28784 | var thisNode = _reactDom2.default.findDOMNode(_this);
|
28785 | if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) {
|
28786 | throw new Error('<DraggableCore> not mounted on DragStart!');
|
28787 | }
|
28788 | var ownerDocument = thisNode.ownerDocument;
|
28789 |
|
28790 |
|
28791 |
|
28792 | if (_this.props.disabled || !(e.target instanceof ownerDocument.defaultView.Node) || _this.props.handle && !(0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.handle, thisNode) || _this.props.cancel && (0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.cancel, thisNode)) {
|
28793 | return;
|
28794 | }
|
28795 |
|
28796 |
|
28797 |
|
28798 |
|
28799 | var touchIdentifier = (0, _domFns.getTouchIdentifier)(e);
|
28800 | _this.setState({ touchIdentifier: touchIdentifier });
|
28801 |
|
28802 |
|
28803 | var position = (0, _positionFns.getControlPosition)(e, touchIdentifier, _this);
|
28804 | if (position == null) return;
|
28805 | var x = position.x,
|
28806 | y = position.y;
|
28807 |
|
28808 |
|
28809 |
|
28810 | var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
|
28811 |
|
28812 | (0, _log2.default)('DraggableCore: handleDragStart: %j', coreEvent);
|
28813 |
|
28814 |
|
28815 | (0, _log2.default)('calling', _this.props.onStart);
|
28816 | var shouldUpdate = _this.props.onStart(e, coreEvent);
|
28817 | if (shouldUpdate === false) return;
|
28818 |
|
28819 |
|
28820 |
|
28821 | if (_this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)(ownerDocument);
|
28822 |
|
28823 |
|
28824 |
|
28825 |
|
28826 | _this.setState({
|
28827 | dragging: true,
|
28828 |
|
28829 | lastX: x,
|
28830 | lastY: y
|
28831 | });
|
28832 |
|
28833 |
|
28834 |
|
28835 |
|
28836 | (0, _domFns.addEvent)(ownerDocument, dragEventFor.move, _this.handleDrag);
|
28837 | (0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, _this.handleDragStop);
|
28838 | }, _this.handleDrag = function (e) {
|
28839 |
|
28840 |
|
28841 | if (e.type === 'touchmove') e.preventDefault();
|
28842 |
|
28843 |
|
28844 | var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _this);
|
28845 | if (position == null) return;
|
28846 | var x = position.x,
|
28847 | y = position.y;
|
28848 |
|
28849 |
|
28850 |
|
28851 | if (Array.isArray(_this.props.grid)) {
|
28852 | var _deltaX = x - _this.state.lastX,
|
28853 | _deltaY = y - _this.state.lastY;
|
28854 |
|
28855 | var _snapToGrid = (0, _positionFns.snapToGrid)(_this.props.grid, _deltaX, _deltaY);
|
28856 |
|
28857 | var _snapToGrid2 = _slicedToArray(_snapToGrid, 2);
|
28858 |
|
28859 | _deltaX = _snapToGrid2[0];
|
28860 | _deltaY = _snapToGrid2[1];
|
28861 |
|
28862 | if (!_deltaX && !_deltaY) return;
|
28863 | x = _this.state.lastX + _deltaX, y = _this.state.lastY + _deltaY;
|
28864 | }
|
28865 |
|
28866 | var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
|
28867 |
|
28868 | (0, _log2.default)('DraggableCore: handleDrag: %j', coreEvent);
|
28869 |
|
28870 |
|
28871 | var shouldUpdate = _this.props.onDrag(e, coreEvent);
|
28872 | if (shouldUpdate === false) {
|
28873 | try {
|
28874 |
|
28875 | _this.handleDragStop(new MouseEvent('mouseup'));
|
28876 | } catch (err) {
|
28877 |
|
28878 | var event = ((document.createEvent('MouseEvents') ) );
|
28879 |
|
28880 |
|
28881 | event.initMouseEvent('mouseup', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
28882 | _this.handleDragStop(event);
|
28883 | }
|
28884 | return;
|
28885 | }
|
28886 |
|
28887 | _this.setState({
|
28888 | lastX: x,
|
28889 | lastY: y
|
28890 | });
|
28891 | }, _this.handleDragStop = function (e) {
|
28892 | if (!_this.state.dragging) return;
|
28893 |
|
28894 | var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _this);
|
28895 | if (position == null) return;
|
28896 | var x = position.x,
|
28897 | y = position.y;
|
28898 |
|
28899 | var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
|
28900 |
|
28901 | var thisNode = _reactDom2.default.findDOMNode(_this);
|
28902 | if (thisNode) {
|
28903 |
|
28904 | if (_this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(thisNode.ownerDocument);
|
28905 | }
|
28906 |
|
28907 | (0, _log2.default)('DraggableCore: handleDragStop: %j', coreEvent);
|
28908 |
|
28909 |
|
28910 | _this.setState({
|
28911 | dragging: false,
|
28912 | lastX: NaN,
|
28913 | lastY: NaN
|
28914 | });
|
28915 |
|
28916 |
|
28917 | _this.props.onStop(e, coreEvent);
|
28918 |
|
28919 | if (thisNode) {
|
28920 |
|
28921 | (0, _log2.default)('DraggableCore: Removing handlers');
|
28922 | (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.move, _this.handleDrag);
|
28923 | (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.stop, _this.handleDragStop);
|
28924 | }
|
28925 | }, _this.onMouseDown = function (e) {
|
28926 | dragEventFor = eventsFor.mouse;
|
28927 |
|
28928 | return _this.handleDragStart(e);
|
28929 | }, _this.onMouseUp = function (e) {
|
28930 | dragEventFor = eventsFor.mouse;
|
28931 |
|
28932 | return _this.handleDragStop(e);
|
28933 | }, _this.onTouchStart = function (e) {
|
28934 |
|
28935 | dragEventFor = eventsFor.touch;
|
28936 |
|
28937 | return _this.handleDragStart(e);
|
28938 | }, _this.onTouchEnd = function (e) {
|
28939 |
|
28940 | dragEventFor = eventsFor.touch;
|
28941 |
|
28942 | return _this.handleDragStop(e);
|
28943 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
28944 | }
|
28945 |
|
28946 | _createClass(DraggableCore, [{
|
28947 | key: 'componentWillUnmount',
|
28948 | value: function componentWillUnmount() {
|
28949 |
|
28950 |
|
28951 | var thisNode = _reactDom2.default.findDOMNode(this);
|
28952 | if (thisNode) {
|
28953 | var ownerDocument = thisNode.ownerDocument;
|
28954 |
|
28955 | (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag);
|
28956 | (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag);
|
28957 | (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
|
28958 | (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
|
28959 | if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument);
|
28960 | }
|
28961 | }
|
28962 |
|
28963 |
|
28964 |
|
28965 | }, {
|
28966 | key: 'render',
|
28967 | value: function render() {
|
28968 |
|
28969 |
|
28970 | return _react2.default.cloneElement(_react2.default.Children.only(this.props.children), {
|
28971 | style: (0, _domFns.styleHacks)(this.props.children.props.style),
|
28972 |
|
28973 |
|
28974 |
|
28975 | onMouseDown: this.onMouseDown,
|
28976 | onTouchStart: this.onTouchStart,
|
28977 | onMouseUp: this.onMouseUp,
|
28978 | onTouchEnd: this.onTouchEnd
|
28979 | });
|
28980 | }
|
28981 | }]);
|
28982 |
|
28983 | return DraggableCore;
|
28984 | }(_react2.default.Component);
|
28985 |
|
28986 | DraggableCore.displayName = 'DraggableCore';
|
28987 | DraggableCore.propTypes = {
|
28988 | |
28989 |
|
28990 |
|
28991 |
|
28992 |
|
28993 |
|
28994 | allowAnyClick: _propTypes2.default.bool,
|
28995 |
|
28996 | |
28997 |
|
28998 |
|
28999 |
|
29000 | disabled: _propTypes2.default.bool,
|
29001 |
|
29002 | |
29003 |
|
29004 |
|
29005 |
|
29006 |
|
29007 | enableUserSelectHack: _propTypes2.default.bool,
|
29008 |
|
29009 | |
29010 |
|
29011 |
|
29012 |
|
29013 | offsetParent: function offsetParent(props /*: DraggableCoreProps*/, propName /*: $Keys<DraggableCoreProps>*/) {
|
29014 | if (process.browser === true && props[propName] && props[propName].nodeType !== 1) {
|
29015 | throw new Error('Draggable\'s offsetParent must be a DOM Node.');
|
29016 | }
|
29017 | },
|
29018 |
|
29019 | |
29020 |
|
29021 |
|
29022 | grid: _propTypes2.default.arrayOf(_propTypes2.default.number),
|
29023 |
|
29024 | |
29025 |
|
29026 |
|
29027 |
|
29028 |
|
29029 |
|
29030 |
|
29031 |
|
29032 |
|
29033 |
|
29034 |
|
29035 |
|
29036 |
|
29037 |
|
29038 |
|
29039 |
|
29040 |
|
29041 |
|
29042 |
|
29043 |
|
29044 | handle: _propTypes2.default.string,
|
29045 |
|
29046 | |
29047 |
|
29048 |
|
29049 |
|
29050 |
|
29051 |
|
29052 |
|
29053 |
|
29054 |
|
29055 |
|
29056 |
|
29057 |
|
29058 |
|
29059 |
|
29060 |
|
29061 |
|
29062 |
|
29063 |
|
29064 |
|
29065 |
|
29066 | cancel: _propTypes2.default.string,
|
29067 |
|
29068 | |
29069 |
|
29070 |
|
29071 |
|
29072 | onStart: _propTypes2.default.func,
|
29073 |
|
29074 | |
29075 |
|
29076 |
|
29077 |
|
29078 | onDrag: _propTypes2.default.func,
|
29079 |
|
29080 | |
29081 |
|
29082 |
|
29083 |
|
29084 | onStop: _propTypes2.default.func,
|
29085 |
|
29086 | |
29087 |
|
29088 |
|
29089 |
|
29090 | onMouseDown: _propTypes2.default.func,
|
29091 |
|
29092 | |
29093 |
|
29094 |
|
29095 | className: _shims.dontSetMe,
|
29096 | style: _shims.dontSetMe,
|
29097 | transform: _shims.dontSetMe
|
29098 | };
|
29099 | DraggableCore.defaultProps = {
|
29100 | allowAnyClick: false,
|
29101 | cancel: null,
|
29102 | disabled: false,
|
29103 | enableUserSelectHack: true,
|
29104 | offsetParent: null,
|
29105 | handle: null,
|
29106 | grid: null,
|
29107 | transform: null,
|
29108 | onStart: function onStart() {},
|
29109 | onDrag: function onDrag() {},
|
29110 | onStop: function onStop() {},
|
29111 | onMouseDown: function onMouseDown() {}
|
29112 | };
|
29113 | exports.default = DraggableCore;
|
29114 | }.call(exports, __webpack_require__(20)))
|
29115 |
|
29116 | }),
|
29117 |
|
29118 | (function(module, exports, __webpack_require__) {
|
29119 |
|
29120 | "use strict";
|
29121 |
|
29122 |
|
29123 | Object.defineProperty(exports, "__esModule", {
|
29124 | value: true
|
29125 | });
|
29126 | exports.default = log;
|
29127 |
|
29128 |
|
29129 | function log() {
|
29130 | var _console;
|
29131 |
|
29132 | if (undefined) (_console = console).log.apply(_console, arguments);
|
29133 | }
|
29134 |
|
29135 | }),
|
29136 |
|
29137 | (function(module, exports, __webpack_require__) {
|
29138 |
|
29139 | "use strict";
|
29140 |
|
29141 |
|
29142 | var Draggable = __webpack_require__(13).default;
|
29143 |
|
29144 |
|
29145 |
|
29146 |
|
29147 |
|
29148 | module.exports = Draggable;
|
29149 | module.exports.default = Draggable;
|
29150 | module.exports.DraggableCore = __webpack_require__(10).default;
|
29151 |
|
29152 | }),
|
29153 |
|
29154 | (function(module, exports, __webpack_require__) {
|
29155 |
|
29156 | "use strict";
|
29157 |
|
29158 |
|
29159 | Object.defineProperty(exports, "__esModule", {
|
29160 | value: true
|
29161 | });
|
29162 |
|
29163 | 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; };
|
29164 |
|
29165 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
29166 |
|
29167 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
29168 |
|
29169 | var _react = __webpack_require__(6);
|
29170 |
|
29171 | var _react2 = _interopRequireDefault(_react);
|
29172 |
|
29173 | var _propTypes = __webpack_require__(7);
|
29174 |
|
29175 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
29176 |
|
29177 | var _reactDom = __webpack_require__(4);
|
29178 |
|
29179 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
29180 |
|
29181 | var _classnames = __webpack_require__(18);
|
29182 |
|
29183 | var _classnames2 = _interopRequireDefault(_classnames);
|
29184 |
|
29185 | var _domFns = __webpack_require__(5);
|
29186 |
|
29187 | var _positionFns = __webpack_require__(9);
|
29188 |
|
29189 | var _shims = __webpack_require__(0);
|
29190 |
|
29191 | var _DraggableCore = __webpack_require__(10);
|
29192 |
|
29193 | var _DraggableCore2 = _interopRequireDefault(_DraggableCore);
|
29194 |
|
29195 | var _log = __webpack_require__(11);
|
29196 |
|
29197 | var _log2 = _interopRequireDefault(_log);
|
29198 |
|
29199 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29200 |
|
29201 | 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; }
|
29202 |
|
29203 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
29204 |
|
29205 | 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; }
|
29206 |
|
29207 | 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; }
|
29208 |
|
29209 |
|
29210 |
|
29211 |
|
29212 | |
29213 |
|
29214 |
|
29215 |
|
29216 |
|
29217 |
|
29218 |
|
29219 |
|
29220 |
|
29221 |
|
29222 |
|
29223 |
|
29224 |
|
29225 | |
29226 |
|
29227 |
|
29228 |
|
29229 |
|
29230 |
|
29231 |
|
29232 |
|
29233 |
|
29234 |
|
29235 |
|
29236 | var Draggable = function (_React$Component) {
|
29237 | _inherits(Draggable, _React$Component);
|
29238 |
|
29239 | function Draggable(props /*: DraggableProps*/) {
|
29240 | _classCallCheck(this, Draggable);
|
29241 |
|
29242 | var _this = _possibleConstructorReturn(this, (Draggable.__proto__ || Object.getPrototypeOf(Draggable)).call(this, props));
|
29243 |
|
29244 | _this.onDragStart = function (e, coreData) {
|
29245 | (0, _log2.default)('Draggable: onDragStart: %j', coreData);
|
29246 |
|
29247 |
|
29248 | var shouldStart = _this.props.onStart(e, (0, _positionFns.createDraggableData)(_this, coreData));
|
29249 |
|
29250 | if (shouldStart === false) return false;
|
29251 |
|
29252 | _this.setState({ dragging: true, dragged: true });
|
29253 | };
|
29254 |
|
29255 | _this.onDrag = function (e, coreData) {
|
29256 | if (!_this.state.dragging) return false;
|
29257 | (0, _log2.default)('Draggable: onDrag: %j', coreData);
|
29258 |
|
29259 | var uiData = (0, _positionFns.createDraggableData)(_this, coreData);
|
29260 |
|
29261 | var newState = {
|
29262 | x: uiData.x,
|
29263 | y: uiData.y
|
29264 | };
|
29265 |
|
29266 |
|
29267 | if (_this.props.bounds) {
|
29268 |
|
29269 | var _x = newState.x,
|
29270 | _y = newState.y;
|
29271 |
|
29272 |
|
29273 |
|
29274 |
|
29275 |
|
29276 | newState.x += _this.state.slackX;
|
29277 | newState.y += _this.state.slackY;
|
29278 |
|
29279 |
|
29280 |
|
29281 | var _getBoundPosition = (0, _positionFns.getBoundPosition)(_this, newState.x, newState.y),
|
29282 | _getBoundPosition2 = _slicedToArray(_getBoundPosition, 2),
|
29283 | newStateX = _getBoundPosition2[0],
|
29284 | newStateY = _getBoundPosition2[1];
|
29285 |
|
29286 | newState.x = newStateX;
|
29287 | newState.y = newStateY;
|
29288 |
|
29289 |
|
29290 | newState.slackX = _this.state.slackX + (_x - newState.x);
|
29291 | newState.slackY = _this.state.slackY + (_y - newState.y);
|
29292 |
|
29293 |
|
29294 | uiData.x = newState.x;
|
29295 | uiData.y = newState.y;
|
29296 | uiData.deltaX = newState.x - _this.state.x;
|
29297 | uiData.deltaY = newState.y - _this.state.y;
|
29298 | }
|
29299 |
|
29300 |
|
29301 | var shouldUpdate = _this.props.onDrag(e, uiData);
|
29302 | if (shouldUpdate === false) return false;
|
29303 |
|
29304 | _this.setState(newState);
|
29305 | };
|
29306 |
|
29307 | _this.onDragStop = function (e, coreData) {
|
29308 | if (!_this.state.dragging) return false;
|
29309 |
|
29310 |
|
29311 | var shouldStop = _this.props.onStop(e, (0, _positionFns.createDraggableData)(_this, coreData));
|
29312 | if (shouldStop === false) return false;
|
29313 |
|
29314 | (0, _log2.default)('Draggable: onDragStop: %j', coreData);
|
29315 |
|
29316 | var newState = {
|
29317 | dragging: false,
|
29318 | slackX: 0,
|
29319 | slackY: 0
|
29320 | };
|
29321 |
|
29322 |
|
29323 |
|
29324 | var controlled = Boolean(_this.props.position);
|
29325 | if (controlled) {
|
29326 | var _this$props$position = _this.props.position,
|
29327 | _x2 = _this$props$position.x,
|
29328 | _y2 = _this$props$position.y;
|
29329 |
|
29330 | newState.x = _x2;
|
29331 | newState.y = _y2;
|
29332 | }
|
29333 |
|
29334 | _this.setState(newState);
|
29335 | };
|
29336 |
|
29337 | _this.state = {
|
29338 |
|
29339 | dragging: false,
|
29340 |
|
29341 |
|
29342 | dragged: false,
|
29343 |
|
29344 |
|
29345 | x: props.position ? props.position.x : props.defaultPosition.x,
|
29346 | y: props.position ? props.position.y : props.defaultPosition.y,
|
29347 |
|
29348 |
|
29349 | slackX: 0, slackY: 0,
|
29350 |
|
29351 |
|
29352 | isElementSVG: false
|
29353 | };
|
29354 | return _this;
|
29355 | }
|
29356 |
|
29357 | _createClass(Draggable, [{
|
29358 | key: 'componentWillMount',
|
29359 | value: function componentWillMount() {
|
29360 | if (this.props.position && !(this.props.onDrag || this.props.onStop)) {
|
29361 |
|
29362 | console.warn('A `position` was applied to this <Draggable>, without drag handlers. This will make this ' + 'component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the ' + '`position` of this element.');
|
29363 | }
|
29364 | }
|
29365 | }, {
|
29366 | key: 'componentDidMount',
|
29367 | value: function componentDidMount() {
|
29368 |
|
29369 | if (typeof window.SVGElement !== 'undefined' && _reactDom2.default.findDOMNode(this) instanceof window.SVGElement) {
|
29370 | this.setState({ isElementSVG: true });
|
29371 | }
|
29372 | }
|
29373 | }, {
|
29374 | key: 'componentWillReceiveProps',
|
29375 | value: function componentWillReceiveProps(nextProps /*: Object*/) {
|
29376 |
|
29377 | if (nextProps.position && (!this.props.position || nextProps.position.x !== this.props.position.x || nextProps.position.y !== this.props.position.y)) {
|
29378 | this.setState({ x: nextProps.position.x, y: nextProps.position.y });
|
29379 | }
|
29380 | }
|
29381 | }, {
|
29382 | key: 'componentWillUnmount',
|
29383 | value: function componentWillUnmount() {
|
29384 | this.setState({ dragging: false });
|
29385 | }
|
29386 | }, {
|
29387 | key: 'render',
|
29388 | value: function render() /*: ReactElement<any>*/ {
|
29389 | var _classNames;
|
29390 |
|
29391 | var style = {},
|
29392 | svgTransform = null;
|
29393 |
|
29394 |
|
29395 | var controlled = Boolean(this.props.position);
|
29396 | var draggable = !controlled || this.state.dragging;
|
29397 |
|
29398 | var position = this.props.position || this.props.defaultPosition;
|
29399 | var transformOpts = {
|
29400 |
|
29401 | x: (0, _positionFns.canDragX)(this) && draggable ? this.state.x : position.x,
|
29402 |
|
29403 |
|
29404 | y: (0, _positionFns.canDragY)(this) && draggable ? this.state.y : position.y
|
29405 | };
|
29406 |
|
29407 |
|
29408 | if (this.state.isElementSVG) {
|
29409 | svgTransform = (0, _domFns.createSVGTransform)(transformOpts);
|
29410 | } else {
|
29411 |
|
29412 |
|
29413 |
|
29414 |
|
29415 | style = (0, _domFns.createCSSTransform)(transformOpts);
|
29416 | }
|
29417 |
|
29418 | var _props = this.props,
|
29419 | defaultClassName = _props.defaultClassName,
|
29420 | defaultClassNameDragging = _props.defaultClassNameDragging,
|
29421 | defaultClassNameDragged = _props.defaultClassNameDragged;
|
29422 |
|
29423 |
|
29424 | var children = _react2.default.Children.only(this.props.children);
|
29425 |
|
29426 |
|
29427 | var className = (0, _classnames2.default)(children.props.className || '', defaultClassName, (_classNames = {}, _defineProperty(_classNames, defaultClassNameDragging, this.state.dragging), _defineProperty(_classNames, defaultClassNameDragged, this.state.dragged), _classNames));
|
29428 |
|
29429 |
|
29430 |
|
29431 | return _react2.default.createElement(
|
29432 | _DraggableCore2.default,
|
29433 | _extends({}, this.props, { onStart: this.onDragStart, onDrag: this.onDrag, onStop: this.onDragStop }),
|
29434 | _react2.default.cloneElement(children, {
|
29435 | className: className,
|
29436 | style: _extends({}, children.props.style, style),
|
29437 | transform: svgTransform
|
29438 | })
|
29439 | );
|
29440 | }
|
29441 | }]);
|
29442 |
|
29443 | return Draggable;
|
29444 | }(_react2.default.Component);
|
29445 |
|
29446 | Draggable.displayName = 'Draggable';
|
29447 | Draggable.propTypes = _extends({}, _DraggableCore2.default.propTypes, {
|
29448 |
|
29449 | |
29450 |
|
29451 |
|
29452 |
|
29453 |
|
29454 |
|
29455 |
|
29456 |
|
29457 |
|
29458 |
|
29459 |
|
29460 |
|
29461 |
|
29462 | axis: _propTypes2.default.oneOf(['both', 'x', 'y', 'none']),
|
29463 |
|
29464 | |
29465 |
|
29466 |
|
29467 |
|
29468 |
|
29469 |
|
29470 |
|
29471 |
|
29472 |
|
29473 |
|
29474 |
|
29475 |
|
29476 |
|
29477 |
|
29478 |
|
29479 |
|
29480 |
|
29481 |
|
29482 |
|
29483 |
|
29484 |
|
29485 |
|
29486 |
|
29487 |
|
29488 |
|
29489 |
|
29490 | bounds: _propTypes2.default.oneOfType([_propTypes2.default.shape({
|
29491 | left: _propTypes2.default.number,
|
29492 | right: _propTypes2.default.number,
|
29493 | top: _propTypes2.default.number,
|
29494 | bottom: _propTypes2.default.number
|
29495 | }), _propTypes2.default.string, _propTypes2.default.oneOf([false])]),
|
29496 |
|
29497 | defaultClassName: _propTypes2.default.string,
|
29498 | defaultClassNameDragging: _propTypes2.default.string,
|
29499 | defaultClassNameDragged: _propTypes2.default.string,
|
29500 |
|
29501 | |
29502 |
|
29503 |
|
29504 |
|
29505 |
|
29506 |
|
29507 |
|
29508 |
|
29509 |
|
29510 |
|
29511 |
|
29512 |
|
29513 |
|
29514 |
|
29515 |
|
29516 |
|
29517 |
|
29518 | defaultPosition: _propTypes2.default.shape({
|
29519 | x: _propTypes2.default.number,
|
29520 | y: _propTypes2.default.number
|
29521 | }),
|
29522 |
|
29523 | |
29524 |
|
29525 |
|
29526 |
|
29527 |
|
29528 |
|
29529 |
|
29530 |
|
29531 |
|
29532 |
|
29533 |
|
29534 |
|
29535 |
|
29536 |
|
29537 |
|
29538 |
|
29539 |
|
29540 |
|
29541 |
|
29542 |
|
29543 | position: _propTypes2.default.shape({
|
29544 | x: _propTypes2.default.number,
|
29545 | y: _propTypes2.default.number
|
29546 | }),
|
29547 |
|
29548 | |
29549 |
|
29550 |
|
29551 | className: _shims.dontSetMe,
|
29552 | style: _shims.dontSetMe,
|
29553 | transform: _shims.dontSetMe
|
29554 | });
|
29555 | Draggable.defaultProps = _extends({}, _DraggableCore2.default.defaultProps, {
|
29556 | axis: 'both',
|
29557 | bounds: false,
|
29558 | defaultClassName: 'react-draggable',
|
29559 | defaultClassNameDragging: 'react-draggable-dragging',
|
29560 | defaultClassNameDragged: 'react-draggable-dragged',
|
29561 | defaultPosition: { x: 0, y: 0 },
|
29562 | position: null
|
29563 | });
|
29564 | exports.default = Draggable;
|
29565 |
|
29566 | }),
|
29567 |
|
29568 | (function(module, exports, __webpack_require__) {
|
29569 |
|
29570 | "use strict";
|
29571 | |
29572 |
|
29573 |
|
29574 |
|
29575 |
|
29576 |
|
29577 |
|
29578 |
|
29579 |
|
29580 | var emptyFunction = __webpack_require__(1);
|
29581 | var invariant = __webpack_require__(2);
|
29582 | var warning = __webpack_require__(8);
|
29583 | var assign = __webpack_require__(15);
|
29584 |
|
29585 | var ReactPropTypesSecret = __webpack_require__(3);
|
29586 | var checkPropTypes = __webpack_require__(16);
|
29587 |
|
29588 | module.exports = function(isValidElement, throwOnDirectAccess) {
|
29589 |
|
29590 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
29591 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
29592 |
|
29593 | |
29594 |
|
29595 |
|
29596 |
|
29597 |
|
29598 |
|
29599 |
|
29600 |
|
29601 |
|
29602 |
|
29603 |
|
29604 |
|
29605 |
|
29606 |
|
29607 | function getIteratorFn(maybeIterable) {
|
29608 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
29609 | if (typeof iteratorFn === 'function') {
|
29610 | return iteratorFn;
|
29611 | }
|
29612 | }
|
29613 |
|
29614 | |
29615 |
|
29616 |
|
29617 |
|
29618 |
|
29619 |
|
29620 |
|
29621 |
|
29622 |
|
29623 |
|
29624 |
|
29625 |
|
29626 |
|
29627 |
|
29628 |
|
29629 |
|
29630 |
|
29631 |
|
29632 |
|
29633 |
|
29634 |
|
29635 |
|
29636 |
|
29637 |
|
29638 |
|
29639 |
|
29640 |
|
29641 |
|
29642 |
|
29643 |
|
29644 |
|
29645 |
|
29646 |
|
29647 |
|
29648 |
|
29649 |
|
29650 |
|
29651 |
|
29652 |
|
29653 |
|
29654 |
|
29655 |
|
29656 |
|
29657 |
|
29658 |
|
29659 |
|
29660 |
|
29661 | var ANONYMOUS = '<<anonymous>>';
|
29662 |
|
29663 |
|
29664 |
|
29665 | var ReactPropTypes = {
|
29666 | array: createPrimitiveTypeChecker('array'),
|
29667 | bool: createPrimitiveTypeChecker('boolean'),
|
29668 | func: createPrimitiveTypeChecker('function'),
|
29669 | number: createPrimitiveTypeChecker('number'),
|
29670 | object: createPrimitiveTypeChecker('object'),
|
29671 | string: createPrimitiveTypeChecker('string'),
|
29672 | symbol: createPrimitiveTypeChecker('symbol'),
|
29673 |
|
29674 | any: createAnyTypeChecker(),
|
29675 | arrayOf: createArrayOfTypeChecker,
|
29676 | element: createElementTypeChecker(),
|
29677 | instanceOf: createInstanceTypeChecker,
|
29678 | node: createNodeChecker(),
|
29679 | objectOf: createObjectOfTypeChecker,
|
29680 | oneOf: createEnumTypeChecker,
|
29681 | oneOfType: createUnionTypeChecker,
|
29682 | shape: createShapeTypeChecker,
|
29683 | exact: createStrictShapeTypeChecker,
|
29684 | };
|
29685 |
|
29686 | |
29687 |
|
29688 |
|
29689 |
|
29690 |
|
29691 | function is(x, y) {
|
29692 |
|
29693 | if (x === y) {
|
29694 |
|
29695 |
|
29696 | return x !== 0 || 1 / x === 1 / y;
|
29697 | } else {
|
29698 |
|
29699 | return x !== x && y !== y;
|
29700 | }
|
29701 | }
|
29702 |
|
29703 |
|
29704 | |
29705 |
|
29706 |
|
29707 |
|
29708 |
|
29709 |
|
29710 |
|
29711 | function PropTypeError(message) {
|
29712 | this.message = message;
|
29713 | this.stack = '';
|
29714 | }
|
29715 |
|
29716 | PropTypeError.prototype = Error.prototype;
|
29717 |
|
29718 | function createChainableTypeChecker(validate) {
|
29719 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
29720 | var manualPropTypeCallCache = {};
|
29721 | var manualPropTypeWarningCount = 0;
|
29722 | }
|
29723 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
29724 | componentName = componentName || ANONYMOUS;
|
29725 | propFullName = propFullName || propName;
|
29726 |
|
29727 | if (secret !== ReactPropTypesSecret) {
|
29728 | if (throwOnDirectAccess) {
|
29729 |
|
29730 | invariant(
|
29731 | false,
|
29732 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
29733 | 'Use `PropTypes.checkPropTypes()` to call them. ' +
|
29734 | 'Read more at http://fb.me/use-check-prop-types'
|
29735 | );
|
29736 | } else if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
29737 |
|
29738 | var cacheKey = componentName + ':' + propName;
|
29739 | if (
|
29740 | !manualPropTypeCallCache[cacheKey] &&
|
29741 |
|
29742 | manualPropTypeWarningCount < 3
|
29743 | ) {
|
29744 | warning(
|
29745 | false,
|
29746 | 'You are manually calling a React.PropTypes validation ' +
|
29747 | 'function for the `%s` prop on `%s`. This is deprecated ' +
|
29748 | 'and will throw in the standalone `prop-types` package. ' +
|
29749 | 'You may be seeing this warning due to a third-party PropTypes ' +
|
29750 | 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
|
29751 | propFullName,
|
29752 | componentName
|
29753 | );
|
29754 | manualPropTypeCallCache[cacheKey] = true;
|
29755 | manualPropTypeWarningCount++;
|
29756 | }
|
29757 | }
|
29758 | }
|
29759 | if (props[propName] == null) {
|
29760 | if (isRequired) {
|
29761 | if (props[propName] === null) {
|
29762 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
29763 | }
|
29764 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
29765 | }
|
29766 | return null;
|
29767 | } else {
|
29768 | return validate(props, propName, componentName, location, propFullName);
|
29769 | }
|
29770 | }
|
29771 |
|
29772 | var chainedCheckType = checkType.bind(null, false);
|
29773 | chainedCheckType.isRequired = checkType.bind(null, true);
|
29774 |
|
29775 | return chainedCheckType;
|
29776 | }
|
29777 |
|
29778 | function createPrimitiveTypeChecker(expectedType) {
|
29779 | function validate(props, propName, componentName, location, propFullName, secret) {
|
29780 | var propValue = props[propName];
|
29781 | var propType = getPropType(propValue);
|
29782 | if (propType !== expectedType) {
|
29783 |
|
29784 |
|
29785 |
|
29786 | var preciseType = getPreciseType(propValue);
|
29787 |
|
29788 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
29789 | }
|
29790 | return null;
|
29791 | }
|
29792 | return createChainableTypeChecker(validate);
|
29793 | }
|
29794 |
|
29795 | function createAnyTypeChecker() {
|
29796 | return createChainableTypeChecker(emptyFunction.thatReturnsNull);
|
29797 | }
|
29798 |
|
29799 | function createArrayOfTypeChecker(typeChecker) {
|
29800 | function validate(props, propName, componentName, location, propFullName) {
|
29801 | if (typeof typeChecker !== 'function') {
|
29802 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
29803 | }
|
29804 | var propValue = props[propName];
|
29805 | if (!Array.isArray(propValue)) {
|
29806 | var propType = getPropType(propValue);
|
29807 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
29808 | }
|
29809 | for (var i = 0; i < propValue.length; i++) {
|
29810 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
29811 | if (error instanceof Error) {
|
29812 | return error;
|
29813 | }
|
29814 | }
|
29815 | return null;
|
29816 | }
|
29817 | return createChainableTypeChecker(validate);
|
29818 | }
|
29819 |
|
29820 | function createElementTypeChecker() {
|
29821 | function validate(props, propName, componentName, location, propFullName) {
|
29822 | var propValue = props[propName];
|
29823 | if (!isValidElement(propValue)) {
|
29824 | var propType = getPropType(propValue);
|
29825 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
29826 | }
|
29827 | return null;
|
29828 | }
|
29829 | return createChainableTypeChecker(validate);
|
29830 | }
|
29831 |
|
29832 | function createInstanceTypeChecker(expectedClass) {
|
29833 | function validate(props, propName, componentName, location, propFullName) {
|
29834 | if (!(props[propName] instanceof expectedClass)) {
|
29835 | var expectedClassName = expectedClass.name || ANONYMOUS;
|
29836 | var actualClassName = getClassName(props[propName]);
|
29837 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
29838 | }
|
29839 | return null;
|
29840 | }
|
29841 | return createChainableTypeChecker(validate);
|
29842 | }
|
29843 |
|
29844 | function createEnumTypeChecker(expectedValues) {
|
29845 | if (!Array.isArray(expectedValues)) {
|
29846 | Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
|
29847 | return emptyFunction.thatReturnsNull;
|
29848 | }
|
29849 |
|
29850 | function validate(props, propName, componentName, location, propFullName) {
|
29851 | var propValue = props[propName];
|
29852 | for (var i = 0; i < expectedValues.length; i++) {
|
29853 | if (is(propValue, expectedValues[i])) {
|
29854 | return null;
|
29855 | }
|
29856 | }
|
29857 |
|
29858 | var valuesString = JSON.stringify(expectedValues);
|
29859 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
29860 | }
|
29861 | return createChainableTypeChecker(validate);
|
29862 | }
|
29863 |
|
29864 | function createObjectOfTypeChecker(typeChecker) {
|
29865 | function validate(props, propName, componentName, location, propFullName) {
|
29866 | if (typeof typeChecker !== 'function') {
|
29867 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
29868 | }
|
29869 | var propValue = props[propName];
|
29870 | var propType = getPropType(propValue);
|
29871 | if (propType !== 'object') {
|
29872 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
29873 | }
|
29874 | for (var key in propValue) {
|
29875 | if (propValue.hasOwnProperty(key)) {
|
29876 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
29877 | if (error instanceof Error) {
|
29878 | return error;
|
29879 | }
|
29880 | }
|
29881 | }
|
29882 | return null;
|
29883 | }
|
29884 | return createChainableTypeChecker(validate);
|
29885 | }
|
29886 |
|
29887 | function createUnionTypeChecker(arrayOfTypeCheckers) {
|
29888 | if (!Array.isArray(arrayOfTypeCheckers)) {
|
29889 | Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
29890 | return emptyFunction.thatReturnsNull;
|
29891 | }
|
29892 |
|
29893 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
29894 | var checker = arrayOfTypeCheckers[i];
|
29895 | if (typeof checker !== 'function') {
|
29896 | warning(
|
29897 | false,
|
29898 | 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
29899 | 'received %s at index %s.',
|
29900 | getPostfixForTypeWarning(checker),
|
29901 | i
|
29902 | );
|
29903 | return emptyFunction.thatReturnsNull;
|
29904 | }
|
29905 | }
|
29906 |
|
29907 | function validate(props, propName, componentName, location, propFullName) {
|
29908 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
29909 | var checker = arrayOfTypeCheckers[i];
|
29910 | if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
|
29911 | return null;
|
29912 | }
|
29913 | }
|
29914 |
|
29915 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
29916 | }
|
29917 | return createChainableTypeChecker(validate);
|
29918 | }
|
29919 |
|
29920 | function createNodeChecker() {
|
29921 | function validate(props, propName, componentName, location, propFullName) {
|
29922 | if (!isNode(props[propName])) {
|
29923 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
29924 | }
|
29925 | return null;
|
29926 | }
|
29927 | return createChainableTypeChecker(validate);
|
29928 | }
|
29929 |
|
29930 | function createShapeTypeChecker(shapeTypes) {
|
29931 | function validate(props, propName, componentName, location, propFullName) {
|
29932 | var propValue = props[propName];
|
29933 | var propType = getPropType(propValue);
|
29934 | if (propType !== 'object') {
|
29935 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
29936 | }
|
29937 | for (var key in shapeTypes) {
|
29938 | var checker = shapeTypes[key];
|
29939 | if (!checker) {
|
29940 | continue;
|
29941 | }
|
29942 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
29943 | if (error) {
|
29944 | return error;
|
29945 | }
|
29946 | }
|
29947 | return null;
|
29948 | }
|
29949 | return createChainableTypeChecker(validate);
|
29950 | }
|
29951 |
|
29952 | function createStrictShapeTypeChecker(shapeTypes) {
|
29953 | function validate(props, propName, componentName, location, propFullName) {
|
29954 | var propValue = props[propName];
|
29955 | var propType = getPropType(propValue);
|
29956 | if (propType !== 'object') {
|
29957 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
29958 | }
|
29959 |
|
29960 |
|
29961 | var allKeys = assign({}, props[propName], shapeTypes);
|
29962 | for (var key in allKeys) {
|
29963 | var checker = shapeTypes[key];
|
29964 | if (!checker) {
|
29965 | return new PropTypeError(
|
29966 | 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
29967 | '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
29968 | '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
29969 | );
|
29970 | }
|
29971 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
29972 | if (error) {
|
29973 | return error;
|
29974 | }
|
29975 | }
|
29976 | return null;
|
29977 | }
|
29978 |
|
29979 | return createChainableTypeChecker(validate);
|
29980 | }
|
29981 |
|
29982 | function isNode(propValue) {
|
29983 | switch (typeof propValue) {
|
29984 | case 'number':
|
29985 | case 'string':
|
29986 | case 'undefined':
|
29987 | return true;
|
29988 | case 'boolean':
|
29989 | return !propValue;
|
29990 | case 'object':
|
29991 | if (Array.isArray(propValue)) {
|
29992 | return propValue.every(isNode);
|
29993 | }
|
29994 | if (propValue === null || isValidElement(propValue)) {
|
29995 | return true;
|
29996 | }
|
29997 |
|
29998 | var iteratorFn = getIteratorFn(propValue);
|
29999 | if (iteratorFn) {
|
30000 | var iterator = iteratorFn.call(propValue);
|
30001 | var step;
|
30002 | if (iteratorFn !== propValue.entries) {
|
30003 | while (!(step = iterator.next()).done) {
|
30004 | if (!isNode(step.value)) {
|
30005 | return false;
|
30006 | }
|
30007 | }
|
30008 | } else {
|
30009 |
|
30010 | while (!(step = iterator.next()).done) {
|
30011 | var entry = step.value;
|
30012 | if (entry) {
|
30013 | if (!isNode(entry[1])) {
|
30014 | return false;
|
30015 | }
|
30016 | }
|
30017 | }
|
30018 | }
|
30019 | } else {
|
30020 | return false;
|
30021 | }
|
30022 |
|
30023 | return true;
|
30024 | default:
|
30025 | return false;
|
30026 | }
|
30027 | }
|
30028 |
|
30029 | function isSymbol(propType, propValue) {
|
30030 |
|
30031 | if (propType === 'symbol') {
|
30032 | return true;
|
30033 | }
|
30034 |
|
30035 |
|
30036 | if (propValue['@@toStringTag'] === 'Symbol') {
|
30037 | return true;
|
30038 | }
|
30039 |
|
30040 |
|
30041 | if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
30042 | return true;
|
30043 | }
|
30044 |
|
30045 | return false;
|
30046 | }
|
30047 |
|
30048 |
|
30049 | function getPropType(propValue) {
|
30050 | var propType = typeof propValue;
|
30051 | if (Array.isArray(propValue)) {
|
30052 | return 'array';
|
30053 | }
|
30054 | if (propValue instanceof RegExp) {
|
30055 |
|
30056 |
|
30057 |
|
30058 | return 'object';
|
30059 | }
|
30060 | if (isSymbol(propType, propValue)) {
|
30061 | return 'symbol';
|
30062 | }
|
30063 | return propType;
|
30064 | }
|
30065 |
|
30066 |
|
30067 |
|
30068 | function getPreciseType(propValue) {
|
30069 | if (typeof propValue === 'undefined' || propValue === null) {
|
30070 | return '' + propValue;
|
30071 | }
|
30072 | var propType = getPropType(propValue);
|
30073 | if (propType === 'object') {
|
30074 | if (propValue instanceof Date) {
|
30075 | return 'date';
|
30076 | } else if (propValue instanceof RegExp) {
|
30077 | return 'regexp';
|
30078 | }
|
30079 | }
|
30080 | return propType;
|
30081 | }
|
30082 |
|
30083 |
|
30084 |
|
30085 | function getPostfixForTypeWarning(value) {
|
30086 | var type = getPreciseType(value);
|
30087 | switch (type) {
|
30088 | case 'array':
|
30089 | case 'object':
|
30090 | return 'an ' + type;
|
30091 | case 'boolean':
|
30092 | case 'date':
|
30093 | case 'regexp':
|
30094 | return 'a ' + type;
|
30095 | default:
|
30096 | return type;
|
30097 | }
|
30098 | }
|
30099 |
|
30100 |
|
30101 | function getClassName(propValue) {
|
30102 | if (!propValue.constructor || !propValue.constructor.name) {
|
30103 | return ANONYMOUS;
|
30104 | }
|
30105 | return propValue.constructor.name;
|
30106 | }
|
30107 |
|
30108 | ReactPropTypes.checkPropTypes = checkPropTypes;
|
30109 | ReactPropTypes.PropTypes = ReactPropTypes;
|
30110 |
|
30111 | return ReactPropTypes;
|
30112 | };
|
30113 |
|
30114 |
|
30115 | }),
|
30116 |
|
30117 | (function(module, exports, __webpack_require__) {
|
30118 |
|
30119 | "use strict";
|
30120 | |
30121 |
|
30122 |
|
30123 |
|
30124 |
|
30125 |
|
30126 |
|
30127 |
|
30128 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
30129 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
30130 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
30131 |
|
30132 | function toObject(val) {
|
30133 | if (val === null || val === undefined) {
|
30134 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
30135 | }
|
30136 |
|
30137 | return Object(val);
|
30138 | }
|
30139 |
|
30140 | function shouldUseNative() {
|
30141 | try {
|
30142 | if (!Object.assign) {
|
30143 | return false;
|
30144 | }
|
30145 |
|
30146 |
|
30147 |
|
30148 |
|
30149 | var test1 = new String('abc');
|
30150 | test1[5] = 'de';
|
30151 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
30152 | return false;
|
30153 | }
|
30154 |
|
30155 |
|
30156 | var test2 = {};
|
30157 | for (var i = 0; i < 10; i++) {
|
30158 | test2['_' + String.fromCharCode(i)] = i;
|
30159 | }
|
30160 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
30161 | return test2[n];
|
30162 | });
|
30163 | if (order2.join('') !== '0123456789') {
|
30164 | return false;
|
30165 | }
|
30166 |
|
30167 |
|
30168 | var test3 = {};
|
30169 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
30170 | test3[letter] = letter;
|
30171 | });
|
30172 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
30173 | 'abcdefghijklmnopqrst') {
|
30174 | return false;
|
30175 | }
|
30176 |
|
30177 | return true;
|
30178 | } catch (err) {
|
30179 |
|
30180 | return false;
|
30181 | }
|
30182 | }
|
30183 |
|
30184 | module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
30185 | var from;
|
30186 | var to = toObject(target);
|
30187 | var symbols;
|
30188 |
|
30189 | for (var s = 1; s < arguments.length; s++) {
|
30190 | from = Object(arguments[s]);
|
30191 |
|
30192 | for (var key in from) {
|
30193 | if (hasOwnProperty.call(from, key)) {
|
30194 | to[key] = from[key];
|
30195 | }
|
30196 | }
|
30197 |
|
30198 | if (getOwnPropertySymbols) {
|
30199 | symbols = getOwnPropertySymbols(from);
|
30200 | for (var i = 0; i < symbols.length; i++) {
|
30201 | if (propIsEnumerable.call(from, symbols[i])) {
|
30202 | to[symbols[i]] = from[symbols[i]];
|
30203 | }
|
30204 | }
|
30205 | }
|
30206 | }
|
30207 |
|
30208 | return to;
|
30209 | };
|
30210 |
|
30211 |
|
30212 | }),
|
30213 |
|
30214 | (function(module, exports, __webpack_require__) {
|
30215 |
|
30216 | "use strict";
|
30217 | |
30218 |
|
30219 |
|
30220 |
|
30221 |
|
30222 |
|
30223 |
|
30224 |
|
30225 |
|
30226 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
30227 | var invariant = __webpack_require__(2);
|
30228 | var warning = __webpack_require__(8);
|
30229 | var ReactPropTypesSecret = __webpack_require__(3);
|
30230 | var loggedTypeFailures = {};
|
30231 | }
|
30232 |
|
30233 | |
30234 |
|
30235 |
|
30236 |
|
30237 |
|
30238 |
|
30239 |
|
30240 |
|
30241 |
|
30242 |
|
30243 |
|
30244 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
30245 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
30246 | for (var typeSpecName in typeSpecs) {
|
30247 | if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
30248 | var error;
|
30249 |
|
30250 |
|
30251 |
|
30252 | try {
|
30253 |
|
30254 |
|
30255 | invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
|
30256 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
30257 | } catch (ex) {
|
30258 | error = ex;
|
30259 | }
|
30260 | warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
|
30261 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
30262 |
|
30263 |
|
30264 | loggedTypeFailures[error.message] = true;
|
30265 |
|
30266 | var stack = getStack ? getStack() : '';
|
30267 |
|
30268 | warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
30269 | }
|
30270 | }
|
30271 | }
|
30272 | }
|
30273 | }
|
30274 |
|
30275 | module.exports = checkPropTypes;
|
30276 |
|
30277 |
|
30278 | }),
|
30279 |
|
30280 | (function(module, exports, __webpack_require__) {
|
30281 |
|
30282 | "use strict";
|
30283 | |
30284 |
|
30285 |
|
30286 |
|
30287 |
|
30288 |
|
30289 |
|
30290 |
|
30291 |
|
30292 | var emptyFunction = __webpack_require__(1);
|
30293 | var invariant = __webpack_require__(2);
|
30294 | var ReactPropTypesSecret = __webpack_require__(3);
|
30295 |
|
30296 | module.exports = function() {
|
30297 | function shim(props, propName, componentName, location, propFullName, secret) {
|
30298 | if (secret === ReactPropTypesSecret) {
|
30299 |
|
30300 | return;
|
30301 | }
|
30302 | invariant(
|
30303 | false,
|
30304 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
30305 | 'Use PropTypes.checkPropTypes() to call them. ' +
|
30306 | 'Read more at http://fb.me/use-check-prop-types'
|
30307 | );
|
30308 | };
|
30309 | shim.isRequired = shim;
|
30310 | function getShim() {
|
30311 | return shim;
|
30312 | };
|
30313 |
|
30314 |
|
30315 | var ReactPropTypes = {
|
30316 | array: shim,
|
30317 | bool: shim,
|
30318 | func: shim,
|
30319 | number: shim,
|
30320 | object: shim,
|
30321 | string: shim,
|
30322 | symbol: shim,
|
30323 |
|
30324 | any: shim,
|
30325 | arrayOf: getShim,
|
30326 | element: shim,
|
30327 | instanceOf: getShim,
|
30328 | node: shim,
|
30329 | objectOf: getShim,
|
30330 | oneOf: getShim,
|
30331 | oneOfType: getShim,
|
30332 | shape: getShim,
|
30333 | exact: getShim
|
30334 | };
|
30335 |
|
30336 | ReactPropTypes.checkPropTypes = emptyFunction;
|
30337 | ReactPropTypes.PropTypes = ReactPropTypes;
|
30338 |
|
30339 | return ReactPropTypes;
|
30340 | };
|
30341 |
|
30342 |
|
30343 | }),
|
30344 |
|
30345 | (function(module, exports, __webpack_require__) {
|
30346 |
|
30347 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; |
30348 |
|
30349 |
|
30350 |
|
30351 |
|
30352 |
|
30353 |
|
30354 | (function () {
|
30355 | 'use strict';
|
30356 |
|
30357 | var hasOwn = {}.hasOwnProperty;
|
30358 |
|
30359 | function classNames () {
|
30360 | var classes = [];
|
30361 |
|
30362 | for (var i = 0; i < arguments.length; i++) {
|
30363 | var arg = arguments[i];
|
30364 | if (!arg) continue;
|
30365 |
|
30366 | var argType = typeof arg;
|
30367 |
|
30368 | if (argType === 'string' || argType === 'number') {
|
30369 | classes.push(arg);
|
30370 | } else if (Array.isArray(arg)) {
|
30371 | classes.push(classNames.apply(null, arg));
|
30372 | } else if (argType === 'object') {
|
30373 | for (var key in arg) {
|
30374 | if (hasOwn.call(arg, key) && arg[key]) {
|
30375 | classes.push(key);
|
30376 | }
|
30377 | }
|
30378 | }
|
30379 | }
|
30380 |
|
30381 | return classes.join(' ');
|
30382 | }
|
30383 |
|
30384 | if (typeof module !== 'undefined' && module.exports) {
|
30385 | module.exports = classNames;
|
30386 | } else if (true) {
|
30387 |
|
30388 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
|
30389 | return classNames;
|
30390 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
|
30391 | __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
30392 | } else {
|
30393 | window.classNames = classNames;
|
30394 | }
|
30395 | }());
|
30396 |
|
30397 |
|
30398 | }),
|
30399 |
|
30400 | (function(module, exports, __webpack_require__) {
|
30401 |
|
30402 | "use strict";
|
30403 |
|
30404 |
|
30405 | Object.defineProperty(exports, "__esModule", {
|
30406 | value: true
|
30407 | });
|
30408 | exports.getPrefix = getPrefix;
|
30409 | exports.browserPrefixToKey = browserPrefixToKey;
|
30410 | exports.browserPrefixToStyle = browserPrefixToStyle;
|
30411 | var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
|
30412 | function getPrefix() /*: string*/ {
|
30413 | var prop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
|
30414 |
|
30415 |
|
30416 |
|
30417 |
|
30418 | if (typeof window === 'undefined' || typeof window.document === 'undefined') return '';
|
30419 |
|
30420 | var style = window.document.documentElement.style;
|
30421 |
|
30422 | if (prop in style) return '';
|
30423 |
|
30424 | for (var i = 0; i < prefixes.length; i++) {
|
30425 | if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i];
|
30426 | }
|
30427 |
|
30428 | return '';
|
30429 | }
|
30430 |
|
30431 | function browserPrefixToKey(prop /*: string*/, prefix /*: string*/) /*: string*/ {
|
30432 | return prefix ? '' + prefix + kebabToTitleCase(prop) : prop;
|
30433 | }
|
30434 |
|
30435 | function browserPrefixToStyle(prop /*: string*/, prefix /*: string*/) /*: string*/ {
|
30436 | return prefix ? '-' + prefix.toLowerCase() + '-' + prop : prop;
|
30437 | }
|
30438 |
|
30439 | function kebabToTitleCase(str /*: string*/) /*: string*/ {
|
30440 | var out = '';
|
30441 | var shouldCapitalize = true;
|
30442 | for (var i = 0; i < str.length; i++) {
|
30443 | if (shouldCapitalize) {
|
30444 | out += str[i].toUpperCase();
|
30445 | shouldCapitalize = false;
|
30446 | } else if (str[i] === '-') {
|
30447 | shouldCapitalize = true;
|
30448 | } else {
|
30449 | out += str[i];
|
30450 | }
|
30451 | }
|
30452 | return out;
|
30453 | }
|
30454 |
|
30455 |
|
30456 |
|
30457 |
|
30458 | exports.default = getPrefix();
|
30459 |
|
30460 | }),
|
30461 |
|
30462 | (function(module, exports) {
|
30463 |
|
30464 |
|
30465 | var process = module.exports = {};
|
30466 |
|
30467 |
|
30468 |
|
30469 |
|
30470 |
|
30471 |
|
30472 | var cachedSetTimeout;
|
30473 | var cachedClearTimeout;
|
30474 |
|
30475 | function defaultSetTimout() {
|
30476 | throw new Error('setTimeout has not been defined');
|
30477 | }
|
30478 | function defaultClearTimeout () {
|
30479 | throw new Error('clearTimeout has not been defined');
|
30480 | }
|
30481 | (function () {
|
30482 | try {
|
30483 | if (typeof setTimeout === 'function') {
|
30484 | cachedSetTimeout = setTimeout;
|
30485 | } else {
|
30486 | cachedSetTimeout = defaultSetTimout;
|
30487 | }
|
30488 | } catch (e) {
|
30489 | cachedSetTimeout = defaultSetTimout;
|
30490 | }
|
30491 | try {
|
30492 | if (typeof clearTimeout === 'function') {
|
30493 | cachedClearTimeout = clearTimeout;
|
30494 | } else {
|
30495 | cachedClearTimeout = defaultClearTimeout;
|
30496 | }
|
30497 | } catch (e) {
|
30498 | cachedClearTimeout = defaultClearTimeout;
|
30499 | }
|
30500 | } ())
|
30501 | function runTimeout(fun) {
|
30502 | if (cachedSetTimeout === setTimeout) {
|
30503 |
|
30504 | return setTimeout(fun, 0);
|
30505 | }
|
30506 |
|
30507 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
30508 | cachedSetTimeout = setTimeout;
|
30509 | return setTimeout(fun, 0);
|
30510 | }
|
30511 | try {
|
30512 |
|
30513 | return cachedSetTimeout(fun, 0);
|
30514 | } catch(e){
|
30515 | try {
|
30516 |
|
30517 | return cachedSetTimeout.call(null, fun, 0);
|
30518 | } catch(e){
|
30519 |
|
30520 | return cachedSetTimeout.call(this, fun, 0);
|
30521 | }
|
30522 | }
|
30523 |
|
30524 |
|
30525 | }
|
30526 | function runClearTimeout(marker) {
|
30527 | if (cachedClearTimeout === clearTimeout) {
|
30528 |
|
30529 | return clearTimeout(marker);
|
30530 | }
|
30531 |
|
30532 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
30533 | cachedClearTimeout = clearTimeout;
|
30534 | return clearTimeout(marker);
|
30535 | }
|
30536 | try {
|
30537 |
|
30538 | return cachedClearTimeout(marker);
|
30539 | } catch (e){
|
30540 | try {
|
30541 |
|
30542 | return cachedClearTimeout.call(null, marker);
|
30543 | } catch (e){
|
30544 |
|
30545 |
|
30546 | return cachedClearTimeout.call(this, marker);
|
30547 | }
|
30548 | }
|
30549 |
|
30550 |
|
30551 |
|
30552 | }
|
30553 | var queue = [];
|
30554 | var draining = false;
|
30555 | var currentQueue;
|
30556 | var queueIndex = -1;
|
30557 |
|
30558 | function cleanUpNextTick() {
|
30559 | if (!draining || !currentQueue) {
|
30560 | return;
|
30561 | }
|
30562 | draining = false;
|
30563 | if (currentQueue.length) {
|
30564 | queue = currentQueue.concat(queue);
|
30565 | } else {
|
30566 | queueIndex = -1;
|
30567 | }
|
30568 | if (queue.length) {
|
30569 | drainQueue();
|
30570 | }
|
30571 | }
|
30572 |
|
30573 | function drainQueue() {
|
30574 | if (draining) {
|
30575 | return;
|
30576 | }
|
30577 | var timeout = runTimeout(cleanUpNextTick);
|
30578 | draining = true;
|
30579 |
|
30580 | var len = queue.length;
|
30581 | while(len) {
|
30582 | currentQueue = queue;
|
30583 | queue = [];
|
30584 | while (++queueIndex < len) {
|
30585 | if (currentQueue) {
|
30586 | currentQueue[queueIndex].run();
|
30587 | }
|
30588 | }
|
30589 | queueIndex = -1;
|
30590 | len = queue.length;
|
30591 | }
|
30592 | currentQueue = null;
|
30593 | draining = false;
|
30594 | runClearTimeout(timeout);
|
30595 | }
|
30596 |
|
30597 | process.nextTick = function (fun) {
|
30598 | var args = new Array(arguments.length - 1);
|
30599 | if (arguments.length > 1) {
|
30600 | for (var i = 1; i < arguments.length; i++) {
|
30601 | args[i - 1] = arguments[i];
|
30602 | }
|
30603 | }
|
30604 | queue.push(new Item(fun, args));
|
30605 | if (queue.length === 1 && !draining) {
|
30606 | runTimeout(drainQueue);
|
30607 | }
|
30608 | };
|
30609 |
|
30610 |
|
30611 | function Item(fun, array) {
|
30612 | this.fun = fun;
|
30613 | this.array = array;
|
30614 | }
|
30615 | Item.prototype.run = function () {
|
30616 | this.fun.apply(null, this.array);
|
30617 | };
|
30618 | process.title = 'browser';
|
30619 | process.browser = true;
|
30620 | process.env = {};
|
30621 | process.argv = [];
|
30622 | process.version = '';
|
30623 | process.versions = {};
|
30624 |
|
30625 | function noop() {}
|
30626 |
|
30627 | process.on = noop;
|
30628 | process.addListener = noop;
|
30629 | process.once = noop;
|
30630 | process.off = noop;
|
30631 | process.removeListener = noop;
|
30632 | process.removeAllListeners = noop;
|
30633 | process.emit = noop;
|
30634 | process.prependListener = noop;
|
30635 | process.prependOnceListener = noop;
|
30636 |
|
30637 | process.listeners = function (name) { return [] }
|
30638 |
|
30639 | process.binding = function (name) {
|
30640 | throw new Error('process.binding is not supported');
|
30641 | };
|
30642 |
|
30643 | process.cwd = function () { return '/' };
|
30644 | process.chdir = function (dir) {
|
30645 | throw new Error('process.chdir is not supported');
|
30646 | };
|
30647 | process.umask = function() { return 0; };
|
30648 |
|
30649 |
|
30650 | })
|
30651 | ]);
|
30652 | });
|
30653 |
|
30654 |
|
30655 | }),
|
30656 |
|
30657 | (function(module, exports, __webpack_require__) {
|
30658 |
|
30659 | (function(global, module) { |
30660 |
|
30661 |
|
30662 |
|
30663 |
|
30664 |
|
30665 |
|
30666 |
|
30667 |
|
30668 |
|
30669 | var LARGE_ARRAY_SIZE = 200;
|
30670 |
|
30671 |
|
30672 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
30673 |
|
30674 |
|
30675 | var COMPARE_PARTIAL_FLAG = 1,
|
30676 | COMPARE_UNORDERED_FLAG = 2;
|
30677 |
|
30678 |
|
30679 | var MAX_SAFE_INTEGER = 9007199254740991;
|
30680 |
|
30681 |
|
30682 | var argsTag = '[object Arguments]',
|
30683 | arrayTag = '[object Array]',
|
30684 | asyncTag = '[object AsyncFunction]',
|
30685 | boolTag = '[object Boolean]',
|
30686 | dateTag = '[object Date]',
|
30687 | errorTag = '[object Error]',
|
30688 | funcTag = '[object Function]',
|
30689 | genTag = '[object GeneratorFunction]',
|
30690 | mapTag = '[object Map]',
|
30691 | numberTag = '[object Number]',
|
30692 | nullTag = '[object Null]',
|
30693 | objectTag = '[object Object]',
|
30694 | promiseTag = '[object Promise]',
|
30695 | proxyTag = '[object Proxy]',
|
30696 | regexpTag = '[object RegExp]',
|
30697 | setTag = '[object Set]',
|
30698 | stringTag = '[object String]',
|
30699 | symbolTag = '[object Symbol]',
|
30700 | undefinedTag = '[object Undefined]',
|
30701 | weakMapTag = '[object WeakMap]';
|
30702 |
|
30703 | var arrayBufferTag = '[object ArrayBuffer]',
|
30704 | dataViewTag = '[object DataView]',
|
30705 | float32Tag = '[object Float32Array]',
|
30706 | float64Tag = '[object Float64Array]',
|
30707 | int8Tag = '[object Int8Array]',
|
30708 | int16Tag = '[object Int16Array]',
|
30709 | int32Tag = '[object Int32Array]',
|
30710 | uint8Tag = '[object Uint8Array]',
|
30711 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
30712 | uint16Tag = '[object Uint16Array]',
|
30713 | uint32Tag = '[object Uint32Array]';
|
30714 |
|
30715 | |
30716 |
|
30717 |
|
30718 |
|
30719 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
30720 |
|
30721 |
|
30722 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
30723 |
|
30724 |
|
30725 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
30726 |
|
30727 |
|
30728 | var typedArrayTags = {};
|
30729 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
30730 | typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
30731 | typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
30732 | typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
30733 | typedArrayTags[uint32Tag] = true;
|
30734 | typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
30735 | typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
30736 | typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
30737 | typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
30738 | typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
30739 | typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
30740 | typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
30741 | typedArrayTags[weakMapTag] = false;
|
30742 |
|
30743 |
|
30744 | var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
30745 |
|
30746 |
|
30747 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
30748 |
|
30749 |
|
30750 | var root = freeGlobal || freeSelf || Function('return this')();
|
30751 |
|
30752 |
|
30753 | var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
30754 |
|
30755 |
|
30756 | var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
30757 |
|
30758 |
|
30759 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
30760 |
|
30761 |
|
30762 | var freeProcess = moduleExports && freeGlobal.process;
|
30763 |
|
30764 |
|
30765 | var nodeUtil = (function() {
|
30766 | try {
|
30767 | return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
30768 | } catch (e) {}
|
30769 | }());
|
30770 |
|
30771 |
|
30772 | var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
30773 |
|
30774 | |
30775 |
|
30776 |
|
30777 |
|
30778 |
|
30779 |
|
30780 |
|
30781 |
|
30782 |
|
30783 | function arrayFilter(array, predicate) {
|
30784 | var index = -1,
|
30785 | length = array == null ? 0 : array.length,
|
30786 | resIndex = 0,
|
30787 | result = [];
|
30788 |
|
30789 | while (++index < length) {
|
30790 | var value = array[index];
|
30791 | if (predicate(value, index, array)) {
|
30792 | result[resIndex++] = value;
|
30793 | }
|
30794 | }
|
30795 | return result;
|
30796 | }
|
30797 |
|
30798 | |
30799 |
|
30800 |
|
30801 |
|
30802 |
|
30803 |
|
30804 |
|
30805 |
|
30806 | function arrayPush(array, values) {
|
30807 | var index = -1,
|
30808 | length = values.length,
|
30809 | offset = array.length;
|
30810 |
|
30811 | while (++index < length) {
|
30812 | array[offset + index] = values[index];
|
30813 | }
|
30814 | return array;
|
30815 | }
|
30816 |
|
30817 | |
30818 |
|
30819 |
|
30820 |
|
30821 |
|
30822 |
|
30823 |
|
30824 |
|
30825 |
|
30826 |
|
30827 | function arraySome(array, predicate) {
|
30828 | var index = -1,
|
30829 | length = array == null ? 0 : array.length;
|
30830 |
|
30831 | while (++index < length) {
|
30832 | if (predicate(array[index], index, array)) {
|
30833 | return true;
|
30834 | }
|
30835 | }
|
30836 | return false;
|
30837 | }
|
30838 |
|
30839 | |
30840 |
|
30841 |
|
30842 |
|
30843 |
|
30844 |
|
30845 |
|
30846 |
|
30847 |
|
30848 | function baseTimes(n, iteratee) {
|
30849 | var index = -1,
|
30850 | result = Array(n);
|
30851 |
|
30852 | while (++index < n) {
|
30853 | result[index] = iteratee(index);
|
30854 | }
|
30855 | return result;
|
30856 | }
|
30857 |
|
30858 | |
30859 |
|
30860 |
|
30861 |
|
30862 |
|
30863 |
|
30864 |
|
30865 | function baseUnary(func) {
|
30866 | return function(value) {
|
30867 | return func(value);
|
30868 | };
|
30869 | }
|
30870 |
|
30871 | |
30872 |
|
30873 |
|
30874 |
|
30875 |
|
30876 |
|
30877 |
|
30878 |
|
30879 | function cacheHas(cache, key) {
|
30880 | return cache.has(key);
|
30881 | }
|
30882 |
|
30883 | |
30884 |
|
30885 |
|
30886 |
|
30887 |
|
30888 |
|
30889 |
|
30890 |
|
30891 | function getValue(object, key) {
|
30892 | return object == null ? undefined : object[key];
|
30893 | }
|
30894 |
|
30895 | |
30896 |
|
30897 |
|
30898 |
|
30899 |
|
30900 |
|
30901 |
|
30902 | function mapToArray(map) {
|
30903 | var index = -1,
|
30904 | result = Array(map.size);
|
30905 |
|
30906 | map.forEach(function(value, key) {
|
30907 | result[++index] = [key, value];
|
30908 | });
|
30909 | return result;
|
30910 | }
|
30911 |
|
30912 | |
30913 |
|
30914 |
|
30915 |
|
30916 |
|
30917 |
|
30918 |
|
30919 |
|
30920 | function overArg(func, transform) {
|
30921 | return function(arg) {
|
30922 | return func(transform(arg));
|
30923 | };
|
30924 | }
|
30925 |
|
30926 | |
30927 |
|
30928 |
|
30929 |
|
30930 |
|
30931 |
|
30932 |
|
30933 | function setToArray(set) {
|
30934 | var index = -1,
|
30935 | result = Array(set.size);
|
30936 |
|
30937 | set.forEach(function(value) {
|
30938 | result[++index] = value;
|
30939 | });
|
30940 | return result;
|
30941 | }
|
30942 |
|
30943 |
|
30944 | var arrayProto = Array.prototype,
|
30945 | funcProto = Function.prototype,
|
30946 | objectProto = Object.prototype;
|
30947 |
|
30948 |
|
30949 | var coreJsData = root['__core-js_shared__'];
|
30950 |
|
30951 |
|
30952 | var funcToString = funcProto.toString;
|
30953 |
|
30954 |
|
30955 | var hasOwnProperty = objectProto.hasOwnProperty;
|
30956 |
|
30957 |
|
30958 | var maskSrcKey = (function() {
|
30959 | var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
30960 | return uid ? ('Symbol(src)_1.' + uid) : '';
|
30961 | }());
|
30962 |
|
30963 | |
30964 |
|
30965 |
|
30966 |
|
30967 |
|
30968 | var nativeObjectToString = objectProto.toString;
|
30969 |
|
30970 |
|
30971 | var reIsNative = RegExp('^' +
|
30972 | funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
30973 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
30974 | );
|
30975 |
|
30976 |
|
30977 | var Buffer = moduleExports ? root.Buffer : undefined,
|
30978 | Symbol = root.Symbol,
|
30979 | Uint8Array = root.Uint8Array,
|
30980 | propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
30981 | splice = arrayProto.splice,
|
30982 | symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
30983 |
|
30984 |
|
30985 | var nativeGetSymbols = Object.getOwnPropertySymbols,
|
30986 | nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
|
30987 | nativeKeys = overArg(Object.keys, Object);
|
30988 |
|
30989 |
|
30990 | var DataView = getNative(root, 'DataView'),
|
30991 | Map = getNative(root, 'Map'),
|
30992 | Promise = getNative(root, 'Promise'),
|
30993 | Set = getNative(root, 'Set'),
|
30994 | WeakMap = getNative(root, 'WeakMap'),
|
30995 | nativeCreate = getNative(Object, 'create');
|
30996 |
|
30997 |
|
30998 | var dataViewCtorString = toSource(DataView),
|
30999 | mapCtorString = toSource(Map),
|
31000 | promiseCtorString = toSource(Promise),
|
31001 | setCtorString = toSource(Set),
|
31002 | weakMapCtorString = toSource(WeakMap);
|
31003 |
|
31004 |
|
31005 | var symbolProto = Symbol ? Symbol.prototype : undefined,
|
31006 | symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
31007 |
|
31008 | |
31009 |
|
31010 |
|
31011 |
|
31012 |
|
31013 |
|
31014 |
|
31015 | function Hash(entries) {
|
31016 | var index = -1,
|
31017 | length = entries == null ? 0 : entries.length;
|
31018 |
|
31019 | this.clear();
|
31020 | while (++index < length) {
|
31021 | var entry = entries[index];
|
31022 | this.set(entry[0], entry[1]);
|
31023 | }
|
31024 | }
|
31025 |
|
31026 | |
31027 |
|
31028 |
|
31029 |
|
31030 |
|
31031 |
|
31032 |
|
31033 | function hashClear() {
|
31034 | this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
31035 | this.size = 0;
|
31036 | }
|
31037 |
|
31038 | |
31039 |
|
31040 |
|
31041 |
|
31042 |
|
31043 |
|
31044 |
|
31045 |
|
31046 |
|
31047 |
|
31048 | function hashDelete(key) {
|
31049 | var result = this.has(key) && delete this.__data__[key];
|
31050 | this.size -= result ? 1 : 0;
|
31051 | return result;
|
31052 | }
|
31053 |
|
31054 | |
31055 |
|
31056 |
|
31057 |
|
31058 |
|
31059 |
|
31060 |
|
31061 |
|
31062 |
|
31063 | function hashGet(key) {
|
31064 | var data = this.__data__;
|
31065 | if (nativeCreate) {
|
31066 | var result = data[key];
|
31067 | return result === HASH_UNDEFINED ? undefined : result;
|
31068 | }
|
31069 | return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
31070 | }
|
31071 |
|
31072 | |
31073 |
|
31074 |
|
31075 |
|
31076 |
|
31077 |
|
31078 |
|
31079 |
|
31080 |
|
31081 | function hashHas(key) {
|
31082 | var data = this.__data__;
|
31083 | return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
31084 | }
|
31085 |
|
31086 | |
31087 |
|
31088 |
|
31089 |
|
31090 |
|
31091 |
|
31092 |
|
31093 |
|
31094 |
|
31095 |
|
31096 | function hashSet(key, value) {
|
31097 | var data = this.__data__;
|
31098 | this.size += this.has(key) ? 0 : 1;
|
31099 | data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
31100 | return this;
|
31101 | }
|
31102 |
|
31103 |
|
31104 | Hash.prototype.clear = hashClear;
|
31105 | Hash.prototype['delete'] = hashDelete;
|
31106 | Hash.prototype.get = hashGet;
|
31107 | Hash.prototype.has = hashHas;
|
31108 | Hash.prototype.set = hashSet;
|
31109 |
|
31110 | |
31111 |
|
31112 |
|
31113 |
|
31114 |
|
31115 |
|
31116 |
|
31117 | function ListCache(entries) {
|
31118 | var index = -1,
|
31119 | length = entries == null ? 0 : entries.length;
|
31120 |
|
31121 | this.clear();
|
31122 | while (++index < length) {
|
31123 | var entry = entries[index];
|
31124 | this.set(entry[0], entry[1]);
|
31125 | }
|
31126 | }
|
31127 |
|
31128 | |
31129 |
|
31130 |
|
31131 |
|
31132 |
|
31133 |
|
31134 |
|
31135 | function listCacheClear() {
|
31136 | this.__data__ = [];
|
31137 | this.size = 0;
|
31138 | }
|
31139 |
|
31140 | |
31141 |
|
31142 |
|
31143 |
|
31144 |
|
31145 |
|
31146 |
|
31147 |
|
31148 |
|
31149 | function listCacheDelete(key) {
|
31150 | var data = this.__data__,
|
31151 | index = assocIndexOf(data, key);
|
31152 |
|
31153 | if (index < 0) {
|
31154 | return false;
|
31155 | }
|
31156 | var lastIndex = data.length - 1;
|
31157 | if (index == lastIndex) {
|
31158 | data.pop();
|
31159 | } else {
|
31160 | splice.call(data, index, 1);
|
31161 | }
|
31162 | --this.size;
|
31163 | return true;
|
31164 | }
|
31165 |
|
31166 | |
31167 |
|
31168 |
|
31169 |
|
31170 |
|
31171 |
|
31172 |
|
31173 |
|
31174 |
|
31175 | function listCacheGet(key) {
|
31176 | var data = this.__data__,
|
31177 | index = assocIndexOf(data, key);
|
31178 |
|
31179 | return index < 0 ? undefined : data[index][1];
|
31180 | }
|
31181 |
|
31182 | |
31183 |
|
31184 |
|
31185 |
|
31186 |
|
31187 |
|
31188 |
|
31189 |
|
31190 |
|
31191 | function listCacheHas(key) {
|
31192 | return assocIndexOf(this.__data__, key) > -1;
|
31193 | }
|
31194 |
|
31195 | |
31196 |
|
31197 |
|
31198 |
|
31199 |
|
31200 |
|
31201 |
|
31202 |
|
31203 |
|
31204 |
|
31205 | function listCacheSet(key, value) {
|
31206 | var data = this.__data__,
|
31207 | index = assocIndexOf(data, key);
|
31208 |
|
31209 | if (index < 0) {
|
31210 | ++this.size;
|
31211 | data.push([key, value]);
|
31212 | } else {
|
31213 | data[index][1] = value;
|
31214 | }
|
31215 | return this;
|
31216 | }
|
31217 |
|
31218 |
|
31219 | ListCache.prototype.clear = listCacheClear;
|
31220 | ListCache.prototype['delete'] = listCacheDelete;
|
31221 | ListCache.prototype.get = listCacheGet;
|
31222 | ListCache.prototype.has = listCacheHas;
|
31223 | ListCache.prototype.set = listCacheSet;
|
31224 |
|
31225 | |
31226 |
|
31227 |
|
31228 |
|
31229 |
|
31230 |
|
31231 |
|
31232 | function MapCache(entries) {
|
31233 | var index = -1,
|
31234 | length = entries == null ? 0 : entries.length;
|
31235 |
|
31236 | this.clear();
|
31237 | while (++index < length) {
|
31238 | var entry = entries[index];
|
31239 | this.set(entry[0], entry[1]);
|
31240 | }
|
31241 | }
|
31242 |
|
31243 | |
31244 |
|
31245 |
|
31246 |
|
31247 |
|
31248 |
|
31249 |
|
31250 | function mapCacheClear() {
|
31251 | this.size = 0;
|
31252 | this.__data__ = {
|
31253 | 'hash': new Hash,
|
31254 | 'map': new (Map || ListCache),
|
31255 | 'string': new Hash
|
31256 | };
|
31257 | }
|
31258 |
|
31259 | |
31260 |
|
31261 |
|
31262 |
|
31263 |
|
31264 |
|
31265 |
|
31266 |
|
31267 |
|
31268 | function mapCacheDelete(key) {
|
31269 | var result = getMapData(this, key)['delete'](key);
|
31270 | this.size -= result ? 1 : 0;
|
31271 | return result;
|
31272 | }
|
31273 |
|
31274 | |
31275 |
|
31276 |
|
31277 |
|
31278 |
|
31279 |
|
31280 |
|
31281 |
|
31282 |
|
31283 | function mapCacheGet(key) {
|
31284 | return getMapData(this, key).get(key);
|
31285 | }
|
31286 |
|
31287 | |
31288 |
|
31289 |
|
31290 |
|
31291 |
|
31292 |
|
31293 |
|
31294 |
|
31295 |
|
31296 | function mapCacheHas(key) {
|
31297 | return getMapData(this, key).has(key);
|
31298 | }
|
31299 |
|
31300 | |
31301 |
|
31302 |
|
31303 |
|
31304 |
|
31305 |
|
31306 |
|
31307 |
|
31308 |
|
31309 |
|
31310 | function mapCacheSet(key, value) {
|
31311 | var data = getMapData(this, key),
|
31312 | size = data.size;
|
31313 |
|
31314 | data.set(key, value);
|
31315 | this.size += data.size == size ? 0 : 1;
|
31316 | return this;
|
31317 | }
|
31318 |
|
31319 |
|
31320 | MapCache.prototype.clear = mapCacheClear;
|
31321 | MapCache.prototype['delete'] = mapCacheDelete;
|
31322 | MapCache.prototype.get = mapCacheGet;
|
31323 | MapCache.prototype.has = mapCacheHas;
|
31324 | MapCache.prototype.set = mapCacheSet;
|
31325 |
|
31326 | |
31327 |
|
31328 |
|
31329 |
|
31330 |
|
31331 |
|
31332 |
|
31333 |
|
31334 | function SetCache(values) {
|
31335 | var index = -1,
|
31336 | length = values == null ? 0 : values.length;
|
31337 |
|
31338 | this.__data__ = new MapCache;
|
31339 | while (++index < length) {
|
31340 | this.add(values[index]);
|
31341 | }
|
31342 | }
|
31343 |
|
31344 | |
31345 |
|
31346 |
|
31347 |
|
31348 |
|
31349 |
|
31350 |
|
31351 |
|
31352 |
|
31353 |
|
31354 | function setCacheAdd(value) {
|
31355 | this.__data__.set(value, HASH_UNDEFINED);
|
31356 | return this;
|
31357 | }
|
31358 |
|
31359 | |
31360 |
|
31361 |
|
31362 |
|
31363 |
|
31364 |
|
31365 |
|
31366 |
|
31367 |
|
31368 | function setCacheHas(value) {
|
31369 | return this.__data__.has(value);
|
31370 | }
|
31371 |
|
31372 |
|
31373 | SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
31374 | SetCache.prototype.has = setCacheHas;
|
31375 |
|
31376 | |
31377 |
|
31378 |
|
31379 |
|
31380 |
|
31381 |
|
31382 |
|
31383 | function Stack(entries) {
|
31384 | var data = this.__data__ = new ListCache(entries);
|
31385 | this.size = data.size;
|
31386 | }
|
31387 |
|
31388 | |
31389 |
|
31390 |
|
31391 |
|
31392 |
|
31393 |
|
31394 |
|
31395 | function stackClear() {
|
31396 | this.__data__ = new ListCache;
|
31397 | this.size = 0;
|
31398 | }
|
31399 |
|
31400 | |
31401 |
|
31402 |
|
31403 |
|
31404 |
|
31405 |
|
31406 |
|
31407 |
|
31408 |
|
31409 | function stackDelete(key) {
|
31410 | var data = this.__data__,
|
31411 | result = data['delete'](key);
|
31412 |
|
31413 | this.size = data.size;
|
31414 | return result;
|
31415 | }
|
31416 |
|
31417 | |
31418 |
|
31419 |
|
31420 |
|
31421 |
|
31422 |
|
31423 |
|
31424 |
|
31425 |
|
31426 | function stackGet(key) {
|
31427 | return this.__data__.get(key);
|
31428 | }
|
31429 |
|
31430 | |
31431 |
|
31432 |
|
31433 |
|
31434 |
|
31435 |
|
31436 |
|
31437 |
|
31438 |
|
31439 | function stackHas(key) {
|
31440 | return this.__data__.has(key);
|
31441 | }
|
31442 |
|
31443 | |
31444 |
|
31445 |
|
31446 |
|
31447 |
|
31448 |
|
31449 |
|
31450 |
|
31451 |
|
31452 |
|
31453 | function stackSet(key, value) {
|
31454 | var data = this.__data__;
|
31455 | if (data instanceof ListCache) {
|
31456 | var pairs = data.__data__;
|
31457 | if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
31458 | pairs.push([key, value]);
|
31459 | this.size = ++data.size;
|
31460 | return this;
|
31461 | }
|
31462 | data = this.__data__ = new MapCache(pairs);
|
31463 | }
|
31464 | data.set(key, value);
|
31465 | this.size = data.size;
|
31466 | return this;
|
31467 | }
|
31468 |
|
31469 |
|
31470 | Stack.prototype.clear = stackClear;
|
31471 | Stack.prototype['delete'] = stackDelete;
|
31472 | Stack.prototype.get = stackGet;
|
31473 | Stack.prototype.has = stackHas;
|
31474 | Stack.prototype.set = stackSet;
|
31475 |
|
31476 | |
31477 |
|
31478 |
|
31479 |
|
31480 |
|
31481 |
|
31482 |
|
31483 |
|
31484 | function arrayLikeKeys(value, inherited) {
|
31485 | var isArr = isArray(value),
|
31486 | isArg = !isArr && isArguments(value),
|
31487 | isBuff = !isArr && !isArg && isBuffer(value),
|
31488 | isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
31489 | skipIndexes = isArr || isArg || isBuff || isType,
|
31490 | result = skipIndexes ? baseTimes(value.length, String) : [],
|
31491 | length = result.length;
|
31492 |
|
31493 | for (var key in value) {
|
31494 | if ((inherited || hasOwnProperty.call(value, key)) &&
|
31495 | !(skipIndexes && (
|
31496 |
|
31497 | key == 'length' ||
|
31498 |
|
31499 | (isBuff && (key == 'offset' || key == 'parent')) ||
|
31500 |
|
31501 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
31502 |
|
31503 | isIndex(key, length)
|
31504 | ))) {
|
31505 | result.push(key);
|
31506 | }
|
31507 | }
|
31508 | return result;
|
31509 | }
|
31510 |
|
31511 | |
31512 |
|
31513 |
|
31514 |
|
31515 |
|
31516 |
|
31517 |
|
31518 |
|
31519 | function assocIndexOf(array, key) {
|
31520 | var length = array.length;
|
31521 | while (length--) {
|
31522 | if (eq(array[length][0], key)) {
|
31523 | return length;
|
31524 | }
|
31525 | }
|
31526 | return -1;
|
31527 | }
|
31528 |
|
31529 | |
31530 |
|
31531 |
|
31532 |
|
31533 |
|
31534 |
|
31535 |
|
31536 |
|
31537 |
|
31538 |
|
31539 |
|
31540 | function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
31541 | var result = keysFunc(object);
|
31542 | return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
31543 | }
|
31544 |
|
31545 | |
31546 |
|
31547 |
|
31548 |
|
31549 |
|
31550 |
|
31551 |
|
31552 | function baseGetTag(value) {
|
31553 | if (value == null) {
|
31554 | return value === undefined ? undefinedTag : nullTag;
|
31555 | }
|
31556 | return (symToStringTag && symToStringTag in Object(value))
|
31557 | ? getRawTag(value)
|
31558 | : objectToString(value);
|
31559 | }
|
31560 |
|
31561 | |
31562 |
|
31563 |
|
31564 |
|
31565 |
|
31566 |
|
31567 |
|
31568 | function baseIsArguments(value) {
|
31569 | return isObjectLike(value) && baseGetTag(value) == argsTag;
|
31570 | }
|
31571 |
|
31572 | |
31573 |
|
31574 |
|
31575 |
|
31576 |
|
31577 |
|
31578 |
|
31579 |
|
31580 |
|
31581 |
|
31582 |
|
31583 |
|
31584 |
|
31585 |
|
31586 | function baseIsEqual(value, other, bitmask, customizer, stack) {
|
31587 | if (value === other) {
|
31588 | return true;
|
31589 | }
|
31590 | if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
31591 | return value !== value && other !== other;
|
31592 | }
|
31593 | return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
31594 | }
|
31595 |
|
31596 | |
31597 |
|
31598 |
|
31599 |
|
31600 |
|
31601 |
|
31602 |
|
31603 |
|
31604 |
|
31605 |
|
31606 |
|
31607 |
|
31608 |
|
31609 |
|
31610 | function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
31611 | var objIsArr = isArray(object),
|
31612 | othIsArr = isArray(other),
|
31613 | objTag = objIsArr ? arrayTag : getTag(object),
|
31614 | othTag = othIsArr ? arrayTag : getTag(other);
|
31615 |
|
31616 | objTag = objTag == argsTag ? objectTag : objTag;
|
31617 | othTag = othTag == argsTag ? objectTag : othTag;
|
31618 |
|
31619 | var objIsObj = objTag == objectTag,
|
31620 | othIsObj = othTag == objectTag,
|
31621 | isSameTag = objTag == othTag;
|
31622 |
|
31623 | if (isSameTag && isBuffer(object)) {
|
31624 | if (!isBuffer(other)) {
|
31625 | return false;
|
31626 | }
|
31627 | objIsArr = true;
|
31628 | objIsObj = false;
|
31629 | }
|
31630 | if (isSameTag && !objIsObj) {
|
31631 | stack || (stack = new Stack);
|
31632 | return (objIsArr || isTypedArray(object))
|
31633 | ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
31634 | : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
31635 | }
|
31636 | if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
31637 | var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
31638 | othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
31639 |
|
31640 | if (objIsWrapped || othIsWrapped) {
|
31641 | var objUnwrapped = objIsWrapped ? object.value() : object,
|
31642 | othUnwrapped = othIsWrapped ? other.value() : other;
|
31643 |
|
31644 | stack || (stack = new Stack);
|
31645 | return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
31646 | }
|
31647 | }
|
31648 | if (!isSameTag) {
|
31649 | return false;
|
31650 | }
|
31651 | stack || (stack = new Stack);
|
31652 | return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
31653 | }
|
31654 |
|
31655 | |
31656 |
|
31657 |
|
31658 |
|
31659 |
|
31660 |
|
31661 |
|
31662 |
|
31663 | function baseIsNative(value) {
|
31664 | if (!isObject(value) || isMasked(value)) {
|
31665 | return false;
|
31666 | }
|
31667 | var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
31668 | return pattern.test(toSource(value));
|
31669 | }
|
31670 |
|
31671 | |
31672 |
|
31673 |
|
31674 |
|
31675 |
|
31676 |
|
31677 |
|
31678 | function baseIsTypedArray(value) {
|
31679 | return isObjectLike(value) &&
|
31680 | isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
31681 | }
|
31682 |
|
31683 | |
31684 |
|
31685 |
|
31686 |
|
31687 |
|
31688 |
|
31689 |
|
31690 | function baseKeys(object) {
|
31691 | if (!isPrototype(object)) {
|
31692 | return nativeKeys(object);
|
31693 | }
|
31694 | var result = [];
|
31695 | for (var key in Object(object)) {
|
31696 | if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
31697 | result.push(key);
|
31698 | }
|
31699 | }
|
31700 | return result;
|
31701 | }
|
31702 |
|
31703 | |
31704 |
|
31705 |
|
31706 |
|
31707 |
|
31708 |
|
31709 |
|
31710 |
|
31711 |
|
31712 |
|
31713 |
|
31714 |
|
31715 |
|
31716 | function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
31717 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
31718 | arrLength = array.length,
|
31719 | othLength = other.length;
|
31720 |
|
31721 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
31722 | return false;
|
31723 | }
|
31724 |
|
31725 | var stacked = stack.get(array);
|
31726 | if (stacked && stack.get(other)) {
|
31727 | return stacked == other;
|
31728 | }
|
31729 | var index = -1,
|
31730 | result = true,
|
31731 | seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
|
31732 |
|
31733 | stack.set(array, other);
|
31734 | stack.set(other, array);
|
31735 |
|
31736 |
|
31737 | while (++index < arrLength) {
|
31738 | var arrValue = array[index],
|
31739 | othValue = other[index];
|
31740 |
|
31741 | if (customizer) {
|
31742 | var compared = isPartial
|
31743 | ? customizer(othValue, arrValue, index, other, array, stack)
|
31744 | : customizer(arrValue, othValue, index, array, other, stack);
|
31745 | }
|
31746 | if (compared !== undefined) {
|
31747 | if (compared) {
|
31748 | continue;
|
31749 | }
|
31750 | result = false;
|
31751 | break;
|
31752 | }
|
31753 |
|
31754 | if (seen) {
|
31755 | if (!arraySome(other, function(othValue, othIndex) {
|
31756 | if (!cacheHas(seen, othIndex) &&
|
31757 | (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
31758 | return seen.push(othIndex);
|
31759 | }
|
31760 | })) {
|
31761 | result = false;
|
31762 | break;
|
31763 | }
|
31764 | } else if (!(
|
31765 | arrValue === othValue ||
|
31766 | equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
31767 | )) {
|
31768 | result = false;
|
31769 | break;
|
31770 | }
|
31771 | }
|
31772 | stack['delete'](array);
|
31773 | stack['delete'](other);
|
31774 | return result;
|
31775 | }
|
31776 |
|
31777 | |
31778 |
|
31779 |
|
31780 |
|
31781 |
|
31782 |
|
31783 |
|
31784 |
|
31785 |
|
31786 |
|
31787 |
|
31788 |
|
31789 |
|
31790 |
|
31791 |
|
31792 |
|
31793 |
|
31794 | function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
31795 | switch (tag) {
|
31796 | case dataViewTag:
|
31797 | if ((object.byteLength != other.byteLength) ||
|
31798 | (object.byteOffset != other.byteOffset)) {
|
31799 | return false;
|
31800 | }
|
31801 | object = object.buffer;
|
31802 | other = other.buffer;
|
31803 |
|
31804 | case arrayBufferTag:
|
31805 | if ((object.byteLength != other.byteLength) ||
|
31806 | !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
31807 | return false;
|
31808 | }
|
31809 | return true;
|
31810 |
|
31811 | case boolTag:
|
31812 | case dateTag:
|
31813 | case numberTag:
|
31814 |
|
31815 |
|
31816 | return eq(+object, +other);
|
31817 |
|
31818 | case errorTag:
|
31819 | return object.name == other.name && object.message == other.message;
|
31820 |
|
31821 | case regexpTag:
|
31822 | case stringTag:
|
31823 |
|
31824 |
|
31825 |
|
31826 | return object == (other + '');
|
31827 |
|
31828 | case mapTag:
|
31829 | var convert = mapToArray;
|
31830 |
|
31831 | case setTag:
|
31832 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
31833 | convert || (convert = setToArray);
|
31834 |
|
31835 | if (object.size != other.size && !isPartial) {
|
31836 | return false;
|
31837 | }
|
31838 |
|
31839 | var stacked = stack.get(object);
|
31840 | if (stacked) {
|
31841 | return stacked == other;
|
31842 | }
|
31843 | bitmask |= COMPARE_UNORDERED_FLAG;
|
31844 |
|
31845 |
|
31846 | stack.set(object, other);
|
31847 | var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
31848 | stack['delete'](object);
|
31849 | return result;
|
31850 |
|
31851 | case symbolTag:
|
31852 | if (symbolValueOf) {
|
31853 | return symbolValueOf.call(object) == symbolValueOf.call(other);
|
31854 | }
|
31855 | }
|
31856 | return false;
|
31857 | }
|
31858 |
|
31859 | |
31860 |
|
31861 |
|
31862 |
|
31863 |
|
31864 |
|
31865 |
|
31866 |
|
31867 |
|
31868 |
|
31869 |
|
31870 |
|
31871 |
|
31872 | function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
31873 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
31874 | objProps = getAllKeys(object),
|
31875 | objLength = objProps.length,
|
31876 | othProps = getAllKeys(other),
|
31877 | othLength = othProps.length;
|
31878 |
|
31879 | if (objLength != othLength && !isPartial) {
|
31880 | return false;
|
31881 | }
|
31882 | var index = objLength;
|
31883 | while (index--) {
|
31884 | var key = objProps[index];
|
31885 | if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
31886 | return false;
|
31887 | }
|
31888 | }
|
31889 |
|
31890 | var stacked = stack.get(object);
|
31891 | if (stacked && stack.get(other)) {
|
31892 | return stacked == other;
|
31893 | }
|
31894 | var result = true;
|
31895 | stack.set(object, other);
|
31896 | stack.set(other, object);
|
31897 |
|
31898 | var skipCtor = isPartial;
|
31899 | while (++index < objLength) {
|
31900 | key = objProps[index];
|
31901 | var objValue = object[key],
|
31902 | othValue = other[key];
|
31903 |
|
31904 | if (customizer) {
|
31905 | var compared = isPartial
|
31906 | ? customizer(othValue, objValue, key, other, object, stack)
|
31907 | : customizer(objValue, othValue, key, object, other, stack);
|
31908 | }
|
31909 |
|
31910 | if (!(compared === undefined
|
31911 | ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
31912 | : compared
|
31913 | )) {
|
31914 | result = false;
|
31915 | break;
|
31916 | }
|
31917 | skipCtor || (skipCtor = key == 'constructor');
|
31918 | }
|
31919 | if (result && !skipCtor) {
|
31920 | var objCtor = object.constructor,
|
31921 | othCtor = other.constructor;
|
31922 |
|
31923 |
|
31924 | if (objCtor != othCtor &&
|
31925 | ('constructor' in object && 'constructor' in other) &&
|
31926 | !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
31927 | typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
31928 | result = false;
|
31929 | }
|
31930 | }
|
31931 | stack['delete'](object);
|
31932 | stack['delete'](other);
|
31933 | return result;
|
31934 | }
|
31935 |
|
31936 | |
31937 |
|
31938 |
|
31939 |
|
31940 |
|
31941 |
|
31942 |
|
31943 | function getAllKeys(object) {
|
31944 | return baseGetAllKeys(object, keys, getSymbols);
|
31945 | }
|
31946 |
|
31947 | |
31948 |
|
31949 |
|
31950 |
|
31951 |
|
31952 |
|
31953 |
|
31954 |
|
31955 | function getMapData(map, key) {
|
31956 | var data = map.__data__;
|
31957 | return isKeyable(key)
|
31958 | ? data[typeof key == 'string' ? 'string' : 'hash']
|
31959 | : data.map;
|
31960 | }
|
31961 |
|
31962 | |
31963 |
|
31964 |
|
31965 |
|
31966 |
|
31967 |
|
31968 |
|
31969 |
|
31970 | function getNative(object, key) {
|
31971 | var value = getValue(object, key);
|
31972 | return baseIsNative(value) ? value : undefined;
|
31973 | }
|
31974 |
|
31975 | |
31976 |
|
31977 |
|
31978 |
|
31979 |
|
31980 |
|
31981 |
|
31982 | function getRawTag(value) {
|
31983 | var isOwn = hasOwnProperty.call(value, symToStringTag),
|
31984 | tag = value[symToStringTag];
|
31985 |
|
31986 | try {
|
31987 | value[symToStringTag] = undefined;
|
31988 | var unmasked = true;
|
31989 | } catch (e) {}
|
31990 |
|
31991 | var result = nativeObjectToString.call(value);
|
31992 | if (unmasked) {
|
31993 | if (isOwn) {
|
31994 | value[symToStringTag] = tag;
|
31995 | } else {
|
31996 | delete value[symToStringTag];
|
31997 | }
|
31998 | }
|
31999 | return result;
|
32000 | }
|
32001 |
|
32002 | |
32003 |
|
32004 |
|
32005 |
|
32006 |
|
32007 |
|
32008 |
|
32009 | var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
32010 | if (object == null) {
|
32011 | return [];
|
32012 | }
|
32013 | object = Object(object);
|
32014 | return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
32015 | return propertyIsEnumerable.call(object, symbol);
|
32016 | });
|
32017 | };
|
32018 |
|
32019 | |
32020 |
|
32021 |
|
32022 |
|
32023 |
|
32024 |
|
32025 |
|
32026 | var getTag = baseGetTag;
|
32027 |
|
32028 |
|
32029 | if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
32030 | (Map && getTag(new Map) != mapTag) ||
|
32031 | (Promise && getTag(Promise.resolve()) != promiseTag) ||
|
32032 | (Set && getTag(new Set) != setTag) ||
|
32033 | (WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
32034 | getTag = function(value) {
|
32035 | var result = baseGetTag(value),
|
32036 | Ctor = result == objectTag ? value.constructor : undefined,
|
32037 | ctorString = Ctor ? toSource(Ctor) : '';
|
32038 |
|
32039 | if (ctorString) {
|
32040 | switch (ctorString) {
|
32041 | case dataViewCtorString: return dataViewTag;
|
32042 | case mapCtorString: return mapTag;
|
32043 | case promiseCtorString: return promiseTag;
|
32044 | case setCtorString: return setTag;
|
32045 | case weakMapCtorString: return weakMapTag;
|
32046 | }
|
32047 | }
|
32048 | return result;
|
32049 | };
|
32050 | }
|
32051 |
|
32052 | |
32053 |
|
32054 |
|
32055 |
|
32056 |
|
32057 |
|
32058 |
|
32059 |
|
32060 | function isIndex(value, length) {
|
32061 | length = length == null ? MAX_SAFE_INTEGER : length;
|
32062 | return !!length &&
|
32063 | (typeof value == 'number' || reIsUint.test(value)) &&
|
32064 | (value > -1 && value % 1 == 0 && value < length);
|
32065 | }
|
32066 |
|
32067 | |
32068 |
|
32069 |
|
32070 |
|
32071 |
|
32072 |
|
32073 |
|
32074 | function isKeyable(value) {
|
32075 | var type = typeof value;
|
32076 | return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
32077 | ? (value !== '__proto__')
|
32078 | : (value === null);
|
32079 | }
|
32080 |
|
32081 | |
32082 |
|
32083 |
|
32084 |
|
32085 |
|
32086 |
|
32087 |
|
32088 | function isMasked(func) {
|
32089 | return !!maskSrcKey && (maskSrcKey in func);
|
32090 | }
|
32091 |
|
32092 | |
32093 |
|
32094 |
|
32095 |
|
32096 |
|
32097 |
|
32098 |
|
32099 | function isPrototype(value) {
|
32100 | var Ctor = value && value.constructor,
|
32101 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
32102 |
|
32103 | return value === proto;
|
32104 | }
|
32105 |
|
32106 | |
32107 |
|
32108 |
|
32109 |
|
32110 |
|
32111 |
|
32112 |
|
32113 | function objectToString(value) {
|
32114 | return nativeObjectToString.call(value);
|
32115 | }
|
32116 |
|
32117 | |
32118 |
|
32119 |
|
32120 |
|
32121 |
|
32122 |
|
32123 |
|
32124 | function toSource(func) {
|
32125 | if (func != null) {
|
32126 | try {
|
32127 | return funcToString.call(func);
|
32128 | } catch (e) {}
|
32129 | try {
|
32130 | return (func + '');
|
32131 | } catch (e) {}
|
32132 | }
|
32133 | return '';
|
32134 | }
|
32135 |
|
32136 | |
32137 |
|
32138 |
|
32139 |
|
32140 |
|
32141 |
|
32142 |
|
32143 |
|
32144 |
|
32145 |
|
32146 |
|
32147 |
|
32148 |
|
32149 |
|
32150 |
|
32151 |
|
32152 |
|
32153 |
|
32154 |
|
32155 |
|
32156 |
|
32157 |
|
32158 |
|
32159 |
|
32160 |
|
32161 |
|
32162 |
|
32163 |
|
32164 |
|
32165 |
|
32166 |
|
32167 |
|
32168 | function eq(value, other) {
|
32169 | return value === other || (value !== value && other !== other);
|
32170 | }
|
32171 |
|
32172 | |
32173 |
|
32174 |
|
32175 |
|
32176 |
|
32177 |
|
32178 |
|
32179 |
|
32180 |
|
32181 |
|
32182 |
|
32183 |
|
32184 |
|
32185 |
|
32186 |
|
32187 |
|
32188 |
|
32189 |
|
32190 | var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
32191 | return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
32192 | !propertyIsEnumerable.call(value, 'callee');
|
32193 | };
|
32194 |
|
32195 | |
32196 |
|
32197 |
|
32198 |
|
32199 |
|
32200 |
|
32201 |
|
32202 |
|
32203 |
|
32204 |
|
32205 |
|
32206 |
|
32207 |
|
32208 |
|
32209 |
|
32210 |
|
32211 |
|
32212 |
|
32213 |
|
32214 |
|
32215 |
|
32216 |
|
32217 |
|
32218 | var isArray = Array.isArray;
|
32219 |
|
32220 | |
32221 |
|
32222 |
|
32223 |
|
32224 |
|
32225 |
|
32226 |
|
32227 |
|
32228 |
|
32229 |
|
32230 |
|
32231 |
|
32232 |
|
32233 |
|
32234 |
|
32235 |
|
32236 |
|
32237 |
|
32238 |
|
32239 |
|
32240 |
|
32241 |
|
32242 |
|
32243 |
|
32244 |
|
32245 | function isArrayLike(value) {
|
32246 | return value != null && isLength(value.length) && !isFunction(value);
|
32247 | }
|
32248 |
|
32249 | |
32250 |
|
32251 |
|
32252 |
|
32253 |
|
32254 |
|
32255 |
|
32256 |
|
32257 |
|
32258 |
|
32259 |
|
32260 |
|
32261 |
|
32262 |
|
32263 |
|
32264 |
|
32265 |
|
32266 | var isBuffer = nativeIsBuffer || stubFalse;
|
32267 |
|
32268 | |
32269 |
|
32270 |
|
32271 |
|
32272 |
|
32273 |
|
32274 |
|
32275 |
|
32276 |
|
32277 |
|
32278 |
|
32279 |
|
32280 |
|
32281 |
|
32282 |
|
32283 |
|
32284 |
|
32285 |
|
32286 |
|
32287 |
|
32288 |
|
32289 |
|
32290 |
|
32291 |
|
32292 |
|
32293 |
|
32294 |
|
32295 |
|
32296 | function isEqual(value, other) {
|
32297 | return baseIsEqual(value, other);
|
32298 | }
|
32299 |
|
32300 | |
32301 |
|
32302 |
|
32303 |
|
32304 |
|
32305 |
|
32306 |
|
32307 |
|
32308 |
|
32309 |
|
32310 |
|
32311 |
|
32312 |
|
32313 |
|
32314 |
|
32315 |
|
32316 |
|
32317 | function isFunction(value) {
|
32318 | if (!isObject(value)) {
|
32319 | return false;
|
32320 | }
|
32321 |
|
32322 |
|
32323 | var tag = baseGetTag(value);
|
32324 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
32325 | }
|
32326 |
|
32327 | |
32328 |
|
32329 |
|
32330 |
|
32331 |
|
32332 |
|
32333 |
|
32334 |
|
32335 |
|
32336 |
|
32337 |
|
32338 |
|
32339 |
|
32340 |
|
32341 |
|
32342 |
|
32343 |
|
32344 |
|
32345 |
|
32346 |
|
32347 |
|
32348 |
|
32349 |
|
32350 |
|
32351 |
|
32352 |
|
32353 | function isLength(value) {
|
32354 | return typeof value == 'number' &&
|
32355 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
32356 | }
|
32357 |
|
32358 | |
32359 |
|
32360 |
|
32361 |
|
32362 |
|
32363 |
|
32364 |
|
32365 |
|
32366 |
|
32367 |
|
32368 |
|
32369 |
|
32370 |
|
32371 |
|
32372 |
|
32373 |
|
32374 |
|
32375 |
|
32376 |
|
32377 |
|
32378 |
|
32379 |
|
32380 |
|
32381 |
|
32382 |
|
32383 | function isObject(value) {
|
32384 | var type = typeof value;
|
32385 | return value != null && (type == 'object' || type == 'function');
|
32386 | }
|
32387 |
|
32388 | |
32389 |
|
32390 |
|
32391 |
|
32392 |
|
32393 |
|
32394 |
|
32395 |
|
32396 |
|
32397 |
|
32398 |
|
32399 |
|
32400 |
|
32401 |
|
32402 |
|
32403 |
|
32404 |
|
32405 |
|
32406 |
|
32407 |
|
32408 |
|
32409 |
|
32410 |
|
32411 |
|
32412 | function isObjectLike(value) {
|
32413 | return value != null && typeof value == 'object';
|
32414 | }
|
32415 |
|
32416 | |
32417 |
|
32418 |
|
32419 |
|
32420 |
|
32421 |
|
32422 |
|
32423 |
|
32424 |
|
32425 |
|
32426 |
|
32427 |
|
32428 |
|
32429 |
|
32430 |
|
32431 |
|
32432 |
|
32433 | var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
32434 |
|
32435 | |
32436 |
|
32437 |
|
32438 |
|
32439 |
|
32440 |
|
32441 |
|
32442 |
|
32443 |
|
32444 |
|
32445 |
|
32446 |
|
32447 |
|
32448 |
|
32449 |
|
32450 |
|
32451 |
|
32452 |
|
32453 |
|
32454 |
|
32455 |
|
32456 |
|
32457 |
|
32458 |
|
32459 |
|
32460 |
|
32461 |
|
32462 |
|
32463 | function keys(object) {
|
32464 | return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
32465 | }
|
32466 |
|
32467 | |
32468 |
|
32469 |
|
32470 |
|
32471 |
|
32472 |
|
32473 |
|
32474 |
|
32475 |
|
32476 |
|
32477 |
|
32478 |
|
32479 |
|
32480 |
|
32481 |
|
32482 |
|
32483 |
|
32484 |
|
32485 | function stubArray() {
|
32486 | return [];
|
32487 | }
|
32488 |
|
32489 | |
32490 |
|
32491 |
|
32492 |
|
32493 |
|
32494 |
|
32495 |
|
32496 |
|
32497 |
|
32498 |
|
32499 |
|
32500 |
|
32501 |
|
32502 | function stubFalse() {
|
32503 | return false;
|
32504 | }
|
32505 |
|
32506 | module.exports = isEqual;
|
32507 |
|
32508 | }.call(exports, (function() { return this; }()), __webpack_require__(208)(module)))
|
32509 |
|
32510 | }),
|
32511 |
|
32512 | (function(module, exports, __webpack_require__) {
|
32513 |
|
32514 | 'use strict';
|
32515 |
|
32516 | Object.defineProperty(exports, "__esModule", {
|
32517 | value: true
|
32518 | });
|
32519 |
|
32520 | 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; };
|
32521 |
|
32522 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
32523 |
|
32524 | var _react = __webpack_require__(1);
|
32525 |
|
32526 | var _react2 = _interopRequireDefault(_react);
|
32527 |
|
32528 | var _reactBeautifulDnd = __webpack_require__(159);
|
32529 |
|
32530 | var _util = __webpack_require__(260);
|
32531 |
|
32532 | var _classnames = __webpack_require__(5);
|
32533 |
|
32534 | var _classnames2 = _interopRequireDefault(_classnames);
|
32535 |
|
32536 | var _lodash = __webpack_require__(258);
|
32537 |
|
32538 | var _lodash2 = _interopRequireDefault(_lodash);
|
32539 |
|
32540 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
32541 |
|
32542 | 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; }
|
32543 |
|
32544 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
32545 |
|
32546 | 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; }
|
32547 |
|
32548 | 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); }
|
32549 |
|
32550 | var reorder = function reorder(list, startIndex, endIndex) {
|
32551 | var result = Array.from(list);
|
32552 |
|
32553 | var _result$splice = result.splice(startIndex, 1),
|
32554 | _result$splice2 = _slicedToArray(_result$splice, 1),
|
32555 | removed = _result$splice2[0];
|
32556 |
|
32557 | result.splice(endIndex, 0, removed);
|
32558 |
|
32559 | return result;
|
32560 | };
|
32561 |
|
32562 | var Vertical = function (_Component) {
|
32563 | _inherits(Vertical, _Component);
|
32564 |
|
32565 | function Vertical(props) {
|
32566 | _classCallCheck(this, Vertical);
|
32567 |
|
32568 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
32569 |
|
32570 | _this.onDragEnd = function (result) {
|
32571 | if (!result.destination) {
|
32572 | return;
|
32573 | }
|
32574 | var items = reorder(_this.state.items, result.source.index, result.destination.index);
|
32575 |
|
32576 | _this.setState({
|
32577 | items: items
|
32578 | });
|
32579 | _this.props.onStop(result, items);
|
32580 | };
|
32581 |
|
32582 | _this.onDragStart = function (result) {
|
32583 | _this.props.onStart(result, _this.state.items);
|
32584 | };
|
32585 |
|
32586 | _this.state = {
|
32587 | items: _this.props.list || []
|
32588 | };
|
32589 | return _this;
|
32590 | }
|
32591 |
|
32592 | Vertical.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
32593 | if (!(0, _lodash2['default'])(this.state.items, nextProps.list)) {
|
32594 | this.setState({
|
32595 | items: nextProps.list
|
32596 | });
|
32597 | }
|
32598 | };
|
32599 |
|
32600 | Vertical.prototype.render = function render() {
|
32601 | var _this2 = this;
|
32602 |
|
32603 | var _props = this.props,
|
32604 | onStart = _props.onStart,
|
32605 | onDrag = _props.onDrag,
|
32606 | onStop = _props.onStop,
|
32607 | onDragUpdate = _props.onDragUpdate,
|
32608 | dropClass = _props.dropClass,
|
32609 | dropOverClass = _props.dropOverClass,
|
32610 | dragClass = _props.dragClass,
|
32611 | dragingClass = _props.dragingClass,
|
32612 | showKey = _props.showKey,
|
32613 | type = _props.type;
|
32614 |
|
32615 |
|
32616 | return _react2['default'].createElement(
|
32617 | _reactBeautifulDnd.DragDropContext,
|
32618 | { onDragEnd: this.onDragEnd, onDragStart: this.onDragStart, onDragUpdate: onDragUpdate },
|
32619 | _react2['default'].createElement(
|
32620 | _reactBeautifulDnd.Droppable,
|
32621 | { droppableId: 'droppable', direction: type },
|
32622 | function (provided, snapshot) {
|
32623 | return _react2['default'].createElement(
|
32624 | 'div',
|
32625 | {
|
32626 | ref: provided.innerRef,
|
32627 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDraggingOver).drop))
|
32628 | },
|
32629 | _this2.state.items.map(function (item, index) {
|
32630 | return _react2['default'].createElement(
|
32631 | _reactBeautifulDnd.Draggable,
|
32632 | { key: index, draggableId: '' + index, index: index },
|
32633 | function (provided, snapshot) {
|
32634 | return _react2['default'].createElement(
|
32635 | 'div',
|
32636 | _extends({
|
32637 | ref: provided.innerRef
|
32638 | }, provided.draggableProps, provided.dragHandleProps, {
|
32639 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDragging).drag)),
|
32640 | style: _extends({}, provided.draggableProps.style)
|
32641 | }),
|
32642 | showKey ? item[showKey] : item
|
32643 | );
|
32644 | }
|
32645 | );
|
32646 | }),
|
32647 | provided.placeholder
|
32648 | );
|
32649 | }
|
32650 | )
|
32651 | );
|
32652 | };
|
32653 |
|
32654 | return Vertical;
|
32655 | }(_react.Component);
|
32656 |
|
32657 | exports['default'] = Vertical;
|
32658 | module.exports = exports['default'];
|
32659 |
|
32660 | }),
|
32661 |
|
32662 | (function(module, exports) {
|
32663 |
|
32664 | 'use strict';
|
32665 |
|
32666 | Object.defineProperty(exports, "__esModule", {
|
32667 | value: true
|
32668 | });
|
32669 | var getClass = exports.getClass = function getClass(props, doing) {
|
32670 | var dropClass = props.dropClass,
|
32671 | dropOverClass = props.dropOverClass,
|
32672 | dragClass = props.dragClass,
|
32673 | dragingClass = props.dragingClass,
|
32674 | type = props.type;
|
32675 |
|
32676 |
|
32677 | var verticalObj = {
|
32678 | drop: {}, drag: {}
|
32679 | };
|
32680 | verticalObj.drop['u-drop ' + dropClass] = true;
|
32681 | verticalObj.drop['u-droping ' + dropOverClass] = doing;
|
32682 | verticalObj.drag['u-drag ' + dragClass] = true;
|
32683 | verticalObj.drag['u-draging ' + dragingClass] = doing;
|
32684 |
|
32685 | var horizontalObj = {
|
32686 | drop: {}, drag: {}
|
32687 | };
|
32688 | horizontalObj.drop['u-drop u-drop-horizontal ' + dropClass] = true;
|
32689 | horizontalObj.drop['u-droping u-droping-horizontal ' + dropOverClass] = doing;
|
32690 | horizontalObj.drag['u-drag u-drag-horizontal ' + dragClass] = true;
|
32691 | horizontalObj.drag['u-draging u-draging-horizontal ' + dragingClass] = doing;
|
32692 |
|
32693 | switch (type) {
|
32694 | case 'vertical':
|
32695 | return verticalObj;
|
32696 | break;
|
32697 | case 'horizontal':
|
32698 | return horizontalObj;
|
32699 | break;
|
32700 | case 'betweenVertical':
|
32701 | return verticalObj;
|
32702 | break;
|
32703 | case 'betweenHorizontal':
|
32704 | return horizontalObj;
|
32705 | break;
|
32706 | }
|
32707 | };
|
32708 |
|
32709 | }),
|
32710 |
|
32711 | (function(module, exports, __webpack_require__) {
|
32712 |
|
32713 | 'use strict';
|
32714 |
|
32715 | Object.defineProperty(exports, "__esModule", {
|
32716 | value: true
|
32717 | });
|
32718 |
|
32719 | 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; };
|
32720 |
|
32721 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
32722 |
|
32723 | var _react = __webpack_require__(1);
|
32724 |
|
32725 | var _react2 = _interopRequireDefault(_react);
|
32726 |
|
32727 | var _reactDom = __webpack_require__(2);
|
32728 |
|
32729 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
32730 |
|
32731 | var _reactBeautifulDnd = __webpack_require__(159);
|
32732 |
|
32733 | var _util = __webpack_require__(260);
|
32734 |
|
32735 | var _classnames = __webpack_require__(5);
|
32736 |
|
32737 | var _classnames2 = _interopRequireDefault(_classnames);
|
32738 |
|
32739 | var _lodash = __webpack_require__(258);
|
32740 |
|
32741 | var _lodash2 = _interopRequireDefault(_lodash);
|
32742 |
|
32743 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
32744 |
|
32745 | 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; }
|
32746 |
|
32747 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
32748 |
|
32749 | 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; }
|
32750 |
|
32751 | 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); }
|
32752 |
|
32753 | var reorder = function reorder(list, startIndex, endIndex) {
|
32754 | var result = Array.from(list);
|
32755 |
|
32756 | var _result$splice = result.splice(startIndex, 1),
|
32757 | _result$splice2 = _slicedToArray(_result$splice, 1),
|
32758 | removed = _result$splice2[0];
|
32759 |
|
32760 | result.splice(endIndex, 0, removed);
|
32761 |
|
32762 | return result;
|
32763 | };
|
32764 |
|
32765 | |
32766 |
|
32767 |
|
32768 | var move = function move(source, destination, droppableSource, droppableDestination) {
|
32769 | var sourceClone = Array.from(source);
|
32770 | var destClone = Array.from(destination);
|
32771 |
|
32772 | var _sourceClone$splice = sourceClone.splice(droppableSource.index, 1),
|
32773 | _sourceClone$splice2 = _slicedToArray(_sourceClone$splice, 1),
|
32774 | removed = _sourceClone$splice2[0];
|
32775 |
|
32776 | destClone.splice(droppableDestination.index, 0, removed);
|
32777 |
|
32778 | var result = {};
|
32779 | result[droppableSource.droppableId] = sourceClone;
|
32780 | result[droppableDestination.droppableId] = destClone;
|
32781 |
|
32782 | return result;
|
32783 | };
|
32784 |
|
32785 | var Between = function (_Component) {
|
32786 | _inherits(Between, _Component);
|
32787 |
|
32788 | function Between(props) {
|
32789 | _classCallCheck(this, Between);
|
32790 |
|
32791 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
32792 |
|
32793 | _this.id2List = {
|
32794 | droppable: 'items',
|
32795 | droppable2: 'selected'
|
32796 | };
|
32797 |
|
32798 | _this.getList = function (id) {
|
32799 | return _this.state[_this.id2List[id]];
|
32800 | };
|
32801 |
|
32802 | _this.onDragEnd = function (result) {
|
32803 | console.log(result);
|
32804 | var source = result.source,
|
32805 | destination = result.destination;
|
32806 |
|
32807 |
|
32808 |
|
32809 | if (!destination) {
|
32810 | return;
|
32811 | }
|
32812 | var list = _this.state.items;
|
32813 | var otherList = _this.state.selected;
|
32814 |
|
32815 | if (source.droppableId === destination.droppableId) {
|
32816 | var items = reorder(_this.getList(source.droppableId), source.index, destination.index);
|
32817 |
|
32818 | var state = { items: items };
|
32819 | list = items;
|
32820 |
|
32821 | if (source.droppableId === 'droppable2') {
|
32822 | state = { selected: items };
|
32823 | otherList = items;
|
32824 | list = _this.state.items;
|
32825 | }
|
32826 | _this.setState(state);
|
32827 | } else {
|
32828 | var _result = move(_this.getList(source.droppableId), _this.getList(destination.droppableId), source, destination);
|
32829 |
|
32830 | _this.setState({
|
32831 | items: _result.droppable,
|
32832 | selected: _result.droppable2
|
32833 | });
|
32834 | list = _result.droppable;
|
32835 | otherList = _result.droppable2;
|
32836 | }
|
32837 | _this.props.onStop(result, {
|
32838 | list: list,
|
32839 | otherList: otherList
|
32840 | });
|
32841 | };
|
32842 |
|
32843 | _this.onDragStart = function (result) {
|
32844 | _this.props.onStart(result, {
|
32845 | list: _this.state.list,
|
32846 | otherList: _this.state.selected
|
32847 | });
|
32848 | };
|
32849 |
|
32850 | _this.state = {
|
32851 | items: _this.props.list,
|
32852 | selected: _this.props.otherList
|
32853 | };
|
32854 | return _this;
|
32855 | }
|
32856 |
|
32857 | Between.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
32858 | if (!(0, _lodash2['default'])(this.state.items, nextProps.list)) {
|
32859 | this.setState({
|
32860 | items: nextProps.list
|
32861 | });
|
32862 | }
|
32863 | if (!(0, _lodash2['default'])(this.state.selected, nextProps.otherList)) {
|
32864 | this.setState({
|
32865 | selected: nextProps.otherList
|
32866 | });
|
32867 | }
|
32868 | };
|
32869 |
|
32870 | Between.prototype.render = function render() {
|
32871 | var _this2 = this;
|
32872 |
|
32873 | var _props = this.props,
|
32874 | onStart = _props.onStart,
|
32875 | onDrag = _props.onDrag,
|
32876 | onStop = _props.onStop,
|
32877 | onDragUpdate = _props.onDragUpdate,
|
32878 | dropClass = _props.dropClass,
|
32879 | dropOverClass = _props.dropOverClass,
|
32880 | dragClass = _props.dragClass,
|
32881 | dragingClass = _props.dragingClass,
|
32882 | showKey = _props.showKey,
|
32883 | type = _props.type;
|
32884 |
|
32885 |
|
32886 | return _react2['default'].createElement(
|
32887 | 'div',
|
32888 | { className: (0, _classnames2['default'])({
|
32889 | 'u-drag-between': type == 'betweenVertical',
|
32890 | 'u-drag-between u-drag-between-horizontal': type == 'betweenHorizontal'
|
32891 |
|
32892 | }) },
|
32893 | _react2['default'].createElement(
|
32894 | _reactBeautifulDnd.DragDropContext,
|
32895 | { onDragEnd: this.onDragEnd, onDragStart: this.onDragStart, onDragUpdate: onDragUpdate },
|
32896 | _react2['default'].createElement(
|
32897 | _reactBeautifulDnd.Droppable,
|
32898 | { droppableId: 'droppable', direction: type == 'betweenVertical' ? 'vertical' : 'horizontal' },
|
32899 | function (provided, snapshot) {
|
32900 | return _react2['default'].createElement(
|
32901 | 'div',
|
32902 | {
|
32903 | ref: provided.innerRef,
|
32904 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDraggingOver).drop)) },
|
32905 | _this2.state.items.map(function (item, index) {
|
32906 | return _react2['default'].createElement(
|
32907 | _reactBeautifulDnd.Draggable,
|
32908 | {
|
32909 | key: '1' + index,
|
32910 | draggableId: '1' + index,
|
32911 | index: index },
|
32912 | function (provided, snapshot) {
|
32913 | return _react2['default'].createElement(
|
32914 | 'div',
|
32915 | _extends({
|
32916 | ref: provided.innerRef
|
32917 | }, provided.draggableProps, provided.dragHandleProps, {
|
32918 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDragging).drag)),
|
32919 | style: _extends({}, provided.draggableProps.style) }),
|
32920 | showKey ? item[showKey] : item
|
32921 | );
|
32922 | }
|
32923 | );
|
32924 | }),
|
32925 | provided.placeholder
|
32926 | );
|
32927 | }
|
32928 | ),
|
32929 | _react2['default'].createElement(
|
32930 | _reactBeautifulDnd.Droppable,
|
32931 | { droppableId: 'droppable2', direction: type == 'betweenVertical' ? 'vertical' : 'horizontal' },
|
32932 | function (provided, snapshot) {
|
32933 | return _react2['default'].createElement(
|
32934 | 'div',
|
32935 | {
|
32936 | ref: provided.innerRef,
|
32937 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDraggingOver).drop)) },
|
32938 | _this2.state.selected.map(function (item, index) {
|
32939 | return _react2['default'].createElement(
|
32940 | _reactBeautifulDnd.Draggable,
|
32941 | {
|
32942 | key: '2' + index,
|
32943 | draggableId: '2' + index,
|
32944 | index: index },
|
32945 | function (provided, snapshot) {
|
32946 | return _react2['default'].createElement(
|
32947 | 'div',
|
32948 | _extends({
|
32949 | ref: provided.innerRef
|
32950 | }, provided.draggableProps, provided.dragHandleProps, {
|
32951 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDragging).drag)),
|
32952 | style: _extends({}, provided.draggableProps.style) }),
|
32953 | showKey ? item[showKey] : item
|
32954 | );
|
32955 | }
|
32956 | );
|
32957 | }),
|
32958 | provided.placeholder
|
32959 | );
|
32960 | }
|
32961 | )
|
32962 | )
|
32963 | );
|
32964 | };
|
32965 |
|
32966 | return Between;
|
32967 | }(_react.Component);
|
32968 |
|
32969 | exports['default'] = Between;
|
32970 | module.exports = exports['default'];
|
32971 |
|
32972 | }),
|
32973 |
|
32974 | (function(module, exports, __webpack_require__) {
|
32975 |
|
32976 | 'use strict';
|
32977 |
|
32978 | Object.defineProperty(exports, "__esModule", {
|
32979 | value: true
|
32980 | });
|
32981 |
|
32982 | var _reactGridLayout = __webpack_require__(263);
|
32983 |
|
32984 | var _reactGridLayout2 = _interopRequireDefault(_reactGridLayout);
|
32985 |
|
32986 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
32987 |
|
32988 | exports['default'] = _reactGridLayout2['default'];
|
32989 | module.exports = exports['default'];
|
32990 |
|
32991 | }),
|
32992 |
|
32993 | (function(module, exports, __webpack_require__) {
|
32994 |
|
32995 | module.exports = __webpack_require__(264).default;
|
32996 | module.exports.utils = __webpack_require__(265);
|
32997 | module.exports.Responsive = __webpack_require__(271).default;
|
32998 | module.exports.Responsive.utils = __webpack_require__(272);
|
32999 | module.exports.WidthProvider = __webpack_require__(273).default;
|
33000 |
|
33001 |
|
33002 | }),
|
33003 |
|
33004 | (function(module, exports, __webpack_require__) {
|
33005 |
|
33006 | (function(process) {"use strict";
|
33007 |
|
33008 | exports.__esModule = true;
|
33009 |
|
33010 | 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; };
|
33011 |
|
33012 | var _react = __webpack_require__(1);
|
33013 |
|
33014 | var _react2 = _interopRequireDefault(_react);
|
33015 |
|
33016 | var _propTypes = __webpack_require__(6);
|
33017 |
|
33018 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
33019 |
|
33020 | var _lodash = __webpack_require__(258);
|
33021 |
|
33022 | var _lodash2 = _interopRequireDefault(_lodash);
|
33023 |
|
33024 | var _classnames = __webpack_require__(5);
|
33025 |
|
33026 | var _classnames2 = _interopRequireDefault(_classnames);
|
33027 |
|
33028 | var _utils = __webpack_require__(265);
|
33029 |
|
33030 | var _GridItem = __webpack_require__(266);
|
33031 |
|
33032 | var _GridItem2 = _interopRequireDefault(_GridItem);
|
33033 |
|
33034 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33035 |
|
33036 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
33037 |
|
33038 | 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; }
|
33039 |
|
33040 | 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; }
|
33041 |
|
33042 |
|
33043 |
|
33044 | |
33045 |
|
33046 |
|
33047 |
|
33048 |
|
33049 | var ReactGridLayout = function (_React$Component) {
|
33050 | _inherits(ReactGridLayout, _React$Component);
|
33051 |
|
33052 |
|
33053 | function ReactGridLayout(props, context) {
|
33054 | _classCallCheck(this, ReactGridLayout);
|
33055 |
|
33056 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
33057 |
|
33058 | _initialiseProps.call(_this);
|
33059 |
|
33060 | (0, _utils.autoBindHandlers)(_this, ["onDragStart", "onDrag", "onDragStop", "onResizeStart", "onResize", "onResizeStop"]);
|
33061 | return _this;
|
33062 | }
|
33063 |
|
33064 | ReactGridLayout.prototype.componentDidMount = function componentDidMount() {
|
33065 | this.setState({ mounted: true });
|
33066 |
|
33067 |
|
33068 | this.onLayoutMaybeChanged(this.state.layout, this.props.layout);
|
33069 | };
|
33070 |
|
33071 | ReactGridLayout.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
33072 | var newLayoutBase = void 0;
|
33073 |
|
33074 |
|
33075 | if (!(0, _lodash2.default)(nextProps.layout, this.props.layout) || nextProps.compactType !== this.props.compactType) {
|
33076 | newLayoutBase = nextProps.layout;
|
33077 | } else if (!(0, _utils.childrenEqual)(this.props.children, nextProps.children)) {
|
33078 |
|
33079 |
|
33080 |
|
33081 | newLayoutBase = this.state.layout;
|
33082 | }
|
33083 |
|
33084 |
|
33085 | if (newLayoutBase) {
|
33086 | var newLayout = (0, _utils.synchronizeLayoutWithChildren)(newLayoutBase, nextProps.children, nextProps.cols, this.compactType(nextProps));
|
33087 | var _oldLayout = this.state.layout;
|
33088 | this.setState({ layout: newLayout });
|
33089 | this.onLayoutMaybeChanged(newLayout, _oldLayout);
|
33090 | }
|
33091 | };
|
33092 |
|
33093 | |
33094 |
|
33095 |
|
33096 |
|
33097 |
|
33098 |
|
33099 | ReactGridLayout.prototype.containerHeight = function containerHeight() {
|
33100 | if (!this.props.autoSize) return;
|
33101 | var nbRow = (0, _utils.bottom)(this.state.layout);
|
33102 | var containerPaddingY = this.props.containerPadding ? this.props.containerPadding[1] : this.props.margin[1];
|
33103 | return nbRow * this.props.rowHeight + (nbRow - 1) * this.props.margin[1] + containerPaddingY * 2 + "px";
|
33104 | };
|
33105 |
|
33106 | ReactGridLayout.prototype.compactType = function compactType(props) {
|
33107 | if (!props) props = this.props;
|
33108 | return props.verticalCompact === false ? null : props.compactType;
|
33109 | };
|
33110 |
|
33111 | |
33112 |
|
33113 |
|
33114 |
|
33115 |
|
33116 |
|
33117 |
|
33118 |
|
33119 |
|
33120 |
|
33121 | ReactGridLayout.prototype.onDragStart = function onDragStart(i, x, y, _ref) {
|
33122 | var e = _ref.e,
|
33123 | node = _ref.node;
|
33124 | var layout = this.state.layout;
|
33125 |
|
33126 | var l = (0, _utils.getLayoutItem)(layout, i);
|
33127 | if (!l) return;
|
33128 |
|
33129 | this.setState({
|
33130 | oldDragItem: (0, _utils.cloneLayoutItem)(l),
|
33131 | oldLayout: this.state.layout
|
33132 | });
|
33133 |
|
33134 | return this.props.onDragStart(layout, l, l, null, e, node);
|
33135 | };
|
33136 |
|
33137 | |
33138 |
|
33139 |
|
33140 |
|
33141 |
|
33142 |
|
33143 |
|
33144 |
|
33145 |
|
33146 |
|
33147 | ReactGridLayout.prototype.onDrag = function onDrag(i, x, y, _ref2) {
|
33148 | var e = _ref2.e,
|
33149 | node = _ref2.node;
|
33150 | var oldDragItem = this.state.oldDragItem;
|
33151 | var layout = this.state.layout;
|
33152 | var cols = this.props.cols;
|
33153 |
|
33154 | var l = (0, _utils.getLayoutItem)(layout, i);
|
33155 | if (!l) return;
|
33156 |
|
33157 |
|
33158 | var placeholder = {
|
33159 | w: l.w,
|
33160 | h: l.h,
|
33161 | x: l.x,
|
33162 | y: l.y,
|
33163 | placeholder: true,
|
33164 | i: i
|
33165 | };
|
33166 |
|
33167 |
|
33168 | var isUserAction = true;
|
33169 | layout = (0, _utils.moveElement)(layout, l, x, y, isUserAction, this.props.preventCollision, this.compactType(), cols);
|
33170 |
|
33171 | this.props.onDrag(layout, oldDragItem, l, placeholder, e, node);
|
33172 |
|
33173 | this.setState({
|
33174 | layout: (0, _utils.compact)(layout, this.compactType(), cols),
|
33175 | activeDrag: placeholder
|
33176 | });
|
33177 | };
|
33178 |
|
33179 | |
33180 |
|
33181 |
|
33182 |
|
33183 |
|
33184 |
|
33185 |
|
33186 |
|
33187 |
|
33188 |
|
33189 | ReactGridLayout.prototype.onDragStop = function onDragStop(i, x, y, _ref3) {
|
33190 | var e = _ref3.e,
|
33191 | node = _ref3.node;
|
33192 | var oldDragItem = this.state.oldDragItem;
|
33193 | var layout = this.state.layout;
|
33194 | var _props = this.props,
|
33195 | cols = _props.cols,
|
33196 | preventCollision = _props.preventCollision;
|
33197 |
|
33198 | var l = (0, _utils.getLayoutItem)(layout, i);
|
33199 | if (!l) return;
|
33200 |
|
33201 |
|
33202 | var isUserAction = true;
|
33203 | layout = (0, _utils.moveElement)(layout, l, x, y, isUserAction, preventCollision, this.compactType(), cols);
|
33204 |
|
33205 | this.props.onDragStop(layout, oldDragItem, l, null, e, node);
|
33206 |
|
33207 |
|
33208 | var newLayout = (0, _utils.compact)(layout, this.compactType(), cols);
|
33209 | var oldLayout = this.state.oldLayout;
|
33210 |
|
33211 | this.setState({
|
33212 | activeDrag: null,
|
33213 | layout: newLayout,
|
33214 | oldDragItem: null,
|
33215 | oldLayout: null
|
33216 | });
|
33217 |
|
33218 | this.onLayoutMaybeChanged(newLayout, oldLayout);
|
33219 | };
|
33220 |
|
33221 | ReactGridLayout.prototype.onLayoutMaybeChanged = function onLayoutMaybeChanged(newLayout, oldLayout) {
|
33222 | if (!oldLayout) oldLayout = this.state.layout;
|
33223 | if (!(0, _lodash2.default)(oldLayout, newLayout)) {
|
33224 | this.props.onLayoutChange(newLayout);
|
33225 | }
|
33226 | };
|
33227 |
|
33228 | ReactGridLayout.prototype.onResizeStart = function onResizeStart(i, w, h, _ref4) {
|
33229 | var e = _ref4.e,
|
33230 | node = _ref4.node;
|
33231 | var layout = this.state.layout;
|
33232 |
|
33233 | var l = (0, _utils.getLayoutItem)(layout, i);
|
33234 | if (!l) return;
|
33235 |
|
33236 | this.setState({
|
33237 | oldResizeItem: (0, _utils.cloneLayoutItem)(l),
|
33238 | oldLayout: this.state.layout
|
33239 | });
|
33240 |
|
33241 | this.props.onResizeStart(layout, l, l, null, e, node);
|
33242 | };
|
33243 |
|
33244 | ReactGridLayout.prototype.onResize = function onResize(i, w, h, _ref5) {
|
33245 | var e = _ref5.e,
|
33246 | node = _ref5.node;
|
33247 | var _state = this.state,
|
33248 | layout = _state.layout,
|
33249 | oldResizeItem = _state.oldResizeItem;
|
33250 | var _props2 = this.props,
|
33251 | cols = _props2.cols,
|
33252 | preventCollision = _props2.preventCollision;
|
33253 |
|
33254 | var l = (0, _utils.getLayoutItem)(layout, i);
|
33255 | if (!l) return;
|
33256 |
|
33257 |
|
33258 |
|
33259 | var hasCollisions = void 0;
|
33260 | if (preventCollision) {
|
33261 | var collisions = (0, _utils.getAllCollisions)(layout, _extends({}, l, { w: w, h: h })).filter(function (layoutItem) {
|
33262 | return layoutItem.i !== l.i;
|
33263 | });
|
33264 | hasCollisions = collisions.length > 0;
|
33265 |
|
33266 |
|
33267 | if (hasCollisions) {
|
33268 |
|
33269 | var leastX = Infinity,
|
33270 | leastY = Infinity;
|
33271 | collisions.forEach(function (layoutItem) {
|
33272 | if (layoutItem.x > l.x) leastX = Math.min(leastX, layoutItem.x);
|
33273 | if (layoutItem.y > l.y) leastY = Math.min(leastY, layoutItem.y);
|
33274 | });
|
33275 |
|
33276 | if (Number.isFinite(leastX)) l.w = leastX - l.x;
|
33277 | if (Number.isFinite(leastY)) l.h = leastY - l.y;
|
33278 | }
|
33279 | }
|
33280 |
|
33281 | if (!hasCollisions) {
|
33282 |
|
33283 | l.w = w;
|
33284 | l.h = h;
|
33285 | }
|
33286 |
|
33287 |
|
33288 | var placeholder = {
|
33289 | w: l.w,
|
33290 | h: l.h,
|
33291 | x: l.x,
|
33292 | y: l.y,
|
33293 | static: true,
|
33294 | i: i
|
33295 | };
|
33296 |
|
33297 | this.props.onResize(layout, oldResizeItem, l, placeholder, e, node);
|
33298 |
|
33299 |
|
33300 | this.setState({
|
33301 | layout: (0, _utils.compact)(layout, this.compactType(), cols),
|
33302 | activeDrag: placeholder
|
33303 | });
|
33304 | };
|
33305 |
|
33306 | ReactGridLayout.prototype.onResizeStop = function onResizeStop(i, w, h, _ref6) {
|
33307 | var e = _ref6.e,
|
33308 | node = _ref6.node;
|
33309 | var _state2 = this.state,
|
33310 | layout = _state2.layout,
|
33311 | oldResizeItem = _state2.oldResizeItem;
|
33312 | var cols = this.props.cols;
|
33313 |
|
33314 | var l = (0, _utils.getLayoutItem)(layout, i);
|
33315 |
|
33316 | this.props.onResizeStop(layout, oldResizeItem, l, null, e, node);
|
33317 |
|
33318 |
|
33319 | var newLayout = (0, _utils.compact)(layout, this.compactType(), cols);
|
33320 | var oldLayout = this.state.oldLayout;
|
33321 |
|
33322 | this.setState({
|
33323 | activeDrag: null,
|
33324 | layout: newLayout,
|
33325 | oldResizeItem: null,
|
33326 | oldLayout: null
|
33327 | });
|
33328 |
|
33329 | this.onLayoutMaybeChanged(newLayout, oldLayout);
|
33330 | };
|
33331 |
|
33332 | |
33333 |
|
33334 |
|
33335 |
|
33336 |
|
33337 |
|
33338 | ReactGridLayout.prototype.placeholder = function placeholder() {
|
33339 | var activeDrag = this.state.activeDrag;
|
33340 |
|
33341 | if (!activeDrag) return null;
|
33342 | var _props3 = this.props,
|
33343 | width = _props3.width,
|
33344 | cols = _props3.cols,
|
33345 | margin = _props3.margin,
|
33346 | containerPadding = _props3.containerPadding,
|
33347 | rowHeight = _props3.rowHeight,
|
33348 | maxRows = _props3.maxRows,
|
33349 | useCSSTransforms = _props3.useCSSTransforms;
|
33350 |
|
33351 |
|
33352 |
|
33353 | return _react2.default.createElement(
|
33354 | _GridItem2.default,
|
33355 | {
|
33356 | w: activeDrag.w,
|
33357 | h: activeDrag.h,
|
33358 | x: activeDrag.x,
|
33359 | y: activeDrag.y,
|
33360 | i: activeDrag.i,
|
33361 | className: "react-grid-placeholder",
|
33362 | containerWidth: width,
|
33363 | cols: cols,
|
33364 | margin: margin,
|
33365 | containerPadding: containerPadding || margin,
|
33366 | maxRows: maxRows,
|
33367 | rowHeight: rowHeight,
|
33368 | isDraggable: false,
|
33369 | isResizable: false,
|
33370 | useCSSTransforms: useCSSTransforms
|
33371 | },
|
33372 | _react2.default.createElement("div", null)
|
33373 | );
|
33374 | };
|
33375 |
|
33376 | |
33377 |
|
33378 |
|
33379 |
|
33380 |
|
33381 |
|
33382 |
|
33383 | ReactGridLayout.prototype.processGridItem = function processGridItem(child) {
|
33384 | if (!child || !child.key) return;
|
33385 | var l = (0, _utils.getLayoutItem)(this.state.layout, String(child.key));
|
33386 | if (!l) return null;
|
33387 | var _props4 = this.props,
|
33388 | width = _props4.width,
|
33389 | cols = _props4.cols,
|
33390 | margin = _props4.margin,
|
33391 | containerPadding = _props4.containerPadding,
|
33392 | rowHeight = _props4.rowHeight,
|
33393 | maxRows = _props4.maxRows,
|
33394 | isDraggable = _props4.isDraggable,
|
33395 | isResizable = _props4.isResizable,
|
33396 | useCSSTransforms = _props4.useCSSTransforms,
|
33397 | draggableCancel = _props4.draggableCancel,
|
33398 | draggableHandle = _props4.draggableHandle;
|
33399 | var mounted = this.state.mounted;
|
33400 |
|
33401 |
|
33402 |
|
33403 | var draggable = Boolean(!l.static && isDraggable && (l.isDraggable || l.isDraggable == null));
|
33404 | var resizable = Boolean(!l.static && isResizable && (l.isResizable || l.isResizable == null));
|
33405 |
|
33406 | return _react2.default.createElement(
|
33407 | _GridItem2.default,
|
33408 | {
|
33409 | containerWidth: width,
|
33410 | cols: cols,
|
33411 | margin: margin,
|
33412 | containerPadding: containerPadding || margin,
|
33413 | maxRows: maxRows,
|
33414 | rowHeight: rowHeight,
|
33415 | cancel: draggableCancel,
|
33416 | handle: draggableHandle,
|
33417 | onDragStop: this.onDragStop,
|
33418 | onDragStart: this.onDragStart,
|
33419 | onDrag: this.onDrag,
|
33420 | onResizeStart: this.onResizeStart,
|
33421 | onResize: this.onResize,
|
33422 | onResizeStop: this.onResizeStop,
|
33423 | isDraggable: draggable,
|
33424 | isResizable: resizable,
|
33425 | useCSSTransforms: useCSSTransforms && mounted,
|
33426 | usePercentages: !mounted,
|
33427 | w: l.w,
|
33428 | h: l.h,
|
33429 | x: l.x,
|
33430 | y: l.y,
|
33431 | i: l.i,
|
33432 | minH: l.minH,
|
33433 | minW: l.minW,
|
33434 | maxH: l.maxH,
|
33435 | maxW: l.maxW,
|
33436 | "static": l.static
|
33437 | },
|
33438 | child
|
33439 | );
|
33440 | };
|
33441 |
|
33442 | ReactGridLayout.prototype.render = function render() {
|
33443 | var _this2 = this;
|
33444 |
|
33445 | var _props5 = this.props,
|
33446 | className = _props5.className,
|
33447 | style = _props5.style;
|
33448 |
|
33449 |
|
33450 | var mergedClassName = (0, _classnames2.default)("react-grid-layout", className);
|
33451 | var mergedStyle = _extends({
|
33452 | height: this.containerHeight()
|
33453 | }, style);
|
33454 |
|
33455 | return _react2.default.createElement(
|
33456 | "div",
|
33457 | { className: mergedClassName, style: mergedStyle },
|
33458 | _react2.default.Children.map(this.props.children, function (child) {
|
33459 | return _this2.processGridItem(child);
|
33460 | }),
|
33461 | this.placeholder()
|
33462 | );
|
33463 | };
|
33464 |
|
33465 | return ReactGridLayout;
|
33466 | }(_react2.default.Component);
|
33467 |
|
33468 | ReactGridLayout.displayName = "ReactGridLayout";
|
33469 | ReactGridLayout.propTypes = {
|
33470 |
|
33471 |
|
33472 |
|
33473 | className: _propTypes2.default.string,
|
33474 | style: _propTypes2.default.object,
|
33475 |
|
33476 |
|
33477 |
|
33478 |
|
33479 | width: _propTypes2.default.number,
|
33480 |
|
33481 |
|
33482 | autoSize: _propTypes2.default.bool,
|
33483 |
|
33484 | cols: _propTypes2.default.number,
|
33485 |
|
33486 |
|
33487 | draggableCancel: _propTypes2.default.string,
|
33488 |
|
33489 | draggableHandle: _propTypes2.default.string,
|
33490 |
|
33491 |
|
33492 | verticalCompact: function verticalCompact(props) {
|
33493 | if (props.verticalCompact === false && process.env.NODE_ENV !== "production") {
|
33494 | console.warn(
|
33495 |
|
33496 | "`verticalCompact` on <ReactGridLayout> is deprecated and will be removed soon. " + 'Use `compactType`: "horizontal" | "vertical" | null.');
|
33497 | }
|
33498 | },
|
33499 |
|
33500 | compactType: _propTypes2.default.oneOf(["vertical", "horizontal"]),
|
33501 |
|
33502 |
|
33503 |
|
33504 | layout: function layout(props) {
|
33505 | var layout = props.layout;
|
33506 |
|
33507 | if (layout === undefined) return;
|
33508 | (0, _utils.validateLayout)(layout, "layout");
|
33509 | },
|
33510 |
|
33511 |
|
33512 |
|
33513 |
|
33514 |
|
33515 |
|
33516 | margin: _propTypes2.default.arrayOf(_propTypes2.default.number),
|
33517 |
|
33518 | containerPadding: _propTypes2.default.arrayOf(_propTypes2.default.number),
|
33519 |
|
33520 | rowHeight: _propTypes2.default.number,
|
33521 |
|
33522 |
|
33523 |
|
33524 |
|
33525 |
|
33526 | maxRows: _propTypes2.default.number,
|
33527 |
|
33528 |
|
33529 |
|
33530 |
|
33531 | isDraggable: _propTypes2.default.bool,
|
33532 | isResizable: _propTypes2.default.bool,
|
33533 |
|
33534 | preventCollision: _propTypes2.default.bool,
|
33535 |
|
33536 | useCSSTransforms: _propTypes2.default.bool,
|
33537 |
|
33538 |
|
33539 |
|
33540 |
|
33541 |
|
33542 |
|
33543 | onLayoutChange: _propTypes2.default.func,
|
33544 |
|
33545 |
|
33546 |
|
33547 | onDragStart: _propTypes2.default.func,
|
33548 |
|
33549 | onDrag: _propTypes2.default.func,
|
33550 |
|
33551 | onDragStop: _propTypes2.default.func,
|
33552 |
|
33553 | onResizeStart: _propTypes2.default.func,
|
33554 |
|
33555 | onResize: _propTypes2.default.func,
|
33556 |
|
33557 | onResizeStop: _propTypes2.default.func,
|
33558 |
|
33559 |
|
33560 |
|
33561 |
|
33562 |
|
33563 |
|
33564 | children: function children(props, propName) {
|
33565 | var children = props[propName];
|
33566 |
|
33567 |
|
33568 | var keys = {};
|
33569 | _react2.default.Children.forEach(children, function (child) {
|
33570 | if (keys[child.key]) {
|
33571 | throw new Error('Duplicate child key "' + child.key + '" found! This will cause problems in ReactGridLayout.');
|
33572 | }
|
33573 | keys[child.key] = true;
|
33574 | });
|
33575 | }
|
33576 | };
|
33577 | ReactGridLayout.defaultProps = {
|
33578 | autoSize: true,
|
33579 | cols: 12,
|
33580 | className: "",
|
33581 | style: {},
|
33582 | draggableHandle: "",
|
33583 | draggableCancel: "",
|
33584 | containerPadding: null,
|
33585 | rowHeight: 150,
|
33586 | maxRows: Infinity,
|
33587 | layout: [],
|
33588 | margin: [10, 10],
|
33589 | isDraggable: true,
|
33590 | isResizable: true,
|
33591 | useCSSTransforms: true,
|
33592 | verticalCompact: true,
|
33593 | compactType: "vertical",
|
33594 | preventCollision: false,
|
33595 | onLayoutChange: _utils.noop,
|
33596 | onDragStart: _utils.noop,
|
33597 | onDrag: _utils.noop,
|
33598 | onDragStop: _utils.noop,
|
33599 | onResizeStart: _utils.noop,
|
33600 | onResize: _utils.noop,
|
33601 | onResizeStop: _utils.noop
|
33602 | };
|
33603 |
|
33604 | var _initialiseProps = function _initialiseProps() {
|
33605 | this.state = {
|
33606 | activeDrag: null,
|
33607 | layout: (0, _utils.synchronizeLayoutWithChildren)(this.props.layout, this.props.children, this.props.cols,
|
33608 |
|
33609 | this.compactType()),
|
33610 | mounted: false,
|
33611 | oldDragItem: null,
|
33612 | oldLayout: null,
|
33613 | oldResizeItem: null
|
33614 | };
|
33615 | };
|
33616 |
|
33617 | exports.default = ReactGridLayout;
|
33618 | }.call(exports, __webpack_require__(33)))
|
33619 |
|
33620 | }),
|
33621 |
|
33622 | (function(module, exports, __webpack_require__) {
|
33623 |
|
33624 | (function(process) {"use strict";
|
33625 |
|
33626 | exports.__esModule = true;
|
33627 | exports.noop = undefined;
|
33628 |
|
33629 | 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; };
|
33630 |
|
33631 | exports.bottom = bottom;
|
33632 | exports.cloneLayout = cloneLayout;
|
33633 | exports.cloneLayoutItem = cloneLayoutItem;
|
33634 | exports.childrenEqual = childrenEqual;
|
33635 | exports.collides = collides;
|
33636 | exports.compact = compact;
|
33637 | exports.compactItem = compactItem;
|
33638 | exports.correctBounds = correctBounds;
|
33639 | exports.getLayoutItem = getLayoutItem;
|
33640 | exports.getFirstCollision = getFirstCollision;
|
33641 | exports.getAllCollisions = getAllCollisions;
|
33642 | exports.getStatics = getStatics;
|
33643 | exports.moveElement = moveElement;
|
33644 | exports.moveElementAwayFromCollision = moveElementAwayFromCollision;
|
33645 | exports.perc = perc;
|
33646 | exports.setTransform = setTransform;
|
33647 | exports.setTopLeft = setTopLeft;
|
33648 | exports.sortLayoutItems = sortLayoutItems;
|
33649 | exports.sortLayoutItemsByRowCol = sortLayoutItemsByRowCol;
|
33650 | exports.sortLayoutItemsByColRow = sortLayoutItemsByColRow;
|
33651 | exports.synchronizeLayoutWithChildren = synchronizeLayoutWithChildren;
|
33652 | exports.validateLayout = validateLayout;
|
33653 | exports.autoBindHandlers = autoBindHandlers;
|
33654 |
|
33655 | var _lodash = __webpack_require__(258);
|
33656 |
|
33657 | var _lodash2 = _interopRequireDefault(_lodash);
|
33658 |
|
33659 | var _react = __webpack_require__(1);
|
33660 |
|
33661 | var _react2 = _interopRequireDefault(_react);
|
33662 |
|
33663 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33664 |
|
33665 |
|
33666 | var isProduction = process.env.NODE_ENV === "production";
|
33667 | var DEBUG = false;
|
33668 |
|
33669 | |
33670 |
|
33671 |
|
33672 |
|
33673 |
|
33674 |
|
33675 | function bottom(layout) {
|
33676 | var max = 0,
|
33677 | bottomY = void 0;
|
33678 | for (var _i = 0, len = layout.length; _i < len; _i++) {
|
33679 | bottomY = layout[_i].y + layout[_i].h;
|
33680 | if (bottomY > max) max = bottomY;
|
33681 | }
|
33682 | return max;
|
33683 | }
|
33684 |
|
33685 | function cloneLayout(layout) {
|
33686 | var newLayout = Array(layout.length);
|
33687 | for (var _i2 = 0, len = layout.length; _i2 < len; _i2++) {
|
33688 | newLayout[_i2] = cloneLayoutItem(layout[_i2]);
|
33689 | }
|
33690 | return newLayout;
|
33691 | }
|
33692 |
|
33693 |
|
33694 | function cloneLayoutItem(layoutItem) {
|
33695 | return {
|
33696 | w: layoutItem.w,
|
33697 | h: layoutItem.h,
|
33698 | x: layoutItem.x,
|
33699 | y: layoutItem.y,
|
33700 | i: layoutItem.i,
|
33701 | minW: layoutItem.minW,
|
33702 | maxW: layoutItem.maxW,
|
33703 | minH: layoutItem.minH,
|
33704 | maxH: layoutItem.maxH,
|
33705 | moved: Boolean(layoutItem.moved),
|
33706 | static: Boolean(layoutItem.static),
|
33707 |
|
33708 | isDraggable: layoutItem.isDraggable,
|
33709 | isResizable: layoutItem.isResizable
|
33710 | };
|
33711 | }
|
33712 |
|
33713 | |
33714 |
|
33715 |
|
33716 |
|
33717 | function childrenEqual(a, b) {
|
33718 | return (0, _lodash2.default)(_react2.default.Children.map(a, function (c) {
|
33719 | return c.key;
|
33720 | }), _react2.default.Children.map(b, function (c) {
|
33721 | return c.key;
|
33722 | }));
|
33723 | }
|
33724 |
|
33725 | |
33726 |
|
33727 |
|
33728 | function collides(l1, l2) {
|
33729 | if (l1 === l2) return false;
|
33730 | if (l1.x + l1.w <= l2.x) return false;
|
33731 | if (l1.x >= l2.x + l2.w) return false;
|
33732 | if (l1.y + l1.h <= l2.y) return false;
|
33733 | if (l1.y >= l2.y + l2.h) return false;
|
33734 | return true;
|
33735 | }
|
33736 |
|
33737 | |
33738 |
|
33739 |
|
33740 |
|
33741 |
|
33742 |
|
33743 |
|
33744 |
|
33745 |
|
33746 | function compact(layout, compactType, cols) {
|
33747 |
|
33748 | var compareWith = getStatics(layout);
|
33749 |
|
33750 | var sorted = sortLayoutItems(layout, compactType);
|
33751 |
|
33752 | var out = Array(layout.length);
|
33753 |
|
33754 | for (var _i3 = 0, len = sorted.length; _i3 < len; _i3++) {
|
33755 | var l = cloneLayoutItem(sorted[_i3]);
|
33756 |
|
33757 |
|
33758 | if (!l.static) {
|
33759 | l = compactItem(compareWith, l, compactType, cols, sorted);
|
33760 |
|
33761 |
|
33762 |
|
33763 | compareWith.push(l);
|
33764 | }
|
33765 |
|
33766 |
|
33767 | out[layout.indexOf(sorted[_i3])] = l;
|
33768 |
|
33769 |
|
33770 | l.moved = false;
|
33771 | }
|
33772 |
|
33773 | return out;
|
33774 | }
|
33775 |
|
33776 | var heightWidth = { x: "w", y: "h" };
|
33777 | |
33778 |
|
33779 |
|
33780 | function resolveCompactionCollision(layout, item, moveToCoord, axis) {
|
33781 | var sizeProp = heightWidth[axis];
|
33782 | item[axis] += 1;
|
33783 | var itemIndex = layout.indexOf(item);
|
33784 |
|
33785 |
|
33786 | for (var _i4 = itemIndex + 1; _i4 < layout.length; _i4++) {
|
33787 | var otherItem = layout[_i4];
|
33788 |
|
33789 | if (otherItem.static) continue;
|
33790 |
|
33791 |
|
33792 |
|
33793 | if (otherItem.y > item.y + item.h) break;
|
33794 |
|
33795 | if (collides(item, otherItem)) {
|
33796 | resolveCompactionCollision(layout, otherItem, moveToCoord + item[sizeProp], axis);
|
33797 | }
|
33798 | }
|
33799 |
|
33800 | item[axis] = moveToCoord;
|
33801 | }
|
33802 |
|
33803 | |
33804 |
|
33805 |
|
33806 | function compactItem(compareWith, l, compactType, cols, fullLayout) {
|
33807 | var compactV = compactType === "vertical";
|
33808 | var compactH = compactType === "horizontal";
|
33809 | if (compactV) {
|
33810 |
|
33811 |
|
33812 |
|
33813 | l.y = Math.min(bottom(compareWith), l.y);
|
33814 |
|
33815 | while (l.y > 0 && !getFirstCollision(compareWith, l)) {
|
33816 | l.y--;
|
33817 | }
|
33818 | } else if (compactH) {
|
33819 | l.y = Math.min(bottom(compareWith), l.y);
|
33820 |
|
33821 | while (l.x > 0 && !getFirstCollision(compareWith, l)) {
|
33822 | l.x--;
|
33823 | }
|
33824 | }
|
33825 |
|
33826 |
|
33827 | var collides = void 0;
|
33828 | while (collides = getFirstCollision(compareWith, l)) {
|
33829 | if (compactH) {
|
33830 | resolveCompactionCollision(fullLayout, l, collides.x + collides.w, "x");
|
33831 | } else {
|
33832 | resolveCompactionCollision(fullLayout, l, collides.y + collides.h, "y");
|
33833 | }
|
33834 |
|
33835 | if (compactH && l.x + l.w > cols) {
|
33836 | l.x = cols - l.w;
|
33837 | l.y++;
|
33838 | }
|
33839 | }
|
33840 | return l;
|
33841 | }
|
33842 |
|
33843 | |
33844 |
|
33845 |
|
33846 |
|
33847 |
|
33848 |
|
33849 | function correctBounds(layout, bounds) {
|
33850 | var collidesWith = getStatics(layout);
|
33851 | for (var _i5 = 0, len = layout.length; _i5 < len; _i5++) {
|
33852 | var l = layout[_i5];
|
33853 |
|
33854 | if (l.x + l.w > bounds.cols) l.x = bounds.cols - l.w;
|
33855 |
|
33856 | if (l.x < 0) {
|
33857 | l.x = 0;
|
33858 | l.w = bounds.cols;
|
33859 | }
|
33860 | if (!l.static) collidesWith.push(l);else {
|
33861 |
|
33862 |
|
33863 | while (getFirstCollision(collidesWith, l)) {
|
33864 | l.y++;
|
33865 | }
|
33866 | }
|
33867 | }
|
33868 | return layout;
|
33869 | }
|
33870 |
|
33871 | |
33872 |
|
33873 |
|
33874 |
|
33875 |
|
33876 |
|
33877 |
|
33878 | function getLayoutItem(layout, id) {
|
33879 | for (var _i6 = 0, len = layout.length; _i6 < len; _i6++) {
|
33880 | if (layout[_i6].i === id) return layout[_i6];
|
33881 | }
|
33882 | }
|
33883 |
|
33884 | |
33885 |
|
33886 |
|
33887 |
|
33888 |
|
33889 |
|
33890 |
|
33891 |
|
33892 | function getFirstCollision(layout, layoutItem) {
|
33893 | for (var _i7 = 0, len = layout.length; _i7 < len; _i7++) {
|
33894 | if (collides(layout[_i7], layoutItem)) return layout[_i7];
|
33895 | }
|
33896 | }
|
33897 |
|
33898 | function getAllCollisions(layout, layoutItem) {
|
33899 | return layout.filter(function (l) {
|
33900 | return collides(l, layoutItem);
|
33901 | });
|
33902 | }
|
33903 |
|
33904 | |
33905 |
|
33906 |
|
33907 |
|
33908 |
|
33909 | function getStatics(layout) {
|
33910 | return layout.filter(function (l) {
|
33911 | return l.static;
|
33912 | });
|
33913 | }
|
33914 |
|
33915 | |
33916 |
|
33917 |
|
33918 |
|
33919 |
|
33920 |
|
33921 |
|
33922 |
|
33923 | function moveElement(layout, l, x, y, isUserAction, preventCollision, compactType, cols) {
|
33924 | if (l.static) return layout;
|
33925 |
|
33926 |
|
33927 | if (l.y === y && l.x === x) return layout;
|
33928 |
|
33929 | log("Moving element " + l.i + " to [" + String(x) + "," + String(y) + "] from [" + l.x + "," + l.y + "]");
|
33930 | var oldX = l.x;
|
33931 | var oldY = l.y;
|
33932 |
|
33933 |
|
33934 | if (typeof x === 'number') l.x = x;
|
33935 | if (typeof y === 'number') l.y = y;
|
33936 | l.moved = true;
|
33937 |
|
33938 |
|
33939 |
|
33940 |
|
33941 |
|
33942 | var sorted = sortLayoutItems(layout, compactType);
|
33943 | var movingUp = compactType === "vertical" && typeof y === 'number' ? oldY >= y : compactType === "horizontal" && typeof x === 'number' ? oldX >= x : false;
|
33944 | if (movingUp) sorted = sorted.reverse();
|
33945 | var collisions = getAllCollisions(sorted, l);
|
33946 |
|
33947 |
|
33948 | if (preventCollision && collisions.length) {
|
33949 | log("Collision prevented on " + l.i + ", reverting.");
|
33950 | l.x = oldX;
|
33951 | l.y = oldY;
|
33952 | l.moved = false;
|
33953 | return layout;
|
33954 | }
|
33955 |
|
33956 |
|
33957 | for (var _i8 = 0, len = collisions.length; _i8 < len; _i8++) {
|
33958 | var collision = collisions[_i8];
|
33959 | log("Resolving collision between " + l.i + " at [" + l.x + "," + l.y + "] and " + collision.i + " at [" + collision.x + "," + collision.y + "]");
|
33960 |
|
33961 |
|
33962 | if (collision.moved) continue;
|
33963 |
|
33964 |
|
33965 | if (collision.static) {
|
33966 | layout = moveElementAwayFromCollision(layout, collision, l, isUserAction, compactType, cols);
|
33967 | } else {
|
33968 | layout = moveElementAwayFromCollision(layout, l, collision, isUserAction, compactType, cols);
|
33969 | }
|
33970 | }
|
33971 |
|
33972 | return layout;
|
33973 | }
|
33974 |
|
33975 | |
33976 |
|
33977 |
|
33978 |
|
33979 |
|
33980 |
|
33981 |
|
33982 |
|
33983 | function moveElementAwayFromCollision(layout, collidesWith, itemToMove, isUserAction, compactType, cols) {
|
33984 | var compactH = compactType === "horizontal";
|
33985 | var compactV = compactType === "vertical";
|
33986 | var preventCollision = false;
|
33987 |
|
33988 |
|
33989 |
|
33990 |
|
33991 | if (isUserAction) {
|
33992 |
|
33993 | isUserAction = false;
|
33994 |
|
33995 |
|
33996 | var fakeItem = {
|
33997 | x: compactH ? Math.max(collidesWith.x - itemToMove.w, 0) : itemToMove.x,
|
33998 | y: compactV ? Math.max(collidesWith.y - itemToMove.h, 0) : itemToMove.y,
|
33999 | w: itemToMove.w,
|
34000 | h: itemToMove.h,
|
34001 | i: "-1"
|
34002 | };
|
34003 |
|
34004 |
|
34005 | if (!getFirstCollision(layout, fakeItem)) {
|
34006 | log("Doing reverse collision on " + itemToMove.i + " up to [" + fakeItem.x + "," + fakeItem.y + "].");
|
34007 | return moveElement(layout, itemToMove, compactH ? fakeItem.x : undefined, compactV ? fakeItem.y : undefined, isUserAction, preventCollision, compactType, cols);
|
34008 | }
|
34009 | }
|
34010 |
|
34011 | return moveElement(layout, itemToMove, compactH ? itemToMove.x + 1 : undefined, compactV ? itemToMove.y + 1 : undefined, isUserAction, preventCollision, compactType, cols);
|
34012 | }
|
34013 |
|
34014 | |
34015 |
|
34016 |
|
34017 |
|
34018 |
|
34019 |
|
34020 | function perc(num) {
|
34021 | return num * 100 + "%";
|
34022 | }
|
34023 |
|
34024 | function setTransform(_ref) {
|
34025 | var top = _ref.top,
|
34026 | left = _ref.left,
|
34027 | width = _ref.width,
|
34028 | height = _ref.height;
|
34029 |
|
34030 |
|
34031 | var translate = "translate(" + left + "px," + top + "px)";
|
34032 | return {
|
34033 | transform: translate,
|
34034 | WebkitTransform: translate,
|
34035 | MozTransform: translate,
|
34036 | msTransform: translate,
|
34037 | OTransform: translate,
|
34038 | width: width + "px",
|
34039 | height: height + "px",
|
34040 | position: "absolute"
|
34041 | };
|
34042 | }
|
34043 |
|
34044 | function setTopLeft(_ref2) {
|
34045 | var top = _ref2.top,
|
34046 | left = _ref2.left,
|
34047 | width = _ref2.width,
|
34048 | height = _ref2.height;
|
34049 |
|
34050 | return {
|
34051 | top: top + "px",
|
34052 | left: left + "px",
|
34053 | width: width + "px",
|
34054 | height: height + "px",
|
34055 | position: "absolute"
|
34056 | };
|
34057 | }
|
34058 |
|
34059 | |
34060 |
|
34061 |
|
34062 |
|
34063 |
|
34064 |
|
34065 | function sortLayoutItems(layout, compactType) {
|
34066 | if (compactType === "horizontal") return sortLayoutItemsByColRow(layout);else return sortLayoutItemsByRowCol(layout);
|
34067 | }
|
34068 |
|
34069 | function sortLayoutItemsByRowCol(layout) {
|
34070 | return [].concat(layout).sort(function (a, b) {
|
34071 | if (a.y > b.y || a.y === b.y && a.x > b.x) {
|
34072 | return 1;
|
34073 | } else if (a.y === b.y && a.x === b.x) {
|
34074 |
|
34075 | return 0;
|
34076 | }
|
34077 | return -1;
|
34078 | });
|
34079 | }
|
34080 |
|
34081 | function sortLayoutItemsByColRow(layout) {
|
34082 | return [].concat(layout).sort(function (a, b) {
|
34083 | if (a.x > b.x || a.x === b.x && a.y > b.y) {
|
34084 | return 1;
|
34085 | }
|
34086 | return -1;
|
34087 | });
|
34088 | }
|
34089 |
|
34090 | |
34091 |
|
34092 |
|
34093 |
|
34094 |
|
34095 |
|
34096 |
|
34097 |
|
34098 |
|
34099 | function synchronizeLayoutWithChildren(initialLayout, children, cols, compactType) {
|
34100 | initialLayout = initialLayout || [];
|
34101 |
|
34102 |
|
34103 | var layout = [];
|
34104 | _react2.default.Children.forEach(children, function (child, i) {
|
34105 |
|
34106 | var exists = getLayoutItem(initialLayout, String(child.key));
|
34107 | if (exists) {
|
34108 | layout[i] = cloneLayoutItem(exists);
|
34109 | } else {
|
34110 | if (!isProduction && child.props._grid) {
|
34111 | console.warn("`_grid` properties on children have been deprecated as of React 15.2. " +
|
34112 | "Please use `data-grid` or add your properties directly to the `layout`.");
|
34113 | }
|
34114 | var g = child.props["data-grid"] || child.props._grid;
|
34115 |
|
34116 |
|
34117 | if (g) {
|
34118 | if (!isProduction) {
|
34119 | validateLayout([g], "ReactGridLayout.children");
|
34120 | }
|
34121 | layout[i] = cloneLayoutItem(_extends({}, g, { i: child.key }));
|
34122 | } else {
|
34123 |
|
34124 | layout[i] = cloneLayoutItem({
|
34125 | w: 1,
|
34126 | h: 1,
|
34127 | x: 0,
|
34128 | y: bottom(layout),
|
34129 | i: String(child.key)
|
34130 | });
|
34131 | }
|
34132 | }
|
34133 | });
|
34134 |
|
34135 |
|
34136 | layout = correctBounds(layout, { cols: cols });
|
34137 | layout = compact(layout, compactType, cols);
|
34138 |
|
34139 | return layout;
|
34140 | }
|
34141 |
|
34142 | |
34143 |
|
34144 |
|
34145 |
|
34146 |
|
34147 |
|
34148 |
|
34149 | function validateLayout(layout) {
|
34150 | var contextName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Layout";
|
34151 |
|
34152 | var subProps = ["x", "y", "w", "h"];
|
34153 | if (!Array.isArray(layout)) throw new Error(contextName + " must be an array!");
|
34154 | for (var _i9 = 0, len = layout.length; _i9 < len; _i9++) {
|
34155 | var item = layout[_i9];
|
34156 | for (var j = 0; j < subProps.length; j++) {
|
34157 | if (typeof item[subProps[j]] !== "number") {
|
34158 | throw new Error("ReactGridLayout: " + contextName + "[" + _i9 + "]." + subProps[j] + " must be a number!");
|
34159 | }
|
34160 | }
|
34161 | if (item.i && typeof item.i !== "string") {
|
34162 | throw new Error("ReactGridLayout: " + contextName + "[" + _i9 + "].i must be a string!");
|
34163 | }
|
34164 | if (item.static !== undefined && typeof item.static !== "boolean") {
|
34165 | throw new Error("ReactGridLayout: " + contextName + "[" + _i9 + "].static must be a boolean!");
|
34166 | }
|
34167 | }
|
34168 | }
|
34169 |
|
34170 |
|
34171 | function autoBindHandlers(el, fns) {
|
34172 | fns.forEach(function (key) {
|
34173 | return el[key] = el[key].bind(el);
|
34174 | });
|
34175 | }
|
34176 |
|
34177 | function log() {
|
34178 | var _console;
|
34179 |
|
34180 | if (!DEBUG) return;
|
34181 |
|
34182 | (_console = console).log.apply(_console, arguments);
|
34183 | }
|
34184 |
|
34185 | var noop = exports.noop = function noop() {};
|
34186 | }.call(exports, __webpack_require__(33)))
|
34187 |
|
34188 | }),
|
34189 |
|
34190 | (function(module, exports, __webpack_require__) {
|
34191 |
|
34192 | "use strict";
|
34193 |
|
34194 | exports.__esModule = true;
|
34195 |
|
34196 | 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; };
|
34197 |
|
34198 | var _react = __webpack_require__(1);
|
34199 |
|
34200 | var _react2 = _interopRequireDefault(_react);
|
34201 |
|
34202 | var _propTypes = __webpack_require__(6);
|
34203 |
|
34204 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
34205 |
|
34206 | var _reactDraggable = __webpack_require__(257);
|
34207 |
|
34208 | var _reactResizable = __webpack_require__(267);
|
34209 |
|
34210 | var _utils = __webpack_require__(265);
|
34211 |
|
34212 | var _classnames = __webpack_require__(5);
|
34213 |
|
34214 | var _classnames2 = _interopRequireDefault(_classnames);
|
34215 |
|
34216 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
34217 |
|
34218 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
34219 |
|
34220 | 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; }
|
34221 |
|
34222 | 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; }
|
34223 |
|
34224 | |
34225 |
|
34226 |
|
34227 | var GridItem = function (_React$Component) {
|
34228 | _inherits(GridItem, _React$Component);
|
34229 |
|
34230 | function GridItem() {
|
34231 | var _temp, _this, _ret;
|
34232 |
|
34233 | _classCallCheck(this, GridItem);
|
34234 |
|
34235 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
34236 | args[_key] = arguments[_key];
|
34237 | }
|
34238 |
|
34239 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
|
34240 | resizing: null,
|
34241 | dragging: null,
|
34242 | className: ""
|
34243 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
34244 | }
|
34245 |
|
34246 |
|
34247 | GridItem.prototype.calcColWidth = function calcColWidth() {
|
34248 | var _props = this.props,
|
34249 | margin = _props.margin,
|
34250 | containerPadding = _props.containerPadding,
|
34251 | containerWidth = _props.containerWidth,
|
34252 | cols = _props.cols;
|
34253 |
|
34254 | return (containerWidth - margin[0] * (cols - 1) - containerPadding[0] * 2) / cols;
|
34255 | };
|
34256 |
|
34257 | |
34258 |
|
34259 |
|
34260 |
|
34261 |
|
34262 |
|
34263 |
|
34264 |
|
34265 |
|
34266 |
|
34267 |
|
34268 | GridItem.prototype.calcPosition = function calcPosition(x, y, w, h, state) {
|
34269 | var _props2 = this.props,
|
34270 | margin = _props2.margin,
|
34271 | containerPadding = _props2.containerPadding,
|
34272 | rowHeight = _props2.rowHeight;
|
34273 |
|
34274 | var colWidth = this.calcColWidth();
|
34275 |
|
34276 | var out = {
|
34277 | left: Math.round((colWidth + margin[0]) * x + containerPadding[0]),
|
34278 | top: Math.round((rowHeight + margin[1]) * y + containerPadding[1]),
|
34279 |
|
34280 |
|
34281 |
|
34282 | width: w === Infinity ? w : Math.round(colWidth * w + Math.max(0, w - 1) * margin[0]),
|
34283 | height: h === Infinity ? h : Math.round(rowHeight * h + Math.max(0, h - 1) * margin[1])
|
34284 | };
|
34285 |
|
34286 | if (state && state.resizing) {
|
34287 | out.width = Math.round(state.resizing.width);
|
34288 | out.height = Math.round(state.resizing.height);
|
34289 | }
|
34290 |
|
34291 | if (state && state.dragging) {
|
34292 | out.top = Math.round(state.dragging.top);
|
34293 | out.left = Math.round(state.dragging.left);
|
34294 | }
|
34295 |
|
34296 | return out;
|
34297 | };
|
34298 |
|
34299 | |
34300 |
|
34301 |
|
34302 |
|
34303 |
|
34304 |
|
34305 |
|
34306 |
|
34307 | GridItem.prototype.calcXY = function calcXY(top, left) {
|
34308 | var _props3 = this.props,
|
34309 | margin = _props3.margin,
|
34310 | cols = _props3.cols,
|
34311 | rowHeight = _props3.rowHeight,
|
34312 | w = _props3.w,
|
34313 | h = _props3.h,
|
34314 | maxRows = _props3.maxRows;
|
34315 |
|
34316 | var colWidth = this.calcColWidth();
|
34317 |
|
34318 |
|
34319 |
|
34320 |
|
34321 |
|
34322 |
|
34323 |
|
34324 |
|
34325 | var x = Math.round((left - margin[0]) / (colWidth + margin[0]));
|
34326 | var y = Math.round((top - margin[1]) / (rowHeight + margin[1]));
|
34327 |
|
34328 |
|
34329 | x = Math.max(Math.min(x, cols - w), 0);
|
34330 | y = Math.max(Math.min(y, maxRows - h), 0);
|
34331 |
|
34332 | return { x: x, y: y };
|
34333 | };
|
34334 |
|
34335 | |
34336 |
|
34337 |
|
34338 |
|
34339 |
|
34340 |
|
34341 |
|
34342 |
|
34343 | GridItem.prototype.calcWH = function calcWH(_ref) {
|
34344 | var height = _ref.height,
|
34345 | width = _ref.width;
|
34346 | var _props4 = this.props,
|
34347 | margin = _props4.margin,
|
34348 | maxRows = _props4.maxRows,
|
34349 | cols = _props4.cols,
|
34350 | rowHeight = _props4.rowHeight,
|
34351 | x = _props4.x,
|
34352 | y = _props4.y;
|
34353 |
|
34354 | var colWidth = this.calcColWidth();
|
34355 |
|
34356 |
|
34357 |
|
34358 |
|
34359 | var w = Math.round((width + margin[0]) / (colWidth + margin[0]));
|
34360 | var h = Math.round((height + margin[1]) / (rowHeight + margin[1]));
|
34361 |
|
34362 |
|
34363 | w = Math.max(Math.min(w, cols - x), 0);
|
34364 | h = Math.max(Math.min(h, maxRows - y), 0);
|
34365 | return { w: w, h: h };
|
34366 | };
|
34367 |
|
34368 | |
34369 |
|
34370 |
|
34371 |
|
34372 |
|
34373 |
|
34374 |
|
34375 |
|
34376 |
|
34377 |
|
34378 |
|
34379 |
|
34380 | GridItem.prototype.createStyle = function createStyle(pos) {
|
34381 | var _props5 = this.props,
|
34382 | usePercentages = _props5.usePercentages,
|
34383 | containerWidth = _props5.containerWidth,
|
34384 | useCSSTransforms = _props5.useCSSTransforms;
|
34385 |
|
34386 |
|
34387 | var style = void 0;
|
34388 |
|
34389 | if (useCSSTransforms) {
|
34390 | style = (0, _utils.setTransform)(pos);
|
34391 | } else {
|
34392 |
|
34393 | style = (0, _utils.setTopLeft)(pos);
|
34394 |
|
34395 |
|
34396 | if (usePercentages) {
|
34397 | style.left = (0, _utils.perc)(pos.left / containerWidth);
|
34398 | style.width = (0, _utils.perc)(pos.width / containerWidth);
|
34399 | }
|
34400 | }
|
34401 |
|
34402 | return style;
|
34403 | };
|
34404 |
|
34405 | |
34406 |
|
34407 |
|
34408 |
|
34409 |
|
34410 |
|
34411 |
|
34412 | GridItem.prototype.mixinDraggable = function mixinDraggable(child) {
|
34413 | return _react2.default.createElement(
|
34414 | _reactDraggable.DraggableCore,
|
34415 | {
|
34416 | onStart: this.onDragHandler("onDragStart"),
|
34417 | onDrag: this.onDragHandler("onDrag"),
|
34418 | onStop: this.onDragHandler("onDragStop"),
|
34419 | handle: this.props.handle,
|
34420 | cancel: ".react-resizable-handle" + (this.props.cancel ? "," + this.props.cancel : "")
|
34421 | },
|
34422 | child
|
34423 | );
|
34424 | };
|
34425 |
|
34426 | |
34427 |
|
34428 |
|
34429 |
|
34430 |
|
34431 |
|
34432 |
|
34433 |
|
34434 | GridItem.prototype.mixinResizable = function mixinResizable(child, position) {
|
34435 | var _props6 = this.props,
|
34436 | cols = _props6.cols,
|
34437 | x = _props6.x,
|
34438 | minW = _props6.minW,
|
34439 | minH = _props6.minH,
|
34440 | maxW = _props6.maxW,
|
34441 | maxH = _props6.maxH;
|
34442 |
|
34443 |
|
34444 |
|
34445 | var maxWidth = this.calcPosition(0, 0, cols - x, 0).width;
|
34446 |
|
34447 |
|
34448 | var mins = this.calcPosition(0, 0, minW, minH);
|
34449 | var maxes = this.calcPosition(0, 0, maxW, maxH);
|
34450 | var minConstraints = [mins.width, mins.height];
|
34451 | var maxConstraints = [Math.min(maxes.width, maxWidth), Math.min(maxes.height, Infinity)];
|
34452 | return _react2.default.createElement(
|
34453 | _reactResizable.Resizable,
|
34454 | {
|
34455 | width: position.width,
|
34456 | height: position.height,
|
34457 | minConstraints: minConstraints,
|
34458 | maxConstraints: maxConstraints,
|
34459 | onResizeStop: this.onResizeHandler("onResizeStop"),
|
34460 | onResizeStart: this.onResizeHandler("onResizeStart"),
|
34461 | onResize: this.onResizeHandler("onResize")
|
34462 | },
|
34463 | child
|
34464 | );
|
34465 | };
|
34466 |
|
34467 | |
34468 |
|
34469 |
|
34470 |
|
34471 |
|
34472 |
|
34473 |
|
34474 |
|
34475 |
|
34476 |
|
34477 | GridItem.prototype.onDragHandler = function onDragHandler(handlerName) {
|
34478 | var _this2 = this;
|
34479 |
|
34480 | return function (e, _ref2) {
|
34481 | var node = _ref2.node,
|
34482 | deltaX = _ref2.deltaX,
|
34483 | deltaY = _ref2.deltaY;
|
34484 |
|
34485 | var handler = _this2.props[handlerName];
|
34486 | if (!handler) return;
|
34487 |
|
34488 | var newPosition = { top: 0, left: 0 };
|
34489 |
|
34490 |
|
34491 | switch (handlerName) {
|
34492 | case "onDragStart":
|
34493 | {
|
34494 |
|
34495 | var offsetParent = node.offsetParent;
|
34496 |
|
34497 | if (!offsetParent) return;
|
34498 | var parentRect = offsetParent.getBoundingClientRect();
|
34499 | var clientRect = node.getBoundingClientRect();
|
34500 | newPosition.left = clientRect.left - parentRect.left + offsetParent.scrollLeft;
|
34501 | newPosition.top = clientRect.top - parentRect.top + offsetParent.scrollTop;
|
34502 | _this2.setState({ dragging: newPosition });
|
34503 | break;
|
34504 | }
|
34505 | case "onDrag":
|
34506 | if (!_this2.state.dragging) throw new Error("onDrag called before onDragStart.");
|
34507 | newPosition.left = _this2.state.dragging.left + deltaX;
|
34508 | newPosition.top = _this2.state.dragging.top + deltaY;
|
34509 | _this2.setState({ dragging: newPosition });
|
34510 | break;
|
34511 | case "onDragStop":
|
34512 | if (!_this2.state.dragging) throw new Error("onDragEnd called before onDragStart.");
|
34513 | newPosition.left = _this2.state.dragging.left;
|
34514 | newPosition.top = _this2.state.dragging.top;
|
34515 | _this2.setState({ dragging: null });
|
34516 | break;
|
34517 | default:
|
34518 | throw new Error("onDragHandler called with unrecognized handlerName: " + handlerName);
|
34519 | }
|
34520 |
|
34521 | var _calcXY = _this2.calcXY(newPosition.top, newPosition.left),
|
34522 | x = _calcXY.x,
|
34523 | y = _calcXY.y;
|
34524 |
|
34525 | return handler.call(_this2, _this2.props.i, x, y, { e: e, node: node, newPosition: newPosition });
|
34526 | };
|
34527 | };
|
34528 |
|
34529 | |
34530 |
|
34531 |
|
34532 |
|
34533 |
|
34534 |
|
34535 |
|
34536 |
|
34537 |
|
34538 |
|
34539 | GridItem.prototype.onResizeHandler = function onResizeHandler(handlerName) {
|
34540 | var _this3 = this;
|
34541 |
|
34542 | return function (e, _ref3) {
|
34543 | var node = _ref3.node,
|
34544 | size = _ref3.size;
|
34545 |
|
34546 | var handler = _this3.props[handlerName];
|
34547 | if (!handler) return;
|
34548 | var _props7 = _this3.props,
|
34549 | cols = _props7.cols,
|
34550 | x = _props7.x,
|
34551 | i = _props7.i,
|
34552 | maxW = _props7.maxW,
|
34553 | minW = _props7.minW,
|
34554 | maxH = _props7.maxH,
|
34555 | minH = _props7.minH;
|
34556 |
|
34557 |
|
34558 |
|
34559 | var _calcWH = _this3.calcWH(size),
|
34560 | w = _calcWH.w,
|
34561 | h = _calcWH.h;
|
34562 |
|
34563 |
|
34564 |
|
34565 |
|
34566 | w = Math.min(w, cols - x);
|
34567 |
|
34568 | w = Math.max(w, 1);
|
34569 |
|
34570 |
|
34571 | w = Math.max(Math.min(w, maxW), minW);
|
34572 | h = Math.max(Math.min(h, maxH), minH);
|
34573 |
|
34574 | _this3.setState({ resizing: handlerName === "onResizeStop" ? null : size });
|
34575 |
|
34576 | handler.call(_this3, i, w, h, { e: e, node: node, size: size });
|
34577 | };
|
34578 | };
|
34579 |
|
34580 | GridItem.prototype.render = function render() {
|
34581 | var _props8 = this.props,
|
34582 | x = _props8.x,
|
34583 | y = _props8.y,
|
34584 | w = _props8.w,
|
34585 | h = _props8.h,
|
34586 | isDraggable = _props8.isDraggable,
|
34587 | isResizable = _props8.isResizable,
|
34588 | useCSSTransforms = _props8.useCSSTransforms;
|
34589 |
|
34590 |
|
34591 | var pos = this.calcPosition(x, y, w, h, this.state);
|
34592 | var child = _react2.default.Children.only(this.props.children);
|
34593 |
|
34594 |
|
34595 | var newChild = _react2.default.cloneElement(child, {
|
34596 | className: (0, _classnames2.default)("react-grid-item", child.props.className, this.props.className, {
|
34597 | static: this.props.static,
|
34598 | resizing: Boolean(this.state.resizing),
|
34599 | "react-draggable": isDraggable,
|
34600 | "react-draggable-dragging": Boolean(this.state.dragging),
|
34601 | cssTransforms: useCSSTransforms
|
34602 | }),
|
34603 |
|
34604 | style: _extends({}, this.props.style, child.props.style, this.createStyle(pos))
|
34605 | });
|
34606 |
|
34607 |
|
34608 | if (isResizable) newChild = this.mixinResizable(newChild, pos);
|
34609 |
|
34610 |
|
34611 | if (isDraggable) newChild = this.mixinDraggable(newChild);
|
34612 |
|
34613 | return newChild;
|
34614 | };
|
34615 |
|
34616 | return GridItem;
|
34617 | }(_react2.default.Component);
|
34618 |
|
34619 | GridItem.propTypes = {
|
34620 |
|
34621 | children: _propTypes2.default.element,
|
34622 |
|
34623 |
|
34624 | cols: _propTypes2.default.number.isRequired,
|
34625 | containerWidth: _propTypes2.default.number.isRequired,
|
34626 | rowHeight: _propTypes2.default.number.isRequired,
|
34627 | margin: _propTypes2.default.array.isRequired,
|
34628 | maxRows: _propTypes2.default.number.isRequired,
|
34629 | containerPadding: _propTypes2.default.array.isRequired,
|
34630 |
|
34631 |
|
34632 | x: _propTypes2.default.number.isRequired,
|
34633 | y: _propTypes2.default.number.isRequired,
|
34634 | w: _propTypes2.default.number.isRequired,
|
34635 | h: _propTypes2.default.number.isRequired,
|
34636 |
|
34637 |
|
34638 | minW: function minW(props, propName) {
|
34639 | var value = props[propName];
|
34640 | if (typeof value !== "number") return new Error("minWidth not Number");
|
34641 | if (value > props.w || value > props.maxW) return new Error("minWidth larger than item width/maxWidth");
|
34642 | },
|
34643 |
|
34644 | maxW: function maxW(props, propName) {
|
34645 | var value = props[propName];
|
34646 | if (typeof value !== "number") return new Error("maxWidth not Number");
|
34647 | if (value < props.w || value < props.minW) return new Error("maxWidth smaller than item width/minWidth");
|
34648 | },
|
34649 |
|
34650 | minH: function minH(props, propName) {
|
34651 | var value = props[propName];
|
34652 | if (typeof value !== "number") return new Error("minHeight not Number");
|
34653 | if (value > props.h || value > props.maxH) return new Error("minHeight larger than item height/maxHeight");
|
34654 | },
|
34655 |
|
34656 | maxH: function maxH(props, propName) {
|
34657 | var value = props[propName];
|
34658 | if (typeof value !== "number") return new Error("maxHeight not Number");
|
34659 | if (value < props.h || value < props.minH) return new Error("maxHeight smaller than item height/minHeight");
|
34660 | },
|
34661 |
|
34662 |
|
34663 | i: _propTypes2.default.string.isRequired,
|
34664 |
|
34665 |
|
34666 | onDragStop: _propTypes2.default.func,
|
34667 | onDragStart: _propTypes2.default.func,
|
34668 | onDrag: _propTypes2.default.func,
|
34669 | onResizeStop: _propTypes2.default.func,
|
34670 | onResizeStart: _propTypes2.default.func,
|
34671 | onResize: _propTypes2.default.func,
|
34672 |
|
34673 |
|
34674 | isDraggable: _propTypes2.default.bool.isRequired,
|
34675 | isResizable: _propTypes2.default.bool.isRequired,
|
34676 | static: _propTypes2.default.bool,
|
34677 |
|
34678 |
|
34679 | useCSSTransforms: _propTypes2.default.bool.isRequired,
|
34680 |
|
34681 |
|
34682 | className: _propTypes2.default.string,
|
34683 |
|
34684 | handle: _propTypes2.default.string,
|
34685 |
|
34686 | cancel: _propTypes2.default.string
|
34687 | };
|
34688 | GridItem.defaultProps = {
|
34689 | className: "",
|
34690 | cancel: "",
|
34691 | handle: "",
|
34692 | minH: 1,
|
34693 | minW: 1,
|
34694 | maxH: Infinity,
|
34695 | maxW: Infinity
|
34696 | };
|
34697 | exports.default = GridItem;
|
34698 |
|
34699 | }),
|
34700 |
|
34701 | (function(module, exports, __webpack_require__) {
|
34702 |
|
34703 | 'use strict';
|
34704 | module.exports = function() {
|
34705 | throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable");
|
34706 | };
|
34707 |
|
34708 | module.exports.Resizable = __webpack_require__(268).default;
|
34709 | module.exports.ResizableBox = __webpack_require__(270).default;
|
34710 |
|
34711 |
|
34712 | }),
|
34713 |
|
34714 | (function(module, exports, __webpack_require__) {
|
34715 |
|
34716 | 'use strict';
|
34717 |
|
34718 | exports.__esModule = true;
|
34719 |
|
34720 | 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; };
|
34721 |
|
34722 | var _react = __webpack_require__(1);
|
34723 |
|
34724 | var _react2 = _interopRequireDefault(_react);
|
34725 |
|
34726 | var _propTypes = __webpack_require__(6);
|
34727 |
|
34728 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
34729 |
|
34730 | var _reactDraggable = __webpack_require__(257);
|
34731 |
|
34732 | var _cloneElement = __webpack_require__(269);
|
34733 |
|
34734 | var _cloneElement2 = _interopRequireDefault(_cloneElement);
|
34735 |
|
34736 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
34737 |
|
34738 | 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; }
|
34739 |
|
34740 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
34741 |
|
34742 | 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; }
|
34743 |
|
34744 | 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; }
|
34745 |
|
34746 | var Resizable = function (_React$Component) {
|
34747 | _inherits(Resizable, _React$Component);
|
34748 |
|
34749 | function Resizable() {
|
34750 | var _temp, _this, _ret;
|
34751 |
|
34752 | _classCallCheck(this, Resizable);
|
34753 |
|
34754 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
34755 | args[_key] = arguments[_key];
|
34756 | }
|
34757 |
|
34758 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
|
34759 | resizing: false,
|
34760 | width: _this.props.width, height: _this.props.height,
|
34761 | slackW: 0, slackH: 0
|
34762 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
34763 | }
|
34764 |
|
34765 | Resizable.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
34766 |
|
34767 | if (!this.state.resizing && (nextProps.width !== this.props.width || nextProps.height !== this.props.height)) {
|
34768 | this.setState({
|
34769 | width: nextProps.width,
|
34770 | height: nextProps.height
|
34771 | });
|
34772 | }
|
34773 | };
|
34774 |
|
34775 | Resizable.prototype.lockAspectRatio = function lockAspectRatio(width, height, aspectRatio) {
|
34776 | height = width / aspectRatio;
|
34777 | width = height * aspectRatio;
|
34778 | return [width, height];
|
34779 | };
|
34780 |
|
34781 |
|
34782 |
|
34783 |
|
34784 | Resizable.prototype.runConstraints = function runConstraints(width, height) {
|
34785 | var _ref = [this.props.minConstraints, this.props.maxConstraints],
|
34786 | min = _ref[0],
|
34787 | max = _ref[1];
|
34788 |
|
34789 |
|
34790 | if (this.props.lockAspectRatio) {
|
34791 | var ratio = this.state.width / this.state.height;
|
34792 | height = width / ratio;
|
34793 | width = height * ratio;
|
34794 | }
|
34795 |
|
34796 | if (!min && !max) return [width, height];
|
34797 |
|
34798 | var oldW = width,
|
34799 | oldH = height;
|
34800 |
|
34801 |
|
34802 |
|
34803 |
|
34804 |
|
34805 | var _state = this.state,
|
34806 | slackW = _state.slackW,
|
34807 | slackH = _state.slackH;
|
34808 |
|
34809 | width += slackW;
|
34810 | height += slackH;
|
34811 |
|
34812 | if (min) {
|
34813 | width = Math.max(min[0], width);
|
34814 | height = Math.max(min[1], height);
|
34815 | }
|
34816 | if (max) {
|
34817 | width = Math.min(max[0], width);
|
34818 | height = Math.min(max[1], height);
|
34819 | }
|
34820 |
|
34821 |
|
34822 | slackW += oldW - width;
|
34823 | slackH += oldH - height;
|
34824 | if (slackW !== this.state.slackW || slackH !== this.state.slackH) {
|
34825 | this.setState({ slackW: slackW, slackH: slackH });
|
34826 | }
|
34827 |
|
34828 | return [width, height];
|
34829 | };
|
34830 |
|
34831 | |
34832 |
|
34833 |
|
34834 |
|
34835 |
|
34836 |
|
34837 |
|
34838 |
|
34839 | Resizable.prototype.resizeHandler = function resizeHandler(handlerName, axis) {
|
34840 | var _this2 = this;
|
34841 |
|
34842 | return function (e, _ref2) {
|
34843 | var node = _ref2.node,
|
34844 | deltaX = _ref2.deltaX,
|
34845 | deltaY = _ref2.deltaY;
|
34846 |
|
34847 |
|
34848 |
|
34849 | var canDragX = (_this2.props.axis === 'both' || _this2.props.axis === 'x') && ['n', 's'].indexOf(axis) === -1;
|
34850 | var canDragY = (_this2.props.axis === 'both' || _this2.props.axis === 'y') && ['e', 'w'].indexOf(axis) === -1;
|
34851 |
|
34852 |
|
34853 | if (canDragX && axis[axis.length - 1] === 'w') {
|
34854 | deltaX = -deltaX;
|
34855 | }
|
34856 | if (canDragY && axis[0] === 'n') {
|
34857 | deltaY = -deltaY;
|
34858 | }
|
34859 |
|
34860 |
|
34861 | var width = _this2.state.width + (canDragX ? deltaX : 0);
|
34862 | var height = _this2.state.height + (canDragY ? deltaY : 0);
|
34863 |
|
34864 |
|
34865 | var widthChanged = width !== _this2.state.width,
|
34866 | heightChanged = height !== _this2.state.height;
|
34867 | if (handlerName === 'onResize' && !widthChanged && !heightChanged) return;
|
34868 |
|
34869 |
|
34870 | var _runConstraints = _this2.runConstraints(width, height);
|
34871 |
|
34872 | width = _runConstraints[0];
|
34873 | height = _runConstraints[1];
|
34874 | var newState = {};
|
34875 | if (handlerName === 'onResizeStart') {
|
34876 | newState.resizing = true;
|
34877 | } else if (handlerName === 'onResizeStop') {
|
34878 | newState.resizing = false;
|
34879 | newState.slackW = newState.slackH = 0;
|
34880 | } else {
|
34881 |
|
34882 | if (width === _this2.state.width && height === _this2.state.height) return;
|
34883 | newState.width = width;
|
34884 | newState.height = height;
|
34885 | }
|
34886 |
|
34887 | var hasCb = typeof _this2.props[handlerName] === 'function';
|
34888 | if (hasCb) {
|
34889 |
|
34890 | if (typeof e.persist === 'function') e.persist();
|
34891 | _this2.setState(newState, function () {
|
34892 | return _this2.props[handlerName](e, { node: node, size: { width: width, height: height }, handle: axis });
|
34893 | });
|
34894 | } else {
|
34895 | _this2.setState(newState);
|
34896 | }
|
34897 | };
|
34898 | };
|
34899 |
|
34900 | Resizable.prototype.renderResizeHandle = function renderResizeHandle(resizeHandle) {
|
34901 | var handle = this.props.handle;
|
34902 |
|
34903 | if (handle) {
|
34904 | if (typeof handle === 'function') {
|
34905 | return handle(resizeHandle);
|
34906 | }
|
34907 | return handle;
|
34908 | }
|
34909 | return _react2.default.createElement('span', { className: 'react-resizable-handle react-resizable-handle-' + resizeHandle });
|
34910 | };
|
34911 |
|
34912 | Resizable.prototype.render = function render() {
|
34913 | var _this3 = this;
|
34914 |
|
34915 |
|
34916 | var _props = this.props,
|
34917 | children = _props.children,
|
34918 | draggableOpts = _props.draggableOpts,
|
34919 | width = _props.width,
|
34920 | height = _props.height,
|
34921 | handleSize = _props.handleSize,
|
34922 | lockAspectRatio = _props.lockAspectRatio,
|
34923 | axis = _props.axis,
|
34924 | minConstraints = _props.minConstraints,
|
34925 | maxConstraints = _props.maxConstraints,
|
34926 | onResize = _props.onResize,
|
34927 | onResizeStop = _props.onResizeStop,
|
34928 | onResizeStart = _props.onResizeStart,
|
34929 | resizeHandles = _props.resizeHandles,
|
34930 | p = _objectWithoutProperties(_props, ['children', 'draggableOpts', 'width', 'height', 'handleSize', 'lockAspectRatio', 'axis', 'minConstraints', 'maxConstraints', 'onResize', 'onResizeStop', 'onResizeStart', 'resizeHandles']);
|
34931 |
|
34932 | var className = p.className ? p.className + ' react-resizable' : 'react-resizable';
|
34933 |
|
34934 |
|
34935 |
|
34936 |
|
34937 |
|
34938 | return (0, _cloneElement2.default)(children, _extends({}, p, {
|
34939 | className: className,
|
34940 | children: [children.props.children, resizeHandles.map(function (h) {
|
34941 | return _react2.default.createElement(
|
34942 | _reactDraggable.DraggableCore,
|
34943 | _extends({}, draggableOpts, {
|
34944 | key: 'resizableHandle-' + h,
|
34945 | onStop: _this3.resizeHandler('onResizeStop', h),
|
34946 | onStart: _this3.resizeHandler('onResizeStart', h),
|
34947 | onDrag: _this3.resizeHandler('onResize', h)
|
34948 | }),
|
34949 | _this3.renderResizeHandle(h)
|
34950 | );
|
34951 | })]
|
34952 | }));
|
34953 | };
|
34954 |
|
34955 | return Resizable;
|
34956 | }(_react2.default.Component);
|
34957 |
|
34958 | Resizable.propTypes = {
|
34959 |
|
34960 |
|
34961 |
|
34962 |
|
34963 |
|
34964 | children: _propTypes2.default.element.isRequired,
|
34965 |
|
34966 |
|
34967 | width: _propTypes2.default.number.isRequired,
|
34968 | height: _propTypes2.default.number.isRequired,
|
34969 |
|
34970 |
|
34971 |
|
34972 |
|
34973 |
|
34974 |
|
34975 | handle: _propTypes2.default.element,
|
34976 |
|
34977 |
|
34978 | handleSize: _propTypes2.default.array,
|
34979 |
|
34980 |
|
34981 |
|
34982 |
|
34983 |
|
34984 |
|
34985 |
|
34986 |
|
34987 |
|
34988 |
|
34989 |
|
34990 | resizeHandles: _propTypes2.default.arrayOf(_propTypes2.default.oneOf(['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'])),
|
34991 |
|
34992 |
|
34993 | lockAspectRatio: _propTypes2.default.bool,
|
34994 |
|
34995 |
|
34996 |
|
34997 |
|
34998 |
|
34999 |
|
35000 | axis: _propTypes2.default.oneOf(['both', 'x', 'y', 'none']),
|
35001 |
|
35002 |
|
35003 | minConstraints: _propTypes2.default.arrayOf(_propTypes2.default.number),
|
35004 | maxConstraints: _propTypes2.default.arrayOf(_propTypes2.default.number),
|
35005 |
|
35006 |
|
35007 | onResizeStop: _propTypes2.default.func,
|
35008 | onResizeStart: _propTypes2.default.func,
|
35009 | onResize: _propTypes2.default.func,
|
35010 |
|
35011 |
|
35012 | draggableOpts: _propTypes2.default.object
|
35013 | };
|
35014 | Resizable.defaultProps = {
|
35015 | handleSize: [20, 20],
|
35016 | lockAspectRatio: false,
|
35017 | axis: 'both',
|
35018 | minConstraints: [20, 20],
|
35019 | maxConstraints: [Infinity, Infinity],
|
35020 | resizeHandles: ['se']
|
35021 | };
|
35022 | exports.default = Resizable;
|
35023 |
|
35024 | }),
|
35025 |
|
35026 | (function(module, exports, __webpack_require__) {
|
35027 |
|
35028 | 'use strict';
|
35029 |
|
35030 | 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; };
|
35031 |
|
35032 | var _react = __webpack_require__(1);
|
35033 |
|
35034 | var _react2 = _interopRequireDefault(_react);
|
35035 |
|
35036 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
35037 |
|
35038 |
|
35039 | module.exports = function cloneElement(element, props) {
|
35040 | if (props.style && element.props.style) {
|
35041 | props.style = _extends({}, element.props.style, props.style);
|
35042 | }
|
35043 | if (props.className && element.props.className) {
|
35044 | props.className = element.props.className + ' ' + props.className;
|
35045 | }
|
35046 | return _react2.default.cloneElement(element, props);
|
35047 | };
|
35048 |
|
35049 | }),
|
35050 |
|
35051 | (function(module, exports, __webpack_require__) {
|
35052 |
|
35053 | 'use strict';
|
35054 |
|
35055 | exports.__esModule = true;
|
35056 |
|
35057 | 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; };
|
35058 |
|
35059 | var _react = __webpack_require__(1);
|
35060 |
|
35061 | var _react2 = _interopRequireDefault(_react);
|
35062 |
|
35063 | var _propTypes = __webpack_require__(6);
|
35064 |
|
35065 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
35066 |
|
35067 | var _Resizable = __webpack_require__(268);
|
35068 |
|
35069 | var _Resizable2 = _interopRequireDefault(_Resizable);
|
35070 |
|
35071 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
35072 |
|
35073 | 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; }
|
35074 |
|
35075 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35076 |
|
35077 | 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; }
|
35078 |
|
35079 | 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; }
|
35080 |
|
35081 |
|
35082 | var ResizableBox = function (_React$Component) {
|
35083 | _inherits(ResizableBox, _React$Component);
|
35084 |
|
35085 | function ResizableBox() {
|
35086 | var _temp, _this, _ret;
|
35087 |
|
35088 | _classCallCheck(this, ResizableBox);
|
35089 |
|
35090 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
35091 | args[_key] = arguments[_key];
|
35092 | }
|
35093 |
|
35094 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
|
35095 | width: _this.props.width,
|
35096 | height: _this.props.height
|
35097 | }, _this.onResize = function (e, data) {
|
35098 | var size = data.size;
|
35099 | var width = size.width,
|
35100 | height = size.height;
|
35101 |
|
35102 |
|
35103 | if (_this.props.onResize) {
|
35104 | e.persist && e.persist();
|
35105 | _this.setState(size, function () {
|
35106 | return _this.props.onResize && _this.props.onResize(e, data);
|
35107 | });
|
35108 | } else {
|
35109 | _this.setState(size);
|
35110 | }
|
35111 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
35112 | }
|
35113 |
|
35114 | ResizableBox.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
35115 | if (nextProps.width !== this.props.width || nextProps.height !== this.props.height) {
|
35116 | this.setState({
|
35117 | width: nextProps.width,
|
35118 | height: nextProps.height
|
35119 | });
|
35120 | }
|
35121 | };
|
35122 |
|
35123 | ResizableBox.prototype.render = function render() {
|
35124 |
|
35125 |
|
35126 |
|
35127 | var _props = this.props,
|
35128 | handle = _props.handle,
|
35129 | handleSize = _props.handleSize,
|
35130 | onResize = _props.onResize,
|
35131 | onResizeStart = _props.onResizeStart,
|
35132 | onResizeStop = _props.onResizeStop,
|
35133 | draggableOpts = _props.draggableOpts,
|
35134 | minConstraints = _props.minConstraints,
|
35135 | maxConstraints = _props.maxConstraints,
|
35136 | lockAspectRatio = _props.lockAspectRatio,
|
35137 | axis = _props.axis,
|
35138 | width = _props.width,
|
35139 | height = _props.height,
|
35140 | resizeHandles = _props.resizeHandles,
|
35141 | props = _objectWithoutProperties(_props, ['handle', 'handleSize', 'onResize', 'onResizeStart', 'onResizeStop', 'draggableOpts', 'minConstraints', 'maxConstraints', 'lockAspectRatio', 'axis', 'width', 'height', 'resizeHandles']);
|
35142 |
|
35143 | return _react2.default.createElement(
|
35144 | _Resizable2.default,
|
35145 | {
|
35146 | handle: handle,
|
35147 | handleSize: handleSize,
|
35148 | width: this.state.width,
|
35149 | height: this.state.height,
|
35150 | onResizeStart: onResizeStart,
|
35151 | onResize: this.onResize,
|
35152 | onResizeStop: onResizeStop,
|
35153 | draggableOpts: draggableOpts,
|
35154 | minConstraints: minConstraints,
|
35155 | maxConstraints: maxConstraints,
|
35156 | lockAspectRatio: lockAspectRatio,
|
35157 | axis: axis,
|
35158 | resizeHandles: resizeHandles
|
35159 | },
|
35160 | _react2.default.createElement('div', _extends({ style: { width: this.state.width + 'px', height: this.state.height + 'px' } }, props))
|
35161 | );
|
35162 | };
|
35163 |
|
35164 | return ResizableBox;
|
35165 | }(_react2.default.Component);
|
35166 |
|
35167 | ResizableBox.propTypes = {
|
35168 | height: _propTypes2.default.number,
|
35169 | width: _propTypes2.default.number
|
35170 | };
|
35171 | ResizableBox.defaultProps = {
|
35172 | handleSize: [20, 20]
|
35173 | };
|
35174 | exports.default = ResizableBox;
|
35175 |
|
35176 | }),
|
35177 |
|
35178 | (function(module, exports, __webpack_require__) {
|
35179 |
|
35180 | "use strict";
|
35181 |
|
35182 | exports.__esModule = true;
|
35183 |
|
35184 | 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; };
|
35185 |
|
35186 | var _react = __webpack_require__(1);
|
35187 |
|
35188 | var _react2 = _interopRequireDefault(_react);
|
35189 |
|
35190 | var _propTypes = __webpack_require__(6);
|
35191 |
|
35192 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
35193 |
|
35194 | var _lodash = __webpack_require__(258);
|
35195 |
|
35196 | var _lodash2 = _interopRequireDefault(_lodash);
|
35197 |
|
35198 | var _utils = __webpack_require__(265);
|
35199 |
|
35200 | var _responsiveUtils = __webpack_require__(272);
|
35201 |
|
35202 | var _ReactGridLayout = __webpack_require__(264);
|
35203 |
|
35204 | var _ReactGridLayout2 = _interopRequireDefault(_ReactGridLayout);
|
35205 |
|
35206 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
35207 |
|
35208 | 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; }
|
35209 |
|
35210 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35211 |
|
35212 | 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; }
|
35213 |
|
35214 | 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; }
|
35215 |
|
35216 | var type = function type(obj) {
|
35217 | return Object.prototype.toString.call(obj);
|
35218 | };
|
35219 |
|
35220 | var ResponsiveReactGridLayout = function (_React$Component) {
|
35221 | _inherits(ResponsiveReactGridLayout, _React$Component);
|
35222 |
|
35223 | function ResponsiveReactGridLayout() {
|
35224 | var _temp, _this, _ret;
|
35225 |
|
35226 | _classCallCheck(this, ResponsiveReactGridLayout);
|
35227 |
|
35228 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
35229 | args[_key] = arguments[_key];
|
35230 | }
|
35231 |
|
35232 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = _this.generateInitialState(), _this.onLayoutChange = function (layout) {
|
35233 | var _extends2;
|
35234 |
|
35235 | _this.props.onLayoutChange(layout, _extends({}, _this.props.layouts, (_extends2 = {}, _extends2[_this.state.breakpoint] = layout, _extends2)));
|
35236 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
35237 | }
|
35238 |
|
35239 |
|
35240 |
|
35241 |
|
35242 | ResponsiveReactGridLayout.prototype.generateInitialState = function generateInitialState() {
|
35243 | var _props = this.props,
|
35244 | width = _props.width,
|
35245 | breakpoints = _props.breakpoints,
|
35246 | layouts = _props.layouts,
|
35247 | cols = _props.cols;
|
35248 |
|
35249 | var breakpoint = (0, _responsiveUtils.getBreakpointFromWidth)(breakpoints, width);
|
35250 | var colNo = (0, _responsiveUtils.getColsFromBreakpoint)(breakpoint, cols);
|
35251 |
|
35252 | var compactType = this.props.verticalCompact === false ? null : this.props.compactType;
|
35253 |
|
35254 |
|
35255 | var initialLayout = (0, _responsiveUtils.findOrGenerateResponsiveLayout)(layouts, breakpoints, breakpoint, breakpoint, colNo, compactType);
|
35256 |
|
35257 | return {
|
35258 | layout: initialLayout,
|
35259 | breakpoint: breakpoint,
|
35260 | cols: colNo
|
35261 | };
|
35262 | };
|
35263 |
|
35264 | ResponsiveReactGridLayout.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
35265 |
|
35266 | if (nextProps.width != this.props.width || nextProps.breakpoint !== this.props.breakpoint || !(0, _lodash2.default)(nextProps.breakpoints, this.props.breakpoints) || !(0, _lodash2.default)(nextProps.cols, this.props.cols)) {
|
35267 | this.onWidthChange(nextProps);
|
35268 | } else if (!(0, _lodash2.default)(nextProps.layouts, this.props.layouts)) {
|
35269 |
|
35270 | var _state = this.state,
|
35271 | _breakpoint = _state.breakpoint,
|
35272 | _cols = _state.cols;
|
35273 |
|
35274 |
|
35275 |
|
35276 |
|
35277 | var newLayout = (0, _responsiveUtils.findOrGenerateResponsiveLayout)(nextProps.layouts, nextProps.breakpoints, _breakpoint, _breakpoint, _cols, nextProps.compactType);
|
35278 | this.setState({ layout: newLayout });
|
35279 | }
|
35280 | };
|
35281 |
|
35282 |
|
35283 |
|
35284 |
|
35285 | |
35286 |
|
35287 |
|
35288 |
|
35289 | ResponsiveReactGridLayout.prototype.onWidthChange = function onWidthChange(nextProps) {
|
35290 | var breakpoints = nextProps.breakpoints,
|
35291 | cols = nextProps.cols,
|
35292 | layouts = nextProps.layouts,
|
35293 | compactType = nextProps.compactType;
|
35294 |
|
35295 | var newBreakpoint = nextProps.breakpoint || (0, _responsiveUtils.getBreakpointFromWidth)(nextProps.breakpoints, nextProps.width);
|
35296 |
|
35297 | var lastBreakpoint = this.state.breakpoint;
|
35298 |
|
35299 |
|
35300 | if (lastBreakpoint !== newBreakpoint || this.props.breakpoints !== breakpoints || this.props.cols !== cols) {
|
35301 |
|
35302 | if (!(lastBreakpoint in layouts)) layouts[lastBreakpoint] = (0, _utils.cloneLayout)(this.state.layout);
|
35303 |
|
35304 |
|
35305 | var newCols = (0, _responsiveUtils.getColsFromBreakpoint)(newBreakpoint, cols);
|
35306 | var _layout = (0, _responsiveUtils.findOrGenerateResponsiveLayout)(layouts, breakpoints, newBreakpoint, lastBreakpoint, newCols, compactType);
|
35307 |
|
35308 |
|
35309 | _layout = (0, _utils.synchronizeLayoutWithChildren)(_layout, nextProps.children, newCols, compactType);
|
35310 |
|
35311 |
|
35312 | layouts[newBreakpoint] = _layout;
|
35313 |
|
35314 |
|
35315 | this.props.onLayoutChange(_layout, layouts);
|
35316 | this.props.onBreakpointChange(newBreakpoint, newCols);
|
35317 | this.props.onWidthChange(nextProps.width, nextProps.margin, newCols, nextProps.containerPadding);
|
35318 |
|
35319 | this.setState({
|
35320 | breakpoint: newBreakpoint,
|
35321 | layout: _layout,
|
35322 | cols: newCols
|
35323 | });
|
35324 | }
|
35325 | };
|
35326 |
|
35327 | ResponsiveReactGridLayout.prototype.render = function render() {
|
35328 |
|
35329 | var _props2 = this.props,
|
35330 | breakpoint = _props2.breakpoint,
|
35331 | breakpoints = _props2.breakpoints,
|
35332 | cols = _props2.cols,
|
35333 | layouts = _props2.layouts,
|
35334 | onBreakpointChange = _props2.onBreakpointChange,
|
35335 | onLayoutChange = _props2.onLayoutChange,
|
35336 | onWidthChange = _props2.onWidthChange,
|
35337 | other = _objectWithoutProperties(_props2, ["breakpoint", "breakpoints", "cols", "layouts", "onBreakpointChange", "onLayoutChange", "onWidthChange"]);
|
35338 |
|
35339 |
|
35340 | return _react2.default.createElement(_ReactGridLayout2.default, _extends({}, other, {
|
35341 | onLayoutChange: this.onLayoutChange,
|
35342 | layout: this.state.layout,
|
35343 | cols: this.state.cols
|
35344 | }));
|
35345 | };
|
35346 |
|
35347 | return ResponsiveReactGridLayout;
|
35348 | }(_react2.default.Component);
|
35349 |
|
35350 | ResponsiveReactGridLayout.propTypes = {
|
35351 |
|
35352 |
|
35353 |
|
35354 |
|
35355 |
|
35356 |
|
35357 | breakpoint: _propTypes2.default.string,
|
35358 |
|
35359 |
|
35360 | breakpoints: _propTypes2.default.object,
|
35361 |
|
35362 |
|
35363 | cols: _propTypes2.default.object,
|
35364 |
|
35365 |
|
35366 |
|
35367 | layouts: function layouts(props, propName) {
|
35368 | if (type(props[propName]) !== "[object Object]") {
|
35369 | throw new Error("Layout property must be an object. Received: " + type(props[propName]));
|
35370 | }
|
35371 | Object.keys(props[propName]).forEach(function (key) {
|
35372 | if (!(key in props.breakpoints)) {
|
35373 | throw new Error("Each key in layouts must align with a key in breakpoints.");
|
35374 | }
|
35375 | (0, _utils.validateLayout)(props.layouts[key], "layouts." + key);
|
35376 | });
|
35377 | },
|
35378 |
|
35379 |
|
35380 |
|
35381 |
|
35382 | width: _propTypes2.default.number.isRequired,
|
35383 |
|
35384 |
|
35385 |
|
35386 |
|
35387 |
|
35388 |
|
35389 | onBreakpointChange: _propTypes2.default.func,
|
35390 |
|
35391 |
|
35392 |
|
35393 | onLayoutChange: _propTypes2.default.func,
|
35394 |
|
35395 |
|
35396 | onWidthChange: _propTypes2.default.func
|
35397 | };
|
35398 | ResponsiveReactGridLayout.defaultProps = {
|
35399 | breakpoints: { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 },
|
35400 | cols: { lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 },
|
35401 | layouts: {},
|
35402 | onBreakpointChange: _utils.noop,
|
35403 | onLayoutChange: _utils.noop,
|
35404 | onWidthChange: _utils.noop
|
35405 | };
|
35406 | exports.default = ResponsiveReactGridLayout;
|
35407 |
|
35408 | }),
|
35409 |
|
35410 | (function(module, exports, __webpack_require__) {
|
35411 |
|
35412 | "use strict";
|
35413 |
|
35414 | exports.__esModule = true;
|
35415 | exports.getBreakpointFromWidth = getBreakpointFromWidth;
|
35416 | exports.getColsFromBreakpoint = getColsFromBreakpoint;
|
35417 | exports.findOrGenerateResponsiveLayout = findOrGenerateResponsiveLayout;
|
35418 | exports.sortBreakpoints = sortBreakpoints;
|
35419 |
|
35420 | var _utils = __webpack_require__(265);
|
35421 |
|
35422 | |
35423 |
|
35424 |
|
35425 |
|
35426 |
|
35427 |
|
35428 |
|
35429 | function getBreakpointFromWidth(breakpoints, width) {
|
35430 | var sorted = sortBreakpoints(breakpoints);
|
35431 | var matching = sorted[0];
|
35432 | for (var i = 1, len = sorted.length; i < len; i++) {
|
35433 | var breakpointName = sorted[i];
|
35434 | if (width > breakpoints[breakpointName]) matching = breakpointName;
|
35435 | }
|
35436 | return matching;
|
35437 | }
|
35438 |
|
35439 | |
35440 |
|
35441 |
|
35442 |
|
35443 |
|
35444 |
|
35445 |
|
35446 |
|
35447 | function getColsFromBreakpoint(breakpoint, cols) {
|
35448 | if (!cols[breakpoint]) {
|
35449 | throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint " + breakpoint + " is missing!");
|
35450 | }
|
35451 | return cols[breakpoint];
|
35452 | }
|
35453 |
|
35454 | |
35455 |
|
35456 |
|
35457 |
|
35458 |
|
35459 |
|
35460 |
|
35461 |
|
35462 |
|
35463 |
|
35464 |
|
35465 |
|
35466 |
|
35467 |
|
35468 | function findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, lastBreakpoint, cols, compactType) {
|
35469 |
|
35470 | if (layouts[breakpoint]) return (0, _utils.cloneLayout)(layouts[breakpoint]);
|
35471 |
|
35472 | var layout = layouts[lastBreakpoint];
|
35473 | var breakpointsSorted = sortBreakpoints(breakpoints);
|
35474 | var breakpointsAbove = breakpointsSorted.slice(breakpointsSorted.indexOf(breakpoint));
|
35475 | for (var i = 0, len = breakpointsAbove.length; i < len; i++) {
|
35476 | var b = breakpointsAbove[i];
|
35477 | if (layouts[b]) {
|
35478 | layout = layouts[b];
|
35479 | break;
|
35480 | }
|
35481 | }
|
35482 | layout = (0, _utils.cloneLayout)(layout || []);
|
35483 | return (0, _utils.compact)((0, _utils.correctBounds)(layout, { cols: cols }), compactType, cols);
|
35484 | }
|
35485 |
|
35486 | |
35487 |
|
35488 |
|
35489 |
|
35490 |
|
35491 |
|
35492 |
|
35493 | function sortBreakpoints(breakpoints) {
|
35494 | var keys = Object.keys(breakpoints);
|
35495 | return keys.sort(function (a, b) {
|
35496 | return breakpoints[a] - breakpoints[b];
|
35497 | });
|
35498 | }
|
35499 |
|
35500 | }),
|
35501 |
|
35502 | (function(module, exports, __webpack_require__) {
|
35503 |
|
35504 | "use strict";
|
35505 |
|
35506 | exports.__esModule = true;
|
35507 |
|
35508 | 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; };
|
35509 |
|
35510 | exports.default = WidthProvider;
|
35511 |
|
35512 | var _react = __webpack_require__(1);
|
35513 |
|
35514 | var _react2 = _interopRequireDefault(_react);
|
35515 |
|
35516 | var _propTypes = __webpack_require__(6);
|
35517 |
|
35518 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
35519 |
|
35520 | var _reactDom = __webpack_require__(2);
|
35521 |
|
35522 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
35523 |
|
35524 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
35525 |
|
35526 | 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; }
|
35527 |
|
35528 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35529 |
|
35530 | 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; }
|
35531 |
|
35532 | 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; }
|
35533 |
|
35534 | |
35535 |
|
35536 |
|
35537 | function WidthProvider(ComposedComponent) {
|
35538 | var _class, _temp2;
|
35539 |
|
35540 | return _temp2 = _class = function (_React$Component) {
|
35541 | _inherits(WidthProvider, _React$Component);
|
35542 |
|
35543 | function WidthProvider() {
|
35544 | var _temp, _this, _ret;
|
35545 |
|
35546 | _classCallCheck(this, WidthProvider);
|
35547 |
|
35548 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
35549 | args[_key] = arguments[_key];
|
35550 | }
|
35551 |
|
35552 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
|
35553 | width: 1280
|
35554 | }, _this.mounted = false, _this.onWindowResize = function () {
|
35555 | if (!_this.mounted) return;
|
35556 |
|
35557 | var node = _reactDom2.default.findDOMNode(_this);
|
35558 | if (node instanceof HTMLElement) _this.setState({ width: node.offsetWidth });
|
35559 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
35560 | }
|
35561 |
|
35562 | WidthProvider.prototype.componentDidMount = function componentDidMount() {
|
35563 | this.mounted = true;
|
35564 |
|
35565 | window.addEventListener("resize", this.onWindowResize);
|
35566 |
|
35567 |
|
35568 |
|
35569 | this.onWindowResize();
|
35570 | };
|
35571 |
|
35572 | WidthProvider.prototype.componentWillUnmount = function componentWillUnmount() {
|
35573 | this.mounted = false;
|
35574 | window.removeEventListener("resize", this.onWindowResize);
|
35575 | };
|
35576 |
|
35577 | WidthProvider.prototype.render = function render() {
|
35578 | var _props = this.props,
|
35579 | measureBeforeMount = _props.measureBeforeMount,
|
35580 | rest = _objectWithoutProperties(_props, ["measureBeforeMount"]);
|
35581 |
|
35582 | if (measureBeforeMount && !this.mounted) {
|
35583 | return _react2.default.createElement("div", { className: this.props.className, style: this.props.style });
|
35584 | }
|
35585 |
|
35586 | return _react2.default.createElement(ComposedComponent, _extends({}, rest, this.state));
|
35587 | };
|
35588 |
|
35589 | return WidthProvider;
|
35590 | }(_react2.default.Component), _class.defaultProps = {
|
35591 | measureBeforeMount: false
|
35592 | }, _class.propTypes = {
|
35593 |
|
35594 |
|
35595 | measureBeforeMount: _propTypes2.default.bool
|
35596 | }, _temp2;
|
35597 | }
|
35598 |
|
35599 | }),
|
35600 |
|
35601 | (function(module, exports, __webpack_require__) {
|
35602 |
|
35603 | 'use strict';
|
35604 |
|
35605 | Object.defineProperty(exports, "__esModule", {
|
35606 | value: true
|
35607 | });
|
35608 |
|
35609 | var _react = __webpack_require__(1);
|
35610 |
|
35611 | var _react2 = _interopRequireDefault(_react);
|
35612 |
|
35613 | var _beeButton = __webpack_require__(155);
|
35614 |
|
35615 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
35616 |
|
35617 | var _index = __webpack_require__(157);
|
35618 |
|
35619 | var _index2 = _interopRequireDefault(_index);
|
35620 |
|
35621 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
35622 |
|
35623 | 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; }
|
35624 |
|
35625 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35626 |
|
35627 | 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; }
|
35628 |
|
35629 | 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); }
|
35630 | |
35631 |
|
35632 |
|
35633 |
|
35634 |
|
35635 |
|
35636 |
|
35637 | var Demo1 = function (_Component) {
|
35638 | _inherits(Demo1, _Component);
|
35639 |
|
35640 | function Demo1() {
|
35641 | var _temp, _this, _ret;
|
35642 |
|
35643 | _classCallCheck(this, Demo1);
|
35644 |
|
35645 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
35646 | args[_key] = arguments[_key];
|
35647 | }
|
35648 |
|
35649 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
35650 | console.log('start');
|
35651 | }, _this.onStop = function () {
|
35652 | console.log('stop');
|
35653 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
35654 | }
|
35655 |
|
35656 | Demo1.prototype.render = function render() {
|
35657 | return _react2['default'].createElement(
|
35658 | 'div',
|
35659 | null,
|
35660 | _react2['default'].createElement(
|
35661 | _index2['default'],
|
35662 | { onStart: this.onStart, onStop: this.onStop },
|
35663 | _react2['default'].createElement(
|
35664 | 'div',
|
35665 | { className: 'demo' },
|
35666 | '\u6211\u53EF\u968F\u610F\u62D6\u62FD'
|
35667 | )
|
35668 | )
|
35669 | );
|
35670 | };
|
35671 |
|
35672 | return Demo1;
|
35673 | }(_react.Component);
|
35674 |
|
35675 | exports['default'] = Demo1;
|
35676 | module.exports = exports['default'];
|
35677 |
|
35678 | }),
|
35679 |
|
35680 | (function(module, exports, __webpack_require__) {
|
35681 |
|
35682 | 'use strict';
|
35683 |
|
35684 | Object.defineProperty(exports, "__esModule", {
|
35685 | value: true
|
35686 | });
|
35687 |
|
35688 | var _react = __webpack_require__(1);
|
35689 |
|
35690 | var _react2 = _interopRequireDefault(_react);
|
35691 |
|
35692 | var _beeButton = __webpack_require__(155);
|
35693 |
|
35694 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
35695 |
|
35696 | var _index = __webpack_require__(157);
|
35697 |
|
35698 | var _index2 = _interopRequireDefault(_index);
|
35699 |
|
35700 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
35701 |
|
35702 | 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; }
|
35703 |
|
35704 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35705 |
|
35706 | 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; }
|
35707 |
|
35708 | 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); }
|
35709 | |
35710 |
|
35711 |
|
35712 |
|
35713 |
|
35714 |
|
35715 |
|
35716 | var Demo2 = function (_Component) {
|
35717 | _inherits(Demo2, _Component);
|
35718 |
|
35719 | function Demo2() {
|
35720 | var _temp, _this, _ret;
|
35721 |
|
35722 | _classCallCheck(this, Demo2);
|
35723 |
|
35724 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
35725 | args[_key] = arguments[_key];
|
35726 | }
|
35727 |
|
35728 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
35729 | console.log('start');
|
35730 | }, _this.onStop = function () {
|
35731 | console.log('stop');
|
35732 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
35733 | }
|
35734 |
|
35735 | Demo2.prototype.render = function render() {
|
35736 | return _react2['default'].createElement(
|
35737 | 'div',
|
35738 | null,
|
35739 | _react2['default'].createElement(
|
35740 | _index2['default'],
|
35741 | { axis: 'x', onStart: this.onStart, onStop: this.onStop },
|
35742 | _react2['default'].createElement(
|
35743 | 'div',
|
35744 | { className: 'demo' },
|
35745 | '\u6211\u53EA\u53EF\u5EF6X\u8F74\u62D6\u62FD'
|
35746 | )
|
35747 | )
|
35748 | );
|
35749 | };
|
35750 |
|
35751 | return Demo2;
|
35752 | }(_react.Component);
|
35753 |
|
35754 | exports['default'] = Demo2;
|
35755 | module.exports = exports['default'];
|
35756 |
|
35757 | }),
|
35758 |
|
35759 | (function(module, exports, __webpack_require__) {
|
35760 |
|
35761 | 'use strict';
|
35762 |
|
35763 | Object.defineProperty(exports, "__esModule", {
|
35764 | value: true
|
35765 | });
|
35766 |
|
35767 | var _react = __webpack_require__(1);
|
35768 |
|
35769 | var _react2 = _interopRequireDefault(_react);
|
35770 |
|
35771 | var _beeButton = __webpack_require__(155);
|
35772 |
|
35773 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
35774 |
|
35775 | var _index = __webpack_require__(157);
|
35776 |
|
35777 | var _index2 = _interopRequireDefault(_index);
|
35778 |
|
35779 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
35780 |
|
35781 | 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; }
|
35782 |
|
35783 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35784 |
|
35785 | 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; }
|
35786 |
|
35787 | 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); }
|
35788 | |
35789 |
|
35790 |
|
35791 |
|
35792 |
|
35793 |
|
35794 |
|
35795 | var Demo3 = function (_Component) {
|
35796 | _inherits(Demo3, _Component);
|
35797 |
|
35798 | function Demo3() {
|
35799 | var _temp, _this, _ret;
|
35800 |
|
35801 | _classCallCheck(this, Demo3);
|
35802 |
|
35803 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
35804 | args[_key] = arguments[_key];
|
35805 | }
|
35806 |
|
35807 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
35808 | console.log('start');
|
35809 | return false;
|
35810 | }, _this.onStop = function () {
|
35811 | console.log('stop');
|
35812 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
35813 | }
|
35814 |
|
35815 | Demo3.prototype.render = function render() {
|
35816 | return _react2['default'].createElement(
|
35817 | 'div',
|
35818 | { className: 'demo-3' },
|
35819 | _react2['default'].createElement(
|
35820 | _index2['default'],
|
35821 | { onStart: this.onStart, onStop: this.onStop },
|
35822 | _react2['default'].createElement(
|
35823 | 'div',
|
35824 | { className: 'demo3 demo' },
|
35825 | '\u6211\u4E0D\u53EF\u4EE5\u62D6\u62FD'
|
35826 | )
|
35827 | )
|
35828 | );
|
35829 | };
|
35830 |
|
35831 | return Demo3;
|
35832 | }(_react.Component);
|
35833 |
|
35834 | exports['default'] = Demo3;
|
35835 | module.exports = exports['default'];
|
35836 |
|
35837 | }),
|
35838 |
|
35839 | (function(module, exports, __webpack_require__) {
|
35840 |
|
35841 | 'use strict';
|
35842 |
|
35843 | Object.defineProperty(exports, "__esModule", {
|
35844 | value: true
|
35845 | });
|
35846 |
|
35847 | var _react = __webpack_require__(1);
|
35848 |
|
35849 | var _react2 = _interopRequireDefault(_react);
|
35850 |
|
35851 | var _beeIcon = __webpack_require__(102);
|
35852 |
|
35853 | var _beeIcon2 = _interopRequireDefault(_beeIcon);
|
35854 |
|
35855 | var _index = __webpack_require__(157);
|
35856 |
|
35857 | var _index2 = _interopRequireDefault(_index);
|
35858 |
|
35859 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
35860 |
|
35861 | 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; }
|
35862 |
|
35863 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35864 |
|
35865 | 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; }
|
35866 |
|
35867 | 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); } |
35868 |
|
35869 |
|
35870 |
|
35871 |
|
35872 |
|
35873 |
|
35874 | var Demo4 = function (_Component) {
|
35875 | _inherits(Demo4, _Component);
|
35876 |
|
35877 | function Demo4() {
|
35878 | var _temp, _this, _ret;
|
35879 |
|
35880 | _classCallCheck(this, Demo4);
|
35881 |
|
35882 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
35883 | args[_key] = arguments[_key];
|
35884 | }
|
35885 |
|
35886 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
35887 | console.log('start');
|
35888 | }, _this.onStop = function () {
|
35889 | console.log('stop');
|
35890 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
35891 | }
|
35892 |
|
35893 | Demo4.prototype.render = function render() {
|
35894 | return _react2['default'].createElement(
|
35895 | 'div',
|
35896 | { className: 'demo-4' },
|
35897 | _react2['default'].createElement(
|
35898 | 'div',
|
35899 | null,
|
35900 | _react2['default'].createElement(
|
35901 | _index2['default'],
|
35902 | { handle: '.handle', onStart: this.onStart, onStop: this.onStop },
|
35903 | _react2['default'].createElement(
|
35904 | 'div',
|
35905 | { className: 'demo4 demo' },
|
35906 | '\u9700\u8981\u62D6\u62FD\u628A\u624B',
|
35907 | _react2['default'].createElement(
|
35908 | 'div',
|
35909 | { className: 'handle' },
|
35910 | _react2['default'].createElement(_beeIcon2['default'], { type: 'uf-move' })
|
35911 | )
|
35912 | )
|
35913 | )
|
35914 | )
|
35915 | );
|
35916 | };
|
35917 |
|
35918 | return Demo4;
|
35919 | }(_react.Component);
|
35920 |
|
35921 | exports['default'] = Demo4;
|
35922 | module.exports = exports['default'];
|
35923 |
|
35924 | }),
|
35925 |
|
35926 | (function(module, exports, __webpack_require__) {
|
35927 |
|
35928 | 'use strict';
|
35929 |
|
35930 | Object.defineProperty(exports, "__esModule", {
|
35931 | value: true
|
35932 | });
|
35933 |
|
35934 | var _react = __webpack_require__(1);
|
35935 |
|
35936 | var _react2 = _interopRequireDefault(_react);
|
35937 |
|
35938 | var _beeButton = __webpack_require__(155);
|
35939 |
|
35940 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
35941 |
|
35942 | var _index = __webpack_require__(157);
|
35943 |
|
35944 | var _index2 = _interopRequireDefault(_index);
|
35945 |
|
35946 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
35947 |
|
35948 | 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; }
|
35949 |
|
35950 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35951 |
|
35952 | 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; }
|
35953 |
|
35954 | 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); }
|
35955 | |
35956 |
|
35957 |
|
35958 |
|
35959 |
|
35960 |
|
35961 |
|
35962 | var Demo5 = function (_Component) {
|
35963 | _inherits(Demo5, _Component);
|
35964 |
|
35965 | function Demo5() {
|
35966 | var _temp, _this, _ret;
|
35967 |
|
35968 | _classCallCheck(this, Demo5);
|
35969 |
|
35970 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
35971 | args[_key] = arguments[_key];
|
35972 | }
|
35973 |
|
35974 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
35975 | console.log('start');
|
35976 | }, _this.onStop = function () {
|
35977 | console.log('stop');
|
35978 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
35979 | }
|
35980 |
|
35981 | Demo5.prototype.render = function render() {
|
35982 | return _react2['default'].createElement(
|
35983 | 'div',
|
35984 | null,
|
35985 | _react2['default'].createElement(
|
35986 | _index2['default'],
|
35987 | { grid: [25, 25], onStart: this.onStart, onStop: this.onStop },
|
35988 | _react2['default'].createElement(
|
35989 | 'div',
|
35990 | { className: 'demo' },
|
35991 | '\u6211\u6BCF\u6B21\u62D6\u62FD\u53EF\u79FB\u52A825px'
|
35992 | )
|
35993 | )
|
35994 | );
|
35995 | };
|
35996 |
|
35997 | return Demo5;
|
35998 | }(_react.Component);
|
35999 |
|
36000 | exports['default'] = Demo5;
|
36001 | module.exports = exports['default'];
|
36002 |
|
36003 | }),
|
36004 |
|
36005 | (function(module, exports, __webpack_require__) {
|
36006 |
|
36007 | 'use strict';
|
36008 |
|
36009 | Object.defineProperty(exports, "__esModule", {
|
36010 | value: true
|
36011 | });
|
36012 |
|
36013 | var _react = __webpack_require__(1);
|
36014 |
|
36015 | var _react2 = _interopRequireDefault(_react);
|
36016 |
|
36017 | var _index = __webpack_require__(157);
|
36018 |
|
36019 | var _index2 = _interopRequireDefault(_index);
|
36020 |
|
36021 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
36022 |
|
36023 | 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; }
|
36024 |
|
36025 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36026 |
|
36027 | 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; }
|
36028 |
|
36029 | 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); }
|
36030 | |
36031 |
|
36032 |
|
36033 |
|
36034 |
|
36035 |
|
36036 |
|
36037 | var Demo6 = function (_Component) {
|
36038 | _inherits(Demo6, _Component);
|
36039 |
|
36040 | function Demo6() {
|
36041 | var _temp, _this, _ret;
|
36042 |
|
36043 | _classCallCheck(this, Demo6);
|
36044 |
|
36045 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
36046 | args[_key] = arguments[_key];
|
36047 | }
|
36048 |
|
36049 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
36050 | console.log('start');
|
36051 | }, _this.onStop = function () {
|
36052 | console.log('stop');
|
36053 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
36054 | }
|
36055 |
|
36056 | Demo6.prototype.render = function render() {
|
36057 | return _react2['default'].createElement(
|
36058 | 'div',
|
36059 | { className: 'demo6' },
|
36060 | _react2['default'].createElement(
|
36061 | _index2['default'],
|
36062 | { bounds: { top: -50, left: -50, right: 50, bottom: 50 }, onStart: this.onStart, onStop: this.onStop },
|
36063 | _react2['default'].createElement(
|
36064 | 'div',
|
36065 | { className: 'demo' },
|
36066 | '\u6211\u53EA\u80FD\u518D\u4E0A\u4E0B\u5DE6\u53F350px\u5185\u79FB\u52A8'
|
36067 | )
|
36068 | )
|
36069 | );
|
36070 | };
|
36071 |
|
36072 | return Demo6;
|
36073 | }(_react.Component);
|
36074 |
|
36075 | exports['default'] = Demo6;
|
36076 | module.exports = exports['default'];
|
36077 |
|
36078 | }),
|
36079 |
|
36080 | (function(module, exports, __webpack_require__) {
|
36081 |
|
36082 | 'use strict';
|
36083 |
|
36084 | Object.defineProperty(exports, "__esModule", {
|
36085 | value: true
|
36086 | });
|
36087 |
|
36088 | var _react = __webpack_require__(1);
|
36089 |
|
36090 | var _react2 = _interopRequireDefault(_react);
|
36091 |
|
36092 | var _beeButton = __webpack_require__(155);
|
36093 |
|
36094 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
36095 |
|
36096 | var _index = __webpack_require__(157);
|
36097 |
|
36098 | var _index2 = _interopRequireDefault(_index);
|
36099 |
|
36100 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
36101 |
|
36102 | 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; }
|
36103 |
|
36104 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36105 |
|
36106 | 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; }
|
36107 |
|
36108 | 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); }
|
36109 | |
36110 |
|
36111 |
|
36112 |
|
36113 |
|
36114 |
|
36115 |
|
36116 | var Demo7 = function (_Component) {
|
36117 | _inherits(Demo7, _Component);
|
36118 |
|
36119 | function Demo7() {
|
36120 | var _temp, _this, _ret;
|
36121 |
|
36122 | _classCallCheck(this, Demo7);
|
36123 |
|
36124 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
36125 | args[_key] = arguments[_key];
|
36126 | }
|
36127 |
|
36128 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
36129 | console.log('start');
|
36130 | }, _this.onStop = function () {
|
36131 | console.log('stop');
|
36132 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
36133 | }
|
36134 |
|
36135 | Demo7.prototype.render = function render() {
|
36136 | return _react2['default'].createElement(
|
36137 | 'div',
|
36138 | null,
|
36139 | _react2['default'].createElement(
|
36140 | 'div',
|
36141 | { className: 'demo7-parent' },
|
36142 | _react2['default'].createElement(
|
36143 | _index2['default'],
|
36144 | { bounds: '.demo7-parent', onStart: this.onStart, onStop: this.onStop },
|
36145 | _react2['default'].createElement(
|
36146 | 'div',
|
36147 | { className: 'demo' },
|
36148 | '\u6211\u53EA\u80FD\u5728\u7236\u7EA7\u5143\u7D20\u4E2D\u79FB\u52A8'
|
36149 | )
|
36150 | )
|
36151 | )
|
36152 | );
|
36153 | };
|
36154 |
|
36155 | return Demo7;
|
36156 | }(_react.Component);
|
36157 |
|
36158 | exports['default'] = Demo7;
|
36159 | module.exports = exports['default'];
|
36160 |
|
36161 | }),
|
36162 |
|
36163 | (function(module, exports, __webpack_require__) {
|
36164 |
|
36165 | 'use strict';
|
36166 |
|
36167 | Object.defineProperty(exports, "__esModule", {
|
36168 | value: true
|
36169 | });
|
36170 |
|
36171 | var _react = __webpack_require__(1);
|
36172 |
|
36173 | var _react2 = _interopRequireDefault(_react);
|
36174 |
|
36175 | var _index = __webpack_require__(157);
|
36176 |
|
36177 | var _index2 = _interopRequireDefault(_index);
|
36178 |
|
36179 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
36180 |
|
36181 | 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; }
|
36182 |
|
36183 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36184 |
|
36185 | 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; }
|
36186 |
|
36187 | 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); } |
36188 |
|
36189 |
|
36190 |
|
36191 |
|
36192 |
|
36193 |
|
36194 |
|
36195 |
|
36196 | var Demo8 = function (_Component) {
|
36197 | _inherits(Demo8, _Component);
|
36198 |
|
36199 | function Demo8() {
|
36200 | var _temp, _this, _ret;
|
36201 |
|
36202 | _classCallCheck(this, Demo8);
|
36203 |
|
36204 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
36205 | args[_key] = arguments[_key];
|
36206 | }
|
36207 |
|
36208 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onDragStart = function (result, list) {
|
36209 | console.log('开始');
|
36210 | }, _this.onDragEnd = function (result, list) {
|
36211 | console.log('结束');
|
36212 | }, _this.onDragUpdate = function (result) {
|
36213 | console.log('update');
|
36214 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
36215 | }
|
36216 |
|
36217 | Demo8.prototype.render = function render() {
|
36218 | var list = [{
|
36219 | name: '第一',
|
36220 | code: 'a'
|
36221 | }, {
|
36222 | name: '第二',
|
36223 | code: 'b'
|
36224 | }, {
|
36225 | name: '第三',
|
36226 | code: 'c'
|
36227 | }, {
|
36228 | name: '第四',
|
36229 | code: 'd'
|
36230 | }, {
|
36231 | name: '第五',
|
36232 | code: 'e'
|
36233 | }];
|
36234 | return _react2['default'].createElement(_index2['default'], { showKey: 'name', list: list, onDragUpdate: this.onDragUpdate, onStart: this.onDragStart, onStop: this.onDragEnd });
|
36235 | };
|
36236 |
|
36237 | return Demo8;
|
36238 | }(_react.Component);
|
36239 |
|
36240 | exports['default'] = Demo8;
|
36241 | module.exports = exports['default'];
|
36242 |
|
36243 | }),
|
36244 |
|
36245 | (function(module, exports, __webpack_require__) {
|
36246 |
|
36247 | 'use strict';
|
36248 |
|
36249 | Object.defineProperty(exports, "__esModule", {
|
36250 | value: true
|
36251 | });
|
36252 |
|
36253 | var _react = __webpack_require__(1);
|
36254 |
|
36255 | var _react2 = _interopRequireDefault(_react);
|
36256 |
|
36257 | var _index = __webpack_require__(157);
|
36258 |
|
36259 | var _index2 = _interopRequireDefault(_index);
|
36260 |
|
36261 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
36262 |
|
36263 | 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; }
|
36264 |
|
36265 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36266 |
|
36267 | 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; }
|
36268 |
|
36269 | 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); }
|
36270 | |
36271 |
|
36272 |
|
36273 |
|
36274 |
|
36275 |
|
36276 |
|
36277 | var Demo9 = function (_Component) {
|
36278 | _inherits(Demo9, _Component);
|
36279 |
|
36280 | function Demo9() {
|
36281 | var _temp, _this, _ret;
|
36282 |
|
36283 | _classCallCheck(this, Demo9);
|
36284 |
|
36285 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
36286 | args[_key] = arguments[_key];
|
36287 | }
|
36288 |
|
36289 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onDragStart = function (result, list) {
|
36290 | console.log('开始');
|
36291 | }, _this.onDragEnd = function (result, list) {
|
36292 | console.log('结束');
|
36293 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
36294 | }
|
36295 |
|
36296 | Demo9.prototype.render = function render() {
|
36297 | var list = [_react2['default'].createElement(
|
36298 | 'div',
|
36299 | null,
|
36300 | 'DOM\u7B2C\u4E00'
|
36301 | ), _react2['default'].createElement(
|
36302 | 'div',
|
36303 | null,
|
36304 | 'DOM\u7B2C\u4E8C'
|
36305 | ), _react2['default'].createElement(
|
36306 | 'div',
|
36307 | null,
|
36308 | 'DOM\u7B2C\u4E09'
|
36309 | ), _react2['default'].createElement(
|
36310 | 'div',
|
36311 | null,
|
36312 | 'DOM\u7B2C\u56DB'
|
36313 | ), _react2['default'].createElement(
|
36314 | 'div',
|
36315 | null,
|
36316 | 'DOM\u7B2C\u4E94'
|
36317 | )];
|
36318 | return _react2['default'].createElement(_index2['default'], { list: list, onStart: this.onDragStart, onStop: this.onDragEnd });
|
36319 | };
|
36320 |
|
36321 | return Demo9;
|
36322 | }(_react.Component);
|
36323 |
|
36324 | exports['default'] = Demo9;
|
36325 | module.exports = exports['default'];
|
36326 |
|
36327 | }),
|
36328 |
|
36329 | (function(module, exports, __webpack_require__) {
|
36330 |
|
36331 | 'use strict';
|
36332 |
|
36333 | Object.defineProperty(exports, "__esModule", {
|
36334 | value: true
|
36335 | });
|
36336 |
|
36337 | var _react = __webpack_require__(1);
|
36338 |
|
36339 | var _react2 = _interopRequireDefault(_react);
|
36340 |
|
36341 | var _Dnd = __webpack_require__(158);
|
36342 |
|
36343 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
36344 |
|
36345 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
36346 |
|
36347 | 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; }
|
36348 |
|
36349 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36350 |
|
36351 | 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; }
|
36352 |
|
36353 | 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); }
|
36354 | |
36355 |
|
36356 |
|
36357 |
|
36358 |
|
36359 |
|
36360 |
|
36361 | var Demo90 = function (_Component) {
|
36362 | _inherits(Demo90, _Component);
|
36363 |
|
36364 | function Demo90() {
|
36365 | _classCallCheck(this, Demo90);
|
36366 |
|
36367 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
36368 | }
|
36369 |
|
36370 | Demo90.prototype.render = function render() {
|
36371 | var list = ['第一', '第二', '第三', '第四', '第五'];
|
36372 | return _react2['default'].createElement(_Dnd2['default'], { list: list, type: 'horizontal' });
|
36373 | };
|
36374 |
|
36375 | return Demo90;
|
36376 | }(_react.Component);
|
36377 |
|
36378 | exports['default'] = Demo90;
|
36379 | module.exports = exports['default'];
|
36380 |
|
36381 | }),
|
36382 |
|
36383 | (function(module, exports, __webpack_require__) {
|
36384 |
|
36385 | 'use strict';
|
36386 |
|
36387 | Object.defineProperty(exports, "__esModule", {
|
36388 | value: true
|
36389 | });
|
36390 |
|
36391 | var _react = __webpack_require__(1);
|
36392 |
|
36393 | var _react2 = _interopRequireDefault(_react);
|
36394 |
|
36395 | var _Dnd = __webpack_require__(158);
|
36396 |
|
36397 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
36398 |
|
36399 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
36400 |
|
36401 | 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; }
|
36402 |
|
36403 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36404 |
|
36405 | 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; }
|
36406 |
|
36407 | 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); }
|
36408 | |
36409 |
|
36410 |
|
36411 |
|
36412 |
|
36413 |
|
36414 |
|
36415 | var Demo90 = function (_Component) {
|
36416 | _inherits(Demo90, _Component);
|
36417 |
|
36418 | function Demo90() {
|
36419 | _classCallCheck(this, Demo90);
|
36420 |
|
36421 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
36422 | }
|
36423 |
|
36424 | Demo90.prototype.render = function render() {
|
36425 | var list1 = ['第一', '第二', '第三', '第四', '第五'];
|
36426 | var list2 = ['1', '2', '3', '4', '5'];
|
36427 | return _react2['default'].createElement(_Dnd2['default'], { className: 'demo91', list: list1, otherList: list2, type: 'betweenVertical' });
|
36428 | };
|
36429 |
|
36430 | return Demo90;
|
36431 | }(_react.Component);
|
36432 |
|
36433 | exports['default'] = Demo90;
|
36434 | module.exports = exports['default'];
|
36435 |
|
36436 | }),
|
36437 |
|
36438 | (function(module, exports, __webpack_require__) {
|
36439 |
|
36440 | 'use strict';
|
36441 |
|
36442 | Object.defineProperty(exports, "__esModule", {
|
36443 | value: true
|
36444 | });
|
36445 |
|
36446 | var _react = __webpack_require__(1);
|
36447 |
|
36448 | var _react2 = _interopRequireDefault(_react);
|
36449 |
|
36450 | var _Dnd = __webpack_require__(158);
|
36451 |
|
36452 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
36453 |
|
36454 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
36455 |
|
36456 | 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; }
|
36457 |
|
36458 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36459 |
|
36460 | 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; }
|
36461 |
|
36462 | 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); }
|
36463 | |
36464 |
|
36465 |
|
36466 |
|
36467 |
|
36468 |
|
36469 |
|
36470 | var Demo90 = function (_Component) {
|
36471 | _inherits(Demo90, _Component);
|
36472 |
|
36473 | function Demo90() {
|
36474 | var _temp, _this, _ret;
|
36475 |
|
36476 | _classCallCheck(this, Demo90);
|
36477 |
|
36478 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
36479 | args[_key] = arguments[_key];
|
36480 | }
|
36481 |
|
36482 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onDragStart = function (result, list) {
|
36483 | console.log('开始');
|
36484 | }, _this.onDragEnd = function (result, listObj) {
|
36485 | console.log('结束');
|
36486 | console.log(listObj);
|
36487 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
36488 | }
|
36489 |
|
36490 | Demo90.prototype.render = function render() {
|
36491 | var list1 = ['第一', '第二', '第三', '第四', '第五'];
|
36492 | var list2 = ['1', '2', '3', '4', '5'];
|
36493 | return _react2['default'].createElement(_Dnd2['default'], { list: list1, otherList: list2, type: 'betweenHorizontal', onStart: this.onDragStart, onStop: this.onDragEnd });
|
36494 | };
|
36495 |
|
36496 | return Demo90;
|
36497 | }(_react.Component);
|
36498 |
|
36499 | exports['default'] = Demo90;
|
36500 | module.exports = exports['default'];
|
36501 |
|
36502 | }),
|
36503 |
|
36504 | (function(module, exports, __webpack_require__) {
|
36505 |
|
36506 | 'use strict';
|
36507 |
|
36508 | Object.defineProperty(exports, "__esModule", {
|
36509 | value: true
|
36510 | });
|
36511 |
|
36512 | var _react = __webpack_require__(1);
|
36513 |
|
36514 | var _react2 = _interopRequireDefault(_react);
|
36515 |
|
36516 | var _Dnd = __webpack_require__(158);
|
36517 |
|
36518 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
36519 |
|
36520 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
36521 |
|
36522 | 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; }
|
36523 |
|
36524 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36525 |
|
36526 | 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; }
|
36527 |
|
36528 | 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); }
|
36529 | |
36530 |
|
36531 |
|
36532 |
|
36533 |
|
36534 |
|
36535 |
|
36536 | var GridLayout = _Dnd2['default'].GridLayout;
|
36537 |
|
36538 | var Demo93 = function (_Component) {
|
36539 | _inherits(Demo93, _Component);
|
36540 |
|
36541 | function Demo93() {
|
36542 | _classCallCheck(this, Demo93);
|
36543 |
|
36544 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
36545 | }
|
36546 |
|
36547 | Demo93.prototype.render = function render() {
|
36548 | var layout = [{ i: 'a', x: 0, y: 0, w: 1, h: 2 }, { i: 'b', x: 1, y: 0, w: 3, h: 2 }, { i: 'c', x: 4, y: 0, w: 1, h: 2, 'static': true }, { i: 'd', x: 0, y: 1, w: 1, h: 1 }, { i: 'e', x: 2, y: 2, w: 1, h: 2 }, { i: 'f', x: 3, y: 3, w: 1, h: 2 }];
|
36549 | return _react2['default'].createElement(
|
36550 | GridLayout,
|
36551 | { className: 'layout', layout: layout, cols: 6, rowHeight: 30, width: 500 },
|
36552 | _react2['default'].createElement(
|
36553 | 'div',
|
36554 | { key: 'a' },
|
36555 | 'a'
|
36556 | ),
|
36557 | _react2['default'].createElement(
|
36558 | 'div',
|
36559 | { key: 'b' },
|
36560 | 'b'
|
36561 | ),
|
36562 | _react2['default'].createElement(
|
36563 | 'div',
|
36564 | { key: 'c' },
|
36565 | 'static'
|
36566 | ),
|
36567 | _react2['default'].createElement(
|
36568 | 'div',
|
36569 | { key: 'd' },
|
36570 | 'd'
|
36571 | ),
|
36572 | _react2['default'].createElement(
|
36573 | 'div',
|
36574 | { key: 'e' },
|
36575 | 'e'
|
36576 | ),
|
36577 | _react2['default'].createElement(
|
36578 | 'div',
|
36579 | { key: 'f' },
|
36580 | 'f'
|
36581 | )
|
36582 | );
|
36583 | };
|
36584 |
|
36585 | return Demo93;
|
36586 | }(_react.Component);
|
36587 |
|
36588 | exports['default'] = Demo93;
|
36589 | module.exports = exports['default'];
|
36590 |
|
36591 | })
|
36592 | ]);
|
36593 |
|
\ | No newline at end of file |