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 _beeLayout = __webpack_require__(1);
|
50 |
|
51 | var _beePanel = __webpack_require__(8);
|
52 |
|
53 | var _beeButton = __webpack_require__(77);
|
54 |
|
55 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
56 |
|
57 | var _react = __webpack_require__(4);
|
58 |
|
59 | var _react2 = _interopRequireDefault(_react);
|
60 |
|
61 | var _reactDom = __webpack_require__(12);
|
62 |
|
63 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
64 |
|
65 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
66 |
|
67 | 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; }
|
68 |
|
69 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
70 |
|
71 | 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; }
|
72 |
|
73 | 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); }
|
74 |
|
75 | var CARET = _react2['default'].createElement('i', { className: 'uf uf-arrow-down' });
|
76 |
|
77 | var CARETUP = _react2['default'].createElement('i', { className: 'uf uf-arrow-up' });
|
78 |
|
79 | var Demo1 = __webpack_require__(79);var Demo2 = __webpack_require__(187);var Demo3 = __webpack_require__(188);var Demo4 = __webpack_require__(189);var Demo5 = __webpack_require__(190);var Demo6 = __webpack_require__(191);var Demo7 = __webpack_require__(192);var Demo8 = __webpack_require__(193);var Demo9 = __webpack_require__(194);var Demo90 = __webpack_require__(195);var Demo91 = __webpack_require__(196);var Demo92 = __webpack_require__(197);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\";\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 {\n width: 250px;\n height: 50px;\n line-height: 50px;\n border: 1px solid rgb(30, 136, 229);\n color: #000000;\n text-align: center;\n cursor: all-scroll;\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\";\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 {\n width: 250px;\n height: 50px;\n line-height: 50px;\n border: 1px solid rgb(30, 136, 229);\n color: #000000;\n text-align: center;\n cursor: all-scroll;\n}" }, { "example": _react2['default'].createElement(Demo3, null), "title": " 设置元素不可拖拽", "code": "\n/**\n *\n * @title 设置元素不可拖拽\n * @description 设置 onStart 的返回值为false,则不可以拖拽\n *\n */\n\nimport React, { Component } from 'react';\nimport Dnd from \"tinper-bee/lib/Dnd\";\n\nclass Demo3 extends Component {\n\n onStart=()=>{\n console.log('start');\n return false;\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", "desc": " 设置 onStart 的返回值为false,则不可以拖拽", "scss_code": ".demo {\n width: 250px;\n height: 50px;\n line-height: 50px;\n border: 1px solid rgb(30, 136, 229);\n color: #000000;\n text-align: center;\n cursor: all-scroll;\n}" }, { "example": _react2['default'].createElement(Demo4, null), "title": " 单个元素拖拽把手", "code": "/**\n *\n * @title 单个元素拖拽把手\n * @description 设置 handle,值为选择器,例如 '.handle'\n * 设置不可拖拽区域 cancel,值为选择器,例如 '.handle'\n */\n\nimport React, { Component } from 'react';\nimport Dnd from \"tinper-bee/lib/Dnd\";\n\nclass Demo4 extends Component {\n\n onStart=()=>{\n console.log('start');\n }\n onStop=()=>{\n console.log('stop');\n }\n\n render() {\n return (\n <div className=\"demo-4\">\n <div>\n <Dnd handle=\".handle\" onStart={this.onStart} onStop={this.onStop}>\n <div className=\"demo4 \">\n <div className=\"handle\">我是把手</div>\n <div className=\"drag-context\">需要拖拽把手</div>\n </div>\n </Dnd>\n </div>\n <div>\n <Dnd cancel=\".handle\" >\n <div className=\"demo4 \">\n <div className=\"handle\">我是把手</div>\n <div className=\"drag-context\">不要拖拽把手</div>\n </div>\n </Dnd>\n </div>\n </div>\n\n\n );\n }\n}\n\n", "desc": " 设置 handle,值为选择器,例如 '.handle'", "scss_code": "\n.demo4 {\n width: 250px;\n line-height: 50px;\n border: 1px solid rgb(30, 136, 229);\n color: #000000;\n text-align: center;\n cursor: all-scroll;\n border: 1px solid rgb(30, 136, 229);\n height: 80px;\n}\n\n.demo4 .handle {\n height: 20px;\n line-height: 20px;\n background: lightgrey;\n margin: 10px;\n}\n\n.demo4 .drag-context {\n height: 50px;\n line-height: 50px;\n}\n\n.demo-4>div {\n display: inline-block;\n padding: 10px;\n}" }, { "example": _react2['default'].createElement(Demo5, null), "title": " 每次拖拽移动距离", "code": "\n/**\n *\n * @title 每次拖拽移动距离\n * @description 设置 grid={[x,y]}\n *\n */\n\nimport React, { Component } from 'react';\nimport Dnd from \"tinper-bee/lib/Dnd\";\n\nclass Demo5 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 grid={[25, 25]} onStart={this.onStart} onStop={this.onStop}>\n <div className=\"demo\">我每次拖拽可移动25px</div>\n </Dnd>\n </div>\n\n );\n }\n}\n\n", "desc": " 设置 grid={[x,y]}", "scss_code": ".demo {\n width: 250px;\n height: 50px;\n line-height: 50px;\n border: 1px solid rgb(30, 136, 229);\n color: #000000;\n text-align: center;\n cursor: all-scroll;\n}" }, { "example": _react2['default'].createElement(Demo6, null), "title": " 元素拖拽范围", "code": "\n/**\n *\n * @title 元素拖拽范围\n * @description 设置上下左右可拖拽范围 bounds={{top: -xxx, left: -xxx, right: xxx, bottom: xx}}\n *\n */\n\nimport React, { Component } from 'react';\nimport Dnd from \"tinper-bee/lib/Dnd\";\n\nclass Demo6 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 bounds={{top: -50, left: -50, right: 50, bottom: 50}} onStart={this.onStart} onStop={this.onStop}>\n <div className=\"demo\">我只能再上下左右50px内移动</div>\n </Dnd>\n </div>\n\n );\n }\n}\n\n", "desc": " 设置上下左右可拖拽范围 bounds={{top: -xxx, left: -xxx, right: xxx, bottom: xx}}", "scss_code": ".demo {\n width: 250px;\n height: 50px;\n line-height: 50px;\n border: 1px solid rgb(30, 136, 229);\n color: #000000;\n text-align: center;\n cursor: all-scroll;\n}" }, { "example": _react2['default'].createElement(Demo7, null), "title": " 在指定容器中拖拽", "code": "\n/**\n *\n * @title 在指定容器中拖拽\n * @description 设置只可以在指定容器中移动\n * bounds的也可以设置为选择器,bounds=\".demo8-parent\"意为在class=demo8-parent的容器中移动\n */\n\nimport React, { Component } from 'react';\nimport Dnd from \"tinper-bee/lib/Dnd\";\n\nclass Demo7 extends Component {\n\n onStart=()=>{\n console.log('start');\n }\n onStop=()=>{\n console.log('stop');\n }\n render() {\n return (\n <div>\n <div className=\"demo7-parent\">\n <Dnd bounds=\".demo7-parent\" onStart={this.onStart} onStop={this.onStop}>\n <div className=\"demo\">我只能在父级元素中移动</div>\n </Dnd>\n </div>\n </div>\n\n\n );\n }\n}\n\n", "desc": " 设置只可以在指定容器中移动", "scss_code": ".demo {\n width: 250px;\n height: 50px;\n line-height: 50px;\n border: 1px solid rgb(30, 136, 229);\n color: #000000;\n text-align: center;\n cursor: all-scroll;\n}\n\n.demo7-parent {\n width: 300px;\n height: 200px;\n background: lightgrey;\n position: relative;\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": "\n/**\n *\n * @title DOM集合拖拽列表排序\n * @description list传dom集合\n *\n */\n\nimport React, { Component } from 'react';\nimport Dnd from \"tinper-bee/lib/Dnd\";\n\nclass Demo9 extends Component {\n\n onDragStart=(result,list)=>{\n console.log('开始');\n }\n onDragEnd=(result,list)=>{\n console.log('结束');\n }\n render() {\n let list=[<div>DOM第一</div>,<div>DOM第二</div>,<div>DOM第三</div>,<div>DOM第四</div>,<div>DOM第五</div>];\n return (\n <Dnd list={list} onStart={this.onDragStart} onStop={this.onDragEnd} />\n );\n }\n}\n\n", "desc": " list传dom集合" }, { "example": _react2['default'].createElement(Demo90, null), "title": " 横向拖拽列表排序", "code": "\n/**\n *\n * @title 横向拖拽列表排序\n * @description type='horizontal'\n *\n */\n\nimport React, { Component } from 'react';\nimport { } from 'tinper-bee';\nimport Dnd from \"tinper-bee/lib/Dnd\";;\n\nclass Demo90 extends Component {\n\n render() {\n let list=['第一','第二','第三','第四','第五'];\n return (\n <Dnd list={list} type='horizontal' />\n );\n }\n}\n\n", "desc": " type='horizontal'" }, { "example": _react2['default'].createElement(Demo91, null), "title": " 两列纵向拖拽", "code": "\n/**\n *\n * @title 两列纵向拖拽\n * @description 设置 type='betweenVertical'。 如果不设置高度以及 overflow: scroll; 则高度会自动撑开\n *\n */\n\nimport React, { Component } from 'react';\nimport { } from 'tinper-bee';\nimport Dnd from \"tinper-bee/lib/Dnd\";;\n\nclass Demo90 extends Component {\n\n render() {\n let list1=['第一','第二','第三','第四','第五'];\n let list2=['1','2','3','4','5'];\n return (\n <Dnd className='demo91' list={list1} otherList={list2} type='betweenVertical' />\n );\n }\n}\n\n", "desc": " 设置 type='betweenVertical'。 如果不设置高度以及 overflow: scroll; 则高度会自动撑开", "scss_code": ".u-drop{\n overflow: scroll;\n}\n.u-drag-between{\n height: 300px;\n}" }, { "example": _react2['default'].createElement(Demo92, null), "title": " 两列横向拖拽", "code": "\n/**\n *\n * @title 两列横向拖拽\n * @description 设置 type='betweenVertical'\n *\n */\n\nimport React, { Component } from 'react';\nimport { } from 'tinper-bee';\nimport Dnd from \"tinper-bee/lib/Dnd\";;\n\nclass Demo90 extends Component {\n onDragStart=(result,list)=>{\n console.log('开始');\n }\n onDragEnd=(result,listObj)=>{\n console.log('结束');\n console.log(listObj)\n }\n render() {\n let list1=['第一','第二','第三','第四','第五'];\n let list2=['1','2','3','4','5'];\n return (\n <Dnd list={list1} otherList={list2} type='betweenHorizontal' onStart={this.onDragStart} onStop={this.onDragEnd} />\n );\n }\n}\n\n", "desc": " 设置 type='betweenVertical'", "scss_code": ".u-drop{\n overflow: scroll;\n}\n.u-drag-between-horizontal{\n height: 200px;\n}" }];
|
80 |
|
81 | var Demo = function (_Component) {
|
82 | _inherits(Demo, _Component);
|
83 |
|
84 | function Demo(props) {
|
85 | _classCallCheck(this, Demo);
|
86 |
|
87 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
88 |
|
89 | _this.state = {
|
90 | open: false
|
91 | };
|
92 | _this.handleClick = _this.handleClick.bind(_this);
|
93 | return _this;
|
94 | }
|
95 |
|
96 | Demo.prototype.handleClick = function handleClick() {
|
97 | this.setState({ open: !this.state.open });
|
98 | };
|
99 |
|
100 | Demo.prototype.render = function render() {
|
101 | var _props = this.props,
|
102 | title = _props.title,
|
103 | example = _props.example,
|
104 | code = _props.code,
|
105 | desc = _props.desc,
|
106 | scss_code = _props.scss_code;
|
107 |
|
108 | var caret = this.state.open ? CARETUP : CARET;
|
109 | var text = this.state.open ? "隐藏代码" : "查看代码";
|
110 |
|
111 | var header = _react2['default'].createElement(
|
112 | 'div',
|
113 | null,
|
114 | example,
|
115 | _react2['default'].createElement(
|
116 | _beeButton2['default'],
|
117 | { style: { "marginTop": "10px" }, shape: 'block', onClick: this.handleClick },
|
118 | caret,
|
119 | text
|
120 | )
|
121 | );
|
122 | return _react2['default'].createElement(
|
123 | _beeLayout.Col,
|
124 | { md: 12 },
|
125 | _react2['default'].createElement(
|
126 | 'h3',
|
127 | null,
|
128 | title
|
129 | ),
|
130 | _react2['default'].createElement(
|
131 | 'p',
|
132 | null,
|
133 | desc
|
134 | ),
|
135 | _react2['default'].createElement(
|
136 | _beePanel.Panel,
|
137 | { copyable: true, collapsible: true, headerContent: true, expanded: this.state.open, colors: 'bordered', header: header, footerStyle: { padding: 0 } },
|
138 | _react2['default'].createElement(
|
139 | 'pre',
|
140 | null,
|
141 | _react2['default'].createElement(
|
142 | 'code',
|
143 | { className: 'hljs javascript' },
|
144 | code
|
145 | )
|
146 | ),
|
147 | !!scss_code ? _react2['default'].createElement(
|
148 | 'pre',
|
149 | null,
|
150 | _react2['default'].createElement(
|
151 | 'code',
|
152 | { className: 'hljs css' },
|
153 | scss_code
|
154 | )
|
155 | ) : null
|
156 | )
|
157 | );
|
158 | };
|
159 |
|
160 | return Demo;
|
161 | }(_react.Component);
|
162 |
|
163 | var DemoGroup = function (_Component2) {
|
164 | _inherits(DemoGroup, _Component2);
|
165 |
|
166 | function DemoGroup(props) {
|
167 | _classCallCheck(this, DemoGroup);
|
168 |
|
169 | return _possibleConstructorReturn(this, _Component2.call(this, props));
|
170 | }
|
171 |
|
172 | DemoGroup.prototype.render = function render() {
|
173 | return _react2['default'].createElement(
|
174 | _beeLayout.Row,
|
175 | null,
|
176 | DemoArray.map(function (child, index) {
|
177 |
|
178 | return _react2['default'].createElement(Demo, { example: child.example, title: child.title, code: child.code, scss_code: child.scss_code, desc: child.desc, key: index });
|
179 | })
|
180 | );
|
181 | };
|
182 |
|
183 | return DemoGroup;
|
184 | }(_react.Component);
|
185 |
|
186 | _reactDom2['default'].render(_react2['default'].createElement(DemoGroup, null), document.getElementById('tinperBeeDemo'));
|
187 |
|
188 | }),
|
189 |
|
190 | (function(module, exports, __webpack_require__) {
|
191 |
|
192 | 'use strict';
|
193 |
|
194 | Object.defineProperty(exports, "__esModule", {
|
195 | value: true
|
196 | });
|
197 | exports.Con = exports.Row = exports.Col = undefined;
|
198 |
|
199 | var _Col2 = __webpack_require__(2);
|
200 |
|
201 | var _Col3 = _interopRequireDefault(_Col2);
|
202 |
|
203 | var _Row2 = __webpack_require__(6);
|
204 |
|
205 | var _Row3 = _interopRequireDefault(_Row2);
|
206 |
|
207 | var _Layout = __webpack_require__(7);
|
208 |
|
209 | var _Layout2 = _interopRequireDefault(_Layout);
|
210 |
|
211 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
212 |
|
213 | exports.Col = _Col3["default"];
|
214 | exports.Row = _Row3["default"];
|
215 | exports.Con = _Layout2["default"];
|
216 |
|
217 | }),
|
218 |
|
219 | (function(module, exports, __webpack_require__) {
|
220 |
|
221 | 'use strict';
|
222 |
|
223 | Object.defineProperty(exports, "__esModule", {
|
224 | value: true
|
225 | });
|
226 |
|
227 | 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; };
|
228 |
|
229 | var _classnames = __webpack_require__(3);
|
230 |
|
231 | var _classnames2 = _interopRequireDefault(_classnames);
|
232 |
|
233 | var _react = __webpack_require__(4);
|
234 |
|
235 | var _react2 = _interopRequireDefault(_react);
|
236 |
|
237 | var _propTypes = __webpack_require__(5);
|
238 |
|
239 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
240 |
|
241 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
242 |
|
243 | 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; }
|
244 |
|
245 | 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; }
|
246 |
|
247 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
248 |
|
249 | 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; }
|
250 |
|
251 | 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); }
|
252 |
|
253 | var propTypes = {
|
254 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]),
|
255 |
|
256 | |
257 |
|
258 |
|
259 | xs: _propTypes2["default"].number,
|
260 | |
261 |
|
262 |
|
263 | sm: _propTypes2["default"].number,
|
264 | |
265 |
|
266 |
|
267 | md: _propTypes2["default"].number,
|
268 | |
269 |
|
270 |
|
271 | lg: _propTypes2["default"].number,
|
272 | |
273 |
|
274 |
|
275 | xsOffset: _propTypes2["default"].number,
|
276 | |
277 |
|
278 |
|
279 | smOffset: _propTypes2["default"].number,
|
280 | |
281 |
|
282 |
|
283 | mdOffset: _propTypes2["default"].number,
|
284 | |
285 |
|
286 |
|
287 | lgOffset: _propTypes2["default"].number,
|
288 | |
289 |
|
290 |
|
291 | xsPush: _propTypes2["default"].number,
|
292 | |
293 |
|
294 |
|
295 | smPush: _propTypes2["default"].number,
|
296 | |
297 |
|
298 |
|
299 | mdPush: _propTypes2["default"].number,
|
300 | |
301 |
|
302 |
|
303 | lgPush: _propTypes2["default"].number,
|
304 | |
305 |
|
306 |
|
307 | xsPull: _propTypes2["default"].number,
|
308 | |
309 |
|
310 |
|
311 | smPull: _propTypes2["default"].number,
|
312 | |
313 |
|
314 |
|
315 | mdPull: _propTypes2["default"].number,
|
316 | |
317 |
|
318 |
|
319 | lgPull: _propTypes2["default"].number
|
320 | };
|
321 |
|
322 | var defaultProps = {
|
323 | componentClass: 'div',
|
324 | clsPrefix: 'u-col'
|
325 | };
|
326 |
|
327 | var DEVICE_SIZES = ['lg', 'md', 'sm', 'xs'];
|
328 |
|
329 | var Col = function (_Component) {
|
330 | _inherits(Col, _Component);
|
331 |
|
332 | function Col() {
|
333 | _classCallCheck(this, Col);
|
334 |
|
335 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
336 | }
|
337 |
|
338 | Col.prototype.render = function render() {
|
339 | var _props = this.props,
|
340 | Component = _props.componentClass,
|
341 | className = _props.className,
|
342 | clsPrefix = _props.clsPrefix,
|
343 | others = _objectWithoutProperties(_props, ['componentClass', 'className', 'clsPrefix']);
|
344 |
|
345 | var tbClass = [];
|
346 | |
347 |
|
348 |
|
349 |
|
350 | DEVICE_SIZES.forEach(function (size) {
|
351 | function popProp(propSuffix, modifier) {
|
352 | var propName = '' + size + propSuffix;
|
353 | var propValue = others[propName];
|
354 |
|
355 | if (propValue != undefined && propValue != null) {
|
356 | tbClass.push(clsPrefix + '-' + size + modifier + '-' + propValue);
|
357 | }
|
358 |
|
359 | delete others[propName];
|
360 | }
|
361 |
|
362 | popProp('', '');
|
363 | popProp('Offset', '-offset');
|
364 | popProp('Push', '-push');
|
365 | popProp('Pull', '-pull');
|
366 | });
|
367 |
|
368 | return _react2["default"].createElement(
|
369 | Component,
|
370 | _extends({
|
371 | className: (0, _classnames2["default"])(tbClass, className)
|
372 | }, others),
|
373 | this.props.children
|
374 | );
|
375 | };
|
376 |
|
377 | return Col;
|
378 | }(_react.Component);
|
379 |
|
380 | Col.defaultProps = defaultProps;
|
381 | Col.propTypes = propTypes;
|
382 |
|
383 | exports["default"] = Col;
|
384 | module.exports = exports['default'];
|
385 |
|
386 | }),
|
387 |
|
388 | (function(module, exports, __webpack_require__) {
|
389 |
|
390 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; |
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 | (function () {
|
398 | 'use strict';
|
399 |
|
400 | var hasOwn = {}.hasOwnProperty;
|
401 |
|
402 | function classNames () {
|
403 | var classes = [];
|
404 |
|
405 | for (var i = 0; i < arguments.length; i++) {
|
406 | var arg = arguments[i];
|
407 | if (!arg) continue;
|
408 |
|
409 | var argType = typeof arg;
|
410 |
|
411 | if (argType === 'string' || argType === 'number') {
|
412 | classes.push(arg);
|
413 | } else if (Array.isArray(arg) && arg.length) {
|
414 | var inner = classNames.apply(null, arg);
|
415 | if (inner) {
|
416 | classes.push(inner);
|
417 | }
|
418 | } else if (argType === 'object') {
|
419 | for (var key in arg) {
|
420 | if (hasOwn.call(arg, key) && arg[key]) {
|
421 | classes.push(key);
|
422 | }
|
423 | }
|
424 | }
|
425 | }
|
426 |
|
427 | return classes.join(' ');
|
428 | }
|
429 |
|
430 | if (typeof module !== 'undefined' && module.exports) {
|
431 | classNames.default = classNames;
|
432 | module.exports = classNames;
|
433 | } else if (true) {
|
434 |
|
435 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
|
436 | return classNames;
|
437 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
438 | } else {
|
439 | window.classNames = classNames;
|
440 | }
|
441 | }());
|
442 |
|
443 |
|
444 | }),
|
445 |
|
446 | (function(module, exports) {
|
447 |
|
448 | module.exports = React;
|
449 |
|
450 | }),
|
451 |
|
452 | (function(module, exports) {
|
453 |
|
454 | module.exports = PropTypes;
|
455 |
|
456 | }),
|
457 |
|
458 | (function(module, exports, __webpack_require__) {
|
459 |
|
460 | 'use strict';
|
461 |
|
462 | Object.defineProperty(exports, "__esModule", {
|
463 | value: true
|
464 | });
|
465 |
|
466 | 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; };
|
467 |
|
468 | var _classnames = __webpack_require__(3);
|
469 |
|
470 | var _classnames2 = _interopRequireDefault(_classnames);
|
471 |
|
472 | var _react = __webpack_require__(4);
|
473 |
|
474 | var _react2 = _interopRequireDefault(_react);
|
475 |
|
476 | var _propTypes = __webpack_require__(5);
|
477 |
|
478 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
479 |
|
480 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
481 |
|
482 | 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; }
|
483 |
|
484 | 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; }
|
485 |
|
486 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
487 |
|
488 | 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; }
|
489 |
|
490 | 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); }
|
491 |
|
492 | var propTypes = {
|
493 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string])
|
494 | };
|
495 |
|
496 | var defaultProps = {
|
497 | componentClass: 'div',
|
498 | clsPrefix: 'u-row'
|
499 | };
|
500 |
|
501 | var Row = function (_Component) {
|
502 | _inherits(Row, _Component);
|
503 |
|
504 | function Row() {
|
505 | _classCallCheck(this, Row);
|
506 |
|
507 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
508 | }
|
509 |
|
510 | Row.prototype.render = function render() {
|
511 | var _props = this.props,
|
512 | Component = _props.componentClass,
|
513 | clsPrefix = _props.clsPrefix,
|
514 | className = _props.className,
|
515 | others = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
|
516 |
|
517 | var bsclass = '' + clsPrefix;
|
518 |
|
519 | return _react2["default"].createElement(
|
520 | Component,
|
521 | _extends({}, others, {
|
522 | className: (0, _classnames2["default"])(bsclass, className)
|
523 | }),
|
524 | this.props.children
|
525 | );
|
526 | };
|
527 |
|
528 | return Row;
|
529 | }(_react.Component);
|
530 |
|
531 | Row.propTypes = propTypes;
|
532 | Row.defaultProps = defaultProps;
|
533 |
|
534 | exports["default"] = Row;
|
535 | module.exports = exports['default'];
|
536 |
|
537 | }),
|
538 |
|
539 | (function(module, exports, __webpack_require__) {
|
540 |
|
541 | 'use strict';
|
542 |
|
543 | Object.defineProperty(exports, "__esModule", {
|
544 | value: true
|
545 | });
|
546 |
|
547 | 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; };
|
548 |
|
549 | var _classnames = __webpack_require__(3);
|
550 |
|
551 | var _classnames2 = _interopRequireDefault(_classnames);
|
552 |
|
553 | var _react = __webpack_require__(4);
|
554 |
|
555 | var _react2 = _interopRequireDefault(_react);
|
556 |
|
557 | var _propTypes = __webpack_require__(5);
|
558 |
|
559 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
560 |
|
561 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
562 |
|
563 | 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; }
|
564 |
|
565 | 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; }
|
566 |
|
567 | 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; }
|
568 |
|
569 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
570 |
|
571 | 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; }
|
572 |
|
573 | 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); }
|
574 |
|
575 | var propTypes = {
|
576 | |
577 |
|
578 |
|
579 | fluid: _propTypes2["default"].bool,
|
580 | |
581 |
|
582 |
|
583 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string])
|
584 | };
|
585 |
|
586 | var defaultProps = {
|
587 | componentClass: 'div',
|
588 | fluid: false,
|
589 | clsPrefix: 'u-container'
|
590 | };
|
591 |
|
592 | var Con = function (_React$Component) {
|
593 | _inherits(Con, _React$Component);
|
594 |
|
595 | function Con() {
|
596 | _classCallCheck(this, Con);
|
597 |
|
598 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
599 | }
|
600 |
|
601 | Con.prototype.render = function render() {
|
602 | var _tbclass;
|
603 |
|
604 | var _props = this.props,
|
605 | fluid = _props.fluid,
|
606 | Component = _props.componentClass,
|
607 | clsPrefix = _props.clsPrefix,
|
608 | className = _props.className,
|
609 | others = _objectWithoutProperties(_props, ['fluid', 'componentClass', 'clsPrefix', 'className']);
|
610 |
|
611 | var tbclass = (_tbclass = {}, _defineProperty(_tbclass, '' + clsPrefix, !fluid), _defineProperty(_tbclass, clsPrefix + '-fluid', fluid), _tbclass);
|
612 |
|
613 | return _react2["default"].createElement(
|
614 | Component,
|
615 | _extends({}, others, {
|
616 | className: (0, _classnames2["default"])(tbclass, className)
|
617 | }),
|
618 | this.props.children
|
619 | );
|
620 | };
|
621 |
|
622 | return Con;
|
623 | }(_react2["default"].Component);
|
624 |
|
625 | Con.propTypes = propTypes;
|
626 | Con.defaultProps = defaultProps;
|
627 |
|
628 | exports["default"] = Con;
|
629 | module.exports = exports['default'];
|
630 |
|
631 | }),
|
632 |
|
633 | (function(module, exports, __webpack_require__) {
|
634 |
|
635 | 'use strict';
|
636 |
|
637 | Object.defineProperty(exports, "__esModule", {
|
638 | value: true
|
639 | });
|
640 | exports.PanelGroup = exports.Panel = undefined;
|
641 |
|
642 | var _Panel2 = __webpack_require__(9);
|
643 |
|
644 | var _Panel3 = _interopRequireDefault(_Panel2);
|
645 |
|
646 | var _PanelGroup2 = __webpack_require__(76);
|
647 |
|
648 | var _PanelGroup3 = _interopRequireDefault(_PanelGroup2);
|
649 |
|
650 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
651 |
|
652 | exports.Panel = _Panel3["default"];
|
653 | exports.PanelGroup = _PanelGroup3["default"];
|
654 |
|
655 | }),
|
656 |
|
657 | (function(module, exports, __webpack_require__) {
|
658 |
|
659 | 'use strict';
|
660 |
|
661 | Object.defineProperty(exports, "__esModule", {
|
662 | value: true
|
663 | });
|
664 |
|
665 | 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; };
|
666 |
|
667 | var _classnames = __webpack_require__(3);
|
668 |
|
669 | var _classnames2 = _interopRequireDefault(_classnames);
|
670 |
|
671 | var _react = __webpack_require__(4);
|
672 |
|
673 | var _react2 = _interopRequireDefault(_react);
|
674 |
|
675 | var _beeTransition = __webpack_require__(10);
|
676 |
|
677 | var _beeMessage = __webpack_require__(64);
|
678 |
|
679 | var _beeMessage2 = _interopRequireDefault(_beeMessage);
|
680 |
|
681 | var _propTypes = __webpack_require__(5);
|
682 |
|
683 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
684 |
|
685 | var _copyToClipboard = __webpack_require__(74);
|
686 |
|
687 | var _copyToClipboard2 = _interopRequireDefault(_copyToClipboard);
|
688 |
|
689 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
690 |
|
691 | 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; }
|
692 |
|
693 | 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; }
|
694 |
|
695 | 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; }
|
696 |
|
697 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
698 |
|
699 | 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; }
|
700 |
|
701 | 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); }
|
702 |
|
703 | var propTypes = {
|
704 |
|
705 | collapsible: _propTypes2["default"].bool,
|
706 | onSelect: _propTypes2["default"].func,
|
707 |
|
708 | header: _propTypes2["default"].node,
|
709 | headerStyle: _propTypes2["default"].object,
|
710 | id: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
711 | headerContent: _propTypes2["default"].bool,
|
712 |
|
713 | footer: _propTypes2["default"].node,
|
714 | footerStyle: _propTypes2["default"].object,
|
715 |
|
716 | defaultExpanded: _propTypes2["default"].bool,
|
717 |
|
718 | expanded: _propTypes2["default"].bool,
|
719 |
|
720 | eventKey: _propTypes2["default"].any,
|
721 | headerRole: _propTypes2["default"].string,
|
722 | panelRole: _propTypes2["default"].string,
|
723 |
|
724 | colors: _propTypes2["default"].oneOf(['primary', 'accent', 'success', 'info', 'warning', 'danger', 'default', 'bordered']),
|
725 |
|
726 |
|
727 | onEnter: _propTypes2["default"].func,
|
728 | onEntering: _propTypes2["default"].func,
|
729 | onEntered: _propTypes2["default"].func,
|
730 | onExit: _propTypes2["default"].func,
|
731 | onExiting: _propTypes2["default"].func,
|
732 | onExited: _propTypes2["default"].func,
|
733 |
|
734 | copyable: _propTypes2["default"].bool
|
735 | };
|
736 |
|
737 | var defaultProps = {
|
738 | defaultExpanded: false,
|
739 | clsPrefix: "u-panel",
|
740 | colors: "default"
|
741 | };
|
742 |
|
743 | var Panel = function (_React$Component) {
|
744 | _inherits(Panel, _React$Component);
|
745 |
|
746 | function Panel(props, context) {
|
747 | _classCallCheck(this, Panel);
|
748 |
|
749 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
750 |
|
751 | _this.handleClickTitle = _this.handleClickTitle.bind(_this);
|
752 |
|
753 | _this.state = {
|
754 | expanded: _this.props.defaultExpanded
|
755 | };
|
756 | return _this;
|
757 | }
|
758 |
|
759 |
|
760 |
|
761 |
|
762 | Panel.prototype.handleClickTitle = function handleClickTitle(e) {
|
763 |
|
764 | e.persist();
|
765 | e.selected = true;
|
766 |
|
767 | if (this.props.onSelect) {
|
768 | this.props.onSelect(this.props.eventKey, e);
|
769 | } else {
|
770 | e.preventDefault();
|
771 | }
|
772 |
|
773 | if (e.selected) {
|
774 | this.setState({ expanded: !this.state.expanded });
|
775 | }
|
776 | };
|
777 |
|
778 |
|
779 |
|
780 |
|
781 | Panel.prototype.renderHeader = function renderHeader(collapsible, header, id, role, expanded, clsPrefix) {
|
782 | var titleClassName = clsPrefix + '-title';
|
783 |
|
784 | if (!collapsible) {
|
785 | if (!_react2["default"].isValidElement(header)) {
|
786 | return header;
|
787 | }
|
788 |
|
789 | return (0, _react.cloneElement)(header, {
|
790 | className: (0, _classnames2["default"])(header.props.className, titleClassName)
|
791 | });
|
792 | }
|
793 |
|
794 | if (!_react2["default"].isValidElement(header)) {
|
795 | return _react2["default"].createElement(
|
796 | 'h4',
|
797 | { role: 'presentation', className: titleClassName },
|
798 | this.renderAnchor(header, id, role, expanded)
|
799 | );
|
800 | }
|
801 | if (this.props.headerContent) {
|
802 | return (0, _react.cloneElement)(header, {
|
803 | className: (0, _classnames2["default"])(header.props.className, titleClassName)
|
804 | });
|
805 | }
|
806 |
|
807 | return (0, _react.cloneElement)(header, {
|
808 | className: (0, _classnames2["default"])(header.props.className, titleClassName),
|
809 | children: this.renderAnchor(header.props.children, id, role, expanded)
|
810 | });
|
811 | };
|
812 |
|
813 |
|
814 |
|
815 |
|
816 | Panel.prototype.renderAnchor = function renderAnchor(header, id, role, expanded) {
|
817 | return _react2["default"].createElement(
|
818 | 'a',
|
819 | {
|
820 | role: role,
|
821 | href: id && '#' + id,
|
822 | 'aria-controls': id,
|
823 | 'aria-expanded': expanded,
|
824 | 'aria-selected': expanded,
|
825 | className: expanded ? null : 'collapsed'
|
826 | },
|
827 | header
|
828 | );
|
829 | };
|
830 |
|
831 |
|
832 |
|
833 |
|
834 | Panel.prototype.copyDemo = function copyDemo(e) {
|
835 | var panelTarget = e.target.parentNode;
|
836 | var clipBoardContent = panelTarget.firstChild.innerText;
|
837 | (0, _copyToClipboard2["default"])(clipBoardContent);
|
838 | _beeMessage2["default"].create({ content: '复制成功!', color: 'success', duration: 2 });
|
839 | };
|
840 |
|
841 |
|
842 |
|
843 |
|
844 | Panel.prototype.renderCollapsibleBody = function renderCollapsibleBody(id, expanded, role, children, clsPrefix, copyable, animationHooks) {
|
845 | return _react2["default"].createElement(
|
846 | _beeTransition.Collapse,
|
847 | _extends({ 'in': expanded }, animationHooks),
|
848 | _react2["default"].createElement(
|
849 | 'div',
|
850 | {
|
851 | id: id,
|
852 | role: role,
|
853 | className: clsPrefix + '-collapse',
|
854 | 'aria-hidden': !expanded
|
855 | },
|
856 | this.renderBody(children, clsPrefix, copyable)
|
857 | )
|
858 | );
|
859 | };
|
860 |
|
861 |
|
862 |
|
863 |
|
864 | Panel.prototype.renderBody = function renderBody(rawChildren, clsPrefix, copyable) {
|
865 | var self = this;
|
866 | var children = [];
|
867 | var bodyChildren = [];
|
868 |
|
869 | var bodyClassName = clsPrefix + '-body';
|
870 |
|
871 | function maybeAddBody(self) {
|
872 | if (!bodyChildren.length) {
|
873 | return;
|
874 | }
|
875 |
|
876 | children.push(_react2["default"].createElement(
|
877 | 'div',
|
878 | { key: children.length, className: bodyClassName },
|
879 | bodyChildren,
|
880 | copyable && _react2["default"].createElement('i', { className: 'uf uf-files-o', onClick: self.copyDemo })
|
881 | ));
|
882 | bodyChildren = [];
|
883 | }
|
884 |
|
885 |
|
886 | _react2["default"].Children.toArray(rawChildren).forEach(function (child) {
|
887 | if (_react2["default"].isValidElement(child) && child.props.fill) {
|
888 | maybeAddBody(self);
|
889 |
|
890 |
|
891 | children.push((0, _react.cloneElement)(child, { fill: undefined }));
|
892 |
|
893 | return;
|
894 | }
|
895 | bodyChildren.push(child);
|
896 | });
|
897 |
|
898 | maybeAddBody(self);
|
899 |
|
900 | return children;
|
901 | };
|
902 |
|
903 | Panel.prototype.render = function render() {
|
904 | var _props = this.props,
|
905 | collapsible = _props.collapsible,
|
906 | header = _props.header,
|
907 | id = _props.id,
|
908 | footer = _props.footer,
|
909 | propsExpanded = _props.expanded,
|
910 | footerStyle = _props.footerStyle,
|
911 | headerStyle = _props.headerStyle,
|
912 | headerRole = _props.headerRole,
|
913 | panelRole = _props.panelRole,
|
914 | className = _props.className,
|
915 | colors = _props.colors,
|
916 | children = _props.children,
|
917 | onEnter = _props.onEnter,
|
918 | onEntering = _props.onEntering,
|
919 | onEntered = _props.onEntered,
|
920 | clsPrefix = _props.clsPrefix,
|
921 | onExit = _props.onExit,
|
922 | headerContent = _props.headerContent,
|
923 | onExiting = _props.onExiting,
|
924 | onExited = _props.onExited,
|
925 | defaultExpanded = _props.defaultExpanded,
|
926 | eventKey = _props.eventKey,
|
927 | onSelect = _props.onSelect,
|
928 | copyable = _props.copyable,
|
929 | 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']);
|
930 |
|
931 | var expanded = propsExpanded != null ? propsExpanded : this.state.expanded;
|
932 |
|
933 | var classes = {};
|
934 | classes['' + clsPrefix] = true;
|
935 | classes[clsPrefix + '-' + colors] = true;
|
936 |
|
937 | var headerClass = _defineProperty({}, clsPrefix + '-heading', true);
|
938 |
|
939 | copyable === false ? false : true;
|
940 | return _react2["default"].createElement(
|
941 | 'div',
|
942 | _extends({}, props, {
|
943 | className: (0, _classnames2["default"])(className, classes),
|
944 | id: collapsible ? null : id
|
945 | }),
|
946 | header && _react2["default"].createElement(
|
947 | 'div',
|
948 | { className: (0, _classnames2["default"])(headerClass), style: headerStyle, onClick: this.handleClickTitle },
|
949 | this.renderHeader(collapsible, header, id, headerRole, expanded, clsPrefix)
|
950 | ),
|
951 | 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),
|
952 | footer && _react2["default"].createElement(
|
953 | 'div',
|
954 | { className: clsPrefix + '-footer', style: footerStyle },
|
955 | footer
|
956 | )
|
957 | );
|
958 | };
|
959 |
|
960 | return Panel;
|
961 | }(_react2["default"].Component);
|
962 |
|
963 | Panel.propTypes = propTypes;
|
964 | Panel.defaultProps = defaultProps;
|
965 |
|
966 | exports["default"] = Panel;
|
967 | module.exports = exports['default'];
|
968 |
|
969 | }),
|
970 |
|
971 | (function(module, exports, __webpack_require__) {
|
972 |
|
973 | 'use strict';
|
974 |
|
975 | Object.defineProperty(exports, "__esModule", {
|
976 | value: true
|
977 | });
|
978 | exports.Fade = exports.Collapse = exports.Transition = undefined;
|
979 |
|
980 | var _Transition2 = __webpack_require__(11);
|
981 |
|
982 | var _Transition3 = _interopRequireDefault(_Transition2);
|
983 |
|
984 | var _Collapse2 = __webpack_require__(16);
|
985 |
|
986 | var _Collapse3 = _interopRequireDefault(_Collapse2);
|
987 |
|
988 | var _Fade2 = __webpack_require__(63);
|
989 |
|
990 | var _Fade3 = _interopRequireDefault(_Fade2);
|
991 |
|
992 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
993 |
|
994 | exports.Transition = _Transition3["default"];
|
995 | exports.Collapse = _Collapse3["default"];
|
996 | exports.Fade = _Fade3["default"];
|
997 |
|
998 | }),
|
999 |
|
1000 | (function(module, exports, __webpack_require__) {
|
1001 |
|
1002 | 'use strict';
|
1003 |
|
1004 | Object.defineProperty(exports, "__esModule", {
|
1005 | value: true
|
1006 | });
|
1007 | exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined;
|
1008 |
|
1009 | 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; };
|
1010 |
|
1011 | var _react = __webpack_require__(4);
|
1012 |
|
1013 | var _react2 = _interopRequireDefault(_react);
|
1014 |
|
1015 | var _reactDom = __webpack_require__(12);
|
1016 |
|
1017 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
1018 |
|
1019 | var _properties = __webpack_require__(13);
|
1020 |
|
1021 | var _properties2 = _interopRequireDefault(_properties);
|
1022 |
|
1023 | var _on = __webpack_require__(15);
|
1024 |
|
1025 | var _on2 = _interopRequireDefault(_on);
|
1026 |
|
1027 | var _classnames = __webpack_require__(3);
|
1028 |
|
1029 | var _classnames2 = _interopRequireDefault(_classnames);
|
1030 |
|
1031 | var _propTypes = __webpack_require__(5);
|
1032 |
|
1033 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
1034 |
|
1035 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1036 |
|
1037 | 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; }
|
1038 |
|
1039 | 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; }
|
1040 |
|
1041 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1042 |
|
1043 | 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; }
|
1044 |
|
1045 | 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); }
|
1046 |
|
1047 | var transitionEndEvent = _properties2["default"].end;
|
1048 |
|
1049 |
|
1050 | var UNMOUNTED = exports.UNMOUNTED = 0;
|
1051 | var EXITED = exports.EXITED = 1;
|
1052 | var ENTERING = exports.ENTERING = 2;
|
1053 | var ENTERED = exports.ENTERED = 3;
|
1054 | var EXITING = exports.EXITING = 4;
|
1055 |
|
1056 | var propTypes = {
|
1057 | |
1058 |
|
1059 |
|
1060 | "in": _propTypes2["default"].bool,
|
1061 |
|
1062 | |
1063 |
|
1064 |
|
1065 | unmountOnExit: _propTypes2["default"].bool,
|
1066 |
|
1067 | |
1068 |
|
1069 |
|
1070 | transitionAppear: _propTypes2["default"].bool,
|
1071 |
|
1072 | |
1073 |
|
1074 |
|
1075 | timeout: _propTypes2["default"].number,
|
1076 |
|
1077 | |
1078 |
|
1079 |
|
1080 | exitedClassName: _propTypes2["default"].string,
|
1081 | |
1082 |
|
1083 |
|
1084 | exitingClassName: _propTypes2["default"].string,
|
1085 | |
1086 |
|
1087 |
|
1088 | enteredClassName: _propTypes2["default"].string,
|
1089 | |
1090 |
|
1091 |
|
1092 | enteringClassName: _propTypes2["default"].string,
|
1093 |
|
1094 | |
1095 |
|
1096 |
|
1097 | onEnter: _propTypes2["default"].func,
|
1098 | |
1099 |
|
1100 |
|
1101 | onEntering: _propTypes2["default"].func,
|
1102 | |
1103 |
|
1104 |
|
1105 | onEntered: _propTypes2["default"].func,
|
1106 | |
1107 |
|
1108 |
|
1109 | onExit: _propTypes2["default"].func,
|
1110 | |
1111 |
|
1112 |
|
1113 | onExiting: _propTypes2["default"].func,
|
1114 | |
1115 |
|
1116 |
|
1117 | onExited: _propTypes2["default"].func
|
1118 | };
|
1119 |
|
1120 | function noop() {}
|
1121 |
|
1122 | var defaultProps = {
|
1123 | "in": false,
|
1124 | unmountOnExit: false,
|
1125 | transitionAppear: false,
|
1126 | timeout: 5000,
|
1127 | onEnter: noop,
|
1128 | onEntering: noop,
|
1129 | onEntered: noop,
|
1130 | onExit: noop,
|
1131 | onExiting: noop,
|
1132 | onExited: noop
|
1133 | };
|
1134 |
|
1135 | |
1136 |
|
1137 |
|
1138 |
|
1139 | var Transition = function (_Component) {
|
1140 | _inherits(Transition, _Component);
|
1141 |
|
1142 | function Transition(props, context) {
|
1143 | _classCallCheck(this, Transition);
|
1144 |
|
1145 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
1146 |
|
1147 | var initialStatus = void 0;
|
1148 | if (props["in"]) {
|
1149 |
|
1150 | initialStatus = props.transitionAppear ? EXITED : ENTERED;
|
1151 | } else {
|
1152 | initialStatus = props.unmountOnExit ? UNMOUNTED : EXITED;
|
1153 | }
|
1154 | _this.state = { status: initialStatus };
|
1155 |
|
1156 | _this.nextCallback = null;
|
1157 | return _this;
|
1158 | }
|
1159 |
|
1160 | Transition.prototype.componentDidMount = function componentDidMount() {
|
1161 | if (this.props.transitionAppear && this.props["in"]) {
|
1162 | this.performEnter(this.props);
|
1163 | }
|
1164 | };
|
1165 |
|
1166 | Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
1167 | if (nextProps["in"] && this.props.unmountOnExit) {
|
1168 | if (this.state.status === UNMOUNTED) {
|
1169 |
|
1170 | this.setState({ status: EXITED });
|
1171 | }
|
1172 | } else {
|
1173 | this._needsUpdate = true;
|
1174 | }
|
1175 | };
|
1176 |
|
1177 | Transition.prototype.componentDidUpdate = function componentDidUpdate() {
|
1178 | var status = this.state.status;
|
1179 |
|
1180 | if (this.props.unmountOnExit && status === EXITED) {
|
1181 |
|
1182 | if (this.props["in"]) {
|
1183 | this.performEnter(this.props);
|
1184 | } else {
|
1185 | this.setState({ status: UNMOUNTED });
|
1186 | }
|
1187 |
|
1188 | return;
|
1189 | }
|
1190 |
|
1191 |
|
1192 | if (this._needsUpdate) {
|
1193 | this._needsUpdate = false;
|
1194 |
|
1195 | if (this.props["in"]) {
|
1196 | if (status === EXITING) {
|
1197 | this.performEnter(this.props);
|
1198 | } else if (status === EXITED) {
|
1199 | this.performEnter(this.props);
|
1200 | }
|
1201 |
|
1202 | } else {
|
1203 | if (status === ENTERING || status === ENTERED) {
|
1204 | this.performExit(this.props);
|
1205 | }
|
1206 |
|
1207 | }
|
1208 | }
|
1209 | };
|
1210 |
|
1211 | Transition.prototype.componentWillUnmount = function componentWillUnmount() {
|
1212 | this.cancelNextCallback();
|
1213 | };
|
1214 |
|
1215 | Transition.prototype.performEnter = function performEnter(props) {
|
1216 | var _this2 = this;
|
1217 |
|
1218 | this.cancelNextCallback();
|
1219 | var node = _reactDom2["default"].findDOMNode(this);
|
1220 |
|
1221 |
|
1222 | props.onEnter(node);
|
1223 |
|
1224 | this.safeSetState({ status: ENTERING }, function () {
|
1225 | _this2.props.onEntering(node);
|
1226 |
|
1227 | _this2.onTransitionEnd(node, function () {
|
1228 | _this2.safeSetState({ status: ENTERED }, function () {
|
1229 | _this2.props.onEntered(node);
|
1230 | });
|
1231 | });
|
1232 | });
|
1233 | };
|
1234 |
|
1235 | Transition.prototype.performExit = function performExit(props) {
|
1236 | var _this3 = this;
|
1237 |
|
1238 | this.cancelNextCallback();
|
1239 | var node = _reactDom2["default"].findDOMNode(this);
|
1240 |
|
1241 | props.onExit(node);
|
1242 |
|
1243 | this.safeSetState({ status: EXITING }, function () {
|
1244 | _this3.props.onExiting(node);
|
1245 |
|
1246 | _this3.onTransitionEnd(node, function () {
|
1247 | _this3.safeSetState({ status: EXITED }, function () {
|
1248 | _this3.props.onExited(node);
|
1249 | });
|
1250 | });
|
1251 | });
|
1252 | };
|
1253 |
|
1254 | Transition.prototype.cancelNextCallback = function cancelNextCallback() {
|
1255 | if (this.nextCallback !== null) {
|
1256 | this.nextCallback.cancel();
|
1257 | this.nextCallback = null;
|
1258 | }
|
1259 | };
|
1260 |
|
1261 | Transition.prototype.safeSetState = function safeSetState(nextState, callback) {
|
1262 |
|
1263 | this.setState(nextState, this.setNextCallback(callback));
|
1264 | };
|
1265 |
|
1266 | Transition.prototype.setNextCallback = function setNextCallback(callback) {
|
1267 | var _this4 = this;
|
1268 |
|
1269 | var active = true;
|
1270 |
|
1271 | this.nextCallback = function (event) {
|
1272 | if (active) {
|
1273 | active = false;
|
1274 | _this4.nextCallback = null;
|
1275 |
|
1276 | callback(event);
|
1277 | }
|
1278 | };
|
1279 |
|
1280 | this.nextCallback.cancel = function () {
|
1281 | active = false;
|
1282 | };
|
1283 |
|
1284 | return this.nextCallback;
|
1285 | };
|
1286 |
|
1287 | Transition.prototype.onTransitionEnd = function onTransitionEnd(node, handler) {
|
1288 | this.setNextCallback(handler);
|
1289 |
|
1290 | if (node) {
|
1291 | if (transitionEndEvent == undefined) {
|
1292 | this.nextCallback();
|
1293 | } else {
|
1294 | (0, _on2["default"])(node, transitionEndEvent, this.nextCallback);
|
1295 | }
|
1296 | setTimeout(this.nextCallback, this.props.timeout);
|
1297 | } else {
|
1298 | setTimeout(this.nextCallback, 0);
|
1299 | }
|
1300 | };
|
1301 |
|
1302 | Transition.prototype.render = function render() {
|
1303 | var status = this.state.status;
|
1304 | if (status === UNMOUNTED) {
|
1305 | return null;
|
1306 | }
|
1307 |
|
1308 | var _props = this.props,
|
1309 | children = _props.children,
|
1310 | className = _props.className,
|
1311 | childProps = _objectWithoutProperties(_props, ['children', 'className']);
|
1312 |
|
1313 | Object.keys(Transition.propTypes).forEach(function (key) {
|
1314 | return delete childProps[key];
|
1315 | });
|
1316 |
|
1317 | var transitionClassName = void 0;
|
1318 | if (status === EXITED) {
|
1319 | transitionClassName = this.props.exitedClassName;
|
1320 | } else if (status === ENTERING) {
|
1321 | transitionClassName = this.props.enteringClassName;
|
1322 | } else if (status === ENTERED) {
|
1323 | transitionClassName = this.props.enteredClassName;
|
1324 | } else if (status === EXITING) {
|
1325 | transitionClassName = this.props.exitingClassName;
|
1326 | }
|
1327 |
|
1328 | var child = _react2["default"].Children.only(children);
|
1329 | return _react2["default"].cloneElement(child, _extends({}, childProps, {
|
1330 | className: (0, _classnames2["default"])(child.props.className, className, transitionClassName)
|
1331 | }));
|
1332 | };
|
1333 |
|
1334 | return Transition;
|
1335 | }(_react.Component);
|
1336 |
|
1337 | Transition.propTypes = propTypes;
|
1338 |
|
1339 | Transition.defaultProps = defaultProps;
|
1340 |
|
1341 | exports["default"] = Transition;
|
1342 |
|
1343 | }),
|
1344 |
|
1345 | (function(module, exports) {
|
1346 |
|
1347 | module.exports = ReactDOM;
|
1348 |
|
1349 | }),
|
1350 |
|
1351 | (function(module, exports, __webpack_require__) {
|
1352 |
|
1353 | 'use strict';
|
1354 |
|
1355 | Object.defineProperty(exports, "__esModule", {
|
1356 | value: true
|
1357 | });
|
1358 | exports.animationEnd = exports.animationDelay = exports.animationTiming = exports.animationDuration = exports.animationName = exports.transitionEnd = exports.transitionDuration = exports.transitionDelay = exports.transitionTiming = exports.transitionProperty = exports.transform = undefined;
|
1359 |
|
1360 | var _inDOM = __webpack_require__(14);
|
1361 |
|
1362 | var _inDOM2 = _interopRequireDefault(_inDOM);
|
1363 |
|
1364 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1365 |
|
1366 | var transform = 'transform';
|
1367 | var prefix = void 0,
|
1368 | transitionEnd = void 0,
|
1369 | animationEnd = void 0;
|
1370 | var transitionProperty = void 0,
|
1371 | transitionDuration = void 0,
|
1372 | transitionTiming = void 0,
|
1373 | transitionDelay = void 0;
|
1374 | var animationName = void 0,
|
1375 | animationDuration = void 0,
|
1376 | animationTiming = void 0,
|
1377 | animationDelay = void 0;
|
1378 |
|
1379 | if (_inDOM2.default) {
|
1380 | var _getTransitionPropert = getTransitionProperties();
|
1381 |
|
1382 | prefix = _getTransitionPropert.prefix;
|
1383 | exports.transitionEnd = transitionEnd = _getTransitionPropert.transitionEnd;
|
1384 | exports.animationEnd = animationEnd = _getTransitionPropert.animationEnd;
|
1385 |
|
1386 |
|
1387 | exports.transform = transform = prefix + '-' + transform;
|
1388 | exports.transitionProperty = transitionProperty = prefix + '-transition-property';
|
1389 | exports.transitionDuration = transitionDuration = prefix + '-transition-duration';
|
1390 | exports.transitionDelay = transitionDelay = prefix + '-transition-delay';
|
1391 | exports.transitionTiming = transitionTiming = prefix + '-transition-timing-function';
|
1392 |
|
1393 | exports.animationName = animationName = prefix + '-animation-name';
|
1394 | exports.animationDuration = animationDuration = prefix + '-animation-duration';
|
1395 | exports.animationTiming = animationTiming = prefix + '-animation-delay';
|
1396 | exports.animationDelay = animationDelay = prefix + '-animation-timing-function';
|
1397 | }
|
1398 |
|
1399 | exports.transform = transform;
|
1400 | exports.transitionProperty = transitionProperty;
|
1401 | exports.transitionTiming = transitionTiming;
|
1402 | exports.transitionDelay = transitionDelay;
|
1403 | exports.transitionDuration = transitionDuration;
|
1404 | exports.transitionEnd = transitionEnd;
|
1405 | exports.animationName = animationName;
|
1406 | exports.animationDuration = animationDuration;
|
1407 | exports.animationTiming = animationTiming;
|
1408 | exports.animationDelay = animationDelay;
|
1409 | exports.animationEnd = animationEnd;
|
1410 | exports.default = {
|
1411 | transform: transform,
|
1412 | end: transitionEnd,
|
1413 | property: transitionProperty,
|
1414 | timing: transitionTiming,
|
1415 | delay: transitionDelay,
|
1416 | duration: transitionDuration
|
1417 | };
|
1418 |
|
1419 |
|
1420 | function getTransitionProperties() {
|
1421 | var style = document.createElement('div').style;
|
1422 |
|
1423 | var vendorMap = {
|
1424 | O: function O(e) {
|
1425 | return 'o' + e.toLowerCase();
|
1426 | },
|
1427 | Moz: function Moz(e) {
|
1428 | return e.toLowerCase();
|
1429 | },
|
1430 | Webkit: function Webkit(e) {
|
1431 | return 'webkit' + e;
|
1432 | },
|
1433 | ms: function ms(e) {
|
1434 | return 'MS' + e;
|
1435 | }
|
1436 | };
|
1437 |
|
1438 | var vendors = Object.keys(vendorMap);
|
1439 |
|
1440 | var transitionEnd = void 0,
|
1441 | animationEnd = void 0;
|
1442 | var prefix = '';
|
1443 |
|
1444 | for (var i = 0; i < vendors.length; i++) {
|
1445 | var vendor = vendors[i];
|
1446 |
|
1447 | if (vendor + 'TransitionProperty' in style) {
|
1448 | prefix = '-' + vendor.toLowerCase();
|
1449 | transitionEnd = vendorMap[vendor]('TransitionEnd');
|
1450 | animationEnd = vendorMap[vendor]('AnimationEnd');
|
1451 | break;
|
1452 | }
|
1453 | }
|
1454 |
|
1455 | if (!transitionEnd && 'transitionProperty' in style) transitionEnd = 'transitionend';
|
1456 |
|
1457 | if (!animationEnd && 'animationName' in style) animationEnd = 'animationend';
|
1458 |
|
1459 | style = null;
|
1460 |
|
1461 | return { animationEnd: animationEnd, transitionEnd: transitionEnd, prefix: prefix };
|
1462 | }
|
1463 |
|
1464 | }),
|
1465 |
|
1466 | (function(module, exports) {
|
1467 |
|
1468 | 'use strict';
|
1469 |
|
1470 | Object.defineProperty(exports, "__esModule", {
|
1471 | value: true
|
1472 | });
|
1473 | exports.default = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
1474 | module.exports = exports['default'];
|
1475 |
|
1476 | }),
|
1477 |
|
1478 | (function(module, exports, __webpack_require__) {
|
1479 |
|
1480 | 'use strict';
|
1481 |
|
1482 | Object.defineProperty(exports, "__esModule", {
|
1483 | value: true
|
1484 | });
|
1485 |
|
1486 | var _inDOM = __webpack_require__(14);
|
1487 |
|
1488 | var _inDOM2 = _interopRequireDefault(_inDOM);
|
1489 |
|
1490 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1491 |
|
1492 | var on = function on() {};
|
1493 | if (_inDOM2.default) {
|
1494 | on = function () {
|
1495 |
|
1496 | if (document.addEventListener) return function (node, eventName, handler, capture) {
|
1497 | return node.addEventListener(eventName, handler, capture || false);
|
1498 | };else if (document.attachEvent) return function (node, eventName, handler) {
|
1499 | return node.attachEvent('on' + eventName, function (e) {
|
1500 | e = e || window.event;
|
1501 | e.target = e.target || e.srcElement;
|
1502 | e.currentTarget = node;
|
1503 | handler.call(node, e);
|
1504 | });
|
1505 | };
|
1506 | }();
|
1507 | }
|
1508 |
|
1509 | exports.default = on;
|
1510 | module.exports = exports['default'];
|
1511 |
|
1512 | }),
|
1513 |
|
1514 | (function(module, exports, __webpack_require__) {
|
1515 |
|
1516 | 'use strict';
|
1517 |
|
1518 | Object.defineProperty(exports, "__esModule", {
|
1519 | value: true
|
1520 | });
|
1521 |
|
1522 | 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; };
|
1523 |
|
1524 | var _classnames = __webpack_require__(3);
|
1525 |
|
1526 | var _classnames2 = _interopRequireDefault(_classnames);
|
1527 |
|
1528 | var _style = __webpack_require__(17);
|
1529 |
|
1530 | var _style2 = _interopRequireDefault(_style);
|
1531 |
|
1532 | var _react = __webpack_require__(4);
|
1533 |
|
1534 | var _react2 = _interopRequireDefault(_react);
|
1535 |
|
1536 | var _propTypes = __webpack_require__(5);
|
1537 |
|
1538 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
1539 |
|
1540 | var _Transition = __webpack_require__(11);
|
1541 |
|
1542 | var _Transition2 = _interopRequireDefault(_Transition);
|
1543 |
|
1544 | var _capitalize = __webpack_require__(25);
|
1545 |
|
1546 | var _capitalize2 = _interopRequireDefault(_capitalize);
|
1547 |
|
1548 | var _tinperBeeCore = __webpack_require__(26);
|
1549 |
|
1550 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1551 |
|
1552 | 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; }
|
1553 |
|
1554 | 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; }
|
1555 |
|
1556 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1557 |
|
1558 | 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; }
|
1559 |
|
1560 | 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); }
|
1561 |
|
1562 | var MARGINS = {
|
1563 | height: ['marginTop', 'marginBottom'],
|
1564 | width: ['marginLeft', 'marginRight']
|
1565 | };
|
1566 |
|
1567 |
|
1568 |
|
1569 | function triggerBrowserReflow(node) {
|
1570 | node.offsetHeight;
|
1571 | }
|
1572 |
|
1573 | function getDimensionValue(dimension, elem) {
|
1574 | var value = elem['offset' + (0, _capitalize2["default"])(dimension)];
|
1575 | var margins = MARGINS[dimension];
|
1576 |
|
1577 | return value + parseInt((0, _style2["default"])(elem, margins[0]), 10) + parseInt((0, _style2["default"])(elem, margins[1]), 10);
|
1578 | }
|
1579 |
|
1580 | var propTypes = {
|
1581 | |
1582 |
|
1583 |
|
1584 | "in": _propTypes2["default"].bool,
|
1585 |
|
1586 | |
1587 |
|
1588 |
|
1589 | unmountOnExit: _propTypes2["default"].bool,
|
1590 |
|
1591 | |
1592 |
|
1593 |
|
1594 |
|
1595 | transitionAppear: _propTypes2["default"].bool,
|
1596 |
|
1597 | |
1598 |
|
1599 |
|
1600 |
|
1601 |
|
1602 | timeout: _propTypes2["default"].number,
|
1603 |
|
1604 | |
1605 |
|
1606 |
|
1607 | onEnter: _propTypes2["default"].func,
|
1608 | |
1609 |
|
1610 |
|
1611 | onEntering: _propTypes2["default"].func,
|
1612 | |
1613 |
|
1614 |
|
1615 | onEntered: _propTypes2["default"].func,
|
1616 | |
1617 |
|
1618 |
|
1619 | onExit: _propTypes2["default"].func,
|
1620 | |
1621 |
|
1622 |
|
1623 | onExiting: _propTypes2["default"].func,
|
1624 | |
1625 |
|
1626 |
|
1627 | onExited: _propTypes2["default"].func,
|
1628 |
|
1629 | |
1630 |
|
1631 |
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 | dimension: _propTypes2["default"].oneOfType([_propTypes2["default"].oneOf(['height', 'width']), _propTypes2["default"].func]),
|
1637 |
|
1638 | |
1639 |
|
1640 |
|
1641 |
|
1642 |
|
1643 |
|
1644 |
|
1645 | getDimensionValue: _propTypes2["default"].func,
|
1646 |
|
1647 | |
1648 |
|
1649 |
|
1650 | role: _propTypes2["default"].string
|
1651 | };
|
1652 |
|
1653 | var defaultProps = {
|
1654 | "in": false,
|
1655 | timeout: 300,
|
1656 | unmountOnExit: false,
|
1657 | transitionAppear: false,
|
1658 |
|
1659 | dimension: 'height',
|
1660 | getDimensionValue: getDimensionValue
|
1661 | };
|
1662 |
|
1663 | var Collapse = function (_React$Component) {
|
1664 | _inherits(Collapse, _React$Component);
|
1665 |
|
1666 | function Collapse(props, context) {
|
1667 | _classCallCheck(this, Collapse);
|
1668 |
|
1669 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
1670 |
|
1671 | _this.handleEnter = _this.handleEnter.bind(_this);
|
1672 | _this.handleEntering = _this.handleEntering.bind(_this);
|
1673 | _this.handleEntered = _this.handleEntered.bind(_this);
|
1674 | _this.handleExit = _this.handleExit.bind(_this);
|
1675 | _this.handleExiting = _this.handleExiting.bind(_this);
|
1676 | return _this;
|
1677 | }
|
1678 |
|
1679 |
|
1680 |
|
1681 |
|
1682 | Collapse.prototype.handleEnter = function handleEnter(elem) {
|
1683 | var dimension = this._dimension();
|
1684 | elem.style[dimension] = '0';
|
1685 | };
|
1686 |
|
1687 | Collapse.prototype.handleEntering = function handleEntering(elem) {
|
1688 | var dimension = this._dimension();
|
1689 | elem.style[dimension] = this._getScrollDimensionValue(elem, dimension);
|
1690 | };
|
1691 |
|
1692 | Collapse.prototype.handleEntered = function handleEntered(elem) {
|
1693 | var dimension = this._dimension();
|
1694 | elem.style[dimension] = null;
|
1695 | };
|
1696 |
|
1697 |
|
1698 |
|
1699 |
|
1700 | Collapse.prototype.handleExit = function handleExit(elem) {
|
1701 | var dimension = this._dimension();
|
1702 | elem.style[dimension] = this.props.getDimensionValue(dimension, elem) + 'px';
|
1703 | triggerBrowserReflow(elem);
|
1704 | };
|
1705 |
|
1706 | Collapse.prototype.handleExiting = function handleExiting(elem) {
|
1707 | var dimension = this._dimension();
|
1708 | elem.style[dimension] = '0';
|
1709 | };
|
1710 |
|
1711 | Collapse.prototype._dimension = function _dimension() {
|
1712 | return typeof this.props.dimension === 'function' ? this.props.dimension() : this.props.dimension;
|
1713 | };
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 | Collapse.prototype._getScrollDimensionValue = function _getScrollDimensionValue(elem, dimension) {
|
1719 | return elem['scroll' + (0, _capitalize2["default"])(dimension)] + 'px';
|
1720 | };
|
1721 |
|
1722 | Collapse.prototype.render = function render() {
|
1723 | var _props = this.props,
|
1724 | onEnter = _props.onEnter,
|
1725 | onEntering = _props.onEntering,
|
1726 | onEntered = _props.onEntered,
|
1727 | onExit = _props.onExit,
|
1728 | onExiting = _props.onExiting,
|
1729 | className = _props.className,
|
1730 | props = _objectWithoutProperties(_props, ['onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'className']);
|
1731 |
|
1732 | delete props.dimension;
|
1733 | delete props.getDimensionValue;
|
1734 |
|
1735 | var handleEnter = (0, _tinperBeeCore.createChainedFunction)(this.handleEnter, onEnter);
|
1736 | var handleEntering = (0, _tinperBeeCore.createChainedFunction)(this.handleEntering, onEntering);
|
1737 | var handleEntered = (0, _tinperBeeCore.createChainedFunction)(this.handleEntered, onEntered);
|
1738 | var handleExit = (0, _tinperBeeCore.createChainedFunction)(this.handleExit, onExit);
|
1739 | var handleExiting = (0, _tinperBeeCore.createChainedFunction)(this.handleExiting, onExiting);
|
1740 |
|
1741 | var classes = {
|
1742 | width: this._dimension() === 'width'
|
1743 | };
|
1744 |
|
1745 | return _react2["default"].createElement(_Transition2["default"], _extends({}, props, {
|
1746 | 'aria-expanded': props.role ? props["in"] : null,
|
1747 | className: (0, _classnames2["default"])(className, classes),
|
1748 | exitedClassName: 'collapse',
|
1749 | exitingClassName: 'collapsing',
|
1750 | enteredClassName: 'collapse in',
|
1751 | enteringClassName: 'collapsing',
|
1752 | onEnter: handleEnter,
|
1753 | onEntering: handleEntering,
|
1754 | onEntered: handleEntered,
|
1755 | onExit: handleExit,
|
1756 | onExiting: handleExiting
|
1757 | }));
|
1758 | };
|
1759 |
|
1760 | return Collapse;
|
1761 | }(_react2["default"].Component);
|
1762 |
|
1763 | Collapse.propTypes = propTypes;
|
1764 | Collapse.defaultProps = defaultProps;
|
1765 |
|
1766 | exports["default"] = Collapse;
|
1767 | module.exports = exports['default'];
|
1768 |
|
1769 | }),
|
1770 |
|
1771 | (function(module, exports, __webpack_require__) {
|
1772 |
|
1773 | 'use strict';
|
1774 |
|
1775 | Object.defineProperty(exports, "__esModule", {
|
1776 | value: true
|
1777 | });
|
1778 | exports.default = style;
|
1779 |
|
1780 | var _camelizeStyle = __webpack_require__(18);
|
1781 |
|
1782 | var _camelizeStyle2 = _interopRequireDefault(_camelizeStyle);
|
1783 |
|
1784 | var _hyphenateStyle = __webpack_require__(20);
|
1785 |
|
1786 | var _hyphenateStyle2 = _interopRequireDefault(_hyphenateStyle);
|
1787 |
|
1788 | var _getComputedStyle2 = __webpack_require__(22);
|
1789 |
|
1790 | var _getComputedStyle3 = _interopRequireDefault(_getComputedStyle2);
|
1791 |
|
1792 | var _removeStyle = __webpack_require__(23);
|
1793 |
|
1794 | var _removeStyle2 = _interopRequireDefault(_removeStyle);
|
1795 |
|
1796 | var _properties = __webpack_require__(13);
|
1797 |
|
1798 | var _isTransform = __webpack_require__(24);
|
1799 |
|
1800 | var _isTransform2 = _interopRequireDefault(_isTransform);
|
1801 |
|
1802 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1803 |
|
1804 | function style(node, property, value) {
|
1805 | var css = '';
|
1806 | var transforms = '';
|
1807 | var props = property;
|
1808 |
|
1809 | if (typeof property === 'string') {
|
1810 | if (value === undefined) {
|
1811 | return node.style[(0, _camelizeStyle2.default)(property)] || (0, _getComputedStyle3.default)(node).getPropertyValue((0, _hyphenateStyle2.default)(property));
|
1812 | } else {
|
1813 | (props = {})[property] = value;
|
1814 | }
|
1815 | }
|
1816 |
|
1817 | Object.keys(props).forEach(function (key) {
|
1818 | var value = props[key];
|
1819 | if (!value && value !== 0) {
|
1820 | (0, _removeStyle2.default)(node, (0, _hyphenateStyle2.default)(key));
|
1821 | } else if ((0, _isTransform2.default)(key)) {
|
1822 | transforms += key + '(' + value + ') ';
|
1823 | } else {
|
1824 | css += (0, _hyphenateStyle2.default)(key) + ': ' + value + ';';
|
1825 | }
|
1826 | });
|
1827 |
|
1828 | if (transforms) {
|
1829 | css += _properties.transform + ': ' + transforms + ';';
|
1830 | }
|
1831 |
|
1832 | node.style.cssText += ';' + css;
|
1833 | }
|
1834 | module.exports = exports['default'];
|
1835 |
|
1836 | }),
|
1837 |
|
1838 | (function(module, exports, __webpack_require__) {
|
1839 |
|
1840 | 'use strict';
|
1841 |
|
1842 | Object.defineProperty(exports, "__esModule", {
|
1843 | value: true
|
1844 | });
|
1845 | exports.default = camelizeStyleName;
|
1846 |
|
1847 | var _camelize = __webpack_require__(19);
|
1848 |
|
1849 | var _camelize2 = _interopRequireDefault(_camelize);
|
1850 |
|
1851 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1852 |
|
1853 | var msPattern = /^-ms-/; |
1854 |
|
1855 |
|
1856 |
|
1857 |
|
1858 | function camelizeStyleName(string) {
|
1859 | return (0, _camelize2.default)(string.replace(msPattern, 'ms-'));
|
1860 | }
|
1861 | module.exports = exports['default'];
|
1862 |
|
1863 | }),
|
1864 |
|
1865 | (function(module, exports) {
|
1866 |
|
1867 | "use strict";
|
1868 |
|
1869 | Object.defineProperty(exports, "__esModule", {
|
1870 | value: true
|
1871 | });
|
1872 | exports.default = camelize;
|
1873 | var rHyphen = /-(.)/g;
|
1874 |
|
1875 | function camelize(string) {
|
1876 | return string.replace(rHyphen, function (_, chr) {
|
1877 | return chr.toUpperCase();
|
1878 | });
|
1879 | }
|
1880 | module.exports = exports["default"];
|
1881 |
|
1882 | }),
|
1883 |
|
1884 | (function(module, exports, __webpack_require__) {
|
1885 |
|
1886 | 'use strict';
|
1887 |
|
1888 | Object.defineProperty(exports, "__esModule", {
|
1889 | value: true
|
1890 | });
|
1891 | exports.default = hyphenateStyleName;
|
1892 |
|
1893 | var _hyphenate = __webpack_require__(21);
|
1894 |
|
1895 | var _hyphenate2 = _interopRequireDefault(_hyphenate);
|
1896 |
|
1897 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1898 |
|
1899 | var msPattern = /^ms-/; |
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 | function hyphenateStyleName(string) {
|
1906 | return (0, _hyphenate2.default)(string).replace(msPattern, '-ms-');
|
1907 | }
|
1908 | module.exports = exports['default'];
|
1909 |
|
1910 | }),
|
1911 |
|
1912 | (function(module, exports) {
|
1913 |
|
1914 | 'use strict';
|
1915 |
|
1916 | Object.defineProperty(exports, "__esModule", {
|
1917 | value: true
|
1918 | });
|
1919 | exports.default = hyphenate;
|
1920 |
|
1921 | var rUpper = /([A-Z])/g;
|
1922 |
|
1923 | function hyphenate(string) {
|
1924 | return string.replace(rUpper, '-$1').toLowerCase();
|
1925 | }
|
1926 | module.exports = exports['default'];
|
1927 |
|
1928 | }),
|
1929 |
|
1930 | (function(module, exports, __webpack_require__) {
|
1931 |
|
1932 | 'use strict';
|
1933 |
|
1934 | Object.defineProperty(exports, "__esModule", {
|
1935 | value: true
|
1936 | });
|
1937 | exports.default = _getComputedStyle;
|
1938 |
|
1939 | var _camelizeStyle = __webpack_require__(18);
|
1940 |
|
1941 | var _camelizeStyle2 = _interopRequireDefault(_camelizeStyle);
|
1942 |
|
1943 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1944 |
|
1945 | var rposition = /^(top|right|bottom|left)$/;
|
1946 | var rnumnonpx = /^([+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/i;
|
1947 |
|
1948 | function _getComputedStyle(node) {
|
1949 | if (!node) throw new TypeError('No Element passed to `getComputedStyle()`');
|
1950 | var doc = node.ownerDocument;
|
1951 |
|
1952 | return 'defaultView' in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : {
|
1953 |
|
1954 | getPropertyValue: function getPropertyValue(prop) {
|
1955 | var style = node.style;
|
1956 |
|
1957 | prop = (0, _camelizeStyle2.default)(prop);
|
1958 |
|
1959 | if (prop == 'float') prop = 'styleFloat';
|
1960 |
|
1961 | var current = node.currentStyle[prop] || null;
|
1962 |
|
1963 | if (current == null && style && style[prop]) current = style[prop];
|
1964 |
|
1965 | if (rnumnonpx.test(current) && !rposition.test(prop)) {
|
1966 |
|
1967 | var left = style.left;
|
1968 | var runStyle = node.runtimeStyle;
|
1969 | var rsLeft = runStyle && runStyle.left;
|
1970 |
|
1971 |
|
1972 | if (rsLeft) runStyle.left = node.currentStyle.left;
|
1973 |
|
1974 | style.left = prop === 'fontSize' ? '1em' : current;
|
1975 | current = style.pixelLeft + 'px';
|
1976 |
|
1977 |
|
1978 | style.left = left;
|
1979 | if (rsLeft) runStyle.left = rsLeft;
|
1980 | }
|
1981 |
|
1982 | return current;
|
1983 | }
|
1984 | };
|
1985 | }
|
1986 | module.exports = exports['default'];
|
1987 |
|
1988 | }),
|
1989 |
|
1990 | (function(module, exports) {
|
1991 |
|
1992 | 'use strict';
|
1993 |
|
1994 | Object.defineProperty(exports, "__esModule", {
|
1995 | value: true
|
1996 | });
|
1997 | exports.default = removeStyle;
|
1998 | function removeStyle(node, key) {
|
1999 | return 'removeProperty' in node.style ? node.style.removeProperty(key) : node.style.removeAttribute(key);
|
2000 | }
|
2001 | module.exports = exports['default'];
|
2002 |
|
2003 | }),
|
2004 |
|
2005 | (function(module, exports) {
|
2006 |
|
2007 | "use strict";
|
2008 |
|
2009 | Object.defineProperty(exports, "__esModule", {
|
2010 | value: true
|
2011 | });
|
2012 | exports.default = isTransform;
|
2013 | var supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;
|
2014 |
|
2015 | function isTransform(property) {
|
2016 | return !!(property && supportedTransforms.test(property));
|
2017 | }
|
2018 | module.exports = exports["default"];
|
2019 |
|
2020 | }),
|
2021 |
|
2022 | (function(module, exports) {
|
2023 |
|
2024 | "use strict";
|
2025 |
|
2026 | Object.defineProperty(exports, "__esModule", {
|
2027 | value: true
|
2028 | });
|
2029 | exports["default"] = capitalize;
|
2030 | function capitalize(string) {
|
2031 | return "" + string.charAt(0).toUpperCase() + string.slice(1);
|
2032 | }
|
2033 | module.exports = exports["default"];
|
2034 |
|
2035 | }),
|
2036 |
|
2037 | (function(module, exports, __webpack_require__) {
|
2038 |
|
2039 | 'use strict';
|
2040 |
|
2041 | exports.__esModule = true;
|
2042 | 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;
|
2043 |
|
2044 | var _all2 = __webpack_require__(27);
|
2045 |
|
2046 | var _all3 = _interopRequireDefault(_all2);
|
2047 |
|
2048 | var _componentOrElement2 = __webpack_require__(29);
|
2049 |
|
2050 | var _componentOrElement3 = _interopRequireDefault(_componentOrElement2);
|
2051 |
|
2052 | var _deprecated2 = __webpack_require__(30);
|
2053 |
|
2054 | var _deprecated3 = _interopRequireDefault(_deprecated2);
|
2055 |
|
2056 | var _elementType2 = __webpack_require__(33);
|
2057 |
|
2058 | var _elementType3 = _interopRequireDefault(_elementType2);
|
2059 |
|
2060 | var _isRequiredForA11y2 = __webpack_require__(34);
|
2061 |
|
2062 | var _isRequiredForA11y3 = _interopRequireDefault(_isRequiredForA11y2);
|
2063 |
|
2064 | var _splitComponent2 = __webpack_require__(35);
|
2065 |
|
2066 | var _splitComponent3 = _interopRequireDefault(_splitComponent2);
|
2067 |
|
2068 | var _createChainedFunction2 = __webpack_require__(36);
|
2069 |
|
2070 | var _createChainedFunction3 = _interopRequireDefault(_createChainedFunction2);
|
2071 |
|
2072 | var _keyCode = __webpack_require__(37);
|
2073 |
|
2074 | var _keyCode2 = _interopRequireDefault(_keyCode);
|
2075 |
|
2076 | var _contains2 = __webpack_require__(38);
|
2077 |
|
2078 | var _contains3 = _interopRequireDefault(_contains2);
|
2079 |
|
2080 | var _addEventListener2 = __webpack_require__(39);
|
2081 |
|
2082 | var _addEventListener3 = _interopRequireDefault(_addEventListener2);
|
2083 |
|
2084 | var _cssAnimation2 = __webpack_require__(44);
|
2085 |
|
2086 | var _cssAnimation3 = _interopRequireDefault(_cssAnimation2);
|
2087 |
|
2088 | var _toArray2 = __webpack_require__(48);
|
2089 |
|
2090 | var _toArray3 = _interopRequireDefault(_toArray2);
|
2091 |
|
2092 | var _Align2 = __webpack_require__(49);
|
2093 |
|
2094 | var _Align3 = _interopRequireDefault(_Align2);
|
2095 |
|
2096 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2097 |
|
2098 | exports.all = _all3.default;
|
2099 | exports.componentOrElement = _componentOrElement3.default;
|
2100 | exports.deprecated = _deprecated3.default;
|
2101 | exports.elementType = _elementType3.default;
|
2102 | exports.isRequiredForA11y = _isRequiredForA11y3.default;
|
2103 | exports.splitComponent = _splitComponent3.default;
|
2104 | exports.createChainedFunction = _createChainedFunction3.default;
|
2105 | exports.KeyCode = _keyCode2.default;
|
2106 | exports.contains = _contains3.default;
|
2107 | exports.addEventListener = _addEventListener3.default;
|
2108 | exports.cssAnimation = _cssAnimation3.default;
|
2109 | exports.toArray = _toArray3.default;
|
2110 |
|
2111 |
|
2112 | exports.Align = _Align3.default;
|
2113 |
|
2114 | }),
|
2115 |
|
2116 | (function(module, exports, __webpack_require__) {
|
2117 |
|
2118 | 'use strict';
|
2119 |
|
2120 | exports.__esModule = true;
|
2121 | exports.default = all;
|
2122 |
|
2123 | var _createChainableTypeChecker = __webpack_require__(28);
|
2124 |
|
2125 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2126 |
|
2127 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2128 |
|
2129 | function all() {
|
2130 | for (var _len = arguments.length, validators = Array(_len), _key = 0; _key < _len; _key++) {
|
2131 | validators[_key] = arguments[_key];
|
2132 | }
|
2133 |
|
2134 | function allPropTypes() {
|
2135 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2136 | args[_key2] = arguments[_key2];
|
2137 | }
|
2138 |
|
2139 | var error = null;
|
2140 |
|
2141 | validators.forEach(function (validator) {
|
2142 | if (error != null) {
|
2143 | return;
|
2144 | }
|
2145 |
|
2146 | var result = validator.apply(undefined, args);
|
2147 | if (result != null) {
|
2148 | error = result;
|
2149 | }
|
2150 | });
|
2151 |
|
2152 | return error;
|
2153 | }
|
2154 |
|
2155 | return (0, _createChainableTypeChecker2.default)(allPropTypes);
|
2156 | }
|
2157 |
|
2158 | }),
|
2159 |
|
2160 | (function(module, exports) {
|
2161 |
|
2162 | 'use strict';
|
2163 |
|
2164 | exports.__esModule = true;
|
2165 | exports.default = createChainableTypeChecker;
|
2166 | |
2167 |
|
2168 |
|
2169 |
|
2170 |
|
2171 |
|
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 | function createChainableTypeChecker(validate) {
|
2178 | function checkType(isRequired, props, propName, componentName, location, propFullName) {
|
2179 | var componentNameSafe = componentName || '<<anonymous>>';
|
2180 | var propFullNameSafe = propFullName || propName;
|
2181 |
|
2182 | if (props[propName] == null) {
|
2183 | if (isRequired) {
|
2184 | return new Error('Required ' + location + ' `' + propFullNameSafe + '` was not specified ' + ('in `' + componentNameSafe + '`.'));
|
2185 | }
|
2186 |
|
2187 | return null;
|
2188 | }
|
2189 |
|
2190 | for (var _len = arguments.length, args = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) {
|
2191 | args[_key - 6] = arguments[_key];
|
2192 | }
|
2193 |
|
2194 | return validate.apply(undefined, [props, propName, componentNameSafe, location, propFullNameSafe].concat(args));
|
2195 | }
|
2196 |
|
2197 | var chainedCheckType = checkType.bind(null, false);
|
2198 | chainedCheckType.isRequired = checkType.bind(null, true);
|
2199 |
|
2200 | return chainedCheckType;
|
2201 | }
|
2202 |
|
2203 | }),
|
2204 |
|
2205 | (function(module, exports, __webpack_require__) {
|
2206 |
|
2207 | 'use strict';
|
2208 |
|
2209 | exports.__esModule = true;
|
2210 |
|
2211 | 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; };
|
2212 |
|
2213 | var _react = __webpack_require__(4);
|
2214 |
|
2215 | var _react2 = _interopRequireDefault(_react);
|
2216 |
|
2217 | var _createChainableTypeChecker = __webpack_require__(28);
|
2218 |
|
2219 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2220 |
|
2221 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2222 |
|
2223 | function validate(props, propName, componentName, location, propFullName) {
|
2224 | var propValue = props[propName];
|
2225 | var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
|
2226 |
|
2227 | if (_react2.default.isValidElement(propValue)) {
|
2228 | 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.');
|
2229 | }
|
2230 |
|
2231 | if ((propType !== 'object' || typeof propValue.render !== 'function') && propValue.nodeType !== 1) {
|
2232 | return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected a ReactComponent or a ') + 'DOMElement.');
|
2233 | }
|
2234 |
|
2235 | return null;
|
2236 | }
|
2237 |
|
2238 | exports.default = (0, _createChainableTypeChecker2.default)(validate);
|
2239 |
|
2240 | }),
|
2241 |
|
2242 | (function(module, exports, __webpack_require__) {
|
2243 |
|
2244 | 'use strict';
|
2245 |
|
2246 | exports.__esModule = true;
|
2247 | exports.default = deprecated;
|
2248 |
|
2249 | var _warning = __webpack_require__(31);
|
2250 |
|
2251 | var _warning2 = _interopRequireDefault(_warning);
|
2252 |
|
2253 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2254 |
|
2255 | var warned = {};
|
2256 |
|
2257 | function deprecated(validator, reason) {
|
2258 | return function validate(props, propName, componentName, location, propFullName) {
|
2259 | var componentNameSafe = componentName || '<<anonymous>>';
|
2260 | var propFullNameSafe = propFullName || propName;
|
2261 |
|
2262 | if (props[propName] != null) {
|
2263 | var messageKey = componentName + '.' + propName;
|
2264 |
|
2265 | (0, _warning2.default)(warned[messageKey], 'The ' + location + ' `' + propFullNameSafe + '` of ' + ('`' + componentNameSafe + '` is deprecated. ' + reason + '.'));
|
2266 |
|
2267 | warned[messageKey] = true;
|
2268 | }
|
2269 |
|
2270 | for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
2271 | args[_key - 5] = arguments[_key];
|
2272 | }
|
2273 |
|
2274 | return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
|
2275 | };
|
2276 | }
|
2277 |
|
2278 |
|
2279 | function _resetWarned() {
|
2280 | warned = {};
|
2281 | }
|
2282 |
|
2283 | deprecated._resetWarned = _resetWarned;
|
2284 |
|
2285 |
|
2286 | }),
|
2287 |
|
2288 | (function(module, exports, __webpack_require__) {
|
2289 |
|
2290 | (function(process) { |
2291 |
|
2292 |
|
2293 |
|
2294 |
|
2295 |
|
2296 |
|
2297 |
|
2298 |
|
2299 | 'use strict';
|
2300 |
|
2301 | |
2302 |
|
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 |
|
2308 | var warning = function() {};
|
2309 |
|
2310 | if (process.env.NODE_ENV !== 'production') {
|
2311 | warning = function(condition, format, args) {
|
2312 | var len = arguments.length;
|
2313 | args = new Array(len > 2 ? len - 2 : 0);
|
2314 | for (var key = 2; key < len; key++) {
|
2315 | args[key - 2] = arguments[key];
|
2316 | }
|
2317 | if (format === undefined) {
|
2318 | throw new Error(
|
2319 | '`warning(condition, format, ...args)` requires a warning ' +
|
2320 | 'message argument'
|
2321 | );
|
2322 | }
|
2323 |
|
2324 | if (format.length < 10 || (/^[s\W]*$/).test(format)) {
|
2325 | throw new Error(
|
2326 | 'The warning format should be able to uniquely identify this ' +
|
2327 | 'warning. Please, use a more descriptive format than: ' + format
|
2328 | );
|
2329 | }
|
2330 |
|
2331 | if (!condition) {
|
2332 | var argIndex = 0;
|
2333 | var message = 'Warning: ' +
|
2334 | format.replace(/%s/g, function() {
|
2335 | return args[argIndex++];
|
2336 | });
|
2337 | if (typeof console !== 'undefined') {
|
2338 | console.error(message);
|
2339 | }
|
2340 | try {
|
2341 |
|
2342 |
|
2343 | throw new Error(message);
|
2344 | } catch(x) {}
|
2345 | }
|
2346 | };
|
2347 | }
|
2348 |
|
2349 | module.exports = warning;
|
2350 |
|
2351 | }.call(exports, __webpack_require__(32)))
|
2352 |
|
2353 | }),
|
2354 |
|
2355 | (function(module, exports) {
|
2356 |
|
2357 |
|
2358 | var process = module.exports = {};
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 |
|
2365 | var cachedSetTimeout;
|
2366 | var cachedClearTimeout;
|
2367 |
|
2368 | function defaultSetTimout() {
|
2369 | throw new Error('setTimeout has not been defined');
|
2370 | }
|
2371 | function defaultClearTimeout () {
|
2372 | throw new Error('clearTimeout has not been defined');
|
2373 | }
|
2374 | (function () {
|
2375 | try {
|
2376 | if (typeof setTimeout === 'function') {
|
2377 | cachedSetTimeout = setTimeout;
|
2378 | } else {
|
2379 | cachedSetTimeout = defaultSetTimout;
|
2380 | }
|
2381 | } catch (e) {
|
2382 | cachedSetTimeout = defaultSetTimout;
|
2383 | }
|
2384 | try {
|
2385 | if (typeof clearTimeout === 'function') {
|
2386 | cachedClearTimeout = clearTimeout;
|
2387 | } else {
|
2388 | cachedClearTimeout = defaultClearTimeout;
|
2389 | }
|
2390 | } catch (e) {
|
2391 | cachedClearTimeout = defaultClearTimeout;
|
2392 | }
|
2393 | } ())
|
2394 | function runTimeout(fun) {
|
2395 | if (cachedSetTimeout === setTimeout) {
|
2396 |
|
2397 | return setTimeout(fun, 0);
|
2398 | }
|
2399 |
|
2400 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
2401 | cachedSetTimeout = setTimeout;
|
2402 | return setTimeout(fun, 0);
|
2403 | }
|
2404 | try {
|
2405 |
|
2406 | return cachedSetTimeout(fun, 0);
|
2407 | } catch(e){
|
2408 | try {
|
2409 |
|
2410 | return cachedSetTimeout.call(null, fun, 0);
|
2411 | } catch(e){
|
2412 |
|
2413 | return cachedSetTimeout.call(this, fun, 0);
|
2414 | }
|
2415 | }
|
2416 |
|
2417 |
|
2418 | }
|
2419 | function runClearTimeout(marker) {
|
2420 | if (cachedClearTimeout === clearTimeout) {
|
2421 |
|
2422 | return clearTimeout(marker);
|
2423 | }
|
2424 |
|
2425 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
2426 | cachedClearTimeout = clearTimeout;
|
2427 | return clearTimeout(marker);
|
2428 | }
|
2429 | try {
|
2430 |
|
2431 | return cachedClearTimeout(marker);
|
2432 | } catch (e){
|
2433 | try {
|
2434 |
|
2435 | return cachedClearTimeout.call(null, marker);
|
2436 | } catch (e){
|
2437 |
|
2438 |
|
2439 | return cachedClearTimeout.call(this, marker);
|
2440 | }
|
2441 | }
|
2442 |
|
2443 |
|
2444 |
|
2445 | }
|
2446 | var queue = [];
|
2447 | var draining = false;
|
2448 | var currentQueue;
|
2449 | var queueIndex = -1;
|
2450 |
|
2451 | function cleanUpNextTick() {
|
2452 | if (!draining || !currentQueue) {
|
2453 | return;
|
2454 | }
|
2455 | draining = false;
|
2456 | if (currentQueue.length) {
|
2457 | queue = currentQueue.concat(queue);
|
2458 | } else {
|
2459 | queueIndex = -1;
|
2460 | }
|
2461 | if (queue.length) {
|
2462 | drainQueue();
|
2463 | }
|
2464 | }
|
2465 |
|
2466 | function drainQueue() {
|
2467 | if (draining) {
|
2468 | return;
|
2469 | }
|
2470 | var timeout = runTimeout(cleanUpNextTick);
|
2471 | draining = true;
|
2472 |
|
2473 | var len = queue.length;
|
2474 | while(len) {
|
2475 | currentQueue = queue;
|
2476 | queue = [];
|
2477 | while (++queueIndex < len) {
|
2478 | if (currentQueue) {
|
2479 | currentQueue[queueIndex].run();
|
2480 | }
|
2481 | }
|
2482 | queueIndex = -1;
|
2483 | len = queue.length;
|
2484 | }
|
2485 | currentQueue = null;
|
2486 | draining = false;
|
2487 | runClearTimeout(timeout);
|
2488 | }
|
2489 |
|
2490 | process.nextTick = function (fun) {
|
2491 | var args = new Array(arguments.length - 1);
|
2492 | if (arguments.length > 1) {
|
2493 | for (var i = 1; i < arguments.length; i++) {
|
2494 | args[i - 1] = arguments[i];
|
2495 | }
|
2496 | }
|
2497 | queue.push(new Item(fun, args));
|
2498 | if (queue.length === 1 && !draining) {
|
2499 | runTimeout(drainQueue);
|
2500 | }
|
2501 | };
|
2502 |
|
2503 |
|
2504 | function Item(fun, array) {
|
2505 | this.fun = fun;
|
2506 | this.array = array;
|
2507 | }
|
2508 | Item.prototype.run = function () {
|
2509 | this.fun.apply(null, this.array);
|
2510 | };
|
2511 | process.title = 'browser';
|
2512 | process.browser = true;
|
2513 | process.env = {};
|
2514 | process.argv = [];
|
2515 | process.version = '';
|
2516 | process.versions = {};
|
2517 |
|
2518 | function noop() {}
|
2519 |
|
2520 | process.on = noop;
|
2521 | process.addListener = noop;
|
2522 | process.once = noop;
|
2523 | process.off = noop;
|
2524 | process.removeListener = noop;
|
2525 | process.removeAllListeners = noop;
|
2526 | process.emit = noop;
|
2527 | process.prependListener = noop;
|
2528 | process.prependOnceListener = noop;
|
2529 |
|
2530 | process.listeners = function (name) { return [] }
|
2531 |
|
2532 | process.binding = function (name) {
|
2533 | throw new Error('process.binding is not supported');
|
2534 | };
|
2535 |
|
2536 | process.cwd = function () { return '/' };
|
2537 | process.chdir = function (dir) {
|
2538 | throw new Error('process.chdir is not supported');
|
2539 | };
|
2540 | process.umask = function() { return 0; };
|
2541 |
|
2542 |
|
2543 | }),
|
2544 |
|
2545 | (function(module, exports, __webpack_require__) {
|
2546 |
|
2547 | 'use strict';
|
2548 |
|
2549 | exports.__esModule = true;
|
2550 |
|
2551 | 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; };
|
2552 |
|
2553 | var _react = __webpack_require__(4);
|
2554 |
|
2555 | var _react2 = _interopRequireDefault(_react);
|
2556 |
|
2557 | var _createChainableTypeChecker = __webpack_require__(28);
|
2558 |
|
2559 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2560 |
|
2561 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2562 |
|
2563 | function elementType(props, propName, componentName, location, propFullName) {
|
2564 | var propValue = props[propName];
|
2565 | var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
|
2566 |
|
2567 | if (_react2.default.isValidElement(propValue)) {
|
2568 | return new Error('Invalid ' + location + ' `' + propFullName + '` of type ReactElement ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
|
2569 | }
|
2570 |
|
2571 | if (propType !== 'function' && propType !== 'string') {
|
2572 | return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
|
2573 | }
|
2574 |
|
2575 | return null;
|
2576 | }
|
2577 |
|
2578 | exports.default = (0, _createChainableTypeChecker2.default)(elementType);
|
2579 |
|
2580 | }),
|
2581 |
|
2582 | (function(module, exports) {
|
2583 |
|
2584 | 'use strict';
|
2585 |
|
2586 | exports.__esModule = true;
|
2587 | exports.default = isRequiredForA11y;
|
2588 | function isRequiredForA11y(validator) {
|
2589 | return function validate(props, propName, componentName, location, propFullName) {
|
2590 | var componentNameSafe = componentName || '<<anonymous>>';
|
2591 | var propFullNameSafe = propFullName || propName;
|
2592 |
|
2593 | if (props[propName] == null) {
|
2594 | return new Error('The ' + location + ' `' + propFullNameSafe + '` is required to make ' + ('`' + componentNameSafe + '` accessible for users of assistive ') + 'technologies such as screen readers.');
|
2595 | }
|
2596 |
|
2597 | for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
2598 | args[_key - 5] = arguments[_key];
|
2599 | }
|
2600 |
|
2601 | return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
|
2602 | };
|
2603 | }
|
2604 |
|
2605 | }),
|
2606 |
|
2607 | (function(module, exports) {
|
2608 |
|
2609 | "use strict";
|
2610 |
|
2611 | exports.__esModule = true;
|
2612 | exports.default = splitComponentProps;
|
2613 | function _objectEntries(obj) {
|
2614 | var entries = [];
|
2615 | var keys = Object.keys(obj);
|
2616 |
|
2617 | for (var k = 0; k < keys.length; ++k) {
|
2618 | entries.push([keys[k], obj[keys[k]]]);
|
2619 | }return entries;
|
2620 | }
|
2621 |
|
2622 | |
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 |
|
2628 | function splitComponentProps(props, Component) {
|
2629 | var componentPropTypes = Component.propTypes;
|
2630 |
|
2631 | var parentProps = {};
|
2632 | var childProps = {};
|
2633 |
|
2634 | _objectEntries(props).forEach(function (_ref) {
|
2635 | var propName = _ref[0],
|
2636 | propValue = _ref[1];
|
2637 |
|
2638 | if (componentPropTypes[propName]) {
|
2639 | parentProps[propName] = propValue;
|
2640 | } else {
|
2641 | childProps[propName] = propValue;
|
2642 | }
|
2643 | });
|
2644 |
|
2645 | return [parentProps, childProps];
|
2646 | }
|
2647 |
|
2648 | }),
|
2649 |
|
2650 | (function(module, exports) {
|
2651 |
|
2652 | 'use strict';
|
2653 |
|
2654 | exports.__esModule = true;
|
2655 | function createChainedFunction() {
|
2656 | for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
|
2657 | funcs[_key] = arguments[_key];
|
2658 | }
|
2659 |
|
2660 | return funcs.filter(function (f) {
|
2661 | return f != null;
|
2662 | }).reduce(function (acc, f) {
|
2663 | if (typeof f !== 'function') {
|
2664 | throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
|
2665 | }
|
2666 |
|
2667 | if (acc === null) {
|
2668 | return f;
|
2669 | }
|
2670 |
|
2671 | return function chainedFunction() {
|
2672 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2673 | args[_key2] = arguments[_key2];
|
2674 | }
|
2675 |
|
2676 | acc.apply(this, args);
|
2677 | f.apply(this, args);
|
2678 | };
|
2679 | }, null);
|
2680 | }
|
2681 | exports.default = createChainedFunction;
|
2682 |
|
2683 | }),
|
2684 |
|
2685 | (function(module, exports) {
|
2686 |
|
2687 | 'use strict';
|
2688 |
|
2689 | |
2690 |
|
2691 |
|
2692 |
|
2693 |
|
2694 |
|
2695 | var KeyCode = {
|
2696 | |
2697 |
|
2698 |
|
2699 | MAC_ENTER: 3,
|
2700 | |
2701 |
|
2702 |
|
2703 | BACKSPACE: 8,
|
2704 | |
2705 |
|
2706 |
|
2707 | TAB: 9,
|
2708 | |
2709 |
|
2710 |
|
2711 | NUM_CENTER: 12,
|
2712 | |
2713 |
|
2714 |
|
2715 | ENTER: 13,
|
2716 | |
2717 |
|
2718 |
|
2719 | SHIFT: 16,
|
2720 | |
2721 |
|
2722 |
|
2723 | CTRL: 17,
|
2724 | |
2725 |
|
2726 |
|
2727 | ALT: 18,
|
2728 | |
2729 |
|
2730 |
|
2731 | PAUSE: 19,
|
2732 | |
2733 |
|
2734 |
|
2735 | CAPS_LOCK: 20,
|
2736 | |
2737 |
|
2738 |
|
2739 | ESC: 27,
|
2740 | |
2741 |
|
2742 |
|
2743 | SPACE: 32,
|
2744 | |
2745 |
|
2746 |
|
2747 | PAGE_UP: 33,
|
2748 | |
2749 |
|
2750 |
|
2751 | PAGE_DOWN: 34,
|
2752 | |
2753 |
|
2754 |
|
2755 | END: 35,
|
2756 | |
2757 |
|
2758 |
|
2759 | HOME: 36,
|
2760 | |
2761 |
|
2762 |
|
2763 | LEFT: 37,
|
2764 | |
2765 |
|
2766 |
|
2767 | UP: 38,
|
2768 | |
2769 |
|
2770 |
|
2771 | RIGHT: 39,
|
2772 | |
2773 |
|
2774 |
|
2775 | DOWN: 40,
|
2776 | |
2777 |
|
2778 |
|
2779 | PRINT_SCREEN: 44,
|
2780 | |
2781 |
|
2782 |
|
2783 | INSERT: 45,
|
2784 | |
2785 |
|
2786 |
|
2787 | DELETE: 46,
|
2788 | |
2789 |
|
2790 |
|
2791 | ZERO: 48,
|
2792 | |
2793 |
|
2794 |
|
2795 | ONE: 49,
|
2796 | |
2797 |
|
2798 |
|
2799 | TWO: 50,
|
2800 | |
2801 |
|
2802 |
|
2803 | THREE: 51,
|
2804 | |
2805 |
|
2806 |
|
2807 | FOUR: 52,
|
2808 | |
2809 |
|
2810 |
|
2811 | FIVE: 53,
|
2812 | |
2813 |
|
2814 |
|
2815 | SIX: 54,
|
2816 | |
2817 |
|
2818 |
|
2819 | SEVEN: 55,
|
2820 | |
2821 |
|
2822 |
|
2823 | EIGHT: 56,
|
2824 | |
2825 |
|
2826 |
|
2827 | NINE: 57,
|
2828 | |
2829 |
|
2830 |
|
2831 | QUESTION_MARK: 63,
|
2832 | |
2833 |
|
2834 |
|
2835 | A: 65,
|
2836 | |
2837 |
|
2838 |
|
2839 | B: 66,
|
2840 | |
2841 |
|
2842 |
|
2843 | C: 67,
|
2844 | |
2845 |
|
2846 |
|
2847 | D: 68,
|
2848 | |
2849 |
|
2850 |
|
2851 | E: 69,
|
2852 | |
2853 |
|
2854 |
|
2855 | F: 70,
|
2856 | |
2857 |
|
2858 |
|
2859 | G: 71,
|
2860 | |
2861 |
|
2862 |
|
2863 | H: 72,
|
2864 | |
2865 |
|
2866 |
|
2867 | I: 73,
|
2868 | |
2869 |
|
2870 |
|
2871 | J: 74,
|
2872 | |
2873 |
|
2874 |
|
2875 | K: 75,
|
2876 | |
2877 |
|
2878 |
|
2879 | L: 76,
|
2880 | |
2881 |
|
2882 |
|
2883 | M: 77,
|
2884 | |
2885 |
|
2886 |
|
2887 | N: 78,
|
2888 | |
2889 |
|
2890 |
|
2891 | O: 79,
|
2892 | |
2893 |
|
2894 |
|
2895 | P: 80,
|
2896 | |
2897 |
|
2898 |
|
2899 | Q: 81,
|
2900 | |
2901 |
|
2902 |
|
2903 | R: 82,
|
2904 | |
2905 |
|
2906 |
|
2907 | S: 83,
|
2908 | |
2909 |
|
2910 |
|
2911 | T: 84,
|
2912 | |
2913 |
|
2914 |
|
2915 | U: 85,
|
2916 | |
2917 |
|
2918 |
|
2919 | V: 86,
|
2920 | |
2921 |
|
2922 |
|
2923 | W: 87,
|
2924 | |
2925 |
|
2926 |
|
2927 | X: 88,
|
2928 | |
2929 |
|
2930 |
|
2931 | Y: 89,
|
2932 | |
2933 |
|
2934 |
|
2935 | Z: 90,
|
2936 | |
2937 |
|
2938 |
|
2939 | META: 91,
|
2940 | |
2941 |
|
2942 |
|
2943 | WIN_KEY_RIGHT: 92,
|
2944 | |
2945 |
|
2946 |
|
2947 | CONTEXT_MENU: 93,
|
2948 | |
2949 |
|
2950 |
|
2951 | NUM_ZERO: 96,
|
2952 | |
2953 |
|
2954 |
|
2955 | NUM_ONE: 97,
|
2956 | |
2957 |
|
2958 |
|
2959 | NUM_TWO: 98,
|
2960 | |
2961 |
|
2962 |
|
2963 | NUM_THREE: 99,
|
2964 | |
2965 |
|
2966 |
|
2967 | NUM_FOUR: 100,
|
2968 | |
2969 |
|
2970 |
|
2971 | NUM_FIVE: 101,
|
2972 | |
2973 |
|
2974 |
|
2975 | NUM_SIX: 102,
|
2976 | |
2977 |
|
2978 |
|
2979 | NUM_SEVEN: 103,
|
2980 | |
2981 |
|
2982 |
|
2983 | NUM_EIGHT: 104,
|
2984 | |
2985 |
|
2986 |
|
2987 | NUM_NINE: 105,
|
2988 | |
2989 |
|
2990 |
|
2991 | NUM_MULTIPLY: 106,
|
2992 | |
2993 |
|
2994 |
|
2995 | NUM_PLUS: 107,
|
2996 | |
2997 |
|
2998 |
|
2999 | NUM_MINUS: 109,
|
3000 | |
3001 |
|
3002 |
|
3003 | NUM_PERIOD: 110,
|
3004 | |
3005 |
|
3006 |
|
3007 | NUM_DIVISION: 111,
|
3008 | |
3009 |
|
3010 |
|
3011 | F1: 112,
|
3012 | |
3013 |
|
3014 |
|
3015 | F2: 113,
|
3016 | |
3017 |
|
3018 |
|
3019 | F3: 114,
|
3020 | |
3021 |
|
3022 |
|
3023 | F4: 115,
|
3024 | |
3025 |
|
3026 |
|
3027 | F5: 116,
|
3028 | |
3029 |
|
3030 |
|
3031 | F6: 117,
|
3032 | |
3033 |
|
3034 |
|
3035 | F7: 118,
|
3036 | |
3037 |
|
3038 |
|
3039 | F8: 119,
|
3040 | |
3041 |
|
3042 |
|
3043 | F9: 120,
|
3044 | |
3045 |
|
3046 |
|
3047 | F10: 121,
|
3048 | |
3049 |
|
3050 |
|
3051 | F11: 122,
|
3052 | |
3053 |
|
3054 |
|
3055 | F12: 123,
|
3056 | |
3057 |
|
3058 |
|
3059 | NUMLOCK: 144,
|
3060 | |
3061 |
|
3062 |
|
3063 | SEMICOLON: 186,
|
3064 | |
3065 |
|
3066 |
|
3067 | DASH: 189,
|
3068 | |
3069 |
|
3070 |
|
3071 | EQUALS: 187,
|
3072 | |
3073 |
|
3074 |
|
3075 | COMMA: 188,
|
3076 | |
3077 |
|
3078 |
|
3079 | PERIOD: 190,
|
3080 | |
3081 |
|
3082 |
|
3083 | SLASH: 191,
|
3084 | |
3085 |
|
3086 |
|
3087 | APOSTROPHE: 192,
|
3088 | |
3089 |
|
3090 |
|
3091 | SINGLE_QUOTE: 222,
|
3092 | |
3093 |
|
3094 |
|
3095 | OPEN_SQUARE_BRACKET: 219,
|
3096 | |
3097 |
|
3098 |
|
3099 | BACKSLASH: 220,
|
3100 | |
3101 |
|
3102 |
|
3103 | CLOSE_SQUARE_BRACKET: 221,
|
3104 | |
3105 |
|
3106 |
|
3107 | WIN_KEY: 224,
|
3108 | |
3109 |
|
3110 |
|
3111 | MAC_FF_META: 224,
|
3112 | |
3113 |
|
3114 |
|
3115 | WIN_IME: 229
|
3116 | };
|
3117 |
|
3118 | |
3119 |
|
3120 |
|
3121 | KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) {
|
3122 | var keyCode = e.keyCode;
|
3123 | if (e.altKey && !e.ctrlKey || e.metaKey ||
|
3124 |
|
3125 | keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
|
3126 | return false;
|
3127 | }
|
3128 |
|
3129 |
|
3130 |
|
3131 | switch (keyCode) {
|
3132 | case KeyCode.ALT:
|
3133 | case KeyCode.CAPS_LOCK:
|
3134 | case KeyCode.CONTEXT_MENU:
|
3135 | case KeyCode.CTRL:
|
3136 | case KeyCode.DOWN:
|
3137 | case KeyCode.END:
|
3138 | case KeyCode.ESC:
|
3139 | case KeyCode.HOME:
|
3140 | case KeyCode.INSERT:
|
3141 | case KeyCode.LEFT:
|
3142 | case KeyCode.MAC_FF_META:
|
3143 | case KeyCode.META:
|
3144 | case KeyCode.NUMLOCK:
|
3145 | case KeyCode.NUM_CENTER:
|
3146 | case KeyCode.PAGE_DOWN:
|
3147 | case KeyCode.PAGE_UP:
|
3148 | case KeyCode.PAUSE:
|
3149 | case KeyCode.PRINT_SCREEN:
|
3150 | case KeyCode.RIGHT:
|
3151 | case KeyCode.SHIFT:
|
3152 | case KeyCode.UP:
|
3153 | case KeyCode.WIN_KEY:
|
3154 | case KeyCode.WIN_KEY_RIGHT:
|
3155 | return false;
|
3156 | default:
|
3157 | return true;
|
3158 | }
|
3159 | };
|
3160 |
|
3161 | |
3162 |
|
3163 |
|
3164 | KeyCode.isCharacterKey = function isCharacterKey(keyCode) {
|
3165 | if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
|
3166 | return true;
|
3167 | }
|
3168 |
|
3169 | if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
|
3170 | return true;
|
3171 | }
|
3172 |
|
3173 | if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
|
3174 | return true;
|
3175 | }
|
3176 |
|
3177 |
|
3178 | if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {
|
3179 | return true;
|
3180 | }
|
3181 |
|
3182 | switch (keyCode) {
|
3183 | case KeyCode.SPACE:
|
3184 | case KeyCode.QUESTION_MARK:
|
3185 | case KeyCode.NUM_PLUS:
|
3186 | case KeyCode.NUM_MINUS:
|
3187 | case KeyCode.NUM_PERIOD:
|
3188 | case KeyCode.NUM_DIVISION:
|
3189 | case KeyCode.SEMICOLON:
|
3190 | case KeyCode.DASH:
|
3191 | case KeyCode.EQUALS:
|
3192 | case KeyCode.COMMA:
|
3193 | case KeyCode.PERIOD:
|
3194 | case KeyCode.SLASH:
|
3195 | case KeyCode.APOSTROPHE:
|
3196 | case KeyCode.SINGLE_QUOTE:
|
3197 | case KeyCode.OPEN_SQUARE_BRACKET:
|
3198 | case KeyCode.BACKSLASH:
|
3199 | case KeyCode.CLOSE_SQUARE_BRACKET:
|
3200 | return true;
|
3201 | default:
|
3202 | return false;
|
3203 | }
|
3204 | };
|
3205 |
|
3206 | module.exports = KeyCode;
|
3207 |
|
3208 | }),
|
3209 |
|
3210 | (function(module, exports) {
|
3211 |
|
3212 | "use strict";
|
3213 |
|
3214 | exports.__esModule = true;
|
3215 | exports.default = contains;
|
3216 | function contains(root, n) {
|
3217 | var node = n;
|
3218 | while (node) {
|
3219 | if (node === root) {
|
3220 | return true;
|
3221 | }
|
3222 | node = node.parentNode;
|
3223 | }
|
3224 |
|
3225 | return false;
|
3226 | }
|
3227 |
|
3228 | }),
|
3229 |
|
3230 | (function(module, exports, __webpack_require__) {
|
3231 |
|
3232 | 'use strict';
|
3233 |
|
3234 | exports.__esModule = true;
|
3235 | exports.default = addEventListenerWrap;
|
3236 |
|
3237 | var _addDomEventListener = __webpack_require__(40);
|
3238 |
|
3239 | var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener);
|
3240 |
|
3241 | var _reactDom = __webpack_require__(12);
|
3242 |
|
3243 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
3244 |
|
3245 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3246 |
|
3247 | function addEventListenerWrap(target, eventType, cb) {
|
3248 |
|
3249 | var callback = _reactDom2.default.unstable_batchedUpdates ? function run(e) {
|
3250 | _reactDom2.default.unstable_batchedUpdates(cb, e);
|
3251 | } : cb;
|
3252 | return (0, _addDomEventListener2.default)(target, eventType, callback);
|
3253 | }
|
3254 |
|
3255 | }),
|
3256 |
|
3257 | (function(module, exports, __webpack_require__) {
|
3258 |
|
3259 | 'use strict';
|
3260 |
|
3261 | Object.defineProperty(exports, "__esModule", {
|
3262 | value: true
|
3263 | });
|
3264 | exports["default"] = addEventListener;
|
3265 |
|
3266 | var _EventObject = __webpack_require__(41);
|
3267 |
|
3268 | var _EventObject2 = _interopRequireDefault(_EventObject);
|
3269 |
|
3270 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
3271 |
|
3272 | function addEventListener(target, eventType, callback) {
|
3273 | function wrapCallback(e) {
|
3274 | var ne = new _EventObject2["default"](e);
|
3275 | callback.call(target, ne);
|
3276 | }
|
3277 |
|
3278 | if (target.addEventListener) {
|
3279 | target.addEventListener(eventType, wrapCallback, false);
|
3280 | return {
|
3281 | remove: function remove() {
|
3282 | target.removeEventListener(eventType, wrapCallback, false);
|
3283 | }
|
3284 | };
|
3285 | } else if (target.attachEvent) {
|
3286 | target.attachEvent('on' + eventType, wrapCallback);
|
3287 | return {
|
3288 | remove: function remove() {
|
3289 | target.detachEvent('on' + eventType, wrapCallback);
|
3290 | }
|
3291 | };
|
3292 | }
|
3293 | }
|
3294 | module.exports = exports['default'];
|
3295 |
|
3296 | }),
|
3297 |
|
3298 | (function(module, exports, __webpack_require__) {
|
3299 |
|
3300 | 'use strict';
|
3301 |
|
3302 | Object.defineProperty(exports, "__esModule", {
|
3303 | value: true
|
3304 | });
|
3305 |
|
3306 | var _EventBaseObject = __webpack_require__(42);
|
3307 |
|
3308 | var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject);
|
3309 |
|
3310 | var _objectAssign = __webpack_require__(43);
|
3311 |
|
3312 | var _objectAssign2 = _interopRequireDefault(_objectAssign);
|
3313 |
|
3314 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
3315 |
|
3316 | |
3317 |
|
3318 |
|
3319 |
|
3320 |
|
3321 |
|
3322 | var TRUE = true;
|
3323 | var FALSE = false;
|
3324 | var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type'];
|
3325 |
|
3326 | function isNullOrUndefined(w) {
|
3327 | return w === null || w === undefined;
|
3328 | }
|
3329 |
|
3330 | var eventNormalizers = [{
|
3331 | reg: /^key/,
|
3332 | props: ['char', 'charCode', 'key', 'keyCode', 'which'],
|
3333 | fix: function fix(event, nativeEvent) {
|
3334 | if (isNullOrUndefined(event.which)) {
|
3335 | event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode;
|
3336 | }
|
3337 |
|
3338 |
|
3339 | if (event.metaKey === undefined) {
|
3340 | event.metaKey = event.ctrlKey;
|
3341 | }
|
3342 | }
|
3343 | }, {
|
3344 | reg: /^touch/,
|
3345 | props: ['touches', 'changedTouches', 'targetTouches']
|
3346 | }, {
|
3347 | reg: /^hashchange$/,
|
3348 | props: ['newURL', 'oldURL']
|
3349 | }, {
|
3350 | reg: /^gesturechange$/i,
|
3351 | props: ['rotation', 'scale']
|
3352 | }, {
|
3353 | reg: /^(mousewheel|DOMMouseScroll)$/,
|
3354 | props: [],
|
3355 | fix: function fix(event, nativeEvent) {
|
3356 | var deltaX = void 0;
|
3357 | var deltaY = void 0;
|
3358 | var delta = void 0;
|
3359 | var wheelDelta = nativeEvent.wheelDelta;
|
3360 | var axis = nativeEvent.axis;
|
3361 | var wheelDeltaY = nativeEvent.wheelDeltaY;
|
3362 | var wheelDeltaX = nativeEvent.wheelDeltaX;
|
3363 | var detail = nativeEvent.detail;
|
3364 |
|
3365 |
|
3366 | if (wheelDelta) {
|
3367 | delta = wheelDelta / 120;
|
3368 | }
|
3369 |
|
3370 |
|
3371 | if (detail) {
|
3372 |
|
3373 | delta = 0 - (detail % 3 === 0 ? detail / 3 : detail);
|
3374 | }
|
3375 |
|
3376 |
|
3377 | if (axis !== undefined) {
|
3378 | if (axis === event.HORIZONTAL_AXIS) {
|
3379 | deltaY = 0;
|
3380 | deltaX = 0 - delta;
|
3381 | } else if (axis === event.VERTICAL_AXIS) {
|
3382 | deltaX = 0;
|
3383 | deltaY = delta;
|
3384 | }
|
3385 | }
|
3386 |
|
3387 |
|
3388 | if (wheelDeltaY !== undefined) {
|
3389 | deltaY = wheelDeltaY / 120;
|
3390 | }
|
3391 | if (wheelDeltaX !== undefined) {
|
3392 | deltaX = -1 * wheelDeltaX / 120;
|
3393 | }
|
3394 |
|
3395 |
|
3396 | if (!deltaX && !deltaY) {
|
3397 | deltaY = delta;
|
3398 | }
|
3399 |
|
3400 | if (deltaX !== undefined) {
|
3401 | |
3402 |
|
3403 |
|
3404 |
|
3405 |
|
3406 | event.deltaX = deltaX;
|
3407 | }
|
3408 |
|
3409 | if (deltaY !== undefined) {
|
3410 | |
3411 |
|
3412 |
|
3413 |
|
3414 |
|
3415 | event.deltaY = deltaY;
|
3416 | }
|
3417 |
|
3418 | if (delta !== undefined) {
|
3419 | |
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 | event.delta = delta;
|
3425 | }
|
3426 | }
|
3427 | }, {
|
3428 | reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,
|
3429 | props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'],
|
3430 | fix: function fix(event, nativeEvent) {
|
3431 | var eventDoc = void 0;
|
3432 | var doc = void 0;
|
3433 | var body = void 0;
|
3434 | var target = event.target;
|
3435 | var button = nativeEvent.button;
|
3436 |
|
3437 |
|
3438 | if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) {
|
3439 | eventDoc = target.ownerDocument || document;
|
3440 | doc = eventDoc.documentElement;
|
3441 | body = eventDoc.body;
|
3442 | event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
|
3443 | event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
|
3444 | }
|
3445 |
|
3446 |
|
3447 |
|
3448 | if (!event.which && button !== undefined) {
|
3449 | if (button & 1) {
|
3450 | event.which = 1;
|
3451 | } else if (button & 2) {
|
3452 | event.which = 3;
|
3453 | } else if (button & 4) {
|
3454 | event.which = 2;
|
3455 | } else {
|
3456 | event.which = 0;
|
3457 | }
|
3458 | }
|
3459 |
|
3460 |
|
3461 | if (!event.relatedTarget && event.fromElement) {
|
3462 | event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement;
|
3463 | }
|
3464 |
|
3465 | return event;
|
3466 | }
|
3467 | }];
|
3468 |
|
3469 | function retTrue() {
|
3470 | return TRUE;
|
3471 | }
|
3472 |
|
3473 | function retFalse() {
|
3474 | return FALSE;
|
3475 | }
|
3476 |
|
3477 | function DomEventObject(nativeEvent) {
|
3478 | var type = nativeEvent.type;
|
3479 |
|
3480 | var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean';
|
3481 |
|
3482 | _EventBaseObject2["default"].call(this);
|
3483 |
|
3484 | this.nativeEvent = nativeEvent;
|
3485 |
|
3486 |
|
3487 | var isDefaultPrevented = retFalse;
|
3488 | if ('defaultPrevented' in nativeEvent) {
|
3489 | isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse;
|
3490 | } else if ('getPreventDefault' in nativeEvent) {
|
3491 |
|
3492 | isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse;
|
3493 | } else if ('returnValue' in nativeEvent) {
|
3494 | isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse;
|
3495 | }
|
3496 |
|
3497 | this.isDefaultPrevented = isDefaultPrevented;
|
3498 |
|
3499 | var fixFns = [];
|
3500 | var fixFn = void 0;
|
3501 | var l = void 0;
|
3502 | var prop = void 0;
|
3503 | var props = commonProps.concat();
|
3504 |
|
3505 | eventNormalizers.forEach(function (normalizer) {
|
3506 | if (type.match(normalizer.reg)) {
|
3507 | props = props.concat(normalizer.props);
|
3508 | if (normalizer.fix) {
|
3509 | fixFns.push(normalizer.fix);
|
3510 | }
|
3511 | }
|
3512 | });
|
3513 |
|
3514 | l = props.length;
|
3515 |
|
3516 |
|
3517 | while (l) {
|
3518 | prop = props[--l];
|
3519 | this[prop] = nativeEvent[prop];
|
3520 | }
|
3521 |
|
3522 |
|
3523 | if (!this.target && isNative) {
|
3524 | this.target = nativeEvent.srcElement || document;
|
3525 | }
|
3526 |
|
3527 |
|
3528 | if (this.target && this.target.nodeType === 3) {
|
3529 | this.target = this.target.parentNode;
|
3530 | }
|
3531 |
|
3532 | l = fixFns.length;
|
3533 |
|
3534 | while (l) {
|
3535 | fixFn = fixFns[--l];
|
3536 | fixFn(this, nativeEvent);
|
3537 | }
|
3538 |
|
3539 | this.timeStamp = nativeEvent.timeStamp || Date.now();
|
3540 | }
|
3541 |
|
3542 | var EventBaseObjectProto = _EventBaseObject2["default"].prototype;
|
3543 |
|
3544 | (0, _objectAssign2["default"])(DomEventObject.prototype, EventBaseObjectProto, {
|
3545 | constructor: DomEventObject,
|
3546 |
|
3547 | preventDefault: function preventDefault() {
|
3548 | var e = this.nativeEvent;
|
3549 |
|
3550 |
|
3551 | if (e.preventDefault) {
|
3552 | e.preventDefault();
|
3553 | } else {
|
3554 |
|
3555 | e.returnValue = FALSE;
|
3556 | }
|
3557 |
|
3558 | EventBaseObjectProto.preventDefault.call(this);
|
3559 | },
|
3560 | stopPropagation: function stopPropagation() {
|
3561 | var e = this.nativeEvent;
|
3562 |
|
3563 |
|
3564 | if (e.stopPropagation) {
|
3565 | e.stopPropagation();
|
3566 | } else {
|
3567 |
|
3568 | e.cancelBubble = TRUE;
|
3569 | }
|
3570 |
|
3571 | EventBaseObjectProto.stopPropagation.call(this);
|
3572 | }
|
3573 | });
|
3574 |
|
3575 | exports["default"] = DomEventObject;
|
3576 | module.exports = exports['default'];
|
3577 |
|
3578 | }),
|
3579 |
|
3580 | (function(module, exports) {
|
3581 |
|
3582 | "use strict";
|
3583 |
|
3584 | Object.defineProperty(exports, "__esModule", {
|
3585 | value: true
|
3586 | });
|
3587 | |
3588 |
|
3589 |
|
3590 |
|
3591 |
|
3592 |
|
3593 | function returnFalse() {
|
3594 | return false;
|
3595 | }
|
3596 |
|
3597 | function returnTrue() {
|
3598 | return true;
|
3599 | }
|
3600 |
|
3601 | function EventBaseObject() {
|
3602 | this.timeStamp = Date.now();
|
3603 | this.target = undefined;
|
3604 | this.currentTarget = undefined;
|
3605 | }
|
3606 |
|
3607 | EventBaseObject.prototype = {
|
3608 | isEventObject: 1,
|
3609 |
|
3610 | constructor: EventBaseObject,
|
3611 |
|
3612 | isDefaultPrevented: returnFalse,
|
3613 |
|
3614 | isPropagationStopped: returnFalse,
|
3615 |
|
3616 | isImmediatePropagationStopped: returnFalse,
|
3617 |
|
3618 | preventDefault: function preventDefault() {
|
3619 | this.isDefaultPrevented = returnTrue;
|
3620 | },
|
3621 | stopPropagation: function stopPropagation() {
|
3622 | this.isPropagationStopped = returnTrue;
|
3623 | },
|
3624 | stopImmediatePropagation: function stopImmediatePropagation() {
|
3625 | this.isImmediatePropagationStopped = returnTrue;
|
3626 |
|
3627 |
|
3628 | this.stopPropagation();
|
3629 | },
|
3630 | halt: function halt(immediate) {
|
3631 | if (immediate) {
|
3632 | this.stopImmediatePropagation();
|
3633 | } else {
|
3634 | this.stopPropagation();
|
3635 | }
|
3636 | this.preventDefault();
|
3637 | }
|
3638 | };
|
3639 |
|
3640 | exports["default"] = EventBaseObject;
|
3641 | module.exports = exports['default'];
|
3642 |
|
3643 | }),
|
3644 |
|
3645 | (function(module, exports) {
|
3646 |
|
3647 | |
3648 |
|
3649 |
|
3650 |
|
3651 |
|
3652 |
|
3653 | 'use strict';
|
3654 |
|
3655 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
3656 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
3657 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
3658 |
|
3659 | function toObject(val) {
|
3660 | if (val === null || val === undefined) {
|
3661 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
3662 | }
|
3663 |
|
3664 | return Object(val);
|
3665 | }
|
3666 |
|
3667 | function shouldUseNative() {
|
3668 | try {
|
3669 | if (!Object.assign) {
|
3670 | return false;
|
3671 | }
|
3672 |
|
3673 |
|
3674 |
|
3675 |
|
3676 | var test1 = new String('abc');
|
3677 | test1[5] = 'de';
|
3678 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
3679 | return false;
|
3680 | }
|
3681 |
|
3682 |
|
3683 | var test2 = {};
|
3684 | for (var i = 0; i < 10; i++) {
|
3685 | test2['_' + String.fromCharCode(i)] = i;
|
3686 | }
|
3687 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
3688 | return test2[n];
|
3689 | });
|
3690 | if (order2.join('') !== '0123456789') {
|
3691 | return false;
|
3692 | }
|
3693 |
|
3694 |
|
3695 | var test3 = {};
|
3696 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
3697 | test3[letter] = letter;
|
3698 | });
|
3699 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
3700 | 'abcdefghijklmnopqrst') {
|
3701 | return false;
|
3702 | }
|
3703 |
|
3704 | return true;
|
3705 | } catch (err) {
|
3706 |
|
3707 | return false;
|
3708 | }
|
3709 | }
|
3710 |
|
3711 | module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
3712 | var from;
|
3713 | var to = toObject(target);
|
3714 | var symbols;
|
3715 |
|
3716 | for (var s = 1; s < arguments.length; s++) {
|
3717 | from = Object(arguments[s]);
|
3718 |
|
3719 | for (var key in from) {
|
3720 | if (hasOwnProperty.call(from, key)) {
|
3721 | to[key] = from[key];
|
3722 | }
|
3723 | }
|
3724 |
|
3725 | if (getOwnPropertySymbols) {
|
3726 | symbols = getOwnPropertySymbols(from);
|
3727 | for (var i = 0; i < symbols.length; i++) {
|
3728 | if (propIsEnumerable.call(from, symbols[i])) {
|
3729 | to[symbols[i]] = from[symbols[i]];
|
3730 | }
|
3731 | }
|
3732 | }
|
3733 | }
|
3734 |
|
3735 | return to;
|
3736 | };
|
3737 |
|
3738 |
|
3739 | }),
|
3740 |
|
3741 | (function(module, exports, __webpack_require__) {
|
3742 |
|
3743 | 'use strict';
|
3744 |
|
3745 | exports.__esModule = true;
|
3746 |
|
3747 | 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; };
|
3748 |
|
3749 | var _Event = __webpack_require__(45);
|
3750 |
|
3751 | var _Event2 = _interopRequireDefault(_Event);
|
3752 |
|
3753 | var _componentClasses = __webpack_require__(46);
|
3754 |
|
3755 | var _componentClasses2 = _interopRequireDefault(_componentClasses);
|
3756 |
|
3757 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3758 |
|
3759 | var isCssAnimationSupported = _Event2.default.endEvents.length !== 0;
|
3760 |
|
3761 |
|
3762 | var capitalPrefixes = ['Webkit', 'Moz', 'O',
|
3763 |
|
3764 | 'ms'];
|
3765 | var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];
|
3766 |
|
3767 | function getStyleProperty(node, name) {
|
3768 | var style = window.getComputedStyle(node);
|
3769 |
|
3770 | var ret = '';
|
3771 | for (var i = 0; i < prefixes.length; i++) {
|
3772 | ret = style.getPropertyValue(prefixes[i] + name);
|
3773 | if (ret) {
|
3774 | break;
|
3775 | }
|
3776 | }
|
3777 | return ret;
|
3778 | }
|
3779 |
|
3780 | function fixBrowserByTimeout(node) {
|
3781 | if (isCssAnimationSupported) {
|
3782 | var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0;
|
3783 | var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0;
|
3784 | var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0;
|
3785 | var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0;
|
3786 | var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay);
|
3787 |
|
3788 | node.rcEndAnimTimeout = setTimeout(function () {
|
3789 | node.rcEndAnimTimeout = null;
|
3790 | if (node.rcEndListener) {
|
3791 | node.rcEndListener();
|
3792 | }
|
3793 | }, time * 1000 + 200);
|
3794 | }
|
3795 | }
|
3796 |
|
3797 | function clearBrowserBugTimeout(node) {
|
3798 | if (node.rcEndAnimTimeout) {
|
3799 | clearTimeout(node.rcEndAnimTimeout);
|
3800 | node.rcEndAnimTimeout = null;
|
3801 | }
|
3802 | }
|
3803 |
|
3804 | var cssAnimation = function cssAnimation(node, transitionName, endCallback) {
|
3805 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
|
3806 | var className = nameIsObj ? transitionName.name : transitionName;
|
3807 | var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active';
|
3808 | var end = endCallback;
|
3809 | var start = void 0;
|
3810 | var active = void 0;
|
3811 | var nodeClasses = (0, _componentClasses2.default)(node);
|
3812 |
|
3813 | if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') {
|
3814 | end = endCallback.end;
|
3815 | start = endCallback.start;
|
3816 | active = endCallback.active;
|
3817 | }
|
3818 |
|
3819 | if (node.rcEndListener) {
|
3820 | node.rcEndListener();
|
3821 | }
|
3822 |
|
3823 | node.rcEndListener = function (e) {
|
3824 | if (e && e.target !== node) {
|
3825 | return;
|
3826 | }
|
3827 |
|
3828 | if (node.rcAnimTimeout) {
|
3829 | clearTimeout(node.rcAnimTimeout);
|
3830 | node.rcAnimTimeout = null;
|
3831 | }
|
3832 |
|
3833 | clearBrowserBugTimeout(node);
|
3834 |
|
3835 | nodeClasses.remove(className);
|
3836 | nodeClasses.remove(activeClassName);
|
3837 |
|
3838 | _Event2.default.removeEndEventListener(node, node.rcEndListener);
|
3839 | node.rcEndListener = null;
|
3840 |
|
3841 |
|
3842 |
|
3843 | if (end) {
|
3844 | end();
|
3845 | }
|
3846 | };
|
3847 |
|
3848 | _Event2.default.addEndEventListener(node, node.rcEndListener);
|
3849 |
|
3850 | if (start) {
|
3851 | start();
|
3852 | }
|
3853 | nodeClasses.add(className);
|
3854 |
|
3855 | node.rcAnimTimeout = setTimeout(function () {
|
3856 | node.rcAnimTimeout = null;
|
3857 | nodeClasses.add(activeClassName);
|
3858 | if (active) {
|
3859 | setTimeout(active, 0);
|
3860 | }
|
3861 | fixBrowserByTimeout(node);
|
3862 |
|
3863 | }, 30);
|
3864 |
|
3865 | return {
|
3866 | stop: function stop() {
|
3867 | if (node.rcEndListener) {
|
3868 | node.rcEndListener();
|
3869 | }
|
3870 | }
|
3871 | };
|
3872 | };
|
3873 |
|
3874 | cssAnimation.style = function (node, style, callback) {
|
3875 | if (node.rcEndListener) {
|
3876 | node.rcEndListener();
|
3877 | }
|
3878 |
|
3879 | node.rcEndListener = function (e) {
|
3880 | if (e && e.target !== node) {
|
3881 | return;
|
3882 | }
|
3883 |
|
3884 | if (node.rcAnimTimeout) {
|
3885 | clearTimeout(node.rcAnimTimeout);
|
3886 | node.rcAnimTimeout = null;
|
3887 | }
|
3888 |
|
3889 | clearBrowserBugTimeout(node);
|
3890 |
|
3891 | _Event2.default.removeEndEventListener(node, node.rcEndListener);
|
3892 | node.rcEndListener = null;
|
3893 |
|
3894 |
|
3895 |
|
3896 | if (callback) {
|
3897 | callback();
|
3898 | }
|
3899 | };
|
3900 |
|
3901 | _Event2.default.addEndEventListener(node, node.rcEndListener);
|
3902 |
|
3903 | node.rcAnimTimeout = setTimeout(function () {
|
3904 | for (var s in style) {
|
3905 | if (style.hasOwnProperty(s)) {
|
3906 | node.style[s] = style[s];
|
3907 | }
|
3908 | }
|
3909 | node.rcAnimTimeout = null;
|
3910 | fixBrowserByTimeout(node);
|
3911 | }, 0);
|
3912 | };
|
3913 |
|
3914 | cssAnimation.setTransition = function (node, p, value) {
|
3915 | var property = p;
|
3916 | var v = value;
|
3917 | if (value === undefined) {
|
3918 | v = property;
|
3919 | property = '';
|
3920 | }
|
3921 | property = property || '';
|
3922 | capitalPrefixes.forEach(function (prefix) {
|
3923 | node.style[prefix + 'Transition' + property] = v;
|
3924 | });
|
3925 | };
|
3926 |
|
3927 | cssAnimation.isCssAnimationSupported = isCssAnimationSupported;
|
3928 |
|
3929 | exports.default = cssAnimation;
|
3930 |
|
3931 | }),
|
3932 |
|
3933 | (function(module, exports) {
|
3934 |
|
3935 | 'use strict';
|
3936 |
|
3937 | exports.__esModule = true;
|
3938 | var EVENT_NAME_MAP = {
|
3939 | transitionend: {
|
3940 | transition: 'transitionend',
|
3941 | WebkitTransition: 'webkitTransitionEnd',
|
3942 | MozTransition: 'mozTransitionEnd',
|
3943 | OTransition: 'oTransitionEnd',
|
3944 | msTransition: 'MSTransitionEnd'
|
3945 | },
|
3946 |
|
3947 | animationend: {
|
3948 | animation: 'animationend',
|
3949 | WebkitAnimation: 'webkitAnimationEnd',
|
3950 | MozAnimation: 'mozAnimationEnd',
|
3951 | OAnimation: 'oAnimationEnd',
|
3952 | msAnimation: 'MSAnimationEnd'
|
3953 | }
|
3954 | };
|
3955 |
|
3956 | var endEvents = [];
|
3957 |
|
3958 | function detectEvents() {
|
3959 | var testEl = document.createElement('div');
|
3960 | var style = testEl.style;
|
3961 |
|
3962 | if (!('AnimationEvent' in window)) {
|
3963 | delete EVENT_NAME_MAP.animationend.animation;
|
3964 | }
|
3965 |
|
3966 | if (!('TransitionEvent' in window)) {
|
3967 | delete EVENT_NAME_MAP.transitionend.transition;
|
3968 | }
|
3969 |
|
3970 | for (var baseEventName in EVENT_NAME_MAP) {
|
3971 | if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
|
3972 | var baseEvents = EVENT_NAME_MAP[baseEventName];
|
3973 | for (var styleName in baseEvents) {
|
3974 | if (styleName in style) {
|
3975 | endEvents.push(baseEvents[styleName]);
|
3976 | break;
|
3977 | }
|
3978 | }
|
3979 | }
|
3980 | }
|
3981 | }
|
3982 |
|
3983 | if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
3984 | detectEvents();
|
3985 | }
|
3986 |
|
3987 | function addEventListener(node, eventName, eventListener) {
|
3988 | node.addEventListener(eventName, eventListener, false);
|
3989 | }
|
3990 |
|
3991 | function removeEventListener(node, eventName, eventListener) {
|
3992 | node.removeEventListener(eventName, eventListener, false);
|
3993 | }
|
3994 |
|
3995 | var TransitionEvents = {
|
3996 | addEndEventListener: function addEndEventListener(node, eventListener) {
|
3997 | if (endEvents.length === 0) {
|
3998 | window.setTimeout(eventListener, 0);
|
3999 | return;
|
4000 | }
|
4001 | endEvents.forEach(function (endEvent) {
|
4002 | addEventListener(node, endEvent, eventListener);
|
4003 | });
|
4004 | },
|
4005 |
|
4006 |
|
4007 | endEvents: endEvents,
|
4008 |
|
4009 | removeEndEventListener: function removeEndEventListener(node, eventListener) {
|
4010 | if (endEvents.length === 0) {
|
4011 | return;
|
4012 | }
|
4013 | endEvents.forEach(function (endEvent) {
|
4014 | removeEventListener(node, endEvent, eventListener);
|
4015 | });
|
4016 | }
|
4017 | };
|
4018 |
|
4019 | exports.default = TransitionEvents;
|
4020 |
|
4021 | }),
|
4022 |
|
4023 | (function(module, exports, __webpack_require__) {
|
4024 |
|
4025 | |
4026 |
|
4027 |
|
4028 |
|
4029 | try {
|
4030 | var index = __webpack_require__(47);
|
4031 | } catch (err) {
|
4032 | var index = __webpack_require__(47);
|
4033 | }
|
4034 |
|
4035 | |
4036 |
|
4037 |
|
4038 |
|
4039 | var re = /\s+/;
|
4040 |
|
4041 | |
4042 |
|
4043 |
|
4044 |
|
4045 | var toString = Object.prototype.toString;
|
4046 |
|
4047 | |
4048 |
|
4049 |
|
4050 |
|
4051 |
|
4052 |
|
4053 |
|
4054 |
|
4055 | module.exports = function(el){
|
4056 | return new ClassList(el);
|
4057 | };
|
4058 |
|
4059 | |
4060 |
|
4061 |
|
4062 |
|
4063 |
|
4064 |
|
4065 |
|
4066 | function ClassList(el) {
|
4067 | if (!el || !el.nodeType) {
|
4068 | throw new Error('A DOM element reference is required');
|
4069 | }
|
4070 | this.el = el;
|
4071 | this.list = el.classList;
|
4072 | }
|
4073 |
|
4074 | |
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 |
|
4080 |
|
4081 |
|
4082 | ClassList.prototype.add = function(name){
|
4083 |
|
4084 | if (this.list) {
|
4085 | this.list.add(name);
|
4086 | return this;
|
4087 | }
|
4088 |
|
4089 |
|
4090 | var arr = this.array();
|
4091 | var i = index(arr, name);
|
4092 | if (!~i) arr.push(name);
|
4093 | this.el.className = arr.join(' ');
|
4094 | return this;
|
4095 | };
|
4096 |
|
4097 | |
4098 |
|
4099 |
|
4100 |
|
4101 |
|
4102 |
|
4103 |
|
4104 |
|
4105 |
|
4106 |
|
4107 | ClassList.prototype.remove = function(name){
|
4108 | if ('[object RegExp]' == toString.call(name)) {
|
4109 | return this.removeMatching(name);
|
4110 | }
|
4111 |
|
4112 |
|
4113 | if (this.list) {
|
4114 | this.list.remove(name);
|
4115 | return this;
|
4116 | }
|
4117 |
|
4118 |
|
4119 | var arr = this.array();
|
4120 | var i = index(arr, name);
|
4121 | if (~i) arr.splice(i, 1);
|
4122 | this.el.className = arr.join(' ');
|
4123 | return this;
|
4124 | };
|
4125 |
|
4126 | |
4127 |
|
4128 |
|
4129 |
|
4130 |
|
4131 |
|
4132 |
|
4133 |
|
4134 | ClassList.prototype.removeMatching = function(re){
|
4135 | var arr = this.array();
|
4136 | for (var i = 0; i < arr.length; i++) {
|
4137 | if (re.test(arr[i])) {
|
4138 | this.remove(arr[i]);
|
4139 | }
|
4140 | }
|
4141 | return this;
|
4142 | };
|
4143 |
|
4144 | |
4145 |
|
4146 |
|
4147 |
|
4148 |
|
4149 |
|
4150 |
|
4151 |
|
4152 |
|
4153 |
|
4154 |
|
4155 |
|
4156 | ClassList.prototype.toggle = function(name, force){
|
4157 |
|
4158 | if (this.list) {
|
4159 | if ("undefined" !== typeof force) {
|
4160 | if (force !== this.list.toggle(name, force)) {
|
4161 | this.list.toggle(name);
|
4162 | }
|
4163 | } else {
|
4164 | this.list.toggle(name);
|
4165 | }
|
4166 | return this;
|
4167 | }
|
4168 |
|
4169 |
|
4170 | if ("undefined" !== typeof force) {
|
4171 | if (!force) {
|
4172 | this.remove(name);
|
4173 | } else {
|
4174 | this.add(name);
|
4175 | }
|
4176 | } else {
|
4177 | if (this.has(name)) {
|
4178 | this.remove(name);
|
4179 | } else {
|
4180 | this.add(name);
|
4181 | }
|
4182 | }
|
4183 |
|
4184 | return this;
|
4185 | };
|
4186 |
|
4187 | |
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 |
|
4193 |
|
4194 | ClassList.prototype.array = function(){
|
4195 | var className = this.el.getAttribute('class') || '';
|
4196 | var str = className.replace(/^\s+|\s+$/g, '');
|
4197 | var arr = str.split(re);
|
4198 | if ('' === arr[0]) arr.shift();
|
4199 | return arr;
|
4200 | };
|
4201 |
|
4202 | |
4203 |
|
4204 |
|
4205 |
|
4206 |
|
4207 |
|
4208 |
|
4209 |
|
4210 | ClassList.prototype.has =
|
4211 | ClassList.prototype.contains = function(name){
|
4212 | return this.list
|
4213 | ? this.list.contains(name)
|
4214 | : !! ~index(this.array(), name);
|
4215 | };
|
4216 |
|
4217 |
|
4218 | }),
|
4219 |
|
4220 | (function(module, exports) {
|
4221 |
|
4222 | module.exports = function(arr, obj){
|
4223 | if (arr.indexOf) return arr.indexOf(obj);
|
4224 | for (var i = 0; i < arr.length; ++i) {
|
4225 | if (arr[i] === obj) return i;
|
4226 | }
|
4227 | return -1;
|
4228 | };
|
4229 |
|
4230 | }),
|
4231 |
|
4232 | (function(module, exports, __webpack_require__) {
|
4233 |
|
4234 | 'use strict';
|
4235 |
|
4236 | exports.__esModule = true;
|
4237 | exports.default = toArray;
|
4238 |
|
4239 | var _react = __webpack_require__(4);
|
4240 |
|
4241 | var _react2 = _interopRequireDefault(_react);
|
4242 |
|
4243 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4244 |
|
4245 | function toArray(children) {
|
4246 | var ret = [];
|
4247 | _react2.default.Children.forEach(children, function (c) {
|
4248 | ret.push(c);
|
4249 | });
|
4250 | return ret;
|
4251 | }
|
4252 |
|
4253 | }),
|
4254 |
|
4255 | (function(module, exports, __webpack_require__) {
|
4256 |
|
4257 | 'use strict';
|
4258 |
|
4259 | exports.__esModule = true;
|
4260 |
|
4261 | var _react = __webpack_require__(4);
|
4262 |
|
4263 | var _react2 = _interopRequireDefault(_react);
|
4264 |
|
4265 | var _propTypes = __webpack_require__(5);
|
4266 |
|
4267 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
4268 |
|
4269 | var _reactDom = __webpack_require__(12);
|
4270 |
|
4271 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
4272 |
|
4273 | var _domAlign = __webpack_require__(50);
|
4274 |
|
4275 | var _domAlign2 = _interopRequireDefault(_domAlign);
|
4276 |
|
4277 | var _addEventListener = __webpack_require__(39);
|
4278 |
|
4279 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
4280 |
|
4281 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4282 |
|
4283 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
4284 |
|
4285 | 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; }
|
4286 |
|
4287 | 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; }
|
4288 |
|
4289 |
|
4290 |
|
4291 | function isWindow(obj) {
|
4292 |
|
4293 |
|
4294 | return obj != null && obj == obj.window;
|
4295 | }
|
4296 |
|
4297 | function buffer(fn, ms) {
|
4298 | var timer = void 0;
|
4299 |
|
4300 | function clear() {
|
4301 | if (timer) {
|
4302 | clearTimeout(timer);
|
4303 | timer = null;
|
4304 | }
|
4305 | }
|
4306 |
|
4307 | function bufferFn() {
|
4308 | clear();
|
4309 | timer = setTimeout(fn, ms);
|
4310 | }
|
4311 |
|
4312 | bufferFn.clear = clear;
|
4313 |
|
4314 | return bufferFn;
|
4315 | }
|
4316 |
|
4317 | var propTypes = {
|
4318 | childrenProps: _propTypes2.default.object,
|
4319 | align: _propTypes2.default.object.isRequired,
|
4320 | target: _propTypes2.default.func,
|
4321 | onAlign: _propTypes2.default.func,
|
4322 | monitorBufferTime: _propTypes2.default.number,
|
4323 | monitorWindowResize: _propTypes2.default.bool,
|
4324 | disabled: _propTypes2.default.bool,
|
4325 | children: _propTypes2.default.any
|
4326 | };
|
4327 |
|
4328 | var defaultProps = {
|
4329 | target: function target() {
|
4330 | return window;
|
4331 | },
|
4332 | onAlign: function onAlign() {},
|
4333 |
|
4334 | monitorBufferTime: 50,
|
4335 | monitorWindowResize: false,
|
4336 | disabled: false
|
4337 | };
|
4338 |
|
4339 | var Align = function (_React$Component) {
|
4340 | _inherits(Align, _React$Component);
|
4341 |
|
4342 | function Align(props) {
|
4343 | _classCallCheck(this, Align);
|
4344 |
|
4345 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
4346 |
|
4347 | _initialiseProps.call(_this);
|
4348 |
|
4349 | return _this;
|
4350 | }
|
4351 |
|
4352 | Align.prototype.componentDidMount = function componentDidMount() {
|
4353 | var props = this.props;
|
4354 |
|
4355 | this.forceAlign();
|
4356 | if (!props.disabled && props.monitorWindowResize) {
|
4357 | this.startMonitorWindowResize();
|
4358 | }
|
4359 | };
|
4360 |
|
4361 | Align.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
4362 | var reAlign = false;
|
4363 | var props = this.props;
|
4364 |
|
4365 | if (!props.disabled) {
|
4366 | if (prevProps.disabled || prevProps.align !== props.align) {
|
4367 | reAlign = true;
|
4368 | } else {
|
4369 | var lastTarget = prevProps.target();
|
4370 | var currentTarget = props.target();
|
4371 | if (isWindow(lastTarget) && isWindow(currentTarget)) {
|
4372 | reAlign = false;
|
4373 | } else if (lastTarget !== currentTarget) {
|
4374 | reAlign = true;
|
4375 | }
|
4376 | }
|
4377 | }
|
4378 |
|
4379 | if (reAlign) {
|
4380 | this.forceAlign();
|
4381 | }
|
4382 |
|
4383 | if (props.monitorWindowResize && !props.disabled) {
|
4384 | this.startMonitorWindowResize();
|
4385 | } else {
|
4386 | this.stopMonitorWindowResize();
|
4387 | }
|
4388 | };
|
4389 |
|
4390 | Align.prototype.componentWillUnmount = function componentWillUnmount() {
|
4391 | this.stopMonitorWindowResize();
|
4392 | };
|
4393 |
|
4394 | Align.prototype.render = function render() {
|
4395 | var _props = this.props,
|
4396 | childrenProps = _props.childrenProps,
|
4397 | children = _props.children;
|
4398 |
|
4399 | var child = _react2.default.Children.only(children);
|
4400 | if (childrenProps) {
|
4401 | var newProps = {};
|
4402 | for (var prop in childrenProps) {
|
4403 | if (childrenProps.hasOwnProperty(prop)) {
|
4404 | newProps[prop] = this.props[childrenProps[prop]];
|
4405 | }
|
4406 | }
|
4407 | return _react2.default.cloneElement(child, newProps);
|
4408 | }
|
4409 | return child;
|
4410 | };
|
4411 |
|
4412 | return Align;
|
4413 | }(_react2.default.Component);
|
4414 |
|
4415 | var _initialiseProps = function _initialiseProps() {
|
4416 | var _this2 = this;
|
4417 |
|
4418 | this.startMonitorWindowResize = function () {
|
4419 | if (!_this2.resizeHandler) {
|
4420 | _this2.bufferMonitor = buffer(_this2.forceAlign, _this2.props.monitorBufferTime);
|
4421 | _this2.resizeHandler = (0, _addEventListener2.default)(window, 'resize', _this2.bufferMonitor);
|
4422 | }
|
4423 | };
|
4424 |
|
4425 | this.stopMonitorWindowResize = function () {
|
4426 | if (_this2.resizeHandler) {
|
4427 | _this2.bufferMonitor.clear();
|
4428 | _this2.resizeHandler.remove();
|
4429 | _this2.resizeHandler = null;
|
4430 | }
|
4431 | };
|
4432 |
|
4433 | this.forceAlign = function () {
|
4434 | var props = _this2.props;
|
4435 | if (!props.disabled) {
|
4436 | var source = _reactDom2.default.findDOMNode(_this2);
|
4437 | props.onAlign(source, (0, _domAlign2.default)(source, props.target(), props.align));
|
4438 | }
|
4439 | };
|
4440 | };
|
4441 |
|
4442 | ;
|
4443 |
|
4444 | Align.defaultProps = defaultProps;
|
4445 | Align.propTypes = propTypes;
|
4446 |
|
4447 | exports.default = Align;
|
4448 |
|
4449 | }),
|
4450 |
|
4451 | (function(module, exports, __webpack_require__) {
|
4452 |
|
4453 | 'use strict';
|
4454 |
|
4455 | Object.defineProperty(exports, "__esModule", {
|
4456 | value: true
|
4457 | });
|
4458 | exports.alignPoint = exports.alignElement = undefined;
|
4459 |
|
4460 | var _alignElement = __webpack_require__(51);
|
4461 |
|
4462 | var _alignElement2 = _interopRequireDefault(_alignElement);
|
4463 |
|
4464 | var _alignPoint = __webpack_require__(62);
|
4465 |
|
4466 | var _alignPoint2 = _interopRequireDefault(_alignPoint);
|
4467 |
|
4468 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4469 |
|
4470 | exports.alignElement = _alignElement2['default'];
|
4471 | exports.alignPoint = _alignPoint2['default'];
|
4472 | exports['default'] = _alignElement2['default'];
|
4473 |
|
4474 | }),
|
4475 |
|
4476 | (function(module, exports, __webpack_require__) {
|
4477 |
|
4478 | 'use strict';
|
4479 |
|
4480 | Object.defineProperty(exports, "__esModule", {
|
4481 | value: true
|
4482 | });
|
4483 |
|
4484 | var _align = __webpack_require__(52);
|
4485 |
|
4486 | var _align2 = _interopRequireDefault(_align);
|
4487 |
|
4488 | var _getOffsetParent = __webpack_require__(56);
|
4489 |
|
4490 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
|
4491 |
|
4492 | var _getVisibleRectForElement = __webpack_require__(55);
|
4493 |
|
4494 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
|
4495 |
|
4496 | var _getRegion = __webpack_require__(59);
|
4497 |
|
4498 | var _getRegion2 = _interopRequireDefault(_getRegion);
|
4499 |
|
4500 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4501 |
|
4502 | function isOutOfVisibleRect(target) {
|
4503 | var visibleRect = (0, _getVisibleRectForElement2['default'])(target);
|
4504 | var targetRegion = (0, _getRegion2['default'])(target);
|
4505 |
|
4506 | return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom;
|
4507 | }
|
4508 |
|
4509 | function alignElement(el, refNode, align) {
|
4510 | var target = align.target || refNode;
|
4511 | var refNodeRegion = (0, _getRegion2['default'])(target);
|
4512 |
|
4513 | var isTargetNotOutOfVisible = !isOutOfVisibleRect(target);
|
4514 |
|
4515 | return (0, _align2['default'])(el, refNodeRegion, align, isTargetNotOutOfVisible);
|
4516 | }
|
4517 |
|
4518 | alignElement.__getOffsetParent = _getOffsetParent2['default'];
|
4519 |
|
4520 | alignElement.__getVisibleRectForElement = _getVisibleRectForElement2['default'];
|
4521 |
|
4522 | exports['default'] = alignElement;
|
4523 | module.exports = exports['default'];
|
4524 |
|
4525 | }),
|
4526 |
|
4527 | (function(module, exports, __webpack_require__) {
|
4528 |
|
4529 | 'use strict';
|
4530 |
|
4531 | Object.defineProperty(exports, "__esModule", {
|
4532 | value: true
|
4533 | });
|
4534 |
|
4535 | var _utils = __webpack_require__(53);
|
4536 |
|
4537 | var _utils2 = _interopRequireDefault(_utils);
|
4538 |
|
4539 | var _getVisibleRectForElement = __webpack_require__(55);
|
4540 |
|
4541 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
|
4542 |
|
4543 | var _adjustForViewport = __webpack_require__(58);
|
4544 |
|
4545 | var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport);
|
4546 |
|
4547 | var _getRegion = __webpack_require__(59);
|
4548 |
|
4549 | var _getRegion2 = _interopRequireDefault(_getRegion);
|
4550 |
|
4551 | var _getElFuturePos = __webpack_require__(60);
|
4552 |
|
4553 | var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos);
|
4554 |
|
4555 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4556 |
|
4557 |
|
4558 |
|
4559 | function isFailX(elFuturePos, elRegion, visibleRect) {
|
4560 | return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;
|
4561 | } |
4562 |
|
4563 |
|
4564 |
|
4565 |
|
4566 | function isFailY(elFuturePos, elRegion, visibleRect) {
|
4567 | return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom;
|
4568 | }
|
4569 |
|
4570 | function isCompleteFailX(elFuturePos, elRegion, visibleRect) {
|
4571 | return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;
|
4572 | }
|
4573 |
|
4574 | function isCompleteFailY(elFuturePos, elRegion, visibleRect) {
|
4575 | return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;
|
4576 | }
|
4577 |
|
4578 | function flip(points, reg, map) {
|
4579 | var ret = [];
|
4580 | _utils2['default'].each(points, function (p) {
|
4581 | ret.push(p.replace(reg, function (m) {
|
4582 | return map[m];
|
4583 | }));
|
4584 | });
|
4585 | return ret;
|
4586 | }
|
4587 |
|
4588 | function flipOffset(offset, index) {
|
4589 | offset[index] = -offset[index];
|
4590 | return offset;
|
4591 | }
|
4592 |
|
4593 | function convertOffset(str, offsetLen) {
|
4594 | var n = void 0;
|
4595 | if (/%$/.test(str)) {
|
4596 | n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen;
|
4597 | } else {
|
4598 | n = parseInt(str, 10);
|
4599 | }
|
4600 | return n || 0;
|
4601 | }
|
4602 |
|
4603 | function normalizeOffset(offset, el) {
|
4604 | offset[0] = convertOffset(offset[0], el.width);
|
4605 | offset[1] = convertOffset(offset[1], el.height);
|
4606 | }
|
4607 |
|
4608 | |
4609 |
|
4610 |
|
4611 |
|
4612 |
|
4613 | function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
4614 | var points = align.points;
|
4615 | var offset = align.offset || [0, 0];
|
4616 | var targetOffset = align.targetOffset || [0, 0];
|
4617 | var overflow = align.overflow;
|
4618 | var source = align.source || el;
|
4619 | offset = [].concat(offset);
|
4620 | targetOffset = [].concat(targetOffset);
|
4621 | overflow = overflow || {};
|
4622 | var newOverflowCfg = {};
|
4623 | var fail = 0;
|
4624 |
|
4625 | var visibleRect = (0, _getVisibleRectForElement2['default'])(source);
|
4626 |
|
4627 | var elRegion = (0, _getRegion2['default'])(source);
|
4628 |
|
4629 | normalizeOffset(offset, elRegion);
|
4630 | normalizeOffset(targetOffset, tgtRegion);
|
4631 |
|
4632 | var elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
|
4633 |
|
4634 | var newElRegion = _utils2['default'].merge(elRegion, elFuturePos);
|
4635 |
|
4636 |
|
4637 | if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTgtRegionVisible) {
|
4638 | if (overflow.adjustX) {
|
4639 |
|
4640 | if (isFailX(elFuturePos, elRegion, visibleRect)) {
|
4641 |
|
4642 | var newPoints = flip(points, /[lr]/ig, {
|
4643 | l: 'r',
|
4644 | r: 'l'
|
4645 | });
|
4646 |
|
4647 | var newOffset = flipOffset(offset, 0);
|
4648 | var newTargetOffset = flipOffset(targetOffset, 0);
|
4649 | var newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, newPoints, newOffset, newTargetOffset);
|
4650 |
|
4651 | if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {
|
4652 | fail = 1;
|
4653 | points = newPoints;
|
4654 | offset = newOffset;
|
4655 | targetOffset = newTargetOffset;
|
4656 | }
|
4657 | }
|
4658 | }
|
4659 |
|
4660 | if (overflow.adjustY) {
|
4661 |
|
4662 | if (isFailY(elFuturePos, elRegion, visibleRect)) {
|
4663 |
|
4664 | var _newPoints = flip(points, /[tb]/ig, {
|
4665 | t: 'b',
|
4666 | b: 't'
|
4667 | });
|
4668 |
|
4669 | var _newOffset = flipOffset(offset, 1);
|
4670 | var _newTargetOffset = flipOffset(targetOffset, 1);
|
4671 | var _newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, _newPoints, _newOffset, _newTargetOffset);
|
4672 |
|
4673 | if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) {
|
4674 | fail = 1;
|
4675 | points = _newPoints;
|
4676 | offset = _newOffset;
|
4677 | targetOffset = _newTargetOffset;
|
4678 | }
|
4679 | }
|
4680 | }
|
4681 |
|
4682 |
|
4683 | if (fail) {
|
4684 | elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
|
4685 | _utils2['default'].mix(newElRegion, elFuturePos);
|
4686 | }
|
4687 | var isStillFailX = isFailX(elFuturePos, elRegion, visibleRect);
|
4688 | var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect);
|
4689 |
|
4690 |
|
4691 | if (isStillFailX || isStillFailY) {
|
4692 | points = align.points;
|
4693 | offset = align.offset || [0, 0];
|
4694 | targetOffset = align.targetOffset || [0, 0];
|
4695 | }
|
4696 |
|
4697 | newOverflowCfg.adjustX = overflow.adjustX && isStillFailX;
|
4698 | newOverflowCfg.adjustY = overflow.adjustY && isStillFailY;
|
4699 |
|
4700 |
|
4701 | if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) {
|
4702 | newElRegion = (0, _adjustForViewport2['default'])(elFuturePos, elRegion, visibleRect, newOverflowCfg);
|
4703 | }
|
4704 | }
|
4705 |
|
4706 |
|
4707 | if (newElRegion.width !== elRegion.width) {
|
4708 | _utils2['default'].css(source, 'width', _utils2['default'].width(source) + newElRegion.width - elRegion.width);
|
4709 | }
|
4710 |
|
4711 | if (newElRegion.height !== elRegion.height) {
|
4712 | _utils2['default'].css(source, 'height', _utils2['default'].height(source) + newElRegion.height - elRegion.height);
|
4713 | }
|
4714 |
|
4715 |
|
4716 |
|
4717 |
|
4718 | _utils2['default'].offset(source, {
|
4719 | left: newElRegion.left,
|
4720 | top: newElRegion.top
|
4721 | }, {
|
4722 | useCssRight: align.useCssRight,
|
4723 | useCssBottom: align.useCssBottom,
|
4724 | useCssTransform: align.useCssTransform,
|
4725 | ignoreShake: align.ignoreShake
|
4726 | });
|
4727 |
|
4728 | return {
|
4729 | points: points,
|
4730 | offset: offset,
|
4731 | targetOffset: targetOffset,
|
4732 | overflow: newOverflowCfg
|
4733 | };
|
4734 | }
|
4735 |
|
4736 | exports['default'] = doAlign;
|
4737 | |
4738 |
|
4739 |
|
4740 |
|
4741 |
|
4742 |
|
4743 |
|
4744 |
|
4745 |
|
4746 | module.exports = exports['default'];
|
4747 |
|
4748 | }),
|
4749 |
|
4750 | (function(module, exports, __webpack_require__) {
|
4751 |
|
4752 | 'use strict';
|
4753 |
|
4754 | Object.defineProperty(exports, "__esModule", {
|
4755 | value: true
|
4756 | });
|
4757 |
|
4758 | 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; };
|
4759 |
|
4760 | var _propertyUtils = __webpack_require__(54);
|
4761 |
|
4762 | var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
|
4763 |
|
4764 | var getComputedStyleX = void 0;
|
4765 |
|
4766 |
|
4767 | function forceRelayout(elem) {
|
4768 | var originalStyle = elem.style.display;
|
4769 | elem.style.display = 'none';
|
4770 | elem.offsetHeight;
|
4771 | elem.style.display = originalStyle;
|
4772 | }
|
4773 |
|
4774 | function css(el, name, v) {
|
4775 | var value = v;
|
4776 | if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
|
4777 | for (var i in name) {
|
4778 | if (name.hasOwnProperty(i)) {
|
4779 | css(el, i, name[i]);
|
4780 | }
|
4781 | }
|
4782 | return undefined;
|
4783 | }
|
4784 | if (typeof value !== 'undefined') {
|
4785 | if (typeof value === 'number') {
|
4786 | value = value + 'px';
|
4787 | }
|
4788 | el.style[name] = value;
|
4789 | return undefined;
|
4790 | }
|
4791 | return getComputedStyleX(el, name);
|
4792 | }
|
4793 |
|
4794 | function getClientPosition(elem) {
|
4795 | var box = void 0;
|
4796 | var x = void 0;
|
4797 | var y = void 0;
|
4798 | var doc = elem.ownerDocument;
|
4799 | var body = doc.body;
|
4800 | var docElem = doc && doc.documentElement;
|
4801 |
|
4802 | box = elem.getBoundingClientRect();
|
4803 |
|
4804 |
|
4805 |
|
4806 |
|
4807 |
|
4808 | x = box.left;
|
4809 | y = box.top;
|
4810 |
|
4811 |
|
4812 |
|
4813 |
|
4814 |
|
4815 |
|
4816 |
|
4817 |
|
4818 |
|
4819 |
|
4820 |
|
4821 |
|
4822 |
|
4823 |
|
4824 |
|
4825 |
|
4826 |
|
4827 |
|
4828 |
|
4829 |
|
4830 |
|
4831 | x -= docElem.clientLeft || body.clientLeft || 0;
|
4832 | y -= docElem.clientTop || body.clientTop || 0;
|
4833 |
|
4834 | return {
|
4835 | left: x,
|
4836 | top: y
|
4837 | };
|
4838 | }
|
4839 |
|
4840 | function getScroll(w, top) {
|
4841 | var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
|
4842 | var method = 'scroll' + (top ? 'Top' : 'Left');
|
4843 | if (typeof ret !== 'number') {
|
4844 | var d = w.document;
|
4845 |
|
4846 | ret = d.documentElement[method];
|
4847 | if (typeof ret !== 'number') {
|
4848 |
|
4849 | ret = d.body[method];
|
4850 | }
|
4851 | }
|
4852 | return ret;
|
4853 | }
|
4854 |
|
4855 | function getScrollLeft(w) {
|
4856 | return getScroll(w);
|
4857 | }
|
4858 |
|
4859 | function getScrollTop(w) {
|
4860 | return getScroll(w, true);
|
4861 | }
|
4862 |
|
4863 | function getOffset(el) {
|
4864 | var pos = getClientPosition(el);
|
4865 | var doc = el.ownerDocument;
|
4866 | var w = doc.defaultView || doc.parentWindow;
|
4867 | pos.left += getScrollLeft(w);
|
4868 | pos.top += getScrollTop(w);
|
4869 | return pos;
|
4870 | }
|
4871 |
|
4872 | |
4873 |
|
4874 |
|
4875 |
|
4876 | function isWindow(obj) {
|
4877 |
|
4878 |
|
4879 | return obj !== null && obj !== undefined && obj == obj.window;
|
4880 | }
|
4881 |
|
4882 | function getDocument(node) {
|
4883 | if (isWindow(node)) {
|
4884 | return node.document;
|
4885 | }
|
4886 | if (node.nodeType === 9) {
|
4887 | return node;
|
4888 | }
|
4889 | return node.ownerDocument;
|
4890 | }
|
4891 |
|
4892 | function _getComputedStyle(elem, name, cs) {
|
4893 | var computedStyle = cs;
|
4894 | var val = '';
|
4895 | var d = getDocument(elem);
|
4896 | computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null);
|
4897 |
|
4898 |
|
4899 | if (computedStyle) {
|
4900 | val = computedStyle.getPropertyValue(name) || computedStyle[name];
|
4901 | }
|
4902 |
|
4903 | return val;
|
4904 | }
|
4905 |
|
4906 | var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
|
4907 | var RE_POS = /^(top|right|bottom|left)$/;
|
4908 | var CURRENT_STYLE = 'currentStyle';
|
4909 | var RUNTIME_STYLE = 'runtimeStyle';
|
4910 | var LEFT = 'left';
|
4911 | var PX = 'px';
|
4912 |
|
4913 | function _getComputedStyleIE(elem, name) {
|
4914 |
|
4915 |
|
4916 | var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
|
4917 |
|
4918 |
|
4919 |
|
4920 |
|
4921 |
|
4922 |
|
4923 |
|
4924 |
|
4925 |
|
4926 |
|
4927 |
|
4928 | if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
|
4929 |
|
4930 | var style = elem.style;
|
4931 | var left = style[LEFT];
|
4932 | var rsLeft = elem[RUNTIME_STYLE][LEFT];
|
4933 |
|
4934 |
|
4935 | elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
|
4936 |
|
4937 |
|
4938 | style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
|
4939 | ret = style.pixelLeft + PX;
|
4940 |
|
4941 |
|
4942 | style[LEFT] = left;
|
4943 |
|
4944 | elem[RUNTIME_STYLE][LEFT] = rsLeft;
|
4945 | }
|
4946 | return ret === '' ? 'auto' : ret;
|
4947 | }
|
4948 |
|
4949 | if (typeof window !== 'undefined') {
|
4950 | getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
|
4951 | }
|
4952 |
|
4953 | function getOffsetDirection(dir, option) {
|
4954 | if (dir === 'left') {
|
4955 | return option.useCssRight ? 'right' : dir;
|
4956 | }
|
4957 | return option.useCssBottom ? 'bottom' : dir;
|
4958 | }
|
4959 |
|
4960 | function oppositeOffsetDirection(dir) {
|
4961 | if (dir === 'left') {
|
4962 | return 'right';
|
4963 | } else if (dir === 'right') {
|
4964 | return 'left';
|
4965 | } else if (dir === 'top') {
|
4966 | return 'bottom';
|
4967 | } else if (dir === 'bottom') {
|
4968 | return 'top';
|
4969 | }
|
4970 | }
|
4971 |
|
4972 |
|
4973 | function setLeftTop(elem, offset, option) {
|
4974 |
|
4975 | if (css(elem, 'position') === 'static') {
|
4976 | elem.style.position = 'relative';
|
4977 | }
|
4978 | var presetH = -999;
|
4979 | var presetV = -999;
|
4980 | var horizontalProperty = getOffsetDirection('left', option);
|
4981 | var verticalProperty = getOffsetDirection('top', option);
|
4982 | var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
|
4983 | var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);
|
4984 |
|
4985 | if (horizontalProperty !== 'left') {
|
4986 | presetH = 999;
|
4987 | }
|
4988 |
|
4989 | if (verticalProperty !== 'top') {
|
4990 | presetV = 999;
|
4991 | }
|
4992 | var originalTransition = '';
|
4993 | var originalOffset = getOffset(elem);
|
4994 | if ('left' in offset || 'top' in offset) {
|
4995 | originalTransition = (0, _propertyUtils.getTransitionProperty)(elem) || '';
|
4996 | (0, _propertyUtils.setTransitionProperty)(elem, 'none');
|
4997 | }
|
4998 | if ('left' in offset) {
|
4999 | elem.style[oppositeHorizontalProperty] = '';
|
5000 | elem.style[horizontalProperty] = presetH + 'px';
|
5001 | }
|
5002 | if ('top' in offset) {
|
5003 | elem.style[oppositeVerticalProperty] = '';
|
5004 | elem.style[verticalProperty] = presetV + 'px';
|
5005 | }
|
5006 |
|
5007 | forceRelayout(elem);
|
5008 | var old = getOffset(elem);
|
5009 | var originalStyle = {};
|
5010 | for (var key in offset) {
|
5011 | if (offset.hasOwnProperty(key)) {
|
5012 | var dir = getOffsetDirection(key, option);
|
5013 | var preset = key === 'left' ? presetH : presetV;
|
5014 | var off = originalOffset[key] - old[key];
|
5015 | if (dir === key) {
|
5016 | originalStyle[dir] = preset + off;
|
5017 | } else {
|
5018 | originalStyle[dir] = preset - off;
|
5019 | }
|
5020 | }
|
5021 | }
|
5022 | css(elem, originalStyle);
|
5023 |
|
5024 | forceRelayout(elem);
|
5025 | if ('left' in offset || 'top' in offset) {
|
5026 | (0, _propertyUtils.setTransitionProperty)(elem, originalTransition);
|
5027 | }
|
5028 | var ret = {};
|
5029 | for (var _key in offset) {
|
5030 | if (offset.hasOwnProperty(_key)) {
|
5031 | var _dir = getOffsetDirection(_key, option);
|
5032 | var _off = offset[_key] - originalOffset[_key];
|
5033 | if (_key === _dir) {
|
5034 | ret[_dir] = originalStyle[_dir] + _off;
|
5035 | } else {
|
5036 | ret[_dir] = originalStyle[_dir] - _off;
|
5037 | }
|
5038 | }
|
5039 | }
|
5040 | css(elem, ret);
|
5041 | }
|
5042 |
|
5043 | function setTransform(elem, offset) {
|
5044 | var originalOffset = getOffset(elem);
|
5045 | var originalXY = (0, _propertyUtils.getTransformXY)(elem);
|
5046 | var resultXY = { x: originalXY.x, y: originalXY.y };
|
5047 | if ('left' in offset) {
|
5048 | resultXY.x = originalXY.x + offset.left - originalOffset.left;
|
5049 | }
|
5050 | if ('top' in offset) {
|
5051 | resultXY.y = originalXY.y + offset.top - originalOffset.top;
|
5052 | }
|
5053 | (0, _propertyUtils.setTransformXY)(elem, resultXY);
|
5054 | }
|
5055 |
|
5056 | function setOffset(elem, offset, option) {
|
5057 | if (option.ignoreShake) {
|
5058 | var oriOffset = getOffset(elem);
|
5059 |
|
5060 | var oLeft = oriOffset.left.toFixed(0);
|
5061 | var oTop = oriOffset.top.toFixed(0);
|
5062 | var tLeft = offset.left.toFixed(0);
|
5063 | var tTop = offset.top.toFixed(0);
|
5064 |
|
5065 | if (oLeft === tLeft && oTop === tTop) {
|
5066 | return;
|
5067 | }
|
5068 | }
|
5069 |
|
5070 | if (option.useCssRight || option.useCssBottom) {
|
5071 | setLeftTop(elem, offset, option);
|
5072 | } else if (option.useCssTransform && (0, _propertyUtils.getTransformName)() in document.body.style) {
|
5073 | setTransform(elem, offset, option);
|
5074 | } else {
|
5075 | setLeftTop(elem, offset, option);
|
5076 | }
|
5077 | }
|
5078 |
|
5079 | function each(arr, fn) {
|
5080 | for (var i = 0; i < arr.length; i++) {
|
5081 | fn(arr[i]);
|
5082 | }
|
5083 | }
|
5084 |
|
5085 | function isBorderBoxFn(elem) {
|
5086 | return getComputedStyleX(elem, 'boxSizing') === 'border-box';
|
5087 | }
|
5088 |
|
5089 | var BOX_MODELS = ['margin', 'border', 'padding'];
|
5090 | var CONTENT_INDEX = -1;
|
5091 | var PADDING_INDEX = 2;
|
5092 | var BORDER_INDEX = 1;
|
5093 | var MARGIN_INDEX = 0;
|
5094 |
|
5095 | function swap(elem, options, callback) {
|
5096 | var old = {};
|
5097 | var style = elem.style;
|
5098 | var name = void 0;
|
5099 |
|
5100 |
|
5101 | for (name in options) {
|
5102 | if (options.hasOwnProperty(name)) {
|
5103 | old[name] = style[name];
|
5104 | style[name] = options[name];
|
5105 | }
|
5106 | }
|
5107 |
|
5108 | callback.call(elem);
|
5109 |
|
5110 |
|
5111 | for (name in options) {
|
5112 | if (options.hasOwnProperty(name)) {
|
5113 | style[name] = old[name];
|
5114 | }
|
5115 | }
|
5116 | }
|
5117 |
|
5118 | function getPBMWidth(elem, props, which) {
|
5119 | var value = 0;
|
5120 | var prop = void 0;
|
5121 | var j = void 0;
|
5122 | var i = void 0;
|
5123 | for (j = 0; j < props.length; j++) {
|
5124 | prop = props[j];
|
5125 | if (prop) {
|
5126 | for (i = 0; i < which.length; i++) {
|
5127 | var cssProp = void 0;
|
5128 | if (prop === 'border') {
|
5129 | cssProp = '' + prop + which[i] + 'Width';
|
5130 | } else {
|
5131 | cssProp = prop + which[i];
|
5132 | }
|
5133 | value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
|
5134 | }
|
5135 | }
|
5136 | }
|
5137 | return value;
|
5138 | }
|
5139 |
|
5140 | var domUtils = {};
|
5141 |
|
5142 | each(['Width', 'Height'], function (name) {
|
5143 | domUtils['doc' + name] = function (refWin) {
|
5144 | var d = refWin.document;
|
5145 | return Math.max(
|
5146 |
|
5147 |
|
5148 | d.documentElement['scroll' + name],
|
5149 |
|
5150 | d.body['scroll' + name], domUtils['viewport' + name](d));
|
5151 | };
|
5152 |
|
5153 | domUtils['viewport' + name] = function (win) {
|
5154 |
|
5155 | var prop = 'client' + name;
|
5156 | var doc = win.document;
|
5157 | var body = doc.body;
|
5158 | var documentElement = doc.documentElement;
|
5159 | var documentElementProp = documentElement[prop];
|
5160 |
|
5161 |
|
5162 | return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
|
5163 | };
|
5164 | });
|
5165 |
|
5166 | |
5167 |
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 |
|
5173 |
|
5174 | function getWH(elem, name, ex) {
|
5175 | var extra = ex;
|
5176 | if (isWindow(elem)) {
|
5177 | return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
|
5178 | } else if (elem.nodeType === 9) {
|
5179 | return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
|
5180 | }
|
5181 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
5182 | var borderBoxValue = name === 'width' ? elem.getBoundingClientRect().width : elem.getBoundingClientRect().height;
|
5183 | var computedStyle = getComputedStyleX(elem);
|
5184 | var isBorderBox = isBorderBoxFn(elem, computedStyle);
|
5185 | var cssBoxValue = 0;
|
5186 | if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) {
|
5187 | borderBoxValue = undefined;
|
5188 |
|
5189 | cssBoxValue = getComputedStyleX(elem, name);
|
5190 | if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) {
|
5191 | cssBoxValue = elem.style[name] || 0;
|
5192 | }
|
5193 |
|
5194 | cssBoxValue = parseFloat(cssBoxValue) || 0;
|
5195 | }
|
5196 | if (extra === undefined) {
|
5197 | extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
|
5198 | }
|
5199 | var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
|
5200 | var val = borderBoxValue || cssBoxValue;
|
5201 | if (extra === CONTENT_INDEX) {
|
5202 | if (borderBoxValueOrIsBorderBox) {
|
5203 | return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
|
5204 | }
|
5205 | return cssBoxValue;
|
5206 | } else if (borderBoxValueOrIsBorderBox) {
|
5207 | if (extra === BORDER_INDEX) {
|
5208 | return val;
|
5209 | }
|
5210 | return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle));
|
5211 | }
|
5212 | return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
|
5213 | }
|
5214 |
|
5215 | var cssShow = {
|
5216 | position: 'absolute',
|
5217 | visibility: 'hidden',
|
5218 | display: 'block'
|
5219 | };
|
5220 |
|
5221 |
|
5222 | function getWHIgnoreDisplay() {
|
5223 | for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
5224 | args[_key2] = arguments[_key2];
|
5225 | }
|
5226 |
|
5227 | var val = void 0;
|
5228 | var elem = args[0];
|
5229 |
|
5230 |
|
5231 | if (elem.offsetWidth !== 0) {
|
5232 | val = getWH.apply(undefined, args);
|
5233 | } else {
|
5234 | swap(elem, cssShow, function () {
|
5235 | val = getWH.apply(undefined, args);
|
5236 | });
|
5237 | }
|
5238 | return val;
|
5239 | }
|
5240 |
|
5241 | each(['width', 'height'], function (name) {
|
5242 | var first = name.charAt(0).toUpperCase() + name.slice(1);
|
5243 | domUtils['outer' + first] = function (el, includeMargin) {
|
5244 | return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
|
5245 | };
|
5246 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
5247 |
|
5248 | domUtils[name] = function (elem, v) {
|
5249 | var val = v;
|
5250 | if (val !== undefined) {
|
5251 | if (elem) {
|
5252 | var computedStyle = getComputedStyleX(elem);
|
5253 | var isBorderBox = isBorderBoxFn(elem);
|
5254 | if (isBorderBox) {
|
5255 | val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
|
5256 | }
|
5257 | return css(elem, name, val);
|
5258 | }
|
5259 | return undefined;
|
5260 | }
|
5261 | return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
|
5262 | };
|
5263 | });
|
5264 |
|
5265 | function mix(to, from) {
|
5266 | for (var i in from) {
|
5267 | if (from.hasOwnProperty(i)) {
|
5268 | to[i] = from[i];
|
5269 | }
|
5270 | }
|
5271 | return to;
|
5272 | }
|
5273 |
|
5274 | var utils = {
|
5275 | getWindow: function getWindow(node) {
|
5276 | if (node && node.document && node.setTimeout) {
|
5277 | return node;
|
5278 | }
|
5279 | var doc = node.ownerDocument || node;
|
5280 | return doc.defaultView || doc.parentWindow;
|
5281 | },
|
5282 |
|
5283 | getDocument: getDocument,
|
5284 | offset: function offset(el, value, option) {
|
5285 | if (typeof value !== 'undefined') {
|
5286 | setOffset(el, value, option || {});
|
5287 | } else {
|
5288 | return getOffset(el);
|
5289 | }
|
5290 | },
|
5291 |
|
5292 | isWindow: isWindow,
|
5293 | each: each,
|
5294 | css: css,
|
5295 | clone: function clone(obj) {
|
5296 | var i = void 0;
|
5297 | var ret = {};
|
5298 | for (i in obj) {
|
5299 | if (obj.hasOwnProperty(i)) {
|
5300 | ret[i] = obj[i];
|
5301 | }
|
5302 | }
|
5303 | var overflow = obj.overflow;
|
5304 | if (overflow) {
|
5305 | for (i in obj) {
|
5306 | if (obj.hasOwnProperty(i)) {
|
5307 | ret.overflow[i] = obj.overflow[i];
|
5308 | }
|
5309 | }
|
5310 | }
|
5311 | return ret;
|
5312 | },
|
5313 |
|
5314 | mix: mix,
|
5315 | getWindowScrollLeft: function getWindowScrollLeft(w) {
|
5316 | return getScrollLeft(w);
|
5317 | },
|
5318 | getWindowScrollTop: function getWindowScrollTop(w) {
|
5319 | return getScrollTop(w);
|
5320 | },
|
5321 | merge: function merge() {
|
5322 | var ret = {};
|
5323 |
|
5324 | for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
|
5325 | args[_key3] = arguments[_key3];
|
5326 | }
|
5327 |
|
5328 | for (var i = 0; i < args.length; i++) {
|
5329 | utils.mix(ret, args[i]);
|
5330 | }
|
5331 | return ret;
|
5332 | },
|
5333 |
|
5334 | viewportWidth: 0,
|
5335 | viewportHeight: 0
|
5336 | };
|
5337 |
|
5338 | mix(utils, domUtils);
|
5339 |
|
5340 | exports['default'] = utils;
|
5341 | module.exports = exports['default'];
|
5342 |
|
5343 | }),
|
5344 |
|
5345 | (function(module, exports) {
|
5346 |
|
5347 | 'use strict';
|
5348 |
|
5349 | Object.defineProperty(exports, "__esModule", {
|
5350 | value: true
|
5351 | });
|
5352 | exports.getTransformName = getTransformName;
|
5353 | exports.setTransitionProperty = setTransitionProperty;
|
5354 | exports.getTransitionProperty = getTransitionProperty;
|
5355 | exports.getTransformXY = getTransformXY;
|
5356 | exports.setTransformXY = setTransformXY;
|
5357 | var vendorPrefix = void 0;
|
5358 |
|
5359 | var jsCssMap = {
|
5360 | Webkit: '-webkit-',
|
5361 | Moz: '-moz-',
|
5362 |
|
5363 | ms: '-ms-',
|
5364 | O: '-o-'
|
5365 | };
|
5366 |
|
5367 | function getVendorPrefix() {
|
5368 | if (vendorPrefix !== undefined) {
|
5369 | return vendorPrefix;
|
5370 | }
|
5371 | vendorPrefix = '';
|
5372 | var style = document.createElement('p').style;
|
5373 | var testProp = 'Transform';
|
5374 | for (var key in jsCssMap) {
|
5375 | if (key + testProp in style) {
|
5376 | vendorPrefix = key;
|
5377 | }
|
5378 | }
|
5379 | return vendorPrefix;
|
5380 | }
|
5381 |
|
5382 | function getTransitionName() {
|
5383 | return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty';
|
5384 | }
|
5385 |
|
5386 | function getTransformName() {
|
5387 | return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform';
|
5388 | }
|
5389 |
|
5390 | function setTransitionProperty(node, value) {
|
5391 | var name = getTransitionName();
|
5392 | if (name) {
|
5393 | node.style[name] = value;
|
5394 | if (name !== 'transitionProperty') {
|
5395 | node.style.transitionProperty = value;
|
5396 | }
|
5397 | }
|
5398 | }
|
5399 |
|
5400 | function setTransform(node, value) {
|
5401 | var name = getTransformName();
|
5402 | if (name) {
|
5403 | node.style[name] = value;
|
5404 | if (name !== 'transform') {
|
5405 | node.style.transform = value;
|
5406 | }
|
5407 | }
|
5408 | }
|
5409 |
|
5410 | function getTransitionProperty(node) {
|
5411 | return node.style.transitionProperty || node.style[getTransitionName()];
|
5412 | }
|
5413 |
|
5414 | function getTransformXY(node) {
|
5415 | var style = window.getComputedStyle(node, null);
|
5416 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
5417 | if (transform && transform !== 'none') {
|
5418 | var matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
|
5419 | return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) };
|
5420 | }
|
5421 | return {
|
5422 | x: 0,
|
5423 | y: 0
|
5424 | };
|
5425 | }
|
5426 |
|
5427 | var matrix2d = /matrix\((.*)\)/;
|
5428 | var matrix3d = /matrix3d\((.*)\)/;
|
5429 |
|
5430 | function setTransformXY(node, xy) {
|
5431 | var style = window.getComputedStyle(node, null);
|
5432 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
5433 | if (transform && transform !== 'none') {
|
5434 | var arr = void 0;
|
5435 | var match2d = transform.match(matrix2d);
|
5436 | if (match2d) {
|
5437 | match2d = match2d[1];
|
5438 | arr = match2d.split(',').map(function (item) {
|
5439 | return parseFloat(item, 10);
|
5440 | });
|
5441 | arr[4] = xy.x;
|
5442 | arr[5] = xy.y;
|
5443 | setTransform(node, 'matrix(' + arr.join(',') + ')');
|
5444 | } else {
|
5445 | var match3d = transform.match(matrix3d)[1];
|
5446 | arr = match3d.split(',').map(function (item) {
|
5447 | return parseFloat(item, 10);
|
5448 | });
|
5449 | arr[12] = xy.x;
|
5450 | arr[13] = xy.y;
|
5451 | setTransform(node, 'matrix3d(' + arr.join(',') + ')');
|
5452 | }
|
5453 | } else {
|
5454 | setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)');
|
5455 | }
|
5456 | }
|
5457 |
|
5458 | }),
|
5459 |
|
5460 | (function(module, exports, __webpack_require__) {
|
5461 |
|
5462 | 'use strict';
|
5463 |
|
5464 | Object.defineProperty(exports, "__esModule", {
|
5465 | value: true
|
5466 | });
|
5467 |
|
5468 | var _utils = __webpack_require__(53);
|
5469 |
|
5470 | var _utils2 = _interopRequireDefault(_utils);
|
5471 |
|
5472 | var _getOffsetParent = __webpack_require__(56);
|
5473 |
|
5474 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
|
5475 |
|
5476 | var _isAncestorFixed = __webpack_require__(57);
|
5477 |
|
5478 | var _isAncestorFixed2 = _interopRequireDefault(_isAncestorFixed);
|
5479 |
|
5480 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5481 |
|
5482 | |
5483 |
|
5484 |
|
5485 | function getVisibleRectForElement(element) {
|
5486 | var visibleRect = {
|
5487 | left: 0,
|
5488 | right: Infinity,
|
5489 | top: 0,
|
5490 | bottom: Infinity
|
5491 | };
|
5492 | var el = (0, _getOffsetParent2['default'])(element);
|
5493 | var doc = _utils2['default'].getDocument(element);
|
5494 | var win = doc.defaultView || doc.parentWindow;
|
5495 | var body = doc.body;
|
5496 | var documentElement = doc.documentElement;
|
5497 |
|
5498 |
|
5499 |
|
5500 | while (el) {
|
5501 |
|
5502 | if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) &&
|
5503 |
|
5504 |
|
5505 |
|
5506 | el !== body && el !== documentElement && _utils2['default'].css(el, 'overflow') !== 'visible') {
|
5507 | var pos = _utils2['default'].offset(el);
|
5508 |
|
5509 | pos.left += el.clientLeft;
|
5510 | pos.top += el.clientTop;
|
5511 | visibleRect.top = Math.max(visibleRect.top, pos.top);
|
5512 | visibleRect.right = Math.min(visibleRect.right,
|
5513 |
|
5514 | pos.left + el.clientWidth);
|
5515 | visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight);
|
5516 | visibleRect.left = Math.max(visibleRect.left, pos.left);
|
5517 | } else if (el === body || el === documentElement) {
|
5518 | break;
|
5519 | }
|
5520 | el = (0, _getOffsetParent2['default'])(el);
|
5521 | }
|
5522 |
|
5523 |
|
5524 |
|
5525 |
|
5526 | var originalPosition = null;
|
5527 | if (!_utils2['default'].isWindow(element) && element.nodeType !== 9) {
|
5528 | originalPosition = element.style.position;
|
5529 | var position = _utils2['default'].css(element, 'position');
|
5530 | if (position === 'absolute') {
|
5531 | element.style.position = 'fixed';
|
5532 | }
|
5533 | }
|
5534 |
|
5535 | var scrollX = _utils2['default'].getWindowScrollLeft(win);
|
5536 | var scrollY = _utils2['default'].getWindowScrollTop(win);
|
5537 | var viewportWidth = _utils2['default'].viewportWidth(win);
|
5538 | var viewportHeight = _utils2['default'].viewportHeight(win);
|
5539 | var documentWidth = documentElement.scrollWidth;
|
5540 | var documentHeight = documentElement.scrollHeight;
|
5541 |
|
5542 |
|
5543 | if (element.style) {
|
5544 | element.style.position = originalPosition;
|
5545 | }
|
5546 |
|
5547 | if ((0, _isAncestorFixed2['default'])(element)) {
|
5548 |
|
5549 | visibleRect.left = Math.max(visibleRect.left, scrollX);
|
5550 | visibleRect.top = Math.max(visibleRect.top, scrollY);
|
5551 | visibleRect.right = Math.min(visibleRect.right, scrollX + viewportWidth);
|
5552 | visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + viewportHeight);
|
5553 | } else {
|
5554 |
|
5555 | var maxVisibleWidth = Math.max(documentWidth, scrollX + viewportWidth);
|
5556 | visibleRect.right = Math.min(visibleRect.right, maxVisibleWidth);
|
5557 |
|
5558 | var maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight);
|
5559 | visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight);
|
5560 | }
|
5561 |
|
5562 | return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;
|
5563 | }
|
5564 |
|
5565 | exports['default'] = getVisibleRectForElement;
|
5566 | module.exports = exports['default'];
|
5567 |
|
5568 | }),
|
5569 |
|
5570 | (function(module, exports, __webpack_require__) {
|
5571 |
|
5572 | 'use strict';
|
5573 |
|
5574 | Object.defineProperty(exports, "__esModule", {
|
5575 | value: true
|
5576 | });
|
5577 |
|
5578 | var _utils = __webpack_require__(53);
|
5579 |
|
5580 | var _utils2 = _interopRequireDefault(_utils);
|
5581 |
|
5582 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5583 |
|
5584 | |
5585 |
|
5586 |
|
5587 |
|
5588 | function getOffsetParent(element) {
|
5589 | if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
|
5590 | return null;
|
5591 | }
|
5592 |
|
5593 | |
5594 |
|
5595 |
|
5596 |
|
5597 |
|
5598 |
|
5599 |
|
5600 |
|
5601 |
|
5602 |
|
5603 |
|
5604 |
|
5605 |
|
5606 |
|
5607 | var doc = _utils2['default'].getDocument(element);
|
5608 | var body = doc.body;
|
5609 | var parent = void 0;
|
5610 | var positionStyle = _utils2['default'].css(element, 'position');
|
5611 | var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute';
|
5612 |
|
5613 | if (!skipStatic) {
|
5614 | return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode;
|
5615 | }
|
5616 |
|
5617 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
|
5618 | positionStyle = _utils2['default'].css(parent, 'position');
|
5619 | if (positionStyle !== 'static') {
|
5620 | return parent;
|
5621 | }
|
5622 | }
|
5623 | return null;
|
5624 | }
|
5625 |
|
5626 | exports['default'] = getOffsetParent;
|
5627 | module.exports = exports['default'];
|
5628 |
|
5629 | }),
|
5630 |
|
5631 | (function(module, exports, __webpack_require__) {
|
5632 |
|
5633 | 'use strict';
|
5634 |
|
5635 | Object.defineProperty(exports, "__esModule", {
|
5636 | value: true
|
5637 | });
|
5638 | exports['default'] = isAncestorFixed;
|
5639 |
|
5640 | var _utils = __webpack_require__(53);
|
5641 |
|
5642 | var _utils2 = _interopRequireDefault(_utils);
|
5643 |
|
5644 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5645 |
|
5646 | function isAncestorFixed(element) {
|
5647 | if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
|
5648 | return false;
|
5649 | }
|
5650 |
|
5651 | var doc = _utils2['default'].getDocument(element);
|
5652 | var body = doc.body;
|
5653 | var parent = null;
|
5654 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
|
5655 | var positionStyle = _utils2['default'].css(parent, 'position');
|
5656 | if (positionStyle === 'fixed') {
|
5657 | return true;
|
5658 | }
|
5659 | }
|
5660 | return false;
|
5661 | }
|
5662 | module.exports = exports['default'];
|
5663 |
|
5664 | }),
|
5665 |
|
5666 | (function(module, exports, __webpack_require__) {
|
5667 |
|
5668 | 'use strict';
|
5669 |
|
5670 | Object.defineProperty(exports, "__esModule", {
|
5671 | value: true
|
5672 | });
|
5673 |
|
5674 | var _utils = __webpack_require__(53);
|
5675 |
|
5676 | var _utils2 = _interopRequireDefault(_utils);
|
5677 |
|
5678 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5679 |
|
5680 | function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {
|
5681 | var pos = _utils2['default'].clone(elFuturePos);
|
5682 | var size = {
|
5683 | width: elRegion.width,
|
5684 | height: elRegion.height
|
5685 | };
|
5686 |
|
5687 | if (overflow.adjustX && pos.left < visibleRect.left) {
|
5688 | pos.left = visibleRect.left;
|
5689 | }
|
5690 |
|
5691 |
|
5692 | if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) {
|
5693 | size.width -= pos.left + size.width - visibleRect.right;
|
5694 | }
|
5695 |
|
5696 |
|
5697 | if (overflow.adjustX && pos.left + size.width > visibleRect.right) {
|
5698 |
|
5699 | pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);
|
5700 | }
|
5701 |
|
5702 |
|
5703 | if (overflow.adjustY && pos.top < visibleRect.top) {
|
5704 | pos.top = visibleRect.top;
|
5705 | }
|
5706 |
|
5707 |
|
5708 | if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) {
|
5709 | size.height -= pos.top + size.height - visibleRect.bottom;
|
5710 | }
|
5711 |
|
5712 |
|
5713 | if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {
|
5714 |
|
5715 | pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);
|
5716 | }
|
5717 |
|
5718 | return _utils2['default'].mix(pos, size);
|
5719 | }
|
5720 |
|
5721 | exports['default'] = adjustForViewport;
|
5722 | module.exports = exports['default'];
|
5723 |
|
5724 | }),
|
5725 |
|
5726 | (function(module, exports, __webpack_require__) {
|
5727 |
|
5728 | 'use strict';
|
5729 |
|
5730 | Object.defineProperty(exports, "__esModule", {
|
5731 | value: true
|
5732 | });
|
5733 |
|
5734 | var _utils = __webpack_require__(53);
|
5735 |
|
5736 | var _utils2 = _interopRequireDefault(_utils);
|
5737 |
|
5738 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5739 |
|
5740 | function getRegion(node) {
|
5741 | var offset = void 0;
|
5742 | var w = void 0;
|
5743 | var h = void 0;
|
5744 | if (!_utils2['default'].isWindow(node) && node.nodeType !== 9) {
|
5745 | offset = _utils2['default'].offset(node);
|
5746 | w = _utils2['default'].outerWidth(node);
|
5747 | h = _utils2['default'].outerHeight(node);
|
5748 | } else {
|
5749 | var win = _utils2['default'].getWindow(node);
|
5750 | offset = {
|
5751 | left: _utils2['default'].getWindowScrollLeft(win),
|
5752 | top: _utils2['default'].getWindowScrollTop(win)
|
5753 | };
|
5754 | w = _utils2['default'].viewportWidth(win);
|
5755 | h = _utils2['default'].viewportHeight(win);
|
5756 | }
|
5757 | offset.width = w;
|
5758 | offset.height = h;
|
5759 | return offset;
|
5760 | }
|
5761 |
|
5762 | exports['default'] = getRegion;
|
5763 | module.exports = exports['default'];
|
5764 |
|
5765 | }),
|
5766 |
|
5767 | (function(module, exports, __webpack_require__) {
|
5768 |
|
5769 | 'use strict';
|
5770 |
|
5771 | Object.defineProperty(exports, "__esModule", {
|
5772 | value: true
|
5773 | });
|
5774 |
|
5775 | var _getAlignOffset = __webpack_require__(61);
|
5776 |
|
5777 | var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset);
|
5778 |
|
5779 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5780 |
|
5781 | function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {
|
5782 | var p1 = (0, _getAlignOffset2['default'])(refNodeRegion, points[1]);
|
5783 | var p2 = (0, _getAlignOffset2['default'])(elRegion, points[0]);
|
5784 | var diff = [p2.left - p1.left, p2.top - p1.top];
|
5785 |
|
5786 | return {
|
5787 | left: elRegion.left - diff[0] + offset[0] - targetOffset[0],
|
5788 | top: elRegion.top - diff[1] + offset[1] - targetOffset[1]
|
5789 | };
|
5790 | }
|
5791 |
|
5792 | exports['default'] = getElFuturePos;
|
5793 | module.exports = exports['default'];
|
5794 |
|
5795 | }),
|
5796 |
|
5797 | (function(module, exports) {
|
5798 |
|
5799 | 'use strict';
|
5800 |
|
5801 | Object.defineProperty(exports, "__esModule", {
|
5802 | value: true
|
5803 | });
|
5804 | |
5805 |
|
5806 |
|
5807 |
|
5808 | function getAlignOffset(region, align) {
|
5809 | var V = align.charAt(0);
|
5810 | var H = align.charAt(1);
|
5811 | var w = region.width;
|
5812 | var h = region.height;
|
5813 |
|
5814 | var x = region.left;
|
5815 | var y = region.top;
|
5816 |
|
5817 | if (V === 'c') {
|
5818 | y += h / 2;
|
5819 | } else if (V === 'b') {
|
5820 | y += h;
|
5821 | }
|
5822 |
|
5823 | if (H === 'c') {
|
5824 | x += w / 2;
|
5825 | } else if (H === 'r') {
|
5826 | x += w;
|
5827 | }
|
5828 |
|
5829 | return {
|
5830 | left: x,
|
5831 | top: y
|
5832 | };
|
5833 | }
|
5834 |
|
5835 | exports['default'] = getAlignOffset;
|
5836 | module.exports = exports['default'];
|
5837 |
|
5838 | }),
|
5839 |
|
5840 | (function(module, exports, __webpack_require__) {
|
5841 |
|
5842 | 'use strict';
|
5843 |
|
5844 | Object.defineProperty(exports, "__esModule", {
|
5845 | value: true
|
5846 | });
|
5847 |
|
5848 | 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; };
|
5849 |
|
5850 | var _utils = __webpack_require__(53);
|
5851 |
|
5852 | var _utils2 = _interopRequireDefault(_utils);
|
5853 |
|
5854 | var _align = __webpack_require__(52);
|
5855 |
|
5856 | var _align2 = _interopRequireDefault(_align);
|
5857 |
|
5858 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5859 |
|
5860 | |
5861 |
|
5862 |
|
5863 |
|
5864 |
|
5865 | function alignPoint(el, tgtPoint, align) {
|
5866 | var pageX = void 0;
|
5867 | var pageY = void 0;
|
5868 |
|
5869 | var doc = _utils2['default'].getDocument(el);
|
5870 | var win = doc.defaultView || doc.parentWindow;
|
5871 |
|
5872 | var scrollX = _utils2['default'].getWindowScrollLeft(win);
|
5873 | var scrollY = _utils2['default'].getWindowScrollTop(win);
|
5874 | var viewportWidth = _utils2['default'].viewportWidth(win);
|
5875 | var viewportHeight = _utils2['default'].viewportHeight(win);
|
5876 |
|
5877 | if ('pageX' in tgtPoint) {
|
5878 | pageX = tgtPoint.pageX;
|
5879 | } else {
|
5880 | pageX = scrollX + tgtPoint.clientX;
|
5881 | }
|
5882 |
|
5883 | if ('pageY' in tgtPoint) {
|
5884 | pageY = tgtPoint.pageY;
|
5885 | } else {
|
5886 | pageY = scrollY + tgtPoint.clientY;
|
5887 | }
|
5888 |
|
5889 | var tgtRegion = {
|
5890 | left: pageX,
|
5891 | top: pageY,
|
5892 | width: 0,
|
5893 | height: 0
|
5894 | };
|
5895 |
|
5896 | var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight;
|
5897 |
|
5898 |
|
5899 | var points = [align.points[0], 'cc'];
|
5900 |
|
5901 | return (0, _align2['default'])(el, tgtRegion, _extends({}, align, { points: points }), pointInView);
|
5902 | }
|
5903 |
|
5904 | exports['default'] = alignPoint;
|
5905 | module.exports = exports['default'];
|
5906 |
|
5907 | }),
|
5908 |
|
5909 | (function(module, exports, __webpack_require__) {
|
5910 |
|
5911 | 'use strict';
|
5912 |
|
5913 | Object.defineProperty(exports, "__esModule", {
|
5914 | value: true
|
5915 | });
|
5916 |
|
5917 | 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; };
|
5918 |
|
5919 | var _classnames = __webpack_require__(3);
|
5920 |
|
5921 | var _classnames2 = _interopRequireDefault(_classnames);
|
5922 |
|
5923 | var _react = __webpack_require__(4);
|
5924 |
|
5925 | var _react2 = _interopRequireDefault(_react);
|
5926 |
|
5927 | var _propTypes = __webpack_require__(5);
|
5928 |
|
5929 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
5930 |
|
5931 | var _Transition = __webpack_require__(11);
|
5932 |
|
5933 | var _Transition2 = _interopRequireDefault(_Transition);
|
5934 |
|
5935 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
5936 |
|
5937 | 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; }
|
5938 |
|
5939 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
5940 |
|
5941 | 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; }
|
5942 |
|
5943 | 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); }
|
5944 |
|
5945 | var propTypes = {
|
5946 | |
5947 |
|
5948 |
|
5949 | "in": _propTypes2["default"].bool,
|
5950 |
|
5951 | |
5952 |
|
5953 |
|
5954 | unmountOnExit: _propTypes2["default"].bool,
|
5955 |
|
5956 | |
5957 |
|
5958 |
|
5959 |
|
5960 | transitionAppear: _propTypes2["default"].bool,
|
5961 |
|
5962 | |
5963 |
|
5964 |
|
5965 |
|
5966 |
|
5967 | timeout: _propTypes2["default"].number,
|
5968 |
|
5969 | |
5970 |
|
5971 |
|
5972 | onEnter: _propTypes2["default"].func,
|
5973 | |
5974 |
|
5975 |
|
5976 | onEntering: _propTypes2["default"].func,
|
5977 | |
5978 |
|
5979 |
|
5980 | onEntered: _propTypes2["default"].func,
|
5981 | |
5982 |
|
5983 |
|
5984 | onExit: _propTypes2["default"].func,
|
5985 | |
5986 |
|
5987 |
|
5988 | onExiting: _propTypes2["default"].func,
|
5989 | |
5990 |
|
5991 |
|
5992 | onExited: _propTypes2["default"].func
|
5993 | };
|
5994 |
|
5995 | var defaultProps = {
|
5996 | "in": false,
|
5997 | timeout: 300,
|
5998 | unmountOnExit: false,
|
5999 | transitionAppear: false
|
6000 | };
|
6001 |
|
6002 | var Fade = function (_React$Component) {
|
6003 | _inherits(Fade, _React$Component);
|
6004 |
|
6005 | function Fade() {
|
6006 | _classCallCheck(this, Fade);
|
6007 |
|
6008 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
6009 | }
|
6010 |
|
6011 | Fade.prototype.render = function render() {
|
6012 | return _react2["default"].createElement(_Transition2["default"], _extends({}, this.props, {
|
6013 | className: (0, _classnames2["default"])(this.props.className, 'fade'),
|
6014 | enteredClassName: 'in',
|
6015 | enteringClassName: 'in'
|
6016 | }));
|
6017 | };
|
6018 |
|
6019 | return Fade;
|
6020 | }(_react2["default"].Component);
|
6021 |
|
6022 | Fade.propTypes = propTypes;
|
6023 | Fade.defaultProps = defaultProps;
|
6024 |
|
6025 | exports["default"] = Fade;
|
6026 | module.exports = exports['default'];
|
6027 |
|
6028 | }),
|
6029 |
|
6030 | (function(module, exports, __webpack_require__) {
|
6031 |
|
6032 | 'use strict';
|
6033 |
|
6034 | Object.defineProperty(exports, "__esModule", {
|
6035 | value: true
|
6036 | });
|
6037 |
|
6038 | var _Message = __webpack_require__(65);
|
6039 |
|
6040 | var _Message2 = _interopRequireDefault(_Message);
|
6041 |
|
6042 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6043 |
|
6044 | exports["default"] = _Message2["default"];
|
6045 | module.exports = exports['default'];
|
6046 |
|
6047 | }),
|
6048 |
|
6049 | (function(module, exports, __webpack_require__) {
|
6050 |
|
6051 | 'use strict';
|
6052 |
|
6053 | Object.defineProperty(exports, "__esModule", {
|
6054 | value: true
|
6055 | });
|
6056 |
|
6057 | 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; };
|
6058 |
|
6059 | 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; };
|
6060 |
|
6061 | var _react = __webpack_require__(4);
|
6062 |
|
6063 | var _react2 = _interopRequireDefault(_react);
|
6064 |
|
6065 | var _beeNotification = __webpack_require__(66);
|
6066 |
|
6067 | var _beeNotification2 = _interopRequireDefault(_beeNotification);
|
6068 |
|
6069 | var _classnames = __webpack_require__(3);
|
6070 |
|
6071 | var _classnames2 = _interopRequireDefault(_classnames);
|
6072 |
|
6073 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6074 |
|
6075 | var defaultDuration = 1.5;
|
6076 | var defaultTop = 0;
|
6077 | var defaultBottom = 48;
|
6078 | var bottom = 90;
|
6079 | var padding = 30;
|
6080 | var width = 200;
|
6081 | var messageInstance = void 0;
|
6082 | var key = 1;
|
6083 | var clsPrefix = 'u-message';
|
6084 | var noop = function noop() {};
|
6085 |
|
6086 | var positionObj = {
|
6087 | "top": {
|
6088 | messageStyle: {
|
6089 | width: "100%"
|
6090 | },
|
6091 | notificationStyle: {
|
6092 | top: defaultTop,
|
6093 | width: "100%"
|
6094 | },
|
6095 | transitionName: 'top'
|
6096 | },
|
6097 | "bottom": {
|
6098 | messageStyle: {
|
6099 | width: "100%"
|
6100 | },
|
6101 | notificationStyle: {
|
6102 | bottom: defaultBottom,
|
6103 | width: "100%"
|
6104 | },
|
6105 | transitionName: 'bottom'
|
6106 | },
|
6107 | "topRight": {
|
6108 | messageStyle: {
|
6109 | width: width
|
6110 | },
|
6111 | notificationStyle: {
|
6112 | top: padding,
|
6113 | right: padding,
|
6114 | width: width
|
6115 | },
|
6116 | transitionName: 'right'
|
6117 | },
|
6118 | "bottomRight": {
|
6119 | messageStyle: {
|
6120 | width: width
|
6121 | },
|
6122 | notificationStyle: {
|
6123 | bottom: bottom,
|
6124 | right: padding,
|
6125 | width: width
|
6126 | },
|
6127 | transitionName: 'right'
|
6128 | },
|
6129 | "topLeft": {
|
6130 | messageStyle: {
|
6131 | width: width
|
6132 | },
|
6133 | notificationStyle: {
|
6134 | top: padding,
|
6135 | left: padding,
|
6136 | width: width
|
6137 | },
|
6138 | transitionName: 'left'
|
6139 | },
|
6140 | "bottomLeft": {
|
6141 | messageStyle: {
|
6142 | width: width
|
6143 | },
|
6144 | notificationStyle: {
|
6145 | bottom: bottom,
|
6146 | left: padding,
|
6147 | width: width
|
6148 | },
|
6149 | transitionName: 'left'
|
6150 | }
|
6151 | };
|
6152 |
|
6153 | function getMessageInstance() {
|
6154 | var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'top';
|
6155 | var callback = arguments[1];
|
6156 |
|
6157 | if (messageInstance) {
|
6158 | callback(messageInstance);
|
6159 | return;
|
6160 | }
|
6161 | var style = positionObj[position].notificationStyle;
|
6162 | _beeNotification2["default"].newInstance({
|
6163 | clsPrefix: clsPrefix,
|
6164 | transitionName: clsPrefix + '-' + positionObj[position].transitionName,
|
6165 | style: style,
|
6166 | position: ''
|
6167 | }, function (instance) {
|
6168 | messageInstance = instance;
|
6169 | callback(instance);
|
6170 | });
|
6171 | }
|
6172 |
|
6173 | function notice(content, duration, type, onClose, position, style) {
|
6174 | var iconType = {
|
6175 | info: 'uf uf-i-c-2',
|
6176 | success: 'uf uf-correct',
|
6177 | danger: 'uf uf-close-c',
|
6178 | warning: 'uf uf-exc-t',
|
6179 | light: 'uf uf-notification',
|
6180 | dark: 'uf uf-bubble',
|
6181 | news: 'uf uf-bell',
|
6182 | infolight: 'uf uf-i-c-2',
|
6183 | successlight: 'uf uf-correct',
|
6184 | dangerlight: 'uf uf-close-c',
|
6185 | warninglight: 'uf uf-exc-t'
|
6186 | }[type];
|
6187 |
|
6188 | var positionStyle = positionObj[position].messageStyle;
|
6189 |
|
6190 | getMessageInstance(position, function (instance) {
|
6191 | instance.notice({
|
6192 | key: key,
|
6193 | duration: duration,
|
6194 | color: type,
|
6195 | style: _extends({}, positionStyle, style),
|
6196 | content: _react2["default"].createElement(
|
6197 | 'div',
|
6198 | null,
|
6199 | _react2["default"].createElement(
|
6200 | 'div',
|
6201 | { className: clsPrefix + '-notice-description-icon' },
|
6202 | _react2["default"].createElement('i', { className: (0, _classnames2["default"])(iconType) })
|
6203 | ),
|
6204 | _react2["default"].createElement(
|
6205 | 'div',
|
6206 | { className: clsPrefix + '-notice-description-content' },
|
6207 | content
|
6208 | )
|
6209 | ),
|
6210 | onClose: onClose
|
6211 | });
|
6212 | });
|
6213 | return function () {
|
6214 | var target = key++;
|
6215 | return function () {
|
6216 | if (messageInstance) {
|
6217 | messageInstance.removeNotice(target);
|
6218 | }
|
6219 | };
|
6220 | }();
|
6221 | }
|
6222 |
|
6223 | exports["default"] = {
|
6224 | create: function create(obj) {
|
6225 | var content = obj.content || '';
|
6226 | var duration = _typeof(obj.duration) == undefined ? defaultDuration : obj.duration;
|
6227 | var color = obj.color || 'dark';
|
6228 | var onClose = obj.onClose || noop;
|
6229 | var position = obj.position || "top";
|
6230 | var style = obj.style || {};
|
6231 | return notice(content, duration, color, onClose, position, style);
|
6232 | },
|
6233 | config: function config(options) {
|
6234 | if (options.top !== undefined) {
|
6235 | defaultTop = options.top;
|
6236 | }
|
6237 | if (options.duration !== undefined) {
|
6238 | defaultDuration = options.duration;
|
6239 | }
|
6240 | if (options.clsPrefix !== undefined) {
|
6241 | clsPrefix = options.clsPrefix;
|
6242 | }
|
6243 | if (options.defaultBottom !== undefined) {
|
6244 | defaultBottom = options.defaultBottom;
|
6245 | }
|
6246 | if (options.bottom !== undefined) {
|
6247 | bottom = options.bottom;
|
6248 | }
|
6249 | if (options.width !== undefined) {
|
6250 | bottom = options.width;
|
6251 | }
|
6252 | },
|
6253 | destroy: function destroy() {
|
6254 | if (messageInstance) {
|
6255 | messageInstance.destroy();
|
6256 | messageInstance = null;
|
6257 | }
|
6258 | }
|
6259 | };
|
6260 | module.exports = exports['default'];
|
6261 |
|
6262 | }),
|
6263 |
|
6264 | (function(module, exports, __webpack_require__) {
|
6265 |
|
6266 | 'use strict';
|
6267 |
|
6268 | Object.defineProperty(exports, "__esModule", {
|
6269 | value: true
|
6270 | });
|
6271 |
|
6272 | var _Notification = __webpack_require__(67);
|
6273 |
|
6274 | var _Notification2 = _interopRequireDefault(_Notification);
|
6275 |
|
6276 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6277 |
|
6278 | exports["default"] = _Notification2["default"];
|
6279 | module.exports = exports['default'];
|
6280 |
|
6281 | }),
|
6282 |
|
6283 | (function(module, exports, __webpack_require__) {
|
6284 |
|
6285 | 'use strict';
|
6286 |
|
6287 | Object.defineProperty(exports, "__esModule", {
|
6288 | value: true
|
6289 | });
|
6290 |
|
6291 | 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; };
|
6292 |
|
6293 | var _react = __webpack_require__(4);
|
6294 |
|
6295 | var _react2 = _interopRequireDefault(_react);
|
6296 |
|
6297 | var _propTypes = __webpack_require__(5);
|
6298 |
|
6299 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6300 |
|
6301 | var _reactDom = __webpack_require__(12);
|
6302 |
|
6303 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
6304 |
|
6305 | var _beeAnimate = __webpack_require__(68);
|
6306 |
|
6307 | var _beeAnimate2 = _interopRequireDefault(_beeAnimate);
|
6308 |
|
6309 | var _createChainedFunction = __webpack_require__(36);
|
6310 |
|
6311 | var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
|
6312 |
|
6313 | var _classnames = __webpack_require__(3);
|
6314 |
|
6315 | var _classnames2 = _interopRequireDefault(_classnames);
|
6316 |
|
6317 | var _Notice = __webpack_require__(73);
|
6318 |
|
6319 | var _Notice2 = _interopRequireDefault(_Notice);
|
6320 |
|
6321 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6322 |
|
6323 | 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; }
|
6324 |
|
6325 | 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; }
|
6326 |
|
6327 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6328 |
|
6329 | 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; }
|
6330 |
|
6331 | 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); }
|
6332 |
|
6333 | var seed = 0;
|
6334 | var now = Date.now();
|
6335 |
|
6336 | function getUuid() {
|
6337 | return 'uNotification_' + now + '_' + seed++;
|
6338 | }
|
6339 |
|
6340 | var propTypes = {
|
6341 | show: _propTypes2["default"].bool,
|
6342 | clsPrefix: _propTypes2["default"].string,
|
6343 | style: _propTypes2["default"].object,
|
6344 | position: _propTypes2["default"].oneOf(['topRight', 'bottomRight', '']),
|
6345 | transitionName: _propTypes2["default"].string,
|
6346 | animation: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object])
|
6347 | };
|
6348 |
|
6349 | var defaultProps = {
|
6350 | clsPrefix: 'u-notification',
|
6351 | animation: 'fade',
|
6352 | position: 'topRight'
|
6353 | };
|
6354 |
|
6355 | var Notification = function (_Component) {
|
6356 | _inherits(Notification, _Component);
|
6357 |
|
6358 | function Notification(props) {
|
6359 | _classCallCheck(this, Notification);
|
6360 |
|
6361 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
6362 |
|
6363 | _this.state = {
|
6364 | notices: []
|
6365 | };
|
6366 | _this.add = _this.add.bind(_this);
|
6367 | _this.remove = _this.remove.bind(_this);
|
6368 |
|
6369 | return _this;
|
6370 | }
|
6371 |
|
6372 | Notification.prototype.getTransitionName = function getTransitionName() {
|
6373 | var props = this.props;
|
6374 | var transitionName = props.transitionName;
|
6375 | if (!transitionName && props.animation) {
|
6376 | transitionName = props.clsPrefix + '-' + props.animation;
|
6377 | }
|
6378 | return transitionName;
|
6379 | };
|
6380 |
|
6381 | Notification.prototype.add = function add(notice) {
|
6382 | var key = notice.key = notice.key || getUuid();
|
6383 | this.setState(function (previousState) {
|
6384 | var notices = previousState.notices;
|
6385 | if (!notices.filter(function (v) {
|
6386 | return v.key === key;
|
6387 | }).length) {
|
6388 | return {
|
6389 | notices: notices.concat(notice)
|
6390 | };
|
6391 | }
|
6392 | });
|
6393 | };
|
6394 |
|
6395 | Notification.prototype.remove = function remove(key) {
|
6396 | this.setState(function (previousState) {
|
6397 | return {
|
6398 | notices: previousState.notices.filter(function (notice) {
|
6399 | return notice.key !== key;
|
6400 | })
|
6401 | };
|
6402 | });
|
6403 | };
|
6404 |
|
6405 | Notification.prototype.render = function render() {
|
6406 | var _this2 = this,
|
6407 | _classes;
|
6408 |
|
6409 | var _props = this.props,
|
6410 | clsPrefix = _props.clsPrefix,
|
6411 | className = _props.className,
|
6412 | position = _props.position,
|
6413 | style = _props.style;
|
6414 |
|
6415 | var noticeNodes = this.state.notices.map(function (notice) {
|
6416 | var onClose = (0, _createChainedFunction2["default"])(_this2.remove.bind(_this2, notice.key), notice.onClose);
|
6417 | return _react2["default"].createElement(
|
6418 | _Notice2["default"],
|
6419 | _extends({
|
6420 | clsPrefix: clsPrefix
|
6421 | }, notice, {
|
6422 | onClose: onClose
|
6423 | }),
|
6424 | notice.content
|
6425 | );
|
6426 | });
|
6427 | var classes = (_classes = {}, _defineProperty(_classes, clsPrefix, 1), _defineProperty(_classes, className, !!className), _classes);
|
6428 | if (position) {
|
6429 | classes[clsPrefix + '-' + position] = !!position;
|
6430 | }
|
6431 |
|
6432 | return _react2["default"].createElement(
|
6433 | 'div',
|
6434 | { className: (0, _classnames2["default"])(className, classes), style: style },
|
6435 | _react2["default"].createElement(
|
6436 | _beeAnimate2["default"],
|
6437 | { transitionName: this.getTransitionName() },
|
6438 | noticeNodes
|
6439 | )
|
6440 | );
|
6441 | };
|
6442 |
|
6443 | return Notification;
|
6444 | }(_react.Component);
|
6445 |
|
6446 | ;
|
6447 |
|
6448 | Notification.propTypes = propTypes;
|
6449 | Notification.defaultProps = defaultProps;
|
6450 |
|
6451 | Notification.newInstance = function newNotificationInstance(properties, callback) {
|
6452 | var props = properties || {};
|
6453 | var div = document.createElement('div');
|
6454 | document.body.appendChild(div);
|
6455 |
|
6456 | var called = false;
|
6457 | function ref(notification) {
|
6458 | if (called) {
|
6459 | return;
|
6460 | }
|
6461 | called = true;
|
6462 | callback({
|
6463 | notice: function notice(noticeProps) {
|
6464 | notification.add(noticeProps);
|
6465 | },
|
6466 | removeNotice: function removeNotice(key) {
|
6467 | notification.remove(key);
|
6468 | },
|
6469 |
|
6470 | component: notification,
|
6471 | destroy: function destroy() {
|
6472 | _reactDom2["default"].unmountComponentAtNode(div);
|
6473 | document.body.removeChild(div);
|
6474 | }
|
6475 | });
|
6476 | }
|
6477 | _reactDom2["default"].render(_react2["default"].createElement(Notification, _extends({}, props, { ref: ref })), div);
|
6478 | };
|
6479 |
|
6480 | exports["default"] = Notification;
|
6481 | module.exports = exports['default'];
|
6482 |
|
6483 | }),
|
6484 |
|
6485 | (function(module, exports, __webpack_require__) {
|
6486 |
|
6487 | 'use strict';
|
6488 |
|
6489 | Object.defineProperty(exports, "__esModule", {
|
6490 | value: true
|
6491 | });
|
6492 |
|
6493 | var _Animate = __webpack_require__(69);
|
6494 |
|
6495 | var _Animate2 = _interopRequireDefault(_Animate);
|
6496 |
|
6497 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6498 |
|
6499 | exports["default"] = _Animate2["default"];
|
6500 | module.exports = exports['default'];
|
6501 |
|
6502 | }),
|
6503 |
|
6504 | (function(module, exports, __webpack_require__) {
|
6505 |
|
6506 | 'use strict';
|
6507 |
|
6508 | Object.defineProperty(exports, "__esModule", {
|
6509 | value: true
|
6510 | });
|
6511 |
|
6512 | var _react = __webpack_require__(4);
|
6513 |
|
6514 | var _react2 = _interopRequireDefault(_react);
|
6515 |
|
6516 | var _propTypes = __webpack_require__(5);
|
6517 |
|
6518 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6519 |
|
6520 | var _ChildrenUtils = __webpack_require__(70);
|
6521 |
|
6522 | var _AnimateChild = __webpack_require__(71);
|
6523 |
|
6524 | var _AnimateChild2 = _interopRequireDefault(_AnimateChild);
|
6525 |
|
6526 | var _util = __webpack_require__(72);
|
6527 |
|
6528 | var _util2 = _interopRequireDefault(_util);
|
6529 |
|
6530 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6531 |
|
6532 | 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; }
|
6533 |
|
6534 | 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; }
|
6535 |
|
6536 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6537 |
|
6538 | 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; }
|
6539 |
|
6540 | 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); }
|
6541 |
|
6542 | var defaultKey = 'u_animate_' + Date.now();
|
6543 |
|
6544 |
|
6545 | function getChildrenFromProps(props) {
|
6546 | var children = props.children;
|
6547 | if (_react2["default"].isValidElement(children)) {
|
6548 | if (!children.key) {
|
6549 | return _react2["default"].cloneElement(children, {
|
6550 | key: defaultKey
|
6551 | });
|
6552 | }
|
6553 | }
|
6554 | return children;
|
6555 | }
|
6556 |
|
6557 | function noop() {}
|
6558 |
|
6559 | var propTypes = {
|
6560 | component: _propTypes2["default"].any,
|
6561 | animation: _propTypes2["default"].object,
|
6562 | transitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
|
6563 | transitionEnter: _propTypes2["default"].bool,
|
6564 | transitionAppear: _propTypes2["default"].bool,
|
6565 | exclusive: _propTypes2["default"].bool,
|
6566 | transitionLeave: _propTypes2["default"].bool,
|
6567 | onEnd: _propTypes2["default"].func,
|
6568 | onEnter: _propTypes2["default"].func,
|
6569 | onLeave: _propTypes2["default"].func,
|
6570 | onAppear: _propTypes2["default"].func,
|
6571 | showProp: _propTypes2["default"].string
|
6572 | };
|
6573 |
|
6574 | var defaultProps = {
|
6575 | animation: {},
|
6576 | component: 'span',
|
6577 | transitionEnter: true,
|
6578 | transitionLeave: true,
|
6579 | transitionAppear: false,
|
6580 | onEnd: noop,
|
6581 | onEnter: noop,
|
6582 | onLeave: noop,
|
6583 | onAppear: noop
|
6584 | };
|
6585 |
|
6586 | var Animate = function (_Component) {
|
6587 | _inherits(Animate, _Component);
|
6588 |
|
6589 | function Animate(props) {
|
6590 | _classCallCheck(this, Animate);
|
6591 |
|
6592 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
6593 |
|
6594 | _this.currentlyAnimatingKeys = {};
|
6595 | _this.keysToEnter = [];
|
6596 | _this.keysToLeave = [];
|
6597 | _this.state = {
|
6598 | children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(_this.props))
|
6599 | };
|
6600 |
|
6601 | _this.performEnter = _this.performEnter.bind(_this);
|
6602 | _this.performAppear = _this.performAppear.bind(_this);
|
6603 | _this.handleDoneAdding = _this.handleDoneAdding.bind(_this);
|
6604 | _this.performLeave = _this.performLeave.bind(_this);
|
6605 |
|
6606 | _this.performLeave = _this.performLeave.bind(_this);
|
6607 | _this.handleDoneLeaving = _this.handleDoneLeaving.bind(_this);
|
6608 | _this.isValidChildByKey = _this.isValidChildByKey.bind(_this);
|
6609 | _this.stop = _this.stop.bind(_this);
|
6610 | return _this;
|
6611 | }
|
6612 |
|
6613 | Animate.prototype.componentDidMount = function componentDidMount() {
|
6614 | var _this2 = this;
|
6615 |
|
6616 | this.mounted = true;
|
6617 | var showProp = this.props.showProp;
|
6618 | var children = this.state.children;
|
6619 | if (showProp) {
|
6620 | children = children.filter(function (child) {
|
6621 | return !!child.props[showProp];
|
6622 | });
|
6623 | }
|
6624 | children.forEach(function (child) {
|
6625 | if (child) {
|
6626 | _this2.performAppear(child.key);
|
6627 | }
|
6628 | });
|
6629 | };
|
6630 |
|
6631 | Animate.prototype.componentWillUnmount = function componentWillUnmount() {
|
6632 | this.mounted = false;
|
6633 | };
|
6634 |
|
6635 | Animate.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
6636 | var _this3 = this;
|
6637 |
|
6638 | this.nextProps = nextProps;
|
6639 | var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps));
|
6640 | var props = this.props;
|
6641 |
|
6642 | if (props.exclusive) {
|
6643 | Object.keys(this.currentlyAnimatingKeys).forEach(function (key) {
|
6644 | _this3.stop(key);
|
6645 | });
|
6646 | }
|
6647 | var showProp = props.showProp;
|
6648 | var currentlyAnimatingKeys = this.currentlyAnimatingKeys;
|
6649 |
|
6650 | var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children;
|
6651 |
|
6652 | var newChildren = [];
|
6653 | if (showProp) {
|
6654 | currentChildren.forEach(function (currentChild) {
|
6655 | var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key);
|
6656 | var newChild = void 0;
|
6657 | if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) {
|
6658 | newChild = _react2["default"].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true));
|
6659 | } else {
|
6660 | newChild = nextChild;
|
6661 | }
|
6662 | if (newChild) {
|
6663 | newChildren.push(newChild);
|
6664 | }
|
6665 | });
|
6666 | nextChildren.forEach(function (nextChild) {
|
6667 | if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) {
|
6668 | newChildren.push(nextChild);
|
6669 | }
|
6670 | });
|
6671 | } else {
|
6672 | newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren);
|
6673 | }
|
6674 |
|
6675 |
|
6676 | this.setState({
|
6677 | children: newChildren
|
6678 | });
|
6679 |
|
6680 | nextChildren.forEach(function (child) {
|
6681 | var key = child && child.key;
|
6682 | if (child && currentlyAnimatingKeys[key]) {
|
6683 | return;
|
6684 | }
|
6685 | var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
6686 | if (showProp) {
|
6687 | var showInNext = child.props[showProp];
|
6688 | if (hasPrev) {
|
6689 | var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
6690 | if (!showInNow && showInNext) {
|
6691 | _this3.keysToEnter.push(key);
|
6692 | }
|
6693 | } else if (showInNext) {
|
6694 | _this3.keysToEnter.push(key);
|
6695 | }
|
6696 | } else if (!hasPrev) {
|
6697 | _this3.keysToEnter.push(key);
|
6698 | }
|
6699 | });
|
6700 |
|
6701 | currentChildren.forEach(function (child) {
|
6702 | var key = child && child.key;
|
6703 | if (child && currentlyAnimatingKeys[key]) {
|
6704 | return;
|
6705 | }
|
6706 | var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key);
|
6707 | if (showProp) {
|
6708 | var showInNow = child.props[showProp];
|
6709 | if (hasNext) {
|
6710 | var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp);
|
6711 | if (!showInNext && showInNow) {
|
6712 | _this3.keysToLeave.push(key);
|
6713 | }
|
6714 | } else if (showInNow) {
|
6715 | _this3.keysToLeave.push(key);
|
6716 | }
|
6717 | } else if (!hasNext) {
|
6718 | _this3.keysToLeave.push(key);
|
6719 | }
|
6720 | });
|
6721 | };
|
6722 |
|
6723 | Animate.prototype.componentDidUpdate = function componentDidUpdate() {
|
6724 | var keysToEnter = this.keysToEnter;
|
6725 | this.keysToEnter = [];
|
6726 | keysToEnter.forEach(this.performEnter);
|
6727 | var keysToLeave = this.keysToLeave;
|
6728 | this.keysToLeave = [];
|
6729 | keysToLeave.forEach(this.performLeave);
|
6730 | };
|
6731 |
|
6732 | Animate.prototype.performEnter = function performEnter(key) {
|
6733 |
|
6734 | if (this.refs[key]) {
|
6735 | this.currentlyAnimatingKeys[key] = true;
|
6736 | this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter'));
|
6737 | }
|
6738 | };
|
6739 |
|
6740 | Animate.prototype.performAppear = function performAppear(key) {
|
6741 | if (this.refs[key]) {
|
6742 | this.currentlyAnimatingKeys[key] = true;
|
6743 | this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear'));
|
6744 | }
|
6745 | };
|
6746 |
|
6747 | Animate.prototype.handleDoneAdding = function handleDoneAdding(key, type) {
|
6748 | var props = this.props;
|
6749 | delete this.currentlyAnimatingKeys[key];
|
6750 |
|
6751 | if (props.exclusive && props !== this.nextProps) {
|
6752 | return;
|
6753 | }
|
6754 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
6755 | if (!this.isValidChildByKey(currentChildren, key)) {
|
6756 |
|
6757 | this.performLeave(key);
|
6758 | } else {
|
6759 | if (type === 'appear') {
|
6760 | if (_util2["default"].allowAppearCallback(props)) {
|
6761 | props.onAppear(key);
|
6762 | props.onEnd(key, true);
|
6763 | }
|
6764 | } else {
|
6765 | if (_util2["default"].allowEnterCallback(props)) {
|
6766 | props.onEnter(key);
|
6767 | props.onEnd(key, true);
|
6768 | }
|
6769 | }
|
6770 | }
|
6771 | };
|
6772 |
|
6773 | Animate.prototype.performLeave = function performLeave(key) {
|
6774 |
|
6775 | if (this.refs[key]) {
|
6776 | this.currentlyAnimatingKeys[key] = true;
|
6777 | this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key));
|
6778 | }
|
6779 | };
|
6780 |
|
6781 | Animate.prototype.handleDoneLeaving = function handleDoneLeaving(key) {
|
6782 | var props = this.props;
|
6783 | delete this.currentlyAnimatingKeys[key];
|
6784 |
|
6785 | if (props.exclusive && props !== this.nextProps) {
|
6786 | return;
|
6787 | }
|
6788 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
6789 |
|
6790 | if (this.isValidChildByKey(currentChildren, key)) {
|
6791 | this.performEnter(key);
|
6792 | } else {
|
6793 | var end = function end() {
|
6794 | if (_util2["default"].allowLeaveCallback(props)) {
|
6795 | props.onLeave(key);
|
6796 | props.onEnd(key, false);
|
6797 | }
|
6798 | };
|
6799 |
|
6800 | if (this.mounted && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) {
|
6801 | this.setState({
|
6802 | children: currentChildren
|
6803 | }, end);
|
6804 | } else {
|
6805 | end();
|
6806 | }
|
6807 | }
|
6808 | };
|
6809 |
|
6810 | Animate.prototype.isValidChildByKey = function isValidChildByKey(currentChildren, key) {
|
6811 | var showProp = this.props.showProp;
|
6812 | if (showProp) {
|
6813 | return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
6814 | }
|
6815 | return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
6816 | };
|
6817 |
|
6818 | Animate.prototype.stop = function stop(key) {
|
6819 | delete this.currentlyAnimatingKeys[key];
|
6820 | var component = this.refs[key];
|
6821 | if (component) {
|
6822 | component.stop();
|
6823 | }
|
6824 | };
|
6825 |
|
6826 | Animate.prototype.render = function render() {
|
6827 | var props = this.props;
|
6828 | this.nextProps = props;
|
6829 | var stateChildren = this.state.children;
|
6830 | var children = null;
|
6831 | if (stateChildren) {
|
6832 | children = stateChildren.map(function (child) {
|
6833 | if (child === null || child === undefined) {
|
6834 | return child;
|
6835 | }
|
6836 | if (!child.key) {
|
6837 | throw new Error('must set key for <rc-animate> children');
|
6838 | }
|
6839 | return _react2["default"].createElement(
|
6840 | _AnimateChild2["default"],
|
6841 | {
|
6842 | key: child.key,
|
6843 | ref: child.key,
|
6844 | animation: props.animation,
|
6845 | transitionName: props.transitionName,
|
6846 | transitionEnter: props.transitionEnter,
|
6847 | transitionAppear: props.transitionAppear,
|
6848 | transitionLeave: props.transitionLeave
|
6849 | },
|
6850 | child
|
6851 | );
|
6852 | });
|
6853 | }
|
6854 | var Component = props.component;
|
6855 | if (Component) {
|
6856 | var passedProps = props;
|
6857 | if (typeof Component === 'string') {
|
6858 | passedProps = {
|
6859 | className: props.className,
|
6860 | style: props.style
|
6861 | };
|
6862 | }
|
6863 | return _react2["default"].createElement(
|
6864 | Component,
|
6865 | passedProps,
|
6866 | children
|
6867 | );
|
6868 | }
|
6869 | return children[0] || null;
|
6870 | };
|
6871 |
|
6872 | return Animate;
|
6873 | }(_react.Component);
|
6874 |
|
6875 | ;
|
6876 | Animate.defaultProps = defaultProps;
|
6877 | Animate.propTypes = Animate.propTypes;
|
6878 |
|
6879 | exports["default"] = Animate;
|
6880 | module.exports = exports['default'];
|
6881 |
|
6882 | }),
|
6883 |
|
6884 | (function(module, exports, __webpack_require__) {
|
6885 |
|
6886 | 'use strict';
|
6887 |
|
6888 | Object.defineProperty(exports, "__esModule", {
|
6889 | value: true
|
6890 | });
|
6891 | exports.toArrayChildren = toArrayChildren;
|
6892 | exports.findChildInChildrenByKey = findChildInChildrenByKey;
|
6893 | exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey;
|
6894 | exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey;
|
6895 | exports.isSameChildren = isSameChildren;
|
6896 | exports.mergeChildren = mergeChildren;
|
6897 |
|
6898 | var _react = __webpack_require__(4);
|
6899 |
|
6900 | var _react2 = _interopRequireDefault(_react);
|
6901 |
|
6902 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6903 |
|
6904 | function toArrayChildren(children) {
|
6905 | var ret = [];
|
6906 | _react2["default"].Children.forEach(children, function (child) {
|
6907 | ret.push(child);
|
6908 | });
|
6909 | return ret;
|
6910 | }
|
6911 |
|
6912 | function findChildInChildrenByKey(children, key) {
|
6913 | var ret = null;
|
6914 | if (children) {
|
6915 | children.forEach(function (child) {
|
6916 | if (ret) {
|
6917 | return;
|
6918 | }
|
6919 | if (child && child.key === key) {
|
6920 | ret = child;
|
6921 | }
|
6922 | });
|
6923 | }
|
6924 | return ret;
|
6925 | }
|
6926 |
|
6927 | function findShownChildInChildrenByKey(children, key, showProp) {
|
6928 | var ret = null;
|
6929 | if (children) {
|
6930 | children.forEach(function (child) {
|
6931 | if (child && child.key === key && child.props[showProp]) {
|
6932 | if (ret) {
|
6933 | throw new Error('two child with same key for <rc-animate> children');
|
6934 | }
|
6935 | ret = child;
|
6936 | }
|
6937 | });
|
6938 | }
|
6939 | return ret;
|
6940 | }
|
6941 |
|
6942 | function findHiddenChildInChildrenByKey(children, key, showProp) {
|
6943 | var found = 0;
|
6944 | if (children) {
|
6945 | children.forEach(function (child) {
|
6946 | if (found) {
|
6947 | return;
|
6948 | }
|
6949 | found = child && child.key === key && !child.props[showProp];
|
6950 | });
|
6951 | }
|
6952 | return found;
|
6953 | }
|
6954 |
|
6955 | function isSameChildren(c1, c2, showProp) {
|
6956 | var same = c1.length === c2.length;
|
6957 | if (same) {
|
6958 | c1.forEach(function (child, index) {
|
6959 | var child2 = c2[index];
|
6960 | if (child && child2) {
|
6961 | if (child && !child2 || !child && child2) {
|
6962 | same = false;
|
6963 | } else if (child.key !== child2.key) {
|
6964 | same = false;
|
6965 | } else if (showProp && child.props[showProp] !== child2.props[showProp]) {
|
6966 | same = false;
|
6967 | }
|
6968 | }
|
6969 | });
|
6970 | }
|
6971 | return same;
|
6972 | }
|
6973 |
|
6974 | function mergeChildren(prev, next) {
|
6975 | var ret = [];
|
6976 |
|
6977 |
|
6978 |
|
6979 | var nextChildrenPending = {};
|
6980 | var pendingChildren = [];
|
6981 | prev.forEach(function (child) {
|
6982 | if (child && findChildInChildrenByKey(next, child.key)) {
|
6983 | if (pendingChildren.length) {
|
6984 | nextChildrenPending[child.key] = pendingChildren;
|
6985 | pendingChildren = [];
|
6986 | }
|
6987 | } else {
|
6988 | pendingChildren.push(child);
|
6989 | }
|
6990 | });
|
6991 |
|
6992 | next.forEach(function (child) {
|
6993 | if (child && nextChildrenPending.hasOwnProperty(child.key)) {
|
6994 | ret = ret.concat(nextChildrenPending[child.key]);
|
6995 | }
|
6996 | ret.push(child);
|
6997 | });
|
6998 |
|
6999 | ret = ret.concat(pendingChildren);
|
7000 |
|
7001 | return ret;
|
7002 | }
|
7003 |
|
7004 | }),
|
7005 |
|
7006 | (function(module, exports, __webpack_require__) {
|
7007 |
|
7008 | 'use strict';
|
7009 |
|
7010 | Object.defineProperty(exports, "__esModule", {
|
7011 | value: true
|
7012 | });
|
7013 |
|
7014 | 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; };
|
7015 |
|
7016 | var _react = __webpack_require__(4);
|
7017 |
|
7018 | var _react2 = _interopRequireDefault(_react);
|
7019 |
|
7020 | var _propTypes = __webpack_require__(5);
|
7021 |
|
7022 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7023 |
|
7024 | var _reactDom = __webpack_require__(12);
|
7025 |
|
7026 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7027 |
|
7028 | var _tinperBeeCore = __webpack_require__(26);
|
7029 |
|
7030 | var _util = __webpack_require__(72);
|
7031 |
|
7032 | var _util2 = _interopRequireDefault(_util);
|
7033 |
|
7034 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7035 |
|
7036 | 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; }
|
7037 |
|
7038 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7039 |
|
7040 | 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; }
|
7041 |
|
7042 | 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); }
|
7043 |
|
7044 | var transitionMap = {
|
7045 | enter: 'transitionEnter',
|
7046 | appear: 'transitionAppear',
|
7047 | leave: 'transitionLeave'
|
7048 | };
|
7049 |
|
7050 | var propTypes = {
|
7051 | children: _propTypes2["default"].any
|
7052 | };
|
7053 |
|
7054 | var AnimateChild = function (_Component) {
|
7055 | _inherits(AnimateChild, _Component);
|
7056 |
|
7057 | function AnimateChild(props) {
|
7058 | _classCallCheck(this, AnimateChild);
|
7059 |
|
7060 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
7061 |
|
7062 | _this.transition = _this.transition.bind(_this);
|
7063 | _this.stop = _this.stop.bind(_this);
|
7064 | return _this;
|
7065 | }
|
7066 |
|
7067 | AnimateChild.prototype.componentWillUnmount = function componentWillUnmount() {
|
7068 | this.stop();
|
7069 | };
|
7070 |
|
7071 | AnimateChild.prototype.componentWillEnter = function componentWillEnter(done) {
|
7072 | if (_util2["default"].isEnterSupported(this.props)) {
|
7073 | this.transition('enter', done);
|
7074 | } else {
|
7075 | done();
|
7076 | }
|
7077 | };
|
7078 |
|
7079 | AnimateChild.prototype.componentWillAppear = function componentWillAppear(done) {
|
7080 | if (_util2["default"].isAppearSupported(this.props)) {
|
7081 | this.transition('appear', done);
|
7082 | } else {
|
7083 | done();
|
7084 | }
|
7085 | };
|
7086 |
|
7087 | AnimateChild.prototype.componentWillLeave = function componentWillLeave(done) {
|
7088 | if (_util2["default"].isLeaveSupported(this.props)) {
|
7089 | this.transition('leave', done);
|
7090 | } else {
|
7091 |
|
7092 |
|
7093 |
|
7094 | done();
|
7095 | }
|
7096 | };
|
7097 |
|
7098 | AnimateChild.prototype.transition = function transition(animationType, finishCallback) {
|
7099 | var _this2 = this;
|
7100 |
|
7101 | var node = _reactDom2["default"].findDOMNode(this);
|
7102 | var props = this.props;
|
7103 | var transitionName = props.transitionName;
|
7104 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
|
7105 | this.stop();
|
7106 | var end = function end() {
|
7107 | _this2.stopper = null;
|
7108 | finishCallback();
|
7109 | };
|
7110 | if ((_tinperBeeCore.cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {
|
7111 | var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType;
|
7112 | var activeName = name + '-active';
|
7113 | if (nameIsObj && transitionName[animationType + 'Active']) {
|
7114 | activeName = transitionName[animationType + 'Active'];
|
7115 | }
|
7116 | this.stopper = (0, _tinperBeeCore.cssAnimation)(node, {
|
7117 | name: name,
|
7118 | active: activeName
|
7119 | }, end);
|
7120 | } else {
|
7121 | this.stopper = props.animation[animationType](node, end);
|
7122 | }
|
7123 | };
|
7124 |
|
7125 | AnimateChild.prototype.stop = function stop() {
|
7126 | var stopper = this.stopper;
|
7127 | if (stopper) {
|
7128 | this.stopper = null;
|
7129 | stopper.stop();
|
7130 | }
|
7131 | };
|
7132 |
|
7133 | AnimateChild.prototype.render = function render() {
|
7134 | return this.props.children;
|
7135 | };
|
7136 |
|
7137 | return AnimateChild;
|
7138 | }(_react.Component);
|
7139 |
|
7140 | ;
|
7141 |
|
7142 | AnimateChild.propTypes = propTypes;
|
7143 |
|
7144 | exports["default"] = AnimateChild;
|
7145 | module.exports = exports['default'];
|
7146 |
|
7147 | }),
|
7148 |
|
7149 | (function(module, exports) {
|
7150 |
|
7151 | "use strict";
|
7152 |
|
7153 | Object.defineProperty(exports, "__esModule", {
|
7154 | value: true
|
7155 | });
|
7156 | var util = {
|
7157 | isAppearSupported: function isAppearSupported(props) {
|
7158 | return props.transitionName && props.transitionAppear || props.animation.appear;
|
7159 | },
|
7160 | isEnterSupported: function isEnterSupported(props) {
|
7161 | return props.transitionName && props.transitionEnter || props.animation.enter;
|
7162 | },
|
7163 | isLeaveSupported: function isLeaveSupported(props) {
|
7164 | return props.transitionName && props.transitionLeave || props.animation.leave;
|
7165 | },
|
7166 | allowAppearCallback: function allowAppearCallback(props) {
|
7167 | return props.transitionAppear || props.animation.appear;
|
7168 | },
|
7169 | allowEnterCallback: function allowEnterCallback(props) {
|
7170 | return props.transitionEnter || props.animation.enter;
|
7171 | },
|
7172 | allowLeaveCallback: function allowLeaveCallback(props) {
|
7173 | return props.transitionLeave || props.animation.leave;
|
7174 | }
|
7175 | };
|
7176 | exports["default"] = util;
|
7177 | module.exports = exports["default"];
|
7178 |
|
7179 | }),
|
7180 |
|
7181 | (function(module, exports, __webpack_require__) {
|
7182 |
|
7183 | 'use strict';
|
7184 |
|
7185 | Object.defineProperty(exports, "__esModule", {
|
7186 | value: true
|
7187 | });
|
7188 |
|
7189 | var _react = __webpack_require__(4);
|
7190 |
|
7191 | var _react2 = _interopRequireDefault(_react);
|
7192 |
|
7193 | var _classnames = __webpack_require__(3);
|
7194 |
|
7195 | var _classnames2 = _interopRequireDefault(_classnames);
|
7196 |
|
7197 | var _propTypes = __webpack_require__(5);
|
7198 |
|
7199 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7200 |
|
7201 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7202 |
|
7203 | 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; }
|
7204 |
|
7205 | 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; }
|
7206 |
|
7207 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7208 |
|
7209 | 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; }
|
7210 |
|
7211 | 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); }
|
7212 |
|
7213 | var propTypes = {
|
7214 | duration: _propTypes2["default"].number,
|
7215 | onClose: _propTypes2["default"].func,
|
7216 | children: _propTypes2["default"].any,
|
7217 | color: _propTypes2["default"].oneOf(['light']),
|
7218 | title: _propTypes2["default"].any
|
7219 | };
|
7220 |
|
7221 | function noop() {}
|
7222 |
|
7223 | var defaultProps = {
|
7224 | onEnd: noop,
|
7225 | onClose: noop,
|
7226 | duration: 4.5,
|
7227 | closable: true
|
7228 | };
|
7229 |
|
7230 | var Notice = function (_React$Component) {
|
7231 | _inherits(Notice, _React$Component);
|
7232 |
|
7233 | function Notice(props) {
|
7234 | _classCallCheck(this, Notice);
|
7235 |
|
7236 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
7237 |
|
7238 | _this.clearCloseTimer = _this.clearCloseTimer.bind(_this);
|
7239 | _this.close = _this.close.bind(_this);
|
7240 | return _this;
|
7241 | }
|
7242 |
|
7243 | Notice.prototype.componentDidMount = function componentDidMount() {
|
7244 | var _this2 = this;
|
7245 |
|
7246 | if (this.props.duration) {
|
7247 | this.closeTimer = setTimeout(function () {
|
7248 | _this2.close();
|
7249 | }, this.props.duration * 1000);
|
7250 | }
|
7251 | };
|
7252 |
|
7253 | Notice.prototype.componentWillUnmount = function componentWillUnmount() {
|
7254 | this.clearCloseTimer();
|
7255 | };
|
7256 |
|
7257 | Notice.prototype.clearCloseTimer = function clearCloseTimer() {
|
7258 | if (this.closeTimer) {
|
7259 | clearTimeout(this.closeTimer);
|
7260 | this.closeTimer = null;
|
7261 | }
|
7262 | };
|
7263 |
|
7264 | Notice.prototype.close = function close() {
|
7265 | this.clearCloseTimer();
|
7266 | this.props.onClose();
|
7267 | };
|
7268 |
|
7269 | Notice.prototype.render = function render() {
|
7270 | var _classes;
|
7271 |
|
7272 | var _props = this.props,
|
7273 | closable = _props.closable,
|
7274 | clsPrefix = _props.clsPrefix,
|
7275 | className = _props.className,
|
7276 | style = _props.style,
|
7277 | children = _props.children,
|
7278 | color = _props.color,
|
7279 | title = _props.title;
|
7280 |
|
7281 | var componentClass = clsPrefix + '-notice';
|
7282 | var classes = (_classes = {}, _defineProperty(_classes, '' + componentClass, 1), _defineProperty(_classes, componentClass + '-closable', closable), _defineProperty(_classes, className, !!className), _classes);
|
7283 | if (color) {
|
7284 | classes[componentClass + '-' + color] = true;
|
7285 | }
|
7286 | return _react2["default"].createElement(
|
7287 | 'div',
|
7288 | { className: (0, _classnames2["default"])(classes), style: style, onClick: this.close },
|
7289 | _react2["default"].createElement(
|
7290 | 'div',
|
7291 | { className: componentClass + '-content' },
|
7292 | title && _react2["default"].createElement(
|
7293 | 'div',
|
7294 | { className: componentClass + '-title' },
|
7295 | title
|
7296 | ),
|
7297 | _react2["default"].createElement(
|
7298 | 'div',
|
7299 | { className: componentClass + '-description' },
|
7300 | children
|
7301 | )
|
7302 | ),
|
7303 | closable ? _react2["default"].createElement(
|
7304 | 'a',
|
7305 | { tabIndex: '0', onClick: this.close, className: componentClass + '-close' },
|
7306 | _react2["default"].createElement('span', { className: componentClass + '-close-x' })
|
7307 | ) : null
|
7308 | );
|
7309 | };
|
7310 |
|
7311 | return Notice;
|
7312 | }(_react2["default"].Component);
|
7313 |
|
7314 | ;
|
7315 |
|
7316 | Notice.PropTypes = _propTypes2["default"];
|
7317 | Notice.defaultProps = defaultProps;
|
7318 |
|
7319 | exports["default"] = Notice;
|
7320 | module.exports = exports['default'];
|
7321 |
|
7322 | }),
|
7323 |
|
7324 | (function(module, exports, __webpack_require__) {
|
7325 |
|
7326 | 'use strict';
|
7327 |
|
7328 | var deselectCurrent = __webpack_require__(75);
|
7329 |
|
7330 | var defaultMessage = 'Copy to clipboard: #{key}, Enter';
|
7331 |
|
7332 | function format(message) {
|
7333 | var copyKey = (/mac os x/i.test(navigator.userAgent) ? '⌘' : 'Ctrl') + '+C';
|
7334 | return message.replace(/#{\s*key\s*}/g, copyKey);
|
7335 | }
|
7336 |
|
7337 | function copy(text, options) {
|
7338 | var debug, message, reselectPrevious, range, selection, mark, success = false;
|
7339 | if (!options) { options = {}; }
|
7340 | debug = options.debug || false;
|
7341 | try {
|
7342 | reselectPrevious = deselectCurrent();
|
7343 |
|
7344 | range = document.createRange();
|
7345 | selection = document.getSelection();
|
7346 |
|
7347 | mark = document.createElement('span');
|
7348 | mark.textContent = text;
|
7349 |
|
7350 | mark.style.all = 'unset';
|
7351 |
|
7352 | mark.style.position = 'fixed';
|
7353 | mark.style.top = 0;
|
7354 | mark.style.clip = 'rect(0, 0, 0, 0)';
|
7355 |
|
7356 | mark.style.whiteSpace = 'pre';
|
7357 |
|
7358 | mark.style.webkitUserSelect = 'text';
|
7359 | mark.style.MozUserSelect = 'text';
|
7360 | mark.style.msUserSelect = 'text';
|
7361 | mark.style.userSelect = 'text';
|
7362 |
|
7363 | document.body.appendChild(mark);
|
7364 |
|
7365 | range.selectNode(mark);
|
7366 | selection.addRange(range);
|
7367 |
|
7368 | var successful = document.execCommand('copy');
|
7369 | if (!successful) {
|
7370 | throw new Error('copy command was unsuccessful');
|
7371 | }
|
7372 | success = true;
|
7373 | } catch (err) {
|
7374 | debug && console.error('unable to copy using execCommand: ', err);
|
7375 | debug && console.warn('trying IE specific stuff');
|
7376 | try {
|
7377 | window.clipboardData.setData('text', text);
|
7378 | success = true;
|
7379 | } catch (err) {
|
7380 | debug && console.error('unable to copy using clipboardData: ', err);
|
7381 | debug && console.error('falling back to prompt');
|
7382 | message = format('message' in options ? options.message : defaultMessage);
|
7383 | window.prompt(message, text);
|
7384 | }
|
7385 | } finally {
|
7386 | if (selection) {
|
7387 | if (typeof selection.removeRange == 'function') {
|
7388 | selection.removeRange(range);
|
7389 | } else {
|
7390 | selection.removeAllRanges();
|
7391 | }
|
7392 | }
|
7393 |
|
7394 | if (mark) {
|
7395 | document.body.removeChild(mark);
|
7396 | }
|
7397 | reselectPrevious();
|
7398 | }
|
7399 |
|
7400 | return success;
|
7401 | }
|
7402 |
|
7403 | module.exports = copy;
|
7404 |
|
7405 |
|
7406 | }),
|
7407 |
|
7408 | (function(module, exports) {
|
7409 |
|
7410 |
|
7411 | module.exports = function () {
|
7412 | var selection = document.getSelection();
|
7413 | if (!selection.rangeCount) {
|
7414 | return function () {};
|
7415 | }
|
7416 | var active = document.activeElement;
|
7417 |
|
7418 | var ranges = [];
|
7419 | for (var i = 0; i < selection.rangeCount; i++) {
|
7420 | ranges.push(selection.getRangeAt(i));
|
7421 | }
|
7422 |
|
7423 | switch (active.tagName.toUpperCase()) {
|
7424 | case 'INPUT':
|
7425 | case 'TEXTAREA':
|
7426 | active.blur();
|
7427 | break;
|
7428 |
|
7429 | default:
|
7430 | active = null;
|
7431 | break;
|
7432 | }
|
7433 |
|
7434 | selection.removeAllRanges();
|
7435 | return function () {
|
7436 | selection.type === 'Caret' &&
|
7437 | selection.removeAllRanges();
|
7438 |
|
7439 | if (!selection.rangeCount) {
|
7440 | ranges.forEach(function(range) {
|
7441 | selection.addRange(range);
|
7442 | });
|
7443 | }
|
7444 |
|
7445 | active &&
|
7446 | active.focus();
|
7447 | };
|
7448 | };
|
7449 |
|
7450 |
|
7451 | }),
|
7452 |
|
7453 | (function(module, exports, __webpack_require__) {
|
7454 |
|
7455 | 'use strict';
|
7456 |
|
7457 | Object.defineProperty(exports, "__esModule", {
|
7458 | value: true
|
7459 | });
|
7460 |
|
7461 | 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; };
|
7462 |
|
7463 | var _classnames = __webpack_require__(3);
|
7464 |
|
7465 | var _classnames2 = _interopRequireDefault(_classnames);
|
7466 |
|
7467 | var _react = __webpack_require__(4);
|
7468 |
|
7469 | var _react2 = _interopRequireDefault(_react);
|
7470 |
|
7471 | var _propTypes = __webpack_require__(5);
|
7472 |
|
7473 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7474 |
|
7475 | var _tinperBeeCore = __webpack_require__(26);
|
7476 |
|
7477 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7478 |
|
7479 | 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; }
|
7480 |
|
7481 | 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; }
|
7482 |
|
7483 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7484 |
|
7485 | 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; }
|
7486 |
|
7487 | 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); }
|
7488 |
|
7489 | var propTypes = {
|
7490 |
|
7491 | accordion: _propTypes2["default"].bool,
|
7492 |
|
7493 | activeKey: _propTypes2["default"].any,
|
7494 |
|
7495 | defaultActiveKey: _propTypes2["default"].any,
|
7496 |
|
7497 | onSelect: _propTypes2["default"].func,
|
7498 | role: _propTypes2["default"].string
|
7499 | };
|
7500 |
|
7501 | var defaultProps = {
|
7502 | accordion: false,
|
7503 | clsPrefix: 'u-panel-group'
|
7504 | };
|
7505 |
|
7506 |
|
7507 |
|
7508 | var PanelGroup = function (_React$Component) {
|
7509 | _inherits(PanelGroup, _React$Component);
|
7510 |
|
7511 | function PanelGroup(props, context) {
|
7512 | _classCallCheck(this, PanelGroup);
|
7513 |
|
7514 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
7515 |
|
7516 | _this.handleSelect = _this.handleSelect.bind(_this);
|
7517 |
|
7518 | _this.state = {
|
7519 | activeKey: props.defaultActiveKey
|
7520 | };
|
7521 | return _this;
|
7522 | }
|
7523 |
|
7524 | PanelGroup.prototype.handleSelect = function handleSelect(key, e) {
|
7525 | e.preventDefault();
|
7526 |
|
7527 | if (this.props.onSelect) {
|
7528 | this.props.onSelect(key, e);
|
7529 | }
|
7530 |
|
7531 | if (this.state.activeKey === key) {
|
7532 | key = null;
|
7533 | }
|
7534 |
|
7535 | this.setState({ activeKey: key });
|
7536 | };
|
7537 |
|
7538 | PanelGroup.prototype.render = function render() {
|
7539 | var _this2 = this;
|
7540 |
|
7541 | var _props = this.props,
|
7542 | accordion = _props.accordion,
|
7543 | propsActiveKey = _props.activeKey,
|
7544 | className = _props.className,
|
7545 | children = _props.children,
|
7546 | defaultActiveKey = _props.defaultActiveKey,
|
7547 | onSelect = _props.onSelect,
|
7548 | style = _props.style,
|
7549 | clsPrefix = _props.clsPrefix,
|
7550 | others = _objectWithoutProperties(_props, ['accordion', 'activeKey', 'className', 'children', 'defaultActiveKey', 'onSelect', 'style', 'clsPrefix']);
|
7551 |
|
7552 | var activeKey = void 0;
|
7553 | if (accordion) {
|
7554 | activeKey = propsActiveKey != null ? propsActiveKey : this.state.activeKey;
|
7555 | others.role = others.role || 'tablist';
|
7556 | }
|
7557 |
|
7558 | var classes = {};
|
7559 | classes['' + clsPrefix] = true;
|
7560 |
|
7561 | return _react2["default"].createElement(
|
7562 | 'div',
|
7563 | _extends({}, others, {
|
7564 | className: (0, _classnames2["default"])(className, classes)
|
7565 | }),
|
7566 | _react2["default"].Children.map(children, function (child) {
|
7567 | if (!_react2["default"].isValidElement(child)) {
|
7568 | return child;
|
7569 | }
|
7570 | var childProps = {
|
7571 | style: child.props.style
|
7572 | };
|
7573 |
|
7574 | if (accordion) {
|
7575 | _extends(childProps, {
|
7576 | headerRole: 'tab',
|
7577 | panelRole: 'tabpanel',
|
7578 | collapsible: true,
|
7579 | expanded: child.props.eventKey === activeKey,
|
7580 | onSelect: (0, _tinperBeeCore.createChainedFunction)(_this2.handleSelect, child.props.onSelect)
|
7581 | });
|
7582 | }
|
7583 |
|
7584 | return (0, _react.cloneElement)(child, childProps);
|
7585 | })
|
7586 | );
|
7587 | };
|
7588 |
|
7589 | return PanelGroup;
|
7590 | }(_react2["default"].Component);
|
7591 |
|
7592 | PanelGroup.propTypes = propTypes;
|
7593 | PanelGroup.defaultProps = defaultProps;
|
7594 |
|
7595 | exports["default"] = PanelGroup;
|
7596 | module.exports = exports['default'];
|
7597 |
|
7598 | }),
|
7599 |
|
7600 | (function(module, exports, __webpack_require__) {
|
7601 |
|
7602 | 'use strict';
|
7603 |
|
7604 | Object.defineProperty(exports, "__esModule", {
|
7605 | value: true
|
7606 | });
|
7607 |
|
7608 | var _Button = __webpack_require__(78);
|
7609 |
|
7610 | var _Button2 = _interopRequireDefault(_Button);
|
7611 |
|
7612 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7613 |
|
7614 | exports["default"] = _Button2["default"];
|
7615 | module.exports = exports['default'];
|
7616 |
|
7617 | }),
|
7618 |
|
7619 | (function(module, exports, __webpack_require__) {
|
7620 |
|
7621 | 'use strict';
|
7622 |
|
7623 | Object.defineProperty(exports, "__esModule", {
|
7624 | value: true
|
7625 | });
|
7626 |
|
7627 | 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; };
|
7628 |
|
7629 | var _react = __webpack_require__(4);
|
7630 |
|
7631 | var _react2 = _interopRequireDefault(_react);
|
7632 |
|
7633 | var _reactDom = __webpack_require__(12);
|
7634 |
|
7635 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7636 |
|
7637 | var _propTypes = __webpack_require__(5);
|
7638 |
|
7639 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7640 |
|
7641 | var _classnames = __webpack_require__(3);
|
7642 |
|
7643 | var _classnames2 = _interopRequireDefault(_classnames);
|
7644 |
|
7645 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7646 |
|
7647 | 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; }
|
7648 |
|
7649 | 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; }
|
7650 |
|
7651 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7652 |
|
7653 | 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; }
|
7654 |
|
7655 | 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); }
|
7656 |
|
7657 | var propTypes = {
|
7658 | |
7659 |
|
7660 |
|
7661 | size: _propTypes2["default"].oneOf(['sm', 'xg', 'lg']),
|
7662 | |
7663 |
|
7664 |
|
7665 | style: _propTypes2["default"].object,
|
7666 | |
7667 |
|
7668 |
|
7669 | shape: _propTypes2["default"].oneOf(['block', 'round', 'border', 'squared', 'floating', 'pillRight', 'pillLeft', 'icon']),
|
7670 |
|
7671 | bordered: _propTypes2["default"].bool,
|
7672 | |
7673 |
|
7674 |
|
7675 | colors: _propTypes2["default"].oneOf(['primary', 'accent', 'success', 'info', 'warning', 'danger', 'default']),
|
7676 | |
7677 |
|
7678 |
|
7679 |
|
7680 | disabled: _propTypes2["default"].bool,
|
7681 | |
7682 |
|
7683 |
|
7684 |
|
7685 | className: _propTypes2["default"].string,
|
7686 |
|
7687 | |
7688 |
|
7689 |
|
7690 |
|
7691 | htmlType: _propTypes2["default"].oneOf(['submit', 'button', 'reset']),
|
7692 | isSubmit: _propTypes2["default"].bool
|
7693 | };
|
7694 |
|
7695 | var defaultProps = {
|
7696 | disabled: false,
|
7697 | htmlType: 'button',
|
7698 | clsPrefix: 'u-button',
|
7699 | bordered: false,
|
7700 | isSubmit: false
|
7701 | };
|
7702 |
|
7703 | var sizeMap = {
|
7704 | sm: 'sm',
|
7705 | xg: 'xg',
|
7706 | lg: 'lg'
|
7707 | },
|
7708 | colorsMap = {
|
7709 | primary: 'primary',
|
7710 | accent: 'accent',
|
7711 | success: 'success',
|
7712 | info: 'info',
|
7713 | warning: 'warning',
|
7714 | danger: 'danger'
|
7715 | },
|
7716 | shapeMap = {
|
7717 | block: 'block',
|
7718 | round: 'round',
|
7719 | border: 'border',
|
7720 | squared: 'squared',
|
7721 | floating: 'floating',
|
7722 | pillRight: 'pill-right',
|
7723 | pillLeft: 'pill-left',
|
7724 | icon: 'icon'
|
7725 | };
|
7726 |
|
7727 | var Button = function (_Component) {
|
7728 | _inherits(Button, _Component);
|
7729 |
|
7730 | function Button(props) {
|
7731 | _classCallCheck(this, Button);
|
7732 |
|
7733 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
7734 | }
|
7735 |
|
7736 | Button.prototype.render = function render() {
|
7737 | var _props = this.props,
|
7738 | colors = _props.colors,
|
7739 | shape = _props.shape,
|
7740 | disabled = _props.disabled,
|
7741 | className = _props.className,
|
7742 | size = _props.size,
|
7743 | bordered = _props.bordered,
|
7744 | children = _props.children,
|
7745 | htmlType = _props.htmlType,
|
7746 | clsPrefix = _props.clsPrefix,
|
7747 | isSubmit = _props.isSubmit,
|
7748 | others = _objectWithoutProperties(_props, ['colors', 'shape', 'disabled', 'className', 'size', 'bordered', 'children', 'htmlType', 'clsPrefix', 'isSubmit']);
|
7749 |
|
7750 | var clsObj = {};
|
7751 | if (className) {
|
7752 | clsObj[className] = true;
|
7753 | }
|
7754 | if (sizeMap[size]) {
|
7755 | clsObj[clsPrefix + '-' + sizeMap[size]] = true;
|
7756 | }
|
7757 |
|
7758 | if (shapeMap[shape]) {
|
7759 | clsObj[clsPrefix + '-' + shapeMap[shape]] = true;
|
7760 | }
|
7761 | if (colorsMap[colors]) {
|
7762 | clsObj[clsPrefix + '-' + colorsMap[colors]] = true;
|
7763 | }
|
7764 |
|
7765 | var classes = (0, _classnames2["default"])(clsPrefix, clsObj);
|
7766 | return _react2["default"].createElement(
|
7767 | 'button',
|
7768 | _extends({
|
7769 | type: htmlType,
|
7770 | className: classes,
|
7771 | disabled: disabled
|
7772 | }, others),
|
7773 | this.props.children
|
7774 | );
|
7775 | };
|
7776 |
|
7777 | return Button;
|
7778 | }(_react.Component);
|
7779 |
|
7780 | Button.propTypes = propTypes;
|
7781 | Button.defaultProps = defaultProps;
|
7782 |
|
7783 | exports["default"] = Button;
|
7784 | module.exports = exports['default'];
|
7785 |
|
7786 | }),
|
7787 |
|
7788 | (function(module, exports, __webpack_require__) {
|
7789 |
|
7790 | 'use strict';
|
7791 |
|
7792 | Object.defineProperty(exports, "__esModule", {
|
7793 | value: true
|
7794 | });
|
7795 |
|
7796 | var _react = __webpack_require__(4);
|
7797 |
|
7798 | var _react2 = _interopRequireDefault(_react);
|
7799 |
|
7800 | var _index = __webpack_require__(80);
|
7801 |
|
7802 | var _index2 = _interopRequireDefault(_index);
|
7803 |
|
7804 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
7805 |
|
7806 | 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; }
|
7807 |
|
7808 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7809 |
|
7810 | 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; }
|
7811 |
|
7812 | 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); }
|
7813 | |
7814 |
|
7815 |
|
7816 |
|
7817 |
|
7818 |
|
7819 |
|
7820 | var Demo1 = function (_Component) {
|
7821 | _inherits(Demo1, _Component);
|
7822 |
|
7823 | function Demo1() {
|
7824 | var _temp, _this, _ret;
|
7825 |
|
7826 | _classCallCheck(this, Demo1);
|
7827 |
|
7828 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
7829 | args[_key] = arguments[_key];
|
7830 | }
|
7831 |
|
7832 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
7833 | console.log('start');
|
7834 | }, _this.onStop = function () {
|
7835 | console.log('stop');
|
7836 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
7837 | }
|
7838 |
|
7839 | Demo1.prototype.render = function render() {
|
7840 | return _react2['default'].createElement(
|
7841 | 'div',
|
7842 | null,
|
7843 | _react2['default'].createElement(
|
7844 | _index2['default'],
|
7845 | { onStart: this.onStart, onStop: this.onStop },
|
7846 | _react2['default'].createElement(
|
7847 | 'div',
|
7848 | { className: 'demo' },
|
7849 | '\u6211\u53EF\u968F\u610F\u62D6\u62FD'
|
7850 | )
|
7851 | )
|
7852 | );
|
7853 | };
|
7854 |
|
7855 | return Demo1;
|
7856 | }(_react.Component);
|
7857 |
|
7858 | exports['default'] = Demo1;
|
7859 | module.exports = exports['default'];
|
7860 |
|
7861 | }),
|
7862 |
|
7863 | (function(module, exports, __webpack_require__) {
|
7864 |
|
7865 | 'use strict';
|
7866 |
|
7867 | Object.defineProperty(exports, "__esModule", {
|
7868 | value: true
|
7869 | });
|
7870 |
|
7871 | var _Dnd = __webpack_require__(81);
|
7872 |
|
7873 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
7874 |
|
7875 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
7876 |
|
7877 | exports['default'] = _Dnd2['default'];
|
7878 | module.exports = exports['default'];
|
7879 |
|
7880 | }),
|
7881 |
|
7882 | (function(module, exports, __webpack_require__) {
|
7883 |
|
7884 | 'use strict';
|
7885 |
|
7886 | Object.defineProperty(exports, "__esModule", {
|
7887 | value: true
|
7888 | });
|
7889 |
|
7890 | 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; };
|
7891 |
|
7892 | var _react = __webpack_require__(4);
|
7893 |
|
7894 | var _react2 = _interopRequireDefault(_react);
|
7895 |
|
7896 | var _reactBeautifulDnd = __webpack_require__(82);
|
7897 |
|
7898 | var _reactDraggable = __webpack_require__(182);
|
7899 |
|
7900 | var _reactDraggable2 = _interopRequireDefault(_reactDraggable);
|
7901 |
|
7902 | var _propTypes = __webpack_require__(5);
|
7903 |
|
7904 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7905 |
|
7906 | var _lodash = __webpack_require__(183);
|
7907 |
|
7908 | var _lodash2 = _interopRequireDefault(_lodash);
|
7909 |
|
7910 | var _SortList = __webpack_require__(184);
|
7911 |
|
7912 | var _SortList2 = _interopRequireDefault(_SortList);
|
7913 |
|
7914 | var _Between = __webpack_require__(186);
|
7915 |
|
7916 | var _Between2 = _interopRequireDefault(_Between);
|
7917 |
|
7918 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
7919 |
|
7920 | 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; }
|
7921 |
|
7922 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7923 |
|
7924 | 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; }
|
7925 |
|
7926 | 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); }
|
7927 |
|
7928 | var propTypes = {
|
7929 | onStart: _propTypes2['default'].func,
|
7930 | onDrag: _propTypes2['default'].func,
|
7931 | onStop: _propTypes2['default'].func,
|
7932 | onDragUpdate: _propTypes2['default'].func,
|
7933 | dropClass: _propTypes2['default'].string,
|
7934 | dropOverClass: _propTypes2['default'].string,
|
7935 | dragClass: _propTypes2['default'].string,
|
7936 | dragingClass: _propTypes2['default'].string,
|
7937 | draggedClass: _propTypes2['default'].string,
|
7938 | className: _propTypes2['default'].string,
|
7939 | style: _propTypes2['default'].object,
|
7940 | list: _propTypes2['default'].array,
|
7941 | otherList: _propTypes2['default'].array,
|
7942 | type: _propTypes2['default'].oneOf(['vertical', 'horizontal', 'betweenVertical', 'betweenHorizontal']),
|
7943 | showKey: _propTypes2['default'].string
|
7944 |
|
7945 | };
|
7946 | var defaultProps = {
|
7947 | onStart: function onStart() {},
|
7948 | onDrag: function onDrag() {},
|
7949 | onStop: function onStop() {},
|
7950 | onDragUpdate: function onDragUpdate() {},
|
7951 | list: false,
|
7952 | otherList: [],
|
7953 | dropClass: '',
|
7954 | dropOverClass: '',
|
7955 | dragClass: '',
|
7956 | dragingClass: '',
|
7957 | draggedClass: '',
|
7958 | type: 'vertical'
|
7959 | };
|
7960 |
|
7961 | var Dnd = function (_Component) {
|
7962 | _inherits(Dnd, _Component);
|
7963 |
|
7964 | function Dnd(props) {
|
7965 | _classCallCheck(this, Dnd);
|
7966 |
|
7967 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
7968 |
|
7969 | _this.state = {
|
7970 | items: _this.props.list || []
|
7971 | };
|
7972 | return _this;
|
7973 | }
|
7974 |
|
7975 | Dnd.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
7976 | if (!(0, _lodash2['default'])(this.state.items, nextProps.list)) {
|
7977 | this.setState({
|
7978 | items: nextProps.list
|
7979 | });
|
7980 | }
|
7981 | };
|
7982 |
|
7983 | Dnd.prototype.render = function render() {
|
7984 | var _this2 = this;
|
7985 |
|
7986 | var self = this;
|
7987 | var DndType = function DndType() {
|
7988 | switch (_this2.props.type) {
|
7989 | case 'vertical':
|
7990 | return _react2['default'].createElement(_SortList2['default'], _this2.props);
|
7991 | break;
|
7992 | case 'horizontal':
|
7993 | return _react2['default'].createElement(_SortList2['default'], _this2.props);
|
7994 | break;
|
7995 | case 'betweenVertical':
|
7996 | return _react2['default'].createElement(_Between2['default'], _this2.props);
|
7997 | break;
|
7998 | case 'betweenHorizontal':
|
7999 | return _react2['default'].createElement(_Between2['default'], _this2.props);
|
8000 | break;
|
8001 | default:
|
8002 | return _react2['default'].createElement(_SortList2['default'], _this2.props);
|
8003 | break;
|
8004 | }
|
8005 | };
|
8006 | return _react2['default'].createElement(
|
8007 | 'div',
|
8008 | null,
|
8009 | self.state.items.length ? DndType() : _react2['default'].createElement(
|
8010 | _reactDraggable2['default'],
|
8011 | _extends({ defaultClassName: this.props.dragClass,
|
8012 | defaultClassNameDragging: this.props.dragingClass,
|
8013 | defaultClassNameDragged: this.props.draggedClass
|
8014 | }, this.props),
|
8015 | self.props.children
|
8016 | )
|
8017 | );
|
8018 | };
|
8019 |
|
8020 | return Dnd;
|
8021 | }(_react.Component);
|
8022 |
|
8023 | Dnd.propTypes = propTypes;
|
8024 | Dnd.defaultProps = defaultProps;
|
8025 | Dnd.Drag = _reactDraggable2['default'];
|
8026 | Dnd.DragDropContext = _reactBeautifulDnd.DragDropContext;
|
8027 | Dnd.Droppable = _reactBeautifulDnd.Droppable;
|
8028 | Dnd.Draggable = _reactBeautifulDnd.Draggable;
|
8029 | exports['default'] = Dnd;
|
8030 | module.exports = exports['default'];
|
8031 |
|
8032 | }),
|
8033 |
|
8034 | (function(module, exports, __webpack_require__) {
|
8035 |
|
8036 | (function(process) {'use strict';
|
8037 |
|
8038 | Object.defineProperty(exports, '__esModule', { value: true });
|
8039 |
|
8040 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
8041 |
|
8042 | var _extends = _interopDefault(__webpack_require__(83));
|
8043 | var invariant = _interopDefault(__webpack_require__(122));
|
8044 | var cssBoxModel = __webpack_require__(123);
|
8045 | var _Object$keys = _interopDefault(__webpack_require__(124));
|
8046 | var memoizeOne = _interopDefault(__webpack_require__(128));
|
8047 | var redux = __webpack_require__(129);
|
8048 | var _Object$assign = _interopDefault(__webpack_require__(84));
|
8049 | var rafSchd = _interopDefault(__webpack_require__(133));
|
8050 | var _inheritsLoose = _interopDefault(__webpack_require__(134));
|
8051 | var React = __webpack_require__(4);
|
8052 | var React__default = _interopDefault(React);
|
8053 | var PropTypes = _interopDefault(__webpack_require__(5));
|
8054 | var reactRedux = __webpack_require__(141);
|
8055 | var reactMotion = __webpack_require__(168);
|
8056 |
|
8057 | var vertical = {
|
8058 | direction: 'vertical',
|
8059 | line: 'y',
|
8060 | crossAxisLine: 'x',
|
8061 | start: 'top',
|
8062 | end: 'bottom',
|
8063 | size: 'height',
|
8064 | crossAxisStart: 'left',
|
8065 | crossAxisEnd: 'right',
|
8066 | crossAxisSize: 'width'
|
8067 | };
|
8068 | var horizontal = {
|
8069 | direction: 'horizontal',
|
8070 | line: 'x',
|
8071 | crossAxisLine: 'y',
|
8072 | start: 'left',
|
8073 | end: 'right',
|
8074 | size: 'width',
|
8075 | crossAxisStart: 'top',
|
8076 | crossAxisEnd: 'bottom',
|
8077 | crossAxisSize: 'height'
|
8078 | };
|
8079 |
|
8080 | var origin = {
|
8081 | x: 0,
|
8082 | y: 0
|
8083 | };
|
8084 | var add = function add(point1, point2) {
|
8085 | return {
|
8086 | x: point1.x + point2.x,
|
8087 | y: point1.y + point2.y
|
8088 | };
|
8089 | };
|
8090 | var subtract = function subtract(point1, point2) {
|
8091 | return {
|
8092 | x: point1.x - point2.x,
|
8093 | y: point1.y - point2.y
|
8094 | };
|
8095 | };
|
8096 | var isEqual = function isEqual(point1, point2) {
|
8097 | return point1.x === point2.x && point1.y === point2.y;
|
8098 | };
|
8099 | var negate = function negate(point) {
|
8100 | return {
|
8101 | x: point.x !== 0 ? -point.x : 0,
|
8102 | y: point.y !== 0 ? -point.y : 0
|
8103 | };
|
8104 | };
|
8105 | var absolute = function absolute(point) {
|
8106 | return {
|
8107 | x: Math.abs(point.x),
|
8108 | y: Math.abs(point.y)
|
8109 | };
|
8110 | };
|
8111 | var patch = function patch(line, value, otherValue) {
|
8112 | var _ref;
|
8113 |
|
8114 | if (otherValue === void 0) {
|
8115 | otherValue = 0;
|
8116 | }
|
8117 |
|
8118 | return _ref = {}, _ref[line] = value, _ref[line === 'x' ? 'y' : 'x'] = otherValue, _ref;
|
8119 | };
|
8120 | var distance = function distance(point1, point2) {
|
8121 | return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
|
8122 | };
|
8123 | var closest = function closest(target, points) {
|
8124 | return Math.min.apply(Math, points.map(function (point) {
|
8125 | return distance(target, point);
|
8126 | }));
|
8127 | };
|
8128 | var apply = function apply(fn) {
|
8129 | return function (point) {
|
8130 | return {
|
8131 | x: fn(point.x),
|
8132 | y: fn(point.y)
|
8133 | };
|
8134 | };
|
8135 | };
|
8136 |
|
8137 | var offsetByPosition = function offsetByPosition(spacing, point) {
|
8138 | return {
|
8139 | top: spacing.top + point.y,
|
8140 | left: spacing.left + point.x,
|
8141 | bottom: spacing.bottom + point.y,
|
8142 | right: spacing.right + point.x
|
8143 | };
|
8144 | };
|
8145 | var expandByPosition = function expandByPosition(spacing, position) {
|
8146 | return {
|
8147 | top: spacing.top - position.y,
|
8148 | left: spacing.left - position.x,
|
8149 | right: spacing.right + position.x,
|
8150 | bottom: spacing.bottom + position.y
|
8151 | };
|
8152 | };
|
8153 | var getCorners = function getCorners(spacing) {
|
8154 | return [{
|
8155 | x: spacing.left,
|
8156 | y: spacing.top
|
8157 | }, {
|
8158 | x: spacing.right,
|
8159 | y: spacing.top
|
8160 | }, {
|
8161 | x: spacing.left,
|
8162 | y: spacing.bottom
|
8163 | }, {
|
8164 | x: spacing.right,
|
8165 | y: spacing.bottom
|
8166 | }];
|
8167 | };
|
8168 |
|
8169 | var getMaxScroll = (function (_ref) {
|
8170 | var scrollHeight = _ref.scrollHeight,
|
8171 | scrollWidth = _ref.scrollWidth,
|
8172 | height = _ref.height,
|
8173 | width = _ref.width;
|
8174 | var maxScroll = subtract({
|
8175 | x: scrollWidth,
|
8176 | y: scrollHeight
|
8177 | }, {
|
8178 | x: width,
|
8179 | y: height
|
8180 | });
|
8181 | var adjustedMaxScroll = {
|
8182 | x: Math.max(0, maxScroll.x),
|
8183 | y: Math.max(0, maxScroll.y)
|
8184 | };
|
8185 | return adjustedMaxScroll;
|
8186 | });
|
8187 |
|
8188 | var clip = function clip(frame, subject) {
|
8189 | var result = cssBoxModel.getRect({
|
8190 | top: Math.max(subject.top, frame.top),
|
8191 | right: Math.min(subject.right, frame.right),
|
8192 | bottom: Math.min(subject.bottom, frame.bottom),
|
8193 | left: Math.max(subject.left, frame.left)
|
8194 | });
|
8195 |
|
8196 | if (result.width <= 0 || result.height <= 0) {
|
8197 | return null;
|
8198 | }
|
8199 |
|
8200 | return result;
|
8201 | };
|
8202 | var getDroppableDimension = function getDroppableDimension(_ref) {
|
8203 | var descriptor = _ref.descriptor,
|
8204 | isEnabled = _ref.isEnabled,
|
8205 | direction = _ref.direction,
|
8206 | client = _ref.client,
|
8207 | page = _ref.page,
|
8208 | closest$$1 = _ref.closest;
|
8209 |
|
8210 | var scrollable = function () {
|
8211 | if (!closest$$1) {
|
8212 | return null;
|
8213 | }
|
8214 |
|
8215 | var maxScroll = getMaxScroll({
|
8216 | scrollHeight: closest$$1.scrollHeight,
|
8217 | scrollWidth: closest$$1.scrollWidth,
|
8218 | height: closest$$1.client.paddingBox.height,
|
8219 | width: closest$$1.client.paddingBox.width
|
8220 | });
|
8221 | return {
|
8222 | framePageMarginBox: closest$$1.page.marginBox,
|
8223 | shouldClipSubject: closest$$1.shouldClipSubject,
|
8224 | scroll: {
|
8225 | initial: closest$$1.scroll,
|
8226 | current: closest$$1.scroll,
|
8227 | max: maxScroll,
|
8228 | diff: {
|
8229 | value: origin,
|
8230 | displacement: origin
|
8231 | }
|
8232 | }
|
8233 | };
|
8234 | }();
|
8235 |
|
8236 | var subjectPageMarginBox = page.marginBox;
|
8237 | var clippedPageMarginBox = scrollable && scrollable.shouldClipSubject ? clip(scrollable.framePageMarginBox, subjectPageMarginBox) : subjectPageMarginBox;
|
8238 | var viewport = {
|
8239 | closestScrollable: scrollable,
|
8240 | subjectPageMarginBox: subjectPageMarginBox,
|
8241 | clippedPageMarginBox: clippedPageMarginBox
|
8242 | };
|
8243 | var dimension = {
|
8244 | descriptor: descriptor,
|
8245 | axis: direction === 'vertical' ? vertical : horizontal,
|
8246 | isEnabled: isEnabled,
|
8247 | client: client,
|
8248 | page: page,
|
8249 | viewport: viewport
|
8250 | };
|
8251 | return dimension;
|
8252 | };
|
8253 | var scrollDroppable = function scrollDroppable(droppable, newScroll) {
|
8254 | !droppable.viewport.closestScrollable ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
8255 | var scrollable = droppable.viewport.closestScrollable;
|
8256 | var framePageMarginBox = scrollable.framePageMarginBox;
|
8257 | var scrollDiff = subtract(newScroll, scrollable.scroll.initial);
|
8258 | var scrollDisplacement = negate(scrollDiff);
|
8259 | var closestScrollable = {
|
8260 | framePageMarginBox: scrollable.framePageMarginBox,
|
8261 | shouldClipSubject: scrollable.shouldClipSubject,
|
8262 | scroll: {
|
8263 | initial: scrollable.scroll.initial,
|
8264 | current: newScroll,
|
8265 | diff: {
|
8266 | value: scrollDiff,
|
8267 | displacement: scrollDisplacement
|
8268 | },
|
8269 | max: scrollable.scroll.max
|
8270 | }
|
8271 | };
|
8272 | var displacedSubject = offsetByPosition(droppable.viewport.subjectPageMarginBox, scrollDisplacement);
|
8273 | var clippedPageMarginBox = closestScrollable.shouldClipSubject ? clip(framePageMarginBox, displacedSubject) : cssBoxModel.getRect(displacedSubject);
|
8274 | var viewport = {
|
8275 | closestScrollable: closestScrollable,
|
8276 | subjectPageMarginBox: droppable.viewport.subjectPageMarginBox,
|
8277 | clippedPageMarginBox: clippedPageMarginBox
|
8278 | };
|
8279 |
|
8280 | var result = _extends({}, droppable, {
|
8281 | viewport: viewport
|
8282 | });
|
8283 |
|
8284 | return result;
|
8285 | };
|
8286 |
|
8287 | var toDroppableMap = memoizeOne(function (droppables) {
|
8288 | return droppables.reduce(function (previous, current) {
|
8289 | previous[current.descriptor.id] = current;
|
8290 | return previous;
|
8291 | }, {});
|
8292 | });
|
8293 | var toDraggableMap = memoizeOne(function (draggables) {
|
8294 | return draggables.reduce(function (previous, current) {
|
8295 | previous[current.descriptor.id] = current;
|
8296 | return previous;
|
8297 | }, {});
|
8298 | });
|
8299 | var toDroppableList = memoizeOne(function (droppables) {
|
8300 | return _Object$keys(droppables).map(function (id) {
|
8301 | return droppables[id];
|
8302 | });
|
8303 | });
|
8304 | var toDraggableList = memoizeOne(function (draggables) {
|
8305 | return _Object$keys(draggables).map(function (id) {
|
8306 | return draggables[id];
|
8307 | });
|
8308 | });
|
8309 |
|
8310 | var getDraggablesInsideDroppable = memoizeOne(function (droppable, draggables) {
|
8311 | return toDraggableList(draggables).filter(function (draggable) {
|
8312 | return droppable.descriptor.id === draggable.descriptor.droppableId;
|
8313 | }).sort(function (a, b) {
|
8314 | return a.descriptor.index - b.descriptor.index;
|
8315 | });
|
8316 | });
|
8317 |
|
8318 | var isWithin = (function (lowerBound, upperBound) {
|
8319 | return function (value) {
|
8320 | return value <= upperBound && value >= lowerBound;
|
8321 | };
|
8322 | });
|
8323 |
|
8324 | var isPositionInFrame = (function (frame) {
|
8325 | var isWithinVertical = isWithin(frame.top, frame.bottom);
|
8326 | var isWithinHorizontal = isWithin(frame.left, frame.right);
|
8327 | return function (point) {
|
8328 | return isWithinVertical(point.y) && isWithinVertical(point.y) && isWithinHorizontal(point.x) && isWithinHorizontal(point.x);
|
8329 | };
|
8330 | });
|
8331 |
|
8332 | var getRequiredGrowth = memoizeOne(function (draggable, draggables, droppable) {
|
8333 | var getResult = function getResult(existingSpace) {
|
8334 | var requiredSpace = draggable.page.marginBox[droppable.axis.size];
|
8335 |
|
8336 | if (requiredSpace <= existingSpace) {
|
8337 | return null;
|
8338 | }
|
8339 |
|
8340 | var requiredGrowth = patch(droppable.axis.line, requiredSpace - existingSpace);
|
8341 | return requiredGrowth;
|
8342 | };
|
8343 |
|
8344 | var dimensions = getDraggablesInsideDroppable(droppable, draggables);
|
8345 |
|
8346 | if (!dimensions.length) {
|
8347 | var _existingSpace = droppable.page.marginBox[droppable.axis.size];
|
8348 | return getResult(_existingSpace);
|
8349 | }
|
8350 |
|
8351 | var endOfDraggables = dimensions[dimensions.length - 1].page.marginBox[droppable.axis.end];
|
8352 | var endOfDroppable = droppable.page.marginBox[droppable.axis.end];
|
8353 | var existingSpace = endOfDroppable - endOfDraggables;
|
8354 | return getResult(existingSpace);
|
8355 | });
|
8356 | var getWithGrowth = memoizeOne(function (area, growth) {
|
8357 | return cssBoxModel.getRect(expandByPosition(area, growth));
|
8358 | });
|
8359 |
|
8360 | var getClippedRectWithPlaceholder = function getClippedRectWithPlaceholder(_ref) {
|
8361 | var draggable = _ref.draggable,
|
8362 | draggables = _ref.draggables,
|
8363 | droppable = _ref.droppable,
|
8364 | previousDroppableOverId = _ref.previousDroppableOverId;
|
8365 | var isHome = draggable.descriptor.droppableId === droppable.descriptor.id;
|
8366 | var wasOver = Boolean(previousDroppableOverId && previousDroppableOverId === droppable.descriptor.id);
|
8367 | var clippedPageMarginBox = droppable.viewport.clippedPageMarginBox;
|
8368 |
|
8369 | if (!clippedPageMarginBox) {
|
8370 | return clippedPageMarginBox;
|
8371 | }
|
8372 |
|
8373 | if (isHome || !wasOver) {
|
8374 | return clippedPageMarginBox;
|
8375 | }
|
8376 |
|
8377 | var requiredGrowth = getRequiredGrowth(draggable, draggables, droppable);
|
8378 |
|
8379 | if (!requiredGrowth) {
|
8380 | return clippedPageMarginBox;
|
8381 | }
|
8382 |
|
8383 | var subjectWithGrowth = getWithGrowth(clippedPageMarginBox, requiredGrowth);
|
8384 | var closestScrollable = droppable.viewport.closestScrollable;
|
8385 |
|
8386 | if (!closestScrollable) {
|
8387 | return subjectWithGrowth;
|
8388 | }
|
8389 |
|
8390 | if (!closestScrollable.shouldClipSubject) {
|
8391 | return subjectWithGrowth;
|
8392 | }
|
8393 |
|
8394 | return clip(closestScrollable.framePageMarginBox, subjectWithGrowth);
|
8395 | };
|
8396 |
|
8397 | var getDroppableOver = (function (_ref2) {
|
8398 | var target = _ref2.target,
|
8399 | draggable = _ref2.draggable,
|
8400 | draggables = _ref2.draggables,
|
8401 | droppables = _ref2.droppables,
|
8402 | previousDroppableOverId = _ref2.previousDroppableOverId;
|
8403 | var maybe = toDroppableList(droppables).filter(function (droppable) {
|
8404 | return droppable.isEnabled;
|
8405 | }).find(function (droppable) {
|
8406 | var withPlaceholder = getClippedRectWithPlaceholder({
|
8407 | draggable: draggable,
|
8408 | draggables: draggables,
|
8409 | droppable: droppable,
|
8410 | previousDroppableOverId: previousDroppableOverId
|
8411 | });
|
8412 |
|
8413 | if (!withPlaceholder) {
|
8414 | return false;
|
8415 | }
|
8416 |
|
8417 | return isPositionInFrame(withPlaceholder)(target);
|
8418 | });
|
8419 | return maybe ? maybe.descriptor.id : null;
|
8420 | });
|
8421 |
|
8422 | var noMovement = {
|
8423 | displaced: [],
|
8424 | amount: origin,
|
8425 | isBeyondStartPosition: false
|
8426 | };
|
8427 | var noImpact = {
|
8428 | movement: noMovement,
|
8429 | direction: null,
|
8430 | destination: null
|
8431 | };
|
8432 |
|
8433 | var getDisplacementMap = memoizeOne(function (displaced) {
|
8434 | return displaced.reduce(function (map, displacement) {
|
8435 | map[displacement.draggableId] = displacement;
|
8436 | return map;
|
8437 | }, {});
|
8438 | });
|
8439 |
|
8440 | var isPartiallyVisibleThroughFrame = (function (frame) {
|
8441 | var isWithinVertical = isWithin(frame.top, frame.bottom);
|
8442 | var isWithinHorizontal = isWithin(frame.left, frame.right);
|
8443 | return function (subject) {
|
8444 | var isContained = isWithinVertical(subject.top) && isWithinVertical(subject.bottom) && isWithinHorizontal(subject.left) && isWithinHorizontal(subject.right);
|
8445 |
|
8446 | if (isContained) {
|
8447 | return true;
|
8448 | }
|
8449 |
|
8450 | var isPartiallyVisibleVertically = isWithinVertical(subject.top) || isWithinVertical(subject.bottom);
|
8451 | var isPartiallyVisibleHorizontally = isWithinHorizontal(subject.left) || isWithinHorizontal(subject.right);
|
8452 | var isPartiallyContained = isPartiallyVisibleVertically && isPartiallyVisibleHorizontally;
|
8453 |
|
8454 | if (isPartiallyContained) {
|
8455 | return true;
|
8456 | }
|
8457 |
|
8458 | var isBiggerVertically = subject.top < frame.top && subject.bottom > frame.bottom;
|
8459 | var isBiggerHorizontally = subject.left < frame.left && subject.right > frame.right;
|
8460 | var isTargetBiggerThanFrame = isBiggerVertically && isBiggerHorizontally;
|
8461 |
|
8462 | if (isTargetBiggerThanFrame) {
|
8463 | return true;
|
8464 | }
|
8465 |
|
8466 | var isTargetBiggerOnOneAxis = isBiggerVertically && isPartiallyVisibleHorizontally || isBiggerHorizontally && isPartiallyVisibleVertically;
|
8467 | return isTargetBiggerOnOneAxis;
|
8468 | };
|
8469 | });
|
8470 |
|
8471 | var isTotallyVisibleThroughFrame = (function (frame) {
|
8472 | var isWithinVertical = isWithin(frame.top, frame.bottom);
|
8473 | var isWithinHorizontal = isWithin(frame.left, frame.right);
|
8474 | return function (subject) {
|
8475 | var isContained = isWithinVertical(subject.top) && isWithinVertical(subject.bottom) && isWithinHorizontal(subject.left) && isWithinHorizontal(subject.right);
|
8476 | return isContained;
|
8477 | };
|
8478 | });
|
8479 |
|
8480 | var isVisible = function isVisible(_ref) {
|
8481 | var target = _ref.target,
|
8482 | destination = _ref.destination,
|
8483 | viewport = _ref.viewport,
|
8484 | isVisibleThroughFrameFn = _ref.isVisibleThroughFrameFn;
|
8485 | var displacement = destination.viewport.closestScrollable ? destination.viewport.closestScrollable.scroll.diff.displacement : origin;
|
8486 | var withDisplacement = offsetByPosition(target, displacement);
|
8487 |
|
8488 | if (!destination.viewport.clippedPageMarginBox) {
|
8489 | return false;
|
8490 | }
|
8491 |
|
8492 | var isVisibleInDroppable = isVisibleThroughFrameFn(destination.viewport.clippedPageMarginBox)(withDisplacement);
|
8493 | var isVisibleInViewport = isVisibleThroughFrameFn(viewport)(withDisplacement);
|
8494 | return isVisibleInDroppable && isVisibleInViewport;
|
8495 | };
|
8496 |
|
8497 | var isPartiallyVisible = function isPartiallyVisible(_ref2) {
|
8498 | var target = _ref2.target,
|
8499 | destination = _ref2.destination,
|
8500 | viewport = _ref2.viewport;
|
8501 | return isVisible({
|
8502 | target: target,
|
8503 | destination: destination,
|
8504 | viewport: viewport,
|
8505 | isVisibleThroughFrameFn: isPartiallyVisibleThroughFrame
|
8506 | });
|
8507 | };
|
8508 | var isTotallyVisible = function isTotallyVisible(_ref3) {
|
8509 | var target = _ref3.target,
|
8510 | destination = _ref3.destination,
|
8511 | viewport = _ref3.viewport;
|
8512 | return isVisible({
|
8513 | target: target,
|
8514 | destination: destination,
|
8515 | viewport: viewport,
|
8516 | isVisibleThroughFrameFn: isTotallyVisibleThroughFrame
|
8517 | });
|
8518 | };
|
8519 |
|
8520 | var getDisplacement = (function (_ref) {
|
8521 | var draggable = _ref.draggable,
|
8522 | destination = _ref.destination,
|
8523 | previousImpact = _ref.previousImpact,
|
8524 | viewport = _ref.viewport;
|
8525 | var id = draggable.descriptor.id;
|
8526 | var map = getDisplacementMap(previousImpact.movement.displaced);
|
8527 | var isVisible = isPartiallyVisible({
|
8528 | target: draggable.page.marginBox,
|
8529 | destination: destination,
|
8530 | viewport: viewport
|
8531 | });
|
8532 |
|
8533 | var shouldAnimate = function () {
|
8534 | if (!isVisible) {
|
8535 | return false;
|
8536 | }
|
8537 |
|
8538 | var previous = map[id];
|
8539 |
|
8540 | if (!previous) {
|
8541 | return true;
|
8542 | }
|
8543 |
|
8544 | return previous.shouldAnimate;
|
8545 | }();
|
8546 |
|
8547 | var displacement = {
|
8548 | draggableId: id,
|
8549 | isVisible: isVisible,
|
8550 | shouldAnimate: shouldAnimate
|
8551 | };
|
8552 | return displacement;
|
8553 | });
|
8554 |
|
8555 | var withDroppableScroll = (function (droppable, point) {
|
8556 | var closestScrollable = droppable.viewport.closestScrollable;
|
8557 |
|
8558 | if (!closestScrollable) {
|
8559 | return point;
|
8560 | }
|
8561 |
|
8562 | return add(point, closestScrollable.scroll.diff.value);
|
8563 | });
|
8564 |
|
8565 | var inHomeList = (function (_ref) {
|
8566 | var pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
8567 | draggable = _ref.draggable,
|
8568 | home = _ref.home,
|
8569 | insideHome = _ref.insideHome,
|
8570 | previousImpact = _ref.previousImpact,
|
8571 | viewport = _ref.viewport;
|
8572 | var axis = home.axis;
|
8573 | var originalCenter = draggable.page.borderBox.center;
|
8574 | var currentCenter = withDroppableScroll(home, pageBorderBoxCenter);
|
8575 | var isBeyondStartPosition = currentCenter[axis.line] - originalCenter[axis.line] > 0;
|
8576 | var amount = patch(axis.line, draggable.client.marginBox[axis.size]);
|
8577 | var displaced = insideHome.filter(function (child) {
|
8578 | if (child === draggable) {
|
8579 | return false;
|
8580 | }
|
8581 |
|
8582 | var borderBox = child.page.borderBox;
|
8583 |
|
8584 | if (isBeyondStartPosition) {
|
8585 | if (borderBox.center[axis.line] < originalCenter[axis.line]) {
|
8586 | return false;
|
8587 | }
|
8588 |
|
8589 | return currentCenter[axis.line] > borderBox[axis.start];
|
8590 | }
|
8591 |
|
8592 | if (originalCenter[axis.line] < borderBox.center[axis.line]) {
|
8593 | return false;
|
8594 | }
|
8595 |
|
8596 | return currentCenter[axis.line] < borderBox[axis.end];
|
8597 | }).map(function (dimension) {
|
8598 | return getDisplacement({
|
8599 | draggable: dimension,
|
8600 | destination: home,
|
8601 | previousImpact: previousImpact,
|
8602 | viewport: viewport.frame
|
8603 | });
|
8604 | });
|
8605 | var ordered = isBeyondStartPosition ? displaced.reverse() : displaced;
|
8606 |
|
8607 | var index = function () {
|
8608 | var startIndex = draggable.descriptor.index;
|
8609 | var length = ordered.length;
|
8610 |
|
8611 | if (!length) {
|
8612 | return startIndex;
|
8613 | }
|
8614 |
|
8615 | if (isBeyondStartPosition) {
|
8616 | return startIndex + length;
|
8617 | }
|
8618 |
|
8619 | return startIndex - length;
|
8620 | }();
|
8621 |
|
8622 | var movement = {
|
8623 | amount: amount,
|
8624 | displaced: ordered,
|
8625 | isBeyondStartPosition: isBeyondStartPosition
|
8626 | };
|
8627 | var impact = {
|
8628 | movement: movement,
|
8629 | direction: axis.direction,
|
8630 | destination: {
|
8631 | droppableId: home.descriptor.id,
|
8632 | index: index
|
8633 | }
|
8634 | };
|
8635 | return impact;
|
8636 | });
|
8637 |
|
8638 | var inForeignList = (function (_ref) {
|
8639 | var pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
8640 | draggable = _ref.draggable,
|
8641 | destination = _ref.destination,
|
8642 | insideDestination = _ref.insideDestination,
|
8643 | previousImpact = _ref.previousImpact,
|
8644 | viewport = _ref.viewport;
|
8645 | var axis = destination.axis;
|
8646 | var currentCenter = withDroppableScroll(destination, pageBorderBoxCenter);
|
8647 | var displaced = insideDestination.filter(function (child) {
|
8648 | var threshold = child.page.borderBox[axis.end];
|
8649 | return threshold > currentCenter[axis.line];
|
8650 | }).map(function (dimension) {
|
8651 | return getDisplacement({
|
8652 | draggable: dimension,
|
8653 | destination: destination,
|
8654 | previousImpact: previousImpact,
|
8655 | viewport: viewport.frame
|
8656 | });
|
8657 | });
|
8658 | var newIndex = insideDestination.length - displaced.length;
|
8659 | var movement = {
|
8660 | amount: patch(axis.line, draggable.page.marginBox[axis.size]),
|
8661 | displaced: displaced,
|
8662 | isBeyondStartPosition: false
|
8663 | };
|
8664 | var impact = {
|
8665 | movement: movement,
|
8666 | direction: axis.direction,
|
8667 | destination: {
|
8668 | droppableId: destination.descriptor.id,
|
8669 | index: newIndex
|
8670 | }
|
8671 | };
|
8672 | return impact;
|
8673 | });
|
8674 |
|
8675 | var getDragImpact = (function (_ref) {
|
8676 | var pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
8677 | draggable = _ref.draggable,
|
8678 | draggables = _ref.draggables,
|
8679 | droppables = _ref.droppables,
|
8680 | previousImpact = _ref.previousImpact,
|
8681 | viewport = _ref.viewport;
|
8682 | var previousDroppableOverId = previousImpact.destination && previousImpact.destination.droppableId;
|
8683 | var destinationId = getDroppableOver({
|
8684 | target: pageBorderBoxCenter,
|
8685 | draggable: draggable,
|
8686 | draggables: draggables,
|
8687 | droppables: droppables,
|
8688 | previousDroppableOverId: previousDroppableOverId
|
8689 | });
|
8690 |
|
8691 | if (!destinationId) {
|
8692 | return noImpact;
|
8693 | }
|
8694 |
|
8695 | var destination = droppables[destinationId];
|
8696 |
|
8697 | if (!destination.isEnabled) {
|
8698 | return noImpact;
|
8699 | }
|
8700 |
|
8701 | var home = droppables[draggable.descriptor.droppableId];
|
8702 | var isWithinHomeDroppable = home.descriptor.id === destinationId;
|
8703 | var insideDestination = getDraggablesInsideDroppable(destination, draggables);
|
8704 |
|
8705 | if (isWithinHomeDroppable) {
|
8706 | return inHomeList({
|
8707 | pageBorderBoxCenter: pageBorderBoxCenter,
|
8708 | draggable: draggable,
|
8709 | home: home,
|
8710 | insideHome: insideDestination,
|
8711 | previousImpact: previousImpact || noImpact,
|
8712 | viewport: viewport
|
8713 | });
|
8714 | }
|
8715 |
|
8716 | return inForeignList({
|
8717 | pageBorderBoxCenter: pageBorderBoxCenter,
|
8718 | draggable: draggable,
|
8719 | destination: destination,
|
8720 | insideDestination: insideDestination,
|
8721 | previousImpact: previousImpact || noImpact,
|
8722 | viewport: viewport
|
8723 | });
|
8724 | });
|
8725 |
|
8726 | var getHomeLocation = (function (critical) {
|
8727 | return {
|
8728 | index: critical.draggable.index,
|
8729 | droppableId: critical.droppable.id
|
8730 | };
|
8731 | });
|
8732 |
|
8733 | var getSafeClipped = function getSafeClipped(droppable) {
|
8734 | var rect = droppable.viewport.clippedPageMarginBox;
|
8735 | !rect ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get clipped area from droppable') : invariant(false) : void 0;
|
8736 | return rect;
|
8737 | };
|
8738 |
|
8739 | var getBestCrossAxisDroppable = (function (_ref) {
|
8740 | var isMovingForward = _ref.isMovingForward,
|
8741 | pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
8742 | source = _ref.source,
|
8743 | droppables = _ref.droppables,
|
8744 | viewport = _ref.viewport;
|
8745 | var sourceClipped = source.viewport.clippedPageMarginBox;
|
8746 |
|
8747 | if (!sourceClipped) {
|
8748 | return null;
|
8749 | }
|
8750 |
|
8751 | var axis = source.axis;
|
8752 | var isBetweenSourceClipped = isWithin(sourceClipped[axis.start], sourceClipped[axis.end]);
|
8753 | var candidates = toDroppableList(droppables).filter(function (droppable) {
|
8754 | return droppable !== source;
|
8755 | }).filter(function (droppable) {
|
8756 | return droppable.isEnabled;
|
8757 | }).filter(function (droppable) {
|
8758 | var clippedPageMarginBox = droppable.viewport.clippedPageMarginBox;
|
8759 |
|
8760 | if (!clippedPageMarginBox) {
|
8761 | return false;
|
8762 | }
|
8763 |
|
8764 | return isPartiallyVisibleThroughFrame(viewport.frame)(clippedPageMarginBox);
|
8765 | }).filter(function (droppable) {
|
8766 | var targetClipped = getSafeClipped(droppable);
|
8767 |
|
8768 | if (isMovingForward) {
|
8769 | return sourceClipped[axis.crossAxisEnd] < targetClipped[axis.crossAxisEnd];
|
8770 | }
|
8771 |
|
8772 | return targetClipped[axis.crossAxisStart] < sourceClipped[axis.crossAxisStart];
|
8773 | }).filter(function (droppable) {
|
8774 | var targetClipped = getSafeClipped(droppable);
|
8775 | var isBetweenDestinationClipped = isWithin(targetClipped[axis.start], targetClipped[axis.end]);
|
8776 | return isBetweenSourceClipped(targetClipped[axis.start]) || isBetweenSourceClipped(targetClipped[axis.end]) || isBetweenDestinationClipped(sourceClipped[axis.start]) || isBetweenDestinationClipped(sourceClipped[axis.end]);
|
8777 | }).sort(function (a, b) {
|
8778 | var first = getSafeClipped(a)[axis.crossAxisStart];
|
8779 | var second = getSafeClipped(b)[axis.crossAxisStart];
|
8780 |
|
8781 | if (isMovingForward) {
|
8782 | return first - second;
|
8783 | }
|
8784 |
|
8785 | return second - first;
|
8786 | }).filter(function (droppable, index, array) {
|
8787 | return getSafeClipped(droppable)[axis.crossAxisStart] === getSafeClipped(array[0])[axis.crossAxisStart];
|
8788 | });
|
8789 |
|
8790 | if (!candidates.length) {
|
8791 | return null;
|
8792 | }
|
8793 |
|
8794 | if (candidates.length === 1) {
|
8795 | return candidates[0];
|
8796 | }
|
8797 |
|
8798 | var contains = candidates.filter(function (droppable) {
|
8799 | var isWithinDroppable = isWithin(getSafeClipped(droppable)[axis.start], getSafeClipped(droppable)[axis.end]);
|
8800 | return isWithinDroppable(pageBorderBoxCenter[axis.line]);
|
8801 | });
|
8802 |
|
8803 | if (contains.length === 1) {
|
8804 | return contains[0];
|
8805 | }
|
8806 |
|
8807 | if (contains.length > 1) {
|
8808 | return contains.sort(function (a, b) {
|
8809 | return getSafeClipped(a)[axis.start] - getSafeClipped(b)[axis.start];
|
8810 | })[0];
|
8811 | }
|
8812 |
|
8813 | return candidates.sort(function (a, b) {
|
8814 | var first = closest(pageBorderBoxCenter, getCorners(getSafeClipped(a)));
|
8815 | var second = closest(pageBorderBoxCenter, getCorners(getSafeClipped(b)));
|
8816 |
|
8817 | if (first !== second) {
|
8818 | return first - second;
|
8819 | }
|
8820 |
|
8821 | return getSafeClipped(a)[axis.start] - getSafeClipped(b)[axis.start];
|
8822 | })[0];
|
8823 | });
|
8824 |
|
8825 | var withDroppableDisplacement = (function (droppable, point) {
|
8826 | var closestScrollable = droppable.viewport.closestScrollable;
|
8827 |
|
8828 | if (!closestScrollable) {
|
8829 | return point;
|
8830 | }
|
8831 |
|
8832 | return add(point, closestScrollable.scroll.diff.displacement);
|
8833 | });
|
8834 |
|
8835 | var getClosestDraggable = (function (_ref) {
|
8836 | var axis = _ref.axis,
|
8837 | viewport = _ref.viewport,
|
8838 | pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
8839 | destination = _ref.destination,
|
8840 | insideDestination = _ref.insideDestination;
|
8841 |
|
8842 | if (!insideDestination.length) {
|
8843 | return null;
|
8844 | }
|
8845 |
|
8846 | var result = insideDestination.filter(function (draggable) {
|
8847 | return isTotallyVisible({
|
8848 | target: draggable.page.borderBox,
|
8849 | destination: destination,
|
8850 | viewport: viewport.frame
|
8851 | });
|
8852 | }).sort(function (a, b) {
|
8853 | var distanceToA = distance(pageBorderBoxCenter, withDroppableDisplacement(destination, a.page.borderBox.center));
|
8854 | var distanceToB = distance(pageBorderBoxCenter, withDroppableDisplacement(destination, b.page.borderBox.center));
|
8855 |
|
8856 | if (distanceToA < distanceToB) {
|
8857 | return -1;
|
8858 | }
|
8859 |
|
8860 | if (distanceToB < distanceToA) {
|
8861 | return 1;
|
8862 | }
|
8863 |
|
8864 | return a.page.borderBox[axis.start] - b.page.borderBox[axis.start];
|
8865 | });
|
8866 | return result.length ? result[0] : null;
|
8867 | });
|
8868 |
|
8869 | var moveToEdge = (function (_ref) {
|
8870 | var source = _ref.source,
|
8871 | sourceEdge = _ref.sourceEdge,
|
8872 | destination = _ref.destination,
|
8873 | destinationEdge = _ref.destinationEdge,
|
8874 | destinationAxis = _ref.destinationAxis;
|
8875 |
|
8876 | var getCorner = function getCorner(area) {
|
8877 | return patch(destinationAxis.line, area[destinationAxis[destinationEdge]], area[destinationAxis.crossAxisStart]);
|
8878 | };
|
8879 |
|
8880 | var corner = getCorner(destination);
|
8881 | var centerDiff = absolute(subtract(source.center, getCorner(source)));
|
8882 | var signed = patch(destinationAxis.line, (sourceEdge === 'end' ? -1 : 1) * centerDiff[destinationAxis.line], centerDiff[destinationAxis.crossAxisLine]);
|
8883 | return add(corner, signed);
|
8884 | });
|
8885 |
|
8886 | var toHomeList = (function (_ref) {
|
8887 | var amount = _ref.amount,
|
8888 | homeIndex = _ref.homeIndex,
|
8889 | movingRelativeTo = _ref.movingRelativeTo,
|
8890 | insideDestination = _ref.insideDestination,
|
8891 | draggable = _ref.draggable,
|
8892 | destination = _ref.destination,
|
8893 | previousImpact = _ref.previousImpact,
|
8894 | viewport = _ref.viewport;
|
8895 | var axis = destination.axis;
|
8896 | var targetIndex = insideDestination.indexOf(movingRelativeTo);
|
8897 | !(targetIndex !== -1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Unable to find target in destination droppable') : invariant(false) : void 0;
|
8898 |
|
8899 | if (targetIndex === homeIndex) {
|
8900 | var _newCenter = draggable.page.borderBox.center;
|
8901 | var _newImpact = {
|
8902 | movement: {
|
8903 | displaced: [],
|
8904 | amount: amount,
|
8905 | isBeyondStartPosition: false
|
8906 | },
|
8907 | direction: destination.axis.direction,
|
8908 | destination: {
|
8909 | droppableId: destination.descriptor.id,
|
8910 | index: homeIndex
|
8911 | }
|
8912 | };
|
8913 | return {
|
8914 | pageBorderBoxCenter: withDroppableDisplacement(destination, _newCenter),
|
8915 | impact: _newImpact
|
8916 | };
|
8917 | }
|
8918 |
|
8919 | var isMovingPastOriginalIndex = targetIndex > homeIndex;
|
8920 | var edge = isMovingPastOriginalIndex ? 'end' : 'start';
|
8921 | var newCenter = moveToEdge({
|
8922 | source: draggable.page.borderBox,
|
8923 | sourceEdge: edge,
|
8924 | destination: isMovingPastOriginalIndex ? movingRelativeTo.page.borderBox : movingRelativeTo.page.marginBox,
|
8925 | destinationEdge: edge,
|
8926 | destinationAxis: axis
|
8927 | });
|
8928 |
|
8929 | var modified = function () {
|
8930 | if (!isMovingPastOriginalIndex) {
|
8931 | return insideDestination.slice(targetIndex, homeIndex);
|
8932 | }
|
8933 |
|
8934 | var from = homeIndex + 1;
|
8935 | var to = targetIndex + 1;
|
8936 | return insideDestination.slice(from, to).reverse();
|
8937 | }();
|
8938 |
|
8939 | var displaced = modified.map(function (dimension) {
|
8940 | return getDisplacement({
|
8941 | draggable: dimension,
|
8942 | destination: destination,
|
8943 | previousImpact: previousImpact,
|
8944 | viewport: viewport.frame
|
8945 | });
|
8946 | });
|
8947 | var newImpact = {
|
8948 | movement: {
|
8949 | displaced: displaced,
|
8950 | amount: amount,
|
8951 | isBeyondStartPosition: isMovingPastOriginalIndex
|
8952 | },
|
8953 | direction: axis.direction,
|
8954 | destination: {
|
8955 | droppableId: destination.descriptor.id,
|
8956 | index: targetIndex
|
8957 | }
|
8958 | };
|
8959 | return {
|
8960 | pageBorderBoxCenter: withDroppableDisplacement(destination, newCenter),
|
8961 | impact: newImpact
|
8962 | };
|
8963 | });
|
8964 |
|
8965 | var toForeignList = (function (_ref) {
|
8966 | var amount = _ref.amount,
|
8967 | pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
8968 | movingRelativeTo = _ref.movingRelativeTo,
|
8969 | insideDestination = _ref.insideDestination,
|
8970 | draggable = _ref.draggable,
|
8971 | destination = _ref.destination,
|
8972 | previousImpact = _ref.previousImpact,
|
8973 | viewport = _ref.viewport;
|
8974 | var axis = destination.axis;
|
8975 | var isGoingBeforeTarget = Boolean(movingRelativeTo && pageBorderBoxCenter[destination.axis.line] < movingRelativeTo.page.borderBox.center[destination.axis.line]);
|
8976 |
|
8977 | if (!movingRelativeTo) {
|
8978 | var _newCenter = moveToEdge({
|
8979 | source: draggable.page.borderBox,
|
8980 | sourceEdge: 'start',
|
8981 | destination: destination.page.contentBox,
|
8982 | destinationEdge: 'start',
|
8983 | destinationAxis: axis
|
8984 | });
|
8985 |
|
8986 | var _newImpact = {
|
8987 | movement: {
|
8988 | displaced: [],
|
8989 | amount: amount,
|
8990 | isBeyondStartPosition: false
|
8991 | },
|
8992 | direction: axis.direction,
|
8993 | destination: {
|
8994 | droppableId: destination.descriptor.id,
|
8995 | index: 0
|
8996 | }
|
8997 | };
|
8998 | return {
|
8999 | pageBorderBoxCenter: withDroppableDisplacement(destination, _newCenter),
|
9000 | impact: _newImpact
|
9001 | };
|
9002 | }
|
9003 |
|
9004 | var targetIndex = insideDestination.indexOf(movingRelativeTo);
|
9005 | !(targetIndex !== -1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'The target was not found within its droppable') : invariant(false) : void 0;
|
9006 | var proposedIndex = isGoingBeforeTarget ? targetIndex : targetIndex + 1;
|
9007 | var newCenter = moveToEdge({
|
9008 | source: draggable.page.borderBox,
|
9009 | sourceEdge: 'start',
|
9010 | destination: movingRelativeTo.page.marginBox,
|
9011 | destinationEdge: isGoingBeforeTarget ? 'start' : 'end',
|
9012 | destinationAxis: axis
|
9013 | });
|
9014 | var displaced = insideDestination.slice(proposedIndex, insideDestination.length).map(function (dimension) {
|
9015 | return getDisplacement({
|
9016 | draggable: dimension,
|
9017 | destination: destination,
|
9018 | viewport: viewport.frame,
|
9019 | previousImpact: previousImpact
|
9020 | });
|
9021 | });
|
9022 | var newImpact = {
|
9023 | movement: {
|
9024 | displaced: displaced,
|
9025 | amount: amount,
|
9026 | isBeyondStartPosition: false
|
9027 | },
|
9028 | direction: axis.direction,
|
9029 | destination: {
|
9030 | droppableId: destination.descriptor.id,
|
9031 | index: proposedIndex
|
9032 | }
|
9033 | };
|
9034 | return {
|
9035 | pageBorderBoxCenter: withDroppableDisplacement(destination, newCenter),
|
9036 | impact: newImpact
|
9037 | };
|
9038 | });
|
9039 |
|
9040 | var moveToNewDroppable = (function (_ref) {
|
9041 | var pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
9042 | destination = _ref.destination,
|
9043 | insideDestination = _ref.insideDestination,
|
9044 | draggable = _ref.draggable,
|
9045 | movingRelativeTo = _ref.movingRelativeTo,
|
9046 | home = _ref.home,
|
9047 | previousImpact = _ref.previousImpact,
|
9048 | viewport = _ref.viewport;
|
9049 | var amount = patch(destination.axis.line, draggable.client.marginBox[destination.axis.size]);
|
9050 |
|
9051 | if (destination.descriptor.id === draggable.descriptor.droppableId) {
|
9052 | !movingRelativeTo ? process.env.NODE_ENV !== "production" ? invariant(false, 'There will always be a target in the original list') : invariant(false) : void 0;
|
9053 | return toHomeList({
|
9054 | amount: amount,
|
9055 | homeIndex: home.index,
|
9056 | movingRelativeTo: movingRelativeTo,
|
9057 | insideDestination: insideDestination,
|
9058 | draggable: draggable,
|
9059 | destination: destination,
|
9060 | previousImpact: previousImpact,
|
9061 | viewport: viewport
|
9062 | });
|
9063 | }
|
9064 |
|
9065 | return toForeignList({
|
9066 | amount: amount,
|
9067 | pageBorderBoxCenter: pageBorderBoxCenter,
|
9068 | movingRelativeTo: movingRelativeTo,
|
9069 | insideDestination: insideDestination,
|
9070 | draggable: draggable,
|
9071 | destination: destination,
|
9072 | previousImpact: previousImpact,
|
9073 | viewport: viewport
|
9074 | });
|
9075 | });
|
9076 |
|
9077 | var moveCrossAxis = (function (_ref) {
|
9078 | var isMovingForward = _ref.isMovingForward,
|
9079 | pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
9080 | draggableId = _ref.draggableId,
|
9081 | droppableId = _ref.droppableId,
|
9082 | home = _ref.home,
|
9083 | draggables = _ref.draggables,
|
9084 | droppables = _ref.droppables,
|
9085 | previousImpact = _ref.previousImpact,
|
9086 | viewport = _ref.viewport;
|
9087 | var draggable = draggables[draggableId];
|
9088 | var source = droppables[droppableId];
|
9089 | var destination = getBestCrossAxisDroppable({
|
9090 | isMovingForward: isMovingForward,
|
9091 | pageBorderBoxCenter: pageBorderBoxCenter,
|
9092 | source: source,
|
9093 | droppables: droppables,
|
9094 | viewport: viewport
|
9095 | });
|
9096 |
|
9097 | if (!destination) {
|
9098 | return null;
|
9099 | }
|
9100 |
|
9101 | var insideDestination = getDraggablesInsideDroppable(destination, draggables);
|
9102 | var movingRelativeTo = getClosestDraggable({
|
9103 | axis: destination.axis,
|
9104 | pageBorderBoxCenter: pageBorderBoxCenter,
|
9105 | destination: destination,
|
9106 | insideDestination: insideDestination,
|
9107 | viewport: viewport
|
9108 | });
|
9109 |
|
9110 | if (insideDestination.length && !movingRelativeTo) {
|
9111 | return null;
|
9112 | }
|
9113 |
|
9114 | return moveToNewDroppable({
|
9115 | pageBorderBoxCenter: pageBorderBoxCenter,
|
9116 | destination: destination,
|
9117 | draggable: draggable,
|
9118 | movingRelativeTo: movingRelativeTo,
|
9119 | insideDestination: insideDestination,
|
9120 | home: home,
|
9121 | previousImpact: previousImpact || noImpact,
|
9122 | viewport: viewport
|
9123 | });
|
9124 | });
|
9125 |
|
9126 | var isTotallyVisibleInNewLocation = (function (_ref) {
|
9127 | var draggable = _ref.draggable,
|
9128 | destination = _ref.destination,
|
9129 | newPageBorderBoxCenter = _ref.newPageBorderBoxCenter,
|
9130 | viewport = _ref.viewport;
|
9131 | var diff = subtract(newPageBorderBoxCenter, draggable.page.borderBox.center);
|
9132 | var shifted = offsetByPosition(draggable.page.borderBox, diff);
|
9133 | return isTotallyVisible({
|
9134 | target: shifted,
|
9135 | destination: destination,
|
9136 | viewport: viewport
|
9137 | });
|
9138 | });
|
9139 |
|
9140 | var withFirstAdded = function withFirstAdded(_ref) {
|
9141 | var add = _ref.add,
|
9142 | previousImpact = _ref.previousImpact,
|
9143 | droppable = _ref.droppable,
|
9144 | draggables = _ref.draggables,
|
9145 | viewport = _ref.viewport;
|
9146 | var newDisplacement = {
|
9147 | draggableId: add,
|
9148 | isVisible: true,
|
9149 | shouldAnimate: true
|
9150 | };
|
9151 | var added = [newDisplacement].concat(previousImpact.movement.displaced);
|
9152 | var withUpdatedVisibility = added.map(function (current) {
|
9153 | if (current === newDisplacement) {
|
9154 | return current;
|
9155 | }
|
9156 |
|
9157 | var updated = getDisplacement({
|
9158 | draggable: draggables[current.draggableId],
|
9159 | destination: droppable,
|
9160 | previousImpact: previousImpact,
|
9161 | viewport: viewport.frame
|
9162 | });
|
9163 | return updated;
|
9164 | });
|
9165 | return withUpdatedVisibility;
|
9166 | };
|
9167 |
|
9168 | var forceVisibleDisplacement = function forceVisibleDisplacement(current) {
|
9169 | if (current.isVisible) {
|
9170 | return current;
|
9171 | }
|
9172 |
|
9173 | return {
|
9174 | draggableId: current.draggableId,
|
9175 | isVisible: true,
|
9176 | shouldAnimate: false
|
9177 | };
|
9178 | };
|
9179 |
|
9180 | var withFirstRemoved = function withFirstRemoved(_ref2) {
|
9181 | var dragging = _ref2.dragging,
|
9182 | isVisibleInNewLocation = _ref2.isVisibleInNewLocation,
|
9183 | previousImpact = _ref2.previousImpact,
|
9184 | droppable = _ref2.droppable,
|
9185 | draggables = _ref2.draggables;
|
9186 | var last = previousImpact.movement.displaced;
|
9187 | !last.length ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot remove displacement from empty list') : invariant(false) : void 0;
|
9188 | var withFirstRestored = last.slice(1, last.length);
|
9189 |
|
9190 | if (!withFirstRestored.length) {
|
9191 | return withFirstRestored;
|
9192 | }
|
9193 |
|
9194 | if (isVisibleInNewLocation) {
|
9195 | return withFirstRestored;
|
9196 | }
|
9197 |
|
9198 | var axis = droppable.axis;
|
9199 | var sizeOfRestored = draggables[last[0].draggableId].page.marginBox[axis.size];
|
9200 | var sizeOfDragging = draggables[dragging].page.marginBox[axis.size];
|
9201 | var buffer = sizeOfRestored + sizeOfDragging;
|
9202 | var withUpdatedVisibility = withFirstRestored.map(function (displacement, index) {
|
9203 | if (index === 0) {
|
9204 | return forceVisibleDisplacement(displacement);
|
9205 | }
|
9206 |
|
9207 | if (buffer > 0) {
|
9208 | var current = draggables[displacement.draggableId];
|
9209 | var size = current.page.marginBox[axis.size];
|
9210 | buffer -= size;
|
9211 | return forceVisibleDisplacement(displacement);
|
9212 | }
|
9213 |
|
9214 | return {
|
9215 | draggableId: displacement.draggableId,
|
9216 | isVisible: false,
|
9217 | shouldAnimate: false
|
9218 | };
|
9219 | });
|
9220 | return withUpdatedVisibility;
|
9221 | };
|
9222 |
|
9223 | var inHomeList$1 = (function (_ref) {
|
9224 | var isMovingForward = _ref.isMovingForward,
|
9225 | draggableId = _ref.draggableId,
|
9226 | previousPageBorderBoxCenter = _ref.previousPageBorderBoxCenter,
|
9227 | previousImpact = _ref.previousImpact,
|
9228 | droppable = _ref.droppable,
|
9229 | draggables = _ref.draggables,
|
9230 | viewport = _ref.viewport;
|
9231 | var location = previousImpact.destination;
|
9232 | !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;
|
9233 | var draggable = draggables[draggableId];
|
9234 | var axis = droppable.axis;
|
9235 | var insideDroppable = getDraggablesInsideDroppable(droppable, draggables);
|
9236 | var startIndex = draggable.descriptor.index;
|
9237 | var currentIndex = location.index;
|
9238 | var proposedIndex = isMovingForward ? currentIndex + 1 : currentIndex - 1;
|
9239 |
|
9240 | if (proposedIndex > insideDroppable.length - 1) {
|
9241 | return null;
|
9242 | }
|
9243 |
|
9244 | if (proposedIndex < 0) {
|
9245 | return null;
|
9246 | }
|
9247 |
|
9248 | var destination = insideDroppable[proposedIndex];
|
9249 | var isMovingTowardStart = isMovingForward && proposedIndex <= startIndex || !isMovingForward && proposedIndex >= startIndex;
|
9250 |
|
9251 | var edge = function () {
|
9252 | if (!isMovingTowardStart) {
|
9253 | return isMovingForward ? 'end' : 'start';
|
9254 | }
|
9255 |
|
9256 | return isMovingForward ? 'start' : 'end';
|
9257 | }();
|
9258 |
|
9259 | var newPageBorderBoxCenter = moveToEdge({
|
9260 | source: draggable.page.borderBox,
|
9261 | sourceEdge: edge,
|
9262 | destination: destination.page.borderBox,
|
9263 | destinationEdge: edge,
|
9264 | destinationAxis: droppable.axis
|
9265 | });
|
9266 | var isVisibleInNewLocation = isTotallyVisibleInNewLocation({
|
9267 | draggable: draggable,
|
9268 | destination: droppable,
|
9269 | newPageBorderBoxCenter: newPageBorderBoxCenter,
|
9270 | viewport: viewport.frame
|
9271 | });
|
9272 | var displaced = isMovingTowardStart ? withFirstRemoved({
|
9273 | dragging: draggableId,
|
9274 | isVisibleInNewLocation: isVisibleInNewLocation,
|
9275 | previousImpact: previousImpact,
|
9276 | droppable: droppable,
|
9277 | draggables: draggables
|
9278 | }) : withFirstAdded({
|
9279 | add: destination.descriptor.id,
|
9280 | previousImpact: previousImpact,
|
9281 | droppable: droppable,
|
9282 | draggables: draggables,
|
9283 | viewport: viewport
|
9284 | });
|
9285 | var newImpact = {
|
9286 | movement: {
|
9287 | displaced: displaced,
|
9288 | amount: patch(axis.line, draggable.page.marginBox[axis.size]),
|
9289 | isBeyondStartPosition: proposedIndex > startIndex
|
9290 | },
|
9291 | destination: {
|
9292 | droppableId: droppable.descriptor.id,
|
9293 | index: proposedIndex
|
9294 | },
|
9295 | direction: droppable.axis.direction
|
9296 | };
|
9297 |
|
9298 | if (isVisibleInNewLocation) {
|
9299 | return {
|
9300 | pageBorderBoxCenter: withDroppableDisplacement(droppable, newPageBorderBoxCenter),
|
9301 | impact: newImpact,
|
9302 | scrollJumpRequest: null
|
9303 | };
|
9304 | }
|
9305 |
|
9306 | var distance$$1 = subtract(newPageBorderBoxCenter, previousPageBorderBoxCenter);
|
9307 | var distanceWithScroll = withDroppableDisplacement(droppable, distance$$1);
|
9308 | return {
|
9309 | pageBorderBoxCenter: previousPageBorderBoxCenter,
|
9310 | impact: newImpact,
|
9311 | scrollJumpRequest: distanceWithScroll
|
9312 | };
|
9313 | });
|
9314 |
|
9315 | var inForeignList$1 = (function (_ref) {
|
9316 | var isMovingForward = _ref.isMovingForward,
|
9317 | draggableId = _ref.draggableId,
|
9318 | previousImpact = _ref.previousImpact,
|
9319 | previousPageBorderBoxCenter = _ref.previousPageBorderBoxCenter,
|
9320 | droppable = _ref.droppable,
|
9321 | draggables = _ref.draggables,
|
9322 | viewport = _ref.viewport;
|
9323 | !previousImpact.destination ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot move to next index where there is no previous destination') : invariant(false) : void 0;
|
9324 | var location = previousImpact.destination;
|
9325 | var draggable = draggables[draggableId];
|
9326 | var axis = droppable.axis;
|
9327 | var insideForeignDroppable = getDraggablesInsideDroppable(droppable, draggables);
|
9328 | var currentIndex = location.index;
|
9329 | var proposedIndex = isMovingForward ? currentIndex + 1 : currentIndex - 1;
|
9330 | var lastIndex = insideForeignDroppable.length - 1;
|
9331 |
|
9332 | if (proposedIndex > insideForeignDroppable.length) {
|
9333 | return null;
|
9334 | }
|
9335 |
|
9336 | if (proposedIndex < 0) {
|
9337 | return null;
|
9338 | }
|
9339 |
|
9340 | var movingRelativeTo = insideForeignDroppable[Math.min(proposedIndex, lastIndex)];
|
9341 | var isMovingPastLastIndex = proposedIndex > lastIndex;
|
9342 | var sourceEdge = 'start';
|
9343 |
|
9344 | var destinationEdge = function () {
|
9345 | if (isMovingPastLastIndex) {
|
9346 | return 'end';
|
9347 | }
|
9348 |
|
9349 | return 'start';
|
9350 | }();
|
9351 |
|
9352 | var newPageBorderBoxCenter = moveToEdge({
|
9353 | source: draggable.page.borderBox,
|
9354 | sourceEdge: sourceEdge,
|
9355 | destination: movingRelativeTo.page.marginBox,
|
9356 | destinationEdge: destinationEdge,
|
9357 | destinationAxis: droppable.axis
|
9358 | });
|
9359 | var isVisibleInNewLocation = isTotallyVisibleInNewLocation({
|
9360 | draggable: draggable,
|
9361 | destination: droppable,
|
9362 | newPageBorderBoxCenter: newPageBorderBoxCenter,
|
9363 | viewport: viewport.frame
|
9364 | });
|
9365 |
|
9366 | var displaced = function () {
|
9367 | if (isMovingForward) {
|
9368 | return withFirstRemoved({
|
9369 | dragging: draggableId,
|
9370 | isVisibleInNewLocation: isVisibleInNewLocation,
|
9371 | previousImpact: previousImpact,
|
9372 | droppable: droppable,
|
9373 | draggables: draggables
|
9374 | });
|
9375 | }
|
9376 |
|
9377 | return withFirstAdded({
|
9378 | add: movingRelativeTo.descriptor.id,
|
9379 | previousImpact: previousImpact,
|
9380 | droppable: droppable,
|
9381 | draggables: draggables,
|
9382 | viewport: viewport
|
9383 | });
|
9384 | }();
|
9385 |
|
9386 | var newImpact = {
|
9387 | movement: {
|
9388 | displaced: displaced,
|
9389 | amount: patch(axis.line, draggable.page.marginBox[axis.size]),
|
9390 | isBeyondStartPosition: false
|
9391 | },
|
9392 | destination: {
|
9393 | droppableId: droppable.descriptor.id,
|
9394 | index: proposedIndex
|
9395 | },
|
9396 | direction: droppable.axis.direction
|
9397 | };
|
9398 |
|
9399 | if (isVisibleInNewLocation) {
|
9400 | return {
|
9401 | pageBorderBoxCenter: withDroppableDisplacement(droppable, newPageBorderBoxCenter),
|
9402 | impact: newImpact,
|
9403 | scrollJumpRequest: null
|
9404 | };
|
9405 | }
|
9406 |
|
9407 | var distanceMoving = subtract(newPageBorderBoxCenter, previousPageBorderBoxCenter);
|
9408 | var distanceWithScroll = withDroppableDisplacement(droppable, distanceMoving);
|
9409 | return {
|
9410 | pageBorderBoxCenter: previousPageBorderBoxCenter,
|
9411 | impact: newImpact,
|
9412 | scrollJumpRequest: distanceWithScroll
|
9413 | };
|
9414 | });
|
9415 |
|
9416 | var moveToNextIndex = (function (args) {
|
9417 | var draggableId = args.draggableId,
|
9418 | draggables = args.draggables,
|
9419 | droppable = args.droppable;
|
9420 | var draggable = draggables[draggableId];
|
9421 | var isInHomeList = draggable.descriptor.droppableId === droppable.descriptor.id;
|
9422 |
|
9423 | if (!droppable.isEnabled) {
|
9424 | return null;
|
9425 | }
|
9426 |
|
9427 | if (isInHomeList) {
|
9428 | return inHomeList$1(args);
|
9429 | }
|
9430 |
|
9431 | return inForeignList$1(args);
|
9432 | });
|
9433 |
|
9434 | var getClientSelection = function getClientSelection(pageBorderBoxCenter, currentScroll) {
|
9435 | return subtract(pageBorderBoxCenter, currentScroll);
|
9436 | };
|
9437 |
|
9438 | var moveInDirection = (function (_ref) {
|
9439 | var state = _ref.state,
|
9440 | type = _ref.type;
|
9441 |
|
9442 | var _ref2 = function () {
|
9443 | if (state.impact.destination) {
|
9444 | return {
|
9445 | droppable: state.dimensions.droppables[state.impact.destination.droppableId],
|
9446 | isMainAxisMovementAllowed: true
|
9447 | };
|
9448 | }
|
9449 |
|
9450 | return {
|
9451 | droppable: state.dimensions.droppables[state.critical.droppable.id],
|
9452 | isMainAxisMovementAllowed: false
|
9453 | };
|
9454 | }(),
|
9455 | droppable = _ref2.droppable,
|
9456 | isMainAxisMovementAllowed = _ref2.isMainAxisMovementAllowed;
|
9457 |
|
9458 | var direction = droppable.axis.direction;
|
9459 | var isMovingOnMainAxis = direction === 'vertical' && (type === 'MOVE_UP' || type === 'MOVE_DOWN') || direction === 'horizontal' && (type === 'MOVE_LEFT' || type === 'MOVE_RIGHT');
|
9460 |
|
9461 | if (isMovingOnMainAxis && !isMainAxisMovementAllowed) {
|
9462 | return null;
|
9463 | }
|
9464 |
|
9465 | var isMovingForward = type === 'MOVE_DOWN' || type === 'MOVE_RIGHT';
|
9466 |
|
9467 | if (isMovingOnMainAxis) {
|
9468 | var _result = moveToNextIndex({
|
9469 | isMovingForward: isMovingForward,
|
9470 | draggableId: state.critical.draggable.id,
|
9471 | droppable: droppable,
|
9472 | draggables: state.dimensions.draggables,
|
9473 | previousPageBorderBoxCenter: state.current.page.borderBoxCenter,
|
9474 | previousImpact: state.impact,
|
9475 | viewport: state.viewport
|
9476 | });
|
9477 |
|
9478 | if (!_result) {
|
9479 | return null;
|
9480 | }
|
9481 |
|
9482 | return {
|
9483 | impact: _result.impact,
|
9484 | clientSelection: getClientSelection(_result.pageBorderBoxCenter, state.viewport.scroll.current),
|
9485 | scrollJumpRequest: _result.scrollJumpRequest
|
9486 | };
|
9487 | }
|
9488 |
|
9489 | var home = getHomeLocation(state.critical);
|
9490 | var result = moveCrossAxis({
|
9491 | isMovingForward: isMovingForward,
|
9492 | pageBorderBoxCenter: state.current.page.borderBoxCenter,
|
9493 | draggableId: state.critical.draggable.id,
|
9494 | droppableId: droppable.descriptor.id,
|
9495 | home: home,
|
9496 | draggables: state.dimensions.draggables,
|
9497 | droppables: state.dimensions.droppables,
|
9498 | previousImpact: state.impact,
|
9499 | viewport: state.viewport
|
9500 | });
|
9501 |
|
9502 | if (!result) {
|
9503 | return null;
|
9504 | }
|
9505 |
|
9506 | return {
|
9507 | clientSelection: getClientSelection(result.pageBorderBoxCenter, state.viewport.scroll.current),
|
9508 | impact: result.impact,
|
9509 | scrollJumpRequest: null
|
9510 | };
|
9511 | });
|
9512 |
|
9513 | var scrollViewport = (function (viewport, newScroll) {
|
9514 | var diff = subtract(newScroll, viewport.scroll.initial);
|
9515 | var displacement = negate(diff);
|
9516 | var frame = cssBoxModel.getRect({
|
9517 | top: newScroll.y,
|
9518 | bottom: newScroll.y + viewport.frame.height,
|
9519 | left: newScroll.x,
|
9520 | right: newScroll.x + viewport.frame.width
|
9521 | });
|
9522 | var updated = {
|
9523 | frame: frame,
|
9524 | scroll: {
|
9525 | initial: viewport.scroll.initial,
|
9526 | max: viewport.scroll.max,
|
9527 | current: newScroll,
|
9528 | diff: {
|
9529 | value: diff,
|
9530 | displacement: displacement
|
9531 | }
|
9532 | }
|
9533 | };
|
9534 | return updated;
|
9535 | });
|
9536 |
|
9537 | var getHomeImpact = (function (critical, dimensions) {
|
9538 | var home = dimensions.droppables[critical.droppable.id];
|
9539 | var axis = home.axis;
|
9540 | var draggable = dimensions.draggables[critical.draggable.id];
|
9541 | return {
|
9542 | movement: {
|
9543 | displaced: [],
|
9544 | isBeyondStartPosition: false,
|
9545 | amount: patch(axis.line, draggable.client.marginBox[axis.size])
|
9546 | },
|
9547 | direction: axis.direction,
|
9548 | destination: getHomeLocation(critical)
|
9549 | };
|
9550 | });
|
9551 |
|
9552 | var getPageItemPositions = (function (client, windowScroll) {
|
9553 | return {
|
9554 | selection: add(client.selection, windowScroll),
|
9555 | borderBoxCenter: add(client.borderBoxCenter, windowScroll),
|
9556 | offset: add(client.offset, windowScroll)
|
9557 | };
|
9558 | });
|
9559 |
|
9560 | function isMovementAllowed(state) {
|
9561 | return state.phase === 'DRAGGING' || state.phase === 'COLLECTING';
|
9562 | }
|
9563 |
|
9564 | var idle = {
|
9565 | phase: 'IDLE'
|
9566 | };
|
9567 | var preparing = {
|
9568 | phase: 'PREPARING'
|
9569 | };
|
9570 |
|
9571 | var moveWithPositionUpdates = function moveWithPositionUpdates(_ref) {
|
9572 | var state = _ref.state,
|
9573 | clientSelection = _ref.clientSelection,
|
9574 | shouldAnimate = _ref.shouldAnimate,
|
9575 | viewport = _ref.viewport,
|
9576 | impact = _ref.impact,
|
9577 | scrollJumpRequest = _ref.scrollJumpRequest;
|
9578 | var newViewport = viewport || state.viewport;
|
9579 | var currentWindowScroll = newViewport.scroll.current;
|
9580 |
|
9581 | var client = function () {
|
9582 | var offset = subtract(clientSelection, state.initial.client.selection);
|
9583 | return {
|
9584 | offset: offset,
|
9585 | selection: clientSelection,
|
9586 | borderBoxCenter: add(state.initial.client.borderBoxCenter, offset)
|
9587 | };
|
9588 | }();
|
9589 |
|
9590 | var page = getPageItemPositions(client, currentWindowScroll);
|
9591 | var current = {
|
9592 | client: client,
|
9593 | page: page
|
9594 | };
|
9595 |
|
9596 | if (state.phase === 'COLLECTING') {
|
9597 | return _extends({
|
9598 | phase: 'COLLECTING'
|
9599 | }, state, {
|
9600 | current: current
|
9601 | });
|
9602 | }
|
9603 |
|
9604 | var newImpact = impact || getDragImpact({
|
9605 | pageBorderBoxCenter: page.borderBoxCenter,
|
9606 | draggable: state.dimensions.draggables[state.critical.draggable.id],
|
9607 | draggables: state.dimensions.draggables,
|
9608 | droppables: state.dimensions.droppables,
|
9609 | previousImpact: state.impact,
|
9610 | viewport: newViewport
|
9611 | });
|
9612 |
|
9613 | var result = _extends({}, state, {
|
9614 | current: current,
|
9615 | shouldAnimate: shouldAnimate,
|
9616 | impact: newImpact,
|
9617 | scrollJumpRequest: scrollJumpRequest || null,
|
9618 | viewport: newViewport
|
9619 | });
|
9620 |
|
9621 | return result;
|
9622 | };
|
9623 |
|
9624 | var reducer = (function (state, action) {
|
9625 | if (state === void 0) {
|
9626 | state = idle;
|
9627 | }
|
9628 |
|
9629 | if (action.type === 'CLEAN') {
|
9630 | return idle;
|
9631 | }
|
9632 |
|
9633 | if (action.type === 'PREPARE') {
|
9634 | return preparing;
|
9635 | }
|
9636 |
|
9637 | if (action.type === 'INITIAL_PUBLISH') {
|
9638 | !(state.phase === 'PREPARING') ? process.env.NODE_ENV !== "production" ? invariant(false, 'INITIAL_PUBLISH must come after a PREPARING phase') : invariant(false) : void 0;
|
9639 | var _action$payload = action.payload,
|
9640 | critical = _action$payload.critical,
|
9641 | client = _action$payload.client,
|
9642 | viewport = _action$payload.viewport,
|
9643 | dimensions = _action$payload.dimensions,
|
9644 | autoScrollMode = _action$payload.autoScrollMode;
|
9645 | var initial = {
|
9646 | client: client,
|
9647 | page: {
|
9648 | selection: add(client.selection, viewport.scroll.initial),
|
9649 | borderBoxCenter: add(client.selection, viewport.scroll.initial),
|
9650 | offset: origin
|
9651 | }
|
9652 | };
|
9653 | var result = {
|
9654 | phase: 'DRAGGING',
|
9655 | isDragging: true,
|
9656 | critical: critical,
|
9657 | autoScrollMode: autoScrollMode,
|
9658 | dimensions: dimensions,
|
9659 | initial: initial,
|
9660 | current: initial,
|
9661 | impact: getHomeImpact(critical, dimensions),
|
9662 | viewport: viewport,
|
9663 | scrollJumpRequest: null,
|
9664 | shouldAnimate: false
|
9665 | };
|
9666 | return result;
|
9667 | }
|
9668 |
|
9669 | if (action.type === 'COLLECTION_STARTING') {
|
9670 | var _extends2;
|
9671 |
|
9672 | if (state.phase === 'COLLECTING' || state.phase === 'DROP_PENDING') {
|
9673 | return state;
|
9674 | }
|
9675 |
|
9676 | !(state.phase === 'DRAGGING') ? process.env.NODE_ENV !== "production" ? invariant(false, "Collection cannot start from phase " + state.phase) : invariant(false) : void 0;
|
9677 |
|
9678 | var _result = _extends({
|
9679 | phase: 'COLLECTING'
|
9680 | }, state, (_extends2 = {}, _extends2["phase"] = 'COLLECTING', _extends2));
|
9681 |
|
9682 | return _result;
|
9683 | }
|
9684 |
|
9685 | if (action.type === 'PUBLISH') {
|
9686 | !(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;
|
9687 | 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);
|
9688 | }
|
9689 |
|
9690 | if (action.type === 'MOVE') {
|
9691 | if (state.phase === 'PREPARING') {
|
9692 | return state;
|
9693 | }
|
9694 |
|
9695 | if (state.phase === 'DROP_PENDING') {
|
9696 | return state;
|
9697 | }
|
9698 |
|
9699 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false, action.type + " not permitted in phase " + state.phase) : invariant(false) : void 0;
|
9700 | var _action$payload2 = action.payload,
|
9701 | _client = _action$payload2.client,
|
9702 | shouldAnimate = _action$payload2.shouldAnimate;
|
9703 |
|
9704 | if (state.shouldAnimate === shouldAnimate && isEqual(_client, state.current.client.selection)) {
|
9705 | return state;
|
9706 | }
|
9707 |
|
9708 | var impact = state.autoScrollMode === 'JUMP' ? state.impact : null;
|
9709 | return moveWithPositionUpdates({
|
9710 | state: state,
|
9711 | clientSelection: _client,
|
9712 | impact: impact,
|
9713 | shouldAnimate: shouldAnimate
|
9714 | });
|
9715 | }
|
9716 |
|
9717 | if (action.type === 'UPDATE_DROPPABLE_SCROLL') {
|
9718 | var _extends3, _extends4;
|
9719 |
|
9720 | if (state.phase === 'PREPARING') {
|
9721 | return state;
|
9722 | }
|
9723 |
|
9724 | if (state.phase === 'DROP_PENDING') {
|
9725 | return state;
|
9726 | }
|
9727 |
|
9728 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false, action.type + " not permitted in phase " + state.phase) : invariant(false) : void 0;
|
9729 | var _action$payload3 = action.payload,
|
9730 | id = _action$payload3.id,
|
9731 | offset = _action$payload3.offset;
|
9732 | var target = state.dimensions.droppables[id];
|
9733 |
|
9734 | if (!target) {
|
9735 | return state;
|
9736 | }
|
9737 |
|
9738 | var updated = scrollDroppable(target, offset);
|
9739 |
|
9740 | var _dimensions = _extends({}, state.dimensions, {
|
9741 | droppables: _extends({}, state.dimensions.droppables, (_extends3 = {}, _extends3[id] = updated, _extends3))
|
9742 | });
|
9743 |
|
9744 | var _impact = function () {
|
9745 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
9746 |
|
9747 | if (state.autoScrollMode === 'JUMP') {
|
9748 | return state.impact;
|
9749 | }
|
9750 |
|
9751 | return getDragImpact({
|
9752 | pageBorderBoxCenter: state.current.page.borderBoxCenter,
|
9753 | draggable: _dimensions.draggables[state.critical.draggable.id],
|
9754 | draggables: _dimensions.draggables,
|
9755 | droppables: _dimensions.droppables,
|
9756 | previousImpact: state.impact,
|
9757 | viewport: state.viewport
|
9758 | });
|
9759 | }();
|
9760 |
|
9761 | return _extends({
|
9762 | phase: 'DRAGGING'
|
9763 | }, state, (_extends4 = {}, _extends4["phase"] = state.phase, _extends4.impact = _impact, _extends4.dimensions = _dimensions, _extends4.scrollJumpRequest = null, _extends4));
|
9764 | }
|
9765 |
|
9766 | if (action.type === 'UPDATE_DROPPABLE_IS_ENABLED') {
|
9767 | var _extends5, _extends6;
|
9768 |
|
9769 | if (state.phase === 'DROP_PENDING') {
|
9770 | return state;
|
9771 | }
|
9772 |
|
9773 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false, "Attempting to move in an unsupported phase " + state.phase) : invariant(false) : void 0;
|
9774 | var _action$payload4 = action.payload,
|
9775 | _id = _action$payload4.id,
|
9776 | isEnabled = _action$payload4.isEnabled;
|
9777 | var _target = state.dimensions.droppables[_id];
|
9778 | !_target ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot find Droppable[id: " + _id + "] to toggle its enabled state") : invariant(false) : void 0;
|
9779 | !(_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;
|
9780 |
|
9781 | var _updated = _extends({}, _target, {
|
9782 | isEnabled: isEnabled
|
9783 | });
|
9784 |
|
9785 | var _dimensions2 = _extends({}, state.dimensions, {
|
9786 | droppables: _extends({}, state.dimensions.droppables, (_extends5 = {}, _extends5[_id] = _updated, _extends5))
|
9787 | });
|
9788 |
|
9789 | var _impact2 = getDragImpact({
|
9790 | pageBorderBoxCenter: state.current.page.borderBoxCenter,
|
9791 | draggable: _dimensions2.draggables[state.critical.draggable.id],
|
9792 | draggables: _dimensions2.draggables,
|
9793 | droppables: _dimensions2.droppables,
|
9794 | previousImpact: state.impact,
|
9795 | viewport: state.viewport
|
9796 | });
|
9797 |
|
9798 | return _extends({
|
9799 | phase: 'DRAGGING'
|
9800 | }, state, (_extends6 = {}, _extends6["phase"] = state.phase, _extends6.impact = _impact2, _extends6.dimensions = _dimensions2, _extends6));
|
9801 | }
|
9802 |
|
9803 | if (action.type === 'MOVE_BY_WINDOW_SCROLL') {
|
9804 | if (state.phase === 'PREPARING') {
|
9805 | return state;
|
9806 | }
|
9807 |
|
9808 | if (state.phase === 'DROP_PENDING' || state.phase === 'DROP_ANIMATING') {
|
9809 | return state;
|
9810 | }
|
9811 |
|
9812 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot move by window in phase " + state.phase) : invariant(false) : void 0;
|
9813 | var newScroll = action.payload.scroll;
|
9814 |
|
9815 | if (isEqual(state.viewport.scroll.current, newScroll)) {
|
9816 | return state;
|
9817 | }
|
9818 |
|
9819 | var isJumpScrolling = state.autoScrollMode === 'JUMP';
|
9820 |
|
9821 | var _impact3 = isJumpScrolling ? state.impact : null;
|
9822 |
|
9823 | var _viewport = scrollViewport(state.viewport, newScroll);
|
9824 |
|
9825 | return moveWithPositionUpdates({
|
9826 | state: state,
|
9827 | clientSelection: state.current.client.selection,
|
9828 | viewport: _viewport,
|
9829 | shouldAnimate: false,
|
9830 | impact: _impact3
|
9831 | });
|
9832 | }
|
9833 |
|
9834 | if (action.type === 'UPDATE_VIEWPORT_MAX_SCROLL') {
|
9835 | var _extends7;
|
9836 |
|
9837 | !state.isDragging ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot update the max viewport scroll if not dragging') : invariant(false) : void 0;
|
9838 | var existing = state.viewport;
|
9839 |
|
9840 | var _viewport2 = _extends({}, existing, {
|
9841 | scroll: _extends({}, existing.scroll, {
|
9842 | max: action.payload
|
9843 | })
|
9844 | });
|
9845 |
|
9846 | return _extends({
|
9847 | phase: 'DRAGGING'
|
9848 | }, state, (_extends7 = {}, _extends7["phase"] = state.phase, _extends7.viewport = _viewport2, _extends7));
|
9849 | }
|
9850 |
|
9851 | if (action.type === 'MOVE_UP' || action.type === 'MOVE_DOWN' || action.type === 'MOVE_LEFT' || action.type === 'MOVE_RIGHT') {
|
9852 | if (state.phase === 'PREPARING') {
|
9853 | return state;
|
9854 | }
|
9855 |
|
9856 | if (state.phase === 'COLLECTING' || state.phase === 'DROP_PENDING') {
|
9857 | return state;
|
9858 | }
|
9859 |
|
9860 | !(state.phase === 'DRAGGING') ? process.env.NODE_ENV !== "production" ? invariant(false, action.type + " received while not in DRAGGING phase") : invariant(false) : void 0;
|
9861 |
|
9862 | var _result2 = moveInDirection({
|
9863 | state: state,
|
9864 | type: action.type
|
9865 | });
|
9866 |
|
9867 | if (!_result2) {
|
9868 | return state;
|
9869 | }
|
9870 |
|
9871 | return moveWithPositionUpdates({
|
9872 | state: state,
|
9873 | impact: _result2.impact,
|
9874 | clientSelection: _result2.clientSelection,
|
9875 | shouldAnimate: true,
|
9876 | scrollJumpRequest: _result2.scrollJumpRequest
|
9877 | });
|
9878 | }
|
9879 |
|
9880 | if (action.type === 'DROP_PENDING') {
|
9881 | var _extends8;
|
9882 |
|
9883 | var reason = action.payload.reason;
|
9884 | !(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;
|
9885 |
|
9886 | var newState = _extends({
|
9887 | phase: 'DROP_PENDING'
|
9888 | }, state, (_extends8 = {}, _extends8["phase"] = 'DROP_PENDING', _extends8.isWaiting = true, _extends8.reason = reason, _extends8));
|
9889 |
|
9890 | return newState;
|
9891 | }
|
9892 |
|
9893 | if (action.type === 'DROP_ANIMATE') {
|
9894 | var pending = action.payload;
|
9895 | !(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;
|
9896 | var _result3 = {
|
9897 | phase: 'DROP_ANIMATING',
|
9898 | pending: pending,
|
9899 | dimensions: state.dimensions
|
9900 | };
|
9901 | return _result3;
|
9902 | }
|
9903 |
|
9904 | if (action.type === 'DROP_COMPLETE') {
|
9905 | return idle;
|
9906 | }
|
9907 |
|
9908 | return state;
|
9909 | });
|
9910 |
|
9911 | var lift = function lift(args) {
|
9912 | return {
|
9913 | type: 'LIFT',
|
9914 | payload: args
|
9915 | };
|
9916 | };
|
9917 | var initialPublish = function initialPublish(args) {
|
9918 | return {
|
9919 | type: 'INITIAL_PUBLISH',
|
9920 | payload: args
|
9921 | };
|
9922 | };
|
9923 | var publish = function publish(args) {
|
9924 | return {
|
9925 | type: 'PUBLISH',
|
9926 | payload: args
|
9927 | };
|
9928 | };
|
9929 | var collectionStarting = function collectionStarting() {
|
9930 | return {
|
9931 | type: 'COLLECTION_STARTING',
|
9932 | payload: null
|
9933 | };
|
9934 | };
|
9935 | var updateDroppableScroll = function updateDroppableScroll(args) {
|
9936 | return {
|
9937 | type: 'UPDATE_DROPPABLE_SCROLL',
|
9938 | payload: args
|
9939 | };
|
9940 | };
|
9941 | var updateDroppableIsEnabled = function updateDroppableIsEnabled(args) {
|
9942 | return {
|
9943 | type: 'UPDATE_DROPPABLE_IS_ENABLED',
|
9944 | payload: args
|
9945 | };
|
9946 | };
|
9947 | var move = function move(args) {
|
9948 | return {
|
9949 | type: 'MOVE',
|
9950 | payload: args
|
9951 | };
|
9952 | };
|
9953 | var moveByWindowScroll = function moveByWindowScroll(args) {
|
9954 | return {
|
9955 | type: 'MOVE_BY_WINDOW_SCROLL',
|
9956 | payload: args
|
9957 | };
|
9958 | };
|
9959 | var updateViewportMaxScroll = function updateViewportMaxScroll(max) {
|
9960 | return {
|
9961 | type: 'UPDATE_VIEWPORT_MAX_SCROLL',
|
9962 | payload: max
|
9963 | };
|
9964 | };
|
9965 | var moveUp = function moveUp() {
|
9966 | return {
|
9967 | type: 'MOVE_UP',
|
9968 | payload: null
|
9969 | };
|
9970 | };
|
9971 | var moveDown = function moveDown() {
|
9972 | return {
|
9973 | type: 'MOVE_DOWN',
|
9974 | payload: null
|
9975 | };
|
9976 | };
|
9977 | var moveRight = function moveRight() {
|
9978 | return {
|
9979 | type: 'MOVE_RIGHT',
|
9980 | payload: null
|
9981 | };
|
9982 | };
|
9983 | var moveLeft = function moveLeft() {
|
9984 | return {
|
9985 | type: 'MOVE_LEFT',
|
9986 | payload: null
|
9987 | };
|
9988 | };
|
9989 | var clean = function clean() {
|
9990 | return {
|
9991 | type: 'CLEAN',
|
9992 | payload: null
|
9993 | };
|
9994 | };
|
9995 | var prepare = function prepare() {
|
9996 | return {
|
9997 | type: 'PREPARE',
|
9998 | payload: null
|
9999 | };
|
10000 | };
|
10001 | var animateDrop = function animateDrop(pending) {
|
10002 | return {
|
10003 | type: 'DROP_ANIMATE',
|
10004 | payload: pending
|
10005 | };
|
10006 | };
|
10007 | var completeDrop = function completeDrop(result) {
|
10008 | return {
|
10009 | type: 'DROP_COMPLETE',
|
10010 | payload: result
|
10011 | };
|
10012 | };
|
10013 | var drop = function drop(args) {
|
10014 | return {
|
10015 | type: 'DROP',
|
10016 | payload: args
|
10017 | };
|
10018 | };
|
10019 | var dropPending = function dropPending(args) {
|
10020 | return {
|
10021 | type: 'DROP_PENDING',
|
10022 | payload: args
|
10023 | };
|
10024 | };
|
10025 | var dropAnimationFinished = function dropAnimationFinished() {
|
10026 | return {
|
10027 | type: 'DROP_ANIMATION_FINISHED',
|
10028 | payload: null
|
10029 | };
|
10030 | };
|
10031 |
|
10032 | var lift$1 = (function (getMarshal) {
|
10033 | var timeoutId = null;
|
10034 |
|
10035 | var tryAbortCriticalCollection = function tryAbortCriticalCollection() {
|
10036 | if (timeoutId == null) {
|
10037 | return;
|
10038 | }
|
10039 |
|
10040 | clearTimeout(timeoutId);
|
10041 | timeoutId = null;
|
10042 | };
|
10043 |
|
10044 | return function (_ref) {
|
10045 | var getState = _ref.getState,
|
10046 | dispatch = _ref.dispatch;
|
10047 | return function (next) {
|
10048 | return function (action) {
|
10049 | if (action.type === 'CLEAN') {
|
10050 | tryAbortCriticalCollection();
|
10051 | next(action);
|
10052 | return;
|
10053 | }
|
10054 |
|
10055 | if (action.type !== 'LIFT') {
|
10056 | next(action);
|
10057 | return;
|
10058 | }
|
10059 |
|
10060 | !!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;
|
10061 | var marshal = getMarshal();
|
10062 | var _action$payload = action.payload,
|
10063 | id = _action$payload.id,
|
10064 | client = _action$payload.client,
|
10065 | autoScrollMode = _action$payload.autoScrollMode,
|
10066 | viewport = _action$payload.viewport;
|
10067 | var initial = getState();
|
10068 |
|
10069 | if (initial.phase === 'DROP_ANIMATING') {
|
10070 | dispatch(completeDrop(initial.pending.result));
|
10071 | }
|
10072 |
|
10073 | var postFlushState = getState();
|
10074 | !(postFlushState.phase === 'IDLE') ? process.env.NODE_ENV !== "production" ? invariant(false, 'Incorrect phase to start a drag') : invariant(false) : void 0;
|
10075 | dispatch(prepare());
|
10076 | timeoutId = setTimeout(function () {
|
10077 | timeoutId = null;
|
10078 | var state = getState();
|
10079 | !(state.phase === 'PREPARING') ? process.env.NODE_ENV !== "production" ? invariant(false, 'Invalid phase for completing lift') : invariant(false) : void 0;
|
10080 | var scrollOptions = {
|
10081 | shouldPublishImmediately: autoScrollMode === 'JUMP'
|
10082 | };
|
10083 | var request = {
|
10084 | draggableId: id,
|
10085 | scrollOptions: scrollOptions
|
10086 | };
|
10087 |
|
10088 | var _marshal$startPublish = marshal.startPublishing(request, viewport.scroll.current),
|
10089 | critical = _marshal$startPublish.critical,
|
10090 | dimensions = _marshal$startPublish.dimensions;
|
10091 |
|
10092 | dispatch(initialPublish({
|
10093 | critical: critical,
|
10094 | dimensions: dimensions,
|
10095 | client: client,
|
10096 | autoScrollMode: autoScrollMode,
|
10097 | viewport: viewport
|
10098 | }));
|
10099 | });
|
10100 | };
|
10101 | };
|
10102 | };
|
10103 | });
|
10104 |
|
10105 | var style = (function (marshal) {
|
10106 | return function () {
|
10107 | return function (next) {
|
10108 | return function (action) {
|
10109 | if (action.type === 'INITIAL_PUBLISH') {
|
10110 | marshal.dragging();
|
10111 | }
|
10112 |
|
10113 | if (action.type === 'COLLECTION_STARTING') {
|
10114 | marshal.collecting();
|
10115 | }
|
10116 |
|
10117 | if (action.type === 'PUBLISH') {
|
10118 | marshal.dragging();
|
10119 | }
|
10120 |
|
10121 | if (action.type === 'DROP_ANIMATE') {
|
10122 | marshal.dropping(action.payload.result.reason);
|
10123 | }
|
10124 |
|
10125 | if (action.type === 'CLEAN' || action.type === 'DROP_COMPLETE') {
|
10126 | marshal.resting();
|
10127 | }
|
10128 |
|
10129 | next(action);
|
10130 | };
|
10131 | };
|
10132 | };
|
10133 | });
|
10134 |
|
10135 | var getNewHomeClientBorderBoxCenter = (function (_ref) {
|
10136 | var movement = _ref.movement,
|
10137 | draggable = _ref.draggable,
|
10138 | draggables = _ref.draggables,
|
10139 | destination = _ref.destination;
|
10140 | var originalCenter = draggable.client.borderBox.center;
|
10141 |
|
10142 | if (destination == null) {
|
10143 | return originalCenter;
|
10144 | }
|
10145 |
|
10146 | var displaced = movement.displaced,
|
10147 | isBeyondStartPosition = movement.isBeyondStartPosition;
|
10148 | var axis = destination.axis;
|
10149 | var isWithinHomeDroppable = destination.descriptor.id === draggable.descriptor.droppableId;
|
10150 |
|
10151 | if (isWithinHomeDroppable && !displaced.length) {
|
10152 | return originalCenter;
|
10153 | }
|
10154 |
|
10155 | var draggablesInDestination = getDraggablesInsideDroppable(destination, draggables);
|
10156 |
|
10157 | var movingRelativeTo = function () {
|
10158 | if (isWithinHomeDroppable) {
|
10159 | return draggables[displaced[0].draggableId].client.borderBox;
|
10160 | }
|
10161 |
|
10162 | if (displaced.length) {
|
10163 | return draggables[displaced[0].draggableId].client.borderBox;
|
10164 | }
|
10165 |
|
10166 | if (draggablesInDestination.length) {
|
10167 | return draggablesInDestination[draggablesInDestination.length - 1].client.marginBox;
|
10168 | }
|
10169 |
|
10170 | return destination.client.contentBox;
|
10171 | }();
|
10172 |
|
10173 | var _ref2 = function () {
|
10174 | if (isWithinHomeDroppable) {
|
10175 | if (isBeyondStartPosition) {
|
10176 | return {
|
10177 | sourceEdge: 'end',
|
10178 | destinationEdge: 'end'
|
10179 | };
|
10180 | }
|
10181 |
|
10182 | return {
|
10183 | sourceEdge: 'start',
|
10184 | destinationEdge: 'start'
|
10185 | };
|
10186 | }
|
10187 |
|
10188 | if (!displaced.length && draggablesInDestination.length) {
|
10189 | return {
|
10190 | sourceEdge: 'start',
|
10191 | destinationEdge: 'end'
|
10192 | };
|
10193 | }
|
10194 |
|
10195 | return {
|
10196 | sourceEdge: 'start',
|
10197 | destinationEdge: 'start'
|
10198 | };
|
10199 | }(),
|
10200 | sourceEdge = _ref2.sourceEdge,
|
10201 | destinationEdge = _ref2.destinationEdge;
|
10202 |
|
10203 | var source = draggable.client.borderBox;
|
10204 | var targetCenter = moveToEdge({
|
10205 | source: source,
|
10206 | sourceEdge: sourceEdge,
|
10207 | destination: movingRelativeTo,
|
10208 | destinationEdge: destinationEdge,
|
10209 | destinationAxis: axis
|
10210 | });
|
10211 | return targetCenter;
|
10212 | });
|
10213 |
|
10214 | var getScrollDisplacement = function getScrollDisplacement(droppable, viewport) {
|
10215 | return withDroppableDisplacement(droppable, viewport.scroll.diff.displacement);
|
10216 | };
|
10217 |
|
10218 | var drop$1 = (function (_ref) {
|
10219 | var getState = _ref.getState,
|
10220 | dispatch = _ref.dispatch;
|
10221 | return function (next) {
|
10222 | return function (action) {
|
10223 | if (action.type !== 'DROP') {
|
10224 | next(action);
|
10225 | return;
|
10226 | }
|
10227 |
|
10228 | var state = getState();
|
10229 | var reason = action.payload.reason;
|
10230 |
|
10231 | if (state.phase === 'COLLECTING') {
|
10232 | dispatch(dropPending({
|
10233 | reason: reason
|
10234 | }));
|
10235 | return;
|
10236 | }
|
10237 |
|
10238 | if (state.phase === 'PREPARING') {
|
10239 | dispatch(clean());
|
10240 | return;
|
10241 | }
|
10242 |
|
10243 | if (state.phase === 'IDLE') {
|
10244 | return;
|
10245 | }
|
10246 |
|
10247 | var isWaitingForDrop = state.phase === 'DROP_PENDING' && state.isWaiting;
|
10248 | !!isWaitingForDrop ? process.env.NODE_ENV !== "production" ? invariant(false, 'A DROP action occurred while DROP_PENDING and still waiting') : invariant(false) : void 0;
|
10249 | !(state.phase === 'DRAGGING' || state.phase === 'DROP_PENDING') ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot drop in phase: " + state.phase) : invariant(false) : void 0;
|
10250 | var critical = state.critical;
|
10251 | var dimensions = state.dimensions;
|
10252 | var impact = reason === 'DROP' ? state.impact : noImpact;
|
10253 | var home = dimensions.droppables[state.critical.droppable.id];
|
10254 | var draggable = dimensions.draggables[state.critical.draggable.id];
|
10255 | var droppable = impact && impact.destination ? dimensions.droppables[impact.destination.droppableId] : null;
|
10256 | var source = {
|
10257 | index: critical.draggable.index,
|
10258 | droppableId: critical.droppable.id
|
10259 | };
|
10260 | var destination = reason === 'DROP' ? impact.destination : null;
|
10261 | var result = {
|
10262 | draggableId: draggable.descriptor.id,
|
10263 | type: home.descriptor.type,
|
10264 | source: source,
|
10265 | destination: destination,
|
10266 | reason: reason
|
10267 | };
|
10268 |
|
10269 | var clientOffset = function () {
|
10270 | if (reason === 'CANCEL') {
|
10271 | return origin;
|
10272 | }
|
10273 |
|
10274 | var newBorderBoxClientCenter = getNewHomeClientBorderBoxCenter({
|
10275 | movement: impact.movement,
|
10276 | draggable: draggable,
|
10277 | draggables: dimensions.draggables,
|
10278 | destination: droppable
|
10279 | });
|
10280 | return subtract(newBorderBoxClientCenter, draggable.client.borderBox.center);
|
10281 | }();
|
10282 |
|
10283 | var newHomeOffset = add(clientOffset, getScrollDisplacement(droppable || home, state.viewport));
|
10284 | var isAnimationRequired = !isEqual(state.current.client.offset, newHomeOffset);
|
10285 | var pending = {
|
10286 | newHomeOffset: newHomeOffset,
|
10287 | result: result,
|
10288 | impact: impact
|
10289 | };
|
10290 |
|
10291 | if (isAnimationRequired) {
|
10292 | dispatch(animateDrop(pending));
|
10293 | return;
|
10294 | }
|
10295 |
|
10296 | dispatch(completeDrop(result));
|
10297 | };
|
10298 | };
|
10299 | });
|
10300 |
|
10301 | var onDragStart = function onDragStart(start) {
|
10302 | 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";
|
10303 | };
|
10304 |
|
10305 | var onDragUpdate = function onDragUpdate(update) {
|
10306 | if (!update.destination) {
|
10307 | return 'You are currently not dragging over a droppable area';
|
10308 | }
|
10309 |
|
10310 | if (update.source.droppableId === update.destination.droppableId) {
|
10311 | return "You have moved the item to position " + (update.destination.index + 1);
|
10312 | }
|
10313 |
|
10314 | 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 ";
|
10315 | };
|
10316 |
|
10317 | var onDragEnd = function onDragEnd(result) {
|
10318 | if (result.reason === 'CANCEL') {
|
10319 | return "\n Movement cancelled.\n The item has returned to its starting position of " + (result.source.index + 1) + "\n ";
|
10320 | }
|
10321 |
|
10322 | if (!result.destination) {
|
10323 | 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 ";
|
10324 | }
|
10325 |
|
10326 | if (result.source.droppableId === result.destination.droppableId) {
|
10327 | if (result.source.index === result.destination.index) {
|
10328 | return "\n You have dropped the item.\n It has been dropped on its starting position of " + (result.source.index + 1) + "\n ";
|
10329 | }
|
10330 |
|
10331 | return "\n You have dropped the item.\n It has moved from position " + (result.source.index + 1) + " to " + (result.destination.index + 1) + "\n ";
|
10332 | }
|
10333 |
|
10334 | 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 ";
|
10335 | };
|
10336 |
|
10337 | var preset = {
|
10338 | onDragStart: onDragStart,
|
10339 | onDragUpdate: onDragUpdate,
|
10340 | onDragEnd: onDragEnd
|
10341 | };
|
10342 |
|
10343 | var records = {};
|
10344 | var flag = '__react-beautiful-dnd-debug-timings-hook__';
|
10345 |
|
10346 | var isTimingsEnabled = function isTimingsEnabled() {
|
10347 | return Boolean(window[flag]);
|
10348 | };
|
10349 |
|
10350 | var start = function start(key) {
|
10351 | if (process.env.NODE_ENV !== 'production') {
|
10352 | if (!isTimingsEnabled()) {
|
10353 | return;
|
10354 | }
|
10355 |
|
10356 | var now = performance.now();
|
10357 | records[key] = now;
|
10358 | }
|
10359 | };
|
10360 | var finish = function finish(key) {
|
10361 | if (process.env.NODE_ENV !== 'production') {
|
10362 | if (!isTimingsEnabled()) {
|
10363 | return;
|
10364 | }
|
10365 |
|
10366 | var now = performance.now();
|
10367 | var previous = records[key];
|
10368 | !previous ? process.env.NODE_ENV !== "production" ? invariant(false, 'cannot finish timing as no previous time found') : invariant(false) : void 0;
|
10369 | var result = now - previous;
|
10370 | var rounded = result.toFixed(2);
|
10371 |
|
10372 | var style = function () {
|
10373 | if (result < 12) {
|
10374 | return {
|
10375 | textColor: 'green',
|
10376 | symbol: '✅'
|
10377 | };
|
10378 | }
|
10379 |
|
10380 | if (result < 40) {
|
10381 | return {
|
10382 | textColor: 'orange',
|
10383 | symbol: '⚠️'
|
10384 | };
|
10385 | }
|
10386 |
|
10387 | return {
|
10388 | textColor: 'red',
|
10389 | symbol: '❌'
|
10390 | };
|
10391 | }();
|
10392 |
|
10393 | 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;');
|
10394 | }
|
10395 | };
|
10396 |
|
10397 | var withTimings = function withTimings(key, fn) {
|
10398 | start(key);
|
10399 | fn();
|
10400 | finish(key);
|
10401 | };
|
10402 |
|
10403 | var areLocationsEqual = function areLocationsEqual(first, second) {
|
10404 | if (first == null && second == null) {
|
10405 | return true;
|
10406 | }
|
10407 |
|
10408 | if (first == null || second == null) {
|
10409 | return false;
|
10410 | }
|
10411 |
|
10412 | return first.droppableId === second.droppableId && first.index === second.index;
|
10413 | };
|
10414 |
|
10415 | var isCriticalEqual = function isCriticalEqual(first, second) {
|
10416 | if (first === second) {
|
10417 | return true;
|
10418 | }
|
10419 |
|
10420 | 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;
|
10421 | var isDroppableEqual = first.droppable.id === second.droppable.id && first.droppable.type === second.droppable.type;
|
10422 | return isDraggableEqual && isDroppableEqual;
|
10423 | };
|
10424 |
|
10425 | var getExpiringAnnounce = function getExpiringAnnounce(announce) {
|
10426 | var wasCalled = false;
|
10427 | var isExpired = false;
|
10428 | setTimeout(function () {
|
10429 | isExpired = true;
|
10430 | });
|
10431 |
|
10432 | var result = function result(message) {
|
10433 | if (wasCalled) {
|
10434 | if (process.env.NODE_ENV !== 'production') {
|
10435 | console.warn('Announcement already made. Not making a second announcement');
|
10436 | }
|
10437 |
|
10438 | return;
|
10439 | }
|
10440 |
|
10441 | if (isExpired) {
|
10442 | if (process.env.NODE_ENV !== 'production') {
|
10443 | console.warn("\n Announcements cannot be made asynchronously.\n Default message has already been announced.\n ");
|
10444 | }
|
10445 |
|
10446 | return;
|
10447 | }
|
10448 |
|
10449 | wasCalled = true;
|
10450 | announce(message);
|
10451 | };
|
10452 |
|
10453 | result.wasCalled = function () {
|
10454 | return wasCalled;
|
10455 | };
|
10456 |
|
10457 | return result;
|
10458 | };
|
10459 |
|
10460 | var getDragStart = function getDragStart(critical) {
|
10461 | return {
|
10462 | draggableId: critical.draggable.id,
|
10463 | type: critical.droppable.type,
|
10464 | source: {
|
10465 | droppableId: critical.droppable.id,
|
10466 | index: critical.draggable.index
|
10467 | }
|
10468 | };
|
10469 | };
|
10470 |
|
10471 | var hooks = (function (getHooks, announce) {
|
10472 | var execute = function execute(hook, data, getDefaultMessage) {
|
10473 | if (!hook) {
|
10474 | announce(getDefaultMessage(data));
|
10475 | return;
|
10476 | }
|
10477 |
|
10478 | var willExpire = getExpiringAnnounce(announce);
|
10479 | var provided = {
|
10480 | announce: willExpire
|
10481 | };
|
10482 | hook(data, provided);
|
10483 |
|
10484 | if (!willExpire.wasCalled()) {
|
10485 | announce(getDefaultMessage(data));
|
10486 | }
|
10487 | };
|
10488 |
|
10489 | var publisher = function () {
|
10490 | var lastLocation = null;
|
10491 | var lastCritical = null;
|
10492 | var _isDragStartPublished = false;
|
10493 |
|
10494 | var beforeStart = function beforeStart(critical) {
|
10495 | !!_isDragStartPublished ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot fire onBeforeDragStart as a drag start has already been published') : invariant(false) : void 0;
|
10496 | withTimings('onBeforeDragStart', function () {
|
10497 | var fn = getHooks().onBeforeDragStart;
|
10498 |
|
10499 | if (fn) {
|
10500 | fn(getDragStart(critical));
|
10501 | }
|
10502 | });
|
10503 | };
|
10504 |
|
10505 | var start$$1 = function start$$1(critical) {
|
10506 | !!_isDragStartPublished ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot fire onBeforeDragStart as a drag start has already been published') : invariant(false) : void 0;
|
10507 | var data = getDragStart(critical);
|
10508 | lastCritical = critical;
|
10509 | lastLocation = data.source;
|
10510 | _isDragStartPublished = true;
|
10511 | withTimings('onDragStart', function () {
|
10512 | return execute(getHooks().onDragStart, data, preset.onDragStart);
|
10513 | });
|
10514 | };
|
10515 |
|
10516 | var move = function move(critical, location) {
|
10517 | !(_isDragStartPublished && lastCritical) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot fire onDragMove when onDragStart has not been called') : invariant(false) : void 0;
|
10518 | var hasCriticalChanged = !isCriticalEqual(critical, lastCritical);
|
10519 |
|
10520 | if (hasCriticalChanged) {
|
10521 | lastCritical = critical;
|
10522 | }
|
10523 |
|
10524 | var hasLocationChanged = !areLocationsEqual(lastLocation, location);
|
10525 |
|
10526 | if (hasLocationChanged) {
|
10527 | lastLocation = location;
|
10528 | }
|
10529 |
|
10530 | if (!hasCriticalChanged && !hasLocationChanged) {
|
10531 | return;
|
10532 | }
|
10533 |
|
10534 | var data = _extends({}, getDragStart(critical), {
|
10535 | destination: location
|
10536 | });
|
10537 |
|
10538 | withTimings('onDragUpdate', function () {
|
10539 | return execute(getHooks().onDragUpdate, data, preset.onDragUpdate);
|
10540 | });
|
10541 | };
|
10542 |
|
10543 | var drop = function drop(result) {
|
10544 | !_isDragStartPublished ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot fire onDragEnd when there is no matching onDragStart') : invariant(false) : void 0;
|
10545 | _isDragStartPublished = false;
|
10546 | lastLocation = null;
|
10547 | lastCritical = null;
|
10548 | withTimings('onDragEnd', function () {
|
10549 | return execute(getHooks().onDragEnd, result, preset.onDragEnd);
|
10550 | });
|
10551 | };
|
10552 |
|
10553 | var abort = function abort() {
|
10554 | !(_isDragStartPublished && lastCritical) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot cancel when onDragStart not fired') : invariant(false) : void 0;
|
10555 |
|
10556 | var result = _extends({}, getDragStart(lastCritical), {
|
10557 | destination: null,
|
10558 | reason: 'CANCEL'
|
10559 | });
|
10560 |
|
10561 | drop(result);
|
10562 | };
|
10563 |
|
10564 | return {
|
10565 | beforeStart: beforeStart,
|
10566 | start: start$$1,
|
10567 | move: move,
|
10568 | drop: drop,
|
10569 | abort: abort,
|
10570 | isDragStartPublished: function isDragStartPublished() {
|
10571 | return _isDragStartPublished;
|
10572 | }
|
10573 | };
|
10574 | }();
|
10575 |
|
10576 | return function (store) {
|
10577 | return function (next) {
|
10578 | return function (action) {
|
10579 | if (action.type === 'INITIAL_PUBLISH') {
|
10580 | var critical = action.payload.critical;
|
10581 | publisher.beforeStart(critical);
|
10582 | next(action);
|
10583 | publisher.start(critical);
|
10584 | return;
|
10585 | }
|
10586 |
|
10587 | next(action);
|
10588 |
|
10589 | if (action.type === 'DROP_COMPLETE') {
|
10590 | var result = action.payload;
|
10591 | publisher.drop(result);
|
10592 | return;
|
10593 | }
|
10594 |
|
10595 | if (action.type === 'CLEAN') {
|
10596 | if (publisher.isDragStartPublished()) {
|
10597 | publisher.abort();
|
10598 | }
|
10599 |
|
10600 | return;
|
10601 | }
|
10602 |
|
10603 | if (!publisher.isDragStartPublished()) {
|
10604 | return;
|
10605 | }
|
10606 |
|
10607 | var state = store.getState();
|
10608 |
|
10609 | if (state.phase === 'DRAGGING') {
|
10610 | publisher.move(state.critical, state.impact.destination);
|
10611 | }
|
10612 | };
|
10613 | };
|
10614 | };
|
10615 | });
|
10616 |
|
10617 | var dropAnimationFinish = (function (store) {
|
10618 | return function (next) {
|
10619 | return function (action) {
|
10620 | if (action.type !== 'DROP_ANIMATION_FINISHED') {
|
10621 | next(action);
|
10622 | return;
|
10623 | }
|
10624 |
|
10625 | var state = store.getState();
|
10626 | !(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;
|
10627 | store.dispatch(completeDrop(state.pending.result));
|
10628 | };
|
10629 | };
|
10630 | });
|
10631 |
|
10632 | var dimensionMarshalStopper = (function (getMarshal) {
|
10633 | return function () {
|
10634 | return function (next) {
|
10635 | return function (action) {
|
10636 | if (action.type === 'DROP_COMPLETE' || action.type === 'CLEAN' || action.type === 'DROP_ANIMATE') {
|
10637 | var marshal = getMarshal();
|
10638 | marshal.stopPublishing();
|
10639 | }
|
10640 |
|
10641 | next(action);
|
10642 | };
|
10643 | };
|
10644 | };
|
10645 | });
|
10646 |
|
10647 | var shouldCancel = function shouldCancel(action) {
|
10648 | return action.type === 'CANCEL' || action.type === 'DROP_ANIMATE' || action.type === 'DROP' || action.type === 'DROP_COMPLETE' || action.type === 'COLLECTION_STARTING';
|
10649 | };
|
10650 |
|
10651 | var autoScroll = (function (getScroller) {
|
10652 | return function (store) {
|
10653 | return function (next) {
|
10654 | return function (action) {
|
10655 | if (shouldCancel(action)) {
|
10656 | getScroller().cancel();
|
10657 | next(action);
|
10658 | return;
|
10659 | }
|
10660 |
|
10661 | next(action);
|
10662 | var state = store.getState();
|
10663 |
|
10664 | if (state.phase !== 'DRAGGING') {
|
10665 | return;
|
10666 | }
|
10667 |
|
10668 | if (state.autoScrollMode === 'FLUID') {
|
10669 | getScroller().fluidScroll(state);
|
10670 | return;
|
10671 | }
|
10672 |
|
10673 | if (!state.scrollJumpRequest) {
|
10674 | return;
|
10675 | }
|
10676 |
|
10677 | getScroller().jumpScroll(state);
|
10678 | };
|
10679 | };
|
10680 | };
|
10681 | });
|
10682 |
|
10683 | var shouldCheckOnAction = function shouldCheckOnAction(action) {
|
10684 | 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';
|
10685 | };
|
10686 |
|
10687 | var hasDroppableOverChanged = function hasDroppableOverChanged(previous, current) {
|
10688 | if (!previous) {
|
10689 | return Boolean(current);
|
10690 | }
|
10691 |
|
10692 | if (!current) {
|
10693 | return Boolean(previous);
|
10694 | }
|
10695 |
|
10696 | return previous.droppableId !== current.droppableId;
|
10697 | };
|
10698 |
|
10699 | var getNewMaxScroll = function getNewMaxScroll(previous, current, action) {
|
10700 | if (!shouldCheckOnAction(action)) {
|
10701 | return null;
|
10702 | }
|
10703 |
|
10704 | if (!isMovementAllowed(previous) || !isMovementAllowed(current)) {
|
10705 | return null;
|
10706 | }
|
10707 |
|
10708 | if (!hasDroppableOverChanged(previous.impact.destination, current.impact.destination)) {
|
10709 | return null;
|
10710 | }
|
10711 |
|
10712 | var viewport = current.viewport;
|
10713 | var doc = document.documentElement;
|
10714 | !doc ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not find document.documentElement') : invariant(false) : void 0;
|
10715 | var maxScroll = getMaxScroll({
|
10716 | scrollHeight: doc.scrollHeight,
|
10717 | scrollWidth: doc.scrollWidth,
|
10718 | width: viewport.frame.width,
|
10719 | height: viewport.frame.height
|
10720 | });
|
10721 |
|
10722 | if (isEqual(maxScroll, viewport.scroll.max)) {
|
10723 | return null;
|
10724 | }
|
10725 |
|
10726 | return maxScroll;
|
10727 | };
|
10728 |
|
10729 | var maxScrollUpdater = (function (store) {
|
10730 | return function (next) {
|
10731 | return function (action) {
|
10732 | var previous = store.getState();
|
10733 | next(action);
|
10734 | var current = store.getState();
|
10735 | var maxScroll = getNewMaxScroll(previous, current, action);
|
10736 |
|
10737 | if (maxScroll) {
|
10738 | next(updateViewportMaxScroll(maxScroll));
|
10739 | }
|
10740 | };
|
10741 | };
|
10742 | });
|
10743 |
|
10744 | var composeEnhancers = typeof window === 'object' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : redux.compose;
|
10745 | var createStore = (function (_ref) {
|
10746 | var getDimensionMarshal = _ref.getDimensionMarshal,
|
10747 | styleMarshal = _ref.styleMarshal,
|
10748 | getHooks = _ref.getHooks,
|
10749 | announce = _ref.announce,
|
10750 | getScroller = _ref.getScroller;
|
10751 | return redux.createStore(reducer, composeEnhancers(redux.applyMiddleware(style(styleMarshal), dimensionMarshalStopper(getDimensionMarshal), lift$1(getDimensionMarshal), drop$1, dropAnimationFinish, maxScrollUpdater, autoScroll(getScroller), hooks(getHooks, announce))));
|
10752 | });
|
10753 |
|
10754 | var getEmptyMap = function getEmptyMap() {
|
10755 | return {
|
10756 | draggables: {},
|
10757 | droppables: {}
|
10758 | };
|
10759 | };
|
10760 |
|
10761 | var timingKey = 'Publish collection from DOM';
|
10762 | var createPublisher = (function (_ref) {
|
10763 | var getProvided = _ref.getProvided,
|
10764 | callbacks = _ref.callbacks;
|
10765 |
|
10766 | var advancedUsageWarning = function () {
|
10767 | if (process.env.NODE_ENV === 'production') {
|
10768 | return function () {};
|
10769 | }
|
10770 |
|
10771 | var hasAnnounced = false;
|
10772 | return function () {
|
10773 | if (hasAnnounced) {
|
10774 | return;
|
10775 | }
|
10776 |
|
10777 | hasAnnounced = true;
|
10778 |
|
10779 | if (process.env.NODE_ENV === 'production') {
|
10780 | return;
|
10781 | }
|
10782 |
|
10783 | 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());
|
10784 | };
|
10785 | }();
|
10786 |
|
10787 | var additions = getEmptyMap();
|
10788 | var removals = getEmptyMap();
|
10789 | var frameId = null;
|
10790 |
|
10791 | var reset = function reset() {
|
10792 | additions = getEmptyMap();
|
10793 | removals = getEmptyMap();
|
10794 | };
|
10795 |
|
10796 | var collect = function collect() {
|
10797 | advancedUsageWarning();
|
10798 |
|
10799 | if (frameId) {
|
10800 | return;
|
10801 | }
|
10802 |
|
10803 | frameId = requestAnimationFrame(function () {
|
10804 | frameId = null;
|
10805 | callbacks.collectionStarting();
|
10806 | start(timingKey);
|
10807 |
|
10808 | var _getProvided = getProvided(),
|
10809 | entries = _getProvided.entries,
|
10810 | collection = _getProvided.collection;
|
10811 |
|
10812 | var windowScroll = collection.initialWindowScroll;
|
10813 |
|
10814 | var draggables = _Object$keys(additions.draggables).map(function (id) {
|
10815 | return entries.draggables[id].getDimension(windowScroll);
|
10816 | });
|
10817 |
|
10818 | var droppables = _Object$keys(additions.droppables).map(function (id) {
|
10819 | return entries.droppables[id].callbacks.getDimensionAndWatchScroll(windowScroll, collection.scrollOptions);
|
10820 | });
|
10821 |
|
10822 | var result = {
|
10823 | additions: {
|
10824 | draggables: draggables,
|
10825 | droppables: droppables
|
10826 | },
|
10827 | removals: {
|
10828 | draggables: _Object$keys(removals.draggables),
|
10829 | droppables: _Object$keys(removals.droppables)
|
10830 | }
|
10831 | };
|
10832 | reset();
|
10833 | finish(timingKey);
|
10834 | callbacks.publish(result);
|
10835 | });
|
10836 | };
|
10837 |
|
10838 | var addDraggable = function addDraggable(id) {
|
10839 | additions.draggables[id] = true;
|
10840 |
|
10841 | if (removals.draggables[id]) {
|
10842 | delete removals.draggables[id];
|
10843 | }
|
10844 |
|
10845 | collect();
|
10846 | };
|
10847 |
|
10848 | var removeDraggable = function removeDraggable(id) {
|
10849 | removals.draggables[id] = true;
|
10850 |
|
10851 | if (additions.draggables[id]) {
|
10852 | delete additions.draggables[id];
|
10853 | }
|
10854 |
|
10855 | collect();
|
10856 | };
|
10857 |
|
10858 | var addDroppable = function addDroppable(id) {
|
10859 | additions.droppables[id] = true;
|
10860 |
|
10861 | if (removals.droppables[id]) {
|
10862 | delete removals.droppables[id];
|
10863 | }
|
10864 |
|
10865 | collect();
|
10866 | };
|
10867 |
|
10868 | var removeDroppable = function removeDroppable(id) {
|
10869 | removals.droppables[id] = true;
|
10870 |
|
10871 | if (additions.droppables[id]) {
|
10872 | delete additions.droppables[id];
|
10873 | }
|
10874 |
|
10875 | collect();
|
10876 | };
|
10877 |
|
10878 | var stop = function stop() {
|
10879 | if (!frameId) {
|
10880 | return;
|
10881 | }
|
10882 |
|
10883 | cancelAnimationFrame(frameId);
|
10884 | frameId = null;
|
10885 | reset();
|
10886 | };
|
10887 |
|
10888 | return {
|
10889 | addDraggable: addDraggable,
|
10890 | removeDraggable: removeDraggable,
|
10891 | addDroppable: addDroppable,
|
10892 | removeDroppable: removeDroppable,
|
10893 | stop: stop
|
10894 | };
|
10895 | });
|
10896 |
|
10897 | var createDimensionMarshal = (function (callbacks) {
|
10898 | var entries = {
|
10899 | droppables: {},
|
10900 | draggables: {}
|
10901 | };
|
10902 | var collection = null;
|
10903 | var publisher = createPublisher({
|
10904 | callbacks: {
|
10905 | publish: callbacks.publish,
|
10906 | collectionStarting: callbacks.collectionStarting
|
10907 | },
|
10908 | getProvided: function getProvided() {
|
10909 | !collection ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get scroll options when there is no collection') : invariant(false) : void 0;
|
10910 | return {
|
10911 | entries: entries,
|
10912 | collection: collection
|
10913 | };
|
10914 | }
|
10915 | });
|
10916 |
|
10917 | var registerDraggable = function registerDraggable(descriptor, getDimension) {
|
10918 | var entry = {
|
10919 | descriptor: descriptor,
|
10920 | getDimension: getDimension
|
10921 | };
|
10922 | entries.draggables[descriptor.id] = entry;
|
10923 |
|
10924 | if (!collection) {
|
10925 | return;
|
10926 | }
|
10927 |
|
10928 | if (collection.critical.draggable.type !== descriptor.type) {
|
10929 | return;
|
10930 | }
|
10931 |
|
10932 | publisher.addDraggable(descriptor.id);
|
10933 | };
|
10934 |
|
10935 | var updateDraggable = function updateDraggable(previous, descriptor, getDimension) {
|
10936 | !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;
|
10937 | delete entries.draggables[previous.id];
|
10938 | var entry = {
|
10939 | descriptor: descriptor,
|
10940 | getDimension: getDimension
|
10941 | };
|
10942 | entries.draggables[descriptor.id] = entry;
|
10943 | };
|
10944 |
|
10945 | var unregisterDraggable = function unregisterDraggable(descriptor) {
|
10946 | var entry = entries.draggables[descriptor.id];
|
10947 | !entry ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot unregister Draggable with id " + descriptor.id + " as it is not registered") : invariant(false) : void 0;
|
10948 |
|
10949 | if (entry.descriptor !== descriptor) {
|
10950 | return;
|
10951 | }
|
10952 |
|
10953 | delete entries.draggables[descriptor.id];
|
10954 |
|
10955 | if (!collection) {
|
10956 | return;
|
10957 | }
|
10958 |
|
10959 | !(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;
|
10960 |
|
10961 | if (descriptor.type !== collection.critical.draggable.type) {
|
10962 | return;
|
10963 | }
|
10964 |
|
10965 | publisher.removeDraggable(descriptor.id);
|
10966 | };
|
10967 |
|
10968 | var registerDroppable = function registerDroppable(descriptor, droppableCallbacks) {
|
10969 | var id = descriptor.id;
|
10970 | entries.droppables[id] = {
|
10971 | descriptor: descriptor,
|
10972 | callbacks: droppableCallbacks
|
10973 | };
|
10974 |
|
10975 | if (!collection) {
|
10976 | return;
|
10977 | }
|
10978 |
|
10979 | if (descriptor.type !== collection.critical.droppable.type) {
|
10980 | return;
|
10981 | }
|
10982 |
|
10983 | publisher.addDroppable(id);
|
10984 | };
|
10985 |
|
10986 | var updateDroppable = function updateDroppable(previous, descriptor, droppableCallbacks) {
|
10987 | !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;
|
10988 | delete entries.droppables[previous.id];
|
10989 | var entry = {
|
10990 | descriptor: descriptor,
|
10991 | callbacks: droppableCallbacks
|
10992 | };
|
10993 | entries.droppables[descriptor.id] = entry;
|
10994 |
|
10995 | if (collection) {
|
10996 | 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);
|
10997 | }
|
10998 | };
|
10999 |
|
11000 | var unregisterDroppable = function unregisterDroppable(descriptor) {
|
11001 | var entry = entries.droppables[descriptor.id];
|
11002 | !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;
|
11003 |
|
11004 | if (entry.descriptor !== descriptor) {
|
11005 | return;
|
11006 | }
|
11007 |
|
11008 | delete entries.droppables[descriptor.id];
|
11009 |
|
11010 | if (!collection) {
|
11011 | return;
|
11012 | }
|
11013 |
|
11014 | !(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;
|
11015 |
|
11016 | if (collection.critical.droppable.type !== descriptor.type) {
|
11017 | return;
|
11018 | }
|
11019 |
|
11020 | publisher.removeDroppable(descriptor.id);
|
11021 | };
|
11022 |
|
11023 | var updateDroppableIsEnabled = function updateDroppableIsEnabled(id, isEnabled) {
|
11024 | !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;
|
11025 |
|
11026 | if (!collection) {
|
11027 | return;
|
11028 | }
|
11029 |
|
11030 | callbacks.updateDroppableIsEnabled({
|
11031 | id: id,
|
11032 | isEnabled: isEnabled
|
11033 | });
|
11034 | };
|
11035 |
|
11036 | var updateDroppableScroll = function updateDroppableScroll(id, newScroll) {
|
11037 | !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;
|
11038 |
|
11039 | if (!collection) {
|
11040 | return;
|
11041 | }
|
11042 |
|
11043 | callbacks.updateDroppableScroll({
|
11044 | id: id,
|
11045 | offset: newScroll
|
11046 | });
|
11047 | };
|
11048 |
|
11049 | var scrollDroppable = function scrollDroppable(id, change) {
|
11050 | var entry = entries.droppables[id];
|
11051 | !entry ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot scroll Droppable " + id + " as it is not registered") : invariant(false) : void 0;
|
11052 |
|
11053 | if (!collection) {
|
11054 | return;
|
11055 | }
|
11056 |
|
11057 | entry.callbacks.scroll(change);
|
11058 | };
|
11059 |
|
11060 | var getInitialPublish = function getInitialPublish(args) {
|
11061 | var critical = args.critical,
|
11062 | scrollOptions = args.scrollOptions,
|
11063 | windowScroll = args.initialWindowScroll;
|
11064 | var timingKey = 'Initial collection from DOM';
|
11065 | start(timingKey);
|
11066 | var home = critical.droppable;
|
11067 |
|
11068 | var droppables = _Object$keys(entries.droppables).map(function (id) {
|
11069 | return entries.droppables[id];
|
11070 | }).filter(function (entry) {
|
11071 | return entry.descriptor.type === home.type;
|
11072 | }).map(function (entry) {
|
11073 | return entry.callbacks.getDimensionAndWatchScroll(windowScroll, scrollOptions);
|
11074 | }).reduce(function (previous, dimension) {
|
11075 | previous[dimension.descriptor.id] = dimension;
|
11076 | return previous;
|
11077 | }, {});
|
11078 |
|
11079 | var draggables = _Object$keys(entries.draggables).map(function (id) {
|
11080 | return entries.draggables[id];
|
11081 | }).filter(function (entry) {
|
11082 | return entry.descriptor.type === critical.draggable.type;
|
11083 | }).map(function (entry) {
|
11084 | return entry.getDimension(windowScroll);
|
11085 | }).reduce(function (previous, dimension) {
|
11086 | previous[dimension.descriptor.id] = dimension;
|
11087 | return previous;
|
11088 | }, {});
|
11089 |
|
11090 | finish(timingKey);
|
11091 | var dimensions = {
|
11092 | draggables: draggables,
|
11093 | droppables: droppables
|
11094 | };
|
11095 | var result = {
|
11096 | dimensions: dimensions,
|
11097 | critical: critical
|
11098 | };
|
11099 | return result;
|
11100 | };
|
11101 |
|
11102 | var stopPublishing = function stopPublishing() {
|
11103 | if (!collection) {
|
11104 | return;
|
11105 | }
|
11106 |
|
11107 | publisher.stop();
|
11108 | var home = collection.critical.droppable;
|
11109 |
|
11110 | _Object$keys(entries.droppables).filter(function (id) {
|
11111 | return entries.droppables[id].descriptor.type === home.type;
|
11112 | }).forEach(function (id) {
|
11113 | return entries.droppables[id].callbacks.unwatchScroll();
|
11114 | });
|
11115 |
|
11116 | collection = null;
|
11117 | };
|
11118 |
|
11119 | var startPublishing = function startPublishing(request, windowScroll) {
|
11120 | !!collection ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot start capturing critical dimensions as there is already a collection') : invariant(false) : void 0;
|
11121 | var entry = entries.draggables[request.draggableId];
|
11122 | !entry ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot find critical draggable entry') : invariant(false) : void 0;
|
11123 | var home = entries.droppables[entry.descriptor.droppableId];
|
11124 | !home ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot find critical droppable entry') : invariant(false) : void 0;
|
11125 | var critical = {
|
11126 | draggable: entry.descriptor,
|
11127 | droppable: home.descriptor
|
11128 | };
|
11129 | collection = {
|
11130 | scrollOptions: request.scrollOptions,
|
11131 | critical: critical,
|
11132 | initialWindowScroll: windowScroll
|
11133 | };
|
11134 | return getInitialPublish(collection);
|
11135 | };
|
11136 |
|
11137 | var marshal = {
|
11138 | registerDraggable: registerDraggable,
|
11139 | updateDraggable: updateDraggable,
|
11140 | unregisterDraggable: unregisterDraggable,
|
11141 | registerDroppable: registerDroppable,
|
11142 | updateDroppable: updateDroppable,
|
11143 | unregisterDroppable: unregisterDroppable,
|
11144 | updateDroppableIsEnabled: updateDroppableIsEnabled,
|
11145 | scrollDroppable: scrollDroppable,
|
11146 | updateDroppableScroll: updateDroppableScroll,
|
11147 | startPublishing: startPublishing,
|
11148 | stopPublishing: stopPublishing
|
11149 | };
|
11150 | return marshal;
|
11151 | });
|
11152 |
|
11153 | var physics = function () {
|
11154 | var base = {
|
11155 | stiffness: 1000,
|
11156 | damping: 60,
|
11157 | precision: 0.99
|
11158 | };
|
11159 |
|
11160 | var standard = _extends({}, base);
|
11161 |
|
11162 | var fast = _extends({}, base, {
|
11163 | stiffness: base.stiffness * 2
|
11164 | });
|
11165 |
|
11166 | return {
|
11167 | standard: standard,
|
11168 | fast: fast
|
11169 | };
|
11170 | }();
|
11171 | var css = {
|
11172 | outOfTheWay: 'transform 0.2s cubic-bezier(0.2, 0, 0, 1)'
|
11173 | };
|
11174 |
|
11175 | var prefix = 'data-react-beautiful-dnd';
|
11176 | var dragHandle = prefix + "-drag-handle";
|
11177 | var draggable = prefix + "-draggable";
|
11178 | var droppable = prefix + "-droppable";
|
11179 |
|
11180 | var getStyles = (function (styleContext) {
|
11181 | var dragHandleSelector = "[" + dragHandle + "=\"" + styleContext + "\"]";
|
11182 | var draggableSelector = "[" + draggable + "=\"" + styleContext + "\"]";
|
11183 | var droppableSelector = "[" + droppable + "=\"" + styleContext + "\"]";
|
11184 | var dragHandleStyles = {
|
11185 | base: "\n " + dragHandleSelector + " {\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n }\n ",
|
11186 | grabCursor: "\n " + dragHandleSelector + " {\n cursor: -webkit-grab;\n cursor: grab;\n }\n ",
|
11187 | blockPointerEvents: "\n " + dragHandleSelector + " {\n pointer-events: none;\n }\n "
|
11188 | };
|
11189 | var draggableStyles = {
|
11190 | animateMovement: "\n " + draggableSelector + " {\n transition: " + css.outOfTheWay + ";\n }\n "
|
11191 | };
|
11192 | var droppableStyles = {
|
11193 | base: "\n " + droppableSelector + " {\n overflow-anchor: none;\n }\n "
|
11194 | };
|
11195 | var bodyStyles = {
|
11196 | 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 "
|
11197 | };
|
11198 | var base = [dragHandleStyles.base, droppableStyles.base];
|
11199 | var resting = base.concat([dragHandleStyles.grabCursor]);
|
11200 | var collecting = base.concat([dragHandleStyles.blockPointerEvents, bodyStyles.whileActiveDragging]);
|
11201 | var dragging = collecting.concat([draggableStyles.animateMovement]);
|
11202 | var dropAnimating = base.concat([dragHandleStyles.grabCursor, draggableStyles.animateMovement]);
|
11203 | var userCancel = base.concat([draggableStyles.animateMovement]);
|
11204 | return {
|
11205 | resting: resting.join(''),
|
11206 | dragging: dragging.join(''),
|
11207 | dropAnimating: dropAnimating.join(''),
|
11208 | collecting: collecting.join(''),
|
11209 | userCancel: userCancel.join('')
|
11210 | };
|
11211 | });
|
11212 |
|
11213 | var count = 0;
|
11214 | var resetStyleContext = function resetStyleContext() {
|
11215 | count = 0;
|
11216 | };
|
11217 |
|
11218 | var getHead = function getHead() {
|
11219 | var head = document.querySelector('head');
|
11220 | !head ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot find the head to append a style to') : invariant(false) : void 0;
|
11221 | return head;
|
11222 | };
|
11223 |
|
11224 | var createStyleMarshal = (function () {
|
11225 | var context = "" + count++;
|
11226 | var styles = getStyles(context);
|
11227 | var el = null;
|
11228 | var setStyle = memoizeOne(function (proposed) {
|
11229 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot set style of style tag if not mounted') : invariant(false) : void 0;
|
11230 | el.innerHTML = proposed;
|
11231 | });
|
11232 |
|
11233 | var mount = function mount() {
|
11234 | !!el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Style marshal already mounted') : invariant(false) : void 0;
|
11235 | el = document.createElement('style');
|
11236 | el.type = 'text/css';
|
11237 | el.setAttribute(prefix, context);
|
11238 | getHead().appendChild(el);
|
11239 | setStyle(styles.resting);
|
11240 | };
|
11241 |
|
11242 | var collecting = function collecting() {
|
11243 | return setStyle(styles.collecting);
|
11244 | };
|
11245 |
|
11246 | var dragging = function dragging() {
|
11247 | return setStyle(styles.dragging);
|
11248 | };
|
11249 |
|
11250 | var dropping = function dropping(reason) {
|
11251 | if (reason === 'DROP') {
|
11252 | setStyle(styles.dropAnimating);
|
11253 | return;
|
11254 | }
|
11255 |
|
11256 | setStyle(styles.userCancel);
|
11257 | };
|
11258 |
|
11259 | var resting = function resting() {
|
11260 | return setStyle(styles.resting);
|
11261 | };
|
11262 |
|
11263 | var unmount = function unmount() {
|
11264 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot unmount style marshal as it is already unmounted') : invariant(false) : void 0;
|
11265 | getHead().removeChild(el);
|
11266 | el = null;
|
11267 | };
|
11268 |
|
11269 | var marshal = {
|
11270 | collecting: collecting,
|
11271 | dragging: dragging,
|
11272 | dropping: dropping,
|
11273 | resting: resting,
|
11274 | styleContext: context,
|
11275 | mount: mount,
|
11276 | unmount: unmount
|
11277 | };
|
11278 | return marshal;
|
11279 | });
|
11280 |
|
11281 | var canStartDrag = (function (state, id) {
|
11282 | if (state.phase === 'IDLE') {
|
11283 | return true;
|
11284 | }
|
11285 |
|
11286 | if (state.phase !== 'DROP_ANIMATING') {
|
11287 | return false;
|
11288 | }
|
11289 |
|
11290 | if (state.pending.result.draggableId === id) {
|
11291 | return false;
|
11292 | }
|
11293 |
|
11294 | return state.pending.result.reason === 'DROP';
|
11295 | });
|
11296 |
|
11297 | var scrollWindow = (function (change) {
|
11298 | window.scrollBy(change.x, change.y);
|
11299 | });
|
11300 |
|
11301 | var count$1 = 0;
|
11302 | var visuallyHidden = {
|
11303 | position: 'absolute',
|
11304 | width: '1px',
|
11305 | height: '1px',
|
11306 | margin: '-1px',
|
11307 | border: '0',
|
11308 | padding: '0',
|
11309 | overflow: 'hidden',
|
11310 | clip: 'rect(0 0 0 0)',
|
11311 | 'clip-path': 'inset(100%)'
|
11312 | };
|
11313 |
|
11314 | var getBody = function getBody() {
|
11315 | !document.body ? process.env.NODE_ENV !== "production" ? invariant(false, 'Announcer cannot find document.body') : invariant(false) : void 0;
|
11316 | return document.body;
|
11317 | };
|
11318 |
|
11319 | var createAnnouncer = (function () {
|
11320 | var id = "react-beautiful-dnd-announcement-" + count$1++;
|
11321 | var el = null;
|
11322 |
|
11323 | var announce = function announce(message) {
|
11324 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot announce to unmounted node') : invariant(false) : void 0;
|
11325 | el.textContent = message;
|
11326 | };
|
11327 |
|
11328 | var mount = function mount() {
|
11329 | !!el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Announcer already mounted') : invariant(false) : void 0;
|
11330 | el = document.createElement('div');
|
11331 | el.id = id;
|
11332 | el.setAttribute('aria-live', 'assertive');
|
11333 | el.setAttribute('role', 'log');
|
11334 | el.setAttribute('aria-atomic', 'true');
|
11335 |
|
11336 | _Object$assign(el.style, visuallyHidden);
|
11337 |
|
11338 | getBody().appendChild(el);
|
11339 | };
|
11340 |
|
11341 | var unmount = function unmount() {
|
11342 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Will not unmount annoucer as it is already unmounted') : invariant(false) : void 0;
|
11343 | getBody().removeChild(el);
|
11344 | el = null;
|
11345 | };
|
11346 |
|
11347 | var announcer = {
|
11348 | announce: announce,
|
11349 | id: id,
|
11350 | mount: mount,
|
11351 | unmount: unmount
|
11352 | };
|
11353 | return announcer;
|
11354 | });
|
11355 |
|
11356 | var getScrollableDroppables = memoizeOne(function (droppables) {
|
11357 | return toDroppableList(droppables).filter(function (droppable) {
|
11358 | if (!droppable.isEnabled) {
|
11359 | return false;
|
11360 | }
|
11361 |
|
11362 | if (!droppable.viewport.closestScrollable) {
|
11363 | return false;
|
11364 | }
|
11365 |
|
11366 | return true;
|
11367 | });
|
11368 | });
|
11369 |
|
11370 | var getScrollableDroppableOver = function getScrollableDroppableOver(target, droppables) {
|
11371 | var maybe = getScrollableDroppables(droppables).find(function (droppable) {
|
11372 | !droppable.viewport.closestScrollable ? process.env.NODE_ENV !== "production" ? invariant(false, 'Invalid result') : invariant(false) : void 0;
|
11373 | return isPositionInFrame(droppable.viewport.closestScrollable.framePageMarginBox)(target);
|
11374 | });
|
11375 | return maybe;
|
11376 | };
|
11377 |
|
11378 | var getBestScrollableDroppable = (function (_ref) {
|
11379 | var center = _ref.center,
|
11380 | destination = _ref.destination,
|
11381 | droppables = _ref.droppables;
|
11382 |
|
11383 | if (destination) {
|
11384 | var _dimension = droppables[destination.droppableId];
|
11385 |
|
11386 | if (!_dimension.viewport.closestScrollable) {
|
11387 | return null;
|
11388 | }
|
11389 |
|
11390 | return _dimension;
|
11391 | }
|
11392 |
|
11393 | var dimension = getScrollableDroppableOver(center, droppables);
|
11394 | return dimension;
|
11395 | });
|
11396 |
|
11397 | var smallestSigned = apply(function (value) {
|
11398 | if (value === 0) {
|
11399 | return 0;
|
11400 | }
|
11401 |
|
11402 | return value > 0 ? 1 : -1;
|
11403 | });
|
11404 | var getOverlap = function () {
|
11405 | var getRemainder = function getRemainder(target, max) {
|
11406 | if (target < 0) {
|
11407 | return target;
|
11408 | }
|
11409 |
|
11410 | if (target > max) {
|
11411 | return target - max;
|
11412 | }
|
11413 |
|
11414 | return 0;
|
11415 | };
|
11416 |
|
11417 | return function (_ref) {
|
11418 | var current = _ref.current,
|
11419 | max = _ref.max,
|
11420 | change = _ref.change;
|
11421 | var targetScroll = add(current, change);
|
11422 | var overlap = {
|
11423 | x: getRemainder(targetScroll.x, max.x),
|
11424 | y: getRemainder(targetScroll.y, max.y)
|
11425 | };
|
11426 |
|
11427 | if (isEqual(overlap, origin)) {
|
11428 | return null;
|
11429 | }
|
11430 |
|
11431 | return overlap;
|
11432 | };
|
11433 | }();
|
11434 | var canPartiallyScroll = function canPartiallyScroll(_ref2) {
|
11435 | var rawMax = _ref2.max,
|
11436 | current = _ref2.current,
|
11437 | change = _ref2.change;
|
11438 | var max = {
|
11439 | x: Math.max(current.x, rawMax.x),
|
11440 | y: Math.max(current.y, rawMax.y)
|
11441 | };
|
11442 | var smallestChange = smallestSigned(change);
|
11443 | var overlap = getOverlap({
|
11444 | max: max,
|
11445 | current: current,
|
11446 | change: smallestChange
|
11447 | });
|
11448 |
|
11449 | if (!overlap) {
|
11450 | return true;
|
11451 | }
|
11452 |
|
11453 | if (smallestChange.x !== 0 && overlap.x === 0) {
|
11454 | return true;
|
11455 | }
|
11456 |
|
11457 | if (smallestChange.y !== 0 && overlap.y === 0) {
|
11458 | return true;
|
11459 | }
|
11460 |
|
11461 | return false;
|
11462 | };
|
11463 | var canScrollWindow = function canScrollWindow(viewport, change) {
|
11464 | return canPartiallyScroll({
|
11465 | current: viewport.scroll.current,
|
11466 | max: viewport.scroll.max,
|
11467 | change: change
|
11468 | });
|
11469 | };
|
11470 | var getWindowOverlap = function getWindowOverlap(viewport, change) {
|
11471 | if (!canScrollWindow(viewport, change)) {
|
11472 | return null;
|
11473 | }
|
11474 |
|
11475 | var max = viewport.scroll.max;
|
11476 | var current = viewport.scroll.current;
|
11477 | return getOverlap({
|
11478 | current: current,
|
11479 | max: max,
|
11480 | change: change
|
11481 | });
|
11482 | };
|
11483 | var canScrollDroppable = function canScrollDroppable(droppable, change) {
|
11484 | var closest$$1 = droppable.viewport.closestScrollable;
|
11485 |
|
11486 | if (!closest$$1) {
|
11487 | return false;
|
11488 | }
|
11489 |
|
11490 | return canPartiallyScroll({
|
11491 | current: closest$$1.scroll.current,
|
11492 | max: closest$$1.scroll.max,
|
11493 | change: change
|
11494 | });
|
11495 | };
|
11496 | var getDroppableOverlap = function getDroppableOverlap(droppable, change) {
|
11497 | var closest$$1 = droppable.viewport.closestScrollable;
|
11498 |
|
11499 | if (!closest$$1) {
|
11500 | return null;
|
11501 | }
|
11502 |
|
11503 | if (!canScrollDroppable(droppable, change)) {
|
11504 | return null;
|
11505 | }
|
11506 |
|
11507 | return getOverlap({
|
11508 | current: closest$$1.scroll.current,
|
11509 | max: closest$$1.scroll.max,
|
11510 | change: change
|
11511 | });
|
11512 | };
|
11513 |
|
11514 | var config = {
|
11515 | startFrom: 0.25,
|
11516 | maxSpeedAt: 0.05,
|
11517 | maxScrollSpeed: 28,
|
11518 | ease: function ease(percentage) {
|
11519 | return Math.pow(percentage, 2);
|
11520 | }
|
11521 | };
|
11522 | var clean$1 = apply(function (value) {
|
11523 | return value === 0 ? 0 : value;
|
11524 | });
|
11525 | var getPixelThresholds = function getPixelThresholds(container, axis) {
|
11526 | var startFrom = container[axis.size] * config.startFrom;
|
11527 | var maxSpeedAt = container[axis.size] * config.maxSpeedAt;
|
11528 | var accelerationPlane = startFrom - maxSpeedAt;
|
11529 | var thresholds = {
|
11530 | startFrom: startFrom,
|
11531 | maxSpeedAt: maxSpeedAt,
|
11532 | accelerationPlane: accelerationPlane
|
11533 | };
|
11534 | return thresholds;
|
11535 | };
|
11536 |
|
11537 | var getSpeed = function getSpeed(distance$$1, thresholds) {
|
11538 | if (distance$$1 >= thresholds.startFrom) {
|
11539 | return 0;
|
11540 | }
|
11541 |
|
11542 | if (distance$$1 <= thresholds.maxSpeedAt) {
|
11543 | return config.maxScrollSpeed;
|
11544 | }
|
11545 |
|
11546 | var distancePastStart = thresholds.startFrom - distance$$1;
|
11547 | var percentage = distancePastStart / thresholds.accelerationPlane;
|
11548 | var transformed = config.ease(percentage);
|
11549 | var speed = config.maxScrollSpeed * transformed;
|
11550 | return speed;
|
11551 | };
|
11552 |
|
11553 | var adjustForSizeLimits = function adjustForSizeLimits(_ref) {
|
11554 | var container = _ref.container,
|
11555 | subject = _ref.subject,
|
11556 | proposedScroll = _ref.proposedScroll;
|
11557 | var isTooBigVertically = subject.height > container.height;
|
11558 | var isTooBigHorizontally = subject.width > container.width;
|
11559 |
|
11560 | if (!isTooBigHorizontally && !isTooBigVertically) {
|
11561 | return proposedScroll;
|
11562 | }
|
11563 |
|
11564 | if (isTooBigHorizontally && isTooBigVertically) {
|
11565 | return null;
|
11566 | }
|
11567 |
|
11568 | return {
|
11569 | x: isTooBigHorizontally ? 0 : proposedScroll.x,
|
11570 | y: isTooBigVertically ? 0 : proposedScroll.y
|
11571 | };
|
11572 | };
|
11573 |
|
11574 | var getRequiredScroll = function getRequiredScroll(_ref2) {
|
11575 | var container = _ref2.container,
|
11576 | subject = _ref2.subject,
|
11577 | center = _ref2.center;
|
11578 | var distance$$1 = {
|
11579 | top: center.y - container.top,
|
11580 | right: container.right - center.x,
|
11581 | bottom: container.bottom - center.y,
|
11582 | left: center.x - container.left
|
11583 | };
|
11584 |
|
11585 | var y = function () {
|
11586 | var thresholds = getPixelThresholds(container, vertical);
|
11587 | var isCloserToBottom = distance$$1.bottom < distance$$1.top;
|
11588 |
|
11589 | if (isCloserToBottom) {
|
11590 | return getSpeed(distance$$1.bottom, thresholds);
|
11591 | }
|
11592 |
|
11593 | return -1 * getSpeed(distance$$1.top, thresholds);
|
11594 | }();
|
11595 |
|
11596 | var x = function () {
|
11597 | var thresholds = getPixelThresholds(container, horizontal);
|
11598 | var isCloserToRight = distance$$1.right < distance$$1.left;
|
11599 |
|
11600 | if (isCloserToRight) {
|
11601 | return getSpeed(distance$$1.right, thresholds);
|
11602 | }
|
11603 |
|
11604 | return -1 * getSpeed(distance$$1.left, thresholds);
|
11605 | }();
|
11606 |
|
11607 | var required = clean$1({
|
11608 | x: x,
|
11609 | y: y
|
11610 | });
|
11611 |
|
11612 | if (isEqual(required, origin)) {
|
11613 | return null;
|
11614 | }
|
11615 |
|
11616 | var limited = adjustForSizeLimits({
|
11617 | container: container,
|
11618 | subject: subject,
|
11619 | proposedScroll: required
|
11620 | });
|
11621 |
|
11622 | if (!limited) {
|
11623 | return null;
|
11624 | }
|
11625 |
|
11626 | return isEqual(limited, origin) ? null : limited;
|
11627 | };
|
11628 |
|
11629 | var withPlaceholder = function withPlaceholder(droppable, draggable) {
|
11630 | var closest$$1 = droppable.viewport.closestScrollable;
|
11631 |
|
11632 | if (!closest$$1) {
|
11633 | return null;
|
11634 | }
|
11635 |
|
11636 | var isOverHome = droppable.descriptor.id === draggable.descriptor.droppableId;
|
11637 | var max = closest$$1.scroll.max;
|
11638 | var current = closest$$1.scroll.current;
|
11639 |
|
11640 | if (isOverHome) {
|
11641 | return {
|
11642 | max: max,
|
11643 | current: current
|
11644 | };
|
11645 | }
|
11646 |
|
11647 | var spaceForPlaceholder = patch(droppable.axis.line, draggable.placeholder.client.borderBox[droppable.axis.size]);
|
11648 | var newMax = add(max, spaceForPlaceholder);
|
11649 | var newCurrent = {
|
11650 | x: Math.min(current.x, newMax.x),
|
11651 | y: Math.min(current.y, newMax.y)
|
11652 | };
|
11653 | return {
|
11654 | max: newMax,
|
11655 | current: newCurrent
|
11656 | };
|
11657 | };
|
11658 |
|
11659 | var createFluidScroller = (function (_ref3) {
|
11660 | var scrollWindow = _ref3.scrollWindow,
|
11661 | scrollDroppable = _ref3.scrollDroppable;
|
11662 | var scheduleWindowScroll = rafSchd(scrollWindow);
|
11663 | var scheduleDroppableScroll = rafSchd(scrollDroppable);
|
11664 |
|
11665 | var scroller = function scroller(state) {
|
11666 | var center = state.current.page.borderBoxCenter;
|
11667 | var draggable = state.dimensions.draggables[state.critical.draggable.id];
|
11668 | var subject = draggable.page.marginBox;
|
11669 | var viewport = state.viewport;
|
11670 | var requiredWindowScroll = getRequiredScroll({
|
11671 | container: viewport.frame,
|
11672 | subject: subject,
|
11673 | center: center
|
11674 | });
|
11675 |
|
11676 | if (requiredWindowScroll && canScrollWindow(viewport, requiredWindowScroll)) {
|
11677 | scheduleWindowScroll(requiredWindowScroll);
|
11678 | return;
|
11679 | }
|
11680 |
|
11681 | var droppable = getBestScrollableDroppable({
|
11682 | center: center,
|
11683 | destination: state.impact.destination,
|
11684 | droppables: state.dimensions.droppables
|
11685 | });
|
11686 |
|
11687 | if (!droppable) {
|
11688 | return;
|
11689 | }
|
11690 |
|
11691 | var closestScrollable = droppable.viewport.closestScrollable;
|
11692 |
|
11693 | if (!closestScrollable) {
|
11694 | return;
|
11695 | }
|
11696 |
|
11697 | var requiredFrameScroll = getRequiredScroll({
|
11698 | container: closestScrollable.framePageMarginBox,
|
11699 | subject: subject,
|
11700 | center: center
|
11701 | });
|
11702 |
|
11703 | if (!requiredFrameScroll) {
|
11704 | return;
|
11705 | }
|
11706 |
|
11707 | var result = withPlaceholder(droppable, draggable);
|
11708 |
|
11709 | if (!result) {
|
11710 | return;
|
11711 | }
|
11712 |
|
11713 | var closest$$1 = droppable.viewport.closestScrollable;
|
11714 |
|
11715 | if (!closest$$1) {
|
11716 | return;
|
11717 | }
|
11718 |
|
11719 | var canScrollDroppable$$1 = canPartiallyScroll({
|
11720 | current: result.current,
|
11721 | max: result.max,
|
11722 | change: requiredFrameScroll
|
11723 | });
|
11724 |
|
11725 | if (canScrollDroppable$$1) {
|
11726 | scheduleDroppableScroll(droppable.descriptor.id, requiredFrameScroll);
|
11727 | }
|
11728 | };
|
11729 |
|
11730 | scroller.cancel = function () {
|
11731 | scheduleWindowScroll.cancel();
|
11732 | scheduleDroppableScroll.cancel();
|
11733 | };
|
11734 |
|
11735 | return scroller;
|
11736 | });
|
11737 |
|
11738 | var createJumpScroller = (function (_ref) {
|
11739 | var move = _ref.move,
|
11740 | scrollDroppable = _ref.scrollDroppable,
|
11741 | scrollWindow = _ref.scrollWindow;
|
11742 |
|
11743 | var moveByOffset = function moveByOffset(state, offset) {
|
11744 | var client = add(state.current.client.selection, offset);
|
11745 | move({
|
11746 | client: client,
|
11747 | shouldAnimate: true
|
11748 | });
|
11749 | };
|
11750 |
|
11751 | var scrollDroppableAsMuchAsItCan = function scrollDroppableAsMuchAsItCan(droppable, change) {
|
11752 | if (!canScrollDroppable(droppable, change)) {
|
11753 | return change;
|
11754 | }
|
11755 |
|
11756 | var overlap = getDroppableOverlap(droppable, change);
|
11757 |
|
11758 | if (!overlap) {
|
11759 | scrollDroppable(droppable.descriptor.id, change);
|
11760 | return null;
|
11761 | }
|
11762 |
|
11763 | var whatTheDroppableCanScroll = subtract(change, overlap);
|
11764 | scrollDroppable(droppable.descriptor.id, whatTheDroppableCanScroll);
|
11765 | var remainder = subtract(change, whatTheDroppableCanScroll);
|
11766 | return remainder;
|
11767 | };
|
11768 |
|
11769 | var scrollWindowAsMuchAsItCan = function scrollWindowAsMuchAsItCan(viewport, change) {
|
11770 | if (!canScrollWindow(viewport, change)) {
|
11771 | return change;
|
11772 | }
|
11773 |
|
11774 | var overlap = getWindowOverlap(viewport, change);
|
11775 |
|
11776 | if (!overlap) {
|
11777 | scrollWindow(change);
|
11778 | return null;
|
11779 | }
|
11780 |
|
11781 | var whatTheWindowCanScroll = subtract(change, overlap);
|
11782 | scrollWindow(whatTheWindowCanScroll);
|
11783 | var remainder = subtract(change, whatTheWindowCanScroll);
|
11784 | return remainder;
|
11785 | };
|
11786 |
|
11787 | var jumpScroller = function jumpScroller(state) {
|
11788 | var request = state.scrollJumpRequest;
|
11789 |
|
11790 | if (!request) {
|
11791 | return;
|
11792 | }
|
11793 |
|
11794 | var destination = state.impact.destination;
|
11795 | !destination ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot perform a jump scroll when there is no destination') : invariant(false) : void 0;
|
11796 | var droppableRemainder = scrollDroppableAsMuchAsItCan(state.dimensions.droppables[destination.droppableId], request);
|
11797 |
|
11798 | if (!droppableRemainder) {
|
11799 | return;
|
11800 | }
|
11801 |
|
11802 | var viewport = state.viewport;
|
11803 | var windowRemainder = scrollWindowAsMuchAsItCan(viewport, droppableRemainder);
|
11804 |
|
11805 | if (!windowRemainder) {
|
11806 | return;
|
11807 | }
|
11808 |
|
11809 | moveByOffset(state, windowRemainder);
|
11810 | };
|
11811 |
|
11812 | return jumpScroller;
|
11813 | });
|
11814 |
|
11815 | var createAutoScroller = (function (_ref) {
|
11816 | var scrollDroppable = _ref.scrollDroppable,
|
11817 | scrollWindow = _ref.scrollWindow,
|
11818 | move = _ref.move;
|
11819 | var fluidScroll = createFluidScroller({
|
11820 | scrollWindow: scrollWindow,
|
11821 | scrollDroppable: scrollDroppable
|
11822 | });
|
11823 | var jumpScroll = createJumpScroller({
|
11824 | move: move,
|
11825 | scrollWindow: scrollWindow,
|
11826 | scrollDroppable: scrollDroppable
|
11827 | });
|
11828 | var marshal = {
|
11829 | cancel: fluidScroll.cancel,
|
11830 | fluidScroll: fluidScroll,
|
11831 | jumpScroll: jumpScroll
|
11832 | };
|
11833 | return marshal;
|
11834 | });
|
11835 |
|
11836 | var prefix$1 = function prefix(key) {
|
11837 | return "private-react-beautiful-dnd-key-do-not-use-" + key;
|
11838 | };
|
11839 |
|
11840 | var storeKey = prefix$1('store');
|
11841 | var droppableIdKey = prefix$1('droppable-id');
|
11842 | var droppableTypeKey = prefix$1('droppable-type');
|
11843 | var dimensionMarshalKey = prefix$1('dimension-marshal');
|
11844 | var styleContextKey = prefix$1('style-context');
|
11845 | var canLiftContextKey = prefix$1('can-lift');
|
11846 |
|
11847 | var _DragDropContext$chil;
|
11848 | var resetServerContext = function resetServerContext() {
|
11849 | resetStyleContext();
|
11850 | };
|
11851 |
|
11852 | var printFatalDevError = function printFatalDevError(error) {
|
11853 | if (process.env.NODE_ENV === 'production') {
|
11854 | return;
|
11855 | }
|
11856 |
|
11857 | console.warn("\n An error has occurred while a drag is occurring.\n Any existing drag will be cancelled.\n\n Raw error:\n ");
|
11858 | console.error(error);
|
11859 | };
|
11860 |
|
11861 | var DragDropContext = function (_React$Component) {
|
11862 | _inheritsLoose(DragDropContext, _React$Component);
|
11863 |
|
11864 | function DragDropContext(props, context) {
|
11865 | var _this;
|
11866 |
|
11867 | _this = _React$Component.call(this, props, context) || this;
|
11868 | _this.store = void 0;
|
11869 | _this.dimensionMarshal = void 0;
|
11870 | _this.styleMarshal = void 0;
|
11871 | _this.autoScroller = void 0;
|
11872 | _this.announcer = void 0;
|
11873 | _this.unsubscribe = void 0;
|
11874 |
|
11875 | _this.canLift = function (id) {
|
11876 | return canStartDrag(_this.store.getState(), id);
|
11877 | };
|
11878 |
|
11879 | _this.onFatalError = function (error) {
|
11880 | printFatalDevError(error);
|
11881 |
|
11882 | var state = _this.store.getState();
|
11883 |
|
11884 | if (state.phase !== 'IDLE') {
|
11885 | _this.store.dispatch(clean());
|
11886 | }
|
11887 | };
|
11888 |
|
11889 | _this.onWindowError = function (error) {
|
11890 | return _this.onFatalError(error);
|
11891 | };
|
11892 |
|
11893 | _this.announcer = createAnnouncer();
|
11894 | _this.styleMarshal = createStyleMarshal();
|
11895 | _this.store = createStore({
|
11896 | getDimensionMarshal: function getDimensionMarshal() {
|
11897 | return _this.dimensionMarshal;
|
11898 | },
|
11899 | styleMarshal: _this.styleMarshal,
|
11900 | getHooks: function getHooks() {
|
11901 | return {
|
11902 | onBeforeDragStart: _this.props.onBeforeDragStart,
|
11903 | onDragStart: _this.props.onDragStart,
|
11904 | onDragEnd: _this.props.onDragEnd,
|
11905 | onDragUpdate: _this.props.onDragUpdate
|
11906 | };
|
11907 | },
|
11908 | announce: _this.announcer.announce,
|
11909 | getScroller: function getScroller() {
|
11910 | return _this.autoScroller;
|
11911 | }
|
11912 | });
|
11913 | var callbacks = redux.bindActionCreators({
|
11914 | collectionStarting: collectionStarting,
|
11915 | publish: publish,
|
11916 | updateDroppableScroll: updateDroppableScroll,
|
11917 | updateDroppableIsEnabled: updateDroppableIsEnabled
|
11918 | }, _this.store.dispatch);
|
11919 | _this.dimensionMarshal = createDimensionMarshal(callbacks);
|
11920 | _this.autoScroller = createAutoScroller(_extends({
|
11921 | scrollWindow: scrollWindow,
|
11922 | scrollDroppable: _this.dimensionMarshal.scrollDroppable
|
11923 | }, redux.bindActionCreators({
|
11924 | move: move
|
11925 | }, _this.store.dispatch)));
|
11926 | return _this;
|
11927 | }
|
11928 |
|
11929 | var _proto = DragDropContext.prototype;
|
11930 |
|
11931 | _proto.getChildContext = function getChildContext() {
|
11932 | var _ref;
|
11933 |
|
11934 | return _ref = {}, _ref[storeKey] = this.store, _ref[dimensionMarshalKey] = this.dimensionMarshal, _ref[styleContextKey] = this.styleMarshal.styleContext, _ref[canLiftContextKey] = this.canLift, _ref;
|
11935 | };
|
11936 |
|
11937 | _proto.componentDidMount = function componentDidMount() {
|
11938 | window.addEventListener('error', this.onWindowError);
|
11939 | this.styleMarshal.mount();
|
11940 | this.announcer.mount();
|
11941 | };
|
11942 |
|
11943 | _proto.componentDidCatch = function componentDidCatch(error) {
|
11944 | this.onFatalError(error);
|
11945 |
|
11946 | if (error.message.indexOf('Invariant failed') !== -1) {
|
11947 | this.setState({});
|
11948 | return;
|
11949 | }
|
11950 |
|
11951 | throw error;
|
11952 | };
|
11953 |
|
11954 | _proto.componentWillUnmount = function componentWillUnmount() {
|
11955 | window.removeEventListener('error', this.onWindowError);
|
11956 | var state = this.store.getState();
|
11957 |
|
11958 | if (state.phase !== 'IDLE') {
|
11959 | this.store.dispatch(clean());
|
11960 | }
|
11961 |
|
11962 | this.styleMarshal.unmount();
|
11963 | this.announcer.unmount();
|
11964 | };
|
11965 |
|
11966 | _proto.render = function render() {
|
11967 | return this.props.children;
|
11968 | };
|
11969 |
|
11970 | return DragDropContext;
|
11971 | }(React__default.Component);
|
11972 |
|
11973 | DragDropContext.childContextTypes = (_DragDropContext$chil = {}, _DragDropContext$chil[storeKey] = PropTypes.shape({
|
11974 | dispatch: PropTypes.func.isRequired,
|
11975 | subscribe: PropTypes.func.isRequired,
|
11976 | getState: PropTypes.func.isRequired
|
11977 | }).isRequired, _DragDropContext$chil[dimensionMarshalKey] = PropTypes.object.isRequired, _DragDropContext$chil[styleContextKey] = PropTypes.string.isRequired, _DragDropContext$chil[canLiftContextKey] = PropTypes.func.isRequired, _DragDropContext$chil);
|
11978 |
|
11979 | var isScrollable = function isScrollable() {
|
11980 | for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
11981 | values[_key] = arguments[_key];
|
11982 | }
|
11983 |
|
11984 | return values.some(function (value) {
|
11985 | return value === 'auto' || value === 'scroll';
|
11986 | });
|
11987 | };
|
11988 |
|
11989 | var isElementScrollable = function isElementScrollable(el) {
|
11990 | var style = window.getComputedStyle(el);
|
11991 | return isScrollable(style.overflow, style.overflowY, style.overflowX);
|
11992 | };
|
11993 |
|
11994 | var getClosestScrollable = function getClosestScrollable(el) {
|
11995 | if (el == null) {
|
11996 | return null;
|
11997 | }
|
11998 |
|
11999 | if (!isElementScrollable(el)) {
|
12000 | return getClosestScrollable(el.parentElement);
|
12001 | }
|
12002 |
|
12003 | return el;
|
12004 | };
|
12005 |
|
12006 | var _DroppableDimensionPu;
|
12007 |
|
12008 | var getScroll = function getScroll(el) {
|
12009 | return {
|
12010 | x: el.scrollLeft,
|
12011 | y: el.scrollTop
|
12012 | };
|
12013 | };
|
12014 |
|
12015 | var checkForNestedScrollContainers = function checkForNestedScrollContainers(scrollable) {
|
12016 | if (process.env.NODE_ENV === 'production') {
|
12017 | return;
|
12018 | }
|
12019 |
|
12020 | if (!scrollable) {
|
12021 | return;
|
12022 | }
|
12023 |
|
12024 | var anotherScrollParent = getClosestScrollable(scrollable.parentElement);
|
12025 |
|
12026 | if (!anotherScrollParent) {
|
12027 | return;
|
12028 | }
|
12029 |
|
12030 | 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 ");
|
12031 | };
|
12032 |
|
12033 | var listenerOptions = {
|
12034 | passive: true
|
12035 | };
|
12036 |
|
12037 | var DroppableDimensionPublisher = function (_React$Component) {
|
12038 | _inheritsLoose(DroppableDimensionPublisher, _React$Component);
|
12039 |
|
12040 | function DroppableDimensionPublisher(props, context) {
|
12041 | var _this;
|
12042 |
|
12043 | _this = _React$Component.call(this, props, context) || this;
|
12044 | _this.watchingScroll = null;
|
12045 | _this.callbacks = void 0;
|
12046 | _this.publishedDescriptor = null;
|
12047 |
|
12048 | _this.getClosestScroll = function () {
|
12049 | if (!_this.watchingScroll) {
|
12050 | return origin;
|
12051 | }
|
12052 |
|
12053 | return getScroll(_this.watchingScroll.closestScrollable);
|
12054 | };
|
12055 |
|
12056 | _this.memoizedUpdateScroll = memoizeOne(function (x, y) {
|
12057 | !_this.publishedDescriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot update scroll on unpublished droppable') : invariant(false) : void 0;
|
12058 | var newScroll = {
|
12059 | x: x,
|
12060 | y: y
|
12061 | };
|
12062 | var marshal = _this.context[dimensionMarshalKey];
|
12063 | marshal.updateDroppableScroll(_this.publishedDescriptor.id, newScroll);
|
12064 | });
|
12065 |
|
12066 | _this.updateScroll = function () {
|
12067 | var offset = _this.getClosestScroll();
|
12068 |
|
12069 | _this.memoizedUpdateScroll(offset.x, offset.y);
|
12070 | };
|
12071 |
|
12072 | _this.scheduleScrollUpdate = rafSchd(_this.updateScroll);
|
12073 |
|
12074 | _this.onClosestScroll = function () {
|
12075 | !_this.watchingScroll ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not find scroll options while scrolling') : invariant(false) : void 0;
|
12076 | var options = _this.watchingScroll.options;
|
12077 |
|
12078 | if (options.shouldPublishImmediately) {
|
12079 | _this.updateScroll();
|
12080 |
|
12081 | return;
|
12082 | }
|
12083 |
|
12084 | _this.scheduleScrollUpdate();
|
12085 | };
|
12086 |
|
12087 | _this.scroll = function (change) {
|
12088 | !_this.watchingScroll ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot scroll a droppable with no closest scrollable') : invariant(false) : void 0;
|
12089 | var closestScrollable = _this.watchingScroll.closestScrollable;
|
12090 | closestScrollable.scrollTop += change.y;
|
12091 | closestScrollable.scrollLeft += change.x;
|
12092 | };
|
12093 |
|
12094 | _this.watchScroll = function (closestScrollable, options) {
|
12095 | !!_this.watchingScroll ? process.env.NODE_ENV !== "production" ? invariant(false, 'Droppable cannot watch scroll as it is already watching scroll') : invariant(false) : void 0;
|
12096 |
|
12097 | if (!closestScrollable) {
|
12098 | return;
|
12099 | }
|
12100 |
|
12101 | _this.watchingScroll = {
|
12102 | options: options,
|
12103 | closestScrollable: closestScrollable
|
12104 | };
|
12105 | closestScrollable.addEventListener('scroll', _this.onClosestScroll, listenerOptions);
|
12106 | };
|
12107 |
|
12108 | _this.unwatchScroll = function () {
|
12109 | var watching = _this.watchingScroll;
|
12110 |
|
12111 | if (!watching) {
|
12112 | return;
|
12113 | }
|
12114 |
|
12115 | _this.scheduleScrollUpdate.cancel();
|
12116 |
|
12117 | watching.closestScrollable.removeEventListener('scroll', _this.onClosestScroll, listenerOptions);
|
12118 | _this.watchingScroll = null;
|
12119 | };
|
12120 |
|
12121 | _this.getMemoizedDescriptor = memoizeOne(function (id, type) {
|
12122 | return {
|
12123 | id: id,
|
12124 | type: type
|
12125 | };
|
12126 | });
|
12127 |
|
12128 | _this.publish = function () {
|
12129 | var marshal = _this.context[dimensionMarshalKey];
|
12130 |
|
12131 | var descriptor = _this.getMemoizedDescriptor(_this.props.droppableId, _this.props.type);
|
12132 |
|
12133 | if (!_this.publishedDescriptor) {
|
12134 | marshal.registerDroppable(descriptor, _this.callbacks);
|
12135 | _this.publishedDescriptor = descriptor;
|
12136 | return;
|
12137 | }
|
12138 |
|
12139 | if (_this.publishedDescriptor === descriptor) {
|
12140 | return;
|
12141 | }
|
12142 |
|
12143 | marshal.updateDroppable(_this.publishedDescriptor, descriptor, _this.callbacks);
|
12144 | _this.publishedDescriptor = descriptor;
|
12145 | };
|
12146 |
|
12147 | _this.unpublish = function () {
|
12148 | !_this.publishedDescriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot unpublish descriptor when none is published') : invariant(false) : void 0;
|
12149 | var marshal = _this.context[dimensionMarshalKey];
|
12150 | marshal.unregisterDroppable(_this.publishedDescriptor);
|
12151 | _this.publishedDescriptor = null;
|
12152 | };
|
12153 |
|
12154 | _this.getDimensionAndWatchScroll = function (windowScroll, options) {
|
12155 | var _this$props = _this.props,
|
12156 | direction = _this$props.direction,
|
12157 | ignoreContainerClipping = _this$props.ignoreContainerClipping,
|
12158 | isDropDisabled = _this$props.isDropDisabled,
|
12159 | getDroppableRef = _this$props.getDroppableRef;
|
12160 | var targetRef = getDroppableRef();
|
12161 | var descriptor = _this.publishedDescriptor;
|
12162 | !targetRef ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot calculate a dimension when not attached to the DOM') : invariant(false) : void 0;
|
12163 | !descriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get dimension for unpublished droppable') : invariant(false) : void 0;
|
12164 | var scrollableRef = getClosestScrollable(targetRef);
|
12165 | checkForNestedScrollContainers(scrollableRef);
|
12166 |
|
12167 | _this.watchScroll(scrollableRef, options);
|
12168 |
|
12169 | var client = function () {
|
12170 | var base = cssBoxModel.getBox(targetRef);
|
12171 |
|
12172 | if (!scrollableRef) {
|
12173 | return base;
|
12174 | }
|
12175 |
|
12176 | if (targetRef !== scrollableRef) {
|
12177 | return base;
|
12178 | }
|
12179 |
|
12180 | var top = base.paddingBox.top - scrollableRef.scrollTop;
|
12181 | var left = base.paddingBox.left - scrollableRef.scrollLeft;
|
12182 | var bottom = top + scrollableRef.scrollHeight;
|
12183 | var right = left + scrollableRef.scrollWidth;
|
12184 | var paddingBox = {
|
12185 | top: top,
|
12186 | right: right,
|
12187 | bottom: bottom,
|
12188 | left: left
|
12189 | };
|
12190 | var borderBox = {
|
12191 | top: paddingBox.top - base.border.top,
|
12192 | right: paddingBox.right + base.border.right,
|
12193 | bottom: paddingBox.bottom + base.border.bottom,
|
12194 | left: paddingBox.left - base.border.left
|
12195 | };
|
12196 | return cssBoxModel.createBox({
|
12197 | borderBox: borderBox,
|
12198 | margin: base.margin,
|
12199 | border: base.border,
|
12200 | padding: base.padding
|
12201 | });
|
12202 | }();
|
12203 |
|
12204 | var page = cssBoxModel.withScroll(client, windowScroll);
|
12205 |
|
12206 | var closest$$1 = function () {
|
12207 | if (!scrollableRef) {
|
12208 | return null;
|
12209 | }
|
12210 |
|
12211 | var frameClient = cssBoxModel.getBox(scrollableRef);
|
12212 | return {
|
12213 | client: frameClient,
|
12214 | page: cssBoxModel.withScroll(frameClient),
|
12215 | scrollHeight: scrollableRef.scrollHeight,
|
12216 | scrollWidth: scrollableRef.scrollWidth,
|
12217 | scroll: getScroll(scrollableRef),
|
12218 | shouldClipSubject: !ignoreContainerClipping
|
12219 | };
|
12220 | }();
|
12221 |
|
12222 | return getDroppableDimension({
|
12223 | descriptor: descriptor,
|
12224 | isEnabled: !isDropDisabled,
|
12225 | direction: direction,
|
12226 | client: client,
|
12227 | page: page,
|
12228 | closest: closest$$1
|
12229 | });
|
12230 | };
|
12231 |
|
12232 | var callbacks = {
|
12233 | getDimensionAndWatchScroll: _this.getDimensionAndWatchScroll,
|
12234 | unwatchScroll: _this.unwatchScroll,
|
12235 | scroll: _this.scroll
|
12236 | };
|
12237 | _this.callbacks = callbacks;
|
12238 | return _this;
|
12239 | }
|
12240 |
|
12241 | var _proto = DroppableDimensionPublisher.prototype;
|
12242 |
|
12243 | _proto.componentDidMount = function componentDidMount() {
|
12244 | this.publish();
|
12245 | };
|
12246 |
|
12247 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
12248 | this.publish();
|
12249 |
|
12250 | if (this.props.isDropDisabled === prevProps.isDropDisabled) {
|
12251 | return;
|
12252 | }
|
12253 |
|
12254 | var marshal = this.context[dimensionMarshalKey];
|
12255 | marshal.updateDroppableIsEnabled(this.props.droppableId, !this.props.isDropDisabled);
|
12256 | };
|
12257 |
|
12258 | _proto.componentWillUnmount = function componentWillUnmount() {
|
12259 | if (this.watchingScroll) {
|
12260 | if (process.env.NODE_ENV !== 'production') {
|
12261 | console.warn('Unmounting droppable while it was watching scroll');
|
12262 | }
|
12263 |
|
12264 | this.unwatchScroll();
|
12265 | }
|
12266 |
|
12267 | this.unpublish();
|
12268 | };
|
12269 |
|
12270 | _proto.render = function render() {
|
12271 | return this.props.children;
|
12272 | };
|
12273 |
|
12274 | return DroppableDimensionPublisher;
|
12275 | }(React__default.Component);
|
12276 |
|
12277 | DroppableDimensionPublisher.contextTypes = (_DroppableDimensionPu = {}, _DroppableDimensionPu[dimensionMarshalKey] = PropTypes.object.isRequired, _DroppableDimensionPu);
|
12278 |
|
12279 | var Placeholder = function (_PureComponent) {
|
12280 | _inheritsLoose(Placeholder, _PureComponent);
|
12281 |
|
12282 | function Placeholder() {
|
12283 | return _PureComponent.apply(this, arguments) || this;
|
12284 | }
|
12285 |
|
12286 | var _proto = Placeholder.prototype;
|
12287 |
|
12288 | _proto.componentDidMount = function componentDidMount() {
|
12289 | if (this.props.onMount) {
|
12290 | this.props.onMount();
|
12291 | }
|
12292 | };
|
12293 |
|
12294 | _proto.componentWillUnmount = function componentWillUnmount() {
|
12295 | if (this.props.onUnmount) {
|
12296 | this.props.onUnmount();
|
12297 | }
|
12298 | };
|
12299 |
|
12300 | _proto.render = function render() {
|
12301 | var placeholder = this.props.placeholder;
|
12302 | var client = placeholder.client,
|
12303 | display = placeholder.display,
|
12304 | tagName = placeholder.tagName;
|
12305 | var style = {
|
12306 | display: display,
|
12307 | boxSizing: 'border-box',
|
12308 | width: client.borderBox.width,
|
12309 | height: client.borderBox.height,
|
12310 | marginTop: client.margin.top,
|
12311 | marginRight: client.margin.right,
|
12312 | marginBottom: client.margin.bottom,
|
12313 | marginLeft: client.margin.left,
|
12314 | flexShrink: '0',
|
12315 | flexGrow: '0',
|
12316 | pointerEvents: 'none'
|
12317 | };
|
12318 | return React__default.createElement(tagName, {
|
12319 | style: style
|
12320 | });
|
12321 | };
|
12322 |
|
12323 | return Placeholder;
|
12324 | }(React.PureComponent);
|
12325 |
|
12326 | var throwIfRefIsInvalid = (function (ref) {
|
12327 | !(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;
|
12328 | });
|
12329 |
|
12330 | var _Droppable$contextTyp, _Droppable$childConte;
|
12331 |
|
12332 | var Droppable = function (_Component) {
|
12333 | _inheritsLoose(Droppable, _Component);
|
12334 |
|
12335 | function Droppable(props, context) {
|
12336 | var _this;
|
12337 |
|
12338 | _this = _Component.call(this, props, context) || this;
|
12339 | _this.styleContext = void 0;
|
12340 | _this.ref = null;
|
12341 | _this.isPlaceholderMounted = false;
|
12342 |
|
12343 | _this.onPlaceholderMount = function () {
|
12344 | _this.isPlaceholderMounted = true;
|
12345 | };
|
12346 |
|
12347 | _this.onPlaceholderUnmount = function () {
|
12348 | _this.isPlaceholderMounted = false;
|
12349 | };
|
12350 |
|
12351 | _this.setRef = function (ref) {
|
12352 | if (ref === null) {
|
12353 | return;
|
12354 | }
|
12355 |
|
12356 | if (ref === _this.ref) {
|
12357 | return;
|
12358 | }
|
12359 |
|
12360 | _this.ref = ref;
|
12361 | throwIfRefIsInvalid(ref);
|
12362 | };
|
12363 |
|
12364 | _this.getDroppableRef = function () {
|
12365 | return _this.ref;
|
12366 | };
|
12367 |
|
12368 | _this.styleContext = context[styleContextKey];
|
12369 | return _this;
|
12370 | }
|
12371 |
|
12372 | var _proto = Droppable.prototype;
|
12373 |
|
12374 | _proto.getChildContext = function getChildContext() {
|
12375 | var _value;
|
12376 |
|
12377 | var value = (_value = {}, _value[droppableIdKey] = this.props.droppableId, _value[droppableTypeKey] = this.props.type, _value);
|
12378 | return value;
|
12379 | };
|
12380 |
|
12381 | _proto.componentDidMount = function componentDidMount() {
|
12382 | throwIfRefIsInvalid(this.ref);
|
12383 | this.warnIfPlaceholderNotMounted();
|
12384 | };
|
12385 |
|
12386 | _proto.componentDidUpdate = function componentDidUpdate() {
|
12387 | this.warnIfPlaceholderNotMounted();
|
12388 | };
|
12389 |
|
12390 | _proto.warnIfPlaceholderNotMounted = function warnIfPlaceholderNotMounted() {
|
12391 | if (process.env.NODE_ENV === 'production') {
|
12392 | return;
|
12393 | }
|
12394 |
|
12395 | if (!this.props.placeholder) {
|
12396 | return;
|
12397 | }
|
12398 |
|
12399 | if (this.isPlaceholderMounted) {
|
12400 | return;
|
12401 | }
|
12402 |
|
12403 | 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 ");
|
12404 | };
|
12405 |
|
12406 | _proto.getPlaceholder = function getPlaceholder() {
|
12407 | if (!this.props.placeholder) {
|
12408 | return null;
|
12409 | }
|
12410 |
|
12411 | return React__default.createElement(Placeholder, {
|
12412 | placeholder: this.props.placeholder,
|
12413 | onMount: this.onPlaceholderMount,
|
12414 | onUnmount: this.onPlaceholderUnmount
|
12415 | });
|
12416 | };
|
12417 |
|
12418 | _proto.render = function render() {
|
12419 | var _this$props = this.props,
|
12420 | children = _this$props.children,
|
12421 | direction = _this$props.direction,
|
12422 | droppableId = _this$props.droppableId,
|
12423 | ignoreContainerClipping = _this$props.ignoreContainerClipping,
|
12424 | isDraggingOver = _this$props.isDraggingOver,
|
12425 | isDropDisabled = _this$props.isDropDisabled,
|
12426 | draggingOverWith = _this$props.draggingOverWith,
|
12427 | type = _this$props.type;
|
12428 | var provided = {
|
12429 | innerRef: this.setRef,
|
12430 | placeholder: this.getPlaceholder(),
|
12431 | droppableProps: {
|
12432 | 'data-react-beautiful-dnd-droppable': this.styleContext
|
12433 | }
|
12434 | };
|
12435 | var snapshot = {
|
12436 | isDraggingOver: isDraggingOver,
|
12437 | draggingOverWith: draggingOverWith
|
12438 | };
|
12439 | return React__default.createElement(DroppableDimensionPublisher, {
|
12440 | droppableId: droppableId,
|
12441 | type: type,
|
12442 | direction: direction,
|
12443 | ignoreContainerClipping: ignoreContainerClipping,
|
12444 | isDropDisabled: isDropDisabled,
|
12445 | getDroppableRef: this.getDroppableRef
|
12446 | }, children(provided, snapshot));
|
12447 | };
|
12448 |
|
12449 | return Droppable;
|
12450 | }(React.Component);
|
12451 |
|
12452 | Droppable.contextTypes = (_Droppable$contextTyp = {}, _Droppable$contextTyp[styleContextKey] = PropTypes.string.isRequired, _Droppable$contextTyp);
|
12453 | Droppable.childContextTypes = (_Droppable$childConte = {}, _Droppable$childConte[droppableIdKey] = PropTypes.string.isRequired, _Droppable$childConte[droppableTypeKey] = PropTypes.string.isRequired, _Droppable$childConte);
|
12454 |
|
12455 | var isStrictEqual = (function (a, b) {
|
12456 | return a === b;
|
12457 | });
|
12458 |
|
12459 | var makeMapStateToProps = function makeMapStateToProps() {
|
12460 | var getIsDraggingOver = function getIsDraggingOver(id, destination) {
|
12461 | if (!destination) {
|
12462 | return false;
|
12463 | }
|
12464 |
|
12465 | return destination.droppableId === id;
|
12466 | };
|
12467 |
|
12468 | var shouldUsePlaceholder = function shouldUsePlaceholder(id, descriptor, destination) {
|
12469 | if (!destination) {
|
12470 | return false;
|
12471 | }
|
12472 |
|
12473 | if (id === descriptor.droppableId) {
|
12474 | return false;
|
12475 | }
|
12476 |
|
12477 | return id === destination.droppableId;
|
12478 | };
|
12479 |
|
12480 | var getMapProps = memoizeOne(function (isDraggingOver, draggingOverWith, placeholder) {
|
12481 | return {
|
12482 | isDraggingOver: isDraggingOver,
|
12483 | draggingOverWith: draggingOverWith,
|
12484 | placeholder: placeholder
|
12485 | };
|
12486 | });
|
12487 |
|
12488 | var getDefault = function getDefault() {
|
12489 | return getMapProps(false, null, null);
|
12490 | };
|
12491 |
|
12492 | var selector = function selector(state, ownProps) {
|
12493 | if (ownProps.isDropDisabled) {
|
12494 | return getDefault();
|
12495 | }
|
12496 |
|
12497 | var id = ownProps.droppableId;
|
12498 |
|
12499 | if (state.isDragging) {
|
12500 | var destination = state.impact.destination;
|
12501 | var isDraggingOver = getIsDraggingOver(id, destination);
|
12502 | var draggableId = state.critical.draggable.id;
|
12503 | var draggingOverWith = isDraggingOver ? draggableId : null;
|
12504 | var draggable = state.dimensions.draggables[draggableId];
|
12505 | var placeholder = shouldUsePlaceholder(id, draggable.descriptor, destination) ? draggable.placeholder : null;
|
12506 | return getMapProps(isDraggingOver, draggingOverWith, placeholder);
|
12507 | }
|
12508 |
|
12509 | if (state.phase === 'DROP_ANIMATING') {
|
12510 | var _destination = state.pending.impact.destination;
|
12511 |
|
12512 | var _isDraggingOver = getIsDraggingOver(id, _destination);
|
12513 |
|
12514 | var _draggableId = state.pending.result.draggableId;
|
12515 |
|
12516 | var _draggingOverWith = _isDraggingOver ? _draggableId : null;
|
12517 |
|
12518 | var _draggable = state.dimensions.draggables[_draggableId];
|
12519 |
|
12520 | var _placeholder = shouldUsePlaceholder(id, _draggable.descriptor, _destination) ? _draggable.placeholder : null;
|
12521 |
|
12522 | return getMapProps(_isDraggingOver, _draggingOverWith, _placeholder);
|
12523 | }
|
12524 |
|
12525 | return getDefault();
|
12526 | };
|
12527 |
|
12528 | return selector;
|
12529 | };
|
12530 | var connectedDroppable = reactRedux.connect(makeMapStateToProps, null, null, {
|
12531 | storeKey: storeKey,
|
12532 | pure: true,
|
12533 | areStatePropsEqual: isStrictEqual
|
12534 | })(Droppable);
|
12535 | connectedDroppable.defaultProps = {
|
12536 | type: 'DEFAULT',
|
12537 | isDropDisabled: false,
|
12538 | direction: 'vertical',
|
12539 | ignoreContainerClipping: false
|
12540 | };
|
12541 |
|
12542 | var _DraggableDimensionPu;
|
12543 |
|
12544 | var DraggableDimensionPublisher = function (_Component) {
|
12545 | _inheritsLoose(DraggableDimensionPublisher, _Component);
|
12546 |
|
12547 | function DraggableDimensionPublisher() {
|
12548 | var _this;
|
12549 |
|
12550 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
12551 | args[_key] = arguments[_key];
|
12552 | }
|
12553 |
|
12554 | _this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
12555 | _this.publishedDescriptor = null;
|
12556 | _this.getMemoizedDescriptor = memoizeOne(function (id, index, droppableId, type) {
|
12557 | return {
|
12558 | id: id,
|
12559 | index: index,
|
12560 | droppableId: droppableId,
|
12561 | type: type
|
12562 | };
|
12563 | });
|
12564 |
|
12565 | _this.publish = function () {
|
12566 | var marshal = _this.context[dimensionMarshalKey];
|
12567 |
|
12568 | var descriptor = _this.getMemoizedDescriptor(_this.props.draggableId, _this.props.index, _this.props.droppableId, _this.props.type);
|
12569 |
|
12570 | if (!_this.publishedDescriptor) {
|
12571 | marshal.registerDraggable(descriptor, _this.getDimension);
|
12572 | _this.publishedDescriptor = descriptor;
|
12573 | return;
|
12574 | }
|
12575 |
|
12576 | if (descriptor === _this.publishedDescriptor) {
|
12577 | return;
|
12578 | }
|
12579 |
|
12580 | marshal.updateDraggable(_this.publishedDescriptor, descriptor, _this.getDimension);
|
12581 | _this.publishedDescriptor = descriptor;
|
12582 | };
|
12583 |
|
12584 | _this.unpublish = function () {
|
12585 | !_this.publishedDescriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot unpublish descriptor when none is published') : invariant(false) : void 0;
|
12586 | var marshal = _this.context[dimensionMarshalKey];
|
12587 | marshal.unregisterDraggable(_this.publishedDescriptor);
|
12588 | _this.publishedDescriptor = null;
|
12589 | };
|
12590 |
|
12591 | _this.getDimension = function (windowScroll) {
|
12592 | var targetRef = _this.props.getDraggableRef();
|
12593 |
|
12594 | var descriptor = _this.publishedDescriptor;
|
12595 | !targetRef ? process.env.NODE_ENV !== "production" ? invariant(false, 'DraggableDimensionPublisher cannot calculate a dimension when not attached to the DOM') : invariant(false) : void 0;
|
12596 | !descriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get dimension for unpublished draggable') : invariant(false) : void 0;
|
12597 | var computedStyles = window.getComputedStyle(targetRef);
|
12598 | var borderBox = targetRef.getBoundingClientRect();
|
12599 | var client = cssBoxModel.calculateBox(borderBox, computedStyles);
|
12600 | var page = cssBoxModel.withScroll(client, windowScroll);
|
12601 | var placeholder = {
|
12602 | client: client,
|
12603 | tagName: targetRef.tagName.toLowerCase(),
|
12604 | display: computedStyles.display
|
12605 | };
|
12606 | var dimension = {
|
12607 | descriptor: descriptor,
|
12608 | placeholder: placeholder,
|
12609 | client: client,
|
12610 | page: page
|
12611 | };
|
12612 | return dimension;
|
12613 | };
|
12614 |
|
12615 | return _this;
|
12616 | }
|
12617 |
|
12618 | var _proto = DraggableDimensionPublisher.prototype;
|
12619 |
|
12620 | _proto.componentDidMount = function componentDidMount() {
|
12621 | this.publish();
|
12622 | };
|
12623 |
|
12624 | _proto.componentDidUpdate = function componentDidUpdate() {
|
12625 | this.publish();
|
12626 | };
|
12627 |
|
12628 | _proto.componentWillUnmount = function componentWillUnmount() {
|
12629 | this.unpublish();
|
12630 | };
|
12631 |
|
12632 | _proto.render = function render() {
|
12633 | return this.props.children;
|
12634 | };
|
12635 |
|
12636 | return DraggableDimensionPublisher;
|
12637 | }(React.Component);
|
12638 |
|
12639 | DraggableDimensionPublisher.contextTypes = (_DraggableDimensionPu = {}, _DraggableDimensionPu[dimensionMarshalKey] = PropTypes.object.isRequired, _DraggableDimensionPu);
|
12640 |
|
12641 | var DoubleRenderBlocker = function (_React$Component) {
|
12642 | _inheritsLoose(DoubleRenderBlocker, _React$Component);
|
12643 |
|
12644 | function DoubleRenderBlocker() {
|
12645 | return _React$Component.apply(this, arguments) || this;
|
12646 | }
|
12647 |
|
12648 | var _proto = DoubleRenderBlocker.prototype;
|
12649 |
|
12650 | _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
12651 | if (isEqual(origin, nextProps.change)) {
|
12652 | return true;
|
12653 | }
|
12654 |
|
12655 | if (isEqual(this.props.change, nextProps.change)) {
|
12656 | return false;
|
12657 | }
|
12658 |
|
12659 | return true;
|
12660 | };
|
12661 |
|
12662 | _proto.render = function render() {
|
12663 | return this.props.children(this.props.change);
|
12664 | };
|
12665 |
|
12666 | return DoubleRenderBlocker;
|
12667 | }(React__default.Component);
|
12668 |
|
12669 | var Moveable = function (_Component) {
|
12670 | _inheritsLoose(Moveable, _Component);
|
12671 |
|
12672 | function Moveable() {
|
12673 | return _Component.apply(this, arguments) || this;
|
12674 | }
|
12675 |
|
12676 | var _proto2 = Moveable.prototype;
|
12677 |
|
12678 | _proto2.getFinal = function getFinal() {
|
12679 | var destination = this.props.destination;
|
12680 | var speed = this.props.speed;
|
12681 |
|
12682 | if (speed === 'INSTANT') {
|
12683 | return destination;
|
12684 | }
|
12685 |
|
12686 | var config = speed === 'FAST' ? physics.fast : physics.standard;
|
12687 | return {
|
12688 | x: reactMotion.spring(destination.x, config),
|
12689 | y: reactMotion.spring(destination.y, config)
|
12690 | };
|
12691 | };
|
12692 |
|
12693 | _proto2.render = function render() {
|
12694 | var _this = this;
|
12695 |
|
12696 | var final = this.getFinal();
|
12697 | return React__default.createElement(reactMotion.Motion, {
|
12698 | defaultStyle: origin,
|
12699 | style: final,
|
12700 | onRest: this.props.onMoveEnd
|
12701 | }, function (current) {
|
12702 | var _this$props = _this.props,
|
12703 | speed = _this$props.speed,
|
12704 | destination = _this$props.destination,
|
12705 | children = _this$props.children;
|
12706 | var target = speed === 'INSTANT' ? destination : current;
|
12707 | return React__default.createElement(DoubleRenderBlocker, {
|
12708 | change: target
|
12709 | }, children);
|
12710 | });
|
12711 | };
|
12712 |
|
12713 | return Moveable;
|
12714 | }(React.Component);
|
12715 |
|
12716 | Moveable.defaultProps = {
|
12717 | destination: origin
|
12718 | };
|
12719 |
|
12720 | var getWindowFromRef = (function (ref) {
|
12721 | return ref ? ref.ownerDocument.defaultView : window;
|
12722 | });
|
12723 |
|
12724 | var selector = "[" + dragHandle + "]";
|
12725 |
|
12726 | var isSVG = function isSVG(el) {
|
12727 | if (typeof SVGElement === 'undefined') {
|
12728 | return false;
|
12729 | }
|
12730 |
|
12731 | return el instanceof SVGElement;
|
12732 | };
|
12733 |
|
12734 | var throwIfSVG = function throwIfSVG(el) {
|
12735 | !!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;
|
12736 | };
|
12737 |
|
12738 | var getDragHandleRef = function getDragHandleRef(draggableRef) {
|
12739 | if (draggableRef.hasAttribute(dragHandle)) {
|
12740 | throwIfSVG(draggableRef);
|
12741 | return draggableRef;
|
12742 | }
|
12743 |
|
12744 | var el = draggableRef.querySelector(selector);
|
12745 | throwIfSVG(draggableRef);
|
12746 | !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;
|
12747 | !(el instanceof HTMLElement) ? process.env.NODE_ENV !== "production" ? invariant(false, 'A drag handle must be a HTMLElement') : invariant(false) : void 0;
|
12748 | return el;
|
12749 | };
|
12750 |
|
12751 | var retainingFocusFor = null;
|
12752 | var listenerOptions$1 = {
|
12753 | capture: true
|
12754 | };
|
12755 |
|
12756 | var clearRetentionOnFocusChange = function () {
|
12757 | var isBound = false;
|
12758 |
|
12759 | var bind = function bind() {
|
12760 | if (isBound) {
|
12761 | return;
|
12762 | }
|
12763 |
|
12764 | isBound = true;
|
12765 | window.addEventListener('focus', onWindowFocusChange, listenerOptions$1);
|
12766 | };
|
12767 |
|
12768 | var unbind = function unbind() {
|
12769 | if (!isBound) {
|
12770 | return;
|
12771 | }
|
12772 |
|
12773 | isBound = false;
|
12774 | window.removeEventListener('focus', onWindowFocusChange, listenerOptions$1);
|
12775 | };
|
12776 |
|
12777 | var onWindowFocusChange = function onWindowFocusChange() {
|
12778 | unbind();
|
12779 | retainingFocusFor = null;
|
12780 | };
|
12781 |
|
12782 | var result = function result() {
|
12783 | return bind();
|
12784 | };
|
12785 |
|
12786 | result.cancel = function () {
|
12787 | return unbind();
|
12788 | };
|
12789 |
|
12790 | return result;
|
12791 | }();
|
12792 |
|
12793 | var retain = function retain(id) {
|
12794 | retainingFocusFor = id;
|
12795 | clearRetentionOnFocusChange();
|
12796 | };
|
12797 |
|
12798 | var tryRestoreFocus = function tryRestoreFocus(id, draggableRef) {
|
12799 | if (!retainingFocusFor) {
|
12800 | return;
|
12801 | }
|
12802 |
|
12803 | if (id !== retainingFocusFor) {
|
12804 | return;
|
12805 | }
|
12806 |
|
12807 | retainingFocusFor = null;
|
12808 | clearRetentionOnFocusChange.cancel();
|
12809 | var dragHandleRef = getDragHandleRef(draggableRef);
|
12810 |
|
12811 | if (!dragHandleRef) {
|
12812 | console.warn('Could not find drag handle in the DOM to focus on it');
|
12813 | return;
|
12814 | }
|
12815 |
|
12816 | dragHandleRef.focus();
|
12817 | };
|
12818 |
|
12819 | var retainer = {
|
12820 | retain: retain,
|
12821 | tryRestoreFocus: tryRestoreFocus
|
12822 | };
|
12823 |
|
12824 | var interactiveTagNames = {
|
12825 | input: true,
|
12826 | button: true,
|
12827 | textarea: true,
|
12828 | select: true,
|
12829 | option: true,
|
12830 | optgroup: true,
|
12831 | video: true,
|
12832 | audio: true
|
12833 | };
|
12834 |
|
12835 | var isAnInteractiveElement = function isAnInteractiveElement(parent, current) {
|
12836 | if (current == null) {
|
12837 | return false;
|
12838 | }
|
12839 |
|
12840 | var hasAnInteractiveTag = Boolean(interactiveTagNames[current.tagName.toLowerCase()]);
|
12841 |
|
12842 | if (hasAnInteractiveTag) {
|
12843 | return true;
|
12844 | }
|
12845 |
|
12846 | var attribute = current.getAttribute('contenteditable');
|
12847 |
|
12848 | if (attribute === 'true' || attribute === '') {
|
12849 | return true;
|
12850 | }
|
12851 |
|
12852 | if (current === parent) {
|
12853 | return false;
|
12854 | }
|
12855 |
|
12856 | return isAnInteractiveElement(parent, current.parentElement);
|
12857 | };
|
12858 |
|
12859 | var shouldAllowDraggingFromTarget = (function (event, props) {
|
12860 | if (props.canDragInteractiveElements) {
|
12861 | return true;
|
12862 | }
|
12863 |
|
12864 | var target = event.target,
|
12865 | currentTarget = event.currentTarget;
|
12866 |
|
12867 | if (!(target instanceof Element) || !(currentTarget instanceof Element)) {
|
12868 | return true;
|
12869 | }
|
12870 |
|
12871 | return !isAnInteractiveElement(currentTarget, target);
|
12872 | });
|
12873 |
|
12874 | var createScheduler = (function (callbacks) {
|
12875 | var memoizedMove = memoizeOne(function (x, y) {
|
12876 | var point = {
|
12877 | x: x,
|
12878 | y: y
|
12879 | };
|
12880 | callbacks.onMove(point);
|
12881 | });
|
12882 | var move = rafSchd(function (point) {
|
12883 | return memoizedMove(point.x, point.y);
|
12884 | });
|
12885 | var moveUp = rafSchd(callbacks.onMoveUp);
|
12886 | var moveDown = rafSchd(callbacks.onMoveDown);
|
12887 | var moveRight = rafSchd(callbacks.onMoveRight);
|
12888 | var moveLeft = rafSchd(callbacks.onMoveLeft);
|
12889 | var windowScrollMove = rafSchd(callbacks.onWindowScroll);
|
12890 |
|
12891 | var cancel = function cancel() {
|
12892 | move.cancel();
|
12893 | moveUp.cancel();
|
12894 | moveDown.cancel();
|
12895 | moveRight.cancel();
|
12896 | moveLeft.cancel();
|
12897 | windowScrollMove.cancel();
|
12898 | };
|
12899 |
|
12900 | return {
|
12901 | move: move,
|
12902 | moveUp: moveUp,
|
12903 | moveDown: moveDown,
|
12904 | moveRight: moveRight,
|
12905 | moveLeft: moveLeft,
|
12906 | windowScrollMove: windowScrollMove,
|
12907 | cancel: cancel
|
12908 | };
|
12909 | });
|
12910 |
|
12911 | var sloppyClickThreshold = 5;
|
12912 | var isSloppyClickThresholdExceeded = (function (original, current) {
|
12913 | return Math.abs(current.x - original.x) >= sloppyClickThreshold || Math.abs(current.y - original.y) >= sloppyClickThreshold;
|
12914 | });
|
12915 |
|
12916 | var tab = 9;
|
12917 | var enter = 13;
|
12918 | var escape = 27;
|
12919 | var space = 32;
|
12920 | var pageUp = 33;
|
12921 | var pageDown = 34;
|
12922 | var end = 35;
|
12923 | var home = 36;
|
12924 | var arrowLeft = 37;
|
12925 | var arrowUp = 38;
|
12926 | var arrowRight = 39;
|
12927 | var arrowDown = 40;
|
12928 |
|
12929 | var _preventedKeys;
|
12930 | var preventedKeys = (_preventedKeys = {}, _preventedKeys[enter] = true, _preventedKeys[tab] = true, _preventedKeys);
|
12931 | var preventStandardKeyEvents = (function (event) {
|
12932 | if (preventedKeys[event.keyCode]) {
|
12933 | event.preventDefault();
|
12934 | }
|
12935 | });
|
12936 |
|
12937 | var getOptions = function getOptions(shared, fromBinding) {
|
12938 | return _extends({}, shared, fromBinding);
|
12939 | };
|
12940 |
|
12941 | var bindEvents = function bindEvents(el, bindings, sharedOptions) {
|
12942 | bindings.forEach(function (binding) {
|
12943 | var options = getOptions(sharedOptions, binding.options);
|
12944 | el.addEventListener(binding.eventName, binding.fn, options);
|
12945 | });
|
12946 | };
|
12947 | var unbindEvents = function unbindEvents(el, bindings, sharedOptions) {
|
12948 | bindings.forEach(function (binding) {
|
12949 | var options = getOptions(sharedOptions, binding.options);
|
12950 | el.removeEventListener(binding.eventName, binding.fn, options);
|
12951 | });
|
12952 | };
|
12953 |
|
12954 | var sharedOptions = {
|
12955 | capture: true
|
12956 | };
|
12957 | var createPostDragEventPreventer = (function (getWindow) {
|
12958 | var isBound = false;
|
12959 |
|
12960 | var bind = function bind() {
|
12961 | if (isBound) {
|
12962 | return;
|
12963 | }
|
12964 |
|
12965 | isBound = true;
|
12966 | bindEvents(getWindow(), pointerEvents, sharedOptions);
|
12967 | };
|
12968 |
|
12969 | var unbind = function unbind() {
|
12970 | if (!isBound) {
|
12971 | return;
|
12972 | }
|
12973 |
|
12974 | isBound = false;
|
12975 | unbindEvents(getWindow(), pointerEvents, sharedOptions);
|
12976 | };
|
12977 |
|
12978 | var pointerEvents = [{
|
12979 | eventName: 'click',
|
12980 | fn: function fn(event) {
|
12981 | event.preventDefault();
|
12982 | unbind();
|
12983 | }
|
12984 | }, {
|
12985 | eventName: 'mousedown',
|
12986 | fn: unbind
|
12987 | }, {
|
12988 | eventName: 'touchstart',
|
12989 | fn: unbind
|
12990 | }];
|
12991 |
|
12992 | var preventNext = function preventNext() {
|
12993 | if (isBound) {
|
12994 | unbind();
|
12995 | }
|
12996 |
|
12997 | bind();
|
12998 | };
|
12999 |
|
13000 | var preventer = {
|
13001 | preventNext: preventNext,
|
13002 | abort: unbind
|
13003 | };
|
13004 | return preventer;
|
13005 | });
|
13006 |
|
13007 | var createEventMarshal = (function () {
|
13008 | var isMouseDownHandled = false;
|
13009 |
|
13010 | var handle = function handle() {
|
13011 | !!isMouseDownHandled ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot handle mouse down as it is already handled') : invariant(false) : void 0;
|
13012 | isMouseDownHandled = true;
|
13013 | };
|
13014 |
|
13015 | var isHandled = function isHandled() {
|
13016 | return isMouseDownHandled;
|
13017 | };
|
13018 |
|
13019 | var reset = function reset() {
|
13020 | isMouseDownHandled = false;
|
13021 | };
|
13022 |
|
13023 | return {
|
13024 | handle: handle,
|
13025 | isHandled: isHandled,
|
13026 | reset: reset
|
13027 | };
|
13028 | });
|
13029 |
|
13030 | var supportedEventName = function () {
|
13031 | var base = 'visibilitychange';
|
13032 |
|
13033 | if (typeof document === 'undefined') {
|
13034 | return base;
|
13035 | }
|
13036 |
|
13037 | var candidates = [base, "ms" + base, "webkit" + base, "moz" + base, "o" + base];
|
13038 | var supported = candidates.find(function (eventName) {
|
13039 | return "on" + eventName in document;
|
13040 | });
|
13041 | return supported || base;
|
13042 | }();
|
13043 |
|
13044 | var primaryButton = 0;
|
13045 |
|
13046 | var noop = function noop() {};
|
13047 |
|
13048 | var mouseDownMarshal = createEventMarshal();
|
13049 | var createMouseSensor = (function (_ref) {
|
13050 | var callbacks = _ref.callbacks,
|
13051 | getWindow = _ref.getWindow,
|
13052 | canStartCapturing = _ref.canStartCapturing;
|
13053 | var state = {
|
13054 | isDragging: false,
|
13055 | pending: null
|
13056 | };
|
13057 |
|
13058 | var setState = function setState(newState) {
|
13059 | state = newState;
|
13060 | };
|
13061 |
|
13062 | var isDragging = function isDragging() {
|
13063 | return state.isDragging;
|
13064 | };
|
13065 |
|
13066 | var isCapturing = function isCapturing() {
|
13067 | return Boolean(state.pending || state.isDragging);
|
13068 | };
|
13069 |
|
13070 | var schedule = createScheduler(callbacks);
|
13071 | var postDragEventPreventer = createPostDragEventPreventer(getWindow);
|
13072 |
|
13073 | var startDragging = function startDragging(fn) {
|
13074 | if (fn === void 0) {
|
13075 | fn = noop;
|
13076 | }
|
13077 |
|
13078 | setState({
|
13079 | pending: null,
|
13080 | isDragging: true
|
13081 | });
|
13082 | fn();
|
13083 | };
|
13084 |
|
13085 | var stopDragging = function stopDragging(fn, shouldBlockClick) {
|
13086 | if (fn === void 0) {
|
13087 | fn = noop;
|
13088 | }
|
13089 |
|
13090 | if (shouldBlockClick === void 0) {
|
13091 | shouldBlockClick = true;
|
13092 | }
|
13093 |
|
13094 | schedule.cancel();
|
13095 | unbindWindowEvents();
|
13096 | mouseDownMarshal.reset();
|
13097 |
|
13098 | if (shouldBlockClick) {
|
13099 | postDragEventPreventer.preventNext();
|
13100 | }
|
13101 |
|
13102 | setState({
|
13103 | isDragging: false,
|
13104 | pending: null
|
13105 | });
|
13106 | fn();
|
13107 | };
|
13108 |
|
13109 | var startPendingDrag = function startPendingDrag(point) {
|
13110 | setState({
|
13111 | pending: point,
|
13112 | isDragging: false
|
13113 | });
|
13114 | bindWindowEvents();
|
13115 | };
|
13116 |
|
13117 | var stopPendingDrag = function stopPendingDrag() {
|
13118 | stopDragging(noop, false);
|
13119 | };
|
13120 |
|
13121 | var kill = function kill(fn) {
|
13122 | if (fn === void 0) {
|
13123 | fn = noop;
|
13124 | }
|
13125 |
|
13126 | if (state.pending) {
|
13127 | stopPendingDrag();
|
13128 | return;
|
13129 | }
|
13130 |
|
13131 | stopDragging(fn);
|
13132 | };
|
13133 |
|
13134 | var unmount = function unmount() {
|
13135 | kill();
|
13136 | postDragEventPreventer.abort();
|
13137 | };
|
13138 |
|
13139 | var cancel = function cancel() {
|
13140 | kill(callbacks.onCancel);
|
13141 | };
|
13142 |
|
13143 | var windowBindings = [{
|
13144 | eventName: 'mousemove',
|
13145 | fn: function fn(event) {
|
13146 | var button = event.button,
|
13147 | clientX = event.clientX,
|
13148 | clientY = event.clientY;
|
13149 |
|
13150 | if (button !== primaryButton) {
|
13151 | return;
|
13152 | }
|
13153 |
|
13154 | var point = {
|
13155 | x: clientX,
|
13156 | y: clientY
|
13157 | };
|
13158 |
|
13159 | if (state.isDragging) {
|
13160 | event.preventDefault();
|
13161 | schedule.move(point);
|
13162 | return;
|
13163 | }
|
13164 |
|
13165 | if (!state.pending) {
|
13166 | kill();
|
13167 | process.env.NODE_ENV !== "production" ? invariant(false, 'Expected there to be a pending drag') : invariant(false);
|
13168 | }
|
13169 |
|
13170 | if (!isSloppyClickThresholdExceeded(state.pending, point)) {
|
13171 | return;
|
13172 | }
|
13173 |
|
13174 | event.preventDefault();
|
13175 | startDragging(function () {
|
13176 | return callbacks.onLift({
|
13177 | clientSelection: point,
|
13178 | autoScrollMode: 'FLUID'
|
13179 | });
|
13180 | });
|
13181 | }
|
13182 | }, {
|
13183 | eventName: 'mouseup',
|
13184 | fn: function fn(event) {
|
13185 | if (state.pending) {
|
13186 | stopPendingDrag();
|
13187 | return;
|
13188 | }
|
13189 |
|
13190 | event.preventDefault();
|
13191 | stopDragging(callbacks.onDrop);
|
13192 | }
|
13193 | }, {
|
13194 | eventName: 'mousedown',
|
13195 | fn: function fn(event) {
|
13196 | if (state.isDragging) {
|
13197 | event.preventDefault();
|
13198 | }
|
13199 |
|
13200 | stopDragging(callbacks.onCancel);
|
13201 | }
|
13202 | }, {
|
13203 | eventName: 'keydown',
|
13204 | fn: function fn(event) {
|
13205 | if (!state.isDragging) {
|
13206 | cancel();
|
13207 | return;
|
13208 | }
|
13209 |
|
13210 | if (event.keyCode === escape) {
|
13211 | event.preventDefault();
|
13212 | cancel();
|
13213 | return;
|
13214 | }
|
13215 |
|
13216 | preventStandardKeyEvents(event);
|
13217 | }
|
13218 | }, {
|
13219 | eventName: 'resize',
|
13220 | fn: cancel
|
13221 | }, {
|
13222 | eventName: 'scroll',
|
13223 | options: {
|
13224 | passive: true,
|
13225 | capture: false
|
13226 | },
|
13227 | fn: function fn() {
|
13228 | if (state.pending) {
|
13229 | stopPendingDrag();
|
13230 | return;
|
13231 | }
|
13232 |
|
13233 | schedule.windowScrollMove();
|
13234 | }
|
13235 | }, {
|
13236 | eventName: 'webkitmouseforcechanged',
|
13237 | fn: function fn(event) {
|
13238 | if (event.webkitForce == null || MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN == null) {
|
13239 | if (process.env.NODE_ENV !== 'production') {
|
13240 | console.warn('handling a mouse force changed event when it is not supported');
|
13241 | }
|
13242 |
|
13243 | return;
|
13244 | }
|
13245 |
|
13246 | var forcePressThreshold = MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN;
|
13247 | var isForcePressing = event.webkitForce >= forcePressThreshold;
|
13248 |
|
13249 | if (isForcePressing) {
|
13250 | cancel();
|
13251 | }
|
13252 | }
|
13253 | }, {
|
13254 | eventName: supportedEventName,
|
13255 | fn: cancel
|
13256 | }];
|
13257 |
|
13258 | var bindWindowEvents = function bindWindowEvents() {
|
13259 | var win = getWindow();
|
13260 | bindEvents(win, windowBindings, {
|
13261 | capture: true
|
13262 | });
|
13263 | };
|
13264 |
|
13265 | var unbindWindowEvents = function unbindWindowEvents() {
|
13266 | var win = getWindow();
|
13267 | unbindEvents(win, windowBindings, {
|
13268 | capture: true
|
13269 | });
|
13270 | };
|
13271 |
|
13272 | var onMouseDown = function onMouseDown(event) {
|
13273 | if (mouseDownMarshal.isHandled()) {
|
13274 | return;
|
13275 | }
|
13276 |
|
13277 | !!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;
|
13278 |
|
13279 | if (!canStartCapturing(event)) {
|
13280 | return;
|
13281 | }
|
13282 |
|
13283 | if (event.button !== primaryButton) {
|
13284 | return;
|
13285 | }
|
13286 |
|
13287 | if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) {
|
13288 | return;
|
13289 | }
|
13290 |
|
13291 | mouseDownMarshal.handle();
|
13292 | event.preventDefault();
|
13293 | var point = {
|
13294 | x: event.clientX,
|
13295 | y: event.clientY
|
13296 | };
|
13297 | startPendingDrag(point);
|
13298 | };
|
13299 |
|
13300 | var sensor = {
|
13301 | onMouseDown: onMouseDown,
|
13302 | kill: kill,
|
13303 | isCapturing: isCapturing,
|
13304 | isDragging: isDragging,
|
13305 | unmount: unmount
|
13306 | };
|
13307 | return sensor;
|
13308 | });
|
13309 |
|
13310 | var getBorderBoxCenterPosition = (function (el) {
|
13311 | return cssBoxModel.getRect(el.getBoundingClientRect()).center;
|
13312 | });
|
13313 |
|
13314 | var _scrollJumpKeys;
|
13315 | var scrollJumpKeys = (_scrollJumpKeys = {}, _scrollJumpKeys[pageDown] = true, _scrollJumpKeys[pageUp] = true, _scrollJumpKeys[home] = true, _scrollJumpKeys[end] = true, _scrollJumpKeys);
|
13316 |
|
13317 | var noop$1 = function noop() {};
|
13318 |
|
13319 | var createKeyboardSensor = (function (_ref) {
|
13320 | var callbacks = _ref.callbacks,
|
13321 | getWindow = _ref.getWindow,
|
13322 | getDraggableRef = _ref.getDraggableRef,
|
13323 | canStartCapturing = _ref.canStartCapturing;
|
13324 | var state = {
|
13325 | isDragging: false
|
13326 | };
|
13327 |
|
13328 | var setState = function setState(newState) {
|
13329 | state = newState;
|
13330 | };
|
13331 |
|
13332 | var startDragging = function startDragging(fn) {
|
13333 | if (fn === void 0) {
|
13334 | fn = noop$1;
|
13335 | }
|
13336 |
|
13337 | setState({
|
13338 | isDragging: true
|
13339 | });
|
13340 | bindWindowEvents();
|
13341 | fn();
|
13342 | };
|
13343 |
|
13344 | var stopDragging = function stopDragging(fn) {
|
13345 | if (fn === void 0) {
|
13346 | fn = noop$1;
|
13347 | }
|
13348 |
|
13349 | schedule.cancel();
|
13350 | unbindWindowEvents();
|
13351 | setState({
|
13352 | isDragging: false
|
13353 | });
|
13354 | fn();
|
13355 | };
|
13356 |
|
13357 | var kill = function kill() {
|
13358 | return stopDragging();
|
13359 | };
|
13360 |
|
13361 | var cancel = function cancel() {
|
13362 | stopDragging(callbacks.onCancel);
|
13363 | };
|
13364 |
|
13365 | var isDragging = function isDragging() {
|
13366 | return state.isDragging;
|
13367 | };
|
13368 |
|
13369 | var schedule = createScheduler(callbacks);
|
13370 |
|
13371 | var onKeyDown = function onKeyDown(event) {
|
13372 | if (!isDragging()) {
|
13373 | if (event.defaultPrevented) {
|
13374 | return;
|
13375 | }
|
13376 |
|
13377 | if (!canStartCapturing(event)) {
|
13378 | return;
|
13379 | }
|
13380 |
|
13381 | if (event.keyCode !== space) {
|
13382 | return;
|
13383 | }
|
13384 |
|
13385 | var ref = getDraggableRef();
|
13386 | !ref ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot start a keyboard drag without a draggable ref') : invariant(false) : void 0;
|
13387 | var center = getBorderBoxCenterPosition(ref);
|
13388 | event.preventDefault();
|
13389 | startDragging(function () {
|
13390 | return callbacks.onLift({
|
13391 | clientSelection: center,
|
13392 | autoScrollMode: 'JUMP'
|
13393 | });
|
13394 | });
|
13395 | return;
|
13396 | }
|
13397 |
|
13398 | if (event.keyCode === escape) {
|
13399 | event.preventDefault();
|
13400 | cancel();
|
13401 | return;
|
13402 | }
|
13403 |
|
13404 | if (event.keyCode === space) {
|
13405 | event.preventDefault();
|
13406 | stopDragging(callbacks.onDrop);
|
13407 | return;
|
13408 | }
|
13409 |
|
13410 | if (event.keyCode === arrowDown) {
|
13411 | event.preventDefault();
|
13412 | schedule.moveDown();
|
13413 | return;
|
13414 | }
|
13415 |
|
13416 | if (event.keyCode === arrowUp) {
|
13417 | event.preventDefault();
|
13418 | schedule.moveUp();
|
13419 | return;
|
13420 | }
|
13421 |
|
13422 | if (event.keyCode === arrowRight) {
|
13423 | event.preventDefault();
|
13424 | schedule.moveRight();
|
13425 | return;
|
13426 | }
|
13427 |
|
13428 | if (event.keyCode === arrowLeft) {
|
13429 | event.preventDefault();
|
13430 | schedule.moveLeft();
|
13431 | return;
|
13432 | }
|
13433 |
|
13434 | if (scrollJumpKeys[event.keyCode]) {
|
13435 | event.preventDefault();
|
13436 | return;
|
13437 | }
|
13438 |
|
13439 | preventStandardKeyEvents(event);
|
13440 | };
|
13441 |
|
13442 | var windowBindings = [{
|
13443 | eventName: 'mousedown',
|
13444 | fn: cancel
|
13445 | }, {
|
13446 | eventName: 'mouseup',
|
13447 | fn: cancel
|
13448 | }, {
|
13449 | eventName: 'click',
|
13450 | fn: cancel
|
13451 | }, {
|
13452 | eventName: 'touchstart',
|
13453 | fn: cancel
|
13454 | }, {
|
13455 | eventName: 'resize',
|
13456 | fn: cancel
|
13457 | }, {
|
13458 | eventName: 'wheel',
|
13459 | fn: cancel
|
13460 | }, {
|
13461 | eventName: 'scroll',
|
13462 | options: {
|
13463 | capture: false
|
13464 | },
|
13465 | fn: callbacks.onWindowScroll
|
13466 | }, {
|
13467 | eventName: supportedEventName,
|
13468 | fn: cancel
|
13469 | }];
|
13470 |
|
13471 | var bindWindowEvents = function bindWindowEvents() {
|
13472 | bindEvents(getWindow(), windowBindings, {
|
13473 | capture: true
|
13474 | });
|
13475 | };
|
13476 |
|
13477 | var unbindWindowEvents = function unbindWindowEvents() {
|
13478 | unbindEvents(getWindow(), windowBindings, {
|
13479 | capture: true
|
13480 | });
|
13481 | };
|
13482 |
|
13483 | var sensor = {
|
13484 | onKeyDown: onKeyDown,
|
13485 | kill: kill,
|
13486 | isDragging: isDragging,
|
13487 | isCapturing: isDragging,
|
13488 | unmount: kill
|
13489 | };
|
13490 | return sensor;
|
13491 | });
|
13492 |
|
13493 | var timeForLongPress = 150;
|
13494 | var forcePressThreshold = 0.15;
|
13495 | var touchStartMarshal = createEventMarshal();
|
13496 |
|
13497 | var noop$2 = function noop() {};
|
13498 |
|
13499 | var webkitHack = function () {
|
13500 | var stub = {
|
13501 | preventTouchMove: noop$2,
|
13502 | releaseTouchMove: noop$2
|
13503 | };
|
13504 |
|
13505 | if (typeof window === 'undefined') {
|
13506 | return stub;
|
13507 | }
|
13508 |
|
13509 | if (!('ontouchstart' in window)) {
|
13510 | return stub;
|
13511 | }
|
13512 |
|
13513 | var isBlocking = false;
|
13514 | window.addEventListener('touchmove', function (event) {
|
13515 | if (!isBlocking) {
|
13516 | return;
|
13517 | }
|
13518 |
|
13519 | if (event.defaultPrevented) {
|
13520 | return;
|
13521 | }
|
13522 |
|
13523 | event.preventDefault();
|
13524 | }, {
|
13525 | passive: false,
|
13526 | capture: false
|
13527 | });
|
13528 |
|
13529 | var preventTouchMove = function preventTouchMove() {
|
13530 | isBlocking = true;
|
13531 | };
|
13532 |
|
13533 | var releaseTouchMove = function releaseTouchMove() {
|
13534 | isBlocking = false;
|
13535 | };
|
13536 |
|
13537 | return {
|
13538 | preventTouchMove: preventTouchMove,
|
13539 | releaseTouchMove: releaseTouchMove
|
13540 | };
|
13541 | }();
|
13542 |
|
13543 | var initial = {
|
13544 | isDragging: false,
|
13545 | pending: null,
|
13546 | hasMoved: false,
|
13547 | longPressTimerId: null
|
13548 | };
|
13549 | var createTouchSensor = (function (_ref) {
|
13550 | var callbacks = _ref.callbacks,
|
13551 | getWindow = _ref.getWindow,
|
13552 | canStartCapturing = _ref.canStartCapturing;
|
13553 | var state = initial;
|
13554 |
|
13555 | var setState = function setState(partial) {
|
13556 | state = _extends({}, state, partial);
|
13557 | };
|
13558 |
|
13559 | var isDragging = function isDragging() {
|
13560 | return state.isDragging;
|
13561 | };
|
13562 |
|
13563 | var isCapturing = function isCapturing() {
|
13564 | return Boolean(state.pending || state.isDragging || state.longPressTimerId);
|
13565 | };
|
13566 |
|
13567 | var schedule = createScheduler(callbacks);
|
13568 | var postDragEventPreventer = createPostDragEventPreventer(getWindow);
|
13569 |
|
13570 | var startDragging = function startDragging() {
|
13571 | var pending = state.pending;
|
13572 |
|
13573 | if (!pending) {
|
13574 | kill();
|
13575 | process.env.NODE_ENV !== "production" ? invariant(false, 'cannot start a touch drag without a pending position') : invariant(false);
|
13576 | }
|
13577 |
|
13578 | setState({
|
13579 | isDragging: true,
|
13580 | hasMoved: false,
|
13581 | pending: null,
|
13582 | longPressTimerId: null
|
13583 | });
|
13584 | callbacks.onLift({
|
13585 | clientSelection: pending,
|
13586 | autoScrollMode: 'FLUID'
|
13587 | });
|
13588 | };
|
13589 |
|
13590 | var stopDragging = function stopDragging(fn) {
|
13591 | if (fn === void 0) {
|
13592 | fn = noop$2;
|
13593 | }
|
13594 |
|
13595 | schedule.cancel();
|
13596 | touchStartMarshal.reset();
|
13597 | webkitHack.releaseTouchMove();
|
13598 | unbindWindowEvents();
|
13599 | postDragEventPreventer.preventNext();
|
13600 | setState(initial);
|
13601 | fn();
|
13602 | };
|
13603 |
|
13604 | var startPendingDrag = function startPendingDrag(event) {
|
13605 | var touch = event.touches[0];
|
13606 | var clientX = touch.clientX,
|
13607 | clientY = touch.clientY;
|
13608 | var point = {
|
13609 | x: clientX,
|
13610 | y: clientY
|
13611 | };
|
13612 | var longPressTimerId = setTimeout(startDragging, timeForLongPress);
|
13613 | setState({
|
13614 | longPressTimerId: longPressTimerId,
|
13615 | pending: point,
|
13616 | isDragging: false,
|
13617 | hasMoved: false
|
13618 | });
|
13619 | bindWindowEvents();
|
13620 | };
|
13621 |
|
13622 | var stopPendingDrag = function stopPendingDrag() {
|
13623 | if (state.longPressTimerId) {
|
13624 | clearTimeout(state.longPressTimerId);
|
13625 | }
|
13626 |
|
13627 | schedule.cancel();
|
13628 | touchStartMarshal.reset();
|
13629 | webkitHack.releaseTouchMove();
|
13630 | unbindWindowEvents();
|
13631 | setState(initial);
|
13632 | };
|
13633 |
|
13634 | var kill = function kill(fn) {
|
13635 | if (fn === void 0) {
|
13636 | fn = noop$2;
|
13637 | }
|
13638 |
|
13639 | if (state.pending) {
|
13640 | stopPendingDrag();
|
13641 | return;
|
13642 | }
|
13643 |
|
13644 | stopDragging(fn);
|
13645 | };
|
13646 |
|
13647 | var unmount = function unmount() {
|
13648 | kill();
|
13649 | postDragEventPreventer.abort();
|
13650 | };
|
13651 |
|
13652 | var cancel = function cancel() {
|
13653 | kill(callbacks.onCancel);
|
13654 | };
|
13655 |
|
13656 | var windowBindings = [{
|
13657 | eventName: 'touchmove',
|
13658 | options: {
|
13659 | passive: false
|
13660 | },
|
13661 | fn: function fn(event) {
|
13662 | if (!state.isDragging) {
|
13663 | stopPendingDrag();
|
13664 | return;
|
13665 | }
|
13666 |
|
13667 | if (!state.hasMoved) {
|
13668 | setState({
|
13669 | hasMoved: true
|
13670 | });
|
13671 | }
|
13672 |
|
13673 | var _event$touches$ = event.touches[0],
|
13674 | clientX = _event$touches$.clientX,
|
13675 | clientY = _event$touches$.clientY;
|
13676 | var point = {
|
13677 | x: clientX,
|
13678 | y: clientY
|
13679 | };
|
13680 | event.preventDefault();
|
13681 | schedule.move(point);
|
13682 | }
|
13683 | }, {
|
13684 | eventName: 'touchend',
|
13685 | fn: function fn(event) {
|
13686 | if (!state.isDragging) {
|
13687 | stopPendingDrag();
|
13688 | return;
|
13689 | }
|
13690 |
|
13691 | event.preventDefault();
|
13692 | stopDragging(callbacks.onDrop);
|
13693 | }
|
13694 | }, {
|
13695 | eventName: 'touchcancel',
|
13696 | fn: function fn(event) {
|
13697 | if (!state.isDragging) {
|
13698 | stopPendingDrag();
|
13699 | return;
|
13700 | }
|
13701 |
|
13702 | event.preventDefault();
|
13703 | stopDragging(callbacks.onCancel);
|
13704 | }
|
13705 | }, {
|
13706 | eventName: 'touchstart',
|
13707 | fn: cancel
|
13708 | }, {
|
13709 | eventName: 'orientationchange',
|
13710 | fn: cancel
|
13711 | }, {
|
13712 | eventName: 'resize',
|
13713 | fn: cancel
|
13714 | }, {
|
13715 | eventName: 'scroll',
|
13716 | options: {
|
13717 | passive: true,
|
13718 | capture: false
|
13719 | },
|
13720 | fn: function fn() {
|
13721 | if (state.pending) {
|
13722 | stopPendingDrag();
|
13723 | return;
|
13724 | }
|
13725 |
|
13726 | schedule.windowScrollMove();
|
13727 | }
|
13728 | }, {
|
13729 | eventName: 'contextmenu',
|
13730 | fn: function fn(event) {
|
13731 | event.preventDefault();
|
13732 | }
|
13733 | }, {
|
13734 | eventName: 'keydown',
|
13735 | fn: function fn(event) {
|
13736 | if (!state.isDragging) {
|
13737 | cancel();
|
13738 | return;
|
13739 | }
|
13740 |
|
13741 | if (event.keyCode === escape) {
|
13742 | event.preventDefault();
|
13743 | }
|
13744 |
|
13745 | cancel();
|
13746 | }
|
13747 | }, {
|
13748 | eventName: 'touchforcechange',
|
13749 | fn: function fn(event) {
|
13750 | if (state.hasMoved) {
|
13751 | event.preventDefault();
|
13752 | return;
|
13753 | }
|
13754 |
|
13755 | var touch = event.touches[0];
|
13756 |
|
13757 | if (touch.force >= forcePressThreshold) {
|
13758 | cancel();
|
13759 | }
|
13760 | }
|
13761 | }, {
|
13762 | eventName: supportedEventName,
|
13763 | fn: cancel
|
13764 | }];
|
13765 |
|
13766 | var bindWindowEvents = function bindWindowEvents() {
|
13767 | bindEvents(getWindow(), windowBindings, {
|
13768 | capture: true
|
13769 | });
|
13770 | };
|
13771 |
|
13772 | var unbindWindowEvents = function unbindWindowEvents() {
|
13773 | unbindEvents(getWindow(), windowBindings, {
|
13774 | capture: true
|
13775 | });
|
13776 | };
|
13777 |
|
13778 | var onTouchStart = function onTouchStart(event) {
|
13779 | if (touchStartMarshal.isHandled()) {
|
13780 | return;
|
13781 | }
|
13782 |
|
13783 | !!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;
|
13784 |
|
13785 | if (!canStartCapturing(event)) {
|
13786 | return;
|
13787 | }
|
13788 |
|
13789 | touchStartMarshal.handle();
|
13790 | webkitHack.preventTouchMove();
|
13791 | startPendingDrag(event);
|
13792 | };
|
13793 |
|
13794 | var sensor = {
|
13795 | onTouchStart: onTouchStart,
|
13796 | kill: kill,
|
13797 | isCapturing: isCapturing,
|
13798 | isDragging: isDragging,
|
13799 | unmount: unmount
|
13800 | };
|
13801 | return sensor;
|
13802 | });
|
13803 |
|
13804 | var _DragHandle$contextTy;
|
13805 |
|
13806 | var preventHtml5Dnd = function preventHtml5Dnd(event) {
|
13807 | event.preventDefault();
|
13808 | };
|
13809 |
|
13810 | var DragHandle = function (_Component) {
|
13811 | _inheritsLoose(DragHandle, _Component);
|
13812 |
|
13813 | function DragHandle(props, context) {
|
13814 | var _this;
|
13815 |
|
13816 | _this = _Component.call(this, props, context) || this;
|
13817 | _this.mouseSensor = void 0;
|
13818 | _this.keyboardSensor = void 0;
|
13819 | _this.touchSensor = void 0;
|
13820 | _this.sensors = void 0;
|
13821 | _this.styleContext = void 0;
|
13822 | _this.canLift = void 0;
|
13823 | _this.isFocused = false;
|
13824 | _this.lastDraggableRef = void 0;
|
13825 |
|
13826 | _this.onFocus = function () {
|
13827 | _this.isFocused = true;
|
13828 | };
|
13829 |
|
13830 | _this.onBlur = function () {
|
13831 | _this.isFocused = false;
|
13832 | };
|
13833 |
|
13834 | _this.onKeyDown = function (event) {
|
13835 | if (_this.mouseSensor.isCapturing() || _this.touchSensor.isCapturing()) {
|
13836 | return;
|
13837 | }
|
13838 |
|
13839 | _this.keyboardSensor.onKeyDown(event);
|
13840 | };
|
13841 |
|
13842 | _this.onMouseDown = function (event) {
|
13843 | if (_this.keyboardSensor.isCapturing() || _this.mouseSensor.isCapturing()) {
|
13844 | return;
|
13845 | }
|
13846 |
|
13847 | _this.mouseSensor.onMouseDown(event);
|
13848 | };
|
13849 |
|
13850 | _this.onTouchStart = function (event) {
|
13851 | if (_this.mouseSensor.isCapturing() || _this.keyboardSensor.isCapturing()) {
|
13852 | return;
|
13853 | }
|
13854 |
|
13855 | _this.touchSensor.onTouchStart(event);
|
13856 | };
|
13857 |
|
13858 | _this.canStartCapturing = function (event) {
|
13859 | if (_this.isAnySensorCapturing()) {
|
13860 | return false;
|
13861 | }
|
13862 |
|
13863 | if (!_this.canLift(_this.props.draggableId)) {
|
13864 | return false;
|
13865 | }
|
13866 |
|
13867 | return shouldAllowDraggingFromTarget(event, _this.props);
|
13868 | };
|
13869 |
|
13870 | _this.isAnySensorCapturing = function () {
|
13871 | return _this.sensors.some(function (sensor) {
|
13872 | return sensor.isCapturing();
|
13873 | });
|
13874 | };
|
13875 |
|
13876 | _this.getProvided = memoizeOne(function (isEnabled) {
|
13877 | if (!isEnabled) {
|
13878 | return null;
|
13879 | }
|
13880 |
|
13881 | var provided = {
|
13882 | onMouseDown: _this.onMouseDown,
|
13883 | onKeyDown: _this.onKeyDown,
|
13884 | onTouchStart: _this.onTouchStart,
|
13885 | onFocus: _this.onFocus,
|
13886 | onBlur: _this.onBlur,
|
13887 | tabIndex: 0,
|
13888 | 'data-react-beautiful-dnd-drag-handle': _this.styleContext,
|
13889 | 'aria-roledescription': 'Draggable item. Press space bar to lift',
|
13890 | draggable: false,
|
13891 | onDragStart: preventHtml5Dnd
|
13892 | };
|
13893 | return provided;
|
13894 | });
|
13895 |
|
13896 | var getWindow = function getWindow() {
|
13897 | return getWindowFromRef(_this.props.getDraggableRef());
|
13898 | };
|
13899 |
|
13900 | var args = {
|
13901 | callbacks: _this.props.callbacks,
|
13902 | getDraggableRef: _this.props.getDraggableRef,
|
13903 | getWindow: getWindow,
|
13904 | canStartCapturing: _this.canStartCapturing
|
13905 | };
|
13906 | _this.mouseSensor = createMouseSensor(args);
|
13907 | _this.keyboardSensor = createKeyboardSensor(args);
|
13908 | _this.touchSensor = createTouchSensor(args);
|
13909 | _this.sensors = [_this.mouseSensor, _this.keyboardSensor, _this.touchSensor];
|
13910 | _this.styleContext = context[styleContextKey];
|
13911 | _this.canLift = context[canLiftContextKey];
|
13912 | return _this;
|
13913 | }
|
13914 |
|
13915 | var _proto = DragHandle.prototype;
|
13916 |
|
13917 | _proto.componentDidMount = function componentDidMount() {
|
13918 | var draggableRef = this.props.getDraggableRef();
|
13919 | this.lastDraggableRef = draggableRef;
|
13920 | !draggableRef ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get draggable ref from drag handle') : invariant(false) : void 0;
|
13921 |
|
13922 | if (!this.props.isEnabled) {
|
13923 | return;
|
13924 | }
|
13925 |
|
13926 | var dragHandleRef = getDragHandleRef(draggableRef);
|
13927 | retainer.tryRestoreFocus(this.props.draggableId, dragHandleRef);
|
13928 | };
|
13929 |
|
13930 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
13931 | var _this2 = this;
|
13932 |
|
13933 | var ref = this.props.getDraggableRef();
|
13934 |
|
13935 | if (ref !== this.lastDraggableRef) {
|
13936 | this.lastDraggableRef = ref;
|
13937 |
|
13938 | if (!ref || !this.isFocused) {
|
13939 | return;
|
13940 | }
|
13941 |
|
13942 | if (!this.props.isEnabled) {
|
13943 | return;
|
13944 | }
|
13945 |
|
13946 | getDragHandleRef(ref).focus();
|
13947 | }
|
13948 |
|
13949 | var isCapturing = this.isAnySensorCapturing();
|
13950 |
|
13951 | if (!isCapturing) {
|
13952 | return;
|
13953 | }
|
13954 |
|
13955 | var isDragStopping = prevProps.isDragging && !this.props.isDragging;
|
13956 |
|
13957 | if (isDragStopping) {
|
13958 | this.sensors.forEach(function (sensor) {
|
13959 | if (sensor.isCapturing()) {
|
13960 | sensor.kill();
|
13961 | }
|
13962 | });
|
13963 | }
|
13964 |
|
13965 | if (this.props.isEnabled) {
|
13966 | return;
|
13967 | }
|
13968 |
|
13969 | this.sensors.forEach(function (sensor) {
|
13970 | if (!sensor.isCapturing()) {
|
13971 | return;
|
13972 | }
|
13973 |
|
13974 | var wasDragging = sensor.isDragging();
|
13975 | sensor.kill();
|
13976 |
|
13977 | if (wasDragging) {
|
13978 | if (process.env.NODE_ENV !== 'production') {
|
13979 | console.warn('You have disabled dragging on a Draggable while it was dragging. The drag has been cancelled');
|
13980 | }
|
13981 |
|
13982 | _this2.props.callbacks.onCancel();
|
13983 | }
|
13984 | });
|
13985 | };
|
13986 |
|
13987 | _proto.componentWillUnmount = function componentWillUnmount() {
|
13988 | var _this3 = this;
|
13989 |
|
13990 | this.sensors.forEach(function (sensor) {
|
13991 | var wasDragging = sensor.isDragging();
|
13992 | sensor.unmount();
|
13993 |
|
13994 | if (wasDragging) {
|
13995 | _this3.props.callbacks.onCancel();
|
13996 | }
|
13997 | });
|
13998 |
|
13999 | var shouldRetainFocus = function () {
|
14000 | if (!_this3.props.isEnabled) {
|
14001 | return false;
|
14002 | }
|
14003 |
|
14004 | if (!_this3.isFocused) {
|
14005 | return false;
|
14006 | }
|
14007 |
|
14008 | return _this3.props.isDragging || _this3.props.isDropAnimating;
|
14009 | }();
|
14010 |
|
14011 | if (shouldRetainFocus) {
|
14012 | retainer.retain(this.props.draggableId);
|
14013 | }
|
14014 | };
|
14015 |
|
14016 | _proto.render = function render() {
|
14017 | var _this$props = this.props,
|
14018 | children = _this$props.children,
|
14019 | isEnabled = _this$props.isEnabled;
|
14020 | return children(this.getProvided(isEnabled));
|
14021 | };
|
14022 |
|
14023 | return DragHandle;
|
14024 | }(React.Component);
|
14025 |
|
14026 | DragHandle.contextTypes = (_DragHandle$contextTy = {}, _DragHandle$contextTy[styleContextKey] = PropTypes.string.isRequired, _DragHandle$contextTy[canLiftContextKey] = PropTypes.func.isRequired, _DragHandle$contextTy);
|
14027 |
|
14028 | var getWindowScroll = (function () {
|
14029 | return {
|
14030 | x: window.pageXOffset,
|
14031 | y: window.pageYOffset
|
14032 | };
|
14033 | });
|
14034 |
|
14035 | var getViewport = (function () {
|
14036 | var scroll = getWindowScroll();
|
14037 | var top = scroll.y;
|
14038 | var left = scroll.x;
|
14039 | var doc = document.documentElement;
|
14040 | !doc ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not find document.documentElement') : invariant(false) : void 0;
|
14041 | var width = doc.clientWidth;
|
14042 | var height = doc.clientHeight;
|
14043 | var right = left + width;
|
14044 | var bottom = top + height;
|
14045 | var frame = cssBoxModel.getRect({
|
14046 | top: top,
|
14047 | left: left,
|
14048 | right: right,
|
14049 | bottom: bottom
|
14050 | });
|
14051 | var maxScroll = getMaxScroll({
|
14052 | scrollHeight: doc.scrollHeight,
|
14053 | scrollWidth: doc.scrollWidth,
|
14054 | width: frame.width,
|
14055 | height: frame.height
|
14056 | });
|
14057 | var viewport = {
|
14058 | frame: frame,
|
14059 | scroll: {
|
14060 | initial: scroll,
|
14061 | current: scroll,
|
14062 | max: maxScroll,
|
14063 | diff: {
|
14064 | value: origin,
|
14065 | displacement: origin
|
14066 | }
|
14067 | }
|
14068 | };
|
14069 | return viewport;
|
14070 | });
|
14071 |
|
14072 | var _Draggable$contextTyp;
|
14073 | var zIndexOptions = {
|
14074 | dragging: 5000,
|
14075 | dropAnimating: 4500
|
14076 | };
|
14077 |
|
14078 | var getTranslate = function getTranslate(offset) {
|
14079 | if (isEqual(offset, origin)) {
|
14080 | return null;
|
14081 | }
|
14082 |
|
14083 | return "translate(" + offset.x + "px, " + offset.y + "px)";
|
14084 | };
|
14085 |
|
14086 | var getSpeed$1 = function getSpeed(isDragging, shouldAnimateDragMovement, isDropAnimating) {
|
14087 | if (isDropAnimating) {
|
14088 | return 'STANDARD';
|
14089 | }
|
14090 |
|
14091 | if (isDragging && shouldAnimateDragMovement) {
|
14092 | return 'FAST';
|
14093 | }
|
14094 |
|
14095 | return 'INSTANT';
|
14096 | };
|
14097 |
|
14098 | var Draggable = function (_Component) {
|
14099 | _inheritsLoose(Draggable, _Component);
|
14100 |
|
14101 | function Draggable(props, context) {
|
14102 | var _this;
|
14103 |
|
14104 | _this = _Component.call(this, props, context) || this;
|
14105 | _this.callbacks = void 0;
|
14106 | _this.styleContext = void 0;
|
14107 | _this.ref = null;
|
14108 |
|
14109 | _this.onMoveEnd = function () {
|
14110 | if (_this.props.isDropAnimating) {
|
14111 | _this.props.dropAnimationFinished();
|
14112 | }
|
14113 | };
|
14114 |
|
14115 | _this.onLift = function (options) {
|
14116 | start('LIFT');
|
14117 | var ref = _this.ref;
|
14118 | !ref ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
14119 | !!_this.props.isDragDisabled ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot lift a Draggable when it is disabled') : invariant(false) : void 0;
|
14120 | var clientSelection = options.clientSelection,
|
14121 | autoScrollMode = options.autoScrollMode;
|
14122 | var _this$props = _this.props,
|
14123 | lift = _this$props.lift,
|
14124 | draggableId = _this$props.draggableId;
|
14125 | var client = {
|
14126 | selection: clientSelection,
|
14127 | borderBoxCenter: getBorderBoxCenterPosition(ref),
|
14128 | offset: origin
|
14129 | };
|
14130 | lift({
|
14131 | id: draggableId,
|
14132 | client: client,
|
14133 | autoScrollMode: autoScrollMode,
|
14134 | viewport: getViewport()
|
14135 | });
|
14136 | finish('LIFT');
|
14137 | };
|
14138 |
|
14139 | _this.setRef = function (ref) {
|
14140 | if (ref === null) {
|
14141 | return;
|
14142 | }
|
14143 |
|
14144 | if (ref === _this.ref) {
|
14145 | return;
|
14146 | }
|
14147 |
|
14148 | _this.ref = ref;
|
14149 | throwIfRefIsInvalid(ref);
|
14150 | };
|
14151 |
|
14152 | _this.getDraggableRef = function () {
|
14153 | return _this.ref;
|
14154 | };
|
14155 |
|
14156 | _this.getDraggingStyle = memoizeOne(function (change, dimension, isDropAnimating) {
|
14157 | var box = dimension.client;
|
14158 | var style = {
|
14159 | position: 'fixed',
|
14160 | top: box.marginBox.top,
|
14161 | left: box.marginBox.left,
|
14162 | boxSizing: 'border-box',
|
14163 | width: box.borderBox.width,
|
14164 | height: box.borderBox.height,
|
14165 | transition: 'none',
|
14166 | zIndex: isDropAnimating ? zIndexOptions.dropAnimating : zIndexOptions.dragging,
|
14167 | transform: getTranslate(change),
|
14168 | pointerEvents: 'none'
|
14169 | };
|
14170 | return style;
|
14171 | });
|
14172 | _this.getNotDraggingStyle = memoizeOne(function (current, shouldAnimateDisplacement) {
|
14173 | var style = {
|
14174 | transform: getTranslate(current),
|
14175 | transition: shouldAnimateDisplacement ? null : 'none'
|
14176 | };
|
14177 | return style;
|
14178 | });
|
14179 | _this.getProvided = memoizeOne(function (change, isDragging, isDropAnimating, shouldAnimateDisplacement, dimension, dragHandleProps) {
|
14180 | var useDraggingStyle = isDragging || isDropAnimating;
|
14181 |
|
14182 | var draggableStyle = function () {
|
14183 | if (!useDraggingStyle) {
|
14184 | return _this.getNotDraggingStyle(change, shouldAnimateDisplacement);
|
14185 | }
|
14186 |
|
14187 | !dimension ? process.env.NODE_ENV !== "production" ? invariant(false, 'draggable dimension required for dragging') : invariant(false) : void 0;
|
14188 | return _this.getDraggingStyle(change, dimension, isDropAnimating);
|
14189 | }();
|
14190 |
|
14191 | var provided = {
|
14192 | innerRef: _this.setRef,
|
14193 | draggableProps: {
|
14194 | 'data-react-beautiful-dnd-draggable': _this.styleContext,
|
14195 | style: draggableStyle
|
14196 | },
|
14197 | dragHandleProps: dragHandleProps
|
14198 | };
|
14199 | return provided;
|
14200 | });
|
14201 | _this.getSnapshot = memoizeOne(function (isDragging, isDropAnimating, draggingOver) {
|
14202 | return {
|
14203 | isDragging: isDragging || isDropAnimating,
|
14204 | isDropAnimating: isDropAnimating,
|
14205 | draggingOver: draggingOver
|
14206 | };
|
14207 | });
|
14208 |
|
14209 | _this.renderChildren = function (change, dragHandleProps) {
|
14210 | var _this$props2 = _this.props,
|
14211 | isDragging = _this$props2.isDragging,
|
14212 | isDropAnimating = _this$props2.isDropAnimating,
|
14213 | dimension = _this$props2.dimension,
|
14214 | draggingOver = _this$props2.draggingOver,
|
14215 | shouldAnimateDisplacement = _this$props2.shouldAnimateDisplacement,
|
14216 | children = _this$props2.children;
|
14217 | var child = children(_this.getProvided(change, isDragging, isDropAnimating, shouldAnimateDisplacement, dimension, dragHandleProps), _this.getSnapshot(isDragging, isDropAnimating, draggingOver));
|
14218 | var isDraggingOrDropping = isDragging || isDropAnimating;
|
14219 |
|
14220 | var placeholder = function () {
|
14221 | if (!isDraggingOrDropping) {
|
14222 | return null;
|
14223 | }
|
14224 |
|
14225 | !dimension ? process.env.NODE_ENV !== "production" ? invariant(false, 'Draggable: Dimension is required for dragging') : invariant(false) : void 0;
|
14226 | return React__default.createElement(Placeholder, {
|
14227 | placeholder: dimension.placeholder
|
14228 | });
|
14229 | }();
|
14230 |
|
14231 | return React__default.createElement(React.Fragment, null, child, placeholder);
|
14232 | };
|
14233 |
|
14234 | var callbacks = {
|
14235 | onLift: _this.onLift,
|
14236 | onMove: function onMove(clientSelection) {
|
14237 | return props.move({
|
14238 | client: clientSelection,
|
14239 | shouldAnimate: false
|
14240 | });
|
14241 | },
|
14242 | onDrop: function onDrop() {
|
14243 | return props.drop({
|
14244 | reason: 'DROP'
|
14245 | });
|
14246 | },
|
14247 | onCancel: function onCancel() {
|
14248 | return props.drop({
|
14249 | reason: 'CANCEL'
|
14250 | });
|
14251 | },
|
14252 | onMoveUp: props.moveUp,
|
14253 | onMoveDown: props.moveDown,
|
14254 | onMoveRight: props.moveRight,
|
14255 | onMoveLeft: props.moveLeft,
|
14256 | onWindowScroll: function onWindowScroll() {
|
14257 | return props.moveByWindowScroll({
|
14258 | scroll: getWindowScroll()
|
14259 | });
|
14260 | }
|
14261 | };
|
14262 | _this.callbacks = callbacks;
|
14263 | _this.styleContext = context[styleContextKey];
|
14264 | return _this;
|
14265 | }
|
14266 |
|
14267 | var _proto = Draggable.prototype;
|
14268 |
|
14269 | _proto.componentWillUnmount = function componentWillUnmount() {
|
14270 | this.ref = null;
|
14271 | };
|
14272 |
|
14273 | _proto.render = function render() {
|
14274 | var _this2 = this;
|
14275 |
|
14276 | var _this$props3 = this.props,
|
14277 | draggableId = _this$props3.draggableId,
|
14278 | index = _this$props3.index,
|
14279 | offset = _this$props3.offset,
|
14280 | isDragging = _this$props3.isDragging,
|
14281 | isDropAnimating = _this$props3.isDropAnimating,
|
14282 | isDragDisabled = _this$props3.isDragDisabled,
|
14283 | shouldAnimateDragMovement = _this$props3.shouldAnimateDragMovement,
|
14284 | disableInteractiveElementBlocking = _this$props3.disableInteractiveElementBlocking;
|
14285 | var droppableId = this.context[droppableIdKey];
|
14286 | var type = this.context[droppableTypeKey];
|
14287 | var speed = getSpeed$1(isDragging, shouldAnimateDragMovement, isDropAnimating);
|
14288 | return React__default.createElement(DraggableDimensionPublisher, {
|
14289 | key: draggableId,
|
14290 | draggableId: draggableId,
|
14291 | droppableId: droppableId,
|
14292 | type: type,
|
14293 | index: index,
|
14294 | getDraggableRef: this.getDraggableRef
|
14295 | }, React__default.createElement(Moveable, {
|
14296 | speed: speed,
|
14297 | destination: offset,
|
14298 | onMoveEnd: this.onMoveEnd
|
14299 | }, function (change) {
|
14300 | return React__default.createElement(DragHandle, {
|
14301 | draggableId: draggableId,
|
14302 | isDragging: isDragging,
|
14303 | isDropAnimating: isDropAnimating,
|
14304 | isEnabled: !isDragDisabled,
|
14305 | callbacks: _this2.callbacks,
|
14306 | getDraggableRef: _this2.getDraggableRef,
|
14307 | canDragInteractiveElements: disableInteractiveElementBlocking
|
14308 | }, function (dragHandleProps) {
|
14309 | return _this2.renderChildren(change, dragHandleProps);
|
14310 | });
|
14311 | }));
|
14312 | };
|
14313 |
|
14314 | return Draggable;
|
14315 | }(React.Component);
|
14316 |
|
14317 | Draggable.contextTypes = (_Draggable$contextTyp = {}, _Draggable$contextTyp[droppableIdKey] = PropTypes.string.isRequired, _Draggable$contextTyp[droppableTypeKey] = PropTypes.string.isRequired, _Draggable$contextTyp[styleContextKey] = PropTypes.string.isRequired, _Draggable$contextTyp);
|
14318 |
|
14319 | var defaultMapProps = {
|
14320 | isDropAnimating: false,
|
14321 | isDragging: false,
|
14322 | offset: origin,
|
14323 | shouldAnimateDragMovement: false,
|
14324 | shouldAnimateDisplacement: true,
|
14325 | dimension: null,
|
14326 | draggingOver: null
|
14327 | };
|
14328 | var makeMapStateToProps$1 = function makeMapStateToProps() {
|
14329 | var memoizedOffset = memoizeOne(function (x, y) {
|
14330 | return {
|
14331 | x: x,
|
14332 | y: y
|
14333 | };
|
14334 | });
|
14335 | var getNotDraggingProps = memoizeOne(function (offset, shouldAnimateDisplacement) {
|
14336 | return {
|
14337 | isDropAnimating: false,
|
14338 | isDragging: false,
|
14339 | offset: offset,
|
14340 | shouldAnimateDisplacement: shouldAnimateDisplacement,
|
14341 | shouldAnimateDragMovement: false,
|
14342 | dimension: null,
|
14343 | draggingOver: null
|
14344 | };
|
14345 | });
|
14346 | var getDraggingProps = memoizeOne(function (offset, shouldAnimateDragMovement, dimension, draggingOver) {
|
14347 | return {
|
14348 | isDragging: true,
|
14349 | isDropAnimating: false,
|
14350 | shouldAnimateDisplacement: false,
|
14351 | offset: offset,
|
14352 | shouldAnimateDragMovement: shouldAnimateDragMovement,
|
14353 | dimension: dimension,
|
14354 | draggingOver: draggingOver
|
14355 | };
|
14356 | });
|
14357 |
|
14358 | var getOutOfTheWayMovement = function getOutOfTheWayMovement(id, movement) {
|
14359 | var map = getDisplacementMap(movement.displaced);
|
14360 | var displacement = map[id];
|
14361 |
|
14362 | if (!displacement) {
|
14363 | return null;
|
14364 | }
|
14365 |
|
14366 | if (!displacement.isVisible) {
|
14367 | return null;
|
14368 | }
|
14369 |
|
14370 | var amount = movement.isBeyondStartPosition ? negate(movement.amount) : movement.amount;
|
14371 | return getNotDraggingProps(memoizedOffset(amount.x, amount.y), displacement.shouldAnimate);
|
14372 | };
|
14373 |
|
14374 | var draggingSelector = function draggingSelector(state, ownProps) {
|
14375 | if (state.isDragging) {
|
14376 | if (state.critical.draggable.id !== ownProps.draggableId) {
|
14377 | return null;
|
14378 | }
|
14379 |
|
14380 | var offset = state.current.client.offset;
|
14381 | var dimension = state.dimensions.draggables[ownProps.draggableId];
|
14382 | var shouldAnimateDragMovement = state.shouldAnimate;
|
14383 | var draggingOver = state.impact.destination ? state.impact.destination.droppableId : null;
|
14384 | return getDraggingProps(memoizedOffset(offset.x, offset.y), shouldAnimateDragMovement, dimension, draggingOver);
|
14385 | }
|
14386 |
|
14387 | if (state.phase === 'DROP_ANIMATING') {
|
14388 | var pending = state.pending;
|
14389 |
|
14390 | if (pending.result.draggableId !== ownProps.draggableId) {
|
14391 | return null;
|
14392 | }
|
14393 |
|
14394 | var _draggingOver = pending.result.destination ? pending.result.destination.droppableId : null;
|
14395 |
|
14396 | return {
|
14397 | isDragging: false,
|
14398 | isDropAnimating: true,
|
14399 | offset: pending.newHomeOffset,
|
14400 | dimension: state.dimensions.draggables[ownProps.draggableId],
|
14401 | draggingOver: _draggingOver,
|
14402 | shouldAnimateDragMovement: false,
|
14403 | shouldAnimateDisplacement: false
|
14404 | };
|
14405 | }
|
14406 |
|
14407 | return null;
|
14408 | };
|
14409 |
|
14410 | var movingOutOfTheWaySelector = function movingOutOfTheWaySelector(state, ownProps) {
|
14411 | if (state.isDragging) {
|
14412 | if (state.critical.draggable.id === ownProps.draggableId) {
|
14413 | return null;
|
14414 | }
|
14415 |
|
14416 | return getOutOfTheWayMovement(ownProps.draggableId, state.impact.movement);
|
14417 | }
|
14418 |
|
14419 | if (state.phase === 'DROP_ANIMATING') {
|
14420 | if (state.pending.result.draggableId === ownProps.draggableId) {
|
14421 | return null;
|
14422 | }
|
14423 |
|
14424 | return getOutOfTheWayMovement(ownProps.draggableId, state.pending.impact.movement);
|
14425 | }
|
14426 |
|
14427 | return null;
|
14428 | };
|
14429 |
|
14430 | var selector = function selector(state, ownProps) {
|
14431 | var dragging = draggingSelector(state, ownProps);
|
14432 |
|
14433 | if (dragging) {
|
14434 | return dragging;
|
14435 | }
|
14436 |
|
14437 | var movingOutOfTheWay = movingOutOfTheWaySelector(state, ownProps);
|
14438 |
|
14439 | if (movingOutOfTheWay) {
|
14440 | return movingOutOfTheWay;
|
14441 | }
|
14442 |
|
14443 | return defaultMapProps;
|
14444 | };
|
14445 |
|
14446 | return selector;
|
14447 | };
|
14448 | var mapDispatchToProps = {
|
14449 | lift: lift,
|
14450 | move: move,
|
14451 | moveUp: moveUp,
|
14452 | moveDown: moveDown,
|
14453 | moveLeft: moveLeft,
|
14454 | moveRight: moveRight,
|
14455 | moveByWindowScroll: moveByWindowScroll,
|
14456 | drop: drop,
|
14457 | dropAnimationFinished: dropAnimationFinished
|
14458 | };
|
14459 | var ConnectedDraggable = reactRedux.connect(makeMapStateToProps$1, mapDispatchToProps, null, {
|
14460 | storeKey: storeKey,
|
14461 | pure: true,
|
14462 | areStatePropsEqual: isStrictEqual
|
14463 | })(Draggable);
|
14464 | ConnectedDraggable.defaultProps = {
|
14465 | isDragDisabled: false,
|
14466 | disableInteractiveElementBlocking: false
|
14467 | };
|
14468 |
|
14469 | exports.DragDropContext = DragDropContext;
|
14470 | exports.Droppable = connectedDroppable;
|
14471 | exports.Draggable = ConnectedDraggable;
|
14472 | exports.resetServerContext = resetServerContext;
|
14473 |
|
14474 | }.call(exports, __webpack_require__(32)))
|
14475 |
|
14476 | }),
|
14477 |
|
14478 | (function(module, exports, __webpack_require__) {
|
14479 |
|
14480 | var _Object$assign = __webpack_require__(84);
|
14481 |
|
14482 | function _extends() {
|
14483 | module.exports = _extends = _Object$assign || function (target) {
|
14484 | for (var i = 1; i < arguments.length; i++) {
|
14485 | var source = arguments[i];
|
14486 |
|
14487 | for (var key in source) {
|
14488 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
14489 | target[key] = source[key];
|
14490 | }
|
14491 | }
|
14492 | }
|
14493 |
|
14494 | return target;
|
14495 | };
|
14496 |
|
14497 | return _extends.apply(this, arguments);
|
14498 | }
|
14499 |
|
14500 | module.exports = _extends;
|
14501 |
|
14502 | }),
|
14503 |
|
14504 | (function(module, exports, __webpack_require__) {
|
14505 |
|
14506 | module.exports = __webpack_require__(85);
|
14507 |
|
14508 | }),
|
14509 |
|
14510 | (function(module, exports, __webpack_require__) {
|
14511 |
|
14512 | __webpack_require__(86);
|
14513 | module.exports = __webpack_require__(89).Object.assign;
|
14514 |
|
14515 |
|
14516 | }),
|
14517 |
|
14518 | (function(module, exports, __webpack_require__) {
|
14519 |
|
14520 |
|
14521 | var $export = __webpack_require__(87);
|
14522 |
|
14523 | $export($export.S + $export.F, 'Object', { assign: __webpack_require__(103) });
|
14524 |
|
14525 |
|
14526 | }),
|
14527 |
|
14528 | (function(module, exports, __webpack_require__) {
|
14529 |
|
14530 | var global = __webpack_require__(88);
|
14531 | var core = __webpack_require__(89);
|
14532 | var ctx = __webpack_require__(90);
|
14533 | var hide = __webpack_require__(92);
|
14534 | var has = __webpack_require__(102);
|
14535 | var PROTOTYPE = 'prototype';
|
14536 |
|
14537 | var $export = function (type, name, source) {
|
14538 | var IS_FORCED = type & $export.F;
|
14539 | var IS_GLOBAL = type & $export.G;
|
14540 | var IS_STATIC = type & $export.S;
|
14541 | var IS_PROTO = type & $export.P;
|
14542 | var IS_BIND = type & $export.B;
|
14543 | var IS_WRAP = type & $export.W;
|
14544 | var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
|
14545 | var expProto = exports[PROTOTYPE];
|
14546 | var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
|
14547 | var key, own, out;
|
14548 | if (IS_GLOBAL) source = name;
|
14549 | for (key in source) {
|
14550 |
|
14551 | own = !IS_FORCED && target && target[key] !== undefined;
|
14552 | if (own && has(exports, key)) continue;
|
14553 |
|
14554 | out = own ? target[key] : source[key];
|
14555 |
|
14556 | exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
|
14557 |
|
14558 | : IS_BIND && own ? ctx(out, global)
|
14559 |
|
14560 | : IS_WRAP && target[key] == out ? (function (C) {
|
14561 | var F = function (a, b, c) {
|
14562 | if (this instanceof C) {
|
14563 | switch (arguments.length) {
|
14564 | case 0: return new C();
|
14565 | case 1: return new C(a);
|
14566 | case 2: return new C(a, b);
|
14567 | } return new C(a, b, c);
|
14568 | } return C.apply(this, arguments);
|
14569 | };
|
14570 | F[PROTOTYPE] = C[PROTOTYPE];
|
14571 | return F;
|
14572 |
|
14573 | })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
|
14574 |
|
14575 | if (IS_PROTO) {
|
14576 | (exports.virtual || (exports.virtual = {}))[key] = out;
|
14577 |
|
14578 | if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
|
14579 | }
|
14580 | }
|
14581 | };
|
14582 |
|
14583 | $export.F = 1;
|
14584 | $export.G = 2;
|
14585 | $export.S = 4;
|
14586 | $export.P = 8;
|
14587 | $export.B = 16;
|
14588 | $export.W = 32;
|
14589 | $export.U = 64;
|
14590 | $export.R = 128;
|
14591 | module.exports = $export;
|
14592 |
|
14593 |
|
14594 | }),
|
14595 |
|
14596 | (function(module, exports) {
|
14597 |
|
14598 |
|
14599 | var global = module.exports = typeof window != 'undefined' && window.Math == Math
|
14600 | ? window : typeof self != 'undefined' && self.Math == Math ? self
|
14601 |
|
14602 | : Function('return this')();
|
14603 | if (typeof __g == 'number') __g = global;
|
14604 |
|
14605 |
|
14606 | }),
|
14607 |
|
14608 | (function(module, exports) {
|
14609 |
|
14610 | var core = module.exports = { version: '2.5.7' };
|
14611 | if (typeof __e == 'number') __e = core;
|
14612 |
|
14613 |
|
14614 | }),
|
14615 |
|
14616 | (function(module, exports, __webpack_require__) {
|
14617 |
|
14618 |
|
14619 | var aFunction = __webpack_require__(91);
|
14620 | module.exports = function (fn, that, length) {
|
14621 | aFunction(fn);
|
14622 | if (that === undefined) return fn;
|
14623 | switch (length) {
|
14624 | case 1: return function (a) {
|
14625 | return fn.call(that, a);
|
14626 | };
|
14627 | case 2: return function (a, b) {
|
14628 | return fn.call(that, a, b);
|
14629 | };
|
14630 | case 3: return function (a, b, c) {
|
14631 | return fn.call(that, a, b, c);
|
14632 | };
|
14633 | }
|
14634 | return function (/* ...args */) {
|
14635 | return fn.apply(that, arguments);
|
14636 | };
|
14637 | };
|
14638 |
|
14639 |
|
14640 | }),
|
14641 |
|
14642 | (function(module, exports) {
|
14643 |
|
14644 | module.exports = function (it) {
|
14645 | if (typeof it != 'function') throw TypeError(it + ' is not a function!');
|
14646 | return it;
|
14647 | };
|
14648 |
|
14649 |
|
14650 | }),
|
14651 |
|
14652 | (function(module, exports, __webpack_require__) {
|
14653 |
|
14654 | var dP = __webpack_require__(93);
|
14655 | var createDesc = __webpack_require__(101);
|
14656 | module.exports = __webpack_require__(97) ? function (object, key, value) {
|
14657 | return dP.f(object, key, createDesc(1, value));
|
14658 | } : function (object, key, value) {
|
14659 | object[key] = value;
|
14660 | return object;
|
14661 | };
|
14662 |
|
14663 |
|
14664 | }),
|
14665 |
|
14666 | (function(module, exports, __webpack_require__) {
|
14667 |
|
14668 | var anObject = __webpack_require__(94);
|
14669 | var IE8_DOM_DEFINE = __webpack_require__(96);
|
14670 | var toPrimitive = __webpack_require__(100);
|
14671 | var dP = Object.defineProperty;
|
14672 |
|
14673 | exports.f = __webpack_require__(97) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
|
14674 | anObject(O);
|
14675 | P = toPrimitive(P, true);
|
14676 | anObject(Attributes);
|
14677 | if (IE8_DOM_DEFINE) try {
|
14678 | return dP(O, P, Attributes);
|
14679 | } catch (e) { }
|
14680 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
|
14681 | if ('value' in Attributes) O[P] = Attributes.value;
|
14682 | return O;
|
14683 | };
|
14684 |
|
14685 |
|
14686 | }),
|
14687 |
|
14688 | (function(module, exports, __webpack_require__) {
|
14689 |
|
14690 | var isObject = __webpack_require__(95);
|
14691 | module.exports = function (it) {
|
14692 | if (!isObject(it)) throw TypeError(it + ' is not an object!');
|
14693 | return it;
|
14694 | };
|
14695 |
|
14696 |
|
14697 | }),
|
14698 |
|
14699 | (function(module, exports) {
|
14700 |
|
14701 | module.exports = function (it) {
|
14702 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
14703 | };
|
14704 |
|
14705 |
|
14706 | }),
|
14707 |
|
14708 | (function(module, exports, __webpack_require__) {
|
14709 |
|
14710 | module.exports = !__webpack_require__(97) && !__webpack_require__(98)(function () {
|
14711 | return Object.defineProperty(__webpack_require__(99)('div'), 'a', { get: function () { return 7; } }).a != 7;
|
14712 | });
|
14713 |
|
14714 |
|
14715 | }),
|
14716 |
|
14717 | (function(module, exports, __webpack_require__) {
|
14718 |
|
14719 |
|
14720 | module.exports = !__webpack_require__(98)(function () {
|
14721 | return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
14722 | });
|
14723 |
|
14724 |
|
14725 | }),
|
14726 |
|
14727 | (function(module, exports) {
|
14728 |
|
14729 | module.exports = function (exec) {
|
14730 | try {
|
14731 | return !!exec();
|
14732 | } catch (e) {
|
14733 | return true;
|
14734 | }
|
14735 | };
|
14736 |
|
14737 |
|
14738 | }),
|
14739 |
|
14740 | (function(module, exports, __webpack_require__) {
|
14741 |
|
14742 | var isObject = __webpack_require__(95);
|
14743 | var document = __webpack_require__(88).document;
|
14744 |
|
14745 | var is = isObject(document) && isObject(document.createElement);
|
14746 | module.exports = function (it) {
|
14747 | return is ? document.createElement(it) : {};
|
14748 | };
|
14749 |
|
14750 |
|
14751 | }),
|
14752 |
|
14753 | (function(module, exports, __webpack_require__) {
|
14754 |
|
14755 |
|
14756 | var isObject = __webpack_require__(95);
|
14757 |
|
14758 |
|
14759 | module.exports = function (it, S) {
|
14760 | if (!isObject(it)) return it;
|
14761 | var fn, val;
|
14762 | if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
14763 | if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
|
14764 | if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
14765 | throw TypeError("Can't convert object to primitive value");
|
14766 | };
|
14767 |
|
14768 |
|
14769 | }),
|
14770 |
|
14771 | (function(module, exports) {
|
14772 |
|
14773 | module.exports = function (bitmap, value) {
|
14774 | return {
|
14775 | enumerable: !(bitmap & 1),
|
14776 | configurable: !(bitmap & 2),
|
14777 | writable: !(bitmap & 4),
|
14778 | value: value
|
14779 | };
|
14780 | };
|
14781 |
|
14782 |
|
14783 | }),
|
14784 |
|
14785 | (function(module, exports) {
|
14786 |
|
14787 | var hasOwnProperty = {}.hasOwnProperty;
|
14788 | module.exports = function (it, key) {
|
14789 | return hasOwnProperty.call(it, key);
|
14790 | };
|
14791 |
|
14792 |
|
14793 | }),
|
14794 |
|
14795 | (function(module, exports, __webpack_require__) {
|
14796 |
|
14797 | 'use strict';
|
14798 |
|
14799 | var getKeys = __webpack_require__(104);
|
14800 | var gOPS = __webpack_require__(119);
|
14801 | var pIE = __webpack_require__(120);
|
14802 | var toObject = __webpack_require__(121);
|
14803 | var IObject = __webpack_require__(107);
|
14804 | var $assign = Object.assign;
|
14805 |
|
14806 |
|
14807 | module.exports = !$assign || __webpack_require__(98)(function () {
|
14808 | var A = {};
|
14809 | var B = {};
|
14810 |
|
14811 | var S = Symbol();
|
14812 | var K = 'abcdefghijklmnopqrst';
|
14813 | A[S] = 7;
|
14814 | K.split('').forEach(function (k) { B[k] = k; });
|
14815 | return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
14816 | }) ? function assign(target, source) {
|
14817 | var T = toObject(target);
|
14818 | var aLen = arguments.length;
|
14819 | var index = 1;
|
14820 | var getSymbols = gOPS.f;
|
14821 | var isEnum = pIE.f;
|
14822 | while (aLen > index) {
|
14823 | var S = IObject(arguments[index++]);
|
14824 | var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
|
14825 | var length = keys.length;
|
14826 | var j = 0;
|
14827 | var key;
|
14828 | while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
|
14829 | } return T;
|
14830 | } : $assign;
|
14831 |
|
14832 |
|
14833 | }),
|
14834 |
|
14835 | (function(module, exports, __webpack_require__) {
|
14836 |
|
14837 |
|
14838 | var $keys = __webpack_require__(105);
|
14839 | var enumBugKeys = __webpack_require__(118);
|
14840 |
|
14841 | module.exports = Object.keys || function keys(O) {
|
14842 | return $keys(O, enumBugKeys);
|
14843 | };
|
14844 |
|
14845 |
|
14846 | }),
|
14847 |
|
14848 | (function(module, exports, __webpack_require__) {
|
14849 |
|
14850 | var has = __webpack_require__(102);
|
14851 | var toIObject = __webpack_require__(106);
|
14852 | var arrayIndexOf = __webpack_require__(110)(false);
|
14853 | var IE_PROTO = __webpack_require__(114)('IE_PROTO');
|
14854 |
|
14855 | module.exports = function (object, names) {
|
14856 | var O = toIObject(object);
|
14857 | var i = 0;
|
14858 | var result = [];
|
14859 | var key;
|
14860 | for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
|
14861 |
|
14862 | while (names.length > i) if (has(O, key = names[i++])) {
|
14863 | ~arrayIndexOf(result, key) || result.push(key);
|
14864 | }
|
14865 | return result;
|
14866 | };
|
14867 |
|
14868 |
|
14869 | }),
|
14870 |
|
14871 | (function(module, exports, __webpack_require__) {
|
14872 |
|
14873 |
|
14874 | var IObject = __webpack_require__(107);
|
14875 | var defined = __webpack_require__(109);
|
14876 | module.exports = function (it) {
|
14877 | return IObject(defined(it));
|
14878 | };
|
14879 |
|
14880 |
|
14881 | }),
|
14882 |
|
14883 | (function(module, exports, __webpack_require__) {
|
14884 |
|
14885 |
|
14886 | var cof = __webpack_require__(108);
|
14887 |
|
14888 | module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
|
14889 | return cof(it) == 'String' ? it.split('') : Object(it);
|
14890 | };
|
14891 |
|
14892 |
|
14893 | }),
|
14894 |
|
14895 | (function(module, exports) {
|
14896 |
|
14897 | var toString = {}.toString;
|
14898 |
|
14899 | module.exports = function (it) {
|
14900 | return toString.call(it).slice(8, -1);
|
14901 | };
|
14902 |
|
14903 |
|
14904 | }),
|
14905 |
|
14906 | (function(module, exports) {
|
14907 |
|
14908 |
|
14909 | module.exports = function (it) {
|
14910 | if (it == undefined) throw TypeError("Can't call method on " + it);
|
14911 | return it;
|
14912 | };
|
14913 |
|
14914 |
|
14915 | }),
|
14916 |
|
14917 | (function(module, exports, __webpack_require__) {
|
14918 |
|
14919 |
|
14920 |
|
14921 | var toIObject = __webpack_require__(106);
|
14922 | var toLength = __webpack_require__(111);
|
14923 | var toAbsoluteIndex = __webpack_require__(113);
|
14924 | module.exports = function (IS_INCLUDES) {
|
14925 | return function ($this, el, fromIndex) {
|
14926 | var O = toIObject($this);
|
14927 | var length = toLength(O.length);
|
14928 | var index = toAbsoluteIndex(fromIndex, length);
|
14929 | var value;
|
14930 |
|
14931 |
|
14932 | if (IS_INCLUDES && el != el) while (length > index) {
|
14933 | value = O[index++];
|
14934 |
|
14935 | if (value != value) return true;
|
14936 |
|
14937 | } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
|
14938 | if (O[index] === el) return IS_INCLUDES || index || 0;
|
14939 | } return !IS_INCLUDES && -1;
|
14940 | };
|
14941 | };
|
14942 |
|
14943 |
|
14944 | }),
|
14945 |
|
14946 | (function(module, exports, __webpack_require__) {
|
14947 |
|
14948 |
|
14949 | var toInteger = __webpack_require__(112);
|
14950 | var min = Math.min;
|
14951 | module.exports = function (it) {
|
14952 | return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0;
|
14953 | };
|
14954 |
|
14955 |
|
14956 | }),
|
14957 |
|
14958 | (function(module, exports) {
|
14959 |
|
14960 |
|
14961 | var ceil = Math.ceil;
|
14962 | var floor = Math.floor;
|
14963 | module.exports = function (it) {
|
14964 | return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
14965 | };
|
14966 |
|
14967 |
|
14968 | }),
|
14969 |
|
14970 | (function(module, exports, __webpack_require__) {
|
14971 |
|
14972 | var toInteger = __webpack_require__(112);
|
14973 | var max = Math.max;
|
14974 | var min = Math.min;
|
14975 | module.exports = function (index, length) {
|
14976 | index = toInteger(index);
|
14977 | return index < 0 ? max(index + length, 0) : min(index, length);
|
14978 | };
|
14979 |
|
14980 |
|
14981 | }),
|
14982 |
|
14983 | (function(module, exports, __webpack_require__) {
|
14984 |
|
14985 | var shared = __webpack_require__(115)('keys');
|
14986 | var uid = __webpack_require__(117);
|
14987 | module.exports = function (key) {
|
14988 | return shared[key] || (shared[key] = uid(key));
|
14989 | };
|
14990 |
|
14991 |
|
14992 | }),
|
14993 |
|
14994 | (function(module, exports, __webpack_require__) {
|
14995 |
|
14996 | var core = __webpack_require__(89);
|
14997 | var global = __webpack_require__(88);
|
14998 | var SHARED = '__core-js_shared__';
|
14999 | var store = global[SHARED] || (global[SHARED] = {});
|
15000 |
|
15001 | (module.exports = function (key, value) {
|
15002 | return store[key] || (store[key] = value !== undefined ? value : {});
|
15003 | })('versions', []).push({
|
15004 | version: core.version,
|
15005 | mode: __webpack_require__(116) ? 'pure' : 'global',
|
15006 | copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
|
15007 | });
|
15008 |
|
15009 |
|
15010 | }),
|
15011 |
|
15012 | (function(module, exports) {
|
15013 |
|
15014 | module.exports = true;
|
15015 |
|
15016 |
|
15017 | }),
|
15018 |
|
15019 | (function(module, exports) {
|
15020 |
|
15021 | var id = 0;
|
15022 | var px = Math.random();
|
15023 | module.exports = function (key) {
|
15024 | return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
15025 | };
|
15026 |
|
15027 |
|
15028 | }),
|
15029 |
|
15030 | (function(module, exports) {
|
15031 |
|
15032 |
|
15033 | module.exports = (
|
15034 | 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
|
15035 | ).split(',');
|
15036 |
|
15037 |
|
15038 | }),
|
15039 |
|
15040 | (function(module, exports) {
|
15041 |
|
15042 | exports.f = Object.getOwnPropertySymbols;
|
15043 |
|
15044 |
|
15045 | }),
|
15046 |
|
15047 | (function(module, exports) {
|
15048 |
|
15049 | exports.f = {}.propertyIsEnumerable;
|
15050 |
|
15051 |
|
15052 | }),
|
15053 |
|
15054 | (function(module, exports, __webpack_require__) {
|
15055 |
|
15056 |
|
15057 | var defined = __webpack_require__(109);
|
15058 | module.exports = function (it) {
|
15059 | return Object(defined(it));
|
15060 | };
|
15061 |
|
15062 |
|
15063 | }),
|
15064 |
|
15065 | (function(module, exports, __webpack_require__) {
|
15066 |
|
15067 | (function(process) {'use strict';
|
15068 |
|
15069 | var isProduction = process.env.NODE_ENV === 'production';
|
15070 | var prefix = 'Invariant failed';
|
15071 |
|
15072 | var index = (function (condition, message) {
|
15073 | if (condition) {
|
15074 | return;
|
15075 | }
|
15076 |
|
15077 |
|
15078 | if (isProduction) {
|
15079 | throw new Error(prefix);
|
15080 | } else {
|
15081 | throw new Error(prefix + ': ' + (message || ''));
|
15082 | }
|
15083 | });
|
15084 |
|
15085 | module.exports = index;
|
15086 |
|
15087 | }.call(exports, __webpack_require__(32)))
|
15088 |
|
15089 | }),
|
15090 |
|
15091 | (function(module, exports) {
|
15092 |
|
15093 | 'use strict';
|
15094 |
|
15095 | Object.defineProperty(exports, '__esModule', { value: true });
|
15096 |
|
15097 | var getRect = function getRect(_ref) {
|
15098 | var top = _ref.top,
|
15099 | right = _ref.right,
|
15100 | bottom = _ref.bottom,
|
15101 | left = _ref.left;
|
15102 |
|
15103 | var width = right - left;
|
15104 | var height = bottom - top;
|
15105 |
|
15106 | var rect = {
|
15107 | top: top,
|
15108 | right: right,
|
15109 | bottom: bottom,
|
15110 | left: left,
|
15111 | width: width,
|
15112 | height: height,
|
15113 |
|
15114 | x: left,
|
15115 | y: top,
|
15116 |
|
15117 | center: {
|
15118 | x: (right + left) / 2,
|
15119 | y: (bottom + top) / 2
|
15120 | }
|
15121 | };
|
15122 |
|
15123 | return rect;
|
15124 | };
|
15125 |
|
15126 | var expand = function expand(target, expandBy) {
|
15127 | return {
|
15128 | top: target.top - expandBy.top,
|
15129 | left: target.left - expandBy.left,
|
15130 |
|
15131 | bottom: target.bottom + expandBy.bottom,
|
15132 | right: target.right + expandBy.right
|
15133 | };
|
15134 | };
|
15135 |
|
15136 | var shrink = function shrink(target, shrinkBy) {
|
15137 | return {
|
15138 | top: target.top + shrinkBy.top,
|
15139 | left: target.left + shrinkBy.left,
|
15140 |
|
15141 | bottom: target.bottom - shrinkBy.bottom,
|
15142 | right: target.right - shrinkBy.right
|
15143 | };
|
15144 | };
|
15145 |
|
15146 | var shift = function shift(spacing, point) {
|
15147 | return {
|
15148 | top: spacing.top + point.y,
|
15149 | left: spacing.left + point.x,
|
15150 | bottom: spacing.bottom + point.y,
|
15151 | right: spacing.right + point.x
|
15152 | };
|
15153 | };
|
15154 |
|
15155 | var noSpacing = {
|
15156 | top: 0,
|
15157 | right: 0,
|
15158 | bottom: 0,
|
15159 | left: 0
|
15160 | };
|
15161 |
|
15162 | var createBox = function createBox(_ref2) {
|
15163 | var borderBox = _ref2.borderBox,
|
15164 | _ref2$margin = _ref2.margin,
|
15165 | margin = _ref2$margin === undefined ? noSpacing : _ref2$margin,
|
15166 | _ref2$border = _ref2.border,
|
15167 | border = _ref2$border === undefined ? noSpacing : _ref2$border,
|
15168 | _ref2$padding = _ref2.padding,
|
15169 | padding = _ref2$padding === undefined ? noSpacing : _ref2$padding;
|
15170 |
|
15171 | var marginBox = getRect(expand(borderBox, margin));
|
15172 |
|
15173 | var paddingBox = getRect(shrink(borderBox, border));
|
15174 |
|
15175 | var contentBox = getRect(shrink(paddingBox, padding));
|
15176 |
|
15177 | return {
|
15178 | marginBox: marginBox,
|
15179 | borderBox: getRect(borderBox),
|
15180 | paddingBox: paddingBox,
|
15181 | contentBox: contentBox,
|
15182 | margin: margin,
|
15183 | border: border,
|
15184 | padding: padding
|
15185 | };
|
15186 | };
|
15187 |
|
15188 | var parse = function parse(value) {
|
15189 | return parseInt(value, 10);
|
15190 | };
|
15191 | var getWindowScroll = function getWindowScroll() {
|
15192 | return {
|
15193 | x: window.pageXOffset,
|
15194 | y: window.pageYOffset
|
15195 | };
|
15196 | };
|
15197 |
|
15198 | var offset = function offset(original, change) {
|
15199 | var borderBox = original.borderBox,
|
15200 | border = original.border,
|
15201 | margin = original.margin,
|
15202 | padding = original.padding;
|
15203 |
|
15204 | var shifted = shift(borderBox, change);
|
15205 |
|
15206 | return createBox({
|
15207 | borderBox: shifted,
|
15208 | border: border,
|
15209 | margin: margin,
|
15210 | padding: padding
|
15211 | });
|
15212 | };
|
15213 |
|
15214 | var withScroll = function withScroll(original) {
|
15215 | var scroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getWindowScroll();
|
15216 | return offset(original, scroll);
|
15217 | };
|
15218 |
|
15219 | var calculateBox = function calculateBox(borderBox, styles) {
|
15220 | var margin = {
|
15221 | top: parse(styles.marginTop),
|
15222 | right: parse(styles.marginRight),
|
15223 | bottom: parse(styles.marginBottom),
|
15224 | left: parse(styles.marginLeft)
|
15225 | };
|
15226 | var padding = {
|
15227 | top: parse(styles.paddingTop),
|
15228 | right: parse(styles.paddingRight),
|
15229 | bottom: parse(styles.paddingBottom),
|
15230 | left: parse(styles.paddingLeft)
|
15231 | };
|
15232 | var border = {
|
15233 | top: parse(styles.borderTopWidth),
|
15234 | right: parse(styles.borderRightWidth),
|
15235 | bottom: parse(styles.borderBottomWidth),
|
15236 | left: parse(styles.borderLeftWidth)
|
15237 | };
|
15238 |
|
15239 | return createBox({
|
15240 | borderBox: borderBox,
|
15241 | margin: margin,
|
15242 | padding: padding,
|
15243 | border: border
|
15244 | });
|
15245 | };
|
15246 |
|
15247 | var getBox = function getBox(el) {
|
15248 | var borderBox = el.getBoundingClientRect();
|
15249 | var styles = window.getComputedStyle(el);
|
15250 |
|
15251 | return calculateBox(borderBox, styles);
|
15252 | };
|
15253 |
|
15254 | exports.getRect = getRect;
|
15255 | exports.createBox = createBox;
|
15256 | exports.offset = offset;
|
15257 | exports.withScroll = withScroll;
|
15258 | exports.calculateBox = calculateBox;
|
15259 | exports.getBox = getBox;
|
15260 |
|
15261 |
|
15262 | }),
|
15263 |
|
15264 | (function(module, exports, __webpack_require__) {
|
15265 |
|
15266 | module.exports = __webpack_require__(125);
|
15267 |
|
15268 | }),
|
15269 |
|
15270 | (function(module, exports, __webpack_require__) {
|
15271 |
|
15272 | __webpack_require__(126);
|
15273 | module.exports = __webpack_require__(89).Object.keys;
|
15274 |
|
15275 |
|
15276 | }),
|
15277 |
|
15278 | (function(module, exports, __webpack_require__) {
|
15279 |
|
15280 |
|
15281 | var toObject = __webpack_require__(121);
|
15282 | var $keys = __webpack_require__(104);
|
15283 |
|
15284 | __webpack_require__(127)('keys', function () {
|
15285 | return function keys(it) {
|
15286 | return $keys(toObject(it));
|
15287 | };
|
15288 | });
|
15289 |
|
15290 |
|
15291 | }),
|
15292 |
|
15293 | (function(module, exports, __webpack_require__) {
|
15294 |
|
15295 |
|
15296 | var $export = __webpack_require__(87);
|
15297 | var core = __webpack_require__(89);
|
15298 | var fails = __webpack_require__(98);
|
15299 | module.exports = function (KEY, exec) {
|
15300 | var fn = (core.Object || {})[KEY] || Object[KEY];
|
15301 | var exp = {};
|
15302 | exp[KEY] = exec(fn);
|
15303 | $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
|
15304 | };
|
15305 |
|
15306 |
|
15307 | }),
|
15308 |
|
15309 | (function(module, exports) {
|
15310 |
|
15311 | 'use strict';
|
15312 |
|
15313 | var simpleIsEqual = function simpleIsEqual(a, b) {
|
15314 | return a === b;
|
15315 | };
|
15316 |
|
15317 | function index (resultFn, isEqual) {
|
15318 | if (isEqual === void 0) {
|
15319 | isEqual = simpleIsEqual;
|
15320 | }
|
15321 |
|
15322 | var lastThis;
|
15323 | var lastArgs = [];
|
15324 | var lastResult;
|
15325 | var calledOnce = false;
|
15326 |
|
15327 | var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) {
|
15328 | return isEqual(newArg, lastArgs[index]);
|
15329 | };
|
15330 |
|
15331 | var result = function result() {
|
15332 | for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {
|
15333 | newArgs[_key] = arguments[_key];
|
15334 | }
|
15335 |
|
15336 | if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {
|
15337 | return lastResult;
|
15338 | }
|
15339 |
|
15340 | lastResult = resultFn.apply(this, newArgs);
|
15341 | calledOnce = true;
|
15342 | lastThis = this;
|
15343 | lastArgs = newArgs;
|
15344 | return lastResult;
|
15345 | };
|
15346 |
|
15347 | return result;
|
15348 | }
|
15349 |
|
15350 | module.exports = index;
|
15351 |
|
15352 |
|
15353 | }),
|
15354 |
|
15355 | (function(module, exports, __webpack_require__) {
|
15356 |
|
15357 | (function(process) {'use strict';
|
15358 |
|
15359 | Object.defineProperty(exports, '__esModule', { value: true });
|
15360 |
|
15361 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
15362 |
|
15363 | var $$observable = _interopDefault(__webpack_require__(130));
|
15364 |
|
15365 | |
15366 |
|
15367 |
|
15368 |
|
15369 |
|
15370 |
|
15371 | var ActionTypes = {
|
15372 | INIT: '@@redux/INIT' + Math.random().toString(36).substring(7).split('').join('.'),
|
15373 | REPLACE: '@@redux/REPLACE' + Math.random().toString(36).substring(7).split('').join('.')
|
15374 | };
|
15375 |
|
15376 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
15377 | return typeof obj;
|
15378 | } : function (obj) {
|
15379 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
15380 | };
|
15381 |
|
15382 | var _extends = Object.assign || function (target) {
|
15383 | for (var i = 1; i < arguments.length; i++) {
|
15384 | var source = arguments[i];
|
15385 |
|
15386 | for (var key in source) {
|
15387 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
15388 | target[key] = source[key];
|
15389 | }
|
15390 | }
|
15391 | }
|
15392 |
|
15393 | return target;
|
15394 | };
|
15395 |
|
15396 | |
15397 |
|
15398 |
|
15399 |
|
15400 | function isPlainObject(obj) {
|
15401 | if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object' || obj === null) return false;
|
15402 |
|
15403 | var proto = obj;
|
15404 | while (Object.getPrototypeOf(proto) !== null) {
|
15405 | proto = Object.getPrototypeOf(proto);
|
15406 | }
|
15407 |
|
15408 | return Object.getPrototypeOf(obj) === proto;
|
15409 | }
|
15410 |
|
15411 | |
15412 |
|
15413 |
|
15414 |
|
15415 |
|
15416 |
|
15417 |
|
15418 |
|
15419 |
|
15420 |
|
15421 |
|
15422 |
|
15423 |
|
15424 |
|
15425 |
|
15426 |
|
15427 |
|
15428 |
|
15429 |
|
15430 |
|
15431 |
|
15432 |
|
15433 |
|
15434 |
|
15435 |
|
15436 | function createStore(reducer, preloadedState, enhancer) {
|
15437 | var _ref2;
|
15438 |
|
15439 | if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
|
15440 | enhancer = preloadedState;
|
15441 | preloadedState = undefined;
|
15442 | }
|
15443 |
|
15444 | if (typeof enhancer !== 'undefined') {
|
15445 | if (typeof enhancer !== 'function') {
|
15446 | throw new Error('Expected the enhancer to be a function.');
|
15447 | }
|
15448 |
|
15449 | return enhancer(createStore)(reducer, preloadedState);
|
15450 | }
|
15451 |
|
15452 | if (typeof reducer !== 'function') {
|
15453 | throw new Error('Expected the reducer to be a function.');
|
15454 | }
|
15455 |
|
15456 | var currentReducer = reducer;
|
15457 | var currentState = preloadedState;
|
15458 | var currentListeners = [];
|
15459 | var nextListeners = currentListeners;
|
15460 | var isDispatching = false;
|
15461 |
|
15462 | function ensureCanMutateNextListeners() {
|
15463 | if (nextListeners === currentListeners) {
|
15464 | nextListeners = currentListeners.slice();
|
15465 | }
|
15466 | }
|
15467 |
|
15468 | |
15469 |
|
15470 |
|
15471 |
|
15472 |
|
15473 | function getState() {
|
15474 | if (isDispatching) {
|
15475 | 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.');
|
15476 | }
|
15477 |
|
15478 | return currentState;
|
15479 | }
|
15480 |
|
15481 | |
15482 |
|
15483 |
|
15484 |
|
15485 |
|
15486 |
|
15487 |
|
15488 |
|
15489 |
|
15490 |
|
15491 |
|
15492 |
|
15493 |
|
15494 |
|
15495 |
|
15496 |
|
15497 |
|
15498 |
|
15499 |
|
15500 |
|
15501 |
|
15502 |
|
15503 |
|
15504 | function subscribe(listener) {
|
15505 | if (typeof listener !== 'function') {
|
15506 | throw new Error('Expected the listener to be a function.');
|
15507 | }
|
15508 |
|
15509 | if (isDispatching) {
|
15510 | 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.');
|
15511 | }
|
15512 |
|
15513 | var isSubscribed = true;
|
15514 |
|
15515 | ensureCanMutateNextListeners();
|
15516 | nextListeners.push(listener);
|
15517 |
|
15518 | return function unsubscribe() {
|
15519 | if (!isSubscribed) {
|
15520 | return;
|
15521 | }
|
15522 |
|
15523 | if (isDispatching) {
|
15524 | 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.');
|
15525 | }
|
15526 |
|
15527 | isSubscribed = false;
|
15528 |
|
15529 | ensureCanMutateNextListeners();
|
15530 | var index = nextListeners.indexOf(listener);
|
15531 | nextListeners.splice(index, 1);
|
15532 | };
|
15533 | }
|
15534 |
|
15535 | |
15536 |
|
15537 |
|
15538 |
|
15539 |
|
15540 |
|
15541 |
|
15542 |
|
15543 |
|
15544 |
|
15545 |
|
15546 |
|
15547 |
|
15548 |
|
15549 |
|
15550 |
|
15551 |
|
15552 |
|
15553 |
|
15554 |
|
15555 |
|
15556 |
|
15557 |
|
15558 |
|
15559 |
|
15560 | function dispatch(action) {
|
15561 | if (!isPlainObject(action)) {
|
15562 | throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
|
15563 | }
|
15564 |
|
15565 | if (typeof action.type === 'undefined') {
|
15566 | throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
|
15567 | }
|
15568 |
|
15569 | if (isDispatching) {
|
15570 | throw new Error('Reducers may not dispatch actions.');
|
15571 | }
|
15572 |
|
15573 | try {
|
15574 | isDispatching = true;
|
15575 | currentState = currentReducer(currentState, action);
|
15576 | } finally {
|
15577 | isDispatching = false;
|
15578 | }
|
15579 |
|
15580 | var listeners = currentListeners = nextListeners;
|
15581 | for (var i = 0; i < listeners.length; i++) {
|
15582 | var listener = listeners[i];
|
15583 | listener();
|
15584 | }
|
15585 |
|
15586 | return action;
|
15587 | }
|
15588 |
|
15589 | |
15590 |
|
15591 |
|
15592 |
|
15593 |
|
15594 |
|
15595 |
|
15596 |
|
15597 |
|
15598 |
|
15599 | function replaceReducer(nextReducer) {
|
15600 | if (typeof nextReducer !== 'function') {
|
15601 | throw new Error('Expected the nextReducer to be a function.');
|
15602 | }
|
15603 |
|
15604 | currentReducer = nextReducer;
|
15605 | dispatch({ type: ActionTypes.REPLACE });
|
15606 | }
|
15607 |
|
15608 | |
15609 |
|
15610 |
|
15611 |
|
15612 |
|
15613 |
|
15614 | function observable() {
|
15615 | var _ref;
|
15616 |
|
15617 | var outerSubscribe = subscribe;
|
15618 | return _ref = {
|
15619 | |
15620 |
|
15621 |
|
15622 |
|
15623 |
|
15624 |
|
15625 |
|
15626 |
|
15627 | subscribe: function subscribe(observer) {
|
15628 | if ((typeof observer === 'undefined' ? 'undefined' : _typeof(observer)) !== 'object' || observer === null) {
|
15629 | throw new TypeError('Expected the observer to be an object.');
|
15630 | }
|
15631 |
|
15632 | function observeState() {
|
15633 | if (observer.next) {
|
15634 | observer.next(getState());
|
15635 | }
|
15636 | }
|
15637 |
|
15638 | observeState();
|
15639 | var unsubscribe = outerSubscribe(observeState);
|
15640 | return { unsubscribe: unsubscribe };
|
15641 | }
|
15642 | }, _ref[$$observable] = function () {
|
15643 | return this;
|
15644 | }, _ref;
|
15645 | }
|
15646 |
|
15647 |
|
15648 |
|
15649 |
|
15650 | dispatch({ type: ActionTypes.INIT });
|
15651 |
|
15652 | return _ref2 = {
|
15653 | dispatch: dispatch,
|
15654 | subscribe: subscribe,
|
15655 | getState: getState,
|
15656 | replaceReducer: replaceReducer
|
15657 | }, _ref2[$$observable] = observable, _ref2;
|
15658 | }
|
15659 |
|
15660 | |
15661 |
|
15662 |
|
15663 |
|
15664 |
|
15665 |
|
15666 | function warning(message) {
|
15667 |
|
15668 | if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
15669 | console.error(message);
|
15670 | }
|
15671 |
|
15672 | try {
|
15673 |
|
15674 |
|
15675 |
|
15676 | throw new Error(message);
|
15677 | } catch (e) {}
|
15678 | }
|
15679 |
|
15680 | function getUndefinedStateErrorMessage(key, action) {
|
15681 | var actionType = action && action.type;
|
15682 | var actionDescription = actionType && 'action "' + String(actionType) + '"' || 'an action';
|
15683 |
|
15684 | 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.';
|
15685 | }
|
15686 |
|
15687 | function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
15688 | var reducerKeys = Object.keys(reducers);
|
15689 | var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
|
15690 |
|
15691 | if (reducerKeys.length === 0) {
|
15692 | return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
|
15693 | }
|
15694 |
|
15695 | if (!isPlainObject(inputState)) {
|
15696 | 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('", "') + '"');
|
15697 | }
|
15698 |
|
15699 | var unexpectedKeys = Object.keys(inputState).filter(function (key) {
|
15700 | return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
|
15701 | });
|
15702 |
|
15703 | unexpectedKeys.forEach(function (key) {
|
15704 | unexpectedKeyCache[key] = true;
|
15705 | });
|
15706 |
|
15707 | if (action && action.type === ActionTypes.REPLACE) return;
|
15708 |
|
15709 | if (unexpectedKeys.length > 0) {
|
15710 | 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.');
|
15711 | }
|
15712 | }
|
15713 |
|
15714 | function assertReducerShape(reducers) {
|
15715 | Object.keys(reducers).forEach(function (key) {
|
15716 | var reducer = reducers[key];
|
15717 | var initialState = reducer(undefined, { type: ActionTypes.INIT });
|
15718 |
|
15719 | if (typeof initialState === 'undefined') {
|
15720 | 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.');
|
15721 | }
|
15722 |
|
15723 | var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');
|
15724 | if (typeof reducer(undefined, { type: type }) === 'undefined') {
|
15725 | 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.');
|
15726 | }
|
15727 | });
|
15728 | }
|
15729 |
|
15730 | |
15731 |
|
15732 |
|
15733 |
|
15734 |
|
15735 |
|
15736 |
|
15737 |
|
15738 |
|
15739 |
|
15740 |
|
15741 |
|
15742 |
|
15743 |
|
15744 |
|
15745 |
|
15746 | function combineReducers(reducers) {
|
15747 | var reducerKeys = Object.keys(reducers);
|
15748 | var finalReducers = {};
|
15749 | for (var i = 0; i < reducerKeys.length; i++) {
|
15750 | var key = reducerKeys[i];
|
15751 |
|
15752 | if (process.env.NODE_ENV !== 'production') {
|
15753 | if (typeof reducers[key] === 'undefined') {
|
15754 | warning('No reducer provided for key "' + key + '"');
|
15755 | }
|
15756 | }
|
15757 |
|
15758 | if (typeof reducers[key] === 'function') {
|
15759 | finalReducers[key] = reducers[key];
|
15760 | }
|
15761 | }
|
15762 | var finalReducerKeys = Object.keys(finalReducers);
|
15763 |
|
15764 | var unexpectedKeyCache = void 0;
|
15765 | if (process.env.NODE_ENV !== 'production') {
|
15766 | unexpectedKeyCache = {};
|
15767 | }
|
15768 |
|
15769 | var shapeAssertionError = void 0;
|
15770 | try {
|
15771 | assertReducerShape(finalReducers);
|
15772 | } catch (e) {
|
15773 | shapeAssertionError = e;
|
15774 | }
|
15775 |
|
15776 | return function combination() {
|
15777 | var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
15778 | var action = arguments[1];
|
15779 |
|
15780 | if (shapeAssertionError) {
|
15781 | throw shapeAssertionError;
|
15782 | }
|
15783 |
|
15784 | if (process.env.NODE_ENV !== 'production') {
|
15785 | var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
15786 | if (warningMessage) {
|
15787 | warning(warningMessage);
|
15788 | }
|
15789 | }
|
15790 |
|
15791 | var hasChanged = false;
|
15792 | var nextState = {};
|
15793 | for (var _i = 0; _i < finalReducerKeys.length; _i++) {
|
15794 | var _key = finalReducerKeys[_i];
|
15795 | var reducer = finalReducers[_key];
|
15796 | var previousStateForKey = state[_key];
|
15797 | var nextStateForKey = reducer(previousStateForKey, action);
|
15798 | if (typeof nextStateForKey === 'undefined') {
|
15799 | var errorMessage = getUndefinedStateErrorMessage(_key, action);
|
15800 | throw new Error(errorMessage);
|
15801 | }
|
15802 | nextState[_key] = nextStateForKey;
|
15803 | hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
15804 | }
|
15805 | return hasChanged ? nextState : state;
|
15806 | };
|
15807 | }
|
15808 |
|
15809 | function bindActionCreator(actionCreator, dispatch) {
|
15810 | return function () {
|
15811 | return dispatch(actionCreator.apply(this, arguments));
|
15812 | };
|
15813 | }
|
15814 |
|
15815 | |
15816 |
|
15817 |
|
15818 |
|
15819 |
|
15820 |
|
15821 |
|
15822 |
|
15823 |
|
15824 |
|
15825 |
|
15826 |
|
15827 |
|
15828 |
|
15829 |
|
15830 |
|
15831 |
|
15832 |
|
15833 |
|
15834 |
|
15835 |
|
15836 | function bindActionCreators(actionCreators, dispatch) {
|
15837 | if (typeof actionCreators === 'function') {
|
15838 | return bindActionCreator(actionCreators, dispatch);
|
15839 | }
|
15840 |
|
15841 | if ((typeof actionCreators === 'undefined' ? 'undefined' : _typeof(actionCreators)) !== 'object' || actionCreators === null) {
|
15842 | throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators === 'undefined' ? 'undefined' : _typeof(actionCreators)) + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');
|
15843 | }
|
15844 |
|
15845 | var keys = Object.keys(actionCreators);
|
15846 | var boundActionCreators = {};
|
15847 | for (var i = 0; i < keys.length; i++) {
|
15848 | var key = keys[i];
|
15849 | var actionCreator = actionCreators[key];
|
15850 | if (typeof actionCreator === 'function') {
|
15851 | boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
|
15852 | }
|
15853 | }
|
15854 | return boundActionCreators;
|
15855 | }
|
15856 |
|
15857 | |
15858 |
|
15859 |
|
15860 |
|
15861 |
|
15862 |
|
15863 |
|
15864 |
|
15865 |
|
15866 |
|
15867 |
|
15868 | function compose() {
|
15869 | for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
|
15870 | funcs[_key] = arguments[_key];
|
15871 | }
|
15872 |
|
15873 | if (funcs.length === 0) {
|
15874 | return function (arg) {
|
15875 | return arg;
|
15876 | };
|
15877 | }
|
15878 |
|
15879 | if (funcs.length === 1) {
|
15880 | return funcs[0];
|
15881 | }
|
15882 |
|
15883 | return funcs.reduce(function (a, b) {
|
15884 | return function () {
|
15885 | return a(b.apply(undefined, arguments));
|
15886 | };
|
15887 | });
|
15888 | }
|
15889 |
|
15890 | |
15891 |
|
15892 |
|
15893 |
|
15894 |
|
15895 |
|
15896 |
|
15897 |
|
15898 |
|
15899 |
|
15900 |
|
15901 |
|
15902 |
|
15903 |
|
15904 |
|
15905 |
|
15906 | function applyMiddleware() {
|
15907 | for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
|
15908 | middlewares[_key] = arguments[_key];
|
15909 | }
|
15910 |
|
15911 | return function (createStore) {
|
15912 | return function () {
|
15913 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
15914 | args[_key2] = arguments[_key2];
|
15915 | }
|
15916 |
|
15917 | var store = createStore.apply(undefined, args);
|
15918 | var _dispatch = function dispatch() {
|
15919 | throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
|
15920 | };
|
15921 |
|
15922 | var middlewareAPI = {
|
15923 | getState: store.getState,
|
15924 | dispatch: function dispatch() {
|
15925 | return _dispatch.apply(undefined, arguments);
|
15926 | }
|
15927 | };
|
15928 | var chain = middlewares.map(function (middleware) {
|
15929 | return middleware(middlewareAPI);
|
15930 | });
|
15931 | _dispatch = compose.apply(undefined, chain)(store.dispatch);
|
15932 |
|
15933 | return _extends({}, store, {
|
15934 | dispatch: _dispatch
|
15935 | });
|
15936 | };
|
15937 | };
|
15938 | }
|
15939 |
|
15940 | |
15941 |
|
15942 |
|
15943 |
|
15944 | function isCrushed() {}
|
15945 |
|
15946 | if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
|
15947 | 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 DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
|
15948 | }
|
15949 |
|
15950 | exports.createStore = createStore;
|
15951 | exports.combineReducers = combineReducers;
|
15952 | exports.bindActionCreators = bindActionCreators;
|
15953 | exports.applyMiddleware = applyMiddleware;
|
15954 | exports.compose = compose;
|
15955 | exports.__DO_NOT_USE__ActionTypes = ActionTypes;
|
15956 |
|
15957 | }.call(exports, __webpack_require__(32)))
|
15958 |
|
15959 | }),
|
15960 |
|
15961 | (function(module, exports, __webpack_require__) {
|
15962 |
|
15963 | (function(global, module) {'use strict';
|
15964 |
|
15965 | Object.defineProperty(exports, "__esModule", {
|
15966 | value: true
|
15967 | });
|
15968 |
|
15969 | var _ponyfill = __webpack_require__(132);
|
15970 |
|
15971 | var _ponyfill2 = _interopRequireDefault(_ponyfill);
|
15972 |
|
15973 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
15974 |
|
15975 | var root;
|
15976 |
|
15977 |
|
15978 | if (typeof self !== 'undefined') {
|
15979 | root = self;
|
15980 | } else if (typeof window !== 'undefined') {
|
15981 | root = window;
|
15982 | } else if (typeof global !== 'undefined') {
|
15983 | root = global;
|
15984 | } else if (true) {
|
15985 | root = module;
|
15986 | } else {
|
15987 | root = Function('return this')();
|
15988 | }
|
15989 |
|
15990 | var result = (0, _ponyfill2['default'])(root);
|
15991 | exports['default'] = result;
|
15992 | }.call(exports, (function() { return this; }()), __webpack_require__(131)(module)))
|
15993 |
|
15994 | }),
|
15995 |
|
15996 | (function(module, exports) {
|
15997 |
|
15998 | module.exports = function(module) {
|
15999 | if(!module.webpackPolyfill) {
|
16000 | module.deprecate = function() {};
|
16001 | module.paths = [];
|
16002 |
|
16003 | module.children = [];
|
16004 | module.webpackPolyfill = 1;
|
16005 | }
|
16006 | return module;
|
16007 | }
|
16008 |
|
16009 |
|
16010 | }),
|
16011 |
|
16012 | (function(module, exports) {
|
16013 |
|
16014 | 'use strict';
|
16015 |
|
16016 | Object.defineProperty(exports, "__esModule", {
|
16017 | value: true
|
16018 | });
|
16019 | exports['default'] = symbolObservablePonyfill;
|
16020 | function symbolObservablePonyfill(root) {
|
16021 | var result;
|
16022 | var _Symbol = root.Symbol;
|
16023 |
|
16024 | if (typeof _Symbol === 'function') {
|
16025 | if (_Symbol.observable) {
|
16026 | result = _Symbol.observable;
|
16027 | } else {
|
16028 | result = _Symbol('observable');
|
16029 | _Symbol.observable = result;
|
16030 | }
|
16031 | } else {
|
16032 | result = '@@observable';
|
16033 | }
|
16034 |
|
16035 | return result;
|
16036 | };
|
16037 |
|
16038 | }),
|
16039 |
|
16040 | (function(module, exports) {
|
16041 |
|
16042 | 'use strict';
|
16043 |
|
16044 | var index = (function (fn) {
|
16045 | var lastArgs = [];
|
16046 | var frameId = null;
|
16047 |
|
16048 | var wrapperFn = function wrapperFn() {
|
16049 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
16050 | args[_key] = arguments[_key];
|
16051 | }
|
16052 |
|
16053 | lastArgs = args;
|
16054 |
|
16055 | if (frameId) {
|
16056 | return;
|
16057 | }
|
16058 |
|
16059 | frameId = requestAnimationFrame(function () {
|
16060 | frameId = null;
|
16061 | fn.apply(undefined, lastArgs);
|
16062 | });
|
16063 | };
|
16064 |
|
16065 | wrapperFn.cancel = function () {
|
16066 | if (!frameId) {
|
16067 | return;
|
16068 | }
|
16069 |
|
16070 | cancelAnimationFrame(frameId);
|
16071 | frameId = null;
|
16072 | };
|
16073 |
|
16074 | var resultFn = wrapperFn;
|
16075 |
|
16076 | return resultFn;
|
16077 | });
|
16078 |
|
16079 | module.exports = index;
|
16080 |
|
16081 |
|
16082 | }),
|
16083 |
|
16084 | (function(module, exports, __webpack_require__) {
|
16085 |
|
16086 | var _Object$create = __webpack_require__(135);
|
16087 |
|
16088 | function _inheritsLoose(subClass, superClass) {
|
16089 | subClass.prototype = _Object$create(superClass.prototype);
|
16090 | subClass.prototype.constructor = subClass;
|
16091 | subClass.__proto__ = superClass;
|
16092 | }
|
16093 |
|
16094 | module.exports = _inheritsLoose;
|
16095 |
|
16096 | }),
|
16097 |
|
16098 | (function(module, exports, __webpack_require__) {
|
16099 |
|
16100 | module.exports = __webpack_require__(136);
|
16101 |
|
16102 | }),
|
16103 |
|
16104 | (function(module, exports, __webpack_require__) {
|
16105 |
|
16106 | __webpack_require__(137);
|
16107 | var $Object = __webpack_require__(89).Object;
|
16108 | module.exports = function create(P, D) {
|
16109 | return $Object.create(P, D);
|
16110 | };
|
16111 |
|
16112 |
|
16113 | }),
|
16114 |
|
16115 | (function(module, exports, __webpack_require__) {
|
16116 |
|
16117 | var $export = __webpack_require__(87);
|
16118 |
|
16119 | $export($export.S, 'Object', { create: __webpack_require__(138) });
|
16120 |
|
16121 |
|
16122 | }),
|
16123 |
|
16124 | (function(module, exports, __webpack_require__) {
|
16125 |
|
16126 |
|
16127 | var anObject = __webpack_require__(94);
|
16128 | var dPs = __webpack_require__(139);
|
16129 | var enumBugKeys = __webpack_require__(118);
|
16130 | var IE_PROTO = __webpack_require__(114)('IE_PROTO');
|
16131 | var Empty = function () { };
|
16132 | var PROTOTYPE = 'prototype';
|
16133 |
|
16134 |
|
16135 | var createDict = function () {
|
16136 |
|
16137 | var iframe = __webpack_require__(99)('iframe');
|
16138 | var i = enumBugKeys.length;
|
16139 | var lt = '<';
|
16140 | var gt = '>';
|
16141 | var iframeDocument;
|
16142 | iframe.style.display = 'none';
|
16143 | __webpack_require__(140).appendChild(iframe);
|
16144 | iframe.src = 'javascript:';
|
16145 |
|
16146 |
|
16147 | iframeDocument = iframe.contentWindow.document;
|
16148 | iframeDocument.open();
|
16149 | iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
|
16150 | iframeDocument.close();
|
16151 | createDict = iframeDocument.F;
|
16152 | while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
|
16153 | return createDict();
|
16154 | };
|
16155 |
|
16156 | module.exports = Object.create || function create(O, Properties) {
|
16157 | var result;
|
16158 | if (O !== null) {
|
16159 | Empty[PROTOTYPE] = anObject(O);
|
16160 | result = new Empty();
|
16161 | Empty[PROTOTYPE] = null;
|
16162 |
|
16163 | result[IE_PROTO] = O;
|
16164 | } else result = createDict();
|
16165 | return Properties === undefined ? result : dPs(result, Properties);
|
16166 | };
|
16167 |
|
16168 |
|
16169 | }),
|
16170 |
|
16171 | (function(module, exports, __webpack_require__) {
|
16172 |
|
16173 | var dP = __webpack_require__(93);
|
16174 | var anObject = __webpack_require__(94);
|
16175 | var getKeys = __webpack_require__(104);
|
16176 |
|
16177 | module.exports = __webpack_require__(97) ? Object.defineProperties : function defineProperties(O, Properties) {
|
16178 | anObject(O);
|
16179 | var keys = getKeys(Properties);
|
16180 | var length = keys.length;
|
16181 | var i = 0;
|
16182 | var P;
|
16183 | while (length > i) dP.f(O, P = keys[i++], Properties[P]);
|
16184 | return O;
|
16185 | };
|
16186 |
|
16187 |
|
16188 | }),
|
16189 |
|
16190 | (function(module, exports, __webpack_require__) {
|
16191 |
|
16192 | var document = __webpack_require__(88).document;
|
16193 | module.exports = document && document.documentElement;
|
16194 |
|
16195 |
|
16196 | }),
|
16197 |
|
16198 | (function(module, exports, __webpack_require__) {
|
16199 |
|
16200 | 'use strict';
|
16201 |
|
16202 | exports.__esModule = true;
|
16203 | exports.connect = exports.connectAdvanced = exports.createProvider = exports.Provider = undefined;
|
16204 |
|
16205 | var _Provider = __webpack_require__(142);
|
16206 |
|
16207 | var _Provider2 = _interopRequireDefault(_Provider);
|
16208 |
|
16209 | var _connectAdvanced = __webpack_require__(145);
|
16210 |
|
16211 | var _connectAdvanced2 = _interopRequireDefault(_connectAdvanced);
|
16212 |
|
16213 | var _connect = __webpack_require__(149);
|
16214 |
|
16215 | var _connect2 = _interopRequireDefault(_connect);
|
16216 |
|
16217 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16218 |
|
16219 | exports.Provider = _Provider2.default;
|
16220 | exports.createProvider = _Provider.createProvider;
|
16221 | exports.connectAdvanced = _connectAdvanced2.default;
|
16222 | exports.connect = _connect2.default;
|
16223 |
|
16224 | }),
|
16225 |
|
16226 | (function(module, exports, __webpack_require__) {
|
16227 |
|
16228 | (function(process) {'use strict';
|
16229 |
|
16230 | exports.__esModule = true;
|
16231 | exports.createProvider = createProvider;
|
16232 |
|
16233 | var _react = __webpack_require__(4);
|
16234 |
|
16235 | var _propTypes = __webpack_require__(5);
|
16236 |
|
16237 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16238 |
|
16239 | var _PropTypes = __webpack_require__(143);
|
16240 |
|
16241 | var _warning = __webpack_require__(144);
|
16242 |
|
16243 | var _warning2 = _interopRequireDefault(_warning);
|
16244 |
|
16245 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16246 |
|
16247 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16248 |
|
16249 | 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; }
|
16250 |
|
16251 | 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; }
|
16252 |
|
16253 | var didWarnAboutReceivingStore = false;
|
16254 | function warnAboutReceivingStore() {
|
16255 | if (didWarnAboutReceivingStore) {
|
16256 | return;
|
16257 | }
|
16258 | didWarnAboutReceivingStore = true;
|
16259 |
|
16260 | (0, _warning2.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/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
|
16261 | }
|
16262 |
|
16263 | function createProvider() {
|
16264 | var _Provider$childContex;
|
16265 |
|
16266 | var storeKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'store';
|
16267 | var subKey = arguments[1];
|
16268 |
|
16269 | var subscriptionKey = subKey || storeKey + 'Subscription';
|
16270 |
|
16271 | var Provider = function (_Component) {
|
16272 | _inherits(Provider, _Component);
|
16273 |
|
16274 | Provider.prototype.getChildContext = function getChildContext() {
|
16275 | var _ref;
|
16276 |
|
16277 | return _ref = {}, _ref[storeKey] = this[storeKey], _ref[subscriptionKey] = null, _ref;
|
16278 | };
|
16279 |
|
16280 | function Provider(props, context) {
|
16281 | _classCallCheck(this, Provider);
|
16282 |
|
16283 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
16284 |
|
16285 | _this[storeKey] = props.store;
|
16286 | return _this;
|
16287 | }
|
16288 |
|
16289 | Provider.prototype.render = function render() {
|
16290 | return _react.Children.only(this.props.children);
|
16291 | };
|
16292 |
|
16293 | return Provider;
|
16294 | }(_react.Component);
|
16295 |
|
16296 | if (process.env.NODE_ENV !== 'production') {
|
16297 | Provider.prototype.componentWillReceiveProps = function (nextProps) {
|
16298 | if (this[storeKey] !== nextProps.store) {
|
16299 | warnAboutReceivingStore();
|
16300 | }
|
16301 | };
|
16302 | }
|
16303 |
|
16304 | Provider.propTypes = {
|
16305 | store: _PropTypes.storeShape.isRequired,
|
16306 | children: _propTypes2.default.element.isRequired
|
16307 | };
|
16308 | Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[storeKey] = _PropTypes.storeShape.isRequired, _Provider$childContex[subscriptionKey] = _PropTypes.subscriptionShape, _Provider$childContex);
|
16309 |
|
16310 | return Provider;
|
16311 | }
|
16312 |
|
16313 | exports.default = createProvider();
|
16314 | }.call(exports, __webpack_require__(32)))
|
16315 |
|
16316 | }),
|
16317 |
|
16318 | (function(module, exports, __webpack_require__) {
|
16319 |
|
16320 | 'use strict';
|
16321 |
|
16322 | exports.__esModule = true;
|
16323 | exports.storeShape = exports.subscriptionShape = undefined;
|
16324 |
|
16325 | var _propTypes = __webpack_require__(5);
|
16326 |
|
16327 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16328 |
|
16329 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16330 |
|
16331 | var subscriptionShape = exports.subscriptionShape = _propTypes2.default.shape({
|
16332 | trySubscribe: _propTypes2.default.func.isRequired,
|
16333 | tryUnsubscribe: _propTypes2.default.func.isRequired,
|
16334 | notifyNestedSubs: _propTypes2.default.func.isRequired,
|
16335 | isSubscribed: _propTypes2.default.func.isRequired
|
16336 | });
|
16337 |
|
16338 | var storeShape = exports.storeShape = _propTypes2.default.shape({
|
16339 | subscribe: _propTypes2.default.func.isRequired,
|
16340 | dispatch: _propTypes2.default.func.isRequired,
|
16341 | getState: _propTypes2.default.func.isRequired
|
16342 | });
|
16343 |
|
16344 | }),
|
16345 |
|
16346 | (function(module, exports) {
|
16347 |
|
16348 | 'use strict';
|
16349 |
|
16350 | exports.__esModule = true;
|
16351 | exports.default = warning;
|
16352 | |
16353 |
|
16354 |
|
16355 |
|
16356 |
|
16357 |
|
16358 | function warning(message) {
|
16359 |
|
16360 | if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
16361 | console.error(message);
|
16362 | }
|
16363 |
|
16364 | try {
|
16365 |
|
16366 |
|
16367 |
|
16368 | throw new Error(message);
|
16369 |
|
16370 | } catch (e) {}
|
16371 |
|
16372 | }
|
16373 |
|
16374 | }),
|
16375 |
|
16376 | (function(module, exports, __webpack_require__) {
|
16377 |
|
16378 | (function(process) {'use strict';
|
16379 |
|
16380 | exports.__esModule = true;
|
16381 |
|
16382 | 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; };
|
16383 |
|
16384 | exports.default = connectAdvanced;
|
16385 |
|
16386 | var _hoistNonReactStatics = __webpack_require__(146);
|
16387 |
|
16388 | var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
|
16389 |
|
16390 | var _invariant = __webpack_require__(147);
|
16391 |
|
16392 | var _invariant2 = _interopRequireDefault(_invariant);
|
16393 |
|
16394 | var _react = __webpack_require__(4);
|
16395 |
|
16396 | var _Subscription = __webpack_require__(148);
|
16397 |
|
16398 | var _Subscription2 = _interopRequireDefault(_Subscription);
|
16399 |
|
16400 | var _PropTypes = __webpack_require__(143);
|
16401 |
|
16402 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16403 |
|
16404 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16405 |
|
16406 | 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; }
|
16407 |
|
16408 | 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; }
|
16409 |
|
16410 | 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; }
|
16411 |
|
16412 | var hotReloadingVersion = 0;
|
16413 | var dummyState = {};
|
16414 | function noop() {}
|
16415 | function makeSelectorStateful(sourceSelector, store) {
|
16416 |
|
16417 | var selector = {
|
16418 | run: function runComponentSelector(props) {
|
16419 | try {
|
16420 | var nextProps = sourceSelector(store.getState(), props);
|
16421 | if (nextProps !== selector.props || selector.error) {
|
16422 | selector.shouldComponentUpdate = true;
|
16423 | selector.props = nextProps;
|
16424 | selector.error = null;
|
16425 | }
|
16426 | } catch (error) {
|
16427 | selector.shouldComponentUpdate = true;
|
16428 | selector.error = error;
|
16429 | }
|
16430 | }
|
16431 | };
|
16432 |
|
16433 | return selector;
|
16434 | }
|
16435 |
|
16436 | function connectAdvanced(
|
16437 | /*
|
16438 | selectorFactory is a func that is responsible for returning the selector function used to
|
16439 | compute new props from state, props, and dispatch. For example:
|
16440 | export default connectAdvanced((dispatch, options) => (state, props) => ({
|
16441 | thing: state.things[props.thingId],
|
16442 | saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)),
|
16443 | }))(YourComponent)
|
16444 | Access to dispatch is provided to the factory so selectorFactories can bind actionCreators
|
16445 | outside of their selector as an optimization. Options passed to connectAdvanced are passed to
|
16446 | the selectorFactory, along with displayName and WrappedComponent, as the second argument.
|
16447 | Note that selectorFactory is responsible for all caching/memoization of inbound and outbound
|
16448 | props. Do not use connectAdvanced directly without memoizing results between calls to your
|
16449 | selector, otherwise the Connect component will re-render on every state or props change.
|
16450 | */
|
16451 | selectorFactory) {
|
16452 | var _contextTypes, _childContextTypes;
|
16453 |
|
16454 | var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
16455 | _ref$getDisplayName = _ref.getDisplayName,
|
16456 | getDisplayName = _ref$getDisplayName === undefined ? function (name) {
|
16457 | return 'ConnectAdvanced(' + name + ')';
|
16458 | } : _ref$getDisplayName,
|
16459 | _ref$methodName = _ref.methodName,
|
16460 | methodName = _ref$methodName === undefined ? 'connectAdvanced' : _ref$methodName,
|
16461 | _ref$renderCountProp = _ref.renderCountProp,
|
16462 | renderCountProp = _ref$renderCountProp === undefined ? undefined : _ref$renderCountProp,
|
16463 | _ref$shouldHandleStat = _ref.shouldHandleStateChanges,
|
16464 | shouldHandleStateChanges = _ref$shouldHandleStat === undefined ? true : _ref$shouldHandleStat,
|
16465 | _ref$storeKey = _ref.storeKey,
|
16466 | storeKey = _ref$storeKey === undefined ? 'store' : _ref$storeKey,
|
16467 | _ref$withRef = _ref.withRef,
|
16468 | withRef = _ref$withRef === undefined ? false : _ref$withRef,
|
16469 | connectOptions = _objectWithoutProperties(_ref, ['getDisplayName', 'methodName', 'renderCountProp', 'shouldHandleStateChanges', 'storeKey', 'withRef']);
|
16470 |
|
16471 | var subscriptionKey = storeKey + 'Subscription';
|
16472 | var version = hotReloadingVersion++;
|
16473 |
|
16474 | var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = _PropTypes.storeShape, _contextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _contextTypes);
|
16475 | var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _childContextTypes);
|
16476 |
|
16477 | return function wrapWithConnect(WrappedComponent) {
|
16478 | (0, _invariant2.default)(typeof WrappedComponent == 'function', 'You must pass a component to the function returned by ' + (methodName + '. Instead received ' + JSON.stringify(WrappedComponent)));
|
16479 |
|
16480 | var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
16481 |
|
16482 | var displayName = getDisplayName(wrappedComponentName);
|
16483 |
|
16484 | var selectorFactoryOptions = _extends({}, connectOptions, {
|
16485 | getDisplayName: getDisplayName,
|
16486 | methodName: methodName,
|
16487 | renderCountProp: renderCountProp,
|
16488 | shouldHandleStateChanges: shouldHandleStateChanges,
|
16489 | storeKey: storeKey,
|
16490 | withRef: withRef,
|
16491 | displayName: displayName,
|
16492 | wrappedComponentName: wrappedComponentName,
|
16493 | WrappedComponent: WrappedComponent
|
16494 | });
|
16495 |
|
16496 | var Connect = function (_Component) {
|
16497 | _inherits(Connect, _Component);
|
16498 |
|
16499 | function Connect(props, context) {
|
16500 | _classCallCheck(this, Connect);
|
16501 |
|
16502 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
16503 |
|
16504 | _this.version = version;
|
16505 | _this.state = {};
|
16506 | _this.renderCount = 0;
|
16507 | _this.store = props[storeKey] || context[storeKey];
|
16508 | _this.propsMode = Boolean(props[storeKey]);
|
16509 | _this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
|
16510 |
|
16511 | (0, _invariant2.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 + '".'));
|
16512 |
|
16513 | _this.initSelector();
|
16514 | _this.initSubscription();
|
16515 | return _this;
|
16516 | }
|
16517 |
|
16518 | Connect.prototype.getChildContext = function getChildContext() {
|
16519 | var _ref2;
|
16520 |
|
16521 |
|
16522 |
|
16523 |
|
16524 |
|
16525 | var subscription = this.propsMode ? null : this.subscription;
|
16526 | return _ref2 = {}, _ref2[subscriptionKey] = subscription || this.context[subscriptionKey], _ref2;
|
16527 | };
|
16528 |
|
16529 | Connect.prototype.componentDidMount = function componentDidMount() {
|
16530 | if (!shouldHandleStateChanges) return;
|
16531 |
|
16532 |
|
16533 |
|
16534 |
|
16535 |
|
16536 |
|
16537 |
|
16538 | this.subscription.trySubscribe();
|
16539 | this.selector.run(this.props);
|
16540 | if (this.selector.shouldComponentUpdate) this.forceUpdate();
|
16541 | };
|
16542 |
|
16543 | Connect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
16544 | this.selector.run(nextProps);
|
16545 | };
|
16546 |
|
16547 | Connect.prototype.shouldComponentUpdate = function shouldComponentUpdate() {
|
16548 | return this.selector.shouldComponentUpdate;
|
16549 | };
|
16550 |
|
16551 | Connect.prototype.componentWillUnmount = function componentWillUnmount() {
|
16552 | if (this.subscription) this.subscription.tryUnsubscribe();
|
16553 | this.subscription = null;
|
16554 | this.notifyNestedSubs = noop;
|
16555 | this.store = null;
|
16556 | this.selector.run = noop;
|
16557 | this.selector.shouldComponentUpdate = false;
|
16558 | };
|
16559 |
|
16560 | Connect.prototype.getWrappedInstance = function getWrappedInstance() {
|
16561 | (0, _invariant2.default)(withRef, 'To access the wrapped instance, you need to specify ' + ('{ withRef: true } in the options argument of the ' + methodName + '() call.'));
|
16562 | return this.wrappedInstance;
|
16563 | };
|
16564 |
|
16565 | Connect.prototype.setWrappedInstance = function setWrappedInstance(ref) {
|
16566 | this.wrappedInstance = ref;
|
16567 | };
|
16568 |
|
16569 | Connect.prototype.initSelector = function initSelector() {
|
16570 | var sourceSelector = selectorFactory(this.store.dispatch, selectorFactoryOptions);
|
16571 | this.selector = makeSelectorStateful(sourceSelector, this.store);
|
16572 | this.selector.run(this.props);
|
16573 | };
|
16574 |
|
16575 | Connect.prototype.initSubscription = function initSubscription() {
|
16576 | if (!shouldHandleStateChanges) return;
|
16577 |
|
16578 |
|
16579 |
|
16580 | var parentSub = (this.propsMode ? this.props : this.context)[subscriptionKey];
|
16581 | this.subscription = new _Subscription2.default(this.store, parentSub, this.onStateChange.bind(this));
|
16582 |
|
16583 |
|
16584 |
|
16585 |
|
16586 |
|
16587 |
|
16588 |
|
16589 | this.notifyNestedSubs = this.subscription.notifyNestedSubs.bind(this.subscription);
|
16590 | };
|
16591 |
|
16592 | Connect.prototype.onStateChange = function onStateChange() {
|
16593 | this.selector.run(this.props);
|
16594 |
|
16595 | if (!this.selector.shouldComponentUpdate) {
|
16596 | this.notifyNestedSubs();
|
16597 | } else {
|
16598 | this.componentDidUpdate = this.notifyNestedSubsOnComponentDidUpdate;
|
16599 | this.setState(dummyState);
|
16600 | }
|
16601 | };
|
16602 |
|
16603 | Connect.prototype.notifyNestedSubsOnComponentDidUpdate = function notifyNestedSubsOnComponentDidUpdate() {
|
16604 |
|
16605 |
|
16606 |
|
16607 |
|
16608 |
|
16609 | this.componentDidUpdate = undefined;
|
16610 | this.notifyNestedSubs();
|
16611 | };
|
16612 |
|
16613 | Connect.prototype.isSubscribed = function isSubscribed() {
|
16614 | return Boolean(this.subscription) && this.subscription.isSubscribed();
|
16615 | };
|
16616 |
|
16617 | Connect.prototype.addExtraProps = function addExtraProps(props) {
|
16618 | if (!withRef && !renderCountProp && !(this.propsMode && this.subscription)) return props;
|
16619 |
|
16620 |
|
16621 |
|
16622 |
|
16623 | var withExtras = _extends({}, props);
|
16624 | if (withRef) withExtras.ref = this.setWrappedInstance;
|
16625 | if (renderCountProp) withExtras[renderCountProp] = this.renderCount++;
|
16626 | if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription;
|
16627 | return withExtras;
|
16628 | };
|
16629 |
|
16630 | Connect.prototype.render = function render() {
|
16631 | var selector = this.selector;
|
16632 | selector.shouldComponentUpdate = false;
|
16633 |
|
16634 | if (selector.error) {
|
16635 | throw selector.error;
|
16636 | } else {
|
16637 | return (0, _react.createElement)(WrappedComponent, this.addExtraProps(selector.props));
|
16638 | }
|
16639 | };
|
16640 |
|
16641 | return Connect;
|
16642 | }(_react.Component);
|
16643 |
|
16644 | Connect.WrappedComponent = WrappedComponent;
|
16645 | Connect.displayName = displayName;
|
16646 | Connect.childContextTypes = childContextTypes;
|
16647 | Connect.contextTypes = contextTypes;
|
16648 | Connect.propTypes = contextTypes;
|
16649 |
|
16650 | if (process.env.NODE_ENV !== 'production') {
|
16651 | Connect.prototype.componentWillUpdate = function componentWillUpdate() {
|
16652 | var _this2 = this;
|
16653 |
|
16654 |
|
16655 | if (this.version !== version) {
|
16656 | this.version = version;
|
16657 | this.initSelector();
|
16658 |
|
16659 |
|
16660 |
|
16661 |
|
16662 |
|
16663 |
|
16664 | var oldListeners = [];
|
16665 |
|
16666 | if (this.subscription) {
|
16667 | oldListeners = this.subscription.listeners.get();
|
16668 | this.subscription.tryUnsubscribe();
|
16669 | }
|
16670 | this.initSubscription();
|
16671 | if (shouldHandleStateChanges) {
|
16672 | this.subscription.trySubscribe();
|
16673 | oldListeners.forEach(function (listener) {
|
16674 | return _this2.subscription.listeners.subscribe(listener);
|
16675 | });
|
16676 | }
|
16677 | }
|
16678 | };
|
16679 | }
|
16680 |
|
16681 | return (0, _hoistNonReactStatics2.default)(Connect, WrappedComponent);
|
16682 | };
|
16683 | }
|
16684 | }.call(exports, __webpack_require__(32)))
|
16685 |
|
16686 | }),
|
16687 |
|
16688 | (function(module, exports) {
|
16689 |
|
16690 | 'use strict';
|
16691 |
|
16692 | |
16693 |
|
16694 |
|
16695 |
|
16696 | var REACT_STATICS = {
|
16697 | childContextTypes: true,
|
16698 | contextTypes: true,
|
16699 | defaultProps: true,
|
16700 | displayName: true,
|
16701 | getDefaultProps: true,
|
16702 | getDerivedStateFromProps: true,
|
16703 | mixins: true,
|
16704 | propTypes: true,
|
16705 | type: true
|
16706 | };
|
16707 |
|
16708 | var KNOWN_STATICS = {
|
16709 | name: true,
|
16710 | length: true,
|
16711 | prototype: true,
|
16712 | caller: true,
|
16713 | callee: true,
|
16714 | arguments: true,
|
16715 | arity: true
|
16716 | };
|
16717 |
|
16718 | var defineProperty = Object.defineProperty;
|
16719 | var getOwnPropertyNames = Object.getOwnPropertyNames;
|
16720 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
16721 | var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
16722 | var getPrototypeOf = Object.getPrototypeOf;
|
16723 | var objectPrototype = getPrototypeOf && getPrototypeOf(Object);
|
16724 |
|
16725 | function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
16726 | if (typeof sourceComponent !== 'string') {
|
16727 |
|
16728 | if (objectPrototype) {
|
16729 | var inheritedComponent = getPrototypeOf(sourceComponent);
|
16730 | if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
16731 | hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
16732 | }
|
16733 | }
|
16734 |
|
16735 | var keys = getOwnPropertyNames(sourceComponent);
|
16736 |
|
16737 | if (getOwnPropertySymbols) {
|
16738 | keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
16739 | }
|
16740 |
|
16741 | for (var i = 0; i < keys.length; ++i) {
|
16742 | var key = keys[i];
|
16743 | if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) {
|
16744 | var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
16745 | try {
|
16746 | defineProperty(targetComponent, key, descriptor);
|
16747 | } catch (e) {}
|
16748 | }
|
16749 | }
|
16750 |
|
16751 | return targetComponent;
|
16752 | }
|
16753 |
|
16754 | return targetComponent;
|
16755 | }
|
16756 |
|
16757 | module.exports = hoistNonReactStatics;
|
16758 |
|
16759 |
|
16760 | }),
|
16761 |
|
16762 | (function(module, exports, __webpack_require__) {
|
16763 |
|
16764 | (function(process) { |
16765 |
|
16766 |
|
16767 |
|
16768 |
|
16769 |
|
16770 |
|
16771 | 'use strict';
|
16772 |
|
16773 | |
16774 |
|
16775 |
|
16776 |
|
16777 |
|
16778 |
|
16779 |
|
16780 |
|
16781 |
|
16782 |
|
16783 |
|
16784 | var invariant = function(condition, format, a, b, c, d, e, f) {
|
16785 | if (process.env.NODE_ENV !== 'production') {
|
16786 | if (format === undefined) {
|
16787 | throw new Error('invariant requires an error message argument');
|
16788 | }
|
16789 | }
|
16790 |
|
16791 | if (!condition) {
|
16792 | var error;
|
16793 | if (format === undefined) {
|
16794 | error = new Error(
|
16795 | 'Minified exception occurred; use the non-minified dev environment ' +
|
16796 | 'for the full error message and additional helpful warnings.'
|
16797 | );
|
16798 | } else {
|
16799 | var args = [a, b, c, d, e, f];
|
16800 | var argIndex = 0;
|
16801 | error = new Error(
|
16802 | format.replace(/%s/g, function() { return args[argIndex++]; })
|
16803 | );
|
16804 | error.name = 'Invariant Violation';
|
16805 | }
|
16806 |
|
16807 | error.framesToPop = 1;
|
16808 | throw error;
|
16809 | }
|
16810 | };
|
16811 |
|
16812 | module.exports = invariant;
|
16813 |
|
16814 | }.call(exports, __webpack_require__(32)))
|
16815 |
|
16816 | }),
|
16817 |
|
16818 | (function(module, exports) {
|
16819 |
|
16820 | "use strict";
|
16821 |
|
16822 | exports.__esModule = true;
|
16823 |
|
16824 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16825 |
|
16826 |
|
16827 |
|
16828 |
|
16829 |
|
16830 | var CLEARED = null;
|
16831 | var nullListeners = {
|
16832 | notify: function notify() {}
|
16833 | };
|
16834 |
|
16835 | function createListenerCollection() {
|
16836 |
|
16837 |
|
16838 | var current = [];
|
16839 | var next = [];
|
16840 |
|
16841 | return {
|
16842 | clear: function clear() {
|
16843 | next = CLEARED;
|
16844 | current = CLEARED;
|
16845 | },
|
16846 | notify: function notify() {
|
16847 | var listeners = current = next;
|
16848 | for (var i = 0; i < listeners.length; i++) {
|
16849 | listeners[i]();
|
16850 | }
|
16851 | },
|
16852 | get: function get() {
|
16853 | return next;
|
16854 | },
|
16855 | subscribe: function subscribe(listener) {
|
16856 | var isSubscribed = true;
|
16857 | if (next === current) next = current.slice();
|
16858 | next.push(listener);
|
16859 |
|
16860 | return function unsubscribe() {
|
16861 | if (!isSubscribed || current === CLEARED) return;
|
16862 | isSubscribed = false;
|
16863 |
|
16864 | if (next === current) next = current.slice();
|
16865 | next.splice(next.indexOf(listener), 1);
|
16866 | };
|
16867 | }
|
16868 | };
|
16869 | }
|
16870 |
|
16871 | var Subscription = function () {
|
16872 | function Subscription(store, parentSub, onStateChange) {
|
16873 | _classCallCheck(this, Subscription);
|
16874 |
|
16875 | this.store = store;
|
16876 | this.parentSub = parentSub;
|
16877 | this.onStateChange = onStateChange;
|
16878 | this.unsubscribe = null;
|
16879 | this.listeners = nullListeners;
|
16880 | }
|
16881 |
|
16882 | Subscription.prototype.addNestedSub = function addNestedSub(listener) {
|
16883 | this.trySubscribe();
|
16884 | return this.listeners.subscribe(listener);
|
16885 | };
|
16886 |
|
16887 | Subscription.prototype.notifyNestedSubs = function notifyNestedSubs() {
|
16888 | this.listeners.notify();
|
16889 | };
|
16890 |
|
16891 | Subscription.prototype.isSubscribed = function isSubscribed() {
|
16892 | return Boolean(this.unsubscribe);
|
16893 | };
|
16894 |
|
16895 | Subscription.prototype.trySubscribe = function trySubscribe() {
|
16896 | if (!this.unsubscribe) {
|
16897 | this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);
|
16898 |
|
16899 | this.listeners = createListenerCollection();
|
16900 | }
|
16901 | };
|
16902 |
|
16903 | Subscription.prototype.tryUnsubscribe = function tryUnsubscribe() {
|
16904 | if (this.unsubscribe) {
|
16905 | this.unsubscribe();
|
16906 | this.unsubscribe = null;
|
16907 | this.listeners.clear();
|
16908 | this.listeners = nullListeners;
|
16909 | }
|
16910 | };
|
16911 |
|
16912 | return Subscription;
|
16913 | }();
|
16914 |
|
16915 | exports.default = Subscription;
|
16916 |
|
16917 | }),
|
16918 |
|
16919 | (function(module, exports, __webpack_require__) {
|
16920 |
|
16921 | 'use strict';
|
16922 |
|
16923 | exports.__esModule = true;
|
16924 |
|
16925 | 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; };
|
16926 |
|
16927 | exports.createConnect = createConnect;
|
16928 |
|
16929 | var _connectAdvanced = __webpack_require__(145);
|
16930 |
|
16931 | var _connectAdvanced2 = _interopRequireDefault(_connectAdvanced);
|
16932 |
|
16933 | var _shallowEqual = __webpack_require__(150);
|
16934 |
|
16935 | var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
|
16936 |
|
16937 | var _mapDispatchToProps = __webpack_require__(151);
|
16938 |
|
16939 | var _mapDispatchToProps2 = _interopRequireDefault(_mapDispatchToProps);
|
16940 |
|
16941 | var _mapStateToProps = __webpack_require__(164);
|
16942 |
|
16943 | var _mapStateToProps2 = _interopRequireDefault(_mapStateToProps);
|
16944 |
|
16945 | var _mergeProps = __webpack_require__(165);
|
16946 |
|
16947 | var _mergeProps2 = _interopRequireDefault(_mergeProps);
|
16948 |
|
16949 | var _selectorFactory = __webpack_require__(166);
|
16950 |
|
16951 | var _selectorFactory2 = _interopRequireDefault(_selectorFactory);
|
16952 |
|
16953 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16954 |
|
16955 | 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; }
|
16956 |
|
16957 | |
16958 |
|
16959 |
|
16960 |
|
16961 |
|
16962 |
|
16963 |
|
16964 |
|
16965 |
|
16966 |
|
16967 |
|
16968 |
|
16969 |
|
16970 |
|
16971 |
|
16972 |
|
16973 |
|
16974 | function match(arg, factories, name) {
|
16975 | for (var i = factories.length - 1; i >= 0; i--) {
|
16976 | var result = factories[i](arg);
|
16977 | if (result) return result;
|
16978 | }
|
16979 |
|
16980 | return function (dispatch, options) {
|
16981 | throw new Error('Invalid value of type ' + typeof arg + ' for ' + name + ' argument when connecting component ' + options.wrappedComponentName + '.');
|
16982 | };
|
16983 | }
|
16984 |
|
16985 | function strictEqual(a, b) {
|
16986 | return a === b;
|
16987 | }
|
16988 |
|
16989 |
|
16990 |
|
16991 | function createConnect() {
|
16992 | var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
16993 | _ref$connectHOC = _ref.connectHOC,
|
16994 | connectHOC = _ref$connectHOC === undefined ? _connectAdvanced2.default : _ref$connectHOC,
|
16995 | _ref$mapStateToPropsF = _ref.mapStateToPropsFactories,
|
16996 | mapStateToPropsFactories = _ref$mapStateToPropsF === undefined ? _mapStateToProps2.default : _ref$mapStateToPropsF,
|
16997 | _ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories,
|
16998 | mapDispatchToPropsFactories = _ref$mapDispatchToPro === undefined ? _mapDispatchToProps2.default : _ref$mapDispatchToPro,
|
16999 | _ref$mergePropsFactor = _ref.mergePropsFactories,
|
17000 | mergePropsFactories = _ref$mergePropsFactor === undefined ? _mergeProps2.default : _ref$mergePropsFactor,
|
17001 | _ref$selectorFactory = _ref.selectorFactory,
|
17002 | selectorFactory = _ref$selectorFactory === undefined ? _selectorFactory2.default : _ref$selectorFactory;
|
17003 |
|
17004 | return function connect(mapStateToProps, mapDispatchToProps, mergeProps) {
|
17005 | var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
|
17006 | _ref2$pure = _ref2.pure,
|
17007 | pure = _ref2$pure === undefined ? true : _ref2$pure,
|
17008 | _ref2$areStatesEqual = _ref2.areStatesEqual,
|
17009 | areStatesEqual = _ref2$areStatesEqual === undefined ? strictEqual : _ref2$areStatesEqual,
|
17010 | _ref2$areOwnPropsEqua = _ref2.areOwnPropsEqual,
|
17011 | areOwnPropsEqual = _ref2$areOwnPropsEqua === undefined ? _shallowEqual2.default : _ref2$areOwnPropsEqua,
|
17012 | _ref2$areStatePropsEq = _ref2.areStatePropsEqual,
|
17013 | areStatePropsEqual = _ref2$areStatePropsEq === undefined ? _shallowEqual2.default : _ref2$areStatePropsEq,
|
17014 | _ref2$areMergedPropsE = _ref2.areMergedPropsEqual,
|
17015 | areMergedPropsEqual = _ref2$areMergedPropsE === undefined ? _shallowEqual2.default : _ref2$areMergedPropsE,
|
17016 | extraOptions = _objectWithoutProperties(_ref2, ['pure', 'areStatesEqual', 'areOwnPropsEqual', 'areStatePropsEqual', 'areMergedPropsEqual']);
|
17017 |
|
17018 | var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps');
|
17019 | var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps');
|
17020 | var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps');
|
17021 |
|
17022 | return connectHOC(selectorFactory, _extends({
|
17023 |
|
17024 | methodName: 'connect',
|
17025 |
|
17026 |
|
17027 | getDisplayName: function getDisplayName(name) {
|
17028 | return 'Connect(' + name + ')';
|
17029 | },
|
17030 |
|
17031 |
|
17032 | shouldHandleStateChanges: Boolean(mapStateToProps),
|
17033 |
|
17034 |
|
17035 | initMapStateToProps: initMapStateToProps,
|
17036 | initMapDispatchToProps: initMapDispatchToProps,
|
17037 | initMergeProps: initMergeProps,
|
17038 | pure: pure,
|
17039 | areStatesEqual: areStatesEqual,
|
17040 | areOwnPropsEqual: areOwnPropsEqual,
|
17041 | areStatePropsEqual: areStatePropsEqual,
|
17042 | areMergedPropsEqual: areMergedPropsEqual
|
17043 |
|
17044 | }, extraOptions));
|
17045 | };
|
17046 | }
|
17047 |
|
17048 | exports.default = createConnect();
|
17049 |
|
17050 | }),
|
17051 |
|
17052 | (function(module, exports) {
|
17053 |
|
17054 | 'use strict';
|
17055 |
|
17056 | exports.__esModule = true;
|
17057 | exports.default = shallowEqual;
|
17058 | var hasOwn = Object.prototype.hasOwnProperty;
|
17059 |
|
17060 | function is(x, y) {
|
17061 | if (x === y) {
|
17062 | return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
17063 | } else {
|
17064 | return x !== x && y !== y;
|
17065 | }
|
17066 | }
|
17067 |
|
17068 | function shallowEqual(objA, objB) {
|
17069 | if (is(objA, objB)) return true;
|
17070 |
|
17071 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
17072 | return false;
|
17073 | }
|
17074 |
|
17075 | var keysA = Object.keys(objA);
|
17076 | var keysB = Object.keys(objB);
|
17077 |
|
17078 | if (keysA.length !== keysB.length) return false;
|
17079 |
|
17080 | for (var i = 0; i < keysA.length; i++) {
|
17081 | if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
|
17082 | return false;
|
17083 | }
|
17084 | }
|
17085 |
|
17086 | return true;
|
17087 | }
|
17088 |
|
17089 | }),
|
17090 |
|
17091 | (function(module, exports, __webpack_require__) {
|
17092 |
|
17093 | 'use strict';
|
17094 |
|
17095 | exports.__esModule = true;
|
17096 | exports.whenMapDispatchToPropsIsFunction = whenMapDispatchToPropsIsFunction;
|
17097 | exports.whenMapDispatchToPropsIsMissing = whenMapDispatchToPropsIsMissing;
|
17098 | exports.whenMapDispatchToPropsIsObject = whenMapDispatchToPropsIsObject;
|
17099 |
|
17100 | var _redux = __webpack_require__(129);
|
17101 |
|
17102 | var _wrapMapToProps = __webpack_require__(152);
|
17103 |
|
17104 | function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {
|
17105 | return typeof mapDispatchToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapDispatchToProps, 'mapDispatchToProps') : undefined;
|
17106 | }
|
17107 |
|
17108 | function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {
|
17109 | return !mapDispatchToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) {
|
17110 | return { dispatch: dispatch };
|
17111 | }) : undefined;
|
17112 | }
|
17113 |
|
17114 | function whenMapDispatchToPropsIsObject(mapDispatchToProps) {
|
17115 | return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) {
|
17116 | return (0, _redux.bindActionCreators)(mapDispatchToProps, dispatch);
|
17117 | }) : undefined;
|
17118 | }
|
17119 |
|
17120 | exports.default = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];
|
17121 |
|
17122 | }),
|
17123 |
|
17124 | (function(module, exports, __webpack_require__) {
|
17125 |
|
17126 | (function(process) {'use strict';
|
17127 |
|
17128 | exports.__esModule = true;
|
17129 | exports.wrapMapToPropsConstant = wrapMapToPropsConstant;
|
17130 | exports.getDependsOnOwnProps = getDependsOnOwnProps;
|
17131 | exports.wrapMapToPropsFunc = wrapMapToPropsFunc;
|
17132 |
|
17133 | var _verifyPlainObject = __webpack_require__(153);
|
17134 |
|
17135 | var _verifyPlainObject2 = _interopRequireDefault(_verifyPlainObject);
|
17136 |
|
17137 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17138 |
|
17139 | function wrapMapToPropsConstant(getConstant) {
|
17140 | return function initConstantSelector(dispatch, options) {
|
17141 | var constant = getConstant(dispatch, options);
|
17142 |
|
17143 | function constantSelector() {
|
17144 | return constant;
|
17145 | }
|
17146 | constantSelector.dependsOnOwnProps = false;
|
17147 | return constantSelector;
|
17148 | };
|
17149 | }
|
17150 |
|
17151 |
|
17152 |
|
17153 |
|
17154 |
|
17155 |
|
17156 |
|
17157 |
|
17158 | function getDependsOnOwnProps(mapToProps) {
|
17159 | return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1;
|
17160 | }
|
17161 |
|
17162 |
|
17163 |
|
17164 |
|
17165 |
|
17166 |
|
17167 |
|
17168 |
|
17169 |
|
17170 |
|
17171 |
|
17172 |
|
17173 |
|
17174 | function wrapMapToPropsFunc(mapToProps, methodName) {
|
17175 | return function initProxySelector(dispatch, _ref) {
|
17176 | var displayName = _ref.displayName;
|
17177 |
|
17178 | var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) {
|
17179 | return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch);
|
17180 | };
|
17181 |
|
17182 |
|
17183 | proxy.dependsOnOwnProps = true;
|
17184 |
|
17185 | proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
|
17186 | proxy.mapToProps = mapToProps;
|
17187 | proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
|
17188 | var props = proxy(stateOrDispatch, ownProps);
|
17189 |
|
17190 | if (typeof props === 'function') {
|
17191 | proxy.mapToProps = props;
|
17192 | proxy.dependsOnOwnProps = getDependsOnOwnProps(props);
|
17193 | props = proxy(stateOrDispatch, ownProps);
|
17194 | }
|
17195 |
|
17196 | if (process.env.NODE_ENV !== 'production') (0, _verifyPlainObject2.default)(props, displayName, methodName);
|
17197 |
|
17198 | return props;
|
17199 | };
|
17200 |
|
17201 | return proxy;
|
17202 | };
|
17203 | }
|
17204 | }.call(exports, __webpack_require__(32)))
|
17205 |
|
17206 | }),
|
17207 |
|
17208 | (function(module, exports, __webpack_require__) {
|
17209 |
|
17210 | 'use strict';
|
17211 |
|
17212 | exports.__esModule = true;
|
17213 | exports.default = verifyPlainObject;
|
17214 |
|
17215 | var _isPlainObject = __webpack_require__(154);
|
17216 |
|
17217 | var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
|
17218 |
|
17219 | var _warning = __webpack_require__(144);
|
17220 |
|
17221 | var _warning2 = _interopRequireDefault(_warning);
|
17222 |
|
17223 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17224 |
|
17225 | function verifyPlainObject(value, displayName, methodName) {
|
17226 | if (!(0, _isPlainObject2.default)(value)) {
|
17227 | (0, _warning2.default)(methodName + '() in ' + displayName + ' must return a plain object. Instead received ' + value + '.');
|
17228 | }
|
17229 | }
|
17230 |
|
17231 | }),
|
17232 |
|
17233 | (function(module, exports, __webpack_require__) {
|
17234 |
|
17235 | var baseGetTag = __webpack_require__(155),
|
17236 | getPrototype = __webpack_require__(161),
|
17237 | isObjectLike = __webpack_require__(163);
|
17238 |
|
17239 |
|
17240 | var objectTag = '[object Object]';
|
17241 |
|
17242 |
|
17243 | var funcProto = Function.prototype,
|
17244 | objectProto = Object.prototype;
|
17245 |
|
17246 |
|
17247 | var funcToString = funcProto.toString;
|
17248 |
|
17249 |
|
17250 | var hasOwnProperty = objectProto.hasOwnProperty;
|
17251 |
|
17252 |
|
17253 | var objectCtorString = funcToString.call(Object);
|
17254 |
|
17255 | |
17256 |
|
17257 |
|
17258 |
|
17259 |
|
17260 |
|
17261 |
|
17262 |
|
17263 |
|
17264 |
|
17265 |
|
17266 |
|
17267 |
|
17268 |
|
17269 |
|
17270 |
|
17271 |
|
17272 |
|
17273 |
|
17274 |
|
17275 |
|
17276 |
|
17277 |
|
17278 |
|
17279 |
|
17280 |
|
17281 |
|
17282 |
|
17283 | function isPlainObject(value) {
|
17284 | if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
17285 | return false;
|
17286 | }
|
17287 | var proto = getPrototype(value);
|
17288 | if (proto === null) {
|
17289 | return true;
|
17290 | }
|
17291 | var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
17292 | return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
17293 | funcToString.call(Ctor) == objectCtorString;
|
17294 | }
|
17295 |
|
17296 | module.exports = isPlainObject;
|
17297 |
|
17298 |
|
17299 | }),
|
17300 |
|
17301 | (function(module, exports, __webpack_require__) {
|
17302 |
|
17303 | var Symbol = __webpack_require__(156),
|
17304 | getRawTag = __webpack_require__(159),
|
17305 | objectToString = __webpack_require__(160);
|
17306 |
|
17307 |
|
17308 | var nullTag = '[object Null]',
|
17309 | undefinedTag = '[object Undefined]';
|
17310 |
|
17311 |
|
17312 | var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
17313 |
|
17314 | |
17315 |
|
17316 |
|
17317 |
|
17318 |
|
17319 |
|
17320 |
|
17321 | function baseGetTag(value) {
|
17322 | if (value == null) {
|
17323 | return value === undefined ? undefinedTag : nullTag;
|
17324 | }
|
17325 | return (symToStringTag && symToStringTag in Object(value))
|
17326 | ? getRawTag(value)
|
17327 | : objectToString(value);
|
17328 | }
|
17329 |
|
17330 | module.exports = baseGetTag;
|
17331 |
|
17332 |
|
17333 | }),
|
17334 |
|
17335 | (function(module, exports, __webpack_require__) {
|
17336 |
|
17337 | var root = __webpack_require__(157);
|
17338 |
|
17339 |
|
17340 | var Symbol = root.Symbol;
|
17341 |
|
17342 | module.exports = Symbol;
|
17343 |
|
17344 |
|
17345 | }),
|
17346 |
|
17347 | (function(module, exports, __webpack_require__) {
|
17348 |
|
17349 | var freeGlobal = __webpack_require__(158);
|
17350 |
|
17351 |
|
17352 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
17353 |
|
17354 |
|
17355 | var root = freeGlobal || freeSelf || Function('return this')();
|
17356 |
|
17357 | module.exports = root;
|
17358 |
|
17359 |
|
17360 | }),
|
17361 |
|
17362 | (function(module, exports) {
|
17363 |
|
17364 | (function(global) {
|
17365 | var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
17366 |
|
17367 | module.exports = freeGlobal;
|
17368 |
|
17369 | }.call(exports, (function() { return this; }())))
|
17370 |
|
17371 | }),
|
17372 |
|
17373 | (function(module, exports, __webpack_require__) {
|
17374 |
|
17375 | var Symbol = __webpack_require__(156);
|
17376 |
|
17377 |
|
17378 | var objectProto = Object.prototype;
|
17379 |
|
17380 |
|
17381 | var hasOwnProperty = objectProto.hasOwnProperty;
|
17382 |
|
17383 | |
17384 |
|
17385 |
|
17386 |
|
17387 |
|
17388 | var nativeObjectToString = objectProto.toString;
|
17389 |
|
17390 |
|
17391 | var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
17392 |
|
17393 | |
17394 |
|
17395 |
|
17396 |
|
17397 |
|
17398 |
|
17399 |
|
17400 | function getRawTag(value) {
|
17401 | var isOwn = hasOwnProperty.call(value, symToStringTag),
|
17402 | tag = value[symToStringTag];
|
17403 |
|
17404 | try {
|
17405 | value[symToStringTag] = undefined;
|
17406 | var unmasked = true;
|
17407 | } catch (e) {}
|
17408 |
|
17409 | var result = nativeObjectToString.call(value);
|
17410 | if (unmasked) {
|
17411 | if (isOwn) {
|
17412 | value[symToStringTag] = tag;
|
17413 | } else {
|
17414 | delete value[symToStringTag];
|
17415 | }
|
17416 | }
|
17417 | return result;
|
17418 | }
|
17419 |
|
17420 | module.exports = getRawTag;
|
17421 |
|
17422 |
|
17423 | }),
|
17424 |
|
17425 | (function(module, exports) {
|
17426 |
|
17427 |
|
17428 | var objectProto = Object.prototype;
|
17429 |
|
17430 | |
17431 |
|
17432 |
|
17433 |
|
17434 |
|
17435 | var nativeObjectToString = objectProto.toString;
|
17436 |
|
17437 | |
17438 |
|
17439 |
|
17440 |
|
17441 |
|
17442 |
|
17443 |
|
17444 | function objectToString(value) {
|
17445 | return nativeObjectToString.call(value);
|
17446 | }
|
17447 |
|
17448 | module.exports = objectToString;
|
17449 |
|
17450 |
|
17451 | }),
|
17452 |
|
17453 | (function(module, exports, __webpack_require__) {
|
17454 |
|
17455 | var overArg = __webpack_require__(162);
|
17456 |
|
17457 |
|
17458 | var getPrototype = overArg(Object.getPrototypeOf, Object);
|
17459 |
|
17460 | module.exports = getPrototype;
|
17461 |
|
17462 |
|
17463 | }),
|
17464 |
|
17465 | (function(module, exports) {
|
17466 |
|
17467 | |
17468 |
|
17469 |
|
17470 |
|
17471 |
|
17472 |
|
17473 |
|
17474 |
|
17475 | function overArg(func, transform) {
|
17476 | return function(arg) {
|
17477 | return func(transform(arg));
|
17478 | };
|
17479 | }
|
17480 |
|
17481 | module.exports = overArg;
|
17482 |
|
17483 |
|
17484 | }),
|
17485 |
|
17486 | (function(module, exports) {
|
17487 |
|
17488 | |
17489 |
|
17490 |
|
17491 |
|
17492 |
|
17493 |
|
17494 |
|
17495 |
|
17496 |
|
17497 |
|
17498 |
|
17499 |
|
17500 |
|
17501 |
|
17502 |
|
17503 |
|
17504 |
|
17505 |
|
17506 |
|
17507 |
|
17508 |
|
17509 |
|
17510 |
|
17511 |
|
17512 | function isObjectLike(value) {
|
17513 | return value != null && typeof value == 'object';
|
17514 | }
|
17515 |
|
17516 | module.exports = isObjectLike;
|
17517 |
|
17518 |
|
17519 | }),
|
17520 |
|
17521 | (function(module, exports, __webpack_require__) {
|
17522 |
|
17523 | 'use strict';
|
17524 |
|
17525 | exports.__esModule = true;
|
17526 | exports.whenMapStateToPropsIsFunction = whenMapStateToPropsIsFunction;
|
17527 | exports.whenMapStateToPropsIsMissing = whenMapStateToPropsIsMissing;
|
17528 |
|
17529 | var _wrapMapToProps = __webpack_require__(152);
|
17530 |
|
17531 | function whenMapStateToPropsIsFunction(mapStateToProps) {
|
17532 | return typeof mapStateToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapStateToProps, 'mapStateToProps') : undefined;
|
17533 | }
|
17534 |
|
17535 | function whenMapStateToPropsIsMissing(mapStateToProps) {
|
17536 | return !mapStateToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function () {
|
17537 | return {};
|
17538 | }) : undefined;
|
17539 | }
|
17540 |
|
17541 | exports.default = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing];
|
17542 |
|
17543 | }),
|
17544 |
|
17545 | (function(module, exports, __webpack_require__) {
|
17546 |
|
17547 | (function(process) {'use strict';
|
17548 |
|
17549 | exports.__esModule = true;
|
17550 |
|
17551 | 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; };
|
17552 |
|
17553 | exports.defaultMergeProps = defaultMergeProps;
|
17554 | exports.wrapMergePropsFunc = wrapMergePropsFunc;
|
17555 | exports.whenMergePropsIsFunction = whenMergePropsIsFunction;
|
17556 | exports.whenMergePropsIsOmitted = whenMergePropsIsOmitted;
|
17557 |
|
17558 | var _verifyPlainObject = __webpack_require__(153);
|
17559 |
|
17560 | var _verifyPlainObject2 = _interopRequireDefault(_verifyPlainObject);
|
17561 |
|
17562 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17563 |
|
17564 | function defaultMergeProps(stateProps, dispatchProps, ownProps) {
|
17565 | return _extends({}, ownProps, stateProps, dispatchProps);
|
17566 | }
|
17567 |
|
17568 | function wrapMergePropsFunc(mergeProps) {
|
17569 | return function initMergePropsProxy(dispatch, _ref) {
|
17570 | var displayName = _ref.displayName,
|
17571 | pure = _ref.pure,
|
17572 | areMergedPropsEqual = _ref.areMergedPropsEqual;
|
17573 |
|
17574 | var hasRunOnce = false;
|
17575 | var mergedProps = void 0;
|
17576 |
|
17577 | return function mergePropsProxy(stateProps, dispatchProps, ownProps) {
|
17578 | var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
17579 |
|
17580 | if (hasRunOnce) {
|
17581 | if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps;
|
17582 | } else {
|
17583 | hasRunOnce = true;
|
17584 | mergedProps = nextMergedProps;
|
17585 |
|
17586 | if (process.env.NODE_ENV !== 'production') (0, _verifyPlainObject2.default)(mergedProps, displayName, 'mergeProps');
|
17587 | }
|
17588 |
|
17589 | return mergedProps;
|
17590 | };
|
17591 | };
|
17592 | }
|
17593 |
|
17594 | function whenMergePropsIsFunction(mergeProps) {
|
17595 | return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined;
|
17596 | }
|
17597 |
|
17598 | function whenMergePropsIsOmitted(mergeProps) {
|
17599 | return !mergeProps ? function () {
|
17600 | return defaultMergeProps;
|
17601 | } : undefined;
|
17602 | }
|
17603 |
|
17604 | exports.default = [whenMergePropsIsFunction, whenMergePropsIsOmitted];
|
17605 | }.call(exports, __webpack_require__(32)))
|
17606 |
|
17607 | }),
|
17608 |
|
17609 | (function(module, exports, __webpack_require__) {
|
17610 |
|
17611 | (function(process) {'use strict';
|
17612 |
|
17613 | exports.__esModule = true;
|
17614 | exports.impureFinalPropsSelectorFactory = impureFinalPropsSelectorFactory;
|
17615 | exports.pureFinalPropsSelectorFactory = pureFinalPropsSelectorFactory;
|
17616 | exports.default = finalPropsSelectorFactory;
|
17617 |
|
17618 | var _verifySubselectors = __webpack_require__(167);
|
17619 |
|
17620 | var _verifySubselectors2 = _interopRequireDefault(_verifySubselectors);
|
17621 |
|
17622 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17623 |
|
17624 | 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; }
|
17625 |
|
17626 | function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {
|
17627 | return function impureFinalPropsSelector(state, ownProps) {
|
17628 | return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps);
|
17629 | };
|
17630 | }
|
17631 |
|
17632 | function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) {
|
17633 | var areStatesEqual = _ref.areStatesEqual,
|
17634 | areOwnPropsEqual = _ref.areOwnPropsEqual,
|
17635 | areStatePropsEqual = _ref.areStatePropsEqual;
|
17636 |
|
17637 | var hasRunAtLeastOnce = false;
|
17638 | var state = void 0;
|
17639 | var ownProps = void 0;
|
17640 | var stateProps = void 0;
|
17641 | var dispatchProps = void 0;
|
17642 | var mergedProps = void 0;
|
17643 |
|
17644 | function handleFirstCall(firstState, firstOwnProps) {
|
17645 | state = firstState;
|
17646 | ownProps = firstOwnProps;
|
17647 | stateProps = mapStateToProps(state, ownProps);
|
17648 | dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
17649 | mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
17650 | hasRunAtLeastOnce = true;
|
17651 | return mergedProps;
|
17652 | }
|
17653 |
|
17654 | function handleNewPropsAndNewState() {
|
17655 | stateProps = mapStateToProps(state, ownProps);
|
17656 |
|
17657 | if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
17658 |
|
17659 | mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
17660 | return mergedProps;
|
17661 | }
|
17662 |
|
17663 | function handleNewProps() {
|
17664 | if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps);
|
17665 |
|
17666 | if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
17667 |
|
17668 | mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
17669 | return mergedProps;
|
17670 | }
|
17671 |
|
17672 | function handleNewState() {
|
17673 | var nextStateProps = mapStateToProps(state, ownProps);
|
17674 | var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps);
|
17675 | stateProps = nextStateProps;
|
17676 |
|
17677 | if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
17678 |
|
17679 | return mergedProps;
|
17680 | }
|
17681 |
|
17682 | function handleSubsequentCalls(nextState, nextOwnProps) {
|
17683 | var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps);
|
17684 | var stateChanged = !areStatesEqual(nextState, state);
|
17685 | state = nextState;
|
17686 | ownProps = nextOwnProps;
|
17687 |
|
17688 | if (propsChanged && stateChanged) return handleNewPropsAndNewState();
|
17689 | if (propsChanged) return handleNewProps();
|
17690 | if (stateChanged) return handleNewState();
|
17691 | return mergedProps;
|
17692 | }
|
17693 |
|
17694 | return function pureFinalPropsSelector(nextState, nextOwnProps) {
|
17695 | return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps);
|
17696 | };
|
17697 | }
|
17698 |
|
17699 |
|
17700 |
|
17701 |
|
17702 |
|
17703 |
|
17704 |
|
17705 |
|
17706 | function finalPropsSelectorFactory(dispatch, _ref2) {
|
17707 | var initMapStateToProps = _ref2.initMapStateToProps,
|
17708 | initMapDispatchToProps = _ref2.initMapDispatchToProps,
|
17709 | initMergeProps = _ref2.initMergeProps,
|
17710 | options = _objectWithoutProperties(_ref2, ['initMapStateToProps', 'initMapDispatchToProps', 'initMergeProps']);
|
17711 |
|
17712 | var mapStateToProps = initMapStateToProps(dispatch, options);
|
17713 | var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
|
17714 | var mergeProps = initMergeProps(dispatch, options);
|
17715 |
|
17716 | if (process.env.NODE_ENV !== 'production') {
|
17717 | (0, _verifySubselectors2.default)(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName);
|
17718 | }
|
17719 |
|
17720 | var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory;
|
17721 |
|
17722 | return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
|
17723 | }
|
17724 | }.call(exports, __webpack_require__(32)))
|
17725 |
|
17726 | }),
|
17727 |
|
17728 | (function(module, exports, __webpack_require__) {
|
17729 |
|
17730 | 'use strict';
|
17731 |
|
17732 | exports.__esModule = true;
|
17733 | exports.default = verifySubselectors;
|
17734 |
|
17735 | var _warning = __webpack_require__(144);
|
17736 |
|
17737 | var _warning2 = _interopRequireDefault(_warning);
|
17738 |
|
17739 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17740 |
|
17741 | function verify(selector, methodName, displayName) {
|
17742 | if (!selector) {
|
17743 | throw new Error('Unexpected value for ' + methodName + ' in ' + displayName + '.');
|
17744 | } else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') {
|
17745 | if (!selector.hasOwnProperty('dependsOnOwnProps')) {
|
17746 | (0, _warning2.default)('The selector for ' + methodName + ' of ' + displayName + ' did not specify a value for dependsOnOwnProps.');
|
17747 | }
|
17748 | }
|
17749 | }
|
17750 |
|
17751 | function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) {
|
17752 | verify(mapStateToProps, 'mapStateToProps', displayName);
|
17753 | verify(mapDispatchToProps, 'mapDispatchToProps', displayName);
|
17754 | verify(mergeProps, 'mergeProps', displayName);
|
17755 | }
|
17756 |
|
17757 | }),
|
17758 |
|
17759 | (function(module, exports, __webpack_require__) {
|
17760 |
|
17761 | 'use strict';
|
17762 |
|
17763 | exports.__esModule = true;
|
17764 |
|
17765 | function _interopRequire(obj) { return obj && obj.__esModule ? obj['default'] : obj; }
|
17766 |
|
17767 | var _Motion = __webpack_require__(169);
|
17768 |
|
17769 | exports.Motion = _interopRequire(_Motion);
|
17770 |
|
17771 | var _StaggeredMotion = __webpack_require__(176);
|
17772 |
|
17773 | exports.StaggeredMotion = _interopRequire(_StaggeredMotion);
|
17774 |
|
17775 | var _TransitionMotion = __webpack_require__(177);
|
17776 |
|
17777 | exports.TransitionMotion = _interopRequire(_TransitionMotion);
|
17778 |
|
17779 | var _spring = __webpack_require__(179);
|
17780 |
|
17781 | exports.spring = _interopRequire(_spring);
|
17782 |
|
17783 | var _presets = __webpack_require__(180);
|
17784 |
|
17785 | exports.presets = _interopRequire(_presets);
|
17786 |
|
17787 | var _stripStyle = __webpack_require__(171);
|
17788 |
|
17789 | exports.stripStyle = _interopRequire(_stripStyle);
|
17790 |
|
17791 |
|
17792 |
|
17793 | var _reorderKeys = __webpack_require__(181);
|
17794 |
|
17795 | exports.reorderKeys = _interopRequire(_reorderKeys);
|
17796 |
|
17797 | }),
|
17798 |
|
17799 | (function(module, exports, __webpack_require__) {
|
17800 |
|
17801 | 'use strict';
|
17802 |
|
17803 | exports.__esModule = true;
|
17804 |
|
17805 | 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; };
|
17806 |
|
17807 | 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; }; })();
|
17808 |
|
17809 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
17810 |
|
17811 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
17812 |
|
17813 | 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; }
|
17814 |
|
17815 | var _mapToZero = __webpack_require__(170);
|
17816 |
|
17817 | var _mapToZero2 = _interopRequireDefault(_mapToZero);
|
17818 |
|
17819 | var _stripStyle = __webpack_require__(171);
|
17820 |
|
17821 | var _stripStyle2 = _interopRequireDefault(_stripStyle);
|
17822 |
|
17823 | var _stepper3 = __webpack_require__(172);
|
17824 |
|
17825 | var _stepper4 = _interopRequireDefault(_stepper3);
|
17826 |
|
17827 | var _performanceNow = __webpack_require__(173);
|
17828 |
|
17829 | var _performanceNow2 = _interopRequireDefault(_performanceNow);
|
17830 |
|
17831 | var _raf = __webpack_require__(174);
|
17832 |
|
17833 | var _raf2 = _interopRequireDefault(_raf);
|
17834 |
|
17835 | var _shouldStopAnimation = __webpack_require__(175);
|
17836 |
|
17837 | var _shouldStopAnimation2 = _interopRequireDefault(_shouldStopAnimation);
|
17838 |
|
17839 | var _react = __webpack_require__(4);
|
17840 |
|
17841 | var _react2 = _interopRequireDefault(_react);
|
17842 |
|
17843 | var _propTypes = __webpack_require__(5);
|
17844 |
|
17845 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
17846 |
|
17847 | var msPerFrame = 1000 / 60;
|
17848 |
|
17849 | var Motion = (function (_React$Component) {
|
17850 | _inherits(Motion, _React$Component);
|
17851 |
|
17852 | _createClass(Motion, null, [{
|
17853 | key: 'propTypes',
|
17854 | value: {
|
17855 |
|
17856 | defaultStyle: _propTypes2['default'].objectOf(_propTypes2['default'].number),
|
17857 | style: _propTypes2['default'].objectOf(_propTypes2['default'].oneOfType([_propTypes2['default'].number, _propTypes2['default'].object])).isRequired,
|
17858 | children: _propTypes2['default'].func.isRequired,
|
17859 | onRest: _propTypes2['default'].func
|
17860 | },
|
17861 | enumerable: true
|
17862 | }]);
|
17863 |
|
17864 | function Motion(props) {
|
17865 | var _this = this;
|
17866 |
|
17867 | _classCallCheck(this, Motion);
|
17868 |
|
17869 | _React$Component.call(this, props);
|
17870 | this.wasAnimating = false;
|
17871 | this.animationID = null;
|
17872 | this.prevTime = 0;
|
17873 | this.accumulatedTime = 0;
|
17874 | this.unreadPropStyle = null;
|
17875 |
|
17876 | this.clearUnreadPropStyle = function (destStyle) {
|
17877 | var dirty = false;
|
17878 | var _state = _this.state;
|
17879 | var currentStyle = _state.currentStyle;
|
17880 | var currentVelocity = _state.currentVelocity;
|
17881 | var lastIdealStyle = _state.lastIdealStyle;
|
17882 | var lastIdealVelocity = _state.lastIdealVelocity;
|
17883 |
|
17884 | for (var key in destStyle) {
|
17885 | if (!Object.prototype.hasOwnProperty.call(destStyle, key)) {
|
17886 | continue;
|
17887 | }
|
17888 |
|
17889 | var styleValue = destStyle[key];
|
17890 | if (typeof styleValue === 'number') {
|
17891 | if (!dirty) {
|
17892 | dirty = true;
|
17893 | currentStyle = _extends({}, currentStyle);
|
17894 | currentVelocity = _extends({}, currentVelocity);
|
17895 | lastIdealStyle = _extends({}, lastIdealStyle);
|
17896 | lastIdealVelocity = _extends({}, lastIdealVelocity);
|
17897 | }
|
17898 |
|
17899 | currentStyle[key] = styleValue;
|
17900 | currentVelocity[key] = 0;
|
17901 | lastIdealStyle[key] = styleValue;
|
17902 | lastIdealVelocity[key] = 0;
|
17903 | }
|
17904 | }
|
17905 |
|
17906 | if (dirty) {
|
17907 | _this.setState({ currentStyle: currentStyle, currentVelocity: currentVelocity, lastIdealStyle: lastIdealStyle, lastIdealVelocity: lastIdealVelocity });
|
17908 | }
|
17909 | };
|
17910 |
|
17911 | this.startAnimationIfNecessary = function () {
|
17912 |
|
17913 |
|
17914 | _this.animationID = _raf2['default'](function (timestamp) {
|
17915 |
|
17916 | var propsStyle = _this.props.style;
|
17917 | if (_shouldStopAnimation2['default'](_this.state.currentStyle, propsStyle, _this.state.currentVelocity)) {
|
17918 | if (_this.wasAnimating && _this.props.onRest) {
|
17919 | _this.props.onRest();
|
17920 | }
|
17921 |
|
17922 |
|
17923 | _this.animationID = null;
|
17924 | _this.wasAnimating = false;
|
17925 | _this.accumulatedTime = 0;
|
17926 | return;
|
17927 | }
|
17928 |
|
17929 | _this.wasAnimating = true;
|
17930 |
|
17931 | var currentTime = timestamp || _performanceNow2['default']();
|
17932 | var timeDelta = currentTime - _this.prevTime;
|
17933 | _this.prevTime = currentTime;
|
17934 | _this.accumulatedTime = _this.accumulatedTime + timeDelta;
|
17935 |
|
17936 | if (_this.accumulatedTime > msPerFrame * 10) {
|
17937 | _this.accumulatedTime = 0;
|
17938 | }
|
17939 |
|
17940 | if (_this.accumulatedTime === 0) {
|
17941 |
|
17942 | _this.animationID = null;
|
17943 | _this.startAnimationIfNecessary();
|
17944 | return;
|
17945 | }
|
17946 |
|
17947 | var currentFrameCompletion = (_this.accumulatedTime - Math.floor(_this.accumulatedTime / msPerFrame) * msPerFrame) / msPerFrame;
|
17948 | var framesToCatchUp = Math.floor(_this.accumulatedTime / msPerFrame);
|
17949 |
|
17950 | var newLastIdealStyle = {};
|
17951 | var newLastIdealVelocity = {};
|
17952 | var newCurrentStyle = {};
|
17953 | var newCurrentVelocity = {};
|
17954 |
|
17955 | for (var key in propsStyle) {
|
17956 | if (!Object.prototype.hasOwnProperty.call(propsStyle, key)) {
|
17957 | continue;
|
17958 | }
|
17959 |
|
17960 | var styleValue = propsStyle[key];
|
17961 | if (typeof styleValue === 'number') {
|
17962 | newCurrentStyle[key] = styleValue;
|
17963 | newCurrentVelocity[key] = 0;
|
17964 | newLastIdealStyle[key] = styleValue;
|
17965 | newLastIdealVelocity[key] = 0;
|
17966 | } else {
|
17967 | var newLastIdealStyleValue = _this.state.lastIdealStyle[key];
|
17968 | var newLastIdealVelocityValue = _this.state.lastIdealVelocity[key];
|
17969 | for (var i = 0; i < framesToCatchUp; i++) {
|
17970 | var _stepper = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
17971 |
|
17972 | newLastIdealStyleValue = _stepper[0];
|
17973 | newLastIdealVelocityValue = _stepper[1];
|
17974 | }
|
17975 |
|
17976 | var _stepper2 = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
17977 |
|
17978 | var nextIdealX = _stepper2[0];
|
17979 | var nextIdealV = _stepper2[1];
|
17980 |
|
17981 | newCurrentStyle[key] = newLastIdealStyleValue + (nextIdealX - newLastIdealStyleValue) * currentFrameCompletion;
|
17982 | newCurrentVelocity[key] = newLastIdealVelocityValue + (nextIdealV - newLastIdealVelocityValue) * currentFrameCompletion;
|
17983 | newLastIdealStyle[key] = newLastIdealStyleValue;
|
17984 | newLastIdealVelocity[key] = newLastIdealVelocityValue;
|
17985 | }
|
17986 | }
|
17987 |
|
17988 | _this.animationID = null;
|
17989 |
|
17990 | _this.accumulatedTime -= framesToCatchUp * msPerFrame;
|
17991 |
|
17992 | _this.setState({
|
17993 | currentStyle: newCurrentStyle,
|
17994 | currentVelocity: newCurrentVelocity,
|
17995 | lastIdealStyle: newLastIdealStyle,
|
17996 | lastIdealVelocity: newLastIdealVelocity
|
17997 | });
|
17998 |
|
17999 | _this.unreadPropStyle = null;
|
18000 |
|
18001 | _this.startAnimationIfNecessary();
|
18002 | });
|
18003 | };
|
18004 |
|
18005 | this.state = this.defaultState();
|
18006 | }
|
18007 |
|
18008 | Motion.prototype.defaultState = function defaultState() {
|
18009 | var _props = this.props;
|
18010 | var defaultStyle = _props.defaultStyle;
|
18011 | var style = _props.style;
|
18012 |
|
18013 | var currentStyle = defaultStyle || _stripStyle2['default'](style);
|
18014 | var currentVelocity = _mapToZero2['default'](currentStyle);
|
18015 | return {
|
18016 | currentStyle: currentStyle,
|
18017 | currentVelocity: currentVelocity,
|
18018 | lastIdealStyle: currentStyle,
|
18019 | lastIdealVelocity: currentVelocity
|
18020 | };
|
18021 | };
|
18022 |
|
18023 |
|
18024 |
|
18025 |
|
18026 |
|
18027 |
|
18028 |
|
18029 | Motion.prototype.componentDidMount = function componentDidMount() {
|
18030 | this.prevTime = _performanceNow2['default']();
|
18031 | this.startAnimationIfNecessary();
|
18032 | };
|
18033 |
|
18034 | Motion.prototype.componentWillReceiveProps = function componentWillReceiveProps(props) {
|
18035 | if (this.unreadPropStyle != null) {
|
18036 |
|
18037 | this.clearUnreadPropStyle(this.unreadPropStyle);
|
18038 | }
|
18039 |
|
18040 | this.unreadPropStyle = props.style;
|
18041 | if (this.animationID == null) {
|
18042 | this.prevTime = _performanceNow2['default']();
|
18043 | this.startAnimationIfNecessary();
|
18044 | }
|
18045 | };
|
18046 |
|
18047 | Motion.prototype.componentWillUnmount = function componentWillUnmount() {
|
18048 | if (this.animationID != null) {
|
18049 | _raf2['default'].cancel(this.animationID);
|
18050 | this.animationID = null;
|
18051 | }
|
18052 | };
|
18053 |
|
18054 | Motion.prototype.render = function render() {
|
18055 | var renderedChildren = this.props.children(this.state.currentStyle);
|
18056 | return renderedChildren && _react2['default'].Children.only(renderedChildren);
|
18057 | };
|
18058 |
|
18059 | return Motion;
|
18060 | })(_react2['default'].Component);
|
18061 |
|
18062 | exports['default'] = Motion;
|
18063 | module.exports = exports['default'];
|
18064 |
|
18065 |
|
18066 |
|
18067 |
|
18068 |
|
18069 | }),
|
18070 |
|
18071 | (function(module, exports) {
|
18072 |
|
18073 |
|
18074 |
|
18075 |
|
18076 | 'use strict';
|
18077 |
|
18078 | exports.__esModule = true;
|
18079 | exports['default'] = mapToZero;
|
18080 |
|
18081 | function mapToZero(obj) {
|
18082 | var ret = {};
|
18083 | for (var key in obj) {
|
18084 | if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
18085 | ret[key] = 0;
|
18086 | }
|
18087 | }
|
18088 | return ret;
|
18089 | }
|
18090 |
|
18091 | module.exports = exports['default'];
|
18092 |
|
18093 | }),
|
18094 |
|
18095 | (function(module, exports) {
|
18096 |
|
18097 |
|
18098 |
|
18099 |
|
18100 |
|
18101 | 'use strict';
|
18102 |
|
18103 | exports.__esModule = true;
|
18104 | exports['default'] = stripStyle;
|
18105 |
|
18106 | function stripStyle(style) {
|
18107 | var ret = {};
|
18108 | for (var key in style) {
|
18109 | if (!Object.prototype.hasOwnProperty.call(style, key)) {
|
18110 | continue;
|
18111 | }
|
18112 | ret[key] = typeof style[key] === 'number' ? style[key] : style[key].val;
|
18113 | }
|
18114 | return ret;
|
18115 | }
|
18116 |
|
18117 | module.exports = exports['default'];
|
18118 |
|
18119 | }),
|
18120 |
|
18121 | (function(module, exports) {
|
18122 |
|
18123 |
|
18124 |
|
18125 |
|
18126 |
|
18127 |
|
18128 | "use strict";
|
18129 |
|
18130 | exports.__esModule = true;
|
18131 | exports["default"] = stepper;
|
18132 |
|
18133 | var reusedTuple = [0, 0];
|
18134 |
|
18135 | function stepper(secondPerFrame, x, v, destX, k, b, precision) {
|
18136 |
|
18137 |
|
18138 |
|
18139 |
|
18140 | var Fspring = -k * (x - destX);
|
18141 |
|
18142 |
|
18143 | var Fdamper = -b * v;
|
18144 |
|
18145 |
|
18146 |
|
18147 |
|
18148 | var a = Fspring + Fdamper;
|
18149 |
|
18150 | var newV = v + a * secondPerFrame;
|
18151 | var newX = x + newV * secondPerFrame;
|
18152 |
|
18153 | if (Math.abs(newV) < precision && Math.abs(newX - destX) < precision) {
|
18154 | reusedTuple[0] = destX;
|
18155 | reusedTuple[1] = 0;
|
18156 | return reusedTuple;
|
18157 | }
|
18158 |
|
18159 | reusedTuple[0] = newX;
|
18160 | reusedTuple[1] = newV;
|
18161 | return reusedTuple;
|
18162 | }
|
18163 |
|
18164 | module.exports = exports["default"];
|
18165 |
|
18166 |
|
18167 | }),
|
18168 |
|
18169 | (function(module, exports, __webpack_require__) {
|
18170 |
|
18171 | (function(process) {
|
18172 | (function() {
|
18173 | var getNanoSeconds, hrtime, loadTime;
|
18174 |
|
18175 | if ((typeof performance !== "undefined" && performance !== null) && performance.now) {
|
18176 | module.exports = function() {
|
18177 | return performance.now();
|
18178 | };
|
18179 | } else if ((typeof process !== "undefined" && process !== null) && process.hrtime) {
|
18180 | module.exports = function() {
|
18181 | return (getNanoSeconds() - loadTime) / 1e6;
|
18182 | };
|
18183 | hrtime = process.hrtime;
|
18184 | getNanoSeconds = function() {
|
18185 | var hr;
|
18186 | hr = hrtime();
|
18187 | return hr[0] * 1e9 + hr[1];
|
18188 | };
|
18189 | loadTime = getNanoSeconds();
|
18190 | } else if (Date.now) {
|
18191 | module.exports = function() {
|
18192 | return Date.now() - loadTime;
|
18193 | };
|
18194 | loadTime = Date.now();
|
18195 | } else {
|
18196 | module.exports = function() {
|
18197 | return new Date().getTime() - loadTime;
|
18198 | };
|
18199 | loadTime = new Date().getTime();
|
18200 | }
|
18201 |
|
18202 | }).call(this);
|
18203 |
|
18204 | }.call(exports, __webpack_require__(32)))
|
18205 |
|
18206 | }),
|
18207 |
|
18208 | (function(module, exports, __webpack_require__) {
|
18209 |
|
18210 | (function(global) {var now = __webpack_require__(173)
|
18211 | , root = typeof window === 'undefined' ? global : window
|
18212 | , vendors = ['moz', 'webkit']
|
18213 | , suffix = 'AnimationFrame'
|
18214 | , raf = root['request' + suffix]
|
18215 | , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]
|
18216 |
|
18217 | for(var i = 0; !raf && i < vendors.length; i++) {
|
18218 | raf = root[vendors[i] + 'Request' + suffix]
|
18219 | caf = root[vendors[i] + 'Cancel' + suffix]
|
18220 | || root[vendors[i] + 'CancelRequest' + suffix]
|
18221 | }
|
18222 |
|
18223 |
|
18224 | if(!raf || !caf) {
|
18225 | var last = 0
|
18226 | , id = 0
|
18227 | , queue = []
|
18228 | , frameDuration = 1000 / 60
|
18229 |
|
18230 | raf = function(callback) {
|
18231 | if(queue.length === 0) {
|
18232 | var _now = now()
|
18233 | , next = Math.max(0, frameDuration - (_now - last))
|
18234 | last = next + _now
|
18235 | setTimeout(function() {
|
18236 | var cp = queue.slice(0)
|
18237 |
|
18238 |
|
18239 |
|
18240 | queue.length = 0
|
18241 | for(var i = 0; i < cp.length; i++) {
|
18242 | if(!cp[i].cancelled) {
|
18243 | try{
|
18244 | cp[i].callback(last)
|
18245 | } catch(e) {
|
18246 | setTimeout(function() { throw e }, 0)
|
18247 | }
|
18248 | }
|
18249 | }
|
18250 | }, Math.round(next))
|
18251 | }
|
18252 | queue.push({
|
18253 | handle: ++id,
|
18254 | callback: callback,
|
18255 | cancelled: false
|
18256 | })
|
18257 | return id
|
18258 | }
|
18259 |
|
18260 | caf = function(handle) {
|
18261 | for(var i = 0; i < queue.length; i++) {
|
18262 | if(queue[i].handle === handle) {
|
18263 | queue[i].cancelled = true
|
18264 | }
|
18265 | }
|
18266 | }
|
18267 | }
|
18268 |
|
18269 | module.exports = function(fn) {
|
18270 |
|
18271 |
|
18272 |
|
18273 | return raf.call(root, fn)
|
18274 | }
|
18275 | module.exports.cancel = function() {
|
18276 | caf.apply(root, arguments)
|
18277 | }
|
18278 | module.exports.polyfill = function(object) {
|
18279 | if (!object) {
|
18280 | object = root;
|
18281 | }
|
18282 | object.requestAnimationFrame = raf
|
18283 | object.cancelAnimationFrame = caf
|
18284 | }
|
18285 |
|
18286 | }.call(exports, (function() { return this; }())))
|
18287 |
|
18288 | }),
|
18289 |
|
18290 | (function(module, exports) {
|
18291 |
|
18292 |
|
18293 |
|
18294 |
|
18295 |
|
18296 | 'use strict';
|
18297 |
|
18298 | exports.__esModule = true;
|
18299 | exports['default'] = shouldStopAnimation;
|
18300 |
|
18301 | function shouldStopAnimation(currentStyle, style, currentVelocity) {
|
18302 | for (var key in style) {
|
18303 | if (!Object.prototype.hasOwnProperty.call(style, key)) {
|
18304 | continue;
|
18305 | }
|
18306 |
|
18307 | if (currentVelocity[key] !== 0) {
|
18308 | return false;
|
18309 | }
|
18310 |
|
18311 | var styleValue = typeof style[key] === 'number' ? style[key] : style[key].val;
|
18312 |
|
18313 |
|
18314 | if (currentStyle[key] !== styleValue) {
|
18315 | return false;
|
18316 | }
|
18317 | }
|
18318 |
|
18319 | return true;
|
18320 | }
|
18321 |
|
18322 | module.exports = exports['default'];
|
18323 |
|
18324 | }),
|
18325 |
|
18326 | (function(module, exports, __webpack_require__) {
|
18327 |
|
18328 | 'use strict';
|
18329 |
|
18330 | exports.__esModule = true;
|
18331 |
|
18332 | 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; };
|
18333 |
|
18334 | 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; }; })();
|
18335 |
|
18336 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18337 |
|
18338 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
18339 |
|
18340 | 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; }
|
18341 |
|
18342 | var _mapToZero = __webpack_require__(170);
|
18343 |
|
18344 | var _mapToZero2 = _interopRequireDefault(_mapToZero);
|
18345 |
|
18346 | var _stripStyle = __webpack_require__(171);
|
18347 |
|
18348 | var _stripStyle2 = _interopRequireDefault(_stripStyle);
|
18349 |
|
18350 | var _stepper3 = __webpack_require__(172);
|
18351 |
|
18352 | var _stepper4 = _interopRequireDefault(_stepper3);
|
18353 |
|
18354 | var _performanceNow = __webpack_require__(173);
|
18355 |
|
18356 | var _performanceNow2 = _interopRequireDefault(_performanceNow);
|
18357 |
|
18358 | var _raf = __webpack_require__(174);
|
18359 |
|
18360 | var _raf2 = _interopRequireDefault(_raf);
|
18361 |
|
18362 | var _shouldStopAnimation = __webpack_require__(175);
|
18363 |
|
18364 | var _shouldStopAnimation2 = _interopRequireDefault(_shouldStopAnimation);
|
18365 |
|
18366 | var _react = __webpack_require__(4);
|
18367 |
|
18368 | var _react2 = _interopRequireDefault(_react);
|
18369 |
|
18370 | var _propTypes = __webpack_require__(5);
|
18371 |
|
18372 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
18373 |
|
18374 | var msPerFrame = 1000 / 60;
|
18375 |
|
18376 | function shouldStopAnimationAll(currentStyles, styles, currentVelocities) {
|
18377 | for (var i = 0; i < currentStyles.length; i++) {
|
18378 | if (!_shouldStopAnimation2['default'](currentStyles[i], styles[i], currentVelocities[i])) {
|
18379 | return false;
|
18380 | }
|
18381 | }
|
18382 | return true;
|
18383 | }
|
18384 |
|
18385 | var StaggeredMotion = (function (_React$Component) {
|
18386 | _inherits(StaggeredMotion, _React$Component);
|
18387 |
|
18388 | _createClass(StaggeredMotion, null, [{
|
18389 | key: 'propTypes',
|
18390 | value: {
|
18391 |
|
18392 | defaultStyles: _propTypes2['default'].arrayOf(_propTypes2['default'].objectOf(_propTypes2['default'].number)),
|
18393 | styles: _propTypes2['default'].func.isRequired,
|
18394 | children: _propTypes2['default'].func.isRequired
|
18395 | },
|
18396 | enumerable: true
|
18397 | }]);
|
18398 |
|
18399 | function StaggeredMotion(props) {
|
18400 | var _this = this;
|
18401 |
|
18402 | _classCallCheck(this, StaggeredMotion);
|
18403 |
|
18404 | _React$Component.call(this, props);
|
18405 | this.animationID = null;
|
18406 | this.prevTime = 0;
|
18407 | this.accumulatedTime = 0;
|
18408 | this.unreadPropStyles = null;
|
18409 |
|
18410 | this.clearUnreadPropStyle = function (unreadPropStyles) {
|
18411 | var _state = _this.state;
|
18412 | var currentStyles = _state.currentStyles;
|
18413 | var currentVelocities = _state.currentVelocities;
|
18414 | var lastIdealStyles = _state.lastIdealStyles;
|
18415 | var lastIdealVelocities = _state.lastIdealVelocities;
|
18416 |
|
18417 | var someDirty = false;
|
18418 | for (var i = 0; i < unreadPropStyles.length; i++) {
|
18419 | var unreadPropStyle = unreadPropStyles[i];
|
18420 | var dirty = false;
|
18421 |
|
18422 | for (var key in unreadPropStyle) {
|
18423 | if (!Object.prototype.hasOwnProperty.call(unreadPropStyle, key)) {
|
18424 | continue;
|
18425 | }
|
18426 |
|
18427 | var styleValue = unreadPropStyle[key];
|
18428 | if (typeof styleValue === 'number') {
|
18429 | if (!dirty) {
|
18430 | dirty = true;
|
18431 | someDirty = true;
|
18432 | currentStyles[i] = _extends({}, currentStyles[i]);
|
18433 | currentVelocities[i] = _extends({}, currentVelocities[i]);
|
18434 | lastIdealStyles[i] = _extends({}, lastIdealStyles[i]);
|
18435 | lastIdealVelocities[i] = _extends({}, lastIdealVelocities[i]);
|
18436 | }
|
18437 | currentStyles[i][key] = styleValue;
|
18438 | currentVelocities[i][key] = 0;
|
18439 | lastIdealStyles[i][key] = styleValue;
|
18440 | lastIdealVelocities[i][key] = 0;
|
18441 | }
|
18442 | }
|
18443 | }
|
18444 |
|
18445 | if (someDirty) {
|
18446 | _this.setState({ currentStyles: currentStyles, currentVelocities: currentVelocities, lastIdealStyles: lastIdealStyles, lastIdealVelocities: lastIdealVelocities });
|
18447 | }
|
18448 | };
|
18449 |
|
18450 | this.startAnimationIfNecessary = function () {
|
18451 |
|
18452 |
|
18453 | _this.animationID = _raf2['default'](function (timestamp) {
|
18454 | var destStyles = _this.props.styles(_this.state.lastIdealStyles);
|
18455 |
|
18456 |
|
18457 | if (shouldStopAnimationAll(_this.state.currentStyles, destStyles, _this.state.currentVelocities)) {
|
18458 |
|
18459 | _this.animationID = null;
|
18460 | _this.accumulatedTime = 0;
|
18461 | return;
|
18462 | }
|
18463 |
|
18464 | var currentTime = timestamp || _performanceNow2['default']();
|
18465 | var timeDelta = currentTime - _this.prevTime;
|
18466 | _this.prevTime = currentTime;
|
18467 | _this.accumulatedTime = _this.accumulatedTime + timeDelta;
|
18468 |
|
18469 | if (_this.accumulatedTime > msPerFrame * 10) {
|
18470 | _this.accumulatedTime = 0;
|
18471 | }
|
18472 |
|
18473 | if (_this.accumulatedTime === 0) {
|
18474 |
|
18475 | _this.animationID = null;
|
18476 | _this.startAnimationIfNecessary();
|
18477 | return;
|
18478 | }
|
18479 |
|
18480 | var currentFrameCompletion = (_this.accumulatedTime - Math.floor(_this.accumulatedTime / msPerFrame) * msPerFrame) / msPerFrame;
|
18481 | var framesToCatchUp = Math.floor(_this.accumulatedTime / msPerFrame);
|
18482 |
|
18483 | var newLastIdealStyles = [];
|
18484 | var newLastIdealVelocities = [];
|
18485 | var newCurrentStyles = [];
|
18486 | var newCurrentVelocities = [];
|
18487 |
|
18488 | for (var i = 0; i < destStyles.length; i++) {
|
18489 | var destStyle = destStyles[i];
|
18490 | var newCurrentStyle = {};
|
18491 | var newCurrentVelocity = {};
|
18492 | var newLastIdealStyle = {};
|
18493 | var newLastIdealVelocity = {};
|
18494 |
|
18495 | for (var key in destStyle) {
|
18496 | if (!Object.prototype.hasOwnProperty.call(destStyle, key)) {
|
18497 | continue;
|
18498 | }
|
18499 |
|
18500 | var styleValue = destStyle[key];
|
18501 | if (typeof styleValue === 'number') {
|
18502 | newCurrentStyle[key] = styleValue;
|
18503 | newCurrentVelocity[key] = 0;
|
18504 | newLastIdealStyle[key] = styleValue;
|
18505 | newLastIdealVelocity[key] = 0;
|
18506 | } else {
|
18507 | var newLastIdealStyleValue = _this.state.lastIdealStyles[i][key];
|
18508 | var newLastIdealVelocityValue = _this.state.lastIdealVelocities[i][key];
|
18509 | for (var j = 0; j < framesToCatchUp; j++) {
|
18510 | var _stepper = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
18511 |
|
18512 | newLastIdealStyleValue = _stepper[0];
|
18513 | newLastIdealVelocityValue = _stepper[1];
|
18514 | }
|
18515 |
|
18516 | var _stepper2 = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
18517 |
|
18518 | var nextIdealX = _stepper2[0];
|
18519 | var nextIdealV = _stepper2[1];
|
18520 |
|
18521 | newCurrentStyle[key] = newLastIdealStyleValue + (nextIdealX - newLastIdealStyleValue) * currentFrameCompletion;
|
18522 | newCurrentVelocity[key] = newLastIdealVelocityValue + (nextIdealV - newLastIdealVelocityValue) * currentFrameCompletion;
|
18523 | newLastIdealStyle[key] = newLastIdealStyleValue;
|
18524 | newLastIdealVelocity[key] = newLastIdealVelocityValue;
|
18525 | }
|
18526 | }
|
18527 |
|
18528 | newCurrentStyles[i] = newCurrentStyle;
|
18529 | newCurrentVelocities[i] = newCurrentVelocity;
|
18530 | newLastIdealStyles[i] = newLastIdealStyle;
|
18531 | newLastIdealVelocities[i] = newLastIdealVelocity;
|
18532 | }
|
18533 |
|
18534 | _this.animationID = null;
|
18535 |
|
18536 | _this.accumulatedTime -= framesToCatchUp * msPerFrame;
|
18537 |
|
18538 | _this.setState({
|
18539 | currentStyles: newCurrentStyles,
|
18540 | currentVelocities: newCurrentVelocities,
|
18541 | lastIdealStyles: newLastIdealStyles,
|
18542 | lastIdealVelocities: newLastIdealVelocities
|
18543 | });
|
18544 |
|
18545 | _this.unreadPropStyles = null;
|
18546 |
|
18547 | _this.startAnimationIfNecessary();
|
18548 | });
|
18549 | };
|
18550 |
|
18551 | this.state = this.defaultState();
|
18552 | }
|
18553 |
|
18554 | StaggeredMotion.prototype.defaultState = function defaultState() {
|
18555 | var _props = this.props;
|
18556 | var defaultStyles = _props.defaultStyles;
|
18557 | var styles = _props.styles;
|
18558 |
|
18559 | var currentStyles = defaultStyles || styles().map(_stripStyle2['default']);
|
18560 | var currentVelocities = currentStyles.map(function (currentStyle) {
|
18561 | return _mapToZero2['default'](currentStyle);
|
18562 | });
|
18563 | return {
|
18564 | currentStyles: currentStyles,
|
18565 | currentVelocities: currentVelocities,
|
18566 | lastIdealStyles: currentStyles,
|
18567 | lastIdealVelocities: currentVelocities
|
18568 | };
|
18569 | };
|
18570 |
|
18571 | StaggeredMotion.prototype.componentDidMount = function componentDidMount() {
|
18572 | this.prevTime = _performanceNow2['default']();
|
18573 | this.startAnimationIfNecessary();
|
18574 | };
|
18575 |
|
18576 | StaggeredMotion.prototype.componentWillReceiveProps = function componentWillReceiveProps(props) {
|
18577 | if (this.unreadPropStyles != null) {
|
18578 |
|
18579 | this.clearUnreadPropStyle(this.unreadPropStyles);
|
18580 | }
|
18581 |
|
18582 | this.unreadPropStyles = props.styles(this.state.lastIdealStyles);
|
18583 | if (this.animationID == null) {
|
18584 | this.prevTime = _performanceNow2['default']();
|
18585 | this.startAnimationIfNecessary();
|
18586 | }
|
18587 | };
|
18588 |
|
18589 | StaggeredMotion.prototype.componentWillUnmount = function componentWillUnmount() {
|
18590 | if (this.animationID != null) {
|
18591 | _raf2['default'].cancel(this.animationID);
|
18592 | this.animationID = null;
|
18593 | }
|
18594 | };
|
18595 |
|
18596 | StaggeredMotion.prototype.render = function render() {
|
18597 | var renderedChildren = this.props.children(this.state.currentStyles);
|
18598 | return renderedChildren && _react2['default'].Children.only(renderedChildren);
|
18599 | };
|
18600 |
|
18601 | return StaggeredMotion;
|
18602 | })(_react2['default'].Component);
|
18603 |
|
18604 | exports['default'] = StaggeredMotion;
|
18605 | module.exports = exports['default'];
|
18606 |
|
18607 |
|
18608 |
|
18609 |
|
18610 |
|
18611 |
|
18612 |
|
18613 |
|
18614 |
|
18615 |
|
18616 |
|
18617 | }),
|
18618 |
|
18619 | (function(module, exports, __webpack_require__) {
|
18620 |
|
18621 | 'use strict';
|
18622 |
|
18623 | exports.__esModule = true;
|
18624 |
|
18625 | 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; };
|
18626 |
|
18627 | 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; }; })();
|
18628 |
|
18629 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18630 |
|
18631 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
18632 |
|
18633 | 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; }
|
18634 |
|
18635 | var _mapToZero = __webpack_require__(170);
|
18636 |
|
18637 | var _mapToZero2 = _interopRequireDefault(_mapToZero);
|
18638 |
|
18639 | var _stripStyle = __webpack_require__(171);
|
18640 |
|
18641 | var _stripStyle2 = _interopRequireDefault(_stripStyle);
|
18642 |
|
18643 | var _stepper3 = __webpack_require__(172);
|
18644 |
|
18645 | var _stepper4 = _interopRequireDefault(_stepper3);
|
18646 |
|
18647 | var _mergeDiff = __webpack_require__(178);
|
18648 |
|
18649 | var _mergeDiff2 = _interopRequireDefault(_mergeDiff);
|
18650 |
|
18651 | var _performanceNow = __webpack_require__(173);
|
18652 |
|
18653 | var _performanceNow2 = _interopRequireDefault(_performanceNow);
|
18654 |
|
18655 | var _raf = __webpack_require__(174);
|
18656 |
|
18657 | var _raf2 = _interopRequireDefault(_raf);
|
18658 |
|
18659 | var _shouldStopAnimation = __webpack_require__(175);
|
18660 |
|
18661 | var _shouldStopAnimation2 = _interopRequireDefault(_shouldStopAnimation);
|
18662 |
|
18663 | var _react = __webpack_require__(4);
|
18664 |
|
18665 | var _react2 = _interopRequireDefault(_react);
|
18666 |
|
18667 | var _propTypes = __webpack_require__(5);
|
18668 |
|
18669 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
18670 |
|
18671 | var msPerFrame = 1000 / 60;
|
18672 |
|
18673 |
|
18674 |
|
18675 |
|
18676 |
|
18677 |
|
18678 |
|
18679 |
|
18680 | function rehydrateStyles(mergedPropsStyles, unreadPropStyles, plainStyles) {
|
18681 |
|
18682 |
|
18683 | var cUnreadPropStyles = unreadPropStyles;
|
18684 | if (cUnreadPropStyles == null) {
|
18685 | return mergedPropsStyles.map(function (mergedPropsStyle, i) {
|
18686 | return {
|
18687 | key: mergedPropsStyle.key,
|
18688 | data: mergedPropsStyle.data,
|
18689 | style: plainStyles[i]
|
18690 | };
|
18691 | });
|
18692 | }
|
18693 | return mergedPropsStyles.map(function (mergedPropsStyle, i) {
|
18694 | for (var j = 0; j < cUnreadPropStyles.length; j++) {
|
18695 | if (cUnreadPropStyles[j].key === mergedPropsStyle.key) {
|
18696 | return {
|
18697 | key: cUnreadPropStyles[j].key,
|
18698 | data: cUnreadPropStyles[j].data,
|
18699 | style: plainStyles[i]
|
18700 | };
|
18701 | }
|
18702 | }
|
18703 | return { key: mergedPropsStyle.key, data: mergedPropsStyle.data, style: plainStyles[i] };
|
18704 | });
|
18705 | }
|
18706 |
|
18707 | function shouldStopAnimationAll(currentStyles, destStyles, currentVelocities, mergedPropsStyles) {
|
18708 | if (mergedPropsStyles.length !== destStyles.length) {
|
18709 | return false;
|
18710 | }
|
18711 |
|
18712 | for (var i = 0; i < mergedPropsStyles.length; i++) {
|
18713 | if (mergedPropsStyles[i].key !== destStyles[i].key) {
|
18714 | return false;
|
18715 | }
|
18716 | }
|
18717 |
|
18718 |
|
18719 |
|
18720 |
|
18721 | for (var i = 0; i < mergedPropsStyles.length; i++) {
|
18722 | if (!_shouldStopAnimation2['default'](currentStyles[i], destStyles[i].style, currentVelocities[i])) {
|
18723 | return false;
|
18724 | }
|
18725 | }
|
18726 |
|
18727 | return true;
|
18728 | }
|
18729 |
|
18730 |
|
18731 |
|
18732 |
|
18733 |
|
18734 |
|
18735 |
|
18736 |
|
18737 |
|
18738 |
|
18739 |
|
18740 |
|
18741 |
|
18742 |
|
18743 |
|
18744 |
|
18745 | function mergeAndSync(willEnter, willLeave, didLeave, oldMergedPropsStyles, destStyles, oldCurrentStyles, oldCurrentVelocities, oldLastIdealStyles, oldLastIdealVelocities) {
|
18746 | var newMergedPropsStyles = _mergeDiff2['default'](oldMergedPropsStyles, destStyles, function (oldIndex, oldMergedPropsStyle) {
|
18747 | var leavingStyle = willLeave(oldMergedPropsStyle);
|
18748 | if (leavingStyle == null) {
|
18749 | didLeave({ key: oldMergedPropsStyle.key, data: oldMergedPropsStyle.data });
|
18750 | return null;
|
18751 | }
|
18752 | if (_shouldStopAnimation2['default'](oldCurrentStyles[oldIndex], leavingStyle, oldCurrentVelocities[oldIndex])) {
|
18753 | didLeave({ key: oldMergedPropsStyle.key, data: oldMergedPropsStyle.data });
|
18754 | return null;
|
18755 | }
|
18756 | return { key: oldMergedPropsStyle.key, data: oldMergedPropsStyle.data, style: leavingStyle };
|
18757 | });
|
18758 |
|
18759 | var newCurrentStyles = [];
|
18760 | var newCurrentVelocities = [];
|
18761 | var newLastIdealStyles = [];
|
18762 | var newLastIdealVelocities = [];
|
18763 | for (var i = 0; i < newMergedPropsStyles.length; i++) {
|
18764 | var newMergedPropsStyleCell = newMergedPropsStyles[i];
|
18765 | var foundOldIndex = null;
|
18766 | for (var j = 0; j < oldMergedPropsStyles.length; j++) {
|
18767 | if (oldMergedPropsStyles[j].key === newMergedPropsStyleCell.key) {
|
18768 | foundOldIndex = j;
|
18769 | break;
|
18770 | }
|
18771 | }
|
18772 |
|
18773 | if (foundOldIndex == null) {
|
18774 | var plainStyle = willEnter(newMergedPropsStyleCell);
|
18775 | newCurrentStyles[i] = plainStyle;
|
18776 | newLastIdealStyles[i] = plainStyle;
|
18777 |
|
18778 | var velocity = _mapToZero2['default'](newMergedPropsStyleCell.style);
|
18779 | newCurrentVelocities[i] = velocity;
|
18780 | newLastIdealVelocities[i] = velocity;
|
18781 | } else {
|
18782 | newCurrentStyles[i] = oldCurrentStyles[foundOldIndex];
|
18783 | newLastIdealStyles[i] = oldLastIdealStyles[foundOldIndex];
|
18784 | newCurrentVelocities[i] = oldCurrentVelocities[foundOldIndex];
|
18785 | newLastIdealVelocities[i] = oldLastIdealVelocities[foundOldIndex];
|
18786 | }
|
18787 | }
|
18788 |
|
18789 | return [newMergedPropsStyles, newCurrentStyles, newCurrentVelocities, newLastIdealStyles, newLastIdealVelocities];
|
18790 | }
|
18791 |
|
18792 | var TransitionMotion = (function (_React$Component) {
|
18793 | _inherits(TransitionMotion, _React$Component);
|
18794 |
|
18795 | _createClass(TransitionMotion, null, [{
|
18796 | key: 'propTypes',
|
18797 | value: {
|
18798 | defaultStyles: _propTypes2['default'].arrayOf(_propTypes2['default'].shape({
|
18799 | key: _propTypes2['default'].string.isRequired,
|
18800 | data: _propTypes2['default'].any,
|
18801 | style: _propTypes2['default'].objectOf(_propTypes2['default'].number).isRequired
|
18802 | })),
|
18803 | styles: _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].arrayOf(_propTypes2['default'].shape({
|
18804 | key: _propTypes2['default'].string.isRequired,
|
18805 | data: _propTypes2['default'].any,
|
18806 | style: _propTypes2['default'].objectOf(_propTypes2['default'].oneOfType([_propTypes2['default'].number, _propTypes2['default'].object])).isRequired
|
18807 | }))]).isRequired,
|
18808 | children: _propTypes2['default'].func.isRequired,
|
18809 | willEnter: _propTypes2['default'].func,
|
18810 | willLeave: _propTypes2['default'].func,
|
18811 | didLeave: _propTypes2['default'].func
|
18812 | },
|
18813 | enumerable: true
|
18814 | }, {
|
18815 | key: 'defaultProps',
|
18816 | value: {
|
18817 | willEnter: function willEnter(styleThatEntered) {
|
18818 | return _stripStyle2['default'](styleThatEntered.style);
|
18819 | },
|
18820 |
|
18821 |
|
18822 | willLeave: function willLeave() {
|
18823 | return null;
|
18824 | },
|
18825 | didLeave: function didLeave() {}
|
18826 | },
|
18827 | enumerable: true
|
18828 | }]);
|
18829 |
|
18830 | function TransitionMotion(props) {
|
18831 | var _this = this;
|
18832 |
|
18833 | _classCallCheck(this, TransitionMotion);
|
18834 |
|
18835 | _React$Component.call(this, props);
|
18836 | this.unmounting = false;
|
18837 | this.animationID = null;
|
18838 | this.prevTime = 0;
|
18839 | this.accumulatedTime = 0;
|
18840 | this.unreadPropStyles = null;
|
18841 |
|
18842 | this.clearUnreadPropStyle = function (unreadPropStyles) {
|
18843 | 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);
|
18844 |
|
18845 | var mergedPropsStyles = _mergeAndSync[0];
|
18846 | var currentStyles = _mergeAndSync[1];
|
18847 | var currentVelocities = _mergeAndSync[2];
|
18848 | var lastIdealStyles = _mergeAndSync[3];
|
18849 | var lastIdealVelocities = _mergeAndSync[4];
|
18850 |
|
18851 | for (var i = 0; i < unreadPropStyles.length; i++) {
|
18852 | var unreadPropStyle = unreadPropStyles[i].style;
|
18853 | var dirty = false;
|
18854 |
|
18855 | for (var key in unreadPropStyle) {
|
18856 | if (!Object.prototype.hasOwnProperty.call(unreadPropStyle, key)) {
|
18857 | continue;
|
18858 | }
|
18859 |
|
18860 | var styleValue = unreadPropStyle[key];
|
18861 | if (typeof styleValue === 'number') {
|
18862 | if (!dirty) {
|
18863 | dirty = true;
|
18864 | currentStyles[i] = _extends({}, currentStyles[i]);
|
18865 | currentVelocities[i] = _extends({}, currentVelocities[i]);
|
18866 | lastIdealStyles[i] = _extends({}, lastIdealStyles[i]);
|
18867 | lastIdealVelocities[i] = _extends({}, lastIdealVelocities[i]);
|
18868 | mergedPropsStyles[i] = {
|
18869 | key: mergedPropsStyles[i].key,
|
18870 | data: mergedPropsStyles[i].data,
|
18871 | style: _extends({}, mergedPropsStyles[i].style)
|
18872 | };
|
18873 | }
|
18874 | currentStyles[i][key] = styleValue;
|
18875 | currentVelocities[i][key] = 0;
|
18876 | lastIdealStyles[i][key] = styleValue;
|
18877 | lastIdealVelocities[i][key] = 0;
|
18878 | mergedPropsStyles[i].style[key] = styleValue;
|
18879 | }
|
18880 | }
|
18881 | }
|
18882 |
|
18883 |
|
18884 |
|
18885 |
|
18886 | _this.setState({
|
18887 | currentStyles: currentStyles,
|
18888 | currentVelocities: currentVelocities,
|
18889 | mergedPropsStyles: mergedPropsStyles,
|
18890 | lastIdealStyles: lastIdealStyles,
|
18891 | lastIdealVelocities: lastIdealVelocities
|
18892 | });
|
18893 | };
|
18894 |
|
18895 | this.startAnimationIfNecessary = function () {
|
18896 | if (_this.unmounting) {
|
18897 | return;
|
18898 | }
|
18899 |
|
18900 |
|
18901 |
|
18902 | _this.animationID = _raf2['default'](function (timestamp) {
|
18903 |
|
18904 |
|
18905 |
|
18906 |
|
18907 |
|
18908 | if (_this.unmounting) {
|
18909 | return;
|
18910 | }
|
18911 |
|
18912 | var propStyles = _this.props.styles;
|
18913 | var destStyles = typeof propStyles === 'function' ? propStyles(rehydrateStyles(_this.state.mergedPropsStyles, _this.unreadPropStyles, _this.state.lastIdealStyles)) : propStyles;
|
18914 |
|
18915 |
|
18916 | if (shouldStopAnimationAll(_this.state.currentStyles, destStyles, _this.state.currentVelocities, _this.state.mergedPropsStyles)) {
|
18917 |
|
18918 | _this.animationID = null;
|
18919 | _this.accumulatedTime = 0;
|
18920 | return;
|
18921 | }
|
18922 |
|
18923 | var currentTime = timestamp || _performanceNow2['default']();
|
18924 | var timeDelta = currentTime - _this.prevTime;
|
18925 | _this.prevTime = currentTime;
|
18926 | _this.accumulatedTime = _this.accumulatedTime + timeDelta;
|
18927 |
|
18928 | if (_this.accumulatedTime > msPerFrame * 10) {
|
18929 | _this.accumulatedTime = 0;
|
18930 | }
|
18931 |
|
18932 | if (_this.accumulatedTime === 0) {
|
18933 |
|
18934 | _this.animationID = null;
|
18935 | _this.startAnimationIfNecessary();
|
18936 | return;
|
18937 | }
|
18938 |
|
18939 | var currentFrameCompletion = (_this.accumulatedTime - Math.floor(_this.accumulatedTime / msPerFrame) * msPerFrame) / msPerFrame;
|
18940 | var framesToCatchUp = Math.floor(_this.accumulatedTime / msPerFrame);
|
18941 |
|
18942 | 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);
|
18943 |
|
18944 | var newMergedPropsStyles = _mergeAndSync2[0];
|
18945 | var newCurrentStyles = _mergeAndSync2[1];
|
18946 | var newCurrentVelocities = _mergeAndSync2[2];
|
18947 | var newLastIdealStyles = _mergeAndSync2[3];
|
18948 | var newLastIdealVelocities = _mergeAndSync2[4];
|
18949 |
|
18950 | for (var i = 0; i < newMergedPropsStyles.length; i++) {
|
18951 | var newMergedPropsStyle = newMergedPropsStyles[i].style;
|
18952 | var newCurrentStyle = {};
|
18953 | var newCurrentVelocity = {};
|
18954 | var newLastIdealStyle = {};
|
18955 | var newLastIdealVelocity = {};
|
18956 |
|
18957 | for (var key in newMergedPropsStyle) {
|
18958 | if (!Object.prototype.hasOwnProperty.call(newMergedPropsStyle, key)) {
|
18959 | continue;
|
18960 | }
|
18961 |
|
18962 | var styleValue = newMergedPropsStyle[key];
|
18963 | if (typeof styleValue === 'number') {
|
18964 | newCurrentStyle[key] = styleValue;
|
18965 | newCurrentVelocity[key] = 0;
|
18966 | newLastIdealStyle[key] = styleValue;
|
18967 | newLastIdealVelocity[key] = 0;
|
18968 | } else {
|
18969 | var newLastIdealStyleValue = newLastIdealStyles[i][key];
|
18970 | var newLastIdealVelocityValue = newLastIdealVelocities[i][key];
|
18971 | for (var j = 0; j < framesToCatchUp; j++) {
|
18972 | var _stepper = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
18973 |
|
18974 | newLastIdealStyleValue = _stepper[0];
|
18975 | newLastIdealVelocityValue = _stepper[1];
|
18976 | }
|
18977 |
|
18978 | var _stepper2 = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
18979 |
|
18980 | var nextIdealX = _stepper2[0];
|
18981 | var nextIdealV = _stepper2[1];
|
18982 |
|
18983 | newCurrentStyle[key] = newLastIdealStyleValue + (nextIdealX - newLastIdealStyleValue) * currentFrameCompletion;
|
18984 | newCurrentVelocity[key] = newLastIdealVelocityValue + (nextIdealV - newLastIdealVelocityValue) * currentFrameCompletion;
|
18985 | newLastIdealStyle[key] = newLastIdealStyleValue;
|
18986 | newLastIdealVelocity[key] = newLastIdealVelocityValue;
|
18987 | }
|
18988 | }
|
18989 |
|
18990 | newLastIdealStyles[i] = newLastIdealStyle;
|
18991 | newLastIdealVelocities[i] = newLastIdealVelocity;
|
18992 | newCurrentStyles[i] = newCurrentStyle;
|
18993 | newCurrentVelocities[i] = newCurrentVelocity;
|
18994 | }
|
18995 |
|
18996 | _this.animationID = null;
|
18997 |
|
18998 | _this.accumulatedTime -= framesToCatchUp * msPerFrame;
|
18999 |
|
19000 | _this.setState({
|
19001 | currentStyles: newCurrentStyles,
|
19002 | currentVelocities: newCurrentVelocities,
|
19003 | lastIdealStyles: newLastIdealStyles,
|
19004 | lastIdealVelocities: newLastIdealVelocities,
|
19005 | mergedPropsStyles: newMergedPropsStyles
|
19006 | });
|
19007 |
|
19008 | _this.unreadPropStyles = null;
|
19009 |
|
19010 | _this.startAnimationIfNecessary();
|
19011 | });
|
19012 | };
|
19013 |
|
19014 | this.state = this.defaultState();
|
19015 | }
|
19016 |
|
19017 | TransitionMotion.prototype.defaultState = function defaultState() {
|
19018 | var _props = this.props;
|
19019 | var defaultStyles = _props.defaultStyles;
|
19020 | var styles = _props.styles;
|
19021 | var willEnter = _props.willEnter;
|
19022 | var willLeave = _props.willLeave;
|
19023 | var didLeave = _props.didLeave;
|
19024 |
|
19025 | var destStyles = typeof styles === 'function' ? styles(defaultStyles) : styles;
|
19026 |
|
19027 |
|
19028 |
|
19029 |
|
19030 |
|
19031 | var oldMergedPropsStyles = undefined;
|
19032 | if (defaultStyles == null) {
|
19033 | oldMergedPropsStyles = destStyles;
|
19034 | } else {
|
19035 | oldMergedPropsStyles = defaultStyles.map(function (defaultStyleCell) {
|
19036 |
|
19037 | for (var i = 0; i < destStyles.length; i++) {
|
19038 | if (destStyles[i].key === defaultStyleCell.key) {
|
19039 | return destStyles[i];
|
19040 | }
|
19041 | }
|
19042 | return defaultStyleCell;
|
19043 | });
|
19044 | }
|
19045 | var oldCurrentStyles = defaultStyles == null ? destStyles.map(function (s) {
|
19046 | return _stripStyle2['default'](s.style);
|
19047 | }) : defaultStyles.map(function (s) {
|
19048 | return _stripStyle2['default'](s.style);
|
19049 | });
|
19050 | var oldCurrentVelocities = defaultStyles == null ? destStyles.map(function (s) {
|
19051 | return _mapToZero2['default'](s.style);
|
19052 | }) : defaultStyles.map(function (s) {
|
19053 | return _mapToZero2['default'](s.style);
|
19054 | });
|
19055 |
|
19056 | var _mergeAndSync3 = mergeAndSync(
|
19057 |
|
19058 |
|
19059 |
|
19060 | willEnter, willLeave, didLeave, oldMergedPropsStyles, destStyles, oldCurrentStyles, oldCurrentVelocities, oldCurrentStyles,
|
19061 | oldCurrentVelocities);
|
19062 |
|
19063 | var mergedPropsStyles = _mergeAndSync3[0];
|
19064 | var currentStyles = _mergeAndSync3[1];
|
19065 | var currentVelocities = _mergeAndSync3[2];
|
19066 | var lastIdealStyles = _mergeAndSync3[3];
|
19067 | var lastIdealVelocities = _mergeAndSync3[4];
|
19068 |
|
19069 |
|
19070 | return {
|
19071 | currentStyles: currentStyles,
|
19072 | currentVelocities: currentVelocities,
|
19073 | lastIdealStyles: lastIdealStyles,
|
19074 | lastIdealVelocities: lastIdealVelocities,
|
19075 | mergedPropsStyles: mergedPropsStyles
|
19076 | };
|
19077 | };
|
19078 |
|
19079 |
|
19080 |
|
19081 |
|
19082 |
|
19083 | TransitionMotion.prototype.componentDidMount = function componentDidMount() {
|
19084 | this.prevTime = _performanceNow2['default']();
|
19085 | this.startAnimationIfNecessary();
|
19086 | };
|
19087 |
|
19088 | TransitionMotion.prototype.componentWillReceiveProps = function componentWillReceiveProps(props) {
|
19089 | if (this.unreadPropStyles) {
|
19090 |
|
19091 | this.clearUnreadPropStyle(this.unreadPropStyles);
|
19092 | }
|
19093 |
|
19094 | var styles = props.styles;
|
19095 | if (typeof styles === 'function') {
|
19096 | this.unreadPropStyles = styles(rehydrateStyles(this.state.mergedPropsStyles, this.unreadPropStyles, this.state.lastIdealStyles));
|
19097 | } else {
|
19098 | this.unreadPropStyles = styles;
|
19099 | }
|
19100 |
|
19101 | if (this.animationID == null) {
|
19102 | this.prevTime = _performanceNow2['default']();
|
19103 | this.startAnimationIfNecessary();
|
19104 | }
|
19105 | };
|
19106 |
|
19107 | TransitionMotion.prototype.componentWillUnmount = function componentWillUnmount() {
|
19108 | this.unmounting = true;
|
19109 | if (this.animationID != null) {
|
19110 | _raf2['default'].cancel(this.animationID);
|
19111 | this.animationID = null;
|
19112 | }
|
19113 | };
|
19114 |
|
19115 | TransitionMotion.prototype.render = function render() {
|
19116 | var hydratedStyles = rehydrateStyles(this.state.mergedPropsStyles, this.unreadPropStyles, this.state.currentStyles);
|
19117 | var renderedChildren = this.props.children(hydratedStyles);
|
19118 | return renderedChildren && _react2['default'].Children.only(renderedChildren);
|
19119 | };
|
19120 |
|
19121 | return TransitionMotion;
|
19122 | })(_react2['default'].Component);
|
19123 |
|
19124 | exports['default'] = TransitionMotion;
|
19125 | module.exports = exports['default'];
|
19126 |
|
19127 |
|
19128 |
|
19129 |
|
19130 |
|
19131 |
|
19132 |
|
19133 |
|
19134 |
|
19135 |
|
19136 |
|
19137 |
|
19138 |
|
19139 |
|
19140 |
|
19141 |
|
19142 |
|
19143 |
|
19144 | }),
|
19145 |
|
19146 | (function(module, exports) {
|
19147 |
|
19148 |
|
19149 |
|
19150 |
|
19151 |
|
19152 |
|
19153 |
|
19154 |
|
19155 |
|
19156 |
|
19157 |
|
19158 |
|
19159 |
|
19160 |
|
19161 |
|
19162 |
|
19163 |
|
19164 |
|
19165 |
|
19166 | 'use strict';
|
19167 |
|
19168 | exports.__esModule = true;
|
19169 | exports['default'] = mergeDiff;
|
19170 |
|
19171 | function mergeDiff(prev, next, onRemove) {
|
19172 |
|
19173 |
|
19174 |
|
19175 | var prevKeyIndex = {};
|
19176 | for (var i = 0; i < prev.length; i++) {
|
19177 | prevKeyIndex[prev[i].key] = i;
|
19178 | }
|
19179 | var nextKeyIndex = {};
|
19180 | for (var i = 0; i < next.length; i++) {
|
19181 | nextKeyIndex[next[i].key] = i;
|
19182 | }
|
19183 |
|
19184 |
|
19185 |
|
19186 |
|
19187 | var ret = [];
|
19188 | for (var i = 0; i < next.length; i++) {
|
19189 | ret[i] = next[i];
|
19190 | }
|
19191 | for (var i = 0; i < prev.length; i++) {
|
19192 | if (!Object.prototype.hasOwnProperty.call(nextKeyIndex, prev[i].key)) {
|
19193 |
|
19194 |
|
19195 | var fill = onRemove(i, prev[i]);
|
19196 | if (fill != null) {
|
19197 | ret.push(fill);
|
19198 | }
|
19199 | }
|
19200 | }
|
19201 |
|
19202 |
|
19203 | return ret.sort(function (a, b) {
|
19204 | var nextOrderA = nextKeyIndex[a.key];
|
19205 | var nextOrderB = nextKeyIndex[b.key];
|
19206 | var prevOrderA = prevKeyIndex[a.key];
|
19207 | var prevOrderB = prevKeyIndex[b.key];
|
19208 |
|
19209 | if (nextOrderA != null && nextOrderB != null) {
|
19210 |
|
19211 | return nextKeyIndex[a.key] - nextKeyIndex[b.key];
|
19212 | } else if (prevOrderA != null && prevOrderB != null) {
|
19213 |
|
19214 | return prevKeyIndex[a.key] - prevKeyIndex[b.key];
|
19215 | } else if (nextOrderA != null) {
|
19216 |
|
19217 |
|
19218 |
|
19219 |
|
19220 |
|
19221 |
|
19222 | for (var i = 0; i < next.length; i++) {
|
19223 | var pivot = next[i].key;
|
19224 | if (!Object.prototype.hasOwnProperty.call(prevKeyIndex, pivot)) {
|
19225 | continue;
|
19226 | }
|
19227 |
|
19228 | if (nextOrderA < nextKeyIndex[pivot] && prevOrderB > prevKeyIndex[pivot]) {
|
19229 | return -1;
|
19230 | } else if (nextOrderA > nextKeyIndex[pivot] && prevOrderB < prevKeyIndex[pivot]) {
|
19231 | return 1;
|
19232 | }
|
19233 | }
|
19234 |
|
19235 | return 1;
|
19236 | }
|
19237 |
|
19238 | for (var i = 0; i < next.length; i++) {
|
19239 | var pivot = next[i].key;
|
19240 | if (!Object.prototype.hasOwnProperty.call(prevKeyIndex, pivot)) {
|
19241 | continue;
|
19242 | }
|
19243 | if (nextOrderB < nextKeyIndex[pivot] && prevOrderA > prevKeyIndex[pivot]) {
|
19244 | return 1;
|
19245 | } else if (nextOrderB > nextKeyIndex[pivot] && prevOrderA < prevKeyIndex[pivot]) {
|
19246 | return -1;
|
19247 | }
|
19248 | }
|
19249 |
|
19250 | return -1;
|
19251 | });
|
19252 | }
|
19253 |
|
19254 | module.exports = exports['default'];
|
19255 |
|
19256 |
|
19257 | }),
|
19258 |
|
19259 | (function(module, exports, __webpack_require__) {
|
19260 |
|
19261 | 'use strict';
|
19262 |
|
19263 | exports.__esModule = true;
|
19264 |
|
19265 | 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; };
|
19266 |
|
19267 | exports['default'] = spring;
|
19268 |
|
19269 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19270 |
|
19271 | var _presets = __webpack_require__(180);
|
19272 |
|
19273 | var _presets2 = _interopRequireDefault(_presets);
|
19274 |
|
19275 | var defaultConfig = _extends({}, _presets2['default'].noWobble, {
|
19276 | precision: 0.01
|
19277 | });
|
19278 |
|
19279 | function spring(val, config) {
|
19280 | return _extends({}, defaultConfig, config, { val: val });
|
19281 | }
|
19282 |
|
19283 | module.exports = exports['default'];
|
19284 |
|
19285 | }),
|
19286 |
|
19287 | (function(module, exports) {
|
19288 |
|
19289 | "use strict";
|
19290 |
|
19291 | exports.__esModule = true;
|
19292 | exports["default"] = {
|
19293 | noWobble: { stiffness: 170, damping: 26 },
|
19294 | gentle: { stiffness: 120, damping: 14 },
|
19295 | wobbly: { stiffness: 180, damping: 12 },
|
19296 | stiff: { stiffness: 210, damping: 20 }
|
19297 | };
|
19298 | module.exports = exports["default"];
|
19299 |
|
19300 | }),
|
19301 |
|
19302 | (function(module, exports, __webpack_require__) {
|
19303 |
|
19304 | (function(process) {'use strict';
|
19305 |
|
19306 | exports.__esModule = true;
|
19307 | exports['default'] = reorderKeys;
|
19308 |
|
19309 | var hasWarned = false;
|
19310 |
|
19311 | function reorderKeys() {
|
19312 | if (process.env.NODE_ENV === 'development') {
|
19313 | if (!hasWarned) {
|
19314 | hasWarned = true;
|
19315 | console.error('`reorderKeys` has been removed, since it is no longer needed for TransitionMotion\'s new styles array API.');
|
19316 | }
|
19317 | }
|
19318 | }
|
19319 |
|
19320 | module.exports = exports['default'];
|
19321 | }.call(exports, __webpack_require__(32)))
|
19322 |
|
19323 | }),
|
19324 |
|
19325 | (function(module, exports, __webpack_require__) {
|
19326 |
|
19327 | (function webpackUniversalModuleDefinition(root, factory) {
|
19328 | if(true)
|
19329 | module.exports = factory(__webpack_require__(12), __webpack_require__(4));
|
19330 | else if(typeof define === 'function' && define.amd)
|
19331 | define(["react-dom", "react"], factory);
|
19332 | else if(typeof exports === 'object')
|
19333 | exports["ReactDraggable"] = factory(require("react-dom"), require("react"));
|
19334 | else
|
19335 | root["ReactDraggable"] = factory(root["ReactDOM"], root["React"]);
|
19336 | })(this, function(__WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_6__) {
|
19337 | return (function(modules) {
|
19338 |
|
19339 | var installedModules = {};
|
19340 |
|
19341 |
|
19342 | function __webpack_require__(moduleId) {
|
19343 |
|
19344 |
|
19345 | if(installedModules[moduleId]) {
|
19346 | return installedModules[moduleId].exports;
|
19347 | }
|
19348 |
|
19349 | var module = installedModules[moduleId] = {
|
19350 | i: moduleId,
|
19351 | l: false,
|
19352 | exports: {}
|
19353 | };
|
19354 |
|
19355 |
|
19356 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
19357 |
|
19358 |
|
19359 | module.l = true;
|
19360 |
|
19361 |
|
19362 | return module.exports;
|
19363 | }
|
19364 |
|
19365 |
|
19366 |
|
19367 | __webpack_require__.m = modules;
|
19368 |
|
19369 |
|
19370 | __webpack_require__.c = installedModules;
|
19371 |
|
19372 |
|
19373 | __webpack_require__.d = function(exports, name, getter) {
|
19374 | if(!__webpack_require__.o(exports, name)) {
|
19375 | Object.defineProperty(exports, name, {
|
19376 | configurable: false,
|
19377 | enumerable: true,
|
19378 | get: getter
|
19379 | /******/ });
|
19380 | /******/ }
|
19381 | /******/ };
|
19382 | /******/
|
19383 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
19384 | /******/ __webpack_require__.n = function(module) {
|
19385 | var getter = module && module.__esModule ?
|
19386 | function getDefault() { return module['default']; } :
|
19387 | function getModuleExports() { return module; };
|
19388 | __webpack_require__.d(getter, 'a', getter);
|
19389 | return getter;
|
19390 | };
|
19391 |
|
19392 |
|
19393 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
19394 |
|
19395 |
|
19396 | __webpack_require__.p = "";
|
19397 |
|
19398 |
|
19399 | return __webpack_require__(__webpack_require__.s = 12);
|
19400 | })
|
19401 |
|
19402 | ([
|
19403 |
|
19404 | (function(module, exports, __webpack_require__) {
|
19405 |
|
19406 | "use strict";
|
19407 |
|
19408 |
|
19409 | Object.defineProperty(exports, "__esModule", {
|
19410 | value: true
|
19411 | });
|
19412 | exports.findInArray = findInArray;
|
19413 | exports.isFunction = isFunction;
|
19414 | exports.isNum = isNum;
|
19415 | exports.int = int;
|
19416 | exports.dontSetMe = dontSetMe;
|
19417 |
|
19418 |
|
19419 | function findInArray(array /*: Array<any> | TouchList*/, callback /*: Function*/) /*: any*/ {
|
19420 | for (var i = 0, length = array.length; i < length; i++) {
|
19421 | if (callback.apply(callback, [array[i], i, array])) return array[i];
|
19422 | }
|
19423 | }
|
19424 |
|
19425 | function isFunction(func /*: any*/) /*: boolean*/ {
|
19426 | return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';
|
19427 | }
|
19428 |
|
19429 | function isNum(num /*: any*/) /*: boolean*/ {
|
19430 | return typeof num === 'number' && !isNaN(num);
|
19431 | }
|
19432 |
|
19433 | function int(a /*: string*/) /*: number*/ {
|
19434 | return parseInt(a, 10);
|
19435 | }
|
19436 |
|
19437 | function dontSetMe(props /*: Object*/, propName /*: string*/, componentName /*: string*/) {
|
19438 | if (props[propName]) {
|
19439 | return new Error('Invalid prop ' + propName + ' passed to ' + componentName + ' - do not set this, set it on the child.');
|
19440 | }
|
19441 | }
|
19442 |
|
19443 | }),
|
19444 |
|
19445 | (function(module, exports, __webpack_require__) {
|
19446 |
|
19447 | "use strict";
|
19448 |
|
19449 |
|
19450 | |
19451 |
|
19452 |
|
19453 |
|
19454 |
|
19455 |
|
19456 |
|
19457 |
|
19458 |
|
19459 | function makeEmptyFunction(arg) {
|
19460 | return function () {
|
19461 | return arg;
|
19462 | };
|
19463 | }
|
19464 |
|
19465 | |
19466 |
|
19467 |
|
19468 |
|
19469 |
|
19470 | var emptyFunction = function emptyFunction() {};
|
19471 |
|
19472 | emptyFunction.thatReturns = makeEmptyFunction;
|
19473 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
19474 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
19475 | emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
19476 | emptyFunction.thatReturnsThis = function () {
|
19477 | return this;
|
19478 | };
|
19479 | emptyFunction.thatReturnsArgument = function (arg) {
|
19480 | return arg;
|
19481 | };
|
19482 |
|
19483 | module.exports = emptyFunction;
|
19484 |
|
19485 | }),
|
19486 |
|
19487 | (function(module, exports, __webpack_require__) {
|
19488 |
|
19489 | "use strict";
|
19490 | |
19491 |
|
19492 |
|
19493 |
|
19494 |
|
19495 |
|
19496 |
|
19497 |
|
19498 |
|
19499 |
|
19500 | |
19501 |
|
19502 |
|
19503 |
|
19504 |
|
19505 |
|
19506 |
|
19507 |
|
19508 |
|
19509 |
|
19510 |
|
19511 | var validateFormat = function validateFormat(format) {};
|
19512 |
|
19513 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
19514 | validateFormat = function validateFormat(format) {
|
19515 | if (format === undefined) {
|
19516 | throw new Error('invariant requires an error message argument');
|
19517 | }
|
19518 | };
|
19519 | }
|
19520 |
|
19521 | function invariant(condition, format, a, b, c, d, e, f) {
|
19522 | validateFormat(format);
|
19523 |
|
19524 | if (!condition) {
|
19525 | var error;
|
19526 | if (format === undefined) {
|
19527 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
19528 | } else {
|
19529 | var args = [a, b, c, d, e, f];
|
19530 | var argIndex = 0;
|
19531 | error = new Error(format.replace(/%s/g, function () {
|
19532 | return args[argIndex++];
|
19533 | }));
|
19534 | error.name = 'Invariant Violation';
|
19535 | }
|
19536 |
|
19537 | error.framesToPop = 1;
|
19538 | throw error;
|
19539 | }
|
19540 | }
|
19541 |
|
19542 | module.exports = invariant;
|
19543 |
|
19544 | }),
|
19545 |
|
19546 | (function(module, exports, __webpack_require__) {
|
19547 |
|
19548 | "use strict";
|
19549 | |
19550 |
|
19551 |
|
19552 |
|
19553 |
|
19554 |
|
19555 |
|
19556 |
|
19557 |
|
19558 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
19559 |
|
19560 | module.exports = ReactPropTypesSecret;
|
19561 |
|
19562 |
|
19563 | }),
|
19564 |
|
19565 | (function(module, exports) {
|
19566 |
|
19567 | module.exports = __WEBPACK_EXTERNAL_MODULE_4__;
|
19568 |
|
19569 | }),
|
19570 |
|
19571 | (function(module, exports, __webpack_require__) {
|
19572 |
|
19573 | "use strict";
|
19574 |
|
19575 |
|
19576 | Object.defineProperty(exports, "__esModule", {
|
19577 | value: true
|
19578 | });
|
19579 |
|
19580 | 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; };
|
19581 |
|
19582 | exports.matchesSelector = matchesSelector;
|
19583 | exports.matchesSelectorAndParentsTo = matchesSelectorAndParentsTo;
|
19584 | exports.addEvent = addEvent;
|
19585 | exports.removeEvent = removeEvent;
|
19586 | exports.outerHeight = outerHeight;
|
19587 | exports.outerWidth = outerWidth;
|
19588 | exports.innerHeight = innerHeight;
|
19589 | exports.innerWidth = innerWidth;
|
19590 | exports.offsetXYFromParent = offsetXYFromParent;
|
19591 | exports.createCSSTransform = createCSSTransform;
|
19592 | exports.createSVGTransform = createSVGTransform;
|
19593 | exports.getTouch = getTouch;
|
19594 | exports.getTouchIdentifier = getTouchIdentifier;
|
19595 | exports.addUserSelectStyles = addUserSelectStyles;
|
19596 | exports.removeUserSelectStyles = removeUserSelectStyles;
|
19597 | exports.styleHacks = styleHacks;
|
19598 | exports.addClassName = addClassName;
|
19599 | exports.removeClassName = removeClassName;
|
19600 |
|
19601 | var _shims = __webpack_require__(0);
|
19602 |
|
19603 | var _getPrefix = __webpack_require__(19);
|
19604 |
|
19605 | var _getPrefix2 = _interopRequireDefault(_getPrefix);
|
19606 |
|
19607 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19608 |
|
19609 | 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; }
|
19610 |
|
19611 |
|
19612 |
|
19613 |
|
19614 | var matchesSelectorFunc = '';
|
19615 | function matchesSelector(el /*: Node*/, selector /*: string*/) /*: boolean*/ {
|
19616 | if (!matchesSelectorFunc) {
|
19617 | matchesSelectorFunc = (0, _shims.findInArray)(['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'], function (method) {
|
19618 |
|
19619 | return (0, _shims.isFunction)(el[method]);
|
19620 | });
|
19621 | }
|
19622 |
|
19623 |
|
19624 |
|
19625 | if (!(0, _shims.isFunction)(el[matchesSelectorFunc])) return false;
|
19626 |
|
19627 |
|
19628 | return el[matchesSelectorFunc](selector);
|
19629 | }
|
19630 |
|
19631 |
|
19632 | function matchesSelectorAndParentsTo(el /*: Node*/, selector /*: string*/, baseNode /*: Node*/) /*: boolean*/ {
|
19633 | var node = el;
|
19634 | do {
|
19635 | if (matchesSelector(node, selector)) return true;
|
19636 | if (node === baseNode) return false;
|
19637 | node = node.parentNode;
|
19638 | } while (node);
|
19639 |
|
19640 | return false;
|
19641 | }
|
19642 |
|
19643 | function addEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ {
|
19644 | if (!el) {
|
19645 | return;
|
19646 | }
|
19647 | if (el.attachEvent) {
|
19648 | el.attachEvent('on' + event, handler);
|
19649 | } else if (el.addEventListener) {
|
19650 | el.addEventListener(event, handler, true);
|
19651 | } else {
|
19652 |
|
19653 | el['on' + event] = handler;
|
19654 | }
|
19655 | }
|
19656 |
|
19657 | function removeEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ {
|
19658 | if (!el) {
|
19659 | return;
|
19660 | }
|
19661 | if (el.detachEvent) {
|
19662 | el.detachEvent('on' + event, handler);
|
19663 | } else if (el.removeEventListener) {
|
19664 | el.removeEventListener(event, handler, true);
|
19665 | } else {
|
19666 |
|
19667 | el['on' + event] = null;
|
19668 | }
|
19669 | }
|
19670 |
|
19671 | function outerHeight(node /*: HTMLElement*/) /*: number*/ {
|
19672 |
|
19673 |
|
19674 | var height = node.clientHeight;
|
19675 | var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
19676 | height += (0, _shims.int)(computedStyle.borderTopWidth);
|
19677 | height += (0, _shims.int)(computedStyle.borderBottomWidth);
|
19678 | return height;
|
19679 | }
|
19680 |
|
19681 | function outerWidth(node /*: HTMLElement*/) /*: number*/ {
|
19682 |
|
19683 |
|
19684 | var width = node.clientWidth;
|
19685 | var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
19686 | width += (0, _shims.int)(computedStyle.borderLeftWidth);
|
19687 | width += (0, _shims.int)(computedStyle.borderRightWidth);
|
19688 | return width;
|
19689 | }
|
19690 | function innerHeight(node /*: HTMLElement*/) /*: number*/ {
|
19691 | var height = node.clientHeight;
|
19692 | var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
19693 | height -= (0, _shims.int)(computedStyle.paddingTop);
|
19694 | height -= (0, _shims.int)(computedStyle.paddingBottom);
|
19695 | return height;
|
19696 | }
|
19697 |
|
19698 | function innerWidth(node /*: HTMLElement*/) /*: number*/ {
|
19699 | var width = node.clientWidth;
|
19700 | var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
19701 | width -= (0, _shims.int)(computedStyle.paddingLeft);
|
19702 | width -= (0, _shims.int)(computedStyle.paddingRight);
|
19703 | return width;
|
19704 | }
|
19705 |
|
19706 |
|
19707 | function offsetXYFromParent(evt /*: {clientX: number, clientY: number}*/, offsetParent /*: HTMLElement*/) /*: ControlPosition*/ {
|
19708 | var isBody = offsetParent === offsetParent.ownerDocument.body;
|
19709 | var offsetParentRect = isBody ? { left: 0, top: 0 } : offsetParent.getBoundingClientRect();
|
19710 |
|
19711 | var x = evt.clientX + offsetParent.scrollLeft - offsetParentRect.left;
|
19712 | var y = evt.clientY + offsetParent.scrollTop - offsetParentRect.top;
|
19713 |
|
19714 | return { x: x, y: y };
|
19715 | }
|
19716 |
|
19717 | function createCSSTransform(_ref) /*: Object*/ {
|
19718 | var x = _ref.x,
|
19719 | y = _ref.y;
|
19720 |
|
19721 |
|
19722 | return _defineProperty({}, (0, _getPrefix.browserPrefixToKey)('transform', _getPrefix2.default), 'translate(' + x + 'px,' + y + 'px)');
|
19723 | }
|
19724 |
|
19725 | function createSVGTransform(_ref3) /*: string*/ {
|
19726 | var x = _ref3.x,
|
19727 | y = _ref3.y;
|
19728 |
|
19729 | return 'translate(' + x + ',' + y + ')';
|
19730 | }
|
19731 |
|
19732 | function getTouch(e /*: MouseTouchEvent*/, identifier /*: number*/) /*: ?{clientX: number, clientY: number}*/ {
|
19733 | return e.targetTouches && (0, _shims.findInArray)(e.targetTouches, function (t) {
|
19734 | return identifier === t.identifier;
|
19735 | }) || e.changedTouches && (0, _shims.findInArray)(e.changedTouches, function (t) {
|
19736 | return identifier === t.identifier;
|
19737 | });
|
19738 | }
|
19739 |
|
19740 | function getTouchIdentifier(e /*: MouseTouchEvent*/) /*: ?number*/ {
|
19741 | if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier;
|
19742 | if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier;
|
19743 | }
|
19744 |
|
19745 |
|
19746 |
|
19747 |
|
19748 |
|
19749 |
|
19750 | function addUserSelectStyles(doc /*: ?Document*/) {
|
19751 | if (!doc) return;
|
19752 | var styleEl = doc.getElementById('react-draggable-style-el');
|
19753 | if (!styleEl) {
|
19754 | styleEl = doc.createElement('style');
|
19755 | styleEl.type = 'text/css';
|
19756 | styleEl.id = 'react-draggable-style-el';
|
19757 | styleEl.innerHTML = '.react-draggable-transparent-selection *::-moz-selection {background: transparent;}\n';
|
19758 | styleEl.innerHTML += '.react-draggable-transparent-selection *::selection {background: transparent;}\n';
|
19759 | doc.getElementsByTagName('head')[0].appendChild(styleEl);
|
19760 | }
|
19761 | if (doc.body) addClassName(doc.body, 'react-draggable-transparent-selection');
|
19762 | }
|
19763 |
|
19764 | function removeUserSelectStyles(doc /*: ?Document*/) {
|
19765 | try {
|
19766 | if (doc && doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection');
|
19767 | window.getSelection().removeAllRanges();
|
19768 | } catch (e) {
|
19769 |
|
19770 | }
|
19771 | }
|
19772 |
|
19773 | function styleHacks() /*: Object*/ {
|
19774 | var childStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
19775 |
|
19776 |
|
19777 |
|
19778 | return _extends({
|
19779 | touchAction: 'none'
|
19780 | }, childStyle);
|
19781 | }
|
19782 |
|
19783 | function addClassName(el /*: HTMLElement*/, className /*: string*/) {
|
19784 | if (el.classList) {
|
19785 | el.classList.add(className);
|
19786 | } else {
|
19787 | if (!el.className.match(new RegExp('(?:^|\\s)' + className + '(?!\\S)'))) {
|
19788 | el.className += ' ' + className;
|
19789 | }
|
19790 | }
|
19791 | }
|
19792 |
|
19793 | function removeClassName(el /*: HTMLElement*/, className /*: string*/) {
|
19794 | if (el.classList) {
|
19795 | el.classList.remove(className);
|
19796 | } else {
|
19797 | el.className = el.className.replace(new RegExp('(?:^|\\s)' + className + '(?!\\S)', 'g'), '');
|
19798 | }
|
19799 | }
|
19800 |
|
19801 | }),
|
19802 |
|
19803 | (function(module, exports) {
|
19804 |
|
19805 | module.exports = __WEBPACK_EXTERNAL_MODULE_6__;
|
19806 |
|
19807 | }),
|
19808 |
|
19809 | (function(module, exports, __webpack_require__) {
|
19810 |
|
19811 | |
19812 |
|
19813 |
|
19814 |
|
19815 |
|
19816 |
|
19817 |
|
19818 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
19819 | var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
|
19820 | Symbol.for &&
|
19821 | Symbol.for('react.element')) ||
|
19822 | 0xeac7;
|
19823 |
|
19824 | var isValidElement = function(object) {
|
19825 | return typeof object === 'object' &&
|
19826 | object !== null &&
|
19827 | object.$$typeof === REACT_ELEMENT_TYPE;
|
19828 | };
|
19829 |
|
19830 |
|
19831 |
|
19832 | var throwOnDirectAccess = true;
|
19833 | module.exports = __webpack_require__(14)(isValidElement, throwOnDirectAccess);
|
19834 | } else {
|
19835 |
|
19836 |
|
19837 | module.exports = __webpack_require__(17)();
|
19838 | }
|
19839 |
|
19840 |
|
19841 | }),
|
19842 |
|
19843 | (function(module, exports, __webpack_require__) {
|
19844 |
|
19845 | "use strict";
|
19846 | |
19847 |
|
19848 |
|
19849 |
|
19850 |
|
19851 |
|
19852 |
|
19853 |
|
19854 |
|
19855 |
|
19856 | var emptyFunction = __webpack_require__(1);
|
19857 |
|
19858 | |
19859 |
|
19860 |
|
19861 |
|
19862 |
|
19863 |
|
19864 |
|
19865 | var warning = emptyFunction;
|
19866 |
|
19867 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
19868 | var printWarning = function printWarning(format) {
|
19869 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
19870 | args[_key - 1] = arguments[_key];
|
19871 | }
|
19872 |
|
19873 | var argIndex = 0;
|
19874 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
19875 | return args[argIndex++];
|
19876 | });
|
19877 | if (typeof console !== 'undefined') {
|
19878 | console.error(message);
|
19879 | }
|
19880 | try {
|
19881 |
|
19882 |
|
19883 |
|
19884 | throw new Error(message);
|
19885 | } catch (x) {}
|
19886 | };
|
19887 |
|
19888 | warning = function warning(condition, format) {
|
19889 | if (format === undefined) {
|
19890 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
19891 | }
|
19892 |
|
19893 | if (format.indexOf('Failed Composite propType: ') === 0) {
|
19894 | return;
|
19895 | }
|
19896 |
|
19897 | if (!condition) {
|
19898 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
19899 | args[_key2 - 2] = arguments[_key2];
|
19900 | }
|
19901 |
|
19902 | printWarning.apply(undefined, [format].concat(args));
|
19903 | }
|
19904 | };
|
19905 | }
|
19906 |
|
19907 | module.exports = warning;
|
19908 |
|
19909 | }),
|
19910 |
|
19911 | (function(module, exports, __webpack_require__) {
|
19912 |
|
19913 | "use strict";
|
19914 |
|
19915 |
|
19916 | Object.defineProperty(exports, "__esModule", {
|
19917 | value: true
|
19918 | });
|
19919 | exports.getBoundPosition = getBoundPosition;
|
19920 | exports.snapToGrid = snapToGrid;
|
19921 | exports.canDragX = canDragX;
|
19922 | exports.canDragY = canDragY;
|
19923 | exports.getControlPosition = getControlPosition;
|
19924 | exports.createCoreData = createCoreData;
|
19925 | exports.createDraggableData = createDraggableData;
|
19926 |
|
19927 | var _shims = __webpack_require__(0);
|
19928 |
|
19929 | var _reactDom = __webpack_require__(4);
|
19930 |
|
19931 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
19932 |
|
19933 | var _domFns = __webpack_require__(5);
|
19934 |
|
19935 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19936 |
|
19937 |
|
19938 |
|
19939 |
|
19940 | function getBoundPosition(draggable /*: Draggable*/, x /*: number*/, y /*: number*/) /*: [number, number]*/ {
|
19941 |
|
19942 | if (!draggable.props.bounds) return [x, y];
|
19943 |
|
19944 |
|
19945 | var bounds = draggable.props.bounds;
|
19946 |
|
19947 | bounds = typeof bounds === 'string' ? bounds : cloneBounds(bounds);
|
19948 | var node = findDOMNode(draggable);
|
19949 |
|
19950 | if (typeof bounds === 'string') {
|
19951 | var ownerDocument = node.ownerDocument;
|
19952 |
|
19953 | var ownerWindow = ownerDocument.defaultView;
|
19954 | var boundNode = void 0;
|
19955 | if (bounds === 'parent') {
|
19956 | boundNode = node.parentNode;
|
19957 | } else {
|
19958 | boundNode = ownerDocument.querySelector(bounds);
|
19959 | }
|
19960 | if (!(boundNode instanceof HTMLElement)) {
|
19961 | throw new Error('Bounds selector "' + bounds + '" could not find an element.');
|
19962 | }
|
19963 | var nodeStyle = ownerWindow.getComputedStyle(node);
|
19964 | var boundNodeStyle = ownerWindow.getComputedStyle(boundNode);
|
19965 |
|
19966 | bounds = {
|
19967 | left: -node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingLeft) + (0, _shims.int)(nodeStyle.marginLeft),
|
19968 | top: -node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingTop) + (0, _shims.int)(nodeStyle.marginTop),
|
19969 | right: (0, _domFns.innerWidth)(boundNode) - (0, _domFns.outerWidth)(node) - node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingRight) - (0, _shims.int)(nodeStyle.marginRight),
|
19970 | bottom: (0, _domFns.innerHeight)(boundNode) - (0, _domFns.outerHeight)(node) - node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingBottom) - (0, _shims.int)(nodeStyle.marginBottom)
|
19971 | };
|
19972 | }
|
19973 |
|
19974 |
|
19975 | if ((0, _shims.isNum)(bounds.right)) x = Math.min(x, bounds.right);
|
19976 | if ((0, _shims.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom);
|
19977 |
|
19978 |
|
19979 | if ((0, _shims.isNum)(bounds.left)) x = Math.max(x, bounds.left);
|
19980 | if ((0, _shims.isNum)(bounds.top)) y = Math.max(y, bounds.top);
|
19981 |
|
19982 | return [x, y];
|
19983 | }
|
19984 |
|
19985 | function snapToGrid(grid /*: [number, number]*/, pendingX /*: number*/, pendingY /*: number*/) /*: [number, number]*/ {
|
19986 | var x = Math.round(pendingX / grid[0]) * grid[0];
|
19987 | var y = Math.round(pendingY / grid[1]) * grid[1];
|
19988 | return [x, y];
|
19989 | }
|
19990 |
|
19991 | function canDragX(draggable /*: Draggable*/) /*: boolean*/ {
|
19992 | return draggable.props.axis === 'both' || draggable.props.axis === 'x';
|
19993 | }
|
19994 |
|
19995 | function canDragY(draggable /*: Draggable*/) /*: boolean*/ {
|
19996 | return draggable.props.axis === 'both' || draggable.props.axis === 'y';
|
19997 | }
|
19998 |
|
19999 |
|
20000 | function getControlPosition(e /*: MouseTouchEvent*/, touchIdentifier /*: ?number*/, draggableCore /*: DraggableCore*/) /*: ?ControlPosition*/ {
|
20001 | var touchObj = typeof touchIdentifier === 'number' ? (0, _domFns.getTouch)(e, touchIdentifier) : null;
|
20002 | if (typeof touchIdentifier === 'number' && !touchObj) return null;
|
20003 | var node = findDOMNode(draggableCore);
|
20004 |
|
20005 | var offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;
|
20006 | return (0, _domFns.offsetXYFromParent)(touchObj || e, offsetParent);
|
20007 | }
|
20008 |
|
20009 |
|
20010 | function createCoreData(draggable /*: DraggableCore*/, x /*: number*/, y /*: number*/) /*: DraggableData*/ {
|
20011 | var state = draggable.state;
|
20012 | var isStart = !(0, _shims.isNum)(state.lastX);
|
20013 | var node = findDOMNode(draggable);
|
20014 |
|
20015 | if (isStart) {
|
20016 |
|
20017 | return {
|
20018 | node: node,
|
20019 | deltaX: 0, deltaY: 0,
|
20020 | lastX: x, lastY: y,
|
20021 | x: x, y: y
|
20022 | };
|
20023 | } else {
|
20024 |
|
20025 | return {
|
20026 | node: node,
|
20027 | deltaX: x - state.lastX, deltaY: y - state.lastY,
|
20028 | lastX: state.lastX, lastY: state.lastY,
|
20029 | x: x, y: y
|
20030 | };
|
20031 | }
|
20032 | }
|
20033 |
|
20034 |
|
20035 | function createDraggableData(draggable /*: Draggable*/, coreData /*: DraggableData*/) /*: DraggableData*/ {
|
20036 | return {
|
20037 | node: coreData.node,
|
20038 | x: draggable.state.x + coreData.deltaX,
|
20039 | y: draggable.state.y + coreData.deltaY,
|
20040 | deltaX: coreData.deltaX,
|
20041 | deltaY: coreData.deltaY,
|
20042 | lastX: draggable.state.x,
|
20043 | lastY: draggable.state.y
|
20044 | };
|
20045 | }
|
20046 |
|
20047 |
|
20048 | function cloneBounds(bounds /*: Bounds*/) /*: Bounds*/ {
|
20049 | return {
|
20050 | left: bounds.left,
|
20051 | top: bounds.top,
|
20052 | right: bounds.right,
|
20053 | bottom: bounds.bottom
|
20054 | };
|
20055 | }
|
20056 |
|
20057 | function findDOMNode(draggable /*: Draggable | DraggableCore*/) /*: HTMLElement*/ {
|
20058 | var node = _reactDom2.default.findDOMNode(draggable);
|
20059 | if (!node) {
|
20060 | throw new Error('<DraggableCore>: Unmounted during event!');
|
20061 | }
|
20062 |
|
20063 | return node;
|
20064 | }
|
20065 |
|
20066 | }),
|
20067 |
|
20068 | (function(module, exports, __webpack_require__) {
|
20069 |
|
20070 | "use strict";
|
20071 | (function(process) {
|
20072 |
|
20073 | Object.defineProperty(exports, "__esModule", {
|
20074 | value: true
|
20075 | });
|
20076 |
|
20077 | 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"); } }; }();
|
20078 |
|
20079 | 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; }; }();
|
20080 |
|
20081 | var _react = __webpack_require__(6);
|
20082 |
|
20083 | var _react2 = _interopRequireDefault(_react);
|
20084 |
|
20085 | var _propTypes = __webpack_require__(7);
|
20086 |
|
20087 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
20088 |
|
20089 | var _reactDom = __webpack_require__(4);
|
20090 |
|
20091 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
20092 |
|
20093 | var _domFns = __webpack_require__(5);
|
20094 |
|
20095 | var _positionFns = __webpack_require__(9);
|
20096 |
|
20097 | var _shims = __webpack_require__(0);
|
20098 |
|
20099 | var _log = __webpack_require__(11);
|
20100 |
|
20101 | var _log2 = _interopRequireDefault(_log);
|
20102 |
|
20103 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20104 |
|
20105 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
20106 |
|
20107 | 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; }
|
20108 |
|
20109 | 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; }
|
20110 |
|
20111 |
|
20112 |
|
20113 |
|
20114 |
|
20115 |
|
20116 | var eventsFor = {
|
20117 | touch: {
|
20118 | start: 'touchstart',
|
20119 | move: 'touchmove',
|
20120 | stop: 'touchend'
|
20121 | },
|
20122 | mouse: {
|
20123 | start: 'mousedown',
|
20124 | move: 'mousemove',
|
20125 | stop: 'mouseup'
|
20126 | }
|
20127 | };
|
20128 |
|
20129 |
|
20130 | var dragEventFor = eventsFor.mouse;
|
20131 |
|
20132 | |
20133 |
|
20134 |
|
20135 |
|
20136 |
|
20137 |
|
20138 | |
20139 |
|
20140 |
|
20141 |
|
20142 |
|
20143 |
|
20144 | |
20145 |
|
20146 |
|
20147 |
|
20148 |
|
20149 |
|
20150 |
|
20151 |
|
20152 |
|
20153 |
|
20154 |
|
20155 |
|
20156 |
|
20157 |
|
20158 |
|
20159 |
|
20160 |
|
20161 | |
20162 |
|
20163 |
|
20164 |
|
20165 |
|
20166 |
|
20167 |
|
20168 |
|
20169 |
|
20170 |
|
20171 |
|
20172 |
|
20173 |
|
20174 |
|
20175 |
|
20176 | var DraggableCore = function (_React$Component) {
|
20177 | _inherits(DraggableCore, _React$Component);
|
20178 |
|
20179 | function DraggableCore() {
|
20180 | var _ref;
|
20181 |
|
20182 | var _temp, _this, _ret;
|
20183 |
|
20184 | _classCallCheck(this, DraggableCore);
|
20185 |
|
20186 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
20187 | args[_key] = arguments[_key];
|
20188 | }
|
20189 |
|
20190 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = DraggableCore.__proto__ || Object.getPrototypeOf(DraggableCore)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
20191 | dragging: false,
|
20192 |
|
20193 | lastX: NaN, lastY: NaN,
|
20194 | touchIdentifier: null
|
20195 | }, _this.handleDragStart = function (e) {
|
20196 |
|
20197 | _this.props.onMouseDown(e);
|
20198 |
|
20199 |
|
20200 | if (!_this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false;
|
20201 |
|
20202 |
|
20203 | var thisNode = _reactDom2.default.findDOMNode(_this);
|
20204 | if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) {
|
20205 | throw new Error('<DraggableCore> not mounted on DragStart!');
|
20206 | }
|
20207 | var ownerDocument = thisNode.ownerDocument;
|
20208 |
|
20209 |
|
20210 |
|
20211 | 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)) {
|
20212 | return;
|
20213 | }
|
20214 |
|
20215 |
|
20216 |
|
20217 |
|
20218 | var touchIdentifier = (0, _domFns.getTouchIdentifier)(e);
|
20219 | _this.setState({ touchIdentifier: touchIdentifier });
|
20220 |
|
20221 |
|
20222 | var position = (0, _positionFns.getControlPosition)(e, touchIdentifier, _this);
|
20223 | if (position == null) return;
|
20224 | var x = position.x,
|
20225 | y = position.y;
|
20226 |
|
20227 |
|
20228 |
|
20229 | var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
|
20230 |
|
20231 | (0, _log2.default)('DraggableCore: handleDragStart: %j', coreEvent);
|
20232 |
|
20233 |
|
20234 | (0, _log2.default)('calling', _this.props.onStart);
|
20235 | var shouldUpdate = _this.props.onStart(e, coreEvent);
|
20236 | if (shouldUpdate === false) return;
|
20237 |
|
20238 |
|
20239 |
|
20240 | if (_this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)(ownerDocument);
|
20241 |
|
20242 |
|
20243 |
|
20244 |
|
20245 | _this.setState({
|
20246 | dragging: true,
|
20247 |
|
20248 | lastX: x,
|
20249 | lastY: y
|
20250 | });
|
20251 |
|
20252 |
|
20253 |
|
20254 |
|
20255 | (0, _domFns.addEvent)(ownerDocument, dragEventFor.move, _this.handleDrag);
|
20256 | (0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, _this.handleDragStop);
|
20257 | }, _this.handleDrag = function (e) {
|
20258 |
|
20259 |
|
20260 | if (e.type === 'touchmove') e.preventDefault();
|
20261 |
|
20262 |
|
20263 | var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _this);
|
20264 | if (position == null) return;
|
20265 | var x = position.x,
|
20266 | y = position.y;
|
20267 |
|
20268 |
|
20269 |
|
20270 | if (Array.isArray(_this.props.grid)) {
|
20271 | var _deltaX = x - _this.state.lastX,
|
20272 | _deltaY = y - _this.state.lastY;
|
20273 |
|
20274 | var _snapToGrid = (0, _positionFns.snapToGrid)(_this.props.grid, _deltaX, _deltaY);
|
20275 |
|
20276 | var _snapToGrid2 = _slicedToArray(_snapToGrid, 2);
|
20277 |
|
20278 | _deltaX = _snapToGrid2[0];
|
20279 | _deltaY = _snapToGrid2[1];
|
20280 |
|
20281 | if (!_deltaX && !_deltaY) return;
|
20282 | x = _this.state.lastX + _deltaX, y = _this.state.lastY + _deltaY;
|
20283 | }
|
20284 |
|
20285 | var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
|
20286 |
|
20287 | (0, _log2.default)('DraggableCore: handleDrag: %j', coreEvent);
|
20288 |
|
20289 |
|
20290 | var shouldUpdate = _this.props.onDrag(e, coreEvent);
|
20291 | if (shouldUpdate === false) {
|
20292 | try {
|
20293 |
|
20294 | _this.handleDragStop(new MouseEvent('mouseup'));
|
20295 | } catch (err) {
|
20296 |
|
20297 | var event = ((document.createEvent('MouseEvents') ) );
|
20298 |
|
20299 |
|
20300 | event.initMouseEvent('mouseup', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
20301 | _this.handleDragStop(event);
|
20302 | }
|
20303 | return;
|
20304 | }
|
20305 |
|
20306 | _this.setState({
|
20307 | lastX: x,
|
20308 | lastY: y
|
20309 | });
|
20310 | }, _this.handleDragStop = function (e) {
|
20311 | if (!_this.state.dragging) return;
|
20312 |
|
20313 | var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _this);
|
20314 | if (position == null) return;
|
20315 | var x = position.x,
|
20316 | y = position.y;
|
20317 |
|
20318 | var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
|
20319 |
|
20320 | var thisNode = _reactDom2.default.findDOMNode(_this);
|
20321 | if (thisNode) {
|
20322 |
|
20323 | if (_this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(thisNode.ownerDocument);
|
20324 | }
|
20325 |
|
20326 | (0, _log2.default)('DraggableCore: handleDragStop: %j', coreEvent);
|
20327 |
|
20328 |
|
20329 | _this.setState({
|
20330 | dragging: false,
|
20331 | lastX: NaN,
|
20332 | lastY: NaN
|
20333 | });
|
20334 |
|
20335 |
|
20336 | _this.props.onStop(e, coreEvent);
|
20337 |
|
20338 | if (thisNode) {
|
20339 |
|
20340 | (0, _log2.default)('DraggableCore: Removing handlers');
|
20341 | (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.move, _this.handleDrag);
|
20342 | (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.stop, _this.handleDragStop);
|
20343 | }
|
20344 | }, _this.onMouseDown = function (e) {
|
20345 | dragEventFor = eventsFor.mouse;
|
20346 |
|
20347 | return _this.handleDragStart(e);
|
20348 | }, _this.onMouseUp = function (e) {
|
20349 | dragEventFor = eventsFor.mouse;
|
20350 |
|
20351 | return _this.handleDragStop(e);
|
20352 | }, _this.onTouchStart = function (e) {
|
20353 |
|
20354 | dragEventFor = eventsFor.touch;
|
20355 |
|
20356 | return _this.handleDragStart(e);
|
20357 | }, _this.onTouchEnd = function (e) {
|
20358 |
|
20359 | dragEventFor = eventsFor.touch;
|
20360 |
|
20361 | return _this.handleDragStop(e);
|
20362 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
20363 | }
|
20364 |
|
20365 | _createClass(DraggableCore, [{
|
20366 | key: 'componentWillUnmount',
|
20367 | value: function componentWillUnmount() {
|
20368 |
|
20369 |
|
20370 | var thisNode = _reactDom2.default.findDOMNode(this);
|
20371 | if (thisNode) {
|
20372 | var ownerDocument = thisNode.ownerDocument;
|
20373 |
|
20374 | (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag);
|
20375 | (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag);
|
20376 | (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
|
20377 | (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
|
20378 | if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument);
|
20379 | }
|
20380 | }
|
20381 |
|
20382 |
|
20383 |
|
20384 | }, {
|
20385 | key: 'render',
|
20386 | value: function render() {
|
20387 |
|
20388 |
|
20389 | return _react2.default.cloneElement(_react2.default.Children.only(this.props.children), {
|
20390 | style: (0, _domFns.styleHacks)(this.props.children.props.style),
|
20391 |
|
20392 |
|
20393 |
|
20394 | onMouseDown: this.onMouseDown,
|
20395 | onTouchStart: this.onTouchStart,
|
20396 | onMouseUp: this.onMouseUp,
|
20397 | onTouchEnd: this.onTouchEnd
|
20398 | });
|
20399 | }
|
20400 | }]);
|
20401 |
|
20402 | return DraggableCore;
|
20403 | }(_react2.default.Component);
|
20404 |
|
20405 | DraggableCore.displayName = 'DraggableCore';
|
20406 | DraggableCore.propTypes = {
|
20407 | |
20408 |
|
20409 |
|
20410 |
|
20411 |
|
20412 |
|
20413 | allowAnyClick: _propTypes2.default.bool,
|
20414 |
|
20415 | |
20416 |
|
20417 |
|
20418 |
|
20419 | disabled: _propTypes2.default.bool,
|
20420 |
|
20421 | |
20422 |
|
20423 |
|
20424 |
|
20425 |
|
20426 | enableUserSelectHack: _propTypes2.default.bool,
|
20427 |
|
20428 | |
20429 |
|
20430 |
|
20431 |
|
20432 | offsetParent: function offsetParent(props /*: DraggableCoreProps*/, propName /*: $Keys<DraggableCoreProps>*/) {
|
20433 | if (process.browser === true && props[propName] && props[propName].nodeType !== 1) {
|
20434 | throw new Error('Draggable\'s offsetParent must be a DOM Node.');
|
20435 | }
|
20436 | },
|
20437 |
|
20438 | |
20439 |
|
20440 |
|
20441 | grid: _propTypes2.default.arrayOf(_propTypes2.default.number),
|
20442 |
|
20443 | |
20444 |
|
20445 |
|
20446 |
|
20447 |
|
20448 |
|
20449 |
|
20450 |
|
20451 |
|
20452 |
|
20453 |
|
20454 |
|
20455 |
|
20456 |
|
20457 |
|
20458 |
|
20459 |
|
20460 |
|
20461 |
|
20462 |
|
20463 | handle: _propTypes2.default.string,
|
20464 |
|
20465 | |
20466 |
|
20467 |
|
20468 |
|
20469 |
|
20470 |
|
20471 |
|
20472 |
|
20473 |
|
20474 |
|
20475 |
|
20476 |
|
20477 |
|
20478 |
|
20479 |
|
20480 |
|
20481 |
|
20482 |
|
20483 |
|
20484 |
|
20485 | cancel: _propTypes2.default.string,
|
20486 |
|
20487 | |
20488 |
|
20489 |
|
20490 |
|
20491 | onStart: _propTypes2.default.func,
|
20492 |
|
20493 | |
20494 |
|
20495 |
|
20496 |
|
20497 | onDrag: _propTypes2.default.func,
|
20498 |
|
20499 | |
20500 |
|
20501 |
|
20502 |
|
20503 | onStop: _propTypes2.default.func,
|
20504 |
|
20505 | |
20506 |
|
20507 |
|
20508 |
|
20509 | onMouseDown: _propTypes2.default.func,
|
20510 |
|
20511 | |
20512 |
|
20513 |
|
20514 | className: _shims.dontSetMe,
|
20515 | style: _shims.dontSetMe,
|
20516 | transform: _shims.dontSetMe
|
20517 | };
|
20518 | DraggableCore.defaultProps = {
|
20519 | allowAnyClick: false,
|
20520 | cancel: null,
|
20521 | disabled: false,
|
20522 | enableUserSelectHack: true,
|
20523 | offsetParent: null,
|
20524 | handle: null,
|
20525 | grid: null,
|
20526 | transform: null,
|
20527 | onStart: function onStart() {},
|
20528 | onDrag: function onDrag() {},
|
20529 | onStop: function onStop() {},
|
20530 | onMouseDown: function onMouseDown() {}
|
20531 | };
|
20532 | exports.default = DraggableCore;
|
20533 | }.call(exports, __webpack_require__(20)))
|
20534 |
|
20535 | }),
|
20536 |
|
20537 | (function(module, exports, __webpack_require__) {
|
20538 |
|
20539 | "use strict";
|
20540 |
|
20541 |
|
20542 | Object.defineProperty(exports, "__esModule", {
|
20543 | value: true
|
20544 | });
|
20545 | exports.default = log;
|
20546 |
|
20547 |
|
20548 | function log() {
|
20549 | var _console;
|
20550 |
|
20551 | if (undefined) (_console = console).log.apply(_console, arguments);
|
20552 | }
|
20553 |
|
20554 | }),
|
20555 |
|
20556 | (function(module, exports, __webpack_require__) {
|
20557 |
|
20558 | "use strict";
|
20559 |
|
20560 |
|
20561 | var Draggable = __webpack_require__(13).default;
|
20562 |
|
20563 |
|
20564 |
|
20565 |
|
20566 |
|
20567 | module.exports = Draggable;
|
20568 | module.exports.default = Draggable;
|
20569 | module.exports.DraggableCore = __webpack_require__(10).default;
|
20570 |
|
20571 | }),
|
20572 |
|
20573 | (function(module, exports, __webpack_require__) {
|
20574 |
|
20575 | "use strict";
|
20576 |
|
20577 |
|
20578 | Object.defineProperty(exports, "__esModule", {
|
20579 | value: true
|
20580 | });
|
20581 |
|
20582 | 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; };
|
20583 |
|
20584 | 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"); } }; }();
|
20585 |
|
20586 | 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; }; }();
|
20587 |
|
20588 | var _react = __webpack_require__(6);
|
20589 |
|
20590 | var _react2 = _interopRequireDefault(_react);
|
20591 |
|
20592 | var _propTypes = __webpack_require__(7);
|
20593 |
|
20594 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
20595 |
|
20596 | var _reactDom = __webpack_require__(4);
|
20597 |
|
20598 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
20599 |
|
20600 | var _classnames = __webpack_require__(18);
|
20601 |
|
20602 | var _classnames2 = _interopRequireDefault(_classnames);
|
20603 |
|
20604 | var _domFns = __webpack_require__(5);
|
20605 |
|
20606 | var _positionFns = __webpack_require__(9);
|
20607 |
|
20608 | var _shims = __webpack_require__(0);
|
20609 |
|
20610 | var _DraggableCore = __webpack_require__(10);
|
20611 |
|
20612 | var _DraggableCore2 = _interopRequireDefault(_DraggableCore);
|
20613 |
|
20614 | var _log = __webpack_require__(11);
|
20615 |
|
20616 | var _log2 = _interopRequireDefault(_log);
|
20617 |
|
20618 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20619 |
|
20620 | 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; }
|
20621 |
|
20622 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
20623 |
|
20624 | 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; }
|
20625 |
|
20626 | 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; }
|
20627 |
|
20628 |
|
20629 |
|
20630 |
|
20631 | |
20632 |
|
20633 |
|
20634 |
|
20635 |
|
20636 |
|
20637 |
|
20638 |
|
20639 |
|
20640 |
|
20641 |
|
20642 |
|
20643 |
|
20644 | |
20645 |
|
20646 |
|
20647 |
|
20648 |
|
20649 |
|
20650 |
|
20651 |
|
20652 |
|
20653 |
|
20654 |
|
20655 | var Draggable = function (_React$Component) {
|
20656 | _inherits(Draggable, _React$Component);
|
20657 |
|
20658 | function Draggable(props /*: DraggableProps*/) {
|
20659 | _classCallCheck(this, Draggable);
|
20660 |
|
20661 | var _this = _possibleConstructorReturn(this, (Draggable.__proto__ || Object.getPrototypeOf(Draggable)).call(this, props));
|
20662 |
|
20663 | _this.onDragStart = function (e, coreData) {
|
20664 | (0, _log2.default)('Draggable: onDragStart: %j', coreData);
|
20665 |
|
20666 |
|
20667 | var shouldStart = _this.props.onStart(e, (0, _positionFns.createDraggableData)(_this, coreData));
|
20668 |
|
20669 | if (shouldStart === false) return false;
|
20670 |
|
20671 | _this.setState({ dragging: true, dragged: true });
|
20672 | };
|
20673 |
|
20674 | _this.onDrag = function (e, coreData) {
|
20675 | if (!_this.state.dragging) return false;
|
20676 | (0, _log2.default)('Draggable: onDrag: %j', coreData);
|
20677 |
|
20678 | var uiData = (0, _positionFns.createDraggableData)(_this, coreData);
|
20679 |
|
20680 | var newState = {
|
20681 | x: uiData.x,
|
20682 | y: uiData.y
|
20683 | };
|
20684 |
|
20685 |
|
20686 | if (_this.props.bounds) {
|
20687 |
|
20688 | var _x = newState.x,
|
20689 | _y = newState.y;
|
20690 |
|
20691 |
|
20692 |
|
20693 |
|
20694 |
|
20695 | newState.x += _this.state.slackX;
|
20696 | newState.y += _this.state.slackY;
|
20697 |
|
20698 |
|
20699 |
|
20700 | var _getBoundPosition = (0, _positionFns.getBoundPosition)(_this, newState.x, newState.y),
|
20701 | _getBoundPosition2 = _slicedToArray(_getBoundPosition, 2),
|
20702 | newStateX = _getBoundPosition2[0],
|
20703 | newStateY = _getBoundPosition2[1];
|
20704 |
|
20705 | newState.x = newStateX;
|
20706 | newState.y = newStateY;
|
20707 |
|
20708 |
|
20709 | newState.slackX = _this.state.slackX + (_x - newState.x);
|
20710 | newState.slackY = _this.state.slackY + (_y - newState.y);
|
20711 |
|
20712 |
|
20713 | uiData.x = newState.x;
|
20714 | uiData.y = newState.y;
|
20715 | uiData.deltaX = newState.x - _this.state.x;
|
20716 | uiData.deltaY = newState.y - _this.state.y;
|
20717 | }
|
20718 |
|
20719 |
|
20720 | var shouldUpdate = _this.props.onDrag(e, uiData);
|
20721 | if (shouldUpdate === false) return false;
|
20722 |
|
20723 | _this.setState(newState);
|
20724 | };
|
20725 |
|
20726 | _this.onDragStop = function (e, coreData) {
|
20727 | if (!_this.state.dragging) return false;
|
20728 |
|
20729 |
|
20730 | var shouldStop = _this.props.onStop(e, (0, _positionFns.createDraggableData)(_this, coreData));
|
20731 | if (shouldStop === false) return false;
|
20732 |
|
20733 | (0, _log2.default)('Draggable: onDragStop: %j', coreData);
|
20734 |
|
20735 | var newState = {
|
20736 | dragging: false,
|
20737 | slackX: 0,
|
20738 | slackY: 0
|
20739 | };
|
20740 |
|
20741 |
|
20742 |
|
20743 | var controlled = Boolean(_this.props.position);
|
20744 | if (controlled) {
|
20745 | var _this$props$position = _this.props.position,
|
20746 | _x2 = _this$props$position.x,
|
20747 | _y2 = _this$props$position.y;
|
20748 |
|
20749 | newState.x = _x2;
|
20750 | newState.y = _y2;
|
20751 | }
|
20752 |
|
20753 | _this.setState(newState);
|
20754 | };
|
20755 |
|
20756 | _this.state = {
|
20757 |
|
20758 | dragging: false,
|
20759 |
|
20760 |
|
20761 | dragged: false,
|
20762 |
|
20763 |
|
20764 | x: props.position ? props.position.x : props.defaultPosition.x,
|
20765 | y: props.position ? props.position.y : props.defaultPosition.y,
|
20766 |
|
20767 |
|
20768 | slackX: 0, slackY: 0,
|
20769 |
|
20770 |
|
20771 | isElementSVG: false
|
20772 | };
|
20773 | return _this;
|
20774 | }
|
20775 |
|
20776 | _createClass(Draggable, [{
|
20777 | key: 'componentWillMount',
|
20778 | value: function componentWillMount() {
|
20779 | if (this.props.position && !(this.props.onDrag || this.props.onStop)) {
|
20780 |
|
20781 | 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.');
|
20782 | }
|
20783 | }
|
20784 | }, {
|
20785 | key: 'componentDidMount',
|
20786 | value: function componentDidMount() {
|
20787 |
|
20788 | if (typeof window.SVGElement !== 'undefined' && _reactDom2.default.findDOMNode(this) instanceof window.SVGElement) {
|
20789 | this.setState({ isElementSVG: true });
|
20790 | }
|
20791 | }
|
20792 | }, {
|
20793 | key: 'componentWillReceiveProps',
|
20794 | value: function componentWillReceiveProps(nextProps /*: Object*/) {
|
20795 |
|
20796 | if (nextProps.position && (!this.props.position || nextProps.position.x !== this.props.position.x || nextProps.position.y !== this.props.position.y)) {
|
20797 | this.setState({ x: nextProps.position.x, y: nextProps.position.y });
|
20798 | }
|
20799 | }
|
20800 | }, {
|
20801 | key: 'componentWillUnmount',
|
20802 | value: function componentWillUnmount() {
|
20803 | this.setState({ dragging: false });
|
20804 | }
|
20805 | }, {
|
20806 | key: 'render',
|
20807 | value: function render() /*: ReactElement<any>*/ {
|
20808 | var _classNames;
|
20809 |
|
20810 | var style = {},
|
20811 | svgTransform = null;
|
20812 |
|
20813 |
|
20814 | var controlled = Boolean(this.props.position);
|
20815 | var draggable = !controlled || this.state.dragging;
|
20816 |
|
20817 | var position = this.props.position || this.props.defaultPosition;
|
20818 | var transformOpts = {
|
20819 |
|
20820 | x: (0, _positionFns.canDragX)(this) && draggable ? this.state.x : position.x,
|
20821 |
|
20822 |
|
20823 | y: (0, _positionFns.canDragY)(this) && draggable ? this.state.y : position.y
|
20824 | };
|
20825 |
|
20826 |
|
20827 | if (this.state.isElementSVG) {
|
20828 | svgTransform = (0, _domFns.createSVGTransform)(transformOpts);
|
20829 | } else {
|
20830 |
|
20831 |
|
20832 |
|
20833 |
|
20834 | style = (0, _domFns.createCSSTransform)(transformOpts);
|
20835 | }
|
20836 |
|
20837 | var _props = this.props,
|
20838 | defaultClassName = _props.defaultClassName,
|
20839 | defaultClassNameDragging = _props.defaultClassNameDragging,
|
20840 | defaultClassNameDragged = _props.defaultClassNameDragged;
|
20841 |
|
20842 |
|
20843 | var children = _react2.default.Children.only(this.props.children);
|
20844 |
|
20845 |
|
20846 | var className = (0, _classnames2.default)(children.props.className || '', defaultClassName, (_classNames = {}, _defineProperty(_classNames, defaultClassNameDragging, this.state.dragging), _defineProperty(_classNames, defaultClassNameDragged, this.state.dragged), _classNames));
|
20847 |
|
20848 |
|
20849 |
|
20850 | return _react2.default.createElement(
|
20851 | _DraggableCore2.default,
|
20852 | _extends({}, this.props, { onStart: this.onDragStart, onDrag: this.onDrag, onStop: this.onDragStop }),
|
20853 | _react2.default.cloneElement(children, {
|
20854 | className: className,
|
20855 | style: _extends({}, children.props.style, style),
|
20856 | transform: svgTransform
|
20857 | })
|
20858 | );
|
20859 | }
|
20860 | }]);
|
20861 |
|
20862 | return Draggable;
|
20863 | }(_react2.default.Component);
|
20864 |
|
20865 | Draggable.displayName = 'Draggable';
|
20866 | Draggable.propTypes = _extends({}, _DraggableCore2.default.propTypes, {
|
20867 |
|
20868 | |
20869 |
|
20870 |
|
20871 |
|
20872 |
|
20873 |
|
20874 |
|
20875 |
|
20876 |
|
20877 |
|
20878 |
|
20879 |
|
20880 |
|
20881 | axis: _propTypes2.default.oneOf(['both', 'x', 'y', 'none']),
|
20882 |
|
20883 | |
20884 |
|
20885 |
|
20886 |
|
20887 |
|
20888 |
|
20889 |
|
20890 |
|
20891 |
|
20892 |
|
20893 |
|
20894 |
|
20895 |
|
20896 |
|
20897 |
|
20898 |
|
20899 |
|
20900 |
|
20901 |
|
20902 |
|
20903 |
|
20904 |
|
20905 |
|
20906 |
|
20907 |
|
20908 |
|
20909 | bounds: _propTypes2.default.oneOfType([_propTypes2.default.shape({
|
20910 | left: _propTypes2.default.number,
|
20911 | right: _propTypes2.default.number,
|
20912 | top: _propTypes2.default.number,
|
20913 | bottom: _propTypes2.default.number
|
20914 | }), _propTypes2.default.string, _propTypes2.default.oneOf([false])]),
|
20915 |
|
20916 | defaultClassName: _propTypes2.default.string,
|
20917 | defaultClassNameDragging: _propTypes2.default.string,
|
20918 | defaultClassNameDragged: _propTypes2.default.string,
|
20919 |
|
20920 | |
20921 |
|
20922 |
|
20923 |
|
20924 |
|
20925 |
|
20926 |
|
20927 |
|
20928 |
|
20929 |
|
20930 |
|
20931 |
|
20932 |
|
20933 |
|
20934 |
|
20935 |
|
20936 |
|
20937 | defaultPosition: _propTypes2.default.shape({
|
20938 | x: _propTypes2.default.number,
|
20939 | y: _propTypes2.default.number
|
20940 | }),
|
20941 |
|
20942 | |
20943 |
|
20944 |
|
20945 |
|
20946 |
|
20947 |
|
20948 |
|
20949 |
|
20950 |
|
20951 |
|
20952 |
|
20953 |
|
20954 |
|
20955 |
|
20956 |
|
20957 |
|
20958 |
|
20959 |
|
20960 |
|
20961 |
|
20962 | position: _propTypes2.default.shape({
|
20963 | x: _propTypes2.default.number,
|
20964 | y: _propTypes2.default.number
|
20965 | }),
|
20966 |
|
20967 | |
20968 |
|
20969 |
|
20970 | className: _shims.dontSetMe,
|
20971 | style: _shims.dontSetMe,
|
20972 | transform: _shims.dontSetMe
|
20973 | });
|
20974 | Draggable.defaultProps = _extends({}, _DraggableCore2.default.defaultProps, {
|
20975 | axis: 'both',
|
20976 | bounds: false,
|
20977 | defaultClassName: 'react-draggable',
|
20978 | defaultClassNameDragging: 'react-draggable-dragging',
|
20979 | defaultClassNameDragged: 'react-draggable-dragged',
|
20980 | defaultPosition: { x: 0, y: 0 },
|
20981 | position: null
|
20982 | });
|
20983 | exports.default = Draggable;
|
20984 |
|
20985 | }),
|
20986 |
|
20987 | (function(module, exports, __webpack_require__) {
|
20988 |
|
20989 | "use strict";
|
20990 | |
20991 |
|
20992 |
|
20993 |
|
20994 |
|
20995 |
|
20996 |
|
20997 |
|
20998 |
|
20999 | var emptyFunction = __webpack_require__(1);
|
21000 | var invariant = __webpack_require__(2);
|
21001 | var warning = __webpack_require__(8);
|
21002 | var assign = __webpack_require__(15);
|
21003 |
|
21004 | var ReactPropTypesSecret = __webpack_require__(3);
|
21005 | var checkPropTypes = __webpack_require__(16);
|
21006 |
|
21007 | module.exports = function(isValidElement, throwOnDirectAccess) {
|
21008 |
|
21009 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
21010 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
21011 |
|
21012 | |
21013 |
|
21014 |
|
21015 |
|
21016 |
|
21017 |
|
21018 |
|
21019 |
|
21020 |
|
21021 |
|
21022 |
|
21023 |
|
21024 |
|
21025 |
|
21026 | function getIteratorFn(maybeIterable) {
|
21027 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
21028 | if (typeof iteratorFn === 'function') {
|
21029 | return iteratorFn;
|
21030 | }
|
21031 | }
|
21032 |
|
21033 | |
21034 |
|
21035 |
|
21036 |
|
21037 |
|
21038 |
|
21039 |
|
21040 |
|
21041 |
|
21042 |
|
21043 |
|
21044 |
|
21045 |
|
21046 |
|
21047 |
|
21048 |
|
21049 |
|
21050 |
|
21051 |
|
21052 |
|
21053 |
|
21054 |
|
21055 |
|
21056 |
|
21057 |
|
21058 |
|
21059 |
|
21060 |
|
21061 |
|
21062 |
|
21063 |
|
21064 |
|
21065 |
|
21066 |
|
21067 |
|
21068 |
|
21069 |
|
21070 |
|
21071 |
|
21072 |
|
21073 |
|
21074 |
|
21075 |
|
21076 |
|
21077 |
|
21078 |
|
21079 |
|
21080 | var ANONYMOUS = '<<anonymous>>';
|
21081 |
|
21082 |
|
21083 |
|
21084 | var ReactPropTypes = {
|
21085 | array: createPrimitiveTypeChecker('array'),
|
21086 | bool: createPrimitiveTypeChecker('boolean'),
|
21087 | func: createPrimitiveTypeChecker('function'),
|
21088 | number: createPrimitiveTypeChecker('number'),
|
21089 | object: createPrimitiveTypeChecker('object'),
|
21090 | string: createPrimitiveTypeChecker('string'),
|
21091 | symbol: createPrimitiveTypeChecker('symbol'),
|
21092 |
|
21093 | any: createAnyTypeChecker(),
|
21094 | arrayOf: createArrayOfTypeChecker,
|
21095 | element: createElementTypeChecker(),
|
21096 | instanceOf: createInstanceTypeChecker,
|
21097 | node: createNodeChecker(),
|
21098 | objectOf: createObjectOfTypeChecker,
|
21099 | oneOf: createEnumTypeChecker,
|
21100 | oneOfType: createUnionTypeChecker,
|
21101 | shape: createShapeTypeChecker,
|
21102 | exact: createStrictShapeTypeChecker,
|
21103 | };
|
21104 |
|
21105 | |
21106 |
|
21107 |
|
21108 |
|
21109 |
|
21110 | function is(x, y) {
|
21111 |
|
21112 | if (x === y) {
|
21113 |
|
21114 |
|
21115 | return x !== 0 || 1 / x === 1 / y;
|
21116 | } else {
|
21117 |
|
21118 | return x !== x && y !== y;
|
21119 | }
|
21120 | }
|
21121 |
|
21122 |
|
21123 | |
21124 |
|
21125 |
|
21126 |
|
21127 |
|
21128 |
|
21129 |
|
21130 | function PropTypeError(message) {
|
21131 | this.message = message;
|
21132 | this.stack = '';
|
21133 | }
|
21134 |
|
21135 | PropTypeError.prototype = Error.prototype;
|
21136 |
|
21137 | function createChainableTypeChecker(validate) {
|
21138 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
21139 | var manualPropTypeCallCache = {};
|
21140 | var manualPropTypeWarningCount = 0;
|
21141 | }
|
21142 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
21143 | componentName = componentName || ANONYMOUS;
|
21144 | propFullName = propFullName || propName;
|
21145 |
|
21146 | if (secret !== ReactPropTypesSecret) {
|
21147 | if (throwOnDirectAccess) {
|
21148 |
|
21149 | invariant(
|
21150 | false,
|
21151 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
21152 | 'Use `PropTypes.checkPropTypes()` to call them. ' +
|
21153 | 'Read more at http://fb.me/use-check-prop-types'
|
21154 | );
|
21155 | } else if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
21156 |
|
21157 | var cacheKey = componentName + ':' + propName;
|
21158 | if (
|
21159 | !manualPropTypeCallCache[cacheKey] &&
|
21160 |
|
21161 | manualPropTypeWarningCount < 3
|
21162 | ) {
|
21163 | warning(
|
21164 | false,
|
21165 | 'You are manually calling a React.PropTypes validation ' +
|
21166 | 'function for the `%s` prop on `%s`. This is deprecated ' +
|
21167 | 'and will throw in the standalone `prop-types` package. ' +
|
21168 | 'You may be seeing this warning due to a third-party PropTypes ' +
|
21169 | 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
|
21170 | propFullName,
|
21171 | componentName
|
21172 | );
|
21173 | manualPropTypeCallCache[cacheKey] = true;
|
21174 | manualPropTypeWarningCount++;
|
21175 | }
|
21176 | }
|
21177 | }
|
21178 | if (props[propName] == null) {
|
21179 | if (isRequired) {
|
21180 | if (props[propName] === null) {
|
21181 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
21182 | }
|
21183 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
21184 | }
|
21185 | return null;
|
21186 | } else {
|
21187 | return validate(props, propName, componentName, location, propFullName);
|
21188 | }
|
21189 | }
|
21190 |
|
21191 | var chainedCheckType = checkType.bind(null, false);
|
21192 | chainedCheckType.isRequired = checkType.bind(null, true);
|
21193 |
|
21194 | return chainedCheckType;
|
21195 | }
|
21196 |
|
21197 | function createPrimitiveTypeChecker(expectedType) {
|
21198 | function validate(props, propName, componentName, location, propFullName, secret) {
|
21199 | var propValue = props[propName];
|
21200 | var propType = getPropType(propValue);
|
21201 | if (propType !== expectedType) {
|
21202 |
|
21203 |
|
21204 |
|
21205 | var preciseType = getPreciseType(propValue);
|
21206 |
|
21207 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
21208 | }
|
21209 | return null;
|
21210 | }
|
21211 | return createChainableTypeChecker(validate);
|
21212 | }
|
21213 |
|
21214 | function createAnyTypeChecker() {
|
21215 | return createChainableTypeChecker(emptyFunction.thatReturnsNull);
|
21216 | }
|
21217 |
|
21218 | function createArrayOfTypeChecker(typeChecker) {
|
21219 | function validate(props, propName, componentName, location, propFullName) {
|
21220 | if (typeof typeChecker !== 'function') {
|
21221 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
21222 | }
|
21223 | var propValue = props[propName];
|
21224 | if (!Array.isArray(propValue)) {
|
21225 | var propType = getPropType(propValue);
|
21226 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
21227 | }
|
21228 | for (var i = 0; i < propValue.length; i++) {
|
21229 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
21230 | if (error instanceof Error) {
|
21231 | return error;
|
21232 | }
|
21233 | }
|
21234 | return null;
|
21235 | }
|
21236 | return createChainableTypeChecker(validate);
|
21237 | }
|
21238 |
|
21239 | function createElementTypeChecker() {
|
21240 | function validate(props, propName, componentName, location, propFullName) {
|
21241 | var propValue = props[propName];
|
21242 | if (!isValidElement(propValue)) {
|
21243 | var propType = getPropType(propValue);
|
21244 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
21245 | }
|
21246 | return null;
|
21247 | }
|
21248 | return createChainableTypeChecker(validate);
|
21249 | }
|
21250 |
|
21251 | function createInstanceTypeChecker(expectedClass) {
|
21252 | function validate(props, propName, componentName, location, propFullName) {
|
21253 | if (!(props[propName] instanceof expectedClass)) {
|
21254 | var expectedClassName = expectedClass.name || ANONYMOUS;
|
21255 | var actualClassName = getClassName(props[propName]);
|
21256 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
21257 | }
|
21258 | return null;
|
21259 | }
|
21260 | return createChainableTypeChecker(validate);
|
21261 | }
|
21262 |
|
21263 | function createEnumTypeChecker(expectedValues) {
|
21264 | if (!Array.isArray(expectedValues)) {
|
21265 | Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
|
21266 | return emptyFunction.thatReturnsNull;
|
21267 | }
|
21268 |
|
21269 | function validate(props, propName, componentName, location, propFullName) {
|
21270 | var propValue = props[propName];
|
21271 | for (var i = 0; i < expectedValues.length; i++) {
|
21272 | if (is(propValue, expectedValues[i])) {
|
21273 | return null;
|
21274 | }
|
21275 | }
|
21276 |
|
21277 | var valuesString = JSON.stringify(expectedValues);
|
21278 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
21279 | }
|
21280 | return createChainableTypeChecker(validate);
|
21281 | }
|
21282 |
|
21283 | function createObjectOfTypeChecker(typeChecker) {
|
21284 | function validate(props, propName, componentName, location, propFullName) {
|
21285 | if (typeof typeChecker !== 'function') {
|
21286 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
21287 | }
|
21288 | var propValue = props[propName];
|
21289 | var propType = getPropType(propValue);
|
21290 | if (propType !== 'object') {
|
21291 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
21292 | }
|
21293 | for (var key in propValue) {
|
21294 | if (propValue.hasOwnProperty(key)) {
|
21295 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
21296 | if (error instanceof Error) {
|
21297 | return error;
|
21298 | }
|
21299 | }
|
21300 | }
|
21301 | return null;
|
21302 | }
|
21303 | return createChainableTypeChecker(validate);
|
21304 | }
|
21305 |
|
21306 | function createUnionTypeChecker(arrayOfTypeCheckers) {
|
21307 | if (!Array.isArray(arrayOfTypeCheckers)) {
|
21308 | Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
21309 | return emptyFunction.thatReturnsNull;
|
21310 | }
|
21311 |
|
21312 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
21313 | var checker = arrayOfTypeCheckers[i];
|
21314 | if (typeof checker !== 'function') {
|
21315 | warning(
|
21316 | false,
|
21317 | 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
21318 | 'received %s at index %s.',
|
21319 | getPostfixForTypeWarning(checker),
|
21320 | i
|
21321 | );
|
21322 | return emptyFunction.thatReturnsNull;
|
21323 | }
|
21324 | }
|
21325 |
|
21326 | function validate(props, propName, componentName, location, propFullName) {
|
21327 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
21328 | var checker = arrayOfTypeCheckers[i];
|
21329 | if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
|
21330 | return null;
|
21331 | }
|
21332 | }
|
21333 |
|
21334 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
21335 | }
|
21336 | return createChainableTypeChecker(validate);
|
21337 | }
|
21338 |
|
21339 | function createNodeChecker() {
|
21340 | function validate(props, propName, componentName, location, propFullName) {
|
21341 | if (!isNode(props[propName])) {
|
21342 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
21343 | }
|
21344 | return null;
|
21345 | }
|
21346 | return createChainableTypeChecker(validate);
|
21347 | }
|
21348 |
|
21349 | function createShapeTypeChecker(shapeTypes) {
|
21350 | function validate(props, propName, componentName, location, propFullName) {
|
21351 | var propValue = props[propName];
|
21352 | var propType = getPropType(propValue);
|
21353 | if (propType !== 'object') {
|
21354 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
21355 | }
|
21356 | for (var key in shapeTypes) {
|
21357 | var checker = shapeTypes[key];
|
21358 | if (!checker) {
|
21359 | continue;
|
21360 | }
|
21361 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
21362 | if (error) {
|
21363 | return error;
|
21364 | }
|
21365 | }
|
21366 | return null;
|
21367 | }
|
21368 | return createChainableTypeChecker(validate);
|
21369 | }
|
21370 |
|
21371 | function createStrictShapeTypeChecker(shapeTypes) {
|
21372 | function validate(props, propName, componentName, location, propFullName) {
|
21373 | var propValue = props[propName];
|
21374 | var propType = getPropType(propValue);
|
21375 | if (propType !== 'object') {
|
21376 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
21377 | }
|
21378 |
|
21379 |
|
21380 | var allKeys = assign({}, props[propName], shapeTypes);
|
21381 | for (var key in allKeys) {
|
21382 | var checker = shapeTypes[key];
|
21383 | if (!checker) {
|
21384 | return new PropTypeError(
|
21385 | 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
21386 | '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
21387 | '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
21388 | );
|
21389 | }
|
21390 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
21391 | if (error) {
|
21392 | return error;
|
21393 | }
|
21394 | }
|
21395 | return null;
|
21396 | }
|
21397 |
|
21398 | return createChainableTypeChecker(validate);
|
21399 | }
|
21400 |
|
21401 | function isNode(propValue) {
|
21402 | switch (typeof propValue) {
|
21403 | case 'number':
|
21404 | case 'string':
|
21405 | case 'undefined':
|
21406 | return true;
|
21407 | case 'boolean':
|
21408 | return !propValue;
|
21409 | case 'object':
|
21410 | if (Array.isArray(propValue)) {
|
21411 | return propValue.every(isNode);
|
21412 | }
|
21413 | if (propValue === null || isValidElement(propValue)) {
|
21414 | return true;
|
21415 | }
|
21416 |
|
21417 | var iteratorFn = getIteratorFn(propValue);
|
21418 | if (iteratorFn) {
|
21419 | var iterator = iteratorFn.call(propValue);
|
21420 | var step;
|
21421 | if (iteratorFn !== propValue.entries) {
|
21422 | while (!(step = iterator.next()).done) {
|
21423 | if (!isNode(step.value)) {
|
21424 | return false;
|
21425 | }
|
21426 | }
|
21427 | } else {
|
21428 |
|
21429 | while (!(step = iterator.next()).done) {
|
21430 | var entry = step.value;
|
21431 | if (entry) {
|
21432 | if (!isNode(entry[1])) {
|
21433 | return false;
|
21434 | }
|
21435 | }
|
21436 | }
|
21437 | }
|
21438 | } else {
|
21439 | return false;
|
21440 | }
|
21441 |
|
21442 | return true;
|
21443 | default:
|
21444 | return false;
|
21445 | }
|
21446 | }
|
21447 |
|
21448 | function isSymbol(propType, propValue) {
|
21449 |
|
21450 | if (propType === 'symbol') {
|
21451 | return true;
|
21452 | }
|
21453 |
|
21454 |
|
21455 | if (propValue['@@toStringTag'] === 'Symbol') {
|
21456 | return true;
|
21457 | }
|
21458 |
|
21459 |
|
21460 | if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
21461 | return true;
|
21462 | }
|
21463 |
|
21464 | return false;
|
21465 | }
|
21466 |
|
21467 |
|
21468 | function getPropType(propValue) {
|
21469 | var propType = typeof propValue;
|
21470 | if (Array.isArray(propValue)) {
|
21471 | return 'array';
|
21472 | }
|
21473 | if (propValue instanceof RegExp) {
|
21474 |
|
21475 |
|
21476 |
|
21477 | return 'object';
|
21478 | }
|
21479 | if (isSymbol(propType, propValue)) {
|
21480 | return 'symbol';
|
21481 | }
|
21482 | return propType;
|
21483 | }
|
21484 |
|
21485 |
|
21486 |
|
21487 | function getPreciseType(propValue) {
|
21488 | if (typeof propValue === 'undefined' || propValue === null) {
|
21489 | return '' + propValue;
|
21490 | }
|
21491 | var propType = getPropType(propValue);
|
21492 | if (propType === 'object') {
|
21493 | if (propValue instanceof Date) {
|
21494 | return 'date';
|
21495 | } else if (propValue instanceof RegExp) {
|
21496 | return 'regexp';
|
21497 | }
|
21498 | }
|
21499 | return propType;
|
21500 | }
|
21501 |
|
21502 |
|
21503 |
|
21504 | function getPostfixForTypeWarning(value) {
|
21505 | var type = getPreciseType(value);
|
21506 | switch (type) {
|
21507 | case 'array':
|
21508 | case 'object':
|
21509 | return 'an ' + type;
|
21510 | case 'boolean':
|
21511 | case 'date':
|
21512 | case 'regexp':
|
21513 | return 'a ' + type;
|
21514 | default:
|
21515 | return type;
|
21516 | }
|
21517 | }
|
21518 |
|
21519 |
|
21520 | function getClassName(propValue) {
|
21521 | if (!propValue.constructor || !propValue.constructor.name) {
|
21522 | return ANONYMOUS;
|
21523 | }
|
21524 | return propValue.constructor.name;
|
21525 | }
|
21526 |
|
21527 | ReactPropTypes.checkPropTypes = checkPropTypes;
|
21528 | ReactPropTypes.PropTypes = ReactPropTypes;
|
21529 |
|
21530 | return ReactPropTypes;
|
21531 | };
|
21532 |
|
21533 |
|
21534 | }),
|
21535 |
|
21536 | (function(module, exports, __webpack_require__) {
|
21537 |
|
21538 | "use strict";
|
21539 | |
21540 |
|
21541 |
|
21542 |
|
21543 |
|
21544 |
|
21545 |
|
21546 |
|
21547 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
21548 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
21549 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
21550 |
|
21551 | function toObject(val) {
|
21552 | if (val === null || val === undefined) {
|
21553 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
21554 | }
|
21555 |
|
21556 | return Object(val);
|
21557 | }
|
21558 |
|
21559 | function shouldUseNative() {
|
21560 | try {
|
21561 | if (!Object.assign) {
|
21562 | return false;
|
21563 | }
|
21564 |
|
21565 |
|
21566 |
|
21567 |
|
21568 | var test1 = new String('abc');
|
21569 | test1[5] = 'de';
|
21570 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
21571 | return false;
|
21572 | }
|
21573 |
|
21574 |
|
21575 | var test2 = {};
|
21576 | for (var i = 0; i < 10; i++) {
|
21577 | test2['_' + String.fromCharCode(i)] = i;
|
21578 | }
|
21579 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
21580 | return test2[n];
|
21581 | });
|
21582 | if (order2.join('') !== '0123456789') {
|
21583 | return false;
|
21584 | }
|
21585 |
|
21586 |
|
21587 | var test3 = {};
|
21588 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
21589 | test3[letter] = letter;
|
21590 | });
|
21591 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
21592 | 'abcdefghijklmnopqrst') {
|
21593 | return false;
|
21594 | }
|
21595 |
|
21596 | return true;
|
21597 | } catch (err) {
|
21598 |
|
21599 | return false;
|
21600 | }
|
21601 | }
|
21602 |
|
21603 | module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
21604 | var from;
|
21605 | var to = toObject(target);
|
21606 | var symbols;
|
21607 |
|
21608 | for (var s = 1; s < arguments.length; s++) {
|
21609 | from = Object(arguments[s]);
|
21610 |
|
21611 | for (var key in from) {
|
21612 | if (hasOwnProperty.call(from, key)) {
|
21613 | to[key] = from[key];
|
21614 | }
|
21615 | }
|
21616 |
|
21617 | if (getOwnPropertySymbols) {
|
21618 | symbols = getOwnPropertySymbols(from);
|
21619 | for (var i = 0; i < symbols.length; i++) {
|
21620 | if (propIsEnumerable.call(from, symbols[i])) {
|
21621 | to[symbols[i]] = from[symbols[i]];
|
21622 | }
|
21623 | }
|
21624 | }
|
21625 | }
|
21626 |
|
21627 | return to;
|
21628 | };
|
21629 |
|
21630 |
|
21631 | }),
|
21632 |
|
21633 | (function(module, exports, __webpack_require__) {
|
21634 |
|
21635 | "use strict";
|
21636 | |
21637 |
|
21638 |
|
21639 |
|
21640 |
|
21641 |
|
21642 |
|
21643 |
|
21644 |
|
21645 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
21646 | var invariant = __webpack_require__(2);
|
21647 | var warning = __webpack_require__(8);
|
21648 | var ReactPropTypesSecret = __webpack_require__(3);
|
21649 | var loggedTypeFailures = {};
|
21650 | }
|
21651 |
|
21652 | |
21653 |
|
21654 |
|
21655 |
|
21656 |
|
21657 |
|
21658 |
|
21659 |
|
21660 |
|
21661 |
|
21662 |
|
21663 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
21664 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
21665 | for (var typeSpecName in typeSpecs) {
|
21666 | if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
21667 | var error;
|
21668 |
|
21669 |
|
21670 |
|
21671 | try {
|
21672 |
|
21673 |
|
21674 | 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]);
|
21675 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
21676 | } catch (ex) {
|
21677 | error = ex;
|
21678 | }
|
21679 | 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);
|
21680 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
21681 |
|
21682 |
|
21683 | loggedTypeFailures[error.message] = true;
|
21684 |
|
21685 | var stack = getStack ? getStack() : '';
|
21686 |
|
21687 | warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
21688 | }
|
21689 | }
|
21690 | }
|
21691 | }
|
21692 | }
|
21693 |
|
21694 | module.exports = checkPropTypes;
|
21695 |
|
21696 |
|
21697 | }),
|
21698 |
|
21699 | (function(module, exports, __webpack_require__) {
|
21700 |
|
21701 | "use strict";
|
21702 | |
21703 |
|
21704 |
|
21705 |
|
21706 |
|
21707 |
|
21708 |
|
21709 |
|
21710 |
|
21711 | var emptyFunction = __webpack_require__(1);
|
21712 | var invariant = __webpack_require__(2);
|
21713 | var ReactPropTypesSecret = __webpack_require__(3);
|
21714 |
|
21715 | module.exports = function() {
|
21716 | function shim(props, propName, componentName, location, propFullName, secret) {
|
21717 | if (secret === ReactPropTypesSecret) {
|
21718 |
|
21719 | return;
|
21720 | }
|
21721 | invariant(
|
21722 | false,
|
21723 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
21724 | 'Use PropTypes.checkPropTypes() to call them. ' +
|
21725 | 'Read more at http://fb.me/use-check-prop-types'
|
21726 | );
|
21727 | };
|
21728 | shim.isRequired = shim;
|
21729 | function getShim() {
|
21730 | return shim;
|
21731 | };
|
21732 |
|
21733 |
|
21734 | var ReactPropTypes = {
|
21735 | array: shim,
|
21736 | bool: shim,
|
21737 | func: shim,
|
21738 | number: shim,
|
21739 | object: shim,
|
21740 | string: shim,
|
21741 | symbol: shim,
|
21742 |
|
21743 | any: shim,
|
21744 | arrayOf: getShim,
|
21745 | element: shim,
|
21746 | instanceOf: getShim,
|
21747 | node: shim,
|
21748 | objectOf: getShim,
|
21749 | oneOf: getShim,
|
21750 | oneOfType: getShim,
|
21751 | shape: getShim,
|
21752 | exact: getShim
|
21753 | };
|
21754 |
|
21755 | ReactPropTypes.checkPropTypes = emptyFunction;
|
21756 | ReactPropTypes.PropTypes = ReactPropTypes;
|
21757 |
|
21758 | return ReactPropTypes;
|
21759 | };
|
21760 |
|
21761 |
|
21762 | }),
|
21763 |
|
21764 | (function(module, exports, __webpack_require__) {
|
21765 |
|
21766 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; |
21767 |
|
21768 |
|
21769 |
|
21770 |
|
21771 |
|
21772 |
|
21773 | (function () {
|
21774 | 'use strict';
|
21775 |
|
21776 | var hasOwn = {}.hasOwnProperty;
|
21777 |
|
21778 | function classNames () {
|
21779 | var classes = [];
|
21780 |
|
21781 | for (var i = 0; i < arguments.length; i++) {
|
21782 | var arg = arguments[i];
|
21783 | if (!arg) continue;
|
21784 |
|
21785 | var argType = typeof arg;
|
21786 |
|
21787 | if (argType === 'string' || argType === 'number') {
|
21788 | classes.push(arg);
|
21789 | } else if (Array.isArray(arg)) {
|
21790 | classes.push(classNames.apply(null, arg));
|
21791 | } else if (argType === 'object') {
|
21792 | for (var key in arg) {
|
21793 | if (hasOwn.call(arg, key) && arg[key]) {
|
21794 | classes.push(key);
|
21795 | }
|
21796 | }
|
21797 | }
|
21798 | }
|
21799 |
|
21800 | return classes.join(' ');
|
21801 | }
|
21802 |
|
21803 | if (typeof module !== 'undefined' && module.exports) {
|
21804 | module.exports = classNames;
|
21805 | } else if (true) {
|
21806 |
|
21807 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
|
21808 | return classNames;
|
21809 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
|
21810 | __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
21811 | } else {
|
21812 | window.classNames = classNames;
|
21813 | }
|
21814 | }());
|
21815 |
|
21816 |
|
21817 | }),
|
21818 |
|
21819 | (function(module, exports, __webpack_require__) {
|
21820 |
|
21821 | "use strict";
|
21822 |
|
21823 |
|
21824 | Object.defineProperty(exports, "__esModule", {
|
21825 | value: true
|
21826 | });
|
21827 | exports.getPrefix = getPrefix;
|
21828 | exports.browserPrefixToKey = browserPrefixToKey;
|
21829 | exports.browserPrefixToStyle = browserPrefixToStyle;
|
21830 | var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
|
21831 | function getPrefix() /*: string*/ {
|
21832 | var prop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
|
21833 |
|
21834 |
|
21835 |
|
21836 |
|
21837 | if (typeof window === 'undefined' || typeof window.document === 'undefined') return '';
|
21838 |
|
21839 | var style = window.document.documentElement.style;
|
21840 |
|
21841 | if (prop in style) return '';
|
21842 |
|
21843 | for (var i = 0; i < prefixes.length; i++) {
|
21844 | if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i];
|
21845 | }
|
21846 |
|
21847 | return '';
|
21848 | }
|
21849 |
|
21850 | function browserPrefixToKey(prop /*: string*/, prefix /*: string*/) /*: string*/ {
|
21851 | return prefix ? '' + prefix + kebabToTitleCase(prop) : prop;
|
21852 | }
|
21853 |
|
21854 | function browserPrefixToStyle(prop /*: string*/, prefix /*: string*/) /*: string*/ {
|
21855 | return prefix ? '-' + prefix.toLowerCase() + '-' + prop : prop;
|
21856 | }
|
21857 |
|
21858 | function kebabToTitleCase(str /*: string*/) /*: string*/ {
|
21859 | var out = '';
|
21860 | var shouldCapitalize = true;
|
21861 | for (var i = 0; i < str.length; i++) {
|
21862 | if (shouldCapitalize) {
|
21863 | out += str[i].toUpperCase();
|
21864 | shouldCapitalize = false;
|
21865 | } else if (str[i] === '-') {
|
21866 | shouldCapitalize = true;
|
21867 | } else {
|
21868 | out += str[i];
|
21869 | }
|
21870 | }
|
21871 | return out;
|
21872 | }
|
21873 |
|
21874 |
|
21875 |
|
21876 |
|
21877 | exports.default = getPrefix();
|
21878 |
|
21879 | }),
|
21880 |
|
21881 | (function(module, exports) {
|
21882 |
|
21883 |
|
21884 | var process = module.exports = {};
|
21885 |
|
21886 |
|
21887 |
|
21888 |
|
21889 |
|
21890 |
|
21891 | var cachedSetTimeout;
|
21892 | var cachedClearTimeout;
|
21893 |
|
21894 | function defaultSetTimout() {
|
21895 | throw new Error('setTimeout has not been defined');
|
21896 | }
|
21897 | function defaultClearTimeout () {
|
21898 | throw new Error('clearTimeout has not been defined');
|
21899 | }
|
21900 | (function () {
|
21901 | try {
|
21902 | if (typeof setTimeout === 'function') {
|
21903 | cachedSetTimeout = setTimeout;
|
21904 | } else {
|
21905 | cachedSetTimeout = defaultSetTimout;
|
21906 | }
|
21907 | } catch (e) {
|
21908 | cachedSetTimeout = defaultSetTimout;
|
21909 | }
|
21910 | try {
|
21911 | if (typeof clearTimeout === 'function') {
|
21912 | cachedClearTimeout = clearTimeout;
|
21913 | } else {
|
21914 | cachedClearTimeout = defaultClearTimeout;
|
21915 | }
|
21916 | } catch (e) {
|
21917 | cachedClearTimeout = defaultClearTimeout;
|
21918 | }
|
21919 | } ())
|
21920 | function runTimeout(fun) {
|
21921 | if (cachedSetTimeout === setTimeout) {
|
21922 |
|
21923 | return setTimeout(fun, 0);
|
21924 | }
|
21925 |
|
21926 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
21927 | cachedSetTimeout = setTimeout;
|
21928 | return setTimeout(fun, 0);
|
21929 | }
|
21930 | try {
|
21931 |
|
21932 | return cachedSetTimeout(fun, 0);
|
21933 | } catch(e){
|
21934 | try {
|
21935 |
|
21936 | return cachedSetTimeout.call(null, fun, 0);
|
21937 | } catch(e){
|
21938 |
|
21939 | return cachedSetTimeout.call(this, fun, 0);
|
21940 | }
|
21941 | }
|
21942 |
|
21943 |
|
21944 | }
|
21945 | function runClearTimeout(marker) {
|
21946 | if (cachedClearTimeout === clearTimeout) {
|
21947 |
|
21948 | return clearTimeout(marker);
|
21949 | }
|
21950 |
|
21951 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
21952 | cachedClearTimeout = clearTimeout;
|
21953 | return clearTimeout(marker);
|
21954 | }
|
21955 | try {
|
21956 |
|
21957 | return cachedClearTimeout(marker);
|
21958 | } catch (e){
|
21959 | try {
|
21960 |
|
21961 | return cachedClearTimeout.call(null, marker);
|
21962 | } catch (e){
|
21963 |
|
21964 |
|
21965 | return cachedClearTimeout.call(this, marker);
|
21966 | }
|
21967 | }
|
21968 |
|
21969 |
|
21970 |
|
21971 | }
|
21972 | var queue = [];
|
21973 | var draining = false;
|
21974 | var currentQueue;
|
21975 | var queueIndex = -1;
|
21976 |
|
21977 | function cleanUpNextTick() {
|
21978 | if (!draining || !currentQueue) {
|
21979 | return;
|
21980 | }
|
21981 | draining = false;
|
21982 | if (currentQueue.length) {
|
21983 | queue = currentQueue.concat(queue);
|
21984 | } else {
|
21985 | queueIndex = -1;
|
21986 | }
|
21987 | if (queue.length) {
|
21988 | drainQueue();
|
21989 | }
|
21990 | }
|
21991 |
|
21992 | function drainQueue() {
|
21993 | if (draining) {
|
21994 | return;
|
21995 | }
|
21996 | var timeout = runTimeout(cleanUpNextTick);
|
21997 | draining = true;
|
21998 |
|
21999 | var len = queue.length;
|
22000 | while(len) {
|
22001 | currentQueue = queue;
|
22002 | queue = [];
|
22003 | while (++queueIndex < len) {
|
22004 | if (currentQueue) {
|
22005 | currentQueue[queueIndex].run();
|
22006 | }
|
22007 | }
|
22008 | queueIndex = -1;
|
22009 | len = queue.length;
|
22010 | }
|
22011 | currentQueue = null;
|
22012 | draining = false;
|
22013 | runClearTimeout(timeout);
|
22014 | }
|
22015 |
|
22016 | process.nextTick = function (fun) {
|
22017 | var args = new Array(arguments.length - 1);
|
22018 | if (arguments.length > 1) {
|
22019 | for (var i = 1; i < arguments.length; i++) {
|
22020 | args[i - 1] = arguments[i];
|
22021 | }
|
22022 | }
|
22023 | queue.push(new Item(fun, args));
|
22024 | if (queue.length === 1 && !draining) {
|
22025 | runTimeout(drainQueue);
|
22026 | }
|
22027 | };
|
22028 |
|
22029 |
|
22030 | function Item(fun, array) {
|
22031 | this.fun = fun;
|
22032 | this.array = array;
|
22033 | }
|
22034 | Item.prototype.run = function () {
|
22035 | this.fun.apply(null, this.array);
|
22036 | };
|
22037 | process.title = 'browser';
|
22038 | process.browser = true;
|
22039 | process.env = {};
|
22040 | process.argv = [];
|
22041 | process.version = '';
|
22042 | process.versions = {};
|
22043 |
|
22044 | function noop() {}
|
22045 |
|
22046 | process.on = noop;
|
22047 | process.addListener = noop;
|
22048 | process.once = noop;
|
22049 | process.off = noop;
|
22050 | process.removeListener = noop;
|
22051 | process.removeAllListeners = noop;
|
22052 | process.emit = noop;
|
22053 | process.prependListener = noop;
|
22054 | process.prependOnceListener = noop;
|
22055 |
|
22056 | process.listeners = function (name) { return [] }
|
22057 |
|
22058 | process.binding = function (name) {
|
22059 | throw new Error('process.binding is not supported');
|
22060 | };
|
22061 |
|
22062 | process.cwd = function () { return '/' };
|
22063 | process.chdir = function (dir) {
|
22064 | throw new Error('process.chdir is not supported');
|
22065 | };
|
22066 | process.umask = function() { return 0; };
|
22067 |
|
22068 |
|
22069 | })
|
22070 | ]);
|
22071 | });
|
22072 |
|
22073 |
|
22074 | }),
|
22075 |
|
22076 | (function(module, exports, __webpack_require__) {
|
22077 |
|
22078 | (function(global, module) { |
22079 |
|
22080 |
|
22081 |
|
22082 |
|
22083 |
|
22084 |
|
22085 |
|
22086 |
|
22087 |
|
22088 | var LARGE_ARRAY_SIZE = 200;
|
22089 |
|
22090 |
|
22091 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
22092 |
|
22093 |
|
22094 | var COMPARE_PARTIAL_FLAG = 1,
|
22095 | COMPARE_UNORDERED_FLAG = 2;
|
22096 |
|
22097 |
|
22098 | var MAX_SAFE_INTEGER = 9007199254740991;
|
22099 |
|
22100 |
|
22101 | var argsTag = '[object Arguments]',
|
22102 | arrayTag = '[object Array]',
|
22103 | asyncTag = '[object AsyncFunction]',
|
22104 | boolTag = '[object Boolean]',
|
22105 | dateTag = '[object Date]',
|
22106 | errorTag = '[object Error]',
|
22107 | funcTag = '[object Function]',
|
22108 | genTag = '[object GeneratorFunction]',
|
22109 | mapTag = '[object Map]',
|
22110 | numberTag = '[object Number]',
|
22111 | nullTag = '[object Null]',
|
22112 | objectTag = '[object Object]',
|
22113 | promiseTag = '[object Promise]',
|
22114 | proxyTag = '[object Proxy]',
|
22115 | regexpTag = '[object RegExp]',
|
22116 | setTag = '[object Set]',
|
22117 | stringTag = '[object String]',
|
22118 | symbolTag = '[object Symbol]',
|
22119 | undefinedTag = '[object Undefined]',
|
22120 | weakMapTag = '[object WeakMap]';
|
22121 |
|
22122 | var arrayBufferTag = '[object ArrayBuffer]',
|
22123 | dataViewTag = '[object DataView]',
|
22124 | float32Tag = '[object Float32Array]',
|
22125 | float64Tag = '[object Float64Array]',
|
22126 | int8Tag = '[object Int8Array]',
|
22127 | int16Tag = '[object Int16Array]',
|
22128 | int32Tag = '[object Int32Array]',
|
22129 | uint8Tag = '[object Uint8Array]',
|
22130 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
22131 | uint16Tag = '[object Uint16Array]',
|
22132 | uint32Tag = '[object Uint32Array]';
|
22133 |
|
22134 | |
22135 |
|
22136 |
|
22137 |
|
22138 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
22139 |
|
22140 |
|
22141 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
22142 |
|
22143 |
|
22144 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
22145 |
|
22146 |
|
22147 | var typedArrayTags = {};
|
22148 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
22149 | typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
22150 | typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
22151 | typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
22152 | typedArrayTags[uint32Tag] = true;
|
22153 | typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
22154 | typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
22155 | typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
22156 | typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
22157 | typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
22158 | typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
22159 | typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
22160 | typedArrayTags[weakMapTag] = false;
|
22161 |
|
22162 |
|
22163 | var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
22164 |
|
22165 |
|
22166 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
22167 |
|
22168 |
|
22169 | var root = freeGlobal || freeSelf || Function('return this')();
|
22170 |
|
22171 |
|
22172 | var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
22173 |
|
22174 |
|
22175 | var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
22176 |
|
22177 |
|
22178 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
22179 |
|
22180 |
|
22181 | var freeProcess = moduleExports && freeGlobal.process;
|
22182 |
|
22183 |
|
22184 | var nodeUtil = (function() {
|
22185 | try {
|
22186 | return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
22187 | } catch (e) {}
|
22188 | }());
|
22189 |
|
22190 |
|
22191 | var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
22192 |
|
22193 | |
22194 |
|
22195 |
|
22196 |
|
22197 |
|
22198 |
|
22199 |
|
22200 |
|
22201 |
|
22202 | function arrayFilter(array, predicate) {
|
22203 | var index = -1,
|
22204 | length = array == null ? 0 : array.length,
|
22205 | resIndex = 0,
|
22206 | result = [];
|
22207 |
|
22208 | while (++index < length) {
|
22209 | var value = array[index];
|
22210 | if (predicate(value, index, array)) {
|
22211 | result[resIndex++] = value;
|
22212 | }
|
22213 | }
|
22214 | return result;
|
22215 | }
|
22216 |
|
22217 | |
22218 |
|
22219 |
|
22220 |
|
22221 |
|
22222 |
|
22223 |
|
22224 |
|
22225 | function arrayPush(array, values) {
|
22226 | var index = -1,
|
22227 | length = values.length,
|
22228 | offset = array.length;
|
22229 |
|
22230 | while (++index < length) {
|
22231 | array[offset + index] = values[index];
|
22232 | }
|
22233 | return array;
|
22234 | }
|
22235 |
|
22236 | |
22237 |
|
22238 |
|
22239 |
|
22240 |
|
22241 |
|
22242 |
|
22243 |
|
22244 |
|
22245 |
|
22246 | function arraySome(array, predicate) {
|
22247 | var index = -1,
|
22248 | length = array == null ? 0 : array.length;
|
22249 |
|
22250 | while (++index < length) {
|
22251 | if (predicate(array[index], index, array)) {
|
22252 | return true;
|
22253 | }
|
22254 | }
|
22255 | return false;
|
22256 | }
|
22257 |
|
22258 | |
22259 |
|
22260 |
|
22261 |
|
22262 |
|
22263 |
|
22264 |
|
22265 |
|
22266 |
|
22267 | function baseTimes(n, iteratee) {
|
22268 | var index = -1,
|
22269 | result = Array(n);
|
22270 |
|
22271 | while (++index < n) {
|
22272 | result[index] = iteratee(index);
|
22273 | }
|
22274 | return result;
|
22275 | }
|
22276 |
|
22277 | |
22278 |
|
22279 |
|
22280 |
|
22281 |
|
22282 |
|
22283 |
|
22284 | function baseUnary(func) {
|
22285 | return function(value) {
|
22286 | return func(value);
|
22287 | };
|
22288 | }
|
22289 |
|
22290 | |
22291 |
|
22292 |
|
22293 |
|
22294 |
|
22295 |
|
22296 |
|
22297 |
|
22298 | function cacheHas(cache, key) {
|
22299 | return cache.has(key);
|
22300 | }
|
22301 |
|
22302 | |
22303 |
|
22304 |
|
22305 |
|
22306 |
|
22307 |
|
22308 |
|
22309 |
|
22310 | function getValue(object, key) {
|
22311 | return object == null ? undefined : object[key];
|
22312 | }
|
22313 |
|
22314 | |
22315 |
|
22316 |
|
22317 |
|
22318 |
|
22319 |
|
22320 |
|
22321 | function mapToArray(map) {
|
22322 | var index = -1,
|
22323 | result = Array(map.size);
|
22324 |
|
22325 | map.forEach(function(value, key) {
|
22326 | result[++index] = [key, value];
|
22327 | });
|
22328 | return result;
|
22329 | }
|
22330 |
|
22331 | |
22332 |
|
22333 |
|
22334 |
|
22335 |
|
22336 |
|
22337 |
|
22338 |
|
22339 | function overArg(func, transform) {
|
22340 | return function(arg) {
|
22341 | return func(transform(arg));
|
22342 | };
|
22343 | }
|
22344 |
|
22345 | |
22346 |
|
22347 |
|
22348 |
|
22349 |
|
22350 |
|
22351 |
|
22352 | function setToArray(set) {
|
22353 | var index = -1,
|
22354 | result = Array(set.size);
|
22355 |
|
22356 | set.forEach(function(value) {
|
22357 | result[++index] = value;
|
22358 | });
|
22359 | return result;
|
22360 | }
|
22361 |
|
22362 |
|
22363 | var arrayProto = Array.prototype,
|
22364 | funcProto = Function.prototype,
|
22365 | objectProto = Object.prototype;
|
22366 |
|
22367 |
|
22368 | var coreJsData = root['__core-js_shared__'];
|
22369 |
|
22370 |
|
22371 | var funcToString = funcProto.toString;
|
22372 |
|
22373 |
|
22374 | var hasOwnProperty = objectProto.hasOwnProperty;
|
22375 |
|
22376 |
|
22377 | var maskSrcKey = (function() {
|
22378 | var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
22379 | return uid ? ('Symbol(src)_1.' + uid) : '';
|
22380 | }());
|
22381 |
|
22382 | |
22383 |
|
22384 |
|
22385 |
|
22386 |
|
22387 | var nativeObjectToString = objectProto.toString;
|
22388 |
|
22389 |
|
22390 | var reIsNative = RegExp('^' +
|
22391 | funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
22392 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
22393 | );
|
22394 |
|
22395 |
|
22396 | var Buffer = moduleExports ? root.Buffer : undefined,
|
22397 | Symbol = root.Symbol,
|
22398 | Uint8Array = root.Uint8Array,
|
22399 | propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
22400 | splice = arrayProto.splice,
|
22401 | symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
22402 |
|
22403 |
|
22404 | var nativeGetSymbols = Object.getOwnPropertySymbols,
|
22405 | nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
|
22406 | nativeKeys = overArg(Object.keys, Object);
|
22407 |
|
22408 |
|
22409 | var DataView = getNative(root, 'DataView'),
|
22410 | Map = getNative(root, 'Map'),
|
22411 | Promise = getNative(root, 'Promise'),
|
22412 | Set = getNative(root, 'Set'),
|
22413 | WeakMap = getNative(root, 'WeakMap'),
|
22414 | nativeCreate = getNative(Object, 'create');
|
22415 |
|
22416 |
|
22417 | var dataViewCtorString = toSource(DataView),
|
22418 | mapCtorString = toSource(Map),
|
22419 | promiseCtorString = toSource(Promise),
|
22420 | setCtorString = toSource(Set),
|
22421 | weakMapCtorString = toSource(WeakMap);
|
22422 |
|
22423 |
|
22424 | var symbolProto = Symbol ? Symbol.prototype : undefined,
|
22425 | symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
22426 |
|
22427 | |
22428 |
|
22429 |
|
22430 |
|
22431 |
|
22432 |
|
22433 |
|
22434 | function Hash(entries) {
|
22435 | var index = -1,
|
22436 | length = entries == null ? 0 : entries.length;
|
22437 |
|
22438 | this.clear();
|
22439 | while (++index < length) {
|
22440 | var entry = entries[index];
|
22441 | this.set(entry[0], entry[1]);
|
22442 | }
|
22443 | }
|
22444 |
|
22445 | |
22446 |
|
22447 |
|
22448 |
|
22449 |
|
22450 |
|
22451 |
|
22452 | function hashClear() {
|
22453 | this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
22454 | this.size = 0;
|
22455 | }
|
22456 |
|
22457 | |
22458 |
|
22459 |
|
22460 |
|
22461 |
|
22462 |
|
22463 |
|
22464 |
|
22465 |
|
22466 |
|
22467 | function hashDelete(key) {
|
22468 | var result = this.has(key) && delete this.__data__[key];
|
22469 | this.size -= result ? 1 : 0;
|
22470 | return result;
|
22471 | }
|
22472 |
|
22473 | |
22474 |
|
22475 |
|
22476 |
|
22477 |
|
22478 |
|
22479 |
|
22480 |
|
22481 |
|
22482 | function hashGet(key) {
|
22483 | var data = this.__data__;
|
22484 | if (nativeCreate) {
|
22485 | var result = data[key];
|
22486 | return result === HASH_UNDEFINED ? undefined : result;
|
22487 | }
|
22488 | return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
22489 | }
|
22490 |
|
22491 | |
22492 |
|
22493 |
|
22494 |
|
22495 |
|
22496 |
|
22497 |
|
22498 |
|
22499 |
|
22500 | function hashHas(key) {
|
22501 | var data = this.__data__;
|
22502 | return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
22503 | }
|
22504 |
|
22505 | |
22506 |
|
22507 |
|
22508 |
|
22509 |
|
22510 |
|
22511 |
|
22512 |
|
22513 |
|
22514 |
|
22515 | function hashSet(key, value) {
|
22516 | var data = this.__data__;
|
22517 | this.size += this.has(key) ? 0 : 1;
|
22518 | data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
22519 | return this;
|
22520 | }
|
22521 |
|
22522 |
|
22523 | Hash.prototype.clear = hashClear;
|
22524 | Hash.prototype['delete'] = hashDelete;
|
22525 | Hash.prototype.get = hashGet;
|
22526 | Hash.prototype.has = hashHas;
|
22527 | Hash.prototype.set = hashSet;
|
22528 |
|
22529 | |
22530 |
|
22531 |
|
22532 |
|
22533 |
|
22534 |
|
22535 |
|
22536 | function ListCache(entries) {
|
22537 | var index = -1,
|
22538 | length = entries == null ? 0 : entries.length;
|
22539 |
|
22540 | this.clear();
|
22541 | while (++index < length) {
|
22542 | var entry = entries[index];
|
22543 | this.set(entry[0], entry[1]);
|
22544 | }
|
22545 | }
|
22546 |
|
22547 | |
22548 |
|
22549 |
|
22550 |
|
22551 |
|
22552 |
|
22553 |
|
22554 | function listCacheClear() {
|
22555 | this.__data__ = [];
|
22556 | this.size = 0;
|
22557 | }
|
22558 |
|
22559 | |
22560 |
|
22561 |
|
22562 |
|
22563 |
|
22564 |
|
22565 |
|
22566 |
|
22567 |
|
22568 | function listCacheDelete(key) {
|
22569 | var data = this.__data__,
|
22570 | index = assocIndexOf(data, key);
|
22571 |
|
22572 | if (index < 0) {
|
22573 | return false;
|
22574 | }
|
22575 | var lastIndex = data.length - 1;
|
22576 | if (index == lastIndex) {
|
22577 | data.pop();
|
22578 | } else {
|
22579 | splice.call(data, index, 1);
|
22580 | }
|
22581 | --this.size;
|
22582 | return true;
|
22583 | }
|
22584 |
|
22585 | |
22586 |
|
22587 |
|
22588 |
|
22589 |
|
22590 |
|
22591 |
|
22592 |
|
22593 |
|
22594 | function listCacheGet(key) {
|
22595 | var data = this.__data__,
|
22596 | index = assocIndexOf(data, key);
|
22597 |
|
22598 | return index < 0 ? undefined : data[index][1];
|
22599 | }
|
22600 |
|
22601 | |
22602 |
|
22603 |
|
22604 |
|
22605 |
|
22606 |
|
22607 |
|
22608 |
|
22609 |
|
22610 | function listCacheHas(key) {
|
22611 | return assocIndexOf(this.__data__, key) > -1;
|
22612 | }
|
22613 |
|
22614 | |
22615 |
|
22616 |
|
22617 |
|
22618 |
|
22619 |
|
22620 |
|
22621 |
|
22622 |
|
22623 |
|
22624 | function listCacheSet(key, value) {
|
22625 | var data = this.__data__,
|
22626 | index = assocIndexOf(data, key);
|
22627 |
|
22628 | if (index < 0) {
|
22629 | ++this.size;
|
22630 | data.push([key, value]);
|
22631 | } else {
|
22632 | data[index][1] = value;
|
22633 | }
|
22634 | return this;
|
22635 | }
|
22636 |
|
22637 |
|
22638 | ListCache.prototype.clear = listCacheClear;
|
22639 | ListCache.prototype['delete'] = listCacheDelete;
|
22640 | ListCache.prototype.get = listCacheGet;
|
22641 | ListCache.prototype.has = listCacheHas;
|
22642 | ListCache.prototype.set = listCacheSet;
|
22643 |
|
22644 | |
22645 |
|
22646 |
|
22647 |
|
22648 |
|
22649 |
|
22650 |
|
22651 | function MapCache(entries) {
|
22652 | var index = -1,
|
22653 | length = entries == null ? 0 : entries.length;
|
22654 |
|
22655 | this.clear();
|
22656 | while (++index < length) {
|
22657 | var entry = entries[index];
|
22658 | this.set(entry[0], entry[1]);
|
22659 | }
|
22660 | }
|
22661 |
|
22662 | |
22663 |
|
22664 |
|
22665 |
|
22666 |
|
22667 |
|
22668 |
|
22669 | function mapCacheClear() {
|
22670 | this.size = 0;
|
22671 | this.__data__ = {
|
22672 | 'hash': new Hash,
|
22673 | 'map': new (Map || ListCache),
|
22674 | 'string': new Hash
|
22675 | };
|
22676 | }
|
22677 |
|
22678 | |
22679 |
|
22680 |
|
22681 |
|
22682 |
|
22683 |
|
22684 |
|
22685 |
|
22686 |
|
22687 | function mapCacheDelete(key) {
|
22688 | var result = getMapData(this, key)['delete'](key);
|
22689 | this.size -= result ? 1 : 0;
|
22690 | return result;
|
22691 | }
|
22692 |
|
22693 | |
22694 |
|
22695 |
|
22696 |
|
22697 |
|
22698 |
|
22699 |
|
22700 |
|
22701 |
|
22702 | function mapCacheGet(key) {
|
22703 | return getMapData(this, key).get(key);
|
22704 | }
|
22705 |
|
22706 | |
22707 |
|
22708 |
|
22709 |
|
22710 |
|
22711 |
|
22712 |
|
22713 |
|
22714 |
|
22715 | function mapCacheHas(key) {
|
22716 | return getMapData(this, key).has(key);
|
22717 | }
|
22718 |
|
22719 | |
22720 |
|
22721 |
|
22722 |
|
22723 |
|
22724 |
|
22725 |
|
22726 |
|
22727 |
|
22728 |
|
22729 | function mapCacheSet(key, value) {
|
22730 | var data = getMapData(this, key),
|
22731 | size = data.size;
|
22732 |
|
22733 | data.set(key, value);
|
22734 | this.size += data.size == size ? 0 : 1;
|
22735 | return this;
|
22736 | }
|
22737 |
|
22738 |
|
22739 | MapCache.prototype.clear = mapCacheClear;
|
22740 | MapCache.prototype['delete'] = mapCacheDelete;
|
22741 | MapCache.prototype.get = mapCacheGet;
|
22742 | MapCache.prototype.has = mapCacheHas;
|
22743 | MapCache.prototype.set = mapCacheSet;
|
22744 |
|
22745 | |
22746 |
|
22747 |
|
22748 |
|
22749 |
|
22750 |
|
22751 |
|
22752 |
|
22753 | function SetCache(values) {
|
22754 | var index = -1,
|
22755 | length = values == null ? 0 : values.length;
|
22756 |
|
22757 | this.__data__ = new MapCache;
|
22758 | while (++index < length) {
|
22759 | this.add(values[index]);
|
22760 | }
|
22761 | }
|
22762 |
|
22763 | |
22764 |
|
22765 |
|
22766 |
|
22767 |
|
22768 |
|
22769 |
|
22770 |
|
22771 |
|
22772 |
|
22773 | function setCacheAdd(value) {
|
22774 | this.__data__.set(value, HASH_UNDEFINED);
|
22775 | return this;
|
22776 | }
|
22777 |
|
22778 | |
22779 |
|
22780 |
|
22781 |
|
22782 |
|
22783 |
|
22784 |
|
22785 |
|
22786 |
|
22787 | function setCacheHas(value) {
|
22788 | return this.__data__.has(value);
|
22789 | }
|
22790 |
|
22791 |
|
22792 | SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
22793 | SetCache.prototype.has = setCacheHas;
|
22794 |
|
22795 | |
22796 |
|
22797 |
|
22798 |
|
22799 |
|
22800 |
|
22801 |
|
22802 | function Stack(entries) {
|
22803 | var data = this.__data__ = new ListCache(entries);
|
22804 | this.size = data.size;
|
22805 | }
|
22806 |
|
22807 | |
22808 |
|
22809 |
|
22810 |
|
22811 |
|
22812 |
|
22813 |
|
22814 | function stackClear() {
|
22815 | this.__data__ = new ListCache;
|
22816 | this.size = 0;
|
22817 | }
|
22818 |
|
22819 | |
22820 |
|
22821 |
|
22822 |
|
22823 |
|
22824 |
|
22825 |
|
22826 |
|
22827 |
|
22828 | function stackDelete(key) {
|
22829 | var data = this.__data__,
|
22830 | result = data['delete'](key);
|
22831 |
|
22832 | this.size = data.size;
|
22833 | return result;
|
22834 | }
|
22835 |
|
22836 | |
22837 |
|
22838 |
|
22839 |
|
22840 |
|
22841 |
|
22842 |
|
22843 |
|
22844 |
|
22845 | function stackGet(key) {
|
22846 | return this.__data__.get(key);
|
22847 | }
|
22848 |
|
22849 | |
22850 |
|
22851 |
|
22852 |
|
22853 |
|
22854 |
|
22855 |
|
22856 |
|
22857 |
|
22858 | function stackHas(key) {
|
22859 | return this.__data__.has(key);
|
22860 | }
|
22861 |
|
22862 | |
22863 |
|
22864 |
|
22865 |
|
22866 |
|
22867 |
|
22868 |
|
22869 |
|
22870 |
|
22871 |
|
22872 | function stackSet(key, value) {
|
22873 | var data = this.__data__;
|
22874 | if (data instanceof ListCache) {
|
22875 | var pairs = data.__data__;
|
22876 | if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
22877 | pairs.push([key, value]);
|
22878 | this.size = ++data.size;
|
22879 | return this;
|
22880 | }
|
22881 | data = this.__data__ = new MapCache(pairs);
|
22882 | }
|
22883 | data.set(key, value);
|
22884 | this.size = data.size;
|
22885 | return this;
|
22886 | }
|
22887 |
|
22888 |
|
22889 | Stack.prototype.clear = stackClear;
|
22890 | Stack.prototype['delete'] = stackDelete;
|
22891 | Stack.prototype.get = stackGet;
|
22892 | Stack.prototype.has = stackHas;
|
22893 | Stack.prototype.set = stackSet;
|
22894 |
|
22895 | |
22896 |
|
22897 |
|
22898 |
|
22899 |
|
22900 |
|
22901 |
|
22902 |
|
22903 | function arrayLikeKeys(value, inherited) {
|
22904 | var isArr = isArray(value),
|
22905 | isArg = !isArr && isArguments(value),
|
22906 | isBuff = !isArr && !isArg && isBuffer(value),
|
22907 | isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
22908 | skipIndexes = isArr || isArg || isBuff || isType,
|
22909 | result = skipIndexes ? baseTimes(value.length, String) : [],
|
22910 | length = result.length;
|
22911 |
|
22912 | for (var key in value) {
|
22913 | if ((inherited || hasOwnProperty.call(value, key)) &&
|
22914 | !(skipIndexes && (
|
22915 |
|
22916 | key == 'length' ||
|
22917 |
|
22918 | (isBuff && (key == 'offset' || key == 'parent')) ||
|
22919 |
|
22920 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
22921 |
|
22922 | isIndex(key, length)
|
22923 | ))) {
|
22924 | result.push(key);
|
22925 | }
|
22926 | }
|
22927 | return result;
|
22928 | }
|
22929 |
|
22930 | |
22931 |
|
22932 |
|
22933 |
|
22934 |
|
22935 |
|
22936 |
|
22937 |
|
22938 | function assocIndexOf(array, key) {
|
22939 | var length = array.length;
|
22940 | while (length--) {
|
22941 | if (eq(array[length][0], key)) {
|
22942 | return length;
|
22943 | }
|
22944 | }
|
22945 | return -1;
|
22946 | }
|
22947 |
|
22948 | |
22949 |
|
22950 |
|
22951 |
|
22952 |
|
22953 |
|
22954 |
|
22955 |
|
22956 |
|
22957 |
|
22958 |
|
22959 | function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
22960 | var result = keysFunc(object);
|
22961 | return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
22962 | }
|
22963 |
|
22964 | |
22965 |
|
22966 |
|
22967 |
|
22968 |
|
22969 |
|
22970 |
|
22971 | function baseGetTag(value) {
|
22972 | if (value == null) {
|
22973 | return value === undefined ? undefinedTag : nullTag;
|
22974 | }
|
22975 | return (symToStringTag && symToStringTag in Object(value))
|
22976 | ? getRawTag(value)
|
22977 | : objectToString(value);
|
22978 | }
|
22979 |
|
22980 | |
22981 |
|
22982 |
|
22983 |
|
22984 |
|
22985 |
|
22986 |
|
22987 | function baseIsArguments(value) {
|
22988 | return isObjectLike(value) && baseGetTag(value) == argsTag;
|
22989 | }
|
22990 |
|
22991 | |
22992 |
|
22993 |
|
22994 |
|
22995 |
|
22996 |
|
22997 |
|
22998 |
|
22999 |
|
23000 |
|
23001 |
|
23002 |
|
23003 |
|
23004 |
|
23005 | function baseIsEqual(value, other, bitmask, customizer, stack) {
|
23006 | if (value === other) {
|
23007 | return true;
|
23008 | }
|
23009 | if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
23010 | return value !== value && other !== other;
|
23011 | }
|
23012 | return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
23013 | }
|
23014 |
|
23015 | |
23016 |
|
23017 |
|
23018 |
|
23019 |
|
23020 |
|
23021 |
|
23022 |
|
23023 |
|
23024 |
|
23025 |
|
23026 |
|
23027 |
|
23028 |
|
23029 | function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
23030 | var objIsArr = isArray(object),
|
23031 | othIsArr = isArray(other),
|
23032 | objTag = objIsArr ? arrayTag : getTag(object),
|
23033 | othTag = othIsArr ? arrayTag : getTag(other);
|
23034 |
|
23035 | objTag = objTag == argsTag ? objectTag : objTag;
|
23036 | othTag = othTag == argsTag ? objectTag : othTag;
|
23037 |
|
23038 | var objIsObj = objTag == objectTag,
|
23039 | othIsObj = othTag == objectTag,
|
23040 | isSameTag = objTag == othTag;
|
23041 |
|
23042 | if (isSameTag && isBuffer(object)) {
|
23043 | if (!isBuffer(other)) {
|
23044 | return false;
|
23045 | }
|
23046 | objIsArr = true;
|
23047 | objIsObj = false;
|
23048 | }
|
23049 | if (isSameTag && !objIsObj) {
|
23050 | stack || (stack = new Stack);
|
23051 | return (objIsArr || isTypedArray(object))
|
23052 | ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
23053 | : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
23054 | }
|
23055 | if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
23056 | var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
23057 | othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
23058 |
|
23059 | if (objIsWrapped || othIsWrapped) {
|
23060 | var objUnwrapped = objIsWrapped ? object.value() : object,
|
23061 | othUnwrapped = othIsWrapped ? other.value() : other;
|
23062 |
|
23063 | stack || (stack = new Stack);
|
23064 | return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
23065 | }
|
23066 | }
|
23067 | if (!isSameTag) {
|
23068 | return false;
|
23069 | }
|
23070 | stack || (stack = new Stack);
|
23071 | return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
23072 | }
|
23073 |
|
23074 | |
23075 |
|
23076 |
|
23077 |
|
23078 |
|
23079 |
|
23080 |
|
23081 |
|
23082 | function baseIsNative(value) {
|
23083 | if (!isObject(value) || isMasked(value)) {
|
23084 | return false;
|
23085 | }
|
23086 | var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
23087 | return pattern.test(toSource(value));
|
23088 | }
|
23089 |
|
23090 | |
23091 |
|
23092 |
|
23093 |
|
23094 |
|
23095 |
|
23096 |
|
23097 | function baseIsTypedArray(value) {
|
23098 | return isObjectLike(value) &&
|
23099 | isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
23100 | }
|
23101 |
|
23102 | |
23103 |
|
23104 |
|
23105 |
|
23106 |
|
23107 |
|
23108 |
|
23109 | function baseKeys(object) {
|
23110 | if (!isPrototype(object)) {
|
23111 | return nativeKeys(object);
|
23112 | }
|
23113 | var result = [];
|
23114 | for (var key in Object(object)) {
|
23115 | if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
23116 | result.push(key);
|
23117 | }
|
23118 | }
|
23119 | return result;
|
23120 | }
|
23121 |
|
23122 | |
23123 |
|
23124 |
|
23125 |
|
23126 |
|
23127 |
|
23128 |
|
23129 |
|
23130 |
|
23131 |
|
23132 |
|
23133 |
|
23134 |
|
23135 | function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
23136 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
23137 | arrLength = array.length,
|
23138 | othLength = other.length;
|
23139 |
|
23140 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
23141 | return false;
|
23142 | }
|
23143 |
|
23144 | var stacked = stack.get(array);
|
23145 | if (stacked && stack.get(other)) {
|
23146 | return stacked == other;
|
23147 | }
|
23148 | var index = -1,
|
23149 | result = true,
|
23150 | seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
|
23151 |
|
23152 | stack.set(array, other);
|
23153 | stack.set(other, array);
|
23154 |
|
23155 |
|
23156 | while (++index < arrLength) {
|
23157 | var arrValue = array[index],
|
23158 | othValue = other[index];
|
23159 |
|
23160 | if (customizer) {
|
23161 | var compared = isPartial
|
23162 | ? customizer(othValue, arrValue, index, other, array, stack)
|
23163 | : customizer(arrValue, othValue, index, array, other, stack);
|
23164 | }
|
23165 | if (compared !== undefined) {
|
23166 | if (compared) {
|
23167 | continue;
|
23168 | }
|
23169 | result = false;
|
23170 | break;
|
23171 | }
|
23172 |
|
23173 | if (seen) {
|
23174 | if (!arraySome(other, function(othValue, othIndex) {
|
23175 | if (!cacheHas(seen, othIndex) &&
|
23176 | (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
23177 | return seen.push(othIndex);
|
23178 | }
|
23179 | })) {
|
23180 | result = false;
|
23181 | break;
|
23182 | }
|
23183 | } else if (!(
|
23184 | arrValue === othValue ||
|
23185 | equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
23186 | )) {
|
23187 | result = false;
|
23188 | break;
|
23189 | }
|
23190 | }
|
23191 | stack['delete'](array);
|
23192 | stack['delete'](other);
|
23193 | return result;
|
23194 | }
|
23195 |
|
23196 | |
23197 |
|
23198 |
|
23199 |
|
23200 |
|
23201 |
|
23202 |
|
23203 |
|
23204 |
|
23205 |
|
23206 |
|
23207 |
|
23208 |
|
23209 |
|
23210 |
|
23211 |
|
23212 |
|
23213 | function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
23214 | switch (tag) {
|
23215 | case dataViewTag:
|
23216 | if ((object.byteLength != other.byteLength) ||
|
23217 | (object.byteOffset != other.byteOffset)) {
|
23218 | return false;
|
23219 | }
|
23220 | object = object.buffer;
|
23221 | other = other.buffer;
|
23222 |
|
23223 | case arrayBufferTag:
|
23224 | if ((object.byteLength != other.byteLength) ||
|
23225 | !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
23226 | return false;
|
23227 | }
|
23228 | return true;
|
23229 |
|
23230 | case boolTag:
|
23231 | case dateTag:
|
23232 | case numberTag:
|
23233 |
|
23234 |
|
23235 | return eq(+object, +other);
|
23236 |
|
23237 | case errorTag:
|
23238 | return object.name == other.name && object.message == other.message;
|
23239 |
|
23240 | case regexpTag:
|
23241 | case stringTag:
|
23242 |
|
23243 |
|
23244 |
|
23245 | return object == (other + '');
|
23246 |
|
23247 | case mapTag:
|
23248 | var convert = mapToArray;
|
23249 |
|
23250 | case setTag:
|
23251 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
23252 | convert || (convert = setToArray);
|
23253 |
|
23254 | if (object.size != other.size && !isPartial) {
|
23255 | return false;
|
23256 | }
|
23257 |
|
23258 | var stacked = stack.get(object);
|
23259 | if (stacked) {
|
23260 | return stacked == other;
|
23261 | }
|
23262 | bitmask |= COMPARE_UNORDERED_FLAG;
|
23263 |
|
23264 |
|
23265 | stack.set(object, other);
|
23266 | var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
23267 | stack['delete'](object);
|
23268 | return result;
|
23269 |
|
23270 | case symbolTag:
|
23271 | if (symbolValueOf) {
|
23272 | return symbolValueOf.call(object) == symbolValueOf.call(other);
|
23273 | }
|
23274 | }
|
23275 | return false;
|
23276 | }
|
23277 |
|
23278 | |
23279 |
|
23280 |
|
23281 |
|
23282 |
|
23283 |
|
23284 |
|
23285 |
|
23286 |
|
23287 |
|
23288 |
|
23289 |
|
23290 |
|
23291 | function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
23292 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
23293 | objProps = getAllKeys(object),
|
23294 | objLength = objProps.length,
|
23295 | othProps = getAllKeys(other),
|
23296 | othLength = othProps.length;
|
23297 |
|
23298 | if (objLength != othLength && !isPartial) {
|
23299 | return false;
|
23300 | }
|
23301 | var index = objLength;
|
23302 | while (index--) {
|
23303 | var key = objProps[index];
|
23304 | if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
23305 | return false;
|
23306 | }
|
23307 | }
|
23308 |
|
23309 | var stacked = stack.get(object);
|
23310 | if (stacked && stack.get(other)) {
|
23311 | return stacked == other;
|
23312 | }
|
23313 | var result = true;
|
23314 | stack.set(object, other);
|
23315 | stack.set(other, object);
|
23316 |
|
23317 | var skipCtor = isPartial;
|
23318 | while (++index < objLength) {
|
23319 | key = objProps[index];
|
23320 | var objValue = object[key],
|
23321 | othValue = other[key];
|
23322 |
|
23323 | if (customizer) {
|
23324 | var compared = isPartial
|
23325 | ? customizer(othValue, objValue, key, other, object, stack)
|
23326 | : customizer(objValue, othValue, key, object, other, stack);
|
23327 | }
|
23328 |
|
23329 | if (!(compared === undefined
|
23330 | ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
23331 | : compared
|
23332 | )) {
|
23333 | result = false;
|
23334 | break;
|
23335 | }
|
23336 | skipCtor || (skipCtor = key == 'constructor');
|
23337 | }
|
23338 | if (result && !skipCtor) {
|
23339 | var objCtor = object.constructor,
|
23340 | othCtor = other.constructor;
|
23341 |
|
23342 |
|
23343 | if (objCtor != othCtor &&
|
23344 | ('constructor' in object && 'constructor' in other) &&
|
23345 | !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
23346 | typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
23347 | result = false;
|
23348 | }
|
23349 | }
|
23350 | stack['delete'](object);
|
23351 | stack['delete'](other);
|
23352 | return result;
|
23353 | }
|
23354 |
|
23355 | |
23356 |
|
23357 |
|
23358 |
|
23359 |
|
23360 |
|
23361 |
|
23362 | function getAllKeys(object) {
|
23363 | return baseGetAllKeys(object, keys, getSymbols);
|
23364 | }
|
23365 |
|
23366 | |
23367 |
|
23368 |
|
23369 |
|
23370 |
|
23371 |
|
23372 |
|
23373 |
|
23374 | function getMapData(map, key) {
|
23375 | var data = map.__data__;
|
23376 | return isKeyable(key)
|
23377 | ? data[typeof key == 'string' ? 'string' : 'hash']
|
23378 | : data.map;
|
23379 | }
|
23380 |
|
23381 | |
23382 |
|
23383 |
|
23384 |
|
23385 |
|
23386 |
|
23387 |
|
23388 |
|
23389 | function getNative(object, key) {
|
23390 | var value = getValue(object, key);
|
23391 | return baseIsNative(value) ? value : undefined;
|
23392 | }
|
23393 |
|
23394 | |
23395 |
|
23396 |
|
23397 |
|
23398 |
|
23399 |
|
23400 |
|
23401 | function getRawTag(value) {
|
23402 | var isOwn = hasOwnProperty.call(value, symToStringTag),
|
23403 | tag = value[symToStringTag];
|
23404 |
|
23405 | try {
|
23406 | value[symToStringTag] = undefined;
|
23407 | var unmasked = true;
|
23408 | } catch (e) {}
|
23409 |
|
23410 | var result = nativeObjectToString.call(value);
|
23411 | if (unmasked) {
|
23412 | if (isOwn) {
|
23413 | value[symToStringTag] = tag;
|
23414 | } else {
|
23415 | delete value[symToStringTag];
|
23416 | }
|
23417 | }
|
23418 | return result;
|
23419 | }
|
23420 |
|
23421 | |
23422 |
|
23423 |
|
23424 |
|
23425 |
|
23426 |
|
23427 |
|
23428 | var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
23429 | if (object == null) {
|
23430 | return [];
|
23431 | }
|
23432 | object = Object(object);
|
23433 | return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
23434 | return propertyIsEnumerable.call(object, symbol);
|
23435 | });
|
23436 | };
|
23437 |
|
23438 | |
23439 |
|
23440 |
|
23441 |
|
23442 |
|
23443 |
|
23444 |
|
23445 | var getTag = baseGetTag;
|
23446 |
|
23447 |
|
23448 | if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
23449 | (Map && getTag(new Map) != mapTag) ||
|
23450 | (Promise && getTag(Promise.resolve()) != promiseTag) ||
|
23451 | (Set && getTag(new Set) != setTag) ||
|
23452 | (WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
23453 | getTag = function(value) {
|
23454 | var result = baseGetTag(value),
|
23455 | Ctor = result == objectTag ? value.constructor : undefined,
|
23456 | ctorString = Ctor ? toSource(Ctor) : '';
|
23457 |
|
23458 | if (ctorString) {
|
23459 | switch (ctorString) {
|
23460 | case dataViewCtorString: return dataViewTag;
|
23461 | case mapCtorString: return mapTag;
|
23462 | case promiseCtorString: return promiseTag;
|
23463 | case setCtorString: return setTag;
|
23464 | case weakMapCtorString: return weakMapTag;
|
23465 | }
|
23466 | }
|
23467 | return result;
|
23468 | };
|
23469 | }
|
23470 |
|
23471 | |
23472 |
|
23473 |
|
23474 |
|
23475 |
|
23476 |
|
23477 |
|
23478 |
|
23479 | function isIndex(value, length) {
|
23480 | length = length == null ? MAX_SAFE_INTEGER : length;
|
23481 | return !!length &&
|
23482 | (typeof value == 'number' || reIsUint.test(value)) &&
|
23483 | (value > -1 && value % 1 == 0 && value < length);
|
23484 | }
|
23485 |
|
23486 | |
23487 |
|
23488 |
|
23489 |
|
23490 |
|
23491 |
|
23492 |
|
23493 | function isKeyable(value) {
|
23494 | var type = typeof value;
|
23495 | return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
23496 | ? (value !== '__proto__')
|
23497 | : (value === null);
|
23498 | }
|
23499 |
|
23500 | |
23501 |
|
23502 |
|
23503 |
|
23504 |
|
23505 |
|
23506 |
|
23507 | function isMasked(func) {
|
23508 | return !!maskSrcKey && (maskSrcKey in func);
|
23509 | }
|
23510 |
|
23511 | |
23512 |
|
23513 |
|
23514 |
|
23515 |
|
23516 |
|
23517 |
|
23518 | function isPrototype(value) {
|
23519 | var Ctor = value && value.constructor,
|
23520 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
23521 |
|
23522 | return value === proto;
|
23523 | }
|
23524 |
|
23525 | |
23526 |
|
23527 |
|
23528 |
|
23529 |
|
23530 |
|
23531 |
|
23532 | function objectToString(value) {
|
23533 | return nativeObjectToString.call(value);
|
23534 | }
|
23535 |
|
23536 | |
23537 |
|
23538 |
|
23539 |
|
23540 |
|
23541 |
|
23542 |
|
23543 | function toSource(func) {
|
23544 | if (func != null) {
|
23545 | try {
|
23546 | return funcToString.call(func);
|
23547 | } catch (e) {}
|
23548 | try {
|
23549 | return (func + '');
|
23550 | } catch (e) {}
|
23551 | }
|
23552 | return '';
|
23553 | }
|
23554 |
|
23555 | |
23556 |
|
23557 |
|
23558 |
|
23559 |
|
23560 |
|
23561 |
|
23562 |
|
23563 |
|
23564 |
|
23565 |
|
23566 |
|
23567 |
|
23568 |
|
23569 |
|
23570 |
|
23571 |
|
23572 |
|
23573 |
|
23574 |
|
23575 |
|
23576 |
|
23577 |
|
23578 |
|
23579 |
|
23580 |
|
23581 |
|
23582 |
|
23583 |
|
23584 |
|
23585 |
|
23586 |
|
23587 | function eq(value, other) {
|
23588 | return value === other || (value !== value && other !== other);
|
23589 | }
|
23590 |
|
23591 | |
23592 |
|
23593 |
|
23594 |
|
23595 |
|
23596 |
|
23597 |
|
23598 |
|
23599 |
|
23600 |
|
23601 |
|
23602 |
|
23603 |
|
23604 |
|
23605 |
|
23606 |
|
23607 |
|
23608 |
|
23609 | var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
23610 | return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
23611 | !propertyIsEnumerable.call(value, 'callee');
|
23612 | };
|
23613 |
|
23614 | |
23615 |
|
23616 |
|
23617 |
|
23618 |
|
23619 |
|
23620 |
|
23621 |
|
23622 |
|
23623 |
|
23624 |
|
23625 |
|
23626 |
|
23627 |
|
23628 |
|
23629 |
|
23630 |
|
23631 |
|
23632 |
|
23633 |
|
23634 |
|
23635 |
|
23636 |
|
23637 | var isArray = Array.isArray;
|
23638 |
|
23639 | |
23640 |
|
23641 |
|
23642 |
|
23643 |
|
23644 |
|
23645 |
|
23646 |
|
23647 |
|
23648 |
|
23649 |
|
23650 |
|
23651 |
|
23652 |
|
23653 |
|
23654 |
|
23655 |
|
23656 |
|
23657 |
|
23658 |
|
23659 |
|
23660 |
|
23661 |
|
23662 |
|
23663 |
|
23664 | function isArrayLike(value) {
|
23665 | return value != null && isLength(value.length) && !isFunction(value);
|
23666 | }
|
23667 |
|
23668 | |
23669 |
|
23670 |
|
23671 |
|
23672 |
|
23673 |
|
23674 |
|
23675 |
|
23676 |
|
23677 |
|
23678 |
|
23679 |
|
23680 |
|
23681 |
|
23682 |
|
23683 |
|
23684 |
|
23685 | var isBuffer = nativeIsBuffer || stubFalse;
|
23686 |
|
23687 | |
23688 |
|
23689 |
|
23690 |
|
23691 |
|
23692 |
|
23693 |
|
23694 |
|
23695 |
|
23696 |
|
23697 |
|
23698 |
|
23699 |
|
23700 |
|
23701 |
|
23702 |
|
23703 |
|
23704 |
|
23705 |
|
23706 |
|
23707 |
|
23708 |
|
23709 |
|
23710 |
|
23711 |
|
23712 |
|
23713 |
|
23714 |
|
23715 | function isEqual(value, other) {
|
23716 | return baseIsEqual(value, other);
|
23717 | }
|
23718 |
|
23719 | |
23720 |
|
23721 |
|
23722 |
|
23723 |
|
23724 |
|
23725 |
|
23726 |
|
23727 |
|
23728 |
|
23729 |
|
23730 |
|
23731 |
|
23732 |
|
23733 |
|
23734 |
|
23735 |
|
23736 | function isFunction(value) {
|
23737 | if (!isObject(value)) {
|
23738 | return false;
|
23739 | }
|
23740 |
|
23741 |
|
23742 | var tag = baseGetTag(value);
|
23743 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
23744 | }
|
23745 |
|
23746 | |
23747 |
|
23748 |
|
23749 |
|
23750 |
|
23751 |
|
23752 |
|
23753 |
|
23754 |
|
23755 |
|
23756 |
|
23757 |
|
23758 |
|
23759 |
|
23760 |
|
23761 |
|
23762 |
|
23763 |
|
23764 |
|
23765 |
|
23766 |
|
23767 |
|
23768 |
|
23769 |
|
23770 |
|
23771 |
|
23772 | function isLength(value) {
|
23773 | return typeof value == 'number' &&
|
23774 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
23775 | }
|
23776 |
|
23777 | |
23778 |
|
23779 |
|
23780 |
|
23781 |
|
23782 |
|
23783 |
|
23784 |
|
23785 |
|
23786 |
|
23787 |
|
23788 |
|
23789 |
|
23790 |
|
23791 |
|
23792 |
|
23793 |
|
23794 |
|
23795 |
|
23796 |
|
23797 |
|
23798 |
|
23799 |
|
23800 |
|
23801 |
|
23802 | function isObject(value) {
|
23803 | var type = typeof value;
|
23804 | return value != null && (type == 'object' || type == 'function');
|
23805 | }
|
23806 |
|
23807 | |
23808 |
|
23809 |
|
23810 |
|
23811 |
|
23812 |
|
23813 |
|
23814 |
|
23815 |
|
23816 |
|
23817 |
|
23818 |
|
23819 |
|
23820 |
|
23821 |
|
23822 |
|
23823 |
|
23824 |
|
23825 |
|
23826 |
|
23827 |
|
23828 |
|
23829 |
|
23830 |
|
23831 | function isObjectLike(value) {
|
23832 | return value != null && typeof value == 'object';
|
23833 | }
|
23834 |
|
23835 | |
23836 |
|
23837 |
|
23838 |
|
23839 |
|
23840 |
|
23841 |
|
23842 |
|
23843 |
|
23844 |
|
23845 |
|
23846 |
|
23847 |
|
23848 |
|
23849 |
|
23850 |
|
23851 |
|
23852 | var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
23853 |
|
23854 | |
23855 |
|
23856 |
|
23857 |
|
23858 |
|
23859 |
|
23860 |
|
23861 |
|
23862 |
|
23863 |
|
23864 |
|
23865 |
|
23866 |
|
23867 |
|
23868 |
|
23869 |
|
23870 |
|
23871 |
|
23872 |
|
23873 |
|
23874 |
|
23875 |
|
23876 |
|
23877 |
|
23878 |
|
23879 |
|
23880 |
|
23881 |
|
23882 | function keys(object) {
|
23883 | return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
23884 | }
|
23885 |
|
23886 | |
23887 |
|
23888 |
|
23889 |
|
23890 |
|
23891 |
|
23892 |
|
23893 |
|
23894 |
|
23895 |
|
23896 |
|
23897 |
|
23898 |
|
23899 |
|
23900 |
|
23901 |
|
23902 |
|
23903 |
|
23904 | function stubArray() {
|
23905 | return [];
|
23906 | }
|
23907 |
|
23908 | |
23909 |
|
23910 |
|
23911 |
|
23912 |
|
23913 |
|
23914 |
|
23915 |
|
23916 |
|
23917 |
|
23918 |
|
23919 |
|
23920 |
|
23921 | function stubFalse() {
|
23922 | return false;
|
23923 | }
|
23924 |
|
23925 | module.exports = isEqual;
|
23926 |
|
23927 | }.call(exports, (function() { return this; }()), __webpack_require__(131)(module)))
|
23928 |
|
23929 | }),
|
23930 |
|
23931 | (function(module, exports, __webpack_require__) {
|
23932 |
|
23933 | 'use strict';
|
23934 |
|
23935 | Object.defineProperty(exports, "__esModule", {
|
23936 | value: true
|
23937 | });
|
23938 |
|
23939 | 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; };
|
23940 |
|
23941 | 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"); } }; }();
|
23942 |
|
23943 | var _react = __webpack_require__(4);
|
23944 |
|
23945 | var _react2 = _interopRequireDefault(_react);
|
23946 |
|
23947 | var _reactDom = __webpack_require__(12);
|
23948 |
|
23949 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
23950 |
|
23951 | var _reactBeautifulDnd = __webpack_require__(82);
|
23952 |
|
23953 | var _util = __webpack_require__(185);
|
23954 |
|
23955 | var _classnames = __webpack_require__(3);
|
23956 |
|
23957 | var _classnames2 = _interopRequireDefault(_classnames);
|
23958 |
|
23959 | var _lodash = __webpack_require__(183);
|
23960 |
|
23961 | var _lodash2 = _interopRequireDefault(_lodash);
|
23962 |
|
23963 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23964 |
|
23965 | 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; }
|
23966 |
|
23967 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
23968 |
|
23969 | 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; }
|
23970 |
|
23971 | 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); }
|
23972 |
|
23973 | var reorder = function reorder(list, startIndex, endIndex) {
|
23974 | var result = Array.from(list);
|
23975 |
|
23976 | var _result$splice = result.splice(startIndex, 1),
|
23977 | _result$splice2 = _slicedToArray(_result$splice, 1),
|
23978 | removed = _result$splice2[0];
|
23979 |
|
23980 | result.splice(endIndex, 0, removed);
|
23981 |
|
23982 | return result;
|
23983 | };
|
23984 |
|
23985 | var Vertical = function (_Component) {
|
23986 | _inherits(Vertical, _Component);
|
23987 |
|
23988 | function Vertical(props) {
|
23989 | _classCallCheck(this, Vertical);
|
23990 |
|
23991 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
23992 |
|
23993 | _this.onDragEnd = function (result) {
|
23994 | if (!result.destination) {
|
23995 | return;
|
23996 | }
|
23997 | var items = reorder(_this.state.items, result.source.index, result.destination.index);
|
23998 |
|
23999 | _this.setState({
|
24000 | items: items
|
24001 | });
|
24002 | _this.props.onStop(result, items);
|
24003 | };
|
24004 |
|
24005 | _this.onDragStart = function (result) {
|
24006 | _this.props.onStart(result, _this.state.items);
|
24007 | };
|
24008 |
|
24009 | _this.state = {
|
24010 | items: _this.props.list || []
|
24011 | };
|
24012 | return _this;
|
24013 | }
|
24014 |
|
24015 | Vertical.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
24016 | if (!(0, _lodash2['default'])(this.state.items, nextProps.list)) {
|
24017 | this.setState({
|
24018 | items: nextProps.list
|
24019 | });
|
24020 | }
|
24021 | };
|
24022 |
|
24023 | Vertical.prototype.render = function render() {
|
24024 | var _this2 = this;
|
24025 |
|
24026 | var _props = this.props,
|
24027 | onStart = _props.onStart,
|
24028 | onDrag = _props.onDrag,
|
24029 | onStop = _props.onStop,
|
24030 | onDragUpdate = _props.onDragUpdate,
|
24031 | dropClass = _props.dropClass,
|
24032 | dropOverClass = _props.dropOverClass,
|
24033 | dragClass = _props.dragClass,
|
24034 | dragingClass = _props.dragingClass,
|
24035 | showKey = _props.showKey,
|
24036 | type = _props.type;
|
24037 |
|
24038 |
|
24039 | return _react2['default'].createElement(
|
24040 | _reactBeautifulDnd.DragDropContext,
|
24041 | { onDragEnd: this.onDragEnd, onDragStart: this.onDragStart, onDragUpdate: onDragUpdate },
|
24042 | _react2['default'].createElement(
|
24043 | _reactBeautifulDnd.Droppable,
|
24044 | { droppableId: 'droppable', direction: type },
|
24045 | function (provided, snapshot) {
|
24046 | return _react2['default'].createElement(
|
24047 | 'div',
|
24048 | {
|
24049 | ref: provided.innerRef,
|
24050 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDraggingOver).drop))
|
24051 | },
|
24052 | _this2.state.items.map(function (item, index) {
|
24053 | return _react2['default'].createElement(
|
24054 | _reactBeautifulDnd.Draggable,
|
24055 | { key: index, draggableId: index, index: index },
|
24056 | function (provided, snapshot) {
|
24057 | return _react2['default'].createElement(
|
24058 | 'div',
|
24059 | _extends({
|
24060 | ref: provided.innerRef
|
24061 | }, provided.draggableProps, provided.dragHandleProps, {
|
24062 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDragging).drag)),
|
24063 | style: _extends({}, provided.draggableProps.style)
|
24064 | }),
|
24065 | showKey ? item[showKey] : item
|
24066 | );
|
24067 | }
|
24068 | );
|
24069 | }),
|
24070 | provided.placeholder
|
24071 | );
|
24072 | }
|
24073 | )
|
24074 | );
|
24075 | };
|
24076 |
|
24077 | return Vertical;
|
24078 | }(_react.Component);
|
24079 |
|
24080 | exports['default'] = Vertical;
|
24081 | module.exports = exports['default'];
|
24082 |
|
24083 | }),
|
24084 |
|
24085 | (function(module, exports) {
|
24086 |
|
24087 | 'use strict';
|
24088 |
|
24089 | Object.defineProperty(exports, "__esModule", {
|
24090 | value: true
|
24091 | });
|
24092 | var getClass = exports.getClass = function getClass(props, doing) {
|
24093 | var dropClass = props.dropClass,
|
24094 | dropOverClass = props.dropOverClass,
|
24095 | dragClass = props.dragClass,
|
24096 | dragingClass = props.dragingClass,
|
24097 | type = props.type;
|
24098 |
|
24099 |
|
24100 | var verticalObj = {
|
24101 | drop: {}, drag: {}
|
24102 | };
|
24103 | verticalObj.drop['u-drop ' + dropClass] = true;
|
24104 | verticalObj.drop['u-droping ' + dropOverClass] = doing;
|
24105 | verticalObj.drag['u-drag ' + dragClass] = true;
|
24106 | verticalObj.drag['u-draging ' + dragingClass] = doing;
|
24107 |
|
24108 | var horizontalObj = {
|
24109 | drop: {}, drag: {}
|
24110 | };
|
24111 | horizontalObj.drop['u-drop u-drop-horizontal ' + dropClass] = true;
|
24112 | horizontalObj.drop['u-droping u-droping-horizontal ' + dropOverClass] = doing;
|
24113 | horizontalObj.drag['u-drag u-drag-horizontal ' + dragClass] = true;
|
24114 | horizontalObj.drag['u-draging u-draging-horizontal ' + dragingClass] = doing;
|
24115 |
|
24116 | switch (type) {
|
24117 | case 'vertical':
|
24118 | return verticalObj;
|
24119 | break;
|
24120 | case 'horizontal':
|
24121 | return horizontalObj;
|
24122 | break;
|
24123 | case 'betweenVertical':
|
24124 | return verticalObj;
|
24125 | break;
|
24126 | case 'betweenHorizontal':
|
24127 | return horizontalObj;
|
24128 | break;
|
24129 | }
|
24130 | };
|
24131 |
|
24132 | }),
|
24133 |
|
24134 | (function(module, exports, __webpack_require__) {
|
24135 |
|
24136 | 'use strict';
|
24137 |
|
24138 | Object.defineProperty(exports, "__esModule", {
|
24139 | value: true
|
24140 | });
|
24141 |
|
24142 | 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; };
|
24143 |
|
24144 | 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"); } }; }();
|
24145 |
|
24146 | var _react = __webpack_require__(4);
|
24147 |
|
24148 | var _react2 = _interopRequireDefault(_react);
|
24149 |
|
24150 | var _reactDom = __webpack_require__(12);
|
24151 |
|
24152 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
24153 |
|
24154 | var _reactBeautifulDnd = __webpack_require__(82);
|
24155 |
|
24156 | var _util = __webpack_require__(185);
|
24157 |
|
24158 | var _classnames = __webpack_require__(3);
|
24159 |
|
24160 | var _classnames2 = _interopRequireDefault(_classnames);
|
24161 |
|
24162 | var _lodash = __webpack_require__(183);
|
24163 |
|
24164 | var _lodash2 = _interopRequireDefault(_lodash);
|
24165 |
|
24166 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24167 |
|
24168 | 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; }
|
24169 |
|
24170 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24171 |
|
24172 | 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; }
|
24173 |
|
24174 | 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); }
|
24175 |
|
24176 | var reorder = function reorder(list, startIndex, endIndex) {
|
24177 | var result = Array.from(list);
|
24178 |
|
24179 | var _result$splice = result.splice(startIndex, 1),
|
24180 | _result$splice2 = _slicedToArray(_result$splice, 1),
|
24181 | removed = _result$splice2[0];
|
24182 |
|
24183 | result.splice(endIndex, 0, removed);
|
24184 |
|
24185 | return result;
|
24186 | };
|
24187 |
|
24188 | |
24189 |
|
24190 |
|
24191 | var move = function move(source, destination, droppableSource, droppableDestination) {
|
24192 | var sourceClone = Array.from(source);
|
24193 | var destClone = Array.from(destination);
|
24194 |
|
24195 | var _sourceClone$splice = sourceClone.splice(droppableSource.index, 1),
|
24196 | _sourceClone$splice2 = _slicedToArray(_sourceClone$splice, 1),
|
24197 | removed = _sourceClone$splice2[0];
|
24198 |
|
24199 | destClone.splice(droppableDestination.index, 0, removed);
|
24200 |
|
24201 | var result = {};
|
24202 | result[droppableSource.droppableId] = sourceClone;
|
24203 | result[droppableDestination.droppableId] = destClone;
|
24204 |
|
24205 | return result;
|
24206 | };
|
24207 |
|
24208 | var Between = function (_Component) {
|
24209 | _inherits(Between, _Component);
|
24210 |
|
24211 | function Between(props) {
|
24212 | _classCallCheck(this, Between);
|
24213 |
|
24214 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
24215 |
|
24216 | _this.id2List = {
|
24217 | droppable: 'items',
|
24218 | droppable2: 'selected'
|
24219 | };
|
24220 |
|
24221 | _this.getList = function (id) {
|
24222 | return _this.state[_this.id2List[id]];
|
24223 | };
|
24224 |
|
24225 | _this.onDragEnd = function (result) {
|
24226 | console.log(result);
|
24227 | var source = result.source,
|
24228 | destination = result.destination;
|
24229 |
|
24230 |
|
24231 |
|
24232 | if (!destination) {
|
24233 | return;
|
24234 | }
|
24235 | var list = _this.state.items;
|
24236 | var otherList = _this.state.selected;
|
24237 |
|
24238 | if (source.droppableId === destination.droppableId) {
|
24239 | var items = reorder(_this.getList(source.droppableId), source.index, destination.index);
|
24240 |
|
24241 | var state = { items: items };
|
24242 | list = items;
|
24243 |
|
24244 | if (source.droppableId === 'droppable2') {
|
24245 | state = { selected: items };
|
24246 | otherList = items;
|
24247 | list = _this.state.items;
|
24248 | }
|
24249 | _this.setState(state);
|
24250 | } else {
|
24251 | var _result = move(_this.getList(source.droppableId), _this.getList(destination.droppableId), source, destination);
|
24252 |
|
24253 | _this.setState({
|
24254 | items: _result.droppable,
|
24255 | selected: _result.droppable2
|
24256 | });
|
24257 | list = _result.droppable;
|
24258 | otherList = _result.droppable2;
|
24259 | }
|
24260 | _this.props.onStop(result, {
|
24261 | list: list,
|
24262 | otherList: otherList
|
24263 | });
|
24264 | };
|
24265 |
|
24266 | _this.onDragStart = function (result) {
|
24267 | _this.props.onStart(result, {
|
24268 | list: _this.state.list,
|
24269 | otherList: _this.state.selected
|
24270 | });
|
24271 | };
|
24272 |
|
24273 | _this.state = {
|
24274 | items: _this.props.list,
|
24275 | selected: _this.props.otherList
|
24276 | };
|
24277 | return _this;
|
24278 | }
|
24279 |
|
24280 | Between.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
24281 | if (!(0, _lodash2['default'])(this.state.items, nextProps.list)) {
|
24282 | this.setState({
|
24283 | items: nextProps.list
|
24284 | });
|
24285 | }
|
24286 | if (!(0, _lodash2['default'])(this.state.selected, nextProps.otherList)) {
|
24287 | this.setState({
|
24288 | selected: nextProps.otherList
|
24289 | });
|
24290 | }
|
24291 | };
|
24292 |
|
24293 | Between.prototype.render = function render() {
|
24294 | var _this2 = this;
|
24295 |
|
24296 | var _props = this.props,
|
24297 | onStart = _props.onStart,
|
24298 | onDrag = _props.onDrag,
|
24299 | onStop = _props.onStop,
|
24300 | onDragUpdate = _props.onDragUpdate,
|
24301 | dropClass = _props.dropClass,
|
24302 | dropOverClass = _props.dropOverClass,
|
24303 | dragClass = _props.dragClass,
|
24304 | dragingClass = _props.dragingClass,
|
24305 | showKey = _props.showKey,
|
24306 | type = _props.type;
|
24307 |
|
24308 |
|
24309 | return _react2['default'].createElement(
|
24310 | 'div',
|
24311 | { className: (0, _classnames2['default'])({
|
24312 | 'u-drag-between': type == 'betweenVertical',
|
24313 | 'u-drag-between u-drag-between-horizontal': type == 'betweenHorizontal'
|
24314 |
|
24315 | }) },
|
24316 | _react2['default'].createElement(
|
24317 | _reactBeautifulDnd.DragDropContext,
|
24318 | { onDragEnd: this.onDragEnd, onDragStart: this.onDragStart, onDragUpdate: onDragUpdate },
|
24319 | _react2['default'].createElement(
|
24320 | _reactBeautifulDnd.Droppable,
|
24321 | { droppableId: 'droppable', direction: type == 'betweenVertical' ? 'vertical' : 'horizontal' },
|
24322 | function (provided, snapshot) {
|
24323 | return _react2['default'].createElement(
|
24324 | 'div',
|
24325 | {
|
24326 | ref: provided.innerRef,
|
24327 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDraggingOver).drop)) },
|
24328 | _this2.state.items.map(function (item, index) {
|
24329 | return _react2['default'].createElement(
|
24330 | _reactBeautifulDnd.Draggable,
|
24331 | {
|
24332 | key: '1' + index,
|
24333 | draggableId: '1' + index,
|
24334 | index: index },
|
24335 | function (provided, snapshot) {
|
24336 | return _react2['default'].createElement(
|
24337 | 'div',
|
24338 | _extends({
|
24339 | ref: provided.innerRef
|
24340 | }, provided.draggableProps, provided.dragHandleProps, {
|
24341 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDragging).drag)),
|
24342 | style: _extends({}, provided.draggableProps.style) }),
|
24343 | showKey ? item[showKey] : item
|
24344 | );
|
24345 | }
|
24346 | );
|
24347 | }),
|
24348 | provided.placeholder
|
24349 | );
|
24350 | }
|
24351 | ),
|
24352 | _react2['default'].createElement(
|
24353 | _reactBeautifulDnd.Droppable,
|
24354 | { droppableId: 'droppable2', direction: type == 'betweenVertical' ? 'vertical' : 'horizontal' },
|
24355 | function (provided, snapshot) {
|
24356 | return _react2['default'].createElement(
|
24357 | 'div',
|
24358 | {
|
24359 | ref: provided.innerRef,
|
24360 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDraggingOver).drop)) },
|
24361 | _this2.state.selected.map(function (item, index) {
|
24362 | return _react2['default'].createElement(
|
24363 | _reactBeautifulDnd.Draggable,
|
24364 | {
|
24365 | key: '2' + index,
|
24366 | draggableId: '2' + index,
|
24367 | index: index },
|
24368 | function (provided, snapshot) {
|
24369 | return _react2['default'].createElement(
|
24370 | 'div',
|
24371 | _extends({
|
24372 | ref: provided.innerRef
|
24373 | }, provided.draggableProps, provided.dragHandleProps, {
|
24374 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDragging).drag)),
|
24375 | style: _extends({}, provided.draggableProps.style) }),
|
24376 | showKey ? item[showKey] : item
|
24377 | );
|
24378 | }
|
24379 | );
|
24380 | }),
|
24381 | provided.placeholder
|
24382 | );
|
24383 | }
|
24384 | )
|
24385 | )
|
24386 | );
|
24387 | };
|
24388 |
|
24389 | return Between;
|
24390 | }(_react.Component);
|
24391 |
|
24392 | exports['default'] = Between;
|
24393 | module.exports = exports['default'];
|
24394 |
|
24395 | }),
|
24396 |
|
24397 | (function(module, exports, __webpack_require__) {
|
24398 |
|
24399 | 'use strict';
|
24400 |
|
24401 | Object.defineProperty(exports, "__esModule", {
|
24402 | value: true
|
24403 | });
|
24404 |
|
24405 | var _react = __webpack_require__(4);
|
24406 |
|
24407 | var _react2 = _interopRequireDefault(_react);
|
24408 |
|
24409 | var _index = __webpack_require__(80);
|
24410 |
|
24411 | var _index2 = _interopRequireDefault(_index);
|
24412 |
|
24413 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24414 |
|
24415 | 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; }
|
24416 |
|
24417 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24418 |
|
24419 | 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; }
|
24420 |
|
24421 | 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); }
|
24422 | |
24423 |
|
24424 |
|
24425 |
|
24426 |
|
24427 |
|
24428 |
|
24429 | var Demo2 = function (_Component) {
|
24430 | _inherits(Demo2, _Component);
|
24431 |
|
24432 | function Demo2() {
|
24433 | var _temp, _this, _ret;
|
24434 |
|
24435 | _classCallCheck(this, Demo2);
|
24436 |
|
24437 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24438 | args[_key] = arguments[_key];
|
24439 | }
|
24440 |
|
24441 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
24442 | console.log('start');
|
24443 | }, _this.onStop = function () {
|
24444 | console.log('stop');
|
24445 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24446 | }
|
24447 |
|
24448 | Demo2.prototype.render = function render() {
|
24449 | return _react2['default'].createElement(
|
24450 | 'div',
|
24451 | null,
|
24452 | _react2['default'].createElement(
|
24453 | _index2['default'],
|
24454 | { axis: 'x', onStart: this.onStart, onStop: this.onStop },
|
24455 | _react2['default'].createElement(
|
24456 | 'div',
|
24457 | { className: 'demo' },
|
24458 | '\u6211\u53EA\u53EF\u5EF6X\u8F74\u62D6\u62FD'
|
24459 | )
|
24460 | )
|
24461 | );
|
24462 | };
|
24463 |
|
24464 | return Demo2;
|
24465 | }(_react.Component);
|
24466 |
|
24467 | exports['default'] = Demo2;
|
24468 | module.exports = exports['default'];
|
24469 |
|
24470 | }),
|
24471 |
|
24472 | (function(module, exports, __webpack_require__) {
|
24473 |
|
24474 | 'use strict';
|
24475 |
|
24476 | Object.defineProperty(exports, "__esModule", {
|
24477 | value: true
|
24478 | });
|
24479 |
|
24480 | var _react = __webpack_require__(4);
|
24481 |
|
24482 | var _react2 = _interopRequireDefault(_react);
|
24483 |
|
24484 | var _index = __webpack_require__(80);
|
24485 |
|
24486 | var _index2 = _interopRequireDefault(_index);
|
24487 |
|
24488 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24489 |
|
24490 | 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; }
|
24491 |
|
24492 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24493 |
|
24494 | 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; }
|
24495 |
|
24496 | 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); }
|
24497 | |
24498 |
|
24499 |
|
24500 |
|
24501 |
|
24502 |
|
24503 |
|
24504 | var Demo3 = function (_Component) {
|
24505 | _inherits(Demo3, _Component);
|
24506 |
|
24507 | function Demo3() {
|
24508 | var _temp, _this, _ret;
|
24509 |
|
24510 | _classCallCheck(this, Demo3);
|
24511 |
|
24512 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24513 | args[_key] = arguments[_key];
|
24514 | }
|
24515 |
|
24516 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
24517 | console.log('start');
|
24518 | return false;
|
24519 | }, _this.onStop = function () {
|
24520 | console.log('stop');
|
24521 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24522 | }
|
24523 |
|
24524 | Demo3.prototype.render = function render() {
|
24525 | return _react2['default'].createElement(
|
24526 | 'div',
|
24527 | null,
|
24528 | _react2['default'].createElement(
|
24529 | _index2['default'],
|
24530 | { onStart: this.onStart, onStop: this.onStop },
|
24531 | _react2['default'].createElement(
|
24532 | 'div',
|
24533 | { className: 'demo' },
|
24534 | '\u6211\u4E0D\u53EF\u4EE5\u62D6\u62FD'
|
24535 | )
|
24536 | )
|
24537 | );
|
24538 | };
|
24539 |
|
24540 | return Demo3;
|
24541 | }(_react.Component);
|
24542 |
|
24543 | exports['default'] = Demo3;
|
24544 | module.exports = exports['default'];
|
24545 |
|
24546 | }),
|
24547 |
|
24548 | (function(module, exports, __webpack_require__) {
|
24549 |
|
24550 | 'use strict';
|
24551 |
|
24552 | Object.defineProperty(exports, "__esModule", {
|
24553 | value: true
|
24554 | });
|
24555 |
|
24556 | var _react = __webpack_require__(4);
|
24557 |
|
24558 | var _react2 = _interopRequireDefault(_react);
|
24559 |
|
24560 | var _index = __webpack_require__(80);
|
24561 |
|
24562 | var _index2 = _interopRequireDefault(_index);
|
24563 |
|
24564 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24565 |
|
24566 | 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; }
|
24567 |
|
24568 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24569 |
|
24570 | 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; }
|
24571 |
|
24572 | 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); } |
24573 |
|
24574 |
|
24575 |
|
24576 |
|
24577 |
|
24578 |
|
24579 | var Demo4 = function (_Component) {
|
24580 | _inherits(Demo4, _Component);
|
24581 |
|
24582 | function Demo4() {
|
24583 | var _temp, _this, _ret;
|
24584 |
|
24585 | _classCallCheck(this, Demo4);
|
24586 |
|
24587 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24588 | args[_key] = arguments[_key];
|
24589 | }
|
24590 |
|
24591 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
24592 | console.log('start');
|
24593 | }, _this.onStop = function () {
|
24594 | console.log('stop');
|
24595 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24596 | }
|
24597 |
|
24598 | Demo4.prototype.render = function render() {
|
24599 | return _react2['default'].createElement(
|
24600 | 'div',
|
24601 | { className: 'demo-4' },
|
24602 | _react2['default'].createElement(
|
24603 | 'div',
|
24604 | null,
|
24605 | _react2['default'].createElement(
|
24606 | _index2['default'],
|
24607 | { handle: '.handle', onStart: this.onStart, onStop: this.onStop },
|
24608 | _react2['default'].createElement(
|
24609 | 'div',
|
24610 | { className: 'demo4 ' },
|
24611 | _react2['default'].createElement(
|
24612 | 'div',
|
24613 | { className: 'handle' },
|
24614 | '\u6211\u662F\u628A\u624B'
|
24615 | ),
|
24616 | _react2['default'].createElement(
|
24617 | 'div',
|
24618 | { className: 'drag-context' },
|
24619 | '\u9700\u8981\u62D6\u62FD\u628A\u624B'
|
24620 | )
|
24621 | )
|
24622 | )
|
24623 | ),
|
24624 | _react2['default'].createElement(
|
24625 | 'div',
|
24626 | null,
|
24627 | _react2['default'].createElement(
|
24628 | _index2['default'],
|
24629 | { cancel: '.handle' },
|
24630 | _react2['default'].createElement(
|
24631 | 'div',
|
24632 | { className: 'demo4 ' },
|
24633 | _react2['default'].createElement(
|
24634 | 'div',
|
24635 | { className: 'handle' },
|
24636 | '\u6211\u662F\u628A\u624B'
|
24637 | ),
|
24638 | _react2['default'].createElement(
|
24639 | 'div',
|
24640 | { className: 'drag-context' },
|
24641 | '\u4E0D\u8981\u62D6\u62FD\u628A\u624B'
|
24642 | )
|
24643 | )
|
24644 | )
|
24645 | )
|
24646 | );
|
24647 | };
|
24648 |
|
24649 | return Demo4;
|
24650 | }(_react.Component);
|
24651 |
|
24652 | exports['default'] = Demo4;
|
24653 | module.exports = exports['default'];
|
24654 |
|
24655 | }),
|
24656 |
|
24657 | (function(module, exports, __webpack_require__) {
|
24658 |
|
24659 | 'use strict';
|
24660 |
|
24661 | Object.defineProperty(exports, "__esModule", {
|
24662 | value: true
|
24663 | });
|
24664 |
|
24665 | var _react = __webpack_require__(4);
|
24666 |
|
24667 | var _react2 = _interopRequireDefault(_react);
|
24668 |
|
24669 | var _index = __webpack_require__(80);
|
24670 |
|
24671 | var _index2 = _interopRequireDefault(_index);
|
24672 |
|
24673 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24674 |
|
24675 | 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; }
|
24676 |
|
24677 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24678 |
|
24679 | 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; }
|
24680 |
|
24681 | 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); }
|
24682 | |
24683 |
|
24684 |
|
24685 |
|
24686 |
|
24687 |
|
24688 |
|
24689 | var Demo5 = function (_Component) {
|
24690 | _inherits(Demo5, _Component);
|
24691 |
|
24692 | function Demo5() {
|
24693 | var _temp, _this, _ret;
|
24694 |
|
24695 | _classCallCheck(this, Demo5);
|
24696 |
|
24697 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24698 | args[_key] = arguments[_key];
|
24699 | }
|
24700 |
|
24701 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
24702 | console.log('start');
|
24703 | }, _this.onStop = function () {
|
24704 | console.log('stop');
|
24705 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24706 | }
|
24707 |
|
24708 | Demo5.prototype.render = function render() {
|
24709 | return _react2['default'].createElement(
|
24710 | 'div',
|
24711 | null,
|
24712 | _react2['default'].createElement(
|
24713 | _index2['default'],
|
24714 | { grid: [25, 25], onStart: this.onStart, onStop: this.onStop },
|
24715 | _react2['default'].createElement(
|
24716 | 'div',
|
24717 | { className: 'demo' },
|
24718 | '\u6211\u6BCF\u6B21\u62D6\u62FD\u53EF\u79FB\u52A825px'
|
24719 | )
|
24720 | )
|
24721 | );
|
24722 | };
|
24723 |
|
24724 | return Demo5;
|
24725 | }(_react.Component);
|
24726 |
|
24727 | exports['default'] = Demo5;
|
24728 | module.exports = exports['default'];
|
24729 |
|
24730 | }),
|
24731 |
|
24732 | (function(module, exports, __webpack_require__) {
|
24733 |
|
24734 | 'use strict';
|
24735 |
|
24736 | Object.defineProperty(exports, "__esModule", {
|
24737 | value: true
|
24738 | });
|
24739 |
|
24740 | var _react = __webpack_require__(4);
|
24741 |
|
24742 | var _react2 = _interopRequireDefault(_react);
|
24743 |
|
24744 | var _index = __webpack_require__(80);
|
24745 |
|
24746 | var _index2 = _interopRequireDefault(_index);
|
24747 |
|
24748 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24749 |
|
24750 | 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; }
|
24751 |
|
24752 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24753 |
|
24754 | 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; }
|
24755 |
|
24756 | 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); }
|
24757 | |
24758 |
|
24759 |
|
24760 |
|
24761 |
|
24762 |
|
24763 |
|
24764 | var Demo6 = function (_Component) {
|
24765 | _inherits(Demo6, _Component);
|
24766 |
|
24767 | function Demo6() {
|
24768 | var _temp, _this, _ret;
|
24769 |
|
24770 | _classCallCheck(this, Demo6);
|
24771 |
|
24772 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24773 | args[_key] = arguments[_key];
|
24774 | }
|
24775 |
|
24776 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
24777 | console.log('start');
|
24778 | }, _this.onStop = function () {
|
24779 | console.log('stop');
|
24780 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24781 | }
|
24782 |
|
24783 | Demo6.prototype.render = function render() {
|
24784 | return _react2['default'].createElement(
|
24785 | 'div',
|
24786 | null,
|
24787 | _react2['default'].createElement(
|
24788 | _index2['default'],
|
24789 | { bounds: { top: -50, left: -50, right: 50, bottom: 50 }, onStart: this.onStart, onStop: this.onStop },
|
24790 | _react2['default'].createElement(
|
24791 | 'div',
|
24792 | { className: 'demo' },
|
24793 | '\u6211\u53EA\u80FD\u518D\u4E0A\u4E0B\u5DE6\u53F350px\u5185\u79FB\u52A8'
|
24794 | )
|
24795 | )
|
24796 | );
|
24797 | };
|
24798 |
|
24799 | return Demo6;
|
24800 | }(_react.Component);
|
24801 |
|
24802 | exports['default'] = Demo6;
|
24803 | module.exports = exports['default'];
|
24804 |
|
24805 | }),
|
24806 |
|
24807 | (function(module, exports, __webpack_require__) {
|
24808 |
|
24809 | 'use strict';
|
24810 |
|
24811 | Object.defineProperty(exports, "__esModule", {
|
24812 | value: true
|
24813 | });
|
24814 |
|
24815 | var _react = __webpack_require__(4);
|
24816 |
|
24817 | var _react2 = _interopRequireDefault(_react);
|
24818 |
|
24819 | var _index = __webpack_require__(80);
|
24820 |
|
24821 | var _index2 = _interopRequireDefault(_index);
|
24822 |
|
24823 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24824 |
|
24825 | 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; }
|
24826 |
|
24827 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24828 |
|
24829 | 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; }
|
24830 |
|
24831 | 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); }
|
24832 | |
24833 |
|
24834 |
|
24835 |
|
24836 |
|
24837 |
|
24838 |
|
24839 | var Demo7 = function (_Component) {
|
24840 | _inherits(Demo7, _Component);
|
24841 |
|
24842 | function Demo7() {
|
24843 | var _temp, _this, _ret;
|
24844 |
|
24845 | _classCallCheck(this, Demo7);
|
24846 |
|
24847 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24848 | args[_key] = arguments[_key];
|
24849 | }
|
24850 |
|
24851 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
24852 | console.log('start');
|
24853 | }, _this.onStop = function () {
|
24854 | console.log('stop');
|
24855 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24856 | }
|
24857 |
|
24858 | Demo7.prototype.render = function render() {
|
24859 | return _react2['default'].createElement(
|
24860 | 'div',
|
24861 | null,
|
24862 | _react2['default'].createElement(
|
24863 | 'div',
|
24864 | { className: 'demo7-parent' },
|
24865 | _react2['default'].createElement(
|
24866 | _index2['default'],
|
24867 | { bounds: '.demo7-parent', onStart: this.onStart, onStop: this.onStop },
|
24868 | _react2['default'].createElement(
|
24869 | 'div',
|
24870 | { className: 'demo' },
|
24871 | '\u6211\u53EA\u80FD\u5728\u7236\u7EA7\u5143\u7D20\u4E2D\u79FB\u52A8'
|
24872 | )
|
24873 | )
|
24874 | )
|
24875 | );
|
24876 | };
|
24877 |
|
24878 | return Demo7;
|
24879 | }(_react.Component);
|
24880 |
|
24881 | exports['default'] = Demo7;
|
24882 | module.exports = exports['default'];
|
24883 |
|
24884 | }),
|
24885 |
|
24886 | (function(module, exports, __webpack_require__) {
|
24887 |
|
24888 | 'use strict';
|
24889 |
|
24890 | Object.defineProperty(exports, "__esModule", {
|
24891 | value: true
|
24892 | });
|
24893 |
|
24894 | var _react = __webpack_require__(4);
|
24895 |
|
24896 | var _react2 = _interopRequireDefault(_react);
|
24897 |
|
24898 | var _index = __webpack_require__(80);
|
24899 |
|
24900 | var _index2 = _interopRequireDefault(_index);
|
24901 |
|
24902 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24903 |
|
24904 | 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; }
|
24905 |
|
24906 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24907 |
|
24908 | 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; }
|
24909 |
|
24910 | 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); } |
24911 |
|
24912 |
|
24913 |
|
24914 |
|
24915 |
|
24916 |
|
24917 |
|
24918 |
|
24919 | var Demo8 = function (_Component) {
|
24920 | _inherits(Demo8, _Component);
|
24921 |
|
24922 | function Demo8() {
|
24923 | var _temp, _this, _ret;
|
24924 |
|
24925 | _classCallCheck(this, Demo8);
|
24926 |
|
24927 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24928 | args[_key] = arguments[_key];
|
24929 | }
|
24930 |
|
24931 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onDragStart = function (result, list) {
|
24932 | console.log('开始');
|
24933 | }, _this.onDragEnd = function (result, list) {
|
24934 | console.log('结束');
|
24935 | }, _this.onDragUpdate = function (result) {
|
24936 | console.log('update');
|
24937 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24938 | }
|
24939 |
|
24940 | Demo8.prototype.render = function render() {
|
24941 | var list = [{
|
24942 | name: '第一',
|
24943 | code: 'a'
|
24944 | }, {
|
24945 | name: '第二',
|
24946 | code: 'b'
|
24947 | }, {
|
24948 | name: '第三',
|
24949 | code: 'c'
|
24950 | }, {
|
24951 | name: '第四',
|
24952 | code: 'd'
|
24953 | }, {
|
24954 | name: '第五',
|
24955 | code: 'e'
|
24956 | }];
|
24957 | return _react2['default'].createElement(_index2['default'], { showKey: 'name', list: list, onDragUpdate: this.onDragUpdate, onStart: this.onDragStart, onStop: this.onDragEnd });
|
24958 | };
|
24959 |
|
24960 | return Demo8;
|
24961 | }(_react.Component);
|
24962 |
|
24963 | exports['default'] = Demo8;
|
24964 | module.exports = exports['default'];
|
24965 |
|
24966 | }),
|
24967 |
|
24968 | (function(module, exports, __webpack_require__) {
|
24969 |
|
24970 | 'use strict';
|
24971 |
|
24972 | Object.defineProperty(exports, "__esModule", {
|
24973 | value: true
|
24974 | });
|
24975 |
|
24976 | var _react = __webpack_require__(4);
|
24977 |
|
24978 | var _react2 = _interopRequireDefault(_react);
|
24979 |
|
24980 | var _index = __webpack_require__(80);
|
24981 |
|
24982 | var _index2 = _interopRequireDefault(_index);
|
24983 |
|
24984 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24985 |
|
24986 | 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; }
|
24987 |
|
24988 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24989 |
|
24990 | 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; }
|
24991 |
|
24992 | 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); }
|
24993 | |
24994 |
|
24995 |
|
24996 |
|
24997 |
|
24998 |
|
24999 |
|
25000 | var Demo9 = function (_Component) {
|
25001 | _inherits(Demo9, _Component);
|
25002 |
|
25003 | function Demo9() {
|
25004 | var _temp, _this, _ret;
|
25005 |
|
25006 | _classCallCheck(this, Demo9);
|
25007 |
|
25008 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
25009 | args[_key] = arguments[_key];
|
25010 | }
|
25011 |
|
25012 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onDragStart = function (result, list) {
|
25013 | console.log('开始');
|
25014 | }, _this.onDragEnd = function (result, list) {
|
25015 | console.log('结束');
|
25016 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
25017 | }
|
25018 |
|
25019 | Demo9.prototype.render = function render() {
|
25020 | var list = [_react2['default'].createElement(
|
25021 | 'div',
|
25022 | null,
|
25023 | 'DOM\u7B2C\u4E00'
|
25024 | ), _react2['default'].createElement(
|
25025 | 'div',
|
25026 | null,
|
25027 | 'DOM\u7B2C\u4E8C'
|
25028 | ), _react2['default'].createElement(
|
25029 | 'div',
|
25030 | null,
|
25031 | 'DOM\u7B2C\u4E09'
|
25032 | ), _react2['default'].createElement(
|
25033 | 'div',
|
25034 | null,
|
25035 | 'DOM\u7B2C\u56DB'
|
25036 | ), _react2['default'].createElement(
|
25037 | 'div',
|
25038 | null,
|
25039 | 'DOM\u7B2C\u4E94'
|
25040 | )];
|
25041 | return _react2['default'].createElement(_index2['default'], { list: list, onStart: this.onDragStart, onStop: this.onDragEnd });
|
25042 | };
|
25043 |
|
25044 | return Demo9;
|
25045 | }(_react.Component);
|
25046 |
|
25047 | exports['default'] = Demo9;
|
25048 | module.exports = exports['default'];
|
25049 |
|
25050 | }),
|
25051 |
|
25052 | (function(module, exports, __webpack_require__) {
|
25053 |
|
25054 | 'use strict';
|
25055 |
|
25056 | Object.defineProperty(exports, "__esModule", {
|
25057 | value: true
|
25058 | });
|
25059 |
|
25060 | var _react = __webpack_require__(4);
|
25061 |
|
25062 | var _react2 = _interopRequireDefault(_react);
|
25063 |
|
25064 | var _Dnd = __webpack_require__(81);
|
25065 |
|
25066 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
25067 |
|
25068 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
25069 |
|
25070 | 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; }
|
25071 |
|
25072 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
25073 |
|
25074 | 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; }
|
25075 |
|
25076 | 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); }
|
25077 | |
25078 |
|
25079 |
|
25080 |
|
25081 |
|
25082 |
|
25083 |
|
25084 | var Demo90 = function (_Component) {
|
25085 | _inherits(Demo90, _Component);
|
25086 |
|
25087 | function Demo90() {
|
25088 | _classCallCheck(this, Demo90);
|
25089 |
|
25090 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
25091 | }
|
25092 |
|
25093 | Demo90.prototype.render = function render() {
|
25094 | var list = ['第一', '第二', '第三', '第四', '第五'];
|
25095 | return _react2['default'].createElement(_Dnd2['default'], { list: list, type: 'horizontal' });
|
25096 | };
|
25097 |
|
25098 | return Demo90;
|
25099 | }(_react.Component);
|
25100 |
|
25101 | exports['default'] = Demo90;
|
25102 | module.exports = exports['default'];
|
25103 |
|
25104 | }),
|
25105 |
|
25106 | (function(module, exports, __webpack_require__) {
|
25107 |
|
25108 | 'use strict';
|
25109 |
|
25110 | Object.defineProperty(exports, "__esModule", {
|
25111 | value: true
|
25112 | });
|
25113 |
|
25114 | var _react = __webpack_require__(4);
|
25115 |
|
25116 | var _react2 = _interopRequireDefault(_react);
|
25117 |
|
25118 | var _Dnd = __webpack_require__(81);
|
25119 |
|
25120 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
25121 |
|
25122 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
25123 |
|
25124 | 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; }
|
25125 |
|
25126 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
25127 |
|
25128 | 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; }
|
25129 |
|
25130 | 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); }
|
25131 | |
25132 |
|
25133 |
|
25134 |
|
25135 |
|
25136 |
|
25137 |
|
25138 | var Demo90 = function (_Component) {
|
25139 | _inherits(Demo90, _Component);
|
25140 |
|
25141 | function Demo90() {
|
25142 | _classCallCheck(this, Demo90);
|
25143 |
|
25144 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
25145 | }
|
25146 |
|
25147 | Demo90.prototype.render = function render() {
|
25148 | var list1 = ['第一', '第二', '第三', '第四', '第五'];
|
25149 | var list2 = ['1', '2', '3', '4', '5'];
|
25150 | return _react2['default'].createElement(_Dnd2['default'], { className: 'demo91', list: list1, otherList: list2, type: 'betweenVertical' });
|
25151 | };
|
25152 |
|
25153 | return Demo90;
|
25154 | }(_react.Component);
|
25155 |
|
25156 | exports['default'] = Demo90;
|
25157 | module.exports = exports['default'];
|
25158 |
|
25159 | }),
|
25160 |
|
25161 | (function(module, exports, __webpack_require__) {
|
25162 |
|
25163 | 'use strict';
|
25164 |
|
25165 | Object.defineProperty(exports, "__esModule", {
|
25166 | value: true
|
25167 | });
|
25168 |
|
25169 | var _react = __webpack_require__(4);
|
25170 |
|
25171 | var _react2 = _interopRequireDefault(_react);
|
25172 |
|
25173 | var _Dnd = __webpack_require__(81);
|
25174 |
|
25175 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
25176 |
|
25177 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
25178 |
|
25179 | 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; }
|
25180 |
|
25181 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
25182 |
|
25183 | 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; }
|
25184 |
|
25185 | 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); }
|
25186 | |
25187 |
|
25188 |
|
25189 |
|
25190 |
|
25191 |
|
25192 |
|
25193 | var Demo90 = function (_Component) {
|
25194 | _inherits(Demo90, _Component);
|
25195 |
|
25196 | function Demo90() {
|
25197 | var _temp, _this, _ret;
|
25198 |
|
25199 | _classCallCheck(this, Demo90);
|
25200 |
|
25201 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
25202 | args[_key] = arguments[_key];
|
25203 | }
|
25204 |
|
25205 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onDragStart = function (result, list) {
|
25206 | console.log('开始');
|
25207 | }, _this.onDragEnd = function (result, listObj) {
|
25208 | console.log('结束');
|
25209 | console.log(listObj);
|
25210 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
25211 | }
|
25212 |
|
25213 | Demo90.prototype.render = function render() {
|
25214 | var list1 = ['第一', '第二', '第三', '第四', '第五'];
|
25215 | var list2 = ['1', '2', '3', '4', '5'];
|
25216 | return _react2['default'].createElement(_Dnd2['default'], { list: list1, otherList: list2, type: 'betweenHorizontal', onStart: this.onDragStart, onStop: this.onDragEnd });
|
25217 | };
|
25218 |
|
25219 | return Demo90;
|
25220 | }(_react.Component);
|
25221 |
|
25222 | exports['default'] = Demo90;
|
25223 | module.exports = exports['default'];
|
25224 |
|
25225 | })
|
25226 | ]);
|
25227 |
|
\ | No newline at end of file |