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__(78);
|
54 |
|
55 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
56 |
|
57 | var _react = __webpack_require__(4);
|
58 |
|
59 | var _react2 = _interopRequireDefault(_react);
|
60 |
|
61 | var _reactDom = __webpack_require__(12);
|
62 |
|
63 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
64 |
|
65 | 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__(80);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__(77);
|
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__(65);
|
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__(75);
|
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__(17);
|
985 |
|
986 | var _Collapse3 = _interopRequireDefault(_Collapse2);
|
987 |
|
988 | var _Fade2 = __webpack_require__(64);
|
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__(16);
|
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 | var _interopRequireDefault = __webpack_require__(14);
|
1356 |
|
1357 | exports.__esModule = true;
|
1358 | exports.default = exports.animationEnd = exports.animationDelay = exports.animationTiming = exports.animationDuration = exports.animationName = exports.transitionEnd = exports.transitionDuration = exports.transitionDelay = exports.transitionTiming = exports.transitionProperty = exports.transform = void 0;
|
1359 |
|
1360 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
1361 |
|
1362 | var transform = 'transform';
|
1363 | exports.transform = transform;
|
1364 | var prefix, transitionEnd, animationEnd;
|
1365 | exports.animationEnd = animationEnd;
|
1366 | exports.transitionEnd = transitionEnd;
|
1367 | var transitionProperty, transitionDuration, transitionTiming, transitionDelay;
|
1368 | exports.transitionDelay = transitionDelay;
|
1369 | exports.transitionTiming = transitionTiming;
|
1370 | exports.transitionDuration = transitionDuration;
|
1371 | exports.transitionProperty = transitionProperty;
|
1372 | var animationName, animationDuration, animationTiming, animationDelay;
|
1373 | exports.animationDelay = animationDelay;
|
1374 | exports.animationTiming = animationTiming;
|
1375 | exports.animationDuration = animationDuration;
|
1376 | exports.animationName = animationName;
|
1377 |
|
1378 | if (_inDOM.default) {
|
1379 | var _getTransitionPropert = getTransitionProperties();
|
1380 |
|
1381 | prefix = _getTransitionPropert.prefix;
|
1382 | exports.transitionEnd = transitionEnd = _getTransitionPropert.transitionEnd;
|
1383 | exports.animationEnd = animationEnd = _getTransitionPropert.animationEnd;
|
1384 | exports.transform = transform = prefix + "-" + transform;
|
1385 | exports.transitionProperty = transitionProperty = prefix + "-transition-property";
|
1386 | exports.transitionDuration = transitionDuration = prefix + "-transition-duration";
|
1387 | exports.transitionDelay = transitionDelay = prefix + "-transition-delay";
|
1388 | exports.transitionTiming = transitionTiming = prefix + "-transition-timing-function";
|
1389 | exports.animationName = animationName = prefix + "-animation-name";
|
1390 | exports.animationDuration = animationDuration = prefix + "-animation-duration";
|
1391 | exports.animationTiming = animationTiming = prefix + "-animation-delay";
|
1392 | exports.animationDelay = animationDelay = prefix + "-animation-timing-function";
|
1393 | }
|
1394 |
|
1395 | var _default = {
|
1396 | transform: transform,
|
1397 | end: transitionEnd,
|
1398 | property: transitionProperty,
|
1399 | timing: transitionTiming,
|
1400 | delay: transitionDelay,
|
1401 | duration: transitionDuration
|
1402 | };
|
1403 | exports.default = _default;
|
1404 |
|
1405 | function getTransitionProperties() {
|
1406 | var style = document.createElement('div').style;
|
1407 | var vendorMap = {
|
1408 | O: function O(e) {
|
1409 | return "o" + e.toLowerCase();
|
1410 | },
|
1411 | Moz: function Moz(e) {
|
1412 | return e.toLowerCase();
|
1413 | },
|
1414 | Webkit: function Webkit(e) {
|
1415 | return "webkit" + e;
|
1416 | },
|
1417 | ms: function ms(e) {
|
1418 | return "MS" + e;
|
1419 | }
|
1420 | };
|
1421 | var vendors = Object.keys(vendorMap);
|
1422 | var transitionEnd, animationEnd;
|
1423 | var prefix = '';
|
1424 |
|
1425 | for (var i = 0; i < vendors.length; i++) {
|
1426 | var vendor = vendors[i];
|
1427 |
|
1428 | if (vendor + "TransitionProperty" in style) {
|
1429 | prefix = "-" + vendor.toLowerCase();
|
1430 | transitionEnd = vendorMap[vendor]('TransitionEnd');
|
1431 | animationEnd = vendorMap[vendor]('AnimationEnd');
|
1432 | break;
|
1433 | }
|
1434 | }
|
1435 |
|
1436 | if (!transitionEnd && 'transitionProperty' in style) transitionEnd = 'transitionend';
|
1437 | if (!animationEnd && 'animationName' in style) animationEnd = 'animationend';
|
1438 | style = null;
|
1439 | return {
|
1440 | animationEnd: animationEnd,
|
1441 | transitionEnd: transitionEnd,
|
1442 | prefix: prefix
|
1443 | };
|
1444 | }
|
1445 |
|
1446 | }),
|
1447 |
|
1448 | (function(module, exports) {
|
1449 |
|
1450 | function _interopRequireDefault(obj) {
|
1451 | return obj && obj.__esModule ? obj : {
|
1452 | default: obj
|
1453 | };
|
1454 | }
|
1455 |
|
1456 | module.exports = _interopRequireDefault;
|
1457 |
|
1458 | }),
|
1459 |
|
1460 | (function(module, exports) {
|
1461 |
|
1462 | "use strict";
|
1463 |
|
1464 | exports.__esModule = true;
|
1465 | exports.default = void 0;
|
1466 |
|
1467 | var _default = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
1468 |
|
1469 | exports.default = _default;
|
1470 | module.exports = exports["default"];
|
1471 |
|
1472 | }),
|
1473 |
|
1474 | (function(module, exports, __webpack_require__) {
|
1475 |
|
1476 | "use strict";
|
1477 |
|
1478 | var _interopRequireDefault = __webpack_require__(14);
|
1479 |
|
1480 | exports.__esModule = true;
|
1481 | exports.default = void 0;
|
1482 |
|
1483 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
1484 |
|
1485 | var on = function on() {};
|
1486 |
|
1487 | if (_inDOM.default) {
|
1488 | on = function () {
|
1489 | if (document.addEventListener) return function (node, eventName, handler, capture) {
|
1490 | return node.addEventListener(eventName, handler, capture || false);
|
1491 | };else if (document.attachEvent) return function (node, eventName, handler) {
|
1492 | return node.attachEvent('on' + eventName, function (e) {
|
1493 | e = e || window.event;
|
1494 | e.target = e.target || e.srcElement;
|
1495 | e.currentTarget = node;
|
1496 | handler.call(node, e);
|
1497 | });
|
1498 | };
|
1499 | }();
|
1500 | }
|
1501 |
|
1502 | var _default = on;
|
1503 | exports.default = _default;
|
1504 | module.exports = exports["default"];
|
1505 |
|
1506 | }),
|
1507 |
|
1508 | (function(module, exports, __webpack_require__) {
|
1509 |
|
1510 | 'use strict';
|
1511 |
|
1512 | Object.defineProperty(exports, "__esModule", {
|
1513 | value: true
|
1514 | });
|
1515 |
|
1516 | 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; };
|
1517 |
|
1518 | var _classnames = __webpack_require__(3);
|
1519 |
|
1520 | var _classnames2 = _interopRequireDefault(_classnames);
|
1521 |
|
1522 | var _style = __webpack_require__(18);
|
1523 |
|
1524 | var _style2 = _interopRequireDefault(_style);
|
1525 |
|
1526 | var _react = __webpack_require__(4);
|
1527 |
|
1528 | var _react2 = _interopRequireDefault(_react);
|
1529 |
|
1530 | var _propTypes = __webpack_require__(5);
|
1531 |
|
1532 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
1533 |
|
1534 | var _Transition = __webpack_require__(11);
|
1535 |
|
1536 | var _Transition2 = _interopRequireDefault(_Transition);
|
1537 |
|
1538 | var _capitalize = __webpack_require__(26);
|
1539 |
|
1540 | var _capitalize2 = _interopRequireDefault(_capitalize);
|
1541 |
|
1542 | var _tinperBeeCore = __webpack_require__(27);
|
1543 |
|
1544 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1545 |
|
1546 | 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; }
|
1547 |
|
1548 | 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; }
|
1549 |
|
1550 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1551 |
|
1552 | 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; }
|
1553 |
|
1554 | 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); }
|
1555 |
|
1556 | var MARGINS = {
|
1557 | height: ['marginTop', 'marginBottom'],
|
1558 | width: ['marginLeft', 'marginRight']
|
1559 | };
|
1560 |
|
1561 |
|
1562 |
|
1563 | function triggerBrowserReflow(node) {
|
1564 | node.offsetHeight;
|
1565 | }
|
1566 |
|
1567 | function getDimensionValue(dimension, elem) {
|
1568 | var value = elem['offset' + (0, _capitalize2["default"])(dimension)];
|
1569 | var margins = MARGINS[dimension];
|
1570 |
|
1571 | return value + parseInt((0, _style2["default"])(elem, margins[0]), 10) + parseInt((0, _style2["default"])(elem, margins[1]), 10);
|
1572 | }
|
1573 |
|
1574 | var propTypes = {
|
1575 | |
1576 |
|
1577 |
|
1578 | "in": _propTypes2["default"].bool,
|
1579 |
|
1580 | |
1581 |
|
1582 |
|
1583 | unmountOnExit: _propTypes2["default"].bool,
|
1584 |
|
1585 | |
1586 |
|
1587 |
|
1588 |
|
1589 | transitionAppear: _propTypes2["default"].bool,
|
1590 |
|
1591 | |
1592 |
|
1593 |
|
1594 |
|
1595 |
|
1596 | timeout: _propTypes2["default"].number,
|
1597 |
|
1598 | |
1599 |
|
1600 |
|
1601 | onEnter: _propTypes2["default"].func,
|
1602 | |
1603 |
|
1604 |
|
1605 | onEntering: _propTypes2["default"].func,
|
1606 | |
1607 |
|
1608 |
|
1609 | onEntered: _propTypes2["default"].func,
|
1610 | |
1611 |
|
1612 |
|
1613 | onExit: _propTypes2["default"].func,
|
1614 | |
1615 |
|
1616 |
|
1617 | onExiting: _propTypes2["default"].func,
|
1618 | |
1619 |
|
1620 |
|
1621 | onExited: _propTypes2["default"].func,
|
1622 |
|
1623 | |
1624 |
|
1625 |
|
1626 |
|
1627 |
|
1628 |
|
1629 |
|
1630 | dimension: _propTypes2["default"].oneOfType([_propTypes2["default"].oneOf(['height', 'width']), _propTypes2["default"].func]),
|
1631 |
|
1632 | |
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 | getDimensionValue: _propTypes2["default"].func,
|
1640 |
|
1641 | |
1642 |
|
1643 |
|
1644 | role: _propTypes2["default"].string
|
1645 | };
|
1646 |
|
1647 | var defaultProps = {
|
1648 | "in": false,
|
1649 | timeout: 300,
|
1650 | unmountOnExit: false,
|
1651 | transitionAppear: false,
|
1652 |
|
1653 | dimension: 'height',
|
1654 | getDimensionValue: getDimensionValue
|
1655 | };
|
1656 |
|
1657 | var Collapse = function (_React$Component) {
|
1658 | _inherits(Collapse, _React$Component);
|
1659 |
|
1660 | function Collapse(props, context) {
|
1661 | _classCallCheck(this, Collapse);
|
1662 |
|
1663 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
1664 |
|
1665 | _this.handleEnter = _this.handleEnter.bind(_this);
|
1666 | _this.handleEntering = _this.handleEntering.bind(_this);
|
1667 | _this.handleEntered = _this.handleEntered.bind(_this);
|
1668 | _this.handleExit = _this.handleExit.bind(_this);
|
1669 | _this.handleExiting = _this.handleExiting.bind(_this);
|
1670 | return _this;
|
1671 | }
|
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 | Collapse.prototype.handleEnter = function handleEnter(elem) {
|
1677 | var dimension = this._dimension();
|
1678 | elem.style[dimension] = '0';
|
1679 | };
|
1680 |
|
1681 | Collapse.prototype.handleEntering = function handleEntering(elem) {
|
1682 | var dimension = this._dimension();
|
1683 | elem.style[dimension] = this._getScrollDimensionValue(elem, dimension);
|
1684 | };
|
1685 |
|
1686 | Collapse.prototype.handleEntered = function handleEntered(elem) {
|
1687 | var dimension = this._dimension();
|
1688 | elem.style[dimension] = null;
|
1689 | };
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 | Collapse.prototype.handleExit = function handleExit(elem) {
|
1695 | var dimension = this._dimension();
|
1696 | elem.style[dimension] = this.props.getDimensionValue(dimension, elem) + 'px';
|
1697 | triggerBrowserReflow(elem);
|
1698 | };
|
1699 |
|
1700 | Collapse.prototype.handleExiting = function handleExiting(elem) {
|
1701 | var dimension = this._dimension();
|
1702 | elem.style[dimension] = '0';
|
1703 | };
|
1704 |
|
1705 | Collapse.prototype._dimension = function _dimension() {
|
1706 | return typeof this.props.dimension === 'function' ? this.props.dimension() : this.props.dimension;
|
1707 | };
|
1708 |
|
1709 |
|
1710 |
|
1711 |
|
1712 | Collapse.prototype._getScrollDimensionValue = function _getScrollDimensionValue(elem, dimension) {
|
1713 | return elem['scroll' + (0, _capitalize2["default"])(dimension)] + 'px';
|
1714 | };
|
1715 |
|
1716 | Collapse.prototype.render = function render() {
|
1717 | var _props = this.props,
|
1718 | onEnter = _props.onEnter,
|
1719 | onEntering = _props.onEntering,
|
1720 | onEntered = _props.onEntered,
|
1721 | onExit = _props.onExit,
|
1722 | onExiting = _props.onExiting,
|
1723 | className = _props.className,
|
1724 | props = _objectWithoutProperties(_props, ['onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'className']);
|
1725 |
|
1726 | delete props.dimension;
|
1727 | delete props.getDimensionValue;
|
1728 |
|
1729 | var handleEnter = (0, _tinperBeeCore.createChainedFunction)(this.handleEnter, onEnter);
|
1730 | var handleEntering = (0, _tinperBeeCore.createChainedFunction)(this.handleEntering, onEntering);
|
1731 | var handleEntered = (0, _tinperBeeCore.createChainedFunction)(this.handleEntered, onEntered);
|
1732 | var handleExit = (0, _tinperBeeCore.createChainedFunction)(this.handleExit, onExit);
|
1733 | var handleExiting = (0, _tinperBeeCore.createChainedFunction)(this.handleExiting, onExiting);
|
1734 |
|
1735 | var classes = {
|
1736 | width: this._dimension() === 'width'
|
1737 | };
|
1738 |
|
1739 | return _react2["default"].createElement(_Transition2["default"], _extends({}, props, {
|
1740 | 'aria-expanded': props.role ? props["in"] : null,
|
1741 | className: (0, _classnames2["default"])(className, classes),
|
1742 | exitedClassName: 'collapse',
|
1743 | exitingClassName: 'collapsing',
|
1744 | enteredClassName: 'collapse in',
|
1745 | enteringClassName: 'collapsing',
|
1746 | onEnter: handleEnter,
|
1747 | onEntering: handleEntering,
|
1748 | onEntered: handleEntered,
|
1749 | onExit: handleExit,
|
1750 | onExiting: handleExiting
|
1751 | }));
|
1752 | };
|
1753 |
|
1754 | return Collapse;
|
1755 | }(_react2["default"].Component);
|
1756 |
|
1757 | Collapse.propTypes = propTypes;
|
1758 | Collapse.defaultProps = defaultProps;
|
1759 |
|
1760 | exports["default"] = Collapse;
|
1761 | module.exports = exports['default'];
|
1762 |
|
1763 | }),
|
1764 |
|
1765 | (function(module, exports, __webpack_require__) {
|
1766 |
|
1767 | "use strict";
|
1768 |
|
1769 | var _interopRequireDefault = __webpack_require__(14);
|
1770 |
|
1771 | exports.__esModule = true;
|
1772 | exports.default = style;
|
1773 |
|
1774 | var _camelizeStyle = _interopRequireDefault(__webpack_require__(19));
|
1775 |
|
1776 | var _hyphenateStyle = _interopRequireDefault(__webpack_require__(21));
|
1777 |
|
1778 | var _getComputedStyle2 = _interopRequireDefault(__webpack_require__(23));
|
1779 |
|
1780 | var _removeStyle = _interopRequireDefault(__webpack_require__(24));
|
1781 |
|
1782 | var _properties = __webpack_require__(13);
|
1783 |
|
1784 | var _isTransform = _interopRequireDefault(__webpack_require__(25));
|
1785 |
|
1786 | function style(node, property, value) {
|
1787 | var css = '';
|
1788 | var transforms = '';
|
1789 | var props = property;
|
1790 |
|
1791 | if (typeof property === 'string') {
|
1792 | if (value === undefined) {
|
1793 | return node.style[(0, _camelizeStyle.default)(property)] || (0, _getComputedStyle2.default)(node).getPropertyValue((0, _hyphenateStyle.default)(property));
|
1794 | } else {
|
1795 | (props = {})[property] = value;
|
1796 | }
|
1797 | }
|
1798 |
|
1799 | Object.keys(props).forEach(function (key) {
|
1800 | var value = props[key];
|
1801 |
|
1802 | if (!value && value !== 0) {
|
1803 | (0, _removeStyle.default)(node, (0, _hyphenateStyle.default)(key));
|
1804 | } else if ((0, _isTransform.default)(key)) {
|
1805 | transforms += key + "(" + value + ") ";
|
1806 | } else {
|
1807 | css += (0, _hyphenateStyle.default)(key) + ": " + value + ";";
|
1808 | }
|
1809 | });
|
1810 |
|
1811 | if (transforms) {
|
1812 | css += _properties.transform + ": " + transforms + ";";
|
1813 | }
|
1814 |
|
1815 | node.style.cssText += ';' + css;
|
1816 | }
|
1817 |
|
1818 | module.exports = exports["default"];
|
1819 |
|
1820 | }),
|
1821 |
|
1822 | (function(module, exports, __webpack_require__) {
|
1823 |
|
1824 | "use strict";
|
1825 |
|
1826 | var _interopRequireDefault = __webpack_require__(14);
|
1827 |
|
1828 | exports.__esModule = true;
|
1829 | exports.default = camelizeStyleName;
|
1830 |
|
1831 | var _camelize = _interopRequireDefault(__webpack_require__(20));
|
1832 |
|
1833 | |
1834 |
|
1835 |
|
1836 |
|
1837 |
|
1838 | var msPattern = /^-ms-/;
|
1839 |
|
1840 | function camelizeStyleName(string) {
|
1841 | return (0, _camelize.default)(string.replace(msPattern, 'ms-'));
|
1842 | }
|
1843 |
|
1844 | module.exports = exports["default"];
|
1845 |
|
1846 | }),
|
1847 |
|
1848 | (function(module, exports) {
|
1849 |
|
1850 | "use strict";
|
1851 |
|
1852 | exports.__esModule = true;
|
1853 | exports.default = camelize;
|
1854 | var rHyphen = /-(.)/g;
|
1855 |
|
1856 | function camelize(string) {
|
1857 | return string.replace(rHyphen, function (_, chr) {
|
1858 | return chr.toUpperCase();
|
1859 | });
|
1860 | }
|
1861 |
|
1862 | module.exports = exports["default"];
|
1863 |
|
1864 | }),
|
1865 |
|
1866 | (function(module, exports, __webpack_require__) {
|
1867 |
|
1868 | "use strict";
|
1869 |
|
1870 | var _interopRequireDefault = __webpack_require__(14);
|
1871 |
|
1872 | exports.__esModule = true;
|
1873 | exports.default = hyphenateStyleName;
|
1874 |
|
1875 | var _hyphenate = _interopRequireDefault(__webpack_require__(22));
|
1876 |
|
1877 | |
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 | var msPattern = /^ms-/;
|
1883 |
|
1884 | function hyphenateStyleName(string) {
|
1885 | return (0, _hyphenate.default)(string).replace(msPattern, '-ms-');
|
1886 | }
|
1887 |
|
1888 | module.exports = exports["default"];
|
1889 |
|
1890 | }),
|
1891 |
|
1892 | (function(module, exports) {
|
1893 |
|
1894 | "use strict";
|
1895 |
|
1896 | exports.__esModule = true;
|
1897 | exports.default = hyphenate;
|
1898 | var rUpper = /([A-Z])/g;
|
1899 |
|
1900 | function hyphenate(string) {
|
1901 | return string.replace(rUpper, '-$1').toLowerCase();
|
1902 | }
|
1903 |
|
1904 | module.exports = exports["default"];
|
1905 |
|
1906 | }),
|
1907 |
|
1908 | (function(module, exports, __webpack_require__) {
|
1909 |
|
1910 | "use strict";
|
1911 |
|
1912 | var _interopRequireDefault = __webpack_require__(14);
|
1913 |
|
1914 | exports.__esModule = true;
|
1915 | exports.default = _getComputedStyle;
|
1916 |
|
1917 | var _camelizeStyle = _interopRequireDefault(__webpack_require__(19));
|
1918 |
|
1919 | var rposition = /^(top|right|bottom|left)$/;
|
1920 | var rnumnonpx = /^([+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/i;
|
1921 |
|
1922 | function _getComputedStyle(node) {
|
1923 | if (!node) throw new TypeError('No Element passed to `getComputedStyle()`');
|
1924 | var doc = node.ownerDocument;
|
1925 | return 'defaultView' in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : {
|
1926 |
|
1927 | getPropertyValue: function getPropertyValue(prop) {
|
1928 | var style = node.style;
|
1929 | prop = (0, _camelizeStyle.default)(prop);
|
1930 | if (prop == 'float') prop = 'styleFloat';
|
1931 | var current = node.currentStyle[prop] || null;
|
1932 | if (current == null && style && style[prop]) current = style[prop];
|
1933 |
|
1934 | if (rnumnonpx.test(current) && !rposition.test(prop)) {
|
1935 |
|
1936 | var left = style.left;
|
1937 | var runStyle = node.runtimeStyle;
|
1938 | var rsLeft = runStyle && runStyle.left;
|
1939 |
|
1940 | if (rsLeft) runStyle.left = node.currentStyle.left;
|
1941 | style.left = prop === 'fontSize' ? '1em' : current;
|
1942 | current = style.pixelLeft + 'px';
|
1943 |
|
1944 | style.left = left;
|
1945 | if (rsLeft) runStyle.left = rsLeft;
|
1946 | }
|
1947 |
|
1948 | return current;
|
1949 | }
|
1950 | };
|
1951 | }
|
1952 |
|
1953 | module.exports = exports["default"];
|
1954 |
|
1955 | }),
|
1956 |
|
1957 | (function(module, exports) {
|
1958 |
|
1959 | "use strict";
|
1960 |
|
1961 | exports.__esModule = true;
|
1962 | exports.default = removeStyle;
|
1963 |
|
1964 | function removeStyle(node, key) {
|
1965 | return 'removeProperty' in node.style ? node.style.removeProperty(key) : node.style.removeAttribute(key);
|
1966 | }
|
1967 |
|
1968 | module.exports = exports["default"];
|
1969 |
|
1970 | }),
|
1971 |
|
1972 | (function(module, exports) {
|
1973 |
|
1974 | "use strict";
|
1975 |
|
1976 | exports.__esModule = true;
|
1977 | exports.default = isTransform;
|
1978 | var supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;
|
1979 |
|
1980 | function isTransform(property) {
|
1981 | return !!(property && supportedTransforms.test(property));
|
1982 | }
|
1983 |
|
1984 | module.exports = exports["default"];
|
1985 |
|
1986 | }),
|
1987 |
|
1988 | (function(module, exports) {
|
1989 |
|
1990 | "use strict";
|
1991 |
|
1992 | Object.defineProperty(exports, "__esModule", {
|
1993 | value: true
|
1994 | });
|
1995 | exports["default"] = capitalize;
|
1996 | function capitalize(string) {
|
1997 | return "" + string.charAt(0).toUpperCase() + string.slice(1);
|
1998 | }
|
1999 | module.exports = exports["default"];
|
2000 |
|
2001 | }),
|
2002 |
|
2003 | (function(module, exports, __webpack_require__) {
|
2004 |
|
2005 | 'use strict';
|
2006 |
|
2007 | exports.__esModule = true;
|
2008 | 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;
|
2009 |
|
2010 | var _all2 = __webpack_require__(28);
|
2011 |
|
2012 | var _all3 = _interopRequireDefault(_all2);
|
2013 |
|
2014 | var _componentOrElement2 = __webpack_require__(30);
|
2015 |
|
2016 | var _componentOrElement3 = _interopRequireDefault(_componentOrElement2);
|
2017 |
|
2018 | var _deprecated2 = __webpack_require__(31);
|
2019 |
|
2020 | var _deprecated3 = _interopRequireDefault(_deprecated2);
|
2021 |
|
2022 | var _elementType2 = __webpack_require__(34);
|
2023 |
|
2024 | var _elementType3 = _interopRequireDefault(_elementType2);
|
2025 |
|
2026 | var _isRequiredForA11y2 = __webpack_require__(35);
|
2027 |
|
2028 | var _isRequiredForA11y3 = _interopRequireDefault(_isRequiredForA11y2);
|
2029 |
|
2030 | var _splitComponent2 = __webpack_require__(36);
|
2031 |
|
2032 | var _splitComponent3 = _interopRequireDefault(_splitComponent2);
|
2033 |
|
2034 | var _createChainedFunction2 = __webpack_require__(37);
|
2035 |
|
2036 | var _createChainedFunction3 = _interopRequireDefault(_createChainedFunction2);
|
2037 |
|
2038 | var _keyCode = __webpack_require__(38);
|
2039 |
|
2040 | var _keyCode2 = _interopRequireDefault(_keyCode);
|
2041 |
|
2042 | var _contains2 = __webpack_require__(39);
|
2043 |
|
2044 | var _contains3 = _interopRequireDefault(_contains2);
|
2045 |
|
2046 | var _addEventListener2 = __webpack_require__(40);
|
2047 |
|
2048 | var _addEventListener3 = _interopRequireDefault(_addEventListener2);
|
2049 |
|
2050 | var _cssAnimation2 = __webpack_require__(45);
|
2051 |
|
2052 | var _cssAnimation3 = _interopRequireDefault(_cssAnimation2);
|
2053 |
|
2054 | var _toArray2 = __webpack_require__(49);
|
2055 |
|
2056 | var _toArray3 = _interopRequireDefault(_toArray2);
|
2057 |
|
2058 | var _Align2 = __webpack_require__(50);
|
2059 |
|
2060 | var _Align3 = _interopRequireDefault(_Align2);
|
2061 |
|
2062 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2063 |
|
2064 | exports.all = _all3.default;
|
2065 | exports.componentOrElement = _componentOrElement3.default;
|
2066 | exports.deprecated = _deprecated3.default;
|
2067 | exports.elementType = _elementType3.default;
|
2068 | exports.isRequiredForA11y = _isRequiredForA11y3.default;
|
2069 | exports.splitComponent = _splitComponent3.default;
|
2070 | exports.createChainedFunction = _createChainedFunction3.default;
|
2071 | exports.KeyCode = _keyCode2.default;
|
2072 | exports.contains = _contains3.default;
|
2073 | exports.addEventListener = _addEventListener3.default;
|
2074 | exports.cssAnimation = _cssAnimation3.default;
|
2075 | exports.toArray = _toArray3.default;
|
2076 |
|
2077 |
|
2078 | exports.Align = _Align3.default;
|
2079 |
|
2080 | }),
|
2081 |
|
2082 | (function(module, exports, __webpack_require__) {
|
2083 |
|
2084 | 'use strict';
|
2085 |
|
2086 | exports.__esModule = true;
|
2087 | exports.default = all;
|
2088 |
|
2089 | var _createChainableTypeChecker = __webpack_require__(29);
|
2090 |
|
2091 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2092 |
|
2093 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2094 |
|
2095 | function all() {
|
2096 | for (var _len = arguments.length, validators = Array(_len), _key = 0; _key < _len; _key++) {
|
2097 | validators[_key] = arguments[_key];
|
2098 | }
|
2099 |
|
2100 | function allPropTypes() {
|
2101 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2102 | args[_key2] = arguments[_key2];
|
2103 | }
|
2104 |
|
2105 | var error = null;
|
2106 |
|
2107 | validators.forEach(function (validator) {
|
2108 | if (error != null) {
|
2109 | return;
|
2110 | }
|
2111 |
|
2112 | var result = validator.apply(undefined, args);
|
2113 | if (result != null) {
|
2114 | error = result;
|
2115 | }
|
2116 | });
|
2117 |
|
2118 | return error;
|
2119 | }
|
2120 |
|
2121 | return (0, _createChainableTypeChecker2.default)(allPropTypes);
|
2122 | }
|
2123 |
|
2124 | }),
|
2125 |
|
2126 | (function(module, exports) {
|
2127 |
|
2128 | 'use strict';
|
2129 |
|
2130 | exports.__esModule = true;
|
2131 | exports.default = createChainableTypeChecker;
|
2132 | |
2133 |
|
2134 |
|
2135 |
|
2136 |
|
2137 |
|
2138 |
|
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 | function createChainableTypeChecker(validate) {
|
2144 | function checkType(isRequired, props, propName, componentName, location, propFullName) {
|
2145 | var componentNameSafe = componentName || '<<anonymous>>';
|
2146 | var propFullNameSafe = propFullName || propName;
|
2147 |
|
2148 | if (props[propName] == null) {
|
2149 | if (isRequired) {
|
2150 | return new Error('Required ' + location + ' `' + propFullNameSafe + '` was not specified ' + ('in `' + componentNameSafe + '`.'));
|
2151 | }
|
2152 |
|
2153 | return null;
|
2154 | }
|
2155 |
|
2156 | for (var _len = arguments.length, args = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) {
|
2157 | args[_key - 6] = arguments[_key];
|
2158 | }
|
2159 |
|
2160 | return validate.apply(undefined, [props, propName, componentNameSafe, location, propFullNameSafe].concat(args));
|
2161 | }
|
2162 |
|
2163 | var chainedCheckType = checkType.bind(null, false);
|
2164 | chainedCheckType.isRequired = checkType.bind(null, true);
|
2165 |
|
2166 | return chainedCheckType;
|
2167 | }
|
2168 |
|
2169 | }),
|
2170 |
|
2171 | (function(module, exports, __webpack_require__) {
|
2172 |
|
2173 | 'use strict';
|
2174 |
|
2175 | exports.__esModule = true;
|
2176 |
|
2177 | 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; };
|
2178 |
|
2179 | var _react = __webpack_require__(4);
|
2180 |
|
2181 | var _react2 = _interopRequireDefault(_react);
|
2182 |
|
2183 | var _createChainableTypeChecker = __webpack_require__(29);
|
2184 |
|
2185 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2186 |
|
2187 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2188 |
|
2189 | function validate(props, propName, componentName, location, propFullName) {
|
2190 | var propValue = props[propName];
|
2191 | var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
|
2192 |
|
2193 | if (_react2.default.isValidElement(propValue)) {
|
2194 | 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.');
|
2195 | }
|
2196 |
|
2197 | if ((propType !== 'object' || typeof propValue.render !== 'function') && propValue.nodeType !== 1) {
|
2198 | return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected a ReactComponent or a ') + 'DOMElement.');
|
2199 | }
|
2200 |
|
2201 | return null;
|
2202 | }
|
2203 |
|
2204 | exports.default = (0, _createChainableTypeChecker2.default)(validate);
|
2205 |
|
2206 | }),
|
2207 |
|
2208 | (function(module, exports, __webpack_require__) {
|
2209 |
|
2210 | 'use strict';
|
2211 |
|
2212 | exports.__esModule = true;
|
2213 | exports.default = deprecated;
|
2214 |
|
2215 | var _warning = __webpack_require__(32);
|
2216 |
|
2217 | var _warning2 = _interopRequireDefault(_warning);
|
2218 |
|
2219 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2220 |
|
2221 | var warned = {};
|
2222 |
|
2223 | function deprecated(validator, reason) {
|
2224 | return function validate(props, propName, componentName, location, propFullName) {
|
2225 | var componentNameSafe = componentName || '<<anonymous>>';
|
2226 | var propFullNameSafe = propFullName || propName;
|
2227 |
|
2228 | if (props[propName] != null) {
|
2229 | var messageKey = componentName + '.' + propName;
|
2230 |
|
2231 | (0, _warning2.default)(warned[messageKey], 'The ' + location + ' `' + propFullNameSafe + '` of ' + ('`' + componentNameSafe + '` is deprecated. ' + reason + '.'));
|
2232 |
|
2233 | warned[messageKey] = true;
|
2234 | }
|
2235 |
|
2236 | for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
2237 | args[_key - 5] = arguments[_key];
|
2238 | }
|
2239 |
|
2240 | return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
|
2241 | };
|
2242 | }
|
2243 |
|
2244 |
|
2245 | function _resetWarned() {
|
2246 | warned = {};
|
2247 | }
|
2248 |
|
2249 | deprecated._resetWarned = _resetWarned;
|
2250 |
|
2251 |
|
2252 | }),
|
2253 |
|
2254 | (function(module, exports, __webpack_require__) {
|
2255 |
|
2256 | (function(process) { |
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 | 'use strict';
|
2266 |
|
2267 | |
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 | var warning = function() {};
|
2275 |
|
2276 | if (process.env.NODE_ENV !== 'production') {
|
2277 | warning = function(condition, format, args) {
|
2278 | var len = arguments.length;
|
2279 | args = new Array(len > 2 ? len - 2 : 0);
|
2280 | for (var key = 2; key < len; key++) {
|
2281 | args[key - 2] = arguments[key];
|
2282 | }
|
2283 | if (format === undefined) {
|
2284 | throw new Error(
|
2285 | '`warning(condition, format, ...args)` requires a warning ' +
|
2286 | 'message argument'
|
2287 | );
|
2288 | }
|
2289 |
|
2290 | if (format.length < 10 || (/^[s\W]*$/).test(format)) {
|
2291 | throw new Error(
|
2292 | 'The warning format should be able to uniquely identify this ' +
|
2293 | 'warning. Please, use a more descriptive format than: ' + format
|
2294 | );
|
2295 | }
|
2296 |
|
2297 | if (!condition) {
|
2298 | var argIndex = 0;
|
2299 | var message = 'Warning: ' +
|
2300 | format.replace(/%s/g, function() {
|
2301 | return args[argIndex++];
|
2302 | });
|
2303 | if (typeof console !== 'undefined') {
|
2304 | console.error(message);
|
2305 | }
|
2306 | try {
|
2307 |
|
2308 |
|
2309 | throw new Error(message);
|
2310 | } catch(x) {}
|
2311 | }
|
2312 | };
|
2313 | }
|
2314 |
|
2315 | module.exports = warning;
|
2316 |
|
2317 | }.call(exports, __webpack_require__(33)))
|
2318 |
|
2319 | }),
|
2320 |
|
2321 | (function(module, exports) {
|
2322 |
|
2323 |
|
2324 | var process = module.exports = {};
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 | var cachedSetTimeout;
|
2332 | var cachedClearTimeout;
|
2333 |
|
2334 | function defaultSetTimout() {
|
2335 | throw new Error('setTimeout has not been defined');
|
2336 | }
|
2337 | function defaultClearTimeout () {
|
2338 | throw new Error('clearTimeout has not been defined');
|
2339 | }
|
2340 | (function () {
|
2341 | try {
|
2342 | if (typeof setTimeout === 'function') {
|
2343 | cachedSetTimeout = setTimeout;
|
2344 | } else {
|
2345 | cachedSetTimeout = defaultSetTimout;
|
2346 | }
|
2347 | } catch (e) {
|
2348 | cachedSetTimeout = defaultSetTimout;
|
2349 | }
|
2350 | try {
|
2351 | if (typeof clearTimeout === 'function') {
|
2352 | cachedClearTimeout = clearTimeout;
|
2353 | } else {
|
2354 | cachedClearTimeout = defaultClearTimeout;
|
2355 | }
|
2356 | } catch (e) {
|
2357 | cachedClearTimeout = defaultClearTimeout;
|
2358 | }
|
2359 | } ())
|
2360 | function runTimeout(fun) {
|
2361 | if (cachedSetTimeout === setTimeout) {
|
2362 |
|
2363 | return setTimeout(fun, 0);
|
2364 | }
|
2365 |
|
2366 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
2367 | cachedSetTimeout = setTimeout;
|
2368 | return setTimeout(fun, 0);
|
2369 | }
|
2370 | try {
|
2371 |
|
2372 | return cachedSetTimeout(fun, 0);
|
2373 | } catch(e){
|
2374 | try {
|
2375 |
|
2376 | return cachedSetTimeout.call(null, fun, 0);
|
2377 | } catch(e){
|
2378 |
|
2379 | return cachedSetTimeout.call(this, fun, 0);
|
2380 | }
|
2381 | }
|
2382 |
|
2383 |
|
2384 | }
|
2385 | function runClearTimeout(marker) {
|
2386 | if (cachedClearTimeout === clearTimeout) {
|
2387 |
|
2388 | return clearTimeout(marker);
|
2389 | }
|
2390 |
|
2391 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
2392 | cachedClearTimeout = clearTimeout;
|
2393 | return clearTimeout(marker);
|
2394 | }
|
2395 | try {
|
2396 |
|
2397 | return cachedClearTimeout(marker);
|
2398 | } catch (e){
|
2399 | try {
|
2400 |
|
2401 | return cachedClearTimeout.call(null, marker);
|
2402 | } catch (e){
|
2403 |
|
2404 |
|
2405 | return cachedClearTimeout.call(this, marker);
|
2406 | }
|
2407 | }
|
2408 |
|
2409 |
|
2410 |
|
2411 | }
|
2412 | var queue = [];
|
2413 | var draining = false;
|
2414 | var currentQueue;
|
2415 | var queueIndex = -1;
|
2416 |
|
2417 | function cleanUpNextTick() {
|
2418 | if (!draining || !currentQueue) {
|
2419 | return;
|
2420 | }
|
2421 | draining = false;
|
2422 | if (currentQueue.length) {
|
2423 | queue = currentQueue.concat(queue);
|
2424 | } else {
|
2425 | queueIndex = -1;
|
2426 | }
|
2427 | if (queue.length) {
|
2428 | drainQueue();
|
2429 | }
|
2430 | }
|
2431 |
|
2432 | function drainQueue() {
|
2433 | if (draining) {
|
2434 | return;
|
2435 | }
|
2436 | var timeout = runTimeout(cleanUpNextTick);
|
2437 | draining = true;
|
2438 |
|
2439 | var len = queue.length;
|
2440 | while(len) {
|
2441 | currentQueue = queue;
|
2442 | queue = [];
|
2443 | while (++queueIndex < len) {
|
2444 | if (currentQueue) {
|
2445 | currentQueue[queueIndex].run();
|
2446 | }
|
2447 | }
|
2448 | queueIndex = -1;
|
2449 | len = queue.length;
|
2450 | }
|
2451 | currentQueue = null;
|
2452 | draining = false;
|
2453 | runClearTimeout(timeout);
|
2454 | }
|
2455 |
|
2456 | process.nextTick = function (fun) {
|
2457 | var args = new Array(arguments.length - 1);
|
2458 | if (arguments.length > 1) {
|
2459 | for (var i = 1; i < arguments.length; i++) {
|
2460 | args[i - 1] = arguments[i];
|
2461 | }
|
2462 | }
|
2463 | queue.push(new Item(fun, args));
|
2464 | if (queue.length === 1 && !draining) {
|
2465 | runTimeout(drainQueue);
|
2466 | }
|
2467 | };
|
2468 |
|
2469 |
|
2470 | function Item(fun, array) {
|
2471 | this.fun = fun;
|
2472 | this.array = array;
|
2473 | }
|
2474 | Item.prototype.run = function () {
|
2475 | this.fun.apply(null, this.array);
|
2476 | };
|
2477 | process.title = 'browser';
|
2478 | process.browser = true;
|
2479 | process.env = {};
|
2480 | process.argv = [];
|
2481 | process.version = '';
|
2482 | process.versions = {};
|
2483 |
|
2484 | function noop() {}
|
2485 |
|
2486 | process.on = noop;
|
2487 | process.addListener = noop;
|
2488 | process.once = noop;
|
2489 | process.off = noop;
|
2490 | process.removeListener = noop;
|
2491 | process.removeAllListeners = noop;
|
2492 | process.emit = noop;
|
2493 | process.prependListener = noop;
|
2494 | process.prependOnceListener = noop;
|
2495 |
|
2496 | process.listeners = function (name) { return [] }
|
2497 |
|
2498 | process.binding = function (name) {
|
2499 | throw new Error('process.binding is not supported');
|
2500 | };
|
2501 |
|
2502 | process.cwd = function () { return '/' };
|
2503 | process.chdir = function (dir) {
|
2504 | throw new Error('process.chdir is not supported');
|
2505 | };
|
2506 | process.umask = function() { return 0; };
|
2507 |
|
2508 |
|
2509 | }),
|
2510 |
|
2511 | (function(module, exports, __webpack_require__) {
|
2512 |
|
2513 | 'use strict';
|
2514 |
|
2515 | exports.__esModule = true;
|
2516 |
|
2517 | 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; };
|
2518 |
|
2519 | var _react = __webpack_require__(4);
|
2520 |
|
2521 | var _react2 = _interopRequireDefault(_react);
|
2522 |
|
2523 | var _createChainableTypeChecker = __webpack_require__(29);
|
2524 |
|
2525 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2526 |
|
2527 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2528 |
|
2529 | function elementType(props, propName, componentName, location, propFullName) {
|
2530 | var propValue = props[propName];
|
2531 | var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
|
2532 |
|
2533 | if (_react2.default.isValidElement(propValue)) {
|
2534 | return new Error('Invalid ' + location + ' `' + propFullName + '` of type ReactElement ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
|
2535 | }
|
2536 |
|
2537 | if (propType !== 'function' && propType !== 'string') {
|
2538 | return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
|
2539 | }
|
2540 |
|
2541 | return null;
|
2542 | }
|
2543 |
|
2544 | exports.default = (0, _createChainableTypeChecker2.default)(elementType);
|
2545 |
|
2546 | }),
|
2547 |
|
2548 | (function(module, exports) {
|
2549 |
|
2550 | 'use strict';
|
2551 |
|
2552 | exports.__esModule = true;
|
2553 | exports.default = isRequiredForA11y;
|
2554 | function isRequiredForA11y(validator) {
|
2555 | return function validate(props, propName, componentName, location, propFullName) {
|
2556 | var componentNameSafe = componentName || '<<anonymous>>';
|
2557 | var propFullNameSafe = propFullName || propName;
|
2558 |
|
2559 | if (props[propName] == null) {
|
2560 | return new Error('The ' + location + ' `' + propFullNameSafe + '` is required to make ' + ('`' + componentNameSafe + '` accessible for users of assistive ') + 'technologies such as screen readers.');
|
2561 | }
|
2562 |
|
2563 | for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
2564 | args[_key - 5] = arguments[_key];
|
2565 | }
|
2566 |
|
2567 | return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
|
2568 | };
|
2569 | }
|
2570 |
|
2571 | }),
|
2572 |
|
2573 | (function(module, exports) {
|
2574 |
|
2575 | "use strict";
|
2576 |
|
2577 | exports.__esModule = true;
|
2578 | exports.default = splitComponentProps;
|
2579 | function _objectEntries(obj) {
|
2580 | var entries = [];
|
2581 | var keys = Object.keys(obj);
|
2582 |
|
2583 | for (var k = 0; k < keys.length; ++k) {
|
2584 | entries.push([keys[k], obj[keys[k]]]);
|
2585 | }return entries;
|
2586 | }
|
2587 |
|
2588 | |
2589 |
|
2590 |
|
2591 |
|
2592 |
|
2593 |
|
2594 | function splitComponentProps(props, Component) {
|
2595 | var componentPropTypes = Component.propTypes;
|
2596 |
|
2597 | var parentProps = {};
|
2598 | var childProps = {};
|
2599 |
|
2600 | _objectEntries(props).forEach(function (_ref) {
|
2601 | var propName = _ref[0],
|
2602 | propValue = _ref[1];
|
2603 |
|
2604 | if (componentPropTypes[propName]) {
|
2605 | parentProps[propName] = propValue;
|
2606 | } else {
|
2607 | childProps[propName] = propValue;
|
2608 | }
|
2609 | });
|
2610 |
|
2611 | return [parentProps, childProps];
|
2612 | }
|
2613 |
|
2614 | }),
|
2615 |
|
2616 | (function(module, exports) {
|
2617 |
|
2618 | 'use strict';
|
2619 |
|
2620 | exports.__esModule = true;
|
2621 | function createChainedFunction() {
|
2622 | for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
|
2623 | funcs[_key] = arguments[_key];
|
2624 | }
|
2625 |
|
2626 | return funcs.filter(function (f) {
|
2627 | return f != null;
|
2628 | }).reduce(function (acc, f) {
|
2629 | if (typeof f !== 'function') {
|
2630 | throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
|
2631 | }
|
2632 |
|
2633 | if (acc === null) {
|
2634 | return f;
|
2635 | }
|
2636 |
|
2637 | return function chainedFunction() {
|
2638 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2639 | args[_key2] = arguments[_key2];
|
2640 | }
|
2641 |
|
2642 | acc.apply(this, args);
|
2643 | f.apply(this, args);
|
2644 | };
|
2645 | }, null);
|
2646 | }
|
2647 | exports.default = createChainedFunction;
|
2648 |
|
2649 | }),
|
2650 |
|
2651 | (function(module, exports) {
|
2652 |
|
2653 | 'use strict';
|
2654 |
|
2655 | |
2656 |
|
2657 |
|
2658 |
|
2659 |
|
2660 |
|
2661 | var KeyCode = {
|
2662 | |
2663 |
|
2664 |
|
2665 | MAC_ENTER: 3,
|
2666 | |
2667 |
|
2668 |
|
2669 | BACKSPACE: 8,
|
2670 | |
2671 |
|
2672 |
|
2673 | TAB: 9,
|
2674 | |
2675 |
|
2676 |
|
2677 | NUM_CENTER: 12,
|
2678 | |
2679 |
|
2680 |
|
2681 | ENTER: 13,
|
2682 | |
2683 |
|
2684 |
|
2685 | SHIFT: 16,
|
2686 | |
2687 |
|
2688 |
|
2689 | CTRL: 17,
|
2690 | |
2691 |
|
2692 |
|
2693 | ALT: 18,
|
2694 | |
2695 |
|
2696 |
|
2697 | PAUSE: 19,
|
2698 | |
2699 |
|
2700 |
|
2701 | CAPS_LOCK: 20,
|
2702 | |
2703 |
|
2704 |
|
2705 | ESC: 27,
|
2706 | |
2707 |
|
2708 |
|
2709 | SPACE: 32,
|
2710 | |
2711 |
|
2712 |
|
2713 | PAGE_UP: 33,
|
2714 | |
2715 |
|
2716 |
|
2717 | PAGE_DOWN: 34,
|
2718 | |
2719 |
|
2720 |
|
2721 | END: 35,
|
2722 | |
2723 |
|
2724 |
|
2725 | HOME: 36,
|
2726 | |
2727 |
|
2728 |
|
2729 | LEFT: 37,
|
2730 | |
2731 |
|
2732 |
|
2733 | UP: 38,
|
2734 | |
2735 |
|
2736 |
|
2737 | RIGHT: 39,
|
2738 | |
2739 |
|
2740 |
|
2741 | DOWN: 40,
|
2742 | |
2743 |
|
2744 |
|
2745 | PRINT_SCREEN: 44,
|
2746 | |
2747 |
|
2748 |
|
2749 | INSERT: 45,
|
2750 | |
2751 |
|
2752 |
|
2753 | DELETE: 46,
|
2754 | |
2755 |
|
2756 |
|
2757 | ZERO: 48,
|
2758 | |
2759 |
|
2760 |
|
2761 | ONE: 49,
|
2762 | |
2763 |
|
2764 |
|
2765 | TWO: 50,
|
2766 | |
2767 |
|
2768 |
|
2769 | THREE: 51,
|
2770 | |
2771 |
|
2772 |
|
2773 | FOUR: 52,
|
2774 | |
2775 |
|
2776 |
|
2777 | FIVE: 53,
|
2778 | |
2779 |
|
2780 |
|
2781 | SIX: 54,
|
2782 | |
2783 |
|
2784 |
|
2785 | SEVEN: 55,
|
2786 | |
2787 |
|
2788 |
|
2789 | EIGHT: 56,
|
2790 | |
2791 |
|
2792 |
|
2793 | NINE: 57,
|
2794 | |
2795 |
|
2796 |
|
2797 | QUESTION_MARK: 63,
|
2798 | |
2799 |
|
2800 |
|
2801 | A: 65,
|
2802 | |
2803 |
|
2804 |
|
2805 | B: 66,
|
2806 | |
2807 |
|
2808 |
|
2809 | C: 67,
|
2810 | |
2811 |
|
2812 |
|
2813 | D: 68,
|
2814 | |
2815 |
|
2816 |
|
2817 | E: 69,
|
2818 | |
2819 |
|
2820 |
|
2821 | F: 70,
|
2822 | |
2823 |
|
2824 |
|
2825 | G: 71,
|
2826 | |
2827 |
|
2828 |
|
2829 | H: 72,
|
2830 | |
2831 |
|
2832 |
|
2833 | I: 73,
|
2834 | |
2835 |
|
2836 |
|
2837 | J: 74,
|
2838 | |
2839 |
|
2840 |
|
2841 | K: 75,
|
2842 | |
2843 |
|
2844 |
|
2845 | L: 76,
|
2846 | |
2847 |
|
2848 |
|
2849 | M: 77,
|
2850 | |
2851 |
|
2852 |
|
2853 | N: 78,
|
2854 | |
2855 |
|
2856 |
|
2857 | O: 79,
|
2858 | |
2859 |
|
2860 |
|
2861 | P: 80,
|
2862 | |
2863 |
|
2864 |
|
2865 | Q: 81,
|
2866 | |
2867 |
|
2868 |
|
2869 | R: 82,
|
2870 | |
2871 |
|
2872 |
|
2873 | S: 83,
|
2874 | |
2875 |
|
2876 |
|
2877 | T: 84,
|
2878 | |
2879 |
|
2880 |
|
2881 | U: 85,
|
2882 | |
2883 |
|
2884 |
|
2885 | V: 86,
|
2886 | |
2887 |
|
2888 |
|
2889 | W: 87,
|
2890 | |
2891 |
|
2892 |
|
2893 | X: 88,
|
2894 | |
2895 |
|
2896 |
|
2897 | Y: 89,
|
2898 | |
2899 |
|
2900 |
|
2901 | Z: 90,
|
2902 | |
2903 |
|
2904 |
|
2905 | META: 91,
|
2906 | |
2907 |
|
2908 |
|
2909 | WIN_KEY_RIGHT: 92,
|
2910 | |
2911 |
|
2912 |
|
2913 | CONTEXT_MENU: 93,
|
2914 | |
2915 |
|
2916 |
|
2917 | NUM_ZERO: 96,
|
2918 | |
2919 |
|
2920 |
|
2921 | NUM_ONE: 97,
|
2922 | |
2923 |
|
2924 |
|
2925 | NUM_TWO: 98,
|
2926 | |
2927 |
|
2928 |
|
2929 | NUM_THREE: 99,
|
2930 | |
2931 |
|
2932 |
|
2933 | NUM_FOUR: 100,
|
2934 | |
2935 |
|
2936 |
|
2937 | NUM_FIVE: 101,
|
2938 | |
2939 |
|
2940 |
|
2941 | NUM_SIX: 102,
|
2942 | |
2943 |
|
2944 |
|
2945 | NUM_SEVEN: 103,
|
2946 | |
2947 |
|
2948 |
|
2949 | NUM_EIGHT: 104,
|
2950 | |
2951 |
|
2952 |
|
2953 | NUM_NINE: 105,
|
2954 | |
2955 |
|
2956 |
|
2957 | NUM_MULTIPLY: 106,
|
2958 | |
2959 |
|
2960 |
|
2961 | NUM_PLUS: 107,
|
2962 | |
2963 |
|
2964 |
|
2965 | NUM_MINUS: 109,
|
2966 | |
2967 |
|
2968 |
|
2969 | NUM_PERIOD: 110,
|
2970 | |
2971 |
|
2972 |
|
2973 | NUM_DIVISION: 111,
|
2974 | |
2975 |
|
2976 |
|
2977 | F1: 112,
|
2978 | |
2979 |
|
2980 |
|
2981 | F2: 113,
|
2982 | |
2983 |
|
2984 |
|
2985 | F3: 114,
|
2986 | |
2987 |
|
2988 |
|
2989 | F4: 115,
|
2990 | |
2991 |
|
2992 |
|
2993 | F5: 116,
|
2994 | |
2995 |
|
2996 |
|
2997 | F6: 117,
|
2998 | |
2999 |
|
3000 |
|
3001 | F7: 118,
|
3002 | |
3003 |
|
3004 |
|
3005 | F8: 119,
|
3006 | |
3007 |
|
3008 |
|
3009 | F9: 120,
|
3010 | |
3011 |
|
3012 |
|
3013 | F10: 121,
|
3014 | |
3015 |
|
3016 |
|
3017 | F11: 122,
|
3018 | |
3019 |
|
3020 |
|
3021 | F12: 123,
|
3022 | |
3023 |
|
3024 |
|
3025 | NUMLOCK: 144,
|
3026 | |
3027 |
|
3028 |
|
3029 | SEMICOLON: 186,
|
3030 | |
3031 |
|
3032 |
|
3033 | DASH: 189,
|
3034 | |
3035 |
|
3036 |
|
3037 | EQUALS: 187,
|
3038 | |
3039 |
|
3040 |
|
3041 | COMMA: 188,
|
3042 | |
3043 |
|
3044 |
|
3045 | PERIOD: 190,
|
3046 | |
3047 |
|
3048 |
|
3049 | SLASH: 191,
|
3050 | |
3051 |
|
3052 |
|
3053 | APOSTROPHE: 192,
|
3054 | |
3055 |
|
3056 |
|
3057 | SINGLE_QUOTE: 222,
|
3058 | |
3059 |
|
3060 |
|
3061 | OPEN_SQUARE_BRACKET: 219,
|
3062 | |
3063 |
|
3064 |
|
3065 | BACKSLASH: 220,
|
3066 | |
3067 |
|
3068 |
|
3069 | CLOSE_SQUARE_BRACKET: 221,
|
3070 | |
3071 |
|
3072 |
|
3073 | WIN_KEY: 224,
|
3074 | |
3075 |
|
3076 |
|
3077 | MAC_FF_META: 224,
|
3078 | |
3079 |
|
3080 |
|
3081 | WIN_IME: 229
|
3082 | };
|
3083 |
|
3084 | |
3085 |
|
3086 |
|
3087 | KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) {
|
3088 | var keyCode = e.keyCode;
|
3089 | if (e.altKey && !e.ctrlKey || e.metaKey ||
|
3090 |
|
3091 | keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
|
3092 | return false;
|
3093 | }
|
3094 |
|
3095 |
|
3096 |
|
3097 | switch (keyCode) {
|
3098 | case KeyCode.ALT:
|
3099 | case KeyCode.CAPS_LOCK:
|
3100 | case KeyCode.CONTEXT_MENU:
|
3101 | case KeyCode.CTRL:
|
3102 | case KeyCode.DOWN:
|
3103 | case KeyCode.END:
|
3104 | case KeyCode.ESC:
|
3105 | case KeyCode.HOME:
|
3106 | case KeyCode.INSERT:
|
3107 | case KeyCode.LEFT:
|
3108 | case KeyCode.MAC_FF_META:
|
3109 | case KeyCode.META:
|
3110 | case KeyCode.NUMLOCK:
|
3111 | case KeyCode.NUM_CENTER:
|
3112 | case KeyCode.PAGE_DOWN:
|
3113 | case KeyCode.PAGE_UP:
|
3114 | case KeyCode.PAUSE:
|
3115 | case KeyCode.PRINT_SCREEN:
|
3116 | case KeyCode.RIGHT:
|
3117 | case KeyCode.SHIFT:
|
3118 | case KeyCode.UP:
|
3119 | case KeyCode.WIN_KEY:
|
3120 | case KeyCode.WIN_KEY_RIGHT:
|
3121 | return false;
|
3122 | default:
|
3123 | return true;
|
3124 | }
|
3125 | };
|
3126 |
|
3127 | |
3128 |
|
3129 |
|
3130 | KeyCode.isCharacterKey = function isCharacterKey(keyCode) {
|
3131 | if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
|
3132 | return true;
|
3133 | }
|
3134 |
|
3135 | if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
|
3136 | return true;
|
3137 | }
|
3138 |
|
3139 | if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
|
3140 | return true;
|
3141 | }
|
3142 |
|
3143 |
|
3144 | if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {
|
3145 | return true;
|
3146 | }
|
3147 |
|
3148 | switch (keyCode) {
|
3149 | case KeyCode.SPACE:
|
3150 | case KeyCode.QUESTION_MARK:
|
3151 | case KeyCode.NUM_PLUS:
|
3152 | case KeyCode.NUM_MINUS:
|
3153 | case KeyCode.NUM_PERIOD:
|
3154 | case KeyCode.NUM_DIVISION:
|
3155 | case KeyCode.SEMICOLON:
|
3156 | case KeyCode.DASH:
|
3157 | case KeyCode.EQUALS:
|
3158 | case KeyCode.COMMA:
|
3159 | case KeyCode.PERIOD:
|
3160 | case KeyCode.SLASH:
|
3161 | case KeyCode.APOSTROPHE:
|
3162 | case KeyCode.SINGLE_QUOTE:
|
3163 | case KeyCode.OPEN_SQUARE_BRACKET:
|
3164 | case KeyCode.BACKSLASH:
|
3165 | case KeyCode.CLOSE_SQUARE_BRACKET:
|
3166 | return true;
|
3167 | default:
|
3168 | return false;
|
3169 | }
|
3170 | };
|
3171 |
|
3172 | module.exports = KeyCode;
|
3173 |
|
3174 | }),
|
3175 |
|
3176 | (function(module, exports) {
|
3177 |
|
3178 | "use strict";
|
3179 |
|
3180 | exports.__esModule = true;
|
3181 | exports.default = contains;
|
3182 | function contains(root, n) {
|
3183 | var node = n;
|
3184 | while (node) {
|
3185 | if (node === root) {
|
3186 | return true;
|
3187 | }
|
3188 | node = node.parentNode;
|
3189 | }
|
3190 |
|
3191 | return false;
|
3192 | }
|
3193 |
|
3194 | }),
|
3195 |
|
3196 | (function(module, exports, __webpack_require__) {
|
3197 |
|
3198 | 'use strict';
|
3199 |
|
3200 | exports.__esModule = true;
|
3201 | exports.default = addEventListenerWrap;
|
3202 |
|
3203 | var _addDomEventListener = __webpack_require__(41);
|
3204 |
|
3205 | var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener);
|
3206 |
|
3207 | var _reactDom = __webpack_require__(12);
|
3208 |
|
3209 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
3210 |
|
3211 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3212 |
|
3213 | function addEventListenerWrap(target, eventType, cb) {
|
3214 |
|
3215 | var callback = _reactDom2.default.unstable_batchedUpdates ? function run(e) {
|
3216 | _reactDom2.default.unstable_batchedUpdates(cb, e);
|
3217 | } : cb;
|
3218 | return (0, _addDomEventListener2.default)(target, eventType, callback);
|
3219 | }
|
3220 |
|
3221 | }),
|
3222 |
|
3223 | (function(module, exports, __webpack_require__) {
|
3224 |
|
3225 | 'use strict';
|
3226 |
|
3227 | Object.defineProperty(exports, '__esModule', {
|
3228 | value: true
|
3229 | });
|
3230 | exports['default'] = addEventListener;
|
3231 |
|
3232 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
3233 |
|
3234 | var _EventObject = __webpack_require__(42);
|
3235 |
|
3236 | var _EventObject2 = _interopRequireDefault(_EventObject);
|
3237 |
|
3238 | function addEventListener(target, eventType, callback, option) {
|
3239 | function wrapCallback(e) {
|
3240 | var ne = new _EventObject2['default'](e);
|
3241 | callback.call(target, ne);
|
3242 | }
|
3243 |
|
3244 | if (target.addEventListener) {
|
3245 | var _ret = (function () {
|
3246 | var useCapture = false;
|
3247 | if (typeof option === 'object') {
|
3248 | useCapture = option.capture || false;
|
3249 | } else if (typeof option === 'boolean') {
|
3250 | useCapture = option;
|
3251 | }
|
3252 |
|
3253 | target.addEventListener(eventType, wrapCallback, option || false);
|
3254 |
|
3255 | return {
|
3256 | v: {
|
3257 | remove: function remove() {
|
3258 | target.removeEventListener(eventType, wrapCallback, useCapture);
|
3259 | }
|
3260 | }
|
3261 | };
|
3262 | })();
|
3263 |
|
3264 | if (typeof _ret === 'object') return _ret.v;
|
3265 | } else if (target.attachEvent) {
|
3266 | target.attachEvent('on' + eventType, wrapCallback);
|
3267 | return {
|
3268 | remove: function remove() {
|
3269 | target.detachEvent('on' + eventType, wrapCallback);
|
3270 | }
|
3271 | };
|
3272 | }
|
3273 | }
|
3274 |
|
3275 | module.exports = exports['default'];
|
3276 |
|
3277 | }),
|
3278 |
|
3279 | (function(module, exports, __webpack_require__) {
|
3280 |
|
3281 | |
3282 |
|
3283 |
|
3284 |
|
3285 |
|
3286 |
|
3287 | 'use strict';
|
3288 |
|
3289 | Object.defineProperty(exports, '__esModule', {
|
3290 | value: true
|
3291 | });
|
3292 |
|
3293 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
3294 |
|
3295 | var _EventBaseObject = __webpack_require__(43);
|
3296 |
|
3297 | var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject);
|
3298 |
|
3299 | var _objectAssign = __webpack_require__(44);
|
3300 |
|
3301 | var _objectAssign2 = _interopRequireDefault(_objectAssign);
|
3302 |
|
3303 | var TRUE = true;
|
3304 | var FALSE = false;
|
3305 | var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type'];
|
3306 |
|
3307 | function isNullOrUndefined(w) {
|
3308 | return w === null || w === undefined;
|
3309 | }
|
3310 |
|
3311 | var eventNormalizers = [{
|
3312 | reg: /^key/,
|
3313 | props: ['char', 'charCode', 'key', 'keyCode', 'which'],
|
3314 | fix: function fix(event, nativeEvent) {
|
3315 | if (isNullOrUndefined(event.which)) {
|
3316 | event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode;
|
3317 | }
|
3318 |
|
3319 |
|
3320 | if (event.metaKey === undefined) {
|
3321 | event.metaKey = event.ctrlKey;
|
3322 | }
|
3323 | }
|
3324 | }, {
|
3325 | reg: /^touch/,
|
3326 | props: ['touches', 'changedTouches', 'targetTouches']
|
3327 | }, {
|
3328 | reg: /^hashchange$/,
|
3329 | props: ['newURL', 'oldURL']
|
3330 | }, {
|
3331 | reg: /^gesturechange$/i,
|
3332 | props: ['rotation', 'scale']
|
3333 | }, {
|
3334 | reg: /^(mousewheel|DOMMouseScroll)$/,
|
3335 | props: [],
|
3336 | fix: function fix(event, nativeEvent) {
|
3337 | var deltaX = undefined;
|
3338 | var deltaY = undefined;
|
3339 | var delta = undefined;
|
3340 | var wheelDelta = nativeEvent.wheelDelta;
|
3341 | var axis = nativeEvent.axis;
|
3342 | var wheelDeltaY = nativeEvent.wheelDeltaY;
|
3343 | var wheelDeltaX = nativeEvent.wheelDeltaX;
|
3344 | var detail = nativeEvent.detail;
|
3345 |
|
3346 |
|
3347 | if (wheelDelta) {
|
3348 | delta = wheelDelta / 120;
|
3349 | }
|
3350 |
|
3351 |
|
3352 | if (detail) {
|
3353 |
|
3354 | delta = 0 - (detail % 3 === 0 ? detail / 3 : detail);
|
3355 | }
|
3356 |
|
3357 |
|
3358 | if (axis !== undefined) {
|
3359 | if (axis === event.HORIZONTAL_AXIS) {
|
3360 | deltaY = 0;
|
3361 | deltaX = 0 - delta;
|
3362 | } else if (axis === event.VERTICAL_AXIS) {
|
3363 | deltaX = 0;
|
3364 | deltaY = delta;
|
3365 | }
|
3366 | }
|
3367 |
|
3368 |
|
3369 | if (wheelDeltaY !== undefined) {
|
3370 | deltaY = wheelDeltaY / 120;
|
3371 | }
|
3372 | if (wheelDeltaX !== undefined) {
|
3373 | deltaX = -1 * wheelDeltaX / 120;
|
3374 | }
|
3375 |
|
3376 |
|
3377 | if (!deltaX && !deltaY) {
|
3378 | deltaY = delta;
|
3379 | }
|
3380 |
|
3381 | if (deltaX !== undefined) {
|
3382 | |
3383 |
|
3384 |
|
3385 |
|
3386 |
|
3387 | event.deltaX = deltaX;
|
3388 | }
|
3389 |
|
3390 | if (deltaY !== undefined) {
|
3391 | |
3392 |
|
3393 |
|
3394 |
|
3395 |
|
3396 | event.deltaY = deltaY;
|
3397 | }
|
3398 |
|
3399 | if (delta !== undefined) {
|
3400 | |
3401 |
|
3402 |
|
3403 |
|
3404 |
|
3405 | event.delta = delta;
|
3406 | }
|
3407 | }
|
3408 | }, {
|
3409 | reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,
|
3410 | props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'],
|
3411 | fix: function fix(event, nativeEvent) {
|
3412 | var eventDoc = undefined;
|
3413 | var doc = undefined;
|
3414 | var body = undefined;
|
3415 | var target = event.target;
|
3416 | var button = nativeEvent.button;
|
3417 |
|
3418 |
|
3419 | if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) {
|
3420 | eventDoc = target.ownerDocument || document;
|
3421 | doc = eventDoc.documentElement;
|
3422 | body = eventDoc.body;
|
3423 | event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
|
3424 | event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
|
3425 | }
|
3426 |
|
3427 |
|
3428 |
|
3429 | if (!event.which && button !== undefined) {
|
3430 | if (button & 1) {
|
3431 | event.which = 1;
|
3432 | } else if (button & 2) {
|
3433 | event.which = 3;
|
3434 | } else if (button & 4) {
|
3435 | event.which = 2;
|
3436 | } else {
|
3437 | event.which = 0;
|
3438 | }
|
3439 | }
|
3440 |
|
3441 |
|
3442 | if (!event.relatedTarget && event.fromElement) {
|
3443 | event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement;
|
3444 | }
|
3445 |
|
3446 | return event;
|
3447 | }
|
3448 | }];
|
3449 |
|
3450 | function retTrue() {
|
3451 | return TRUE;
|
3452 | }
|
3453 |
|
3454 | function retFalse() {
|
3455 | return FALSE;
|
3456 | }
|
3457 |
|
3458 | function DomEventObject(nativeEvent) {
|
3459 | var type = nativeEvent.type;
|
3460 |
|
3461 | var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean';
|
3462 |
|
3463 | _EventBaseObject2['default'].call(this);
|
3464 |
|
3465 | this.nativeEvent = nativeEvent;
|
3466 |
|
3467 |
|
3468 | var isDefaultPrevented = retFalse;
|
3469 | if ('defaultPrevented' in nativeEvent) {
|
3470 | isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse;
|
3471 | } else if ('getPreventDefault' in nativeEvent) {
|
3472 |
|
3473 | isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse;
|
3474 | } else if ('returnValue' in nativeEvent) {
|
3475 | isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse;
|
3476 | }
|
3477 |
|
3478 | this.isDefaultPrevented = isDefaultPrevented;
|
3479 |
|
3480 | var fixFns = [];
|
3481 | var fixFn = undefined;
|
3482 | var l = undefined;
|
3483 | var prop = undefined;
|
3484 | var props = commonProps.concat();
|
3485 |
|
3486 | eventNormalizers.forEach(function (normalizer) {
|
3487 | if (type.match(normalizer.reg)) {
|
3488 | props = props.concat(normalizer.props);
|
3489 | if (normalizer.fix) {
|
3490 | fixFns.push(normalizer.fix);
|
3491 | }
|
3492 | }
|
3493 | });
|
3494 |
|
3495 | l = props.length;
|
3496 |
|
3497 |
|
3498 | while (l) {
|
3499 | prop = props[--l];
|
3500 | this[prop] = nativeEvent[prop];
|
3501 | }
|
3502 |
|
3503 |
|
3504 | if (!this.target && isNative) {
|
3505 | this.target = nativeEvent.srcElement || document;
|
3506 | }
|
3507 |
|
3508 |
|
3509 | if (this.target && this.target.nodeType === 3) {
|
3510 | this.target = this.target.parentNode;
|
3511 | }
|
3512 |
|
3513 | l = fixFns.length;
|
3514 |
|
3515 | while (l) {
|
3516 | fixFn = fixFns[--l];
|
3517 | fixFn(this, nativeEvent);
|
3518 | }
|
3519 |
|
3520 | this.timeStamp = nativeEvent.timeStamp || Date.now();
|
3521 | }
|
3522 |
|
3523 | var EventBaseObjectProto = _EventBaseObject2['default'].prototype;
|
3524 |
|
3525 | (0, _objectAssign2['default'])(DomEventObject.prototype, EventBaseObjectProto, {
|
3526 | constructor: DomEventObject,
|
3527 |
|
3528 | preventDefault: function preventDefault() {
|
3529 | var e = this.nativeEvent;
|
3530 |
|
3531 |
|
3532 | if (e.preventDefault) {
|
3533 | e.preventDefault();
|
3534 | } else {
|
3535 |
|
3536 | e.returnValue = FALSE;
|
3537 | }
|
3538 |
|
3539 | EventBaseObjectProto.preventDefault.call(this);
|
3540 | },
|
3541 |
|
3542 | stopPropagation: function stopPropagation() {
|
3543 | var e = this.nativeEvent;
|
3544 |
|
3545 |
|
3546 | if (e.stopPropagation) {
|
3547 | e.stopPropagation();
|
3548 | } else {
|
3549 |
|
3550 | e.cancelBubble = TRUE;
|
3551 | }
|
3552 |
|
3553 | EventBaseObjectProto.stopPropagation.call(this);
|
3554 | }
|
3555 | });
|
3556 |
|
3557 | exports['default'] = DomEventObject;
|
3558 | module.exports = exports['default'];
|
3559 |
|
3560 | }),
|
3561 |
|
3562 | (function(module, exports) {
|
3563 |
|
3564 | |
3565 |
|
3566 |
|
3567 |
|
3568 |
|
3569 |
|
3570 | "use strict";
|
3571 |
|
3572 | Object.defineProperty(exports, "__esModule", {
|
3573 | value: true
|
3574 | });
|
3575 | function returnFalse() {
|
3576 | return false;
|
3577 | }
|
3578 |
|
3579 | function returnTrue() {
|
3580 | return true;
|
3581 | }
|
3582 |
|
3583 | function EventBaseObject() {
|
3584 | this.timeStamp = Date.now();
|
3585 | this.target = undefined;
|
3586 | this.currentTarget = undefined;
|
3587 | }
|
3588 |
|
3589 | EventBaseObject.prototype = {
|
3590 | isEventObject: 1,
|
3591 |
|
3592 | constructor: EventBaseObject,
|
3593 |
|
3594 | isDefaultPrevented: returnFalse,
|
3595 |
|
3596 | isPropagationStopped: returnFalse,
|
3597 |
|
3598 | isImmediatePropagationStopped: returnFalse,
|
3599 |
|
3600 | preventDefault: function preventDefault() {
|
3601 | this.isDefaultPrevented = returnTrue;
|
3602 | },
|
3603 |
|
3604 | stopPropagation: function stopPropagation() {
|
3605 | this.isPropagationStopped = returnTrue;
|
3606 | },
|
3607 |
|
3608 | stopImmediatePropagation: function stopImmediatePropagation() {
|
3609 | this.isImmediatePropagationStopped = returnTrue;
|
3610 |
|
3611 |
|
3612 | this.stopPropagation();
|
3613 | },
|
3614 |
|
3615 | halt: function halt(immediate) {
|
3616 | if (immediate) {
|
3617 | this.stopImmediatePropagation();
|
3618 | } else {
|
3619 | this.stopPropagation();
|
3620 | }
|
3621 | this.preventDefault();
|
3622 | }
|
3623 | };
|
3624 |
|
3625 | exports["default"] = EventBaseObject;
|
3626 | module.exports = exports["default"];
|
3627 |
|
3628 | }),
|
3629 |
|
3630 | (function(module, exports) {
|
3631 |
|
3632 | |
3633 |
|
3634 |
|
3635 |
|
3636 |
|
3637 |
|
3638 | 'use strict';
|
3639 |
|
3640 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
3641 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
3642 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
3643 |
|
3644 | function toObject(val) {
|
3645 | if (val === null || val === undefined) {
|
3646 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
3647 | }
|
3648 |
|
3649 | return Object(val);
|
3650 | }
|
3651 |
|
3652 | function shouldUseNative() {
|
3653 | try {
|
3654 | if (!Object.assign) {
|
3655 | return false;
|
3656 | }
|
3657 |
|
3658 |
|
3659 |
|
3660 |
|
3661 | var test1 = new String('abc');
|
3662 | test1[5] = 'de';
|
3663 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
3664 | return false;
|
3665 | }
|
3666 |
|
3667 |
|
3668 | var test2 = {};
|
3669 | for (var i = 0; i < 10; i++) {
|
3670 | test2['_' + String.fromCharCode(i)] = i;
|
3671 | }
|
3672 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
3673 | return test2[n];
|
3674 | });
|
3675 | if (order2.join('') !== '0123456789') {
|
3676 | return false;
|
3677 | }
|
3678 |
|
3679 |
|
3680 | var test3 = {};
|
3681 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
3682 | test3[letter] = letter;
|
3683 | });
|
3684 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
3685 | 'abcdefghijklmnopqrst') {
|
3686 | return false;
|
3687 | }
|
3688 |
|
3689 | return true;
|
3690 | } catch (err) {
|
3691 |
|
3692 | return false;
|
3693 | }
|
3694 | }
|
3695 |
|
3696 | module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
3697 | var from;
|
3698 | var to = toObject(target);
|
3699 | var symbols;
|
3700 |
|
3701 | for (var s = 1; s < arguments.length; s++) {
|
3702 | from = Object(arguments[s]);
|
3703 |
|
3704 | for (var key in from) {
|
3705 | if (hasOwnProperty.call(from, key)) {
|
3706 | to[key] = from[key];
|
3707 | }
|
3708 | }
|
3709 |
|
3710 | if (getOwnPropertySymbols) {
|
3711 | symbols = getOwnPropertySymbols(from);
|
3712 | for (var i = 0; i < symbols.length; i++) {
|
3713 | if (propIsEnumerable.call(from, symbols[i])) {
|
3714 | to[symbols[i]] = from[symbols[i]];
|
3715 | }
|
3716 | }
|
3717 | }
|
3718 | }
|
3719 |
|
3720 | return to;
|
3721 | };
|
3722 |
|
3723 |
|
3724 | }),
|
3725 |
|
3726 | (function(module, exports, __webpack_require__) {
|
3727 |
|
3728 | 'use strict';
|
3729 |
|
3730 | exports.__esModule = true;
|
3731 |
|
3732 | 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; };
|
3733 |
|
3734 | var _Event = __webpack_require__(46);
|
3735 |
|
3736 | var _Event2 = _interopRequireDefault(_Event);
|
3737 |
|
3738 | var _componentClasses = __webpack_require__(47);
|
3739 |
|
3740 | var _componentClasses2 = _interopRequireDefault(_componentClasses);
|
3741 |
|
3742 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3743 |
|
3744 | var isCssAnimationSupported = _Event2.default.endEvents.length !== 0;
|
3745 |
|
3746 |
|
3747 | var capitalPrefixes = ['Webkit', 'Moz', 'O',
|
3748 |
|
3749 | 'ms'];
|
3750 | var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];
|
3751 |
|
3752 | function getStyleProperty(node, name) {
|
3753 | var style = window.getComputedStyle(node);
|
3754 |
|
3755 | var ret = '';
|
3756 | for (var i = 0; i < prefixes.length; i++) {
|
3757 | ret = style.getPropertyValue(prefixes[i] + name);
|
3758 | if (ret) {
|
3759 | break;
|
3760 | }
|
3761 | }
|
3762 | return ret;
|
3763 | }
|
3764 |
|
3765 | function fixBrowserByTimeout(node) {
|
3766 | if (isCssAnimationSupported) {
|
3767 | var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0;
|
3768 | var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0;
|
3769 | var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0;
|
3770 | var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0;
|
3771 | var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay);
|
3772 |
|
3773 | node.rcEndAnimTimeout = setTimeout(function () {
|
3774 | node.rcEndAnimTimeout = null;
|
3775 | if (node.rcEndListener) {
|
3776 | node.rcEndListener();
|
3777 | }
|
3778 | }, time * 1000 + 200);
|
3779 | }
|
3780 | }
|
3781 |
|
3782 | function clearBrowserBugTimeout(node) {
|
3783 | if (node.rcEndAnimTimeout) {
|
3784 | clearTimeout(node.rcEndAnimTimeout);
|
3785 | node.rcEndAnimTimeout = null;
|
3786 | }
|
3787 | }
|
3788 |
|
3789 | var cssAnimation = function cssAnimation(node, transitionName, endCallback) {
|
3790 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
|
3791 | var className = nameIsObj ? transitionName.name : transitionName;
|
3792 | var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active';
|
3793 | var end = endCallback;
|
3794 | var start = void 0;
|
3795 | var active = void 0;
|
3796 | var nodeClasses = (0, _componentClasses2.default)(node);
|
3797 |
|
3798 | if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') {
|
3799 | end = endCallback.end;
|
3800 | start = endCallback.start;
|
3801 | active = endCallback.active;
|
3802 | }
|
3803 |
|
3804 | if (node.rcEndListener) {
|
3805 | node.rcEndListener();
|
3806 | }
|
3807 |
|
3808 | node.rcEndListener = function (e) {
|
3809 | if (e && e.target !== node) {
|
3810 | return;
|
3811 | }
|
3812 |
|
3813 | if (node.rcAnimTimeout) {
|
3814 | clearTimeout(node.rcAnimTimeout);
|
3815 | node.rcAnimTimeout = null;
|
3816 | }
|
3817 |
|
3818 | clearBrowserBugTimeout(node);
|
3819 |
|
3820 | nodeClasses.remove(className);
|
3821 | nodeClasses.remove(activeClassName);
|
3822 |
|
3823 | _Event2.default.removeEndEventListener(node, node.rcEndListener);
|
3824 | node.rcEndListener = null;
|
3825 |
|
3826 |
|
3827 |
|
3828 | if (end) {
|
3829 | end();
|
3830 | }
|
3831 | };
|
3832 |
|
3833 | _Event2.default.addEndEventListener(node, node.rcEndListener);
|
3834 |
|
3835 | if (start) {
|
3836 | start();
|
3837 | }
|
3838 | nodeClasses.add(className);
|
3839 |
|
3840 | node.rcAnimTimeout = setTimeout(function () {
|
3841 | node.rcAnimTimeout = null;
|
3842 | nodeClasses.add(activeClassName);
|
3843 | if (active) {
|
3844 | setTimeout(active, 0);
|
3845 | }
|
3846 | fixBrowserByTimeout(node);
|
3847 |
|
3848 | }, 30);
|
3849 |
|
3850 | return {
|
3851 | stop: function stop() {
|
3852 | if (node.rcEndListener) {
|
3853 | node.rcEndListener();
|
3854 | }
|
3855 | }
|
3856 | };
|
3857 | };
|
3858 |
|
3859 | cssAnimation.style = function (node, style, callback) {
|
3860 | if (node.rcEndListener) {
|
3861 | node.rcEndListener();
|
3862 | }
|
3863 |
|
3864 | node.rcEndListener = function (e) {
|
3865 | if (e && e.target !== node) {
|
3866 | return;
|
3867 | }
|
3868 |
|
3869 | if (node.rcAnimTimeout) {
|
3870 | clearTimeout(node.rcAnimTimeout);
|
3871 | node.rcAnimTimeout = null;
|
3872 | }
|
3873 |
|
3874 | clearBrowserBugTimeout(node);
|
3875 |
|
3876 | _Event2.default.removeEndEventListener(node, node.rcEndListener);
|
3877 | node.rcEndListener = null;
|
3878 |
|
3879 |
|
3880 |
|
3881 | if (callback) {
|
3882 | callback();
|
3883 | }
|
3884 | };
|
3885 |
|
3886 | _Event2.default.addEndEventListener(node, node.rcEndListener);
|
3887 |
|
3888 | node.rcAnimTimeout = setTimeout(function () {
|
3889 | for (var s in style) {
|
3890 | if (style.hasOwnProperty(s)) {
|
3891 | node.style[s] = style[s];
|
3892 | }
|
3893 | }
|
3894 | node.rcAnimTimeout = null;
|
3895 | fixBrowserByTimeout(node);
|
3896 | }, 0);
|
3897 | };
|
3898 |
|
3899 | cssAnimation.setTransition = function (node, p, value) {
|
3900 | var property = p;
|
3901 | var v = value;
|
3902 | if (value === undefined) {
|
3903 | v = property;
|
3904 | property = '';
|
3905 | }
|
3906 | property = property || '';
|
3907 | capitalPrefixes.forEach(function (prefix) {
|
3908 | node.style[prefix + 'Transition' + property] = v;
|
3909 | });
|
3910 | };
|
3911 |
|
3912 | cssAnimation.isCssAnimationSupported = isCssAnimationSupported;
|
3913 |
|
3914 | exports.default = cssAnimation;
|
3915 |
|
3916 | }),
|
3917 |
|
3918 | (function(module, exports) {
|
3919 |
|
3920 | 'use strict';
|
3921 |
|
3922 | exports.__esModule = true;
|
3923 | var EVENT_NAME_MAP = {
|
3924 | transitionend: {
|
3925 | transition: 'transitionend',
|
3926 | WebkitTransition: 'webkitTransitionEnd',
|
3927 | MozTransition: 'mozTransitionEnd',
|
3928 | OTransition: 'oTransitionEnd',
|
3929 | msTransition: 'MSTransitionEnd'
|
3930 | },
|
3931 |
|
3932 | animationend: {
|
3933 | animation: 'animationend',
|
3934 | WebkitAnimation: 'webkitAnimationEnd',
|
3935 | MozAnimation: 'mozAnimationEnd',
|
3936 | OAnimation: 'oAnimationEnd',
|
3937 | msAnimation: 'MSAnimationEnd'
|
3938 | }
|
3939 | };
|
3940 |
|
3941 | var endEvents = [];
|
3942 |
|
3943 | function detectEvents() {
|
3944 | var testEl = document.createElement('div');
|
3945 | var style = testEl.style;
|
3946 |
|
3947 | if (!('AnimationEvent' in window)) {
|
3948 | delete EVENT_NAME_MAP.animationend.animation;
|
3949 | }
|
3950 |
|
3951 | if (!('TransitionEvent' in window)) {
|
3952 | delete EVENT_NAME_MAP.transitionend.transition;
|
3953 | }
|
3954 |
|
3955 | for (var baseEventName in EVENT_NAME_MAP) {
|
3956 | if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
|
3957 | var baseEvents = EVENT_NAME_MAP[baseEventName];
|
3958 | for (var styleName in baseEvents) {
|
3959 | if (styleName in style) {
|
3960 | endEvents.push(baseEvents[styleName]);
|
3961 | break;
|
3962 | }
|
3963 | }
|
3964 | }
|
3965 | }
|
3966 | }
|
3967 |
|
3968 | if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
3969 | detectEvents();
|
3970 | }
|
3971 |
|
3972 | function addEventListener(node, eventName, eventListener) {
|
3973 | node.addEventListener(eventName, eventListener, false);
|
3974 | }
|
3975 |
|
3976 | function removeEventListener(node, eventName, eventListener) {
|
3977 | node.removeEventListener(eventName, eventListener, false);
|
3978 | }
|
3979 |
|
3980 | var TransitionEvents = {
|
3981 | addEndEventListener: function addEndEventListener(node, eventListener) {
|
3982 | if (endEvents.length === 0) {
|
3983 | window.setTimeout(eventListener, 0);
|
3984 | return;
|
3985 | }
|
3986 | endEvents.forEach(function (endEvent) {
|
3987 | addEventListener(node, endEvent, eventListener);
|
3988 | });
|
3989 | },
|
3990 |
|
3991 |
|
3992 | endEvents: endEvents,
|
3993 |
|
3994 | removeEndEventListener: function removeEndEventListener(node, eventListener) {
|
3995 | if (endEvents.length === 0) {
|
3996 | return;
|
3997 | }
|
3998 | endEvents.forEach(function (endEvent) {
|
3999 | removeEventListener(node, endEvent, eventListener);
|
4000 | });
|
4001 | }
|
4002 | };
|
4003 |
|
4004 | exports.default = TransitionEvents;
|
4005 |
|
4006 | }),
|
4007 |
|
4008 | (function(module, exports, __webpack_require__) {
|
4009 |
|
4010 | |
4011 |
|
4012 |
|
4013 |
|
4014 | try {
|
4015 | var index = __webpack_require__(48);
|
4016 | } catch (err) {
|
4017 | var index = __webpack_require__(48);
|
4018 | }
|
4019 |
|
4020 | |
4021 |
|
4022 |
|
4023 |
|
4024 | var re = /\s+/;
|
4025 |
|
4026 | |
4027 |
|
4028 |
|
4029 |
|
4030 | var toString = Object.prototype.toString;
|
4031 |
|
4032 | |
4033 |
|
4034 |
|
4035 |
|
4036 |
|
4037 |
|
4038 |
|
4039 |
|
4040 | module.exports = function(el){
|
4041 | return new ClassList(el);
|
4042 | };
|
4043 |
|
4044 | |
4045 |
|
4046 |
|
4047 |
|
4048 |
|
4049 |
|
4050 |
|
4051 | function ClassList(el) {
|
4052 | if (!el || !el.nodeType) {
|
4053 | throw new Error('A DOM element reference is required');
|
4054 | }
|
4055 | this.el = el;
|
4056 | this.list = el.classList;
|
4057 | }
|
4058 |
|
4059 | |
4060 |
|
4061 |
|
4062 |
|
4063 |
|
4064 |
|
4065 |
|
4066 |
|
4067 | ClassList.prototype.add = function(name){
|
4068 |
|
4069 | if (this.list) {
|
4070 | this.list.add(name);
|
4071 | return this;
|
4072 | }
|
4073 |
|
4074 |
|
4075 | var arr = this.array();
|
4076 | var i = index(arr, name);
|
4077 | if (!~i) arr.push(name);
|
4078 | this.el.className = arr.join(' ');
|
4079 | return this;
|
4080 | };
|
4081 |
|
4082 | |
4083 |
|
4084 |
|
4085 |
|
4086 |
|
4087 |
|
4088 |
|
4089 |
|
4090 |
|
4091 |
|
4092 | ClassList.prototype.remove = function(name){
|
4093 | if ('[object RegExp]' == toString.call(name)) {
|
4094 | return this.removeMatching(name);
|
4095 | }
|
4096 |
|
4097 |
|
4098 | if (this.list) {
|
4099 | this.list.remove(name);
|
4100 | return this;
|
4101 | }
|
4102 |
|
4103 |
|
4104 | var arr = this.array();
|
4105 | var i = index(arr, name);
|
4106 | if (~i) arr.splice(i, 1);
|
4107 | this.el.className = arr.join(' ');
|
4108 | return this;
|
4109 | };
|
4110 |
|
4111 | |
4112 |
|
4113 |
|
4114 |
|
4115 |
|
4116 |
|
4117 |
|
4118 |
|
4119 | ClassList.prototype.removeMatching = function(re){
|
4120 | var arr = this.array();
|
4121 | for (var i = 0; i < arr.length; i++) {
|
4122 | if (re.test(arr[i])) {
|
4123 | this.remove(arr[i]);
|
4124 | }
|
4125 | }
|
4126 | return this;
|
4127 | };
|
4128 |
|
4129 | |
4130 |
|
4131 |
|
4132 |
|
4133 |
|
4134 |
|
4135 |
|
4136 |
|
4137 |
|
4138 |
|
4139 |
|
4140 |
|
4141 | ClassList.prototype.toggle = function(name, force){
|
4142 |
|
4143 | if (this.list) {
|
4144 | if ("undefined" !== typeof force) {
|
4145 | if (force !== this.list.toggle(name, force)) {
|
4146 | this.list.toggle(name);
|
4147 | }
|
4148 | } else {
|
4149 | this.list.toggle(name);
|
4150 | }
|
4151 | return this;
|
4152 | }
|
4153 |
|
4154 |
|
4155 | if ("undefined" !== typeof force) {
|
4156 | if (!force) {
|
4157 | this.remove(name);
|
4158 | } else {
|
4159 | this.add(name);
|
4160 | }
|
4161 | } else {
|
4162 | if (this.has(name)) {
|
4163 | this.remove(name);
|
4164 | } else {
|
4165 | this.add(name);
|
4166 | }
|
4167 | }
|
4168 |
|
4169 | return this;
|
4170 | };
|
4171 |
|
4172 | |
4173 |
|
4174 |
|
4175 |
|
4176 |
|
4177 |
|
4178 |
|
4179 | ClassList.prototype.array = function(){
|
4180 | var className = this.el.getAttribute('class') || '';
|
4181 | var str = className.replace(/^\s+|\s+$/g, '');
|
4182 | var arr = str.split(re);
|
4183 | if ('' === arr[0]) arr.shift();
|
4184 | return arr;
|
4185 | };
|
4186 |
|
4187 | |
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 |
|
4193 |
|
4194 |
|
4195 | ClassList.prototype.has =
|
4196 | ClassList.prototype.contains = function(name){
|
4197 | return this.list
|
4198 | ? this.list.contains(name)
|
4199 | : !! ~index(this.array(), name);
|
4200 | };
|
4201 |
|
4202 |
|
4203 | }),
|
4204 |
|
4205 | (function(module, exports) {
|
4206 |
|
4207 | module.exports = function(arr, obj){
|
4208 | if (arr.indexOf) return arr.indexOf(obj);
|
4209 | for (var i = 0; i < arr.length; ++i) {
|
4210 | if (arr[i] === obj) return i;
|
4211 | }
|
4212 | return -1;
|
4213 | };
|
4214 |
|
4215 | }),
|
4216 |
|
4217 | (function(module, exports, __webpack_require__) {
|
4218 |
|
4219 | 'use strict';
|
4220 |
|
4221 | exports.__esModule = true;
|
4222 | exports.default = toArray;
|
4223 |
|
4224 | var _react = __webpack_require__(4);
|
4225 |
|
4226 | var _react2 = _interopRequireDefault(_react);
|
4227 |
|
4228 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4229 |
|
4230 | function toArray(children) {
|
4231 | var ret = [];
|
4232 | _react2.default.Children.forEach(children, function (c) {
|
4233 | ret.push(c);
|
4234 | });
|
4235 | return ret;
|
4236 | }
|
4237 |
|
4238 | }),
|
4239 |
|
4240 | (function(module, exports, __webpack_require__) {
|
4241 |
|
4242 | 'use strict';
|
4243 |
|
4244 | exports.__esModule = true;
|
4245 |
|
4246 | var _react = __webpack_require__(4);
|
4247 |
|
4248 | var _react2 = _interopRequireDefault(_react);
|
4249 |
|
4250 | var _propTypes = __webpack_require__(5);
|
4251 |
|
4252 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
4253 |
|
4254 | var _reactDom = __webpack_require__(12);
|
4255 |
|
4256 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
4257 |
|
4258 | var _domAlign = __webpack_require__(51);
|
4259 |
|
4260 | var _domAlign2 = _interopRequireDefault(_domAlign);
|
4261 |
|
4262 | var _addEventListener = __webpack_require__(40);
|
4263 |
|
4264 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
4265 |
|
4266 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4267 |
|
4268 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
4269 |
|
4270 | 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; }
|
4271 |
|
4272 | 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; }
|
4273 |
|
4274 |
|
4275 |
|
4276 | function isWindow(obj) {
|
4277 |
|
4278 |
|
4279 | return obj != null && obj == obj.window;
|
4280 | }
|
4281 |
|
4282 | function buffer(fn, ms) {
|
4283 | var timer = void 0;
|
4284 |
|
4285 | function clear() {
|
4286 | if (timer) {
|
4287 | clearTimeout(timer);
|
4288 | timer = null;
|
4289 | }
|
4290 | }
|
4291 |
|
4292 | function bufferFn() {
|
4293 | clear();
|
4294 | timer = setTimeout(fn, ms);
|
4295 | }
|
4296 |
|
4297 | bufferFn.clear = clear;
|
4298 |
|
4299 | return bufferFn;
|
4300 | }
|
4301 |
|
4302 | var propTypes = {
|
4303 | childrenProps: _propTypes2.default.object,
|
4304 | align: _propTypes2.default.object.isRequired,
|
4305 | target: _propTypes2.default.func,
|
4306 | onAlign: _propTypes2.default.func,
|
4307 | monitorBufferTime: _propTypes2.default.number,
|
4308 | monitorWindowResize: _propTypes2.default.bool,
|
4309 | disabled: _propTypes2.default.bool,
|
4310 | children: _propTypes2.default.any
|
4311 | };
|
4312 |
|
4313 | var defaultProps = {
|
4314 | target: function target() {
|
4315 | return window;
|
4316 | },
|
4317 | onAlign: function onAlign() {},
|
4318 |
|
4319 | monitorBufferTime: 50,
|
4320 | monitorWindowResize: false,
|
4321 | disabled: false
|
4322 | };
|
4323 |
|
4324 | var Align = function (_React$Component) {
|
4325 | _inherits(Align, _React$Component);
|
4326 |
|
4327 | function Align(props) {
|
4328 | _classCallCheck(this, Align);
|
4329 |
|
4330 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
4331 |
|
4332 | _initialiseProps.call(_this);
|
4333 |
|
4334 | return _this;
|
4335 | }
|
4336 |
|
4337 | Align.prototype.componentDidMount = function componentDidMount() {
|
4338 | var props = this.props;
|
4339 |
|
4340 | this.forceAlign();
|
4341 | if (!props.disabled && props.monitorWindowResize) {
|
4342 | this.startMonitorWindowResize();
|
4343 | }
|
4344 | };
|
4345 |
|
4346 | Align.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
4347 | var reAlign = false;
|
4348 | var props = this.props;
|
4349 |
|
4350 | if (!props.disabled) {
|
4351 | if (prevProps.disabled || prevProps.align !== props.align) {
|
4352 | reAlign = true;
|
4353 | } else {
|
4354 | var lastTarget = prevProps.target();
|
4355 | var currentTarget = props.target();
|
4356 | if (isWindow(lastTarget) && isWindow(currentTarget)) {
|
4357 | reAlign = false;
|
4358 | } else if (lastTarget !== currentTarget) {
|
4359 | reAlign = true;
|
4360 | }
|
4361 | }
|
4362 | }
|
4363 |
|
4364 | if (reAlign) {
|
4365 | this.forceAlign();
|
4366 | }
|
4367 |
|
4368 | if (props.monitorWindowResize && !props.disabled) {
|
4369 | this.startMonitorWindowResize();
|
4370 | } else {
|
4371 | this.stopMonitorWindowResize();
|
4372 | }
|
4373 | };
|
4374 |
|
4375 | Align.prototype.componentWillUnmount = function componentWillUnmount() {
|
4376 | this.stopMonitorWindowResize();
|
4377 | };
|
4378 |
|
4379 | Align.prototype.render = function render() {
|
4380 | var _props = this.props,
|
4381 | childrenProps = _props.childrenProps,
|
4382 | children = _props.children;
|
4383 |
|
4384 | var child = _react2.default.Children.only(children);
|
4385 | if (childrenProps) {
|
4386 | var newProps = {};
|
4387 | for (var prop in childrenProps) {
|
4388 | if (childrenProps.hasOwnProperty(prop)) {
|
4389 | newProps[prop] = this.props[childrenProps[prop]];
|
4390 | }
|
4391 | }
|
4392 | return _react2.default.cloneElement(child, newProps);
|
4393 | }
|
4394 | return child;
|
4395 | };
|
4396 |
|
4397 | return Align;
|
4398 | }(_react2.default.Component);
|
4399 |
|
4400 | var _initialiseProps = function _initialiseProps() {
|
4401 | var _this2 = this;
|
4402 |
|
4403 | this.startMonitorWindowResize = function () {
|
4404 | if (!_this2.resizeHandler) {
|
4405 | _this2.bufferMonitor = buffer(_this2.forceAlign, _this2.props.monitorBufferTime);
|
4406 | _this2.resizeHandler = (0, _addEventListener2.default)(window, 'resize', _this2.bufferMonitor);
|
4407 | }
|
4408 | };
|
4409 |
|
4410 | this.stopMonitorWindowResize = function () {
|
4411 | if (_this2.resizeHandler) {
|
4412 | _this2.bufferMonitor.clear();
|
4413 | _this2.resizeHandler.remove();
|
4414 | _this2.resizeHandler = null;
|
4415 | }
|
4416 | };
|
4417 |
|
4418 | this.forceAlign = function () {
|
4419 | var props = _this2.props;
|
4420 | if (!props.disabled) {
|
4421 | var source = _reactDom2.default.findDOMNode(_this2);
|
4422 | props.onAlign(source, (0, _domAlign2.default)(source, props.target(), props.align));
|
4423 | }
|
4424 | };
|
4425 | };
|
4426 |
|
4427 | ;
|
4428 |
|
4429 | Align.defaultProps = defaultProps;
|
4430 | Align.propTypes = propTypes;
|
4431 |
|
4432 | exports.default = Align;
|
4433 |
|
4434 | }),
|
4435 |
|
4436 | (function(module, exports, __webpack_require__) {
|
4437 |
|
4438 | 'use strict';
|
4439 |
|
4440 | Object.defineProperty(exports, "__esModule", {
|
4441 | value: true
|
4442 | });
|
4443 | exports.alignPoint = exports.alignElement = undefined;
|
4444 |
|
4445 | var _alignElement = __webpack_require__(52);
|
4446 |
|
4447 | var _alignElement2 = _interopRequireDefault(_alignElement);
|
4448 |
|
4449 | var _alignPoint = __webpack_require__(63);
|
4450 |
|
4451 | var _alignPoint2 = _interopRequireDefault(_alignPoint);
|
4452 |
|
4453 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4454 |
|
4455 | exports.alignElement = _alignElement2['default'];
|
4456 | exports.alignPoint = _alignPoint2['default'];
|
4457 | exports['default'] = _alignElement2['default'];
|
4458 |
|
4459 | }),
|
4460 |
|
4461 | (function(module, exports, __webpack_require__) {
|
4462 |
|
4463 | 'use strict';
|
4464 |
|
4465 | Object.defineProperty(exports, "__esModule", {
|
4466 | value: true
|
4467 | });
|
4468 |
|
4469 | var _align = __webpack_require__(53);
|
4470 |
|
4471 | var _align2 = _interopRequireDefault(_align);
|
4472 |
|
4473 | var _getOffsetParent = __webpack_require__(57);
|
4474 |
|
4475 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
|
4476 |
|
4477 | var _getVisibleRectForElement = __webpack_require__(56);
|
4478 |
|
4479 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
|
4480 |
|
4481 | var _getRegion = __webpack_require__(60);
|
4482 |
|
4483 | var _getRegion2 = _interopRequireDefault(_getRegion);
|
4484 |
|
4485 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4486 |
|
4487 | function isOutOfVisibleRect(target) {
|
4488 | var visibleRect = (0, _getVisibleRectForElement2['default'])(target);
|
4489 | var targetRegion = (0, _getRegion2['default'])(target);
|
4490 |
|
4491 | return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom;
|
4492 | }
|
4493 |
|
4494 | function alignElement(el, refNode, align) {
|
4495 | var target = align.target || refNode;
|
4496 | var refNodeRegion = (0, _getRegion2['default'])(target);
|
4497 |
|
4498 | var isTargetNotOutOfVisible = !isOutOfVisibleRect(target);
|
4499 |
|
4500 | return (0, _align2['default'])(el, refNodeRegion, align, isTargetNotOutOfVisible);
|
4501 | }
|
4502 |
|
4503 | alignElement.__getOffsetParent = _getOffsetParent2['default'];
|
4504 |
|
4505 | alignElement.__getVisibleRectForElement = _getVisibleRectForElement2['default'];
|
4506 |
|
4507 | exports['default'] = alignElement;
|
4508 | module.exports = exports['default'];
|
4509 |
|
4510 | }),
|
4511 |
|
4512 | (function(module, exports, __webpack_require__) {
|
4513 |
|
4514 | 'use strict';
|
4515 |
|
4516 | Object.defineProperty(exports, "__esModule", {
|
4517 | value: true
|
4518 | });
|
4519 |
|
4520 | var _utils = __webpack_require__(54);
|
4521 |
|
4522 | var _utils2 = _interopRequireDefault(_utils);
|
4523 |
|
4524 | var _getVisibleRectForElement = __webpack_require__(56);
|
4525 |
|
4526 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
|
4527 |
|
4528 | var _adjustForViewport = __webpack_require__(59);
|
4529 |
|
4530 | var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport);
|
4531 |
|
4532 | var _getRegion = __webpack_require__(60);
|
4533 |
|
4534 | var _getRegion2 = _interopRequireDefault(_getRegion);
|
4535 |
|
4536 | var _getElFuturePos = __webpack_require__(61);
|
4537 |
|
4538 | var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos);
|
4539 |
|
4540 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4541 |
|
4542 |
|
4543 |
|
4544 | function isFailX(elFuturePos, elRegion, visibleRect) {
|
4545 | return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;
|
4546 | } |
4547 |
|
4548 |
|
4549 |
|
4550 |
|
4551 | function isFailY(elFuturePos, elRegion, visibleRect) {
|
4552 | return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom;
|
4553 | }
|
4554 |
|
4555 | function isCompleteFailX(elFuturePos, elRegion, visibleRect) {
|
4556 | return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;
|
4557 | }
|
4558 |
|
4559 | function isCompleteFailY(elFuturePos, elRegion, visibleRect) {
|
4560 | return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;
|
4561 | }
|
4562 |
|
4563 | function flip(points, reg, map) {
|
4564 | var ret = [];
|
4565 | _utils2['default'].each(points, function (p) {
|
4566 | ret.push(p.replace(reg, function (m) {
|
4567 | return map[m];
|
4568 | }));
|
4569 | });
|
4570 | return ret;
|
4571 | }
|
4572 |
|
4573 | function flipOffset(offset, index) {
|
4574 | offset[index] = -offset[index];
|
4575 | return offset;
|
4576 | }
|
4577 |
|
4578 | function convertOffset(str, offsetLen) {
|
4579 | var n = void 0;
|
4580 | if (/%$/.test(str)) {
|
4581 | n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen;
|
4582 | } else {
|
4583 | n = parseInt(str, 10);
|
4584 | }
|
4585 | return n || 0;
|
4586 | }
|
4587 |
|
4588 | function normalizeOffset(offset, el) {
|
4589 | offset[0] = convertOffset(offset[0], el.width);
|
4590 | offset[1] = convertOffset(offset[1], el.height);
|
4591 | }
|
4592 |
|
4593 | |
4594 |
|
4595 |
|
4596 |
|
4597 |
|
4598 | function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
4599 | var points = align.points;
|
4600 | var offset = align.offset || [0, 0];
|
4601 | var targetOffset = align.targetOffset || [0, 0];
|
4602 | var overflow = align.overflow;
|
4603 | var source = align.source || el;
|
4604 | offset = [].concat(offset);
|
4605 | targetOffset = [].concat(targetOffset);
|
4606 | overflow = overflow || {};
|
4607 | var newOverflowCfg = {};
|
4608 | var fail = 0;
|
4609 |
|
4610 | var visibleRect = (0, _getVisibleRectForElement2['default'])(source);
|
4611 |
|
4612 | var elRegion = (0, _getRegion2['default'])(source);
|
4613 |
|
4614 | normalizeOffset(offset, elRegion);
|
4615 | normalizeOffset(targetOffset, tgtRegion);
|
4616 |
|
4617 | var elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
|
4618 |
|
4619 | var newElRegion = _utils2['default'].merge(elRegion, elFuturePos);
|
4620 |
|
4621 |
|
4622 | if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTgtRegionVisible) {
|
4623 | if (overflow.adjustX) {
|
4624 |
|
4625 | if (isFailX(elFuturePos, elRegion, visibleRect)) {
|
4626 |
|
4627 | var newPoints = flip(points, /[lr]/ig, {
|
4628 | l: 'r',
|
4629 | r: 'l'
|
4630 | });
|
4631 |
|
4632 | var newOffset = flipOffset(offset, 0);
|
4633 | var newTargetOffset = flipOffset(targetOffset, 0);
|
4634 | var newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, newPoints, newOffset, newTargetOffset);
|
4635 |
|
4636 | if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {
|
4637 | fail = 1;
|
4638 | points = newPoints;
|
4639 | offset = newOffset;
|
4640 | targetOffset = newTargetOffset;
|
4641 | }
|
4642 | }
|
4643 | }
|
4644 |
|
4645 | if (overflow.adjustY) {
|
4646 |
|
4647 | if (isFailY(elFuturePos, elRegion, visibleRect)) {
|
4648 |
|
4649 | var _newPoints = flip(points, /[tb]/ig, {
|
4650 | t: 'b',
|
4651 | b: 't'
|
4652 | });
|
4653 |
|
4654 | var _newOffset = flipOffset(offset, 1);
|
4655 | var _newTargetOffset = flipOffset(targetOffset, 1);
|
4656 | var _newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, _newPoints, _newOffset, _newTargetOffset);
|
4657 |
|
4658 | if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) {
|
4659 | fail = 1;
|
4660 | points = _newPoints;
|
4661 | offset = _newOffset;
|
4662 | targetOffset = _newTargetOffset;
|
4663 | }
|
4664 | }
|
4665 | }
|
4666 |
|
4667 |
|
4668 | if (fail) {
|
4669 | elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
|
4670 | _utils2['default'].mix(newElRegion, elFuturePos);
|
4671 | }
|
4672 | var isStillFailX = isFailX(elFuturePos, elRegion, visibleRect);
|
4673 | var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect);
|
4674 |
|
4675 |
|
4676 | if (isStillFailX || isStillFailY) {
|
4677 | points = align.points;
|
4678 | offset = align.offset || [0, 0];
|
4679 | targetOffset = align.targetOffset || [0, 0];
|
4680 | }
|
4681 |
|
4682 | newOverflowCfg.adjustX = overflow.adjustX && isStillFailX;
|
4683 | newOverflowCfg.adjustY = overflow.adjustY && isStillFailY;
|
4684 |
|
4685 |
|
4686 | if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) {
|
4687 | newElRegion = (0, _adjustForViewport2['default'])(elFuturePos, elRegion, visibleRect, newOverflowCfg);
|
4688 | }
|
4689 | }
|
4690 |
|
4691 |
|
4692 | if (newElRegion.width !== elRegion.width) {
|
4693 | _utils2['default'].css(source, 'width', _utils2['default'].width(source) + newElRegion.width - elRegion.width);
|
4694 | }
|
4695 |
|
4696 | if (newElRegion.height !== elRegion.height) {
|
4697 | _utils2['default'].css(source, 'height', _utils2['default'].height(source) + newElRegion.height - elRegion.height);
|
4698 | }
|
4699 |
|
4700 |
|
4701 |
|
4702 |
|
4703 | _utils2['default'].offset(source, {
|
4704 | left: newElRegion.left,
|
4705 | top: newElRegion.top
|
4706 | }, {
|
4707 | useCssRight: align.useCssRight,
|
4708 | useCssBottom: align.useCssBottom,
|
4709 | useCssTransform: align.useCssTransform,
|
4710 | ignoreShake: align.ignoreShake
|
4711 | });
|
4712 |
|
4713 | return {
|
4714 | points: points,
|
4715 | offset: offset,
|
4716 | targetOffset: targetOffset,
|
4717 | overflow: newOverflowCfg
|
4718 | };
|
4719 | }
|
4720 |
|
4721 | exports['default'] = doAlign;
|
4722 | |
4723 |
|
4724 |
|
4725 |
|
4726 |
|
4727 |
|
4728 |
|
4729 |
|
4730 |
|
4731 | module.exports = exports['default'];
|
4732 |
|
4733 | }),
|
4734 |
|
4735 | (function(module, exports, __webpack_require__) {
|
4736 |
|
4737 | 'use strict';
|
4738 |
|
4739 | Object.defineProperty(exports, "__esModule", {
|
4740 | value: true
|
4741 | });
|
4742 |
|
4743 | 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; };
|
4744 |
|
4745 | var _propertyUtils = __webpack_require__(55);
|
4746 |
|
4747 | var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
|
4748 |
|
4749 | var getComputedStyleX = void 0;
|
4750 |
|
4751 |
|
4752 | function forceRelayout(elem) {
|
4753 | var originalStyle = elem.style.display;
|
4754 | elem.style.display = 'none';
|
4755 | elem.offsetHeight;
|
4756 | elem.style.display = originalStyle;
|
4757 | }
|
4758 |
|
4759 | function css(el, name, v) {
|
4760 | var value = v;
|
4761 | if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
|
4762 | for (var i in name) {
|
4763 | if (name.hasOwnProperty(i)) {
|
4764 | css(el, i, name[i]);
|
4765 | }
|
4766 | }
|
4767 | return undefined;
|
4768 | }
|
4769 | if (typeof value !== 'undefined') {
|
4770 | if (typeof value === 'number') {
|
4771 | value = value + 'px';
|
4772 | }
|
4773 | el.style[name] = value;
|
4774 | return undefined;
|
4775 | }
|
4776 | return getComputedStyleX(el, name);
|
4777 | }
|
4778 |
|
4779 | function getClientPosition(elem) {
|
4780 | var box = void 0;
|
4781 | var x = void 0;
|
4782 | var y = void 0;
|
4783 | var doc = elem.ownerDocument;
|
4784 | var body = doc.body;
|
4785 | var docElem = doc && doc.documentElement;
|
4786 |
|
4787 | box = elem.getBoundingClientRect();
|
4788 |
|
4789 |
|
4790 |
|
4791 |
|
4792 |
|
4793 | x = box.left;
|
4794 | y = box.top;
|
4795 |
|
4796 |
|
4797 |
|
4798 |
|
4799 |
|
4800 |
|
4801 |
|
4802 |
|
4803 |
|
4804 |
|
4805 |
|
4806 |
|
4807 |
|
4808 |
|
4809 |
|
4810 |
|
4811 |
|
4812 |
|
4813 |
|
4814 |
|
4815 |
|
4816 | x -= docElem.clientLeft || body.clientLeft || 0;
|
4817 | y -= docElem.clientTop || body.clientTop || 0;
|
4818 |
|
4819 | return {
|
4820 | left: x,
|
4821 | top: y
|
4822 | };
|
4823 | }
|
4824 |
|
4825 | function getScroll(w, top) {
|
4826 | var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
|
4827 | var method = 'scroll' + (top ? 'Top' : 'Left');
|
4828 | if (typeof ret !== 'number') {
|
4829 | var d = w.document;
|
4830 |
|
4831 | ret = d.documentElement[method];
|
4832 | if (typeof ret !== 'number') {
|
4833 |
|
4834 | ret = d.body[method];
|
4835 | }
|
4836 | }
|
4837 | return ret;
|
4838 | }
|
4839 |
|
4840 | function getScrollLeft(w) {
|
4841 | return getScroll(w);
|
4842 | }
|
4843 |
|
4844 | function getScrollTop(w) {
|
4845 | return getScroll(w, true);
|
4846 | }
|
4847 |
|
4848 | function getOffset(el) {
|
4849 | var pos = getClientPosition(el);
|
4850 | var doc = el.ownerDocument;
|
4851 | var w = doc.defaultView || doc.parentWindow;
|
4852 | pos.left += getScrollLeft(w);
|
4853 | pos.top += getScrollTop(w);
|
4854 | return pos;
|
4855 | }
|
4856 |
|
4857 | |
4858 |
|
4859 |
|
4860 |
|
4861 | function isWindow(obj) {
|
4862 |
|
4863 |
|
4864 | return obj !== null && obj !== undefined && obj == obj.window;
|
4865 | }
|
4866 |
|
4867 | function getDocument(node) {
|
4868 | if (isWindow(node)) {
|
4869 | return node.document;
|
4870 | }
|
4871 | if (node.nodeType === 9) {
|
4872 | return node;
|
4873 | }
|
4874 | return node.ownerDocument;
|
4875 | }
|
4876 |
|
4877 | function _getComputedStyle(elem, name, cs) {
|
4878 | var computedStyle = cs;
|
4879 | var val = '';
|
4880 | var d = getDocument(elem);
|
4881 | computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null);
|
4882 |
|
4883 |
|
4884 | if (computedStyle) {
|
4885 | val = computedStyle.getPropertyValue(name) || computedStyle[name];
|
4886 | }
|
4887 |
|
4888 | return val;
|
4889 | }
|
4890 |
|
4891 | var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
|
4892 | var RE_POS = /^(top|right|bottom|left)$/;
|
4893 | var CURRENT_STYLE = 'currentStyle';
|
4894 | var RUNTIME_STYLE = 'runtimeStyle';
|
4895 | var LEFT = 'left';
|
4896 | var PX = 'px';
|
4897 |
|
4898 | function _getComputedStyleIE(elem, name) {
|
4899 |
|
4900 |
|
4901 | var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
|
4902 |
|
4903 |
|
4904 |
|
4905 |
|
4906 |
|
4907 |
|
4908 |
|
4909 |
|
4910 |
|
4911 |
|
4912 |
|
4913 | if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
|
4914 |
|
4915 | var style = elem.style;
|
4916 | var left = style[LEFT];
|
4917 | var rsLeft = elem[RUNTIME_STYLE][LEFT];
|
4918 |
|
4919 |
|
4920 | elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
|
4921 |
|
4922 |
|
4923 | style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
|
4924 | ret = style.pixelLeft + PX;
|
4925 |
|
4926 |
|
4927 | style[LEFT] = left;
|
4928 |
|
4929 | elem[RUNTIME_STYLE][LEFT] = rsLeft;
|
4930 | }
|
4931 | return ret === '' ? 'auto' : ret;
|
4932 | }
|
4933 |
|
4934 | if (typeof window !== 'undefined') {
|
4935 | getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
|
4936 | }
|
4937 |
|
4938 | function getOffsetDirection(dir, option) {
|
4939 | if (dir === 'left') {
|
4940 | return option.useCssRight ? 'right' : dir;
|
4941 | }
|
4942 | return option.useCssBottom ? 'bottom' : dir;
|
4943 | }
|
4944 |
|
4945 | function oppositeOffsetDirection(dir) {
|
4946 | if (dir === 'left') {
|
4947 | return 'right';
|
4948 | } else if (dir === 'right') {
|
4949 | return 'left';
|
4950 | } else if (dir === 'top') {
|
4951 | return 'bottom';
|
4952 | } else if (dir === 'bottom') {
|
4953 | return 'top';
|
4954 | }
|
4955 | }
|
4956 |
|
4957 |
|
4958 | function setLeftTop(elem, offset, option) {
|
4959 |
|
4960 | if (css(elem, 'position') === 'static') {
|
4961 | elem.style.position = 'relative';
|
4962 | }
|
4963 | var presetH = -999;
|
4964 | var presetV = -999;
|
4965 | var horizontalProperty = getOffsetDirection('left', option);
|
4966 | var verticalProperty = getOffsetDirection('top', option);
|
4967 | var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
|
4968 | var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);
|
4969 |
|
4970 | if (horizontalProperty !== 'left') {
|
4971 | presetH = 999;
|
4972 | }
|
4973 |
|
4974 | if (verticalProperty !== 'top') {
|
4975 | presetV = 999;
|
4976 | }
|
4977 | var originalTransition = '';
|
4978 | var originalOffset = getOffset(elem);
|
4979 | if ('left' in offset || 'top' in offset) {
|
4980 | originalTransition = (0, _propertyUtils.getTransitionProperty)(elem) || '';
|
4981 | (0, _propertyUtils.setTransitionProperty)(elem, 'none');
|
4982 | }
|
4983 | if ('left' in offset) {
|
4984 | elem.style[oppositeHorizontalProperty] = '';
|
4985 | elem.style[horizontalProperty] = presetH + 'px';
|
4986 | }
|
4987 | if ('top' in offset) {
|
4988 | elem.style[oppositeVerticalProperty] = '';
|
4989 | elem.style[verticalProperty] = presetV + 'px';
|
4990 | }
|
4991 |
|
4992 | forceRelayout(elem);
|
4993 | var old = getOffset(elem);
|
4994 | var originalStyle = {};
|
4995 | for (var key in offset) {
|
4996 | if (offset.hasOwnProperty(key)) {
|
4997 | var dir = getOffsetDirection(key, option);
|
4998 | var preset = key === 'left' ? presetH : presetV;
|
4999 | var off = originalOffset[key] - old[key];
|
5000 | if (dir === key) {
|
5001 | originalStyle[dir] = preset + off;
|
5002 | } else {
|
5003 | originalStyle[dir] = preset - off;
|
5004 | }
|
5005 | }
|
5006 | }
|
5007 | css(elem, originalStyle);
|
5008 |
|
5009 | forceRelayout(elem);
|
5010 | if ('left' in offset || 'top' in offset) {
|
5011 | (0, _propertyUtils.setTransitionProperty)(elem, originalTransition);
|
5012 | }
|
5013 | var ret = {};
|
5014 | for (var _key in offset) {
|
5015 | if (offset.hasOwnProperty(_key)) {
|
5016 | var _dir = getOffsetDirection(_key, option);
|
5017 | var _off = offset[_key] - originalOffset[_key];
|
5018 | if (_key === _dir) {
|
5019 | ret[_dir] = originalStyle[_dir] + _off;
|
5020 | } else {
|
5021 | ret[_dir] = originalStyle[_dir] - _off;
|
5022 | }
|
5023 | }
|
5024 | }
|
5025 | css(elem, ret);
|
5026 | }
|
5027 |
|
5028 | function setTransform(elem, offset) {
|
5029 | var originalOffset = getOffset(elem);
|
5030 | var originalXY = (0, _propertyUtils.getTransformXY)(elem);
|
5031 | var resultXY = { x: originalXY.x, y: originalXY.y };
|
5032 | if ('left' in offset) {
|
5033 | resultXY.x = originalXY.x + offset.left - originalOffset.left;
|
5034 | }
|
5035 | if ('top' in offset) {
|
5036 | resultXY.y = originalXY.y + offset.top - originalOffset.top;
|
5037 | }
|
5038 | (0, _propertyUtils.setTransformXY)(elem, resultXY);
|
5039 | }
|
5040 |
|
5041 | function setOffset(elem, offset, option) {
|
5042 | if (option.ignoreShake) {
|
5043 | var oriOffset = getOffset(elem);
|
5044 |
|
5045 | var oLeft = oriOffset.left.toFixed(0);
|
5046 | var oTop = oriOffset.top.toFixed(0);
|
5047 | var tLeft = offset.left.toFixed(0);
|
5048 | var tTop = offset.top.toFixed(0);
|
5049 |
|
5050 | if (oLeft === tLeft && oTop === tTop) {
|
5051 | return;
|
5052 | }
|
5053 | }
|
5054 |
|
5055 | if (option.useCssRight || option.useCssBottom) {
|
5056 | setLeftTop(elem, offset, option);
|
5057 | } else if (option.useCssTransform && (0, _propertyUtils.getTransformName)() in document.body.style) {
|
5058 | setTransform(elem, offset, option);
|
5059 | } else {
|
5060 | setLeftTop(elem, offset, option);
|
5061 | }
|
5062 | }
|
5063 |
|
5064 | function each(arr, fn) {
|
5065 | for (var i = 0; i < arr.length; i++) {
|
5066 | fn(arr[i]);
|
5067 | }
|
5068 | }
|
5069 |
|
5070 | function isBorderBoxFn(elem) {
|
5071 | return getComputedStyleX(elem, 'boxSizing') === 'border-box';
|
5072 | }
|
5073 |
|
5074 | var BOX_MODELS = ['margin', 'border', 'padding'];
|
5075 | var CONTENT_INDEX = -1;
|
5076 | var PADDING_INDEX = 2;
|
5077 | var BORDER_INDEX = 1;
|
5078 | var MARGIN_INDEX = 0;
|
5079 |
|
5080 | function swap(elem, options, callback) {
|
5081 | var old = {};
|
5082 | var style = elem.style;
|
5083 | var name = void 0;
|
5084 |
|
5085 |
|
5086 | for (name in options) {
|
5087 | if (options.hasOwnProperty(name)) {
|
5088 | old[name] = style[name];
|
5089 | style[name] = options[name];
|
5090 | }
|
5091 | }
|
5092 |
|
5093 | callback.call(elem);
|
5094 |
|
5095 |
|
5096 | for (name in options) {
|
5097 | if (options.hasOwnProperty(name)) {
|
5098 | style[name] = old[name];
|
5099 | }
|
5100 | }
|
5101 | }
|
5102 |
|
5103 | function getPBMWidth(elem, props, which) {
|
5104 | var value = 0;
|
5105 | var prop = void 0;
|
5106 | var j = void 0;
|
5107 | var i = void 0;
|
5108 | for (j = 0; j < props.length; j++) {
|
5109 | prop = props[j];
|
5110 | if (prop) {
|
5111 | for (i = 0; i < which.length; i++) {
|
5112 | var cssProp = void 0;
|
5113 | if (prop === 'border') {
|
5114 | cssProp = '' + prop + which[i] + 'Width';
|
5115 | } else {
|
5116 | cssProp = prop + which[i];
|
5117 | }
|
5118 | value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
|
5119 | }
|
5120 | }
|
5121 | }
|
5122 | return value;
|
5123 | }
|
5124 |
|
5125 | var domUtils = {};
|
5126 |
|
5127 | each(['Width', 'Height'], function (name) {
|
5128 | domUtils['doc' + name] = function (refWin) {
|
5129 | var d = refWin.document;
|
5130 | return Math.max(
|
5131 |
|
5132 |
|
5133 | d.documentElement['scroll' + name],
|
5134 |
|
5135 | d.body['scroll' + name], domUtils['viewport' + name](d));
|
5136 | };
|
5137 |
|
5138 | domUtils['viewport' + name] = function (win) {
|
5139 |
|
5140 | var prop = 'client' + name;
|
5141 | var doc = win.document;
|
5142 | var body = doc.body;
|
5143 | var documentElement = doc.documentElement;
|
5144 | var documentElementProp = documentElement[prop];
|
5145 |
|
5146 |
|
5147 | return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
|
5148 | };
|
5149 | });
|
5150 |
|
5151 | |
5152 |
|
5153 |
|
5154 |
|
5155 |
|
5156 |
|
5157 |
|
5158 |
|
5159 | function getWH(elem, name, ex) {
|
5160 | var extra = ex;
|
5161 | if (isWindow(elem)) {
|
5162 | return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
|
5163 | } else if (elem.nodeType === 9) {
|
5164 | return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
|
5165 | }
|
5166 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
5167 | var borderBoxValue = name === 'width' ? elem.getBoundingClientRect().width : elem.getBoundingClientRect().height;
|
5168 | var computedStyle = getComputedStyleX(elem);
|
5169 | var isBorderBox = isBorderBoxFn(elem, computedStyle);
|
5170 | var cssBoxValue = 0;
|
5171 | if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) {
|
5172 | borderBoxValue = undefined;
|
5173 |
|
5174 | cssBoxValue = getComputedStyleX(elem, name);
|
5175 | if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) {
|
5176 | cssBoxValue = elem.style[name] || 0;
|
5177 | }
|
5178 |
|
5179 | cssBoxValue = parseFloat(cssBoxValue) || 0;
|
5180 | }
|
5181 | if (extra === undefined) {
|
5182 | extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
|
5183 | }
|
5184 | var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
|
5185 | var val = borderBoxValue || cssBoxValue;
|
5186 | if (extra === CONTENT_INDEX) {
|
5187 | if (borderBoxValueOrIsBorderBox) {
|
5188 | return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
|
5189 | }
|
5190 | return cssBoxValue;
|
5191 | } else if (borderBoxValueOrIsBorderBox) {
|
5192 | if (extra === BORDER_INDEX) {
|
5193 | return val;
|
5194 | }
|
5195 | return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle));
|
5196 | }
|
5197 | return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
|
5198 | }
|
5199 |
|
5200 | var cssShow = {
|
5201 | position: 'absolute',
|
5202 | visibility: 'hidden',
|
5203 | display: 'block'
|
5204 | };
|
5205 |
|
5206 |
|
5207 | function getWHIgnoreDisplay() {
|
5208 | for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
5209 | args[_key2] = arguments[_key2];
|
5210 | }
|
5211 |
|
5212 | var val = void 0;
|
5213 | var elem = args[0];
|
5214 |
|
5215 |
|
5216 | if (elem.offsetWidth !== 0) {
|
5217 | val = getWH.apply(undefined, args);
|
5218 | } else {
|
5219 | swap(elem, cssShow, function () {
|
5220 | val = getWH.apply(undefined, args);
|
5221 | });
|
5222 | }
|
5223 | return val;
|
5224 | }
|
5225 |
|
5226 | each(['width', 'height'], function (name) {
|
5227 | var first = name.charAt(0).toUpperCase() + name.slice(1);
|
5228 | domUtils['outer' + first] = function (el, includeMargin) {
|
5229 | return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
|
5230 | };
|
5231 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
5232 |
|
5233 | domUtils[name] = function (elem, v) {
|
5234 | var val = v;
|
5235 | if (val !== undefined) {
|
5236 | if (elem) {
|
5237 | var computedStyle = getComputedStyleX(elem);
|
5238 | var isBorderBox = isBorderBoxFn(elem);
|
5239 | if (isBorderBox) {
|
5240 | val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
|
5241 | }
|
5242 | return css(elem, name, val);
|
5243 | }
|
5244 | return undefined;
|
5245 | }
|
5246 | return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
|
5247 | };
|
5248 | });
|
5249 |
|
5250 | function mix(to, from) {
|
5251 | for (var i in from) {
|
5252 | if (from.hasOwnProperty(i)) {
|
5253 | to[i] = from[i];
|
5254 | }
|
5255 | }
|
5256 | return to;
|
5257 | }
|
5258 |
|
5259 | var utils = {
|
5260 | getWindow: function getWindow(node) {
|
5261 | if (node && node.document && node.setTimeout) {
|
5262 | return node;
|
5263 | }
|
5264 | var doc = node.ownerDocument || node;
|
5265 | return doc.defaultView || doc.parentWindow;
|
5266 | },
|
5267 |
|
5268 | getDocument: getDocument,
|
5269 | offset: function offset(el, value, option) {
|
5270 | if (typeof value !== 'undefined') {
|
5271 | setOffset(el, value, option || {});
|
5272 | } else {
|
5273 | return getOffset(el);
|
5274 | }
|
5275 | },
|
5276 |
|
5277 | isWindow: isWindow,
|
5278 | each: each,
|
5279 | css: css,
|
5280 | clone: function clone(obj) {
|
5281 | var i = void 0;
|
5282 | var ret = {};
|
5283 | for (i in obj) {
|
5284 | if (obj.hasOwnProperty(i)) {
|
5285 | ret[i] = obj[i];
|
5286 | }
|
5287 | }
|
5288 | var overflow = obj.overflow;
|
5289 | if (overflow) {
|
5290 | for (i in obj) {
|
5291 | if (obj.hasOwnProperty(i)) {
|
5292 | ret.overflow[i] = obj.overflow[i];
|
5293 | }
|
5294 | }
|
5295 | }
|
5296 | return ret;
|
5297 | },
|
5298 |
|
5299 | mix: mix,
|
5300 | getWindowScrollLeft: function getWindowScrollLeft(w) {
|
5301 | return getScrollLeft(w);
|
5302 | },
|
5303 | getWindowScrollTop: function getWindowScrollTop(w) {
|
5304 | return getScrollTop(w);
|
5305 | },
|
5306 | merge: function merge() {
|
5307 | var ret = {};
|
5308 |
|
5309 | for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
|
5310 | args[_key3] = arguments[_key3];
|
5311 | }
|
5312 |
|
5313 | for (var i = 0; i < args.length; i++) {
|
5314 | utils.mix(ret, args[i]);
|
5315 | }
|
5316 | return ret;
|
5317 | },
|
5318 |
|
5319 | viewportWidth: 0,
|
5320 | viewportHeight: 0
|
5321 | };
|
5322 |
|
5323 | mix(utils, domUtils);
|
5324 |
|
5325 | exports['default'] = utils;
|
5326 | module.exports = exports['default'];
|
5327 |
|
5328 | }),
|
5329 |
|
5330 | (function(module, exports) {
|
5331 |
|
5332 | 'use strict';
|
5333 |
|
5334 | Object.defineProperty(exports, "__esModule", {
|
5335 | value: true
|
5336 | });
|
5337 | exports.getTransformName = getTransformName;
|
5338 | exports.setTransitionProperty = setTransitionProperty;
|
5339 | exports.getTransitionProperty = getTransitionProperty;
|
5340 | exports.getTransformXY = getTransformXY;
|
5341 | exports.setTransformXY = setTransformXY;
|
5342 | var vendorPrefix = void 0;
|
5343 |
|
5344 | var jsCssMap = {
|
5345 | Webkit: '-webkit-',
|
5346 | Moz: '-moz-',
|
5347 |
|
5348 | ms: '-ms-',
|
5349 | O: '-o-'
|
5350 | };
|
5351 |
|
5352 | function getVendorPrefix() {
|
5353 | if (vendorPrefix !== undefined) {
|
5354 | return vendorPrefix;
|
5355 | }
|
5356 | vendorPrefix = '';
|
5357 | var style = document.createElement('p').style;
|
5358 | var testProp = 'Transform';
|
5359 | for (var key in jsCssMap) {
|
5360 | if (key + testProp in style) {
|
5361 | vendorPrefix = key;
|
5362 | }
|
5363 | }
|
5364 | return vendorPrefix;
|
5365 | }
|
5366 |
|
5367 | function getTransitionName() {
|
5368 | return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty';
|
5369 | }
|
5370 |
|
5371 | function getTransformName() {
|
5372 | return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform';
|
5373 | }
|
5374 |
|
5375 | function setTransitionProperty(node, value) {
|
5376 | var name = getTransitionName();
|
5377 | if (name) {
|
5378 | node.style[name] = value;
|
5379 | if (name !== 'transitionProperty') {
|
5380 | node.style.transitionProperty = value;
|
5381 | }
|
5382 | }
|
5383 | }
|
5384 |
|
5385 | function setTransform(node, value) {
|
5386 | var name = getTransformName();
|
5387 | if (name) {
|
5388 | node.style[name] = value;
|
5389 | if (name !== 'transform') {
|
5390 | node.style.transform = value;
|
5391 | }
|
5392 | }
|
5393 | }
|
5394 |
|
5395 | function getTransitionProperty(node) {
|
5396 | return node.style.transitionProperty || node.style[getTransitionName()];
|
5397 | }
|
5398 |
|
5399 | function getTransformXY(node) {
|
5400 | var style = window.getComputedStyle(node, null);
|
5401 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
5402 | if (transform && transform !== 'none') {
|
5403 | var matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
|
5404 | return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) };
|
5405 | }
|
5406 | return {
|
5407 | x: 0,
|
5408 | y: 0
|
5409 | };
|
5410 | }
|
5411 |
|
5412 | var matrix2d = /matrix\((.*)\)/;
|
5413 | var matrix3d = /matrix3d\((.*)\)/;
|
5414 |
|
5415 | function setTransformXY(node, xy) {
|
5416 | var style = window.getComputedStyle(node, null);
|
5417 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
5418 | if (transform && transform !== 'none') {
|
5419 | var arr = void 0;
|
5420 | var match2d = transform.match(matrix2d);
|
5421 | if (match2d) {
|
5422 | match2d = match2d[1];
|
5423 | arr = match2d.split(',').map(function (item) {
|
5424 | return parseFloat(item, 10);
|
5425 | });
|
5426 | arr[4] = xy.x;
|
5427 | arr[5] = xy.y;
|
5428 | setTransform(node, 'matrix(' + arr.join(',') + ')');
|
5429 | } else {
|
5430 | var match3d = transform.match(matrix3d)[1];
|
5431 | arr = match3d.split(',').map(function (item) {
|
5432 | return parseFloat(item, 10);
|
5433 | });
|
5434 | arr[12] = xy.x;
|
5435 | arr[13] = xy.y;
|
5436 | setTransform(node, 'matrix3d(' + arr.join(',') + ')');
|
5437 | }
|
5438 | } else {
|
5439 | setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)');
|
5440 | }
|
5441 | }
|
5442 |
|
5443 | }),
|
5444 |
|
5445 | (function(module, exports, __webpack_require__) {
|
5446 |
|
5447 | 'use strict';
|
5448 |
|
5449 | Object.defineProperty(exports, "__esModule", {
|
5450 | value: true
|
5451 | });
|
5452 |
|
5453 | var _utils = __webpack_require__(54);
|
5454 |
|
5455 | var _utils2 = _interopRequireDefault(_utils);
|
5456 |
|
5457 | var _getOffsetParent = __webpack_require__(57);
|
5458 |
|
5459 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
|
5460 |
|
5461 | var _isAncestorFixed = __webpack_require__(58);
|
5462 |
|
5463 | var _isAncestorFixed2 = _interopRequireDefault(_isAncestorFixed);
|
5464 |
|
5465 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5466 |
|
5467 | |
5468 |
|
5469 |
|
5470 | function getVisibleRectForElement(element) {
|
5471 | var visibleRect = {
|
5472 | left: 0,
|
5473 | right: Infinity,
|
5474 | top: 0,
|
5475 | bottom: Infinity
|
5476 | };
|
5477 | var el = (0, _getOffsetParent2['default'])(element);
|
5478 | var doc = _utils2['default'].getDocument(element);
|
5479 | var win = doc.defaultView || doc.parentWindow;
|
5480 | var body = doc.body;
|
5481 | var documentElement = doc.documentElement;
|
5482 |
|
5483 |
|
5484 |
|
5485 | while (el) {
|
5486 |
|
5487 | if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) &&
|
5488 |
|
5489 |
|
5490 |
|
5491 | el !== body && el !== documentElement && _utils2['default'].css(el, 'overflow') !== 'visible') {
|
5492 | var pos = _utils2['default'].offset(el);
|
5493 |
|
5494 | pos.left += el.clientLeft;
|
5495 | pos.top += el.clientTop;
|
5496 | visibleRect.top = Math.max(visibleRect.top, pos.top);
|
5497 | visibleRect.right = Math.min(visibleRect.right,
|
5498 |
|
5499 | pos.left + el.clientWidth);
|
5500 | visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight);
|
5501 | visibleRect.left = Math.max(visibleRect.left, pos.left);
|
5502 | } else if (el === body || el === documentElement) {
|
5503 | break;
|
5504 | }
|
5505 | el = (0, _getOffsetParent2['default'])(el);
|
5506 | }
|
5507 |
|
5508 |
|
5509 |
|
5510 |
|
5511 | var originalPosition = null;
|
5512 | if (!_utils2['default'].isWindow(element) && element.nodeType !== 9) {
|
5513 | originalPosition = element.style.position;
|
5514 | var position = _utils2['default'].css(element, 'position');
|
5515 | if (position === 'absolute') {
|
5516 | element.style.position = 'fixed';
|
5517 | }
|
5518 | }
|
5519 |
|
5520 | var scrollX = _utils2['default'].getWindowScrollLeft(win);
|
5521 | var scrollY = _utils2['default'].getWindowScrollTop(win);
|
5522 | var viewportWidth = _utils2['default'].viewportWidth(win);
|
5523 | var viewportHeight = _utils2['default'].viewportHeight(win);
|
5524 | var documentWidth = documentElement.scrollWidth;
|
5525 | var documentHeight = documentElement.scrollHeight;
|
5526 |
|
5527 |
|
5528 | if (element.style) {
|
5529 | element.style.position = originalPosition;
|
5530 | }
|
5531 |
|
5532 | if ((0, _isAncestorFixed2['default'])(element)) {
|
5533 |
|
5534 | visibleRect.left = Math.max(visibleRect.left, scrollX);
|
5535 | visibleRect.top = Math.max(visibleRect.top, scrollY);
|
5536 | visibleRect.right = Math.min(visibleRect.right, scrollX + viewportWidth);
|
5537 | visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + viewportHeight);
|
5538 | } else {
|
5539 |
|
5540 | var maxVisibleWidth = Math.max(documentWidth, scrollX + viewportWidth);
|
5541 | visibleRect.right = Math.min(visibleRect.right, maxVisibleWidth);
|
5542 |
|
5543 | var maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight);
|
5544 | visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight);
|
5545 | }
|
5546 |
|
5547 | return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;
|
5548 | }
|
5549 |
|
5550 | exports['default'] = getVisibleRectForElement;
|
5551 | module.exports = exports['default'];
|
5552 |
|
5553 | }),
|
5554 |
|
5555 | (function(module, exports, __webpack_require__) {
|
5556 |
|
5557 | 'use strict';
|
5558 |
|
5559 | Object.defineProperty(exports, "__esModule", {
|
5560 | value: true
|
5561 | });
|
5562 |
|
5563 | var _utils = __webpack_require__(54);
|
5564 |
|
5565 | var _utils2 = _interopRequireDefault(_utils);
|
5566 |
|
5567 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5568 |
|
5569 | |
5570 |
|
5571 |
|
5572 |
|
5573 | function getOffsetParent(element) {
|
5574 | if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
|
5575 | return null;
|
5576 | }
|
5577 |
|
5578 | |
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 |
|
5584 |
|
5585 |
|
5586 |
|
5587 |
|
5588 |
|
5589 |
|
5590 |
|
5591 |
|
5592 | var doc = _utils2['default'].getDocument(element);
|
5593 | var body = doc.body;
|
5594 | var parent = void 0;
|
5595 | var positionStyle = _utils2['default'].css(element, 'position');
|
5596 | var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute';
|
5597 |
|
5598 | if (!skipStatic) {
|
5599 | return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode;
|
5600 | }
|
5601 |
|
5602 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
|
5603 | positionStyle = _utils2['default'].css(parent, 'position');
|
5604 | if (positionStyle !== 'static') {
|
5605 | return parent;
|
5606 | }
|
5607 | }
|
5608 | return null;
|
5609 | }
|
5610 |
|
5611 | exports['default'] = getOffsetParent;
|
5612 | module.exports = exports['default'];
|
5613 |
|
5614 | }),
|
5615 |
|
5616 | (function(module, exports, __webpack_require__) {
|
5617 |
|
5618 | 'use strict';
|
5619 |
|
5620 | Object.defineProperty(exports, "__esModule", {
|
5621 | value: true
|
5622 | });
|
5623 | exports['default'] = isAncestorFixed;
|
5624 |
|
5625 | var _utils = __webpack_require__(54);
|
5626 |
|
5627 | var _utils2 = _interopRequireDefault(_utils);
|
5628 |
|
5629 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5630 |
|
5631 | function isAncestorFixed(element) {
|
5632 | if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
|
5633 | return false;
|
5634 | }
|
5635 |
|
5636 | var doc = _utils2['default'].getDocument(element);
|
5637 | var body = doc.body;
|
5638 | var parent = null;
|
5639 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
|
5640 | var positionStyle = _utils2['default'].css(parent, 'position');
|
5641 | if (positionStyle === 'fixed') {
|
5642 | return true;
|
5643 | }
|
5644 | }
|
5645 | return false;
|
5646 | }
|
5647 | module.exports = exports['default'];
|
5648 |
|
5649 | }),
|
5650 |
|
5651 | (function(module, exports, __webpack_require__) {
|
5652 |
|
5653 | 'use strict';
|
5654 |
|
5655 | Object.defineProperty(exports, "__esModule", {
|
5656 | value: true
|
5657 | });
|
5658 |
|
5659 | var _utils = __webpack_require__(54);
|
5660 |
|
5661 | var _utils2 = _interopRequireDefault(_utils);
|
5662 |
|
5663 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5664 |
|
5665 | function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {
|
5666 | var pos = _utils2['default'].clone(elFuturePos);
|
5667 | var size = {
|
5668 | width: elRegion.width,
|
5669 | height: elRegion.height
|
5670 | };
|
5671 |
|
5672 | if (overflow.adjustX && pos.left < visibleRect.left) {
|
5673 | pos.left = visibleRect.left;
|
5674 | }
|
5675 |
|
5676 |
|
5677 | if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) {
|
5678 | size.width -= pos.left + size.width - visibleRect.right;
|
5679 | }
|
5680 |
|
5681 |
|
5682 | if (overflow.adjustX && pos.left + size.width > visibleRect.right) {
|
5683 |
|
5684 | pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);
|
5685 | }
|
5686 |
|
5687 |
|
5688 | if (overflow.adjustY && pos.top < visibleRect.top) {
|
5689 | pos.top = visibleRect.top;
|
5690 | }
|
5691 |
|
5692 |
|
5693 | if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) {
|
5694 | size.height -= pos.top + size.height - visibleRect.bottom;
|
5695 | }
|
5696 |
|
5697 |
|
5698 | if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {
|
5699 |
|
5700 | pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);
|
5701 | }
|
5702 |
|
5703 | return _utils2['default'].mix(pos, size);
|
5704 | }
|
5705 |
|
5706 | exports['default'] = adjustForViewport;
|
5707 | module.exports = exports['default'];
|
5708 |
|
5709 | }),
|
5710 |
|
5711 | (function(module, exports, __webpack_require__) {
|
5712 |
|
5713 | 'use strict';
|
5714 |
|
5715 | Object.defineProperty(exports, "__esModule", {
|
5716 | value: true
|
5717 | });
|
5718 |
|
5719 | var _utils = __webpack_require__(54);
|
5720 |
|
5721 | var _utils2 = _interopRequireDefault(_utils);
|
5722 |
|
5723 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5724 |
|
5725 | function getRegion(node) {
|
5726 | var offset = void 0;
|
5727 | var w = void 0;
|
5728 | var h = void 0;
|
5729 | if (!_utils2['default'].isWindow(node) && node.nodeType !== 9) {
|
5730 | offset = _utils2['default'].offset(node);
|
5731 | w = _utils2['default'].outerWidth(node);
|
5732 | h = _utils2['default'].outerHeight(node);
|
5733 | } else {
|
5734 | var win = _utils2['default'].getWindow(node);
|
5735 | offset = {
|
5736 | left: _utils2['default'].getWindowScrollLeft(win),
|
5737 | top: _utils2['default'].getWindowScrollTop(win)
|
5738 | };
|
5739 | w = _utils2['default'].viewportWidth(win);
|
5740 | h = _utils2['default'].viewportHeight(win);
|
5741 | }
|
5742 | offset.width = w;
|
5743 | offset.height = h;
|
5744 | return offset;
|
5745 | }
|
5746 |
|
5747 | exports['default'] = getRegion;
|
5748 | module.exports = exports['default'];
|
5749 |
|
5750 | }),
|
5751 |
|
5752 | (function(module, exports, __webpack_require__) {
|
5753 |
|
5754 | 'use strict';
|
5755 |
|
5756 | Object.defineProperty(exports, "__esModule", {
|
5757 | value: true
|
5758 | });
|
5759 |
|
5760 | var _getAlignOffset = __webpack_require__(62);
|
5761 |
|
5762 | var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset);
|
5763 |
|
5764 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5765 |
|
5766 | function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {
|
5767 | var p1 = (0, _getAlignOffset2['default'])(refNodeRegion, points[1]);
|
5768 | var p2 = (0, _getAlignOffset2['default'])(elRegion, points[0]);
|
5769 | var diff = [p2.left - p1.left, p2.top - p1.top];
|
5770 |
|
5771 | return {
|
5772 | left: elRegion.left - diff[0] + offset[0] - targetOffset[0],
|
5773 | top: elRegion.top - diff[1] + offset[1] - targetOffset[1]
|
5774 | };
|
5775 | }
|
5776 |
|
5777 | exports['default'] = getElFuturePos;
|
5778 | module.exports = exports['default'];
|
5779 |
|
5780 | }),
|
5781 |
|
5782 | (function(module, exports) {
|
5783 |
|
5784 | 'use strict';
|
5785 |
|
5786 | Object.defineProperty(exports, "__esModule", {
|
5787 | value: true
|
5788 | });
|
5789 | |
5790 |
|
5791 |
|
5792 |
|
5793 | function getAlignOffset(region, align) {
|
5794 | var V = align.charAt(0);
|
5795 | var H = align.charAt(1);
|
5796 | var w = region.width;
|
5797 | var h = region.height;
|
5798 |
|
5799 | var x = region.left;
|
5800 | var y = region.top;
|
5801 |
|
5802 | if (V === 'c') {
|
5803 | y += h / 2;
|
5804 | } else if (V === 'b') {
|
5805 | y += h;
|
5806 | }
|
5807 |
|
5808 | if (H === 'c') {
|
5809 | x += w / 2;
|
5810 | } else if (H === 'r') {
|
5811 | x += w;
|
5812 | }
|
5813 |
|
5814 | return {
|
5815 | left: x,
|
5816 | top: y
|
5817 | };
|
5818 | }
|
5819 |
|
5820 | exports['default'] = getAlignOffset;
|
5821 | module.exports = exports['default'];
|
5822 |
|
5823 | }),
|
5824 |
|
5825 | (function(module, exports, __webpack_require__) {
|
5826 |
|
5827 | 'use strict';
|
5828 |
|
5829 | Object.defineProperty(exports, "__esModule", {
|
5830 | value: true
|
5831 | });
|
5832 |
|
5833 | 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; };
|
5834 |
|
5835 | var _utils = __webpack_require__(54);
|
5836 |
|
5837 | var _utils2 = _interopRequireDefault(_utils);
|
5838 |
|
5839 | var _align = __webpack_require__(53);
|
5840 |
|
5841 | var _align2 = _interopRequireDefault(_align);
|
5842 |
|
5843 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5844 |
|
5845 | |
5846 |
|
5847 |
|
5848 |
|
5849 |
|
5850 | function alignPoint(el, tgtPoint, align) {
|
5851 | var pageX = void 0;
|
5852 | var pageY = void 0;
|
5853 |
|
5854 | var doc = _utils2['default'].getDocument(el);
|
5855 | var win = doc.defaultView || doc.parentWindow;
|
5856 |
|
5857 | var scrollX = _utils2['default'].getWindowScrollLeft(win);
|
5858 | var scrollY = _utils2['default'].getWindowScrollTop(win);
|
5859 | var viewportWidth = _utils2['default'].viewportWidth(win);
|
5860 | var viewportHeight = _utils2['default'].viewportHeight(win);
|
5861 |
|
5862 | if ('pageX' in tgtPoint) {
|
5863 | pageX = tgtPoint.pageX;
|
5864 | } else {
|
5865 | pageX = scrollX + tgtPoint.clientX;
|
5866 | }
|
5867 |
|
5868 | if ('pageY' in tgtPoint) {
|
5869 | pageY = tgtPoint.pageY;
|
5870 | } else {
|
5871 | pageY = scrollY + tgtPoint.clientY;
|
5872 | }
|
5873 |
|
5874 | var tgtRegion = {
|
5875 | left: pageX,
|
5876 | top: pageY,
|
5877 | width: 0,
|
5878 | height: 0
|
5879 | };
|
5880 |
|
5881 | var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight;
|
5882 |
|
5883 |
|
5884 | var points = [align.points[0], 'cc'];
|
5885 |
|
5886 | return (0, _align2['default'])(el, tgtRegion, _extends({}, align, { points: points }), pointInView);
|
5887 | }
|
5888 |
|
5889 | exports['default'] = alignPoint;
|
5890 | module.exports = exports['default'];
|
5891 |
|
5892 | }),
|
5893 |
|
5894 | (function(module, exports, __webpack_require__) {
|
5895 |
|
5896 | 'use strict';
|
5897 |
|
5898 | Object.defineProperty(exports, "__esModule", {
|
5899 | value: true
|
5900 | });
|
5901 |
|
5902 | 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; };
|
5903 |
|
5904 | var _classnames = __webpack_require__(3);
|
5905 |
|
5906 | var _classnames2 = _interopRequireDefault(_classnames);
|
5907 |
|
5908 | var _react = __webpack_require__(4);
|
5909 |
|
5910 | var _react2 = _interopRequireDefault(_react);
|
5911 |
|
5912 | var _propTypes = __webpack_require__(5);
|
5913 |
|
5914 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
5915 |
|
5916 | var _Transition = __webpack_require__(11);
|
5917 |
|
5918 | var _Transition2 = _interopRequireDefault(_Transition);
|
5919 |
|
5920 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
5921 |
|
5922 | 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; }
|
5923 |
|
5924 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
5925 |
|
5926 | 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; }
|
5927 |
|
5928 | 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); }
|
5929 |
|
5930 | var propTypes = {
|
5931 | |
5932 |
|
5933 |
|
5934 | "in": _propTypes2["default"].bool,
|
5935 |
|
5936 | |
5937 |
|
5938 |
|
5939 | unmountOnExit: _propTypes2["default"].bool,
|
5940 |
|
5941 | |
5942 |
|
5943 |
|
5944 |
|
5945 | transitionAppear: _propTypes2["default"].bool,
|
5946 |
|
5947 | |
5948 |
|
5949 |
|
5950 |
|
5951 |
|
5952 | timeout: _propTypes2["default"].number,
|
5953 |
|
5954 | |
5955 |
|
5956 |
|
5957 | onEnter: _propTypes2["default"].func,
|
5958 | |
5959 |
|
5960 |
|
5961 | onEntering: _propTypes2["default"].func,
|
5962 | |
5963 |
|
5964 |
|
5965 | onEntered: _propTypes2["default"].func,
|
5966 | |
5967 |
|
5968 |
|
5969 | onExit: _propTypes2["default"].func,
|
5970 | |
5971 |
|
5972 |
|
5973 | onExiting: _propTypes2["default"].func,
|
5974 | |
5975 |
|
5976 |
|
5977 | onExited: _propTypes2["default"].func
|
5978 | };
|
5979 |
|
5980 | var defaultProps = {
|
5981 | "in": false,
|
5982 | timeout: 300,
|
5983 | unmountOnExit: false,
|
5984 | transitionAppear: false
|
5985 | };
|
5986 |
|
5987 | var Fade = function (_React$Component) {
|
5988 | _inherits(Fade, _React$Component);
|
5989 |
|
5990 | function Fade() {
|
5991 | _classCallCheck(this, Fade);
|
5992 |
|
5993 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
5994 | }
|
5995 |
|
5996 | Fade.prototype.render = function render() {
|
5997 | return _react2["default"].createElement(_Transition2["default"], _extends({}, this.props, {
|
5998 | className: (0, _classnames2["default"])(this.props.className, 'fade'),
|
5999 | enteredClassName: 'in',
|
6000 | enteringClassName: 'in'
|
6001 | }));
|
6002 | };
|
6003 |
|
6004 | return Fade;
|
6005 | }(_react2["default"].Component);
|
6006 |
|
6007 | Fade.propTypes = propTypes;
|
6008 | Fade.defaultProps = defaultProps;
|
6009 |
|
6010 | exports["default"] = Fade;
|
6011 | module.exports = exports['default'];
|
6012 |
|
6013 | }),
|
6014 |
|
6015 | (function(module, exports, __webpack_require__) {
|
6016 |
|
6017 | 'use strict';
|
6018 |
|
6019 | Object.defineProperty(exports, "__esModule", {
|
6020 | value: true
|
6021 | });
|
6022 |
|
6023 | var _Message = __webpack_require__(66);
|
6024 |
|
6025 | var _Message2 = _interopRequireDefault(_Message);
|
6026 |
|
6027 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6028 |
|
6029 | exports["default"] = _Message2["default"];
|
6030 | module.exports = exports['default'];
|
6031 |
|
6032 | }),
|
6033 |
|
6034 | (function(module, exports, __webpack_require__) {
|
6035 |
|
6036 | 'use strict';
|
6037 |
|
6038 | Object.defineProperty(exports, "__esModule", {
|
6039 | value: true
|
6040 | });
|
6041 |
|
6042 | 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; };
|
6043 |
|
6044 | 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; };
|
6045 |
|
6046 | var _react = __webpack_require__(4);
|
6047 |
|
6048 | var _react2 = _interopRequireDefault(_react);
|
6049 |
|
6050 | var _beeNotification = __webpack_require__(67);
|
6051 |
|
6052 | var _beeNotification2 = _interopRequireDefault(_beeNotification);
|
6053 |
|
6054 | var _classnames = __webpack_require__(3);
|
6055 |
|
6056 | var _classnames2 = _interopRequireDefault(_classnames);
|
6057 |
|
6058 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6059 |
|
6060 | var defaultDuration = 1.5;
|
6061 | var defaultTop = 0;
|
6062 | var defaultBottom = 48;
|
6063 | var bottom = 90;
|
6064 | var padding = 30;
|
6065 | var width = 200;
|
6066 | var messageInstance = void 0;
|
6067 | var key = 1;
|
6068 | var clsPrefix = 'u-message';
|
6069 | var noop = function noop() {};
|
6070 |
|
6071 | var positionObj = {
|
6072 | "top": {
|
6073 | messageStyle: {
|
6074 | width: "100%"
|
6075 | },
|
6076 | notificationStyle: {
|
6077 | top: defaultTop,
|
6078 | width: "100%"
|
6079 | },
|
6080 | transitionName: 'top'
|
6081 | },
|
6082 | "bottom": {
|
6083 | messageStyle: {
|
6084 | width: "100%"
|
6085 | },
|
6086 | notificationStyle: {
|
6087 | bottom: defaultBottom,
|
6088 | width: "100%"
|
6089 | },
|
6090 | transitionName: 'bottom'
|
6091 | },
|
6092 | "topRight": {
|
6093 | messageStyle: {
|
6094 | width: width
|
6095 | },
|
6096 | notificationStyle: {
|
6097 | top: padding,
|
6098 | right: padding,
|
6099 | width: width
|
6100 | },
|
6101 | transitionName: 'right'
|
6102 | },
|
6103 | "bottomRight": {
|
6104 | messageStyle: {
|
6105 | width: width
|
6106 | },
|
6107 | notificationStyle: {
|
6108 | bottom: bottom,
|
6109 | right: padding,
|
6110 | width: width
|
6111 | },
|
6112 | transitionName: 'right'
|
6113 | },
|
6114 | "topLeft": {
|
6115 | messageStyle: {
|
6116 | width: width
|
6117 | },
|
6118 | notificationStyle: {
|
6119 | top: padding,
|
6120 | left: padding,
|
6121 | width: width
|
6122 | },
|
6123 | transitionName: 'left'
|
6124 | },
|
6125 | "bottomLeft": {
|
6126 | messageStyle: {
|
6127 | width: width
|
6128 | },
|
6129 | notificationStyle: {
|
6130 | bottom: bottom,
|
6131 | left: padding,
|
6132 | width: width
|
6133 | },
|
6134 | transitionName: 'left'
|
6135 | }
|
6136 | };
|
6137 |
|
6138 | function getMessageInstance() {
|
6139 | var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'top';
|
6140 | var callback = arguments[1];
|
6141 |
|
6142 | if (messageInstance) {
|
6143 | callback(messageInstance);
|
6144 | return;
|
6145 | }
|
6146 | var style = positionObj[position].notificationStyle;
|
6147 | _beeNotification2["default"].newInstance({
|
6148 | clsPrefix: clsPrefix,
|
6149 | transitionName: clsPrefix + '-' + positionObj[position].transitionName,
|
6150 | style: style,
|
6151 | position: ''
|
6152 | }, function (instance) {
|
6153 | messageInstance = instance;
|
6154 | callback(instance);
|
6155 | });
|
6156 | }
|
6157 |
|
6158 | function notice(content, duration, type, onClose, position, style) {
|
6159 | var iconType = {
|
6160 | info: 'uf uf-i-c-2',
|
6161 | success: 'uf uf-correct',
|
6162 | danger: 'uf uf-close-c',
|
6163 | warning: 'uf uf-exc-t',
|
6164 | light: 'uf uf-notification',
|
6165 | dark: 'uf uf-bubble',
|
6166 | news: 'uf uf-bell',
|
6167 | infolight: 'uf uf-i-c-2',
|
6168 | successlight: 'uf uf-correct',
|
6169 | dangerlight: 'uf uf-close-c',
|
6170 | warninglight: 'uf uf-exc-t'
|
6171 | }[type];
|
6172 |
|
6173 | var positionStyle = positionObj[position].messageStyle;
|
6174 |
|
6175 | getMessageInstance(position, function (instance) {
|
6176 | instance.notice({
|
6177 | key: key,
|
6178 | duration: duration,
|
6179 | color: type,
|
6180 | style: _extends({}, positionStyle, style),
|
6181 | content: _react2["default"].createElement(
|
6182 | 'div',
|
6183 | null,
|
6184 | _react2["default"].createElement(
|
6185 | 'div',
|
6186 | { className: clsPrefix + '-notice-description-icon' },
|
6187 | _react2["default"].createElement('i', { className: (0, _classnames2["default"])(iconType) })
|
6188 | ),
|
6189 | _react2["default"].createElement(
|
6190 | 'div',
|
6191 | { className: clsPrefix + '-notice-description-content' },
|
6192 | content
|
6193 | )
|
6194 | ),
|
6195 | onClose: onClose
|
6196 | });
|
6197 | });
|
6198 | return function () {
|
6199 | var target = key++;
|
6200 | return function () {
|
6201 | if (messageInstance) {
|
6202 | messageInstance.removeNotice(target);
|
6203 | }
|
6204 | };
|
6205 | }();
|
6206 | }
|
6207 |
|
6208 | exports["default"] = {
|
6209 | create: function create(obj) {
|
6210 | var content = obj.content || '';
|
6211 | var duration = _typeof(obj.duration) == undefined ? defaultDuration : obj.duration;
|
6212 | var color = obj.color || 'dark';
|
6213 | var onClose = obj.onClose || noop;
|
6214 | var position = obj.position || "top";
|
6215 | var style = obj.style || {};
|
6216 | return notice(content, duration, color, onClose, position, style);
|
6217 | },
|
6218 | config: function config(options) {
|
6219 | if (options.top !== undefined) {
|
6220 | defaultTop = options.top;
|
6221 | }
|
6222 | if (options.duration !== undefined) {
|
6223 | defaultDuration = options.duration;
|
6224 | }
|
6225 | if (options.clsPrefix !== undefined) {
|
6226 | clsPrefix = options.clsPrefix;
|
6227 | }
|
6228 | if (options.defaultBottom !== undefined) {
|
6229 | defaultBottom = options.defaultBottom;
|
6230 | }
|
6231 | if (options.bottom !== undefined) {
|
6232 | bottom = options.bottom;
|
6233 | }
|
6234 | if (options.width !== undefined) {
|
6235 | bottom = options.width;
|
6236 | }
|
6237 | },
|
6238 | destroy: function destroy() {
|
6239 | if (messageInstance) {
|
6240 | messageInstance.destroy();
|
6241 | messageInstance = null;
|
6242 | }
|
6243 | }
|
6244 | };
|
6245 | module.exports = exports['default'];
|
6246 |
|
6247 | }),
|
6248 |
|
6249 | (function(module, exports, __webpack_require__) {
|
6250 |
|
6251 | 'use strict';
|
6252 |
|
6253 | Object.defineProperty(exports, "__esModule", {
|
6254 | value: true
|
6255 | });
|
6256 |
|
6257 | var _Notification = __webpack_require__(68);
|
6258 |
|
6259 | var _Notification2 = _interopRequireDefault(_Notification);
|
6260 |
|
6261 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6262 |
|
6263 | exports["default"] = _Notification2["default"];
|
6264 | module.exports = exports['default'];
|
6265 |
|
6266 | }),
|
6267 |
|
6268 | (function(module, exports, __webpack_require__) {
|
6269 |
|
6270 | 'use strict';
|
6271 |
|
6272 | Object.defineProperty(exports, "__esModule", {
|
6273 | value: true
|
6274 | });
|
6275 |
|
6276 | 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; };
|
6277 |
|
6278 | var _react = __webpack_require__(4);
|
6279 |
|
6280 | var _react2 = _interopRequireDefault(_react);
|
6281 |
|
6282 | var _propTypes = __webpack_require__(5);
|
6283 |
|
6284 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6285 |
|
6286 | var _reactDom = __webpack_require__(12);
|
6287 |
|
6288 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
6289 |
|
6290 | var _beeAnimate = __webpack_require__(69);
|
6291 |
|
6292 | var _beeAnimate2 = _interopRequireDefault(_beeAnimate);
|
6293 |
|
6294 | var _createChainedFunction = __webpack_require__(37);
|
6295 |
|
6296 | var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
|
6297 |
|
6298 | var _classnames = __webpack_require__(3);
|
6299 |
|
6300 | var _classnames2 = _interopRequireDefault(_classnames);
|
6301 |
|
6302 | var _Notice = __webpack_require__(74);
|
6303 |
|
6304 | var _Notice2 = _interopRequireDefault(_Notice);
|
6305 |
|
6306 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6307 |
|
6308 | 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; }
|
6309 |
|
6310 | 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; }
|
6311 |
|
6312 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6313 |
|
6314 | 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; }
|
6315 |
|
6316 | 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); }
|
6317 |
|
6318 | var seed = 0;
|
6319 | var now = Date.now();
|
6320 |
|
6321 | function getUuid() {
|
6322 | return 'uNotification_' + now + '_' + seed++;
|
6323 | }
|
6324 |
|
6325 | var propTypes = {
|
6326 | show: _propTypes2["default"].bool,
|
6327 | clsPrefix: _propTypes2["default"].string,
|
6328 | style: _propTypes2["default"].object,
|
6329 | position: _propTypes2["default"].oneOf(['topRight', 'bottomRight', '']),
|
6330 | transitionName: _propTypes2["default"].string,
|
6331 | animation: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object])
|
6332 | };
|
6333 |
|
6334 | var defaultProps = {
|
6335 | clsPrefix: 'u-notification',
|
6336 | animation: 'fade',
|
6337 | position: 'topRight'
|
6338 | };
|
6339 |
|
6340 | var Notification = function (_Component) {
|
6341 | _inherits(Notification, _Component);
|
6342 |
|
6343 | function Notification(props) {
|
6344 | _classCallCheck(this, Notification);
|
6345 |
|
6346 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
6347 |
|
6348 | _this.state = {
|
6349 | notices: []
|
6350 | };
|
6351 | _this.add = _this.add.bind(_this);
|
6352 | _this.remove = _this.remove.bind(_this);
|
6353 |
|
6354 | return _this;
|
6355 | }
|
6356 |
|
6357 | Notification.prototype.getTransitionName = function getTransitionName() {
|
6358 | var props = this.props;
|
6359 | var transitionName = props.transitionName;
|
6360 | if (!transitionName && props.animation) {
|
6361 | transitionName = props.clsPrefix + '-' + props.animation;
|
6362 | }
|
6363 | return transitionName;
|
6364 | };
|
6365 |
|
6366 | Notification.prototype.add = function add(notice) {
|
6367 | var key = notice.key = notice.key || getUuid();
|
6368 | this.setState(function (previousState) {
|
6369 | var notices = previousState.notices;
|
6370 | if (!notices.filter(function (v) {
|
6371 | return v.key === key;
|
6372 | }).length) {
|
6373 | return {
|
6374 | notices: notices.concat(notice)
|
6375 | };
|
6376 | }
|
6377 | });
|
6378 | };
|
6379 |
|
6380 | Notification.prototype.remove = function remove(key) {
|
6381 | this.setState(function (previousState) {
|
6382 | return {
|
6383 | notices: previousState.notices.filter(function (notice) {
|
6384 | return notice.key !== key;
|
6385 | })
|
6386 | };
|
6387 | });
|
6388 | };
|
6389 |
|
6390 | Notification.prototype.render = function render() {
|
6391 | var _this2 = this,
|
6392 | _classes;
|
6393 |
|
6394 | var _props = this.props,
|
6395 | clsPrefix = _props.clsPrefix,
|
6396 | className = _props.className,
|
6397 | position = _props.position,
|
6398 | style = _props.style;
|
6399 |
|
6400 | var noticeNodes = this.state.notices.map(function (notice) {
|
6401 | var onClose = (0, _createChainedFunction2["default"])(_this2.remove.bind(_this2, notice.key), notice.onClose);
|
6402 | return _react2["default"].createElement(
|
6403 | _Notice2["default"],
|
6404 | _extends({
|
6405 | clsPrefix: clsPrefix
|
6406 | }, notice, {
|
6407 | onClose: onClose
|
6408 | }),
|
6409 | notice.content
|
6410 | );
|
6411 | });
|
6412 | var classes = (_classes = {}, _defineProperty(_classes, clsPrefix, 1), _defineProperty(_classes, className, !!className), _classes);
|
6413 | if (position) {
|
6414 | classes[clsPrefix + '-' + position] = !!position;
|
6415 | }
|
6416 |
|
6417 | return _react2["default"].createElement(
|
6418 | 'div',
|
6419 | { className: (0, _classnames2["default"])(className, classes), style: style },
|
6420 | _react2["default"].createElement(
|
6421 | _beeAnimate2["default"],
|
6422 | { transitionName: this.getTransitionName() },
|
6423 | noticeNodes
|
6424 | )
|
6425 | );
|
6426 | };
|
6427 |
|
6428 | return Notification;
|
6429 | }(_react.Component);
|
6430 |
|
6431 | ;
|
6432 |
|
6433 | Notification.propTypes = propTypes;
|
6434 | Notification.defaultProps = defaultProps;
|
6435 |
|
6436 | Notification.newInstance = function newNotificationInstance(properties, callback) {
|
6437 | if (typeof callback !== 'function') {
|
6438 | console.error('You must introduce callback as the second parameter of Notification.newInstance().');
|
6439 | return;
|
6440 | }
|
6441 | var props = properties || {};
|
6442 | var div = document.createElement('div');
|
6443 | document.body.appendChild(div);
|
6444 |
|
6445 | var called = false;
|
6446 | function ref(notification) {
|
6447 | if (called) {
|
6448 | return;
|
6449 | }
|
6450 | called = true;
|
6451 | callback({
|
6452 | notice: function notice(noticeProps) {
|
6453 | notification.add(noticeProps);
|
6454 | },
|
6455 | removeNotice: function removeNotice(key) {
|
6456 | notification.remove(key);
|
6457 | },
|
6458 |
|
6459 | component: notification,
|
6460 | destroy: function destroy() {
|
6461 | _reactDom2["default"].unmountComponentAtNode(div);
|
6462 | document.body.removeChild(div);
|
6463 | }
|
6464 | });
|
6465 | }
|
6466 | _reactDom2["default"].render(_react2["default"].createElement(Notification, _extends({}, props, { ref: ref })), div);
|
6467 | };
|
6468 |
|
6469 | exports["default"] = Notification;
|
6470 | module.exports = exports['default'];
|
6471 |
|
6472 | }),
|
6473 |
|
6474 | (function(module, exports, __webpack_require__) {
|
6475 |
|
6476 | 'use strict';
|
6477 |
|
6478 | Object.defineProperty(exports, "__esModule", {
|
6479 | value: true
|
6480 | });
|
6481 |
|
6482 | var _Animate = __webpack_require__(70);
|
6483 |
|
6484 | var _Animate2 = _interopRequireDefault(_Animate);
|
6485 |
|
6486 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6487 |
|
6488 | exports["default"] = _Animate2["default"];
|
6489 | module.exports = exports['default'];
|
6490 |
|
6491 | }),
|
6492 |
|
6493 | (function(module, exports, __webpack_require__) {
|
6494 |
|
6495 | 'use strict';
|
6496 |
|
6497 | Object.defineProperty(exports, "__esModule", {
|
6498 | value: true
|
6499 | });
|
6500 |
|
6501 | var _react = __webpack_require__(4);
|
6502 |
|
6503 | var _react2 = _interopRequireDefault(_react);
|
6504 |
|
6505 | var _propTypes = __webpack_require__(5);
|
6506 |
|
6507 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6508 |
|
6509 | var _ChildrenUtils = __webpack_require__(71);
|
6510 |
|
6511 | var _AnimateChild = __webpack_require__(72);
|
6512 |
|
6513 | var _AnimateChild2 = _interopRequireDefault(_AnimateChild);
|
6514 |
|
6515 | var _util = __webpack_require__(73);
|
6516 |
|
6517 | var _util2 = _interopRequireDefault(_util);
|
6518 |
|
6519 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6520 |
|
6521 | 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; }
|
6522 |
|
6523 | 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; }
|
6524 |
|
6525 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6526 |
|
6527 | 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; }
|
6528 |
|
6529 | 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); }
|
6530 |
|
6531 | var defaultKey = 'u_animate_' + Date.now();
|
6532 |
|
6533 |
|
6534 | function getChildrenFromProps(props) {
|
6535 | var children = props.children;
|
6536 | if (_react2["default"].isValidElement(children)) {
|
6537 | if (!children.key) {
|
6538 | return _react2["default"].cloneElement(children, {
|
6539 | key: defaultKey
|
6540 | });
|
6541 | }
|
6542 | }
|
6543 | return children;
|
6544 | }
|
6545 |
|
6546 | function noop() {}
|
6547 |
|
6548 | var propTypes = {
|
6549 | component: _propTypes2["default"].any,
|
6550 | animation: _propTypes2["default"].object,
|
6551 | transitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
|
6552 | transitionEnter: _propTypes2["default"].bool,
|
6553 | transitionAppear: _propTypes2["default"].bool,
|
6554 | exclusive: _propTypes2["default"].bool,
|
6555 | transitionLeave: _propTypes2["default"].bool,
|
6556 | onEnd: _propTypes2["default"].func,
|
6557 | onEnter: _propTypes2["default"].func,
|
6558 | onLeave: _propTypes2["default"].func,
|
6559 | onAppear: _propTypes2["default"].func,
|
6560 | showProp: _propTypes2["default"].string
|
6561 | };
|
6562 |
|
6563 | var defaultProps = {
|
6564 | animation: {},
|
6565 | component: 'span',
|
6566 | transitionEnter: true,
|
6567 | transitionLeave: true,
|
6568 | transitionAppear: false,
|
6569 | onEnd: noop,
|
6570 | onEnter: noop,
|
6571 | onLeave: noop,
|
6572 | onAppear: noop
|
6573 | };
|
6574 |
|
6575 | var Animate = function (_Component) {
|
6576 | _inherits(Animate, _Component);
|
6577 |
|
6578 | function Animate(props) {
|
6579 | _classCallCheck(this, Animate);
|
6580 |
|
6581 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
6582 |
|
6583 | _this.currentlyAnimatingKeys = {};
|
6584 | _this.keysToEnter = [];
|
6585 | _this.keysToLeave = [];
|
6586 | _this.state = {
|
6587 | children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(_this.props))
|
6588 | };
|
6589 |
|
6590 | _this.performEnter = _this.performEnter.bind(_this);
|
6591 | _this.performAppear = _this.performAppear.bind(_this);
|
6592 | _this.handleDoneAdding = _this.handleDoneAdding.bind(_this);
|
6593 | _this.performLeave = _this.performLeave.bind(_this);
|
6594 |
|
6595 | _this.performLeave = _this.performLeave.bind(_this);
|
6596 | _this.handleDoneLeaving = _this.handleDoneLeaving.bind(_this);
|
6597 | _this.isValidChildByKey = _this.isValidChildByKey.bind(_this);
|
6598 | _this.stop = _this.stop.bind(_this);
|
6599 | return _this;
|
6600 | }
|
6601 |
|
6602 | Animate.prototype.componentDidMount = function componentDidMount() {
|
6603 | var _this2 = this;
|
6604 |
|
6605 | this.mounted = true;
|
6606 | var showProp = this.props.showProp;
|
6607 | var children = this.state.children;
|
6608 | if (showProp) {
|
6609 | children = children.filter(function (child) {
|
6610 | return !!child.props[showProp];
|
6611 | });
|
6612 | }
|
6613 | children.forEach(function (child) {
|
6614 | if (child) {
|
6615 | _this2.performAppear(child.key);
|
6616 | }
|
6617 | });
|
6618 | };
|
6619 |
|
6620 | Animate.prototype.componentWillUnmount = function componentWillUnmount() {
|
6621 | this.mounted = false;
|
6622 | };
|
6623 |
|
6624 | Animate.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
6625 | var _this3 = this;
|
6626 |
|
6627 | this.nextProps = nextProps;
|
6628 | var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps));
|
6629 | var props = this.props;
|
6630 |
|
6631 | if (props.exclusive) {
|
6632 | Object.keys(this.currentlyAnimatingKeys).forEach(function (key) {
|
6633 | _this3.stop(key);
|
6634 | });
|
6635 | }
|
6636 | var showProp = props.showProp;
|
6637 | var currentlyAnimatingKeys = this.currentlyAnimatingKeys;
|
6638 |
|
6639 | var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children;
|
6640 |
|
6641 | var newChildren = [];
|
6642 | if (showProp) {
|
6643 | currentChildren.forEach(function (currentChild) {
|
6644 | var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key);
|
6645 | var newChild = void 0;
|
6646 | if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) {
|
6647 | newChild = _react2["default"].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true));
|
6648 | } else {
|
6649 | newChild = nextChild;
|
6650 | }
|
6651 | if (newChild) {
|
6652 | newChildren.push(newChild);
|
6653 | }
|
6654 | });
|
6655 | nextChildren.forEach(function (nextChild) {
|
6656 | if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) {
|
6657 | newChildren.push(nextChild);
|
6658 | }
|
6659 | });
|
6660 | } else {
|
6661 | newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren);
|
6662 | }
|
6663 |
|
6664 |
|
6665 | this.setState({
|
6666 | children: newChildren
|
6667 | });
|
6668 |
|
6669 | nextChildren.forEach(function (child) {
|
6670 | var key = child && child.key;
|
6671 | if (child && currentlyAnimatingKeys[key]) {
|
6672 | return;
|
6673 | }
|
6674 | var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
6675 | if (showProp) {
|
6676 | var showInNext = child.props[showProp];
|
6677 | if (hasPrev) {
|
6678 | var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
6679 | if (!showInNow && showInNext) {
|
6680 | _this3.keysToEnter.push(key);
|
6681 | }
|
6682 | } else if (showInNext) {
|
6683 | _this3.keysToEnter.push(key);
|
6684 | }
|
6685 | } else if (!hasPrev) {
|
6686 | _this3.keysToEnter.push(key);
|
6687 | }
|
6688 | });
|
6689 |
|
6690 | currentChildren.forEach(function (child) {
|
6691 | var key = child && child.key;
|
6692 | if (child && currentlyAnimatingKeys[key]) {
|
6693 | return;
|
6694 | }
|
6695 | var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key);
|
6696 | if (showProp) {
|
6697 | var showInNow = child.props[showProp];
|
6698 | if (hasNext) {
|
6699 | var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp);
|
6700 | if (!showInNext && showInNow) {
|
6701 | _this3.keysToLeave.push(key);
|
6702 | }
|
6703 | } else if (showInNow) {
|
6704 | _this3.keysToLeave.push(key);
|
6705 | }
|
6706 | } else if (!hasNext) {
|
6707 | _this3.keysToLeave.push(key);
|
6708 | }
|
6709 | });
|
6710 | };
|
6711 |
|
6712 | Animate.prototype.componentDidUpdate = function componentDidUpdate() {
|
6713 | var keysToEnter = this.keysToEnter;
|
6714 | this.keysToEnter = [];
|
6715 | keysToEnter.forEach(this.performEnter);
|
6716 | var keysToLeave = this.keysToLeave;
|
6717 | this.keysToLeave = [];
|
6718 | keysToLeave.forEach(this.performLeave);
|
6719 | };
|
6720 |
|
6721 | Animate.prototype.performEnter = function performEnter(key) {
|
6722 |
|
6723 | if (this.refs[key]) {
|
6724 | this.currentlyAnimatingKeys[key] = true;
|
6725 | this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter'));
|
6726 | }
|
6727 | };
|
6728 |
|
6729 | Animate.prototype.performAppear = function performAppear(key) {
|
6730 | if (this.refs[key]) {
|
6731 | this.currentlyAnimatingKeys[key] = true;
|
6732 | this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear'));
|
6733 | }
|
6734 | };
|
6735 |
|
6736 | Animate.prototype.handleDoneAdding = function handleDoneAdding(key, type) {
|
6737 | var props = this.props;
|
6738 | delete this.currentlyAnimatingKeys[key];
|
6739 |
|
6740 | if (props.exclusive && props !== this.nextProps) {
|
6741 | return;
|
6742 | }
|
6743 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
6744 | if (!this.isValidChildByKey(currentChildren, key)) {
|
6745 |
|
6746 | this.performLeave(key);
|
6747 | } else {
|
6748 | if (type === 'appear') {
|
6749 | if (_util2["default"].allowAppearCallback(props)) {
|
6750 | props.onAppear(key);
|
6751 | props.onEnd(key, true);
|
6752 | }
|
6753 | } else {
|
6754 | if (_util2["default"].allowEnterCallback(props)) {
|
6755 | props.onEnter(key);
|
6756 | props.onEnd(key, true);
|
6757 | }
|
6758 | }
|
6759 | }
|
6760 | };
|
6761 |
|
6762 | Animate.prototype.performLeave = function performLeave(key) {
|
6763 |
|
6764 | if (this.refs[key]) {
|
6765 | this.currentlyAnimatingKeys[key] = true;
|
6766 | this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key));
|
6767 | }
|
6768 | };
|
6769 |
|
6770 | Animate.prototype.handleDoneLeaving = function handleDoneLeaving(key) {
|
6771 | var props = this.props;
|
6772 | delete this.currentlyAnimatingKeys[key];
|
6773 |
|
6774 | if (props.exclusive && props !== this.nextProps) {
|
6775 | return;
|
6776 | }
|
6777 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
6778 |
|
6779 | if (this.isValidChildByKey(currentChildren, key)) {
|
6780 | this.performEnter(key);
|
6781 | } else {
|
6782 | var end = function end() {
|
6783 | if (_util2["default"].allowLeaveCallback(props)) {
|
6784 | props.onLeave(key);
|
6785 | props.onEnd(key, false);
|
6786 | }
|
6787 | };
|
6788 |
|
6789 | if (this.mounted && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) {
|
6790 | this.setState({
|
6791 | children: currentChildren
|
6792 | }, end);
|
6793 | } else {
|
6794 | end();
|
6795 | }
|
6796 | }
|
6797 | };
|
6798 |
|
6799 | Animate.prototype.isValidChildByKey = function isValidChildByKey(currentChildren, key) {
|
6800 | var showProp = this.props.showProp;
|
6801 | if (showProp) {
|
6802 | return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
6803 | }
|
6804 | return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
6805 | };
|
6806 |
|
6807 | Animate.prototype.stop = function stop(key) {
|
6808 | delete this.currentlyAnimatingKeys[key];
|
6809 | var component = this.refs[key];
|
6810 | if (component) {
|
6811 | component.stop();
|
6812 | }
|
6813 | };
|
6814 |
|
6815 | Animate.prototype.render = function render() {
|
6816 | var props = this.props;
|
6817 | this.nextProps = props;
|
6818 | var stateChildren = this.state.children;
|
6819 | var children = null;
|
6820 | if (stateChildren) {
|
6821 | children = stateChildren.map(function (child) {
|
6822 | if (child === null || child === undefined) {
|
6823 | return child;
|
6824 | }
|
6825 | if (!child.key) {
|
6826 | throw new Error('must set key for <rc-animate> children');
|
6827 | }
|
6828 | return _react2["default"].createElement(
|
6829 | _AnimateChild2["default"],
|
6830 | {
|
6831 | key: child.key,
|
6832 | ref: child.key,
|
6833 | animation: props.animation,
|
6834 | transitionName: props.transitionName,
|
6835 | transitionEnter: props.transitionEnter,
|
6836 | transitionAppear: props.transitionAppear,
|
6837 | transitionLeave: props.transitionLeave
|
6838 | },
|
6839 | child
|
6840 | );
|
6841 | });
|
6842 | }
|
6843 | var Component = props.component;
|
6844 | if (Component) {
|
6845 | var passedProps = props;
|
6846 | if (typeof Component === 'string') {
|
6847 | passedProps = {
|
6848 | className: props.className,
|
6849 | style: props.style
|
6850 | };
|
6851 | }
|
6852 | return _react2["default"].createElement(
|
6853 | Component,
|
6854 | passedProps,
|
6855 | children
|
6856 | );
|
6857 | }
|
6858 | return children[0] || null;
|
6859 | };
|
6860 |
|
6861 | return Animate;
|
6862 | }(_react.Component);
|
6863 |
|
6864 | ;
|
6865 | Animate.defaultProps = defaultProps;
|
6866 | Animate.propTypes = Animate.propTypes;
|
6867 |
|
6868 | exports["default"] = Animate;
|
6869 | module.exports = exports['default'];
|
6870 |
|
6871 | }),
|
6872 |
|
6873 | (function(module, exports, __webpack_require__) {
|
6874 |
|
6875 | 'use strict';
|
6876 |
|
6877 | Object.defineProperty(exports, "__esModule", {
|
6878 | value: true
|
6879 | });
|
6880 | exports.toArrayChildren = toArrayChildren;
|
6881 | exports.findChildInChildrenByKey = findChildInChildrenByKey;
|
6882 | exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey;
|
6883 | exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey;
|
6884 | exports.isSameChildren = isSameChildren;
|
6885 | exports.mergeChildren = mergeChildren;
|
6886 |
|
6887 | var _react = __webpack_require__(4);
|
6888 |
|
6889 | var _react2 = _interopRequireDefault(_react);
|
6890 |
|
6891 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6892 |
|
6893 | function toArrayChildren(children) {
|
6894 | var ret = [];
|
6895 | _react2["default"].Children.forEach(children, function (child) {
|
6896 | ret.push(child);
|
6897 | });
|
6898 | return ret;
|
6899 | }
|
6900 |
|
6901 | function findChildInChildrenByKey(children, key) {
|
6902 | var ret = null;
|
6903 | if (children) {
|
6904 | children.forEach(function (child) {
|
6905 | if (ret) {
|
6906 | return;
|
6907 | }
|
6908 | if (child && child.key === key) {
|
6909 | ret = child;
|
6910 | }
|
6911 | });
|
6912 | }
|
6913 | return ret;
|
6914 | }
|
6915 |
|
6916 | function findShownChildInChildrenByKey(children, key, showProp) {
|
6917 | var ret = null;
|
6918 | if (children) {
|
6919 | children.forEach(function (child) {
|
6920 | if (child && child.key === key && child.props[showProp]) {
|
6921 | if (ret) {
|
6922 | throw new Error('two child with same key for <rc-animate> children');
|
6923 | }
|
6924 | ret = child;
|
6925 | }
|
6926 | });
|
6927 | }
|
6928 | return ret;
|
6929 | }
|
6930 |
|
6931 | function findHiddenChildInChildrenByKey(children, key, showProp) {
|
6932 | var found = 0;
|
6933 | if (children) {
|
6934 | children.forEach(function (child) {
|
6935 | if (found) {
|
6936 | return;
|
6937 | }
|
6938 | found = child && child.key === key && !child.props[showProp];
|
6939 | });
|
6940 | }
|
6941 | return found;
|
6942 | }
|
6943 |
|
6944 | function isSameChildren(c1, c2, showProp) {
|
6945 | var same = c1.length === c2.length;
|
6946 | if (same) {
|
6947 | c1.forEach(function (child, index) {
|
6948 | var child2 = c2[index];
|
6949 | if (child && child2) {
|
6950 | if (child && !child2 || !child && child2) {
|
6951 | same = false;
|
6952 | } else if (child.key !== child2.key) {
|
6953 | same = false;
|
6954 | } else if (showProp && child.props[showProp] !== child2.props[showProp]) {
|
6955 | same = false;
|
6956 | }
|
6957 | }
|
6958 | });
|
6959 | }
|
6960 | return same;
|
6961 | }
|
6962 |
|
6963 | function mergeChildren(prev, next) {
|
6964 | var ret = [];
|
6965 |
|
6966 |
|
6967 |
|
6968 | var nextChildrenPending = {};
|
6969 | var pendingChildren = [];
|
6970 | prev.forEach(function (child) {
|
6971 | if (child && findChildInChildrenByKey(next, child.key)) {
|
6972 | if (pendingChildren.length) {
|
6973 | nextChildrenPending[child.key] = pendingChildren;
|
6974 | pendingChildren = [];
|
6975 | }
|
6976 | } else {
|
6977 | pendingChildren.push(child);
|
6978 | }
|
6979 | });
|
6980 |
|
6981 | next.forEach(function (child) {
|
6982 | if (child && nextChildrenPending.hasOwnProperty(child.key)) {
|
6983 | ret = ret.concat(nextChildrenPending[child.key]);
|
6984 | }
|
6985 | ret.push(child);
|
6986 | });
|
6987 |
|
6988 | ret = ret.concat(pendingChildren);
|
6989 |
|
6990 | return ret;
|
6991 | }
|
6992 |
|
6993 | }),
|
6994 |
|
6995 | (function(module, exports, __webpack_require__) {
|
6996 |
|
6997 | 'use strict';
|
6998 |
|
6999 | Object.defineProperty(exports, "__esModule", {
|
7000 | value: true
|
7001 | });
|
7002 |
|
7003 | 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; };
|
7004 |
|
7005 | var _react = __webpack_require__(4);
|
7006 |
|
7007 | var _react2 = _interopRequireDefault(_react);
|
7008 |
|
7009 | var _propTypes = __webpack_require__(5);
|
7010 |
|
7011 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7012 |
|
7013 | var _reactDom = __webpack_require__(12);
|
7014 |
|
7015 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7016 |
|
7017 | var _tinperBeeCore = __webpack_require__(27);
|
7018 |
|
7019 | var _util = __webpack_require__(73);
|
7020 |
|
7021 | var _util2 = _interopRequireDefault(_util);
|
7022 |
|
7023 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7024 |
|
7025 | 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; }
|
7026 |
|
7027 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7028 |
|
7029 | 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; }
|
7030 |
|
7031 | 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); }
|
7032 |
|
7033 | var transitionMap = {
|
7034 | enter: 'transitionEnter',
|
7035 | appear: 'transitionAppear',
|
7036 | leave: 'transitionLeave'
|
7037 | };
|
7038 |
|
7039 | var propTypes = {
|
7040 | children: _propTypes2["default"].any
|
7041 | };
|
7042 |
|
7043 | var AnimateChild = function (_Component) {
|
7044 | _inherits(AnimateChild, _Component);
|
7045 |
|
7046 | function AnimateChild(props) {
|
7047 | _classCallCheck(this, AnimateChild);
|
7048 |
|
7049 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
7050 |
|
7051 | _this.transition = _this.transition.bind(_this);
|
7052 | _this.stop = _this.stop.bind(_this);
|
7053 | return _this;
|
7054 | }
|
7055 |
|
7056 | AnimateChild.prototype.componentWillUnmount = function componentWillUnmount() {
|
7057 | this.stop();
|
7058 | };
|
7059 |
|
7060 | AnimateChild.prototype.componentWillEnter = function componentWillEnter(done) {
|
7061 | if (_util2["default"].isEnterSupported(this.props)) {
|
7062 | this.transition('enter', done);
|
7063 | } else {
|
7064 | done();
|
7065 | }
|
7066 | };
|
7067 |
|
7068 | AnimateChild.prototype.componentWillAppear = function componentWillAppear(done) {
|
7069 | if (_util2["default"].isAppearSupported(this.props)) {
|
7070 | this.transition('appear', done);
|
7071 | } else {
|
7072 | done();
|
7073 | }
|
7074 | };
|
7075 |
|
7076 | AnimateChild.prototype.componentWillLeave = function componentWillLeave(done) {
|
7077 | if (_util2["default"].isLeaveSupported(this.props)) {
|
7078 | this.transition('leave', done);
|
7079 | } else {
|
7080 |
|
7081 |
|
7082 |
|
7083 | done();
|
7084 | }
|
7085 | };
|
7086 |
|
7087 | AnimateChild.prototype.transition = function transition(animationType, finishCallback) {
|
7088 | var _this2 = this;
|
7089 |
|
7090 | var node = _reactDom2["default"].findDOMNode(this);
|
7091 | var props = this.props;
|
7092 | var transitionName = props.transitionName;
|
7093 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
|
7094 | this.stop();
|
7095 | var end = function end() {
|
7096 | _this2.stopper = null;
|
7097 | finishCallback();
|
7098 | };
|
7099 | if ((_tinperBeeCore.cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {
|
7100 | var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType;
|
7101 | var activeName = name + '-active';
|
7102 | if (nameIsObj && transitionName[animationType + 'Active']) {
|
7103 | activeName = transitionName[animationType + 'Active'];
|
7104 | }
|
7105 | this.stopper = (0, _tinperBeeCore.cssAnimation)(node, {
|
7106 | name: name,
|
7107 | active: activeName
|
7108 | }, end);
|
7109 | } else {
|
7110 | this.stopper = props.animation[animationType](node, end);
|
7111 | }
|
7112 | };
|
7113 |
|
7114 | AnimateChild.prototype.stop = function stop() {
|
7115 | var stopper = this.stopper;
|
7116 | if (stopper) {
|
7117 | this.stopper = null;
|
7118 | stopper.stop();
|
7119 | }
|
7120 | };
|
7121 |
|
7122 | AnimateChild.prototype.render = function render() {
|
7123 | return this.props.children;
|
7124 | };
|
7125 |
|
7126 | return AnimateChild;
|
7127 | }(_react.Component);
|
7128 |
|
7129 | ;
|
7130 |
|
7131 | AnimateChild.propTypes = propTypes;
|
7132 |
|
7133 | exports["default"] = AnimateChild;
|
7134 | module.exports = exports['default'];
|
7135 |
|
7136 | }),
|
7137 |
|
7138 | (function(module, exports) {
|
7139 |
|
7140 | "use strict";
|
7141 |
|
7142 | Object.defineProperty(exports, "__esModule", {
|
7143 | value: true
|
7144 | });
|
7145 | var util = {
|
7146 | isAppearSupported: function isAppearSupported(props) {
|
7147 | return props.transitionName && props.transitionAppear || props.animation.appear;
|
7148 | },
|
7149 | isEnterSupported: function isEnterSupported(props) {
|
7150 | return props.transitionName && props.transitionEnter || props.animation.enter;
|
7151 | },
|
7152 | isLeaveSupported: function isLeaveSupported(props) {
|
7153 | return props.transitionName && props.transitionLeave || props.animation.leave;
|
7154 | },
|
7155 | allowAppearCallback: function allowAppearCallback(props) {
|
7156 | return props.transitionAppear || props.animation.appear;
|
7157 | },
|
7158 | allowEnterCallback: function allowEnterCallback(props) {
|
7159 | return props.transitionEnter || props.animation.enter;
|
7160 | },
|
7161 | allowLeaveCallback: function allowLeaveCallback(props) {
|
7162 | return props.transitionLeave || props.animation.leave;
|
7163 | }
|
7164 | };
|
7165 | exports["default"] = util;
|
7166 | module.exports = exports["default"];
|
7167 |
|
7168 | }),
|
7169 |
|
7170 | (function(module, exports, __webpack_require__) {
|
7171 |
|
7172 | 'use strict';
|
7173 |
|
7174 | Object.defineProperty(exports, "__esModule", {
|
7175 | value: true
|
7176 | });
|
7177 |
|
7178 | var _react = __webpack_require__(4);
|
7179 |
|
7180 | var _react2 = _interopRequireDefault(_react);
|
7181 |
|
7182 | var _classnames = __webpack_require__(3);
|
7183 |
|
7184 | var _classnames2 = _interopRequireDefault(_classnames);
|
7185 |
|
7186 | var _propTypes = __webpack_require__(5);
|
7187 |
|
7188 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7189 |
|
7190 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7191 |
|
7192 | 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; }
|
7193 |
|
7194 | 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; }
|
7195 |
|
7196 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7197 |
|
7198 | 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; }
|
7199 |
|
7200 | 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); }
|
7201 |
|
7202 | var propTypes = {
|
7203 | duration: _propTypes2["default"].number,
|
7204 | onClose: _propTypes2["default"].func,
|
7205 | children: _propTypes2["default"].any,
|
7206 | color: _propTypes2["default"].oneOf(['info', 'success', 'danger', 'warning', 'light', 'dark', 'news', 'infolight', 'successlight', 'dangerlight', 'warninglight']),
|
7207 | title: _propTypes2["default"].any
|
7208 | };
|
7209 |
|
7210 | function noop() {}
|
7211 |
|
7212 | var defaultProps = {
|
7213 | onEnd: noop,
|
7214 | onClose: noop,
|
7215 | duration: 4.5,
|
7216 | closable: true
|
7217 | };
|
7218 |
|
7219 | var Notice = function (_React$Component) {
|
7220 | _inherits(Notice, _React$Component);
|
7221 |
|
7222 | function Notice(props) {
|
7223 | _classCallCheck(this, Notice);
|
7224 |
|
7225 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
7226 |
|
7227 | _this.clearCloseTimer = _this.clearCloseTimer.bind(_this);
|
7228 | _this.close = _this.close.bind(_this);
|
7229 | return _this;
|
7230 | }
|
7231 |
|
7232 | Notice.prototype.componentDidMount = function componentDidMount() {
|
7233 | var _this2 = this;
|
7234 |
|
7235 | if (this.props.duration) {
|
7236 | this.closeTimer = setTimeout(function () {
|
7237 | _this2.close();
|
7238 | }, this.props.duration * 1000);
|
7239 | }
|
7240 | };
|
7241 |
|
7242 | Notice.prototype.componentWillUnmount = function componentWillUnmount() {
|
7243 | this.clearCloseTimer();
|
7244 | };
|
7245 |
|
7246 | Notice.prototype.clearCloseTimer = function clearCloseTimer() {
|
7247 | if (this.closeTimer) {
|
7248 | clearTimeout(this.closeTimer);
|
7249 | this.closeTimer = null;
|
7250 | }
|
7251 | };
|
7252 |
|
7253 | Notice.prototype.close = function close() {
|
7254 | this.clearCloseTimer();
|
7255 | this.props.onClose();
|
7256 | };
|
7257 |
|
7258 | Notice.prototype.render = function render() {
|
7259 | var _classes;
|
7260 |
|
7261 | var _props = this.props,
|
7262 | closable = _props.closable,
|
7263 | clsPrefix = _props.clsPrefix,
|
7264 | className = _props.className,
|
7265 | style = _props.style,
|
7266 | children = _props.children,
|
7267 | color = _props.color,
|
7268 | title = _props.title;
|
7269 |
|
7270 | var componentClass = clsPrefix + '-notice';
|
7271 | var classes = (_classes = {}, _defineProperty(_classes, '' + componentClass, 1), _defineProperty(_classes, componentClass + '-closable', closable), _defineProperty(_classes, className, !!className), _classes);
|
7272 | if (color) {
|
7273 | classes[componentClass + '-' + color] = true;
|
7274 | }
|
7275 | return _react2["default"].createElement(
|
7276 | 'div',
|
7277 | { className: (0, _classnames2["default"])(classes), style: style, onClick: this.close },
|
7278 | _react2["default"].createElement(
|
7279 | 'div',
|
7280 | { className: componentClass + '-content' },
|
7281 | title && _react2["default"].createElement(
|
7282 | 'div',
|
7283 | { className: componentClass + '-title' },
|
7284 | title
|
7285 | ),
|
7286 | _react2["default"].createElement(
|
7287 | 'div',
|
7288 | { className: componentClass + '-description' },
|
7289 | children
|
7290 | )
|
7291 | ),
|
7292 | closable ? _react2["default"].createElement(
|
7293 | 'a',
|
7294 | { tabIndex: '0', onClick: this.close, className: componentClass + '-close' },
|
7295 | _react2["default"].createElement('span', { className: componentClass + '-close-x' })
|
7296 | ) : null
|
7297 | );
|
7298 | };
|
7299 |
|
7300 | return Notice;
|
7301 | }(_react2["default"].Component);
|
7302 |
|
7303 | ;
|
7304 |
|
7305 | Notice.propTypes = propTypes;
|
7306 | Notice.defaultProps = defaultProps;
|
7307 |
|
7308 | exports["default"] = Notice;
|
7309 | module.exports = exports['default'];
|
7310 |
|
7311 | }),
|
7312 |
|
7313 | (function(module, exports, __webpack_require__) {
|
7314 |
|
7315 | 'use strict';
|
7316 |
|
7317 | var deselectCurrent = __webpack_require__(76);
|
7318 |
|
7319 | var defaultMessage = 'Copy to clipboard: #{key}, Enter';
|
7320 |
|
7321 | function format(message) {
|
7322 | var copyKey = (/mac os x/i.test(navigator.userAgent) ? '⌘' : 'Ctrl') + '+C';
|
7323 | return message.replace(/#{\s*key\s*}/g, copyKey);
|
7324 | }
|
7325 |
|
7326 | function copy(text, options) {
|
7327 | var debug, message, reselectPrevious, range, selection, mark, success = false;
|
7328 | if (!options) { options = {}; }
|
7329 | debug = options.debug || false;
|
7330 | try {
|
7331 | reselectPrevious = deselectCurrent();
|
7332 |
|
7333 | range = document.createRange();
|
7334 | selection = document.getSelection();
|
7335 |
|
7336 | mark = document.createElement('span');
|
7337 | mark.textContent = text;
|
7338 |
|
7339 | mark.style.all = 'unset';
|
7340 |
|
7341 | mark.style.position = 'fixed';
|
7342 | mark.style.top = 0;
|
7343 | mark.style.clip = 'rect(0, 0, 0, 0)';
|
7344 |
|
7345 | mark.style.whiteSpace = 'pre';
|
7346 |
|
7347 | mark.style.webkitUserSelect = 'text';
|
7348 | mark.style.MozUserSelect = 'text';
|
7349 | mark.style.msUserSelect = 'text';
|
7350 | mark.style.userSelect = 'text';
|
7351 |
|
7352 | document.body.appendChild(mark);
|
7353 |
|
7354 | range.selectNode(mark);
|
7355 | selection.addRange(range);
|
7356 |
|
7357 | var successful = document.execCommand('copy');
|
7358 | if (!successful) {
|
7359 | throw new Error('copy command was unsuccessful');
|
7360 | }
|
7361 | success = true;
|
7362 | } catch (err) {
|
7363 | debug && console.error('unable to copy using execCommand: ', err);
|
7364 | debug && console.warn('trying IE specific stuff');
|
7365 | try {
|
7366 | window.clipboardData.setData('text', text);
|
7367 | success = true;
|
7368 | } catch (err) {
|
7369 | debug && console.error('unable to copy using clipboardData: ', err);
|
7370 | debug && console.error('falling back to prompt');
|
7371 | message = format('message' in options ? options.message : defaultMessage);
|
7372 | window.prompt(message, text);
|
7373 | }
|
7374 | } finally {
|
7375 | if (selection) {
|
7376 | if (typeof selection.removeRange == 'function') {
|
7377 | selection.removeRange(range);
|
7378 | } else {
|
7379 | selection.removeAllRanges();
|
7380 | }
|
7381 | }
|
7382 |
|
7383 | if (mark) {
|
7384 | document.body.removeChild(mark);
|
7385 | }
|
7386 | reselectPrevious();
|
7387 | }
|
7388 |
|
7389 | return success;
|
7390 | }
|
7391 |
|
7392 | module.exports = copy;
|
7393 |
|
7394 |
|
7395 | }),
|
7396 |
|
7397 | (function(module, exports) {
|
7398 |
|
7399 |
|
7400 | module.exports = function () {
|
7401 | var selection = document.getSelection();
|
7402 | if (!selection.rangeCount) {
|
7403 | return function () {};
|
7404 | }
|
7405 | var active = document.activeElement;
|
7406 |
|
7407 | var ranges = [];
|
7408 | for (var i = 0; i < selection.rangeCount; i++) {
|
7409 | ranges.push(selection.getRangeAt(i));
|
7410 | }
|
7411 |
|
7412 | switch (active.tagName.toUpperCase()) {
|
7413 | case 'INPUT':
|
7414 | case 'TEXTAREA':
|
7415 | active.blur();
|
7416 | break;
|
7417 |
|
7418 | default:
|
7419 | active = null;
|
7420 | break;
|
7421 | }
|
7422 |
|
7423 | selection.removeAllRanges();
|
7424 | return function () {
|
7425 | selection.type === 'Caret' &&
|
7426 | selection.removeAllRanges();
|
7427 |
|
7428 | if (!selection.rangeCount) {
|
7429 | ranges.forEach(function(range) {
|
7430 | selection.addRange(range);
|
7431 | });
|
7432 | }
|
7433 |
|
7434 | active &&
|
7435 | active.focus();
|
7436 | };
|
7437 | };
|
7438 |
|
7439 |
|
7440 | }),
|
7441 |
|
7442 | (function(module, exports, __webpack_require__) {
|
7443 |
|
7444 | 'use strict';
|
7445 |
|
7446 | Object.defineProperty(exports, "__esModule", {
|
7447 | value: true
|
7448 | });
|
7449 |
|
7450 | 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; };
|
7451 |
|
7452 | var _classnames = __webpack_require__(3);
|
7453 |
|
7454 | var _classnames2 = _interopRequireDefault(_classnames);
|
7455 |
|
7456 | var _react = __webpack_require__(4);
|
7457 |
|
7458 | var _react2 = _interopRequireDefault(_react);
|
7459 |
|
7460 | var _propTypes = __webpack_require__(5);
|
7461 |
|
7462 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7463 |
|
7464 | var _tinperBeeCore = __webpack_require__(27);
|
7465 |
|
7466 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7467 |
|
7468 | 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; }
|
7469 |
|
7470 | 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; }
|
7471 |
|
7472 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7473 |
|
7474 | 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; }
|
7475 |
|
7476 | 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); }
|
7477 |
|
7478 | var propTypes = {
|
7479 |
|
7480 | accordion: _propTypes2["default"].bool,
|
7481 |
|
7482 | activeKey: _propTypes2["default"].any,
|
7483 |
|
7484 | defaultActiveKey: _propTypes2["default"].any,
|
7485 |
|
7486 | onSelect: _propTypes2["default"].func,
|
7487 | role: _propTypes2["default"].string
|
7488 | };
|
7489 |
|
7490 | var defaultProps = {
|
7491 | accordion: false,
|
7492 | clsPrefix: 'u-panel-group'
|
7493 | };
|
7494 |
|
7495 |
|
7496 |
|
7497 | var PanelGroup = function (_React$Component) {
|
7498 | _inherits(PanelGroup, _React$Component);
|
7499 |
|
7500 | function PanelGroup(props, context) {
|
7501 | _classCallCheck(this, PanelGroup);
|
7502 |
|
7503 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
7504 |
|
7505 | _this.handleSelect = _this.handleSelect.bind(_this);
|
7506 |
|
7507 | _this.state = {
|
7508 | activeKey: props.defaultActiveKey
|
7509 | };
|
7510 | return _this;
|
7511 | }
|
7512 |
|
7513 | PanelGroup.prototype.handleSelect = function handleSelect(key, e) {
|
7514 | e.preventDefault();
|
7515 |
|
7516 | if (this.props.onSelect) {
|
7517 | this.props.onSelect(key, e);
|
7518 | }
|
7519 |
|
7520 | if (this.state.activeKey === key) {
|
7521 | key = null;
|
7522 | }
|
7523 |
|
7524 | this.setState({ activeKey: key });
|
7525 | };
|
7526 |
|
7527 | PanelGroup.prototype.render = function render() {
|
7528 | var _this2 = this;
|
7529 |
|
7530 | var _props = this.props,
|
7531 | accordion = _props.accordion,
|
7532 | propsActiveKey = _props.activeKey,
|
7533 | className = _props.className,
|
7534 | children = _props.children,
|
7535 | defaultActiveKey = _props.defaultActiveKey,
|
7536 | onSelect = _props.onSelect,
|
7537 | style = _props.style,
|
7538 | clsPrefix = _props.clsPrefix,
|
7539 | others = _objectWithoutProperties(_props, ['accordion', 'activeKey', 'className', 'children', 'defaultActiveKey', 'onSelect', 'style', 'clsPrefix']);
|
7540 |
|
7541 | var activeKey = void 0;
|
7542 | if (accordion) {
|
7543 | activeKey = propsActiveKey != null ? propsActiveKey : this.state.activeKey;
|
7544 | others.role = others.role || 'tablist';
|
7545 | }
|
7546 |
|
7547 | var classes = {};
|
7548 | classes['' + clsPrefix] = true;
|
7549 |
|
7550 | return _react2["default"].createElement(
|
7551 | 'div',
|
7552 | _extends({}, others, {
|
7553 | className: (0, _classnames2["default"])(className, classes)
|
7554 | }),
|
7555 | _react2["default"].Children.map(children, function (child) {
|
7556 | if (!_react2["default"].isValidElement(child)) {
|
7557 | return child;
|
7558 | }
|
7559 | var childProps = {
|
7560 | style: child.props.style
|
7561 | };
|
7562 |
|
7563 | if (accordion) {
|
7564 | _extends(childProps, {
|
7565 | headerRole: 'tab',
|
7566 | panelRole: 'tabpanel',
|
7567 | collapsible: true,
|
7568 | expanded: child.props.eventKey === activeKey,
|
7569 | onSelect: (0, _tinperBeeCore.createChainedFunction)(_this2.handleSelect, child.props.onSelect)
|
7570 | });
|
7571 | }
|
7572 |
|
7573 | return (0, _react.cloneElement)(child, childProps);
|
7574 | })
|
7575 | );
|
7576 | };
|
7577 |
|
7578 | return PanelGroup;
|
7579 | }(_react2["default"].Component);
|
7580 |
|
7581 | PanelGroup.propTypes = propTypes;
|
7582 | PanelGroup.defaultProps = defaultProps;
|
7583 |
|
7584 | exports["default"] = PanelGroup;
|
7585 | module.exports = exports['default'];
|
7586 |
|
7587 | }),
|
7588 |
|
7589 | (function(module, exports, __webpack_require__) {
|
7590 |
|
7591 | 'use strict';
|
7592 |
|
7593 | Object.defineProperty(exports, "__esModule", {
|
7594 | value: true
|
7595 | });
|
7596 |
|
7597 | var _Button = __webpack_require__(79);
|
7598 |
|
7599 | var _Button2 = _interopRequireDefault(_Button);
|
7600 |
|
7601 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7602 |
|
7603 | exports["default"] = _Button2["default"];
|
7604 | module.exports = exports['default'];
|
7605 |
|
7606 | }),
|
7607 |
|
7608 | (function(module, exports, __webpack_require__) {
|
7609 |
|
7610 | 'use strict';
|
7611 |
|
7612 | Object.defineProperty(exports, "__esModule", {
|
7613 | value: true
|
7614 | });
|
7615 |
|
7616 | 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; };
|
7617 |
|
7618 | var _react = __webpack_require__(4);
|
7619 |
|
7620 | var _react2 = _interopRequireDefault(_react);
|
7621 |
|
7622 | var _reactDom = __webpack_require__(12);
|
7623 |
|
7624 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7625 |
|
7626 | var _propTypes = __webpack_require__(5);
|
7627 |
|
7628 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7629 |
|
7630 | var _classnames = __webpack_require__(3);
|
7631 |
|
7632 | var _classnames2 = _interopRequireDefault(_classnames);
|
7633 |
|
7634 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7635 |
|
7636 | 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; }
|
7637 |
|
7638 | 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; }
|
7639 |
|
7640 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7641 |
|
7642 | 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; }
|
7643 |
|
7644 | 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); }
|
7645 |
|
7646 | var propTypes = {
|
7647 | |
7648 |
|
7649 |
|
7650 | size: _propTypes2["default"].oneOf(['sm', 'xg', 'lg']),
|
7651 | |
7652 |
|
7653 |
|
7654 | style: _propTypes2["default"].object,
|
7655 | |
7656 |
|
7657 |
|
7658 | shape: _propTypes2["default"].oneOf(['block', 'round', 'border', 'squared', 'floating', 'pillRight', 'pillLeft', 'icon']),
|
7659 |
|
7660 | bordered: _propTypes2["default"].bool,
|
7661 | |
7662 |
|
7663 |
|
7664 | colors: _propTypes2["default"].oneOf(['primary', 'accent', 'success', 'info', 'warning', 'danger', 'default']),
|
7665 | |
7666 |
|
7667 |
|
7668 |
|
7669 | disabled: _propTypes2["default"].bool,
|
7670 | |
7671 |
|
7672 |
|
7673 |
|
7674 | className: _propTypes2["default"].string,
|
7675 |
|
7676 | |
7677 |
|
7678 |
|
7679 |
|
7680 | htmlType: _propTypes2["default"].oneOf(['submit', 'button', 'reset']),
|
7681 | isSubmit: _propTypes2["default"].bool
|
7682 | };
|
7683 |
|
7684 | var defaultProps = {
|
7685 | disabled: false,
|
7686 | htmlType: 'button',
|
7687 | clsPrefix: 'u-button',
|
7688 | bordered: false,
|
7689 | isSubmit: false
|
7690 | };
|
7691 |
|
7692 | var sizeMap = {
|
7693 | sm: 'sm',
|
7694 | xg: 'xg',
|
7695 | lg: 'lg'
|
7696 | },
|
7697 | colorsMap = {
|
7698 | primary: 'primary',
|
7699 | accent: 'accent',
|
7700 | success: 'success',
|
7701 | info: 'info',
|
7702 | warning: 'warning',
|
7703 | danger: 'danger'
|
7704 | },
|
7705 | shapeMap = {
|
7706 | block: 'block',
|
7707 | round: 'round',
|
7708 | border: 'border',
|
7709 | squared: 'squared',
|
7710 | floating: 'floating',
|
7711 | pillRight: 'pill-right',
|
7712 | pillLeft: 'pill-left',
|
7713 | icon: 'icon'
|
7714 | };
|
7715 |
|
7716 | var Button = function (_Component) {
|
7717 | _inherits(Button, _Component);
|
7718 |
|
7719 | function Button(props) {
|
7720 | _classCallCheck(this, Button);
|
7721 |
|
7722 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
7723 | }
|
7724 |
|
7725 | Button.prototype.render = function render() {
|
7726 | var _props = this.props,
|
7727 | colors = _props.colors,
|
7728 | shape = _props.shape,
|
7729 | disabled = _props.disabled,
|
7730 | className = _props.className,
|
7731 | size = _props.size,
|
7732 | bordered = _props.bordered,
|
7733 | children = _props.children,
|
7734 | htmlType = _props.htmlType,
|
7735 | clsPrefix = _props.clsPrefix,
|
7736 | isSubmit = _props.isSubmit,
|
7737 | others = _objectWithoutProperties(_props, ['colors', 'shape', 'disabled', 'className', 'size', 'bordered', 'children', 'htmlType', 'clsPrefix', 'isSubmit']);
|
7738 |
|
7739 | var clsObj = {};
|
7740 | if (className) {
|
7741 | clsObj[className] = true;
|
7742 | }
|
7743 | if (sizeMap[size]) {
|
7744 | clsObj[clsPrefix + '-' + sizeMap[size]] = true;
|
7745 | }
|
7746 |
|
7747 | if (shapeMap[shape]) {
|
7748 | clsObj[clsPrefix + '-' + shapeMap[shape]] = true;
|
7749 | }
|
7750 | if (colorsMap[colors]) {
|
7751 | clsObj[clsPrefix + '-' + colorsMap[colors]] = true;
|
7752 | }
|
7753 |
|
7754 | var classes = (0, _classnames2["default"])(clsPrefix, clsObj);
|
7755 | return _react2["default"].createElement(
|
7756 | 'button',
|
7757 | _extends({
|
7758 | type: htmlType,
|
7759 | className: classes,
|
7760 | disabled: disabled
|
7761 | }, others),
|
7762 | this.props.children
|
7763 | );
|
7764 | };
|
7765 |
|
7766 | return Button;
|
7767 | }(_react.Component);
|
7768 |
|
7769 | Button.propTypes = propTypes;
|
7770 | Button.defaultProps = defaultProps;
|
7771 |
|
7772 | exports["default"] = Button;
|
7773 | module.exports = exports['default'];
|
7774 |
|
7775 | }),
|
7776 |
|
7777 | (function(module, exports, __webpack_require__) {
|
7778 |
|
7779 | 'use strict';
|
7780 |
|
7781 | Object.defineProperty(exports, "__esModule", {
|
7782 | value: true
|
7783 | });
|
7784 |
|
7785 | var _react = __webpack_require__(4);
|
7786 |
|
7787 | var _react2 = _interopRequireDefault(_react);
|
7788 |
|
7789 | var _index = __webpack_require__(81);
|
7790 |
|
7791 | var _index2 = _interopRequireDefault(_index);
|
7792 |
|
7793 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
7794 |
|
7795 | 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; }
|
7796 |
|
7797 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7798 |
|
7799 | 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; }
|
7800 |
|
7801 | 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); }
|
7802 | |
7803 |
|
7804 |
|
7805 |
|
7806 |
|
7807 |
|
7808 |
|
7809 | var Demo1 = function (_Component) {
|
7810 | _inherits(Demo1, _Component);
|
7811 |
|
7812 | function Demo1() {
|
7813 | var _temp, _this, _ret;
|
7814 |
|
7815 | _classCallCheck(this, Demo1);
|
7816 |
|
7817 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
7818 | args[_key] = arguments[_key];
|
7819 | }
|
7820 |
|
7821 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
7822 | console.log('start');
|
7823 | }, _this.onStop = function () {
|
7824 | console.log('stop');
|
7825 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
7826 | }
|
7827 |
|
7828 | Demo1.prototype.render = function render() {
|
7829 | return _react2['default'].createElement(
|
7830 | 'div',
|
7831 | null,
|
7832 | _react2['default'].createElement(
|
7833 | _index2['default'],
|
7834 | { onStart: this.onStart, onStop: this.onStop },
|
7835 | _react2['default'].createElement(
|
7836 | 'div',
|
7837 | { className: 'demo' },
|
7838 | '\u6211\u53EF\u968F\u610F\u62D6\u62FD'
|
7839 | )
|
7840 | )
|
7841 | );
|
7842 | };
|
7843 |
|
7844 | return Demo1;
|
7845 | }(_react.Component);
|
7846 |
|
7847 | exports['default'] = Demo1;
|
7848 | module.exports = exports['default'];
|
7849 |
|
7850 | }),
|
7851 |
|
7852 | (function(module, exports, __webpack_require__) {
|
7853 |
|
7854 | 'use strict';
|
7855 |
|
7856 | Object.defineProperty(exports, "__esModule", {
|
7857 | value: true
|
7858 | });
|
7859 |
|
7860 | var _Dnd = __webpack_require__(82);
|
7861 |
|
7862 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
7863 |
|
7864 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
7865 |
|
7866 | exports['default'] = _Dnd2['default'];
|
7867 | module.exports = exports['default'];
|
7868 |
|
7869 | }),
|
7870 |
|
7871 | (function(module, exports, __webpack_require__) {
|
7872 |
|
7873 | 'use strict';
|
7874 |
|
7875 | Object.defineProperty(exports, "__esModule", {
|
7876 | value: true
|
7877 | });
|
7878 |
|
7879 | 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; };
|
7880 |
|
7881 | var _react = __webpack_require__(4);
|
7882 |
|
7883 | var _react2 = _interopRequireDefault(_react);
|
7884 |
|
7885 | var _reactBeautifulDnd = __webpack_require__(83);
|
7886 |
|
7887 | var _reactDraggable = __webpack_require__(182);
|
7888 |
|
7889 | var _reactDraggable2 = _interopRequireDefault(_reactDraggable);
|
7890 |
|
7891 | var _propTypes = __webpack_require__(5);
|
7892 |
|
7893 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7894 |
|
7895 | var _lodash = __webpack_require__(183);
|
7896 |
|
7897 | var _lodash2 = _interopRequireDefault(_lodash);
|
7898 |
|
7899 | var _SortList = __webpack_require__(184);
|
7900 |
|
7901 | var _SortList2 = _interopRequireDefault(_SortList);
|
7902 |
|
7903 | var _Between = __webpack_require__(186);
|
7904 |
|
7905 | var _Between2 = _interopRequireDefault(_Between);
|
7906 |
|
7907 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
7908 |
|
7909 | 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; }
|
7910 |
|
7911 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7912 |
|
7913 | 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; }
|
7914 |
|
7915 | 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); }
|
7916 |
|
7917 | var propTypes = {
|
7918 | onStart: _propTypes2['default'].func,
|
7919 | onDrag: _propTypes2['default'].func,
|
7920 | onStop: _propTypes2['default'].func,
|
7921 | onDragUpdate: _propTypes2['default'].func,
|
7922 | dropClass: _propTypes2['default'].string,
|
7923 | dropOverClass: _propTypes2['default'].string,
|
7924 | dragClass: _propTypes2['default'].string,
|
7925 | dragingClass: _propTypes2['default'].string,
|
7926 | draggedClass: _propTypes2['default'].string,
|
7927 | className: _propTypes2['default'].string,
|
7928 | style: _propTypes2['default'].object,
|
7929 | list: _propTypes2['default'].array,
|
7930 | otherList: _propTypes2['default'].array,
|
7931 | type: _propTypes2['default'].oneOf(['vertical', 'horizontal', 'betweenVertical', 'betweenHorizontal']),
|
7932 | showKey: _propTypes2['default'].string
|
7933 |
|
7934 | };
|
7935 | var defaultProps = {
|
7936 | onStart: function onStart() {},
|
7937 | onDrag: function onDrag() {},
|
7938 | onStop: function onStop() {},
|
7939 | onDragUpdate: function onDragUpdate() {},
|
7940 | list: false,
|
7941 | otherList: [],
|
7942 | dropClass: '',
|
7943 | dropOverClass: '',
|
7944 | dragClass: '',
|
7945 | dragingClass: '',
|
7946 | draggedClass: '',
|
7947 | type: 'vertical'
|
7948 | };
|
7949 |
|
7950 | var Dnd = function (_Component) {
|
7951 | _inherits(Dnd, _Component);
|
7952 |
|
7953 | function Dnd(props) {
|
7954 | _classCallCheck(this, Dnd);
|
7955 |
|
7956 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
7957 |
|
7958 | _this.state = {
|
7959 | items: _this.props.list || []
|
7960 | };
|
7961 | return _this;
|
7962 | }
|
7963 |
|
7964 | Dnd.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
7965 | if (!(0, _lodash2['default'])(this.state.items, nextProps.list)) {
|
7966 | this.setState({
|
7967 | items: nextProps.list
|
7968 | });
|
7969 | }
|
7970 | };
|
7971 |
|
7972 | Dnd.prototype.render = function render() {
|
7973 | var _this2 = this;
|
7974 |
|
7975 | var self = this;
|
7976 | var DndType = function DndType() {
|
7977 | switch (_this2.props.type) {
|
7978 | case 'vertical':
|
7979 | return _react2['default'].createElement(_SortList2['default'], _this2.props);
|
7980 | break;
|
7981 | case 'horizontal':
|
7982 | return _react2['default'].createElement(_SortList2['default'], _this2.props);
|
7983 | break;
|
7984 | case 'betweenVertical':
|
7985 | return _react2['default'].createElement(_Between2['default'], _this2.props);
|
7986 | break;
|
7987 | case 'betweenHorizontal':
|
7988 | return _react2['default'].createElement(_Between2['default'], _this2.props);
|
7989 | break;
|
7990 | default:
|
7991 | return _react2['default'].createElement(_SortList2['default'], _this2.props);
|
7992 | break;
|
7993 | }
|
7994 | };
|
7995 | return _react2['default'].createElement(
|
7996 | 'div',
|
7997 | null,
|
7998 | self.state.items.length ? DndType() : _react2['default'].createElement(
|
7999 | _reactDraggable2['default'],
|
8000 | _extends({ defaultClassName: this.props.dragClass,
|
8001 | defaultClassNameDragging: this.props.dragingClass,
|
8002 | defaultClassNameDragged: this.props.draggedClass
|
8003 | }, this.props),
|
8004 | self.props.children
|
8005 | )
|
8006 | );
|
8007 | };
|
8008 |
|
8009 | return Dnd;
|
8010 | }(_react.Component);
|
8011 |
|
8012 | Dnd.propTypes = propTypes;
|
8013 | Dnd.defaultProps = defaultProps;
|
8014 | Dnd.Drag = _reactDraggable2['default'];
|
8015 | Dnd.DragDropContext = _reactBeautifulDnd.DragDropContext;
|
8016 | Dnd.Droppable = _reactBeautifulDnd.Droppable;
|
8017 | Dnd.Draggable = _reactBeautifulDnd.Draggable;
|
8018 | exports['default'] = Dnd;
|
8019 | module.exports = exports['default'];
|
8020 |
|
8021 | }),
|
8022 |
|
8023 | (function(module, exports, __webpack_require__) {
|
8024 |
|
8025 | (function(process) {'use strict';
|
8026 |
|
8027 | Object.defineProperty(exports, '__esModule', { value: true });
|
8028 |
|
8029 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
8030 |
|
8031 | var _extends = _interopDefault(__webpack_require__(84));
|
8032 | var invariant = _interopDefault(__webpack_require__(123));
|
8033 | var cssBoxModel = __webpack_require__(124);
|
8034 | var _Object$keys = _interopDefault(__webpack_require__(125));
|
8035 | var memoizeOne = _interopDefault(__webpack_require__(129));
|
8036 | var redux = __webpack_require__(130);
|
8037 | var _Object$assign = _interopDefault(__webpack_require__(85));
|
8038 | var rafSchd = _interopDefault(__webpack_require__(134));
|
8039 | var _inheritsLoose = _interopDefault(__webpack_require__(135));
|
8040 | var React = __webpack_require__(4);
|
8041 | var React__default = _interopDefault(React);
|
8042 | var PropTypes = _interopDefault(__webpack_require__(5));
|
8043 | var reactRedux = __webpack_require__(142);
|
8044 | var reactMotion = __webpack_require__(168);
|
8045 |
|
8046 | var vertical = {
|
8047 | direction: 'vertical',
|
8048 | line: 'y',
|
8049 | crossAxisLine: 'x',
|
8050 | start: 'top',
|
8051 | end: 'bottom',
|
8052 | size: 'height',
|
8053 | crossAxisStart: 'left',
|
8054 | crossAxisEnd: 'right',
|
8055 | crossAxisSize: 'width'
|
8056 | };
|
8057 | var horizontal = {
|
8058 | direction: 'horizontal',
|
8059 | line: 'x',
|
8060 | crossAxisLine: 'y',
|
8061 | start: 'left',
|
8062 | end: 'right',
|
8063 | size: 'width',
|
8064 | crossAxisStart: 'top',
|
8065 | crossAxisEnd: 'bottom',
|
8066 | crossAxisSize: 'height'
|
8067 | };
|
8068 |
|
8069 | var origin = {
|
8070 | x: 0,
|
8071 | y: 0
|
8072 | };
|
8073 | var add = function add(point1, point2) {
|
8074 | return {
|
8075 | x: point1.x + point2.x,
|
8076 | y: point1.y + point2.y
|
8077 | };
|
8078 | };
|
8079 | var subtract = function subtract(point1, point2) {
|
8080 | return {
|
8081 | x: point1.x - point2.x,
|
8082 | y: point1.y - point2.y
|
8083 | };
|
8084 | };
|
8085 | var isEqual = function isEqual(point1, point2) {
|
8086 | return point1.x === point2.x && point1.y === point2.y;
|
8087 | };
|
8088 | var negate = function negate(point) {
|
8089 | return {
|
8090 | x: point.x !== 0 ? -point.x : 0,
|
8091 | y: point.y !== 0 ? -point.y : 0
|
8092 | };
|
8093 | };
|
8094 | var absolute = function absolute(point) {
|
8095 | return {
|
8096 | x: Math.abs(point.x),
|
8097 | y: Math.abs(point.y)
|
8098 | };
|
8099 | };
|
8100 | var patch = function patch(line, value, otherValue) {
|
8101 | var _ref;
|
8102 |
|
8103 | if (otherValue === void 0) {
|
8104 | otherValue = 0;
|
8105 | }
|
8106 |
|
8107 | return _ref = {}, _ref[line] = value, _ref[line === 'x' ? 'y' : 'x'] = otherValue, _ref;
|
8108 | };
|
8109 | var distance = function distance(point1, point2) {
|
8110 | return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
|
8111 | };
|
8112 | var closest = function closest(target, points) {
|
8113 | return Math.min.apply(Math, points.map(function (point) {
|
8114 | return distance(target, point);
|
8115 | }));
|
8116 | };
|
8117 | var apply = function apply(fn) {
|
8118 | return function (point) {
|
8119 | return {
|
8120 | x: fn(point.x),
|
8121 | y: fn(point.y)
|
8122 | };
|
8123 | };
|
8124 | };
|
8125 |
|
8126 | var offsetByPosition = function offsetByPosition(spacing, point) {
|
8127 | return {
|
8128 | top: spacing.top + point.y,
|
8129 | left: spacing.left + point.x,
|
8130 | bottom: spacing.bottom + point.y,
|
8131 | right: spacing.right + point.x
|
8132 | };
|
8133 | };
|
8134 | var expandByPosition = function expandByPosition(spacing, position) {
|
8135 | return {
|
8136 | top: spacing.top - position.y,
|
8137 | left: spacing.left - position.x,
|
8138 | right: spacing.right + position.x,
|
8139 | bottom: spacing.bottom + position.y
|
8140 | };
|
8141 | };
|
8142 | var getCorners = function getCorners(spacing) {
|
8143 | return [{
|
8144 | x: spacing.left,
|
8145 | y: spacing.top
|
8146 | }, {
|
8147 | x: spacing.right,
|
8148 | y: spacing.top
|
8149 | }, {
|
8150 | x: spacing.left,
|
8151 | y: spacing.bottom
|
8152 | }, {
|
8153 | x: spacing.right,
|
8154 | y: spacing.bottom
|
8155 | }];
|
8156 | };
|
8157 |
|
8158 | var getMaxScroll = (function (_ref) {
|
8159 | var scrollHeight = _ref.scrollHeight,
|
8160 | scrollWidth = _ref.scrollWidth,
|
8161 | height = _ref.height,
|
8162 | width = _ref.width;
|
8163 | var maxScroll = subtract({
|
8164 | x: scrollWidth,
|
8165 | y: scrollHeight
|
8166 | }, {
|
8167 | x: width,
|
8168 | y: height
|
8169 | });
|
8170 | var adjustedMaxScroll = {
|
8171 | x: Math.max(0, maxScroll.x),
|
8172 | y: Math.max(0, maxScroll.y)
|
8173 | };
|
8174 | return adjustedMaxScroll;
|
8175 | });
|
8176 |
|
8177 | var clip = function clip(frame, subject) {
|
8178 | var result = cssBoxModel.getRect({
|
8179 | top: Math.max(subject.top, frame.top),
|
8180 | right: Math.min(subject.right, frame.right),
|
8181 | bottom: Math.min(subject.bottom, frame.bottom),
|
8182 | left: Math.max(subject.left, frame.left)
|
8183 | });
|
8184 |
|
8185 | if (result.width <= 0 || result.height <= 0) {
|
8186 | return null;
|
8187 | }
|
8188 |
|
8189 | return result;
|
8190 | };
|
8191 | var getDroppableDimension = function getDroppableDimension(_ref) {
|
8192 | var descriptor = _ref.descriptor,
|
8193 | isEnabled = _ref.isEnabled,
|
8194 | direction = _ref.direction,
|
8195 | client = _ref.client,
|
8196 | page = _ref.page,
|
8197 | closest$$1 = _ref.closest;
|
8198 |
|
8199 | var scrollable = function () {
|
8200 | if (!closest$$1) {
|
8201 | return null;
|
8202 | }
|
8203 |
|
8204 | var maxScroll = getMaxScroll({
|
8205 | scrollHeight: closest$$1.scrollHeight,
|
8206 | scrollWidth: closest$$1.scrollWidth,
|
8207 | height: closest$$1.client.paddingBox.height,
|
8208 | width: closest$$1.client.paddingBox.width
|
8209 | });
|
8210 | return {
|
8211 | framePageMarginBox: closest$$1.page.marginBox,
|
8212 | shouldClipSubject: closest$$1.shouldClipSubject,
|
8213 | scroll: {
|
8214 | initial: closest$$1.scroll,
|
8215 | current: closest$$1.scroll,
|
8216 | max: maxScroll,
|
8217 | diff: {
|
8218 | value: origin,
|
8219 | displacement: origin
|
8220 | }
|
8221 | }
|
8222 | };
|
8223 | }();
|
8224 |
|
8225 | var subjectPageMarginBox = page.marginBox;
|
8226 | var clippedPageMarginBox = scrollable && scrollable.shouldClipSubject ? clip(scrollable.framePageMarginBox, subjectPageMarginBox) : subjectPageMarginBox;
|
8227 | var viewport = {
|
8228 | closestScrollable: scrollable,
|
8229 | subjectPageMarginBox: subjectPageMarginBox,
|
8230 | clippedPageMarginBox: clippedPageMarginBox
|
8231 | };
|
8232 | var dimension = {
|
8233 | descriptor: descriptor,
|
8234 | axis: direction === 'vertical' ? vertical : horizontal,
|
8235 | isEnabled: isEnabled,
|
8236 | client: client,
|
8237 | page: page,
|
8238 | viewport: viewport
|
8239 | };
|
8240 | return dimension;
|
8241 | };
|
8242 | var scrollDroppable = function scrollDroppable(droppable, newScroll) {
|
8243 | !droppable.viewport.closestScrollable ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
8244 | var scrollable = droppable.viewport.closestScrollable;
|
8245 | var framePageMarginBox = scrollable.framePageMarginBox;
|
8246 | var scrollDiff = subtract(newScroll, scrollable.scroll.initial);
|
8247 | var scrollDisplacement = negate(scrollDiff);
|
8248 | var closestScrollable = {
|
8249 | framePageMarginBox: scrollable.framePageMarginBox,
|
8250 | shouldClipSubject: scrollable.shouldClipSubject,
|
8251 | scroll: {
|
8252 | initial: scrollable.scroll.initial,
|
8253 | current: newScroll,
|
8254 | diff: {
|
8255 | value: scrollDiff,
|
8256 | displacement: scrollDisplacement
|
8257 | },
|
8258 | max: scrollable.scroll.max
|
8259 | }
|
8260 | };
|
8261 | var displacedSubject = offsetByPosition(droppable.viewport.subjectPageMarginBox, scrollDisplacement);
|
8262 | var clippedPageMarginBox = closestScrollable.shouldClipSubject ? clip(framePageMarginBox, displacedSubject) : cssBoxModel.getRect(displacedSubject);
|
8263 | var viewport = {
|
8264 | closestScrollable: closestScrollable,
|
8265 | subjectPageMarginBox: droppable.viewport.subjectPageMarginBox,
|
8266 | clippedPageMarginBox: clippedPageMarginBox
|
8267 | };
|
8268 |
|
8269 | var result = _extends({}, droppable, {
|
8270 | viewport: viewport
|
8271 | });
|
8272 |
|
8273 | return result;
|
8274 | };
|
8275 |
|
8276 | var toDroppableMap = memoizeOne(function (droppables) {
|
8277 | return droppables.reduce(function (previous, current) {
|
8278 | previous[current.descriptor.id] = current;
|
8279 | return previous;
|
8280 | }, {});
|
8281 | });
|
8282 | var toDraggableMap = memoizeOne(function (draggables) {
|
8283 | return draggables.reduce(function (previous, current) {
|
8284 | previous[current.descriptor.id] = current;
|
8285 | return previous;
|
8286 | }, {});
|
8287 | });
|
8288 | var toDroppableList = memoizeOne(function (droppables) {
|
8289 | return _Object$keys(droppables).map(function (id) {
|
8290 | return droppables[id];
|
8291 | });
|
8292 | });
|
8293 | var toDraggableList = memoizeOne(function (draggables) {
|
8294 | return _Object$keys(draggables).map(function (id) {
|
8295 | return draggables[id];
|
8296 | });
|
8297 | });
|
8298 |
|
8299 | var getDraggablesInsideDroppable = memoizeOne(function (droppable, draggables) {
|
8300 | return toDraggableList(draggables).filter(function (draggable) {
|
8301 | return droppable.descriptor.id === draggable.descriptor.droppableId;
|
8302 | }).sort(function (a, b) {
|
8303 | return a.descriptor.index - b.descriptor.index;
|
8304 | });
|
8305 | });
|
8306 |
|
8307 | var isWithin = (function (lowerBound, upperBound) {
|
8308 | return function (value) {
|
8309 | return value <= upperBound && value >= lowerBound;
|
8310 | };
|
8311 | });
|
8312 |
|
8313 | var isPositionInFrame = (function (frame) {
|
8314 | var isWithinVertical = isWithin(frame.top, frame.bottom);
|
8315 | var isWithinHorizontal = isWithin(frame.left, frame.right);
|
8316 | return function (point) {
|
8317 | return isWithinVertical(point.y) && isWithinVertical(point.y) && isWithinHorizontal(point.x) && isWithinHorizontal(point.x);
|
8318 | };
|
8319 | });
|
8320 |
|
8321 | var getRequiredGrowth = memoizeOne(function (draggable, draggables, droppable) {
|
8322 | var getResult = function getResult(existingSpace) {
|
8323 | var requiredSpace = draggable.page.marginBox[droppable.axis.size];
|
8324 |
|
8325 | if (requiredSpace <= existingSpace) {
|
8326 | return null;
|
8327 | }
|
8328 |
|
8329 | var requiredGrowth = patch(droppable.axis.line, requiredSpace - existingSpace);
|
8330 | return requiredGrowth;
|
8331 | };
|
8332 |
|
8333 | var dimensions = getDraggablesInsideDroppable(droppable, draggables);
|
8334 |
|
8335 | if (!dimensions.length) {
|
8336 | var _existingSpace = droppable.page.marginBox[droppable.axis.size];
|
8337 | return getResult(_existingSpace);
|
8338 | }
|
8339 |
|
8340 | var endOfDraggables = dimensions[dimensions.length - 1].page.marginBox[droppable.axis.end];
|
8341 | var endOfDroppable = droppable.page.marginBox[droppable.axis.end];
|
8342 | var existingSpace = endOfDroppable - endOfDraggables;
|
8343 | return getResult(existingSpace);
|
8344 | });
|
8345 | var getWithGrowth = memoizeOne(function (area, growth) {
|
8346 | return cssBoxModel.getRect(expandByPosition(area, growth));
|
8347 | });
|
8348 |
|
8349 | var getClippedRectWithPlaceholder = function getClippedRectWithPlaceholder(_ref) {
|
8350 | var draggable = _ref.draggable,
|
8351 | draggables = _ref.draggables,
|
8352 | droppable = _ref.droppable,
|
8353 | previousDroppableOverId = _ref.previousDroppableOverId;
|
8354 | var isHome = draggable.descriptor.droppableId === droppable.descriptor.id;
|
8355 | var wasOver = Boolean(previousDroppableOverId && previousDroppableOverId === droppable.descriptor.id);
|
8356 | var clippedPageMarginBox = droppable.viewport.clippedPageMarginBox;
|
8357 |
|
8358 | if (!clippedPageMarginBox) {
|
8359 | return clippedPageMarginBox;
|
8360 | }
|
8361 |
|
8362 | if (isHome || !wasOver) {
|
8363 | return clippedPageMarginBox;
|
8364 | }
|
8365 |
|
8366 | var requiredGrowth = getRequiredGrowth(draggable, draggables, droppable);
|
8367 |
|
8368 | if (!requiredGrowth) {
|
8369 | return clippedPageMarginBox;
|
8370 | }
|
8371 |
|
8372 | var subjectWithGrowth = getWithGrowth(clippedPageMarginBox, requiredGrowth);
|
8373 | var closestScrollable = droppable.viewport.closestScrollable;
|
8374 |
|
8375 | if (!closestScrollable) {
|
8376 | return subjectWithGrowth;
|
8377 | }
|
8378 |
|
8379 | if (!closestScrollable.shouldClipSubject) {
|
8380 | return subjectWithGrowth;
|
8381 | }
|
8382 |
|
8383 | return clip(closestScrollable.framePageMarginBox, subjectWithGrowth);
|
8384 | };
|
8385 |
|
8386 | var getDroppableOver = (function (_ref2) {
|
8387 | var target = _ref2.target,
|
8388 | draggable = _ref2.draggable,
|
8389 | draggables = _ref2.draggables,
|
8390 | droppables = _ref2.droppables,
|
8391 | previousDroppableOverId = _ref2.previousDroppableOverId;
|
8392 | var maybe = toDroppableList(droppables).filter(function (droppable) {
|
8393 | return droppable.isEnabled;
|
8394 | }).find(function (droppable) {
|
8395 | var withPlaceholder = getClippedRectWithPlaceholder({
|
8396 | draggable: draggable,
|
8397 | draggables: draggables,
|
8398 | droppable: droppable,
|
8399 | previousDroppableOverId: previousDroppableOverId
|
8400 | });
|
8401 |
|
8402 | if (!withPlaceholder) {
|
8403 | return false;
|
8404 | }
|
8405 |
|
8406 | return isPositionInFrame(withPlaceholder)(target);
|
8407 | });
|
8408 | return maybe ? maybe.descriptor.id : null;
|
8409 | });
|
8410 |
|
8411 | var noMovement = {
|
8412 | displaced: [],
|
8413 | amount: origin,
|
8414 | isBeyondStartPosition: false
|
8415 | };
|
8416 | var noImpact = {
|
8417 | movement: noMovement,
|
8418 | direction: null,
|
8419 | destination: null
|
8420 | };
|
8421 |
|
8422 | var getDisplacementMap = memoizeOne(function (displaced) {
|
8423 | return displaced.reduce(function (map, displacement) {
|
8424 | map[displacement.draggableId] = displacement;
|
8425 | return map;
|
8426 | }, {});
|
8427 | });
|
8428 |
|
8429 | var isPartiallyVisibleThroughFrame = (function (frame) {
|
8430 | var isWithinVertical = isWithin(frame.top, frame.bottom);
|
8431 | var isWithinHorizontal = isWithin(frame.left, frame.right);
|
8432 | return function (subject) {
|
8433 | var isContained = isWithinVertical(subject.top) && isWithinVertical(subject.bottom) && isWithinHorizontal(subject.left) && isWithinHorizontal(subject.right);
|
8434 |
|
8435 | if (isContained) {
|
8436 | return true;
|
8437 | }
|
8438 |
|
8439 | var isPartiallyVisibleVertically = isWithinVertical(subject.top) || isWithinVertical(subject.bottom);
|
8440 | var isPartiallyVisibleHorizontally = isWithinHorizontal(subject.left) || isWithinHorizontal(subject.right);
|
8441 | var isPartiallyContained = isPartiallyVisibleVertically && isPartiallyVisibleHorizontally;
|
8442 |
|
8443 | if (isPartiallyContained) {
|
8444 | return true;
|
8445 | }
|
8446 |
|
8447 | var isBiggerVertically = subject.top < frame.top && subject.bottom > frame.bottom;
|
8448 | var isBiggerHorizontally = subject.left < frame.left && subject.right > frame.right;
|
8449 | var isTargetBiggerThanFrame = isBiggerVertically && isBiggerHorizontally;
|
8450 |
|
8451 | if (isTargetBiggerThanFrame) {
|
8452 | return true;
|
8453 | }
|
8454 |
|
8455 | var isTargetBiggerOnOneAxis = isBiggerVertically && isPartiallyVisibleHorizontally || isBiggerHorizontally && isPartiallyVisibleVertically;
|
8456 | return isTargetBiggerOnOneAxis;
|
8457 | };
|
8458 | });
|
8459 |
|
8460 | var isTotallyVisibleThroughFrame = (function (frame) {
|
8461 | var isWithinVertical = isWithin(frame.top, frame.bottom);
|
8462 | var isWithinHorizontal = isWithin(frame.left, frame.right);
|
8463 | return function (subject) {
|
8464 | var isContained = isWithinVertical(subject.top) && isWithinVertical(subject.bottom) && isWithinHorizontal(subject.left) && isWithinHorizontal(subject.right);
|
8465 | return isContained;
|
8466 | };
|
8467 | });
|
8468 |
|
8469 | var isVisible = function isVisible(_ref) {
|
8470 | var target = _ref.target,
|
8471 | destination = _ref.destination,
|
8472 | viewport = _ref.viewport,
|
8473 | isVisibleThroughFrameFn = _ref.isVisibleThroughFrameFn;
|
8474 | var displacement = destination.viewport.closestScrollable ? destination.viewport.closestScrollable.scroll.diff.displacement : origin;
|
8475 | var withDisplacement = offsetByPosition(target, displacement);
|
8476 |
|
8477 | if (!destination.viewport.clippedPageMarginBox) {
|
8478 | return false;
|
8479 | }
|
8480 |
|
8481 | var isVisibleInDroppable = isVisibleThroughFrameFn(destination.viewport.clippedPageMarginBox)(withDisplacement);
|
8482 | var isVisibleInViewport = isVisibleThroughFrameFn(viewport)(withDisplacement);
|
8483 | return isVisibleInDroppable && isVisibleInViewport;
|
8484 | };
|
8485 |
|
8486 | var isPartiallyVisible = function isPartiallyVisible(_ref2) {
|
8487 | var target = _ref2.target,
|
8488 | destination = _ref2.destination,
|
8489 | viewport = _ref2.viewport;
|
8490 | return isVisible({
|
8491 | target: target,
|
8492 | destination: destination,
|
8493 | viewport: viewport,
|
8494 | isVisibleThroughFrameFn: isPartiallyVisibleThroughFrame
|
8495 | });
|
8496 | };
|
8497 | var isTotallyVisible = function isTotallyVisible(_ref3) {
|
8498 | var target = _ref3.target,
|
8499 | destination = _ref3.destination,
|
8500 | viewport = _ref3.viewport;
|
8501 | return isVisible({
|
8502 | target: target,
|
8503 | destination: destination,
|
8504 | viewport: viewport,
|
8505 | isVisibleThroughFrameFn: isTotallyVisibleThroughFrame
|
8506 | });
|
8507 | };
|
8508 |
|
8509 | var getDisplacement = (function (_ref) {
|
8510 | var draggable = _ref.draggable,
|
8511 | destination = _ref.destination,
|
8512 | previousImpact = _ref.previousImpact,
|
8513 | viewport = _ref.viewport;
|
8514 | var id = draggable.descriptor.id;
|
8515 | var map = getDisplacementMap(previousImpact.movement.displaced);
|
8516 | var isVisible = isPartiallyVisible({
|
8517 | target: draggable.page.marginBox,
|
8518 | destination: destination,
|
8519 | viewport: viewport
|
8520 | });
|
8521 |
|
8522 | var shouldAnimate = function () {
|
8523 | if (!isVisible) {
|
8524 | return false;
|
8525 | }
|
8526 |
|
8527 | var previous = map[id];
|
8528 |
|
8529 | if (!previous) {
|
8530 | return true;
|
8531 | }
|
8532 |
|
8533 | return previous.shouldAnimate;
|
8534 | }();
|
8535 |
|
8536 | var displacement = {
|
8537 | draggableId: id,
|
8538 | isVisible: isVisible,
|
8539 | shouldAnimate: shouldAnimate
|
8540 | };
|
8541 | return displacement;
|
8542 | });
|
8543 |
|
8544 | var withDroppableScroll = (function (droppable, point) {
|
8545 | var closestScrollable = droppable.viewport.closestScrollable;
|
8546 |
|
8547 | if (!closestScrollable) {
|
8548 | return point;
|
8549 | }
|
8550 |
|
8551 | return add(point, closestScrollable.scroll.diff.value);
|
8552 | });
|
8553 |
|
8554 | var inHomeList = (function (_ref) {
|
8555 | var pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
8556 | draggable = _ref.draggable,
|
8557 | home = _ref.home,
|
8558 | insideHome = _ref.insideHome,
|
8559 | previousImpact = _ref.previousImpact,
|
8560 | viewport = _ref.viewport;
|
8561 | var axis = home.axis;
|
8562 | var originalCenter = draggable.page.borderBox.center;
|
8563 | var currentCenter = withDroppableScroll(home, pageBorderBoxCenter);
|
8564 | var isBeyondStartPosition = currentCenter[axis.line] - originalCenter[axis.line] > 0;
|
8565 | var amount = patch(axis.line, draggable.client.marginBox[axis.size]);
|
8566 | var displaced = insideHome.filter(function (child) {
|
8567 | if (child === draggable) {
|
8568 | return false;
|
8569 | }
|
8570 |
|
8571 | var borderBox = child.page.borderBox;
|
8572 |
|
8573 | if (isBeyondStartPosition) {
|
8574 | if (borderBox.center[axis.line] < originalCenter[axis.line]) {
|
8575 | return false;
|
8576 | }
|
8577 |
|
8578 | return currentCenter[axis.line] > borderBox[axis.start];
|
8579 | }
|
8580 |
|
8581 | if (originalCenter[axis.line] < borderBox.center[axis.line]) {
|
8582 | return false;
|
8583 | }
|
8584 |
|
8585 | return currentCenter[axis.line] < borderBox[axis.end];
|
8586 | }).map(function (dimension) {
|
8587 | return getDisplacement({
|
8588 | draggable: dimension,
|
8589 | destination: home,
|
8590 | previousImpact: previousImpact,
|
8591 | viewport: viewport.frame
|
8592 | });
|
8593 | });
|
8594 | var ordered = isBeyondStartPosition ? displaced.reverse() : displaced;
|
8595 |
|
8596 | var index = function () {
|
8597 | var startIndex = draggable.descriptor.index;
|
8598 | var length = ordered.length;
|
8599 |
|
8600 | if (!length) {
|
8601 | return startIndex;
|
8602 | }
|
8603 |
|
8604 | if (isBeyondStartPosition) {
|
8605 | return startIndex + length;
|
8606 | }
|
8607 |
|
8608 | return startIndex - length;
|
8609 | }();
|
8610 |
|
8611 | var movement = {
|
8612 | amount: amount,
|
8613 | displaced: ordered,
|
8614 | isBeyondStartPosition: isBeyondStartPosition
|
8615 | };
|
8616 | var impact = {
|
8617 | movement: movement,
|
8618 | direction: axis.direction,
|
8619 | destination: {
|
8620 | droppableId: home.descriptor.id,
|
8621 | index: index
|
8622 | }
|
8623 | };
|
8624 | return impact;
|
8625 | });
|
8626 |
|
8627 | var inForeignList = (function (_ref) {
|
8628 | var pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
8629 | draggable = _ref.draggable,
|
8630 | destination = _ref.destination,
|
8631 | insideDestination = _ref.insideDestination,
|
8632 | previousImpact = _ref.previousImpact,
|
8633 | viewport = _ref.viewport;
|
8634 | var axis = destination.axis;
|
8635 | var currentCenter = withDroppableScroll(destination, pageBorderBoxCenter);
|
8636 | var displaced = insideDestination.filter(function (child) {
|
8637 | var threshold = child.page.borderBox[axis.end];
|
8638 | return threshold > currentCenter[axis.line];
|
8639 | }).map(function (dimension) {
|
8640 | return getDisplacement({
|
8641 | draggable: dimension,
|
8642 | destination: destination,
|
8643 | previousImpact: previousImpact,
|
8644 | viewport: viewport.frame
|
8645 | });
|
8646 | });
|
8647 | var newIndex = insideDestination.length - displaced.length;
|
8648 | var movement = {
|
8649 | amount: patch(axis.line, draggable.page.marginBox[axis.size]),
|
8650 | displaced: displaced,
|
8651 | isBeyondStartPosition: false
|
8652 | };
|
8653 | var impact = {
|
8654 | movement: movement,
|
8655 | direction: axis.direction,
|
8656 | destination: {
|
8657 | droppableId: destination.descriptor.id,
|
8658 | index: newIndex
|
8659 | }
|
8660 | };
|
8661 | return impact;
|
8662 | });
|
8663 |
|
8664 | var getDragImpact = (function (_ref) {
|
8665 | var pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
8666 | draggable = _ref.draggable,
|
8667 | draggables = _ref.draggables,
|
8668 | droppables = _ref.droppables,
|
8669 | previousImpact = _ref.previousImpact,
|
8670 | viewport = _ref.viewport;
|
8671 | var previousDroppableOverId = previousImpact.destination && previousImpact.destination.droppableId;
|
8672 | var destinationId = getDroppableOver({
|
8673 | target: pageBorderBoxCenter,
|
8674 | draggable: draggable,
|
8675 | draggables: draggables,
|
8676 | droppables: droppables,
|
8677 | previousDroppableOverId: previousDroppableOverId
|
8678 | });
|
8679 |
|
8680 | if (!destinationId) {
|
8681 | return noImpact;
|
8682 | }
|
8683 |
|
8684 | var destination = droppables[destinationId];
|
8685 |
|
8686 | if (!destination.isEnabled) {
|
8687 | return noImpact;
|
8688 | }
|
8689 |
|
8690 | var home = droppables[draggable.descriptor.droppableId];
|
8691 | var isWithinHomeDroppable = home.descriptor.id === destinationId;
|
8692 | var insideDestination = getDraggablesInsideDroppable(destination, draggables);
|
8693 |
|
8694 | if (isWithinHomeDroppable) {
|
8695 | return inHomeList({
|
8696 | pageBorderBoxCenter: pageBorderBoxCenter,
|
8697 | draggable: draggable,
|
8698 | home: home,
|
8699 | insideHome: insideDestination,
|
8700 | previousImpact: previousImpact || noImpact,
|
8701 | viewport: viewport
|
8702 | });
|
8703 | }
|
8704 |
|
8705 | return inForeignList({
|
8706 | pageBorderBoxCenter: pageBorderBoxCenter,
|
8707 | draggable: draggable,
|
8708 | destination: destination,
|
8709 | insideDestination: insideDestination,
|
8710 | previousImpact: previousImpact || noImpact,
|
8711 | viewport: viewport
|
8712 | });
|
8713 | });
|
8714 |
|
8715 | var getHomeLocation = (function (critical) {
|
8716 | return {
|
8717 | index: critical.draggable.index,
|
8718 | droppableId: critical.droppable.id
|
8719 | };
|
8720 | });
|
8721 |
|
8722 | var getSafeClipped = function getSafeClipped(droppable) {
|
8723 | var rect = droppable.viewport.clippedPageMarginBox;
|
8724 | !rect ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get clipped area from droppable') : invariant(false) : void 0;
|
8725 | return rect;
|
8726 | };
|
8727 |
|
8728 | var getBestCrossAxisDroppable = (function (_ref) {
|
8729 | var isMovingForward = _ref.isMovingForward,
|
8730 | pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
8731 | source = _ref.source,
|
8732 | droppables = _ref.droppables,
|
8733 | viewport = _ref.viewport;
|
8734 | var sourceClipped = source.viewport.clippedPageMarginBox;
|
8735 |
|
8736 | if (!sourceClipped) {
|
8737 | return null;
|
8738 | }
|
8739 |
|
8740 | var axis = source.axis;
|
8741 | var isBetweenSourceClipped = isWithin(sourceClipped[axis.start], sourceClipped[axis.end]);
|
8742 | var candidates = toDroppableList(droppables).filter(function (droppable) {
|
8743 | return droppable !== source;
|
8744 | }).filter(function (droppable) {
|
8745 | return droppable.isEnabled;
|
8746 | }).filter(function (droppable) {
|
8747 | var clippedPageMarginBox = droppable.viewport.clippedPageMarginBox;
|
8748 |
|
8749 | if (!clippedPageMarginBox) {
|
8750 | return false;
|
8751 | }
|
8752 |
|
8753 | return isPartiallyVisibleThroughFrame(viewport.frame)(clippedPageMarginBox);
|
8754 | }).filter(function (droppable) {
|
8755 | var targetClipped = getSafeClipped(droppable);
|
8756 |
|
8757 | if (isMovingForward) {
|
8758 | return sourceClipped[axis.crossAxisEnd] < targetClipped[axis.crossAxisEnd];
|
8759 | }
|
8760 |
|
8761 | return targetClipped[axis.crossAxisStart] < sourceClipped[axis.crossAxisStart];
|
8762 | }).filter(function (droppable) {
|
8763 | var targetClipped = getSafeClipped(droppable);
|
8764 | var isBetweenDestinationClipped = isWithin(targetClipped[axis.start], targetClipped[axis.end]);
|
8765 | return isBetweenSourceClipped(targetClipped[axis.start]) || isBetweenSourceClipped(targetClipped[axis.end]) || isBetweenDestinationClipped(sourceClipped[axis.start]) || isBetweenDestinationClipped(sourceClipped[axis.end]);
|
8766 | }).sort(function (a, b) {
|
8767 | var first = getSafeClipped(a)[axis.crossAxisStart];
|
8768 | var second = getSafeClipped(b)[axis.crossAxisStart];
|
8769 |
|
8770 | if (isMovingForward) {
|
8771 | return first - second;
|
8772 | }
|
8773 |
|
8774 | return second - first;
|
8775 | }).filter(function (droppable, index, array) {
|
8776 | return getSafeClipped(droppable)[axis.crossAxisStart] === getSafeClipped(array[0])[axis.crossAxisStart];
|
8777 | });
|
8778 |
|
8779 | if (!candidates.length) {
|
8780 | return null;
|
8781 | }
|
8782 |
|
8783 | if (candidates.length === 1) {
|
8784 | return candidates[0];
|
8785 | }
|
8786 |
|
8787 | var contains = candidates.filter(function (droppable) {
|
8788 | var isWithinDroppable = isWithin(getSafeClipped(droppable)[axis.start], getSafeClipped(droppable)[axis.end]);
|
8789 | return isWithinDroppable(pageBorderBoxCenter[axis.line]);
|
8790 | });
|
8791 |
|
8792 | if (contains.length === 1) {
|
8793 | return contains[0];
|
8794 | }
|
8795 |
|
8796 | if (contains.length > 1) {
|
8797 | return contains.sort(function (a, b) {
|
8798 | return getSafeClipped(a)[axis.start] - getSafeClipped(b)[axis.start];
|
8799 | })[0];
|
8800 | }
|
8801 |
|
8802 | return candidates.sort(function (a, b) {
|
8803 | var first = closest(pageBorderBoxCenter, getCorners(getSafeClipped(a)));
|
8804 | var second = closest(pageBorderBoxCenter, getCorners(getSafeClipped(b)));
|
8805 |
|
8806 | if (first !== second) {
|
8807 | return first - second;
|
8808 | }
|
8809 |
|
8810 | return getSafeClipped(a)[axis.start] - getSafeClipped(b)[axis.start];
|
8811 | })[0];
|
8812 | });
|
8813 |
|
8814 | var withDroppableDisplacement = (function (droppable, point) {
|
8815 | var closestScrollable = droppable.viewport.closestScrollable;
|
8816 |
|
8817 | if (!closestScrollable) {
|
8818 | return point;
|
8819 | }
|
8820 |
|
8821 | return add(point, closestScrollable.scroll.diff.displacement);
|
8822 | });
|
8823 |
|
8824 | var getClosestDraggable = (function (_ref) {
|
8825 | var axis = _ref.axis,
|
8826 | viewport = _ref.viewport,
|
8827 | pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
8828 | destination = _ref.destination,
|
8829 | insideDestination = _ref.insideDestination;
|
8830 |
|
8831 | if (!insideDestination.length) {
|
8832 | return null;
|
8833 | }
|
8834 |
|
8835 | var result = insideDestination.filter(function (draggable) {
|
8836 | return isTotallyVisible({
|
8837 | target: draggable.page.borderBox,
|
8838 | destination: destination,
|
8839 | viewport: viewport.frame
|
8840 | });
|
8841 | }).sort(function (a, b) {
|
8842 | var distanceToA = distance(pageBorderBoxCenter, withDroppableDisplacement(destination, a.page.borderBox.center));
|
8843 | var distanceToB = distance(pageBorderBoxCenter, withDroppableDisplacement(destination, b.page.borderBox.center));
|
8844 |
|
8845 | if (distanceToA < distanceToB) {
|
8846 | return -1;
|
8847 | }
|
8848 |
|
8849 | if (distanceToB < distanceToA) {
|
8850 | return 1;
|
8851 | }
|
8852 |
|
8853 | return a.page.borderBox[axis.start] - b.page.borderBox[axis.start];
|
8854 | });
|
8855 | return result.length ? result[0] : null;
|
8856 | });
|
8857 |
|
8858 | var moveToEdge = (function (_ref) {
|
8859 | var source = _ref.source,
|
8860 | sourceEdge = _ref.sourceEdge,
|
8861 | destination = _ref.destination,
|
8862 | destinationEdge = _ref.destinationEdge,
|
8863 | destinationAxis = _ref.destinationAxis;
|
8864 |
|
8865 | var getCorner = function getCorner(area) {
|
8866 | return patch(destinationAxis.line, area[destinationAxis[destinationEdge]], area[destinationAxis.crossAxisStart]);
|
8867 | };
|
8868 |
|
8869 | var corner = getCorner(destination);
|
8870 | var centerDiff = absolute(subtract(source.center, getCorner(source)));
|
8871 | var signed = patch(destinationAxis.line, (sourceEdge === 'end' ? -1 : 1) * centerDiff[destinationAxis.line], centerDiff[destinationAxis.crossAxisLine]);
|
8872 | return add(corner, signed);
|
8873 | });
|
8874 |
|
8875 | var toHomeList = (function (_ref) {
|
8876 | var amount = _ref.amount,
|
8877 | homeIndex = _ref.homeIndex,
|
8878 | movingRelativeTo = _ref.movingRelativeTo,
|
8879 | insideDestination = _ref.insideDestination,
|
8880 | draggable = _ref.draggable,
|
8881 | destination = _ref.destination,
|
8882 | previousImpact = _ref.previousImpact,
|
8883 | viewport = _ref.viewport;
|
8884 | var axis = destination.axis;
|
8885 | var targetIndex = insideDestination.indexOf(movingRelativeTo);
|
8886 | !(targetIndex !== -1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Unable to find target in destination droppable') : invariant(false) : void 0;
|
8887 |
|
8888 | if (targetIndex === homeIndex) {
|
8889 | var _newCenter = draggable.page.borderBox.center;
|
8890 | var _newImpact = {
|
8891 | movement: {
|
8892 | displaced: [],
|
8893 | amount: amount,
|
8894 | isBeyondStartPosition: false
|
8895 | },
|
8896 | direction: destination.axis.direction,
|
8897 | destination: {
|
8898 | droppableId: destination.descriptor.id,
|
8899 | index: homeIndex
|
8900 | }
|
8901 | };
|
8902 | return {
|
8903 | pageBorderBoxCenter: withDroppableDisplacement(destination, _newCenter),
|
8904 | impact: _newImpact
|
8905 | };
|
8906 | }
|
8907 |
|
8908 | var isMovingPastOriginalIndex = targetIndex > homeIndex;
|
8909 | var edge = isMovingPastOriginalIndex ? 'end' : 'start';
|
8910 | var newCenter = moveToEdge({
|
8911 | source: draggable.page.borderBox,
|
8912 | sourceEdge: edge,
|
8913 | destination: isMovingPastOriginalIndex ? movingRelativeTo.page.borderBox : movingRelativeTo.page.marginBox,
|
8914 | destinationEdge: edge,
|
8915 | destinationAxis: axis
|
8916 | });
|
8917 |
|
8918 | var modified = function () {
|
8919 | if (!isMovingPastOriginalIndex) {
|
8920 | return insideDestination.slice(targetIndex, homeIndex);
|
8921 | }
|
8922 |
|
8923 | var from = homeIndex + 1;
|
8924 | var to = targetIndex + 1;
|
8925 | return insideDestination.slice(from, to).reverse();
|
8926 | }();
|
8927 |
|
8928 | var displaced = modified.map(function (dimension) {
|
8929 | return getDisplacement({
|
8930 | draggable: dimension,
|
8931 | destination: destination,
|
8932 | previousImpact: previousImpact,
|
8933 | viewport: viewport.frame
|
8934 | });
|
8935 | });
|
8936 | var newImpact = {
|
8937 | movement: {
|
8938 | displaced: displaced,
|
8939 | amount: amount,
|
8940 | isBeyondStartPosition: isMovingPastOriginalIndex
|
8941 | },
|
8942 | direction: axis.direction,
|
8943 | destination: {
|
8944 | droppableId: destination.descriptor.id,
|
8945 | index: targetIndex
|
8946 | }
|
8947 | };
|
8948 | return {
|
8949 | pageBorderBoxCenter: withDroppableDisplacement(destination, newCenter),
|
8950 | impact: newImpact
|
8951 | };
|
8952 | });
|
8953 |
|
8954 | var toForeignList = (function (_ref) {
|
8955 | var amount = _ref.amount,
|
8956 | pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
8957 | movingRelativeTo = _ref.movingRelativeTo,
|
8958 | insideDestination = _ref.insideDestination,
|
8959 | draggable = _ref.draggable,
|
8960 | destination = _ref.destination,
|
8961 | previousImpact = _ref.previousImpact,
|
8962 | viewport = _ref.viewport;
|
8963 | var axis = destination.axis;
|
8964 | var isGoingBeforeTarget = Boolean(movingRelativeTo && pageBorderBoxCenter[destination.axis.line] < movingRelativeTo.page.borderBox.center[destination.axis.line]);
|
8965 |
|
8966 | if (!movingRelativeTo) {
|
8967 | var _newCenter = moveToEdge({
|
8968 | source: draggable.page.borderBox,
|
8969 | sourceEdge: 'start',
|
8970 | destination: destination.page.contentBox,
|
8971 | destinationEdge: 'start',
|
8972 | destinationAxis: axis
|
8973 | });
|
8974 |
|
8975 | var _newImpact = {
|
8976 | movement: {
|
8977 | displaced: [],
|
8978 | amount: amount,
|
8979 | isBeyondStartPosition: false
|
8980 | },
|
8981 | direction: axis.direction,
|
8982 | destination: {
|
8983 | droppableId: destination.descriptor.id,
|
8984 | index: 0
|
8985 | }
|
8986 | };
|
8987 | return {
|
8988 | pageBorderBoxCenter: withDroppableDisplacement(destination, _newCenter),
|
8989 | impact: _newImpact
|
8990 | };
|
8991 | }
|
8992 |
|
8993 | var targetIndex = insideDestination.indexOf(movingRelativeTo);
|
8994 | !(targetIndex !== -1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'The target was not found within its droppable') : invariant(false) : void 0;
|
8995 | var proposedIndex = isGoingBeforeTarget ? targetIndex : targetIndex + 1;
|
8996 | var newCenter = moveToEdge({
|
8997 | source: draggable.page.borderBox,
|
8998 | sourceEdge: 'start',
|
8999 | destination: movingRelativeTo.page.marginBox,
|
9000 | destinationEdge: isGoingBeforeTarget ? 'start' : 'end',
|
9001 | destinationAxis: axis
|
9002 | });
|
9003 | var displaced = insideDestination.slice(proposedIndex, insideDestination.length).map(function (dimension) {
|
9004 | return getDisplacement({
|
9005 | draggable: dimension,
|
9006 | destination: destination,
|
9007 | viewport: viewport.frame,
|
9008 | previousImpact: previousImpact
|
9009 | });
|
9010 | });
|
9011 | var newImpact = {
|
9012 | movement: {
|
9013 | displaced: displaced,
|
9014 | amount: amount,
|
9015 | isBeyondStartPosition: false
|
9016 | },
|
9017 | direction: axis.direction,
|
9018 | destination: {
|
9019 | droppableId: destination.descriptor.id,
|
9020 | index: proposedIndex
|
9021 | }
|
9022 | };
|
9023 | return {
|
9024 | pageBorderBoxCenter: withDroppableDisplacement(destination, newCenter),
|
9025 | impact: newImpact
|
9026 | };
|
9027 | });
|
9028 |
|
9029 | var moveToNewDroppable = (function (_ref) {
|
9030 | var pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
9031 | destination = _ref.destination,
|
9032 | insideDestination = _ref.insideDestination,
|
9033 | draggable = _ref.draggable,
|
9034 | movingRelativeTo = _ref.movingRelativeTo,
|
9035 | home = _ref.home,
|
9036 | previousImpact = _ref.previousImpact,
|
9037 | viewport = _ref.viewport;
|
9038 | var amount = patch(destination.axis.line, draggable.client.marginBox[destination.axis.size]);
|
9039 |
|
9040 | if (destination.descriptor.id === draggable.descriptor.droppableId) {
|
9041 | !movingRelativeTo ? process.env.NODE_ENV !== "production" ? invariant(false, 'There will always be a target in the original list') : invariant(false) : void 0;
|
9042 | return toHomeList({
|
9043 | amount: amount,
|
9044 | homeIndex: home.index,
|
9045 | movingRelativeTo: movingRelativeTo,
|
9046 | insideDestination: insideDestination,
|
9047 | draggable: draggable,
|
9048 | destination: destination,
|
9049 | previousImpact: previousImpact,
|
9050 | viewport: viewport
|
9051 | });
|
9052 | }
|
9053 |
|
9054 | return toForeignList({
|
9055 | amount: amount,
|
9056 | pageBorderBoxCenter: pageBorderBoxCenter,
|
9057 | movingRelativeTo: movingRelativeTo,
|
9058 | insideDestination: insideDestination,
|
9059 | draggable: draggable,
|
9060 | destination: destination,
|
9061 | previousImpact: previousImpact,
|
9062 | viewport: viewport
|
9063 | });
|
9064 | });
|
9065 |
|
9066 | var moveCrossAxis = (function (_ref) {
|
9067 | var isMovingForward = _ref.isMovingForward,
|
9068 | pageBorderBoxCenter = _ref.pageBorderBoxCenter,
|
9069 | draggableId = _ref.draggableId,
|
9070 | droppableId = _ref.droppableId,
|
9071 | home = _ref.home,
|
9072 | draggables = _ref.draggables,
|
9073 | droppables = _ref.droppables,
|
9074 | previousImpact = _ref.previousImpact,
|
9075 | viewport = _ref.viewport;
|
9076 | var draggable = draggables[draggableId];
|
9077 | var source = droppables[droppableId];
|
9078 | var destination = getBestCrossAxisDroppable({
|
9079 | isMovingForward: isMovingForward,
|
9080 | pageBorderBoxCenter: pageBorderBoxCenter,
|
9081 | source: source,
|
9082 | droppables: droppables,
|
9083 | viewport: viewport
|
9084 | });
|
9085 |
|
9086 | if (!destination) {
|
9087 | return null;
|
9088 | }
|
9089 |
|
9090 | var insideDestination = getDraggablesInsideDroppable(destination, draggables);
|
9091 | var movingRelativeTo = getClosestDraggable({
|
9092 | axis: destination.axis,
|
9093 | pageBorderBoxCenter: pageBorderBoxCenter,
|
9094 | destination: destination,
|
9095 | insideDestination: insideDestination,
|
9096 | viewport: viewport
|
9097 | });
|
9098 |
|
9099 | if (insideDestination.length && !movingRelativeTo) {
|
9100 | return null;
|
9101 | }
|
9102 |
|
9103 | return moveToNewDroppable({
|
9104 | pageBorderBoxCenter: pageBorderBoxCenter,
|
9105 | destination: destination,
|
9106 | draggable: draggable,
|
9107 | movingRelativeTo: movingRelativeTo,
|
9108 | insideDestination: insideDestination,
|
9109 | home: home,
|
9110 | previousImpact: previousImpact || noImpact,
|
9111 | viewport: viewport
|
9112 | });
|
9113 | });
|
9114 |
|
9115 | var isTotallyVisibleInNewLocation = (function (_ref) {
|
9116 | var draggable = _ref.draggable,
|
9117 | destination = _ref.destination,
|
9118 | newPageBorderBoxCenter = _ref.newPageBorderBoxCenter,
|
9119 | viewport = _ref.viewport;
|
9120 | var diff = subtract(newPageBorderBoxCenter, draggable.page.borderBox.center);
|
9121 | var shifted = offsetByPosition(draggable.page.borderBox, diff);
|
9122 | return isTotallyVisible({
|
9123 | target: shifted,
|
9124 | destination: destination,
|
9125 | viewport: viewport
|
9126 | });
|
9127 | });
|
9128 |
|
9129 | var withFirstAdded = function withFirstAdded(_ref) {
|
9130 | var add = _ref.add,
|
9131 | previousImpact = _ref.previousImpact,
|
9132 | droppable = _ref.droppable,
|
9133 | draggables = _ref.draggables,
|
9134 | viewport = _ref.viewport;
|
9135 | var newDisplacement = {
|
9136 | draggableId: add,
|
9137 | isVisible: true,
|
9138 | shouldAnimate: true
|
9139 | };
|
9140 | var added = [newDisplacement].concat(previousImpact.movement.displaced);
|
9141 | var withUpdatedVisibility = added.map(function (current) {
|
9142 | if (current === newDisplacement) {
|
9143 | return current;
|
9144 | }
|
9145 |
|
9146 | var updated = getDisplacement({
|
9147 | draggable: draggables[current.draggableId],
|
9148 | destination: droppable,
|
9149 | previousImpact: previousImpact,
|
9150 | viewport: viewport.frame
|
9151 | });
|
9152 | return updated;
|
9153 | });
|
9154 | return withUpdatedVisibility;
|
9155 | };
|
9156 |
|
9157 | var forceVisibleDisplacement = function forceVisibleDisplacement(current) {
|
9158 | if (current.isVisible) {
|
9159 | return current;
|
9160 | }
|
9161 |
|
9162 | return {
|
9163 | draggableId: current.draggableId,
|
9164 | isVisible: true,
|
9165 | shouldAnimate: false
|
9166 | };
|
9167 | };
|
9168 |
|
9169 | var withFirstRemoved = function withFirstRemoved(_ref2) {
|
9170 | var dragging = _ref2.dragging,
|
9171 | isVisibleInNewLocation = _ref2.isVisibleInNewLocation,
|
9172 | previousImpact = _ref2.previousImpact,
|
9173 | droppable = _ref2.droppable,
|
9174 | draggables = _ref2.draggables;
|
9175 | var last = previousImpact.movement.displaced;
|
9176 | !last.length ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot remove displacement from empty list') : invariant(false) : void 0;
|
9177 | var withFirstRestored = last.slice(1, last.length);
|
9178 |
|
9179 | if (!withFirstRestored.length) {
|
9180 | return withFirstRestored;
|
9181 | }
|
9182 |
|
9183 | if (isVisibleInNewLocation) {
|
9184 | return withFirstRestored;
|
9185 | }
|
9186 |
|
9187 | var axis = droppable.axis;
|
9188 | var sizeOfRestored = draggables[last[0].draggableId].page.marginBox[axis.size];
|
9189 | var sizeOfDragging = draggables[dragging].page.marginBox[axis.size];
|
9190 | var buffer = sizeOfRestored + sizeOfDragging;
|
9191 | var withUpdatedVisibility = withFirstRestored.map(function (displacement, index) {
|
9192 | if (index === 0) {
|
9193 | return forceVisibleDisplacement(displacement);
|
9194 | }
|
9195 |
|
9196 | if (buffer > 0) {
|
9197 | var current = draggables[displacement.draggableId];
|
9198 | var size = current.page.marginBox[axis.size];
|
9199 | buffer -= size;
|
9200 | return forceVisibleDisplacement(displacement);
|
9201 | }
|
9202 |
|
9203 | return {
|
9204 | draggableId: displacement.draggableId,
|
9205 | isVisible: false,
|
9206 | shouldAnimate: false
|
9207 | };
|
9208 | });
|
9209 | return withUpdatedVisibility;
|
9210 | };
|
9211 |
|
9212 | var inHomeList$1 = (function (_ref) {
|
9213 | var isMovingForward = _ref.isMovingForward,
|
9214 | draggableId = _ref.draggableId,
|
9215 | previousPageBorderBoxCenter = _ref.previousPageBorderBoxCenter,
|
9216 | previousImpact = _ref.previousImpact,
|
9217 | droppable = _ref.droppable,
|
9218 | draggables = _ref.draggables,
|
9219 | viewport = _ref.viewport;
|
9220 | var location = previousImpact.destination;
|
9221 | !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;
|
9222 | var draggable = draggables[draggableId];
|
9223 | var axis = droppable.axis;
|
9224 | var insideDroppable = getDraggablesInsideDroppable(droppable, draggables);
|
9225 | var startIndex = draggable.descriptor.index;
|
9226 | var currentIndex = location.index;
|
9227 | var proposedIndex = isMovingForward ? currentIndex + 1 : currentIndex - 1;
|
9228 |
|
9229 | if (proposedIndex > insideDroppable.length - 1) {
|
9230 | return null;
|
9231 | }
|
9232 |
|
9233 | if (proposedIndex < 0) {
|
9234 | return null;
|
9235 | }
|
9236 |
|
9237 | var destination = insideDroppable[proposedIndex];
|
9238 | var isMovingTowardStart = isMovingForward && proposedIndex <= startIndex || !isMovingForward && proposedIndex >= startIndex;
|
9239 |
|
9240 | var edge = function () {
|
9241 | if (!isMovingTowardStart) {
|
9242 | return isMovingForward ? 'end' : 'start';
|
9243 | }
|
9244 |
|
9245 | return isMovingForward ? 'start' : 'end';
|
9246 | }();
|
9247 |
|
9248 | var newPageBorderBoxCenter = moveToEdge({
|
9249 | source: draggable.page.borderBox,
|
9250 | sourceEdge: edge,
|
9251 | destination: destination.page.borderBox,
|
9252 | destinationEdge: edge,
|
9253 | destinationAxis: droppable.axis
|
9254 | });
|
9255 | var isVisibleInNewLocation = isTotallyVisibleInNewLocation({
|
9256 | draggable: draggable,
|
9257 | destination: droppable,
|
9258 | newPageBorderBoxCenter: newPageBorderBoxCenter,
|
9259 | viewport: viewport.frame
|
9260 | });
|
9261 | var displaced = isMovingTowardStart ? withFirstRemoved({
|
9262 | dragging: draggableId,
|
9263 | isVisibleInNewLocation: isVisibleInNewLocation,
|
9264 | previousImpact: previousImpact,
|
9265 | droppable: droppable,
|
9266 | draggables: draggables
|
9267 | }) : withFirstAdded({
|
9268 | add: destination.descriptor.id,
|
9269 | previousImpact: previousImpact,
|
9270 | droppable: droppable,
|
9271 | draggables: draggables,
|
9272 | viewport: viewport
|
9273 | });
|
9274 | var newImpact = {
|
9275 | movement: {
|
9276 | displaced: displaced,
|
9277 | amount: patch(axis.line, draggable.page.marginBox[axis.size]),
|
9278 | isBeyondStartPosition: proposedIndex > startIndex
|
9279 | },
|
9280 | destination: {
|
9281 | droppableId: droppable.descriptor.id,
|
9282 | index: proposedIndex
|
9283 | },
|
9284 | direction: droppable.axis.direction
|
9285 | };
|
9286 |
|
9287 | if (isVisibleInNewLocation) {
|
9288 | return {
|
9289 | pageBorderBoxCenter: withDroppableDisplacement(droppable, newPageBorderBoxCenter),
|
9290 | impact: newImpact,
|
9291 | scrollJumpRequest: null
|
9292 | };
|
9293 | }
|
9294 |
|
9295 | var distance$$1 = subtract(newPageBorderBoxCenter, previousPageBorderBoxCenter);
|
9296 | var distanceWithScroll = withDroppableDisplacement(droppable, distance$$1);
|
9297 | return {
|
9298 | pageBorderBoxCenter: previousPageBorderBoxCenter,
|
9299 | impact: newImpact,
|
9300 | scrollJumpRequest: distanceWithScroll
|
9301 | };
|
9302 | });
|
9303 |
|
9304 | var inForeignList$1 = (function (_ref) {
|
9305 | var isMovingForward = _ref.isMovingForward,
|
9306 | draggableId = _ref.draggableId,
|
9307 | previousImpact = _ref.previousImpact,
|
9308 | previousPageBorderBoxCenter = _ref.previousPageBorderBoxCenter,
|
9309 | droppable = _ref.droppable,
|
9310 | draggables = _ref.draggables,
|
9311 | viewport = _ref.viewport;
|
9312 | !previousImpact.destination ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot move to next index where there is no previous destination') : invariant(false) : void 0;
|
9313 | var location = previousImpact.destination;
|
9314 | var draggable = draggables[draggableId];
|
9315 | var axis = droppable.axis;
|
9316 | var insideForeignDroppable = getDraggablesInsideDroppable(droppable, draggables);
|
9317 | var currentIndex = location.index;
|
9318 | var proposedIndex = isMovingForward ? currentIndex + 1 : currentIndex - 1;
|
9319 | var lastIndex = insideForeignDroppable.length - 1;
|
9320 |
|
9321 | if (proposedIndex > insideForeignDroppable.length) {
|
9322 | return null;
|
9323 | }
|
9324 |
|
9325 | if (proposedIndex < 0) {
|
9326 | return null;
|
9327 | }
|
9328 |
|
9329 | var movingRelativeTo = insideForeignDroppable[Math.min(proposedIndex, lastIndex)];
|
9330 | var isMovingPastLastIndex = proposedIndex > lastIndex;
|
9331 | var sourceEdge = 'start';
|
9332 |
|
9333 | var destinationEdge = function () {
|
9334 | if (isMovingPastLastIndex) {
|
9335 | return 'end';
|
9336 | }
|
9337 |
|
9338 | return 'start';
|
9339 | }();
|
9340 |
|
9341 | var newPageBorderBoxCenter = moveToEdge({
|
9342 | source: draggable.page.borderBox,
|
9343 | sourceEdge: sourceEdge,
|
9344 | destination: movingRelativeTo.page.marginBox,
|
9345 | destinationEdge: destinationEdge,
|
9346 | destinationAxis: droppable.axis
|
9347 | });
|
9348 | var isVisibleInNewLocation = isTotallyVisibleInNewLocation({
|
9349 | draggable: draggable,
|
9350 | destination: droppable,
|
9351 | newPageBorderBoxCenter: newPageBorderBoxCenter,
|
9352 | viewport: viewport.frame
|
9353 | });
|
9354 |
|
9355 | var displaced = function () {
|
9356 | if (isMovingForward) {
|
9357 | return withFirstRemoved({
|
9358 | dragging: draggableId,
|
9359 | isVisibleInNewLocation: isVisibleInNewLocation,
|
9360 | previousImpact: previousImpact,
|
9361 | droppable: droppable,
|
9362 | draggables: draggables
|
9363 | });
|
9364 | }
|
9365 |
|
9366 | return withFirstAdded({
|
9367 | add: movingRelativeTo.descriptor.id,
|
9368 | previousImpact: previousImpact,
|
9369 | droppable: droppable,
|
9370 | draggables: draggables,
|
9371 | viewport: viewport
|
9372 | });
|
9373 | }();
|
9374 |
|
9375 | var newImpact = {
|
9376 | movement: {
|
9377 | displaced: displaced,
|
9378 | amount: patch(axis.line, draggable.page.marginBox[axis.size]),
|
9379 | isBeyondStartPosition: false
|
9380 | },
|
9381 | destination: {
|
9382 | droppableId: droppable.descriptor.id,
|
9383 | index: proposedIndex
|
9384 | },
|
9385 | direction: droppable.axis.direction
|
9386 | };
|
9387 |
|
9388 | if (isVisibleInNewLocation) {
|
9389 | return {
|
9390 | pageBorderBoxCenter: withDroppableDisplacement(droppable, newPageBorderBoxCenter),
|
9391 | impact: newImpact,
|
9392 | scrollJumpRequest: null
|
9393 | };
|
9394 | }
|
9395 |
|
9396 | var distanceMoving = subtract(newPageBorderBoxCenter, previousPageBorderBoxCenter);
|
9397 | var distanceWithScroll = withDroppableDisplacement(droppable, distanceMoving);
|
9398 | return {
|
9399 | pageBorderBoxCenter: previousPageBorderBoxCenter,
|
9400 | impact: newImpact,
|
9401 | scrollJumpRequest: distanceWithScroll
|
9402 | };
|
9403 | });
|
9404 |
|
9405 | var moveToNextIndex = (function (args) {
|
9406 | var draggableId = args.draggableId,
|
9407 | draggables = args.draggables,
|
9408 | droppable = args.droppable;
|
9409 | var draggable = draggables[draggableId];
|
9410 | var isInHomeList = draggable.descriptor.droppableId === droppable.descriptor.id;
|
9411 |
|
9412 | if (!droppable.isEnabled) {
|
9413 | return null;
|
9414 | }
|
9415 |
|
9416 | if (isInHomeList) {
|
9417 | return inHomeList$1(args);
|
9418 | }
|
9419 |
|
9420 | return inForeignList$1(args);
|
9421 | });
|
9422 |
|
9423 | var getClientSelection = function getClientSelection(pageBorderBoxCenter, currentScroll) {
|
9424 | return subtract(pageBorderBoxCenter, currentScroll);
|
9425 | };
|
9426 |
|
9427 | var moveInDirection = (function (_ref) {
|
9428 | var state = _ref.state,
|
9429 | type = _ref.type;
|
9430 |
|
9431 | var _ref2 = function () {
|
9432 | if (state.impact.destination) {
|
9433 | return {
|
9434 | droppable: state.dimensions.droppables[state.impact.destination.droppableId],
|
9435 | isMainAxisMovementAllowed: true
|
9436 | };
|
9437 | }
|
9438 |
|
9439 | return {
|
9440 | droppable: state.dimensions.droppables[state.critical.droppable.id],
|
9441 | isMainAxisMovementAllowed: false
|
9442 | };
|
9443 | }(),
|
9444 | droppable = _ref2.droppable,
|
9445 | isMainAxisMovementAllowed = _ref2.isMainAxisMovementAllowed;
|
9446 |
|
9447 | var direction = droppable.axis.direction;
|
9448 | var isMovingOnMainAxis = direction === 'vertical' && (type === 'MOVE_UP' || type === 'MOVE_DOWN') || direction === 'horizontal' && (type === 'MOVE_LEFT' || type === 'MOVE_RIGHT');
|
9449 |
|
9450 | if (isMovingOnMainAxis && !isMainAxisMovementAllowed) {
|
9451 | return null;
|
9452 | }
|
9453 |
|
9454 | var isMovingForward = type === 'MOVE_DOWN' || type === 'MOVE_RIGHT';
|
9455 |
|
9456 | if (isMovingOnMainAxis) {
|
9457 | var _result = moveToNextIndex({
|
9458 | isMovingForward: isMovingForward,
|
9459 | draggableId: state.critical.draggable.id,
|
9460 | droppable: droppable,
|
9461 | draggables: state.dimensions.draggables,
|
9462 | previousPageBorderBoxCenter: state.current.page.borderBoxCenter,
|
9463 | previousImpact: state.impact,
|
9464 | viewport: state.viewport
|
9465 | });
|
9466 |
|
9467 | if (!_result) {
|
9468 | return null;
|
9469 | }
|
9470 |
|
9471 | return {
|
9472 | impact: _result.impact,
|
9473 | clientSelection: getClientSelection(_result.pageBorderBoxCenter, state.viewport.scroll.current),
|
9474 | scrollJumpRequest: _result.scrollJumpRequest
|
9475 | };
|
9476 | }
|
9477 |
|
9478 | var home = getHomeLocation(state.critical);
|
9479 | var result = moveCrossAxis({
|
9480 | isMovingForward: isMovingForward,
|
9481 | pageBorderBoxCenter: state.current.page.borderBoxCenter,
|
9482 | draggableId: state.critical.draggable.id,
|
9483 | droppableId: droppable.descriptor.id,
|
9484 | home: home,
|
9485 | draggables: state.dimensions.draggables,
|
9486 | droppables: state.dimensions.droppables,
|
9487 | previousImpact: state.impact,
|
9488 | viewport: state.viewport
|
9489 | });
|
9490 |
|
9491 | if (!result) {
|
9492 | return null;
|
9493 | }
|
9494 |
|
9495 | return {
|
9496 | clientSelection: getClientSelection(result.pageBorderBoxCenter, state.viewport.scroll.current),
|
9497 | impact: result.impact,
|
9498 | scrollJumpRequest: null
|
9499 | };
|
9500 | });
|
9501 |
|
9502 | var scrollViewport = (function (viewport, newScroll) {
|
9503 | var diff = subtract(newScroll, viewport.scroll.initial);
|
9504 | var displacement = negate(diff);
|
9505 | var frame = cssBoxModel.getRect({
|
9506 | top: newScroll.y,
|
9507 | bottom: newScroll.y + viewport.frame.height,
|
9508 | left: newScroll.x,
|
9509 | right: newScroll.x + viewport.frame.width
|
9510 | });
|
9511 | var updated = {
|
9512 | frame: frame,
|
9513 | scroll: {
|
9514 | initial: viewport.scroll.initial,
|
9515 | max: viewport.scroll.max,
|
9516 | current: newScroll,
|
9517 | diff: {
|
9518 | value: diff,
|
9519 | displacement: displacement
|
9520 | }
|
9521 | }
|
9522 | };
|
9523 | return updated;
|
9524 | });
|
9525 |
|
9526 | var getHomeImpact = (function (critical, dimensions) {
|
9527 | var home = dimensions.droppables[critical.droppable.id];
|
9528 | var axis = home.axis;
|
9529 | var draggable = dimensions.draggables[critical.draggable.id];
|
9530 | return {
|
9531 | movement: {
|
9532 | displaced: [],
|
9533 | isBeyondStartPosition: false,
|
9534 | amount: patch(axis.line, draggable.client.marginBox[axis.size])
|
9535 | },
|
9536 | direction: axis.direction,
|
9537 | destination: getHomeLocation(critical)
|
9538 | };
|
9539 | });
|
9540 |
|
9541 | var getPageItemPositions = (function (client, windowScroll) {
|
9542 | return {
|
9543 | selection: add(client.selection, windowScroll),
|
9544 | borderBoxCenter: add(client.borderBoxCenter, windowScroll),
|
9545 | offset: add(client.offset, windowScroll)
|
9546 | };
|
9547 | });
|
9548 |
|
9549 | function isMovementAllowed(state) {
|
9550 | return state.phase === 'DRAGGING' || state.phase === 'COLLECTING';
|
9551 | }
|
9552 |
|
9553 | var idle = {
|
9554 | phase: 'IDLE'
|
9555 | };
|
9556 | var preparing = {
|
9557 | phase: 'PREPARING'
|
9558 | };
|
9559 |
|
9560 | var moveWithPositionUpdates = function moveWithPositionUpdates(_ref) {
|
9561 | var state = _ref.state,
|
9562 | clientSelection = _ref.clientSelection,
|
9563 | shouldAnimate = _ref.shouldAnimate,
|
9564 | viewport = _ref.viewport,
|
9565 | impact = _ref.impact,
|
9566 | scrollJumpRequest = _ref.scrollJumpRequest;
|
9567 | var newViewport = viewport || state.viewport;
|
9568 | var currentWindowScroll = newViewport.scroll.current;
|
9569 |
|
9570 | var client = function () {
|
9571 | var offset = subtract(clientSelection, state.initial.client.selection);
|
9572 | return {
|
9573 | offset: offset,
|
9574 | selection: clientSelection,
|
9575 | borderBoxCenter: add(state.initial.client.borderBoxCenter, offset)
|
9576 | };
|
9577 | }();
|
9578 |
|
9579 | var page = getPageItemPositions(client, currentWindowScroll);
|
9580 | var current = {
|
9581 | client: client,
|
9582 | page: page
|
9583 | };
|
9584 |
|
9585 | if (state.phase === 'COLLECTING') {
|
9586 | return _extends({
|
9587 | phase: 'COLLECTING'
|
9588 | }, state, {
|
9589 | current: current
|
9590 | });
|
9591 | }
|
9592 |
|
9593 | var newImpact = impact || getDragImpact({
|
9594 | pageBorderBoxCenter: page.borderBoxCenter,
|
9595 | draggable: state.dimensions.draggables[state.critical.draggable.id],
|
9596 | draggables: state.dimensions.draggables,
|
9597 | droppables: state.dimensions.droppables,
|
9598 | previousImpact: state.impact,
|
9599 | viewport: newViewport
|
9600 | });
|
9601 |
|
9602 | var result = _extends({}, state, {
|
9603 | current: current,
|
9604 | shouldAnimate: shouldAnimate,
|
9605 | impact: newImpact,
|
9606 | scrollJumpRequest: scrollJumpRequest || null,
|
9607 | viewport: newViewport
|
9608 | });
|
9609 |
|
9610 | return result;
|
9611 | };
|
9612 |
|
9613 | var reducer = (function (state, action) {
|
9614 | if (state === void 0) {
|
9615 | state = idle;
|
9616 | }
|
9617 |
|
9618 | if (action.type === 'CLEAN') {
|
9619 | return idle;
|
9620 | }
|
9621 |
|
9622 | if (action.type === 'PREPARE') {
|
9623 | return preparing;
|
9624 | }
|
9625 |
|
9626 | if (action.type === 'INITIAL_PUBLISH') {
|
9627 | !(state.phase === 'PREPARING') ? process.env.NODE_ENV !== "production" ? invariant(false, 'INITIAL_PUBLISH must come after a PREPARING phase') : invariant(false) : void 0;
|
9628 | var _action$payload = action.payload,
|
9629 | critical = _action$payload.critical,
|
9630 | client = _action$payload.client,
|
9631 | viewport = _action$payload.viewport,
|
9632 | dimensions = _action$payload.dimensions,
|
9633 | autoScrollMode = _action$payload.autoScrollMode;
|
9634 | var initial = {
|
9635 | client: client,
|
9636 | page: {
|
9637 | selection: add(client.selection, viewport.scroll.initial),
|
9638 | borderBoxCenter: add(client.selection, viewport.scroll.initial),
|
9639 | offset: origin
|
9640 | }
|
9641 | };
|
9642 | var result = {
|
9643 | phase: 'DRAGGING',
|
9644 | isDragging: true,
|
9645 | critical: critical,
|
9646 | autoScrollMode: autoScrollMode,
|
9647 | dimensions: dimensions,
|
9648 | initial: initial,
|
9649 | current: initial,
|
9650 | impact: getHomeImpact(critical, dimensions),
|
9651 | viewport: viewport,
|
9652 | scrollJumpRequest: null,
|
9653 | shouldAnimate: false
|
9654 | };
|
9655 | return result;
|
9656 | }
|
9657 |
|
9658 | if (action.type === 'COLLECTION_STARTING') {
|
9659 | var _extends2;
|
9660 |
|
9661 | if (state.phase === 'COLLECTING' || state.phase === 'DROP_PENDING') {
|
9662 | return state;
|
9663 | }
|
9664 |
|
9665 | !(state.phase === 'DRAGGING') ? process.env.NODE_ENV !== "production" ? invariant(false, "Collection cannot start from phase " + state.phase) : invariant(false) : void 0;
|
9666 |
|
9667 | var _result = _extends({
|
9668 | phase: 'COLLECTING'
|
9669 | }, state, (_extends2 = {}, _extends2["phase"] = 'COLLECTING', _extends2));
|
9670 |
|
9671 | return _result;
|
9672 | }
|
9673 |
|
9674 | if (action.type === 'PUBLISH') {
|
9675 | !(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;
|
9676 | 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);
|
9677 | }
|
9678 |
|
9679 | if (action.type === 'MOVE') {
|
9680 | if (state.phase === 'PREPARING') {
|
9681 | return state;
|
9682 | }
|
9683 |
|
9684 | if (state.phase === 'DROP_PENDING') {
|
9685 | return state;
|
9686 | }
|
9687 |
|
9688 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false, action.type + " not permitted in phase " + state.phase) : invariant(false) : void 0;
|
9689 | var _action$payload2 = action.payload,
|
9690 | _client = _action$payload2.client,
|
9691 | shouldAnimate = _action$payload2.shouldAnimate;
|
9692 |
|
9693 | if (state.shouldAnimate === shouldAnimate && isEqual(_client, state.current.client.selection)) {
|
9694 | return state;
|
9695 | }
|
9696 |
|
9697 | var impact = state.autoScrollMode === 'JUMP' ? state.impact : null;
|
9698 | return moveWithPositionUpdates({
|
9699 | state: state,
|
9700 | clientSelection: _client,
|
9701 | impact: impact,
|
9702 | shouldAnimate: shouldAnimate
|
9703 | });
|
9704 | }
|
9705 |
|
9706 | if (action.type === 'UPDATE_DROPPABLE_SCROLL') {
|
9707 | var _extends3, _extends4;
|
9708 |
|
9709 | if (state.phase === 'PREPARING') {
|
9710 | return state;
|
9711 | }
|
9712 |
|
9713 | if (state.phase === 'DROP_PENDING') {
|
9714 | return state;
|
9715 | }
|
9716 |
|
9717 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false, action.type + " not permitted in phase " + state.phase) : invariant(false) : void 0;
|
9718 | var _action$payload3 = action.payload,
|
9719 | id = _action$payload3.id,
|
9720 | offset = _action$payload3.offset;
|
9721 | var target = state.dimensions.droppables[id];
|
9722 |
|
9723 | if (!target) {
|
9724 | return state;
|
9725 | }
|
9726 |
|
9727 | var updated = scrollDroppable(target, offset);
|
9728 |
|
9729 | var _dimensions = _extends({}, state.dimensions, {
|
9730 | droppables: _extends({}, state.dimensions.droppables, (_extends3 = {}, _extends3[id] = updated, _extends3))
|
9731 | });
|
9732 |
|
9733 | var _impact = function () {
|
9734 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
9735 |
|
9736 | if (state.autoScrollMode === 'JUMP') {
|
9737 | return state.impact;
|
9738 | }
|
9739 |
|
9740 | return getDragImpact({
|
9741 | pageBorderBoxCenter: state.current.page.borderBoxCenter,
|
9742 | draggable: _dimensions.draggables[state.critical.draggable.id],
|
9743 | draggables: _dimensions.draggables,
|
9744 | droppables: _dimensions.droppables,
|
9745 | previousImpact: state.impact,
|
9746 | viewport: state.viewport
|
9747 | });
|
9748 | }();
|
9749 |
|
9750 | return _extends({
|
9751 | phase: 'DRAGGING'
|
9752 | }, state, (_extends4 = {}, _extends4["phase"] = state.phase, _extends4.impact = _impact, _extends4.dimensions = _dimensions, _extends4.scrollJumpRequest = null, _extends4));
|
9753 | }
|
9754 |
|
9755 | if (action.type === 'UPDATE_DROPPABLE_IS_ENABLED') {
|
9756 | var _extends5, _extends6;
|
9757 |
|
9758 | if (state.phase === 'DROP_PENDING') {
|
9759 | return state;
|
9760 | }
|
9761 |
|
9762 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false, "Attempting to move in an unsupported phase " + state.phase) : invariant(false) : void 0;
|
9763 | var _action$payload4 = action.payload,
|
9764 | _id = _action$payload4.id,
|
9765 | isEnabled = _action$payload4.isEnabled;
|
9766 | var _target = state.dimensions.droppables[_id];
|
9767 | !_target ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot find Droppable[id: " + _id + "] to toggle its enabled state") : invariant(false) : void 0;
|
9768 | !(_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;
|
9769 |
|
9770 | var _updated = _extends({}, _target, {
|
9771 | isEnabled: isEnabled
|
9772 | });
|
9773 |
|
9774 | var _dimensions2 = _extends({}, state.dimensions, {
|
9775 | droppables: _extends({}, state.dimensions.droppables, (_extends5 = {}, _extends5[_id] = _updated, _extends5))
|
9776 | });
|
9777 |
|
9778 | var _impact2 = getDragImpact({
|
9779 | pageBorderBoxCenter: state.current.page.borderBoxCenter,
|
9780 | draggable: _dimensions2.draggables[state.critical.draggable.id],
|
9781 | draggables: _dimensions2.draggables,
|
9782 | droppables: _dimensions2.droppables,
|
9783 | previousImpact: state.impact,
|
9784 | viewport: state.viewport
|
9785 | });
|
9786 |
|
9787 | return _extends({
|
9788 | phase: 'DRAGGING'
|
9789 | }, state, (_extends6 = {}, _extends6["phase"] = state.phase, _extends6.impact = _impact2, _extends6.dimensions = _dimensions2, _extends6));
|
9790 | }
|
9791 |
|
9792 | if (action.type === 'MOVE_BY_WINDOW_SCROLL') {
|
9793 | if (state.phase === 'PREPARING') {
|
9794 | return state;
|
9795 | }
|
9796 |
|
9797 | if (state.phase === 'DROP_PENDING' || state.phase === 'DROP_ANIMATING') {
|
9798 | return state;
|
9799 | }
|
9800 |
|
9801 | !isMovementAllowed(state) ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot move by window in phase " + state.phase) : invariant(false) : void 0;
|
9802 | var newScroll = action.payload.scroll;
|
9803 |
|
9804 | if (isEqual(state.viewport.scroll.current, newScroll)) {
|
9805 | return state;
|
9806 | }
|
9807 |
|
9808 | var isJumpScrolling = state.autoScrollMode === 'JUMP';
|
9809 |
|
9810 | var _impact3 = isJumpScrolling ? state.impact : null;
|
9811 |
|
9812 | var _viewport = scrollViewport(state.viewport, newScroll);
|
9813 |
|
9814 | return moveWithPositionUpdates({
|
9815 | state: state,
|
9816 | clientSelection: state.current.client.selection,
|
9817 | viewport: _viewport,
|
9818 | shouldAnimate: false,
|
9819 | impact: _impact3
|
9820 | });
|
9821 | }
|
9822 |
|
9823 | if (action.type === 'UPDATE_VIEWPORT_MAX_SCROLL') {
|
9824 | var _extends7;
|
9825 |
|
9826 | !state.isDragging ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot update the max viewport scroll if not dragging') : invariant(false) : void 0;
|
9827 | var existing = state.viewport;
|
9828 |
|
9829 | var _viewport2 = _extends({}, existing, {
|
9830 | scroll: _extends({}, existing.scroll, {
|
9831 | max: action.payload
|
9832 | })
|
9833 | });
|
9834 |
|
9835 | return _extends({
|
9836 | phase: 'DRAGGING'
|
9837 | }, state, (_extends7 = {}, _extends7["phase"] = state.phase, _extends7.viewport = _viewport2, _extends7));
|
9838 | }
|
9839 |
|
9840 | if (action.type === 'MOVE_UP' || action.type === 'MOVE_DOWN' || action.type === 'MOVE_LEFT' || action.type === 'MOVE_RIGHT') {
|
9841 | if (state.phase === 'PREPARING') {
|
9842 | return state;
|
9843 | }
|
9844 |
|
9845 | if (state.phase === 'COLLECTING' || state.phase === 'DROP_PENDING') {
|
9846 | return state;
|
9847 | }
|
9848 |
|
9849 | !(state.phase === 'DRAGGING') ? process.env.NODE_ENV !== "production" ? invariant(false, action.type + " received while not in DRAGGING phase") : invariant(false) : void 0;
|
9850 |
|
9851 | var _result2 = moveInDirection({
|
9852 | state: state,
|
9853 | type: action.type
|
9854 | });
|
9855 |
|
9856 | if (!_result2) {
|
9857 | return state;
|
9858 | }
|
9859 |
|
9860 | return moveWithPositionUpdates({
|
9861 | state: state,
|
9862 | impact: _result2.impact,
|
9863 | clientSelection: _result2.clientSelection,
|
9864 | shouldAnimate: true,
|
9865 | scrollJumpRequest: _result2.scrollJumpRequest
|
9866 | });
|
9867 | }
|
9868 |
|
9869 | if (action.type === 'DROP_PENDING') {
|
9870 | var _extends8;
|
9871 |
|
9872 | var reason = action.payload.reason;
|
9873 | !(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;
|
9874 |
|
9875 | var newState = _extends({
|
9876 | phase: 'DROP_PENDING'
|
9877 | }, state, (_extends8 = {}, _extends8["phase"] = 'DROP_PENDING', _extends8.isWaiting = true, _extends8.reason = reason, _extends8));
|
9878 |
|
9879 | return newState;
|
9880 | }
|
9881 |
|
9882 | if (action.type === 'DROP_ANIMATE') {
|
9883 | var pending = action.payload;
|
9884 | !(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;
|
9885 | var _result3 = {
|
9886 | phase: 'DROP_ANIMATING',
|
9887 | pending: pending,
|
9888 | dimensions: state.dimensions
|
9889 | };
|
9890 | return _result3;
|
9891 | }
|
9892 |
|
9893 | if (action.type === 'DROP_COMPLETE') {
|
9894 | return idle;
|
9895 | }
|
9896 |
|
9897 | return state;
|
9898 | });
|
9899 |
|
9900 | var lift = function lift(args) {
|
9901 | return {
|
9902 | type: 'LIFT',
|
9903 | payload: args
|
9904 | };
|
9905 | };
|
9906 | var initialPublish = function initialPublish(args) {
|
9907 | return {
|
9908 | type: 'INITIAL_PUBLISH',
|
9909 | payload: args
|
9910 | };
|
9911 | };
|
9912 | var publish = function publish(args) {
|
9913 | return {
|
9914 | type: 'PUBLISH',
|
9915 | payload: args
|
9916 | };
|
9917 | };
|
9918 | var collectionStarting = function collectionStarting() {
|
9919 | return {
|
9920 | type: 'COLLECTION_STARTING',
|
9921 | payload: null
|
9922 | };
|
9923 | };
|
9924 | var updateDroppableScroll = function updateDroppableScroll(args) {
|
9925 | return {
|
9926 | type: 'UPDATE_DROPPABLE_SCROLL',
|
9927 | payload: args
|
9928 | };
|
9929 | };
|
9930 | var updateDroppableIsEnabled = function updateDroppableIsEnabled(args) {
|
9931 | return {
|
9932 | type: 'UPDATE_DROPPABLE_IS_ENABLED',
|
9933 | payload: args
|
9934 | };
|
9935 | };
|
9936 | var move = function move(args) {
|
9937 | return {
|
9938 | type: 'MOVE',
|
9939 | payload: args
|
9940 | };
|
9941 | };
|
9942 | var moveByWindowScroll = function moveByWindowScroll(args) {
|
9943 | return {
|
9944 | type: 'MOVE_BY_WINDOW_SCROLL',
|
9945 | payload: args
|
9946 | };
|
9947 | };
|
9948 | var updateViewportMaxScroll = function updateViewportMaxScroll(max) {
|
9949 | return {
|
9950 | type: 'UPDATE_VIEWPORT_MAX_SCROLL',
|
9951 | payload: max
|
9952 | };
|
9953 | };
|
9954 | var moveUp = function moveUp() {
|
9955 | return {
|
9956 | type: 'MOVE_UP',
|
9957 | payload: null
|
9958 | };
|
9959 | };
|
9960 | var moveDown = function moveDown() {
|
9961 | return {
|
9962 | type: 'MOVE_DOWN',
|
9963 | payload: null
|
9964 | };
|
9965 | };
|
9966 | var moveRight = function moveRight() {
|
9967 | return {
|
9968 | type: 'MOVE_RIGHT',
|
9969 | payload: null
|
9970 | };
|
9971 | };
|
9972 | var moveLeft = function moveLeft() {
|
9973 | return {
|
9974 | type: 'MOVE_LEFT',
|
9975 | payload: null
|
9976 | };
|
9977 | };
|
9978 | var clean = function clean() {
|
9979 | return {
|
9980 | type: 'CLEAN',
|
9981 | payload: null
|
9982 | };
|
9983 | };
|
9984 | var prepare = function prepare() {
|
9985 | return {
|
9986 | type: 'PREPARE',
|
9987 | payload: null
|
9988 | };
|
9989 | };
|
9990 | var animateDrop = function animateDrop(pending) {
|
9991 | return {
|
9992 | type: 'DROP_ANIMATE',
|
9993 | payload: pending
|
9994 | };
|
9995 | };
|
9996 | var completeDrop = function completeDrop(result) {
|
9997 | return {
|
9998 | type: 'DROP_COMPLETE',
|
9999 | payload: result
|
10000 | };
|
10001 | };
|
10002 | var drop = function drop(args) {
|
10003 | return {
|
10004 | type: 'DROP',
|
10005 | payload: args
|
10006 | };
|
10007 | };
|
10008 | var dropPending = function dropPending(args) {
|
10009 | return {
|
10010 | type: 'DROP_PENDING',
|
10011 | payload: args
|
10012 | };
|
10013 | };
|
10014 | var dropAnimationFinished = function dropAnimationFinished() {
|
10015 | return {
|
10016 | type: 'DROP_ANIMATION_FINISHED',
|
10017 | payload: null
|
10018 | };
|
10019 | };
|
10020 |
|
10021 | var lift$1 = (function (getMarshal) {
|
10022 | var timeoutId = null;
|
10023 |
|
10024 | var tryAbortCriticalCollection = function tryAbortCriticalCollection() {
|
10025 | if (timeoutId == null) {
|
10026 | return;
|
10027 | }
|
10028 |
|
10029 | clearTimeout(timeoutId);
|
10030 | timeoutId = null;
|
10031 | };
|
10032 |
|
10033 | return function (_ref) {
|
10034 | var getState = _ref.getState,
|
10035 | dispatch = _ref.dispatch;
|
10036 | return function (next) {
|
10037 | return function (action) {
|
10038 | if (action.type === 'CLEAN') {
|
10039 | tryAbortCriticalCollection();
|
10040 | next(action);
|
10041 | return;
|
10042 | }
|
10043 |
|
10044 | if (action.type !== 'LIFT') {
|
10045 | next(action);
|
10046 | return;
|
10047 | }
|
10048 |
|
10049 | !!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;
|
10050 | var marshal = getMarshal();
|
10051 | var _action$payload = action.payload,
|
10052 | id = _action$payload.id,
|
10053 | client = _action$payload.client,
|
10054 | autoScrollMode = _action$payload.autoScrollMode,
|
10055 | viewport = _action$payload.viewport;
|
10056 | var initial = getState();
|
10057 |
|
10058 | if (initial.phase === 'DROP_ANIMATING') {
|
10059 | dispatch(completeDrop(initial.pending.result));
|
10060 | }
|
10061 |
|
10062 | var postFlushState = getState();
|
10063 | !(postFlushState.phase === 'IDLE') ? process.env.NODE_ENV !== "production" ? invariant(false, 'Incorrect phase to start a drag') : invariant(false) : void 0;
|
10064 | dispatch(prepare());
|
10065 | timeoutId = setTimeout(function () {
|
10066 | timeoutId = null;
|
10067 | var state = getState();
|
10068 | !(state.phase === 'PREPARING') ? process.env.NODE_ENV !== "production" ? invariant(false, 'Invalid phase for completing lift') : invariant(false) : void 0;
|
10069 | var scrollOptions = {
|
10070 | shouldPublishImmediately: autoScrollMode === 'JUMP'
|
10071 | };
|
10072 | var request = {
|
10073 | draggableId: id,
|
10074 | scrollOptions: scrollOptions
|
10075 | };
|
10076 |
|
10077 | var _marshal$startPublish = marshal.startPublishing(request, viewport.scroll.current),
|
10078 | critical = _marshal$startPublish.critical,
|
10079 | dimensions = _marshal$startPublish.dimensions;
|
10080 |
|
10081 | dispatch(initialPublish({
|
10082 | critical: critical,
|
10083 | dimensions: dimensions,
|
10084 | client: client,
|
10085 | autoScrollMode: autoScrollMode,
|
10086 | viewport: viewport
|
10087 | }));
|
10088 | });
|
10089 | };
|
10090 | };
|
10091 | };
|
10092 | });
|
10093 |
|
10094 | var style = (function (marshal) {
|
10095 | return function () {
|
10096 | return function (next) {
|
10097 | return function (action) {
|
10098 | if (action.type === 'INITIAL_PUBLISH') {
|
10099 | marshal.dragging();
|
10100 | }
|
10101 |
|
10102 | if (action.type === 'COLLECTION_STARTING') {
|
10103 | marshal.collecting();
|
10104 | }
|
10105 |
|
10106 | if (action.type === 'PUBLISH') {
|
10107 | marshal.dragging();
|
10108 | }
|
10109 |
|
10110 | if (action.type === 'DROP_ANIMATE') {
|
10111 | marshal.dropping(action.payload.result.reason);
|
10112 | }
|
10113 |
|
10114 | if (action.type === 'CLEAN' || action.type === 'DROP_COMPLETE') {
|
10115 | marshal.resting();
|
10116 | }
|
10117 |
|
10118 | next(action);
|
10119 | };
|
10120 | };
|
10121 | };
|
10122 | });
|
10123 |
|
10124 | var getNewHomeClientBorderBoxCenter = (function (_ref) {
|
10125 | var movement = _ref.movement,
|
10126 | draggable = _ref.draggable,
|
10127 | draggables = _ref.draggables,
|
10128 | destination = _ref.destination;
|
10129 | var originalCenter = draggable.client.borderBox.center;
|
10130 |
|
10131 | if (destination == null) {
|
10132 | return originalCenter;
|
10133 | }
|
10134 |
|
10135 | var displaced = movement.displaced,
|
10136 | isBeyondStartPosition = movement.isBeyondStartPosition;
|
10137 | var axis = destination.axis;
|
10138 | var isWithinHomeDroppable = destination.descriptor.id === draggable.descriptor.droppableId;
|
10139 |
|
10140 | if (isWithinHomeDroppable && !displaced.length) {
|
10141 | return originalCenter;
|
10142 | }
|
10143 |
|
10144 | var draggablesInDestination = getDraggablesInsideDroppable(destination, draggables);
|
10145 |
|
10146 | var movingRelativeTo = function () {
|
10147 | if (isWithinHomeDroppable) {
|
10148 | return draggables[displaced[0].draggableId].client.borderBox;
|
10149 | }
|
10150 |
|
10151 | if (displaced.length) {
|
10152 | return draggables[displaced[0].draggableId].client.borderBox;
|
10153 | }
|
10154 |
|
10155 | if (draggablesInDestination.length) {
|
10156 | return draggablesInDestination[draggablesInDestination.length - 1].client.marginBox;
|
10157 | }
|
10158 |
|
10159 | return destination.client.contentBox;
|
10160 | }();
|
10161 |
|
10162 | var _ref2 = function () {
|
10163 | if (isWithinHomeDroppable) {
|
10164 | if (isBeyondStartPosition) {
|
10165 | return {
|
10166 | sourceEdge: 'end',
|
10167 | destinationEdge: 'end'
|
10168 | };
|
10169 | }
|
10170 |
|
10171 | return {
|
10172 | sourceEdge: 'start',
|
10173 | destinationEdge: 'start'
|
10174 | };
|
10175 | }
|
10176 |
|
10177 | if (!displaced.length && draggablesInDestination.length) {
|
10178 | return {
|
10179 | sourceEdge: 'start',
|
10180 | destinationEdge: 'end'
|
10181 | };
|
10182 | }
|
10183 |
|
10184 | return {
|
10185 | sourceEdge: 'start',
|
10186 | destinationEdge: 'start'
|
10187 | };
|
10188 | }(),
|
10189 | sourceEdge = _ref2.sourceEdge,
|
10190 | destinationEdge = _ref2.destinationEdge;
|
10191 |
|
10192 | var source = draggable.client.borderBox;
|
10193 | var targetCenter = moveToEdge({
|
10194 | source: source,
|
10195 | sourceEdge: sourceEdge,
|
10196 | destination: movingRelativeTo,
|
10197 | destinationEdge: destinationEdge,
|
10198 | destinationAxis: axis
|
10199 | });
|
10200 | return targetCenter;
|
10201 | });
|
10202 |
|
10203 | var getScrollDisplacement = function getScrollDisplacement(droppable, viewport) {
|
10204 | return withDroppableDisplacement(droppable, viewport.scroll.diff.displacement);
|
10205 | };
|
10206 |
|
10207 | var drop$1 = (function (_ref) {
|
10208 | var getState = _ref.getState,
|
10209 | dispatch = _ref.dispatch;
|
10210 | return function (next) {
|
10211 | return function (action) {
|
10212 | if (action.type !== 'DROP') {
|
10213 | next(action);
|
10214 | return;
|
10215 | }
|
10216 |
|
10217 | var state = getState();
|
10218 | var reason = action.payload.reason;
|
10219 |
|
10220 | if (state.phase === 'COLLECTING') {
|
10221 | dispatch(dropPending({
|
10222 | reason: reason
|
10223 | }));
|
10224 | return;
|
10225 | }
|
10226 |
|
10227 | if (state.phase === 'PREPARING') {
|
10228 | dispatch(clean());
|
10229 | return;
|
10230 | }
|
10231 |
|
10232 | if (state.phase === 'IDLE') {
|
10233 | return;
|
10234 | }
|
10235 |
|
10236 | var isWaitingForDrop = state.phase === 'DROP_PENDING' && state.isWaiting;
|
10237 | !!isWaitingForDrop ? process.env.NODE_ENV !== "production" ? invariant(false, 'A DROP action occurred while DROP_PENDING and still waiting') : invariant(false) : void 0;
|
10238 | !(state.phase === 'DRAGGING' || state.phase === 'DROP_PENDING') ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot drop in phase: " + state.phase) : invariant(false) : void 0;
|
10239 | var critical = state.critical;
|
10240 | var dimensions = state.dimensions;
|
10241 | var impact = reason === 'DROP' ? state.impact : noImpact;
|
10242 | var home = dimensions.droppables[state.critical.droppable.id];
|
10243 | var draggable = dimensions.draggables[state.critical.draggable.id];
|
10244 | var droppable = impact && impact.destination ? dimensions.droppables[impact.destination.droppableId] : null;
|
10245 | var source = {
|
10246 | index: critical.draggable.index,
|
10247 | droppableId: critical.droppable.id
|
10248 | };
|
10249 | var destination = reason === 'DROP' ? impact.destination : null;
|
10250 | var result = {
|
10251 | draggableId: draggable.descriptor.id,
|
10252 | type: home.descriptor.type,
|
10253 | source: source,
|
10254 | destination: destination,
|
10255 | reason: reason
|
10256 | };
|
10257 |
|
10258 | var clientOffset = function () {
|
10259 | if (reason === 'CANCEL') {
|
10260 | return origin;
|
10261 | }
|
10262 |
|
10263 | var newBorderBoxClientCenter = getNewHomeClientBorderBoxCenter({
|
10264 | movement: impact.movement,
|
10265 | draggable: draggable,
|
10266 | draggables: dimensions.draggables,
|
10267 | destination: droppable
|
10268 | });
|
10269 | return subtract(newBorderBoxClientCenter, draggable.client.borderBox.center);
|
10270 | }();
|
10271 |
|
10272 | var newHomeOffset = add(clientOffset, getScrollDisplacement(droppable || home, state.viewport));
|
10273 | var isAnimationRequired = !isEqual(state.current.client.offset, newHomeOffset);
|
10274 | var pending = {
|
10275 | newHomeOffset: newHomeOffset,
|
10276 | result: result,
|
10277 | impact: impact
|
10278 | };
|
10279 |
|
10280 | if (isAnimationRequired) {
|
10281 | dispatch(animateDrop(pending));
|
10282 | return;
|
10283 | }
|
10284 |
|
10285 | dispatch(completeDrop(result));
|
10286 | };
|
10287 | };
|
10288 | });
|
10289 |
|
10290 | var onDragStart = function onDragStart(start) {
|
10291 | 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";
|
10292 | };
|
10293 |
|
10294 | var onDragUpdate = function onDragUpdate(update) {
|
10295 | if (!update.destination) {
|
10296 | return 'You are currently not dragging over a droppable area';
|
10297 | }
|
10298 |
|
10299 | if (update.source.droppableId === update.destination.droppableId) {
|
10300 | return "You have moved the item to position " + (update.destination.index + 1);
|
10301 | }
|
10302 |
|
10303 | 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 ";
|
10304 | };
|
10305 |
|
10306 | var onDragEnd = function onDragEnd(result) {
|
10307 | if (result.reason === 'CANCEL') {
|
10308 | return "\n Movement cancelled.\n The item has returned to its starting position of " + (result.source.index + 1) + "\n ";
|
10309 | }
|
10310 |
|
10311 | if (!result.destination) {
|
10312 | 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 ";
|
10313 | }
|
10314 |
|
10315 | if (result.source.droppableId === result.destination.droppableId) {
|
10316 | if (result.source.index === result.destination.index) {
|
10317 | return "\n You have dropped the item.\n It has been dropped on its starting position of " + (result.source.index + 1) + "\n ";
|
10318 | }
|
10319 |
|
10320 | return "\n You have dropped the item.\n It has moved from position " + (result.source.index + 1) + " to " + (result.destination.index + 1) + "\n ";
|
10321 | }
|
10322 |
|
10323 | 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 ";
|
10324 | };
|
10325 |
|
10326 | var preset = {
|
10327 | onDragStart: onDragStart,
|
10328 | onDragUpdate: onDragUpdate,
|
10329 | onDragEnd: onDragEnd
|
10330 | };
|
10331 |
|
10332 | var records = {};
|
10333 | var flag = '__react-beautiful-dnd-debug-timings-hook__';
|
10334 |
|
10335 | var isTimingsEnabled = function isTimingsEnabled() {
|
10336 | return Boolean(window[flag]);
|
10337 | };
|
10338 |
|
10339 | var start = function start(key) {
|
10340 | if (process.env.NODE_ENV !== 'production') {
|
10341 | if (!isTimingsEnabled()) {
|
10342 | return;
|
10343 | }
|
10344 |
|
10345 | var now = performance.now();
|
10346 | records[key] = now;
|
10347 | }
|
10348 | };
|
10349 | var finish = function finish(key) {
|
10350 | if (process.env.NODE_ENV !== 'production') {
|
10351 | if (!isTimingsEnabled()) {
|
10352 | return;
|
10353 | }
|
10354 |
|
10355 | var now = performance.now();
|
10356 | var previous = records[key];
|
10357 | !previous ? process.env.NODE_ENV !== "production" ? invariant(false, 'cannot finish timing as no previous time found') : invariant(false) : void 0;
|
10358 | var result = now - previous;
|
10359 | var rounded = result.toFixed(2);
|
10360 |
|
10361 | var style = function () {
|
10362 | if (result < 12) {
|
10363 | return {
|
10364 | textColor: 'green',
|
10365 | symbol: '✅'
|
10366 | };
|
10367 | }
|
10368 |
|
10369 | if (result < 40) {
|
10370 | return {
|
10371 | textColor: 'orange',
|
10372 | symbol: '⚠️'
|
10373 | };
|
10374 | }
|
10375 |
|
10376 | return {
|
10377 | textColor: 'red',
|
10378 | symbol: '❌'
|
10379 | };
|
10380 | }();
|
10381 |
|
10382 | 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;');
|
10383 | }
|
10384 | };
|
10385 |
|
10386 | var withTimings = function withTimings(key, fn) {
|
10387 | start(key);
|
10388 | fn();
|
10389 | finish(key);
|
10390 | };
|
10391 |
|
10392 | var areLocationsEqual = function areLocationsEqual(first, second) {
|
10393 | if (first == null && second == null) {
|
10394 | return true;
|
10395 | }
|
10396 |
|
10397 | if (first == null || second == null) {
|
10398 | return false;
|
10399 | }
|
10400 |
|
10401 | return first.droppableId === second.droppableId && first.index === second.index;
|
10402 | };
|
10403 |
|
10404 | var isCriticalEqual = function isCriticalEqual(first, second) {
|
10405 | if (first === second) {
|
10406 | return true;
|
10407 | }
|
10408 |
|
10409 | 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;
|
10410 | var isDroppableEqual = first.droppable.id === second.droppable.id && first.droppable.type === second.droppable.type;
|
10411 | return isDraggableEqual && isDroppableEqual;
|
10412 | };
|
10413 |
|
10414 | var getExpiringAnnounce = function getExpiringAnnounce(announce) {
|
10415 | var wasCalled = false;
|
10416 | var isExpired = false;
|
10417 | setTimeout(function () {
|
10418 | isExpired = true;
|
10419 | });
|
10420 |
|
10421 | var result = function result(message) {
|
10422 | if (wasCalled) {
|
10423 | if (process.env.NODE_ENV !== 'production') {
|
10424 | console.warn('Announcement already made. Not making a second announcement');
|
10425 | }
|
10426 |
|
10427 | return;
|
10428 | }
|
10429 |
|
10430 | if (isExpired) {
|
10431 | if (process.env.NODE_ENV !== 'production') {
|
10432 | console.warn("\n Announcements cannot be made asynchronously.\n Default message has already been announced.\n ");
|
10433 | }
|
10434 |
|
10435 | return;
|
10436 | }
|
10437 |
|
10438 | wasCalled = true;
|
10439 | announce(message);
|
10440 | };
|
10441 |
|
10442 | result.wasCalled = function () {
|
10443 | return wasCalled;
|
10444 | };
|
10445 |
|
10446 | return result;
|
10447 | };
|
10448 |
|
10449 | var getDragStart = function getDragStart(critical) {
|
10450 | return {
|
10451 | draggableId: critical.draggable.id,
|
10452 | type: critical.droppable.type,
|
10453 | source: {
|
10454 | droppableId: critical.droppable.id,
|
10455 | index: critical.draggable.index
|
10456 | }
|
10457 | };
|
10458 | };
|
10459 |
|
10460 | var hooks = (function (getHooks, announce) {
|
10461 | var execute = function execute(hook, data, getDefaultMessage) {
|
10462 | if (!hook) {
|
10463 | announce(getDefaultMessage(data));
|
10464 | return;
|
10465 | }
|
10466 |
|
10467 | var willExpire = getExpiringAnnounce(announce);
|
10468 | var provided = {
|
10469 | announce: willExpire
|
10470 | };
|
10471 | hook(data, provided);
|
10472 |
|
10473 | if (!willExpire.wasCalled()) {
|
10474 | announce(getDefaultMessage(data));
|
10475 | }
|
10476 | };
|
10477 |
|
10478 | var publisher = function () {
|
10479 | var lastLocation = null;
|
10480 | var lastCritical = null;
|
10481 | var _isDragStartPublished = false;
|
10482 |
|
10483 | var beforeStart = function beforeStart(critical) {
|
10484 | !!_isDragStartPublished ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot fire onBeforeDragStart as a drag start has already been published') : invariant(false) : void 0;
|
10485 | withTimings('onBeforeDragStart', function () {
|
10486 | var fn = getHooks().onBeforeDragStart;
|
10487 |
|
10488 | if (fn) {
|
10489 | fn(getDragStart(critical));
|
10490 | }
|
10491 | });
|
10492 | };
|
10493 |
|
10494 | var start$$1 = function start$$1(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 | var data = getDragStart(critical);
|
10497 | lastCritical = critical;
|
10498 | lastLocation = data.source;
|
10499 | _isDragStartPublished = true;
|
10500 | withTimings('onDragStart', function () {
|
10501 | return execute(getHooks().onDragStart, data, preset.onDragStart);
|
10502 | });
|
10503 | };
|
10504 |
|
10505 | var move = function move(critical, location) {
|
10506 | !(_isDragStartPublished && lastCritical) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot fire onDragMove when onDragStart has not been called') : invariant(false) : void 0;
|
10507 | var hasCriticalChanged = !isCriticalEqual(critical, lastCritical);
|
10508 |
|
10509 | if (hasCriticalChanged) {
|
10510 | lastCritical = critical;
|
10511 | }
|
10512 |
|
10513 | var hasLocationChanged = !areLocationsEqual(lastLocation, location);
|
10514 |
|
10515 | if (hasLocationChanged) {
|
10516 | lastLocation = location;
|
10517 | }
|
10518 |
|
10519 | if (!hasCriticalChanged && !hasLocationChanged) {
|
10520 | return;
|
10521 | }
|
10522 |
|
10523 | var data = _extends({}, getDragStart(critical), {
|
10524 | destination: location
|
10525 | });
|
10526 |
|
10527 | withTimings('onDragUpdate', function () {
|
10528 | return execute(getHooks().onDragUpdate, data, preset.onDragUpdate);
|
10529 | });
|
10530 | };
|
10531 |
|
10532 | var drop = function drop(result) {
|
10533 | !_isDragStartPublished ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot fire onDragEnd when there is no matching onDragStart') : invariant(false) : void 0;
|
10534 | _isDragStartPublished = false;
|
10535 | lastLocation = null;
|
10536 | lastCritical = null;
|
10537 | withTimings('onDragEnd', function () {
|
10538 | return execute(getHooks().onDragEnd, result, preset.onDragEnd);
|
10539 | });
|
10540 | };
|
10541 |
|
10542 | var abort = function abort() {
|
10543 | !(_isDragStartPublished && lastCritical) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot cancel when onDragStart not fired') : invariant(false) : void 0;
|
10544 |
|
10545 | var result = _extends({}, getDragStart(lastCritical), {
|
10546 | destination: null,
|
10547 | reason: 'CANCEL'
|
10548 | });
|
10549 |
|
10550 | drop(result);
|
10551 | };
|
10552 |
|
10553 | return {
|
10554 | beforeStart: beforeStart,
|
10555 | start: start$$1,
|
10556 | move: move,
|
10557 | drop: drop,
|
10558 | abort: abort,
|
10559 | isDragStartPublished: function isDragStartPublished() {
|
10560 | return _isDragStartPublished;
|
10561 | }
|
10562 | };
|
10563 | }();
|
10564 |
|
10565 | return function (store) {
|
10566 | return function (next) {
|
10567 | return function (action) {
|
10568 | if (action.type === 'INITIAL_PUBLISH') {
|
10569 | var critical = action.payload.critical;
|
10570 | publisher.beforeStart(critical);
|
10571 | next(action);
|
10572 | publisher.start(critical);
|
10573 | return;
|
10574 | }
|
10575 |
|
10576 | next(action);
|
10577 |
|
10578 | if (action.type === 'DROP_COMPLETE') {
|
10579 | var result = action.payload;
|
10580 | publisher.drop(result);
|
10581 | return;
|
10582 | }
|
10583 |
|
10584 | if (action.type === 'CLEAN') {
|
10585 | if (publisher.isDragStartPublished()) {
|
10586 | publisher.abort();
|
10587 | }
|
10588 |
|
10589 | return;
|
10590 | }
|
10591 |
|
10592 | if (!publisher.isDragStartPublished()) {
|
10593 | return;
|
10594 | }
|
10595 |
|
10596 | var state = store.getState();
|
10597 |
|
10598 | if (state.phase === 'DRAGGING') {
|
10599 | publisher.move(state.critical, state.impact.destination);
|
10600 | }
|
10601 | };
|
10602 | };
|
10603 | };
|
10604 | });
|
10605 |
|
10606 | var dropAnimationFinish = (function (store) {
|
10607 | return function (next) {
|
10608 | return function (action) {
|
10609 | if (action.type !== 'DROP_ANIMATION_FINISHED') {
|
10610 | next(action);
|
10611 | return;
|
10612 | }
|
10613 |
|
10614 | var state = store.getState();
|
10615 | !(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;
|
10616 | store.dispatch(completeDrop(state.pending.result));
|
10617 | };
|
10618 | };
|
10619 | });
|
10620 |
|
10621 | var dimensionMarshalStopper = (function (getMarshal) {
|
10622 | return function () {
|
10623 | return function (next) {
|
10624 | return function (action) {
|
10625 | if (action.type === 'DROP_COMPLETE' || action.type === 'CLEAN' || action.type === 'DROP_ANIMATE') {
|
10626 | var marshal = getMarshal();
|
10627 | marshal.stopPublishing();
|
10628 | }
|
10629 |
|
10630 | next(action);
|
10631 | };
|
10632 | };
|
10633 | };
|
10634 | });
|
10635 |
|
10636 | var shouldCancel = function shouldCancel(action) {
|
10637 | return action.type === 'CANCEL' || action.type === 'DROP_ANIMATE' || action.type === 'DROP' || action.type === 'DROP_COMPLETE' || action.type === 'COLLECTION_STARTING';
|
10638 | };
|
10639 |
|
10640 | var autoScroll = (function (getScroller) {
|
10641 | return function (store) {
|
10642 | return function (next) {
|
10643 | return function (action) {
|
10644 | if (shouldCancel(action)) {
|
10645 | getScroller().cancel();
|
10646 | next(action);
|
10647 | return;
|
10648 | }
|
10649 |
|
10650 | next(action);
|
10651 | var state = store.getState();
|
10652 |
|
10653 | if (state.phase !== 'DRAGGING') {
|
10654 | return;
|
10655 | }
|
10656 |
|
10657 | if (state.autoScrollMode === 'FLUID') {
|
10658 | getScroller().fluidScroll(state);
|
10659 | return;
|
10660 | }
|
10661 |
|
10662 | if (!state.scrollJumpRequest) {
|
10663 | return;
|
10664 | }
|
10665 |
|
10666 | getScroller().jumpScroll(state);
|
10667 | };
|
10668 | };
|
10669 | };
|
10670 | });
|
10671 |
|
10672 | var shouldCheckOnAction = function shouldCheckOnAction(action) {
|
10673 | 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';
|
10674 | };
|
10675 |
|
10676 | var hasDroppableOverChanged = function hasDroppableOverChanged(previous, current) {
|
10677 | if (!previous) {
|
10678 | return Boolean(current);
|
10679 | }
|
10680 |
|
10681 | if (!current) {
|
10682 | return Boolean(previous);
|
10683 | }
|
10684 |
|
10685 | return previous.droppableId !== current.droppableId;
|
10686 | };
|
10687 |
|
10688 | var getNewMaxScroll = function getNewMaxScroll(previous, current, action) {
|
10689 | if (!shouldCheckOnAction(action)) {
|
10690 | return null;
|
10691 | }
|
10692 |
|
10693 | if (!isMovementAllowed(previous) || !isMovementAllowed(current)) {
|
10694 | return null;
|
10695 | }
|
10696 |
|
10697 | if (!hasDroppableOverChanged(previous.impact.destination, current.impact.destination)) {
|
10698 | return null;
|
10699 | }
|
10700 |
|
10701 | var viewport = current.viewport;
|
10702 | var doc = document.documentElement;
|
10703 | !doc ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not find document.documentElement') : invariant(false) : void 0;
|
10704 | var maxScroll = getMaxScroll({
|
10705 | scrollHeight: doc.scrollHeight,
|
10706 | scrollWidth: doc.scrollWidth,
|
10707 | width: viewport.frame.width,
|
10708 | height: viewport.frame.height
|
10709 | });
|
10710 |
|
10711 | if (isEqual(maxScroll, viewport.scroll.max)) {
|
10712 | return null;
|
10713 | }
|
10714 |
|
10715 | return maxScroll;
|
10716 | };
|
10717 |
|
10718 | var maxScrollUpdater = (function (store) {
|
10719 | return function (next) {
|
10720 | return function (action) {
|
10721 | var previous = store.getState();
|
10722 | next(action);
|
10723 | var current = store.getState();
|
10724 | var maxScroll = getNewMaxScroll(previous, current, action);
|
10725 |
|
10726 | if (maxScroll) {
|
10727 | next(updateViewportMaxScroll(maxScroll));
|
10728 | }
|
10729 | };
|
10730 | };
|
10731 | });
|
10732 |
|
10733 | var composeEnhancers = typeof window === 'object' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : redux.compose;
|
10734 | var createStore = (function (_ref) {
|
10735 | var getDimensionMarshal = _ref.getDimensionMarshal,
|
10736 | styleMarshal = _ref.styleMarshal,
|
10737 | getHooks = _ref.getHooks,
|
10738 | announce = _ref.announce,
|
10739 | getScroller = _ref.getScroller;
|
10740 | return redux.createStore(reducer, composeEnhancers(redux.applyMiddleware(style(styleMarshal), dimensionMarshalStopper(getDimensionMarshal), lift$1(getDimensionMarshal), drop$1, dropAnimationFinish, maxScrollUpdater, autoScroll(getScroller), hooks(getHooks, announce))));
|
10741 | });
|
10742 |
|
10743 | var getEmptyMap = function getEmptyMap() {
|
10744 | return {
|
10745 | draggables: {},
|
10746 | droppables: {}
|
10747 | };
|
10748 | };
|
10749 |
|
10750 | var timingKey = 'Publish collection from DOM';
|
10751 | var createPublisher = (function (_ref) {
|
10752 | var getProvided = _ref.getProvided,
|
10753 | callbacks = _ref.callbacks;
|
10754 |
|
10755 | var advancedUsageWarning = function () {
|
10756 | if (process.env.NODE_ENV === 'production') {
|
10757 | return function () {};
|
10758 | }
|
10759 |
|
10760 | var hasAnnounced = false;
|
10761 | return function () {
|
10762 | if (hasAnnounced) {
|
10763 | return;
|
10764 | }
|
10765 |
|
10766 | hasAnnounced = true;
|
10767 |
|
10768 | if (process.env.NODE_ENV === 'production') {
|
10769 | return;
|
10770 | }
|
10771 |
|
10772 | 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());
|
10773 | };
|
10774 | }();
|
10775 |
|
10776 | var additions = getEmptyMap();
|
10777 | var removals = getEmptyMap();
|
10778 | var frameId = null;
|
10779 |
|
10780 | var reset = function reset() {
|
10781 | additions = getEmptyMap();
|
10782 | removals = getEmptyMap();
|
10783 | };
|
10784 |
|
10785 | var collect = function collect() {
|
10786 | advancedUsageWarning();
|
10787 |
|
10788 | if (frameId) {
|
10789 | return;
|
10790 | }
|
10791 |
|
10792 | frameId = requestAnimationFrame(function () {
|
10793 | frameId = null;
|
10794 | callbacks.collectionStarting();
|
10795 | start(timingKey);
|
10796 |
|
10797 | var _getProvided = getProvided(),
|
10798 | entries = _getProvided.entries,
|
10799 | collection = _getProvided.collection;
|
10800 |
|
10801 | var windowScroll = collection.initialWindowScroll;
|
10802 |
|
10803 | var draggables = _Object$keys(additions.draggables).map(function (id) {
|
10804 | return entries.draggables[id].getDimension(windowScroll);
|
10805 | });
|
10806 |
|
10807 | var droppables = _Object$keys(additions.droppables).map(function (id) {
|
10808 | return entries.droppables[id].callbacks.getDimensionAndWatchScroll(windowScroll, collection.scrollOptions);
|
10809 | });
|
10810 |
|
10811 | var result = {
|
10812 | additions: {
|
10813 | draggables: draggables,
|
10814 | droppables: droppables
|
10815 | },
|
10816 | removals: {
|
10817 | draggables: _Object$keys(removals.draggables),
|
10818 | droppables: _Object$keys(removals.droppables)
|
10819 | }
|
10820 | };
|
10821 | reset();
|
10822 | finish(timingKey);
|
10823 | callbacks.publish(result);
|
10824 | });
|
10825 | };
|
10826 |
|
10827 | var addDraggable = function addDraggable(id) {
|
10828 | additions.draggables[id] = true;
|
10829 |
|
10830 | if (removals.draggables[id]) {
|
10831 | delete removals.draggables[id];
|
10832 | }
|
10833 |
|
10834 | collect();
|
10835 | };
|
10836 |
|
10837 | var removeDraggable = function removeDraggable(id) {
|
10838 | removals.draggables[id] = true;
|
10839 |
|
10840 | if (additions.draggables[id]) {
|
10841 | delete additions.draggables[id];
|
10842 | }
|
10843 |
|
10844 | collect();
|
10845 | };
|
10846 |
|
10847 | var addDroppable = function addDroppable(id) {
|
10848 | additions.droppables[id] = true;
|
10849 |
|
10850 | if (removals.droppables[id]) {
|
10851 | delete removals.droppables[id];
|
10852 | }
|
10853 |
|
10854 | collect();
|
10855 | };
|
10856 |
|
10857 | var removeDroppable = function removeDroppable(id) {
|
10858 | removals.droppables[id] = true;
|
10859 |
|
10860 | if (additions.droppables[id]) {
|
10861 | delete additions.droppables[id];
|
10862 | }
|
10863 |
|
10864 | collect();
|
10865 | };
|
10866 |
|
10867 | var stop = function stop() {
|
10868 | if (!frameId) {
|
10869 | return;
|
10870 | }
|
10871 |
|
10872 | cancelAnimationFrame(frameId);
|
10873 | frameId = null;
|
10874 | reset();
|
10875 | };
|
10876 |
|
10877 | return {
|
10878 | addDraggable: addDraggable,
|
10879 | removeDraggable: removeDraggable,
|
10880 | addDroppable: addDroppable,
|
10881 | removeDroppable: removeDroppable,
|
10882 | stop: stop
|
10883 | };
|
10884 | });
|
10885 |
|
10886 | var createDimensionMarshal = (function (callbacks) {
|
10887 | var entries = {
|
10888 | droppables: {},
|
10889 | draggables: {}
|
10890 | };
|
10891 | var collection = null;
|
10892 | var publisher = createPublisher({
|
10893 | callbacks: {
|
10894 | publish: callbacks.publish,
|
10895 | collectionStarting: callbacks.collectionStarting
|
10896 | },
|
10897 | getProvided: function getProvided() {
|
10898 | !collection ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get scroll options when there is no collection') : invariant(false) : void 0;
|
10899 | return {
|
10900 | entries: entries,
|
10901 | collection: collection
|
10902 | };
|
10903 | }
|
10904 | });
|
10905 |
|
10906 | var registerDraggable = function registerDraggable(descriptor, getDimension) {
|
10907 | var entry = {
|
10908 | descriptor: descriptor,
|
10909 | getDimension: getDimension
|
10910 | };
|
10911 | entries.draggables[descriptor.id] = entry;
|
10912 |
|
10913 | if (!collection) {
|
10914 | return;
|
10915 | }
|
10916 |
|
10917 | if (collection.critical.draggable.type !== descriptor.type) {
|
10918 | return;
|
10919 | }
|
10920 |
|
10921 | publisher.addDraggable(descriptor.id);
|
10922 | };
|
10923 |
|
10924 | var updateDraggable = function updateDraggable(previous, descriptor, getDimension) {
|
10925 | !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;
|
10926 | delete entries.draggables[previous.id];
|
10927 | var entry = {
|
10928 | descriptor: descriptor,
|
10929 | getDimension: getDimension
|
10930 | };
|
10931 | entries.draggables[descriptor.id] = entry;
|
10932 | };
|
10933 |
|
10934 | var unregisterDraggable = function unregisterDraggable(descriptor) {
|
10935 | var entry = entries.draggables[descriptor.id];
|
10936 | !entry ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot unregister Draggable with id " + descriptor.id + " as it is not registered") : invariant(false) : void 0;
|
10937 |
|
10938 | if (entry.descriptor !== descriptor) {
|
10939 | return;
|
10940 | }
|
10941 |
|
10942 | delete entries.draggables[descriptor.id];
|
10943 |
|
10944 | if (!collection) {
|
10945 | return;
|
10946 | }
|
10947 |
|
10948 | !(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;
|
10949 |
|
10950 | if (descriptor.type !== collection.critical.draggable.type) {
|
10951 | return;
|
10952 | }
|
10953 |
|
10954 | publisher.removeDraggable(descriptor.id);
|
10955 | };
|
10956 |
|
10957 | var registerDroppable = function registerDroppable(descriptor, droppableCallbacks) {
|
10958 | var id = descriptor.id;
|
10959 | entries.droppables[id] = {
|
10960 | descriptor: descriptor,
|
10961 | callbacks: droppableCallbacks
|
10962 | };
|
10963 |
|
10964 | if (!collection) {
|
10965 | return;
|
10966 | }
|
10967 |
|
10968 | if (descriptor.type !== collection.critical.droppable.type) {
|
10969 | return;
|
10970 | }
|
10971 |
|
10972 | publisher.addDroppable(id);
|
10973 | };
|
10974 |
|
10975 | var updateDroppable = function updateDroppable(previous, descriptor, droppableCallbacks) {
|
10976 | !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;
|
10977 | delete entries.droppables[previous.id];
|
10978 | var entry = {
|
10979 | descriptor: descriptor,
|
10980 | callbacks: droppableCallbacks
|
10981 | };
|
10982 | entries.droppables[descriptor.id] = entry;
|
10983 |
|
10984 | if (collection) {
|
10985 | 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);
|
10986 | }
|
10987 | };
|
10988 |
|
10989 | var unregisterDroppable = function unregisterDroppable(descriptor) {
|
10990 | var entry = entries.droppables[descriptor.id];
|
10991 | !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;
|
10992 |
|
10993 | if (entry.descriptor !== descriptor) {
|
10994 | return;
|
10995 | }
|
10996 |
|
10997 | delete entries.droppables[descriptor.id];
|
10998 |
|
10999 | if (!collection) {
|
11000 | return;
|
11001 | }
|
11002 |
|
11003 | !(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;
|
11004 |
|
11005 | if (collection.critical.droppable.type !== descriptor.type) {
|
11006 | return;
|
11007 | }
|
11008 |
|
11009 | publisher.removeDroppable(descriptor.id);
|
11010 | };
|
11011 |
|
11012 | var updateDroppableIsEnabled = function updateDroppableIsEnabled(id, isEnabled) {
|
11013 | !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;
|
11014 |
|
11015 | if (!collection) {
|
11016 | return;
|
11017 | }
|
11018 |
|
11019 | callbacks.updateDroppableIsEnabled({
|
11020 | id: id,
|
11021 | isEnabled: isEnabled
|
11022 | });
|
11023 | };
|
11024 |
|
11025 | var updateDroppableScroll = function updateDroppableScroll(id, newScroll) {
|
11026 | !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;
|
11027 |
|
11028 | if (!collection) {
|
11029 | return;
|
11030 | }
|
11031 |
|
11032 | callbacks.updateDroppableScroll({
|
11033 | id: id,
|
11034 | offset: newScroll
|
11035 | });
|
11036 | };
|
11037 |
|
11038 | var scrollDroppable = function scrollDroppable(id, change) {
|
11039 | var entry = entries.droppables[id];
|
11040 | !entry ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot scroll Droppable " + id + " as it is not registered") : invariant(false) : void 0;
|
11041 |
|
11042 | if (!collection) {
|
11043 | return;
|
11044 | }
|
11045 |
|
11046 | entry.callbacks.scroll(change);
|
11047 | };
|
11048 |
|
11049 | var getInitialPublish = function getInitialPublish(args) {
|
11050 | var critical = args.critical,
|
11051 | scrollOptions = args.scrollOptions,
|
11052 | windowScroll = args.initialWindowScroll;
|
11053 | var timingKey = 'Initial collection from DOM';
|
11054 | start(timingKey);
|
11055 | var home = critical.droppable;
|
11056 |
|
11057 | var droppables = _Object$keys(entries.droppables).map(function (id) {
|
11058 | return entries.droppables[id];
|
11059 | }).filter(function (entry) {
|
11060 | return entry.descriptor.type === home.type;
|
11061 | }).map(function (entry) {
|
11062 | return entry.callbacks.getDimensionAndWatchScroll(windowScroll, scrollOptions);
|
11063 | }).reduce(function (previous, dimension) {
|
11064 | previous[dimension.descriptor.id] = dimension;
|
11065 | return previous;
|
11066 | }, {});
|
11067 |
|
11068 | var draggables = _Object$keys(entries.draggables).map(function (id) {
|
11069 | return entries.draggables[id];
|
11070 | }).filter(function (entry) {
|
11071 | return entry.descriptor.type === critical.draggable.type;
|
11072 | }).map(function (entry) {
|
11073 | return entry.getDimension(windowScroll);
|
11074 | }).reduce(function (previous, dimension) {
|
11075 | previous[dimension.descriptor.id] = dimension;
|
11076 | return previous;
|
11077 | }, {});
|
11078 |
|
11079 | finish(timingKey);
|
11080 | var dimensions = {
|
11081 | draggables: draggables,
|
11082 | droppables: droppables
|
11083 | };
|
11084 | var result = {
|
11085 | dimensions: dimensions,
|
11086 | critical: critical
|
11087 | };
|
11088 | return result;
|
11089 | };
|
11090 |
|
11091 | var stopPublishing = function stopPublishing() {
|
11092 | if (!collection) {
|
11093 | return;
|
11094 | }
|
11095 |
|
11096 | publisher.stop();
|
11097 | var home = collection.critical.droppable;
|
11098 |
|
11099 | _Object$keys(entries.droppables).filter(function (id) {
|
11100 | return entries.droppables[id].descriptor.type === home.type;
|
11101 | }).forEach(function (id) {
|
11102 | return entries.droppables[id].callbacks.unwatchScroll();
|
11103 | });
|
11104 |
|
11105 | collection = null;
|
11106 | };
|
11107 |
|
11108 | var startPublishing = function startPublishing(request, windowScroll) {
|
11109 | !!collection ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot start capturing critical dimensions as there is already a collection') : invariant(false) : void 0;
|
11110 | var entry = entries.draggables[request.draggableId];
|
11111 | !entry ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot find critical draggable entry') : invariant(false) : void 0;
|
11112 | var home = entries.droppables[entry.descriptor.droppableId];
|
11113 | !home ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot find critical droppable entry') : invariant(false) : void 0;
|
11114 | var critical = {
|
11115 | draggable: entry.descriptor,
|
11116 | droppable: home.descriptor
|
11117 | };
|
11118 | collection = {
|
11119 | scrollOptions: request.scrollOptions,
|
11120 | critical: critical,
|
11121 | initialWindowScroll: windowScroll
|
11122 | };
|
11123 | return getInitialPublish(collection);
|
11124 | };
|
11125 |
|
11126 | var marshal = {
|
11127 | registerDraggable: registerDraggable,
|
11128 | updateDraggable: updateDraggable,
|
11129 | unregisterDraggable: unregisterDraggable,
|
11130 | registerDroppable: registerDroppable,
|
11131 | updateDroppable: updateDroppable,
|
11132 | unregisterDroppable: unregisterDroppable,
|
11133 | updateDroppableIsEnabled: updateDroppableIsEnabled,
|
11134 | scrollDroppable: scrollDroppable,
|
11135 | updateDroppableScroll: updateDroppableScroll,
|
11136 | startPublishing: startPublishing,
|
11137 | stopPublishing: stopPublishing
|
11138 | };
|
11139 | return marshal;
|
11140 | });
|
11141 |
|
11142 | var physics = function () {
|
11143 | var base = {
|
11144 | stiffness: 1000,
|
11145 | damping: 60,
|
11146 | precision: 0.99
|
11147 | };
|
11148 |
|
11149 | var standard = _extends({}, base);
|
11150 |
|
11151 | var fast = _extends({}, base, {
|
11152 | stiffness: base.stiffness * 2
|
11153 | });
|
11154 |
|
11155 | return {
|
11156 | standard: standard,
|
11157 | fast: fast
|
11158 | };
|
11159 | }();
|
11160 | var css = {
|
11161 | outOfTheWay: 'transform 0.2s cubic-bezier(0.2, 0, 0, 1)'
|
11162 | };
|
11163 |
|
11164 | var prefix = 'data-react-beautiful-dnd';
|
11165 | var dragHandle = prefix + "-drag-handle";
|
11166 | var draggable = prefix + "-draggable";
|
11167 | var droppable = prefix + "-droppable";
|
11168 |
|
11169 | var getStyles = (function (styleContext) {
|
11170 | var dragHandleSelector = "[" + dragHandle + "=\"" + styleContext + "\"]";
|
11171 | var draggableSelector = "[" + draggable + "=\"" + styleContext + "\"]";
|
11172 | var droppableSelector = "[" + droppable + "=\"" + styleContext + "\"]";
|
11173 | var dragHandleStyles = {
|
11174 | base: "\n " + dragHandleSelector + " {\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n }\n ",
|
11175 | grabCursor: "\n " + dragHandleSelector + " {\n cursor: -webkit-grab;\n cursor: grab;\n }\n ",
|
11176 | blockPointerEvents: "\n " + dragHandleSelector + " {\n pointer-events: none;\n }\n "
|
11177 | };
|
11178 | var draggableStyles = {
|
11179 | animateMovement: "\n " + draggableSelector + " {\n transition: " + css.outOfTheWay + ";\n }\n "
|
11180 | };
|
11181 | var droppableStyles = {
|
11182 | base: "\n " + droppableSelector + " {\n overflow-anchor: none;\n }\n "
|
11183 | };
|
11184 | var bodyStyles = {
|
11185 | 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 "
|
11186 | };
|
11187 | var base = [dragHandleStyles.base, droppableStyles.base];
|
11188 | var resting = base.concat([dragHandleStyles.grabCursor]);
|
11189 | var collecting = base.concat([dragHandleStyles.blockPointerEvents, bodyStyles.whileActiveDragging]);
|
11190 | var dragging = collecting.concat([draggableStyles.animateMovement]);
|
11191 | var dropAnimating = base.concat([dragHandleStyles.grabCursor, draggableStyles.animateMovement]);
|
11192 | var userCancel = base.concat([draggableStyles.animateMovement]);
|
11193 | return {
|
11194 | resting: resting.join(''),
|
11195 | dragging: dragging.join(''),
|
11196 | dropAnimating: dropAnimating.join(''),
|
11197 | collecting: collecting.join(''),
|
11198 | userCancel: userCancel.join('')
|
11199 | };
|
11200 | });
|
11201 |
|
11202 | var count = 0;
|
11203 | var resetStyleContext = function resetStyleContext() {
|
11204 | count = 0;
|
11205 | };
|
11206 |
|
11207 | var getHead = function getHead() {
|
11208 | var head = document.querySelector('head');
|
11209 | !head ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot find the head to append a style to') : invariant(false) : void 0;
|
11210 | return head;
|
11211 | };
|
11212 |
|
11213 | var createStyleMarshal = (function () {
|
11214 | var context = "" + count++;
|
11215 | var styles = getStyles(context);
|
11216 | var el = null;
|
11217 | var setStyle = memoizeOne(function (proposed) {
|
11218 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot set style of style tag if not mounted') : invariant(false) : void 0;
|
11219 | el.innerHTML = proposed;
|
11220 | });
|
11221 |
|
11222 | var mount = function mount() {
|
11223 | !!el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Style marshal already mounted') : invariant(false) : void 0;
|
11224 | el = document.createElement('style');
|
11225 | el.type = 'text/css';
|
11226 | el.setAttribute(prefix, context);
|
11227 | getHead().appendChild(el);
|
11228 | setStyle(styles.resting);
|
11229 | };
|
11230 |
|
11231 | var collecting = function collecting() {
|
11232 | return setStyle(styles.collecting);
|
11233 | };
|
11234 |
|
11235 | var dragging = function dragging() {
|
11236 | return setStyle(styles.dragging);
|
11237 | };
|
11238 |
|
11239 | var dropping = function dropping(reason) {
|
11240 | if (reason === 'DROP') {
|
11241 | setStyle(styles.dropAnimating);
|
11242 | return;
|
11243 | }
|
11244 |
|
11245 | setStyle(styles.userCancel);
|
11246 | };
|
11247 |
|
11248 | var resting = function resting() {
|
11249 | return setStyle(styles.resting);
|
11250 | };
|
11251 |
|
11252 | var unmount = function unmount() {
|
11253 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot unmount style marshal as it is already unmounted') : invariant(false) : void 0;
|
11254 | getHead().removeChild(el);
|
11255 | el = null;
|
11256 | };
|
11257 |
|
11258 | var marshal = {
|
11259 | collecting: collecting,
|
11260 | dragging: dragging,
|
11261 | dropping: dropping,
|
11262 | resting: resting,
|
11263 | styleContext: context,
|
11264 | mount: mount,
|
11265 | unmount: unmount
|
11266 | };
|
11267 | return marshal;
|
11268 | });
|
11269 |
|
11270 | var canStartDrag = (function (state, id) {
|
11271 | if (state.phase === 'IDLE') {
|
11272 | return true;
|
11273 | }
|
11274 |
|
11275 | if (state.phase !== 'DROP_ANIMATING') {
|
11276 | return false;
|
11277 | }
|
11278 |
|
11279 | if (state.pending.result.draggableId === id) {
|
11280 | return false;
|
11281 | }
|
11282 |
|
11283 | return state.pending.result.reason === 'DROP';
|
11284 | });
|
11285 |
|
11286 | var scrollWindow = (function (change) {
|
11287 | window.scrollBy(change.x, change.y);
|
11288 | });
|
11289 |
|
11290 | var count$1 = 0;
|
11291 | var visuallyHidden = {
|
11292 | position: 'absolute',
|
11293 | width: '1px',
|
11294 | height: '1px',
|
11295 | margin: '-1px',
|
11296 | border: '0',
|
11297 | padding: '0',
|
11298 | overflow: 'hidden',
|
11299 | clip: 'rect(0 0 0 0)',
|
11300 | 'clip-path': 'inset(100%)'
|
11301 | };
|
11302 |
|
11303 | var getBody = function getBody() {
|
11304 | !document.body ? process.env.NODE_ENV !== "production" ? invariant(false, 'Announcer cannot find document.body') : invariant(false) : void 0;
|
11305 | return document.body;
|
11306 | };
|
11307 |
|
11308 | var createAnnouncer = (function () {
|
11309 | var id = "react-beautiful-dnd-announcement-" + count$1++;
|
11310 | var el = null;
|
11311 |
|
11312 | var announce = function announce(message) {
|
11313 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot announce to unmounted node') : invariant(false) : void 0;
|
11314 | el.textContent = message;
|
11315 | };
|
11316 |
|
11317 | var mount = function mount() {
|
11318 | !!el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Announcer already mounted') : invariant(false) : void 0;
|
11319 | el = document.createElement('div');
|
11320 | el.id = id;
|
11321 | el.setAttribute('aria-live', 'assertive');
|
11322 | el.setAttribute('role', 'log');
|
11323 | el.setAttribute('aria-atomic', 'true');
|
11324 |
|
11325 | _Object$assign(el.style, visuallyHidden);
|
11326 |
|
11327 | getBody().appendChild(el);
|
11328 | };
|
11329 |
|
11330 | var unmount = function unmount() {
|
11331 | !el ? process.env.NODE_ENV !== "production" ? invariant(false, 'Will not unmount annoucer as it is already unmounted') : invariant(false) : void 0;
|
11332 | getBody().removeChild(el);
|
11333 | el = null;
|
11334 | };
|
11335 |
|
11336 | var announcer = {
|
11337 | announce: announce,
|
11338 | id: id,
|
11339 | mount: mount,
|
11340 | unmount: unmount
|
11341 | };
|
11342 | return announcer;
|
11343 | });
|
11344 |
|
11345 | var getScrollableDroppables = memoizeOne(function (droppables) {
|
11346 | return toDroppableList(droppables).filter(function (droppable) {
|
11347 | if (!droppable.isEnabled) {
|
11348 | return false;
|
11349 | }
|
11350 |
|
11351 | if (!droppable.viewport.closestScrollable) {
|
11352 | return false;
|
11353 | }
|
11354 |
|
11355 | return true;
|
11356 | });
|
11357 | });
|
11358 |
|
11359 | var getScrollableDroppableOver = function getScrollableDroppableOver(target, droppables) {
|
11360 | var maybe = getScrollableDroppables(droppables).find(function (droppable) {
|
11361 | !droppable.viewport.closestScrollable ? process.env.NODE_ENV !== "production" ? invariant(false, 'Invalid result') : invariant(false) : void 0;
|
11362 | return isPositionInFrame(droppable.viewport.closestScrollable.framePageMarginBox)(target);
|
11363 | });
|
11364 | return maybe;
|
11365 | };
|
11366 |
|
11367 | var getBestScrollableDroppable = (function (_ref) {
|
11368 | var center = _ref.center,
|
11369 | destination = _ref.destination,
|
11370 | droppables = _ref.droppables;
|
11371 |
|
11372 | if (destination) {
|
11373 | var _dimension = droppables[destination.droppableId];
|
11374 |
|
11375 | if (!_dimension.viewport.closestScrollable) {
|
11376 | return null;
|
11377 | }
|
11378 |
|
11379 | return _dimension;
|
11380 | }
|
11381 |
|
11382 | var dimension = getScrollableDroppableOver(center, droppables);
|
11383 | return dimension;
|
11384 | });
|
11385 |
|
11386 | var smallestSigned = apply(function (value) {
|
11387 | if (value === 0) {
|
11388 | return 0;
|
11389 | }
|
11390 |
|
11391 | return value > 0 ? 1 : -1;
|
11392 | });
|
11393 | var getOverlap = function () {
|
11394 | var getRemainder = function getRemainder(target, max) {
|
11395 | if (target < 0) {
|
11396 | return target;
|
11397 | }
|
11398 |
|
11399 | if (target > max) {
|
11400 | return target - max;
|
11401 | }
|
11402 |
|
11403 | return 0;
|
11404 | };
|
11405 |
|
11406 | return function (_ref) {
|
11407 | var current = _ref.current,
|
11408 | max = _ref.max,
|
11409 | change = _ref.change;
|
11410 | var targetScroll = add(current, change);
|
11411 | var overlap = {
|
11412 | x: getRemainder(targetScroll.x, max.x),
|
11413 | y: getRemainder(targetScroll.y, max.y)
|
11414 | };
|
11415 |
|
11416 | if (isEqual(overlap, origin)) {
|
11417 | return null;
|
11418 | }
|
11419 |
|
11420 | return overlap;
|
11421 | };
|
11422 | }();
|
11423 | var canPartiallyScroll = function canPartiallyScroll(_ref2) {
|
11424 | var rawMax = _ref2.max,
|
11425 | current = _ref2.current,
|
11426 | change = _ref2.change;
|
11427 | var max = {
|
11428 | x: Math.max(current.x, rawMax.x),
|
11429 | y: Math.max(current.y, rawMax.y)
|
11430 | };
|
11431 | var smallestChange = smallestSigned(change);
|
11432 | var overlap = getOverlap({
|
11433 | max: max,
|
11434 | current: current,
|
11435 | change: smallestChange
|
11436 | });
|
11437 |
|
11438 | if (!overlap) {
|
11439 | return true;
|
11440 | }
|
11441 |
|
11442 | if (smallestChange.x !== 0 && overlap.x === 0) {
|
11443 | return true;
|
11444 | }
|
11445 |
|
11446 | if (smallestChange.y !== 0 && overlap.y === 0) {
|
11447 | return true;
|
11448 | }
|
11449 |
|
11450 | return false;
|
11451 | };
|
11452 | var canScrollWindow = function canScrollWindow(viewport, change) {
|
11453 | return canPartiallyScroll({
|
11454 | current: viewport.scroll.current,
|
11455 | max: viewport.scroll.max,
|
11456 | change: change
|
11457 | });
|
11458 | };
|
11459 | var getWindowOverlap = function getWindowOverlap(viewport, change) {
|
11460 | if (!canScrollWindow(viewport, change)) {
|
11461 | return null;
|
11462 | }
|
11463 |
|
11464 | var max = viewport.scroll.max;
|
11465 | var current = viewport.scroll.current;
|
11466 | return getOverlap({
|
11467 | current: current,
|
11468 | max: max,
|
11469 | change: change
|
11470 | });
|
11471 | };
|
11472 | var canScrollDroppable = function canScrollDroppable(droppable, change) {
|
11473 | var closest$$1 = droppable.viewport.closestScrollable;
|
11474 |
|
11475 | if (!closest$$1) {
|
11476 | return false;
|
11477 | }
|
11478 |
|
11479 | return canPartiallyScroll({
|
11480 | current: closest$$1.scroll.current,
|
11481 | max: closest$$1.scroll.max,
|
11482 | change: change
|
11483 | });
|
11484 | };
|
11485 | var getDroppableOverlap = function getDroppableOverlap(droppable, change) {
|
11486 | var closest$$1 = droppable.viewport.closestScrollable;
|
11487 |
|
11488 | if (!closest$$1) {
|
11489 | return null;
|
11490 | }
|
11491 |
|
11492 | if (!canScrollDroppable(droppable, change)) {
|
11493 | return null;
|
11494 | }
|
11495 |
|
11496 | return getOverlap({
|
11497 | current: closest$$1.scroll.current,
|
11498 | max: closest$$1.scroll.max,
|
11499 | change: change
|
11500 | });
|
11501 | };
|
11502 |
|
11503 | var config = {
|
11504 | startFrom: 0.25,
|
11505 | maxSpeedAt: 0.05,
|
11506 | maxScrollSpeed: 28,
|
11507 | ease: function ease(percentage) {
|
11508 | return Math.pow(percentage, 2);
|
11509 | }
|
11510 | };
|
11511 | var clean$1 = apply(function (value) {
|
11512 | return value === 0 ? 0 : value;
|
11513 | });
|
11514 | var getPixelThresholds = function getPixelThresholds(container, axis) {
|
11515 | var startFrom = container[axis.size] * config.startFrom;
|
11516 | var maxSpeedAt = container[axis.size] * config.maxSpeedAt;
|
11517 | var accelerationPlane = startFrom - maxSpeedAt;
|
11518 | var thresholds = {
|
11519 | startFrom: startFrom,
|
11520 | maxSpeedAt: maxSpeedAt,
|
11521 | accelerationPlane: accelerationPlane
|
11522 | };
|
11523 | return thresholds;
|
11524 | };
|
11525 |
|
11526 | var getSpeed = function getSpeed(distance$$1, thresholds) {
|
11527 | if (distance$$1 >= thresholds.startFrom) {
|
11528 | return 0;
|
11529 | }
|
11530 |
|
11531 | if (distance$$1 <= thresholds.maxSpeedAt) {
|
11532 | return config.maxScrollSpeed;
|
11533 | }
|
11534 |
|
11535 | var distancePastStart = thresholds.startFrom - distance$$1;
|
11536 | var percentage = distancePastStart / thresholds.accelerationPlane;
|
11537 | var transformed = config.ease(percentage);
|
11538 | var speed = config.maxScrollSpeed * transformed;
|
11539 | return speed;
|
11540 | };
|
11541 |
|
11542 | var adjustForSizeLimits = function adjustForSizeLimits(_ref) {
|
11543 | var container = _ref.container,
|
11544 | subject = _ref.subject,
|
11545 | proposedScroll = _ref.proposedScroll;
|
11546 | var isTooBigVertically = subject.height > container.height;
|
11547 | var isTooBigHorizontally = subject.width > container.width;
|
11548 |
|
11549 | if (!isTooBigHorizontally && !isTooBigVertically) {
|
11550 | return proposedScroll;
|
11551 | }
|
11552 |
|
11553 | if (isTooBigHorizontally && isTooBigVertically) {
|
11554 | return null;
|
11555 | }
|
11556 |
|
11557 | return {
|
11558 | x: isTooBigHorizontally ? 0 : proposedScroll.x,
|
11559 | y: isTooBigVertically ? 0 : proposedScroll.y
|
11560 | };
|
11561 | };
|
11562 |
|
11563 | var getRequiredScroll = function getRequiredScroll(_ref2) {
|
11564 | var container = _ref2.container,
|
11565 | subject = _ref2.subject,
|
11566 | center = _ref2.center;
|
11567 | var distance$$1 = {
|
11568 | top: center.y - container.top,
|
11569 | right: container.right - center.x,
|
11570 | bottom: container.bottom - center.y,
|
11571 | left: center.x - container.left
|
11572 | };
|
11573 |
|
11574 | var y = function () {
|
11575 | var thresholds = getPixelThresholds(container, vertical);
|
11576 | var isCloserToBottom = distance$$1.bottom < distance$$1.top;
|
11577 |
|
11578 | if (isCloserToBottom) {
|
11579 | return getSpeed(distance$$1.bottom, thresholds);
|
11580 | }
|
11581 |
|
11582 | return -1 * getSpeed(distance$$1.top, thresholds);
|
11583 | }();
|
11584 |
|
11585 | var x = function () {
|
11586 | var thresholds = getPixelThresholds(container, horizontal);
|
11587 | var isCloserToRight = distance$$1.right < distance$$1.left;
|
11588 |
|
11589 | if (isCloserToRight) {
|
11590 | return getSpeed(distance$$1.right, thresholds);
|
11591 | }
|
11592 |
|
11593 | return -1 * getSpeed(distance$$1.left, thresholds);
|
11594 | }();
|
11595 |
|
11596 | var required = clean$1({
|
11597 | x: x,
|
11598 | y: y
|
11599 | });
|
11600 |
|
11601 | if (isEqual(required, origin)) {
|
11602 | return null;
|
11603 | }
|
11604 |
|
11605 | var limited = adjustForSizeLimits({
|
11606 | container: container,
|
11607 | subject: subject,
|
11608 | proposedScroll: required
|
11609 | });
|
11610 |
|
11611 | if (!limited) {
|
11612 | return null;
|
11613 | }
|
11614 |
|
11615 | return isEqual(limited, origin) ? null : limited;
|
11616 | };
|
11617 |
|
11618 | var withPlaceholder = function withPlaceholder(droppable, draggable) {
|
11619 | var closest$$1 = droppable.viewport.closestScrollable;
|
11620 |
|
11621 | if (!closest$$1) {
|
11622 | return null;
|
11623 | }
|
11624 |
|
11625 | var isOverHome = droppable.descriptor.id === draggable.descriptor.droppableId;
|
11626 | var max = closest$$1.scroll.max;
|
11627 | var current = closest$$1.scroll.current;
|
11628 |
|
11629 | if (isOverHome) {
|
11630 | return {
|
11631 | max: max,
|
11632 | current: current
|
11633 | };
|
11634 | }
|
11635 |
|
11636 | var spaceForPlaceholder = patch(droppable.axis.line, draggable.placeholder.client.borderBox[droppable.axis.size]);
|
11637 | var newMax = add(max, spaceForPlaceholder);
|
11638 | var newCurrent = {
|
11639 | x: Math.min(current.x, newMax.x),
|
11640 | y: Math.min(current.y, newMax.y)
|
11641 | };
|
11642 | return {
|
11643 | max: newMax,
|
11644 | current: newCurrent
|
11645 | };
|
11646 | };
|
11647 |
|
11648 | var createFluidScroller = (function (_ref3) {
|
11649 | var scrollWindow = _ref3.scrollWindow,
|
11650 | scrollDroppable = _ref3.scrollDroppable;
|
11651 | var scheduleWindowScroll = rafSchd(scrollWindow);
|
11652 | var scheduleDroppableScroll = rafSchd(scrollDroppable);
|
11653 |
|
11654 | var scroller = function scroller(state) {
|
11655 | var center = state.current.page.borderBoxCenter;
|
11656 | var draggable = state.dimensions.draggables[state.critical.draggable.id];
|
11657 | var subject = draggable.page.marginBox;
|
11658 | var viewport = state.viewport;
|
11659 | var requiredWindowScroll = getRequiredScroll({
|
11660 | container: viewport.frame,
|
11661 | subject: subject,
|
11662 | center: center
|
11663 | });
|
11664 |
|
11665 | if (requiredWindowScroll && canScrollWindow(viewport, requiredWindowScroll)) {
|
11666 | scheduleWindowScroll(requiredWindowScroll);
|
11667 | return;
|
11668 | }
|
11669 |
|
11670 | var droppable = getBestScrollableDroppable({
|
11671 | center: center,
|
11672 | destination: state.impact.destination,
|
11673 | droppables: state.dimensions.droppables
|
11674 | });
|
11675 |
|
11676 | if (!droppable) {
|
11677 | return;
|
11678 | }
|
11679 |
|
11680 | var closestScrollable = droppable.viewport.closestScrollable;
|
11681 |
|
11682 | if (!closestScrollable) {
|
11683 | return;
|
11684 | }
|
11685 |
|
11686 | var requiredFrameScroll = getRequiredScroll({
|
11687 | container: closestScrollable.framePageMarginBox,
|
11688 | subject: subject,
|
11689 | center: center
|
11690 | });
|
11691 |
|
11692 | if (!requiredFrameScroll) {
|
11693 | return;
|
11694 | }
|
11695 |
|
11696 | var result = withPlaceholder(droppable, draggable);
|
11697 |
|
11698 | if (!result) {
|
11699 | return;
|
11700 | }
|
11701 |
|
11702 | var closest$$1 = droppable.viewport.closestScrollable;
|
11703 |
|
11704 | if (!closest$$1) {
|
11705 | return;
|
11706 | }
|
11707 |
|
11708 | var canScrollDroppable$$1 = canPartiallyScroll({
|
11709 | current: result.current,
|
11710 | max: result.max,
|
11711 | change: requiredFrameScroll
|
11712 | });
|
11713 |
|
11714 | if (canScrollDroppable$$1) {
|
11715 | scheduleDroppableScroll(droppable.descriptor.id, requiredFrameScroll);
|
11716 | }
|
11717 | };
|
11718 |
|
11719 | scroller.cancel = function () {
|
11720 | scheduleWindowScroll.cancel();
|
11721 | scheduleDroppableScroll.cancel();
|
11722 | };
|
11723 |
|
11724 | return scroller;
|
11725 | });
|
11726 |
|
11727 | var createJumpScroller = (function (_ref) {
|
11728 | var move = _ref.move,
|
11729 | scrollDroppable = _ref.scrollDroppable,
|
11730 | scrollWindow = _ref.scrollWindow;
|
11731 |
|
11732 | var moveByOffset = function moveByOffset(state, offset) {
|
11733 | var client = add(state.current.client.selection, offset);
|
11734 | move({
|
11735 | client: client,
|
11736 | shouldAnimate: true
|
11737 | });
|
11738 | };
|
11739 |
|
11740 | var scrollDroppableAsMuchAsItCan = function scrollDroppableAsMuchAsItCan(droppable, change) {
|
11741 | if (!canScrollDroppable(droppable, change)) {
|
11742 | return change;
|
11743 | }
|
11744 |
|
11745 | var overlap = getDroppableOverlap(droppable, change);
|
11746 |
|
11747 | if (!overlap) {
|
11748 | scrollDroppable(droppable.descriptor.id, change);
|
11749 | return null;
|
11750 | }
|
11751 |
|
11752 | var whatTheDroppableCanScroll = subtract(change, overlap);
|
11753 | scrollDroppable(droppable.descriptor.id, whatTheDroppableCanScroll);
|
11754 | var remainder = subtract(change, whatTheDroppableCanScroll);
|
11755 | return remainder;
|
11756 | };
|
11757 |
|
11758 | var scrollWindowAsMuchAsItCan = function scrollWindowAsMuchAsItCan(viewport, change) {
|
11759 | if (!canScrollWindow(viewport, change)) {
|
11760 | return change;
|
11761 | }
|
11762 |
|
11763 | var overlap = getWindowOverlap(viewport, change);
|
11764 |
|
11765 | if (!overlap) {
|
11766 | scrollWindow(change);
|
11767 | return null;
|
11768 | }
|
11769 |
|
11770 | var whatTheWindowCanScroll = subtract(change, overlap);
|
11771 | scrollWindow(whatTheWindowCanScroll);
|
11772 | var remainder = subtract(change, whatTheWindowCanScroll);
|
11773 | return remainder;
|
11774 | };
|
11775 |
|
11776 | var jumpScroller = function jumpScroller(state) {
|
11777 | var request = state.scrollJumpRequest;
|
11778 |
|
11779 | if (!request) {
|
11780 | return;
|
11781 | }
|
11782 |
|
11783 | var destination = state.impact.destination;
|
11784 | !destination ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot perform a jump scroll when there is no destination') : invariant(false) : void 0;
|
11785 | var droppableRemainder = scrollDroppableAsMuchAsItCan(state.dimensions.droppables[destination.droppableId], request);
|
11786 |
|
11787 | if (!droppableRemainder) {
|
11788 | return;
|
11789 | }
|
11790 |
|
11791 | var viewport = state.viewport;
|
11792 | var windowRemainder = scrollWindowAsMuchAsItCan(viewport, droppableRemainder);
|
11793 |
|
11794 | if (!windowRemainder) {
|
11795 | return;
|
11796 | }
|
11797 |
|
11798 | moveByOffset(state, windowRemainder);
|
11799 | };
|
11800 |
|
11801 | return jumpScroller;
|
11802 | });
|
11803 |
|
11804 | var createAutoScroller = (function (_ref) {
|
11805 | var scrollDroppable = _ref.scrollDroppable,
|
11806 | scrollWindow = _ref.scrollWindow,
|
11807 | move = _ref.move;
|
11808 | var fluidScroll = createFluidScroller({
|
11809 | scrollWindow: scrollWindow,
|
11810 | scrollDroppable: scrollDroppable
|
11811 | });
|
11812 | var jumpScroll = createJumpScroller({
|
11813 | move: move,
|
11814 | scrollWindow: scrollWindow,
|
11815 | scrollDroppable: scrollDroppable
|
11816 | });
|
11817 | var marshal = {
|
11818 | cancel: fluidScroll.cancel,
|
11819 | fluidScroll: fluidScroll,
|
11820 | jumpScroll: jumpScroll
|
11821 | };
|
11822 | return marshal;
|
11823 | });
|
11824 |
|
11825 | var prefix$1 = function prefix(key) {
|
11826 | return "private-react-beautiful-dnd-key-do-not-use-" + key;
|
11827 | };
|
11828 |
|
11829 | var storeKey = prefix$1('store');
|
11830 | var droppableIdKey = prefix$1('droppable-id');
|
11831 | var droppableTypeKey = prefix$1('droppable-type');
|
11832 | var dimensionMarshalKey = prefix$1('dimension-marshal');
|
11833 | var styleContextKey = prefix$1('style-context');
|
11834 | var canLiftContextKey = prefix$1('can-lift');
|
11835 |
|
11836 | var _DragDropContext$chil;
|
11837 | var resetServerContext = function resetServerContext() {
|
11838 | resetStyleContext();
|
11839 | };
|
11840 |
|
11841 | var printFatalDevError = function printFatalDevError(error) {
|
11842 | if (process.env.NODE_ENV === 'production') {
|
11843 | return;
|
11844 | }
|
11845 |
|
11846 | console.warn("\n An error has occurred while a drag is occurring.\n Any existing drag will be cancelled.\n\n Raw error:\n ");
|
11847 | console.error(error);
|
11848 | };
|
11849 |
|
11850 | var DragDropContext = function (_React$Component) {
|
11851 | _inheritsLoose(DragDropContext, _React$Component);
|
11852 |
|
11853 | function DragDropContext(props, context) {
|
11854 | var _this;
|
11855 |
|
11856 | _this = _React$Component.call(this, props, context) || this;
|
11857 | _this.store = void 0;
|
11858 | _this.dimensionMarshal = void 0;
|
11859 | _this.styleMarshal = void 0;
|
11860 | _this.autoScroller = void 0;
|
11861 | _this.announcer = void 0;
|
11862 | _this.unsubscribe = void 0;
|
11863 |
|
11864 | _this.canLift = function (id) {
|
11865 | return canStartDrag(_this.store.getState(), id);
|
11866 | };
|
11867 |
|
11868 | _this.onFatalError = function (error) {
|
11869 | printFatalDevError(error);
|
11870 |
|
11871 | var state = _this.store.getState();
|
11872 |
|
11873 | if (state.phase !== 'IDLE') {
|
11874 | _this.store.dispatch(clean());
|
11875 | }
|
11876 | };
|
11877 |
|
11878 | _this.onWindowError = function (error) {
|
11879 | return _this.onFatalError(error);
|
11880 | };
|
11881 |
|
11882 | _this.announcer = createAnnouncer();
|
11883 | _this.styleMarshal = createStyleMarshal();
|
11884 | _this.store = createStore({
|
11885 | getDimensionMarshal: function getDimensionMarshal() {
|
11886 | return _this.dimensionMarshal;
|
11887 | },
|
11888 | styleMarshal: _this.styleMarshal,
|
11889 | getHooks: function getHooks() {
|
11890 | return {
|
11891 | onBeforeDragStart: _this.props.onBeforeDragStart,
|
11892 | onDragStart: _this.props.onDragStart,
|
11893 | onDragEnd: _this.props.onDragEnd,
|
11894 | onDragUpdate: _this.props.onDragUpdate
|
11895 | };
|
11896 | },
|
11897 | announce: _this.announcer.announce,
|
11898 | getScroller: function getScroller() {
|
11899 | return _this.autoScroller;
|
11900 | }
|
11901 | });
|
11902 | var callbacks = redux.bindActionCreators({
|
11903 | collectionStarting: collectionStarting,
|
11904 | publish: publish,
|
11905 | updateDroppableScroll: updateDroppableScroll,
|
11906 | updateDroppableIsEnabled: updateDroppableIsEnabled
|
11907 | }, _this.store.dispatch);
|
11908 | _this.dimensionMarshal = createDimensionMarshal(callbacks);
|
11909 | _this.autoScroller = createAutoScroller(_extends({
|
11910 | scrollWindow: scrollWindow,
|
11911 | scrollDroppable: _this.dimensionMarshal.scrollDroppable
|
11912 | }, redux.bindActionCreators({
|
11913 | move: move
|
11914 | }, _this.store.dispatch)));
|
11915 | return _this;
|
11916 | }
|
11917 |
|
11918 | var _proto = DragDropContext.prototype;
|
11919 |
|
11920 | _proto.getChildContext = function getChildContext() {
|
11921 | var _ref;
|
11922 |
|
11923 | return _ref = {}, _ref[storeKey] = this.store, _ref[dimensionMarshalKey] = this.dimensionMarshal, _ref[styleContextKey] = this.styleMarshal.styleContext, _ref[canLiftContextKey] = this.canLift, _ref;
|
11924 | };
|
11925 |
|
11926 | _proto.componentDidMount = function componentDidMount() {
|
11927 | window.addEventListener('error', this.onWindowError);
|
11928 | this.styleMarshal.mount();
|
11929 | this.announcer.mount();
|
11930 | };
|
11931 |
|
11932 | _proto.componentDidCatch = function componentDidCatch(error) {
|
11933 | this.onFatalError(error);
|
11934 |
|
11935 | if (error.message.indexOf('Invariant failed') !== -1) {
|
11936 | this.setState({});
|
11937 | return;
|
11938 | }
|
11939 |
|
11940 | throw error;
|
11941 | };
|
11942 |
|
11943 | _proto.componentWillUnmount = function componentWillUnmount() {
|
11944 | window.removeEventListener('error', this.onWindowError);
|
11945 | var state = this.store.getState();
|
11946 |
|
11947 | if (state.phase !== 'IDLE') {
|
11948 | this.store.dispatch(clean());
|
11949 | }
|
11950 |
|
11951 | this.styleMarshal.unmount();
|
11952 | this.announcer.unmount();
|
11953 | };
|
11954 |
|
11955 | _proto.render = function render() {
|
11956 | return this.props.children;
|
11957 | };
|
11958 |
|
11959 | return DragDropContext;
|
11960 | }(React__default.Component);
|
11961 |
|
11962 | DragDropContext.childContextTypes = (_DragDropContext$chil = {}, _DragDropContext$chil[storeKey] = PropTypes.shape({
|
11963 | dispatch: PropTypes.func.isRequired,
|
11964 | subscribe: PropTypes.func.isRequired,
|
11965 | getState: PropTypes.func.isRequired
|
11966 | }).isRequired, _DragDropContext$chil[dimensionMarshalKey] = PropTypes.object.isRequired, _DragDropContext$chil[styleContextKey] = PropTypes.string.isRequired, _DragDropContext$chil[canLiftContextKey] = PropTypes.func.isRequired, _DragDropContext$chil);
|
11967 |
|
11968 | var isScrollable = function isScrollable() {
|
11969 | for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
11970 | values[_key] = arguments[_key];
|
11971 | }
|
11972 |
|
11973 | return values.some(function (value) {
|
11974 | return value === 'auto' || value === 'scroll';
|
11975 | });
|
11976 | };
|
11977 |
|
11978 | var isElementScrollable = function isElementScrollable(el) {
|
11979 | var style = window.getComputedStyle(el);
|
11980 | return isScrollable(style.overflow, style.overflowY, style.overflowX);
|
11981 | };
|
11982 |
|
11983 | var getClosestScrollable = function getClosestScrollable(el) {
|
11984 | if (el == null) {
|
11985 | return null;
|
11986 | }
|
11987 |
|
11988 | if (!isElementScrollable(el)) {
|
11989 | return getClosestScrollable(el.parentElement);
|
11990 | }
|
11991 |
|
11992 | return el;
|
11993 | };
|
11994 |
|
11995 | var _DroppableDimensionPu;
|
11996 |
|
11997 | var getScroll = function getScroll(el) {
|
11998 | return {
|
11999 | x: el.scrollLeft,
|
12000 | y: el.scrollTop
|
12001 | };
|
12002 | };
|
12003 |
|
12004 | var checkForNestedScrollContainers = function checkForNestedScrollContainers(scrollable) {
|
12005 | if (process.env.NODE_ENV === 'production') {
|
12006 | return;
|
12007 | }
|
12008 |
|
12009 | if (!scrollable) {
|
12010 | return;
|
12011 | }
|
12012 |
|
12013 | var anotherScrollParent = getClosestScrollable(scrollable.parentElement);
|
12014 |
|
12015 | if (!anotherScrollParent) {
|
12016 | return;
|
12017 | }
|
12018 |
|
12019 | 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 ");
|
12020 | };
|
12021 |
|
12022 | var listenerOptions = {
|
12023 | passive: true
|
12024 | };
|
12025 |
|
12026 | var DroppableDimensionPublisher = function (_React$Component) {
|
12027 | _inheritsLoose(DroppableDimensionPublisher, _React$Component);
|
12028 |
|
12029 | function DroppableDimensionPublisher(props, context) {
|
12030 | var _this;
|
12031 |
|
12032 | _this = _React$Component.call(this, props, context) || this;
|
12033 | _this.watchingScroll = null;
|
12034 | _this.callbacks = void 0;
|
12035 | _this.publishedDescriptor = null;
|
12036 |
|
12037 | _this.getClosestScroll = function () {
|
12038 | if (!_this.watchingScroll) {
|
12039 | return origin;
|
12040 | }
|
12041 |
|
12042 | return getScroll(_this.watchingScroll.closestScrollable);
|
12043 | };
|
12044 |
|
12045 | _this.memoizedUpdateScroll = memoizeOne(function (x, y) {
|
12046 | !_this.publishedDescriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot update scroll on unpublished droppable') : invariant(false) : void 0;
|
12047 | var newScroll = {
|
12048 | x: x,
|
12049 | y: y
|
12050 | };
|
12051 | var marshal = _this.context[dimensionMarshalKey];
|
12052 | marshal.updateDroppableScroll(_this.publishedDescriptor.id, newScroll);
|
12053 | });
|
12054 |
|
12055 | _this.updateScroll = function () {
|
12056 | var offset = _this.getClosestScroll();
|
12057 |
|
12058 | _this.memoizedUpdateScroll(offset.x, offset.y);
|
12059 | };
|
12060 |
|
12061 | _this.scheduleScrollUpdate = rafSchd(_this.updateScroll);
|
12062 |
|
12063 | _this.onClosestScroll = function () {
|
12064 | !_this.watchingScroll ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not find scroll options while scrolling') : invariant(false) : void 0;
|
12065 | var options = _this.watchingScroll.options;
|
12066 |
|
12067 | if (options.shouldPublishImmediately) {
|
12068 | _this.updateScroll();
|
12069 |
|
12070 | return;
|
12071 | }
|
12072 |
|
12073 | _this.scheduleScrollUpdate();
|
12074 | };
|
12075 |
|
12076 | _this.scroll = function (change) {
|
12077 | !_this.watchingScroll ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot scroll a droppable with no closest scrollable') : invariant(false) : void 0;
|
12078 | var closestScrollable = _this.watchingScroll.closestScrollable;
|
12079 | closestScrollable.scrollTop += change.y;
|
12080 | closestScrollable.scrollLeft += change.x;
|
12081 | };
|
12082 |
|
12083 | _this.watchScroll = function (closestScrollable, options) {
|
12084 | !!_this.watchingScroll ? process.env.NODE_ENV !== "production" ? invariant(false, 'Droppable cannot watch scroll as it is already watching scroll') : invariant(false) : void 0;
|
12085 |
|
12086 | if (!closestScrollable) {
|
12087 | return;
|
12088 | }
|
12089 |
|
12090 | _this.watchingScroll = {
|
12091 | options: options,
|
12092 | closestScrollable: closestScrollable
|
12093 | };
|
12094 | closestScrollable.addEventListener('scroll', _this.onClosestScroll, listenerOptions);
|
12095 | };
|
12096 |
|
12097 | _this.unwatchScroll = function () {
|
12098 | var watching = _this.watchingScroll;
|
12099 |
|
12100 | if (!watching) {
|
12101 | return;
|
12102 | }
|
12103 |
|
12104 | _this.scheduleScrollUpdate.cancel();
|
12105 |
|
12106 | watching.closestScrollable.removeEventListener('scroll', _this.onClosestScroll, listenerOptions);
|
12107 | _this.watchingScroll = null;
|
12108 | };
|
12109 |
|
12110 | _this.getMemoizedDescriptor = memoizeOne(function (id, type) {
|
12111 | return {
|
12112 | id: id,
|
12113 | type: type
|
12114 | };
|
12115 | });
|
12116 |
|
12117 | _this.publish = function () {
|
12118 | var marshal = _this.context[dimensionMarshalKey];
|
12119 |
|
12120 | var descriptor = _this.getMemoizedDescriptor(_this.props.droppableId, _this.props.type);
|
12121 |
|
12122 | if (!_this.publishedDescriptor) {
|
12123 | marshal.registerDroppable(descriptor, _this.callbacks);
|
12124 | _this.publishedDescriptor = descriptor;
|
12125 | return;
|
12126 | }
|
12127 |
|
12128 | if (_this.publishedDescriptor === descriptor) {
|
12129 | return;
|
12130 | }
|
12131 |
|
12132 | marshal.updateDroppable(_this.publishedDescriptor, descriptor, _this.callbacks);
|
12133 | _this.publishedDescriptor = descriptor;
|
12134 | };
|
12135 |
|
12136 | _this.unpublish = function () {
|
12137 | !_this.publishedDescriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot unpublish descriptor when none is published') : invariant(false) : void 0;
|
12138 | var marshal = _this.context[dimensionMarshalKey];
|
12139 | marshal.unregisterDroppable(_this.publishedDescriptor);
|
12140 | _this.publishedDescriptor = null;
|
12141 | };
|
12142 |
|
12143 | _this.getDimensionAndWatchScroll = function (windowScroll, options) {
|
12144 | var _this$props = _this.props,
|
12145 | direction = _this$props.direction,
|
12146 | ignoreContainerClipping = _this$props.ignoreContainerClipping,
|
12147 | isDropDisabled = _this$props.isDropDisabled,
|
12148 | getDroppableRef = _this$props.getDroppableRef;
|
12149 | var targetRef = getDroppableRef();
|
12150 | var descriptor = _this.publishedDescriptor;
|
12151 | !targetRef ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot calculate a dimension when not attached to the DOM') : invariant(false) : void 0;
|
12152 | !descriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get dimension for unpublished droppable') : invariant(false) : void 0;
|
12153 | var scrollableRef = getClosestScrollable(targetRef);
|
12154 | checkForNestedScrollContainers(scrollableRef);
|
12155 |
|
12156 | _this.watchScroll(scrollableRef, options);
|
12157 |
|
12158 | var client = function () {
|
12159 | var base = cssBoxModel.getBox(targetRef);
|
12160 |
|
12161 | if (!scrollableRef) {
|
12162 | return base;
|
12163 | }
|
12164 |
|
12165 | if (targetRef !== scrollableRef) {
|
12166 | return base;
|
12167 | }
|
12168 |
|
12169 | var top = base.paddingBox.top - scrollableRef.scrollTop;
|
12170 | var left = base.paddingBox.left - scrollableRef.scrollLeft;
|
12171 | var bottom = top + scrollableRef.scrollHeight;
|
12172 | var right = left + scrollableRef.scrollWidth;
|
12173 | var paddingBox = {
|
12174 | top: top,
|
12175 | right: right,
|
12176 | bottom: bottom,
|
12177 | left: left
|
12178 | };
|
12179 | var borderBox = {
|
12180 | top: paddingBox.top - base.border.top,
|
12181 | right: paddingBox.right + base.border.right,
|
12182 | bottom: paddingBox.bottom + base.border.bottom,
|
12183 | left: paddingBox.left - base.border.left
|
12184 | };
|
12185 | return cssBoxModel.createBox({
|
12186 | borderBox: borderBox,
|
12187 | margin: base.margin,
|
12188 | border: base.border,
|
12189 | padding: base.padding
|
12190 | });
|
12191 | }();
|
12192 |
|
12193 | var page = cssBoxModel.withScroll(client, windowScroll);
|
12194 |
|
12195 | var closest$$1 = function () {
|
12196 | if (!scrollableRef) {
|
12197 | return null;
|
12198 | }
|
12199 |
|
12200 | var frameClient = cssBoxModel.getBox(scrollableRef);
|
12201 | return {
|
12202 | client: frameClient,
|
12203 | page: cssBoxModel.withScroll(frameClient),
|
12204 | scrollHeight: scrollableRef.scrollHeight,
|
12205 | scrollWidth: scrollableRef.scrollWidth,
|
12206 | scroll: getScroll(scrollableRef),
|
12207 | shouldClipSubject: !ignoreContainerClipping
|
12208 | };
|
12209 | }();
|
12210 |
|
12211 | return getDroppableDimension({
|
12212 | descriptor: descriptor,
|
12213 | isEnabled: !isDropDisabled,
|
12214 | direction: direction,
|
12215 | client: client,
|
12216 | page: page,
|
12217 | closest: closest$$1
|
12218 | });
|
12219 | };
|
12220 |
|
12221 | var callbacks = {
|
12222 | getDimensionAndWatchScroll: _this.getDimensionAndWatchScroll,
|
12223 | unwatchScroll: _this.unwatchScroll,
|
12224 | scroll: _this.scroll
|
12225 | };
|
12226 | _this.callbacks = callbacks;
|
12227 | return _this;
|
12228 | }
|
12229 |
|
12230 | var _proto = DroppableDimensionPublisher.prototype;
|
12231 |
|
12232 | _proto.componentDidMount = function componentDidMount() {
|
12233 | this.publish();
|
12234 | };
|
12235 |
|
12236 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
12237 | this.publish();
|
12238 |
|
12239 | if (this.props.isDropDisabled === prevProps.isDropDisabled) {
|
12240 | return;
|
12241 | }
|
12242 |
|
12243 | var marshal = this.context[dimensionMarshalKey];
|
12244 | marshal.updateDroppableIsEnabled(this.props.droppableId, !this.props.isDropDisabled);
|
12245 | };
|
12246 |
|
12247 | _proto.componentWillUnmount = function componentWillUnmount() {
|
12248 | if (this.watchingScroll) {
|
12249 | if (process.env.NODE_ENV !== 'production') {
|
12250 | console.warn('Unmounting droppable while it was watching scroll');
|
12251 | }
|
12252 |
|
12253 | this.unwatchScroll();
|
12254 | }
|
12255 |
|
12256 | this.unpublish();
|
12257 | };
|
12258 |
|
12259 | _proto.render = function render() {
|
12260 | return this.props.children;
|
12261 | };
|
12262 |
|
12263 | return DroppableDimensionPublisher;
|
12264 | }(React__default.Component);
|
12265 |
|
12266 | DroppableDimensionPublisher.contextTypes = (_DroppableDimensionPu = {}, _DroppableDimensionPu[dimensionMarshalKey] = PropTypes.object.isRequired, _DroppableDimensionPu);
|
12267 |
|
12268 | var Placeholder = function (_PureComponent) {
|
12269 | _inheritsLoose(Placeholder, _PureComponent);
|
12270 |
|
12271 | function Placeholder() {
|
12272 | return _PureComponent.apply(this, arguments) || this;
|
12273 | }
|
12274 |
|
12275 | var _proto = Placeholder.prototype;
|
12276 |
|
12277 | _proto.componentDidMount = function componentDidMount() {
|
12278 | if (this.props.onMount) {
|
12279 | this.props.onMount();
|
12280 | }
|
12281 | };
|
12282 |
|
12283 | _proto.componentWillUnmount = function componentWillUnmount() {
|
12284 | if (this.props.onUnmount) {
|
12285 | this.props.onUnmount();
|
12286 | }
|
12287 | };
|
12288 |
|
12289 | _proto.render = function render() {
|
12290 | var placeholder = this.props.placeholder;
|
12291 | var client = placeholder.client,
|
12292 | display = placeholder.display,
|
12293 | tagName = placeholder.tagName;
|
12294 | var style = {
|
12295 | display: display,
|
12296 | boxSizing: 'border-box',
|
12297 | width: client.borderBox.width,
|
12298 | height: client.borderBox.height,
|
12299 | marginTop: client.margin.top,
|
12300 | marginRight: client.margin.right,
|
12301 | marginBottom: client.margin.bottom,
|
12302 | marginLeft: client.margin.left,
|
12303 | flexShrink: '0',
|
12304 | flexGrow: '0',
|
12305 | pointerEvents: 'none'
|
12306 | };
|
12307 | return React__default.createElement(tagName, {
|
12308 | style: style
|
12309 | });
|
12310 | };
|
12311 |
|
12312 | return Placeholder;
|
12313 | }(React.PureComponent);
|
12314 |
|
12315 | var throwIfRefIsInvalid = (function (ref) {
|
12316 | !(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;
|
12317 | });
|
12318 |
|
12319 | var _Droppable$contextTyp, _Droppable$childConte;
|
12320 |
|
12321 | var Droppable = function (_Component) {
|
12322 | _inheritsLoose(Droppable, _Component);
|
12323 |
|
12324 | function Droppable(props, context) {
|
12325 | var _this;
|
12326 |
|
12327 | _this = _Component.call(this, props, context) || this;
|
12328 | _this.styleContext = void 0;
|
12329 | _this.ref = null;
|
12330 | _this.isPlaceholderMounted = false;
|
12331 |
|
12332 | _this.onPlaceholderMount = function () {
|
12333 | _this.isPlaceholderMounted = true;
|
12334 | };
|
12335 |
|
12336 | _this.onPlaceholderUnmount = function () {
|
12337 | _this.isPlaceholderMounted = false;
|
12338 | };
|
12339 |
|
12340 | _this.setRef = function (ref) {
|
12341 | if (ref === null) {
|
12342 | return;
|
12343 | }
|
12344 |
|
12345 | if (ref === _this.ref) {
|
12346 | return;
|
12347 | }
|
12348 |
|
12349 | _this.ref = ref;
|
12350 | throwIfRefIsInvalid(ref);
|
12351 | };
|
12352 |
|
12353 | _this.getDroppableRef = function () {
|
12354 | return _this.ref;
|
12355 | };
|
12356 |
|
12357 | _this.styleContext = context[styleContextKey];
|
12358 | return _this;
|
12359 | }
|
12360 |
|
12361 | var _proto = Droppable.prototype;
|
12362 |
|
12363 | _proto.getChildContext = function getChildContext() {
|
12364 | var _value;
|
12365 |
|
12366 | var value = (_value = {}, _value[droppableIdKey] = this.props.droppableId, _value[droppableTypeKey] = this.props.type, _value);
|
12367 | return value;
|
12368 | };
|
12369 |
|
12370 | _proto.componentDidMount = function componentDidMount() {
|
12371 | throwIfRefIsInvalid(this.ref);
|
12372 | this.warnIfPlaceholderNotMounted();
|
12373 | };
|
12374 |
|
12375 | _proto.componentDidUpdate = function componentDidUpdate() {
|
12376 | this.warnIfPlaceholderNotMounted();
|
12377 | };
|
12378 |
|
12379 | _proto.warnIfPlaceholderNotMounted = function warnIfPlaceholderNotMounted() {
|
12380 | if (process.env.NODE_ENV === 'production') {
|
12381 | return;
|
12382 | }
|
12383 |
|
12384 | if (!this.props.placeholder) {
|
12385 | return;
|
12386 | }
|
12387 |
|
12388 | if (this.isPlaceholderMounted) {
|
12389 | return;
|
12390 | }
|
12391 |
|
12392 | 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 ");
|
12393 | };
|
12394 |
|
12395 | _proto.getPlaceholder = function getPlaceholder() {
|
12396 | if (!this.props.placeholder) {
|
12397 | return null;
|
12398 | }
|
12399 |
|
12400 | return React__default.createElement(Placeholder, {
|
12401 | placeholder: this.props.placeholder,
|
12402 | onMount: this.onPlaceholderMount,
|
12403 | onUnmount: this.onPlaceholderUnmount
|
12404 | });
|
12405 | };
|
12406 |
|
12407 | _proto.render = function render() {
|
12408 | var _this$props = this.props,
|
12409 | children = _this$props.children,
|
12410 | direction = _this$props.direction,
|
12411 | droppableId = _this$props.droppableId,
|
12412 | ignoreContainerClipping = _this$props.ignoreContainerClipping,
|
12413 | isDraggingOver = _this$props.isDraggingOver,
|
12414 | isDropDisabled = _this$props.isDropDisabled,
|
12415 | draggingOverWith = _this$props.draggingOverWith,
|
12416 | type = _this$props.type;
|
12417 | var provided = {
|
12418 | innerRef: this.setRef,
|
12419 | placeholder: this.getPlaceholder(),
|
12420 | droppableProps: {
|
12421 | 'data-react-beautiful-dnd-droppable': this.styleContext
|
12422 | }
|
12423 | };
|
12424 | var snapshot = {
|
12425 | isDraggingOver: isDraggingOver,
|
12426 | draggingOverWith: draggingOverWith
|
12427 | };
|
12428 | return React__default.createElement(DroppableDimensionPublisher, {
|
12429 | droppableId: droppableId,
|
12430 | type: type,
|
12431 | direction: direction,
|
12432 | ignoreContainerClipping: ignoreContainerClipping,
|
12433 | isDropDisabled: isDropDisabled,
|
12434 | getDroppableRef: this.getDroppableRef
|
12435 | }, children(provided, snapshot));
|
12436 | };
|
12437 |
|
12438 | return Droppable;
|
12439 | }(React.Component);
|
12440 |
|
12441 | Droppable.contextTypes = (_Droppable$contextTyp = {}, _Droppable$contextTyp[styleContextKey] = PropTypes.string.isRequired, _Droppable$contextTyp);
|
12442 | Droppable.childContextTypes = (_Droppable$childConte = {}, _Droppable$childConte[droppableIdKey] = PropTypes.string.isRequired, _Droppable$childConte[droppableTypeKey] = PropTypes.string.isRequired, _Droppable$childConte);
|
12443 |
|
12444 | var isStrictEqual = (function (a, b) {
|
12445 | return a === b;
|
12446 | });
|
12447 |
|
12448 | var makeMapStateToProps = function makeMapStateToProps() {
|
12449 | var getIsDraggingOver = function getIsDraggingOver(id, destination) {
|
12450 | if (!destination) {
|
12451 | return false;
|
12452 | }
|
12453 |
|
12454 | return destination.droppableId === id;
|
12455 | };
|
12456 |
|
12457 | var shouldUsePlaceholder = function shouldUsePlaceholder(id, descriptor, destination) {
|
12458 | if (!destination) {
|
12459 | return false;
|
12460 | }
|
12461 |
|
12462 | if (id === descriptor.droppableId) {
|
12463 | return false;
|
12464 | }
|
12465 |
|
12466 | return id === destination.droppableId;
|
12467 | };
|
12468 |
|
12469 | var getMapProps = memoizeOne(function (isDraggingOver, draggingOverWith, placeholder) {
|
12470 | return {
|
12471 | isDraggingOver: isDraggingOver,
|
12472 | draggingOverWith: draggingOverWith,
|
12473 | placeholder: placeholder
|
12474 | };
|
12475 | });
|
12476 |
|
12477 | var getDefault = function getDefault() {
|
12478 | return getMapProps(false, null, null);
|
12479 | };
|
12480 |
|
12481 | var selector = function selector(state, ownProps) {
|
12482 | if (ownProps.isDropDisabled) {
|
12483 | return getDefault();
|
12484 | }
|
12485 |
|
12486 | var id = ownProps.droppableId;
|
12487 |
|
12488 | if (state.isDragging) {
|
12489 | var destination = state.impact.destination;
|
12490 | var isDraggingOver = getIsDraggingOver(id, destination);
|
12491 | var draggableId = state.critical.draggable.id;
|
12492 | var draggingOverWith = isDraggingOver ? draggableId : null;
|
12493 | var draggable = state.dimensions.draggables[draggableId];
|
12494 | var placeholder = shouldUsePlaceholder(id, draggable.descriptor, destination) ? draggable.placeholder : null;
|
12495 | return getMapProps(isDraggingOver, draggingOverWith, placeholder);
|
12496 | }
|
12497 |
|
12498 | if (state.phase === 'DROP_ANIMATING') {
|
12499 | var _destination = state.pending.impact.destination;
|
12500 |
|
12501 | var _isDraggingOver = getIsDraggingOver(id, _destination);
|
12502 |
|
12503 | var _draggableId = state.pending.result.draggableId;
|
12504 |
|
12505 | var _draggingOverWith = _isDraggingOver ? _draggableId : null;
|
12506 |
|
12507 | var _draggable = state.dimensions.draggables[_draggableId];
|
12508 |
|
12509 | var _placeholder = shouldUsePlaceholder(id, _draggable.descriptor, _destination) ? _draggable.placeholder : null;
|
12510 |
|
12511 | return getMapProps(_isDraggingOver, _draggingOverWith, _placeholder);
|
12512 | }
|
12513 |
|
12514 | return getDefault();
|
12515 | };
|
12516 |
|
12517 | return selector;
|
12518 | };
|
12519 | var connectedDroppable = reactRedux.connect(makeMapStateToProps, null, null, {
|
12520 | storeKey: storeKey,
|
12521 | pure: true,
|
12522 | areStatePropsEqual: isStrictEqual
|
12523 | })(Droppable);
|
12524 | connectedDroppable.defaultProps = {
|
12525 | type: 'DEFAULT',
|
12526 | isDropDisabled: false,
|
12527 | direction: 'vertical',
|
12528 | ignoreContainerClipping: false
|
12529 | };
|
12530 |
|
12531 | var _DraggableDimensionPu;
|
12532 |
|
12533 | var DraggableDimensionPublisher = function (_Component) {
|
12534 | _inheritsLoose(DraggableDimensionPublisher, _Component);
|
12535 |
|
12536 | function DraggableDimensionPublisher() {
|
12537 | var _this;
|
12538 |
|
12539 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
12540 | args[_key] = arguments[_key];
|
12541 | }
|
12542 |
|
12543 | _this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
12544 | _this.publishedDescriptor = null;
|
12545 | _this.getMemoizedDescriptor = memoizeOne(function (id, index, droppableId, type) {
|
12546 | return {
|
12547 | id: id,
|
12548 | index: index,
|
12549 | droppableId: droppableId,
|
12550 | type: type
|
12551 | };
|
12552 | });
|
12553 |
|
12554 | _this.publish = function () {
|
12555 | var marshal = _this.context[dimensionMarshalKey];
|
12556 |
|
12557 | var descriptor = _this.getMemoizedDescriptor(_this.props.draggableId, _this.props.index, _this.props.droppableId, _this.props.type);
|
12558 |
|
12559 | if (!_this.publishedDescriptor) {
|
12560 | marshal.registerDraggable(descriptor, _this.getDimension);
|
12561 | _this.publishedDescriptor = descriptor;
|
12562 | return;
|
12563 | }
|
12564 |
|
12565 | if (descriptor === _this.publishedDescriptor) {
|
12566 | return;
|
12567 | }
|
12568 |
|
12569 | marshal.updateDraggable(_this.publishedDescriptor, descriptor, _this.getDimension);
|
12570 | _this.publishedDescriptor = descriptor;
|
12571 | };
|
12572 |
|
12573 | _this.unpublish = function () {
|
12574 | !_this.publishedDescriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot unpublish descriptor when none is published') : invariant(false) : void 0;
|
12575 | var marshal = _this.context[dimensionMarshalKey];
|
12576 | marshal.unregisterDraggable(_this.publishedDescriptor);
|
12577 | _this.publishedDescriptor = null;
|
12578 | };
|
12579 |
|
12580 | _this.getDimension = function (windowScroll) {
|
12581 | var targetRef = _this.props.getDraggableRef();
|
12582 |
|
12583 | var descriptor = _this.publishedDescriptor;
|
12584 | !targetRef ? process.env.NODE_ENV !== "production" ? invariant(false, 'DraggableDimensionPublisher cannot calculate a dimension when not attached to the DOM') : invariant(false) : void 0;
|
12585 | !descriptor ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get dimension for unpublished draggable') : invariant(false) : void 0;
|
12586 | var computedStyles = window.getComputedStyle(targetRef);
|
12587 | var borderBox = targetRef.getBoundingClientRect();
|
12588 | var client = cssBoxModel.calculateBox(borderBox, computedStyles);
|
12589 | var page = cssBoxModel.withScroll(client, windowScroll);
|
12590 | var placeholder = {
|
12591 | client: client,
|
12592 | tagName: targetRef.tagName.toLowerCase(),
|
12593 | display: computedStyles.display
|
12594 | };
|
12595 | var dimension = {
|
12596 | descriptor: descriptor,
|
12597 | placeholder: placeholder,
|
12598 | client: client,
|
12599 | page: page
|
12600 | };
|
12601 | return dimension;
|
12602 | };
|
12603 |
|
12604 | return _this;
|
12605 | }
|
12606 |
|
12607 | var _proto = DraggableDimensionPublisher.prototype;
|
12608 |
|
12609 | _proto.componentDidMount = function componentDidMount() {
|
12610 | this.publish();
|
12611 | };
|
12612 |
|
12613 | _proto.componentDidUpdate = function componentDidUpdate() {
|
12614 | this.publish();
|
12615 | };
|
12616 |
|
12617 | _proto.componentWillUnmount = function componentWillUnmount() {
|
12618 | this.unpublish();
|
12619 | };
|
12620 |
|
12621 | _proto.render = function render() {
|
12622 | return this.props.children;
|
12623 | };
|
12624 |
|
12625 | return DraggableDimensionPublisher;
|
12626 | }(React.Component);
|
12627 |
|
12628 | DraggableDimensionPublisher.contextTypes = (_DraggableDimensionPu = {}, _DraggableDimensionPu[dimensionMarshalKey] = PropTypes.object.isRequired, _DraggableDimensionPu);
|
12629 |
|
12630 | var DoubleRenderBlocker = function (_React$Component) {
|
12631 | _inheritsLoose(DoubleRenderBlocker, _React$Component);
|
12632 |
|
12633 | function DoubleRenderBlocker() {
|
12634 | return _React$Component.apply(this, arguments) || this;
|
12635 | }
|
12636 |
|
12637 | var _proto = DoubleRenderBlocker.prototype;
|
12638 |
|
12639 | _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
12640 | if (isEqual(origin, nextProps.change)) {
|
12641 | return true;
|
12642 | }
|
12643 |
|
12644 | if (isEqual(this.props.change, nextProps.change)) {
|
12645 | return false;
|
12646 | }
|
12647 |
|
12648 | return true;
|
12649 | };
|
12650 |
|
12651 | _proto.render = function render() {
|
12652 | return this.props.children(this.props.change);
|
12653 | };
|
12654 |
|
12655 | return DoubleRenderBlocker;
|
12656 | }(React__default.Component);
|
12657 |
|
12658 | var Moveable = function (_Component) {
|
12659 | _inheritsLoose(Moveable, _Component);
|
12660 |
|
12661 | function Moveable() {
|
12662 | return _Component.apply(this, arguments) || this;
|
12663 | }
|
12664 |
|
12665 | var _proto2 = Moveable.prototype;
|
12666 |
|
12667 | _proto2.getFinal = function getFinal() {
|
12668 | var destination = this.props.destination;
|
12669 | var speed = this.props.speed;
|
12670 |
|
12671 | if (speed === 'INSTANT') {
|
12672 | return destination;
|
12673 | }
|
12674 |
|
12675 | var config = speed === 'FAST' ? physics.fast : physics.standard;
|
12676 | return {
|
12677 | x: reactMotion.spring(destination.x, config),
|
12678 | y: reactMotion.spring(destination.y, config)
|
12679 | };
|
12680 | };
|
12681 |
|
12682 | _proto2.render = function render() {
|
12683 | var _this = this;
|
12684 |
|
12685 | var final = this.getFinal();
|
12686 | return React__default.createElement(reactMotion.Motion, {
|
12687 | defaultStyle: origin,
|
12688 | style: final,
|
12689 | onRest: this.props.onMoveEnd
|
12690 | }, function (current) {
|
12691 | var _this$props = _this.props,
|
12692 | speed = _this$props.speed,
|
12693 | destination = _this$props.destination,
|
12694 | children = _this$props.children;
|
12695 | var target = speed === 'INSTANT' ? destination : current;
|
12696 | return React__default.createElement(DoubleRenderBlocker, {
|
12697 | change: target
|
12698 | }, children);
|
12699 | });
|
12700 | };
|
12701 |
|
12702 | return Moveable;
|
12703 | }(React.Component);
|
12704 |
|
12705 | Moveable.defaultProps = {
|
12706 | destination: origin
|
12707 | };
|
12708 |
|
12709 | var getWindowFromRef = (function (ref) {
|
12710 | return ref ? ref.ownerDocument.defaultView : window;
|
12711 | });
|
12712 |
|
12713 | var selector = "[" + dragHandle + "]";
|
12714 |
|
12715 | var isSVG = function isSVG(el) {
|
12716 | if (typeof SVGElement === 'undefined') {
|
12717 | return false;
|
12718 | }
|
12719 |
|
12720 | return el instanceof SVGElement;
|
12721 | };
|
12722 |
|
12723 | var throwIfSVG = function throwIfSVG(el) {
|
12724 | !!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;
|
12725 | };
|
12726 |
|
12727 | var getDragHandleRef = function getDragHandleRef(draggableRef) {
|
12728 | if (draggableRef.hasAttribute(dragHandle)) {
|
12729 | throwIfSVG(draggableRef);
|
12730 | return draggableRef;
|
12731 | }
|
12732 |
|
12733 | var el = draggableRef.querySelector(selector);
|
12734 | throwIfSVG(draggableRef);
|
12735 | !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;
|
12736 | !(el instanceof HTMLElement) ? process.env.NODE_ENV !== "production" ? invariant(false, 'A drag handle must be a HTMLElement') : invariant(false) : void 0;
|
12737 | return el;
|
12738 | };
|
12739 |
|
12740 | var retainingFocusFor = null;
|
12741 | var listenerOptions$1 = {
|
12742 | capture: true
|
12743 | };
|
12744 |
|
12745 | var clearRetentionOnFocusChange = function () {
|
12746 | var isBound = false;
|
12747 |
|
12748 | var bind = function bind() {
|
12749 | if (isBound) {
|
12750 | return;
|
12751 | }
|
12752 |
|
12753 | isBound = true;
|
12754 | window.addEventListener('focus', onWindowFocusChange, listenerOptions$1);
|
12755 | };
|
12756 |
|
12757 | var unbind = function unbind() {
|
12758 | if (!isBound) {
|
12759 | return;
|
12760 | }
|
12761 |
|
12762 | isBound = false;
|
12763 | window.removeEventListener('focus', onWindowFocusChange, listenerOptions$1);
|
12764 | };
|
12765 |
|
12766 | var onWindowFocusChange = function onWindowFocusChange() {
|
12767 | unbind();
|
12768 | retainingFocusFor = null;
|
12769 | };
|
12770 |
|
12771 | var result = function result() {
|
12772 | return bind();
|
12773 | };
|
12774 |
|
12775 | result.cancel = function () {
|
12776 | return unbind();
|
12777 | };
|
12778 |
|
12779 | return result;
|
12780 | }();
|
12781 |
|
12782 | var retain = function retain(id) {
|
12783 | retainingFocusFor = id;
|
12784 | clearRetentionOnFocusChange();
|
12785 | };
|
12786 |
|
12787 | var tryRestoreFocus = function tryRestoreFocus(id, draggableRef) {
|
12788 | if (!retainingFocusFor) {
|
12789 | return;
|
12790 | }
|
12791 |
|
12792 | if (id !== retainingFocusFor) {
|
12793 | return;
|
12794 | }
|
12795 |
|
12796 | retainingFocusFor = null;
|
12797 | clearRetentionOnFocusChange.cancel();
|
12798 | var dragHandleRef = getDragHandleRef(draggableRef);
|
12799 |
|
12800 | if (!dragHandleRef) {
|
12801 | console.warn('Could not find drag handle in the DOM to focus on it');
|
12802 | return;
|
12803 | }
|
12804 |
|
12805 | dragHandleRef.focus();
|
12806 | };
|
12807 |
|
12808 | var retainer = {
|
12809 | retain: retain,
|
12810 | tryRestoreFocus: tryRestoreFocus
|
12811 | };
|
12812 |
|
12813 | var interactiveTagNames = {
|
12814 | input: true,
|
12815 | button: true,
|
12816 | textarea: true,
|
12817 | select: true,
|
12818 | option: true,
|
12819 | optgroup: true,
|
12820 | video: true,
|
12821 | audio: true
|
12822 | };
|
12823 |
|
12824 | var isAnInteractiveElement = function isAnInteractiveElement(parent, current) {
|
12825 | if (current == null) {
|
12826 | return false;
|
12827 | }
|
12828 |
|
12829 | var hasAnInteractiveTag = Boolean(interactiveTagNames[current.tagName.toLowerCase()]);
|
12830 |
|
12831 | if (hasAnInteractiveTag) {
|
12832 | return true;
|
12833 | }
|
12834 |
|
12835 | var attribute = current.getAttribute('contenteditable');
|
12836 |
|
12837 | if (attribute === 'true' || attribute === '') {
|
12838 | return true;
|
12839 | }
|
12840 |
|
12841 | if (current === parent) {
|
12842 | return false;
|
12843 | }
|
12844 |
|
12845 | return isAnInteractiveElement(parent, current.parentElement);
|
12846 | };
|
12847 |
|
12848 | var shouldAllowDraggingFromTarget = (function (event, props) {
|
12849 | if (props.canDragInteractiveElements) {
|
12850 | return true;
|
12851 | }
|
12852 |
|
12853 | var target = event.target,
|
12854 | currentTarget = event.currentTarget;
|
12855 |
|
12856 | if (!(target instanceof Element) || !(currentTarget instanceof Element)) {
|
12857 | return true;
|
12858 | }
|
12859 |
|
12860 | return !isAnInteractiveElement(currentTarget, target);
|
12861 | });
|
12862 |
|
12863 | var createScheduler = (function (callbacks) {
|
12864 | var memoizedMove = memoizeOne(function (x, y) {
|
12865 | var point = {
|
12866 | x: x,
|
12867 | y: y
|
12868 | };
|
12869 | callbacks.onMove(point);
|
12870 | });
|
12871 | var move = rafSchd(function (point) {
|
12872 | return memoizedMove(point.x, point.y);
|
12873 | });
|
12874 | var moveUp = rafSchd(callbacks.onMoveUp);
|
12875 | var moveDown = rafSchd(callbacks.onMoveDown);
|
12876 | var moveRight = rafSchd(callbacks.onMoveRight);
|
12877 | var moveLeft = rafSchd(callbacks.onMoveLeft);
|
12878 | var windowScrollMove = rafSchd(callbacks.onWindowScroll);
|
12879 |
|
12880 | var cancel = function cancel() {
|
12881 | move.cancel();
|
12882 | moveUp.cancel();
|
12883 | moveDown.cancel();
|
12884 | moveRight.cancel();
|
12885 | moveLeft.cancel();
|
12886 | windowScrollMove.cancel();
|
12887 | };
|
12888 |
|
12889 | return {
|
12890 | move: move,
|
12891 | moveUp: moveUp,
|
12892 | moveDown: moveDown,
|
12893 | moveRight: moveRight,
|
12894 | moveLeft: moveLeft,
|
12895 | windowScrollMove: windowScrollMove,
|
12896 | cancel: cancel
|
12897 | };
|
12898 | });
|
12899 |
|
12900 | var sloppyClickThreshold = 5;
|
12901 | var isSloppyClickThresholdExceeded = (function (original, current) {
|
12902 | return Math.abs(current.x - original.x) >= sloppyClickThreshold || Math.abs(current.y - original.y) >= sloppyClickThreshold;
|
12903 | });
|
12904 |
|
12905 | var tab = 9;
|
12906 | var enter = 13;
|
12907 | var escape = 27;
|
12908 | var space = 32;
|
12909 | var pageUp = 33;
|
12910 | var pageDown = 34;
|
12911 | var end = 35;
|
12912 | var home = 36;
|
12913 | var arrowLeft = 37;
|
12914 | var arrowUp = 38;
|
12915 | var arrowRight = 39;
|
12916 | var arrowDown = 40;
|
12917 |
|
12918 | var _preventedKeys;
|
12919 | var preventedKeys = (_preventedKeys = {}, _preventedKeys[enter] = true, _preventedKeys[tab] = true, _preventedKeys);
|
12920 | var preventStandardKeyEvents = (function (event) {
|
12921 | if (preventedKeys[event.keyCode]) {
|
12922 | event.preventDefault();
|
12923 | }
|
12924 | });
|
12925 |
|
12926 | var getOptions = function getOptions(shared, fromBinding) {
|
12927 | return _extends({}, shared, fromBinding);
|
12928 | };
|
12929 |
|
12930 | var bindEvents = function bindEvents(el, bindings, sharedOptions) {
|
12931 | bindings.forEach(function (binding) {
|
12932 | var options = getOptions(sharedOptions, binding.options);
|
12933 | el.addEventListener(binding.eventName, binding.fn, options);
|
12934 | });
|
12935 | };
|
12936 | var unbindEvents = function unbindEvents(el, bindings, sharedOptions) {
|
12937 | bindings.forEach(function (binding) {
|
12938 | var options = getOptions(sharedOptions, binding.options);
|
12939 | el.removeEventListener(binding.eventName, binding.fn, options);
|
12940 | });
|
12941 | };
|
12942 |
|
12943 | var sharedOptions = {
|
12944 | capture: true
|
12945 | };
|
12946 | var createPostDragEventPreventer = (function (getWindow) {
|
12947 | var isBound = false;
|
12948 |
|
12949 | var bind = function bind() {
|
12950 | if (isBound) {
|
12951 | return;
|
12952 | }
|
12953 |
|
12954 | isBound = true;
|
12955 | bindEvents(getWindow(), pointerEvents, sharedOptions);
|
12956 | };
|
12957 |
|
12958 | var unbind = function unbind() {
|
12959 | if (!isBound) {
|
12960 | return;
|
12961 | }
|
12962 |
|
12963 | isBound = false;
|
12964 | unbindEvents(getWindow(), pointerEvents, sharedOptions);
|
12965 | };
|
12966 |
|
12967 | var pointerEvents = [{
|
12968 | eventName: 'click',
|
12969 | fn: function fn(event) {
|
12970 | event.preventDefault();
|
12971 | unbind();
|
12972 | }
|
12973 | }, {
|
12974 | eventName: 'mousedown',
|
12975 | fn: unbind
|
12976 | }, {
|
12977 | eventName: 'touchstart',
|
12978 | fn: unbind
|
12979 | }];
|
12980 |
|
12981 | var preventNext = function preventNext() {
|
12982 | if (isBound) {
|
12983 | unbind();
|
12984 | }
|
12985 |
|
12986 | bind();
|
12987 | };
|
12988 |
|
12989 | var preventer = {
|
12990 | preventNext: preventNext,
|
12991 | abort: unbind
|
12992 | };
|
12993 | return preventer;
|
12994 | });
|
12995 |
|
12996 | var createEventMarshal = (function () {
|
12997 | var isMouseDownHandled = false;
|
12998 |
|
12999 | var handle = function handle() {
|
13000 | !!isMouseDownHandled ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot handle mouse down as it is already handled') : invariant(false) : void 0;
|
13001 | isMouseDownHandled = true;
|
13002 | };
|
13003 |
|
13004 | var isHandled = function isHandled() {
|
13005 | return isMouseDownHandled;
|
13006 | };
|
13007 |
|
13008 | var reset = function reset() {
|
13009 | isMouseDownHandled = false;
|
13010 | };
|
13011 |
|
13012 | return {
|
13013 | handle: handle,
|
13014 | isHandled: isHandled,
|
13015 | reset: reset
|
13016 | };
|
13017 | });
|
13018 |
|
13019 | var supportedEventName = function () {
|
13020 | var base = 'visibilitychange';
|
13021 |
|
13022 | if (typeof document === 'undefined') {
|
13023 | return base;
|
13024 | }
|
13025 |
|
13026 | var candidates = [base, "ms" + base, "webkit" + base, "moz" + base, "o" + base];
|
13027 | var supported = candidates.find(function (eventName) {
|
13028 | return "on" + eventName in document;
|
13029 | });
|
13030 | return supported || base;
|
13031 | }();
|
13032 |
|
13033 | var primaryButton = 0;
|
13034 |
|
13035 | var noop = function noop() {};
|
13036 |
|
13037 | var mouseDownMarshal = createEventMarshal();
|
13038 | var createMouseSensor = (function (_ref) {
|
13039 | var callbacks = _ref.callbacks,
|
13040 | getWindow = _ref.getWindow,
|
13041 | canStartCapturing = _ref.canStartCapturing;
|
13042 | var state = {
|
13043 | isDragging: false,
|
13044 | pending: null
|
13045 | };
|
13046 |
|
13047 | var setState = function setState(newState) {
|
13048 | state = newState;
|
13049 | };
|
13050 |
|
13051 | var isDragging = function isDragging() {
|
13052 | return state.isDragging;
|
13053 | };
|
13054 |
|
13055 | var isCapturing = function isCapturing() {
|
13056 | return Boolean(state.pending || state.isDragging);
|
13057 | };
|
13058 |
|
13059 | var schedule = createScheduler(callbacks);
|
13060 | var postDragEventPreventer = createPostDragEventPreventer(getWindow);
|
13061 |
|
13062 | var startDragging = function startDragging(fn) {
|
13063 | if (fn === void 0) {
|
13064 | fn = noop;
|
13065 | }
|
13066 |
|
13067 | setState({
|
13068 | pending: null,
|
13069 | isDragging: true
|
13070 | });
|
13071 | fn();
|
13072 | };
|
13073 |
|
13074 | var stopDragging = function stopDragging(fn, shouldBlockClick) {
|
13075 | if (fn === void 0) {
|
13076 | fn = noop;
|
13077 | }
|
13078 |
|
13079 | if (shouldBlockClick === void 0) {
|
13080 | shouldBlockClick = true;
|
13081 | }
|
13082 |
|
13083 | schedule.cancel();
|
13084 | unbindWindowEvents();
|
13085 | mouseDownMarshal.reset();
|
13086 |
|
13087 | if (shouldBlockClick) {
|
13088 | postDragEventPreventer.preventNext();
|
13089 | }
|
13090 |
|
13091 | setState({
|
13092 | isDragging: false,
|
13093 | pending: null
|
13094 | });
|
13095 | fn();
|
13096 | };
|
13097 |
|
13098 | var startPendingDrag = function startPendingDrag(point) {
|
13099 | setState({
|
13100 | pending: point,
|
13101 | isDragging: false
|
13102 | });
|
13103 | bindWindowEvents();
|
13104 | };
|
13105 |
|
13106 | var stopPendingDrag = function stopPendingDrag() {
|
13107 | stopDragging(noop, false);
|
13108 | };
|
13109 |
|
13110 | var kill = function kill(fn) {
|
13111 | if (fn === void 0) {
|
13112 | fn = noop;
|
13113 | }
|
13114 |
|
13115 | if (state.pending) {
|
13116 | stopPendingDrag();
|
13117 | return;
|
13118 | }
|
13119 |
|
13120 | stopDragging(fn);
|
13121 | };
|
13122 |
|
13123 | var unmount = function unmount() {
|
13124 | kill();
|
13125 | postDragEventPreventer.abort();
|
13126 | };
|
13127 |
|
13128 | var cancel = function cancel() {
|
13129 | kill(callbacks.onCancel);
|
13130 | };
|
13131 |
|
13132 | var windowBindings = [{
|
13133 | eventName: 'mousemove',
|
13134 | fn: function fn(event) {
|
13135 | var button = event.button,
|
13136 | clientX = event.clientX,
|
13137 | clientY = event.clientY;
|
13138 |
|
13139 | if (button !== primaryButton) {
|
13140 | return;
|
13141 | }
|
13142 |
|
13143 | var point = {
|
13144 | x: clientX,
|
13145 | y: clientY
|
13146 | };
|
13147 |
|
13148 | if (state.isDragging) {
|
13149 | event.preventDefault();
|
13150 | schedule.move(point);
|
13151 | return;
|
13152 | }
|
13153 |
|
13154 | if (!state.pending) {
|
13155 | kill();
|
13156 | process.env.NODE_ENV !== "production" ? invariant(false, 'Expected there to be a pending drag') : invariant(false);
|
13157 | }
|
13158 |
|
13159 | if (!isSloppyClickThresholdExceeded(state.pending, point)) {
|
13160 | return;
|
13161 | }
|
13162 |
|
13163 | event.preventDefault();
|
13164 | startDragging(function () {
|
13165 | return callbacks.onLift({
|
13166 | clientSelection: point,
|
13167 | autoScrollMode: 'FLUID'
|
13168 | });
|
13169 | });
|
13170 | }
|
13171 | }, {
|
13172 | eventName: 'mouseup',
|
13173 | fn: function fn(event) {
|
13174 | if (state.pending) {
|
13175 | stopPendingDrag();
|
13176 | return;
|
13177 | }
|
13178 |
|
13179 | event.preventDefault();
|
13180 | stopDragging(callbacks.onDrop);
|
13181 | }
|
13182 | }, {
|
13183 | eventName: 'mousedown',
|
13184 | fn: function fn(event) {
|
13185 | if (state.isDragging) {
|
13186 | event.preventDefault();
|
13187 | }
|
13188 |
|
13189 | stopDragging(callbacks.onCancel);
|
13190 | }
|
13191 | }, {
|
13192 | eventName: 'keydown',
|
13193 | fn: function fn(event) {
|
13194 | if (!state.isDragging) {
|
13195 | cancel();
|
13196 | return;
|
13197 | }
|
13198 |
|
13199 | if (event.keyCode === escape) {
|
13200 | event.preventDefault();
|
13201 | cancel();
|
13202 | return;
|
13203 | }
|
13204 |
|
13205 | preventStandardKeyEvents(event);
|
13206 | }
|
13207 | }, {
|
13208 | eventName: 'resize',
|
13209 | fn: cancel
|
13210 | }, {
|
13211 | eventName: 'scroll',
|
13212 | options: {
|
13213 | passive: true,
|
13214 | capture: false
|
13215 | },
|
13216 | fn: function fn() {
|
13217 | if (state.pending) {
|
13218 | stopPendingDrag();
|
13219 | return;
|
13220 | }
|
13221 |
|
13222 | schedule.windowScrollMove();
|
13223 | }
|
13224 | }, {
|
13225 | eventName: 'webkitmouseforcechanged',
|
13226 | fn: function fn(event) {
|
13227 | if (event.webkitForce == null || MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN == null) {
|
13228 | if (process.env.NODE_ENV !== 'production') {
|
13229 | console.warn('handling a mouse force changed event when it is not supported');
|
13230 | }
|
13231 |
|
13232 | return;
|
13233 | }
|
13234 |
|
13235 | var forcePressThreshold = MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN;
|
13236 | var isForcePressing = event.webkitForce >= forcePressThreshold;
|
13237 |
|
13238 | if (isForcePressing) {
|
13239 | cancel();
|
13240 | }
|
13241 | }
|
13242 | }, {
|
13243 | eventName: supportedEventName,
|
13244 | fn: cancel
|
13245 | }];
|
13246 |
|
13247 | var bindWindowEvents = function bindWindowEvents() {
|
13248 | var win = getWindow();
|
13249 | bindEvents(win, windowBindings, {
|
13250 | capture: true
|
13251 | });
|
13252 | };
|
13253 |
|
13254 | var unbindWindowEvents = function unbindWindowEvents() {
|
13255 | var win = getWindow();
|
13256 | unbindEvents(win, windowBindings, {
|
13257 | capture: true
|
13258 | });
|
13259 | };
|
13260 |
|
13261 | var onMouseDown = function onMouseDown(event) {
|
13262 | if (mouseDownMarshal.isHandled()) {
|
13263 | return;
|
13264 | }
|
13265 |
|
13266 | !!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;
|
13267 |
|
13268 | if (!canStartCapturing(event)) {
|
13269 | return;
|
13270 | }
|
13271 |
|
13272 | if (event.button !== primaryButton) {
|
13273 | return;
|
13274 | }
|
13275 |
|
13276 | if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) {
|
13277 | return;
|
13278 | }
|
13279 |
|
13280 | mouseDownMarshal.handle();
|
13281 | event.preventDefault();
|
13282 | var point = {
|
13283 | x: event.clientX,
|
13284 | y: event.clientY
|
13285 | };
|
13286 | startPendingDrag(point);
|
13287 | };
|
13288 |
|
13289 | var sensor = {
|
13290 | onMouseDown: onMouseDown,
|
13291 | kill: kill,
|
13292 | isCapturing: isCapturing,
|
13293 | isDragging: isDragging,
|
13294 | unmount: unmount
|
13295 | };
|
13296 | return sensor;
|
13297 | });
|
13298 |
|
13299 | var getBorderBoxCenterPosition = (function (el) {
|
13300 | return cssBoxModel.getRect(el.getBoundingClientRect()).center;
|
13301 | });
|
13302 |
|
13303 | var _scrollJumpKeys;
|
13304 | var scrollJumpKeys = (_scrollJumpKeys = {}, _scrollJumpKeys[pageDown] = true, _scrollJumpKeys[pageUp] = true, _scrollJumpKeys[home] = true, _scrollJumpKeys[end] = true, _scrollJumpKeys);
|
13305 |
|
13306 | var noop$1 = function noop() {};
|
13307 |
|
13308 | var createKeyboardSensor = (function (_ref) {
|
13309 | var callbacks = _ref.callbacks,
|
13310 | getWindow = _ref.getWindow,
|
13311 | getDraggableRef = _ref.getDraggableRef,
|
13312 | canStartCapturing = _ref.canStartCapturing;
|
13313 | var state = {
|
13314 | isDragging: false
|
13315 | };
|
13316 |
|
13317 | var setState = function setState(newState) {
|
13318 | state = newState;
|
13319 | };
|
13320 |
|
13321 | var startDragging = function startDragging(fn) {
|
13322 | if (fn === void 0) {
|
13323 | fn = noop$1;
|
13324 | }
|
13325 |
|
13326 | setState({
|
13327 | isDragging: true
|
13328 | });
|
13329 | bindWindowEvents();
|
13330 | fn();
|
13331 | };
|
13332 |
|
13333 | var stopDragging = function stopDragging(fn) {
|
13334 | if (fn === void 0) {
|
13335 | fn = noop$1;
|
13336 | }
|
13337 |
|
13338 | schedule.cancel();
|
13339 | unbindWindowEvents();
|
13340 | setState({
|
13341 | isDragging: false
|
13342 | });
|
13343 | fn();
|
13344 | };
|
13345 |
|
13346 | var kill = function kill() {
|
13347 | return stopDragging();
|
13348 | };
|
13349 |
|
13350 | var cancel = function cancel() {
|
13351 | stopDragging(callbacks.onCancel);
|
13352 | };
|
13353 |
|
13354 | var isDragging = function isDragging() {
|
13355 | return state.isDragging;
|
13356 | };
|
13357 |
|
13358 | var schedule = createScheduler(callbacks);
|
13359 |
|
13360 | var onKeyDown = function onKeyDown(event) {
|
13361 | if (!isDragging()) {
|
13362 | if (event.defaultPrevented) {
|
13363 | return;
|
13364 | }
|
13365 |
|
13366 | if (!canStartCapturing(event)) {
|
13367 | return;
|
13368 | }
|
13369 |
|
13370 | if (event.keyCode !== space) {
|
13371 | return;
|
13372 | }
|
13373 |
|
13374 | var ref = getDraggableRef();
|
13375 | !ref ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot start a keyboard drag without a draggable ref') : invariant(false) : void 0;
|
13376 | var center = getBorderBoxCenterPosition(ref);
|
13377 | event.preventDefault();
|
13378 | startDragging(function () {
|
13379 | return callbacks.onLift({
|
13380 | clientSelection: center,
|
13381 | autoScrollMode: 'JUMP'
|
13382 | });
|
13383 | });
|
13384 | return;
|
13385 | }
|
13386 |
|
13387 | if (event.keyCode === escape) {
|
13388 | event.preventDefault();
|
13389 | cancel();
|
13390 | return;
|
13391 | }
|
13392 |
|
13393 | if (event.keyCode === space) {
|
13394 | event.preventDefault();
|
13395 | stopDragging(callbacks.onDrop);
|
13396 | return;
|
13397 | }
|
13398 |
|
13399 | if (event.keyCode === arrowDown) {
|
13400 | event.preventDefault();
|
13401 | schedule.moveDown();
|
13402 | return;
|
13403 | }
|
13404 |
|
13405 | if (event.keyCode === arrowUp) {
|
13406 | event.preventDefault();
|
13407 | schedule.moveUp();
|
13408 | return;
|
13409 | }
|
13410 |
|
13411 | if (event.keyCode === arrowRight) {
|
13412 | event.preventDefault();
|
13413 | schedule.moveRight();
|
13414 | return;
|
13415 | }
|
13416 |
|
13417 | if (event.keyCode === arrowLeft) {
|
13418 | event.preventDefault();
|
13419 | schedule.moveLeft();
|
13420 | return;
|
13421 | }
|
13422 |
|
13423 | if (scrollJumpKeys[event.keyCode]) {
|
13424 | event.preventDefault();
|
13425 | return;
|
13426 | }
|
13427 |
|
13428 | preventStandardKeyEvents(event);
|
13429 | };
|
13430 |
|
13431 | var windowBindings = [{
|
13432 | eventName: 'mousedown',
|
13433 | fn: cancel
|
13434 | }, {
|
13435 | eventName: 'mouseup',
|
13436 | fn: cancel
|
13437 | }, {
|
13438 | eventName: 'click',
|
13439 | fn: cancel
|
13440 | }, {
|
13441 | eventName: 'touchstart',
|
13442 | fn: cancel
|
13443 | }, {
|
13444 | eventName: 'resize',
|
13445 | fn: cancel
|
13446 | }, {
|
13447 | eventName: 'wheel',
|
13448 | fn: cancel
|
13449 | }, {
|
13450 | eventName: 'scroll',
|
13451 | options: {
|
13452 | capture: false
|
13453 | },
|
13454 | fn: callbacks.onWindowScroll
|
13455 | }, {
|
13456 | eventName: supportedEventName,
|
13457 | fn: cancel
|
13458 | }];
|
13459 |
|
13460 | var bindWindowEvents = function bindWindowEvents() {
|
13461 | bindEvents(getWindow(), windowBindings, {
|
13462 | capture: true
|
13463 | });
|
13464 | };
|
13465 |
|
13466 | var unbindWindowEvents = function unbindWindowEvents() {
|
13467 | unbindEvents(getWindow(), windowBindings, {
|
13468 | capture: true
|
13469 | });
|
13470 | };
|
13471 |
|
13472 | var sensor = {
|
13473 | onKeyDown: onKeyDown,
|
13474 | kill: kill,
|
13475 | isDragging: isDragging,
|
13476 | isCapturing: isDragging,
|
13477 | unmount: kill
|
13478 | };
|
13479 | return sensor;
|
13480 | });
|
13481 |
|
13482 | var timeForLongPress = 150;
|
13483 | var forcePressThreshold = 0.15;
|
13484 | var touchStartMarshal = createEventMarshal();
|
13485 |
|
13486 | var noop$2 = function noop() {};
|
13487 |
|
13488 | var webkitHack = function () {
|
13489 | var stub = {
|
13490 | preventTouchMove: noop$2,
|
13491 | releaseTouchMove: noop$2
|
13492 | };
|
13493 |
|
13494 | if (typeof window === 'undefined') {
|
13495 | return stub;
|
13496 | }
|
13497 |
|
13498 | if (!('ontouchstart' in window)) {
|
13499 | return stub;
|
13500 | }
|
13501 |
|
13502 | var isBlocking = false;
|
13503 | window.addEventListener('touchmove', function (event) {
|
13504 | if (!isBlocking) {
|
13505 | return;
|
13506 | }
|
13507 |
|
13508 | if (event.defaultPrevented) {
|
13509 | return;
|
13510 | }
|
13511 |
|
13512 | event.preventDefault();
|
13513 | }, {
|
13514 | passive: false,
|
13515 | capture: false
|
13516 | });
|
13517 |
|
13518 | var preventTouchMove = function preventTouchMove() {
|
13519 | isBlocking = true;
|
13520 | };
|
13521 |
|
13522 | var releaseTouchMove = function releaseTouchMove() {
|
13523 | isBlocking = false;
|
13524 | };
|
13525 |
|
13526 | return {
|
13527 | preventTouchMove: preventTouchMove,
|
13528 | releaseTouchMove: releaseTouchMove
|
13529 | };
|
13530 | }();
|
13531 |
|
13532 | var initial = {
|
13533 | isDragging: false,
|
13534 | pending: null,
|
13535 | hasMoved: false,
|
13536 | longPressTimerId: null
|
13537 | };
|
13538 | var createTouchSensor = (function (_ref) {
|
13539 | var callbacks = _ref.callbacks,
|
13540 | getWindow = _ref.getWindow,
|
13541 | canStartCapturing = _ref.canStartCapturing;
|
13542 | var state = initial;
|
13543 |
|
13544 | var setState = function setState(partial) {
|
13545 | state = _extends({}, state, partial);
|
13546 | };
|
13547 |
|
13548 | var isDragging = function isDragging() {
|
13549 | return state.isDragging;
|
13550 | };
|
13551 |
|
13552 | var isCapturing = function isCapturing() {
|
13553 | return Boolean(state.pending || state.isDragging || state.longPressTimerId);
|
13554 | };
|
13555 |
|
13556 | var schedule = createScheduler(callbacks);
|
13557 | var postDragEventPreventer = createPostDragEventPreventer(getWindow);
|
13558 |
|
13559 | var startDragging = function startDragging() {
|
13560 | var pending = state.pending;
|
13561 |
|
13562 | if (!pending) {
|
13563 | kill();
|
13564 | process.env.NODE_ENV !== "production" ? invariant(false, 'cannot start a touch drag without a pending position') : invariant(false);
|
13565 | }
|
13566 |
|
13567 | setState({
|
13568 | isDragging: true,
|
13569 | hasMoved: false,
|
13570 | pending: null,
|
13571 | longPressTimerId: null
|
13572 | });
|
13573 | callbacks.onLift({
|
13574 | clientSelection: pending,
|
13575 | autoScrollMode: 'FLUID'
|
13576 | });
|
13577 | };
|
13578 |
|
13579 | var stopDragging = function stopDragging(fn) {
|
13580 | if (fn === void 0) {
|
13581 | fn = noop$2;
|
13582 | }
|
13583 |
|
13584 | schedule.cancel();
|
13585 | touchStartMarshal.reset();
|
13586 | webkitHack.releaseTouchMove();
|
13587 | unbindWindowEvents();
|
13588 | postDragEventPreventer.preventNext();
|
13589 | setState(initial);
|
13590 | fn();
|
13591 | };
|
13592 |
|
13593 | var startPendingDrag = function startPendingDrag(event) {
|
13594 | var touch = event.touches[0];
|
13595 | var clientX = touch.clientX,
|
13596 | clientY = touch.clientY;
|
13597 | var point = {
|
13598 | x: clientX,
|
13599 | y: clientY
|
13600 | };
|
13601 | var longPressTimerId = setTimeout(startDragging, timeForLongPress);
|
13602 | setState({
|
13603 | longPressTimerId: longPressTimerId,
|
13604 | pending: point,
|
13605 | isDragging: false,
|
13606 | hasMoved: false
|
13607 | });
|
13608 | bindWindowEvents();
|
13609 | };
|
13610 |
|
13611 | var stopPendingDrag = function stopPendingDrag() {
|
13612 | if (state.longPressTimerId) {
|
13613 | clearTimeout(state.longPressTimerId);
|
13614 | }
|
13615 |
|
13616 | schedule.cancel();
|
13617 | touchStartMarshal.reset();
|
13618 | webkitHack.releaseTouchMove();
|
13619 | unbindWindowEvents();
|
13620 | setState(initial);
|
13621 | };
|
13622 |
|
13623 | var kill = function kill(fn) {
|
13624 | if (fn === void 0) {
|
13625 | fn = noop$2;
|
13626 | }
|
13627 |
|
13628 | if (state.pending) {
|
13629 | stopPendingDrag();
|
13630 | return;
|
13631 | }
|
13632 |
|
13633 | stopDragging(fn);
|
13634 | };
|
13635 |
|
13636 | var unmount = function unmount() {
|
13637 | kill();
|
13638 | postDragEventPreventer.abort();
|
13639 | };
|
13640 |
|
13641 | var cancel = function cancel() {
|
13642 | kill(callbacks.onCancel);
|
13643 | };
|
13644 |
|
13645 | var windowBindings = [{
|
13646 | eventName: 'touchmove',
|
13647 | options: {
|
13648 | passive: false
|
13649 | },
|
13650 | fn: function fn(event) {
|
13651 | if (!state.isDragging) {
|
13652 | stopPendingDrag();
|
13653 | return;
|
13654 | }
|
13655 |
|
13656 | if (!state.hasMoved) {
|
13657 | setState({
|
13658 | hasMoved: true
|
13659 | });
|
13660 | }
|
13661 |
|
13662 | var _event$touches$ = event.touches[0],
|
13663 | clientX = _event$touches$.clientX,
|
13664 | clientY = _event$touches$.clientY;
|
13665 | var point = {
|
13666 | x: clientX,
|
13667 | y: clientY
|
13668 | };
|
13669 | event.preventDefault();
|
13670 | schedule.move(point);
|
13671 | }
|
13672 | }, {
|
13673 | eventName: 'touchend',
|
13674 | fn: function fn(event) {
|
13675 | if (!state.isDragging) {
|
13676 | stopPendingDrag();
|
13677 | return;
|
13678 | }
|
13679 |
|
13680 | event.preventDefault();
|
13681 | stopDragging(callbacks.onDrop);
|
13682 | }
|
13683 | }, {
|
13684 | eventName: 'touchcancel',
|
13685 | fn: function fn(event) {
|
13686 | if (!state.isDragging) {
|
13687 | stopPendingDrag();
|
13688 | return;
|
13689 | }
|
13690 |
|
13691 | event.preventDefault();
|
13692 | stopDragging(callbacks.onCancel);
|
13693 | }
|
13694 | }, {
|
13695 | eventName: 'touchstart',
|
13696 | fn: cancel
|
13697 | }, {
|
13698 | eventName: 'orientationchange',
|
13699 | fn: cancel
|
13700 | }, {
|
13701 | eventName: 'resize',
|
13702 | fn: cancel
|
13703 | }, {
|
13704 | eventName: 'scroll',
|
13705 | options: {
|
13706 | passive: true,
|
13707 | capture: false
|
13708 | },
|
13709 | fn: function fn() {
|
13710 | if (state.pending) {
|
13711 | stopPendingDrag();
|
13712 | return;
|
13713 | }
|
13714 |
|
13715 | schedule.windowScrollMove();
|
13716 | }
|
13717 | }, {
|
13718 | eventName: 'contextmenu',
|
13719 | fn: function fn(event) {
|
13720 | event.preventDefault();
|
13721 | }
|
13722 | }, {
|
13723 | eventName: 'keydown',
|
13724 | fn: function fn(event) {
|
13725 | if (!state.isDragging) {
|
13726 | cancel();
|
13727 | return;
|
13728 | }
|
13729 |
|
13730 | if (event.keyCode === escape) {
|
13731 | event.preventDefault();
|
13732 | }
|
13733 |
|
13734 | cancel();
|
13735 | }
|
13736 | }, {
|
13737 | eventName: 'touchforcechange',
|
13738 | fn: function fn(event) {
|
13739 | if (state.hasMoved) {
|
13740 | event.preventDefault();
|
13741 | return;
|
13742 | }
|
13743 |
|
13744 | var touch = event.touches[0];
|
13745 |
|
13746 | if (touch.force >= forcePressThreshold) {
|
13747 | cancel();
|
13748 | }
|
13749 | }
|
13750 | }, {
|
13751 | eventName: supportedEventName,
|
13752 | fn: cancel
|
13753 | }];
|
13754 |
|
13755 | var bindWindowEvents = function bindWindowEvents() {
|
13756 | bindEvents(getWindow(), windowBindings, {
|
13757 | capture: true
|
13758 | });
|
13759 | };
|
13760 |
|
13761 | var unbindWindowEvents = function unbindWindowEvents() {
|
13762 | unbindEvents(getWindow(), windowBindings, {
|
13763 | capture: true
|
13764 | });
|
13765 | };
|
13766 |
|
13767 | var onTouchStart = function onTouchStart(event) {
|
13768 | if (touchStartMarshal.isHandled()) {
|
13769 | return;
|
13770 | }
|
13771 |
|
13772 | !!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;
|
13773 |
|
13774 | if (!canStartCapturing(event)) {
|
13775 | return;
|
13776 | }
|
13777 |
|
13778 | touchStartMarshal.handle();
|
13779 | webkitHack.preventTouchMove();
|
13780 | startPendingDrag(event);
|
13781 | };
|
13782 |
|
13783 | var sensor = {
|
13784 | onTouchStart: onTouchStart,
|
13785 | kill: kill,
|
13786 | isCapturing: isCapturing,
|
13787 | isDragging: isDragging,
|
13788 | unmount: unmount
|
13789 | };
|
13790 | return sensor;
|
13791 | });
|
13792 |
|
13793 | var _DragHandle$contextTy;
|
13794 |
|
13795 | var preventHtml5Dnd = function preventHtml5Dnd(event) {
|
13796 | event.preventDefault();
|
13797 | };
|
13798 |
|
13799 | var DragHandle = function (_Component) {
|
13800 | _inheritsLoose(DragHandle, _Component);
|
13801 |
|
13802 | function DragHandle(props, context) {
|
13803 | var _this;
|
13804 |
|
13805 | _this = _Component.call(this, props, context) || this;
|
13806 | _this.mouseSensor = void 0;
|
13807 | _this.keyboardSensor = void 0;
|
13808 | _this.touchSensor = void 0;
|
13809 | _this.sensors = void 0;
|
13810 | _this.styleContext = void 0;
|
13811 | _this.canLift = void 0;
|
13812 | _this.isFocused = false;
|
13813 | _this.lastDraggableRef = void 0;
|
13814 |
|
13815 | _this.onFocus = function () {
|
13816 | _this.isFocused = true;
|
13817 | };
|
13818 |
|
13819 | _this.onBlur = function () {
|
13820 | _this.isFocused = false;
|
13821 | };
|
13822 |
|
13823 | _this.onKeyDown = function (event) {
|
13824 | if (_this.mouseSensor.isCapturing() || _this.touchSensor.isCapturing()) {
|
13825 | return;
|
13826 | }
|
13827 |
|
13828 | _this.keyboardSensor.onKeyDown(event);
|
13829 | };
|
13830 |
|
13831 | _this.onMouseDown = function (event) {
|
13832 | if (_this.keyboardSensor.isCapturing() || _this.mouseSensor.isCapturing()) {
|
13833 | return;
|
13834 | }
|
13835 |
|
13836 | _this.mouseSensor.onMouseDown(event);
|
13837 | };
|
13838 |
|
13839 | _this.onTouchStart = function (event) {
|
13840 | if (_this.mouseSensor.isCapturing() || _this.keyboardSensor.isCapturing()) {
|
13841 | return;
|
13842 | }
|
13843 |
|
13844 | _this.touchSensor.onTouchStart(event);
|
13845 | };
|
13846 |
|
13847 | _this.canStartCapturing = function (event) {
|
13848 | if (_this.isAnySensorCapturing()) {
|
13849 | return false;
|
13850 | }
|
13851 |
|
13852 | if (!_this.canLift(_this.props.draggableId)) {
|
13853 | return false;
|
13854 | }
|
13855 |
|
13856 | return shouldAllowDraggingFromTarget(event, _this.props);
|
13857 | };
|
13858 |
|
13859 | _this.isAnySensorCapturing = function () {
|
13860 | return _this.sensors.some(function (sensor) {
|
13861 | return sensor.isCapturing();
|
13862 | });
|
13863 | };
|
13864 |
|
13865 | _this.getProvided = memoizeOne(function (isEnabled) {
|
13866 | if (!isEnabled) {
|
13867 | return null;
|
13868 | }
|
13869 |
|
13870 | var provided = {
|
13871 | onMouseDown: _this.onMouseDown,
|
13872 | onKeyDown: _this.onKeyDown,
|
13873 | onTouchStart: _this.onTouchStart,
|
13874 | onFocus: _this.onFocus,
|
13875 | onBlur: _this.onBlur,
|
13876 | tabIndex: 0,
|
13877 | 'data-react-beautiful-dnd-drag-handle': _this.styleContext,
|
13878 | 'aria-roledescription': 'Draggable item. Press space bar to lift',
|
13879 | draggable: false,
|
13880 | onDragStart: preventHtml5Dnd
|
13881 | };
|
13882 | return provided;
|
13883 | });
|
13884 |
|
13885 | var getWindow = function getWindow() {
|
13886 | return getWindowFromRef(_this.props.getDraggableRef());
|
13887 | };
|
13888 |
|
13889 | var args = {
|
13890 | callbacks: _this.props.callbacks,
|
13891 | getDraggableRef: _this.props.getDraggableRef,
|
13892 | getWindow: getWindow,
|
13893 | canStartCapturing: _this.canStartCapturing
|
13894 | };
|
13895 | _this.mouseSensor = createMouseSensor(args);
|
13896 | _this.keyboardSensor = createKeyboardSensor(args);
|
13897 | _this.touchSensor = createTouchSensor(args);
|
13898 | _this.sensors = [_this.mouseSensor, _this.keyboardSensor, _this.touchSensor];
|
13899 | _this.styleContext = context[styleContextKey];
|
13900 | _this.canLift = context[canLiftContextKey];
|
13901 | return _this;
|
13902 | }
|
13903 |
|
13904 | var _proto = DragHandle.prototype;
|
13905 |
|
13906 | _proto.componentDidMount = function componentDidMount() {
|
13907 | var draggableRef = this.props.getDraggableRef();
|
13908 | this.lastDraggableRef = draggableRef;
|
13909 | !draggableRef ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get draggable ref from drag handle') : invariant(false) : void 0;
|
13910 |
|
13911 | if (!this.props.isEnabled) {
|
13912 | return;
|
13913 | }
|
13914 |
|
13915 | var dragHandleRef = getDragHandleRef(draggableRef);
|
13916 | retainer.tryRestoreFocus(this.props.draggableId, dragHandleRef);
|
13917 | };
|
13918 |
|
13919 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
13920 | var _this2 = this;
|
13921 |
|
13922 | var ref = this.props.getDraggableRef();
|
13923 |
|
13924 | if (ref !== this.lastDraggableRef) {
|
13925 | this.lastDraggableRef = ref;
|
13926 |
|
13927 | if (!ref || !this.isFocused) {
|
13928 | return;
|
13929 | }
|
13930 |
|
13931 | if (!this.props.isEnabled) {
|
13932 | return;
|
13933 | }
|
13934 |
|
13935 | getDragHandleRef(ref).focus();
|
13936 | }
|
13937 |
|
13938 | var isCapturing = this.isAnySensorCapturing();
|
13939 |
|
13940 | if (!isCapturing) {
|
13941 | return;
|
13942 | }
|
13943 |
|
13944 | var isDragStopping = prevProps.isDragging && !this.props.isDragging;
|
13945 |
|
13946 | if (isDragStopping) {
|
13947 | this.sensors.forEach(function (sensor) {
|
13948 | if (sensor.isCapturing()) {
|
13949 | sensor.kill();
|
13950 | }
|
13951 | });
|
13952 | }
|
13953 |
|
13954 | if (this.props.isEnabled) {
|
13955 | return;
|
13956 | }
|
13957 |
|
13958 | this.sensors.forEach(function (sensor) {
|
13959 | if (!sensor.isCapturing()) {
|
13960 | return;
|
13961 | }
|
13962 |
|
13963 | var wasDragging = sensor.isDragging();
|
13964 | sensor.kill();
|
13965 |
|
13966 | if (wasDragging) {
|
13967 | if (process.env.NODE_ENV !== 'production') {
|
13968 | console.warn('You have disabled dragging on a Draggable while it was dragging. The drag has been cancelled');
|
13969 | }
|
13970 |
|
13971 | _this2.props.callbacks.onCancel();
|
13972 | }
|
13973 | });
|
13974 | };
|
13975 |
|
13976 | _proto.componentWillUnmount = function componentWillUnmount() {
|
13977 | var _this3 = this;
|
13978 |
|
13979 | this.sensors.forEach(function (sensor) {
|
13980 | var wasDragging = sensor.isDragging();
|
13981 | sensor.unmount();
|
13982 |
|
13983 | if (wasDragging) {
|
13984 | _this3.props.callbacks.onCancel();
|
13985 | }
|
13986 | });
|
13987 |
|
13988 | var shouldRetainFocus = function () {
|
13989 | if (!_this3.props.isEnabled) {
|
13990 | return false;
|
13991 | }
|
13992 |
|
13993 | if (!_this3.isFocused) {
|
13994 | return false;
|
13995 | }
|
13996 |
|
13997 | return _this3.props.isDragging || _this3.props.isDropAnimating;
|
13998 | }();
|
13999 |
|
14000 | if (shouldRetainFocus) {
|
14001 | retainer.retain(this.props.draggableId);
|
14002 | }
|
14003 | };
|
14004 |
|
14005 | _proto.render = function render() {
|
14006 | var _this$props = this.props,
|
14007 | children = _this$props.children,
|
14008 | isEnabled = _this$props.isEnabled;
|
14009 | return children(this.getProvided(isEnabled));
|
14010 | };
|
14011 |
|
14012 | return DragHandle;
|
14013 | }(React.Component);
|
14014 |
|
14015 | DragHandle.contextTypes = (_DragHandle$contextTy = {}, _DragHandle$contextTy[styleContextKey] = PropTypes.string.isRequired, _DragHandle$contextTy[canLiftContextKey] = PropTypes.func.isRequired, _DragHandle$contextTy);
|
14016 |
|
14017 | var getWindowScroll = (function () {
|
14018 | return {
|
14019 | x: window.pageXOffset,
|
14020 | y: window.pageYOffset
|
14021 | };
|
14022 | });
|
14023 |
|
14024 | var getViewport = (function () {
|
14025 | var scroll = getWindowScroll();
|
14026 | var top = scroll.y;
|
14027 | var left = scroll.x;
|
14028 | var doc = document.documentElement;
|
14029 | !doc ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not find document.documentElement') : invariant(false) : void 0;
|
14030 | var width = doc.clientWidth;
|
14031 | var height = doc.clientHeight;
|
14032 | var right = left + width;
|
14033 | var bottom = top + height;
|
14034 | var frame = cssBoxModel.getRect({
|
14035 | top: top,
|
14036 | left: left,
|
14037 | right: right,
|
14038 | bottom: bottom
|
14039 | });
|
14040 | var maxScroll = getMaxScroll({
|
14041 | scrollHeight: doc.scrollHeight,
|
14042 | scrollWidth: doc.scrollWidth,
|
14043 | width: frame.width,
|
14044 | height: frame.height
|
14045 | });
|
14046 | var viewport = {
|
14047 | frame: frame,
|
14048 | scroll: {
|
14049 | initial: scroll,
|
14050 | current: scroll,
|
14051 | max: maxScroll,
|
14052 | diff: {
|
14053 | value: origin,
|
14054 | displacement: origin
|
14055 | }
|
14056 | }
|
14057 | };
|
14058 | return viewport;
|
14059 | });
|
14060 |
|
14061 | var _Draggable$contextTyp;
|
14062 | var zIndexOptions = {
|
14063 | dragging: 5000,
|
14064 | dropAnimating: 4500
|
14065 | };
|
14066 |
|
14067 | var getTranslate = function getTranslate(offset) {
|
14068 | if (isEqual(offset, origin)) {
|
14069 | return null;
|
14070 | }
|
14071 |
|
14072 | return "translate(" + offset.x + "px, " + offset.y + "px)";
|
14073 | };
|
14074 |
|
14075 | var getSpeed$1 = function getSpeed(isDragging, shouldAnimateDragMovement, isDropAnimating) {
|
14076 | if (isDropAnimating) {
|
14077 | return 'STANDARD';
|
14078 | }
|
14079 |
|
14080 | if (isDragging && shouldAnimateDragMovement) {
|
14081 | return 'FAST';
|
14082 | }
|
14083 |
|
14084 | return 'INSTANT';
|
14085 | };
|
14086 |
|
14087 | var Draggable = function (_Component) {
|
14088 | _inheritsLoose(Draggable, _Component);
|
14089 |
|
14090 | function Draggable(props, context) {
|
14091 | var _this;
|
14092 |
|
14093 | _this = _Component.call(this, props, context) || this;
|
14094 | _this.callbacks = void 0;
|
14095 | _this.styleContext = void 0;
|
14096 | _this.ref = null;
|
14097 |
|
14098 | _this.onMoveEnd = function () {
|
14099 | if (_this.props.isDropAnimating) {
|
14100 | _this.props.dropAnimationFinished();
|
14101 | }
|
14102 | };
|
14103 |
|
14104 | _this.onLift = function (options) {
|
14105 | start('LIFT');
|
14106 | var ref = _this.ref;
|
14107 | !ref ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
14108 | !!_this.props.isDragDisabled ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot lift a Draggable when it is disabled') : invariant(false) : void 0;
|
14109 | var clientSelection = options.clientSelection,
|
14110 | autoScrollMode = options.autoScrollMode;
|
14111 | var _this$props = _this.props,
|
14112 | lift = _this$props.lift,
|
14113 | draggableId = _this$props.draggableId;
|
14114 | var client = {
|
14115 | selection: clientSelection,
|
14116 | borderBoxCenter: getBorderBoxCenterPosition(ref),
|
14117 | offset: origin
|
14118 | };
|
14119 | lift({
|
14120 | id: draggableId,
|
14121 | client: client,
|
14122 | autoScrollMode: autoScrollMode,
|
14123 | viewport: getViewport()
|
14124 | });
|
14125 | finish('LIFT');
|
14126 | };
|
14127 |
|
14128 | _this.setRef = function (ref) {
|
14129 | if (ref === null) {
|
14130 | return;
|
14131 | }
|
14132 |
|
14133 | if (ref === _this.ref) {
|
14134 | return;
|
14135 | }
|
14136 |
|
14137 | _this.ref = ref;
|
14138 | throwIfRefIsInvalid(ref);
|
14139 | };
|
14140 |
|
14141 | _this.getDraggableRef = function () {
|
14142 | return _this.ref;
|
14143 | };
|
14144 |
|
14145 | _this.getDraggingStyle = memoizeOne(function (change, dimension, isDropAnimating) {
|
14146 | var box = dimension.client;
|
14147 | var style = {
|
14148 | position: 'fixed',
|
14149 | top: box.marginBox.top,
|
14150 | left: box.marginBox.left,
|
14151 | boxSizing: 'border-box',
|
14152 | width: box.borderBox.width,
|
14153 | height: box.borderBox.height,
|
14154 | transition: 'none',
|
14155 | zIndex: isDropAnimating ? zIndexOptions.dropAnimating : zIndexOptions.dragging,
|
14156 | transform: getTranslate(change),
|
14157 | pointerEvents: 'none'
|
14158 | };
|
14159 | return style;
|
14160 | });
|
14161 | _this.getNotDraggingStyle = memoizeOne(function (current, shouldAnimateDisplacement) {
|
14162 | var style = {
|
14163 | transform: getTranslate(current),
|
14164 | transition: shouldAnimateDisplacement ? null : 'none'
|
14165 | };
|
14166 | return style;
|
14167 | });
|
14168 | _this.getProvided = memoizeOne(function (change, isDragging, isDropAnimating, shouldAnimateDisplacement, dimension, dragHandleProps) {
|
14169 | var useDraggingStyle = isDragging || isDropAnimating;
|
14170 |
|
14171 | var draggableStyle = function () {
|
14172 | if (!useDraggingStyle) {
|
14173 | return _this.getNotDraggingStyle(change, shouldAnimateDisplacement);
|
14174 | }
|
14175 |
|
14176 | !dimension ? process.env.NODE_ENV !== "production" ? invariant(false, 'draggable dimension required for dragging') : invariant(false) : void 0;
|
14177 | return _this.getDraggingStyle(change, dimension, isDropAnimating);
|
14178 | }();
|
14179 |
|
14180 | var provided = {
|
14181 | innerRef: _this.setRef,
|
14182 | draggableProps: {
|
14183 | 'data-react-beautiful-dnd-draggable': _this.styleContext,
|
14184 | style: draggableStyle
|
14185 | },
|
14186 | dragHandleProps: dragHandleProps
|
14187 | };
|
14188 | return provided;
|
14189 | });
|
14190 | _this.getSnapshot = memoizeOne(function (isDragging, isDropAnimating, draggingOver) {
|
14191 | return {
|
14192 | isDragging: isDragging || isDropAnimating,
|
14193 | isDropAnimating: isDropAnimating,
|
14194 | draggingOver: draggingOver
|
14195 | };
|
14196 | });
|
14197 |
|
14198 | _this.renderChildren = function (change, dragHandleProps) {
|
14199 | var _this$props2 = _this.props,
|
14200 | isDragging = _this$props2.isDragging,
|
14201 | isDropAnimating = _this$props2.isDropAnimating,
|
14202 | dimension = _this$props2.dimension,
|
14203 | draggingOver = _this$props2.draggingOver,
|
14204 | shouldAnimateDisplacement = _this$props2.shouldAnimateDisplacement,
|
14205 | children = _this$props2.children;
|
14206 | var child = children(_this.getProvided(change, isDragging, isDropAnimating, shouldAnimateDisplacement, dimension, dragHandleProps), _this.getSnapshot(isDragging, isDropAnimating, draggingOver));
|
14207 | var isDraggingOrDropping = isDragging || isDropAnimating;
|
14208 |
|
14209 | var placeholder = function () {
|
14210 | if (!isDraggingOrDropping) {
|
14211 | return null;
|
14212 | }
|
14213 |
|
14214 | !dimension ? process.env.NODE_ENV !== "production" ? invariant(false, 'Draggable: Dimension is required for dragging') : invariant(false) : void 0;
|
14215 | return React__default.createElement(Placeholder, {
|
14216 | placeholder: dimension.placeholder
|
14217 | });
|
14218 | }();
|
14219 |
|
14220 | return React__default.createElement(React.Fragment, null, child, placeholder);
|
14221 | };
|
14222 |
|
14223 | var callbacks = {
|
14224 | onLift: _this.onLift,
|
14225 | onMove: function onMove(clientSelection) {
|
14226 | return props.move({
|
14227 | client: clientSelection,
|
14228 | shouldAnimate: false
|
14229 | });
|
14230 | },
|
14231 | onDrop: function onDrop() {
|
14232 | return props.drop({
|
14233 | reason: 'DROP'
|
14234 | });
|
14235 | },
|
14236 | onCancel: function onCancel() {
|
14237 | return props.drop({
|
14238 | reason: 'CANCEL'
|
14239 | });
|
14240 | },
|
14241 | onMoveUp: props.moveUp,
|
14242 | onMoveDown: props.moveDown,
|
14243 | onMoveRight: props.moveRight,
|
14244 | onMoveLeft: props.moveLeft,
|
14245 | onWindowScroll: function onWindowScroll() {
|
14246 | return props.moveByWindowScroll({
|
14247 | scroll: getWindowScroll()
|
14248 | });
|
14249 | }
|
14250 | };
|
14251 | _this.callbacks = callbacks;
|
14252 | _this.styleContext = context[styleContextKey];
|
14253 | return _this;
|
14254 | }
|
14255 |
|
14256 | var _proto = Draggable.prototype;
|
14257 |
|
14258 | _proto.componentWillUnmount = function componentWillUnmount() {
|
14259 | this.ref = null;
|
14260 | };
|
14261 |
|
14262 | _proto.render = function render() {
|
14263 | var _this2 = this;
|
14264 |
|
14265 | var _this$props3 = this.props,
|
14266 | draggableId = _this$props3.draggableId,
|
14267 | index = _this$props3.index,
|
14268 | offset = _this$props3.offset,
|
14269 | isDragging = _this$props3.isDragging,
|
14270 | isDropAnimating = _this$props3.isDropAnimating,
|
14271 | isDragDisabled = _this$props3.isDragDisabled,
|
14272 | shouldAnimateDragMovement = _this$props3.shouldAnimateDragMovement,
|
14273 | disableInteractiveElementBlocking = _this$props3.disableInteractiveElementBlocking;
|
14274 | var droppableId = this.context[droppableIdKey];
|
14275 | var type = this.context[droppableTypeKey];
|
14276 | var speed = getSpeed$1(isDragging, shouldAnimateDragMovement, isDropAnimating);
|
14277 | return React__default.createElement(DraggableDimensionPublisher, {
|
14278 | key: draggableId,
|
14279 | draggableId: draggableId,
|
14280 | droppableId: droppableId,
|
14281 | type: type,
|
14282 | index: index,
|
14283 | getDraggableRef: this.getDraggableRef
|
14284 | }, React__default.createElement(Moveable, {
|
14285 | speed: speed,
|
14286 | destination: offset,
|
14287 | onMoveEnd: this.onMoveEnd
|
14288 | }, function (change) {
|
14289 | return React__default.createElement(DragHandle, {
|
14290 | draggableId: draggableId,
|
14291 | isDragging: isDragging,
|
14292 | isDropAnimating: isDropAnimating,
|
14293 | isEnabled: !isDragDisabled,
|
14294 | callbacks: _this2.callbacks,
|
14295 | getDraggableRef: _this2.getDraggableRef,
|
14296 | canDragInteractiveElements: disableInteractiveElementBlocking
|
14297 | }, function (dragHandleProps) {
|
14298 | return _this2.renderChildren(change, dragHandleProps);
|
14299 | });
|
14300 | }));
|
14301 | };
|
14302 |
|
14303 | return Draggable;
|
14304 | }(React.Component);
|
14305 |
|
14306 | Draggable.contextTypes = (_Draggable$contextTyp = {}, _Draggable$contextTyp[droppableIdKey] = PropTypes.string.isRequired, _Draggable$contextTyp[droppableTypeKey] = PropTypes.string.isRequired, _Draggable$contextTyp[styleContextKey] = PropTypes.string.isRequired, _Draggable$contextTyp);
|
14307 |
|
14308 | var defaultMapProps = {
|
14309 | isDropAnimating: false,
|
14310 | isDragging: false,
|
14311 | offset: origin,
|
14312 | shouldAnimateDragMovement: false,
|
14313 | shouldAnimateDisplacement: true,
|
14314 | dimension: null,
|
14315 | draggingOver: null
|
14316 | };
|
14317 | var makeMapStateToProps$1 = function makeMapStateToProps() {
|
14318 | var memoizedOffset = memoizeOne(function (x, y) {
|
14319 | return {
|
14320 | x: x,
|
14321 | y: y
|
14322 | };
|
14323 | });
|
14324 | var getNotDraggingProps = memoizeOne(function (offset, shouldAnimateDisplacement) {
|
14325 | return {
|
14326 | isDropAnimating: false,
|
14327 | isDragging: false,
|
14328 | offset: offset,
|
14329 | shouldAnimateDisplacement: shouldAnimateDisplacement,
|
14330 | shouldAnimateDragMovement: false,
|
14331 | dimension: null,
|
14332 | draggingOver: null
|
14333 | };
|
14334 | });
|
14335 | var getDraggingProps = memoizeOne(function (offset, shouldAnimateDragMovement, dimension, draggingOver) {
|
14336 | return {
|
14337 | isDragging: true,
|
14338 | isDropAnimating: false,
|
14339 | shouldAnimateDisplacement: false,
|
14340 | offset: offset,
|
14341 | shouldAnimateDragMovement: shouldAnimateDragMovement,
|
14342 | dimension: dimension,
|
14343 | draggingOver: draggingOver
|
14344 | };
|
14345 | });
|
14346 |
|
14347 | var getOutOfTheWayMovement = function getOutOfTheWayMovement(id, movement) {
|
14348 | var map = getDisplacementMap(movement.displaced);
|
14349 | var displacement = map[id];
|
14350 |
|
14351 | if (!displacement) {
|
14352 | return null;
|
14353 | }
|
14354 |
|
14355 | if (!displacement.isVisible) {
|
14356 | return null;
|
14357 | }
|
14358 |
|
14359 | var amount = movement.isBeyondStartPosition ? negate(movement.amount) : movement.amount;
|
14360 | return getNotDraggingProps(memoizedOffset(amount.x, amount.y), displacement.shouldAnimate);
|
14361 | };
|
14362 |
|
14363 | var draggingSelector = function draggingSelector(state, ownProps) {
|
14364 | if (state.isDragging) {
|
14365 | if (state.critical.draggable.id !== ownProps.draggableId) {
|
14366 | return null;
|
14367 | }
|
14368 |
|
14369 | var offset = state.current.client.offset;
|
14370 | var dimension = state.dimensions.draggables[ownProps.draggableId];
|
14371 | var shouldAnimateDragMovement = state.shouldAnimate;
|
14372 | var draggingOver = state.impact.destination ? state.impact.destination.droppableId : null;
|
14373 | return getDraggingProps(memoizedOffset(offset.x, offset.y), shouldAnimateDragMovement, dimension, draggingOver);
|
14374 | }
|
14375 |
|
14376 | if (state.phase === 'DROP_ANIMATING') {
|
14377 | var pending = state.pending;
|
14378 |
|
14379 | if (pending.result.draggableId !== ownProps.draggableId) {
|
14380 | return null;
|
14381 | }
|
14382 |
|
14383 | var _draggingOver = pending.result.destination ? pending.result.destination.droppableId : null;
|
14384 |
|
14385 | return {
|
14386 | isDragging: false,
|
14387 | isDropAnimating: true,
|
14388 | offset: pending.newHomeOffset,
|
14389 | dimension: state.dimensions.draggables[ownProps.draggableId],
|
14390 | draggingOver: _draggingOver,
|
14391 | shouldAnimateDragMovement: false,
|
14392 | shouldAnimateDisplacement: false
|
14393 | };
|
14394 | }
|
14395 |
|
14396 | return null;
|
14397 | };
|
14398 |
|
14399 | var movingOutOfTheWaySelector = function movingOutOfTheWaySelector(state, ownProps) {
|
14400 | if (state.isDragging) {
|
14401 | if (state.critical.draggable.id === ownProps.draggableId) {
|
14402 | return null;
|
14403 | }
|
14404 |
|
14405 | return getOutOfTheWayMovement(ownProps.draggableId, state.impact.movement);
|
14406 | }
|
14407 |
|
14408 | if (state.phase === 'DROP_ANIMATING') {
|
14409 | if (state.pending.result.draggableId === ownProps.draggableId) {
|
14410 | return null;
|
14411 | }
|
14412 |
|
14413 | return getOutOfTheWayMovement(ownProps.draggableId, state.pending.impact.movement);
|
14414 | }
|
14415 |
|
14416 | return null;
|
14417 | };
|
14418 |
|
14419 | var selector = function selector(state, ownProps) {
|
14420 | var dragging = draggingSelector(state, ownProps);
|
14421 |
|
14422 | if (dragging) {
|
14423 | return dragging;
|
14424 | }
|
14425 |
|
14426 | var movingOutOfTheWay = movingOutOfTheWaySelector(state, ownProps);
|
14427 |
|
14428 | if (movingOutOfTheWay) {
|
14429 | return movingOutOfTheWay;
|
14430 | }
|
14431 |
|
14432 | return defaultMapProps;
|
14433 | };
|
14434 |
|
14435 | return selector;
|
14436 | };
|
14437 | var mapDispatchToProps = {
|
14438 | lift: lift,
|
14439 | move: move,
|
14440 | moveUp: moveUp,
|
14441 | moveDown: moveDown,
|
14442 | moveLeft: moveLeft,
|
14443 | moveRight: moveRight,
|
14444 | moveByWindowScroll: moveByWindowScroll,
|
14445 | drop: drop,
|
14446 | dropAnimationFinished: dropAnimationFinished
|
14447 | };
|
14448 | var ConnectedDraggable = reactRedux.connect(makeMapStateToProps$1, mapDispatchToProps, null, {
|
14449 | storeKey: storeKey,
|
14450 | pure: true,
|
14451 | areStatePropsEqual: isStrictEqual
|
14452 | })(Draggable);
|
14453 | ConnectedDraggable.defaultProps = {
|
14454 | isDragDisabled: false,
|
14455 | disableInteractiveElementBlocking: false
|
14456 | };
|
14457 |
|
14458 | exports.DragDropContext = DragDropContext;
|
14459 | exports.Droppable = connectedDroppable;
|
14460 | exports.Draggable = ConnectedDraggable;
|
14461 | exports.resetServerContext = resetServerContext;
|
14462 |
|
14463 | }.call(exports, __webpack_require__(33)))
|
14464 |
|
14465 | }),
|
14466 |
|
14467 | (function(module, exports, __webpack_require__) {
|
14468 |
|
14469 | var _Object$assign = __webpack_require__(85);
|
14470 |
|
14471 | function _extends() {
|
14472 | module.exports = _extends = _Object$assign || function (target) {
|
14473 | for (var i = 1; i < arguments.length; i++) {
|
14474 | var source = arguments[i];
|
14475 |
|
14476 | for (var key in source) {
|
14477 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
14478 | target[key] = source[key];
|
14479 | }
|
14480 | }
|
14481 | }
|
14482 |
|
14483 | return target;
|
14484 | };
|
14485 |
|
14486 | return _extends.apply(this, arguments);
|
14487 | }
|
14488 |
|
14489 | module.exports = _extends;
|
14490 |
|
14491 | }),
|
14492 |
|
14493 | (function(module, exports, __webpack_require__) {
|
14494 |
|
14495 | module.exports = __webpack_require__(86);
|
14496 |
|
14497 | }),
|
14498 |
|
14499 | (function(module, exports, __webpack_require__) {
|
14500 |
|
14501 | __webpack_require__(87);
|
14502 | module.exports = __webpack_require__(90).Object.assign;
|
14503 |
|
14504 |
|
14505 | }),
|
14506 |
|
14507 | (function(module, exports, __webpack_require__) {
|
14508 |
|
14509 |
|
14510 | var $export = __webpack_require__(88);
|
14511 |
|
14512 | $export($export.S + $export.F, 'Object', { assign: __webpack_require__(104) });
|
14513 |
|
14514 |
|
14515 | }),
|
14516 |
|
14517 | (function(module, exports, __webpack_require__) {
|
14518 |
|
14519 | var global = __webpack_require__(89);
|
14520 | var core = __webpack_require__(90);
|
14521 | var ctx = __webpack_require__(91);
|
14522 | var hide = __webpack_require__(93);
|
14523 | var has = __webpack_require__(103);
|
14524 | var PROTOTYPE = 'prototype';
|
14525 |
|
14526 | var $export = function (type, name, source) {
|
14527 | var IS_FORCED = type & $export.F;
|
14528 | var IS_GLOBAL = type & $export.G;
|
14529 | var IS_STATIC = type & $export.S;
|
14530 | var IS_PROTO = type & $export.P;
|
14531 | var IS_BIND = type & $export.B;
|
14532 | var IS_WRAP = type & $export.W;
|
14533 | var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
|
14534 | var expProto = exports[PROTOTYPE];
|
14535 | var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
|
14536 | var key, own, out;
|
14537 | if (IS_GLOBAL) source = name;
|
14538 | for (key in source) {
|
14539 |
|
14540 | own = !IS_FORCED && target && target[key] !== undefined;
|
14541 | if (own && has(exports, key)) continue;
|
14542 |
|
14543 | out = own ? target[key] : source[key];
|
14544 |
|
14545 | exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
|
14546 |
|
14547 | : IS_BIND && own ? ctx(out, global)
|
14548 |
|
14549 | : IS_WRAP && target[key] == out ? (function (C) {
|
14550 | var F = function (a, b, c) {
|
14551 | if (this instanceof C) {
|
14552 | switch (arguments.length) {
|
14553 | case 0: return new C();
|
14554 | case 1: return new C(a);
|
14555 | case 2: return new C(a, b);
|
14556 | } return new C(a, b, c);
|
14557 | } return C.apply(this, arguments);
|
14558 | };
|
14559 | F[PROTOTYPE] = C[PROTOTYPE];
|
14560 | return F;
|
14561 |
|
14562 | })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
|
14563 |
|
14564 | if (IS_PROTO) {
|
14565 | (exports.virtual || (exports.virtual = {}))[key] = out;
|
14566 |
|
14567 | if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
|
14568 | }
|
14569 | }
|
14570 | };
|
14571 |
|
14572 | $export.F = 1;
|
14573 | $export.G = 2;
|
14574 | $export.S = 4;
|
14575 | $export.P = 8;
|
14576 | $export.B = 16;
|
14577 | $export.W = 32;
|
14578 | $export.U = 64;
|
14579 | $export.R = 128;
|
14580 | module.exports = $export;
|
14581 |
|
14582 |
|
14583 | }),
|
14584 |
|
14585 | (function(module, exports) {
|
14586 |
|
14587 |
|
14588 | var global = module.exports = typeof window != 'undefined' && window.Math == Math
|
14589 | ? window : typeof self != 'undefined' && self.Math == Math ? self
|
14590 |
|
14591 | : Function('return this')();
|
14592 | if (typeof __g == 'number') __g = global;
|
14593 |
|
14594 |
|
14595 | }),
|
14596 |
|
14597 | (function(module, exports) {
|
14598 |
|
14599 | var core = module.exports = { version: '2.5.7' };
|
14600 | if (typeof __e == 'number') __e = core;
|
14601 |
|
14602 |
|
14603 | }),
|
14604 |
|
14605 | (function(module, exports, __webpack_require__) {
|
14606 |
|
14607 |
|
14608 | var aFunction = __webpack_require__(92);
|
14609 | module.exports = function (fn, that, length) {
|
14610 | aFunction(fn);
|
14611 | if (that === undefined) return fn;
|
14612 | switch (length) {
|
14613 | case 1: return function (a) {
|
14614 | return fn.call(that, a);
|
14615 | };
|
14616 | case 2: return function (a, b) {
|
14617 | return fn.call(that, a, b);
|
14618 | };
|
14619 | case 3: return function (a, b, c) {
|
14620 | return fn.call(that, a, b, c);
|
14621 | };
|
14622 | }
|
14623 | return function (/* ...args */) {
|
14624 | return fn.apply(that, arguments);
|
14625 | };
|
14626 | };
|
14627 |
|
14628 |
|
14629 | }),
|
14630 |
|
14631 | (function(module, exports) {
|
14632 |
|
14633 | module.exports = function (it) {
|
14634 | if (typeof it != 'function') throw TypeError(it + ' is not a function!');
|
14635 | return it;
|
14636 | };
|
14637 |
|
14638 |
|
14639 | }),
|
14640 |
|
14641 | (function(module, exports, __webpack_require__) {
|
14642 |
|
14643 | var dP = __webpack_require__(94);
|
14644 | var createDesc = __webpack_require__(102);
|
14645 | module.exports = __webpack_require__(98) ? function (object, key, value) {
|
14646 | return dP.f(object, key, createDesc(1, value));
|
14647 | } : function (object, key, value) {
|
14648 | object[key] = value;
|
14649 | return object;
|
14650 | };
|
14651 |
|
14652 |
|
14653 | }),
|
14654 |
|
14655 | (function(module, exports, __webpack_require__) {
|
14656 |
|
14657 | var anObject = __webpack_require__(95);
|
14658 | var IE8_DOM_DEFINE = __webpack_require__(97);
|
14659 | var toPrimitive = __webpack_require__(101);
|
14660 | var dP = Object.defineProperty;
|
14661 |
|
14662 | exports.f = __webpack_require__(98) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
|
14663 | anObject(O);
|
14664 | P = toPrimitive(P, true);
|
14665 | anObject(Attributes);
|
14666 | if (IE8_DOM_DEFINE) try {
|
14667 | return dP(O, P, Attributes);
|
14668 | } catch (e) { }
|
14669 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
|
14670 | if ('value' in Attributes) O[P] = Attributes.value;
|
14671 | return O;
|
14672 | };
|
14673 |
|
14674 |
|
14675 | }),
|
14676 |
|
14677 | (function(module, exports, __webpack_require__) {
|
14678 |
|
14679 | var isObject = __webpack_require__(96);
|
14680 | module.exports = function (it) {
|
14681 | if (!isObject(it)) throw TypeError(it + ' is not an object!');
|
14682 | return it;
|
14683 | };
|
14684 |
|
14685 |
|
14686 | }),
|
14687 |
|
14688 | (function(module, exports) {
|
14689 |
|
14690 | module.exports = function (it) {
|
14691 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
14692 | };
|
14693 |
|
14694 |
|
14695 | }),
|
14696 |
|
14697 | (function(module, exports, __webpack_require__) {
|
14698 |
|
14699 | module.exports = !__webpack_require__(98) && !__webpack_require__(99)(function () {
|
14700 | return Object.defineProperty(__webpack_require__(100)('div'), 'a', { get: function () { return 7; } }).a != 7;
|
14701 | });
|
14702 |
|
14703 |
|
14704 | }),
|
14705 |
|
14706 | (function(module, exports, __webpack_require__) {
|
14707 |
|
14708 |
|
14709 | module.exports = !__webpack_require__(99)(function () {
|
14710 | return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
14711 | });
|
14712 |
|
14713 |
|
14714 | }),
|
14715 |
|
14716 | (function(module, exports) {
|
14717 |
|
14718 | module.exports = function (exec) {
|
14719 | try {
|
14720 | return !!exec();
|
14721 | } catch (e) {
|
14722 | return true;
|
14723 | }
|
14724 | };
|
14725 |
|
14726 |
|
14727 | }),
|
14728 |
|
14729 | (function(module, exports, __webpack_require__) {
|
14730 |
|
14731 | var isObject = __webpack_require__(96);
|
14732 | var document = __webpack_require__(89).document;
|
14733 |
|
14734 | var is = isObject(document) && isObject(document.createElement);
|
14735 | module.exports = function (it) {
|
14736 | return is ? document.createElement(it) : {};
|
14737 | };
|
14738 |
|
14739 |
|
14740 | }),
|
14741 |
|
14742 | (function(module, exports, __webpack_require__) {
|
14743 |
|
14744 |
|
14745 | var isObject = __webpack_require__(96);
|
14746 |
|
14747 |
|
14748 | module.exports = function (it, S) {
|
14749 | if (!isObject(it)) return it;
|
14750 | var fn, val;
|
14751 | if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
14752 | if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
|
14753 | if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
14754 | throw TypeError("Can't convert object to primitive value");
|
14755 | };
|
14756 |
|
14757 |
|
14758 | }),
|
14759 |
|
14760 | (function(module, exports) {
|
14761 |
|
14762 | module.exports = function (bitmap, value) {
|
14763 | return {
|
14764 | enumerable: !(bitmap & 1),
|
14765 | configurable: !(bitmap & 2),
|
14766 | writable: !(bitmap & 4),
|
14767 | value: value
|
14768 | };
|
14769 | };
|
14770 |
|
14771 |
|
14772 | }),
|
14773 |
|
14774 | (function(module, exports) {
|
14775 |
|
14776 | var hasOwnProperty = {}.hasOwnProperty;
|
14777 | module.exports = function (it, key) {
|
14778 | return hasOwnProperty.call(it, key);
|
14779 | };
|
14780 |
|
14781 |
|
14782 | }),
|
14783 |
|
14784 | (function(module, exports, __webpack_require__) {
|
14785 |
|
14786 | 'use strict';
|
14787 |
|
14788 | var getKeys = __webpack_require__(105);
|
14789 | var gOPS = __webpack_require__(120);
|
14790 | var pIE = __webpack_require__(121);
|
14791 | var toObject = __webpack_require__(122);
|
14792 | var IObject = __webpack_require__(108);
|
14793 | var $assign = Object.assign;
|
14794 |
|
14795 |
|
14796 | module.exports = !$assign || __webpack_require__(99)(function () {
|
14797 | var A = {};
|
14798 | var B = {};
|
14799 |
|
14800 | var S = Symbol();
|
14801 | var K = 'abcdefghijklmnopqrst';
|
14802 | A[S] = 7;
|
14803 | K.split('').forEach(function (k) { B[k] = k; });
|
14804 | return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
14805 | }) ? function assign(target, source) {
|
14806 | var T = toObject(target);
|
14807 | var aLen = arguments.length;
|
14808 | var index = 1;
|
14809 | var getSymbols = gOPS.f;
|
14810 | var isEnum = pIE.f;
|
14811 | while (aLen > index) {
|
14812 | var S = IObject(arguments[index++]);
|
14813 | var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
|
14814 | var length = keys.length;
|
14815 | var j = 0;
|
14816 | var key;
|
14817 | while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
|
14818 | } return T;
|
14819 | } : $assign;
|
14820 |
|
14821 |
|
14822 | }),
|
14823 |
|
14824 | (function(module, exports, __webpack_require__) {
|
14825 |
|
14826 |
|
14827 | var $keys = __webpack_require__(106);
|
14828 | var enumBugKeys = __webpack_require__(119);
|
14829 |
|
14830 | module.exports = Object.keys || function keys(O) {
|
14831 | return $keys(O, enumBugKeys);
|
14832 | };
|
14833 |
|
14834 |
|
14835 | }),
|
14836 |
|
14837 | (function(module, exports, __webpack_require__) {
|
14838 |
|
14839 | var has = __webpack_require__(103);
|
14840 | var toIObject = __webpack_require__(107);
|
14841 | var arrayIndexOf = __webpack_require__(111)(false);
|
14842 | var IE_PROTO = __webpack_require__(115)('IE_PROTO');
|
14843 |
|
14844 | module.exports = function (object, names) {
|
14845 | var O = toIObject(object);
|
14846 | var i = 0;
|
14847 | var result = [];
|
14848 | var key;
|
14849 | for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
|
14850 |
|
14851 | while (names.length > i) if (has(O, key = names[i++])) {
|
14852 | ~arrayIndexOf(result, key) || result.push(key);
|
14853 | }
|
14854 | return result;
|
14855 | };
|
14856 |
|
14857 |
|
14858 | }),
|
14859 |
|
14860 | (function(module, exports, __webpack_require__) {
|
14861 |
|
14862 |
|
14863 | var IObject = __webpack_require__(108);
|
14864 | var defined = __webpack_require__(110);
|
14865 | module.exports = function (it) {
|
14866 | return IObject(defined(it));
|
14867 | };
|
14868 |
|
14869 |
|
14870 | }),
|
14871 |
|
14872 | (function(module, exports, __webpack_require__) {
|
14873 |
|
14874 |
|
14875 | var cof = __webpack_require__(109);
|
14876 |
|
14877 | module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
|
14878 | return cof(it) == 'String' ? it.split('') : Object(it);
|
14879 | };
|
14880 |
|
14881 |
|
14882 | }),
|
14883 |
|
14884 | (function(module, exports) {
|
14885 |
|
14886 | var toString = {}.toString;
|
14887 |
|
14888 | module.exports = function (it) {
|
14889 | return toString.call(it).slice(8, -1);
|
14890 | };
|
14891 |
|
14892 |
|
14893 | }),
|
14894 |
|
14895 | (function(module, exports) {
|
14896 |
|
14897 |
|
14898 | module.exports = function (it) {
|
14899 | if (it == undefined) throw TypeError("Can't call method on " + it);
|
14900 | return it;
|
14901 | };
|
14902 |
|
14903 |
|
14904 | }),
|
14905 |
|
14906 | (function(module, exports, __webpack_require__) {
|
14907 |
|
14908 |
|
14909 |
|
14910 | var toIObject = __webpack_require__(107);
|
14911 | var toLength = __webpack_require__(112);
|
14912 | var toAbsoluteIndex = __webpack_require__(114);
|
14913 | module.exports = function (IS_INCLUDES) {
|
14914 | return function ($this, el, fromIndex) {
|
14915 | var O = toIObject($this);
|
14916 | var length = toLength(O.length);
|
14917 | var index = toAbsoluteIndex(fromIndex, length);
|
14918 | var value;
|
14919 |
|
14920 |
|
14921 | if (IS_INCLUDES && el != el) while (length > index) {
|
14922 | value = O[index++];
|
14923 |
|
14924 | if (value != value) return true;
|
14925 |
|
14926 | } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
|
14927 | if (O[index] === el) return IS_INCLUDES || index || 0;
|
14928 | } return !IS_INCLUDES && -1;
|
14929 | };
|
14930 | };
|
14931 |
|
14932 |
|
14933 | }),
|
14934 |
|
14935 | (function(module, exports, __webpack_require__) {
|
14936 |
|
14937 |
|
14938 | var toInteger = __webpack_require__(113);
|
14939 | var min = Math.min;
|
14940 | module.exports = function (it) {
|
14941 | return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0;
|
14942 | };
|
14943 |
|
14944 |
|
14945 | }),
|
14946 |
|
14947 | (function(module, exports) {
|
14948 |
|
14949 |
|
14950 | var ceil = Math.ceil;
|
14951 | var floor = Math.floor;
|
14952 | module.exports = function (it) {
|
14953 | return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
14954 | };
|
14955 |
|
14956 |
|
14957 | }),
|
14958 |
|
14959 | (function(module, exports, __webpack_require__) {
|
14960 |
|
14961 | var toInteger = __webpack_require__(113);
|
14962 | var max = Math.max;
|
14963 | var min = Math.min;
|
14964 | module.exports = function (index, length) {
|
14965 | index = toInteger(index);
|
14966 | return index < 0 ? max(index + length, 0) : min(index, length);
|
14967 | };
|
14968 |
|
14969 |
|
14970 | }),
|
14971 |
|
14972 | (function(module, exports, __webpack_require__) {
|
14973 |
|
14974 | var shared = __webpack_require__(116)('keys');
|
14975 | var uid = __webpack_require__(118);
|
14976 | module.exports = function (key) {
|
14977 | return shared[key] || (shared[key] = uid(key));
|
14978 | };
|
14979 |
|
14980 |
|
14981 | }),
|
14982 |
|
14983 | (function(module, exports, __webpack_require__) {
|
14984 |
|
14985 | var core = __webpack_require__(90);
|
14986 | var global = __webpack_require__(89);
|
14987 | var SHARED = '__core-js_shared__';
|
14988 | var store = global[SHARED] || (global[SHARED] = {});
|
14989 |
|
14990 | (module.exports = function (key, value) {
|
14991 | return store[key] || (store[key] = value !== undefined ? value : {});
|
14992 | })('versions', []).push({
|
14993 | version: core.version,
|
14994 | mode: __webpack_require__(117) ? 'pure' : 'global',
|
14995 | copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
|
14996 | });
|
14997 |
|
14998 |
|
14999 | }),
|
15000 |
|
15001 | (function(module, exports) {
|
15002 |
|
15003 | module.exports = true;
|
15004 |
|
15005 |
|
15006 | }),
|
15007 |
|
15008 | (function(module, exports) {
|
15009 |
|
15010 | var id = 0;
|
15011 | var px = Math.random();
|
15012 | module.exports = function (key) {
|
15013 | return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
15014 | };
|
15015 |
|
15016 |
|
15017 | }),
|
15018 |
|
15019 | (function(module, exports) {
|
15020 |
|
15021 |
|
15022 | module.exports = (
|
15023 | 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
|
15024 | ).split(',');
|
15025 |
|
15026 |
|
15027 | }),
|
15028 |
|
15029 | (function(module, exports) {
|
15030 |
|
15031 | exports.f = Object.getOwnPropertySymbols;
|
15032 |
|
15033 |
|
15034 | }),
|
15035 |
|
15036 | (function(module, exports) {
|
15037 |
|
15038 | exports.f = {}.propertyIsEnumerable;
|
15039 |
|
15040 |
|
15041 | }),
|
15042 |
|
15043 | (function(module, exports, __webpack_require__) {
|
15044 |
|
15045 |
|
15046 | var defined = __webpack_require__(110);
|
15047 | module.exports = function (it) {
|
15048 | return Object(defined(it));
|
15049 | };
|
15050 |
|
15051 |
|
15052 | }),
|
15053 |
|
15054 | (function(module, exports, __webpack_require__) {
|
15055 |
|
15056 | (function(process) {'use strict';
|
15057 |
|
15058 | var isProduction = process.env.NODE_ENV === 'production';
|
15059 | var prefix = 'Invariant failed';
|
15060 | function invariant(condition, message) {
|
15061 | if (condition) {
|
15062 | return;
|
15063 | }
|
15064 |
|
15065 | if (isProduction) {
|
15066 | throw new Error(prefix);
|
15067 | } else {
|
15068 | throw new Error(prefix + ": " + (message || ''));
|
15069 | }
|
15070 | }
|
15071 |
|
15072 | module.exports = invariant;
|
15073 |
|
15074 | }.call(exports, __webpack_require__(33)))
|
15075 |
|
15076 | }),
|
15077 |
|
15078 | (function(module, exports, __webpack_require__) {
|
15079 |
|
15080 | (function(process) {'use strict';
|
15081 |
|
15082 | Object.defineProperty(exports, '__esModule', { value: true });
|
15083 |
|
15084 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
15085 |
|
15086 | var invariant = _interopDefault(__webpack_require__(123));
|
15087 |
|
15088 | var getRect = function getRect(_ref) {
|
15089 | var top = _ref.top,
|
15090 | right = _ref.right,
|
15091 | bottom = _ref.bottom,
|
15092 | left = _ref.left;
|
15093 | var width = right - left;
|
15094 | var height = bottom - top;
|
15095 | var rect = {
|
15096 | top: top,
|
15097 | right: right,
|
15098 | bottom: bottom,
|
15099 | left: left,
|
15100 | width: width,
|
15101 | height: height,
|
15102 | x: left,
|
15103 | y: top,
|
15104 | center: {
|
15105 | x: (right + left) / 2,
|
15106 | y: (bottom + top) / 2
|
15107 | }
|
15108 | };
|
15109 | return rect;
|
15110 | };
|
15111 | var expand = function expand(target, expandBy) {
|
15112 | return {
|
15113 | top: target.top - expandBy.top,
|
15114 | left: target.left - expandBy.left,
|
15115 | bottom: target.bottom + expandBy.bottom,
|
15116 | right: target.right + expandBy.right
|
15117 | };
|
15118 | };
|
15119 | var shrink = function shrink(target, shrinkBy) {
|
15120 | return {
|
15121 | top: target.top + shrinkBy.top,
|
15122 | left: target.left + shrinkBy.left,
|
15123 | bottom: target.bottom - shrinkBy.bottom,
|
15124 | right: target.right - shrinkBy.right
|
15125 | };
|
15126 | };
|
15127 |
|
15128 | var shift = function shift(target, shiftBy) {
|
15129 | return {
|
15130 | top: target.top + shiftBy.y,
|
15131 | left: target.left + shiftBy.x,
|
15132 | bottom: target.bottom + shiftBy.y,
|
15133 | right: target.right + shiftBy.x
|
15134 | };
|
15135 | };
|
15136 |
|
15137 | var noSpacing = {
|
15138 | top: 0,
|
15139 | right: 0,
|
15140 | bottom: 0,
|
15141 | left: 0
|
15142 | };
|
15143 | var createBox = function createBox(_ref2) {
|
15144 | var borderBox = _ref2.borderBox,
|
15145 | _ref2$margin = _ref2.margin,
|
15146 | margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin,
|
15147 | _ref2$border = _ref2.border,
|
15148 | border = _ref2$border === void 0 ? noSpacing : _ref2$border,
|
15149 | _ref2$padding = _ref2.padding,
|
15150 | padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
|
15151 | var marginBox = getRect(expand(borderBox, margin));
|
15152 | var paddingBox = getRect(shrink(borderBox, border));
|
15153 | var contentBox = getRect(shrink(paddingBox, padding));
|
15154 | return {
|
15155 | marginBox: marginBox,
|
15156 | borderBox: getRect(borderBox),
|
15157 | paddingBox: paddingBox,
|
15158 | contentBox: contentBox,
|
15159 | margin: margin,
|
15160 | border: border,
|
15161 | padding: padding
|
15162 | };
|
15163 | };
|
15164 |
|
15165 | var parse = function parse(raw) {
|
15166 | var value = raw.slice(0, -2);
|
15167 | var suffix = raw.slice(-2);
|
15168 | !(suffix === 'px') ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected value to be a pixel value.\n Expected form: 10px\n Actual value: " + raw + "\n ") : invariant(false) : void 0;
|
15169 | var result = Number(value);
|
15170 | !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
|
15171 | return result;
|
15172 | };
|
15173 |
|
15174 | var getWindowScroll = function getWindowScroll() {
|
15175 | return {
|
15176 | x: window.pageXOffset,
|
15177 | y: window.pageYOffset
|
15178 | };
|
15179 | };
|
15180 |
|
15181 | var offset = function offset(original, change) {
|
15182 | var borderBox = original.borderBox,
|
15183 | border = original.border,
|
15184 | margin = original.margin,
|
15185 | padding = original.padding;
|
15186 | var shifted = shift(borderBox, change);
|
15187 | return createBox({
|
15188 | borderBox: shifted,
|
15189 | border: border,
|
15190 | margin: margin,
|
15191 | padding: padding
|
15192 | });
|
15193 | };
|
15194 | var withScroll = function withScroll(original, scroll) {
|
15195 | if (scroll === void 0) {
|
15196 | scroll = getWindowScroll();
|
15197 | }
|
15198 |
|
15199 | return offset(original, scroll);
|
15200 | };
|
15201 | var calculateBox = function calculateBox(borderBox, styles) {
|
15202 | var margin = {
|
15203 | top: parse(styles.marginTop),
|
15204 | right: parse(styles.marginRight),
|
15205 | bottom: parse(styles.marginBottom),
|
15206 | left: parse(styles.marginLeft)
|
15207 | };
|
15208 | var padding = {
|
15209 | top: parse(styles.paddingTop),
|
15210 | right: parse(styles.paddingRight),
|
15211 | bottom: parse(styles.paddingBottom),
|
15212 | left: parse(styles.paddingLeft)
|
15213 | };
|
15214 | var border = {
|
15215 | top: parse(styles.borderTopWidth),
|
15216 | right: parse(styles.borderRightWidth),
|
15217 | bottom: parse(styles.borderBottomWidth),
|
15218 | left: parse(styles.borderLeftWidth)
|
15219 | };
|
15220 | return createBox({
|
15221 | borderBox: borderBox,
|
15222 | margin: margin,
|
15223 | padding: padding,
|
15224 | border: border
|
15225 | });
|
15226 | };
|
15227 | var getBox = function getBox(el) {
|
15228 | var borderBox = el.getBoundingClientRect();
|
15229 | var styles = window.getComputedStyle(el);
|
15230 | return calculateBox(borderBox, styles);
|
15231 | };
|
15232 |
|
15233 | exports.getRect = getRect;
|
15234 | exports.expand = expand;
|
15235 | exports.shrink = shrink;
|
15236 | exports.createBox = createBox;
|
15237 | exports.offset = offset;
|
15238 | exports.withScroll = withScroll;
|
15239 | exports.calculateBox = calculateBox;
|
15240 | exports.getBox = getBox;
|
15241 |
|
15242 | }.call(exports, __webpack_require__(33)))
|
15243 |
|
15244 | }),
|
15245 |
|
15246 | (function(module, exports, __webpack_require__) {
|
15247 |
|
15248 | module.exports = __webpack_require__(126);
|
15249 |
|
15250 | }),
|
15251 |
|
15252 | (function(module, exports, __webpack_require__) {
|
15253 |
|
15254 | __webpack_require__(127);
|
15255 | module.exports = __webpack_require__(90).Object.keys;
|
15256 |
|
15257 |
|
15258 | }),
|
15259 |
|
15260 | (function(module, exports, __webpack_require__) {
|
15261 |
|
15262 |
|
15263 | var toObject = __webpack_require__(122);
|
15264 | var $keys = __webpack_require__(105);
|
15265 |
|
15266 | __webpack_require__(128)('keys', function () {
|
15267 | return function keys(it) {
|
15268 | return $keys(toObject(it));
|
15269 | };
|
15270 | });
|
15271 |
|
15272 |
|
15273 | }),
|
15274 |
|
15275 | (function(module, exports, __webpack_require__) {
|
15276 |
|
15277 |
|
15278 | var $export = __webpack_require__(88);
|
15279 | var core = __webpack_require__(90);
|
15280 | var fails = __webpack_require__(99);
|
15281 | module.exports = function (KEY, exec) {
|
15282 | var fn = (core.Object || {})[KEY] || Object[KEY];
|
15283 | var exp = {};
|
15284 | exp[KEY] = exec(fn);
|
15285 | $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
|
15286 | };
|
15287 |
|
15288 |
|
15289 | }),
|
15290 |
|
15291 | (function(module, exports) {
|
15292 |
|
15293 | 'use strict';
|
15294 |
|
15295 | var simpleIsEqual = function simpleIsEqual(a, b) {
|
15296 | return a === b;
|
15297 | };
|
15298 |
|
15299 | function index (resultFn, isEqual) {
|
15300 | if (isEqual === void 0) {
|
15301 | isEqual = simpleIsEqual;
|
15302 | }
|
15303 |
|
15304 | var lastThis;
|
15305 | var lastArgs = [];
|
15306 | var lastResult;
|
15307 | var calledOnce = false;
|
15308 |
|
15309 | var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) {
|
15310 | return isEqual(newArg, lastArgs[index]);
|
15311 | };
|
15312 |
|
15313 | var result = function result() {
|
15314 | for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {
|
15315 | newArgs[_key] = arguments[_key];
|
15316 | }
|
15317 |
|
15318 | if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {
|
15319 | return lastResult;
|
15320 | }
|
15321 |
|
15322 | lastResult = resultFn.apply(this, newArgs);
|
15323 | calledOnce = true;
|
15324 | lastThis = this;
|
15325 | lastArgs = newArgs;
|
15326 | return lastResult;
|
15327 | };
|
15328 |
|
15329 | return result;
|
15330 | }
|
15331 |
|
15332 | module.exports = index;
|
15333 |
|
15334 |
|
15335 | }),
|
15336 |
|
15337 | (function(module, exports, __webpack_require__) {
|
15338 |
|
15339 | (function(process) {'use strict';
|
15340 |
|
15341 | Object.defineProperty(exports, '__esModule', { value: true });
|
15342 |
|
15343 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
15344 |
|
15345 | var $$observable = _interopDefault(__webpack_require__(131));
|
15346 |
|
15347 | |
15348 |
|
15349 |
|
15350 |
|
15351 |
|
15352 |
|
15353 | var randomString = function randomString() {
|
15354 | return Math.random().toString(36).substring(7).split('').join('.');
|
15355 | };
|
15356 |
|
15357 | var ActionTypes = {
|
15358 | INIT: "@@redux/INIT" + randomString(),
|
15359 | REPLACE: "@@redux/REPLACE" + randomString(),
|
15360 | PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
15361 | return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
15362 | }
|
15363 | };
|
15364 |
|
15365 | |
15366 |
|
15367 |
|
15368 |
|
15369 | function isPlainObject(obj) {
|
15370 | if (typeof obj !== 'object' || obj === null) return false;
|
15371 | var proto = obj;
|
15372 |
|
15373 | while (Object.getPrototypeOf(proto) !== null) {
|
15374 | proto = Object.getPrototypeOf(proto);
|
15375 | }
|
15376 |
|
15377 | return Object.getPrototypeOf(obj) === proto;
|
15378 | }
|
15379 |
|
15380 | |
15381 |
|
15382 |
|
15383 |
|
15384 |
|
15385 |
|
15386 |
|
15387 |
|
15388 |
|
15389 |
|
15390 |
|
15391 |
|
15392 |
|
15393 |
|
15394 |
|
15395 |
|
15396 |
|
15397 |
|
15398 |
|
15399 |
|
15400 |
|
15401 |
|
15402 |
|
15403 |
|
15404 |
|
15405 |
|
15406 | function createStore(reducer, preloadedState, enhancer) {
|
15407 | var _ref2;
|
15408 |
|
15409 | if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
|
15410 | throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function');
|
15411 | }
|
15412 |
|
15413 | if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
|
15414 | enhancer = preloadedState;
|
15415 | preloadedState = undefined;
|
15416 | }
|
15417 |
|
15418 | if (typeof enhancer !== 'undefined') {
|
15419 | if (typeof enhancer !== 'function') {
|
15420 | throw new Error('Expected the enhancer to be a function.');
|
15421 | }
|
15422 |
|
15423 | return enhancer(createStore)(reducer, preloadedState);
|
15424 | }
|
15425 |
|
15426 | if (typeof reducer !== 'function') {
|
15427 | throw new Error('Expected the reducer to be a function.');
|
15428 | }
|
15429 |
|
15430 | var currentReducer = reducer;
|
15431 | var currentState = preloadedState;
|
15432 | var currentListeners = [];
|
15433 | var nextListeners = currentListeners;
|
15434 | var isDispatching = false;
|
15435 |
|
15436 | function ensureCanMutateNextListeners() {
|
15437 | if (nextListeners === currentListeners) {
|
15438 | nextListeners = currentListeners.slice();
|
15439 | }
|
15440 | }
|
15441 | |
15442 |
|
15443 |
|
15444 |
|
15445 |
|
15446 |
|
15447 |
|
15448 | function getState() {
|
15449 | if (isDispatching) {
|
15450 | 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.');
|
15451 | }
|
15452 |
|
15453 | return currentState;
|
15454 | }
|
15455 | |
15456 |
|
15457 |
|
15458 |
|
15459 |
|
15460 |
|
15461 |
|
15462 |
|
15463 |
|
15464 |
|
15465 |
|
15466 |
|
15467 |
|
15468 |
|
15469 |
|
15470 |
|
15471 |
|
15472 |
|
15473 |
|
15474 |
|
15475 |
|
15476 |
|
15477 |
|
15478 |
|
15479 |
|
15480 | function subscribe(listener) {
|
15481 | if (typeof listener !== 'function') {
|
15482 | throw new Error('Expected the listener to be a function.');
|
15483 | }
|
15484 |
|
15485 | if (isDispatching) {
|
15486 | 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.');
|
15487 | }
|
15488 |
|
15489 | var isSubscribed = true;
|
15490 | ensureCanMutateNextListeners();
|
15491 | nextListeners.push(listener);
|
15492 | return function unsubscribe() {
|
15493 | if (!isSubscribed) {
|
15494 | return;
|
15495 | }
|
15496 |
|
15497 | if (isDispatching) {
|
15498 | 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.');
|
15499 | }
|
15500 |
|
15501 | isSubscribed = false;
|
15502 | ensureCanMutateNextListeners();
|
15503 | var index = nextListeners.indexOf(listener);
|
15504 | nextListeners.splice(index, 1);
|
15505 | };
|
15506 | }
|
15507 | |
15508 |
|
15509 |
|
15510 |
|
15511 |
|
15512 |
|
15513 |
|
15514 |
|
15515 |
|
15516 |
|
15517 |
|
15518 |
|
15519 |
|
15520 |
|
15521 |
|
15522 |
|
15523 |
|
15524 |
|
15525 |
|
15526 |
|
15527 |
|
15528 |
|
15529 |
|
15530 |
|
15531 |
|
15532 |
|
15533 |
|
15534 | function dispatch(action) {
|
15535 | if (!isPlainObject(action)) {
|
15536 | throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
|
15537 | }
|
15538 |
|
15539 | if (typeof action.type === 'undefined') {
|
15540 | throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
|
15541 | }
|
15542 |
|
15543 | if (isDispatching) {
|
15544 | throw new Error('Reducers may not dispatch actions.');
|
15545 | }
|
15546 |
|
15547 | try {
|
15548 | isDispatching = true;
|
15549 | currentState = currentReducer(currentState, action);
|
15550 | } finally {
|
15551 | isDispatching = false;
|
15552 | }
|
15553 |
|
15554 | var listeners = currentListeners = nextListeners;
|
15555 |
|
15556 | for (var i = 0; i < listeners.length; i++) {
|
15557 | var listener = listeners[i];
|
15558 | listener();
|
15559 | }
|
15560 |
|
15561 | return action;
|
15562 | }
|
15563 | |
15564 |
|
15565 |
|
15566 |
|
15567 |
|
15568 |
|
15569 |
|
15570 |
|
15571 |
|
15572 |
|
15573 |
|
15574 |
|
15575 | function replaceReducer(nextReducer) {
|
15576 | if (typeof nextReducer !== 'function') {
|
15577 | throw new Error('Expected the nextReducer to be a function.');
|
15578 | }
|
15579 |
|
15580 | currentReducer = nextReducer;
|
15581 | dispatch({
|
15582 | type: ActionTypes.REPLACE
|
15583 | });
|
15584 | }
|
15585 | |
15586 |
|
15587 |
|
15588 |
|
15589 |
|
15590 |
|
15591 |
|
15592 |
|
15593 | function observable() {
|
15594 | var _ref;
|
15595 |
|
15596 | var outerSubscribe = subscribe;
|
15597 | return _ref = {
|
15598 | |
15599 |
|
15600 |
|
15601 |
|
15602 |
|
15603 |
|
15604 |
|
15605 |
|
15606 | subscribe: function subscribe(observer) {
|
15607 | if (typeof observer !== 'object' || observer === null) {
|
15608 | throw new TypeError('Expected the observer to be an object.');
|
15609 | }
|
15610 |
|
15611 | function observeState() {
|
15612 | if (observer.next) {
|
15613 | observer.next(getState());
|
15614 | }
|
15615 | }
|
15616 |
|
15617 | observeState();
|
15618 | var unsubscribe = outerSubscribe(observeState);
|
15619 | return {
|
15620 | unsubscribe: unsubscribe
|
15621 | };
|
15622 | }
|
15623 | }, _ref[$$observable] = function () {
|
15624 | return this;
|
15625 | }, _ref;
|
15626 | }
|
15627 |
|
15628 |
|
15629 |
|
15630 |
|
15631 | dispatch({
|
15632 | type: ActionTypes.INIT
|
15633 | });
|
15634 | return _ref2 = {
|
15635 | dispatch: dispatch,
|
15636 | subscribe: subscribe,
|
15637 | getState: getState,
|
15638 | replaceReducer: replaceReducer
|
15639 | }, _ref2[$$observable] = observable, _ref2;
|
15640 | }
|
15641 |
|
15642 | |
15643 |
|
15644 |
|
15645 |
|
15646 |
|
15647 |
|
15648 | function warning(message) {
|
15649 |
|
15650 | if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
15651 | console.error(message);
|
15652 | }
|
15653 |
|
15654 |
|
15655 |
|
15656 | try {
|
15657 |
|
15658 |
|
15659 |
|
15660 | throw new Error(message);
|
15661 | } catch (e) {}
|
15662 |
|
15663 | }
|
15664 |
|
15665 | function getUndefinedStateErrorMessage(key, action) {
|
15666 | var actionType = action && action.type;
|
15667 | var actionDescription = actionType && "action \"" + String(actionType) + "\"" || 'an action';
|
15668 | 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.";
|
15669 | }
|
15670 |
|
15671 | function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
15672 | var reducerKeys = Object.keys(reducers);
|
15673 | var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
|
15674 |
|
15675 | if (reducerKeys.length === 0) {
|
15676 | return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
|
15677 | }
|
15678 |
|
15679 | if (!isPlainObject(inputState)) {
|
15680 | 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('", "') + "\"");
|
15681 | }
|
15682 |
|
15683 | var unexpectedKeys = Object.keys(inputState).filter(function (key) {
|
15684 | return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
|
15685 | });
|
15686 | unexpectedKeys.forEach(function (key) {
|
15687 | unexpectedKeyCache[key] = true;
|
15688 | });
|
15689 | if (action && action.type === ActionTypes.REPLACE) return;
|
15690 |
|
15691 | if (unexpectedKeys.length > 0) {
|
15692 | 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.");
|
15693 | }
|
15694 | }
|
15695 |
|
15696 | function assertReducerShape(reducers) {
|
15697 | Object.keys(reducers).forEach(function (key) {
|
15698 | var reducer = reducers[key];
|
15699 | var initialState = reducer(undefined, {
|
15700 | type: ActionTypes.INIT
|
15701 | });
|
15702 |
|
15703 | if (typeof initialState === 'undefined') {
|
15704 | 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.");
|
15705 | }
|
15706 |
|
15707 | if (typeof reducer(undefined, {
|
15708 | type: ActionTypes.PROBE_UNKNOWN_ACTION()
|
15709 | }) === 'undefined') {
|
15710 | 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.");
|
15711 | }
|
15712 | });
|
15713 | }
|
15714 | |
15715 |
|
15716 |
|
15717 |
|
15718 |
|
15719 |
|
15720 |
|
15721 |
|
15722 |
|
15723 |
|
15724 |
|
15725 |
|
15726 |
|
15727 |
|
15728 |
|
15729 |
|
15730 |
|
15731 |
|
15732 | function combineReducers(reducers) {
|
15733 | var reducerKeys = Object.keys(reducers);
|
15734 | var finalReducers = {};
|
15735 |
|
15736 | for (var i = 0; i < reducerKeys.length; i++) {
|
15737 | var key = reducerKeys[i];
|
15738 |
|
15739 | if (process.env.NODE_ENV !== 'production') {
|
15740 | if (typeof reducers[key] === 'undefined') {
|
15741 | warning("No reducer provided for key \"" + key + "\"");
|
15742 | }
|
15743 | }
|
15744 |
|
15745 | if (typeof reducers[key] === 'function') {
|
15746 | finalReducers[key] = reducers[key];
|
15747 | }
|
15748 | }
|
15749 |
|
15750 | var finalReducerKeys = Object.keys(finalReducers);
|
15751 | var unexpectedKeyCache;
|
15752 |
|
15753 | if (process.env.NODE_ENV !== 'production') {
|
15754 | unexpectedKeyCache = {};
|
15755 | }
|
15756 |
|
15757 | var shapeAssertionError;
|
15758 |
|
15759 | try {
|
15760 | assertReducerShape(finalReducers);
|
15761 | } catch (e) {
|
15762 | shapeAssertionError = e;
|
15763 | }
|
15764 |
|
15765 | return function combination(state, action) {
|
15766 | if (state === void 0) {
|
15767 | state = {};
|
15768 | }
|
15769 |
|
15770 | if (shapeAssertionError) {
|
15771 | throw shapeAssertionError;
|
15772 | }
|
15773 |
|
15774 | if (process.env.NODE_ENV !== 'production') {
|
15775 | var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
15776 |
|
15777 | if (warningMessage) {
|
15778 | warning(warningMessage);
|
15779 | }
|
15780 | }
|
15781 |
|
15782 | var hasChanged = false;
|
15783 | var nextState = {};
|
15784 |
|
15785 | for (var _i = 0; _i < finalReducerKeys.length; _i++) {
|
15786 | var _key = finalReducerKeys[_i];
|
15787 | var reducer = finalReducers[_key];
|
15788 | var previousStateForKey = state[_key];
|
15789 | var nextStateForKey = reducer(previousStateForKey, action);
|
15790 |
|
15791 | if (typeof nextStateForKey === 'undefined') {
|
15792 | var errorMessage = getUndefinedStateErrorMessage(_key, action);
|
15793 | throw new Error(errorMessage);
|
15794 | }
|
15795 |
|
15796 | nextState[_key] = nextStateForKey;
|
15797 | hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
15798 | }
|
15799 |
|
15800 | return hasChanged ? nextState : state;
|
15801 | };
|
15802 | }
|
15803 |
|
15804 | function bindActionCreator(actionCreator, dispatch) {
|
15805 | return function () {
|
15806 | return dispatch(actionCreator.apply(this, arguments));
|
15807 | };
|
15808 | }
|
15809 | |
15810 |
|
15811 |
|
15812 |
|
15813 |
|
15814 |
|
15815 |
|
15816 |
|
15817 |
|
15818 |
|
15819 |
|
15820 |
|
15821 |
|
15822 |
|
15823 |
|
15824 |
|
15825 |
|
15826 |
|
15827 |
|
15828 |
|
15829 |
|
15830 |
|
15831 |
|
15832 | function bindActionCreators(actionCreators, dispatch) {
|
15833 | if (typeof actionCreators === 'function') {
|
15834 | return bindActionCreator(actionCreators, dispatch);
|
15835 | }
|
15836 |
|
15837 | if (typeof actionCreators !== 'object' || actionCreators === null) {
|
15838 | throw new Error("bindActionCreators expected an object or a function, instead received " + (actionCreators === null ? 'null' : typeof actionCreators) + ". " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
|
15839 | }
|
15840 |
|
15841 | var keys = Object.keys(actionCreators);
|
15842 | var boundActionCreators = {};
|
15843 |
|
15844 | for (var i = 0; i < keys.length; i++) {
|
15845 | var key = keys[i];
|
15846 | var actionCreator = actionCreators[key];
|
15847 |
|
15848 | if (typeof actionCreator === 'function') {
|
15849 | boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
|
15850 | }
|
15851 | }
|
15852 |
|
15853 | return boundActionCreators;
|
15854 | }
|
15855 |
|
15856 | function _defineProperty(obj, key, value) {
|
15857 | if (key in obj) {
|
15858 | Object.defineProperty(obj, key, {
|
15859 | value: value,
|
15860 | enumerable: true,
|
15861 | configurable: true,
|
15862 | writable: true
|
15863 | });
|
15864 | } else {
|
15865 | obj[key] = value;
|
15866 | }
|
15867 |
|
15868 | return obj;
|
15869 | }
|
15870 |
|
15871 | function _objectSpread(target) {
|
15872 | for (var i = 1; i < arguments.length; i++) {
|
15873 | var source = arguments[i] != null ? arguments[i] : {};
|
15874 | var ownKeys = Object.keys(source);
|
15875 |
|
15876 | if (typeof Object.getOwnPropertySymbols === 'function') {
|
15877 | ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
15878 | return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
15879 | }));
|
15880 | }
|
15881 |
|
15882 | ownKeys.forEach(function (key) {
|
15883 | _defineProperty(target, key, source[key]);
|
15884 | });
|
15885 | }
|
15886 |
|
15887 | return target;
|
15888 | }
|
15889 |
|
15890 | |
15891 |
|
15892 |
|
15893 |
|
15894 |
|
15895 |
|
15896 |
|
15897 |
|
15898 |
|
15899 |
|
15900 | function compose() {
|
15901 | for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
15902 | funcs[_key] = arguments[_key];
|
15903 | }
|
15904 |
|
15905 | if (funcs.length === 0) {
|
15906 | return function (arg) {
|
15907 | return arg;
|
15908 | };
|
15909 | }
|
15910 |
|
15911 | if (funcs.length === 1) {
|
15912 | return funcs[0];
|
15913 | }
|
15914 |
|
15915 | return funcs.reduce(function (a, b) {
|
15916 | return function () {
|
15917 | return a(b.apply(void 0, arguments));
|
15918 | };
|
15919 | });
|
15920 | }
|
15921 |
|
15922 | |
15923 |
|
15924 |
|
15925 |
|
15926 |
|
15927 |
|
15928 |
|
15929 |
|
15930 |
|
15931 |
|
15932 |
|
15933 |
|
15934 |
|
15935 |
|
15936 |
|
15937 |
|
15938 |
|
15939 | function applyMiddleware() {
|
15940 | for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
|
15941 | middlewares[_key] = arguments[_key];
|
15942 | }
|
15943 |
|
15944 | return function (createStore) {
|
15945 | return function () {
|
15946 | var store = createStore.apply(void 0, arguments);
|
15947 |
|
15948 | var _dispatch = function dispatch() {
|
15949 | throw new Error("Dispatching while constructing your middleware is not allowed. " + "Other middleware would not be applied to this dispatch.");
|
15950 | };
|
15951 |
|
15952 | var middlewareAPI = {
|
15953 | getState: store.getState,
|
15954 | dispatch: function dispatch() {
|
15955 | return _dispatch.apply(void 0, arguments);
|
15956 | }
|
15957 | };
|
15958 | var chain = middlewares.map(function (middleware) {
|
15959 | return middleware(middlewareAPI);
|
15960 | });
|
15961 | _dispatch = compose.apply(void 0, chain)(store.dispatch);
|
15962 | return _objectSpread({}, store, {
|
15963 | dispatch: _dispatch
|
15964 | });
|
15965 | };
|
15966 | };
|
15967 | }
|
15968 |
|
15969 | |
15970 |
|
15971 |
|
15972 |
|
15973 |
|
15974 | function isCrushed() {}
|
15975 |
|
15976 | if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
|
15977 | warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');
|
15978 | }
|
15979 |
|
15980 | exports.createStore = createStore;
|
15981 | exports.combineReducers = combineReducers;
|
15982 | exports.bindActionCreators = bindActionCreators;
|
15983 | exports.applyMiddleware = applyMiddleware;
|
15984 | exports.compose = compose;
|
15985 | exports.__DO_NOT_USE__ActionTypes = ActionTypes;
|
15986 |
|
15987 | }.call(exports, __webpack_require__(33)))
|
15988 |
|
15989 | }),
|
15990 |
|
15991 | (function(module, exports, __webpack_require__) {
|
15992 |
|
15993 | (function(global, module) {'use strict';
|
15994 |
|
15995 | Object.defineProperty(exports, "__esModule", {
|
15996 | value: true
|
15997 | });
|
15998 |
|
15999 | var _ponyfill = __webpack_require__(133);
|
16000 |
|
16001 | var _ponyfill2 = _interopRequireDefault(_ponyfill);
|
16002 |
|
16003 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16004 |
|
16005 | var root;
|
16006 |
|
16007 |
|
16008 | if (typeof self !== 'undefined') {
|
16009 | root = self;
|
16010 | } else if (typeof window !== 'undefined') {
|
16011 | root = window;
|
16012 | } else if (typeof global !== 'undefined') {
|
16013 | root = global;
|
16014 | } else if (true) {
|
16015 | root = module;
|
16016 | } else {
|
16017 | root = Function('return this')();
|
16018 | }
|
16019 |
|
16020 | var result = (0, _ponyfill2['default'])(root);
|
16021 | exports['default'] = result;
|
16022 | }.call(exports, (function() { return this; }()), __webpack_require__(132)(module)))
|
16023 |
|
16024 | }),
|
16025 |
|
16026 | (function(module, exports) {
|
16027 |
|
16028 | module.exports = function(module) {
|
16029 | if(!module.webpackPolyfill) {
|
16030 | module.deprecate = function() {};
|
16031 | module.paths = [];
|
16032 |
|
16033 | module.children = [];
|
16034 | module.webpackPolyfill = 1;
|
16035 | }
|
16036 | return module;
|
16037 | }
|
16038 |
|
16039 |
|
16040 | }),
|
16041 |
|
16042 | (function(module, exports) {
|
16043 |
|
16044 | 'use strict';
|
16045 |
|
16046 | Object.defineProperty(exports, "__esModule", {
|
16047 | value: true
|
16048 | });
|
16049 | exports['default'] = symbolObservablePonyfill;
|
16050 | function symbolObservablePonyfill(root) {
|
16051 | var result;
|
16052 | var _Symbol = root.Symbol;
|
16053 |
|
16054 | if (typeof _Symbol === 'function') {
|
16055 | if (_Symbol.observable) {
|
16056 | result = _Symbol.observable;
|
16057 | } else {
|
16058 | result = _Symbol('observable');
|
16059 | _Symbol.observable = result;
|
16060 | }
|
16061 | } else {
|
16062 | result = '@@observable';
|
16063 | }
|
16064 |
|
16065 | return result;
|
16066 | };
|
16067 |
|
16068 | }),
|
16069 |
|
16070 | (function(module, exports) {
|
16071 |
|
16072 | 'use strict';
|
16073 |
|
16074 | var index = (function (fn) {
|
16075 | var lastArgs = [];
|
16076 | var frameId = null;
|
16077 |
|
16078 | var wrapperFn = function wrapperFn() {
|
16079 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
16080 | args[_key] = arguments[_key];
|
16081 | }
|
16082 |
|
16083 | lastArgs = args;
|
16084 |
|
16085 | if (frameId) {
|
16086 | return;
|
16087 | }
|
16088 |
|
16089 | frameId = requestAnimationFrame(function () {
|
16090 | frameId = null;
|
16091 | fn.apply(undefined, lastArgs);
|
16092 | });
|
16093 | };
|
16094 |
|
16095 | wrapperFn.cancel = function () {
|
16096 | if (!frameId) {
|
16097 | return;
|
16098 | }
|
16099 |
|
16100 | cancelAnimationFrame(frameId);
|
16101 | frameId = null;
|
16102 | };
|
16103 |
|
16104 | var resultFn = wrapperFn;
|
16105 |
|
16106 | return resultFn;
|
16107 | });
|
16108 |
|
16109 | module.exports = index;
|
16110 |
|
16111 |
|
16112 | }),
|
16113 |
|
16114 | (function(module, exports, __webpack_require__) {
|
16115 |
|
16116 | var _Object$create = __webpack_require__(136);
|
16117 |
|
16118 | function _inheritsLoose(subClass, superClass) {
|
16119 | subClass.prototype = _Object$create(superClass.prototype);
|
16120 | subClass.prototype.constructor = subClass;
|
16121 | subClass.__proto__ = superClass;
|
16122 | }
|
16123 |
|
16124 | module.exports = _inheritsLoose;
|
16125 |
|
16126 | }),
|
16127 |
|
16128 | (function(module, exports, __webpack_require__) {
|
16129 |
|
16130 | module.exports = __webpack_require__(137);
|
16131 |
|
16132 | }),
|
16133 |
|
16134 | (function(module, exports, __webpack_require__) {
|
16135 |
|
16136 | __webpack_require__(138);
|
16137 | var $Object = __webpack_require__(90).Object;
|
16138 | module.exports = function create(P, D) {
|
16139 | return $Object.create(P, D);
|
16140 | };
|
16141 |
|
16142 |
|
16143 | }),
|
16144 |
|
16145 | (function(module, exports, __webpack_require__) {
|
16146 |
|
16147 | var $export = __webpack_require__(88);
|
16148 |
|
16149 | $export($export.S, 'Object', { create: __webpack_require__(139) });
|
16150 |
|
16151 |
|
16152 | }),
|
16153 |
|
16154 | (function(module, exports, __webpack_require__) {
|
16155 |
|
16156 |
|
16157 | var anObject = __webpack_require__(95);
|
16158 | var dPs = __webpack_require__(140);
|
16159 | var enumBugKeys = __webpack_require__(119);
|
16160 | var IE_PROTO = __webpack_require__(115)('IE_PROTO');
|
16161 | var Empty = function () { };
|
16162 | var PROTOTYPE = 'prototype';
|
16163 |
|
16164 |
|
16165 | var createDict = function () {
|
16166 |
|
16167 | var iframe = __webpack_require__(100)('iframe');
|
16168 | var i = enumBugKeys.length;
|
16169 | var lt = '<';
|
16170 | var gt = '>';
|
16171 | var iframeDocument;
|
16172 | iframe.style.display = 'none';
|
16173 | __webpack_require__(141).appendChild(iframe);
|
16174 | iframe.src = 'javascript:';
|
16175 |
|
16176 |
|
16177 | iframeDocument = iframe.contentWindow.document;
|
16178 | iframeDocument.open();
|
16179 | iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
|
16180 | iframeDocument.close();
|
16181 | createDict = iframeDocument.F;
|
16182 | while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
|
16183 | return createDict();
|
16184 | };
|
16185 |
|
16186 | module.exports = Object.create || function create(O, Properties) {
|
16187 | var result;
|
16188 | if (O !== null) {
|
16189 | Empty[PROTOTYPE] = anObject(O);
|
16190 | result = new Empty();
|
16191 | Empty[PROTOTYPE] = null;
|
16192 |
|
16193 | result[IE_PROTO] = O;
|
16194 | } else result = createDict();
|
16195 | return Properties === undefined ? result : dPs(result, Properties);
|
16196 | };
|
16197 |
|
16198 |
|
16199 | }),
|
16200 |
|
16201 | (function(module, exports, __webpack_require__) {
|
16202 |
|
16203 | var dP = __webpack_require__(94);
|
16204 | var anObject = __webpack_require__(95);
|
16205 | var getKeys = __webpack_require__(105);
|
16206 |
|
16207 | module.exports = __webpack_require__(98) ? Object.defineProperties : function defineProperties(O, Properties) {
|
16208 | anObject(O);
|
16209 | var keys = getKeys(Properties);
|
16210 | var length = keys.length;
|
16211 | var i = 0;
|
16212 | var P;
|
16213 | while (length > i) dP.f(O, P = keys[i++], Properties[P]);
|
16214 | return O;
|
16215 | };
|
16216 |
|
16217 |
|
16218 | }),
|
16219 |
|
16220 | (function(module, exports, __webpack_require__) {
|
16221 |
|
16222 | var document = __webpack_require__(89).document;
|
16223 | module.exports = document && document.documentElement;
|
16224 |
|
16225 |
|
16226 | }),
|
16227 |
|
16228 | (function(module, exports, __webpack_require__) {
|
16229 |
|
16230 | "use strict";
|
16231 |
|
16232 | var _interopRequireDefault = __webpack_require__(14);
|
16233 |
|
16234 | var _interopRequireWildcard = __webpack_require__(143);
|
16235 |
|
16236 | exports.__esModule = true;
|
16237 |
|
16238 | var _Provider = _interopRequireWildcard(__webpack_require__(144));
|
16239 |
|
16240 | exports.Provider = _Provider.default;
|
16241 | exports.createProvider = _Provider.createProvider;
|
16242 |
|
16243 | var _connectAdvanced = _interopRequireDefault(__webpack_require__(148));
|
16244 |
|
16245 | exports.connectAdvanced = _connectAdvanced.default;
|
16246 |
|
16247 | var _connect = _interopRequireDefault(__webpack_require__(158));
|
16248 |
|
16249 | exports.connect = _connect.default;
|
16250 |
|
16251 | }),
|
16252 |
|
16253 | (function(module, exports) {
|
16254 |
|
16255 | function _interopRequireWildcard(obj) {
|
16256 | if (obj && obj.__esModule) {
|
16257 | return obj;
|
16258 | } else {
|
16259 | var newObj = {};
|
16260 |
|
16261 | if (obj != null) {
|
16262 | for (var key in obj) {
|
16263 | if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
16264 | var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
16265 |
|
16266 | if (desc.get || desc.set) {
|
16267 | Object.defineProperty(newObj, key, desc);
|
16268 | } else {
|
16269 | newObj[key] = obj[key];
|
16270 | }
|
16271 | }
|
16272 | }
|
16273 | }
|
16274 |
|
16275 | newObj.default = obj;
|
16276 | return newObj;
|
16277 | }
|
16278 | }
|
16279 |
|
16280 | module.exports = _interopRequireWildcard;
|
16281 |
|
16282 | }),
|
16283 |
|
16284 | (function(module, exports, __webpack_require__) {
|
16285 |
|
16286 | (function(process) {"use strict";
|
16287 |
|
16288 | var _interopRequireDefault = __webpack_require__(14);
|
16289 |
|
16290 | exports.__esModule = true;
|
16291 | exports.createProvider = createProvider;
|
16292 | exports.default = void 0;
|
16293 |
|
16294 | var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(145));
|
16295 |
|
16296 | var _react = __webpack_require__(4);
|
16297 |
|
16298 | var _propTypes = _interopRequireDefault(__webpack_require__(5));
|
16299 |
|
16300 | var _PropTypes = __webpack_require__(146);
|
16301 |
|
16302 | var _warning = _interopRequireDefault(__webpack_require__(147));
|
16303 |
|
16304 | var didWarnAboutReceivingStore = false;
|
16305 |
|
16306 | function warnAboutReceivingStore() {
|
16307 | if (didWarnAboutReceivingStore) {
|
16308 | return;
|
16309 | }
|
16310 |
|
16311 | didWarnAboutReceivingStore = true;
|
16312 | (0, _warning.default)('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reduxjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
|
16313 | }
|
16314 |
|
16315 | function createProvider(storeKey) {
|
16316 | var _Provider$childContex;
|
16317 |
|
16318 | if (storeKey === void 0) {
|
16319 | storeKey = 'store';
|
16320 | }
|
16321 |
|
16322 | var subscriptionKey = storeKey + "Subscription";
|
16323 |
|
16324 | var Provider =
|
16325 |
|
16326 | function (_Component) {
|
16327 | (0, _inheritsLoose2.default)(Provider, _Component);
|
16328 | var _proto = Provider.prototype;
|
16329 |
|
16330 | _proto.getChildContext = function getChildContext() {
|
16331 | var _ref;
|
16332 |
|
16333 | return _ref = {}, _ref[storeKey] = this[storeKey], _ref[subscriptionKey] = null, _ref;
|
16334 | };
|
16335 |
|
16336 | function Provider(props, context) {
|
16337 | var _this;
|
16338 |
|
16339 | _this = _Component.call(this, props, context) || this;
|
16340 | _this[storeKey] = props.store;
|
16341 | return _this;
|
16342 | }
|
16343 |
|
16344 | _proto.render = function render() {
|
16345 | return _react.Children.only(this.props.children);
|
16346 | };
|
16347 |
|
16348 | return Provider;
|
16349 | }(_react.Component);
|
16350 |
|
16351 | if (process.env.NODE_ENV !== 'production') {
|
16352 | Provider.prototype.componentWillReceiveProps = function (nextProps) {
|
16353 | if (this[storeKey] !== nextProps.store) {
|
16354 | warnAboutReceivingStore();
|
16355 | }
|
16356 | };
|
16357 | }
|
16358 |
|
16359 | Provider.propTypes = {
|
16360 | store: _PropTypes.storeShape.isRequired,
|
16361 | children: _propTypes.default.element.isRequired
|
16362 | };
|
16363 | Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[storeKey] = _PropTypes.storeShape.isRequired, _Provider$childContex[subscriptionKey] = _PropTypes.subscriptionShape, _Provider$childContex);
|
16364 | return Provider;
|
16365 | }
|
16366 |
|
16367 | var _default = createProvider();
|
16368 |
|
16369 | exports.default = _default;
|
16370 | }.call(exports, __webpack_require__(33)))
|
16371 |
|
16372 | }),
|
16373 |
|
16374 | (function(module, exports) {
|
16375 |
|
16376 | function _inheritsLoose(subClass, superClass) {
|
16377 | subClass.prototype = Object.create(superClass.prototype);
|
16378 | subClass.prototype.constructor = subClass;
|
16379 | subClass.__proto__ = superClass;
|
16380 | }
|
16381 |
|
16382 | module.exports = _inheritsLoose;
|
16383 |
|
16384 | }),
|
16385 |
|
16386 | (function(module, exports, __webpack_require__) {
|
16387 |
|
16388 | "use strict";
|
16389 |
|
16390 | var _interopRequireDefault = __webpack_require__(14);
|
16391 |
|
16392 | exports.__esModule = true;
|
16393 | exports.storeShape = exports.subscriptionShape = void 0;
|
16394 |
|
16395 | var _propTypes = _interopRequireDefault(__webpack_require__(5));
|
16396 |
|
16397 | var subscriptionShape = _propTypes.default.shape({
|
16398 | trySubscribe: _propTypes.default.func.isRequired,
|
16399 | tryUnsubscribe: _propTypes.default.func.isRequired,
|
16400 | notifyNestedSubs: _propTypes.default.func.isRequired,
|
16401 | isSubscribed: _propTypes.default.func.isRequired
|
16402 | });
|
16403 |
|
16404 | exports.subscriptionShape = subscriptionShape;
|
16405 |
|
16406 | var storeShape = _propTypes.default.shape({
|
16407 | subscribe: _propTypes.default.func.isRequired,
|
16408 | dispatch: _propTypes.default.func.isRequired,
|
16409 | getState: _propTypes.default.func.isRequired
|
16410 | });
|
16411 |
|
16412 | exports.storeShape = storeShape;
|
16413 |
|
16414 | }),
|
16415 |
|
16416 | (function(module, exports) {
|
16417 |
|
16418 | "use strict";
|
16419 |
|
16420 | exports.__esModule = true;
|
16421 | exports.default = warning;
|
16422 |
|
16423 | |
16424 |
|
16425 |
|
16426 |
|
16427 |
|
16428 |
|
16429 | function warning(message) {
|
16430 |
|
16431 | if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
16432 | console.error(message);
|
16433 | }
|
16434 |
|
16435 |
|
16436 |
|
16437 | try {
|
16438 |
|
16439 |
|
16440 |
|
16441 | throw new Error(message);
|
16442 |
|
16443 | } catch (e) {}
|
16444 |
|
16445 |
|
16446 | }
|
16447 |
|
16448 | }),
|
16449 |
|
16450 | (function(module, exports, __webpack_require__) {
|
16451 |
|
16452 | (function(process) {"use strict";
|
16453 |
|
16454 | var _interopRequireDefault = __webpack_require__(14);
|
16455 |
|
16456 | exports.__esModule = true;
|
16457 | exports.default = connectAdvanced;
|
16458 |
|
16459 | var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(145));
|
16460 |
|
16461 | var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(149));
|
16462 |
|
16463 | var _extends2 = _interopRequireDefault(__webpack_require__(150));
|
16464 |
|
16465 | var _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(151));
|
16466 |
|
16467 | var _hoistNonReactStatics = _interopRequireDefault(__webpack_require__(152));
|
16468 |
|
16469 | var _invariant = _interopRequireDefault(__webpack_require__(156));
|
16470 |
|
16471 | var _react = __webpack_require__(4);
|
16472 |
|
16473 | var _reactIs = __webpack_require__(153);
|
16474 |
|
16475 | var _Subscription = _interopRequireDefault(__webpack_require__(157));
|
16476 |
|
16477 | var _PropTypes = __webpack_require__(146);
|
16478 |
|
16479 | var hotReloadingVersion = 0;
|
16480 | var dummyState = {};
|
16481 |
|
16482 | function noop() {}
|
16483 |
|
16484 | function makeSelectorStateful(sourceSelector, store) {
|
16485 |
|
16486 | var selector = {
|
16487 | run: function runComponentSelector(props) {
|
16488 | try {
|
16489 | var nextProps = sourceSelector(store.getState(), props);
|
16490 |
|
16491 | if (nextProps !== selector.props || selector.error) {
|
16492 | selector.shouldComponentUpdate = true;
|
16493 | selector.props = nextProps;
|
16494 | selector.error = null;
|
16495 | }
|
16496 | } catch (error) {
|
16497 | selector.shouldComponentUpdate = true;
|
16498 | selector.error = error;
|
16499 | }
|
16500 | }
|
16501 | };
|
16502 | return selector;
|
16503 | }
|
16504 |
|
16505 | function connectAdvanced(
|
16506 | /*
|
16507 | selectorFactory is a func that is responsible for returning the selector function used to
|
16508 | compute new props from state, props, and dispatch. For example:
|
16509 | export default connectAdvanced((dispatch, options) => (state, props) => ({
|
16510 | thing: state.things[props.thingId],
|
16511 | saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)),
|
16512 | }))(YourComponent)
|
16513 | Access to dispatch is provided to the factory so selectorFactories can bind actionCreators
|
16514 | outside of their selector as an optimization. Options passed to connectAdvanced are passed to
|
16515 | the selectorFactory, along with displayName and WrappedComponent, as the second argument.
|
16516 | Note that selectorFactory is responsible for all caching/memoization of inbound and outbound
|
16517 | props. Do not use connectAdvanced directly without memoizing results between calls to your
|
16518 | selector, otherwise the Connect component will re-render on every state or props change.
|
16519 | */
|
16520 | selectorFactory, // options object:
|
16521 | _ref) {
|
16522 | var _contextTypes, _childContextTypes;
|
16523 |
|
16524 | if (_ref === void 0) {
|
16525 | _ref = {};
|
16526 | }
|
16527 |
|
16528 | var _ref2 = _ref,
|
16529 | _ref2$getDisplayName = _ref2.getDisplayName,
|
16530 | getDisplayName = _ref2$getDisplayName === void 0 ? function (name) {
|
16531 | return "ConnectAdvanced(" + name + ")";
|
16532 | } : _ref2$getDisplayName,
|
16533 | _ref2$methodName = _ref2.methodName,
|
16534 | methodName = _ref2$methodName === void 0 ? 'connectAdvanced' : _ref2$methodName,
|
16535 | _ref2$renderCountProp = _ref2.renderCountProp,
|
16536 | renderCountProp = _ref2$renderCountProp === void 0 ? undefined : _ref2$renderCountProp,
|
16537 | _ref2$shouldHandleSta = _ref2.shouldHandleStateChanges,
|
16538 | shouldHandleStateChanges = _ref2$shouldHandleSta === void 0 ? true : _ref2$shouldHandleSta,
|
16539 | _ref2$storeKey = _ref2.storeKey,
|
16540 | storeKey = _ref2$storeKey === void 0 ? 'store' : _ref2$storeKey,
|
16541 | _ref2$withRef = _ref2.withRef,
|
16542 | withRef = _ref2$withRef === void 0 ? false : _ref2$withRef,
|
16543 | connectOptions = (0, _objectWithoutPropertiesLoose2.default)(_ref2, ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef"]);
|
16544 | var subscriptionKey = storeKey + 'Subscription';
|
16545 | var version = hotReloadingVersion++;
|
16546 | var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = _PropTypes.storeShape, _contextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _contextTypes);
|
16547 | var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _childContextTypes);
|
16548 | return function wrapWithConnect(WrappedComponent) {
|
16549 | (0, _invariant.default)((0, _reactIs.isValidElementType)(WrappedComponent), "You must pass a component to the function returned by " + (methodName + ". Instead received " + JSON.stringify(WrappedComponent)));
|
16550 | var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
16551 | var displayName = getDisplayName(wrappedComponentName);
|
16552 | var selectorFactoryOptions = (0, _extends2.default)({}, connectOptions, {
|
16553 | getDisplayName: getDisplayName,
|
16554 | methodName: methodName,
|
16555 | renderCountProp: renderCountProp,
|
16556 | shouldHandleStateChanges: shouldHandleStateChanges,
|
16557 | storeKey: storeKey,
|
16558 | withRef: withRef,
|
16559 | displayName: displayName,
|
16560 | wrappedComponentName: wrappedComponentName,
|
16561 | WrappedComponent: WrappedComponent
|
16562 |
|
16563 |
|
16564 |
|
16565 | });
|
16566 |
|
16567 | var Connect =
|
16568 |
|
16569 | function (_Component) {
|
16570 | (0, _inheritsLoose2.default)(Connect, _Component);
|
16571 |
|
16572 | function Connect(props, context) {
|
16573 | var _this;
|
16574 |
|
16575 | _this = _Component.call(this, props, context) || this;
|
16576 | _this.version = version;
|
16577 | _this.state = {};
|
16578 | _this.renderCount = 0;
|
16579 | _this.store = props[storeKey] || context[storeKey];
|
16580 | _this.propsMode = Boolean(props[storeKey]);
|
16581 | _this.setWrappedInstance = _this.setWrappedInstance.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
16582 | (0, _invariant.default)(_this.store, "Could not find \"" + storeKey + "\" in either the context or props of " + ("\"" + displayName + "\". Either wrap the root component in a <Provider>, ") + ("or explicitly pass \"" + storeKey + "\" as a prop to \"" + displayName + "\"."));
|
16583 |
|
16584 | _this.initSelector();
|
16585 |
|
16586 | _this.initSubscription();
|
16587 |
|
16588 | return _this;
|
16589 | }
|
16590 |
|
16591 | var _proto = Connect.prototype;
|
16592 |
|
16593 | _proto.getChildContext = function getChildContext() {
|
16594 | var _ref3;
|
16595 |
|
16596 |
|
16597 |
|
16598 |
|
16599 |
|
16600 | var subscription = this.propsMode ? null : this.subscription;
|
16601 | return _ref3 = {}, _ref3[subscriptionKey] = subscription || this.context[subscriptionKey], _ref3;
|
16602 | };
|
16603 |
|
16604 | _proto.componentDidMount = function componentDidMount() {
|
16605 | if (!shouldHandleStateChanges) return;
|
16606 |
|
16607 |
|
16608 |
|
16609 |
|
16610 |
|
16611 |
|
16612 | this.subscription.trySubscribe();
|
16613 | this.selector.run(this.props);
|
16614 | if (this.selector.shouldComponentUpdate) this.forceUpdate();
|
16615 | };
|
16616 |
|
16617 | _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
16618 | this.selector.run(nextProps);
|
16619 | };
|
16620 |
|
16621 | _proto.shouldComponentUpdate = function shouldComponentUpdate() {
|
16622 | return this.selector.shouldComponentUpdate;
|
16623 | };
|
16624 |
|
16625 | _proto.componentWillUnmount = function componentWillUnmount() {
|
16626 | if (this.subscription) this.subscription.tryUnsubscribe();
|
16627 | this.subscription = null;
|
16628 | this.notifyNestedSubs = noop;
|
16629 | this.store = null;
|
16630 | this.selector.run = noop;
|
16631 | this.selector.shouldComponentUpdate = false;
|
16632 | };
|
16633 |
|
16634 | _proto.getWrappedInstance = function getWrappedInstance() {
|
16635 | (0, _invariant.default)(withRef, "To access the wrapped instance, you need to specify " + ("{ withRef: true } in the options argument of the " + methodName + "() call."));
|
16636 | return this.wrappedInstance;
|
16637 | };
|
16638 |
|
16639 | _proto.setWrappedInstance = function setWrappedInstance(ref) {
|
16640 | this.wrappedInstance = ref;
|
16641 | };
|
16642 |
|
16643 | _proto.initSelector = function initSelector() {
|
16644 | var sourceSelector = selectorFactory(this.store.dispatch, selectorFactoryOptions);
|
16645 | this.selector = makeSelectorStateful(sourceSelector, this.store);
|
16646 | this.selector.run(this.props);
|
16647 | };
|
16648 |
|
16649 | _proto.initSubscription = function initSubscription() {
|
16650 | if (!shouldHandleStateChanges) return;
|
16651 |
|
16652 |
|
16653 | var parentSub = (this.propsMode ? this.props : this.context)[subscriptionKey];
|
16654 | this.subscription = new _Subscription.default(this.store, parentSub, this.onStateChange.bind(this));
|
16655 |
|
16656 |
|
16657 |
|
16658 |
|
16659 |
|
16660 |
|
16661 | this.notifyNestedSubs = this.subscription.notifyNestedSubs.bind(this.subscription);
|
16662 | };
|
16663 |
|
16664 | _proto.onStateChange = function onStateChange() {
|
16665 | this.selector.run(this.props);
|
16666 |
|
16667 | if (!this.selector.shouldComponentUpdate) {
|
16668 | this.notifyNestedSubs();
|
16669 | } else {
|
16670 | this.componentDidUpdate = this.notifyNestedSubsOnComponentDidUpdate;
|
16671 | this.setState(dummyState);
|
16672 | }
|
16673 | };
|
16674 |
|
16675 | _proto.notifyNestedSubsOnComponentDidUpdate = function notifyNestedSubsOnComponentDidUpdate() {
|
16676 |
|
16677 |
|
16678 |
|
16679 |
|
16680 |
|
16681 | this.componentDidUpdate = undefined;
|
16682 | this.notifyNestedSubs();
|
16683 | };
|
16684 |
|
16685 | _proto.isSubscribed = function isSubscribed() {
|
16686 | return Boolean(this.subscription) && this.subscription.isSubscribed();
|
16687 | };
|
16688 |
|
16689 | _proto.addExtraProps = function addExtraProps(props) {
|
16690 | if (!withRef && !renderCountProp && !(this.propsMode && this.subscription)) return props;
|
16691 |
|
16692 |
|
16693 |
|
16694 |
|
16695 | var withExtras = (0, _extends2.default)({}, props);
|
16696 | if (withRef) withExtras.ref = this.setWrappedInstance;
|
16697 | if (renderCountProp) withExtras[renderCountProp] = this.renderCount++;
|
16698 | if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription;
|
16699 | return withExtras;
|
16700 | };
|
16701 |
|
16702 | _proto.render = function render() {
|
16703 | var selector = this.selector;
|
16704 | selector.shouldComponentUpdate = false;
|
16705 |
|
16706 | if (selector.error) {
|
16707 | throw selector.error;
|
16708 | } else {
|
16709 | return (0, _react.createElement)(WrappedComponent, this.addExtraProps(selector.props));
|
16710 | }
|
16711 | };
|
16712 |
|
16713 | return Connect;
|
16714 | }(_react.Component);
|
16715 |
|
16716 |
|
16717 |
|
16718 | Connect.WrappedComponent = WrappedComponent;
|
16719 | Connect.displayName = displayName;
|
16720 | Connect.childContextTypes = childContextTypes;
|
16721 | Connect.contextTypes = contextTypes;
|
16722 | Connect.propTypes = contextTypes;
|
16723 |
|
16724 | if (process.env.NODE_ENV !== 'production') {
|
16725 | Connect.prototype.componentWillUpdate = function componentWillUpdate() {
|
16726 | var _this2 = this;
|
16727 |
|
16728 |
|
16729 | if (this.version !== version) {
|
16730 | this.version = version;
|
16731 | this.initSelector();
|
16732 |
|
16733 |
|
16734 |
|
16735 |
|
16736 |
|
16737 | var oldListeners = [];
|
16738 |
|
16739 | if (this.subscription) {
|
16740 | oldListeners = this.subscription.listeners.get();
|
16741 | this.subscription.tryUnsubscribe();
|
16742 | }
|
16743 |
|
16744 | this.initSubscription();
|
16745 |
|
16746 | if (shouldHandleStateChanges) {
|
16747 | this.subscription.trySubscribe();
|
16748 | oldListeners.forEach(function (listener) {
|
16749 | return _this2.subscription.listeners.subscribe(listener);
|
16750 | });
|
16751 | }
|
16752 | }
|
16753 | };
|
16754 | }
|
16755 |
|
16756 | return (0, _hoistNonReactStatics.default)(Connect, WrappedComponent);
|
16757 | };
|
16758 | }
|
16759 | }.call(exports, __webpack_require__(33)))
|
16760 |
|
16761 | }),
|
16762 |
|
16763 | (function(module, exports) {
|
16764 |
|
16765 | function _assertThisInitialized(self) {
|
16766 | if (self === void 0) {
|
16767 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
16768 | }
|
16769 |
|
16770 | return self;
|
16771 | }
|
16772 |
|
16773 | module.exports = _assertThisInitialized;
|
16774 |
|
16775 | }),
|
16776 |
|
16777 | (function(module, exports) {
|
16778 |
|
16779 | function _extends() {
|
16780 | module.exports = _extends = Object.assign || function (target) {
|
16781 | for (var i = 1; i < arguments.length; i++) {
|
16782 | var source = arguments[i];
|
16783 |
|
16784 | for (var key in source) {
|
16785 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
16786 | target[key] = source[key];
|
16787 | }
|
16788 | }
|
16789 | }
|
16790 |
|
16791 | return target;
|
16792 | };
|
16793 |
|
16794 | return _extends.apply(this, arguments);
|
16795 | }
|
16796 |
|
16797 | module.exports = _extends;
|
16798 |
|
16799 | }),
|
16800 |
|
16801 | (function(module, exports) {
|
16802 |
|
16803 | function _objectWithoutPropertiesLoose(source, excluded) {
|
16804 | if (source == null) return {};
|
16805 | var target = {};
|
16806 | var sourceKeys = Object.keys(source);
|
16807 | var key, i;
|
16808 |
|
16809 | for (i = 0; i < sourceKeys.length; i++) {
|
16810 | key = sourceKeys[i];
|
16811 | if (excluded.indexOf(key) >= 0) continue;
|
16812 | target[key] = source[key];
|
16813 | }
|
16814 |
|
16815 | return target;
|
16816 | }
|
16817 |
|
16818 | module.exports = _objectWithoutPropertiesLoose;
|
16819 |
|
16820 | }),
|
16821 |
|
16822 | (function(module, exports, __webpack_require__) {
|
16823 |
|
16824 | 'use strict';
|
16825 |
|
16826 | |
16827 |
|
16828 |
|
16829 |
|
16830 | var ReactIs = __webpack_require__(153);
|
16831 | var React = __webpack_require__(4);
|
16832 | var REACT_STATICS = {
|
16833 | childContextTypes: true,
|
16834 | contextType: true,
|
16835 | contextTypes: true,
|
16836 | defaultProps: true,
|
16837 | displayName: true,
|
16838 | getDefaultProps: true,
|
16839 | getDerivedStateFromProps: true,
|
16840 | mixins: true,
|
16841 | propTypes: true,
|
16842 | type: true
|
16843 | };
|
16844 |
|
16845 | var KNOWN_STATICS = {
|
16846 | name: true,
|
16847 | length: true,
|
16848 | prototype: true,
|
16849 | caller: true,
|
16850 | callee: true,
|
16851 | arguments: true,
|
16852 | arity: true
|
16853 | };
|
16854 |
|
16855 | var FORWARD_REF_STATICS = {
|
16856 | '$$typeof': true,
|
16857 | render: true
|
16858 | };
|
16859 |
|
16860 | var TYPE_STATICS = {};
|
16861 | TYPE_STATICS[ReactIs.ForwardRef] = FORWARD_REF_STATICS;
|
16862 |
|
16863 | var defineProperty = Object.defineProperty;
|
16864 | var getOwnPropertyNames = Object.getOwnPropertyNames;
|
16865 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
16866 | var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
16867 | var getPrototypeOf = Object.getPrototypeOf;
|
16868 | var objectPrototype = Object.prototype;
|
16869 |
|
16870 | function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
16871 | if (typeof sourceComponent !== 'string') {
|
16872 |
|
16873 |
|
16874 | if (objectPrototype) {
|
16875 | var inheritedComponent = getPrototypeOf(sourceComponent);
|
16876 | if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
16877 | hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
16878 | }
|
16879 | }
|
16880 |
|
16881 | var keys = getOwnPropertyNames(sourceComponent);
|
16882 |
|
16883 | if (getOwnPropertySymbols) {
|
16884 | keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
16885 | }
|
16886 |
|
16887 | var targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS;
|
16888 | var sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS;
|
16889 |
|
16890 | for (var i = 0; i < keys.length; ++i) {
|
16891 | var key = keys[i];
|
16892 | if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
16893 | var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
16894 | try {
|
16895 |
|
16896 | defineProperty(targetComponent, key, descriptor);
|
16897 | } catch (e) {}
|
16898 | }
|
16899 | }
|
16900 |
|
16901 | return targetComponent;
|
16902 | }
|
16903 |
|
16904 | return targetComponent;
|
16905 | }
|
16906 |
|
16907 | module.exports = hoistNonReactStatics;
|
16908 |
|
16909 |
|
16910 | }),
|
16911 |
|
16912 | (function(module, exports, __webpack_require__) {
|
16913 |
|
16914 | (function(process) {'use strict';
|
16915 |
|
16916 | if (process.env.NODE_ENV === 'production') {
|
16917 | module.exports = __webpack_require__(154);
|
16918 | } else {
|
16919 | module.exports = __webpack_require__(155);
|
16920 | }
|
16921 |
|
16922 | }.call(exports, __webpack_require__(33)))
|
16923 |
|
16924 | }),
|
16925 |
|
16926 | (function(module, exports) {
|
16927 |
|
16928 | |
16929 |
|
16930 |
|
16931 |
|
16932 |
|
16933 |
|
16934 |
|
16935 |
|
16936 |
|
16937 | 'use strict';Object.defineProperty(exports,"__esModule",{value:!0});
|
16938 | var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.concurrent_mode"):60111,m=b?Symbol.for("react.forward_ref"):60112,n=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.memo"):60115,r=b?Symbol.for("react.lazy"):
|
16939 | 60116;function t(a){if("object"===typeof a&&null!==a){var p=a.$$typeof;switch(p){case c:switch(a=a.type,a){case l:case e:case g:case f:return a;default:switch(a=a&&a.$$typeof,a){case k:case m:case h:return a;default:return p}}case d:return p}}}function u(a){return t(a)===l}exports.typeOf=t;exports.AsyncMode=l;exports.ConcurrentMode=l;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=m;exports.Fragment=e;exports.Profiler=g;exports.Portal=d;
|
16940 | exports.StrictMode=f;exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===l||a===g||a===f||a===n||"object"===typeof a&&null!==a&&(a.$$typeof===r||a.$$typeof===q||a.$$typeof===h||a.$$typeof===k||a.$$typeof===m)};exports.isAsyncMode=function(a){return u(a)};exports.isConcurrentMode=u;exports.isContextConsumer=function(a){return t(a)===k};exports.isContextProvider=function(a){return t(a)===h};
|
16941 | exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return t(a)===m};exports.isFragment=function(a){return t(a)===e};exports.isProfiler=function(a){return t(a)===g};exports.isPortal=function(a){return t(a)===d};exports.isStrictMode=function(a){return t(a)===f};
|
16942 |
|
16943 |
|
16944 | }),
|
16945 |
|
16946 | (function(module, exports, __webpack_require__) {
|
16947 |
|
16948 | (function(process) { |
16949 |
|
16950 |
|
16951 |
|
16952 |
|
16953 |
|
16954 |
|
16955 |
|
16956 |
|
16957 | 'use strict';
|
16958 |
|
16959 |
|
16960 |
|
16961 | if (process.env.NODE_ENV !== "production") {
|
16962 | (function() {
|
16963 | 'use strict';
|
16964 |
|
16965 | Object.defineProperty(exports, '__esModule', { value: true });
|
16966 |
|
16967 |
|
16968 |
|
16969 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
16970 |
|
16971 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
16972 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
16973 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
16974 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
16975 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
16976 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
16977 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
16978 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
16979 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
16980 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
16981 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
16982 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
16983 |
|
16984 | function isValidElementType(type) {
|
16985 | return typeof type === 'string' || typeof type === 'function' ||
|
16986 |
|
16987 | type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
|
16988 | }
|
16989 |
|
16990 | |
16991 |
|
16992 |
|
16993 |
|
16994 |
|
16995 |
|
16996 |
|
16997 |
|
16998 |
|
16999 |
|
17000 |
|
17001 |
|
17002 |
|
17003 |
|
17004 | var lowPriorityWarning = function () {};
|
17005 |
|
17006 | {
|
17007 | var printWarning = function (format) {
|
17008 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
17009 | args[_key - 1] = arguments[_key];
|
17010 | }
|
17011 |
|
17012 | var argIndex = 0;
|
17013 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
17014 | return args[argIndex++];
|
17015 | });
|
17016 | if (typeof console !== 'undefined') {
|
17017 | console.warn(message);
|
17018 | }
|
17019 | try {
|
17020 |
|
17021 |
|
17022 |
|
17023 | throw new Error(message);
|
17024 | } catch (x) {}
|
17025 | };
|
17026 |
|
17027 | lowPriorityWarning = function (condition, format) {
|
17028 | if (format === undefined) {
|
17029 | throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
17030 | }
|
17031 | if (!condition) {
|
17032 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
17033 | args[_key2 - 2] = arguments[_key2];
|
17034 | }
|
17035 |
|
17036 | printWarning.apply(undefined, [format].concat(args));
|
17037 | }
|
17038 | };
|
17039 | }
|
17040 |
|
17041 | var lowPriorityWarning$1 = lowPriorityWarning;
|
17042 |
|
17043 | function typeOf(object) {
|
17044 | if (typeof object === 'object' && object !== null) {
|
17045 | var $$typeof = object.$$typeof;
|
17046 |
|
17047 | switch ($$typeof) {
|
17048 | case REACT_ELEMENT_TYPE:
|
17049 | var type = object.type;
|
17050 |
|
17051 | switch (type) {
|
17052 | case REACT_CONCURRENT_MODE_TYPE:
|
17053 | case REACT_FRAGMENT_TYPE:
|
17054 | case REACT_PROFILER_TYPE:
|
17055 | case REACT_STRICT_MODE_TYPE:
|
17056 | return type;
|
17057 | default:
|
17058 | var $$typeofType = type && type.$$typeof;
|
17059 |
|
17060 | switch ($$typeofType) {
|
17061 | case REACT_CONTEXT_TYPE:
|
17062 | case REACT_FORWARD_REF_TYPE:
|
17063 | case REACT_PROVIDER_TYPE:
|
17064 | return $$typeofType;
|
17065 | default:
|
17066 | return $$typeof;
|
17067 | }
|
17068 | }
|
17069 | case REACT_PORTAL_TYPE:
|
17070 | return $$typeof;
|
17071 | }
|
17072 | }
|
17073 |
|
17074 | return undefined;
|
17075 | }
|
17076 |
|
17077 |
|
17078 | var AsyncMode = REACT_CONCURRENT_MODE_TYPE;
|
17079 | var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
17080 | var ContextConsumer = REACT_CONTEXT_TYPE;
|
17081 | var ContextProvider = REACT_PROVIDER_TYPE;
|
17082 | var Element = REACT_ELEMENT_TYPE;
|
17083 | var ForwardRef = REACT_FORWARD_REF_TYPE;
|
17084 | var Fragment = REACT_FRAGMENT_TYPE;
|
17085 | var Profiler = REACT_PROFILER_TYPE;
|
17086 | var Portal = REACT_PORTAL_TYPE;
|
17087 | var StrictMode = REACT_STRICT_MODE_TYPE;
|
17088 |
|
17089 | var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
17090 |
|
17091 |
|
17092 | function isAsyncMode(object) {
|
17093 | {
|
17094 | if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
17095 | hasWarnedAboutDeprecatedIsAsyncMode = true;
|
17096 | lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
17097 | }
|
17098 | }
|
17099 | return isConcurrentMode(object);
|
17100 | }
|
17101 | function isConcurrentMode(object) {
|
17102 | return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
17103 | }
|
17104 | function isContextConsumer(object) {
|
17105 | return typeOf(object) === REACT_CONTEXT_TYPE;
|
17106 | }
|
17107 | function isContextProvider(object) {
|
17108 | return typeOf(object) === REACT_PROVIDER_TYPE;
|
17109 | }
|
17110 | function isElement(object) {
|
17111 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
17112 | }
|
17113 | function isForwardRef(object) {
|
17114 | return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
17115 | }
|
17116 | function isFragment(object) {
|
17117 | return typeOf(object) === REACT_FRAGMENT_TYPE;
|
17118 | }
|
17119 | function isProfiler(object) {
|
17120 | return typeOf(object) === REACT_PROFILER_TYPE;
|
17121 | }
|
17122 | function isPortal(object) {
|
17123 | return typeOf(object) === REACT_PORTAL_TYPE;
|
17124 | }
|
17125 | function isStrictMode(object) {
|
17126 | return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
17127 | }
|
17128 |
|
17129 | exports.typeOf = typeOf;
|
17130 | exports.AsyncMode = AsyncMode;
|
17131 | exports.ConcurrentMode = ConcurrentMode;
|
17132 | exports.ContextConsumer = ContextConsumer;
|
17133 | exports.ContextProvider = ContextProvider;
|
17134 | exports.Element = Element;
|
17135 | exports.ForwardRef = ForwardRef;
|
17136 | exports.Fragment = Fragment;
|
17137 | exports.Profiler = Profiler;
|
17138 | exports.Portal = Portal;
|
17139 | exports.StrictMode = StrictMode;
|
17140 | exports.isValidElementType = isValidElementType;
|
17141 | exports.isAsyncMode = isAsyncMode;
|
17142 | exports.isConcurrentMode = isConcurrentMode;
|
17143 | exports.isContextConsumer = isContextConsumer;
|
17144 | exports.isContextProvider = isContextProvider;
|
17145 | exports.isElement = isElement;
|
17146 | exports.isForwardRef = isForwardRef;
|
17147 | exports.isFragment = isFragment;
|
17148 | exports.isProfiler = isProfiler;
|
17149 | exports.isPortal = isPortal;
|
17150 | exports.isStrictMode = isStrictMode;
|
17151 | })();
|
17152 | }
|
17153 |
|
17154 | }.call(exports, __webpack_require__(33)))
|
17155 |
|
17156 | }),
|
17157 |
|
17158 | (function(module, exports, __webpack_require__) {
|
17159 |
|
17160 | (function(process) { |
17161 |
|
17162 |
|
17163 |
|
17164 |
|
17165 |
|
17166 |
|
17167 | 'use strict';
|
17168 |
|
17169 | |
17170 |
|
17171 |
|
17172 |
|
17173 |
|
17174 |
|
17175 |
|
17176 |
|
17177 |
|
17178 |
|
17179 |
|
17180 | var invariant = function(condition, format, a, b, c, d, e, f) {
|
17181 | if (process.env.NODE_ENV !== 'production') {
|
17182 | if (format === undefined) {
|
17183 | throw new Error('invariant requires an error message argument');
|
17184 | }
|
17185 | }
|
17186 |
|
17187 | if (!condition) {
|
17188 | var error;
|
17189 | if (format === undefined) {
|
17190 | error = new Error(
|
17191 | 'Minified exception occurred; use the non-minified dev environment ' +
|
17192 | 'for the full error message and additional helpful warnings.'
|
17193 | );
|
17194 | } else {
|
17195 | var args = [a, b, c, d, e, f];
|
17196 | var argIndex = 0;
|
17197 | error = new Error(
|
17198 | format.replace(/%s/g, function() { return args[argIndex++]; })
|
17199 | );
|
17200 | error.name = 'Invariant Violation';
|
17201 | }
|
17202 |
|
17203 | error.framesToPop = 1;
|
17204 | throw error;
|
17205 | }
|
17206 | };
|
17207 |
|
17208 | module.exports = invariant;
|
17209 |
|
17210 | }.call(exports, __webpack_require__(33)))
|
17211 |
|
17212 | }),
|
17213 |
|
17214 | (function(module, exports) {
|
17215 |
|
17216 | "use strict";
|
17217 |
|
17218 | exports.__esModule = true;
|
17219 | exports.default = void 0;
|
17220 |
|
17221 |
|
17222 |
|
17223 | var CLEARED = null;
|
17224 | var nullListeners = {
|
17225 | notify: function notify() {}
|
17226 | };
|
17227 |
|
17228 | function createListenerCollection() {
|
17229 |
|
17230 |
|
17231 | var current = [];
|
17232 | var next = [];
|
17233 | return {
|
17234 | clear: function clear() {
|
17235 | next = CLEARED;
|
17236 | current = CLEARED;
|
17237 | },
|
17238 | notify: function notify() {
|
17239 | var listeners = current = next;
|
17240 |
|
17241 | for (var i = 0; i < listeners.length; i++) {
|
17242 | listeners[i]();
|
17243 | }
|
17244 | },
|
17245 | get: function get() {
|
17246 | return next;
|
17247 | },
|
17248 | subscribe: function subscribe(listener) {
|
17249 | var isSubscribed = true;
|
17250 | if (next === current) next = current.slice();
|
17251 | next.push(listener);
|
17252 | return function unsubscribe() {
|
17253 | if (!isSubscribed || current === CLEARED) return;
|
17254 | isSubscribed = false;
|
17255 | if (next === current) next = current.slice();
|
17256 | next.splice(next.indexOf(listener), 1);
|
17257 | };
|
17258 | }
|
17259 | };
|
17260 | }
|
17261 |
|
17262 | var Subscription =
|
17263 |
|
17264 | function () {
|
17265 | function Subscription(store, parentSub, onStateChange) {
|
17266 | this.store = store;
|
17267 | this.parentSub = parentSub;
|
17268 | this.onStateChange = onStateChange;
|
17269 | this.unsubscribe = null;
|
17270 | this.listeners = nullListeners;
|
17271 | }
|
17272 |
|
17273 | var _proto = Subscription.prototype;
|
17274 |
|
17275 | _proto.addNestedSub = function addNestedSub(listener) {
|
17276 | this.trySubscribe();
|
17277 | return this.listeners.subscribe(listener);
|
17278 | };
|
17279 |
|
17280 | _proto.notifyNestedSubs = function notifyNestedSubs() {
|
17281 | this.listeners.notify();
|
17282 | };
|
17283 |
|
17284 | _proto.isSubscribed = function isSubscribed() {
|
17285 | return Boolean(this.unsubscribe);
|
17286 | };
|
17287 |
|
17288 | _proto.trySubscribe = function trySubscribe() {
|
17289 | if (!this.unsubscribe) {
|
17290 | this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);
|
17291 | this.listeners = createListenerCollection();
|
17292 | }
|
17293 | };
|
17294 |
|
17295 | _proto.tryUnsubscribe = function tryUnsubscribe() {
|
17296 | if (this.unsubscribe) {
|
17297 | this.unsubscribe();
|
17298 | this.unsubscribe = null;
|
17299 | this.listeners.clear();
|
17300 | this.listeners = nullListeners;
|
17301 | }
|
17302 | };
|
17303 |
|
17304 | return Subscription;
|
17305 | }();
|
17306 |
|
17307 | exports.default = Subscription;
|
17308 |
|
17309 | }),
|
17310 |
|
17311 | (function(module, exports, __webpack_require__) {
|
17312 |
|
17313 | "use strict";
|
17314 |
|
17315 | var _interopRequireDefault = __webpack_require__(14);
|
17316 |
|
17317 | exports.__esModule = true;
|
17318 | exports.createConnect = createConnect;
|
17319 | exports.default = void 0;
|
17320 |
|
17321 | var _extends2 = _interopRequireDefault(__webpack_require__(150));
|
17322 |
|
17323 | var _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(151));
|
17324 |
|
17325 | var _connectAdvanced = _interopRequireDefault(__webpack_require__(148));
|
17326 |
|
17327 | var _shallowEqual = _interopRequireDefault(__webpack_require__(159));
|
17328 |
|
17329 | var _mapDispatchToProps = _interopRequireDefault(__webpack_require__(160));
|
17330 |
|
17331 | var _mapStateToProps = _interopRequireDefault(__webpack_require__(164));
|
17332 |
|
17333 | var _mergeProps = _interopRequireDefault(__webpack_require__(165));
|
17334 |
|
17335 | var _selectorFactory = _interopRequireDefault(__webpack_require__(166));
|
17336 |
|
17337 | |
17338 |
|
17339 |
|
17340 |
|
17341 |
|
17342 |
|
17343 |
|
17344 |
|
17345 |
|
17346 |
|
17347 |
|
17348 |
|
17349 |
|
17350 |
|
17351 |
|
17352 |
|
17353 | function match(arg, factories, name) {
|
17354 | for (var i = factories.length - 1; i >= 0; i--) {
|
17355 | var result = factories[i](arg);
|
17356 | if (result) return result;
|
17357 | }
|
17358 |
|
17359 | return function (dispatch, options) {
|
17360 | throw new Error("Invalid value of type " + typeof arg + " for " + name + " argument when connecting component " + options.wrappedComponentName + ".");
|
17361 | };
|
17362 | }
|
17363 |
|
17364 | function strictEqual(a, b) {
|
17365 | return a === b;
|
17366 | }
|
17367 |
|
17368 |
|
17369 |
|
17370 | function createConnect(_temp) {
|
17371 | var _ref = _temp === void 0 ? {} : _temp,
|
17372 | _ref$connectHOC = _ref.connectHOC,
|
17373 | connectHOC = _ref$connectHOC === void 0 ? _connectAdvanced.default : _ref$connectHOC,
|
17374 | _ref$mapStateToPropsF = _ref.mapStateToPropsFactories,
|
17375 | mapStateToPropsFactories = _ref$mapStateToPropsF === void 0 ? _mapStateToProps.default : _ref$mapStateToPropsF,
|
17376 | _ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories,
|
17377 | mapDispatchToPropsFactories = _ref$mapDispatchToPro === void 0 ? _mapDispatchToProps.default : _ref$mapDispatchToPro,
|
17378 | _ref$mergePropsFactor = _ref.mergePropsFactories,
|
17379 | mergePropsFactories = _ref$mergePropsFactor === void 0 ? _mergeProps.default : _ref$mergePropsFactor,
|
17380 | _ref$selectorFactory = _ref.selectorFactory,
|
17381 | selectorFactory = _ref$selectorFactory === void 0 ? _selectorFactory.default : _ref$selectorFactory;
|
17382 |
|
17383 | return function connect(mapStateToProps, mapDispatchToProps, mergeProps, _ref2) {
|
17384 | if (_ref2 === void 0) {
|
17385 | _ref2 = {};
|
17386 | }
|
17387 |
|
17388 | var _ref3 = _ref2,
|
17389 | _ref3$pure = _ref3.pure,
|
17390 | pure = _ref3$pure === void 0 ? true : _ref3$pure,
|
17391 | _ref3$areStatesEqual = _ref3.areStatesEqual,
|
17392 | areStatesEqual = _ref3$areStatesEqual === void 0 ? strictEqual : _ref3$areStatesEqual,
|
17393 | _ref3$areOwnPropsEqua = _ref3.areOwnPropsEqual,
|
17394 | areOwnPropsEqual = _ref3$areOwnPropsEqua === void 0 ? _shallowEqual.default : _ref3$areOwnPropsEqua,
|
17395 | _ref3$areStatePropsEq = _ref3.areStatePropsEqual,
|
17396 | areStatePropsEqual = _ref3$areStatePropsEq === void 0 ? _shallowEqual.default : _ref3$areStatePropsEq,
|
17397 | _ref3$areMergedPropsE = _ref3.areMergedPropsEqual,
|
17398 | areMergedPropsEqual = _ref3$areMergedPropsE === void 0 ? _shallowEqual.default : _ref3$areMergedPropsE,
|
17399 | extraOptions = (0, _objectWithoutPropertiesLoose2.default)(_ref3, ["pure", "areStatesEqual", "areOwnPropsEqual", "areStatePropsEqual", "areMergedPropsEqual"]);
|
17400 | var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps');
|
17401 | var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps');
|
17402 | var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps');
|
17403 | return connectHOC(selectorFactory, (0, _extends2.default)({
|
17404 |
|
17405 | methodName: 'connect',
|
17406 |
|
17407 | getDisplayName: function getDisplayName(name) {
|
17408 | return "Connect(" + name + ")";
|
17409 | },
|
17410 |
|
17411 | shouldHandleStateChanges: Boolean(mapStateToProps),
|
17412 |
|
17413 | initMapStateToProps: initMapStateToProps,
|
17414 | initMapDispatchToProps: initMapDispatchToProps,
|
17415 | initMergeProps: initMergeProps,
|
17416 | pure: pure,
|
17417 | areStatesEqual: areStatesEqual,
|
17418 | areOwnPropsEqual: areOwnPropsEqual,
|
17419 | areStatePropsEqual: areStatePropsEqual,
|
17420 | areMergedPropsEqual: areMergedPropsEqual
|
17421 | }, extraOptions));
|
17422 | };
|
17423 | }
|
17424 |
|
17425 | var _default = createConnect();
|
17426 |
|
17427 | exports.default = _default;
|
17428 |
|
17429 | }),
|
17430 |
|
17431 | (function(module, exports) {
|
17432 |
|
17433 | "use strict";
|
17434 |
|
17435 | exports.__esModule = true;
|
17436 | exports.default = shallowEqual;
|
17437 | var hasOwn = Object.prototype.hasOwnProperty;
|
17438 |
|
17439 | function is(x, y) {
|
17440 | if (x === y) {
|
17441 | return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
17442 | } else {
|
17443 | return x !== x && y !== y;
|
17444 | }
|
17445 | }
|
17446 |
|
17447 | function shallowEqual(objA, objB) {
|
17448 | if (is(objA, objB)) return true;
|
17449 |
|
17450 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
17451 | return false;
|
17452 | }
|
17453 |
|
17454 | var keysA = Object.keys(objA);
|
17455 | var keysB = Object.keys(objB);
|
17456 | if (keysA.length !== keysB.length) return false;
|
17457 |
|
17458 | for (var i = 0; i < keysA.length; i++) {
|
17459 | if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
|
17460 | return false;
|
17461 | }
|
17462 | }
|
17463 |
|
17464 | return true;
|
17465 | }
|
17466 |
|
17467 | }),
|
17468 |
|
17469 | (function(module, exports, __webpack_require__) {
|
17470 |
|
17471 | "use strict";
|
17472 |
|
17473 | exports.__esModule = true;
|
17474 | exports.whenMapDispatchToPropsIsFunction = whenMapDispatchToPropsIsFunction;
|
17475 | exports.whenMapDispatchToPropsIsMissing = whenMapDispatchToPropsIsMissing;
|
17476 | exports.whenMapDispatchToPropsIsObject = whenMapDispatchToPropsIsObject;
|
17477 | exports.default = void 0;
|
17478 |
|
17479 | var _redux = __webpack_require__(130);
|
17480 |
|
17481 | var _wrapMapToProps = __webpack_require__(161);
|
17482 |
|
17483 | function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {
|
17484 | return typeof mapDispatchToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapDispatchToProps, 'mapDispatchToProps') : undefined;
|
17485 | }
|
17486 |
|
17487 | function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {
|
17488 | return !mapDispatchToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) {
|
17489 | return {
|
17490 | dispatch: dispatch
|
17491 | };
|
17492 | }) : undefined;
|
17493 | }
|
17494 |
|
17495 | function whenMapDispatchToPropsIsObject(mapDispatchToProps) {
|
17496 | return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) {
|
17497 | return (0, _redux.bindActionCreators)(mapDispatchToProps, dispatch);
|
17498 | }) : undefined;
|
17499 | }
|
17500 |
|
17501 | var _default = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];
|
17502 | exports.default = _default;
|
17503 |
|
17504 | }),
|
17505 |
|
17506 | (function(module, exports, __webpack_require__) {
|
17507 |
|
17508 | (function(process) {"use strict";
|
17509 |
|
17510 | var _interopRequireDefault = __webpack_require__(14);
|
17511 |
|
17512 | exports.__esModule = true;
|
17513 | exports.wrapMapToPropsConstant = wrapMapToPropsConstant;
|
17514 | exports.getDependsOnOwnProps = getDependsOnOwnProps;
|
17515 | exports.wrapMapToPropsFunc = wrapMapToPropsFunc;
|
17516 |
|
17517 | var _verifyPlainObject = _interopRequireDefault(__webpack_require__(162));
|
17518 |
|
17519 | function wrapMapToPropsConstant(getConstant) {
|
17520 | return function initConstantSelector(dispatch, options) {
|
17521 | var constant = getConstant(dispatch, options);
|
17522 |
|
17523 | function constantSelector() {
|
17524 | return constant;
|
17525 | }
|
17526 |
|
17527 | constantSelector.dependsOnOwnProps = false;
|
17528 | return constantSelector;
|
17529 | };
|
17530 | }
|
17531 |
|
17532 |
|
17533 |
|
17534 |
|
17535 |
|
17536 |
|
17537 |
|
17538 |
|
17539 | function getDependsOnOwnProps(mapToProps) {
|
17540 | return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1;
|
17541 | }
|
17542 |
|
17543 |
|
17544 |
|
17545 |
|
17546 |
|
17547 |
|
17548 |
|
17549 |
|
17550 |
|
17551 |
|
17552 |
|
17553 |
|
17554 |
|
17555 | function wrapMapToPropsFunc(mapToProps, methodName) {
|
17556 | return function initProxySelector(dispatch, _ref) {
|
17557 | var displayName = _ref.displayName;
|
17558 |
|
17559 | var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) {
|
17560 | return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch);
|
17561 | };
|
17562 |
|
17563 |
|
17564 | proxy.dependsOnOwnProps = true;
|
17565 |
|
17566 | proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
|
17567 | proxy.mapToProps = mapToProps;
|
17568 | proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
|
17569 | var props = proxy(stateOrDispatch, ownProps);
|
17570 |
|
17571 | if (typeof props === 'function') {
|
17572 | proxy.mapToProps = props;
|
17573 | proxy.dependsOnOwnProps = getDependsOnOwnProps(props);
|
17574 | props = proxy(stateOrDispatch, ownProps);
|
17575 | }
|
17576 |
|
17577 | if (process.env.NODE_ENV !== 'production') (0, _verifyPlainObject.default)(props, displayName, methodName);
|
17578 | return props;
|
17579 | };
|
17580 |
|
17581 | return proxy;
|
17582 | };
|
17583 | }
|
17584 | }.call(exports, __webpack_require__(33)))
|
17585 |
|
17586 | }),
|
17587 |
|
17588 | (function(module, exports, __webpack_require__) {
|
17589 |
|
17590 | "use strict";
|
17591 |
|
17592 | var _interopRequireDefault = __webpack_require__(14);
|
17593 |
|
17594 | exports.__esModule = true;
|
17595 | exports.default = verifyPlainObject;
|
17596 |
|
17597 | var _isPlainObject = _interopRequireDefault(__webpack_require__(163));
|
17598 |
|
17599 | var _warning = _interopRequireDefault(__webpack_require__(147));
|
17600 |
|
17601 | function verifyPlainObject(value, displayName, methodName) {
|
17602 | if (!(0, _isPlainObject.default)(value)) {
|
17603 | (0, _warning.default)(methodName + "() in " + displayName + " must return a plain object. Instead received " + value + ".");
|
17604 | }
|
17605 | }
|
17606 |
|
17607 | }),
|
17608 |
|
17609 | (function(module, exports) {
|
17610 |
|
17611 | "use strict";
|
17612 |
|
17613 | exports.__esModule = true;
|
17614 | exports.default = isPlainObject;
|
17615 |
|
17616 | |
17617 |
|
17618 |
|
17619 |
|
17620 | function isPlainObject(obj) {
|
17621 | if (typeof obj !== 'object' || obj === null) return false;
|
17622 | var proto = obj;
|
17623 |
|
17624 | while (Object.getPrototypeOf(proto) !== null) {
|
17625 | proto = Object.getPrototypeOf(proto);
|
17626 | }
|
17627 |
|
17628 | return Object.getPrototypeOf(obj) === proto;
|
17629 | }
|
17630 |
|
17631 | }),
|
17632 |
|
17633 | (function(module, exports, __webpack_require__) {
|
17634 |
|
17635 | "use strict";
|
17636 |
|
17637 | exports.__esModule = true;
|
17638 | exports.whenMapStateToPropsIsFunction = whenMapStateToPropsIsFunction;
|
17639 | exports.whenMapStateToPropsIsMissing = whenMapStateToPropsIsMissing;
|
17640 | exports.default = void 0;
|
17641 |
|
17642 | var _wrapMapToProps = __webpack_require__(161);
|
17643 |
|
17644 | function whenMapStateToPropsIsFunction(mapStateToProps) {
|
17645 | return typeof mapStateToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapStateToProps, 'mapStateToProps') : undefined;
|
17646 | }
|
17647 |
|
17648 | function whenMapStateToPropsIsMissing(mapStateToProps) {
|
17649 | return !mapStateToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function () {
|
17650 | return {};
|
17651 | }) : undefined;
|
17652 | }
|
17653 |
|
17654 | var _default = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing];
|
17655 | exports.default = _default;
|
17656 |
|
17657 | }),
|
17658 |
|
17659 | (function(module, exports, __webpack_require__) {
|
17660 |
|
17661 | (function(process) {"use strict";
|
17662 |
|
17663 | var _interopRequireDefault = __webpack_require__(14);
|
17664 |
|
17665 | exports.__esModule = true;
|
17666 | exports.defaultMergeProps = defaultMergeProps;
|
17667 | exports.wrapMergePropsFunc = wrapMergePropsFunc;
|
17668 | exports.whenMergePropsIsFunction = whenMergePropsIsFunction;
|
17669 | exports.whenMergePropsIsOmitted = whenMergePropsIsOmitted;
|
17670 | exports.default = void 0;
|
17671 |
|
17672 | var _extends2 = _interopRequireDefault(__webpack_require__(150));
|
17673 |
|
17674 | var _verifyPlainObject = _interopRequireDefault(__webpack_require__(162));
|
17675 |
|
17676 | function defaultMergeProps(stateProps, dispatchProps, ownProps) {
|
17677 | return (0, _extends2.default)({}, ownProps, stateProps, dispatchProps);
|
17678 | }
|
17679 |
|
17680 | function wrapMergePropsFunc(mergeProps) {
|
17681 | return function initMergePropsProxy(dispatch, _ref) {
|
17682 | var displayName = _ref.displayName,
|
17683 | pure = _ref.pure,
|
17684 | areMergedPropsEqual = _ref.areMergedPropsEqual;
|
17685 | var hasRunOnce = false;
|
17686 | var mergedProps;
|
17687 | return function mergePropsProxy(stateProps, dispatchProps, ownProps) {
|
17688 | var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
17689 |
|
17690 | if (hasRunOnce) {
|
17691 | if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps;
|
17692 | } else {
|
17693 | hasRunOnce = true;
|
17694 | mergedProps = nextMergedProps;
|
17695 | if (process.env.NODE_ENV !== 'production') (0, _verifyPlainObject.default)(mergedProps, displayName, 'mergeProps');
|
17696 | }
|
17697 |
|
17698 | return mergedProps;
|
17699 | };
|
17700 | };
|
17701 | }
|
17702 |
|
17703 | function whenMergePropsIsFunction(mergeProps) {
|
17704 | return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined;
|
17705 | }
|
17706 |
|
17707 | function whenMergePropsIsOmitted(mergeProps) {
|
17708 | return !mergeProps ? function () {
|
17709 | return defaultMergeProps;
|
17710 | } : undefined;
|
17711 | }
|
17712 |
|
17713 | var _default = [whenMergePropsIsFunction, whenMergePropsIsOmitted];
|
17714 | exports.default = _default;
|
17715 | }.call(exports, __webpack_require__(33)))
|
17716 |
|
17717 | }),
|
17718 |
|
17719 | (function(module, exports, __webpack_require__) {
|
17720 |
|
17721 | (function(process) {"use strict";
|
17722 |
|
17723 | var _interopRequireDefault = __webpack_require__(14);
|
17724 |
|
17725 | exports.__esModule = true;
|
17726 | exports.impureFinalPropsSelectorFactory = impureFinalPropsSelectorFactory;
|
17727 | exports.pureFinalPropsSelectorFactory = pureFinalPropsSelectorFactory;
|
17728 | exports.default = finalPropsSelectorFactory;
|
17729 |
|
17730 | var _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(151));
|
17731 |
|
17732 | var _verifySubselectors = _interopRequireDefault(__webpack_require__(167));
|
17733 |
|
17734 | function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {
|
17735 | return function impureFinalPropsSelector(state, ownProps) {
|
17736 | return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps);
|
17737 | };
|
17738 | }
|
17739 |
|
17740 | function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) {
|
17741 | var areStatesEqual = _ref.areStatesEqual,
|
17742 | areOwnPropsEqual = _ref.areOwnPropsEqual,
|
17743 | areStatePropsEqual = _ref.areStatePropsEqual;
|
17744 | var hasRunAtLeastOnce = false;
|
17745 | var state;
|
17746 | var ownProps;
|
17747 | var stateProps;
|
17748 | var dispatchProps;
|
17749 | var mergedProps;
|
17750 |
|
17751 | function handleFirstCall(firstState, firstOwnProps) {
|
17752 | state = firstState;
|
17753 | ownProps = firstOwnProps;
|
17754 | stateProps = mapStateToProps(state, ownProps);
|
17755 | dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
17756 | mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
17757 | hasRunAtLeastOnce = true;
|
17758 | return mergedProps;
|
17759 | }
|
17760 |
|
17761 | function handleNewPropsAndNewState() {
|
17762 | stateProps = mapStateToProps(state, ownProps);
|
17763 | if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
17764 | mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
17765 | return mergedProps;
|
17766 | }
|
17767 |
|
17768 | function handleNewProps() {
|
17769 | if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps);
|
17770 | if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
17771 | mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
17772 | return mergedProps;
|
17773 | }
|
17774 |
|
17775 | function handleNewState() {
|
17776 | var nextStateProps = mapStateToProps(state, ownProps);
|
17777 | var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps);
|
17778 | stateProps = nextStateProps;
|
17779 | if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
17780 | return mergedProps;
|
17781 | }
|
17782 |
|
17783 | function handleSubsequentCalls(nextState, nextOwnProps) {
|
17784 | var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps);
|
17785 | var stateChanged = !areStatesEqual(nextState, state);
|
17786 | state = nextState;
|
17787 | ownProps = nextOwnProps;
|
17788 | if (propsChanged && stateChanged) return handleNewPropsAndNewState();
|
17789 | if (propsChanged) return handleNewProps();
|
17790 | if (stateChanged) return handleNewState();
|
17791 | return mergedProps;
|
17792 | }
|
17793 |
|
17794 | return function pureFinalPropsSelector(nextState, nextOwnProps) {
|
17795 | return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps);
|
17796 | };
|
17797 | }
|
17798 |
|
17799 |
|
17800 |
|
17801 |
|
17802 |
|
17803 |
|
17804 | function finalPropsSelectorFactory(dispatch, _ref2) {
|
17805 | var initMapStateToProps = _ref2.initMapStateToProps,
|
17806 | initMapDispatchToProps = _ref2.initMapDispatchToProps,
|
17807 | initMergeProps = _ref2.initMergeProps,
|
17808 | options = (0, _objectWithoutPropertiesLoose2.default)(_ref2, ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"]);
|
17809 | var mapStateToProps = initMapStateToProps(dispatch, options);
|
17810 | var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
|
17811 | var mergeProps = initMergeProps(dispatch, options);
|
17812 |
|
17813 | if (process.env.NODE_ENV !== 'production') {
|
17814 | (0, _verifySubselectors.default)(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName);
|
17815 | }
|
17816 |
|
17817 | var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory;
|
17818 | return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
|
17819 | }
|
17820 | }.call(exports, __webpack_require__(33)))
|
17821 |
|
17822 | }),
|
17823 |
|
17824 | (function(module, exports, __webpack_require__) {
|
17825 |
|
17826 | "use strict";
|
17827 |
|
17828 | var _interopRequireDefault = __webpack_require__(14);
|
17829 |
|
17830 | exports.__esModule = true;
|
17831 | exports.default = verifySubselectors;
|
17832 |
|
17833 | var _warning = _interopRequireDefault(__webpack_require__(147));
|
17834 |
|
17835 | function verify(selector, methodName, displayName) {
|
17836 | if (!selector) {
|
17837 | throw new Error("Unexpected value for " + methodName + " in " + displayName + ".");
|
17838 | } else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') {
|
17839 | if (!selector.hasOwnProperty('dependsOnOwnProps')) {
|
17840 | (0, _warning.default)("The selector for " + methodName + " of " + displayName + " did not specify a value for dependsOnOwnProps.");
|
17841 | }
|
17842 | }
|
17843 | }
|
17844 |
|
17845 | function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) {
|
17846 | verify(mapStateToProps, 'mapStateToProps', displayName);
|
17847 | verify(mapDispatchToProps, 'mapDispatchToProps', displayName);
|
17848 | verify(mergeProps, 'mergeProps', displayName);
|
17849 | }
|
17850 |
|
17851 | }),
|
17852 |
|
17853 | (function(module, exports, __webpack_require__) {
|
17854 |
|
17855 | 'use strict';
|
17856 |
|
17857 | exports.__esModule = true;
|
17858 |
|
17859 | function _interopRequire(obj) { return obj && obj.__esModule ? obj['default'] : obj; }
|
17860 |
|
17861 | var _Motion = __webpack_require__(169);
|
17862 |
|
17863 | exports.Motion = _interopRequire(_Motion);
|
17864 |
|
17865 | var _StaggeredMotion = __webpack_require__(176);
|
17866 |
|
17867 | exports.StaggeredMotion = _interopRequire(_StaggeredMotion);
|
17868 |
|
17869 | var _TransitionMotion = __webpack_require__(177);
|
17870 |
|
17871 | exports.TransitionMotion = _interopRequire(_TransitionMotion);
|
17872 |
|
17873 | var _spring = __webpack_require__(179);
|
17874 |
|
17875 | exports.spring = _interopRequire(_spring);
|
17876 |
|
17877 | var _presets = __webpack_require__(180);
|
17878 |
|
17879 | exports.presets = _interopRequire(_presets);
|
17880 |
|
17881 | var _stripStyle = __webpack_require__(171);
|
17882 |
|
17883 | exports.stripStyle = _interopRequire(_stripStyle);
|
17884 |
|
17885 |
|
17886 |
|
17887 | var _reorderKeys = __webpack_require__(181);
|
17888 |
|
17889 | exports.reorderKeys = _interopRequire(_reorderKeys);
|
17890 |
|
17891 | }),
|
17892 |
|
17893 | (function(module, exports, __webpack_require__) {
|
17894 |
|
17895 | 'use strict';
|
17896 |
|
17897 | exports.__esModule = true;
|
17898 |
|
17899 | 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; };
|
17900 |
|
17901 | 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; }; })();
|
17902 |
|
17903 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
17904 |
|
17905 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
17906 |
|
17907 | 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; }
|
17908 |
|
17909 | var _mapToZero = __webpack_require__(170);
|
17910 |
|
17911 | var _mapToZero2 = _interopRequireDefault(_mapToZero);
|
17912 |
|
17913 | var _stripStyle = __webpack_require__(171);
|
17914 |
|
17915 | var _stripStyle2 = _interopRequireDefault(_stripStyle);
|
17916 |
|
17917 | var _stepper3 = __webpack_require__(172);
|
17918 |
|
17919 | var _stepper4 = _interopRequireDefault(_stepper3);
|
17920 |
|
17921 | var _performanceNow = __webpack_require__(173);
|
17922 |
|
17923 | var _performanceNow2 = _interopRequireDefault(_performanceNow);
|
17924 |
|
17925 | var _raf = __webpack_require__(174);
|
17926 |
|
17927 | var _raf2 = _interopRequireDefault(_raf);
|
17928 |
|
17929 | var _shouldStopAnimation = __webpack_require__(175);
|
17930 |
|
17931 | var _shouldStopAnimation2 = _interopRequireDefault(_shouldStopAnimation);
|
17932 |
|
17933 | var _react = __webpack_require__(4);
|
17934 |
|
17935 | var _react2 = _interopRequireDefault(_react);
|
17936 |
|
17937 | var _propTypes = __webpack_require__(5);
|
17938 |
|
17939 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
17940 |
|
17941 | var msPerFrame = 1000 / 60;
|
17942 |
|
17943 | var Motion = (function (_React$Component) {
|
17944 | _inherits(Motion, _React$Component);
|
17945 |
|
17946 | _createClass(Motion, null, [{
|
17947 | key: 'propTypes',
|
17948 | value: {
|
17949 |
|
17950 | defaultStyle: _propTypes2['default'].objectOf(_propTypes2['default'].number),
|
17951 | style: _propTypes2['default'].objectOf(_propTypes2['default'].oneOfType([_propTypes2['default'].number, _propTypes2['default'].object])).isRequired,
|
17952 | children: _propTypes2['default'].func.isRequired,
|
17953 | onRest: _propTypes2['default'].func
|
17954 | },
|
17955 | enumerable: true
|
17956 | }]);
|
17957 |
|
17958 | function Motion(props) {
|
17959 | var _this = this;
|
17960 |
|
17961 | _classCallCheck(this, Motion);
|
17962 |
|
17963 | _React$Component.call(this, props);
|
17964 | this.wasAnimating = false;
|
17965 | this.animationID = null;
|
17966 | this.prevTime = 0;
|
17967 | this.accumulatedTime = 0;
|
17968 | this.unreadPropStyle = null;
|
17969 |
|
17970 | this.clearUnreadPropStyle = function (destStyle) {
|
17971 | var dirty = false;
|
17972 | var _state = _this.state;
|
17973 | var currentStyle = _state.currentStyle;
|
17974 | var currentVelocity = _state.currentVelocity;
|
17975 | var lastIdealStyle = _state.lastIdealStyle;
|
17976 | var lastIdealVelocity = _state.lastIdealVelocity;
|
17977 |
|
17978 | for (var key in destStyle) {
|
17979 | if (!Object.prototype.hasOwnProperty.call(destStyle, key)) {
|
17980 | continue;
|
17981 | }
|
17982 |
|
17983 | var styleValue = destStyle[key];
|
17984 | if (typeof styleValue === 'number') {
|
17985 | if (!dirty) {
|
17986 | dirty = true;
|
17987 | currentStyle = _extends({}, currentStyle);
|
17988 | currentVelocity = _extends({}, currentVelocity);
|
17989 | lastIdealStyle = _extends({}, lastIdealStyle);
|
17990 | lastIdealVelocity = _extends({}, lastIdealVelocity);
|
17991 | }
|
17992 |
|
17993 | currentStyle[key] = styleValue;
|
17994 | currentVelocity[key] = 0;
|
17995 | lastIdealStyle[key] = styleValue;
|
17996 | lastIdealVelocity[key] = 0;
|
17997 | }
|
17998 | }
|
17999 |
|
18000 | if (dirty) {
|
18001 | _this.setState({ currentStyle: currentStyle, currentVelocity: currentVelocity, lastIdealStyle: lastIdealStyle, lastIdealVelocity: lastIdealVelocity });
|
18002 | }
|
18003 | };
|
18004 |
|
18005 | this.startAnimationIfNecessary = function () {
|
18006 |
|
18007 |
|
18008 | _this.animationID = _raf2['default'](function (timestamp) {
|
18009 |
|
18010 | var propsStyle = _this.props.style;
|
18011 | if (_shouldStopAnimation2['default'](_this.state.currentStyle, propsStyle, _this.state.currentVelocity)) {
|
18012 | if (_this.wasAnimating && _this.props.onRest) {
|
18013 | _this.props.onRest();
|
18014 | }
|
18015 |
|
18016 |
|
18017 | _this.animationID = null;
|
18018 | _this.wasAnimating = false;
|
18019 | _this.accumulatedTime = 0;
|
18020 | return;
|
18021 | }
|
18022 |
|
18023 | _this.wasAnimating = true;
|
18024 |
|
18025 | var currentTime = timestamp || _performanceNow2['default']();
|
18026 | var timeDelta = currentTime - _this.prevTime;
|
18027 | _this.prevTime = currentTime;
|
18028 | _this.accumulatedTime = _this.accumulatedTime + timeDelta;
|
18029 |
|
18030 | if (_this.accumulatedTime > msPerFrame * 10) {
|
18031 | _this.accumulatedTime = 0;
|
18032 | }
|
18033 |
|
18034 | if (_this.accumulatedTime === 0) {
|
18035 |
|
18036 | _this.animationID = null;
|
18037 | _this.startAnimationIfNecessary();
|
18038 | return;
|
18039 | }
|
18040 |
|
18041 | var currentFrameCompletion = (_this.accumulatedTime - Math.floor(_this.accumulatedTime / msPerFrame) * msPerFrame) / msPerFrame;
|
18042 | var framesToCatchUp = Math.floor(_this.accumulatedTime / msPerFrame);
|
18043 |
|
18044 | var newLastIdealStyle = {};
|
18045 | var newLastIdealVelocity = {};
|
18046 | var newCurrentStyle = {};
|
18047 | var newCurrentVelocity = {};
|
18048 |
|
18049 | for (var key in propsStyle) {
|
18050 | if (!Object.prototype.hasOwnProperty.call(propsStyle, key)) {
|
18051 | continue;
|
18052 | }
|
18053 |
|
18054 | var styleValue = propsStyle[key];
|
18055 | if (typeof styleValue === 'number') {
|
18056 | newCurrentStyle[key] = styleValue;
|
18057 | newCurrentVelocity[key] = 0;
|
18058 | newLastIdealStyle[key] = styleValue;
|
18059 | newLastIdealVelocity[key] = 0;
|
18060 | } else {
|
18061 | var newLastIdealStyleValue = _this.state.lastIdealStyle[key];
|
18062 | var newLastIdealVelocityValue = _this.state.lastIdealVelocity[key];
|
18063 | for (var i = 0; i < framesToCatchUp; i++) {
|
18064 | var _stepper = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
18065 |
|
18066 | newLastIdealStyleValue = _stepper[0];
|
18067 | newLastIdealVelocityValue = _stepper[1];
|
18068 | }
|
18069 |
|
18070 | var _stepper2 = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
18071 |
|
18072 | var nextIdealX = _stepper2[0];
|
18073 | var nextIdealV = _stepper2[1];
|
18074 |
|
18075 | newCurrentStyle[key] = newLastIdealStyleValue + (nextIdealX - newLastIdealStyleValue) * currentFrameCompletion;
|
18076 | newCurrentVelocity[key] = newLastIdealVelocityValue + (nextIdealV - newLastIdealVelocityValue) * currentFrameCompletion;
|
18077 | newLastIdealStyle[key] = newLastIdealStyleValue;
|
18078 | newLastIdealVelocity[key] = newLastIdealVelocityValue;
|
18079 | }
|
18080 | }
|
18081 |
|
18082 | _this.animationID = null;
|
18083 |
|
18084 | _this.accumulatedTime -= framesToCatchUp * msPerFrame;
|
18085 |
|
18086 | _this.setState({
|
18087 | currentStyle: newCurrentStyle,
|
18088 | currentVelocity: newCurrentVelocity,
|
18089 | lastIdealStyle: newLastIdealStyle,
|
18090 | lastIdealVelocity: newLastIdealVelocity
|
18091 | });
|
18092 |
|
18093 | _this.unreadPropStyle = null;
|
18094 |
|
18095 | _this.startAnimationIfNecessary();
|
18096 | });
|
18097 | };
|
18098 |
|
18099 | this.state = this.defaultState();
|
18100 | }
|
18101 |
|
18102 | Motion.prototype.defaultState = function defaultState() {
|
18103 | var _props = this.props;
|
18104 | var defaultStyle = _props.defaultStyle;
|
18105 | var style = _props.style;
|
18106 |
|
18107 | var currentStyle = defaultStyle || _stripStyle2['default'](style);
|
18108 | var currentVelocity = _mapToZero2['default'](currentStyle);
|
18109 | return {
|
18110 | currentStyle: currentStyle,
|
18111 | currentVelocity: currentVelocity,
|
18112 | lastIdealStyle: currentStyle,
|
18113 | lastIdealVelocity: currentVelocity
|
18114 | };
|
18115 | };
|
18116 |
|
18117 |
|
18118 |
|
18119 |
|
18120 |
|
18121 |
|
18122 |
|
18123 | Motion.prototype.componentDidMount = function componentDidMount() {
|
18124 | this.prevTime = _performanceNow2['default']();
|
18125 | this.startAnimationIfNecessary();
|
18126 | };
|
18127 |
|
18128 | Motion.prototype.componentWillReceiveProps = function componentWillReceiveProps(props) {
|
18129 | if (this.unreadPropStyle != null) {
|
18130 |
|
18131 | this.clearUnreadPropStyle(this.unreadPropStyle);
|
18132 | }
|
18133 |
|
18134 | this.unreadPropStyle = props.style;
|
18135 | if (this.animationID == null) {
|
18136 | this.prevTime = _performanceNow2['default']();
|
18137 | this.startAnimationIfNecessary();
|
18138 | }
|
18139 | };
|
18140 |
|
18141 | Motion.prototype.componentWillUnmount = function componentWillUnmount() {
|
18142 | if (this.animationID != null) {
|
18143 | _raf2['default'].cancel(this.animationID);
|
18144 | this.animationID = null;
|
18145 | }
|
18146 | };
|
18147 |
|
18148 | Motion.prototype.render = function render() {
|
18149 | var renderedChildren = this.props.children(this.state.currentStyle);
|
18150 | return renderedChildren && _react2['default'].Children.only(renderedChildren);
|
18151 | };
|
18152 |
|
18153 | return Motion;
|
18154 | })(_react2['default'].Component);
|
18155 |
|
18156 | exports['default'] = Motion;
|
18157 | module.exports = exports['default'];
|
18158 |
|
18159 |
|
18160 |
|
18161 |
|
18162 |
|
18163 | }),
|
18164 |
|
18165 | (function(module, exports) {
|
18166 |
|
18167 |
|
18168 |
|
18169 |
|
18170 | 'use strict';
|
18171 |
|
18172 | exports.__esModule = true;
|
18173 | exports['default'] = mapToZero;
|
18174 |
|
18175 | function mapToZero(obj) {
|
18176 | var ret = {};
|
18177 | for (var key in obj) {
|
18178 | if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
18179 | ret[key] = 0;
|
18180 | }
|
18181 | }
|
18182 | return ret;
|
18183 | }
|
18184 |
|
18185 | module.exports = exports['default'];
|
18186 |
|
18187 | }),
|
18188 |
|
18189 | (function(module, exports) {
|
18190 |
|
18191 |
|
18192 |
|
18193 |
|
18194 |
|
18195 | 'use strict';
|
18196 |
|
18197 | exports.__esModule = true;
|
18198 | exports['default'] = stripStyle;
|
18199 |
|
18200 | function stripStyle(style) {
|
18201 | var ret = {};
|
18202 | for (var key in style) {
|
18203 | if (!Object.prototype.hasOwnProperty.call(style, key)) {
|
18204 | continue;
|
18205 | }
|
18206 | ret[key] = typeof style[key] === 'number' ? style[key] : style[key].val;
|
18207 | }
|
18208 | return ret;
|
18209 | }
|
18210 |
|
18211 | module.exports = exports['default'];
|
18212 |
|
18213 | }),
|
18214 |
|
18215 | (function(module, exports) {
|
18216 |
|
18217 |
|
18218 |
|
18219 |
|
18220 |
|
18221 |
|
18222 | "use strict";
|
18223 |
|
18224 | exports.__esModule = true;
|
18225 | exports["default"] = stepper;
|
18226 |
|
18227 | var reusedTuple = [0, 0];
|
18228 |
|
18229 | function stepper(secondPerFrame, x, v, destX, k, b, precision) {
|
18230 |
|
18231 |
|
18232 |
|
18233 |
|
18234 | var Fspring = -k * (x - destX);
|
18235 |
|
18236 |
|
18237 | var Fdamper = -b * v;
|
18238 |
|
18239 |
|
18240 |
|
18241 |
|
18242 | var a = Fspring + Fdamper;
|
18243 |
|
18244 | var newV = v + a * secondPerFrame;
|
18245 | var newX = x + newV * secondPerFrame;
|
18246 |
|
18247 | if (Math.abs(newV) < precision && Math.abs(newX - destX) < precision) {
|
18248 | reusedTuple[0] = destX;
|
18249 | reusedTuple[1] = 0;
|
18250 | return reusedTuple;
|
18251 | }
|
18252 |
|
18253 | reusedTuple[0] = newX;
|
18254 | reusedTuple[1] = newV;
|
18255 | return reusedTuple;
|
18256 | }
|
18257 |
|
18258 | module.exports = exports["default"];
|
18259 |
|
18260 |
|
18261 | }),
|
18262 |
|
18263 | (function(module, exports, __webpack_require__) {
|
18264 |
|
18265 | (function(process) {
|
18266 | (function() {
|
18267 | var getNanoSeconds, hrtime, loadTime;
|
18268 |
|
18269 | if ((typeof performance !== "undefined" && performance !== null) && performance.now) {
|
18270 | module.exports = function() {
|
18271 | return performance.now();
|
18272 | };
|
18273 | } else if ((typeof process !== "undefined" && process !== null) && process.hrtime) {
|
18274 | module.exports = function() {
|
18275 | return (getNanoSeconds() - loadTime) / 1e6;
|
18276 | };
|
18277 | hrtime = process.hrtime;
|
18278 | getNanoSeconds = function() {
|
18279 | var hr;
|
18280 | hr = hrtime();
|
18281 | return hr[0] * 1e9 + hr[1];
|
18282 | };
|
18283 | loadTime = getNanoSeconds();
|
18284 | } else if (Date.now) {
|
18285 | module.exports = function() {
|
18286 | return Date.now() - loadTime;
|
18287 | };
|
18288 | loadTime = Date.now();
|
18289 | } else {
|
18290 | module.exports = function() {
|
18291 | return new Date().getTime() - loadTime;
|
18292 | };
|
18293 | loadTime = new Date().getTime();
|
18294 | }
|
18295 |
|
18296 | }).call(this);
|
18297 |
|
18298 | }.call(exports, __webpack_require__(33)))
|
18299 |
|
18300 | }),
|
18301 |
|
18302 | (function(module, exports, __webpack_require__) {
|
18303 |
|
18304 | (function(global) {var now = __webpack_require__(173)
|
18305 | , root = typeof window === 'undefined' ? global : window
|
18306 | , vendors = ['moz', 'webkit']
|
18307 | , suffix = 'AnimationFrame'
|
18308 | , raf = root['request' + suffix]
|
18309 | , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]
|
18310 |
|
18311 | for(var i = 0; !raf && i < vendors.length; i++) {
|
18312 | raf = root[vendors[i] + 'Request' + suffix]
|
18313 | caf = root[vendors[i] + 'Cancel' + suffix]
|
18314 | || root[vendors[i] + 'CancelRequest' + suffix]
|
18315 | }
|
18316 |
|
18317 |
|
18318 | if(!raf || !caf) {
|
18319 | var last = 0
|
18320 | , id = 0
|
18321 | , queue = []
|
18322 | , frameDuration = 1000 / 60
|
18323 |
|
18324 | raf = function(callback) {
|
18325 | if(queue.length === 0) {
|
18326 | var _now = now()
|
18327 | , next = Math.max(0, frameDuration - (_now - last))
|
18328 | last = next + _now
|
18329 | setTimeout(function() {
|
18330 | var cp = queue.slice(0)
|
18331 |
|
18332 |
|
18333 |
|
18334 | queue.length = 0
|
18335 | for(var i = 0; i < cp.length; i++) {
|
18336 | if(!cp[i].cancelled) {
|
18337 | try{
|
18338 | cp[i].callback(last)
|
18339 | } catch(e) {
|
18340 | setTimeout(function() { throw e }, 0)
|
18341 | }
|
18342 | }
|
18343 | }
|
18344 | }, Math.round(next))
|
18345 | }
|
18346 | queue.push({
|
18347 | handle: ++id,
|
18348 | callback: callback,
|
18349 | cancelled: false
|
18350 | })
|
18351 | return id
|
18352 | }
|
18353 |
|
18354 | caf = function(handle) {
|
18355 | for(var i = 0; i < queue.length; i++) {
|
18356 | if(queue[i].handle === handle) {
|
18357 | queue[i].cancelled = true
|
18358 | }
|
18359 | }
|
18360 | }
|
18361 | }
|
18362 |
|
18363 | module.exports = function(fn) {
|
18364 |
|
18365 |
|
18366 |
|
18367 | return raf.call(root, fn)
|
18368 | }
|
18369 | module.exports.cancel = function() {
|
18370 | caf.apply(root, arguments)
|
18371 | }
|
18372 | module.exports.polyfill = function(object) {
|
18373 | if (!object) {
|
18374 | object = root;
|
18375 | }
|
18376 | object.requestAnimationFrame = raf
|
18377 | object.cancelAnimationFrame = caf
|
18378 | }
|
18379 |
|
18380 | }.call(exports, (function() { return this; }())))
|
18381 |
|
18382 | }),
|
18383 |
|
18384 | (function(module, exports) {
|
18385 |
|
18386 |
|
18387 |
|
18388 |
|
18389 |
|
18390 | 'use strict';
|
18391 |
|
18392 | exports.__esModule = true;
|
18393 | exports['default'] = shouldStopAnimation;
|
18394 |
|
18395 | function shouldStopAnimation(currentStyle, style, currentVelocity) {
|
18396 | for (var key in style) {
|
18397 | if (!Object.prototype.hasOwnProperty.call(style, key)) {
|
18398 | continue;
|
18399 | }
|
18400 |
|
18401 | if (currentVelocity[key] !== 0) {
|
18402 | return false;
|
18403 | }
|
18404 |
|
18405 | var styleValue = typeof style[key] === 'number' ? style[key] : style[key].val;
|
18406 |
|
18407 |
|
18408 | if (currentStyle[key] !== styleValue) {
|
18409 | return false;
|
18410 | }
|
18411 | }
|
18412 |
|
18413 | return true;
|
18414 | }
|
18415 |
|
18416 | module.exports = exports['default'];
|
18417 |
|
18418 | }),
|
18419 |
|
18420 | (function(module, exports, __webpack_require__) {
|
18421 |
|
18422 | 'use strict';
|
18423 |
|
18424 | exports.__esModule = true;
|
18425 |
|
18426 | 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; };
|
18427 |
|
18428 | 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; }; })();
|
18429 |
|
18430 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18431 |
|
18432 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
18433 |
|
18434 | 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; }
|
18435 |
|
18436 | var _mapToZero = __webpack_require__(170);
|
18437 |
|
18438 | var _mapToZero2 = _interopRequireDefault(_mapToZero);
|
18439 |
|
18440 | var _stripStyle = __webpack_require__(171);
|
18441 |
|
18442 | var _stripStyle2 = _interopRequireDefault(_stripStyle);
|
18443 |
|
18444 | var _stepper3 = __webpack_require__(172);
|
18445 |
|
18446 | var _stepper4 = _interopRequireDefault(_stepper3);
|
18447 |
|
18448 | var _performanceNow = __webpack_require__(173);
|
18449 |
|
18450 | var _performanceNow2 = _interopRequireDefault(_performanceNow);
|
18451 |
|
18452 | var _raf = __webpack_require__(174);
|
18453 |
|
18454 | var _raf2 = _interopRequireDefault(_raf);
|
18455 |
|
18456 | var _shouldStopAnimation = __webpack_require__(175);
|
18457 |
|
18458 | var _shouldStopAnimation2 = _interopRequireDefault(_shouldStopAnimation);
|
18459 |
|
18460 | var _react = __webpack_require__(4);
|
18461 |
|
18462 | var _react2 = _interopRequireDefault(_react);
|
18463 |
|
18464 | var _propTypes = __webpack_require__(5);
|
18465 |
|
18466 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
18467 |
|
18468 | var msPerFrame = 1000 / 60;
|
18469 |
|
18470 | function shouldStopAnimationAll(currentStyles, styles, currentVelocities) {
|
18471 | for (var i = 0; i < currentStyles.length; i++) {
|
18472 | if (!_shouldStopAnimation2['default'](currentStyles[i], styles[i], currentVelocities[i])) {
|
18473 | return false;
|
18474 | }
|
18475 | }
|
18476 | return true;
|
18477 | }
|
18478 |
|
18479 | var StaggeredMotion = (function (_React$Component) {
|
18480 | _inherits(StaggeredMotion, _React$Component);
|
18481 |
|
18482 | _createClass(StaggeredMotion, null, [{
|
18483 | key: 'propTypes',
|
18484 | value: {
|
18485 |
|
18486 | defaultStyles: _propTypes2['default'].arrayOf(_propTypes2['default'].objectOf(_propTypes2['default'].number)),
|
18487 | styles: _propTypes2['default'].func.isRequired,
|
18488 | children: _propTypes2['default'].func.isRequired
|
18489 | },
|
18490 | enumerable: true
|
18491 | }]);
|
18492 |
|
18493 | function StaggeredMotion(props) {
|
18494 | var _this = this;
|
18495 |
|
18496 | _classCallCheck(this, StaggeredMotion);
|
18497 |
|
18498 | _React$Component.call(this, props);
|
18499 | this.animationID = null;
|
18500 | this.prevTime = 0;
|
18501 | this.accumulatedTime = 0;
|
18502 | this.unreadPropStyles = null;
|
18503 |
|
18504 | this.clearUnreadPropStyle = function (unreadPropStyles) {
|
18505 | var _state = _this.state;
|
18506 | var currentStyles = _state.currentStyles;
|
18507 | var currentVelocities = _state.currentVelocities;
|
18508 | var lastIdealStyles = _state.lastIdealStyles;
|
18509 | var lastIdealVelocities = _state.lastIdealVelocities;
|
18510 |
|
18511 | var someDirty = false;
|
18512 | for (var i = 0; i < unreadPropStyles.length; i++) {
|
18513 | var unreadPropStyle = unreadPropStyles[i];
|
18514 | var dirty = false;
|
18515 |
|
18516 | for (var key in unreadPropStyle) {
|
18517 | if (!Object.prototype.hasOwnProperty.call(unreadPropStyle, key)) {
|
18518 | continue;
|
18519 | }
|
18520 |
|
18521 | var styleValue = unreadPropStyle[key];
|
18522 | if (typeof styleValue === 'number') {
|
18523 | if (!dirty) {
|
18524 | dirty = true;
|
18525 | someDirty = true;
|
18526 | currentStyles[i] = _extends({}, currentStyles[i]);
|
18527 | currentVelocities[i] = _extends({}, currentVelocities[i]);
|
18528 | lastIdealStyles[i] = _extends({}, lastIdealStyles[i]);
|
18529 | lastIdealVelocities[i] = _extends({}, lastIdealVelocities[i]);
|
18530 | }
|
18531 | currentStyles[i][key] = styleValue;
|
18532 | currentVelocities[i][key] = 0;
|
18533 | lastIdealStyles[i][key] = styleValue;
|
18534 | lastIdealVelocities[i][key] = 0;
|
18535 | }
|
18536 | }
|
18537 | }
|
18538 |
|
18539 | if (someDirty) {
|
18540 | _this.setState({ currentStyles: currentStyles, currentVelocities: currentVelocities, lastIdealStyles: lastIdealStyles, lastIdealVelocities: lastIdealVelocities });
|
18541 | }
|
18542 | };
|
18543 |
|
18544 | this.startAnimationIfNecessary = function () {
|
18545 |
|
18546 |
|
18547 | _this.animationID = _raf2['default'](function (timestamp) {
|
18548 | var destStyles = _this.props.styles(_this.state.lastIdealStyles);
|
18549 |
|
18550 |
|
18551 | if (shouldStopAnimationAll(_this.state.currentStyles, destStyles, _this.state.currentVelocities)) {
|
18552 |
|
18553 | _this.animationID = null;
|
18554 | _this.accumulatedTime = 0;
|
18555 | return;
|
18556 | }
|
18557 |
|
18558 | var currentTime = timestamp || _performanceNow2['default']();
|
18559 | var timeDelta = currentTime - _this.prevTime;
|
18560 | _this.prevTime = currentTime;
|
18561 | _this.accumulatedTime = _this.accumulatedTime + timeDelta;
|
18562 |
|
18563 | if (_this.accumulatedTime > msPerFrame * 10) {
|
18564 | _this.accumulatedTime = 0;
|
18565 | }
|
18566 |
|
18567 | if (_this.accumulatedTime === 0) {
|
18568 |
|
18569 | _this.animationID = null;
|
18570 | _this.startAnimationIfNecessary();
|
18571 | return;
|
18572 | }
|
18573 |
|
18574 | var currentFrameCompletion = (_this.accumulatedTime - Math.floor(_this.accumulatedTime / msPerFrame) * msPerFrame) / msPerFrame;
|
18575 | var framesToCatchUp = Math.floor(_this.accumulatedTime / msPerFrame);
|
18576 |
|
18577 | var newLastIdealStyles = [];
|
18578 | var newLastIdealVelocities = [];
|
18579 | var newCurrentStyles = [];
|
18580 | var newCurrentVelocities = [];
|
18581 |
|
18582 | for (var i = 0; i < destStyles.length; i++) {
|
18583 | var destStyle = destStyles[i];
|
18584 | var newCurrentStyle = {};
|
18585 | var newCurrentVelocity = {};
|
18586 | var newLastIdealStyle = {};
|
18587 | var newLastIdealVelocity = {};
|
18588 |
|
18589 | for (var key in destStyle) {
|
18590 | if (!Object.prototype.hasOwnProperty.call(destStyle, key)) {
|
18591 | continue;
|
18592 | }
|
18593 |
|
18594 | var styleValue = destStyle[key];
|
18595 | if (typeof styleValue === 'number') {
|
18596 | newCurrentStyle[key] = styleValue;
|
18597 | newCurrentVelocity[key] = 0;
|
18598 | newLastIdealStyle[key] = styleValue;
|
18599 | newLastIdealVelocity[key] = 0;
|
18600 | } else {
|
18601 | var newLastIdealStyleValue = _this.state.lastIdealStyles[i][key];
|
18602 | var newLastIdealVelocityValue = _this.state.lastIdealVelocities[i][key];
|
18603 | for (var j = 0; j < framesToCatchUp; j++) {
|
18604 | var _stepper = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
18605 |
|
18606 | newLastIdealStyleValue = _stepper[0];
|
18607 | newLastIdealVelocityValue = _stepper[1];
|
18608 | }
|
18609 |
|
18610 | var _stepper2 = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
18611 |
|
18612 | var nextIdealX = _stepper2[0];
|
18613 | var nextIdealV = _stepper2[1];
|
18614 |
|
18615 | newCurrentStyle[key] = newLastIdealStyleValue + (nextIdealX - newLastIdealStyleValue) * currentFrameCompletion;
|
18616 | newCurrentVelocity[key] = newLastIdealVelocityValue + (nextIdealV - newLastIdealVelocityValue) * currentFrameCompletion;
|
18617 | newLastIdealStyle[key] = newLastIdealStyleValue;
|
18618 | newLastIdealVelocity[key] = newLastIdealVelocityValue;
|
18619 | }
|
18620 | }
|
18621 |
|
18622 | newCurrentStyles[i] = newCurrentStyle;
|
18623 | newCurrentVelocities[i] = newCurrentVelocity;
|
18624 | newLastIdealStyles[i] = newLastIdealStyle;
|
18625 | newLastIdealVelocities[i] = newLastIdealVelocity;
|
18626 | }
|
18627 |
|
18628 | _this.animationID = null;
|
18629 |
|
18630 | _this.accumulatedTime -= framesToCatchUp * msPerFrame;
|
18631 |
|
18632 | _this.setState({
|
18633 | currentStyles: newCurrentStyles,
|
18634 | currentVelocities: newCurrentVelocities,
|
18635 | lastIdealStyles: newLastIdealStyles,
|
18636 | lastIdealVelocities: newLastIdealVelocities
|
18637 | });
|
18638 |
|
18639 | _this.unreadPropStyles = null;
|
18640 |
|
18641 | _this.startAnimationIfNecessary();
|
18642 | });
|
18643 | };
|
18644 |
|
18645 | this.state = this.defaultState();
|
18646 | }
|
18647 |
|
18648 | StaggeredMotion.prototype.defaultState = function defaultState() {
|
18649 | var _props = this.props;
|
18650 | var defaultStyles = _props.defaultStyles;
|
18651 | var styles = _props.styles;
|
18652 |
|
18653 | var currentStyles = defaultStyles || styles().map(_stripStyle2['default']);
|
18654 | var currentVelocities = currentStyles.map(function (currentStyle) {
|
18655 | return _mapToZero2['default'](currentStyle);
|
18656 | });
|
18657 | return {
|
18658 | currentStyles: currentStyles,
|
18659 | currentVelocities: currentVelocities,
|
18660 | lastIdealStyles: currentStyles,
|
18661 | lastIdealVelocities: currentVelocities
|
18662 | };
|
18663 | };
|
18664 |
|
18665 | StaggeredMotion.prototype.componentDidMount = function componentDidMount() {
|
18666 | this.prevTime = _performanceNow2['default']();
|
18667 | this.startAnimationIfNecessary();
|
18668 | };
|
18669 |
|
18670 | StaggeredMotion.prototype.componentWillReceiveProps = function componentWillReceiveProps(props) {
|
18671 | if (this.unreadPropStyles != null) {
|
18672 |
|
18673 | this.clearUnreadPropStyle(this.unreadPropStyles);
|
18674 | }
|
18675 |
|
18676 | this.unreadPropStyles = props.styles(this.state.lastIdealStyles);
|
18677 | if (this.animationID == null) {
|
18678 | this.prevTime = _performanceNow2['default']();
|
18679 | this.startAnimationIfNecessary();
|
18680 | }
|
18681 | };
|
18682 |
|
18683 | StaggeredMotion.prototype.componentWillUnmount = function componentWillUnmount() {
|
18684 | if (this.animationID != null) {
|
18685 | _raf2['default'].cancel(this.animationID);
|
18686 | this.animationID = null;
|
18687 | }
|
18688 | };
|
18689 |
|
18690 | StaggeredMotion.prototype.render = function render() {
|
18691 | var renderedChildren = this.props.children(this.state.currentStyles);
|
18692 | return renderedChildren && _react2['default'].Children.only(renderedChildren);
|
18693 | };
|
18694 |
|
18695 | return StaggeredMotion;
|
18696 | })(_react2['default'].Component);
|
18697 |
|
18698 | exports['default'] = StaggeredMotion;
|
18699 | module.exports = exports['default'];
|
18700 |
|
18701 |
|
18702 |
|
18703 |
|
18704 |
|
18705 |
|
18706 |
|
18707 |
|
18708 |
|
18709 |
|
18710 |
|
18711 | }),
|
18712 |
|
18713 | (function(module, exports, __webpack_require__) {
|
18714 |
|
18715 | 'use strict';
|
18716 |
|
18717 | exports.__esModule = true;
|
18718 |
|
18719 | 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; };
|
18720 |
|
18721 | 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; }; })();
|
18722 |
|
18723 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18724 |
|
18725 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
18726 |
|
18727 | 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; }
|
18728 |
|
18729 | var _mapToZero = __webpack_require__(170);
|
18730 |
|
18731 | var _mapToZero2 = _interopRequireDefault(_mapToZero);
|
18732 |
|
18733 | var _stripStyle = __webpack_require__(171);
|
18734 |
|
18735 | var _stripStyle2 = _interopRequireDefault(_stripStyle);
|
18736 |
|
18737 | var _stepper3 = __webpack_require__(172);
|
18738 |
|
18739 | var _stepper4 = _interopRequireDefault(_stepper3);
|
18740 |
|
18741 | var _mergeDiff = __webpack_require__(178);
|
18742 |
|
18743 | var _mergeDiff2 = _interopRequireDefault(_mergeDiff);
|
18744 |
|
18745 | var _performanceNow = __webpack_require__(173);
|
18746 |
|
18747 | var _performanceNow2 = _interopRequireDefault(_performanceNow);
|
18748 |
|
18749 | var _raf = __webpack_require__(174);
|
18750 |
|
18751 | var _raf2 = _interopRequireDefault(_raf);
|
18752 |
|
18753 | var _shouldStopAnimation = __webpack_require__(175);
|
18754 |
|
18755 | var _shouldStopAnimation2 = _interopRequireDefault(_shouldStopAnimation);
|
18756 |
|
18757 | var _react = __webpack_require__(4);
|
18758 |
|
18759 | var _react2 = _interopRequireDefault(_react);
|
18760 |
|
18761 | var _propTypes = __webpack_require__(5);
|
18762 |
|
18763 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
18764 |
|
18765 | var msPerFrame = 1000 / 60;
|
18766 |
|
18767 |
|
18768 |
|
18769 |
|
18770 |
|
18771 |
|
18772 |
|
18773 |
|
18774 | function rehydrateStyles(mergedPropsStyles, unreadPropStyles, plainStyles) {
|
18775 |
|
18776 |
|
18777 | var cUnreadPropStyles = unreadPropStyles;
|
18778 | if (cUnreadPropStyles == null) {
|
18779 | return mergedPropsStyles.map(function (mergedPropsStyle, i) {
|
18780 | return {
|
18781 | key: mergedPropsStyle.key,
|
18782 | data: mergedPropsStyle.data,
|
18783 | style: plainStyles[i]
|
18784 | };
|
18785 | });
|
18786 | }
|
18787 | return mergedPropsStyles.map(function (mergedPropsStyle, i) {
|
18788 | for (var j = 0; j < cUnreadPropStyles.length; j++) {
|
18789 | if (cUnreadPropStyles[j].key === mergedPropsStyle.key) {
|
18790 | return {
|
18791 | key: cUnreadPropStyles[j].key,
|
18792 | data: cUnreadPropStyles[j].data,
|
18793 | style: plainStyles[i]
|
18794 | };
|
18795 | }
|
18796 | }
|
18797 | return { key: mergedPropsStyle.key, data: mergedPropsStyle.data, style: plainStyles[i] };
|
18798 | });
|
18799 | }
|
18800 |
|
18801 | function shouldStopAnimationAll(currentStyles, destStyles, currentVelocities, mergedPropsStyles) {
|
18802 | if (mergedPropsStyles.length !== destStyles.length) {
|
18803 | return false;
|
18804 | }
|
18805 |
|
18806 | for (var i = 0; i < mergedPropsStyles.length; i++) {
|
18807 | if (mergedPropsStyles[i].key !== destStyles[i].key) {
|
18808 | return false;
|
18809 | }
|
18810 | }
|
18811 |
|
18812 |
|
18813 |
|
18814 |
|
18815 | for (var i = 0; i < mergedPropsStyles.length; i++) {
|
18816 | if (!_shouldStopAnimation2['default'](currentStyles[i], destStyles[i].style, currentVelocities[i])) {
|
18817 | return false;
|
18818 | }
|
18819 | }
|
18820 |
|
18821 | return true;
|
18822 | }
|
18823 |
|
18824 |
|
18825 |
|
18826 |
|
18827 |
|
18828 |
|
18829 |
|
18830 |
|
18831 |
|
18832 |
|
18833 |
|
18834 |
|
18835 |
|
18836 |
|
18837 |
|
18838 |
|
18839 | function mergeAndSync(willEnter, willLeave, didLeave, oldMergedPropsStyles, destStyles, oldCurrentStyles, oldCurrentVelocities, oldLastIdealStyles, oldLastIdealVelocities) {
|
18840 | var newMergedPropsStyles = _mergeDiff2['default'](oldMergedPropsStyles, destStyles, function (oldIndex, oldMergedPropsStyle) {
|
18841 | var leavingStyle = willLeave(oldMergedPropsStyle);
|
18842 | if (leavingStyle == null) {
|
18843 | didLeave({ key: oldMergedPropsStyle.key, data: oldMergedPropsStyle.data });
|
18844 | return null;
|
18845 | }
|
18846 | if (_shouldStopAnimation2['default'](oldCurrentStyles[oldIndex], leavingStyle, oldCurrentVelocities[oldIndex])) {
|
18847 | didLeave({ key: oldMergedPropsStyle.key, data: oldMergedPropsStyle.data });
|
18848 | return null;
|
18849 | }
|
18850 | return { key: oldMergedPropsStyle.key, data: oldMergedPropsStyle.data, style: leavingStyle };
|
18851 | });
|
18852 |
|
18853 | var newCurrentStyles = [];
|
18854 | var newCurrentVelocities = [];
|
18855 | var newLastIdealStyles = [];
|
18856 | var newLastIdealVelocities = [];
|
18857 | for (var i = 0; i < newMergedPropsStyles.length; i++) {
|
18858 | var newMergedPropsStyleCell = newMergedPropsStyles[i];
|
18859 | var foundOldIndex = null;
|
18860 | for (var j = 0; j < oldMergedPropsStyles.length; j++) {
|
18861 | if (oldMergedPropsStyles[j].key === newMergedPropsStyleCell.key) {
|
18862 | foundOldIndex = j;
|
18863 | break;
|
18864 | }
|
18865 | }
|
18866 |
|
18867 | if (foundOldIndex == null) {
|
18868 | var plainStyle = willEnter(newMergedPropsStyleCell);
|
18869 | newCurrentStyles[i] = plainStyle;
|
18870 | newLastIdealStyles[i] = plainStyle;
|
18871 |
|
18872 | var velocity = _mapToZero2['default'](newMergedPropsStyleCell.style);
|
18873 | newCurrentVelocities[i] = velocity;
|
18874 | newLastIdealVelocities[i] = velocity;
|
18875 | } else {
|
18876 | newCurrentStyles[i] = oldCurrentStyles[foundOldIndex];
|
18877 | newLastIdealStyles[i] = oldLastIdealStyles[foundOldIndex];
|
18878 | newCurrentVelocities[i] = oldCurrentVelocities[foundOldIndex];
|
18879 | newLastIdealVelocities[i] = oldLastIdealVelocities[foundOldIndex];
|
18880 | }
|
18881 | }
|
18882 |
|
18883 | return [newMergedPropsStyles, newCurrentStyles, newCurrentVelocities, newLastIdealStyles, newLastIdealVelocities];
|
18884 | }
|
18885 |
|
18886 | var TransitionMotion = (function (_React$Component) {
|
18887 | _inherits(TransitionMotion, _React$Component);
|
18888 |
|
18889 | _createClass(TransitionMotion, null, [{
|
18890 | key: 'propTypes',
|
18891 | value: {
|
18892 | defaultStyles: _propTypes2['default'].arrayOf(_propTypes2['default'].shape({
|
18893 | key: _propTypes2['default'].string.isRequired,
|
18894 | data: _propTypes2['default'].any,
|
18895 | style: _propTypes2['default'].objectOf(_propTypes2['default'].number).isRequired
|
18896 | })),
|
18897 | styles: _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].arrayOf(_propTypes2['default'].shape({
|
18898 | key: _propTypes2['default'].string.isRequired,
|
18899 | data: _propTypes2['default'].any,
|
18900 | style: _propTypes2['default'].objectOf(_propTypes2['default'].oneOfType([_propTypes2['default'].number, _propTypes2['default'].object])).isRequired
|
18901 | }))]).isRequired,
|
18902 | children: _propTypes2['default'].func.isRequired,
|
18903 | willEnter: _propTypes2['default'].func,
|
18904 | willLeave: _propTypes2['default'].func,
|
18905 | didLeave: _propTypes2['default'].func
|
18906 | },
|
18907 | enumerable: true
|
18908 | }, {
|
18909 | key: 'defaultProps',
|
18910 | value: {
|
18911 | willEnter: function willEnter(styleThatEntered) {
|
18912 | return _stripStyle2['default'](styleThatEntered.style);
|
18913 | },
|
18914 |
|
18915 |
|
18916 | willLeave: function willLeave() {
|
18917 | return null;
|
18918 | },
|
18919 | didLeave: function didLeave() {}
|
18920 | },
|
18921 | enumerable: true
|
18922 | }]);
|
18923 |
|
18924 | function TransitionMotion(props) {
|
18925 | var _this = this;
|
18926 |
|
18927 | _classCallCheck(this, TransitionMotion);
|
18928 |
|
18929 | _React$Component.call(this, props);
|
18930 | this.unmounting = false;
|
18931 | this.animationID = null;
|
18932 | this.prevTime = 0;
|
18933 | this.accumulatedTime = 0;
|
18934 | this.unreadPropStyles = null;
|
18935 |
|
18936 | this.clearUnreadPropStyle = function (unreadPropStyles) {
|
18937 | 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);
|
18938 |
|
18939 | var mergedPropsStyles = _mergeAndSync[0];
|
18940 | var currentStyles = _mergeAndSync[1];
|
18941 | var currentVelocities = _mergeAndSync[2];
|
18942 | var lastIdealStyles = _mergeAndSync[3];
|
18943 | var lastIdealVelocities = _mergeAndSync[4];
|
18944 |
|
18945 | for (var i = 0; i < unreadPropStyles.length; i++) {
|
18946 | var unreadPropStyle = unreadPropStyles[i].style;
|
18947 | var dirty = false;
|
18948 |
|
18949 | for (var key in unreadPropStyle) {
|
18950 | if (!Object.prototype.hasOwnProperty.call(unreadPropStyle, key)) {
|
18951 | continue;
|
18952 | }
|
18953 |
|
18954 | var styleValue = unreadPropStyle[key];
|
18955 | if (typeof styleValue === 'number') {
|
18956 | if (!dirty) {
|
18957 | dirty = true;
|
18958 | currentStyles[i] = _extends({}, currentStyles[i]);
|
18959 | currentVelocities[i] = _extends({}, currentVelocities[i]);
|
18960 | lastIdealStyles[i] = _extends({}, lastIdealStyles[i]);
|
18961 | lastIdealVelocities[i] = _extends({}, lastIdealVelocities[i]);
|
18962 | mergedPropsStyles[i] = {
|
18963 | key: mergedPropsStyles[i].key,
|
18964 | data: mergedPropsStyles[i].data,
|
18965 | style: _extends({}, mergedPropsStyles[i].style)
|
18966 | };
|
18967 | }
|
18968 | currentStyles[i][key] = styleValue;
|
18969 | currentVelocities[i][key] = 0;
|
18970 | lastIdealStyles[i][key] = styleValue;
|
18971 | lastIdealVelocities[i][key] = 0;
|
18972 | mergedPropsStyles[i].style[key] = styleValue;
|
18973 | }
|
18974 | }
|
18975 | }
|
18976 |
|
18977 |
|
18978 |
|
18979 |
|
18980 | _this.setState({
|
18981 | currentStyles: currentStyles,
|
18982 | currentVelocities: currentVelocities,
|
18983 | mergedPropsStyles: mergedPropsStyles,
|
18984 | lastIdealStyles: lastIdealStyles,
|
18985 | lastIdealVelocities: lastIdealVelocities
|
18986 | });
|
18987 | };
|
18988 |
|
18989 | this.startAnimationIfNecessary = function () {
|
18990 | if (_this.unmounting) {
|
18991 | return;
|
18992 | }
|
18993 |
|
18994 |
|
18995 |
|
18996 | _this.animationID = _raf2['default'](function (timestamp) {
|
18997 |
|
18998 |
|
18999 |
|
19000 |
|
19001 |
|
19002 | if (_this.unmounting) {
|
19003 | return;
|
19004 | }
|
19005 |
|
19006 | var propStyles = _this.props.styles;
|
19007 | var destStyles = typeof propStyles === 'function' ? propStyles(rehydrateStyles(_this.state.mergedPropsStyles, _this.unreadPropStyles, _this.state.lastIdealStyles)) : propStyles;
|
19008 |
|
19009 |
|
19010 | if (shouldStopAnimationAll(_this.state.currentStyles, destStyles, _this.state.currentVelocities, _this.state.mergedPropsStyles)) {
|
19011 |
|
19012 | _this.animationID = null;
|
19013 | _this.accumulatedTime = 0;
|
19014 | return;
|
19015 | }
|
19016 |
|
19017 | var currentTime = timestamp || _performanceNow2['default']();
|
19018 | var timeDelta = currentTime - _this.prevTime;
|
19019 | _this.prevTime = currentTime;
|
19020 | _this.accumulatedTime = _this.accumulatedTime + timeDelta;
|
19021 |
|
19022 | if (_this.accumulatedTime > msPerFrame * 10) {
|
19023 | _this.accumulatedTime = 0;
|
19024 | }
|
19025 |
|
19026 | if (_this.accumulatedTime === 0) {
|
19027 |
|
19028 | _this.animationID = null;
|
19029 | _this.startAnimationIfNecessary();
|
19030 | return;
|
19031 | }
|
19032 |
|
19033 | var currentFrameCompletion = (_this.accumulatedTime - Math.floor(_this.accumulatedTime / msPerFrame) * msPerFrame) / msPerFrame;
|
19034 | var framesToCatchUp = Math.floor(_this.accumulatedTime / msPerFrame);
|
19035 |
|
19036 | 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);
|
19037 |
|
19038 | var newMergedPropsStyles = _mergeAndSync2[0];
|
19039 | var newCurrentStyles = _mergeAndSync2[1];
|
19040 | var newCurrentVelocities = _mergeAndSync2[2];
|
19041 | var newLastIdealStyles = _mergeAndSync2[3];
|
19042 | var newLastIdealVelocities = _mergeAndSync2[4];
|
19043 |
|
19044 | for (var i = 0; i < newMergedPropsStyles.length; i++) {
|
19045 | var newMergedPropsStyle = newMergedPropsStyles[i].style;
|
19046 | var newCurrentStyle = {};
|
19047 | var newCurrentVelocity = {};
|
19048 | var newLastIdealStyle = {};
|
19049 | var newLastIdealVelocity = {};
|
19050 |
|
19051 | for (var key in newMergedPropsStyle) {
|
19052 | if (!Object.prototype.hasOwnProperty.call(newMergedPropsStyle, key)) {
|
19053 | continue;
|
19054 | }
|
19055 |
|
19056 | var styleValue = newMergedPropsStyle[key];
|
19057 | if (typeof styleValue === 'number') {
|
19058 | newCurrentStyle[key] = styleValue;
|
19059 | newCurrentVelocity[key] = 0;
|
19060 | newLastIdealStyle[key] = styleValue;
|
19061 | newLastIdealVelocity[key] = 0;
|
19062 | } else {
|
19063 | var newLastIdealStyleValue = newLastIdealStyles[i][key];
|
19064 | var newLastIdealVelocityValue = newLastIdealVelocities[i][key];
|
19065 | for (var j = 0; j < framesToCatchUp; j++) {
|
19066 | var _stepper = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
19067 |
|
19068 | newLastIdealStyleValue = _stepper[0];
|
19069 | newLastIdealVelocityValue = _stepper[1];
|
19070 | }
|
19071 |
|
19072 | var _stepper2 = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision);
|
19073 |
|
19074 | var nextIdealX = _stepper2[0];
|
19075 | var nextIdealV = _stepper2[1];
|
19076 |
|
19077 | newCurrentStyle[key] = newLastIdealStyleValue + (nextIdealX - newLastIdealStyleValue) * currentFrameCompletion;
|
19078 | newCurrentVelocity[key] = newLastIdealVelocityValue + (nextIdealV - newLastIdealVelocityValue) * currentFrameCompletion;
|
19079 | newLastIdealStyle[key] = newLastIdealStyleValue;
|
19080 | newLastIdealVelocity[key] = newLastIdealVelocityValue;
|
19081 | }
|
19082 | }
|
19083 |
|
19084 | newLastIdealStyles[i] = newLastIdealStyle;
|
19085 | newLastIdealVelocities[i] = newLastIdealVelocity;
|
19086 | newCurrentStyles[i] = newCurrentStyle;
|
19087 | newCurrentVelocities[i] = newCurrentVelocity;
|
19088 | }
|
19089 |
|
19090 | _this.animationID = null;
|
19091 |
|
19092 | _this.accumulatedTime -= framesToCatchUp * msPerFrame;
|
19093 |
|
19094 | _this.setState({
|
19095 | currentStyles: newCurrentStyles,
|
19096 | currentVelocities: newCurrentVelocities,
|
19097 | lastIdealStyles: newLastIdealStyles,
|
19098 | lastIdealVelocities: newLastIdealVelocities,
|
19099 | mergedPropsStyles: newMergedPropsStyles
|
19100 | });
|
19101 |
|
19102 | _this.unreadPropStyles = null;
|
19103 |
|
19104 | _this.startAnimationIfNecessary();
|
19105 | });
|
19106 | };
|
19107 |
|
19108 | this.state = this.defaultState();
|
19109 | }
|
19110 |
|
19111 | TransitionMotion.prototype.defaultState = function defaultState() {
|
19112 | var _props = this.props;
|
19113 | var defaultStyles = _props.defaultStyles;
|
19114 | var styles = _props.styles;
|
19115 | var willEnter = _props.willEnter;
|
19116 | var willLeave = _props.willLeave;
|
19117 | var didLeave = _props.didLeave;
|
19118 |
|
19119 | var destStyles = typeof styles === 'function' ? styles(defaultStyles) : styles;
|
19120 |
|
19121 |
|
19122 |
|
19123 |
|
19124 |
|
19125 | var oldMergedPropsStyles = undefined;
|
19126 | if (defaultStyles == null) {
|
19127 | oldMergedPropsStyles = destStyles;
|
19128 | } else {
|
19129 | oldMergedPropsStyles = defaultStyles.map(function (defaultStyleCell) {
|
19130 |
|
19131 | for (var i = 0; i < destStyles.length; i++) {
|
19132 | if (destStyles[i].key === defaultStyleCell.key) {
|
19133 | return destStyles[i];
|
19134 | }
|
19135 | }
|
19136 | return defaultStyleCell;
|
19137 | });
|
19138 | }
|
19139 | var oldCurrentStyles = defaultStyles == null ? destStyles.map(function (s) {
|
19140 | return _stripStyle2['default'](s.style);
|
19141 | }) : defaultStyles.map(function (s) {
|
19142 | return _stripStyle2['default'](s.style);
|
19143 | });
|
19144 | var oldCurrentVelocities = defaultStyles == null ? destStyles.map(function (s) {
|
19145 | return _mapToZero2['default'](s.style);
|
19146 | }) : defaultStyles.map(function (s) {
|
19147 | return _mapToZero2['default'](s.style);
|
19148 | });
|
19149 |
|
19150 | var _mergeAndSync3 = mergeAndSync(
|
19151 |
|
19152 |
|
19153 |
|
19154 | willEnter, willLeave, didLeave, oldMergedPropsStyles, destStyles, oldCurrentStyles, oldCurrentVelocities, oldCurrentStyles,
|
19155 | oldCurrentVelocities);
|
19156 |
|
19157 | var mergedPropsStyles = _mergeAndSync3[0];
|
19158 | var currentStyles = _mergeAndSync3[1];
|
19159 | var currentVelocities = _mergeAndSync3[2];
|
19160 | var lastIdealStyles = _mergeAndSync3[3];
|
19161 | var lastIdealVelocities = _mergeAndSync3[4];
|
19162 |
|
19163 |
|
19164 | return {
|
19165 | currentStyles: currentStyles,
|
19166 | currentVelocities: currentVelocities,
|
19167 | lastIdealStyles: lastIdealStyles,
|
19168 | lastIdealVelocities: lastIdealVelocities,
|
19169 | mergedPropsStyles: mergedPropsStyles
|
19170 | };
|
19171 | };
|
19172 |
|
19173 |
|
19174 |
|
19175 |
|
19176 |
|
19177 | TransitionMotion.prototype.componentDidMount = function componentDidMount() {
|
19178 | this.prevTime = _performanceNow2['default']();
|
19179 | this.startAnimationIfNecessary();
|
19180 | };
|
19181 |
|
19182 | TransitionMotion.prototype.componentWillReceiveProps = function componentWillReceiveProps(props) {
|
19183 | if (this.unreadPropStyles) {
|
19184 |
|
19185 | this.clearUnreadPropStyle(this.unreadPropStyles);
|
19186 | }
|
19187 |
|
19188 | var styles = props.styles;
|
19189 | if (typeof styles === 'function') {
|
19190 | this.unreadPropStyles = styles(rehydrateStyles(this.state.mergedPropsStyles, this.unreadPropStyles, this.state.lastIdealStyles));
|
19191 | } else {
|
19192 | this.unreadPropStyles = styles;
|
19193 | }
|
19194 |
|
19195 | if (this.animationID == null) {
|
19196 | this.prevTime = _performanceNow2['default']();
|
19197 | this.startAnimationIfNecessary();
|
19198 | }
|
19199 | };
|
19200 |
|
19201 | TransitionMotion.prototype.componentWillUnmount = function componentWillUnmount() {
|
19202 | this.unmounting = true;
|
19203 | if (this.animationID != null) {
|
19204 | _raf2['default'].cancel(this.animationID);
|
19205 | this.animationID = null;
|
19206 | }
|
19207 | };
|
19208 |
|
19209 | TransitionMotion.prototype.render = function render() {
|
19210 | var hydratedStyles = rehydrateStyles(this.state.mergedPropsStyles, this.unreadPropStyles, this.state.currentStyles);
|
19211 | var renderedChildren = this.props.children(hydratedStyles);
|
19212 | return renderedChildren && _react2['default'].Children.only(renderedChildren);
|
19213 | };
|
19214 |
|
19215 | return TransitionMotion;
|
19216 | })(_react2['default'].Component);
|
19217 |
|
19218 | exports['default'] = TransitionMotion;
|
19219 | module.exports = exports['default'];
|
19220 |
|
19221 |
|
19222 |
|
19223 |
|
19224 |
|
19225 |
|
19226 |
|
19227 |
|
19228 |
|
19229 |
|
19230 |
|
19231 |
|
19232 |
|
19233 |
|
19234 |
|
19235 |
|
19236 |
|
19237 |
|
19238 | }),
|
19239 |
|
19240 | (function(module, exports) {
|
19241 |
|
19242 |
|
19243 |
|
19244 |
|
19245 |
|
19246 |
|
19247 |
|
19248 |
|
19249 |
|
19250 |
|
19251 |
|
19252 |
|
19253 |
|
19254 |
|
19255 |
|
19256 |
|
19257 |
|
19258 |
|
19259 |
|
19260 | 'use strict';
|
19261 |
|
19262 | exports.__esModule = true;
|
19263 | exports['default'] = mergeDiff;
|
19264 |
|
19265 | function mergeDiff(prev, next, onRemove) {
|
19266 |
|
19267 |
|
19268 |
|
19269 | var prevKeyIndex = {};
|
19270 | for (var i = 0; i < prev.length; i++) {
|
19271 | prevKeyIndex[prev[i].key] = i;
|
19272 | }
|
19273 | var nextKeyIndex = {};
|
19274 | for (var i = 0; i < next.length; i++) {
|
19275 | nextKeyIndex[next[i].key] = i;
|
19276 | }
|
19277 |
|
19278 |
|
19279 |
|
19280 |
|
19281 | var ret = [];
|
19282 | for (var i = 0; i < next.length; i++) {
|
19283 | ret[i] = next[i];
|
19284 | }
|
19285 | for (var i = 0; i < prev.length; i++) {
|
19286 | if (!Object.prototype.hasOwnProperty.call(nextKeyIndex, prev[i].key)) {
|
19287 |
|
19288 |
|
19289 | var fill = onRemove(i, prev[i]);
|
19290 | if (fill != null) {
|
19291 | ret.push(fill);
|
19292 | }
|
19293 | }
|
19294 | }
|
19295 |
|
19296 |
|
19297 | return ret.sort(function (a, b) {
|
19298 | var nextOrderA = nextKeyIndex[a.key];
|
19299 | var nextOrderB = nextKeyIndex[b.key];
|
19300 | var prevOrderA = prevKeyIndex[a.key];
|
19301 | var prevOrderB = prevKeyIndex[b.key];
|
19302 |
|
19303 | if (nextOrderA != null && nextOrderB != null) {
|
19304 |
|
19305 | return nextKeyIndex[a.key] - nextKeyIndex[b.key];
|
19306 | } else if (prevOrderA != null && prevOrderB != null) {
|
19307 |
|
19308 | return prevKeyIndex[a.key] - prevKeyIndex[b.key];
|
19309 | } else if (nextOrderA != null) {
|
19310 |
|
19311 |
|
19312 |
|
19313 |
|
19314 |
|
19315 |
|
19316 | for (var i = 0; i < next.length; i++) {
|
19317 | var pivot = next[i].key;
|
19318 | if (!Object.prototype.hasOwnProperty.call(prevKeyIndex, pivot)) {
|
19319 | continue;
|
19320 | }
|
19321 |
|
19322 | if (nextOrderA < nextKeyIndex[pivot] && prevOrderB > prevKeyIndex[pivot]) {
|
19323 | return -1;
|
19324 | } else if (nextOrderA > nextKeyIndex[pivot] && prevOrderB < prevKeyIndex[pivot]) {
|
19325 | return 1;
|
19326 | }
|
19327 | }
|
19328 |
|
19329 | return 1;
|
19330 | }
|
19331 |
|
19332 | for (var i = 0; i < next.length; i++) {
|
19333 | var pivot = next[i].key;
|
19334 | if (!Object.prototype.hasOwnProperty.call(prevKeyIndex, pivot)) {
|
19335 | continue;
|
19336 | }
|
19337 | if (nextOrderB < nextKeyIndex[pivot] && prevOrderA > prevKeyIndex[pivot]) {
|
19338 | return 1;
|
19339 | } else if (nextOrderB > nextKeyIndex[pivot] && prevOrderA < prevKeyIndex[pivot]) {
|
19340 | return -1;
|
19341 | }
|
19342 | }
|
19343 |
|
19344 | return -1;
|
19345 | });
|
19346 | }
|
19347 |
|
19348 | module.exports = exports['default'];
|
19349 |
|
19350 |
|
19351 | }),
|
19352 |
|
19353 | (function(module, exports, __webpack_require__) {
|
19354 |
|
19355 | 'use strict';
|
19356 |
|
19357 | exports.__esModule = true;
|
19358 |
|
19359 | 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; };
|
19360 |
|
19361 | exports['default'] = spring;
|
19362 |
|
19363 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19364 |
|
19365 | var _presets = __webpack_require__(180);
|
19366 |
|
19367 | var _presets2 = _interopRequireDefault(_presets);
|
19368 |
|
19369 | var defaultConfig = _extends({}, _presets2['default'].noWobble, {
|
19370 | precision: 0.01
|
19371 | });
|
19372 |
|
19373 | function spring(val, config) {
|
19374 | return _extends({}, defaultConfig, config, { val: val });
|
19375 | }
|
19376 |
|
19377 | module.exports = exports['default'];
|
19378 |
|
19379 | }),
|
19380 |
|
19381 | (function(module, exports) {
|
19382 |
|
19383 | "use strict";
|
19384 |
|
19385 | exports.__esModule = true;
|
19386 | exports["default"] = {
|
19387 | noWobble: { stiffness: 170, damping: 26 },
|
19388 | gentle: { stiffness: 120, damping: 14 },
|
19389 | wobbly: { stiffness: 180, damping: 12 },
|
19390 | stiff: { stiffness: 210, damping: 20 }
|
19391 | };
|
19392 | module.exports = exports["default"];
|
19393 |
|
19394 | }),
|
19395 |
|
19396 | (function(module, exports, __webpack_require__) {
|
19397 |
|
19398 | (function(process) {'use strict';
|
19399 |
|
19400 | exports.__esModule = true;
|
19401 | exports['default'] = reorderKeys;
|
19402 |
|
19403 | var hasWarned = false;
|
19404 |
|
19405 | function reorderKeys() {
|
19406 | if (process.env.NODE_ENV === 'development') {
|
19407 | if (!hasWarned) {
|
19408 | hasWarned = true;
|
19409 | console.error('`reorderKeys` has been removed, since it is no longer needed for TransitionMotion\'s new styles array API.');
|
19410 | }
|
19411 | }
|
19412 | }
|
19413 |
|
19414 | module.exports = exports['default'];
|
19415 | }.call(exports, __webpack_require__(33)))
|
19416 |
|
19417 | }),
|
19418 |
|
19419 | (function(module, exports, __webpack_require__) {
|
19420 |
|
19421 | (function webpackUniversalModuleDefinition(root, factory) {
|
19422 | if(true)
|
19423 | module.exports = factory(__webpack_require__(12), __webpack_require__(4));
|
19424 | else if(typeof define === 'function' && define.amd)
|
19425 | define(["react-dom", "react"], factory);
|
19426 | else if(typeof exports === 'object')
|
19427 | exports["ReactDraggable"] = factory(require("react-dom"), require("react"));
|
19428 | else
|
19429 | root["ReactDraggable"] = factory(root["ReactDOM"], root["React"]);
|
19430 | })(this, function(__WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_6__) {
|
19431 | return (function(modules) {
|
19432 |
|
19433 | var installedModules = {};
|
19434 |
|
19435 |
|
19436 | function __webpack_require__(moduleId) {
|
19437 |
|
19438 |
|
19439 | if(installedModules[moduleId]) {
|
19440 | return installedModules[moduleId].exports;
|
19441 | }
|
19442 |
|
19443 | var module = installedModules[moduleId] = {
|
19444 | i: moduleId,
|
19445 | l: false,
|
19446 | exports: {}
|
19447 | };
|
19448 |
|
19449 |
|
19450 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
19451 |
|
19452 |
|
19453 | module.l = true;
|
19454 |
|
19455 |
|
19456 | return module.exports;
|
19457 | }
|
19458 |
|
19459 |
|
19460 |
|
19461 | __webpack_require__.m = modules;
|
19462 |
|
19463 |
|
19464 | __webpack_require__.c = installedModules;
|
19465 |
|
19466 |
|
19467 | __webpack_require__.d = function(exports, name, getter) {
|
19468 | if(!__webpack_require__.o(exports, name)) {
|
19469 | Object.defineProperty(exports, name, {
|
19470 | configurable: false,
|
19471 | enumerable: true,
|
19472 | get: getter
|
19473 | /******/ });
|
19474 | /******/ }
|
19475 | /******/ };
|
19476 | /******/
|
19477 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
19478 | /******/ __webpack_require__.n = function(module) {
|
19479 | var getter = module && module.__esModule ?
|
19480 | function getDefault() { return module['default']; } :
|
19481 | function getModuleExports() { return module; };
|
19482 | __webpack_require__.d(getter, 'a', getter);
|
19483 | return getter;
|
19484 | };
|
19485 |
|
19486 |
|
19487 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
19488 |
|
19489 |
|
19490 | __webpack_require__.p = "";
|
19491 |
|
19492 |
|
19493 | return __webpack_require__(__webpack_require__.s = 12);
|
19494 | })
|
19495 |
|
19496 | ([
|
19497 |
|
19498 | (function(module, exports, __webpack_require__) {
|
19499 |
|
19500 | "use strict";
|
19501 |
|
19502 |
|
19503 | Object.defineProperty(exports, "__esModule", {
|
19504 | value: true
|
19505 | });
|
19506 | exports.findInArray = findInArray;
|
19507 | exports.isFunction = isFunction;
|
19508 | exports.isNum = isNum;
|
19509 | exports.int = int;
|
19510 | exports.dontSetMe = dontSetMe;
|
19511 |
|
19512 |
|
19513 | function findInArray(array /*: Array<any> | TouchList*/, callback /*: Function*/) /*: any*/ {
|
19514 | for (var i = 0, length = array.length; i < length; i++) {
|
19515 | if (callback.apply(callback, [array[i], i, array])) return array[i];
|
19516 | }
|
19517 | }
|
19518 |
|
19519 | function isFunction(func /*: any*/) /*: boolean*/ {
|
19520 | return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';
|
19521 | }
|
19522 |
|
19523 | function isNum(num /*: any*/) /*: boolean*/ {
|
19524 | return typeof num === 'number' && !isNaN(num);
|
19525 | }
|
19526 |
|
19527 | function int(a /*: string*/) /*: number*/ {
|
19528 | return parseInt(a, 10);
|
19529 | }
|
19530 |
|
19531 | function dontSetMe(props /*: Object*/, propName /*: string*/, componentName /*: string*/) {
|
19532 | if (props[propName]) {
|
19533 | return new Error('Invalid prop ' + propName + ' passed to ' + componentName + ' - do not set this, set it on the child.');
|
19534 | }
|
19535 | }
|
19536 |
|
19537 | }),
|
19538 |
|
19539 | (function(module, exports, __webpack_require__) {
|
19540 |
|
19541 | "use strict";
|
19542 |
|
19543 |
|
19544 | |
19545 |
|
19546 |
|
19547 |
|
19548 |
|
19549 |
|
19550 |
|
19551 |
|
19552 |
|
19553 | function makeEmptyFunction(arg) {
|
19554 | return function () {
|
19555 | return arg;
|
19556 | };
|
19557 | }
|
19558 |
|
19559 | |
19560 |
|
19561 |
|
19562 |
|
19563 |
|
19564 | var emptyFunction = function emptyFunction() {};
|
19565 |
|
19566 | emptyFunction.thatReturns = makeEmptyFunction;
|
19567 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
19568 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
19569 | emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
19570 | emptyFunction.thatReturnsThis = function () {
|
19571 | return this;
|
19572 | };
|
19573 | emptyFunction.thatReturnsArgument = function (arg) {
|
19574 | return arg;
|
19575 | };
|
19576 |
|
19577 | module.exports = emptyFunction;
|
19578 |
|
19579 | }),
|
19580 |
|
19581 | (function(module, exports, __webpack_require__) {
|
19582 |
|
19583 | "use strict";
|
19584 | |
19585 |
|
19586 |
|
19587 |
|
19588 |
|
19589 |
|
19590 |
|
19591 |
|
19592 |
|
19593 |
|
19594 | |
19595 |
|
19596 |
|
19597 |
|
19598 |
|
19599 |
|
19600 |
|
19601 |
|
19602 |
|
19603 |
|
19604 |
|
19605 | var validateFormat = function validateFormat(format) {};
|
19606 |
|
19607 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
19608 | validateFormat = function validateFormat(format) {
|
19609 | if (format === undefined) {
|
19610 | throw new Error('invariant requires an error message argument');
|
19611 | }
|
19612 | };
|
19613 | }
|
19614 |
|
19615 | function invariant(condition, format, a, b, c, d, e, f) {
|
19616 | validateFormat(format);
|
19617 |
|
19618 | if (!condition) {
|
19619 | var error;
|
19620 | if (format === undefined) {
|
19621 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
19622 | } else {
|
19623 | var args = [a, b, c, d, e, f];
|
19624 | var argIndex = 0;
|
19625 | error = new Error(format.replace(/%s/g, function () {
|
19626 | return args[argIndex++];
|
19627 | }));
|
19628 | error.name = 'Invariant Violation';
|
19629 | }
|
19630 |
|
19631 | error.framesToPop = 1;
|
19632 | throw error;
|
19633 | }
|
19634 | }
|
19635 |
|
19636 | module.exports = invariant;
|
19637 |
|
19638 | }),
|
19639 |
|
19640 | (function(module, exports, __webpack_require__) {
|
19641 |
|
19642 | "use strict";
|
19643 | |
19644 |
|
19645 |
|
19646 |
|
19647 |
|
19648 |
|
19649 |
|
19650 |
|
19651 |
|
19652 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
19653 |
|
19654 | module.exports = ReactPropTypesSecret;
|
19655 |
|
19656 |
|
19657 | }),
|
19658 |
|
19659 | (function(module, exports) {
|
19660 |
|
19661 | module.exports = __WEBPACK_EXTERNAL_MODULE_4__;
|
19662 |
|
19663 | }),
|
19664 |
|
19665 | (function(module, exports, __webpack_require__) {
|
19666 |
|
19667 | "use strict";
|
19668 |
|
19669 |
|
19670 | Object.defineProperty(exports, "__esModule", {
|
19671 | value: true
|
19672 | });
|
19673 |
|
19674 | 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; };
|
19675 |
|
19676 | exports.matchesSelector = matchesSelector;
|
19677 | exports.matchesSelectorAndParentsTo = matchesSelectorAndParentsTo;
|
19678 | exports.addEvent = addEvent;
|
19679 | exports.removeEvent = removeEvent;
|
19680 | exports.outerHeight = outerHeight;
|
19681 | exports.outerWidth = outerWidth;
|
19682 | exports.innerHeight = innerHeight;
|
19683 | exports.innerWidth = innerWidth;
|
19684 | exports.offsetXYFromParent = offsetXYFromParent;
|
19685 | exports.createCSSTransform = createCSSTransform;
|
19686 | exports.createSVGTransform = createSVGTransform;
|
19687 | exports.getTouch = getTouch;
|
19688 | exports.getTouchIdentifier = getTouchIdentifier;
|
19689 | exports.addUserSelectStyles = addUserSelectStyles;
|
19690 | exports.removeUserSelectStyles = removeUserSelectStyles;
|
19691 | exports.styleHacks = styleHacks;
|
19692 | exports.addClassName = addClassName;
|
19693 | exports.removeClassName = removeClassName;
|
19694 |
|
19695 | var _shims = __webpack_require__(0);
|
19696 |
|
19697 | var _getPrefix = __webpack_require__(19);
|
19698 |
|
19699 | var _getPrefix2 = _interopRequireDefault(_getPrefix);
|
19700 |
|
19701 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19702 |
|
19703 | 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; }
|
19704 |
|
19705 |
|
19706 |
|
19707 |
|
19708 | var matchesSelectorFunc = '';
|
19709 | function matchesSelector(el /*: Node*/, selector /*: string*/) /*: boolean*/ {
|
19710 | if (!matchesSelectorFunc) {
|
19711 | matchesSelectorFunc = (0, _shims.findInArray)(['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'], function (method) {
|
19712 |
|
19713 | return (0, _shims.isFunction)(el[method]);
|
19714 | });
|
19715 | }
|
19716 |
|
19717 |
|
19718 |
|
19719 | if (!(0, _shims.isFunction)(el[matchesSelectorFunc])) return false;
|
19720 |
|
19721 |
|
19722 | return el[matchesSelectorFunc](selector);
|
19723 | }
|
19724 |
|
19725 |
|
19726 | function matchesSelectorAndParentsTo(el /*: Node*/, selector /*: string*/, baseNode /*: Node*/) /*: boolean*/ {
|
19727 | var node = el;
|
19728 | do {
|
19729 | if (matchesSelector(node, selector)) return true;
|
19730 | if (node === baseNode) return false;
|
19731 | node = node.parentNode;
|
19732 | } while (node);
|
19733 |
|
19734 | return false;
|
19735 | }
|
19736 |
|
19737 | function addEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ {
|
19738 | if (!el) {
|
19739 | return;
|
19740 | }
|
19741 | if (el.attachEvent) {
|
19742 | el.attachEvent('on' + event, handler);
|
19743 | } else if (el.addEventListener) {
|
19744 | el.addEventListener(event, handler, true);
|
19745 | } else {
|
19746 |
|
19747 | el['on' + event] = handler;
|
19748 | }
|
19749 | }
|
19750 |
|
19751 | function removeEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ {
|
19752 | if (!el) {
|
19753 | return;
|
19754 | }
|
19755 | if (el.detachEvent) {
|
19756 | el.detachEvent('on' + event, handler);
|
19757 | } else if (el.removeEventListener) {
|
19758 | el.removeEventListener(event, handler, true);
|
19759 | } else {
|
19760 |
|
19761 | el['on' + event] = null;
|
19762 | }
|
19763 | }
|
19764 |
|
19765 | function outerHeight(node /*: HTMLElement*/) /*: number*/ {
|
19766 |
|
19767 |
|
19768 | var height = node.clientHeight;
|
19769 | var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
19770 | height += (0, _shims.int)(computedStyle.borderTopWidth);
|
19771 | height += (0, _shims.int)(computedStyle.borderBottomWidth);
|
19772 | return height;
|
19773 | }
|
19774 |
|
19775 | function outerWidth(node /*: HTMLElement*/) /*: number*/ {
|
19776 |
|
19777 |
|
19778 | var width = node.clientWidth;
|
19779 | var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
19780 | width += (0, _shims.int)(computedStyle.borderLeftWidth);
|
19781 | width += (0, _shims.int)(computedStyle.borderRightWidth);
|
19782 | return width;
|
19783 | }
|
19784 | function innerHeight(node /*: HTMLElement*/) /*: number*/ {
|
19785 | var height = node.clientHeight;
|
19786 | var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
19787 | height -= (0, _shims.int)(computedStyle.paddingTop);
|
19788 | height -= (0, _shims.int)(computedStyle.paddingBottom);
|
19789 | return height;
|
19790 | }
|
19791 |
|
19792 | function innerWidth(node /*: HTMLElement*/) /*: number*/ {
|
19793 | var width = node.clientWidth;
|
19794 | var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
19795 | width -= (0, _shims.int)(computedStyle.paddingLeft);
|
19796 | width -= (0, _shims.int)(computedStyle.paddingRight);
|
19797 | return width;
|
19798 | }
|
19799 |
|
19800 |
|
19801 | function offsetXYFromParent(evt /*: {clientX: number, clientY: number}*/, offsetParent /*: HTMLElement*/) /*: ControlPosition*/ {
|
19802 | var isBody = offsetParent === offsetParent.ownerDocument.body;
|
19803 | var offsetParentRect = isBody ? { left: 0, top: 0 } : offsetParent.getBoundingClientRect();
|
19804 |
|
19805 | var x = evt.clientX + offsetParent.scrollLeft - offsetParentRect.left;
|
19806 | var y = evt.clientY + offsetParent.scrollTop - offsetParentRect.top;
|
19807 |
|
19808 | return { x: x, y: y };
|
19809 | }
|
19810 |
|
19811 | function createCSSTransform(_ref) /*: Object*/ {
|
19812 | var x = _ref.x,
|
19813 | y = _ref.y;
|
19814 |
|
19815 |
|
19816 | return _defineProperty({}, (0, _getPrefix.browserPrefixToKey)('transform', _getPrefix2.default), 'translate(' + x + 'px,' + y + 'px)');
|
19817 | }
|
19818 |
|
19819 | function createSVGTransform(_ref3) /*: string*/ {
|
19820 | var x = _ref3.x,
|
19821 | y = _ref3.y;
|
19822 |
|
19823 | return 'translate(' + x + ',' + y + ')';
|
19824 | }
|
19825 |
|
19826 | function getTouch(e /*: MouseTouchEvent*/, identifier /*: number*/) /*: ?{clientX: number, clientY: number}*/ {
|
19827 | return e.targetTouches && (0, _shims.findInArray)(e.targetTouches, function (t) {
|
19828 | return identifier === t.identifier;
|
19829 | }) || e.changedTouches && (0, _shims.findInArray)(e.changedTouches, function (t) {
|
19830 | return identifier === t.identifier;
|
19831 | });
|
19832 | }
|
19833 |
|
19834 | function getTouchIdentifier(e /*: MouseTouchEvent*/) /*: ?number*/ {
|
19835 | if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier;
|
19836 | if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier;
|
19837 | }
|
19838 |
|
19839 |
|
19840 |
|
19841 |
|
19842 |
|
19843 |
|
19844 | function addUserSelectStyles(doc /*: ?Document*/) {
|
19845 | if (!doc) return;
|
19846 | var styleEl = doc.getElementById('react-draggable-style-el');
|
19847 | if (!styleEl) {
|
19848 | styleEl = doc.createElement('style');
|
19849 | styleEl.type = 'text/css';
|
19850 | styleEl.id = 'react-draggable-style-el';
|
19851 | styleEl.innerHTML = '.react-draggable-transparent-selection *::-moz-selection {background: transparent;}\n';
|
19852 | styleEl.innerHTML += '.react-draggable-transparent-selection *::selection {background: transparent;}\n';
|
19853 | doc.getElementsByTagName('head')[0].appendChild(styleEl);
|
19854 | }
|
19855 | if (doc.body) addClassName(doc.body, 'react-draggable-transparent-selection');
|
19856 | }
|
19857 |
|
19858 | function removeUserSelectStyles(doc /*: ?Document*/) {
|
19859 | try {
|
19860 | if (doc && doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection');
|
19861 | window.getSelection().removeAllRanges();
|
19862 | } catch (e) {
|
19863 |
|
19864 | }
|
19865 | }
|
19866 |
|
19867 | function styleHacks() /*: Object*/ {
|
19868 | var childStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
19869 |
|
19870 |
|
19871 |
|
19872 | return _extends({
|
19873 | touchAction: 'none'
|
19874 | }, childStyle);
|
19875 | }
|
19876 |
|
19877 | function addClassName(el /*: HTMLElement*/, className /*: string*/) {
|
19878 | if (el.classList) {
|
19879 | el.classList.add(className);
|
19880 | } else {
|
19881 | if (!el.className.match(new RegExp('(?:^|\\s)' + className + '(?!\\S)'))) {
|
19882 | el.className += ' ' + className;
|
19883 | }
|
19884 | }
|
19885 | }
|
19886 |
|
19887 | function removeClassName(el /*: HTMLElement*/, className /*: string*/) {
|
19888 | if (el.classList) {
|
19889 | el.classList.remove(className);
|
19890 | } else {
|
19891 | el.className = el.className.replace(new RegExp('(?:^|\\s)' + className + '(?!\\S)', 'g'), '');
|
19892 | }
|
19893 | }
|
19894 |
|
19895 | }),
|
19896 |
|
19897 | (function(module, exports) {
|
19898 |
|
19899 | module.exports = __WEBPACK_EXTERNAL_MODULE_6__;
|
19900 |
|
19901 | }),
|
19902 |
|
19903 | (function(module, exports, __webpack_require__) {
|
19904 |
|
19905 | |
19906 |
|
19907 |
|
19908 |
|
19909 |
|
19910 |
|
19911 |
|
19912 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
19913 | var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
|
19914 | Symbol.for &&
|
19915 | Symbol.for('react.element')) ||
|
19916 | 0xeac7;
|
19917 |
|
19918 | var isValidElement = function(object) {
|
19919 | return typeof object === 'object' &&
|
19920 | object !== null &&
|
19921 | object.$$typeof === REACT_ELEMENT_TYPE;
|
19922 | };
|
19923 |
|
19924 |
|
19925 |
|
19926 | var throwOnDirectAccess = true;
|
19927 | module.exports = __webpack_require__(14)(isValidElement, throwOnDirectAccess);
|
19928 | } else {
|
19929 |
|
19930 |
|
19931 | module.exports = __webpack_require__(17)();
|
19932 | }
|
19933 |
|
19934 |
|
19935 | }),
|
19936 |
|
19937 | (function(module, exports, __webpack_require__) {
|
19938 |
|
19939 | "use strict";
|
19940 | |
19941 |
|
19942 |
|
19943 |
|
19944 |
|
19945 |
|
19946 |
|
19947 |
|
19948 |
|
19949 |
|
19950 | var emptyFunction = __webpack_require__(1);
|
19951 |
|
19952 | |
19953 |
|
19954 |
|
19955 |
|
19956 |
|
19957 |
|
19958 |
|
19959 | var warning = emptyFunction;
|
19960 |
|
19961 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
19962 | var printWarning = function printWarning(format) {
|
19963 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
19964 | args[_key - 1] = arguments[_key];
|
19965 | }
|
19966 |
|
19967 | var argIndex = 0;
|
19968 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
19969 | return args[argIndex++];
|
19970 | });
|
19971 | if (typeof console !== 'undefined') {
|
19972 | console.error(message);
|
19973 | }
|
19974 | try {
|
19975 |
|
19976 |
|
19977 |
|
19978 | throw new Error(message);
|
19979 | } catch (x) {}
|
19980 | };
|
19981 |
|
19982 | warning = function warning(condition, format) {
|
19983 | if (format === undefined) {
|
19984 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
19985 | }
|
19986 |
|
19987 | if (format.indexOf('Failed Composite propType: ') === 0) {
|
19988 | return;
|
19989 | }
|
19990 |
|
19991 | if (!condition) {
|
19992 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
19993 | args[_key2 - 2] = arguments[_key2];
|
19994 | }
|
19995 |
|
19996 | printWarning.apply(undefined, [format].concat(args));
|
19997 | }
|
19998 | };
|
19999 | }
|
20000 |
|
20001 | module.exports = warning;
|
20002 |
|
20003 | }),
|
20004 |
|
20005 | (function(module, exports, __webpack_require__) {
|
20006 |
|
20007 | "use strict";
|
20008 |
|
20009 |
|
20010 | Object.defineProperty(exports, "__esModule", {
|
20011 | value: true
|
20012 | });
|
20013 | exports.getBoundPosition = getBoundPosition;
|
20014 | exports.snapToGrid = snapToGrid;
|
20015 | exports.canDragX = canDragX;
|
20016 | exports.canDragY = canDragY;
|
20017 | exports.getControlPosition = getControlPosition;
|
20018 | exports.createCoreData = createCoreData;
|
20019 | exports.createDraggableData = createDraggableData;
|
20020 |
|
20021 | var _shims = __webpack_require__(0);
|
20022 |
|
20023 | var _reactDom = __webpack_require__(4);
|
20024 |
|
20025 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
20026 |
|
20027 | var _domFns = __webpack_require__(5);
|
20028 |
|
20029 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20030 |
|
20031 |
|
20032 |
|
20033 |
|
20034 | function getBoundPosition(draggable /*: Draggable*/, x /*: number*/, y /*: number*/) /*: [number, number]*/ {
|
20035 |
|
20036 | if (!draggable.props.bounds) return [x, y];
|
20037 |
|
20038 |
|
20039 | var bounds = draggable.props.bounds;
|
20040 |
|
20041 | bounds = typeof bounds === 'string' ? bounds : cloneBounds(bounds);
|
20042 | var node = findDOMNode(draggable);
|
20043 |
|
20044 | if (typeof bounds === 'string') {
|
20045 | var ownerDocument = node.ownerDocument;
|
20046 |
|
20047 | var ownerWindow = ownerDocument.defaultView;
|
20048 | var boundNode = void 0;
|
20049 | if (bounds === 'parent') {
|
20050 | boundNode = node.parentNode;
|
20051 | } else {
|
20052 | boundNode = ownerDocument.querySelector(bounds);
|
20053 | }
|
20054 | if (!(boundNode instanceof HTMLElement)) {
|
20055 | throw new Error('Bounds selector "' + bounds + '" could not find an element.');
|
20056 | }
|
20057 | var nodeStyle = ownerWindow.getComputedStyle(node);
|
20058 | var boundNodeStyle = ownerWindow.getComputedStyle(boundNode);
|
20059 |
|
20060 | bounds = {
|
20061 | left: -node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingLeft) + (0, _shims.int)(nodeStyle.marginLeft),
|
20062 | top: -node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingTop) + (0, _shims.int)(nodeStyle.marginTop),
|
20063 | right: (0, _domFns.innerWidth)(boundNode) - (0, _domFns.outerWidth)(node) - node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingRight) - (0, _shims.int)(nodeStyle.marginRight),
|
20064 | bottom: (0, _domFns.innerHeight)(boundNode) - (0, _domFns.outerHeight)(node) - node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingBottom) - (0, _shims.int)(nodeStyle.marginBottom)
|
20065 | };
|
20066 | }
|
20067 |
|
20068 |
|
20069 | if ((0, _shims.isNum)(bounds.right)) x = Math.min(x, bounds.right);
|
20070 | if ((0, _shims.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom);
|
20071 |
|
20072 |
|
20073 | if ((0, _shims.isNum)(bounds.left)) x = Math.max(x, bounds.left);
|
20074 | if ((0, _shims.isNum)(bounds.top)) y = Math.max(y, bounds.top);
|
20075 |
|
20076 | return [x, y];
|
20077 | }
|
20078 |
|
20079 | function snapToGrid(grid /*: [number, number]*/, pendingX /*: number*/, pendingY /*: number*/) /*: [number, number]*/ {
|
20080 | var x = Math.round(pendingX / grid[0]) * grid[0];
|
20081 | var y = Math.round(pendingY / grid[1]) * grid[1];
|
20082 | return [x, y];
|
20083 | }
|
20084 |
|
20085 | function canDragX(draggable /*: Draggable*/) /*: boolean*/ {
|
20086 | return draggable.props.axis === 'both' || draggable.props.axis === 'x';
|
20087 | }
|
20088 |
|
20089 | function canDragY(draggable /*: Draggable*/) /*: boolean*/ {
|
20090 | return draggable.props.axis === 'both' || draggable.props.axis === 'y';
|
20091 | }
|
20092 |
|
20093 |
|
20094 | function getControlPosition(e /*: MouseTouchEvent*/, touchIdentifier /*: ?number*/, draggableCore /*: DraggableCore*/) /*: ?ControlPosition*/ {
|
20095 | var touchObj = typeof touchIdentifier === 'number' ? (0, _domFns.getTouch)(e, touchIdentifier) : null;
|
20096 | if (typeof touchIdentifier === 'number' && !touchObj) return null;
|
20097 | var node = findDOMNode(draggableCore);
|
20098 |
|
20099 | var offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;
|
20100 | return (0, _domFns.offsetXYFromParent)(touchObj || e, offsetParent);
|
20101 | }
|
20102 |
|
20103 |
|
20104 | function createCoreData(draggable /*: DraggableCore*/, x /*: number*/, y /*: number*/) /*: DraggableData*/ {
|
20105 | var state = draggable.state;
|
20106 | var isStart = !(0, _shims.isNum)(state.lastX);
|
20107 | var node = findDOMNode(draggable);
|
20108 |
|
20109 | if (isStart) {
|
20110 |
|
20111 | return {
|
20112 | node: node,
|
20113 | deltaX: 0, deltaY: 0,
|
20114 | lastX: x, lastY: y,
|
20115 | x: x, y: y
|
20116 | };
|
20117 | } else {
|
20118 |
|
20119 | return {
|
20120 | node: node,
|
20121 | deltaX: x - state.lastX, deltaY: y - state.lastY,
|
20122 | lastX: state.lastX, lastY: state.lastY,
|
20123 | x: x, y: y
|
20124 | };
|
20125 | }
|
20126 | }
|
20127 |
|
20128 |
|
20129 | function createDraggableData(draggable /*: Draggable*/, coreData /*: DraggableData*/) /*: DraggableData*/ {
|
20130 | return {
|
20131 | node: coreData.node,
|
20132 | x: draggable.state.x + coreData.deltaX,
|
20133 | y: draggable.state.y + coreData.deltaY,
|
20134 | deltaX: coreData.deltaX,
|
20135 | deltaY: coreData.deltaY,
|
20136 | lastX: draggable.state.x,
|
20137 | lastY: draggable.state.y
|
20138 | };
|
20139 | }
|
20140 |
|
20141 |
|
20142 | function cloneBounds(bounds /*: Bounds*/) /*: Bounds*/ {
|
20143 | return {
|
20144 | left: bounds.left,
|
20145 | top: bounds.top,
|
20146 | right: bounds.right,
|
20147 | bottom: bounds.bottom
|
20148 | };
|
20149 | }
|
20150 |
|
20151 | function findDOMNode(draggable /*: Draggable | DraggableCore*/) /*: HTMLElement*/ {
|
20152 | var node = _reactDom2.default.findDOMNode(draggable);
|
20153 | if (!node) {
|
20154 | throw new Error('<DraggableCore>: Unmounted during event!');
|
20155 | }
|
20156 |
|
20157 | return node;
|
20158 | }
|
20159 |
|
20160 | }),
|
20161 |
|
20162 | (function(module, exports, __webpack_require__) {
|
20163 |
|
20164 | "use strict";
|
20165 | (function(process) {
|
20166 |
|
20167 | Object.defineProperty(exports, "__esModule", {
|
20168 | value: true
|
20169 | });
|
20170 |
|
20171 | 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"); } }; }();
|
20172 |
|
20173 | 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; }; }();
|
20174 |
|
20175 | var _react = __webpack_require__(6);
|
20176 |
|
20177 | var _react2 = _interopRequireDefault(_react);
|
20178 |
|
20179 | var _propTypes = __webpack_require__(7);
|
20180 |
|
20181 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
20182 |
|
20183 | var _reactDom = __webpack_require__(4);
|
20184 |
|
20185 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
20186 |
|
20187 | var _domFns = __webpack_require__(5);
|
20188 |
|
20189 | var _positionFns = __webpack_require__(9);
|
20190 |
|
20191 | var _shims = __webpack_require__(0);
|
20192 |
|
20193 | var _log = __webpack_require__(11);
|
20194 |
|
20195 | var _log2 = _interopRequireDefault(_log);
|
20196 |
|
20197 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20198 |
|
20199 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
20200 |
|
20201 | 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; }
|
20202 |
|
20203 | 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; }
|
20204 |
|
20205 |
|
20206 |
|
20207 |
|
20208 |
|
20209 |
|
20210 | var eventsFor = {
|
20211 | touch: {
|
20212 | start: 'touchstart',
|
20213 | move: 'touchmove',
|
20214 | stop: 'touchend'
|
20215 | },
|
20216 | mouse: {
|
20217 | start: 'mousedown',
|
20218 | move: 'mousemove',
|
20219 | stop: 'mouseup'
|
20220 | }
|
20221 | };
|
20222 |
|
20223 |
|
20224 | var dragEventFor = eventsFor.mouse;
|
20225 |
|
20226 | |
20227 |
|
20228 |
|
20229 |
|
20230 |
|
20231 |
|
20232 | |
20233 |
|
20234 |
|
20235 |
|
20236 |
|
20237 |
|
20238 | |
20239 |
|
20240 |
|
20241 |
|
20242 |
|
20243 |
|
20244 |
|
20245 |
|
20246 |
|
20247 |
|
20248 |
|
20249 |
|
20250 |
|
20251 |
|
20252 |
|
20253 |
|
20254 |
|
20255 | |
20256 |
|
20257 |
|
20258 |
|
20259 |
|
20260 |
|
20261 |
|
20262 |
|
20263 |
|
20264 |
|
20265 |
|
20266 |
|
20267 |
|
20268 |
|
20269 |
|
20270 | var DraggableCore = function (_React$Component) {
|
20271 | _inherits(DraggableCore, _React$Component);
|
20272 |
|
20273 | function DraggableCore() {
|
20274 | var _ref;
|
20275 |
|
20276 | var _temp, _this, _ret;
|
20277 |
|
20278 | _classCallCheck(this, DraggableCore);
|
20279 |
|
20280 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
20281 | args[_key] = arguments[_key];
|
20282 | }
|
20283 |
|
20284 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = DraggableCore.__proto__ || Object.getPrototypeOf(DraggableCore)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
20285 | dragging: false,
|
20286 |
|
20287 | lastX: NaN, lastY: NaN,
|
20288 | touchIdentifier: null
|
20289 | }, _this.handleDragStart = function (e) {
|
20290 |
|
20291 | _this.props.onMouseDown(e);
|
20292 |
|
20293 |
|
20294 | if (!_this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false;
|
20295 |
|
20296 |
|
20297 | var thisNode = _reactDom2.default.findDOMNode(_this);
|
20298 | if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) {
|
20299 | throw new Error('<DraggableCore> not mounted on DragStart!');
|
20300 | }
|
20301 | var ownerDocument = thisNode.ownerDocument;
|
20302 |
|
20303 |
|
20304 |
|
20305 | 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)) {
|
20306 | return;
|
20307 | }
|
20308 |
|
20309 |
|
20310 |
|
20311 |
|
20312 | var touchIdentifier = (0, _domFns.getTouchIdentifier)(e);
|
20313 | _this.setState({ touchIdentifier: touchIdentifier });
|
20314 |
|
20315 |
|
20316 | var position = (0, _positionFns.getControlPosition)(e, touchIdentifier, _this);
|
20317 | if (position == null) return;
|
20318 | var x = position.x,
|
20319 | y = position.y;
|
20320 |
|
20321 |
|
20322 |
|
20323 | var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
|
20324 |
|
20325 | (0, _log2.default)('DraggableCore: handleDragStart: %j', coreEvent);
|
20326 |
|
20327 |
|
20328 | (0, _log2.default)('calling', _this.props.onStart);
|
20329 | var shouldUpdate = _this.props.onStart(e, coreEvent);
|
20330 | if (shouldUpdate === false) return;
|
20331 |
|
20332 |
|
20333 |
|
20334 | if (_this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)(ownerDocument);
|
20335 |
|
20336 |
|
20337 |
|
20338 |
|
20339 | _this.setState({
|
20340 | dragging: true,
|
20341 |
|
20342 | lastX: x,
|
20343 | lastY: y
|
20344 | });
|
20345 |
|
20346 |
|
20347 |
|
20348 |
|
20349 | (0, _domFns.addEvent)(ownerDocument, dragEventFor.move, _this.handleDrag);
|
20350 | (0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, _this.handleDragStop);
|
20351 | }, _this.handleDrag = function (e) {
|
20352 |
|
20353 |
|
20354 | if (e.type === 'touchmove') e.preventDefault();
|
20355 |
|
20356 |
|
20357 | var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _this);
|
20358 | if (position == null) return;
|
20359 | var x = position.x,
|
20360 | y = position.y;
|
20361 |
|
20362 |
|
20363 |
|
20364 | if (Array.isArray(_this.props.grid)) {
|
20365 | var _deltaX = x - _this.state.lastX,
|
20366 | _deltaY = y - _this.state.lastY;
|
20367 |
|
20368 | var _snapToGrid = (0, _positionFns.snapToGrid)(_this.props.grid, _deltaX, _deltaY);
|
20369 |
|
20370 | var _snapToGrid2 = _slicedToArray(_snapToGrid, 2);
|
20371 |
|
20372 | _deltaX = _snapToGrid2[0];
|
20373 | _deltaY = _snapToGrid2[1];
|
20374 |
|
20375 | if (!_deltaX && !_deltaY) return;
|
20376 | x = _this.state.lastX + _deltaX, y = _this.state.lastY + _deltaY;
|
20377 | }
|
20378 |
|
20379 | var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
|
20380 |
|
20381 | (0, _log2.default)('DraggableCore: handleDrag: %j', coreEvent);
|
20382 |
|
20383 |
|
20384 | var shouldUpdate = _this.props.onDrag(e, coreEvent);
|
20385 | if (shouldUpdate === false) {
|
20386 | try {
|
20387 |
|
20388 | _this.handleDragStop(new MouseEvent('mouseup'));
|
20389 | } catch (err) {
|
20390 |
|
20391 | var event = ((document.createEvent('MouseEvents') ) );
|
20392 |
|
20393 |
|
20394 | event.initMouseEvent('mouseup', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
20395 | _this.handleDragStop(event);
|
20396 | }
|
20397 | return;
|
20398 | }
|
20399 |
|
20400 | _this.setState({
|
20401 | lastX: x,
|
20402 | lastY: y
|
20403 | });
|
20404 | }, _this.handleDragStop = function (e) {
|
20405 | if (!_this.state.dragging) return;
|
20406 |
|
20407 | var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _this);
|
20408 | if (position == null) return;
|
20409 | var x = position.x,
|
20410 | y = position.y;
|
20411 |
|
20412 | var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
|
20413 |
|
20414 | var thisNode = _reactDom2.default.findDOMNode(_this);
|
20415 | if (thisNode) {
|
20416 |
|
20417 | if (_this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(thisNode.ownerDocument);
|
20418 | }
|
20419 |
|
20420 | (0, _log2.default)('DraggableCore: handleDragStop: %j', coreEvent);
|
20421 |
|
20422 |
|
20423 | _this.setState({
|
20424 | dragging: false,
|
20425 | lastX: NaN,
|
20426 | lastY: NaN
|
20427 | });
|
20428 |
|
20429 |
|
20430 | _this.props.onStop(e, coreEvent);
|
20431 |
|
20432 | if (thisNode) {
|
20433 |
|
20434 | (0, _log2.default)('DraggableCore: Removing handlers');
|
20435 | (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.move, _this.handleDrag);
|
20436 | (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.stop, _this.handleDragStop);
|
20437 | }
|
20438 | }, _this.onMouseDown = function (e) {
|
20439 | dragEventFor = eventsFor.mouse;
|
20440 |
|
20441 | return _this.handleDragStart(e);
|
20442 | }, _this.onMouseUp = function (e) {
|
20443 | dragEventFor = eventsFor.mouse;
|
20444 |
|
20445 | return _this.handleDragStop(e);
|
20446 | }, _this.onTouchStart = function (e) {
|
20447 |
|
20448 | dragEventFor = eventsFor.touch;
|
20449 |
|
20450 | return _this.handleDragStart(e);
|
20451 | }, _this.onTouchEnd = function (e) {
|
20452 |
|
20453 | dragEventFor = eventsFor.touch;
|
20454 |
|
20455 | return _this.handleDragStop(e);
|
20456 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
20457 | }
|
20458 |
|
20459 | _createClass(DraggableCore, [{
|
20460 | key: 'componentWillUnmount',
|
20461 | value: function componentWillUnmount() {
|
20462 |
|
20463 |
|
20464 | var thisNode = _reactDom2.default.findDOMNode(this);
|
20465 | if (thisNode) {
|
20466 | var ownerDocument = thisNode.ownerDocument;
|
20467 |
|
20468 | (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag);
|
20469 | (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag);
|
20470 | (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
|
20471 | (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
|
20472 | if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument);
|
20473 | }
|
20474 | }
|
20475 |
|
20476 |
|
20477 |
|
20478 | }, {
|
20479 | key: 'render',
|
20480 | value: function render() {
|
20481 |
|
20482 |
|
20483 | return _react2.default.cloneElement(_react2.default.Children.only(this.props.children), {
|
20484 | style: (0, _domFns.styleHacks)(this.props.children.props.style),
|
20485 |
|
20486 |
|
20487 |
|
20488 | onMouseDown: this.onMouseDown,
|
20489 | onTouchStart: this.onTouchStart,
|
20490 | onMouseUp: this.onMouseUp,
|
20491 | onTouchEnd: this.onTouchEnd
|
20492 | });
|
20493 | }
|
20494 | }]);
|
20495 |
|
20496 | return DraggableCore;
|
20497 | }(_react2.default.Component);
|
20498 |
|
20499 | DraggableCore.displayName = 'DraggableCore';
|
20500 | DraggableCore.propTypes = {
|
20501 | |
20502 |
|
20503 |
|
20504 |
|
20505 |
|
20506 |
|
20507 | allowAnyClick: _propTypes2.default.bool,
|
20508 |
|
20509 | |
20510 |
|
20511 |
|
20512 |
|
20513 | disabled: _propTypes2.default.bool,
|
20514 |
|
20515 | |
20516 |
|
20517 |
|
20518 |
|
20519 |
|
20520 | enableUserSelectHack: _propTypes2.default.bool,
|
20521 |
|
20522 | |
20523 |
|
20524 |
|
20525 |
|
20526 | offsetParent: function offsetParent(props /*: DraggableCoreProps*/, propName /*: $Keys<DraggableCoreProps>*/) {
|
20527 | if (process.browser === true && props[propName] && props[propName].nodeType !== 1) {
|
20528 | throw new Error('Draggable\'s offsetParent must be a DOM Node.');
|
20529 | }
|
20530 | },
|
20531 |
|
20532 | |
20533 |
|
20534 |
|
20535 | grid: _propTypes2.default.arrayOf(_propTypes2.default.number),
|
20536 |
|
20537 | |
20538 |
|
20539 |
|
20540 |
|
20541 |
|
20542 |
|
20543 |
|
20544 |
|
20545 |
|
20546 |
|
20547 |
|
20548 |
|
20549 |
|
20550 |
|
20551 |
|
20552 |
|
20553 |
|
20554 |
|
20555 |
|
20556 |
|
20557 | handle: _propTypes2.default.string,
|
20558 |
|
20559 | |
20560 |
|
20561 |
|
20562 |
|
20563 |
|
20564 |
|
20565 |
|
20566 |
|
20567 |
|
20568 |
|
20569 |
|
20570 |
|
20571 |
|
20572 |
|
20573 |
|
20574 |
|
20575 |
|
20576 |
|
20577 |
|
20578 |
|
20579 | cancel: _propTypes2.default.string,
|
20580 |
|
20581 | |
20582 |
|
20583 |
|
20584 |
|
20585 | onStart: _propTypes2.default.func,
|
20586 |
|
20587 | |
20588 |
|
20589 |
|
20590 |
|
20591 | onDrag: _propTypes2.default.func,
|
20592 |
|
20593 | |
20594 |
|
20595 |
|
20596 |
|
20597 | onStop: _propTypes2.default.func,
|
20598 |
|
20599 | |
20600 |
|
20601 |
|
20602 |
|
20603 | onMouseDown: _propTypes2.default.func,
|
20604 |
|
20605 | |
20606 |
|
20607 |
|
20608 | className: _shims.dontSetMe,
|
20609 | style: _shims.dontSetMe,
|
20610 | transform: _shims.dontSetMe
|
20611 | };
|
20612 | DraggableCore.defaultProps = {
|
20613 | allowAnyClick: false,
|
20614 | cancel: null,
|
20615 | disabled: false,
|
20616 | enableUserSelectHack: true,
|
20617 | offsetParent: null,
|
20618 | handle: null,
|
20619 | grid: null,
|
20620 | transform: null,
|
20621 | onStart: function onStart() {},
|
20622 | onDrag: function onDrag() {},
|
20623 | onStop: function onStop() {},
|
20624 | onMouseDown: function onMouseDown() {}
|
20625 | };
|
20626 | exports.default = DraggableCore;
|
20627 | }.call(exports, __webpack_require__(20)))
|
20628 |
|
20629 | }),
|
20630 |
|
20631 | (function(module, exports, __webpack_require__) {
|
20632 |
|
20633 | "use strict";
|
20634 |
|
20635 |
|
20636 | Object.defineProperty(exports, "__esModule", {
|
20637 | value: true
|
20638 | });
|
20639 | exports.default = log;
|
20640 |
|
20641 |
|
20642 | function log() {
|
20643 | var _console;
|
20644 |
|
20645 | if (undefined) (_console = console).log.apply(_console, arguments);
|
20646 | }
|
20647 |
|
20648 | }),
|
20649 |
|
20650 | (function(module, exports, __webpack_require__) {
|
20651 |
|
20652 | "use strict";
|
20653 |
|
20654 |
|
20655 | var Draggable = __webpack_require__(13).default;
|
20656 |
|
20657 |
|
20658 |
|
20659 |
|
20660 |
|
20661 | module.exports = Draggable;
|
20662 | module.exports.default = Draggable;
|
20663 | module.exports.DraggableCore = __webpack_require__(10).default;
|
20664 |
|
20665 | }),
|
20666 |
|
20667 | (function(module, exports, __webpack_require__) {
|
20668 |
|
20669 | "use strict";
|
20670 |
|
20671 |
|
20672 | Object.defineProperty(exports, "__esModule", {
|
20673 | value: true
|
20674 | });
|
20675 |
|
20676 | 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; };
|
20677 |
|
20678 | 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"); } }; }();
|
20679 |
|
20680 | 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; }; }();
|
20681 |
|
20682 | var _react = __webpack_require__(6);
|
20683 |
|
20684 | var _react2 = _interopRequireDefault(_react);
|
20685 |
|
20686 | var _propTypes = __webpack_require__(7);
|
20687 |
|
20688 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
20689 |
|
20690 | var _reactDom = __webpack_require__(4);
|
20691 |
|
20692 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
20693 |
|
20694 | var _classnames = __webpack_require__(18);
|
20695 |
|
20696 | var _classnames2 = _interopRequireDefault(_classnames);
|
20697 |
|
20698 | var _domFns = __webpack_require__(5);
|
20699 |
|
20700 | var _positionFns = __webpack_require__(9);
|
20701 |
|
20702 | var _shims = __webpack_require__(0);
|
20703 |
|
20704 | var _DraggableCore = __webpack_require__(10);
|
20705 |
|
20706 | var _DraggableCore2 = _interopRequireDefault(_DraggableCore);
|
20707 |
|
20708 | var _log = __webpack_require__(11);
|
20709 |
|
20710 | var _log2 = _interopRequireDefault(_log);
|
20711 |
|
20712 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20713 |
|
20714 | 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; }
|
20715 |
|
20716 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
20717 |
|
20718 | 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; }
|
20719 |
|
20720 | 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; }
|
20721 |
|
20722 |
|
20723 |
|
20724 |
|
20725 | |
20726 |
|
20727 |
|
20728 |
|
20729 |
|
20730 |
|
20731 |
|
20732 |
|
20733 |
|
20734 |
|
20735 |
|
20736 |
|
20737 |
|
20738 | |
20739 |
|
20740 |
|
20741 |
|
20742 |
|
20743 |
|
20744 |
|
20745 |
|
20746 |
|
20747 |
|
20748 |
|
20749 | var Draggable = function (_React$Component) {
|
20750 | _inherits(Draggable, _React$Component);
|
20751 |
|
20752 | function Draggable(props /*: DraggableProps*/) {
|
20753 | _classCallCheck(this, Draggable);
|
20754 |
|
20755 | var _this = _possibleConstructorReturn(this, (Draggable.__proto__ || Object.getPrototypeOf(Draggable)).call(this, props));
|
20756 |
|
20757 | _this.onDragStart = function (e, coreData) {
|
20758 | (0, _log2.default)('Draggable: onDragStart: %j', coreData);
|
20759 |
|
20760 |
|
20761 | var shouldStart = _this.props.onStart(e, (0, _positionFns.createDraggableData)(_this, coreData));
|
20762 |
|
20763 | if (shouldStart === false) return false;
|
20764 |
|
20765 | _this.setState({ dragging: true, dragged: true });
|
20766 | };
|
20767 |
|
20768 | _this.onDrag = function (e, coreData) {
|
20769 | if (!_this.state.dragging) return false;
|
20770 | (0, _log2.default)('Draggable: onDrag: %j', coreData);
|
20771 |
|
20772 | var uiData = (0, _positionFns.createDraggableData)(_this, coreData);
|
20773 |
|
20774 | var newState = {
|
20775 | x: uiData.x,
|
20776 | y: uiData.y
|
20777 | };
|
20778 |
|
20779 |
|
20780 | if (_this.props.bounds) {
|
20781 |
|
20782 | var _x = newState.x,
|
20783 | _y = newState.y;
|
20784 |
|
20785 |
|
20786 |
|
20787 |
|
20788 |
|
20789 | newState.x += _this.state.slackX;
|
20790 | newState.y += _this.state.slackY;
|
20791 |
|
20792 |
|
20793 |
|
20794 | var _getBoundPosition = (0, _positionFns.getBoundPosition)(_this, newState.x, newState.y),
|
20795 | _getBoundPosition2 = _slicedToArray(_getBoundPosition, 2),
|
20796 | newStateX = _getBoundPosition2[0],
|
20797 | newStateY = _getBoundPosition2[1];
|
20798 |
|
20799 | newState.x = newStateX;
|
20800 | newState.y = newStateY;
|
20801 |
|
20802 |
|
20803 | newState.slackX = _this.state.slackX + (_x - newState.x);
|
20804 | newState.slackY = _this.state.slackY + (_y - newState.y);
|
20805 |
|
20806 |
|
20807 | uiData.x = newState.x;
|
20808 | uiData.y = newState.y;
|
20809 | uiData.deltaX = newState.x - _this.state.x;
|
20810 | uiData.deltaY = newState.y - _this.state.y;
|
20811 | }
|
20812 |
|
20813 |
|
20814 | var shouldUpdate = _this.props.onDrag(e, uiData);
|
20815 | if (shouldUpdate === false) return false;
|
20816 |
|
20817 | _this.setState(newState);
|
20818 | };
|
20819 |
|
20820 | _this.onDragStop = function (e, coreData) {
|
20821 | if (!_this.state.dragging) return false;
|
20822 |
|
20823 |
|
20824 | var shouldStop = _this.props.onStop(e, (0, _positionFns.createDraggableData)(_this, coreData));
|
20825 | if (shouldStop === false) return false;
|
20826 |
|
20827 | (0, _log2.default)('Draggable: onDragStop: %j', coreData);
|
20828 |
|
20829 | var newState = {
|
20830 | dragging: false,
|
20831 | slackX: 0,
|
20832 | slackY: 0
|
20833 | };
|
20834 |
|
20835 |
|
20836 |
|
20837 | var controlled = Boolean(_this.props.position);
|
20838 | if (controlled) {
|
20839 | var _this$props$position = _this.props.position,
|
20840 | _x2 = _this$props$position.x,
|
20841 | _y2 = _this$props$position.y;
|
20842 |
|
20843 | newState.x = _x2;
|
20844 | newState.y = _y2;
|
20845 | }
|
20846 |
|
20847 | _this.setState(newState);
|
20848 | };
|
20849 |
|
20850 | _this.state = {
|
20851 |
|
20852 | dragging: false,
|
20853 |
|
20854 |
|
20855 | dragged: false,
|
20856 |
|
20857 |
|
20858 | x: props.position ? props.position.x : props.defaultPosition.x,
|
20859 | y: props.position ? props.position.y : props.defaultPosition.y,
|
20860 |
|
20861 |
|
20862 | slackX: 0, slackY: 0,
|
20863 |
|
20864 |
|
20865 | isElementSVG: false
|
20866 | };
|
20867 | return _this;
|
20868 | }
|
20869 |
|
20870 | _createClass(Draggable, [{
|
20871 | key: 'componentWillMount',
|
20872 | value: function componentWillMount() {
|
20873 | if (this.props.position && !(this.props.onDrag || this.props.onStop)) {
|
20874 |
|
20875 | 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.');
|
20876 | }
|
20877 | }
|
20878 | }, {
|
20879 | key: 'componentDidMount',
|
20880 | value: function componentDidMount() {
|
20881 |
|
20882 | if (typeof window.SVGElement !== 'undefined' && _reactDom2.default.findDOMNode(this) instanceof window.SVGElement) {
|
20883 | this.setState({ isElementSVG: true });
|
20884 | }
|
20885 | }
|
20886 | }, {
|
20887 | key: 'componentWillReceiveProps',
|
20888 | value: function componentWillReceiveProps(nextProps /*: Object*/) {
|
20889 |
|
20890 | if (nextProps.position && (!this.props.position || nextProps.position.x !== this.props.position.x || nextProps.position.y !== this.props.position.y)) {
|
20891 | this.setState({ x: nextProps.position.x, y: nextProps.position.y });
|
20892 | }
|
20893 | }
|
20894 | }, {
|
20895 | key: 'componentWillUnmount',
|
20896 | value: function componentWillUnmount() {
|
20897 | this.setState({ dragging: false });
|
20898 | }
|
20899 | }, {
|
20900 | key: 'render',
|
20901 | value: function render() /*: ReactElement<any>*/ {
|
20902 | var _classNames;
|
20903 |
|
20904 | var style = {},
|
20905 | svgTransform = null;
|
20906 |
|
20907 |
|
20908 | var controlled = Boolean(this.props.position);
|
20909 | var draggable = !controlled || this.state.dragging;
|
20910 |
|
20911 | var position = this.props.position || this.props.defaultPosition;
|
20912 | var transformOpts = {
|
20913 |
|
20914 | x: (0, _positionFns.canDragX)(this) && draggable ? this.state.x : position.x,
|
20915 |
|
20916 |
|
20917 | y: (0, _positionFns.canDragY)(this) && draggable ? this.state.y : position.y
|
20918 | };
|
20919 |
|
20920 |
|
20921 | if (this.state.isElementSVG) {
|
20922 | svgTransform = (0, _domFns.createSVGTransform)(transformOpts);
|
20923 | } else {
|
20924 |
|
20925 |
|
20926 |
|
20927 |
|
20928 | style = (0, _domFns.createCSSTransform)(transformOpts);
|
20929 | }
|
20930 |
|
20931 | var _props = this.props,
|
20932 | defaultClassName = _props.defaultClassName,
|
20933 | defaultClassNameDragging = _props.defaultClassNameDragging,
|
20934 | defaultClassNameDragged = _props.defaultClassNameDragged;
|
20935 |
|
20936 |
|
20937 | var children = _react2.default.Children.only(this.props.children);
|
20938 |
|
20939 |
|
20940 | var className = (0, _classnames2.default)(children.props.className || '', defaultClassName, (_classNames = {}, _defineProperty(_classNames, defaultClassNameDragging, this.state.dragging), _defineProperty(_classNames, defaultClassNameDragged, this.state.dragged), _classNames));
|
20941 |
|
20942 |
|
20943 |
|
20944 | return _react2.default.createElement(
|
20945 | _DraggableCore2.default,
|
20946 | _extends({}, this.props, { onStart: this.onDragStart, onDrag: this.onDrag, onStop: this.onDragStop }),
|
20947 | _react2.default.cloneElement(children, {
|
20948 | className: className,
|
20949 | style: _extends({}, children.props.style, style),
|
20950 | transform: svgTransform
|
20951 | })
|
20952 | );
|
20953 | }
|
20954 | }]);
|
20955 |
|
20956 | return Draggable;
|
20957 | }(_react2.default.Component);
|
20958 |
|
20959 | Draggable.displayName = 'Draggable';
|
20960 | Draggable.propTypes = _extends({}, _DraggableCore2.default.propTypes, {
|
20961 |
|
20962 | |
20963 |
|
20964 |
|
20965 |
|
20966 |
|
20967 |
|
20968 |
|
20969 |
|
20970 |
|
20971 |
|
20972 |
|
20973 |
|
20974 |
|
20975 | axis: _propTypes2.default.oneOf(['both', 'x', 'y', 'none']),
|
20976 |
|
20977 | |
20978 |
|
20979 |
|
20980 |
|
20981 |
|
20982 |
|
20983 |
|
20984 |
|
20985 |
|
20986 |
|
20987 |
|
20988 |
|
20989 |
|
20990 |
|
20991 |
|
20992 |
|
20993 |
|
20994 |
|
20995 |
|
20996 |
|
20997 |
|
20998 |
|
20999 |
|
21000 |
|
21001 |
|
21002 |
|
21003 | bounds: _propTypes2.default.oneOfType([_propTypes2.default.shape({
|
21004 | left: _propTypes2.default.number,
|
21005 | right: _propTypes2.default.number,
|
21006 | top: _propTypes2.default.number,
|
21007 | bottom: _propTypes2.default.number
|
21008 | }), _propTypes2.default.string, _propTypes2.default.oneOf([false])]),
|
21009 |
|
21010 | defaultClassName: _propTypes2.default.string,
|
21011 | defaultClassNameDragging: _propTypes2.default.string,
|
21012 | defaultClassNameDragged: _propTypes2.default.string,
|
21013 |
|
21014 | |
21015 |
|
21016 |
|
21017 |
|
21018 |
|
21019 |
|
21020 |
|
21021 |
|
21022 |
|
21023 |
|
21024 |
|
21025 |
|
21026 |
|
21027 |
|
21028 |
|
21029 |
|
21030 |
|
21031 | defaultPosition: _propTypes2.default.shape({
|
21032 | x: _propTypes2.default.number,
|
21033 | y: _propTypes2.default.number
|
21034 | }),
|
21035 |
|
21036 | |
21037 |
|
21038 |
|
21039 |
|
21040 |
|
21041 |
|
21042 |
|
21043 |
|
21044 |
|
21045 |
|
21046 |
|
21047 |
|
21048 |
|
21049 |
|
21050 |
|
21051 |
|
21052 |
|
21053 |
|
21054 |
|
21055 |
|
21056 | position: _propTypes2.default.shape({
|
21057 | x: _propTypes2.default.number,
|
21058 | y: _propTypes2.default.number
|
21059 | }),
|
21060 |
|
21061 | |
21062 |
|
21063 |
|
21064 | className: _shims.dontSetMe,
|
21065 | style: _shims.dontSetMe,
|
21066 | transform: _shims.dontSetMe
|
21067 | });
|
21068 | Draggable.defaultProps = _extends({}, _DraggableCore2.default.defaultProps, {
|
21069 | axis: 'both',
|
21070 | bounds: false,
|
21071 | defaultClassName: 'react-draggable',
|
21072 | defaultClassNameDragging: 'react-draggable-dragging',
|
21073 | defaultClassNameDragged: 'react-draggable-dragged',
|
21074 | defaultPosition: { x: 0, y: 0 },
|
21075 | position: null
|
21076 | });
|
21077 | exports.default = Draggable;
|
21078 |
|
21079 | }),
|
21080 |
|
21081 | (function(module, exports, __webpack_require__) {
|
21082 |
|
21083 | "use strict";
|
21084 | |
21085 |
|
21086 |
|
21087 |
|
21088 |
|
21089 |
|
21090 |
|
21091 |
|
21092 |
|
21093 | var emptyFunction = __webpack_require__(1);
|
21094 | var invariant = __webpack_require__(2);
|
21095 | var warning = __webpack_require__(8);
|
21096 | var assign = __webpack_require__(15);
|
21097 |
|
21098 | var ReactPropTypesSecret = __webpack_require__(3);
|
21099 | var checkPropTypes = __webpack_require__(16);
|
21100 |
|
21101 | module.exports = function(isValidElement, throwOnDirectAccess) {
|
21102 |
|
21103 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
21104 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
21105 |
|
21106 | |
21107 |
|
21108 |
|
21109 |
|
21110 |
|
21111 |
|
21112 |
|
21113 |
|
21114 |
|
21115 |
|
21116 |
|
21117 |
|
21118 |
|
21119 |
|
21120 | function getIteratorFn(maybeIterable) {
|
21121 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
21122 | if (typeof iteratorFn === 'function') {
|
21123 | return iteratorFn;
|
21124 | }
|
21125 | }
|
21126 |
|
21127 | |
21128 |
|
21129 |
|
21130 |
|
21131 |
|
21132 |
|
21133 |
|
21134 |
|
21135 |
|
21136 |
|
21137 |
|
21138 |
|
21139 |
|
21140 |
|
21141 |
|
21142 |
|
21143 |
|
21144 |
|
21145 |
|
21146 |
|
21147 |
|
21148 |
|
21149 |
|
21150 |
|
21151 |
|
21152 |
|
21153 |
|
21154 |
|
21155 |
|
21156 |
|
21157 |
|
21158 |
|
21159 |
|
21160 |
|
21161 |
|
21162 |
|
21163 |
|
21164 |
|
21165 |
|
21166 |
|
21167 |
|
21168 |
|
21169 |
|
21170 |
|
21171 |
|
21172 |
|
21173 |
|
21174 | var ANONYMOUS = '<<anonymous>>';
|
21175 |
|
21176 |
|
21177 |
|
21178 | var ReactPropTypes = {
|
21179 | array: createPrimitiveTypeChecker('array'),
|
21180 | bool: createPrimitiveTypeChecker('boolean'),
|
21181 | func: createPrimitiveTypeChecker('function'),
|
21182 | number: createPrimitiveTypeChecker('number'),
|
21183 | object: createPrimitiveTypeChecker('object'),
|
21184 | string: createPrimitiveTypeChecker('string'),
|
21185 | symbol: createPrimitiveTypeChecker('symbol'),
|
21186 |
|
21187 | any: createAnyTypeChecker(),
|
21188 | arrayOf: createArrayOfTypeChecker,
|
21189 | element: createElementTypeChecker(),
|
21190 | instanceOf: createInstanceTypeChecker,
|
21191 | node: createNodeChecker(),
|
21192 | objectOf: createObjectOfTypeChecker,
|
21193 | oneOf: createEnumTypeChecker,
|
21194 | oneOfType: createUnionTypeChecker,
|
21195 | shape: createShapeTypeChecker,
|
21196 | exact: createStrictShapeTypeChecker,
|
21197 | };
|
21198 |
|
21199 | |
21200 |
|
21201 |
|
21202 |
|
21203 |
|
21204 | function is(x, y) {
|
21205 |
|
21206 | if (x === y) {
|
21207 |
|
21208 |
|
21209 | return x !== 0 || 1 / x === 1 / y;
|
21210 | } else {
|
21211 |
|
21212 | return x !== x && y !== y;
|
21213 | }
|
21214 | }
|
21215 |
|
21216 |
|
21217 | |
21218 |
|
21219 |
|
21220 |
|
21221 |
|
21222 |
|
21223 |
|
21224 | function PropTypeError(message) {
|
21225 | this.message = message;
|
21226 | this.stack = '';
|
21227 | }
|
21228 |
|
21229 | PropTypeError.prototype = Error.prototype;
|
21230 |
|
21231 | function createChainableTypeChecker(validate) {
|
21232 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
21233 | var manualPropTypeCallCache = {};
|
21234 | var manualPropTypeWarningCount = 0;
|
21235 | }
|
21236 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
21237 | componentName = componentName || ANONYMOUS;
|
21238 | propFullName = propFullName || propName;
|
21239 |
|
21240 | if (secret !== ReactPropTypesSecret) {
|
21241 | if (throwOnDirectAccess) {
|
21242 |
|
21243 | invariant(
|
21244 | false,
|
21245 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
21246 | 'Use `PropTypes.checkPropTypes()` to call them. ' +
|
21247 | 'Read more at http://fb.me/use-check-prop-types'
|
21248 | );
|
21249 | } else if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
21250 |
|
21251 | var cacheKey = componentName + ':' + propName;
|
21252 | if (
|
21253 | !manualPropTypeCallCache[cacheKey] &&
|
21254 |
|
21255 | manualPropTypeWarningCount < 3
|
21256 | ) {
|
21257 | warning(
|
21258 | false,
|
21259 | 'You are manually calling a React.PropTypes validation ' +
|
21260 | 'function for the `%s` prop on `%s`. This is deprecated ' +
|
21261 | 'and will throw in the standalone `prop-types` package. ' +
|
21262 | 'You may be seeing this warning due to a third-party PropTypes ' +
|
21263 | 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
|
21264 | propFullName,
|
21265 | componentName
|
21266 | );
|
21267 | manualPropTypeCallCache[cacheKey] = true;
|
21268 | manualPropTypeWarningCount++;
|
21269 | }
|
21270 | }
|
21271 | }
|
21272 | if (props[propName] == null) {
|
21273 | if (isRequired) {
|
21274 | if (props[propName] === null) {
|
21275 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
21276 | }
|
21277 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
21278 | }
|
21279 | return null;
|
21280 | } else {
|
21281 | return validate(props, propName, componentName, location, propFullName);
|
21282 | }
|
21283 | }
|
21284 |
|
21285 | var chainedCheckType = checkType.bind(null, false);
|
21286 | chainedCheckType.isRequired = checkType.bind(null, true);
|
21287 |
|
21288 | return chainedCheckType;
|
21289 | }
|
21290 |
|
21291 | function createPrimitiveTypeChecker(expectedType) {
|
21292 | function validate(props, propName, componentName, location, propFullName, secret) {
|
21293 | var propValue = props[propName];
|
21294 | var propType = getPropType(propValue);
|
21295 | if (propType !== expectedType) {
|
21296 |
|
21297 |
|
21298 |
|
21299 | var preciseType = getPreciseType(propValue);
|
21300 |
|
21301 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
21302 | }
|
21303 | return null;
|
21304 | }
|
21305 | return createChainableTypeChecker(validate);
|
21306 | }
|
21307 |
|
21308 | function createAnyTypeChecker() {
|
21309 | return createChainableTypeChecker(emptyFunction.thatReturnsNull);
|
21310 | }
|
21311 |
|
21312 | function createArrayOfTypeChecker(typeChecker) {
|
21313 | function validate(props, propName, componentName, location, propFullName) {
|
21314 | if (typeof typeChecker !== 'function') {
|
21315 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
21316 | }
|
21317 | var propValue = props[propName];
|
21318 | if (!Array.isArray(propValue)) {
|
21319 | var propType = getPropType(propValue);
|
21320 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
21321 | }
|
21322 | for (var i = 0; i < propValue.length; i++) {
|
21323 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
21324 | if (error instanceof Error) {
|
21325 | return error;
|
21326 | }
|
21327 | }
|
21328 | return null;
|
21329 | }
|
21330 | return createChainableTypeChecker(validate);
|
21331 | }
|
21332 |
|
21333 | function createElementTypeChecker() {
|
21334 | function validate(props, propName, componentName, location, propFullName) {
|
21335 | var propValue = props[propName];
|
21336 | if (!isValidElement(propValue)) {
|
21337 | var propType = getPropType(propValue);
|
21338 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
21339 | }
|
21340 | return null;
|
21341 | }
|
21342 | return createChainableTypeChecker(validate);
|
21343 | }
|
21344 |
|
21345 | function createInstanceTypeChecker(expectedClass) {
|
21346 | function validate(props, propName, componentName, location, propFullName) {
|
21347 | if (!(props[propName] instanceof expectedClass)) {
|
21348 | var expectedClassName = expectedClass.name || ANONYMOUS;
|
21349 | var actualClassName = getClassName(props[propName]);
|
21350 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
21351 | }
|
21352 | return null;
|
21353 | }
|
21354 | return createChainableTypeChecker(validate);
|
21355 | }
|
21356 |
|
21357 | function createEnumTypeChecker(expectedValues) {
|
21358 | if (!Array.isArray(expectedValues)) {
|
21359 | Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
|
21360 | return emptyFunction.thatReturnsNull;
|
21361 | }
|
21362 |
|
21363 | function validate(props, propName, componentName, location, propFullName) {
|
21364 | var propValue = props[propName];
|
21365 | for (var i = 0; i < expectedValues.length; i++) {
|
21366 | if (is(propValue, expectedValues[i])) {
|
21367 | return null;
|
21368 | }
|
21369 | }
|
21370 |
|
21371 | var valuesString = JSON.stringify(expectedValues);
|
21372 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
21373 | }
|
21374 | return createChainableTypeChecker(validate);
|
21375 | }
|
21376 |
|
21377 | function createObjectOfTypeChecker(typeChecker) {
|
21378 | function validate(props, propName, componentName, location, propFullName) {
|
21379 | if (typeof typeChecker !== 'function') {
|
21380 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
21381 | }
|
21382 | var propValue = props[propName];
|
21383 | var propType = getPropType(propValue);
|
21384 | if (propType !== 'object') {
|
21385 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
21386 | }
|
21387 | for (var key in propValue) {
|
21388 | if (propValue.hasOwnProperty(key)) {
|
21389 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
21390 | if (error instanceof Error) {
|
21391 | return error;
|
21392 | }
|
21393 | }
|
21394 | }
|
21395 | return null;
|
21396 | }
|
21397 | return createChainableTypeChecker(validate);
|
21398 | }
|
21399 |
|
21400 | function createUnionTypeChecker(arrayOfTypeCheckers) {
|
21401 | if (!Array.isArray(arrayOfTypeCheckers)) {
|
21402 | Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
21403 | return emptyFunction.thatReturnsNull;
|
21404 | }
|
21405 |
|
21406 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
21407 | var checker = arrayOfTypeCheckers[i];
|
21408 | if (typeof checker !== 'function') {
|
21409 | warning(
|
21410 | false,
|
21411 | 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
21412 | 'received %s at index %s.',
|
21413 | getPostfixForTypeWarning(checker),
|
21414 | i
|
21415 | );
|
21416 | return emptyFunction.thatReturnsNull;
|
21417 | }
|
21418 | }
|
21419 |
|
21420 | function validate(props, propName, componentName, location, propFullName) {
|
21421 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
21422 | var checker = arrayOfTypeCheckers[i];
|
21423 | if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
|
21424 | return null;
|
21425 | }
|
21426 | }
|
21427 |
|
21428 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
21429 | }
|
21430 | return createChainableTypeChecker(validate);
|
21431 | }
|
21432 |
|
21433 | function createNodeChecker() {
|
21434 | function validate(props, propName, componentName, location, propFullName) {
|
21435 | if (!isNode(props[propName])) {
|
21436 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
21437 | }
|
21438 | return null;
|
21439 | }
|
21440 | return createChainableTypeChecker(validate);
|
21441 | }
|
21442 |
|
21443 | function createShapeTypeChecker(shapeTypes) {
|
21444 | function validate(props, propName, componentName, location, propFullName) {
|
21445 | var propValue = props[propName];
|
21446 | var propType = getPropType(propValue);
|
21447 | if (propType !== 'object') {
|
21448 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
21449 | }
|
21450 | for (var key in shapeTypes) {
|
21451 | var checker = shapeTypes[key];
|
21452 | if (!checker) {
|
21453 | continue;
|
21454 | }
|
21455 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
21456 | if (error) {
|
21457 | return error;
|
21458 | }
|
21459 | }
|
21460 | return null;
|
21461 | }
|
21462 | return createChainableTypeChecker(validate);
|
21463 | }
|
21464 |
|
21465 | function createStrictShapeTypeChecker(shapeTypes) {
|
21466 | function validate(props, propName, componentName, location, propFullName) {
|
21467 | var propValue = props[propName];
|
21468 | var propType = getPropType(propValue);
|
21469 | if (propType !== 'object') {
|
21470 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
21471 | }
|
21472 |
|
21473 |
|
21474 | var allKeys = assign({}, props[propName], shapeTypes);
|
21475 | for (var key in allKeys) {
|
21476 | var checker = shapeTypes[key];
|
21477 | if (!checker) {
|
21478 | return new PropTypeError(
|
21479 | 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
21480 | '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
21481 | '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
21482 | );
|
21483 | }
|
21484 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
21485 | if (error) {
|
21486 | return error;
|
21487 | }
|
21488 | }
|
21489 | return null;
|
21490 | }
|
21491 |
|
21492 | return createChainableTypeChecker(validate);
|
21493 | }
|
21494 |
|
21495 | function isNode(propValue) {
|
21496 | switch (typeof propValue) {
|
21497 | case 'number':
|
21498 | case 'string':
|
21499 | case 'undefined':
|
21500 | return true;
|
21501 | case 'boolean':
|
21502 | return !propValue;
|
21503 | case 'object':
|
21504 | if (Array.isArray(propValue)) {
|
21505 | return propValue.every(isNode);
|
21506 | }
|
21507 | if (propValue === null || isValidElement(propValue)) {
|
21508 | return true;
|
21509 | }
|
21510 |
|
21511 | var iteratorFn = getIteratorFn(propValue);
|
21512 | if (iteratorFn) {
|
21513 | var iterator = iteratorFn.call(propValue);
|
21514 | var step;
|
21515 | if (iteratorFn !== propValue.entries) {
|
21516 | while (!(step = iterator.next()).done) {
|
21517 | if (!isNode(step.value)) {
|
21518 | return false;
|
21519 | }
|
21520 | }
|
21521 | } else {
|
21522 |
|
21523 | while (!(step = iterator.next()).done) {
|
21524 | var entry = step.value;
|
21525 | if (entry) {
|
21526 | if (!isNode(entry[1])) {
|
21527 | return false;
|
21528 | }
|
21529 | }
|
21530 | }
|
21531 | }
|
21532 | } else {
|
21533 | return false;
|
21534 | }
|
21535 |
|
21536 | return true;
|
21537 | default:
|
21538 | return false;
|
21539 | }
|
21540 | }
|
21541 |
|
21542 | function isSymbol(propType, propValue) {
|
21543 |
|
21544 | if (propType === 'symbol') {
|
21545 | return true;
|
21546 | }
|
21547 |
|
21548 |
|
21549 | if (propValue['@@toStringTag'] === 'Symbol') {
|
21550 | return true;
|
21551 | }
|
21552 |
|
21553 |
|
21554 | if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
21555 | return true;
|
21556 | }
|
21557 |
|
21558 | return false;
|
21559 | }
|
21560 |
|
21561 |
|
21562 | function getPropType(propValue) {
|
21563 | var propType = typeof propValue;
|
21564 | if (Array.isArray(propValue)) {
|
21565 | return 'array';
|
21566 | }
|
21567 | if (propValue instanceof RegExp) {
|
21568 |
|
21569 |
|
21570 |
|
21571 | return 'object';
|
21572 | }
|
21573 | if (isSymbol(propType, propValue)) {
|
21574 | return 'symbol';
|
21575 | }
|
21576 | return propType;
|
21577 | }
|
21578 |
|
21579 |
|
21580 |
|
21581 | function getPreciseType(propValue) {
|
21582 | if (typeof propValue === 'undefined' || propValue === null) {
|
21583 | return '' + propValue;
|
21584 | }
|
21585 | var propType = getPropType(propValue);
|
21586 | if (propType === 'object') {
|
21587 | if (propValue instanceof Date) {
|
21588 | return 'date';
|
21589 | } else if (propValue instanceof RegExp) {
|
21590 | return 'regexp';
|
21591 | }
|
21592 | }
|
21593 | return propType;
|
21594 | }
|
21595 |
|
21596 |
|
21597 |
|
21598 | function getPostfixForTypeWarning(value) {
|
21599 | var type = getPreciseType(value);
|
21600 | switch (type) {
|
21601 | case 'array':
|
21602 | case 'object':
|
21603 | return 'an ' + type;
|
21604 | case 'boolean':
|
21605 | case 'date':
|
21606 | case 'regexp':
|
21607 | return 'a ' + type;
|
21608 | default:
|
21609 | return type;
|
21610 | }
|
21611 | }
|
21612 |
|
21613 |
|
21614 | function getClassName(propValue) {
|
21615 | if (!propValue.constructor || !propValue.constructor.name) {
|
21616 | return ANONYMOUS;
|
21617 | }
|
21618 | return propValue.constructor.name;
|
21619 | }
|
21620 |
|
21621 | ReactPropTypes.checkPropTypes = checkPropTypes;
|
21622 | ReactPropTypes.PropTypes = ReactPropTypes;
|
21623 |
|
21624 | return ReactPropTypes;
|
21625 | };
|
21626 |
|
21627 |
|
21628 | }),
|
21629 |
|
21630 | (function(module, exports, __webpack_require__) {
|
21631 |
|
21632 | "use strict";
|
21633 | |
21634 |
|
21635 |
|
21636 |
|
21637 |
|
21638 |
|
21639 |
|
21640 |
|
21641 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
21642 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
21643 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
21644 |
|
21645 | function toObject(val) {
|
21646 | if (val === null || val === undefined) {
|
21647 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
21648 | }
|
21649 |
|
21650 | return Object(val);
|
21651 | }
|
21652 |
|
21653 | function shouldUseNative() {
|
21654 | try {
|
21655 | if (!Object.assign) {
|
21656 | return false;
|
21657 | }
|
21658 |
|
21659 |
|
21660 |
|
21661 |
|
21662 | var test1 = new String('abc');
|
21663 | test1[5] = 'de';
|
21664 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
21665 | return false;
|
21666 | }
|
21667 |
|
21668 |
|
21669 | var test2 = {};
|
21670 | for (var i = 0; i < 10; i++) {
|
21671 | test2['_' + String.fromCharCode(i)] = i;
|
21672 | }
|
21673 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
21674 | return test2[n];
|
21675 | });
|
21676 | if (order2.join('') !== '0123456789') {
|
21677 | return false;
|
21678 | }
|
21679 |
|
21680 |
|
21681 | var test3 = {};
|
21682 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
21683 | test3[letter] = letter;
|
21684 | });
|
21685 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
21686 | 'abcdefghijklmnopqrst') {
|
21687 | return false;
|
21688 | }
|
21689 |
|
21690 | return true;
|
21691 | } catch (err) {
|
21692 |
|
21693 | return false;
|
21694 | }
|
21695 | }
|
21696 |
|
21697 | module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
21698 | var from;
|
21699 | var to = toObject(target);
|
21700 | var symbols;
|
21701 |
|
21702 | for (var s = 1; s < arguments.length; s++) {
|
21703 | from = Object(arguments[s]);
|
21704 |
|
21705 | for (var key in from) {
|
21706 | if (hasOwnProperty.call(from, key)) {
|
21707 | to[key] = from[key];
|
21708 | }
|
21709 | }
|
21710 |
|
21711 | if (getOwnPropertySymbols) {
|
21712 | symbols = getOwnPropertySymbols(from);
|
21713 | for (var i = 0; i < symbols.length; i++) {
|
21714 | if (propIsEnumerable.call(from, symbols[i])) {
|
21715 | to[symbols[i]] = from[symbols[i]];
|
21716 | }
|
21717 | }
|
21718 | }
|
21719 | }
|
21720 |
|
21721 | return to;
|
21722 | };
|
21723 |
|
21724 |
|
21725 | }),
|
21726 |
|
21727 | (function(module, exports, __webpack_require__) {
|
21728 |
|
21729 | "use strict";
|
21730 | |
21731 |
|
21732 |
|
21733 |
|
21734 |
|
21735 |
|
21736 |
|
21737 |
|
21738 |
|
21739 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
21740 | var invariant = __webpack_require__(2);
|
21741 | var warning = __webpack_require__(8);
|
21742 | var ReactPropTypesSecret = __webpack_require__(3);
|
21743 | var loggedTypeFailures = {};
|
21744 | }
|
21745 |
|
21746 | |
21747 |
|
21748 |
|
21749 |
|
21750 |
|
21751 |
|
21752 |
|
21753 |
|
21754 |
|
21755 |
|
21756 |
|
21757 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
21758 | if (Object({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
|
21759 | for (var typeSpecName in typeSpecs) {
|
21760 | if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
21761 | var error;
|
21762 |
|
21763 |
|
21764 |
|
21765 | try {
|
21766 |
|
21767 |
|
21768 | 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]);
|
21769 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
21770 | } catch (ex) {
|
21771 | error = ex;
|
21772 | }
|
21773 | 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);
|
21774 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
21775 |
|
21776 |
|
21777 | loggedTypeFailures[error.message] = true;
|
21778 |
|
21779 | var stack = getStack ? getStack() : '';
|
21780 |
|
21781 | warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
21782 | }
|
21783 | }
|
21784 | }
|
21785 | }
|
21786 | }
|
21787 |
|
21788 | module.exports = checkPropTypes;
|
21789 |
|
21790 |
|
21791 | }),
|
21792 |
|
21793 | (function(module, exports, __webpack_require__) {
|
21794 |
|
21795 | "use strict";
|
21796 | |
21797 |
|
21798 |
|
21799 |
|
21800 |
|
21801 |
|
21802 |
|
21803 |
|
21804 |
|
21805 | var emptyFunction = __webpack_require__(1);
|
21806 | var invariant = __webpack_require__(2);
|
21807 | var ReactPropTypesSecret = __webpack_require__(3);
|
21808 |
|
21809 | module.exports = function() {
|
21810 | function shim(props, propName, componentName, location, propFullName, secret) {
|
21811 | if (secret === ReactPropTypesSecret) {
|
21812 |
|
21813 | return;
|
21814 | }
|
21815 | invariant(
|
21816 | false,
|
21817 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
21818 | 'Use PropTypes.checkPropTypes() to call them. ' +
|
21819 | 'Read more at http://fb.me/use-check-prop-types'
|
21820 | );
|
21821 | };
|
21822 | shim.isRequired = shim;
|
21823 | function getShim() {
|
21824 | return shim;
|
21825 | };
|
21826 |
|
21827 |
|
21828 | var ReactPropTypes = {
|
21829 | array: shim,
|
21830 | bool: shim,
|
21831 | func: shim,
|
21832 | number: shim,
|
21833 | object: shim,
|
21834 | string: shim,
|
21835 | symbol: shim,
|
21836 |
|
21837 | any: shim,
|
21838 | arrayOf: getShim,
|
21839 | element: shim,
|
21840 | instanceOf: getShim,
|
21841 | node: shim,
|
21842 | objectOf: getShim,
|
21843 | oneOf: getShim,
|
21844 | oneOfType: getShim,
|
21845 | shape: getShim,
|
21846 | exact: getShim
|
21847 | };
|
21848 |
|
21849 | ReactPropTypes.checkPropTypes = emptyFunction;
|
21850 | ReactPropTypes.PropTypes = ReactPropTypes;
|
21851 |
|
21852 | return ReactPropTypes;
|
21853 | };
|
21854 |
|
21855 |
|
21856 | }),
|
21857 |
|
21858 | (function(module, exports, __webpack_require__) {
|
21859 |
|
21860 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; |
21861 |
|
21862 |
|
21863 |
|
21864 |
|
21865 |
|
21866 |
|
21867 | (function () {
|
21868 | 'use strict';
|
21869 |
|
21870 | var hasOwn = {}.hasOwnProperty;
|
21871 |
|
21872 | function classNames () {
|
21873 | var classes = [];
|
21874 |
|
21875 | for (var i = 0; i < arguments.length; i++) {
|
21876 | var arg = arguments[i];
|
21877 | if (!arg) continue;
|
21878 |
|
21879 | var argType = typeof arg;
|
21880 |
|
21881 | if (argType === 'string' || argType === 'number') {
|
21882 | classes.push(arg);
|
21883 | } else if (Array.isArray(arg)) {
|
21884 | classes.push(classNames.apply(null, arg));
|
21885 | } else if (argType === 'object') {
|
21886 | for (var key in arg) {
|
21887 | if (hasOwn.call(arg, key) && arg[key]) {
|
21888 | classes.push(key);
|
21889 | }
|
21890 | }
|
21891 | }
|
21892 | }
|
21893 |
|
21894 | return classes.join(' ');
|
21895 | }
|
21896 |
|
21897 | if (typeof module !== 'undefined' && module.exports) {
|
21898 | module.exports = classNames;
|
21899 | } else if (true) {
|
21900 |
|
21901 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
|
21902 | return classNames;
|
21903 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
|
21904 | __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
21905 | } else {
|
21906 | window.classNames = classNames;
|
21907 | }
|
21908 | }());
|
21909 |
|
21910 |
|
21911 | }),
|
21912 |
|
21913 | (function(module, exports, __webpack_require__) {
|
21914 |
|
21915 | "use strict";
|
21916 |
|
21917 |
|
21918 | Object.defineProperty(exports, "__esModule", {
|
21919 | value: true
|
21920 | });
|
21921 | exports.getPrefix = getPrefix;
|
21922 | exports.browserPrefixToKey = browserPrefixToKey;
|
21923 | exports.browserPrefixToStyle = browserPrefixToStyle;
|
21924 | var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
|
21925 | function getPrefix() /*: string*/ {
|
21926 | var prop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
|
21927 |
|
21928 |
|
21929 |
|
21930 |
|
21931 | if (typeof window === 'undefined' || typeof window.document === 'undefined') return '';
|
21932 |
|
21933 | var style = window.document.documentElement.style;
|
21934 |
|
21935 | if (prop in style) return '';
|
21936 |
|
21937 | for (var i = 0; i < prefixes.length; i++) {
|
21938 | if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i];
|
21939 | }
|
21940 |
|
21941 | return '';
|
21942 | }
|
21943 |
|
21944 | function browserPrefixToKey(prop /*: string*/, prefix /*: string*/) /*: string*/ {
|
21945 | return prefix ? '' + prefix + kebabToTitleCase(prop) : prop;
|
21946 | }
|
21947 |
|
21948 | function browserPrefixToStyle(prop /*: string*/, prefix /*: string*/) /*: string*/ {
|
21949 | return prefix ? '-' + prefix.toLowerCase() + '-' + prop : prop;
|
21950 | }
|
21951 |
|
21952 | function kebabToTitleCase(str /*: string*/) /*: string*/ {
|
21953 | var out = '';
|
21954 | var shouldCapitalize = true;
|
21955 | for (var i = 0; i < str.length; i++) {
|
21956 | if (shouldCapitalize) {
|
21957 | out += str[i].toUpperCase();
|
21958 | shouldCapitalize = false;
|
21959 | } else if (str[i] === '-') {
|
21960 | shouldCapitalize = true;
|
21961 | } else {
|
21962 | out += str[i];
|
21963 | }
|
21964 | }
|
21965 | return out;
|
21966 | }
|
21967 |
|
21968 |
|
21969 |
|
21970 |
|
21971 | exports.default = getPrefix();
|
21972 |
|
21973 | }),
|
21974 |
|
21975 | (function(module, exports) {
|
21976 |
|
21977 |
|
21978 | var process = module.exports = {};
|
21979 |
|
21980 |
|
21981 |
|
21982 |
|
21983 |
|
21984 |
|
21985 | var cachedSetTimeout;
|
21986 | var cachedClearTimeout;
|
21987 |
|
21988 | function defaultSetTimout() {
|
21989 | throw new Error('setTimeout has not been defined');
|
21990 | }
|
21991 | function defaultClearTimeout () {
|
21992 | throw new Error('clearTimeout has not been defined');
|
21993 | }
|
21994 | (function () {
|
21995 | try {
|
21996 | if (typeof setTimeout === 'function') {
|
21997 | cachedSetTimeout = setTimeout;
|
21998 | } else {
|
21999 | cachedSetTimeout = defaultSetTimout;
|
22000 | }
|
22001 | } catch (e) {
|
22002 | cachedSetTimeout = defaultSetTimout;
|
22003 | }
|
22004 | try {
|
22005 | if (typeof clearTimeout === 'function') {
|
22006 | cachedClearTimeout = clearTimeout;
|
22007 | } else {
|
22008 | cachedClearTimeout = defaultClearTimeout;
|
22009 | }
|
22010 | } catch (e) {
|
22011 | cachedClearTimeout = defaultClearTimeout;
|
22012 | }
|
22013 | } ())
|
22014 | function runTimeout(fun) {
|
22015 | if (cachedSetTimeout === setTimeout) {
|
22016 |
|
22017 | return setTimeout(fun, 0);
|
22018 | }
|
22019 |
|
22020 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
22021 | cachedSetTimeout = setTimeout;
|
22022 | return setTimeout(fun, 0);
|
22023 | }
|
22024 | try {
|
22025 |
|
22026 | return cachedSetTimeout(fun, 0);
|
22027 | } catch(e){
|
22028 | try {
|
22029 |
|
22030 | return cachedSetTimeout.call(null, fun, 0);
|
22031 | } catch(e){
|
22032 |
|
22033 | return cachedSetTimeout.call(this, fun, 0);
|
22034 | }
|
22035 | }
|
22036 |
|
22037 |
|
22038 | }
|
22039 | function runClearTimeout(marker) {
|
22040 | if (cachedClearTimeout === clearTimeout) {
|
22041 |
|
22042 | return clearTimeout(marker);
|
22043 | }
|
22044 |
|
22045 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
22046 | cachedClearTimeout = clearTimeout;
|
22047 | return clearTimeout(marker);
|
22048 | }
|
22049 | try {
|
22050 |
|
22051 | return cachedClearTimeout(marker);
|
22052 | } catch (e){
|
22053 | try {
|
22054 |
|
22055 | return cachedClearTimeout.call(null, marker);
|
22056 | } catch (e){
|
22057 |
|
22058 |
|
22059 | return cachedClearTimeout.call(this, marker);
|
22060 | }
|
22061 | }
|
22062 |
|
22063 |
|
22064 |
|
22065 | }
|
22066 | var queue = [];
|
22067 | var draining = false;
|
22068 | var currentQueue;
|
22069 | var queueIndex = -1;
|
22070 |
|
22071 | function cleanUpNextTick() {
|
22072 | if (!draining || !currentQueue) {
|
22073 | return;
|
22074 | }
|
22075 | draining = false;
|
22076 | if (currentQueue.length) {
|
22077 | queue = currentQueue.concat(queue);
|
22078 | } else {
|
22079 | queueIndex = -1;
|
22080 | }
|
22081 | if (queue.length) {
|
22082 | drainQueue();
|
22083 | }
|
22084 | }
|
22085 |
|
22086 | function drainQueue() {
|
22087 | if (draining) {
|
22088 | return;
|
22089 | }
|
22090 | var timeout = runTimeout(cleanUpNextTick);
|
22091 | draining = true;
|
22092 |
|
22093 | var len = queue.length;
|
22094 | while(len) {
|
22095 | currentQueue = queue;
|
22096 | queue = [];
|
22097 | while (++queueIndex < len) {
|
22098 | if (currentQueue) {
|
22099 | currentQueue[queueIndex].run();
|
22100 | }
|
22101 | }
|
22102 | queueIndex = -1;
|
22103 | len = queue.length;
|
22104 | }
|
22105 | currentQueue = null;
|
22106 | draining = false;
|
22107 | runClearTimeout(timeout);
|
22108 | }
|
22109 |
|
22110 | process.nextTick = function (fun) {
|
22111 | var args = new Array(arguments.length - 1);
|
22112 | if (arguments.length > 1) {
|
22113 | for (var i = 1; i < arguments.length; i++) {
|
22114 | args[i - 1] = arguments[i];
|
22115 | }
|
22116 | }
|
22117 | queue.push(new Item(fun, args));
|
22118 | if (queue.length === 1 && !draining) {
|
22119 | runTimeout(drainQueue);
|
22120 | }
|
22121 | };
|
22122 |
|
22123 |
|
22124 | function Item(fun, array) {
|
22125 | this.fun = fun;
|
22126 | this.array = array;
|
22127 | }
|
22128 | Item.prototype.run = function () {
|
22129 | this.fun.apply(null, this.array);
|
22130 | };
|
22131 | process.title = 'browser';
|
22132 | process.browser = true;
|
22133 | process.env = {};
|
22134 | process.argv = [];
|
22135 | process.version = '';
|
22136 | process.versions = {};
|
22137 |
|
22138 | function noop() {}
|
22139 |
|
22140 | process.on = noop;
|
22141 | process.addListener = noop;
|
22142 | process.once = noop;
|
22143 | process.off = noop;
|
22144 | process.removeListener = noop;
|
22145 | process.removeAllListeners = noop;
|
22146 | process.emit = noop;
|
22147 | process.prependListener = noop;
|
22148 | process.prependOnceListener = noop;
|
22149 |
|
22150 | process.listeners = function (name) { return [] }
|
22151 |
|
22152 | process.binding = function (name) {
|
22153 | throw new Error('process.binding is not supported');
|
22154 | };
|
22155 |
|
22156 | process.cwd = function () { return '/' };
|
22157 | process.chdir = function (dir) {
|
22158 | throw new Error('process.chdir is not supported');
|
22159 | };
|
22160 | process.umask = function() { return 0; };
|
22161 |
|
22162 |
|
22163 | })
|
22164 | ]);
|
22165 | });
|
22166 |
|
22167 |
|
22168 | }),
|
22169 |
|
22170 | (function(module, exports, __webpack_require__) {
|
22171 |
|
22172 | (function(global, module) { |
22173 |
|
22174 |
|
22175 |
|
22176 |
|
22177 |
|
22178 |
|
22179 |
|
22180 |
|
22181 |
|
22182 | var LARGE_ARRAY_SIZE = 200;
|
22183 |
|
22184 |
|
22185 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
22186 |
|
22187 |
|
22188 | var COMPARE_PARTIAL_FLAG = 1,
|
22189 | COMPARE_UNORDERED_FLAG = 2;
|
22190 |
|
22191 |
|
22192 | var MAX_SAFE_INTEGER = 9007199254740991;
|
22193 |
|
22194 |
|
22195 | var argsTag = '[object Arguments]',
|
22196 | arrayTag = '[object Array]',
|
22197 | asyncTag = '[object AsyncFunction]',
|
22198 | boolTag = '[object Boolean]',
|
22199 | dateTag = '[object Date]',
|
22200 | errorTag = '[object Error]',
|
22201 | funcTag = '[object Function]',
|
22202 | genTag = '[object GeneratorFunction]',
|
22203 | mapTag = '[object Map]',
|
22204 | numberTag = '[object Number]',
|
22205 | nullTag = '[object Null]',
|
22206 | objectTag = '[object Object]',
|
22207 | promiseTag = '[object Promise]',
|
22208 | proxyTag = '[object Proxy]',
|
22209 | regexpTag = '[object RegExp]',
|
22210 | setTag = '[object Set]',
|
22211 | stringTag = '[object String]',
|
22212 | symbolTag = '[object Symbol]',
|
22213 | undefinedTag = '[object Undefined]',
|
22214 | weakMapTag = '[object WeakMap]';
|
22215 |
|
22216 | var arrayBufferTag = '[object ArrayBuffer]',
|
22217 | dataViewTag = '[object DataView]',
|
22218 | float32Tag = '[object Float32Array]',
|
22219 | float64Tag = '[object Float64Array]',
|
22220 | int8Tag = '[object Int8Array]',
|
22221 | int16Tag = '[object Int16Array]',
|
22222 | int32Tag = '[object Int32Array]',
|
22223 | uint8Tag = '[object Uint8Array]',
|
22224 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
22225 | uint16Tag = '[object Uint16Array]',
|
22226 | uint32Tag = '[object Uint32Array]';
|
22227 |
|
22228 | |
22229 |
|
22230 |
|
22231 |
|
22232 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
22233 |
|
22234 |
|
22235 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
22236 |
|
22237 |
|
22238 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
22239 |
|
22240 |
|
22241 | var typedArrayTags = {};
|
22242 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
22243 | typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
22244 | typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
22245 | typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
22246 | typedArrayTags[uint32Tag] = true;
|
22247 | typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
22248 | typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
22249 | typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
22250 | typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
22251 | typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
22252 | typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
22253 | typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
22254 | typedArrayTags[weakMapTag] = false;
|
22255 |
|
22256 |
|
22257 | var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
22258 |
|
22259 |
|
22260 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
22261 |
|
22262 |
|
22263 | var root = freeGlobal || freeSelf || Function('return this')();
|
22264 |
|
22265 |
|
22266 | var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
22267 |
|
22268 |
|
22269 | var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
22270 |
|
22271 |
|
22272 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
22273 |
|
22274 |
|
22275 | var freeProcess = moduleExports && freeGlobal.process;
|
22276 |
|
22277 |
|
22278 | var nodeUtil = (function() {
|
22279 | try {
|
22280 | return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
22281 | } catch (e) {}
|
22282 | }());
|
22283 |
|
22284 |
|
22285 | var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
22286 |
|
22287 | |
22288 |
|
22289 |
|
22290 |
|
22291 |
|
22292 |
|
22293 |
|
22294 |
|
22295 |
|
22296 | function arrayFilter(array, predicate) {
|
22297 | var index = -1,
|
22298 | length = array == null ? 0 : array.length,
|
22299 | resIndex = 0,
|
22300 | result = [];
|
22301 |
|
22302 | while (++index < length) {
|
22303 | var value = array[index];
|
22304 | if (predicate(value, index, array)) {
|
22305 | result[resIndex++] = value;
|
22306 | }
|
22307 | }
|
22308 | return result;
|
22309 | }
|
22310 |
|
22311 | |
22312 |
|
22313 |
|
22314 |
|
22315 |
|
22316 |
|
22317 |
|
22318 |
|
22319 | function arrayPush(array, values) {
|
22320 | var index = -1,
|
22321 | length = values.length,
|
22322 | offset = array.length;
|
22323 |
|
22324 | while (++index < length) {
|
22325 | array[offset + index] = values[index];
|
22326 | }
|
22327 | return array;
|
22328 | }
|
22329 |
|
22330 | |
22331 |
|
22332 |
|
22333 |
|
22334 |
|
22335 |
|
22336 |
|
22337 |
|
22338 |
|
22339 |
|
22340 | function arraySome(array, predicate) {
|
22341 | var index = -1,
|
22342 | length = array == null ? 0 : array.length;
|
22343 |
|
22344 | while (++index < length) {
|
22345 | if (predicate(array[index], index, array)) {
|
22346 | return true;
|
22347 | }
|
22348 | }
|
22349 | return false;
|
22350 | }
|
22351 |
|
22352 | |
22353 |
|
22354 |
|
22355 |
|
22356 |
|
22357 |
|
22358 |
|
22359 |
|
22360 |
|
22361 | function baseTimes(n, iteratee) {
|
22362 | var index = -1,
|
22363 | result = Array(n);
|
22364 |
|
22365 | while (++index < n) {
|
22366 | result[index] = iteratee(index);
|
22367 | }
|
22368 | return result;
|
22369 | }
|
22370 |
|
22371 | |
22372 |
|
22373 |
|
22374 |
|
22375 |
|
22376 |
|
22377 |
|
22378 | function baseUnary(func) {
|
22379 | return function(value) {
|
22380 | return func(value);
|
22381 | };
|
22382 | }
|
22383 |
|
22384 | |
22385 |
|
22386 |
|
22387 |
|
22388 |
|
22389 |
|
22390 |
|
22391 |
|
22392 | function cacheHas(cache, key) {
|
22393 | return cache.has(key);
|
22394 | }
|
22395 |
|
22396 | |
22397 |
|
22398 |
|
22399 |
|
22400 |
|
22401 |
|
22402 |
|
22403 |
|
22404 | function getValue(object, key) {
|
22405 | return object == null ? undefined : object[key];
|
22406 | }
|
22407 |
|
22408 | |
22409 |
|
22410 |
|
22411 |
|
22412 |
|
22413 |
|
22414 |
|
22415 | function mapToArray(map) {
|
22416 | var index = -1,
|
22417 | result = Array(map.size);
|
22418 |
|
22419 | map.forEach(function(value, key) {
|
22420 | result[++index] = [key, value];
|
22421 | });
|
22422 | return result;
|
22423 | }
|
22424 |
|
22425 | |
22426 |
|
22427 |
|
22428 |
|
22429 |
|
22430 |
|
22431 |
|
22432 |
|
22433 | function overArg(func, transform) {
|
22434 | return function(arg) {
|
22435 | return func(transform(arg));
|
22436 | };
|
22437 | }
|
22438 |
|
22439 | |
22440 |
|
22441 |
|
22442 |
|
22443 |
|
22444 |
|
22445 |
|
22446 | function setToArray(set) {
|
22447 | var index = -1,
|
22448 | result = Array(set.size);
|
22449 |
|
22450 | set.forEach(function(value) {
|
22451 | result[++index] = value;
|
22452 | });
|
22453 | return result;
|
22454 | }
|
22455 |
|
22456 |
|
22457 | var arrayProto = Array.prototype,
|
22458 | funcProto = Function.prototype,
|
22459 | objectProto = Object.prototype;
|
22460 |
|
22461 |
|
22462 | var coreJsData = root['__core-js_shared__'];
|
22463 |
|
22464 |
|
22465 | var funcToString = funcProto.toString;
|
22466 |
|
22467 |
|
22468 | var hasOwnProperty = objectProto.hasOwnProperty;
|
22469 |
|
22470 |
|
22471 | var maskSrcKey = (function() {
|
22472 | var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
22473 | return uid ? ('Symbol(src)_1.' + uid) : '';
|
22474 | }());
|
22475 |
|
22476 | |
22477 |
|
22478 |
|
22479 |
|
22480 |
|
22481 | var nativeObjectToString = objectProto.toString;
|
22482 |
|
22483 |
|
22484 | var reIsNative = RegExp('^' +
|
22485 | funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
22486 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
22487 | );
|
22488 |
|
22489 |
|
22490 | var Buffer = moduleExports ? root.Buffer : undefined,
|
22491 | Symbol = root.Symbol,
|
22492 | Uint8Array = root.Uint8Array,
|
22493 | propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
22494 | splice = arrayProto.splice,
|
22495 | symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
22496 |
|
22497 |
|
22498 | var nativeGetSymbols = Object.getOwnPropertySymbols,
|
22499 | nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
|
22500 | nativeKeys = overArg(Object.keys, Object);
|
22501 |
|
22502 |
|
22503 | var DataView = getNative(root, 'DataView'),
|
22504 | Map = getNative(root, 'Map'),
|
22505 | Promise = getNative(root, 'Promise'),
|
22506 | Set = getNative(root, 'Set'),
|
22507 | WeakMap = getNative(root, 'WeakMap'),
|
22508 | nativeCreate = getNative(Object, 'create');
|
22509 |
|
22510 |
|
22511 | var dataViewCtorString = toSource(DataView),
|
22512 | mapCtorString = toSource(Map),
|
22513 | promiseCtorString = toSource(Promise),
|
22514 | setCtorString = toSource(Set),
|
22515 | weakMapCtorString = toSource(WeakMap);
|
22516 |
|
22517 |
|
22518 | var symbolProto = Symbol ? Symbol.prototype : undefined,
|
22519 | symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
22520 |
|
22521 | |
22522 |
|
22523 |
|
22524 |
|
22525 |
|
22526 |
|
22527 |
|
22528 | function Hash(entries) {
|
22529 | var index = -1,
|
22530 | length = entries == null ? 0 : entries.length;
|
22531 |
|
22532 | this.clear();
|
22533 | while (++index < length) {
|
22534 | var entry = entries[index];
|
22535 | this.set(entry[0], entry[1]);
|
22536 | }
|
22537 | }
|
22538 |
|
22539 | |
22540 |
|
22541 |
|
22542 |
|
22543 |
|
22544 |
|
22545 |
|
22546 | function hashClear() {
|
22547 | this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
22548 | this.size = 0;
|
22549 | }
|
22550 |
|
22551 | |
22552 |
|
22553 |
|
22554 |
|
22555 |
|
22556 |
|
22557 |
|
22558 |
|
22559 |
|
22560 |
|
22561 | function hashDelete(key) {
|
22562 | var result = this.has(key) && delete this.__data__[key];
|
22563 | this.size -= result ? 1 : 0;
|
22564 | return result;
|
22565 | }
|
22566 |
|
22567 | |
22568 |
|
22569 |
|
22570 |
|
22571 |
|
22572 |
|
22573 |
|
22574 |
|
22575 |
|
22576 | function hashGet(key) {
|
22577 | var data = this.__data__;
|
22578 | if (nativeCreate) {
|
22579 | var result = data[key];
|
22580 | return result === HASH_UNDEFINED ? undefined : result;
|
22581 | }
|
22582 | return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
22583 | }
|
22584 |
|
22585 | |
22586 |
|
22587 |
|
22588 |
|
22589 |
|
22590 |
|
22591 |
|
22592 |
|
22593 |
|
22594 | function hashHas(key) {
|
22595 | var data = this.__data__;
|
22596 | return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
22597 | }
|
22598 |
|
22599 | |
22600 |
|
22601 |
|
22602 |
|
22603 |
|
22604 |
|
22605 |
|
22606 |
|
22607 |
|
22608 |
|
22609 | function hashSet(key, value) {
|
22610 | var data = this.__data__;
|
22611 | this.size += this.has(key) ? 0 : 1;
|
22612 | data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
22613 | return this;
|
22614 | }
|
22615 |
|
22616 |
|
22617 | Hash.prototype.clear = hashClear;
|
22618 | Hash.prototype['delete'] = hashDelete;
|
22619 | Hash.prototype.get = hashGet;
|
22620 | Hash.prototype.has = hashHas;
|
22621 | Hash.prototype.set = hashSet;
|
22622 |
|
22623 | |
22624 |
|
22625 |
|
22626 |
|
22627 |
|
22628 |
|
22629 |
|
22630 | function ListCache(entries) {
|
22631 | var index = -1,
|
22632 | length = entries == null ? 0 : entries.length;
|
22633 |
|
22634 | this.clear();
|
22635 | while (++index < length) {
|
22636 | var entry = entries[index];
|
22637 | this.set(entry[0], entry[1]);
|
22638 | }
|
22639 | }
|
22640 |
|
22641 | |
22642 |
|
22643 |
|
22644 |
|
22645 |
|
22646 |
|
22647 |
|
22648 | function listCacheClear() {
|
22649 | this.__data__ = [];
|
22650 | this.size = 0;
|
22651 | }
|
22652 |
|
22653 | |
22654 |
|
22655 |
|
22656 |
|
22657 |
|
22658 |
|
22659 |
|
22660 |
|
22661 |
|
22662 | function listCacheDelete(key) {
|
22663 | var data = this.__data__,
|
22664 | index = assocIndexOf(data, key);
|
22665 |
|
22666 | if (index < 0) {
|
22667 | return false;
|
22668 | }
|
22669 | var lastIndex = data.length - 1;
|
22670 | if (index == lastIndex) {
|
22671 | data.pop();
|
22672 | } else {
|
22673 | splice.call(data, index, 1);
|
22674 | }
|
22675 | --this.size;
|
22676 | return true;
|
22677 | }
|
22678 |
|
22679 | |
22680 |
|
22681 |
|
22682 |
|
22683 |
|
22684 |
|
22685 |
|
22686 |
|
22687 |
|
22688 | function listCacheGet(key) {
|
22689 | var data = this.__data__,
|
22690 | index = assocIndexOf(data, key);
|
22691 |
|
22692 | return index < 0 ? undefined : data[index][1];
|
22693 | }
|
22694 |
|
22695 | |
22696 |
|
22697 |
|
22698 |
|
22699 |
|
22700 |
|
22701 |
|
22702 |
|
22703 |
|
22704 | function listCacheHas(key) {
|
22705 | return assocIndexOf(this.__data__, key) > -1;
|
22706 | }
|
22707 |
|
22708 | |
22709 |
|
22710 |
|
22711 |
|
22712 |
|
22713 |
|
22714 |
|
22715 |
|
22716 |
|
22717 |
|
22718 | function listCacheSet(key, value) {
|
22719 | var data = this.__data__,
|
22720 | index = assocIndexOf(data, key);
|
22721 |
|
22722 | if (index < 0) {
|
22723 | ++this.size;
|
22724 | data.push([key, value]);
|
22725 | } else {
|
22726 | data[index][1] = value;
|
22727 | }
|
22728 | return this;
|
22729 | }
|
22730 |
|
22731 |
|
22732 | ListCache.prototype.clear = listCacheClear;
|
22733 | ListCache.prototype['delete'] = listCacheDelete;
|
22734 | ListCache.prototype.get = listCacheGet;
|
22735 | ListCache.prototype.has = listCacheHas;
|
22736 | ListCache.prototype.set = listCacheSet;
|
22737 |
|
22738 | |
22739 |
|
22740 |
|
22741 |
|
22742 |
|
22743 |
|
22744 |
|
22745 | function MapCache(entries) {
|
22746 | var index = -1,
|
22747 | length = entries == null ? 0 : entries.length;
|
22748 |
|
22749 | this.clear();
|
22750 | while (++index < length) {
|
22751 | var entry = entries[index];
|
22752 | this.set(entry[0], entry[1]);
|
22753 | }
|
22754 | }
|
22755 |
|
22756 | |
22757 |
|
22758 |
|
22759 |
|
22760 |
|
22761 |
|
22762 |
|
22763 | function mapCacheClear() {
|
22764 | this.size = 0;
|
22765 | this.__data__ = {
|
22766 | 'hash': new Hash,
|
22767 | 'map': new (Map || ListCache),
|
22768 | 'string': new Hash
|
22769 | };
|
22770 | }
|
22771 |
|
22772 | |
22773 |
|
22774 |
|
22775 |
|
22776 |
|
22777 |
|
22778 |
|
22779 |
|
22780 |
|
22781 | function mapCacheDelete(key) {
|
22782 | var result = getMapData(this, key)['delete'](key);
|
22783 | this.size -= result ? 1 : 0;
|
22784 | return result;
|
22785 | }
|
22786 |
|
22787 | |
22788 |
|
22789 |
|
22790 |
|
22791 |
|
22792 |
|
22793 |
|
22794 |
|
22795 |
|
22796 | function mapCacheGet(key) {
|
22797 | return getMapData(this, key).get(key);
|
22798 | }
|
22799 |
|
22800 | |
22801 |
|
22802 |
|
22803 |
|
22804 |
|
22805 |
|
22806 |
|
22807 |
|
22808 |
|
22809 | function mapCacheHas(key) {
|
22810 | return getMapData(this, key).has(key);
|
22811 | }
|
22812 |
|
22813 | |
22814 |
|
22815 |
|
22816 |
|
22817 |
|
22818 |
|
22819 |
|
22820 |
|
22821 |
|
22822 |
|
22823 | function mapCacheSet(key, value) {
|
22824 | var data = getMapData(this, key),
|
22825 | size = data.size;
|
22826 |
|
22827 | data.set(key, value);
|
22828 | this.size += data.size == size ? 0 : 1;
|
22829 | return this;
|
22830 | }
|
22831 |
|
22832 |
|
22833 | MapCache.prototype.clear = mapCacheClear;
|
22834 | MapCache.prototype['delete'] = mapCacheDelete;
|
22835 | MapCache.prototype.get = mapCacheGet;
|
22836 | MapCache.prototype.has = mapCacheHas;
|
22837 | MapCache.prototype.set = mapCacheSet;
|
22838 |
|
22839 | |
22840 |
|
22841 |
|
22842 |
|
22843 |
|
22844 |
|
22845 |
|
22846 |
|
22847 | function SetCache(values) {
|
22848 | var index = -1,
|
22849 | length = values == null ? 0 : values.length;
|
22850 |
|
22851 | this.__data__ = new MapCache;
|
22852 | while (++index < length) {
|
22853 | this.add(values[index]);
|
22854 | }
|
22855 | }
|
22856 |
|
22857 | |
22858 |
|
22859 |
|
22860 |
|
22861 |
|
22862 |
|
22863 |
|
22864 |
|
22865 |
|
22866 |
|
22867 | function setCacheAdd(value) {
|
22868 | this.__data__.set(value, HASH_UNDEFINED);
|
22869 | return this;
|
22870 | }
|
22871 |
|
22872 | |
22873 |
|
22874 |
|
22875 |
|
22876 |
|
22877 |
|
22878 |
|
22879 |
|
22880 |
|
22881 | function setCacheHas(value) {
|
22882 | return this.__data__.has(value);
|
22883 | }
|
22884 |
|
22885 |
|
22886 | SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
22887 | SetCache.prototype.has = setCacheHas;
|
22888 |
|
22889 | |
22890 |
|
22891 |
|
22892 |
|
22893 |
|
22894 |
|
22895 |
|
22896 | function Stack(entries) {
|
22897 | var data = this.__data__ = new ListCache(entries);
|
22898 | this.size = data.size;
|
22899 | }
|
22900 |
|
22901 | |
22902 |
|
22903 |
|
22904 |
|
22905 |
|
22906 |
|
22907 |
|
22908 | function stackClear() {
|
22909 | this.__data__ = new ListCache;
|
22910 | this.size = 0;
|
22911 | }
|
22912 |
|
22913 | |
22914 |
|
22915 |
|
22916 |
|
22917 |
|
22918 |
|
22919 |
|
22920 |
|
22921 |
|
22922 | function stackDelete(key) {
|
22923 | var data = this.__data__,
|
22924 | result = data['delete'](key);
|
22925 |
|
22926 | this.size = data.size;
|
22927 | return result;
|
22928 | }
|
22929 |
|
22930 | |
22931 |
|
22932 |
|
22933 |
|
22934 |
|
22935 |
|
22936 |
|
22937 |
|
22938 |
|
22939 | function stackGet(key) {
|
22940 | return this.__data__.get(key);
|
22941 | }
|
22942 |
|
22943 | |
22944 |
|
22945 |
|
22946 |
|
22947 |
|
22948 |
|
22949 |
|
22950 |
|
22951 |
|
22952 | function stackHas(key) {
|
22953 | return this.__data__.has(key);
|
22954 | }
|
22955 |
|
22956 | |
22957 |
|
22958 |
|
22959 |
|
22960 |
|
22961 |
|
22962 |
|
22963 |
|
22964 |
|
22965 |
|
22966 | function stackSet(key, value) {
|
22967 | var data = this.__data__;
|
22968 | if (data instanceof ListCache) {
|
22969 | var pairs = data.__data__;
|
22970 | if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
22971 | pairs.push([key, value]);
|
22972 | this.size = ++data.size;
|
22973 | return this;
|
22974 | }
|
22975 | data = this.__data__ = new MapCache(pairs);
|
22976 | }
|
22977 | data.set(key, value);
|
22978 | this.size = data.size;
|
22979 | return this;
|
22980 | }
|
22981 |
|
22982 |
|
22983 | Stack.prototype.clear = stackClear;
|
22984 | Stack.prototype['delete'] = stackDelete;
|
22985 | Stack.prototype.get = stackGet;
|
22986 | Stack.prototype.has = stackHas;
|
22987 | Stack.prototype.set = stackSet;
|
22988 |
|
22989 | |
22990 |
|
22991 |
|
22992 |
|
22993 |
|
22994 |
|
22995 |
|
22996 |
|
22997 | function arrayLikeKeys(value, inherited) {
|
22998 | var isArr = isArray(value),
|
22999 | isArg = !isArr && isArguments(value),
|
23000 | isBuff = !isArr && !isArg && isBuffer(value),
|
23001 | isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
23002 | skipIndexes = isArr || isArg || isBuff || isType,
|
23003 | result = skipIndexes ? baseTimes(value.length, String) : [],
|
23004 | length = result.length;
|
23005 |
|
23006 | for (var key in value) {
|
23007 | if ((inherited || hasOwnProperty.call(value, key)) &&
|
23008 | !(skipIndexes && (
|
23009 |
|
23010 | key == 'length' ||
|
23011 |
|
23012 | (isBuff && (key == 'offset' || key == 'parent')) ||
|
23013 |
|
23014 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
23015 |
|
23016 | isIndex(key, length)
|
23017 | ))) {
|
23018 | result.push(key);
|
23019 | }
|
23020 | }
|
23021 | return result;
|
23022 | }
|
23023 |
|
23024 | |
23025 |
|
23026 |
|
23027 |
|
23028 |
|
23029 |
|
23030 |
|
23031 |
|
23032 | function assocIndexOf(array, key) {
|
23033 | var length = array.length;
|
23034 | while (length--) {
|
23035 | if (eq(array[length][0], key)) {
|
23036 | return length;
|
23037 | }
|
23038 | }
|
23039 | return -1;
|
23040 | }
|
23041 |
|
23042 | |
23043 |
|
23044 |
|
23045 |
|
23046 |
|
23047 |
|
23048 |
|
23049 |
|
23050 |
|
23051 |
|
23052 |
|
23053 | function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
23054 | var result = keysFunc(object);
|
23055 | return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
23056 | }
|
23057 |
|
23058 | |
23059 |
|
23060 |
|
23061 |
|
23062 |
|
23063 |
|
23064 |
|
23065 | function baseGetTag(value) {
|
23066 | if (value == null) {
|
23067 | return value === undefined ? undefinedTag : nullTag;
|
23068 | }
|
23069 | return (symToStringTag && symToStringTag in Object(value))
|
23070 | ? getRawTag(value)
|
23071 | : objectToString(value);
|
23072 | }
|
23073 |
|
23074 | |
23075 |
|
23076 |
|
23077 |
|
23078 |
|
23079 |
|
23080 |
|
23081 | function baseIsArguments(value) {
|
23082 | return isObjectLike(value) && baseGetTag(value) == argsTag;
|
23083 | }
|
23084 |
|
23085 | |
23086 |
|
23087 |
|
23088 |
|
23089 |
|
23090 |
|
23091 |
|
23092 |
|
23093 |
|
23094 |
|
23095 |
|
23096 |
|
23097 |
|
23098 |
|
23099 | function baseIsEqual(value, other, bitmask, customizer, stack) {
|
23100 | if (value === other) {
|
23101 | return true;
|
23102 | }
|
23103 | if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
23104 | return value !== value && other !== other;
|
23105 | }
|
23106 | return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
23107 | }
|
23108 |
|
23109 | |
23110 |
|
23111 |
|
23112 |
|
23113 |
|
23114 |
|
23115 |
|
23116 |
|
23117 |
|
23118 |
|
23119 |
|
23120 |
|
23121 |
|
23122 |
|
23123 | function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
23124 | var objIsArr = isArray(object),
|
23125 | othIsArr = isArray(other),
|
23126 | objTag = objIsArr ? arrayTag : getTag(object),
|
23127 | othTag = othIsArr ? arrayTag : getTag(other);
|
23128 |
|
23129 | objTag = objTag == argsTag ? objectTag : objTag;
|
23130 | othTag = othTag == argsTag ? objectTag : othTag;
|
23131 |
|
23132 | var objIsObj = objTag == objectTag,
|
23133 | othIsObj = othTag == objectTag,
|
23134 | isSameTag = objTag == othTag;
|
23135 |
|
23136 | if (isSameTag && isBuffer(object)) {
|
23137 | if (!isBuffer(other)) {
|
23138 | return false;
|
23139 | }
|
23140 | objIsArr = true;
|
23141 | objIsObj = false;
|
23142 | }
|
23143 | if (isSameTag && !objIsObj) {
|
23144 | stack || (stack = new Stack);
|
23145 | return (objIsArr || isTypedArray(object))
|
23146 | ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
23147 | : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
23148 | }
|
23149 | if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
23150 | var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
23151 | othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
23152 |
|
23153 | if (objIsWrapped || othIsWrapped) {
|
23154 | var objUnwrapped = objIsWrapped ? object.value() : object,
|
23155 | othUnwrapped = othIsWrapped ? other.value() : other;
|
23156 |
|
23157 | stack || (stack = new Stack);
|
23158 | return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
23159 | }
|
23160 | }
|
23161 | if (!isSameTag) {
|
23162 | return false;
|
23163 | }
|
23164 | stack || (stack = new Stack);
|
23165 | return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
23166 | }
|
23167 |
|
23168 | |
23169 |
|
23170 |
|
23171 |
|
23172 |
|
23173 |
|
23174 |
|
23175 |
|
23176 | function baseIsNative(value) {
|
23177 | if (!isObject(value) || isMasked(value)) {
|
23178 | return false;
|
23179 | }
|
23180 | var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
23181 | return pattern.test(toSource(value));
|
23182 | }
|
23183 |
|
23184 | |
23185 |
|
23186 |
|
23187 |
|
23188 |
|
23189 |
|
23190 |
|
23191 | function baseIsTypedArray(value) {
|
23192 | return isObjectLike(value) &&
|
23193 | isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
23194 | }
|
23195 |
|
23196 | |
23197 |
|
23198 |
|
23199 |
|
23200 |
|
23201 |
|
23202 |
|
23203 | function baseKeys(object) {
|
23204 | if (!isPrototype(object)) {
|
23205 | return nativeKeys(object);
|
23206 | }
|
23207 | var result = [];
|
23208 | for (var key in Object(object)) {
|
23209 | if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
23210 | result.push(key);
|
23211 | }
|
23212 | }
|
23213 | return result;
|
23214 | }
|
23215 |
|
23216 | |
23217 |
|
23218 |
|
23219 |
|
23220 |
|
23221 |
|
23222 |
|
23223 |
|
23224 |
|
23225 |
|
23226 |
|
23227 |
|
23228 |
|
23229 | function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
23230 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
23231 | arrLength = array.length,
|
23232 | othLength = other.length;
|
23233 |
|
23234 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
23235 | return false;
|
23236 | }
|
23237 |
|
23238 | var stacked = stack.get(array);
|
23239 | if (stacked && stack.get(other)) {
|
23240 | return stacked == other;
|
23241 | }
|
23242 | var index = -1,
|
23243 | result = true,
|
23244 | seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
|
23245 |
|
23246 | stack.set(array, other);
|
23247 | stack.set(other, array);
|
23248 |
|
23249 |
|
23250 | while (++index < arrLength) {
|
23251 | var arrValue = array[index],
|
23252 | othValue = other[index];
|
23253 |
|
23254 | if (customizer) {
|
23255 | var compared = isPartial
|
23256 | ? customizer(othValue, arrValue, index, other, array, stack)
|
23257 | : customizer(arrValue, othValue, index, array, other, stack);
|
23258 | }
|
23259 | if (compared !== undefined) {
|
23260 | if (compared) {
|
23261 | continue;
|
23262 | }
|
23263 | result = false;
|
23264 | break;
|
23265 | }
|
23266 |
|
23267 | if (seen) {
|
23268 | if (!arraySome(other, function(othValue, othIndex) {
|
23269 | if (!cacheHas(seen, othIndex) &&
|
23270 | (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
23271 | return seen.push(othIndex);
|
23272 | }
|
23273 | })) {
|
23274 | result = false;
|
23275 | break;
|
23276 | }
|
23277 | } else if (!(
|
23278 | arrValue === othValue ||
|
23279 | equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
23280 | )) {
|
23281 | result = false;
|
23282 | break;
|
23283 | }
|
23284 | }
|
23285 | stack['delete'](array);
|
23286 | stack['delete'](other);
|
23287 | return result;
|
23288 | }
|
23289 |
|
23290 | |
23291 |
|
23292 |
|
23293 |
|
23294 |
|
23295 |
|
23296 |
|
23297 |
|
23298 |
|
23299 |
|
23300 |
|
23301 |
|
23302 |
|
23303 |
|
23304 |
|
23305 |
|
23306 |
|
23307 | function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
23308 | switch (tag) {
|
23309 | case dataViewTag:
|
23310 | if ((object.byteLength != other.byteLength) ||
|
23311 | (object.byteOffset != other.byteOffset)) {
|
23312 | return false;
|
23313 | }
|
23314 | object = object.buffer;
|
23315 | other = other.buffer;
|
23316 |
|
23317 | case arrayBufferTag:
|
23318 | if ((object.byteLength != other.byteLength) ||
|
23319 | !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
23320 | return false;
|
23321 | }
|
23322 | return true;
|
23323 |
|
23324 | case boolTag:
|
23325 | case dateTag:
|
23326 | case numberTag:
|
23327 |
|
23328 |
|
23329 | return eq(+object, +other);
|
23330 |
|
23331 | case errorTag:
|
23332 | return object.name == other.name && object.message == other.message;
|
23333 |
|
23334 | case regexpTag:
|
23335 | case stringTag:
|
23336 |
|
23337 |
|
23338 |
|
23339 | return object == (other + '');
|
23340 |
|
23341 | case mapTag:
|
23342 | var convert = mapToArray;
|
23343 |
|
23344 | case setTag:
|
23345 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
23346 | convert || (convert = setToArray);
|
23347 |
|
23348 | if (object.size != other.size && !isPartial) {
|
23349 | return false;
|
23350 | }
|
23351 |
|
23352 | var stacked = stack.get(object);
|
23353 | if (stacked) {
|
23354 | return stacked == other;
|
23355 | }
|
23356 | bitmask |= COMPARE_UNORDERED_FLAG;
|
23357 |
|
23358 |
|
23359 | stack.set(object, other);
|
23360 | var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
23361 | stack['delete'](object);
|
23362 | return result;
|
23363 |
|
23364 | case symbolTag:
|
23365 | if (symbolValueOf) {
|
23366 | return symbolValueOf.call(object) == symbolValueOf.call(other);
|
23367 | }
|
23368 | }
|
23369 | return false;
|
23370 | }
|
23371 |
|
23372 | |
23373 |
|
23374 |
|
23375 |
|
23376 |
|
23377 |
|
23378 |
|
23379 |
|
23380 |
|
23381 |
|
23382 |
|
23383 |
|
23384 |
|
23385 | function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
23386 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
23387 | objProps = getAllKeys(object),
|
23388 | objLength = objProps.length,
|
23389 | othProps = getAllKeys(other),
|
23390 | othLength = othProps.length;
|
23391 |
|
23392 | if (objLength != othLength && !isPartial) {
|
23393 | return false;
|
23394 | }
|
23395 | var index = objLength;
|
23396 | while (index--) {
|
23397 | var key = objProps[index];
|
23398 | if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
23399 | return false;
|
23400 | }
|
23401 | }
|
23402 |
|
23403 | var stacked = stack.get(object);
|
23404 | if (stacked && stack.get(other)) {
|
23405 | return stacked == other;
|
23406 | }
|
23407 | var result = true;
|
23408 | stack.set(object, other);
|
23409 | stack.set(other, object);
|
23410 |
|
23411 | var skipCtor = isPartial;
|
23412 | while (++index < objLength) {
|
23413 | key = objProps[index];
|
23414 | var objValue = object[key],
|
23415 | othValue = other[key];
|
23416 |
|
23417 | if (customizer) {
|
23418 | var compared = isPartial
|
23419 | ? customizer(othValue, objValue, key, other, object, stack)
|
23420 | : customizer(objValue, othValue, key, object, other, stack);
|
23421 | }
|
23422 |
|
23423 | if (!(compared === undefined
|
23424 | ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
23425 | : compared
|
23426 | )) {
|
23427 | result = false;
|
23428 | break;
|
23429 | }
|
23430 | skipCtor || (skipCtor = key == 'constructor');
|
23431 | }
|
23432 | if (result && !skipCtor) {
|
23433 | var objCtor = object.constructor,
|
23434 | othCtor = other.constructor;
|
23435 |
|
23436 |
|
23437 | if (objCtor != othCtor &&
|
23438 | ('constructor' in object && 'constructor' in other) &&
|
23439 | !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
23440 | typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
23441 | result = false;
|
23442 | }
|
23443 | }
|
23444 | stack['delete'](object);
|
23445 | stack['delete'](other);
|
23446 | return result;
|
23447 | }
|
23448 |
|
23449 | |
23450 |
|
23451 |
|
23452 |
|
23453 |
|
23454 |
|
23455 |
|
23456 | function getAllKeys(object) {
|
23457 | return baseGetAllKeys(object, keys, getSymbols);
|
23458 | }
|
23459 |
|
23460 | |
23461 |
|
23462 |
|
23463 |
|
23464 |
|
23465 |
|
23466 |
|
23467 |
|
23468 | function getMapData(map, key) {
|
23469 | var data = map.__data__;
|
23470 | return isKeyable(key)
|
23471 | ? data[typeof key == 'string' ? 'string' : 'hash']
|
23472 | : data.map;
|
23473 | }
|
23474 |
|
23475 | |
23476 |
|
23477 |
|
23478 |
|
23479 |
|
23480 |
|
23481 |
|
23482 |
|
23483 | function getNative(object, key) {
|
23484 | var value = getValue(object, key);
|
23485 | return baseIsNative(value) ? value : undefined;
|
23486 | }
|
23487 |
|
23488 | |
23489 |
|
23490 |
|
23491 |
|
23492 |
|
23493 |
|
23494 |
|
23495 | function getRawTag(value) {
|
23496 | var isOwn = hasOwnProperty.call(value, symToStringTag),
|
23497 | tag = value[symToStringTag];
|
23498 |
|
23499 | try {
|
23500 | value[symToStringTag] = undefined;
|
23501 | var unmasked = true;
|
23502 | } catch (e) {}
|
23503 |
|
23504 | var result = nativeObjectToString.call(value);
|
23505 | if (unmasked) {
|
23506 | if (isOwn) {
|
23507 | value[symToStringTag] = tag;
|
23508 | } else {
|
23509 | delete value[symToStringTag];
|
23510 | }
|
23511 | }
|
23512 | return result;
|
23513 | }
|
23514 |
|
23515 | |
23516 |
|
23517 |
|
23518 |
|
23519 |
|
23520 |
|
23521 |
|
23522 | var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
23523 | if (object == null) {
|
23524 | return [];
|
23525 | }
|
23526 | object = Object(object);
|
23527 | return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
23528 | return propertyIsEnumerable.call(object, symbol);
|
23529 | });
|
23530 | };
|
23531 |
|
23532 | |
23533 |
|
23534 |
|
23535 |
|
23536 |
|
23537 |
|
23538 |
|
23539 | var getTag = baseGetTag;
|
23540 |
|
23541 |
|
23542 | if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
23543 | (Map && getTag(new Map) != mapTag) ||
|
23544 | (Promise && getTag(Promise.resolve()) != promiseTag) ||
|
23545 | (Set && getTag(new Set) != setTag) ||
|
23546 | (WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
23547 | getTag = function(value) {
|
23548 | var result = baseGetTag(value),
|
23549 | Ctor = result == objectTag ? value.constructor : undefined,
|
23550 | ctorString = Ctor ? toSource(Ctor) : '';
|
23551 |
|
23552 | if (ctorString) {
|
23553 | switch (ctorString) {
|
23554 | case dataViewCtorString: return dataViewTag;
|
23555 | case mapCtorString: return mapTag;
|
23556 | case promiseCtorString: return promiseTag;
|
23557 | case setCtorString: return setTag;
|
23558 | case weakMapCtorString: return weakMapTag;
|
23559 | }
|
23560 | }
|
23561 | return result;
|
23562 | };
|
23563 | }
|
23564 |
|
23565 | |
23566 |
|
23567 |
|
23568 |
|
23569 |
|
23570 |
|
23571 |
|
23572 |
|
23573 | function isIndex(value, length) {
|
23574 | length = length == null ? MAX_SAFE_INTEGER : length;
|
23575 | return !!length &&
|
23576 | (typeof value == 'number' || reIsUint.test(value)) &&
|
23577 | (value > -1 && value % 1 == 0 && value < length);
|
23578 | }
|
23579 |
|
23580 | |
23581 |
|
23582 |
|
23583 |
|
23584 |
|
23585 |
|
23586 |
|
23587 | function isKeyable(value) {
|
23588 | var type = typeof value;
|
23589 | return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
23590 | ? (value !== '__proto__')
|
23591 | : (value === null);
|
23592 | }
|
23593 |
|
23594 | |
23595 |
|
23596 |
|
23597 |
|
23598 |
|
23599 |
|
23600 |
|
23601 | function isMasked(func) {
|
23602 | return !!maskSrcKey && (maskSrcKey in func);
|
23603 | }
|
23604 |
|
23605 | |
23606 |
|
23607 |
|
23608 |
|
23609 |
|
23610 |
|
23611 |
|
23612 | function isPrototype(value) {
|
23613 | var Ctor = value && value.constructor,
|
23614 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
23615 |
|
23616 | return value === proto;
|
23617 | }
|
23618 |
|
23619 | |
23620 |
|
23621 |
|
23622 |
|
23623 |
|
23624 |
|
23625 |
|
23626 | function objectToString(value) {
|
23627 | return nativeObjectToString.call(value);
|
23628 | }
|
23629 |
|
23630 | |
23631 |
|
23632 |
|
23633 |
|
23634 |
|
23635 |
|
23636 |
|
23637 | function toSource(func) {
|
23638 | if (func != null) {
|
23639 | try {
|
23640 | return funcToString.call(func);
|
23641 | } catch (e) {}
|
23642 | try {
|
23643 | return (func + '');
|
23644 | } catch (e) {}
|
23645 | }
|
23646 | return '';
|
23647 | }
|
23648 |
|
23649 | |
23650 |
|
23651 |
|
23652 |
|
23653 |
|
23654 |
|
23655 |
|
23656 |
|
23657 |
|
23658 |
|
23659 |
|
23660 |
|
23661 |
|
23662 |
|
23663 |
|
23664 |
|
23665 |
|
23666 |
|
23667 |
|
23668 |
|
23669 |
|
23670 |
|
23671 |
|
23672 |
|
23673 |
|
23674 |
|
23675 |
|
23676 |
|
23677 |
|
23678 |
|
23679 |
|
23680 |
|
23681 | function eq(value, other) {
|
23682 | return value === other || (value !== value && other !== other);
|
23683 | }
|
23684 |
|
23685 | |
23686 |
|
23687 |
|
23688 |
|
23689 |
|
23690 |
|
23691 |
|
23692 |
|
23693 |
|
23694 |
|
23695 |
|
23696 |
|
23697 |
|
23698 |
|
23699 |
|
23700 |
|
23701 |
|
23702 |
|
23703 | var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
23704 | return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
23705 | !propertyIsEnumerable.call(value, 'callee');
|
23706 | };
|
23707 |
|
23708 | |
23709 |
|
23710 |
|
23711 |
|
23712 |
|
23713 |
|
23714 |
|
23715 |
|
23716 |
|
23717 |
|
23718 |
|
23719 |
|
23720 |
|
23721 |
|
23722 |
|
23723 |
|
23724 |
|
23725 |
|
23726 |
|
23727 |
|
23728 |
|
23729 |
|
23730 |
|
23731 | var isArray = Array.isArray;
|
23732 |
|
23733 | |
23734 |
|
23735 |
|
23736 |
|
23737 |
|
23738 |
|
23739 |
|
23740 |
|
23741 |
|
23742 |
|
23743 |
|
23744 |
|
23745 |
|
23746 |
|
23747 |
|
23748 |
|
23749 |
|
23750 |
|
23751 |
|
23752 |
|
23753 |
|
23754 |
|
23755 |
|
23756 |
|
23757 |
|
23758 | function isArrayLike(value) {
|
23759 | return value != null && isLength(value.length) && !isFunction(value);
|
23760 | }
|
23761 |
|
23762 | |
23763 |
|
23764 |
|
23765 |
|
23766 |
|
23767 |
|
23768 |
|
23769 |
|
23770 |
|
23771 |
|
23772 |
|
23773 |
|
23774 |
|
23775 |
|
23776 |
|
23777 |
|
23778 |
|
23779 | var isBuffer = nativeIsBuffer || stubFalse;
|
23780 |
|
23781 | |
23782 |
|
23783 |
|
23784 |
|
23785 |
|
23786 |
|
23787 |
|
23788 |
|
23789 |
|
23790 |
|
23791 |
|
23792 |
|
23793 |
|
23794 |
|
23795 |
|
23796 |
|
23797 |
|
23798 |
|
23799 |
|
23800 |
|
23801 |
|
23802 |
|
23803 |
|
23804 |
|
23805 |
|
23806 |
|
23807 |
|
23808 |
|
23809 | function isEqual(value, other) {
|
23810 | return baseIsEqual(value, other);
|
23811 | }
|
23812 |
|
23813 | |
23814 |
|
23815 |
|
23816 |
|
23817 |
|
23818 |
|
23819 |
|
23820 |
|
23821 |
|
23822 |
|
23823 |
|
23824 |
|
23825 |
|
23826 |
|
23827 |
|
23828 |
|
23829 |
|
23830 | function isFunction(value) {
|
23831 | if (!isObject(value)) {
|
23832 | return false;
|
23833 | }
|
23834 |
|
23835 |
|
23836 | var tag = baseGetTag(value);
|
23837 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
23838 | }
|
23839 |
|
23840 | |
23841 |
|
23842 |
|
23843 |
|
23844 |
|
23845 |
|
23846 |
|
23847 |
|
23848 |
|
23849 |
|
23850 |
|
23851 |
|
23852 |
|
23853 |
|
23854 |
|
23855 |
|
23856 |
|
23857 |
|
23858 |
|
23859 |
|
23860 |
|
23861 |
|
23862 |
|
23863 |
|
23864 |
|
23865 |
|
23866 | function isLength(value) {
|
23867 | return typeof value == 'number' &&
|
23868 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
23869 | }
|
23870 |
|
23871 | |
23872 |
|
23873 |
|
23874 |
|
23875 |
|
23876 |
|
23877 |
|
23878 |
|
23879 |
|
23880 |
|
23881 |
|
23882 |
|
23883 |
|
23884 |
|
23885 |
|
23886 |
|
23887 |
|
23888 |
|
23889 |
|
23890 |
|
23891 |
|
23892 |
|
23893 |
|
23894 |
|
23895 |
|
23896 | function isObject(value) {
|
23897 | var type = typeof value;
|
23898 | return value != null && (type == 'object' || type == 'function');
|
23899 | }
|
23900 |
|
23901 | |
23902 |
|
23903 |
|
23904 |
|
23905 |
|
23906 |
|
23907 |
|
23908 |
|
23909 |
|
23910 |
|
23911 |
|
23912 |
|
23913 |
|
23914 |
|
23915 |
|
23916 |
|
23917 |
|
23918 |
|
23919 |
|
23920 |
|
23921 |
|
23922 |
|
23923 |
|
23924 |
|
23925 | function isObjectLike(value) {
|
23926 | return value != null && typeof value == 'object';
|
23927 | }
|
23928 |
|
23929 | |
23930 |
|
23931 |
|
23932 |
|
23933 |
|
23934 |
|
23935 |
|
23936 |
|
23937 |
|
23938 |
|
23939 |
|
23940 |
|
23941 |
|
23942 |
|
23943 |
|
23944 |
|
23945 |
|
23946 | var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
23947 |
|
23948 | |
23949 |
|
23950 |
|
23951 |
|
23952 |
|
23953 |
|
23954 |
|
23955 |
|
23956 |
|
23957 |
|
23958 |
|
23959 |
|
23960 |
|
23961 |
|
23962 |
|
23963 |
|
23964 |
|
23965 |
|
23966 |
|
23967 |
|
23968 |
|
23969 |
|
23970 |
|
23971 |
|
23972 |
|
23973 |
|
23974 |
|
23975 |
|
23976 | function keys(object) {
|
23977 | return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
23978 | }
|
23979 |
|
23980 | |
23981 |
|
23982 |
|
23983 |
|
23984 |
|
23985 |
|
23986 |
|
23987 |
|
23988 |
|
23989 |
|
23990 |
|
23991 |
|
23992 |
|
23993 |
|
23994 |
|
23995 |
|
23996 |
|
23997 |
|
23998 | function stubArray() {
|
23999 | return [];
|
24000 | }
|
24001 |
|
24002 | |
24003 |
|
24004 |
|
24005 |
|
24006 |
|
24007 |
|
24008 |
|
24009 |
|
24010 |
|
24011 |
|
24012 |
|
24013 |
|
24014 |
|
24015 | function stubFalse() {
|
24016 | return false;
|
24017 | }
|
24018 |
|
24019 | module.exports = isEqual;
|
24020 |
|
24021 | }.call(exports, (function() { return this; }()), __webpack_require__(132)(module)))
|
24022 |
|
24023 | }),
|
24024 |
|
24025 | (function(module, exports, __webpack_require__) {
|
24026 |
|
24027 | 'use strict';
|
24028 |
|
24029 | Object.defineProperty(exports, "__esModule", {
|
24030 | value: true
|
24031 | });
|
24032 |
|
24033 | 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; };
|
24034 |
|
24035 | 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"); } }; }();
|
24036 |
|
24037 | var _react = __webpack_require__(4);
|
24038 |
|
24039 | var _react2 = _interopRequireDefault(_react);
|
24040 |
|
24041 | var _reactDom = __webpack_require__(12);
|
24042 |
|
24043 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
24044 |
|
24045 | var _reactBeautifulDnd = __webpack_require__(83);
|
24046 |
|
24047 | var _util = __webpack_require__(185);
|
24048 |
|
24049 | var _classnames = __webpack_require__(3);
|
24050 |
|
24051 | var _classnames2 = _interopRequireDefault(_classnames);
|
24052 |
|
24053 | var _lodash = __webpack_require__(183);
|
24054 |
|
24055 | var _lodash2 = _interopRequireDefault(_lodash);
|
24056 |
|
24057 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24058 |
|
24059 | 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; }
|
24060 |
|
24061 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24062 |
|
24063 | 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; }
|
24064 |
|
24065 | 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); }
|
24066 |
|
24067 | var reorder = function reorder(list, startIndex, endIndex) {
|
24068 | var result = Array.from(list);
|
24069 |
|
24070 | var _result$splice = result.splice(startIndex, 1),
|
24071 | _result$splice2 = _slicedToArray(_result$splice, 1),
|
24072 | removed = _result$splice2[0];
|
24073 |
|
24074 | result.splice(endIndex, 0, removed);
|
24075 |
|
24076 | return result;
|
24077 | };
|
24078 |
|
24079 | var Vertical = function (_Component) {
|
24080 | _inherits(Vertical, _Component);
|
24081 |
|
24082 | function Vertical(props) {
|
24083 | _classCallCheck(this, Vertical);
|
24084 |
|
24085 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
24086 |
|
24087 | _this.onDragEnd = function (result) {
|
24088 | if (!result.destination) {
|
24089 | return;
|
24090 | }
|
24091 | var items = reorder(_this.state.items, result.source.index, result.destination.index);
|
24092 |
|
24093 | _this.setState({
|
24094 | items: items
|
24095 | });
|
24096 | _this.props.onStop(result, items);
|
24097 | };
|
24098 |
|
24099 | _this.onDragStart = function (result) {
|
24100 | _this.props.onStart(result, _this.state.items);
|
24101 | };
|
24102 |
|
24103 | _this.state = {
|
24104 | items: _this.props.list || []
|
24105 | };
|
24106 | return _this;
|
24107 | }
|
24108 |
|
24109 | Vertical.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
24110 | if (!(0, _lodash2['default'])(this.state.items, nextProps.list)) {
|
24111 | this.setState({
|
24112 | items: nextProps.list
|
24113 | });
|
24114 | }
|
24115 | };
|
24116 |
|
24117 | Vertical.prototype.render = function render() {
|
24118 | var _this2 = this;
|
24119 |
|
24120 | var _props = this.props,
|
24121 | onStart = _props.onStart,
|
24122 | onDrag = _props.onDrag,
|
24123 | onStop = _props.onStop,
|
24124 | onDragUpdate = _props.onDragUpdate,
|
24125 | dropClass = _props.dropClass,
|
24126 | dropOverClass = _props.dropOverClass,
|
24127 | dragClass = _props.dragClass,
|
24128 | dragingClass = _props.dragingClass,
|
24129 | showKey = _props.showKey,
|
24130 | type = _props.type;
|
24131 |
|
24132 |
|
24133 | return _react2['default'].createElement(
|
24134 | _reactBeautifulDnd.DragDropContext,
|
24135 | { onDragEnd: this.onDragEnd, onDragStart: this.onDragStart, onDragUpdate: onDragUpdate },
|
24136 | _react2['default'].createElement(
|
24137 | _reactBeautifulDnd.Droppable,
|
24138 | { droppableId: 'droppable', direction: type },
|
24139 | function (provided, snapshot) {
|
24140 | return _react2['default'].createElement(
|
24141 | 'div',
|
24142 | {
|
24143 | ref: provided.innerRef,
|
24144 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDraggingOver).drop))
|
24145 | },
|
24146 | _this2.state.items.map(function (item, index) {
|
24147 | return _react2['default'].createElement(
|
24148 | _reactBeautifulDnd.Draggable,
|
24149 | { key: index, draggableId: index, index: index },
|
24150 | function (provided, snapshot) {
|
24151 | return _react2['default'].createElement(
|
24152 | 'div',
|
24153 | _extends({
|
24154 | ref: provided.innerRef
|
24155 | }, provided.draggableProps, provided.dragHandleProps, {
|
24156 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDragging).drag)),
|
24157 | style: _extends({}, provided.draggableProps.style)
|
24158 | }),
|
24159 | showKey ? item[showKey] : item
|
24160 | );
|
24161 | }
|
24162 | );
|
24163 | }),
|
24164 | provided.placeholder
|
24165 | );
|
24166 | }
|
24167 | )
|
24168 | );
|
24169 | };
|
24170 |
|
24171 | return Vertical;
|
24172 | }(_react.Component);
|
24173 |
|
24174 | exports['default'] = Vertical;
|
24175 | module.exports = exports['default'];
|
24176 |
|
24177 | }),
|
24178 |
|
24179 | (function(module, exports) {
|
24180 |
|
24181 | 'use strict';
|
24182 |
|
24183 | Object.defineProperty(exports, "__esModule", {
|
24184 | value: true
|
24185 | });
|
24186 | var getClass = exports.getClass = function getClass(props, doing) {
|
24187 | var dropClass = props.dropClass,
|
24188 | dropOverClass = props.dropOverClass,
|
24189 | dragClass = props.dragClass,
|
24190 | dragingClass = props.dragingClass,
|
24191 | type = props.type;
|
24192 |
|
24193 |
|
24194 | var verticalObj = {
|
24195 | drop: {}, drag: {}
|
24196 | };
|
24197 | verticalObj.drop['u-drop ' + dropClass] = true;
|
24198 | verticalObj.drop['u-droping ' + dropOverClass] = doing;
|
24199 | verticalObj.drag['u-drag ' + dragClass] = true;
|
24200 | verticalObj.drag['u-draging ' + dragingClass] = doing;
|
24201 |
|
24202 | var horizontalObj = {
|
24203 | drop: {}, drag: {}
|
24204 | };
|
24205 | horizontalObj.drop['u-drop u-drop-horizontal ' + dropClass] = true;
|
24206 | horizontalObj.drop['u-droping u-droping-horizontal ' + dropOverClass] = doing;
|
24207 | horizontalObj.drag['u-drag u-drag-horizontal ' + dragClass] = true;
|
24208 | horizontalObj.drag['u-draging u-draging-horizontal ' + dragingClass] = doing;
|
24209 |
|
24210 | switch (type) {
|
24211 | case 'vertical':
|
24212 | return verticalObj;
|
24213 | break;
|
24214 | case 'horizontal':
|
24215 | return horizontalObj;
|
24216 | break;
|
24217 | case 'betweenVertical':
|
24218 | return verticalObj;
|
24219 | break;
|
24220 | case 'betweenHorizontal':
|
24221 | return horizontalObj;
|
24222 | break;
|
24223 | }
|
24224 | };
|
24225 |
|
24226 | }),
|
24227 |
|
24228 | (function(module, exports, __webpack_require__) {
|
24229 |
|
24230 | 'use strict';
|
24231 |
|
24232 | Object.defineProperty(exports, "__esModule", {
|
24233 | value: true
|
24234 | });
|
24235 |
|
24236 | 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; };
|
24237 |
|
24238 | 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"); } }; }();
|
24239 |
|
24240 | var _react = __webpack_require__(4);
|
24241 |
|
24242 | var _react2 = _interopRequireDefault(_react);
|
24243 |
|
24244 | var _reactDom = __webpack_require__(12);
|
24245 |
|
24246 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
24247 |
|
24248 | var _reactBeautifulDnd = __webpack_require__(83);
|
24249 |
|
24250 | var _util = __webpack_require__(185);
|
24251 |
|
24252 | var _classnames = __webpack_require__(3);
|
24253 |
|
24254 | var _classnames2 = _interopRequireDefault(_classnames);
|
24255 |
|
24256 | var _lodash = __webpack_require__(183);
|
24257 |
|
24258 | var _lodash2 = _interopRequireDefault(_lodash);
|
24259 |
|
24260 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24261 |
|
24262 | 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; }
|
24263 |
|
24264 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24265 |
|
24266 | 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; }
|
24267 |
|
24268 | 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); }
|
24269 |
|
24270 | var reorder = function reorder(list, startIndex, endIndex) {
|
24271 | var result = Array.from(list);
|
24272 |
|
24273 | var _result$splice = result.splice(startIndex, 1),
|
24274 | _result$splice2 = _slicedToArray(_result$splice, 1),
|
24275 | removed = _result$splice2[0];
|
24276 |
|
24277 | result.splice(endIndex, 0, removed);
|
24278 |
|
24279 | return result;
|
24280 | };
|
24281 |
|
24282 | |
24283 |
|
24284 |
|
24285 | var move = function move(source, destination, droppableSource, droppableDestination) {
|
24286 | var sourceClone = Array.from(source);
|
24287 | var destClone = Array.from(destination);
|
24288 |
|
24289 | var _sourceClone$splice = sourceClone.splice(droppableSource.index, 1),
|
24290 | _sourceClone$splice2 = _slicedToArray(_sourceClone$splice, 1),
|
24291 | removed = _sourceClone$splice2[0];
|
24292 |
|
24293 | destClone.splice(droppableDestination.index, 0, removed);
|
24294 |
|
24295 | var result = {};
|
24296 | result[droppableSource.droppableId] = sourceClone;
|
24297 | result[droppableDestination.droppableId] = destClone;
|
24298 |
|
24299 | return result;
|
24300 | };
|
24301 |
|
24302 | var Between = function (_Component) {
|
24303 | _inherits(Between, _Component);
|
24304 |
|
24305 | function Between(props) {
|
24306 | _classCallCheck(this, Between);
|
24307 |
|
24308 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
24309 |
|
24310 | _this.id2List = {
|
24311 | droppable: 'items',
|
24312 | droppable2: 'selected'
|
24313 | };
|
24314 |
|
24315 | _this.getList = function (id) {
|
24316 | return _this.state[_this.id2List[id]];
|
24317 | };
|
24318 |
|
24319 | _this.onDragEnd = function (result) {
|
24320 | console.log(result);
|
24321 | var source = result.source,
|
24322 | destination = result.destination;
|
24323 |
|
24324 |
|
24325 |
|
24326 | if (!destination) {
|
24327 | return;
|
24328 | }
|
24329 | var list = _this.state.items;
|
24330 | var otherList = _this.state.selected;
|
24331 |
|
24332 | if (source.droppableId === destination.droppableId) {
|
24333 | var items = reorder(_this.getList(source.droppableId), source.index, destination.index);
|
24334 |
|
24335 | var state = { items: items };
|
24336 | list = items;
|
24337 |
|
24338 | if (source.droppableId === 'droppable2') {
|
24339 | state = { selected: items };
|
24340 | otherList = items;
|
24341 | list = _this.state.items;
|
24342 | }
|
24343 | _this.setState(state);
|
24344 | } else {
|
24345 | var _result = move(_this.getList(source.droppableId), _this.getList(destination.droppableId), source, destination);
|
24346 |
|
24347 | _this.setState({
|
24348 | items: _result.droppable,
|
24349 | selected: _result.droppable2
|
24350 | });
|
24351 | list = _result.droppable;
|
24352 | otherList = _result.droppable2;
|
24353 | }
|
24354 | _this.props.onStop(result, {
|
24355 | list: list,
|
24356 | otherList: otherList
|
24357 | });
|
24358 | };
|
24359 |
|
24360 | _this.onDragStart = function (result) {
|
24361 | _this.props.onStart(result, {
|
24362 | list: _this.state.list,
|
24363 | otherList: _this.state.selected
|
24364 | });
|
24365 | };
|
24366 |
|
24367 | _this.state = {
|
24368 | items: _this.props.list,
|
24369 | selected: _this.props.otherList
|
24370 | };
|
24371 | return _this;
|
24372 | }
|
24373 |
|
24374 | Between.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
24375 | if (!(0, _lodash2['default'])(this.state.items, nextProps.list)) {
|
24376 | this.setState({
|
24377 | items: nextProps.list
|
24378 | });
|
24379 | }
|
24380 | if (!(0, _lodash2['default'])(this.state.selected, nextProps.otherList)) {
|
24381 | this.setState({
|
24382 | selected: nextProps.otherList
|
24383 | });
|
24384 | }
|
24385 | };
|
24386 |
|
24387 | Between.prototype.render = function render() {
|
24388 | var _this2 = this;
|
24389 |
|
24390 | var _props = this.props,
|
24391 | onStart = _props.onStart,
|
24392 | onDrag = _props.onDrag,
|
24393 | onStop = _props.onStop,
|
24394 | onDragUpdate = _props.onDragUpdate,
|
24395 | dropClass = _props.dropClass,
|
24396 | dropOverClass = _props.dropOverClass,
|
24397 | dragClass = _props.dragClass,
|
24398 | dragingClass = _props.dragingClass,
|
24399 | showKey = _props.showKey,
|
24400 | type = _props.type;
|
24401 |
|
24402 |
|
24403 | return _react2['default'].createElement(
|
24404 | 'div',
|
24405 | { className: (0, _classnames2['default'])({
|
24406 | 'u-drag-between': type == 'betweenVertical',
|
24407 | 'u-drag-between u-drag-between-horizontal': type == 'betweenHorizontal'
|
24408 |
|
24409 | }) },
|
24410 | _react2['default'].createElement(
|
24411 | _reactBeautifulDnd.DragDropContext,
|
24412 | { onDragEnd: this.onDragEnd, onDragStart: this.onDragStart, onDragUpdate: onDragUpdate },
|
24413 | _react2['default'].createElement(
|
24414 | _reactBeautifulDnd.Droppable,
|
24415 | { droppableId: 'droppable', direction: type == 'betweenVertical' ? 'vertical' : 'horizontal' },
|
24416 | function (provided, snapshot) {
|
24417 | return _react2['default'].createElement(
|
24418 | 'div',
|
24419 | {
|
24420 | ref: provided.innerRef,
|
24421 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDraggingOver).drop)) },
|
24422 | _this2.state.items.map(function (item, index) {
|
24423 | return _react2['default'].createElement(
|
24424 | _reactBeautifulDnd.Draggable,
|
24425 | {
|
24426 | key: '1' + index,
|
24427 | draggableId: '1' + index,
|
24428 | index: index },
|
24429 | function (provided, snapshot) {
|
24430 | return _react2['default'].createElement(
|
24431 | 'div',
|
24432 | _extends({
|
24433 | ref: provided.innerRef
|
24434 | }, provided.draggableProps, provided.dragHandleProps, {
|
24435 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDragging).drag)),
|
24436 | style: _extends({}, provided.draggableProps.style) }),
|
24437 | showKey ? item[showKey] : item
|
24438 | );
|
24439 | }
|
24440 | );
|
24441 | }),
|
24442 | provided.placeholder
|
24443 | );
|
24444 | }
|
24445 | ),
|
24446 | _react2['default'].createElement(
|
24447 | _reactBeautifulDnd.Droppable,
|
24448 | { droppableId: 'droppable2', direction: type == 'betweenVertical' ? 'vertical' : 'horizontal' },
|
24449 | function (provided, snapshot) {
|
24450 | return _react2['default'].createElement(
|
24451 | 'div',
|
24452 | {
|
24453 | ref: provided.innerRef,
|
24454 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDraggingOver).drop)) },
|
24455 | _this2.state.selected.map(function (item, index) {
|
24456 | return _react2['default'].createElement(
|
24457 | _reactBeautifulDnd.Draggable,
|
24458 | {
|
24459 | key: '2' + index,
|
24460 | draggableId: '2' + index,
|
24461 | index: index },
|
24462 | function (provided, snapshot) {
|
24463 | return _react2['default'].createElement(
|
24464 | 'div',
|
24465 | _extends({
|
24466 | ref: provided.innerRef
|
24467 | }, provided.draggableProps, provided.dragHandleProps, {
|
24468 | className: (0, _classnames2['default'])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDragging).drag)),
|
24469 | style: _extends({}, provided.draggableProps.style) }),
|
24470 | showKey ? item[showKey] : item
|
24471 | );
|
24472 | }
|
24473 | );
|
24474 | }),
|
24475 | provided.placeholder
|
24476 | );
|
24477 | }
|
24478 | )
|
24479 | )
|
24480 | );
|
24481 | };
|
24482 |
|
24483 | return Between;
|
24484 | }(_react.Component);
|
24485 |
|
24486 | exports['default'] = Between;
|
24487 | module.exports = exports['default'];
|
24488 |
|
24489 | }),
|
24490 |
|
24491 | (function(module, exports, __webpack_require__) {
|
24492 |
|
24493 | 'use strict';
|
24494 |
|
24495 | Object.defineProperty(exports, "__esModule", {
|
24496 | value: true
|
24497 | });
|
24498 |
|
24499 | var _react = __webpack_require__(4);
|
24500 |
|
24501 | var _react2 = _interopRequireDefault(_react);
|
24502 |
|
24503 | var _index = __webpack_require__(81);
|
24504 |
|
24505 | var _index2 = _interopRequireDefault(_index);
|
24506 |
|
24507 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24508 |
|
24509 | 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; }
|
24510 |
|
24511 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24512 |
|
24513 | 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; }
|
24514 |
|
24515 | 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); }
|
24516 | |
24517 |
|
24518 |
|
24519 |
|
24520 |
|
24521 |
|
24522 |
|
24523 | var Demo2 = function (_Component) {
|
24524 | _inherits(Demo2, _Component);
|
24525 |
|
24526 | function Demo2() {
|
24527 | var _temp, _this, _ret;
|
24528 |
|
24529 | _classCallCheck(this, Demo2);
|
24530 |
|
24531 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24532 | args[_key] = arguments[_key];
|
24533 | }
|
24534 |
|
24535 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
24536 | console.log('start');
|
24537 | }, _this.onStop = function () {
|
24538 | console.log('stop');
|
24539 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24540 | }
|
24541 |
|
24542 | Demo2.prototype.render = function render() {
|
24543 | return _react2['default'].createElement(
|
24544 | 'div',
|
24545 | null,
|
24546 | _react2['default'].createElement(
|
24547 | _index2['default'],
|
24548 | { axis: 'x', onStart: this.onStart, onStop: this.onStop },
|
24549 | _react2['default'].createElement(
|
24550 | 'div',
|
24551 | { className: 'demo' },
|
24552 | '\u6211\u53EA\u53EF\u5EF6X\u8F74\u62D6\u62FD'
|
24553 | )
|
24554 | )
|
24555 | );
|
24556 | };
|
24557 |
|
24558 | return Demo2;
|
24559 | }(_react.Component);
|
24560 |
|
24561 | exports['default'] = Demo2;
|
24562 | module.exports = exports['default'];
|
24563 |
|
24564 | }),
|
24565 |
|
24566 | (function(module, exports, __webpack_require__) {
|
24567 |
|
24568 | 'use strict';
|
24569 |
|
24570 | Object.defineProperty(exports, "__esModule", {
|
24571 | value: true
|
24572 | });
|
24573 |
|
24574 | var _react = __webpack_require__(4);
|
24575 |
|
24576 | var _react2 = _interopRequireDefault(_react);
|
24577 |
|
24578 | var _index = __webpack_require__(81);
|
24579 |
|
24580 | var _index2 = _interopRequireDefault(_index);
|
24581 |
|
24582 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24583 |
|
24584 | 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; }
|
24585 |
|
24586 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24587 |
|
24588 | 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; }
|
24589 |
|
24590 | 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); }
|
24591 | |
24592 |
|
24593 |
|
24594 |
|
24595 |
|
24596 |
|
24597 |
|
24598 | var Demo3 = function (_Component) {
|
24599 | _inherits(Demo3, _Component);
|
24600 |
|
24601 | function Demo3() {
|
24602 | var _temp, _this, _ret;
|
24603 |
|
24604 | _classCallCheck(this, Demo3);
|
24605 |
|
24606 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24607 | args[_key] = arguments[_key];
|
24608 | }
|
24609 |
|
24610 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
24611 | console.log('start');
|
24612 | return false;
|
24613 | }, _this.onStop = function () {
|
24614 | console.log('stop');
|
24615 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24616 | }
|
24617 |
|
24618 | Demo3.prototype.render = function render() {
|
24619 | return _react2['default'].createElement(
|
24620 | 'div',
|
24621 | null,
|
24622 | _react2['default'].createElement(
|
24623 | _index2['default'],
|
24624 | { onStart: this.onStart, onStop: this.onStop },
|
24625 | _react2['default'].createElement(
|
24626 | 'div',
|
24627 | { className: 'demo' },
|
24628 | '\u6211\u4E0D\u53EF\u4EE5\u62D6\u62FD'
|
24629 | )
|
24630 | )
|
24631 | );
|
24632 | };
|
24633 |
|
24634 | return Demo3;
|
24635 | }(_react.Component);
|
24636 |
|
24637 | exports['default'] = Demo3;
|
24638 | module.exports = exports['default'];
|
24639 |
|
24640 | }),
|
24641 |
|
24642 | (function(module, exports, __webpack_require__) {
|
24643 |
|
24644 | 'use strict';
|
24645 |
|
24646 | Object.defineProperty(exports, "__esModule", {
|
24647 | value: true
|
24648 | });
|
24649 |
|
24650 | var _react = __webpack_require__(4);
|
24651 |
|
24652 | var _react2 = _interopRequireDefault(_react);
|
24653 |
|
24654 | var _index = __webpack_require__(81);
|
24655 |
|
24656 | var _index2 = _interopRequireDefault(_index);
|
24657 |
|
24658 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24659 |
|
24660 | 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; }
|
24661 |
|
24662 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24663 |
|
24664 | 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; }
|
24665 |
|
24666 | 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); } |
24667 |
|
24668 |
|
24669 |
|
24670 |
|
24671 |
|
24672 |
|
24673 | var Demo4 = function (_Component) {
|
24674 | _inherits(Demo4, _Component);
|
24675 |
|
24676 | function Demo4() {
|
24677 | var _temp, _this, _ret;
|
24678 |
|
24679 | _classCallCheck(this, Demo4);
|
24680 |
|
24681 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24682 | args[_key] = arguments[_key];
|
24683 | }
|
24684 |
|
24685 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
24686 | console.log('start');
|
24687 | }, _this.onStop = function () {
|
24688 | console.log('stop');
|
24689 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24690 | }
|
24691 |
|
24692 | Demo4.prototype.render = function render() {
|
24693 | return _react2['default'].createElement(
|
24694 | 'div',
|
24695 | { className: 'demo-4' },
|
24696 | _react2['default'].createElement(
|
24697 | 'div',
|
24698 | null,
|
24699 | _react2['default'].createElement(
|
24700 | _index2['default'],
|
24701 | { handle: '.handle', onStart: this.onStart, onStop: this.onStop },
|
24702 | _react2['default'].createElement(
|
24703 | 'div',
|
24704 | { className: 'demo4 ' },
|
24705 | _react2['default'].createElement(
|
24706 | 'div',
|
24707 | { className: 'handle' },
|
24708 | '\u6211\u662F\u628A\u624B'
|
24709 | ),
|
24710 | _react2['default'].createElement(
|
24711 | 'div',
|
24712 | { className: 'drag-context' },
|
24713 | '\u9700\u8981\u62D6\u62FD\u628A\u624B'
|
24714 | )
|
24715 | )
|
24716 | )
|
24717 | ),
|
24718 | _react2['default'].createElement(
|
24719 | 'div',
|
24720 | null,
|
24721 | _react2['default'].createElement(
|
24722 | _index2['default'],
|
24723 | { cancel: '.handle' },
|
24724 | _react2['default'].createElement(
|
24725 | 'div',
|
24726 | { className: 'demo4 ' },
|
24727 | _react2['default'].createElement(
|
24728 | 'div',
|
24729 | { className: 'handle' },
|
24730 | '\u6211\u662F\u628A\u624B'
|
24731 | ),
|
24732 | _react2['default'].createElement(
|
24733 | 'div',
|
24734 | { className: 'drag-context' },
|
24735 | '\u4E0D\u8981\u62D6\u62FD\u628A\u624B'
|
24736 | )
|
24737 | )
|
24738 | )
|
24739 | )
|
24740 | );
|
24741 | };
|
24742 |
|
24743 | return Demo4;
|
24744 | }(_react.Component);
|
24745 |
|
24746 | exports['default'] = Demo4;
|
24747 | module.exports = exports['default'];
|
24748 |
|
24749 | }),
|
24750 |
|
24751 | (function(module, exports, __webpack_require__) {
|
24752 |
|
24753 | 'use strict';
|
24754 |
|
24755 | Object.defineProperty(exports, "__esModule", {
|
24756 | value: true
|
24757 | });
|
24758 |
|
24759 | var _react = __webpack_require__(4);
|
24760 |
|
24761 | var _react2 = _interopRequireDefault(_react);
|
24762 |
|
24763 | var _index = __webpack_require__(81);
|
24764 |
|
24765 | var _index2 = _interopRequireDefault(_index);
|
24766 |
|
24767 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24768 |
|
24769 | 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; }
|
24770 |
|
24771 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24772 |
|
24773 | 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; }
|
24774 |
|
24775 | 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); }
|
24776 | |
24777 |
|
24778 |
|
24779 |
|
24780 |
|
24781 |
|
24782 |
|
24783 | var Demo5 = function (_Component) {
|
24784 | _inherits(Demo5, _Component);
|
24785 |
|
24786 | function Demo5() {
|
24787 | var _temp, _this, _ret;
|
24788 |
|
24789 | _classCallCheck(this, Demo5);
|
24790 |
|
24791 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24792 | args[_key] = arguments[_key];
|
24793 | }
|
24794 |
|
24795 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
24796 | console.log('start');
|
24797 | }, _this.onStop = function () {
|
24798 | console.log('stop');
|
24799 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24800 | }
|
24801 |
|
24802 | Demo5.prototype.render = function render() {
|
24803 | return _react2['default'].createElement(
|
24804 | 'div',
|
24805 | null,
|
24806 | _react2['default'].createElement(
|
24807 | _index2['default'],
|
24808 | { grid: [25, 25], onStart: this.onStart, onStop: this.onStop },
|
24809 | _react2['default'].createElement(
|
24810 | 'div',
|
24811 | { className: 'demo' },
|
24812 | '\u6211\u6BCF\u6B21\u62D6\u62FD\u53EF\u79FB\u52A825px'
|
24813 | )
|
24814 | )
|
24815 | );
|
24816 | };
|
24817 |
|
24818 | return Demo5;
|
24819 | }(_react.Component);
|
24820 |
|
24821 | exports['default'] = Demo5;
|
24822 | module.exports = exports['default'];
|
24823 |
|
24824 | }),
|
24825 |
|
24826 | (function(module, exports, __webpack_require__) {
|
24827 |
|
24828 | 'use strict';
|
24829 |
|
24830 | Object.defineProperty(exports, "__esModule", {
|
24831 | value: true
|
24832 | });
|
24833 |
|
24834 | var _react = __webpack_require__(4);
|
24835 |
|
24836 | var _react2 = _interopRequireDefault(_react);
|
24837 |
|
24838 | var _index = __webpack_require__(81);
|
24839 |
|
24840 | var _index2 = _interopRequireDefault(_index);
|
24841 |
|
24842 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24843 |
|
24844 | 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; }
|
24845 |
|
24846 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24847 |
|
24848 | 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; }
|
24849 |
|
24850 | 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); }
|
24851 | |
24852 |
|
24853 |
|
24854 |
|
24855 |
|
24856 |
|
24857 |
|
24858 | var Demo6 = function (_Component) {
|
24859 | _inherits(Demo6, _Component);
|
24860 |
|
24861 | function Demo6() {
|
24862 | var _temp, _this, _ret;
|
24863 |
|
24864 | _classCallCheck(this, Demo6);
|
24865 |
|
24866 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24867 | args[_key] = arguments[_key];
|
24868 | }
|
24869 |
|
24870 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
24871 | console.log('start');
|
24872 | }, _this.onStop = function () {
|
24873 | console.log('stop');
|
24874 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24875 | }
|
24876 |
|
24877 | Demo6.prototype.render = function render() {
|
24878 | return _react2['default'].createElement(
|
24879 | 'div',
|
24880 | null,
|
24881 | _react2['default'].createElement(
|
24882 | _index2['default'],
|
24883 | { bounds: { top: -50, left: -50, right: 50, bottom: 50 }, onStart: this.onStart, onStop: this.onStop },
|
24884 | _react2['default'].createElement(
|
24885 | 'div',
|
24886 | { className: 'demo' },
|
24887 | '\u6211\u53EA\u80FD\u518D\u4E0A\u4E0B\u5DE6\u53F350px\u5185\u79FB\u52A8'
|
24888 | )
|
24889 | )
|
24890 | );
|
24891 | };
|
24892 |
|
24893 | return Demo6;
|
24894 | }(_react.Component);
|
24895 |
|
24896 | exports['default'] = Demo6;
|
24897 | module.exports = exports['default'];
|
24898 |
|
24899 | }),
|
24900 |
|
24901 | (function(module, exports, __webpack_require__) {
|
24902 |
|
24903 | 'use strict';
|
24904 |
|
24905 | Object.defineProperty(exports, "__esModule", {
|
24906 | value: true
|
24907 | });
|
24908 |
|
24909 | var _react = __webpack_require__(4);
|
24910 |
|
24911 | var _react2 = _interopRequireDefault(_react);
|
24912 |
|
24913 | var _index = __webpack_require__(81);
|
24914 |
|
24915 | var _index2 = _interopRequireDefault(_index);
|
24916 |
|
24917 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24918 |
|
24919 | 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; }
|
24920 |
|
24921 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24922 |
|
24923 | 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; }
|
24924 |
|
24925 | 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); }
|
24926 | |
24927 |
|
24928 |
|
24929 |
|
24930 |
|
24931 |
|
24932 |
|
24933 | var Demo7 = function (_Component) {
|
24934 | _inherits(Demo7, _Component);
|
24935 |
|
24936 | function Demo7() {
|
24937 | var _temp, _this, _ret;
|
24938 |
|
24939 | _classCallCheck(this, Demo7);
|
24940 |
|
24941 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24942 | args[_key] = arguments[_key];
|
24943 | }
|
24944 |
|
24945 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onStart = function () {
|
24946 | console.log('start');
|
24947 | }, _this.onStop = function () {
|
24948 | console.log('stop');
|
24949 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
24950 | }
|
24951 |
|
24952 | Demo7.prototype.render = function render() {
|
24953 | return _react2['default'].createElement(
|
24954 | 'div',
|
24955 | null,
|
24956 | _react2['default'].createElement(
|
24957 | 'div',
|
24958 | { className: 'demo7-parent' },
|
24959 | _react2['default'].createElement(
|
24960 | _index2['default'],
|
24961 | { bounds: '.demo7-parent', onStart: this.onStart, onStop: this.onStop },
|
24962 | _react2['default'].createElement(
|
24963 | 'div',
|
24964 | { className: 'demo' },
|
24965 | '\u6211\u53EA\u80FD\u5728\u7236\u7EA7\u5143\u7D20\u4E2D\u79FB\u52A8'
|
24966 | )
|
24967 | )
|
24968 | )
|
24969 | );
|
24970 | };
|
24971 |
|
24972 | return Demo7;
|
24973 | }(_react.Component);
|
24974 |
|
24975 | exports['default'] = Demo7;
|
24976 | module.exports = exports['default'];
|
24977 |
|
24978 | }),
|
24979 |
|
24980 | (function(module, exports, __webpack_require__) {
|
24981 |
|
24982 | 'use strict';
|
24983 |
|
24984 | Object.defineProperty(exports, "__esModule", {
|
24985 | value: true
|
24986 | });
|
24987 |
|
24988 | var _react = __webpack_require__(4);
|
24989 |
|
24990 | var _react2 = _interopRequireDefault(_react);
|
24991 |
|
24992 | var _index = __webpack_require__(81);
|
24993 |
|
24994 | var _index2 = _interopRequireDefault(_index);
|
24995 |
|
24996 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24997 |
|
24998 | 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; }
|
24999 |
|
25000 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
25001 |
|
25002 | 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; }
|
25003 |
|
25004 | 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); } |
25005 |
|
25006 |
|
25007 |
|
25008 |
|
25009 |
|
25010 |
|
25011 |
|
25012 |
|
25013 | var Demo8 = function (_Component) {
|
25014 | _inherits(Demo8, _Component);
|
25015 |
|
25016 | function Demo8() {
|
25017 | var _temp, _this, _ret;
|
25018 |
|
25019 | _classCallCheck(this, Demo8);
|
25020 |
|
25021 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
25022 | args[_key] = arguments[_key];
|
25023 | }
|
25024 |
|
25025 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onDragStart = function (result, list) {
|
25026 | console.log('开始');
|
25027 | }, _this.onDragEnd = function (result, list) {
|
25028 | console.log('结束');
|
25029 | }, _this.onDragUpdate = function (result) {
|
25030 | console.log('update');
|
25031 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
25032 | }
|
25033 |
|
25034 | Demo8.prototype.render = function render() {
|
25035 | var list = [{
|
25036 | name: '第一',
|
25037 | code: 'a'
|
25038 | }, {
|
25039 | name: '第二',
|
25040 | code: 'b'
|
25041 | }, {
|
25042 | name: '第三',
|
25043 | code: 'c'
|
25044 | }, {
|
25045 | name: '第四',
|
25046 | code: 'd'
|
25047 | }, {
|
25048 | name: '第五',
|
25049 | code: 'e'
|
25050 | }];
|
25051 | return _react2['default'].createElement(_index2['default'], { showKey: 'name', list: list, onDragUpdate: this.onDragUpdate, onStart: this.onDragStart, onStop: this.onDragEnd });
|
25052 | };
|
25053 |
|
25054 | return Demo8;
|
25055 | }(_react.Component);
|
25056 |
|
25057 | exports['default'] = Demo8;
|
25058 | module.exports = exports['default'];
|
25059 |
|
25060 | }),
|
25061 |
|
25062 | (function(module, exports, __webpack_require__) {
|
25063 |
|
25064 | 'use strict';
|
25065 |
|
25066 | Object.defineProperty(exports, "__esModule", {
|
25067 | value: true
|
25068 | });
|
25069 |
|
25070 | var _react = __webpack_require__(4);
|
25071 |
|
25072 | var _react2 = _interopRequireDefault(_react);
|
25073 |
|
25074 | var _index = __webpack_require__(81);
|
25075 |
|
25076 | var _index2 = _interopRequireDefault(_index);
|
25077 |
|
25078 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
25079 |
|
25080 | 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; }
|
25081 |
|
25082 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
25083 |
|
25084 | 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; }
|
25085 |
|
25086 | 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); }
|
25087 | |
25088 |
|
25089 |
|
25090 |
|
25091 |
|
25092 |
|
25093 |
|
25094 | var Demo9 = function (_Component) {
|
25095 | _inherits(Demo9, _Component);
|
25096 |
|
25097 | function Demo9() {
|
25098 | var _temp, _this, _ret;
|
25099 |
|
25100 | _classCallCheck(this, Demo9);
|
25101 |
|
25102 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
25103 | args[_key] = arguments[_key];
|
25104 | }
|
25105 |
|
25106 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onDragStart = function (result, list) {
|
25107 | console.log('开始');
|
25108 | }, _this.onDragEnd = function (result, list) {
|
25109 | console.log('结束');
|
25110 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
25111 | }
|
25112 |
|
25113 | Demo9.prototype.render = function render() {
|
25114 | var list = [_react2['default'].createElement(
|
25115 | 'div',
|
25116 | null,
|
25117 | 'DOM\u7B2C\u4E00'
|
25118 | ), _react2['default'].createElement(
|
25119 | 'div',
|
25120 | null,
|
25121 | 'DOM\u7B2C\u4E8C'
|
25122 | ), _react2['default'].createElement(
|
25123 | 'div',
|
25124 | null,
|
25125 | 'DOM\u7B2C\u4E09'
|
25126 | ), _react2['default'].createElement(
|
25127 | 'div',
|
25128 | null,
|
25129 | 'DOM\u7B2C\u56DB'
|
25130 | ), _react2['default'].createElement(
|
25131 | 'div',
|
25132 | null,
|
25133 | 'DOM\u7B2C\u4E94'
|
25134 | )];
|
25135 | return _react2['default'].createElement(_index2['default'], { list: list, onStart: this.onDragStart, onStop: this.onDragEnd });
|
25136 | };
|
25137 |
|
25138 | return Demo9;
|
25139 | }(_react.Component);
|
25140 |
|
25141 | exports['default'] = Demo9;
|
25142 | module.exports = exports['default'];
|
25143 |
|
25144 | }),
|
25145 |
|
25146 | (function(module, exports, __webpack_require__) {
|
25147 |
|
25148 | 'use strict';
|
25149 |
|
25150 | Object.defineProperty(exports, "__esModule", {
|
25151 | value: true
|
25152 | });
|
25153 |
|
25154 | var _react = __webpack_require__(4);
|
25155 |
|
25156 | var _react2 = _interopRequireDefault(_react);
|
25157 |
|
25158 | var _Dnd = __webpack_require__(82);
|
25159 |
|
25160 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
25161 |
|
25162 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
25163 |
|
25164 | 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; }
|
25165 |
|
25166 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
25167 |
|
25168 | 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; }
|
25169 |
|
25170 | 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); }
|
25171 | |
25172 |
|
25173 |
|
25174 |
|
25175 |
|
25176 |
|
25177 |
|
25178 | var Demo90 = function (_Component) {
|
25179 | _inherits(Demo90, _Component);
|
25180 |
|
25181 | function Demo90() {
|
25182 | _classCallCheck(this, Demo90);
|
25183 |
|
25184 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
25185 | }
|
25186 |
|
25187 | Demo90.prototype.render = function render() {
|
25188 | var list = ['第一', '第二', '第三', '第四', '第五'];
|
25189 | return _react2['default'].createElement(_Dnd2['default'], { list: list, type: 'horizontal' });
|
25190 | };
|
25191 |
|
25192 | return Demo90;
|
25193 | }(_react.Component);
|
25194 |
|
25195 | exports['default'] = Demo90;
|
25196 | module.exports = exports['default'];
|
25197 |
|
25198 | }),
|
25199 |
|
25200 | (function(module, exports, __webpack_require__) {
|
25201 |
|
25202 | 'use strict';
|
25203 |
|
25204 | Object.defineProperty(exports, "__esModule", {
|
25205 | value: true
|
25206 | });
|
25207 |
|
25208 | var _react = __webpack_require__(4);
|
25209 |
|
25210 | var _react2 = _interopRequireDefault(_react);
|
25211 |
|
25212 | var _Dnd = __webpack_require__(82);
|
25213 |
|
25214 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
25215 |
|
25216 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
25217 |
|
25218 | 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; }
|
25219 |
|
25220 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
25221 |
|
25222 | 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; }
|
25223 |
|
25224 | 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); }
|
25225 | |
25226 |
|
25227 |
|
25228 |
|
25229 |
|
25230 |
|
25231 |
|
25232 | var Demo90 = function (_Component) {
|
25233 | _inherits(Demo90, _Component);
|
25234 |
|
25235 | function Demo90() {
|
25236 | _classCallCheck(this, Demo90);
|
25237 |
|
25238 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
25239 | }
|
25240 |
|
25241 | Demo90.prototype.render = function render() {
|
25242 | var list1 = ['第一', '第二', '第三', '第四', '第五'];
|
25243 | var list2 = ['1', '2', '3', '4', '5'];
|
25244 | return _react2['default'].createElement(_Dnd2['default'], { className: 'demo91', list: list1, otherList: list2, type: 'betweenVertical' });
|
25245 | };
|
25246 |
|
25247 | return Demo90;
|
25248 | }(_react.Component);
|
25249 |
|
25250 | exports['default'] = Demo90;
|
25251 | module.exports = exports['default'];
|
25252 |
|
25253 | }),
|
25254 |
|
25255 | (function(module, exports, __webpack_require__) {
|
25256 |
|
25257 | 'use strict';
|
25258 |
|
25259 | Object.defineProperty(exports, "__esModule", {
|
25260 | value: true
|
25261 | });
|
25262 |
|
25263 | var _react = __webpack_require__(4);
|
25264 |
|
25265 | var _react2 = _interopRequireDefault(_react);
|
25266 |
|
25267 | var _Dnd = __webpack_require__(82);
|
25268 |
|
25269 | var _Dnd2 = _interopRequireDefault(_Dnd);
|
25270 |
|
25271 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
25272 |
|
25273 | 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; }
|
25274 |
|
25275 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
25276 |
|
25277 | 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; }
|
25278 |
|
25279 | 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); }
|
25280 | |
25281 |
|
25282 |
|
25283 |
|
25284 |
|
25285 |
|
25286 |
|
25287 | var Demo90 = function (_Component) {
|
25288 | _inherits(Demo90, _Component);
|
25289 |
|
25290 | function Demo90() {
|
25291 | var _temp, _this, _ret;
|
25292 |
|
25293 | _classCallCheck(this, Demo90);
|
25294 |
|
25295 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
25296 | args[_key] = arguments[_key];
|
25297 | }
|
25298 |
|
25299 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onDragStart = function (result, list) {
|
25300 | console.log('开始');
|
25301 | }, _this.onDragEnd = function (result, listObj) {
|
25302 | console.log('结束');
|
25303 | console.log(listObj);
|
25304 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
25305 | }
|
25306 |
|
25307 | Demo90.prototype.render = function render() {
|
25308 | var list1 = ['第一', '第二', '第三', '第四', '第五'];
|
25309 | var list2 = ['1', '2', '3', '4', '5'];
|
25310 | return _react2['default'].createElement(_Dnd2['default'], { list: list1, otherList: list2, type: 'betweenHorizontal', onStart: this.onDragStart, onStop: this.onDragEnd });
|
25311 | };
|
25312 |
|
25313 | return Demo90;
|
25314 | }(_react.Component);
|
25315 |
|
25316 | exports['default'] = Demo90;
|
25317 | module.exports = exports['default'];
|
25318 |
|
25319 | })
|
25320 | ]);
|
25321 |
|
\ | No newline at end of file |