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__(82);
|
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__(84);var Demo2 = __webpack_require__(245);var Demo3 = __webpack_require__(246);var Demo4 = __webpack_require__(247);var Demo5 = __webpack_require__(248);var Demo6 = __webpack_require__(249);var Demo7 = __webpack_require__(250);var Demo8 = __webpack_require__(251);var DemoArray = [{ "example": _react2['default'].createElement(Demo1, null), "title": " 少页数Pagination", "code": "/**\n * @title 少页数Pagination\n * @description 所有页数均显示。默认无确认按钮。\n */\n\nimport React, { Component } from 'react';\nimport { Pagination } from 'tinper-bee';\n\nclass Demo1 extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n activePage: 1\n }\n }\n handleSelect(eventKey) {\n console.log(eventKey);\n this.setState({\n activePage: eventKey\n });\n }\n\n dataNumSelect = (index, value) => {\n console.log(index, value);\n\n }\n\n render() {\n return (\n <div>\n <Pagination\n first\n last\n prev\n next\n maxButtons={5}\n boundaryLinks\n activePage={this.state.activePage}\n onSelect={this.handleSelect.bind(this)}\n onDataNumSelect={this.dataNumSelect}\n showJump={true}\n total={100}\n dataNum={2}\n />\n\n </div>\n );\n }\n}\n\n", "desc": " 所有页数均显示。默认无确认按钮。" }, { "example": _react2['default'].createElement(Demo2, null), "title": " 多页数Pagination", "code": "/**\n * @title 多页数Pagination\n * @description 可根据参数设置功能按钮的显示,部分页数隐藏。\n */\n\nimport React, { Component } from 'react';\nimport { Pagination } from 'tinper-bee';\n\nclass Demo2 extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tactivePage:1\n\t\t}\n\t}\n\thandleSelect(eventKey) {\n\t this.setState({\n\t activePage: eventKey\n\t });\n\t}\n\trender() {\n\t return (\n\t <div>\n\t <Pagination\n\t \tfirst\n\t \tlast\n\t \tprev\n\t \tnext\n\t \tboundaryLinks\n\t\t items={11}\n\t\t maxButtons={5}\n\t\t activePage={this.state.activePage}\n\t\t onSelect={this.handleSelect.bind(this)}\n\t\t\t/>\n\t </div>\n\t );\n\t}\n}\n", "desc": " 可根据参数设置功能按钮的显示,部分页数隐藏。" }, { "example": _react2['default'].createElement(Demo3, null), "title": " 有间隔Pagination", "code": "/**\n * @title 有间隔Pagination\n * @description 有间隔Pagination\n */\n\nimport React, { Component } from \"react\";\nimport { Pagination } from 'tinper-bee';\n\nclass Demo3 extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n activePage: 1\n };\n }\n handleSelect(eventKey) {\n this.setState({\n activePage: eventKey\n });\n }\n render() {\n return (\n <Pagination\n prev\n next\n size=\"sm\"\n gap={true}\n items={5}\n maxButtons={5}\n activePage={this.state.activePage}\n onSelect={this.handleSelect.bind(this)}\n />\n );\n }\n}\n\n", "desc": " 有间隔Pagination" }, { "example": _react2['default'].createElement(Demo4, null), "title": " 多语示例", "code": "/**\n * @title 多语示例\n * @description 所有页数均显示。\n */\n\nimport React, { Component } from 'react';\nimport { Pagination } from 'tinper-bee';\n\nclass Demo4 extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tactivePage:1\n\t\t}\n\t}\n\thandleSelect(eventKey) {\n\t this.setState({\n\t activePage: eventKey\n\t });\n\t}\n\n dataNumSelect = (index,value) =>{\n console.log(index,value);\n\n }\n\trender() {\n\t\tvar local={\n\t\t\t'lang':'en',\n\t\t\t'total': 'Total',\n\t\t\t'items': 'Items',\n\t\t\t'show': 'page',\n\t\t\t'goto':'goto',\n\t\t\t'page':'',\n\t\t\t'ok':'ok'\n\t\t}\n\t return (\n\t <div>\n\t <Pagination\n\t\t\t\tfirst\n\t\t\t\tlast\n\t\t\t\tprev\n\t\t\t\tnext\n\t\t\t\tmaxButtons={5}\n\t \tboundaryLinks\n\t\t activePage={this.state.activePage}\n\t\t onSelect={this.handleSelect.bind(this)}\n\t\t\t\tonDataNumSelect={this.dataNumSelect}\n\t\t\t\tshowJump={true}\n\t\t\t\ttotal={100}\n\t\t\t\tdataNum={2}\n\t\t\t\tlocale={local}\n\t\t\t/>\n\t </div>\n\t );\n\t}\n}\n\n", "desc": " 所有页数均显示。" }, { "example": _react2['default'].createElement(Demo5, null), "title": " 不可用pagiantion", "code": "/**\n * @title 不可用pagiantion\n * @description pagination不可使用状态\n */\n\nimport React, { Component } from 'react';\nimport { Pagination } from 'tinper-bee';\n\nclass Demo5 extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tactivePage:1\n\t\t}\n\t}\n\thandleSelect(eventKey) {\n\t\tconsole.log(eventKey);\n\t this.setState({\n\t activePage: eventKey\n\t });\n\t}\n\n dataNumSelect = (index,value) =>{\n console.log(index,value);\n\n }\n\trender() {\n\t return (\n\t <div>\n\t <Pagination\n\t\t\t\tfirst\n\t\t\t\tlast\n\t\t\t\tprev\n\t\t\t\tnext\n\t\t\t\tmaxButtons={5}\n\t \tboundaryLinks\n\t\t activePage={this.state.activePage}\n\t\t onSelect={this.handleSelect.bind(this)}\n\t\t\t\tonDataNumSelect={this.dataNumSelect}\n\t\t\t\tshowJump={true}\n\t\t\t\ttotal={100}\n\t\t\t\tdataNum={2}\n\t\t\t\tdisabled={true}\n\t\t\t/>\n\t </div>\n\t );\n\t}\n}\n\n", "desc": " pagination不可使用状态" }, { "example": _react2['default'].createElement(Demo6, null), "title": " 自定义按钮的Pagination", "code": "/**\n * @title 自定义按钮的Pagination\n * @description 通过confirmBtn参数自定义确认按钮,默认不显示按钮。\n */\n\nimport React, { Component } from 'react';\nimport { Pagination, Button } from 'tinper-bee';\n\nclass Demo6 extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tactivePage:1\n\t\t}\n\t}\n\thandleSelect(eventKey) {\n\t\tconsole.log(eventKey);\n\t this.setState({\n\t activePage: eventKey\n\t });\n\t}\n\n dataNumSelect = (index,value) =>{\n console.log(index,value);\n\n\t}\n\t\n\trenderConfirmBtn = () => {\n\t\treturn (\n\t\t \t<Button\n\t\t\t\tcolors=\"dark\"\n\t\t\t\tshape='border'\n\t\t\t>\n\t\t\t\t确认\n\t\t\t</Button>\n\t\t);\n\t}\n\n\trender() {\n\t return (\n\t <div>\n\t <Pagination\n\t\t\t\tfirst\n\t\t\t\tlast\n\t\t\t\tprev\n\t\t\t\tnext\n\t\t\t\tmaxButtons={5}\n\t \tboundaryLinks\n\t\t activePage={this.state.activePage}\n\t\t onSelect={this.handleSelect.bind(this)}\n\t\t\t\tonDataNumSelect={this.dataNumSelect}\n\t\t\t\tshowJump={true}\n\t\t\t\ttotal={100}\n\t\t\t\tdataNum={2}\n\t\t\t\tconfirmBtn={this.renderConfirmBtn}\n\t\t\t/>\n\t </div>\n\t );\n\t}\n}\n\n", "desc": " 通过confirmBtn参数自定义确认按钮,默认不显示按钮。" }, { "example": _react2['default'].createElement(Demo7, null), "title": " 显示按钮边框的Pagination", "code": "/**\n * @title 显示按钮边框的Pagination\n * @description 通过noBorder参数设置是否显示按钮边框。\n */\n\nimport React, { Component } from 'react';\nimport { Pagination } from 'tinper-bee';\n\nclass Demo1 extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n activePage: 1\n }\n }\n handleSelect(eventKey) {\n console.log(eventKey);\n this.setState({\n activePage: eventKey\n });\n }\n\n dataNumSelect = (index, value) => {\n console.log(index, value);\n\n }\n\n render() {\n return (\n <div>\n <Pagination\n first\n last\n prev\n next\n maxButtons={5}\n boundaryLinks\n activePage={this.state.activePage}\n onSelect={this.handleSelect.bind(this)}\n onDataNumSelect={this.dataNumSelect}\n showJump={true}\n noBorder={false}\n total={100}\n dataNum={2}\n />\n\n </div>\n );\n }\n}\n\n", "desc": " 通过noBorder参数设置是否显示按钮边框。" }, { "example": _react2['default'].createElement(Demo8, null), "title": " 不同大小的Pagination", "code": "/**\n * @title 不同大小的Pagination\n * @description 通过size参数控制分页的大小。\n */\n\nimport React, { Component } from 'react';\nimport { Pagination, Button } from 'tinper-bee';\n\nclass Demo8 extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n activePage: 1\n }\n }\n handleSelect(eventKey) {\n console.log(eventKey);\n this.setState({\n activePage: eventKey\n });\n }\n\n dataNumSelect = (index, value) => {\n console.log(index, value);\n\n }\n\n render() {\n return (\n <div className=\"demo8\">\n <Pagination\n className=\"demo8-pagination\"\n first\n last\n prev\n next\n maxButtons={5}\n boundaryLinks\n activePage={this.state.activePage}\n onSelect={this.handleSelect.bind(this)}\n onDataNumSelect={this.dataNumSelect}\n showJump={true}\n total={100}\n dataNum={2}\n size=\"sm\"\n />\n <Pagination\n className=\"demo8-pagination\"\n first\n last\n prev\n next\n maxButtons={5}\n boundaryLinks\n activePage={this.state.activePage}\n onSelect={this.handleSelect.bind(this)}\n onDataNumSelect={this.dataNumSelect}\n showJump={true}\n total={100}\n dataNum={2}\n />\n <Pagination\n className=\"demo8-pagination\"\n first\n last\n prev\n next\n maxButtons={5}\n boundaryLinks\n activePage={this.state.activePage}\n onSelect={this.handleSelect.bind(this)}\n onDataNumSelect={this.dataNumSelect}\n showJump={true}\n total={100}\n dataNum={2}\n size=\"lg\"\n />\n </div>\n );\n }\n}\n\n", "desc": " 通过size参数控制分页的大小。", "scss_code": ".demo8 {\n padding-bottom: 20px;\n display: block;\n .demo8-pagination{\n height: 50px;\n display: block;\n }\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 | { collapsible: true, headerContent: true, expanded: this.state.open, colors: 'bordered', header: header,
|
138 | footerStyle: { padding: 0 } },
|
139 | _react2['default'].createElement(
|
140 | 'pre',
|
141 | null,
|
142 | _react2['default'].createElement(
|
143 | 'code',
|
144 | { className: 'hljs javascript' },
|
145 | code
|
146 | )
|
147 | ),
|
148 | !!scss_code ? _react2['default'].createElement(
|
149 | 'pre',
|
150 | null,
|
151 | _react2['default'].createElement(
|
152 | 'code',
|
153 | { className: 'hljs css' },
|
154 | scss_code
|
155 | )
|
156 | ) : null
|
157 | )
|
158 | );
|
159 | };
|
160 |
|
161 | return Demo;
|
162 | }(_react.Component);
|
163 |
|
164 | var DemoGroup = function (_Component2) {
|
165 | _inherits(DemoGroup, _Component2);
|
166 |
|
167 | function DemoGroup(props) {
|
168 | _classCallCheck(this, DemoGroup);
|
169 |
|
170 | return _possibleConstructorReturn(this, _Component2.call(this, props));
|
171 | }
|
172 |
|
173 | DemoGroup.prototype.render = function render() {
|
174 | return _react2['default'].createElement(
|
175 | _beeLayout.Row,
|
176 | null,
|
177 | DemoArray.map(function (child, index) {
|
178 |
|
179 | return _react2['default'].createElement(Demo, { example: child.example, title: child.title, code: child.code, scss_code: child.scss_code,
|
180 | desc: child.desc, key: index });
|
181 | })
|
182 | );
|
183 | };
|
184 |
|
185 | return DemoGroup;
|
186 | }(_react.Component);
|
187 |
|
188 | _reactDom2['default'].render(_react2['default'].createElement(DemoGroup, null), document.getElementById('tinperBeeDemo'));
|
189 |
|
190 | }),
|
191 |
|
192 | (function(module, exports, __webpack_require__) {
|
193 |
|
194 | 'use strict';
|
195 |
|
196 | Object.defineProperty(exports, "__esModule", {
|
197 | value: true
|
198 | });
|
199 | exports.Con = exports.Row = exports.Col = undefined;
|
200 |
|
201 | var _Col2 = __webpack_require__(2);
|
202 |
|
203 | var _Col3 = _interopRequireDefault(_Col2);
|
204 |
|
205 | var _Row2 = __webpack_require__(6);
|
206 |
|
207 | var _Row3 = _interopRequireDefault(_Row2);
|
208 |
|
209 | var _Layout = __webpack_require__(7);
|
210 |
|
211 | var _Layout2 = _interopRequireDefault(_Layout);
|
212 |
|
213 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
214 |
|
215 | exports.Col = _Col3["default"];
|
216 | exports.Row = _Row3["default"];
|
217 | exports.Con = _Layout2["default"];
|
218 |
|
219 | }),
|
220 |
|
221 | (function(module, exports, __webpack_require__) {
|
222 |
|
223 | 'use strict';
|
224 |
|
225 | Object.defineProperty(exports, "__esModule", {
|
226 | value: true
|
227 | });
|
228 |
|
229 | 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; };
|
230 |
|
231 | var _classnames = __webpack_require__(3);
|
232 |
|
233 | var _classnames2 = _interopRequireDefault(_classnames);
|
234 |
|
235 | var _react = __webpack_require__(4);
|
236 |
|
237 | var _react2 = _interopRequireDefault(_react);
|
238 |
|
239 | var _propTypes = __webpack_require__(5);
|
240 |
|
241 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
242 |
|
243 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
244 |
|
245 | 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; }
|
246 |
|
247 | 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; }
|
248 |
|
249 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
250 |
|
251 | 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; }
|
252 |
|
253 | 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); }
|
254 |
|
255 | var propTypes = {
|
256 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]),
|
257 |
|
258 | |
259 |
|
260 |
|
261 | xs: _propTypes2["default"].number,
|
262 | |
263 |
|
264 |
|
265 | sm: _propTypes2["default"].number,
|
266 | |
267 |
|
268 |
|
269 | md: _propTypes2["default"].number,
|
270 | |
271 |
|
272 |
|
273 | lg: _propTypes2["default"].number,
|
274 | |
275 |
|
276 |
|
277 | xsOffset: _propTypes2["default"].number,
|
278 | |
279 |
|
280 |
|
281 | smOffset: _propTypes2["default"].number,
|
282 | |
283 |
|
284 |
|
285 | mdOffset: _propTypes2["default"].number,
|
286 | |
287 |
|
288 |
|
289 | lgOffset: _propTypes2["default"].number,
|
290 | |
291 |
|
292 |
|
293 | xsPush: _propTypes2["default"].number,
|
294 | |
295 |
|
296 |
|
297 | smPush: _propTypes2["default"].number,
|
298 | |
299 |
|
300 |
|
301 | mdPush: _propTypes2["default"].number,
|
302 | |
303 |
|
304 |
|
305 | lgPush: _propTypes2["default"].number,
|
306 | |
307 |
|
308 |
|
309 | xsPull: _propTypes2["default"].number,
|
310 | |
311 |
|
312 |
|
313 | smPull: _propTypes2["default"].number,
|
314 | |
315 |
|
316 |
|
317 | mdPull: _propTypes2["default"].number,
|
318 | |
319 |
|
320 |
|
321 | lgPull: _propTypes2["default"].number
|
322 | };
|
323 |
|
324 | var defaultProps = {
|
325 | componentClass: 'div',
|
326 | clsPrefix: 'u-col'
|
327 | };
|
328 |
|
329 | var DEVICE_SIZES = ['lg', 'md', 'sm', 'xs'];
|
330 |
|
331 | var Col = function (_Component) {
|
332 | _inherits(Col, _Component);
|
333 |
|
334 | function Col() {
|
335 | _classCallCheck(this, Col);
|
336 |
|
337 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
338 | }
|
339 |
|
340 | Col.prototype.render = function render() {
|
341 | var _props = this.props,
|
342 | Component = _props.componentClass,
|
343 | className = _props.className,
|
344 | clsPrefix = _props.clsPrefix,
|
345 | others = _objectWithoutProperties(_props, ['componentClass', 'className', 'clsPrefix']);
|
346 |
|
347 | var tbClass = [];
|
348 | |
349 |
|
350 |
|
351 |
|
352 | DEVICE_SIZES.forEach(function (size) {
|
353 | function popProp(propSuffix, modifier) {
|
354 | var propName = '' + size + propSuffix;
|
355 | var propValue = others[propName];
|
356 |
|
357 | if (propValue != undefined && propValue != null) {
|
358 | tbClass.push(clsPrefix + '-' + size + modifier + '-' + propValue);
|
359 | }
|
360 |
|
361 | delete others[propName];
|
362 | }
|
363 |
|
364 | popProp('', '');
|
365 | popProp('Offset', '-offset');
|
366 | popProp('Push', '-push');
|
367 | popProp('Pull', '-pull');
|
368 | });
|
369 |
|
370 | return _react2["default"].createElement(
|
371 | Component,
|
372 | _extends({
|
373 | className: (0, _classnames2["default"])(tbClass, className)
|
374 | }, others),
|
375 | this.props.children
|
376 | );
|
377 | };
|
378 |
|
379 | return Col;
|
380 | }(_react.Component);
|
381 |
|
382 | Col.defaultProps = defaultProps;
|
383 | Col.propTypes = propTypes;
|
384 |
|
385 | exports["default"] = Col;
|
386 | module.exports = exports['default'];
|
387 |
|
388 | }),
|
389 |
|
390 | (function(module, exports, __webpack_require__) {
|
391 |
|
392 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; |
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 | (function () {
|
400 | 'use strict';
|
401 |
|
402 | var hasOwn = {}.hasOwnProperty;
|
403 |
|
404 | function classNames () {
|
405 | var classes = [];
|
406 |
|
407 | for (var i = 0; i < arguments.length; i++) {
|
408 | var arg = arguments[i];
|
409 | if (!arg) continue;
|
410 |
|
411 | var argType = typeof arg;
|
412 |
|
413 | if (argType === 'string' || argType === 'number') {
|
414 | classes.push(arg);
|
415 | } else if (Array.isArray(arg) && arg.length) {
|
416 | var inner = classNames.apply(null, arg);
|
417 | if (inner) {
|
418 | classes.push(inner);
|
419 | }
|
420 | } else if (argType === 'object') {
|
421 | for (var key in arg) {
|
422 | if (hasOwn.call(arg, key) && arg[key]) {
|
423 | classes.push(key);
|
424 | }
|
425 | }
|
426 | }
|
427 | }
|
428 |
|
429 | return classes.join(' ');
|
430 | }
|
431 |
|
432 | if (typeof module !== 'undefined' && module.exports) {
|
433 | classNames.default = classNames;
|
434 | module.exports = classNames;
|
435 | } else if (true) {
|
436 |
|
437 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
|
438 | return classNames;
|
439 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
440 | } else {
|
441 | window.classNames = classNames;
|
442 | }
|
443 | }());
|
444 |
|
445 |
|
446 | }),
|
447 |
|
448 | (function(module, exports) {
|
449 |
|
450 | module.exports = React;
|
451 |
|
452 | }),
|
453 |
|
454 | (function(module, exports) {
|
455 |
|
456 | module.exports = PropTypes;
|
457 |
|
458 | }),
|
459 |
|
460 | (function(module, exports, __webpack_require__) {
|
461 |
|
462 | 'use strict';
|
463 |
|
464 | Object.defineProperty(exports, "__esModule", {
|
465 | value: true
|
466 | });
|
467 |
|
468 | 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; };
|
469 |
|
470 | var _classnames = __webpack_require__(3);
|
471 |
|
472 | var _classnames2 = _interopRequireDefault(_classnames);
|
473 |
|
474 | var _react = __webpack_require__(4);
|
475 |
|
476 | var _react2 = _interopRequireDefault(_react);
|
477 |
|
478 | var _propTypes = __webpack_require__(5);
|
479 |
|
480 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
481 |
|
482 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
483 |
|
484 | 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; }
|
485 |
|
486 | 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; }
|
487 |
|
488 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
489 |
|
490 | 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; }
|
491 |
|
492 | 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); }
|
493 |
|
494 | var propTypes = {
|
495 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string])
|
496 | };
|
497 |
|
498 | var defaultProps = {
|
499 | componentClass: 'div',
|
500 | clsPrefix: 'u-row'
|
501 | };
|
502 |
|
503 | var Row = function (_Component) {
|
504 | _inherits(Row, _Component);
|
505 |
|
506 | function Row() {
|
507 | _classCallCheck(this, Row);
|
508 |
|
509 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
510 | }
|
511 |
|
512 | Row.prototype.render = function render() {
|
513 | var _props = this.props,
|
514 | Component = _props.componentClass,
|
515 | clsPrefix = _props.clsPrefix,
|
516 | className = _props.className,
|
517 | others = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
|
518 |
|
519 | var bsclass = '' + clsPrefix;
|
520 |
|
521 | return _react2["default"].createElement(
|
522 | Component,
|
523 | _extends({}, others, {
|
524 | className: (0, _classnames2["default"])(bsclass, className)
|
525 | }),
|
526 | this.props.children
|
527 | );
|
528 | };
|
529 |
|
530 | return Row;
|
531 | }(_react.Component);
|
532 |
|
533 | Row.propTypes = propTypes;
|
534 | Row.defaultProps = defaultProps;
|
535 |
|
536 | exports["default"] = Row;
|
537 | module.exports = exports['default'];
|
538 |
|
539 | }),
|
540 |
|
541 | (function(module, exports, __webpack_require__) {
|
542 |
|
543 | 'use strict';
|
544 |
|
545 | Object.defineProperty(exports, "__esModule", {
|
546 | value: true
|
547 | });
|
548 |
|
549 | 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; };
|
550 |
|
551 | var _classnames = __webpack_require__(3);
|
552 |
|
553 | var _classnames2 = _interopRequireDefault(_classnames);
|
554 |
|
555 | var _react = __webpack_require__(4);
|
556 |
|
557 | var _react2 = _interopRequireDefault(_react);
|
558 |
|
559 | var _propTypes = __webpack_require__(5);
|
560 |
|
561 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
562 |
|
563 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
564 |
|
565 | 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; }
|
566 |
|
567 | 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; }
|
568 |
|
569 | 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; }
|
570 |
|
571 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
572 |
|
573 | 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; }
|
574 |
|
575 | 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); }
|
576 |
|
577 | var propTypes = {
|
578 | |
579 |
|
580 |
|
581 | fluid: _propTypes2["default"].bool,
|
582 | |
583 |
|
584 |
|
585 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string])
|
586 | };
|
587 |
|
588 | var defaultProps = {
|
589 | componentClass: 'div',
|
590 | fluid: false,
|
591 | clsPrefix: 'u-container'
|
592 | };
|
593 |
|
594 | var Con = function (_React$Component) {
|
595 | _inherits(Con, _React$Component);
|
596 |
|
597 | function Con() {
|
598 | _classCallCheck(this, Con);
|
599 |
|
600 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
601 | }
|
602 |
|
603 | Con.prototype.render = function render() {
|
604 | var _tbclass;
|
605 |
|
606 | var _props = this.props,
|
607 | fluid = _props.fluid,
|
608 | Component = _props.componentClass,
|
609 | clsPrefix = _props.clsPrefix,
|
610 | className = _props.className,
|
611 | others = _objectWithoutProperties(_props, ['fluid', 'componentClass', 'clsPrefix', 'className']);
|
612 |
|
613 | var tbclass = (_tbclass = {}, _defineProperty(_tbclass, '' + clsPrefix, !fluid), _defineProperty(_tbclass, clsPrefix + '-fluid', fluid), _tbclass);
|
614 |
|
615 | return _react2["default"].createElement(
|
616 | Component,
|
617 | _extends({}, others, {
|
618 | className: (0, _classnames2["default"])(tbclass, className)
|
619 | }),
|
620 | this.props.children
|
621 | );
|
622 | };
|
623 |
|
624 | return Con;
|
625 | }(_react2["default"].Component);
|
626 |
|
627 | Con.propTypes = propTypes;
|
628 | Con.defaultProps = defaultProps;
|
629 |
|
630 | exports["default"] = Con;
|
631 | module.exports = exports['default'];
|
632 |
|
633 | }),
|
634 |
|
635 | (function(module, exports, __webpack_require__) {
|
636 |
|
637 | 'use strict';
|
638 |
|
639 | Object.defineProperty(exports, "__esModule", {
|
640 | value: true
|
641 | });
|
642 | exports.PanelGroup = exports.Panel = undefined;
|
643 |
|
644 | var _Panel2 = __webpack_require__(9);
|
645 |
|
646 | var _Panel3 = _interopRequireDefault(_Panel2);
|
647 |
|
648 | var _PanelGroup2 = __webpack_require__(81);
|
649 |
|
650 | var _PanelGroup3 = _interopRequireDefault(_PanelGroup2);
|
651 |
|
652 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
653 |
|
654 | exports.Panel = _Panel3["default"];
|
655 | exports.PanelGroup = _PanelGroup3["default"];
|
656 |
|
657 | }),
|
658 |
|
659 | (function(module, exports, __webpack_require__) {
|
660 |
|
661 | 'use strict';
|
662 |
|
663 | Object.defineProperty(exports, "__esModule", {
|
664 | value: true
|
665 | });
|
666 |
|
667 | 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; };
|
668 |
|
669 | var _classnames = __webpack_require__(3);
|
670 |
|
671 | var _classnames2 = _interopRequireDefault(_classnames);
|
672 |
|
673 | var _react = __webpack_require__(4);
|
674 |
|
675 | var _react2 = _interopRequireDefault(_react);
|
676 |
|
677 | var _beeTransition = __webpack_require__(10);
|
678 |
|
679 | var _beeMessage = __webpack_require__(65);
|
680 |
|
681 | var _beeMessage2 = _interopRequireDefault(_beeMessage);
|
682 |
|
683 | var _propTypes = __webpack_require__(5);
|
684 |
|
685 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
686 |
|
687 | var _copyToClipboard = __webpack_require__(79);
|
688 |
|
689 | var _copyToClipboard2 = _interopRequireDefault(_copyToClipboard);
|
690 |
|
691 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
692 |
|
693 | 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; }
|
694 |
|
695 | 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; }
|
696 |
|
697 | 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; }
|
698 |
|
699 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
700 |
|
701 | 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; }
|
702 |
|
703 | 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); }
|
704 |
|
705 | var propTypes = {
|
706 |
|
707 | collapsible: _propTypes2["default"].bool,
|
708 | onSelect: _propTypes2["default"].func,
|
709 |
|
710 | header: _propTypes2["default"].node,
|
711 | headerStyle: _propTypes2["default"].object,
|
712 | id: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
713 | headerContent: _propTypes2["default"].bool,
|
714 |
|
715 | footer: _propTypes2["default"].node,
|
716 | footerStyle: _propTypes2["default"].object,
|
717 |
|
718 | defaultExpanded: _propTypes2["default"].bool,
|
719 |
|
720 | expanded: _propTypes2["default"].bool,
|
721 |
|
722 | eventKey: _propTypes2["default"].any,
|
723 | headerRole: _propTypes2["default"].string,
|
724 | panelRole: _propTypes2["default"].string,
|
725 |
|
726 | colors: _propTypes2["default"].oneOf(['primary', 'accent', 'success', 'info', 'warning', 'danger', 'default', 'bordered']),
|
727 |
|
728 |
|
729 | onEnter: _propTypes2["default"].func,
|
730 | onEntering: _propTypes2["default"].func,
|
731 | onEntered: _propTypes2["default"].func,
|
732 | onExit: _propTypes2["default"].func,
|
733 | onExiting: _propTypes2["default"].func,
|
734 | onExited: _propTypes2["default"].func,
|
735 |
|
736 | copyable: _propTypes2["default"].bool
|
737 | };
|
738 |
|
739 | var defaultProps = {
|
740 | defaultExpanded: false,
|
741 | clsPrefix: "u-panel",
|
742 | colors: "default"
|
743 | };
|
744 |
|
745 | var Panel = function (_React$Component) {
|
746 | _inherits(Panel, _React$Component);
|
747 |
|
748 | function Panel(props, context) {
|
749 | _classCallCheck(this, Panel);
|
750 |
|
751 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
752 |
|
753 | _this.handleClickTitle = _this.handleClickTitle.bind(_this);
|
754 |
|
755 | _this.state = {
|
756 | expanded: _this.props.defaultExpanded
|
757 | };
|
758 | return _this;
|
759 | }
|
760 |
|
761 |
|
762 |
|
763 |
|
764 | Panel.prototype.handleClickTitle = function handleClickTitle(e) {
|
765 |
|
766 | e.persist();
|
767 | e.selected = true;
|
768 |
|
769 | if (this.props.onSelect) {
|
770 | this.props.onSelect(this.props.eventKey, e);
|
771 | } else {
|
772 | e.preventDefault();
|
773 | }
|
774 |
|
775 | if (e.selected) {
|
776 | this.setState({ expanded: !this.state.expanded });
|
777 | }
|
778 | };
|
779 |
|
780 |
|
781 |
|
782 |
|
783 | Panel.prototype.renderHeader = function renderHeader(collapsible, header, id, role, expanded, clsPrefix) {
|
784 | var titleClassName = clsPrefix + '-title';
|
785 |
|
786 | if (!collapsible) {
|
787 | if (!_react2["default"].isValidElement(header)) {
|
788 | return header;
|
789 | }
|
790 |
|
791 | return (0, _react.cloneElement)(header, {
|
792 | className: (0, _classnames2["default"])(header.props.className, titleClassName)
|
793 | });
|
794 | }
|
795 |
|
796 | if (!_react2["default"].isValidElement(header)) {
|
797 | return _react2["default"].createElement(
|
798 | 'h4',
|
799 | { role: 'presentation', className: titleClassName },
|
800 | this.renderAnchor(header, id, role, expanded)
|
801 | );
|
802 | }
|
803 | if (this.props.headerContent) {
|
804 | return (0, _react.cloneElement)(header, {
|
805 | className: (0, _classnames2["default"])(header.props.className, titleClassName)
|
806 | });
|
807 | }
|
808 |
|
809 | return (0, _react.cloneElement)(header, {
|
810 | className: (0, _classnames2["default"])(header.props.className, titleClassName),
|
811 | children: this.renderAnchor(header.props.children, id, role, expanded)
|
812 | });
|
813 | };
|
814 |
|
815 |
|
816 |
|
817 |
|
818 | Panel.prototype.renderAnchor = function renderAnchor(header, id, role, expanded) {
|
819 | return _react2["default"].createElement(
|
820 | 'a',
|
821 | {
|
822 | role: role,
|
823 | href: id && '#' + id,
|
824 | 'aria-controls': id,
|
825 | 'aria-expanded': expanded,
|
826 | 'aria-selected': expanded,
|
827 | className: expanded ? null : 'collapsed'
|
828 | },
|
829 | header
|
830 | );
|
831 | };
|
832 |
|
833 |
|
834 |
|
835 |
|
836 | Panel.prototype.copyDemo = function copyDemo(e) {
|
837 | var panelTarget = e.target.parentNode;
|
838 | var clipBoardContent = panelTarget.firstChild.innerText;
|
839 | (0, _copyToClipboard2["default"])(clipBoardContent);
|
840 | _beeMessage2["default"].create({ content: '复制成功!', color: 'success', duration: 2 });
|
841 | };
|
842 |
|
843 |
|
844 |
|
845 |
|
846 | Panel.prototype.renderCollapsibleBody = function renderCollapsibleBody(id, expanded, role, children, clsPrefix, copyable, animationHooks) {
|
847 | return _react2["default"].createElement(
|
848 | _beeTransition.Collapse,
|
849 | _extends({ 'in': expanded }, animationHooks),
|
850 | _react2["default"].createElement(
|
851 | 'div',
|
852 | {
|
853 | id: id,
|
854 | role: role,
|
855 | className: clsPrefix + '-collapse',
|
856 | 'aria-hidden': !expanded
|
857 | },
|
858 | this.renderBody(children, clsPrefix, copyable)
|
859 | )
|
860 | );
|
861 | };
|
862 |
|
863 |
|
864 |
|
865 |
|
866 | Panel.prototype.renderBody = function renderBody(rawChildren, clsPrefix, copyable) {
|
867 | var self = this;
|
868 | var children = [];
|
869 | var bodyChildren = [];
|
870 |
|
871 | var bodyClassName = clsPrefix + '-body';
|
872 |
|
873 | function maybeAddBody(self) {
|
874 | if (!bodyChildren.length) {
|
875 | return;
|
876 | }
|
877 |
|
878 | children.push(_react2["default"].createElement(
|
879 | 'div',
|
880 | { key: children.length, className: bodyClassName },
|
881 | bodyChildren,
|
882 | copyable && _react2["default"].createElement('i', { className: clsPrefix + '-copy uf uf-files-o', onClick: self.copyDemo })
|
883 | ));
|
884 | bodyChildren = [];
|
885 | }
|
886 |
|
887 |
|
888 | _react2["default"].Children.toArray(rawChildren).forEach(function (child) {
|
889 | if (_react2["default"].isValidElement(child) && child.props.fill) {
|
890 | maybeAddBody(self);
|
891 |
|
892 |
|
893 | children.push((0, _react.cloneElement)(child, { fill: undefined }));
|
894 |
|
895 | return;
|
896 | }
|
897 | bodyChildren.push(child);
|
898 | });
|
899 |
|
900 | maybeAddBody(self);
|
901 |
|
902 | return children;
|
903 | };
|
904 |
|
905 | Panel.prototype.render = function render() {
|
906 | var _props = this.props,
|
907 | collapsible = _props.collapsible,
|
908 | header = _props.header,
|
909 | id = _props.id,
|
910 | footer = _props.footer,
|
911 | propsExpanded = _props.expanded,
|
912 | footerStyle = _props.footerStyle,
|
913 | headerStyle = _props.headerStyle,
|
914 | headerRole = _props.headerRole,
|
915 | panelRole = _props.panelRole,
|
916 | className = _props.className,
|
917 | colors = _props.colors,
|
918 | children = _props.children,
|
919 | onEnter = _props.onEnter,
|
920 | onEntering = _props.onEntering,
|
921 | onEntered = _props.onEntered,
|
922 | clsPrefix = _props.clsPrefix,
|
923 | onExit = _props.onExit,
|
924 | headerContent = _props.headerContent,
|
925 | onExiting = _props.onExiting,
|
926 | onExited = _props.onExited,
|
927 | defaultExpanded = _props.defaultExpanded,
|
928 | eventKey = _props.eventKey,
|
929 | onSelect = _props.onSelect,
|
930 | copyable = _props.copyable,
|
931 | 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']);
|
932 |
|
933 | var expanded = propsExpanded != null ? propsExpanded : this.state.expanded;
|
934 |
|
935 | var classes = {};
|
936 | classes['' + clsPrefix] = true;
|
937 | classes[clsPrefix + '-' + colors] = true;
|
938 |
|
939 | var headerClass = _defineProperty({}, clsPrefix + '-heading', true);
|
940 |
|
941 | copyable === false ? false : true;
|
942 | return _react2["default"].createElement(
|
943 | 'div',
|
944 | _extends({}, props, {
|
945 | className: (0, _classnames2["default"])(className, classes),
|
946 | id: collapsible ? null : id
|
947 | }),
|
948 | header && _react2["default"].createElement(
|
949 | 'div',
|
950 | { className: (0, _classnames2["default"])(headerClass), style: headerStyle, onClick: this.handleClickTitle },
|
951 | this.renderHeader(collapsible, header, id, headerRole, expanded, clsPrefix)
|
952 | ),
|
953 | 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),
|
954 | footer && _react2["default"].createElement(
|
955 | 'div',
|
956 | { className: clsPrefix + '-footer', style: footerStyle },
|
957 | footer
|
958 | )
|
959 | );
|
960 | };
|
961 |
|
962 | return Panel;
|
963 | }(_react2["default"].Component);
|
964 |
|
965 | Panel.propTypes = propTypes;
|
966 | Panel.defaultProps = defaultProps;
|
967 |
|
968 | exports["default"] = Panel;
|
969 | module.exports = exports['default'];
|
970 |
|
971 | }),
|
972 |
|
973 | (function(module, exports, __webpack_require__) {
|
974 |
|
975 | 'use strict';
|
976 |
|
977 | Object.defineProperty(exports, "__esModule", {
|
978 | value: true
|
979 | });
|
980 | exports.Fade = exports.Collapse = exports.Transition = undefined;
|
981 |
|
982 | var _Transition2 = __webpack_require__(11);
|
983 |
|
984 | var _Transition3 = _interopRequireDefault(_Transition2);
|
985 |
|
986 | var _Collapse2 = __webpack_require__(17);
|
987 |
|
988 | var _Collapse3 = _interopRequireDefault(_Collapse2);
|
989 |
|
990 | var _Fade2 = __webpack_require__(64);
|
991 |
|
992 | var _Fade3 = _interopRequireDefault(_Fade2);
|
993 |
|
994 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
995 |
|
996 | exports.Transition = _Transition3["default"];
|
997 | exports.Collapse = _Collapse3["default"];
|
998 | exports.Fade = _Fade3["default"];
|
999 |
|
1000 | }),
|
1001 |
|
1002 | (function(module, exports, __webpack_require__) {
|
1003 |
|
1004 | 'use strict';
|
1005 |
|
1006 | Object.defineProperty(exports, "__esModule", {
|
1007 | value: true
|
1008 | });
|
1009 | exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined;
|
1010 |
|
1011 | 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; };
|
1012 |
|
1013 | var _react = __webpack_require__(4);
|
1014 |
|
1015 | var _react2 = _interopRequireDefault(_react);
|
1016 |
|
1017 | var _reactDom = __webpack_require__(12);
|
1018 |
|
1019 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
1020 |
|
1021 | var _properties = __webpack_require__(13);
|
1022 |
|
1023 | var _properties2 = _interopRequireDefault(_properties);
|
1024 |
|
1025 | var _on = __webpack_require__(16);
|
1026 |
|
1027 | var _on2 = _interopRequireDefault(_on);
|
1028 |
|
1029 | var _classnames = __webpack_require__(3);
|
1030 |
|
1031 | var _classnames2 = _interopRequireDefault(_classnames);
|
1032 |
|
1033 | var _propTypes = __webpack_require__(5);
|
1034 |
|
1035 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
1036 |
|
1037 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1038 |
|
1039 | 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; }
|
1040 |
|
1041 | 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; }
|
1042 |
|
1043 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1044 |
|
1045 | 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; }
|
1046 |
|
1047 | 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); }
|
1048 |
|
1049 | var transitionEndEvent = _properties2["default"].end;
|
1050 |
|
1051 |
|
1052 | var UNMOUNTED = exports.UNMOUNTED = 0;
|
1053 | var EXITED = exports.EXITED = 1;
|
1054 | var ENTERING = exports.ENTERING = 2;
|
1055 | var ENTERED = exports.ENTERED = 3;
|
1056 | var EXITING = exports.EXITING = 4;
|
1057 |
|
1058 | var propTypes = {
|
1059 | |
1060 |
|
1061 |
|
1062 | "in": _propTypes2["default"].bool,
|
1063 |
|
1064 | |
1065 |
|
1066 |
|
1067 | unmountOnExit: _propTypes2["default"].bool,
|
1068 |
|
1069 | |
1070 |
|
1071 |
|
1072 | transitionAppear: _propTypes2["default"].bool,
|
1073 |
|
1074 | |
1075 |
|
1076 |
|
1077 | timeout: _propTypes2["default"].number,
|
1078 |
|
1079 | |
1080 |
|
1081 |
|
1082 | exitedClassName: _propTypes2["default"].string,
|
1083 | |
1084 |
|
1085 |
|
1086 | exitingClassName: _propTypes2["default"].string,
|
1087 | |
1088 |
|
1089 |
|
1090 | enteredClassName: _propTypes2["default"].string,
|
1091 | |
1092 |
|
1093 |
|
1094 | enteringClassName: _propTypes2["default"].string,
|
1095 |
|
1096 | |
1097 |
|
1098 |
|
1099 | onEnter: _propTypes2["default"].func,
|
1100 | |
1101 |
|
1102 |
|
1103 | onEntering: _propTypes2["default"].func,
|
1104 | |
1105 |
|
1106 |
|
1107 | onEntered: _propTypes2["default"].func,
|
1108 | |
1109 |
|
1110 |
|
1111 | onExit: _propTypes2["default"].func,
|
1112 | |
1113 |
|
1114 |
|
1115 | onExiting: _propTypes2["default"].func,
|
1116 | |
1117 |
|
1118 |
|
1119 | onExited: _propTypes2["default"].func
|
1120 | };
|
1121 |
|
1122 | function noop() {}
|
1123 |
|
1124 | var defaultProps = {
|
1125 | "in": false,
|
1126 | unmountOnExit: false,
|
1127 | transitionAppear: false,
|
1128 | timeout: 5000,
|
1129 | onEnter: noop,
|
1130 | onEntering: noop,
|
1131 | onEntered: noop,
|
1132 | onExit: noop,
|
1133 | onExiting: noop,
|
1134 | onExited: noop
|
1135 | };
|
1136 |
|
1137 | |
1138 |
|
1139 |
|
1140 |
|
1141 | var Transition = function (_Component) {
|
1142 | _inherits(Transition, _Component);
|
1143 |
|
1144 | function Transition(props, context) {
|
1145 | _classCallCheck(this, Transition);
|
1146 |
|
1147 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
1148 |
|
1149 | var initialStatus = void 0;
|
1150 | if (props["in"]) {
|
1151 |
|
1152 | initialStatus = props.transitionAppear ? EXITED : ENTERED;
|
1153 | } else {
|
1154 | initialStatus = props.unmountOnExit ? UNMOUNTED : EXITED;
|
1155 | }
|
1156 | _this.state = { status: initialStatus };
|
1157 |
|
1158 | _this.nextCallback = null;
|
1159 | return _this;
|
1160 | }
|
1161 |
|
1162 | Transition.prototype.componentDidMount = function componentDidMount() {
|
1163 | if (this.props.transitionAppear && this.props["in"]) {
|
1164 | this.performEnter(this.props);
|
1165 | }
|
1166 | };
|
1167 |
|
1168 | Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
1169 | if (nextProps["in"] && this.props.unmountOnExit) {
|
1170 | if (this.state.status === UNMOUNTED) {
|
1171 |
|
1172 | this.setState({ status: EXITED });
|
1173 | }
|
1174 | } else {
|
1175 | this._needsUpdate = true;
|
1176 | }
|
1177 | };
|
1178 |
|
1179 | Transition.prototype.componentDidUpdate = function componentDidUpdate() {
|
1180 | var status = this.state.status;
|
1181 |
|
1182 | if (this.props.unmountOnExit && status === EXITED) {
|
1183 |
|
1184 | if (this.props["in"]) {
|
1185 | this.performEnter(this.props);
|
1186 | } else {
|
1187 | this.setState({ status: UNMOUNTED });
|
1188 | }
|
1189 |
|
1190 | return;
|
1191 | }
|
1192 |
|
1193 |
|
1194 | if (this._needsUpdate) {
|
1195 | this._needsUpdate = false;
|
1196 |
|
1197 | if (this.props["in"]) {
|
1198 | if (status === EXITING) {
|
1199 | this.performEnter(this.props);
|
1200 | } else if (status === EXITED) {
|
1201 | this.performEnter(this.props);
|
1202 | }
|
1203 |
|
1204 | } else {
|
1205 | if (status === ENTERING || status === ENTERED) {
|
1206 | this.performExit(this.props);
|
1207 | }
|
1208 |
|
1209 | }
|
1210 | }
|
1211 | };
|
1212 |
|
1213 | Transition.prototype.componentWillUnmount = function componentWillUnmount() {
|
1214 | this.cancelNextCallback();
|
1215 | };
|
1216 |
|
1217 | Transition.prototype.performEnter = function performEnter(props) {
|
1218 | var _this2 = this;
|
1219 |
|
1220 | this.cancelNextCallback();
|
1221 | var node = _reactDom2["default"].findDOMNode(this);
|
1222 |
|
1223 |
|
1224 | props.onEnter(node);
|
1225 |
|
1226 | this.safeSetState({ status: ENTERING }, function () {
|
1227 | _this2.props.onEntering(node);
|
1228 |
|
1229 | _this2.onTransitionEnd(node, function () {
|
1230 | _this2.safeSetState({ status: ENTERED }, function () {
|
1231 | _this2.props.onEntered(node);
|
1232 | });
|
1233 | });
|
1234 | });
|
1235 | };
|
1236 |
|
1237 | Transition.prototype.performExit = function performExit(props) {
|
1238 | var _this3 = this;
|
1239 |
|
1240 | this.cancelNextCallback();
|
1241 | var node = _reactDom2["default"].findDOMNode(this);
|
1242 |
|
1243 | props.onExit(node);
|
1244 |
|
1245 | this.safeSetState({ status: EXITING }, function () {
|
1246 | _this3.props.onExiting(node);
|
1247 |
|
1248 | _this3.onTransitionEnd(node, function () {
|
1249 | _this3.safeSetState({ status: EXITED }, function () {
|
1250 | _this3.props.onExited(node);
|
1251 | });
|
1252 | });
|
1253 | });
|
1254 | };
|
1255 |
|
1256 | Transition.prototype.cancelNextCallback = function cancelNextCallback() {
|
1257 | if (this.nextCallback !== null) {
|
1258 | this.nextCallback.cancel();
|
1259 | this.nextCallback = null;
|
1260 | }
|
1261 | };
|
1262 |
|
1263 | Transition.prototype.safeSetState = function safeSetState(nextState, callback) {
|
1264 |
|
1265 | this.setState(nextState, this.setNextCallback(callback));
|
1266 | };
|
1267 |
|
1268 | Transition.prototype.setNextCallback = function setNextCallback(callback) {
|
1269 | var _this4 = this;
|
1270 |
|
1271 | var active = true;
|
1272 |
|
1273 | this.nextCallback = function (event) {
|
1274 | if (active) {
|
1275 | active = false;
|
1276 | _this4.nextCallback = null;
|
1277 |
|
1278 | callback(event);
|
1279 | }
|
1280 | };
|
1281 |
|
1282 | this.nextCallback.cancel = function () {
|
1283 | active = false;
|
1284 | };
|
1285 |
|
1286 | return this.nextCallback;
|
1287 | };
|
1288 |
|
1289 | Transition.prototype.onTransitionEnd = function onTransitionEnd(node, handler) {
|
1290 | this.setNextCallback(handler);
|
1291 |
|
1292 | if (node) {
|
1293 | if (transitionEndEvent == undefined) {
|
1294 | this.nextCallback();
|
1295 | } else {
|
1296 | (0, _on2["default"])(node, transitionEndEvent, this.nextCallback);
|
1297 | }
|
1298 | setTimeout(this.nextCallback, this.props.timeout);
|
1299 | } else {
|
1300 | setTimeout(this.nextCallback, 0);
|
1301 | }
|
1302 | };
|
1303 |
|
1304 | Transition.prototype.render = function render() {
|
1305 | var status = this.state.status;
|
1306 | if (status === UNMOUNTED) {
|
1307 | return null;
|
1308 | }
|
1309 |
|
1310 | var _props = this.props,
|
1311 | children = _props.children,
|
1312 | className = _props.className,
|
1313 | childProps = _objectWithoutProperties(_props, ['children', 'className']);
|
1314 |
|
1315 | Object.keys(Transition.propTypes).forEach(function (key) {
|
1316 | return delete childProps[key];
|
1317 | });
|
1318 |
|
1319 | var transitionClassName = void 0;
|
1320 | if (status === EXITED) {
|
1321 | transitionClassName = this.props.exitedClassName;
|
1322 | } else if (status === ENTERING) {
|
1323 | transitionClassName = this.props.enteringClassName;
|
1324 | } else if (status === ENTERED) {
|
1325 | transitionClassName = this.props.enteredClassName;
|
1326 | } else if (status === EXITING) {
|
1327 | transitionClassName = this.props.exitingClassName;
|
1328 | }
|
1329 |
|
1330 | var child = _react2["default"].Children.only(children);
|
1331 | return _react2["default"].cloneElement(child, _extends({}, childProps, {
|
1332 | className: (0, _classnames2["default"])(child.props.className, className, transitionClassName)
|
1333 | }));
|
1334 | };
|
1335 |
|
1336 | return Transition;
|
1337 | }(_react.Component);
|
1338 |
|
1339 | Transition.propTypes = propTypes;
|
1340 |
|
1341 | Transition.defaultProps = defaultProps;
|
1342 |
|
1343 | exports["default"] = Transition;
|
1344 |
|
1345 | }),
|
1346 |
|
1347 | (function(module, exports) {
|
1348 |
|
1349 | module.exports = ReactDOM;
|
1350 |
|
1351 | }),
|
1352 |
|
1353 | (function(module, exports, __webpack_require__) {
|
1354 |
|
1355 | "use strict";
|
1356 |
|
1357 | var _interopRequireDefault = __webpack_require__(14);
|
1358 |
|
1359 | exports.__esModule = true;
|
1360 | 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;
|
1361 |
|
1362 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
1363 |
|
1364 | var transform = 'transform';
|
1365 | exports.transform = transform;
|
1366 | var prefix, transitionEnd, animationEnd;
|
1367 | exports.animationEnd = animationEnd;
|
1368 | exports.transitionEnd = transitionEnd;
|
1369 | var transitionProperty, transitionDuration, transitionTiming, transitionDelay;
|
1370 | exports.transitionDelay = transitionDelay;
|
1371 | exports.transitionTiming = transitionTiming;
|
1372 | exports.transitionDuration = transitionDuration;
|
1373 | exports.transitionProperty = transitionProperty;
|
1374 | var animationName, animationDuration, animationTiming, animationDelay;
|
1375 | exports.animationDelay = animationDelay;
|
1376 | exports.animationTiming = animationTiming;
|
1377 | exports.animationDuration = animationDuration;
|
1378 | exports.animationName = animationName;
|
1379 |
|
1380 | if (_inDOM.default) {
|
1381 | var _getTransitionPropert = getTransitionProperties();
|
1382 |
|
1383 | prefix = _getTransitionPropert.prefix;
|
1384 | exports.transitionEnd = transitionEnd = _getTransitionPropert.transitionEnd;
|
1385 | exports.animationEnd = animationEnd = _getTransitionPropert.animationEnd;
|
1386 | exports.transform = transform = prefix + "-" + transform;
|
1387 | exports.transitionProperty = transitionProperty = prefix + "-transition-property";
|
1388 | exports.transitionDuration = transitionDuration = prefix + "-transition-duration";
|
1389 | exports.transitionDelay = transitionDelay = prefix + "-transition-delay";
|
1390 | exports.transitionTiming = transitionTiming = prefix + "-transition-timing-function";
|
1391 | exports.animationName = animationName = prefix + "-animation-name";
|
1392 | exports.animationDuration = animationDuration = prefix + "-animation-duration";
|
1393 | exports.animationTiming = animationTiming = prefix + "-animation-delay";
|
1394 | exports.animationDelay = animationDelay = prefix + "-animation-timing-function";
|
1395 | }
|
1396 |
|
1397 | var _default = {
|
1398 | transform: transform,
|
1399 | end: transitionEnd,
|
1400 | property: transitionProperty,
|
1401 | timing: transitionTiming,
|
1402 | delay: transitionDelay,
|
1403 | duration: transitionDuration
|
1404 | };
|
1405 | exports.default = _default;
|
1406 |
|
1407 | function getTransitionProperties() {
|
1408 | var style = document.createElement('div').style;
|
1409 | var vendorMap = {
|
1410 | O: function O(e) {
|
1411 | return "o" + e.toLowerCase();
|
1412 | },
|
1413 | Moz: function Moz(e) {
|
1414 | return e.toLowerCase();
|
1415 | },
|
1416 | Webkit: function Webkit(e) {
|
1417 | return "webkit" + e;
|
1418 | },
|
1419 | ms: function ms(e) {
|
1420 | return "MS" + e;
|
1421 | }
|
1422 | };
|
1423 | var vendors = Object.keys(vendorMap);
|
1424 | var transitionEnd, animationEnd;
|
1425 | var prefix = '';
|
1426 |
|
1427 | for (var i = 0; i < vendors.length; i++) {
|
1428 | var vendor = vendors[i];
|
1429 |
|
1430 | if (vendor + "TransitionProperty" in style) {
|
1431 | prefix = "-" + vendor.toLowerCase();
|
1432 | transitionEnd = vendorMap[vendor]('TransitionEnd');
|
1433 | animationEnd = vendorMap[vendor]('AnimationEnd');
|
1434 | break;
|
1435 | }
|
1436 | }
|
1437 |
|
1438 | if (!transitionEnd && 'transitionProperty' in style) transitionEnd = 'transitionend';
|
1439 | if (!animationEnd && 'animationName' in style) animationEnd = 'animationend';
|
1440 | style = null;
|
1441 | return {
|
1442 | animationEnd: animationEnd,
|
1443 | transitionEnd: transitionEnd,
|
1444 | prefix: prefix
|
1445 | };
|
1446 | }
|
1447 |
|
1448 | }),
|
1449 |
|
1450 | (function(module, exports) {
|
1451 |
|
1452 | function _interopRequireDefault(obj) {
|
1453 | return obj && obj.__esModule ? obj : {
|
1454 | default: obj
|
1455 | };
|
1456 | }
|
1457 |
|
1458 | module.exports = _interopRequireDefault;
|
1459 |
|
1460 | }),
|
1461 |
|
1462 | (function(module, exports) {
|
1463 |
|
1464 | "use strict";
|
1465 |
|
1466 | exports.__esModule = true;
|
1467 | exports.default = void 0;
|
1468 |
|
1469 | var _default = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
1470 |
|
1471 | exports.default = _default;
|
1472 | module.exports = exports["default"];
|
1473 |
|
1474 | }),
|
1475 |
|
1476 | (function(module, exports, __webpack_require__) {
|
1477 |
|
1478 | "use strict";
|
1479 |
|
1480 | var _interopRequireDefault = __webpack_require__(14);
|
1481 |
|
1482 | exports.__esModule = true;
|
1483 | exports.default = void 0;
|
1484 |
|
1485 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
1486 |
|
1487 | var on = function on() {};
|
1488 |
|
1489 | if (_inDOM.default) {
|
1490 | on = function () {
|
1491 | if (document.addEventListener) return function (node, eventName, handler, capture) {
|
1492 | return node.addEventListener(eventName, handler, capture || false);
|
1493 | };else if (document.attachEvent) return function (node, eventName, handler) {
|
1494 | return node.attachEvent('on' + eventName, function (e) {
|
1495 | e = e || window.event;
|
1496 | e.target = e.target || e.srcElement;
|
1497 | e.currentTarget = node;
|
1498 | handler.call(node, e);
|
1499 | });
|
1500 | };
|
1501 | }();
|
1502 | }
|
1503 |
|
1504 | var _default = on;
|
1505 | exports.default = _default;
|
1506 | module.exports = exports["default"];
|
1507 |
|
1508 | }),
|
1509 |
|
1510 | (function(module, exports, __webpack_require__) {
|
1511 |
|
1512 | 'use strict';
|
1513 |
|
1514 | Object.defineProperty(exports, "__esModule", {
|
1515 | value: true
|
1516 | });
|
1517 |
|
1518 | 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; };
|
1519 |
|
1520 | var _classnames = __webpack_require__(3);
|
1521 |
|
1522 | var _classnames2 = _interopRequireDefault(_classnames);
|
1523 |
|
1524 | var _style = __webpack_require__(18);
|
1525 |
|
1526 | var _style2 = _interopRequireDefault(_style);
|
1527 |
|
1528 | var _react = __webpack_require__(4);
|
1529 |
|
1530 | var _react2 = _interopRequireDefault(_react);
|
1531 |
|
1532 | var _propTypes = __webpack_require__(5);
|
1533 |
|
1534 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
1535 |
|
1536 | var _Transition = __webpack_require__(11);
|
1537 |
|
1538 | var _Transition2 = _interopRequireDefault(_Transition);
|
1539 |
|
1540 | var _capitalize = __webpack_require__(26);
|
1541 |
|
1542 | var _capitalize2 = _interopRequireDefault(_capitalize);
|
1543 |
|
1544 | var _tinperBeeCore = __webpack_require__(27);
|
1545 |
|
1546 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1547 |
|
1548 | 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; }
|
1549 |
|
1550 | 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; }
|
1551 |
|
1552 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1553 |
|
1554 | 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; }
|
1555 |
|
1556 | 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); }
|
1557 |
|
1558 | var MARGINS = {
|
1559 | height: ['marginTop', 'marginBottom'],
|
1560 | width: ['marginLeft', 'marginRight']
|
1561 | };
|
1562 |
|
1563 |
|
1564 |
|
1565 | function triggerBrowserReflow(node) {
|
1566 | node.offsetHeight;
|
1567 | }
|
1568 |
|
1569 | function getDimensionValue(dimension, elem) {
|
1570 | var value = elem['offset' + (0, _capitalize2["default"])(dimension)];
|
1571 | var margins = MARGINS[dimension];
|
1572 |
|
1573 | return value + parseInt((0, _style2["default"])(elem, margins[0]), 10) + parseInt((0, _style2["default"])(elem, margins[1]), 10);
|
1574 | }
|
1575 |
|
1576 | var propTypes = {
|
1577 | |
1578 |
|
1579 |
|
1580 | "in": _propTypes2["default"].bool,
|
1581 |
|
1582 | |
1583 |
|
1584 |
|
1585 | unmountOnExit: _propTypes2["default"].bool,
|
1586 |
|
1587 | |
1588 |
|
1589 |
|
1590 |
|
1591 | transitionAppear: _propTypes2["default"].bool,
|
1592 |
|
1593 | |
1594 |
|
1595 |
|
1596 |
|
1597 |
|
1598 | timeout: _propTypes2["default"].number,
|
1599 |
|
1600 | |
1601 |
|
1602 |
|
1603 | onEnter: _propTypes2["default"].func,
|
1604 | |
1605 |
|
1606 |
|
1607 | onEntering: _propTypes2["default"].func,
|
1608 | |
1609 |
|
1610 |
|
1611 | onEntered: _propTypes2["default"].func,
|
1612 | |
1613 |
|
1614 |
|
1615 | onExit: _propTypes2["default"].func,
|
1616 | |
1617 |
|
1618 |
|
1619 | onExiting: _propTypes2["default"].func,
|
1620 | |
1621 |
|
1622 |
|
1623 | onExited: _propTypes2["default"].func,
|
1624 |
|
1625 | |
1626 |
|
1627 |
|
1628 |
|
1629 |
|
1630 |
|
1631 |
|
1632 | dimension: _propTypes2["default"].oneOfType([_propTypes2["default"].oneOf(['height', 'width']), _propTypes2["default"].func]),
|
1633 |
|
1634 | |
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 | getDimensionValue: _propTypes2["default"].func,
|
1642 |
|
1643 | |
1644 |
|
1645 |
|
1646 | role: _propTypes2["default"].string
|
1647 | };
|
1648 |
|
1649 | var defaultProps = {
|
1650 | "in": false,
|
1651 | timeout: 300,
|
1652 | unmountOnExit: false,
|
1653 | transitionAppear: false,
|
1654 |
|
1655 | dimension: 'height',
|
1656 | getDimensionValue: getDimensionValue
|
1657 | };
|
1658 |
|
1659 | var Collapse = function (_React$Component) {
|
1660 | _inherits(Collapse, _React$Component);
|
1661 |
|
1662 | function Collapse(props, context) {
|
1663 | _classCallCheck(this, Collapse);
|
1664 |
|
1665 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
1666 |
|
1667 | _this.handleEnter = _this.handleEnter.bind(_this);
|
1668 | _this.handleEntering = _this.handleEntering.bind(_this);
|
1669 | _this.handleEntered = _this.handleEntered.bind(_this);
|
1670 | _this.handleExit = _this.handleExit.bind(_this);
|
1671 | _this.handleExiting = _this.handleExiting.bind(_this);
|
1672 | return _this;
|
1673 | }
|
1674 |
|
1675 |
|
1676 |
|
1677 |
|
1678 | Collapse.prototype.handleEnter = function handleEnter(elem) {
|
1679 | var dimension = this._dimension();
|
1680 | elem.style[dimension] = '0';
|
1681 | };
|
1682 |
|
1683 | Collapse.prototype.handleEntering = function handleEntering(elem) {
|
1684 | var dimension = this._dimension();
|
1685 | elem.style[dimension] = this._getScrollDimensionValue(elem, dimension);
|
1686 | };
|
1687 |
|
1688 | Collapse.prototype.handleEntered = function handleEntered(elem) {
|
1689 | var dimension = this._dimension();
|
1690 | elem.style[dimension] = null;
|
1691 | };
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 | Collapse.prototype.handleExit = function handleExit(elem) {
|
1697 | var dimension = this._dimension();
|
1698 | elem.style[dimension] = this.props.getDimensionValue(dimension, elem) + 'px';
|
1699 | triggerBrowserReflow(elem);
|
1700 | };
|
1701 |
|
1702 | Collapse.prototype.handleExiting = function handleExiting(elem) {
|
1703 | var dimension = this._dimension();
|
1704 | elem.style[dimension] = '0';
|
1705 | };
|
1706 |
|
1707 | Collapse.prototype._dimension = function _dimension() {
|
1708 | return typeof this.props.dimension === 'function' ? this.props.dimension() : this.props.dimension;
|
1709 | };
|
1710 |
|
1711 |
|
1712 |
|
1713 |
|
1714 | Collapse.prototype._getScrollDimensionValue = function _getScrollDimensionValue(elem, dimension) {
|
1715 | return elem['scroll' + (0, _capitalize2["default"])(dimension)] + 'px';
|
1716 | };
|
1717 |
|
1718 | Collapse.prototype.render = function render() {
|
1719 | var _props = this.props,
|
1720 | onEnter = _props.onEnter,
|
1721 | onEntering = _props.onEntering,
|
1722 | onEntered = _props.onEntered,
|
1723 | onExit = _props.onExit,
|
1724 | onExiting = _props.onExiting,
|
1725 | className = _props.className,
|
1726 | props = _objectWithoutProperties(_props, ['onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'className']);
|
1727 |
|
1728 | delete props.dimension;
|
1729 | delete props.getDimensionValue;
|
1730 |
|
1731 | var handleEnter = (0, _tinperBeeCore.createChainedFunction)(this.handleEnter, onEnter);
|
1732 | var handleEntering = (0, _tinperBeeCore.createChainedFunction)(this.handleEntering, onEntering);
|
1733 | var handleEntered = (0, _tinperBeeCore.createChainedFunction)(this.handleEntered, onEntered);
|
1734 | var handleExit = (0, _tinperBeeCore.createChainedFunction)(this.handleExit, onExit);
|
1735 | var handleExiting = (0, _tinperBeeCore.createChainedFunction)(this.handleExiting, onExiting);
|
1736 |
|
1737 | var classes = {
|
1738 | width: this._dimension() === 'width'
|
1739 | };
|
1740 |
|
1741 | return _react2["default"].createElement(_Transition2["default"], _extends({}, props, {
|
1742 | 'aria-expanded': props.role ? props["in"] : null,
|
1743 | className: (0, _classnames2["default"])(className, classes),
|
1744 | exitedClassName: 'collapse',
|
1745 | exitingClassName: 'collapsing',
|
1746 | enteredClassName: 'collapse in',
|
1747 | enteringClassName: 'collapsing',
|
1748 | onEnter: handleEnter,
|
1749 | onEntering: handleEntering,
|
1750 | onEntered: handleEntered,
|
1751 | onExit: handleExit,
|
1752 | onExiting: handleExiting
|
1753 | }));
|
1754 | };
|
1755 |
|
1756 | return Collapse;
|
1757 | }(_react2["default"].Component);
|
1758 |
|
1759 | Collapse.propTypes = propTypes;
|
1760 | Collapse.defaultProps = defaultProps;
|
1761 |
|
1762 | exports["default"] = Collapse;
|
1763 | module.exports = exports['default'];
|
1764 |
|
1765 | }),
|
1766 |
|
1767 | (function(module, exports, __webpack_require__) {
|
1768 |
|
1769 | "use strict";
|
1770 |
|
1771 | var _interopRequireDefault = __webpack_require__(14);
|
1772 |
|
1773 | exports.__esModule = true;
|
1774 | exports.default = style;
|
1775 |
|
1776 | var _camelizeStyle = _interopRequireDefault(__webpack_require__(19));
|
1777 |
|
1778 | var _hyphenateStyle = _interopRequireDefault(__webpack_require__(21));
|
1779 |
|
1780 | var _getComputedStyle2 = _interopRequireDefault(__webpack_require__(23));
|
1781 |
|
1782 | var _removeStyle = _interopRequireDefault(__webpack_require__(24));
|
1783 |
|
1784 | var _properties = __webpack_require__(13);
|
1785 |
|
1786 | var _isTransform = _interopRequireDefault(__webpack_require__(25));
|
1787 |
|
1788 | function style(node, property, value) {
|
1789 | var css = '';
|
1790 | var transforms = '';
|
1791 | var props = property;
|
1792 |
|
1793 | if (typeof property === 'string') {
|
1794 | if (value === undefined) {
|
1795 | return node.style[(0, _camelizeStyle.default)(property)] || (0, _getComputedStyle2.default)(node).getPropertyValue((0, _hyphenateStyle.default)(property));
|
1796 | } else {
|
1797 | (props = {})[property] = value;
|
1798 | }
|
1799 | }
|
1800 |
|
1801 | Object.keys(props).forEach(function (key) {
|
1802 | var value = props[key];
|
1803 |
|
1804 | if (!value && value !== 0) {
|
1805 | (0, _removeStyle.default)(node, (0, _hyphenateStyle.default)(key));
|
1806 | } else if ((0, _isTransform.default)(key)) {
|
1807 | transforms += key + "(" + value + ") ";
|
1808 | } else {
|
1809 | css += (0, _hyphenateStyle.default)(key) + ": " + value + ";";
|
1810 | }
|
1811 | });
|
1812 |
|
1813 | if (transforms) {
|
1814 | css += _properties.transform + ": " + transforms + ";";
|
1815 | }
|
1816 |
|
1817 | node.style.cssText += ';' + css;
|
1818 | }
|
1819 |
|
1820 | module.exports = exports["default"];
|
1821 |
|
1822 | }),
|
1823 |
|
1824 | (function(module, exports, __webpack_require__) {
|
1825 |
|
1826 | "use strict";
|
1827 |
|
1828 | var _interopRequireDefault = __webpack_require__(14);
|
1829 |
|
1830 | exports.__esModule = true;
|
1831 | exports.default = camelizeStyleName;
|
1832 |
|
1833 | var _camelize = _interopRequireDefault(__webpack_require__(20));
|
1834 |
|
1835 | |
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 | var msPattern = /^-ms-/;
|
1841 |
|
1842 | function camelizeStyleName(string) {
|
1843 | return (0, _camelize.default)(string.replace(msPattern, 'ms-'));
|
1844 | }
|
1845 |
|
1846 | module.exports = exports["default"];
|
1847 |
|
1848 | }),
|
1849 |
|
1850 | (function(module, exports) {
|
1851 |
|
1852 | "use strict";
|
1853 |
|
1854 | exports.__esModule = true;
|
1855 | exports.default = camelize;
|
1856 | var rHyphen = /-(.)/g;
|
1857 |
|
1858 | function camelize(string) {
|
1859 | return string.replace(rHyphen, function (_, chr) {
|
1860 | return chr.toUpperCase();
|
1861 | });
|
1862 | }
|
1863 |
|
1864 | module.exports = exports["default"];
|
1865 |
|
1866 | }),
|
1867 |
|
1868 | (function(module, exports, __webpack_require__) {
|
1869 |
|
1870 | "use strict";
|
1871 |
|
1872 | var _interopRequireDefault = __webpack_require__(14);
|
1873 |
|
1874 | exports.__esModule = true;
|
1875 | exports.default = hyphenateStyleName;
|
1876 |
|
1877 | var _hyphenate = _interopRequireDefault(__webpack_require__(22));
|
1878 |
|
1879 | |
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 | var msPattern = /^ms-/;
|
1885 |
|
1886 | function hyphenateStyleName(string) {
|
1887 | return (0, _hyphenate.default)(string).replace(msPattern, '-ms-');
|
1888 | }
|
1889 |
|
1890 | module.exports = exports["default"];
|
1891 |
|
1892 | }),
|
1893 |
|
1894 | (function(module, exports) {
|
1895 |
|
1896 | "use strict";
|
1897 |
|
1898 | exports.__esModule = true;
|
1899 | exports.default = hyphenate;
|
1900 | var rUpper = /([A-Z])/g;
|
1901 |
|
1902 | function hyphenate(string) {
|
1903 | return string.replace(rUpper, '-$1').toLowerCase();
|
1904 | }
|
1905 |
|
1906 | module.exports = exports["default"];
|
1907 |
|
1908 | }),
|
1909 |
|
1910 | (function(module, exports, __webpack_require__) {
|
1911 |
|
1912 | "use strict";
|
1913 |
|
1914 | var _interopRequireDefault = __webpack_require__(14);
|
1915 |
|
1916 | exports.__esModule = true;
|
1917 | exports.default = _getComputedStyle;
|
1918 |
|
1919 | var _camelizeStyle = _interopRequireDefault(__webpack_require__(19));
|
1920 |
|
1921 | var rposition = /^(top|right|bottom|left)$/;
|
1922 | var rnumnonpx = /^([+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/i;
|
1923 |
|
1924 | function _getComputedStyle(node) {
|
1925 | if (!node) throw new TypeError('No Element passed to `getComputedStyle()`');
|
1926 | var doc = node.ownerDocument;
|
1927 | return 'defaultView' in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : {
|
1928 |
|
1929 | getPropertyValue: function getPropertyValue(prop) {
|
1930 | var style = node.style;
|
1931 | prop = (0, _camelizeStyle.default)(prop);
|
1932 | if (prop == 'float') prop = 'styleFloat';
|
1933 | var current = node.currentStyle[prop] || null;
|
1934 | if (current == null && style && style[prop]) current = style[prop];
|
1935 |
|
1936 | if (rnumnonpx.test(current) && !rposition.test(prop)) {
|
1937 |
|
1938 | var left = style.left;
|
1939 | var runStyle = node.runtimeStyle;
|
1940 | var rsLeft = runStyle && runStyle.left;
|
1941 |
|
1942 | if (rsLeft) runStyle.left = node.currentStyle.left;
|
1943 | style.left = prop === 'fontSize' ? '1em' : current;
|
1944 | current = style.pixelLeft + 'px';
|
1945 |
|
1946 | style.left = left;
|
1947 | if (rsLeft) runStyle.left = rsLeft;
|
1948 | }
|
1949 |
|
1950 | return current;
|
1951 | }
|
1952 | };
|
1953 | }
|
1954 |
|
1955 | module.exports = exports["default"];
|
1956 |
|
1957 | }),
|
1958 |
|
1959 | (function(module, exports) {
|
1960 |
|
1961 | "use strict";
|
1962 |
|
1963 | exports.__esModule = true;
|
1964 | exports.default = removeStyle;
|
1965 |
|
1966 | function removeStyle(node, key) {
|
1967 | return 'removeProperty' in node.style ? node.style.removeProperty(key) : node.style.removeAttribute(key);
|
1968 | }
|
1969 |
|
1970 | module.exports = exports["default"];
|
1971 |
|
1972 | }),
|
1973 |
|
1974 | (function(module, exports) {
|
1975 |
|
1976 | "use strict";
|
1977 |
|
1978 | exports.__esModule = true;
|
1979 | exports.default = isTransform;
|
1980 | var supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;
|
1981 |
|
1982 | function isTransform(property) {
|
1983 | return !!(property && supportedTransforms.test(property));
|
1984 | }
|
1985 |
|
1986 | module.exports = exports["default"];
|
1987 |
|
1988 | }),
|
1989 |
|
1990 | (function(module, exports) {
|
1991 |
|
1992 | "use strict";
|
1993 |
|
1994 | Object.defineProperty(exports, "__esModule", {
|
1995 | value: true
|
1996 | });
|
1997 | exports["default"] = capitalize;
|
1998 | function capitalize(string) {
|
1999 | return "" + string.charAt(0).toUpperCase() + string.slice(1);
|
2000 | }
|
2001 | module.exports = exports["default"];
|
2002 |
|
2003 | }),
|
2004 |
|
2005 | (function(module, exports, __webpack_require__) {
|
2006 |
|
2007 | 'use strict';
|
2008 |
|
2009 | exports.__esModule = true;
|
2010 | 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;
|
2011 |
|
2012 | var _all2 = __webpack_require__(28);
|
2013 |
|
2014 | var _all3 = _interopRequireDefault(_all2);
|
2015 |
|
2016 | var _componentOrElement2 = __webpack_require__(30);
|
2017 |
|
2018 | var _componentOrElement3 = _interopRequireDefault(_componentOrElement2);
|
2019 |
|
2020 | var _deprecated2 = __webpack_require__(31);
|
2021 |
|
2022 | var _deprecated3 = _interopRequireDefault(_deprecated2);
|
2023 |
|
2024 | var _elementType2 = __webpack_require__(34);
|
2025 |
|
2026 | var _elementType3 = _interopRequireDefault(_elementType2);
|
2027 |
|
2028 | var _isRequiredForA11y2 = __webpack_require__(35);
|
2029 |
|
2030 | var _isRequiredForA11y3 = _interopRequireDefault(_isRequiredForA11y2);
|
2031 |
|
2032 | var _splitComponent2 = __webpack_require__(36);
|
2033 |
|
2034 | var _splitComponent3 = _interopRequireDefault(_splitComponent2);
|
2035 |
|
2036 | var _createChainedFunction2 = __webpack_require__(37);
|
2037 |
|
2038 | var _createChainedFunction3 = _interopRequireDefault(_createChainedFunction2);
|
2039 |
|
2040 | var _keyCode = __webpack_require__(38);
|
2041 |
|
2042 | var _keyCode2 = _interopRequireDefault(_keyCode);
|
2043 |
|
2044 | var _contains2 = __webpack_require__(39);
|
2045 |
|
2046 | var _contains3 = _interopRequireDefault(_contains2);
|
2047 |
|
2048 | var _addEventListener2 = __webpack_require__(40);
|
2049 |
|
2050 | var _addEventListener3 = _interopRequireDefault(_addEventListener2);
|
2051 |
|
2052 | var _cssAnimation2 = __webpack_require__(45);
|
2053 |
|
2054 | var _cssAnimation3 = _interopRequireDefault(_cssAnimation2);
|
2055 |
|
2056 | var _toArray2 = __webpack_require__(49);
|
2057 |
|
2058 | var _toArray3 = _interopRequireDefault(_toArray2);
|
2059 |
|
2060 | var _Align2 = __webpack_require__(50);
|
2061 |
|
2062 | var _Align3 = _interopRequireDefault(_Align2);
|
2063 |
|
2064 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2065 |
|
2066 | exports.all = _all3.default;
|
2067 | exports.componentOrElement = _componentOrElement3.default;
|
2068 | exports.deprecated = _deprecated3.default;
|
2069 | exports.elementType = _elementType3.default;
|
2070 | exports.isRequiredForA11y = _isRequiredForA11y3.default;
|
2071 | exports.splitComponent = _splitComponent3.default;
|
2072 | exports.createChainedFunction = _createChainedFunction3.default;
|
2073 | exports.KeyCode = _keyCode2.default;
|
2074 | exports.contains = _contains3.default;
|
2075 | exports.addEventListener = _addEventListener3.default;
|
2076 | exports.cssAnimation = _cssAnimation3.default;
|
2077 | exports.toArray = _toArray3.default;
|
2078 |
|
2079 |
|
2080 | exports.Align = _Align3.default;
|
2081 |
|
2082 | }),
|
2083 |
|
2084 | (function(module, exports, __webpack_require__) {
|
2085 |
|
2086 | 'use strict';
|
2087 |
|
2088 | exports.__esModule = true;
|
2089 | exports.default = all;
|
2090 |
|
2091 | var _createChainableTypeChecker = __webpack_require__(29);
|
2092 |
|
2093 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2094 |
|
2095 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2096 |
|
2097 | function all() {
|
2098 | for (var _len = arguments.length, validators = Array(_len), _key = 0; _key < _len; _key++) {
|
2099 | validators[_key] = arguments[_key];
|
2100 | }
|
2101 |
|
2102 | function allPropTypes() {
|
2103 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2104 | args[_key2] = arguments[_key2];
|
2105 | }
|
2106 |
|
2107 | var error = null;
|
2108 |
|
2109 | validators.forEach(function (validator) {
|
2110 | if (error != null) {
|
2111 | return;
|
2112 | }
|
2113 |
|
2114 | var result = validator.apply(undefined, args);
|
2115 | if (result != null) {
|
2116 | error = result;
|
2117 | }
|
2118 | });
|
2119 |
|
2120 | return error;
|
2121 | }
|
2122 |
|
2123 | return (0, _createChainableTypeChecker2.default)(allPropTypes);
|
2124 | } |
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 | }),
|
2130 |
|
2131 | (function(module, exports) {
|
2132 |
|
2133 | 'use strict';
|
2134 |
|
2135 | exports.__esModule = true;
|
2136 | exports.default = createChainableTypeChecker;
|
2137 | |
2138 |
|
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 |
|
2146 |
|
2147 |
|
2148 | |
2149 |
|
2150 |
|
2151 |
|
2152 | function createChainableTypeChecker(validate) {
|
2153 | function checkType(isRequired, props, propName, componentName, location, propFullName) {
|
2154 | var componentNameSafe = componentName || '<<anonymous>>';
|
2155 | var propFullNameSafe = propFullName || propName;
|
2156 |
|
2157 | if (props[propName] == null) {
|
2158 | if (isRequired) {
|
2159 | return new Error('Required ' + location + ' `' + propFullNameSafe + '` was not specified ' + ('in `' + componentNameSafe + '`.'));
|
2160 | }
|
2161 |
|
2162 | return null;
|
2163 | }
|
2164 |
|
2165 | for (var _len = arguments.length, args = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) {
|
2166 | args[_key - 6] = arguments[_key];
|
2167 | }
|
2168 |
|
2169 | return validate.apply(undefined, [props, propName, componentNameSafe, location, propFullNameSafe].concat(args));
|
2170 | }
|
2171 |
|
2172 | var chainedCheckType = checkType.bind(null, false);
|
2173 | chainedCheckType.isRequired = checkType.bind(null, true);
|
2174 |
|
2175 | return chainedCheckType;
|
2176 | }
|
2177 |
|
2178 | }),
|
2179 |
|
2180 | (function(module, exports, __webpack_require__) {
|
2181 |
|
2182 | 'use strict';
|
2183 |
|
2184 | exports.__esModule = true;
|
2185 |
|
2186 | 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; }; |
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 | var _react = __webpack_require__(4);
|
2193 |
|
2194 | var _react2 = _interopRequireDefault(_react);
|
2195 |
|
2196 | var _createChainableTypeChecker = __webpack_require__(29);
|
2197 |
|
2198 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2199 |
|
2200 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2201 |
|
2202 | function validate(props, propName, componentName, location, propFullName) {
|
2203 | var propValue = props[propName];
|
2204 | var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
|
2205 |
|
2206 | if (_react2.default.isValidElement(propValue)) {
|
2207 | 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.');
|
2208 | }
|
2209 |
|
2210 | if ((propType !== 'object' || typeof propValue.render !== 'function') && propValue.nodeType !== 1) {
|
2211 | return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected a ReactComponent or a ') + 'DOMElement.');
|
2212 | }
|
2213 |
|
2214 | return null;
|
2215 | }
|
2216 |
|
2217 | exports.default = (0, _createChainableTypeChecker2.default)(validate);
|
2218 |
|
2219 | }),
|
2220 |
|
2221 | (function(module, exports, __webpack_require__) {
|
2222 |
|
2223 | 'use strict';
|
2224 |
|
2225 | exports.__esModule = true;
|
2226 | exports.default = deprecated;
|
2227 |
|
2228 | var _warning = __webpack_require__(32);
|
2229 |
|
2230 | var _warning2 = _interopRequireDefault(_warning);
|
2231 |
|
2232 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2233 |
|
2234 | var warned = {}; |
2235 |
|
2236 |
|
2237 |
|
2238 | function deprecated(validator, reason) {
|
2239 | return function validate(props, propName, componentName, location, propFullName) {
|
2240 | var componentNameSafe = componentName || '<<anonymous>>';
|
2241 | var propFullNameSafe = propFullName || propName;
|
2242 |
|
2243 | if (props[propName] != null) {
|
2244 | var messageKey = componentName + '.' + propName;
|
2245 |
|
2246 | (0, _warning2.default)(warned[messageKey], 'The ' + location + ' `' + propFullNameSafe + '` of ' + ('`' + componentNameSafe + '` is deprecated. ' + reason + '.'));
|
2247 |
|
2248 | warned[messageKey] = true;
|
2249 | }
|
2250 |
|
2251 | for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
2252 | args[_key - 5] = arguments[_key];
|
2253 | }
|
2254 |
|
2255 | return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
|
2256 | };
|
2257 | }
|
2258 |
|
2259 |
|
2260 | function _resetWarned() {
|
2261 | warned = {};
|
2262 | }
|
2263 |
|
2264 | deprecated._resetWarned = _resetWarned;
|
2265 |
|
2266 |
|
2267 | }),
|
2268 |
|
2269 | (function(module, exports, __webpack_require__) {
|
2270 |
|
2271 | (function(process) { |
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 |
|
2280 | 'use strict';
|
2281 |
|
2282 | |
2283 |
|
2284 |
|
2285 |
|
2286 |
|
2287 |
|
2288 |
|
2289 | var warning = function() {};
|
2290 |
|
2291 | if (process.env.NODE_ENV !== 'production') {
|
2292 | warning = function(condition, format, args) {
|
2293 | var len = arguments.length;
|
2294 | args = new Array(len > 2 ? len - 2 : 0);
|
2295 | for (var key = 2; key < len; key++) {
|
2296 | args[key - 2] = arguments[key];
|
2297 | }
|
2298 | if (format === undefined) {
|
2299 | throw new Error(
|
2300 | '`warning(condition, format, ...args)` requires a warning ' +
|
2301 | 'message argument'
|
2302 | );
|
2303 | }
|
2304 |
|
2305 | if (format.length < 10 || (/^[s\W]*$/).test(format)) {
|
2306 | throw new Error(
|
2307 | 'The warning format should be able to uniquely identify this ' +
|
2308 | 'warning. Please, use a more descriptive format than: ' + format
|
2309 | );
|
2310 | }
|
2311 |
|
2312 | if (!condition) {
|
2313 | var argIndex = 0;
|
2314 | var message = 'Warning: ' +
|
2315 | format.replace(/%s/g, function() {
|
2316 | return args[argIndex++];
|
2317 | });
|
2318 | if (typeof console !== 'undefined') {
|
2319 | console.error(message);
|
2320 | }
|
2321 | try {
|
2322 |
|
2323 |
|
2324 | throw new Error(message);
|
2325 | } catch(x) {}
|
2326 | }
|
2327 | };
|
2328 | }
|
2329 |
|
2330 | module.exports = warning;
|
2331 |
|
2332 | }.call(exports, __webpack_require__(33)))
|
2333 |
|
2334 | }),
|
2335 |
|
2336 | (function(module, exports) {
|
2337 |
|
2338 |
|
2339 | var process = module.exports = {};
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 |
|
2346 | var cachedSetTimeout;
|
2347 | var cachedClearTimeout;
|
2348 |
|
2349 | function defaultSetTimout() {
|
2350 | throw new Error('setTimeout has not been defined');
|
2351 | }
|
2352 | function defaultClearTimeout () {
|
2353 | throw new Error('clearTimeout has not been defined');
|
2354 | }
|
2355 | (function () {
|
2356 | try {
|
2357 | if (typeof setTimeout === 'function') {
|
2358 | cachedSetTimeout = setTimeout;
|
2359 | } else {
|
2360 | cachedSetTimeout = defaultSetTimout;
|
2361 | }
|
2362 | } catch (e) {
|
2363 | cachedSetTimeout = defaultSetTimout;
|
2364 | }
|
2365 | try {
|
2366 | if (typeof clearTimeout === 'function') {
|
2367 | cachedClearTimeout = clearTimeout;
|
2368 | } else {
|
2369 | cachedClearTimeout = defaultClearTimeout;
|
2370 | }
|
2371 | } catch (e) {
|
2372 | cachedClearTimeout = defaultClearTimeout;
|
2373 | }
|
2374 | } ())
|
2375 | function runTimeout(fun) {
|
2376 | if (cachedSetTimeout === setTimeout) {
|
2377 |
|
2378 | return setTimeout(fun, 0);
|
2379 | }
|
2380 |
|
2381 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
2382 | cachedSetTimeout = setTimeout;
|
2383 | return setTimeout(fun, 0);
|
2384 | }
|
2385 | try {
|
2386 |
|
2387 | return cachedSetTimeout(fun, 0);
|
2388 | } catch(e){
|
2389 | try {
|
2390 |
|
2391 | return cachedSetTimeout.call(null, fun, 0);
|
2392 | } catch(e){
|
2393 |
|
2394 | return cachedSetTimeout.call(this, fun, 0);
|
2395 | }
|
2396 | }
|
2397 |
|
2398 |
|
2399 | }
|
2400 | function runClearTimeout(marker) {
|
2401 | if (cachedClearTimeout === clearTimeout) {
|
2402 |
|
2403 | return clearTimeout(marker);
|
2404 | }
|
2405 |
|
2406 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
2407 | cachedClearTimeout = clearTimeout;
|
2408 | return clearTimeout(marker);
|
2409 | }
|
2410 | try {
|
2411 |
|
2412 | return cachedClearTimeout(marker);
|
2413 | } catch (e){
|
2414 | try {
|
2415 |
|
2416 | return cachedClearTimeout.call(null, marker);
|
2417 | } catch (e){
|
2418 |
|
2419 |
|
2420 | return cachedClearTimeout.call(this, marker);
|
2421 | }
|
2422 | }
|
2423 |
|
2424 |
|
2425 |
|
2426 | }
|
2427 | var queue = [];
|
2428 | var draining = false;
|
2429 | var currentQueue;
|
2430 | var queueIndex = -1;
|
2431 |
|
2432 | function cleanUpNextTick() {
|
2433 | if (!draining || !currentQueue) {
|
2434 | return;
|
2435 | }
|
2436 | draining = false;
|
2437 | if (currentQueue.length) {
|
2438 | queue = currentQueue.concat(queue);
|
2439 | } else {
|
2440 | queueIndex = -1;
|
2441 | }
|
2442 | if (queue.length) {
|
2443 | drainQueue();
|
2444 | }
|
2445 | }
|
2446 |
|
2447 | function drainQueue() {
|
2448 | if (draining) {
|
2449 | return;
|
2450 | }
|
2451 | var timeout = runTimeout(cleanUpNextTick);
|
2452 | draining = true;
|
2453 |
|
2454 | var len = queue.length;
|
2455 | while(len) {
|
2456 | currentQueue = queue;
|
2457 | queue = [];
|
2458 | while (++queueIndex < len) {
|
2459 | if (currentQueue) {
|
2460 | currentQueue[queueIndex].run();
|
2461 | }
|
2462 | }
|
2463 | queueIndex = -1;
|
2464 | len = queue.length;
|
2465 | }
|
2466 | currentQueue = null;
|
2467 | draining = false;
|
2468 | runClearTimeout(timeout);
|
2469 | }
|
2470 |
|
2471 | process.nextTick = function (fun) {
|
2472 | var args = new Array(arguments.length - 1);
|
2473 | if (arguments.length > 1) {
|
2474 | for (var i = 1; i < arguments.length; i++) {
|
2475 | args[i - 1] = arguments[i];
|
2476 | }
|
2477 | }
|
2478 | queue.push(new Item(fun, args));
|
2479 | if (queue.length === 1 && !draining) {
|
2480 | runTimeout(drainQueue);
|
2481 | }
|
2482 | };
|
2483 |
|
2484 |
|
2485 | function Item(fun, array) {
|
2486 | this.fun = fun;
|
2487 | this.array = array;
|
2488 | }
|
2489 | Item.prototype.run = function () {
|
2490 | this.fun.apply(null, this.array);
|
2491 | };
|
2492 | process.title = 'browser';
|
2493 | process.browser = true;
|
2494 | process.env = {};
|
2495 | process.argv = [];
|
2496 | process.version = '';
|
2497 | process.versions = {};
|
2498 |
|
2499 | function noop() {}
|
2500 |
|
2501 | process.on = noop;
|
2502 | process.addListener = noop;
|
2503 | process.once = noop;
|
2504 | process.off = noop;
|
2505 | process.removeListener = noop;
|
2506 | process.removeAllListeners = noop;
|
2507 | process.emit = noop;
|
2508 | process.prependListener = noop;
|
2509 | process.prependOnceListener = noop;
|
2510 |
|
2511 | process.listeners = function (name) { return [] }
|
2512 |
|
2513 | process.binding = function (name) {
|
2514 | throw new Error('process.binding is not supported');
|
2515 | };
|
2516 |
|
2517 | process.cwd = function () { return '/' };
|
2518 | process.chdir = function (dir) {
|
2519 | throw new Error('process.chdir is not supported');
|
2520 | };
|
2521 | process.umask = function() { return 0; };
|
2522 |
|
2523 |
|
2524 | }),
|
2525 |
|
2526 | (function(module, exports, __webpack_require__) {
|
2527 |
|
2528 | 'use strict';
|
2529 |
|
2530 | exports.__esModule = true;
|
2531 |
|
2532 | 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; }; |
2533 |
|
2534 |
|
2535 |
|
2536 |
|
2537 |
|
2538 | var _react = __webpack_require__(4);
|
2539 |
|
2540 | var _react2 = _interopRequireDefault(_react);
|
2541 |
|
2542 | var _createChainableTypeChecker = __webpack_require__(29);
|
2543 |
|
2544 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2545 |
|
2546 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2547 |
|
2548 | function elementType(props, propName, componentName, location, propFullName) {
|
2549 | var propValue = props[propName];
|
2550 | var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
|
2551 |
|
2552 | if (_react2.default.isValidElement(propValue)) {
|
2553 | return new Error('Invalid ' + location + ' `' + propFullName + '` of type ReactElement ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
|
2554 | }
|
2555 |
|
2556 | if (propType !== 'function' && propType !== 'string') {
|
2557 | return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
|
2558 | }
|
2559 |
|
2560 | return null;
|
2561 | }
|
2562 |
|
2563 | exports.default = (0, _createChainableTypeChecker2.default)(elementType);
|
2564 |
|
2565 | }),
|
2566 |
|
2567 | (function(module, exports) {
|
2568 |
|
2569 | 'use strict';
|
2570 |
|
2571 | exports.__esModule = true;
|
2572 | exports.default = isRequiredForA11y;
|
2573 | |
2574 |
|
2575 |
|
2576 |
|
2577 | function isRequiredForA11y(validator) {
|
2578 | return function validate(props, propName, componentName, location, propFullName) {
|
2579 | var componentNameSafe = componentName || '<<anonymous>>';
|
2580 | var propFullNameSafe = propFullName || propName;
|
2581 |
|
2582 | if (props[propName] == null) {
|
2583 | return new Error('The ' + location + ' `' + propFullNameSafe + '` is required to make ' + ('`' + componentNameSafe + '` accessible for users of assistive ') + 'technologies such as screen readers.');
|
2584 | }
|
2585 |
|
2586 | for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
2587 | args[_key - 5] = arguments[_key];
|
2588 | }
|
2589 |
|
2590 | return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
|
2591 | };
|
2592 | }
|
2593 |
|
2594 | }),
|
2595 |
|
2596 | (function(module, exports) {
|
2597 |
|
2598 | "use strict";
|
2599 |
|
2600 | exports.__esModule = true;
|
2601 | exports.default = splitComponentProps;
|
2602 | |
2603 |
|
2604 |
|
2605 |
|
2606 | function _objectEntries(obj) {
|
2607 | var entries = [];
|
2608 | var keys = Object.keys(obj);
|
2609 |
|
2610 | for (var k = 0; k < keys.length; ++k) {
|
2611 | entries.push([keys[k], obj[keys[k]]]);
|
2612 | }return entries;
|
2613 | }
|
2614 |
|
2615 | |
2616 |
|
2617 |
|
2618 |
|
2619 |
|
2620 |
|
2621 | function splitComponentProps(props, Component) {
|
2622 | var componentPropTypes = Component.propTypes;
|
2623 |
|
2624 | var parentProps = {};
|
2625 | var childProps = {};
|
2626 |
|
2627 | _objectEntries(props).forEach(function (_ref) {
|
2628 | var propName = _ref[0],
|
2629 | propValue = _ref[1];
|
2630 |
|
2631 | if (componentPropTypes[propName]) {
|
2632 | parentProps[propName] = propValue;
|
2633 | } else {
|
2634 | childProps[propName] = propValue;
|
2635 | }
|
2636 | });
|
2637 |
|
2638 | return [parentProps, childProps];
|
2639 | }
|
2640 |
|
2641 | }),
|
2642 |
|
2643 | (function(module, exports) {
|
2644 |
|
2645 | 'use strict';
|
2646 |
|
2647 | exports.__esModule = true;
|
2648 | |
2649 |
|
2650 |
|
2651 |
|
2652 | function createChainedFunction() {
|
2653 | for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
|
2654 | funcs[_key] = arguments[_key];
|
2655 | }
|
2656 |
|
2657 | return funcs.filter(function (f) {
|
2658 | return f != null;
|
2659 | }).reduce(function (acc, f) {
|
2660 | if (typeof f !== 'function') {
|
2661 | throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
|
2662 | }
|
2663 |
|
2664 | if (acc === null) {
|
2665 | return f;
|
2666 | }
|
2667 |
|
2668 | return function chainedFunction() {
|
2669 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2670 | args[_key2] = arguments[_key2];
|
2671 | }
|
2672 |
|
2673 | acc.apply(this, args);
|
2674 | f.apply(this, args);
|
2675 | };
|
2676 | }, null);
|
2677 | }
|
2678 | exports.default = createChainedFunction;
|
2679 |
|
2680 | }),
|
2681 |
|
2682 | (function(module, exports) {
|
2683 |
|
2684 | |
2685 |
|
2686 |
|
2687 |
|
2688 | 'use strict';
|
2689 |
|
2690 | |
2691 |
|
2692 |
|
2693 |
|
2694 |
|
2695 |
|
2696 | var KeyCode = {
|
2697 | |
2698 |
|
2699 |
|
2700 | MAC_ENTER: 3,
|
2701 | |
2702 |
|
2703 |
|
2704 | BACKSPACE: 8,
|
2705 | |
2706 |
|
2707 |
|
2708 | TAB: 9,
|
2709 | |
2710 |
|
2711 |
|
2712 | NUM_CENTER: 12,
|
2713 | |
2714 |
|
2715 |
|
2716 | ENTER: 13,
|
2717 | |
2718 |
|
2719 |
|
2720 | SHIFT: 16,
|
2721 | |
2722 |
|
2723 |
|
2724 | CTRL: 17,
|
2725 | |
2726 |
|
2727 |
|
2728 | ALT: 18,
|
2729 | |
2730 |
|
2731 |
|
2732 | PAUSE: 19,
|
2733 | |
2734 |
|
2735 |
|
2736 | CAPS_LOCK: 20,
|
2737 | |
2738 |
|
2739 |
|
2740 | ESC: 27,
|
2741 | |
2742 |
|
2743 |
|
2744 | SPACE: 32,
|
2745 | |
2746 |
|
2747 |
|
2748 | PAGE_UP: 33,
|
2749 | |
2750 |
|
2751 |
|
2752 | PAGE_DOWN: 34,
|
2753 | |
2754 |
|
2755 |
|
2756 | END: 35,
|
2757 | |
2758 |
|
2759 |
|
2760 | HOME: 36,
|
2761 | |
2762 |
|
2763 |
|
2764 | LEFT: 37,
|
2765 | |
2766 |
|
2767 |
|
2768 | UP: 38,
|
2769 | |
2770 |
|
2771 |
|
2772 | RIGHT: 39,
|
2773 | |
2774 |
|
2775 |
|
2776 | DOWN: 40,
|
2777 | |
2778 |
|
2779 |
|
2780 | PRINT_SCREEN: 44,
|
2781 | |
2782 |
|
2783 |
|
2784 | INSERT: 45,
|
2785 | |
2786 |
|
2787 |
|
2788 | DELETE: 46,
|
2789 | |
2790 |
|
2791 |
|
2792 | ZERO: 48,
|
2793 | |
2794 |
|
2795 |
|
2796 | ONE: 49,
|
2797 | |
2798 |
|
2799 |
|
2800 | TWO: 50,
|
2801 | |
2802 |
|
2803 |
|
2804 | THREE: 51,
|
2805 | |
2806 |
|
2807 |
|
2808 | FOUR: 52,
|
2809 | |
2810 |
|
2811 |
|
2812 | FIVE: 53,
|
2813 | |
2814 |
|
2815 |
|
2816 | SIX: 54,
|
2817 | |
2818 |
|
2819 |
|
2820 | SEVEN: 55,
|
2821 | |
2822 |
|
2823 |
|
2824 | EIGHT: 56,
|
2825 | |
2826 |
|
2827 |
|
2828 | NINE: 57,
|
2829 | |
2830 |
|
2831 |
|
2832 | QUESTION_MARK: 63,
|
2833 | |
2834 |
|
2835 |
|
2836 | A: 65,
|
2837 | |
2838 |
|
2839 |
|
2840 | B: 66,
|
2841 | |
2842 |
|
2843 |
|
2844 | C: 67,
|
2845 | |
2846 |
|
2847 |
|
2848 | D: 68,
|
2849 | |
2850 |
|
2851 |
|
2852 | E: 69,
|
2853 | |
2854 |
|
2855 |
|
2856 | F: 70,
|
2857 | |
2858 |
|
2859 |
|
2860 | G: 71,
|
2861 | |
2862 |
|
2863 |
|
2864 | H: 72,
|
2865 | |
2866 |
|
2867 |
|
2868 | I: 73,
|
2869 | |
2870 |
|
2871 |
|
2872 | J: 74,
|
2873 | |
2874 |
|
2875 |
|
2876 | K: 75,
|
2877 | |
2878 |
|
2879 |
|
2880 | L: 76,
|
2881 | |
2882 |
|
2883 |
|
2884 | M: 77,
|
2885 | |
2886 |
|
2887 |
|
2888 | N: 78,
|
2889 | |
2890 |
|
2891 |
|
2892 | O: 79,
|
2893 | |
2894 |
|
2895 |
|
2896 | P: 80,
|
2897 | |
2898 |
|
2899 |
|
2900 | Q: 81,
|
2901 | |
2902 |
|
2903 |
|
2904 | R: 82,
|
2905 | |
2906 |
|
2907 |
|
2908 | S: 83,
|
2909 | |
2910 |
|
2911 |
|
2912 | T: 84,
|
2913 | |
2914 |
|
2915 |
|
2916 | U: 85,
|
2917 | |
2918 |
|
2919 |
|
2920 | V: 86,
|
2921 | |
2922 |
|
2923 |
|
2924 | W: 87,
|
2925 | |
2926 |
|
2927 |
|
2928 | X: 88,
|
2929 | |
2930 |
|
2931 |
|
2932 | Y: 89,
|
2933 | |
2934 |
|
2935 |
|
2936 | Z: 90,
|
2937 | |
2938 |
|
2939 |
|
2940 | META: 91,
|
2941 | |
2942 |
|
2943 |
|
2944 | WIN_KEY_RIGHT: 92,
|
2945 | |
2946 |
|
2947 |
|
2948 | CONTEXT_MENU: 93,
|
2949 | |
2950 |
|
2951 |
|
2952 | NUM_ZERO: 96,
|
2953 | |
2954 |
|
2955 |
|
2956 | NUM_ONE: 97,
|
2957 | |
2958 |
|
2959 |
|
2960 | NUM_TWO: 98,
|
2961 | |
2962 |
|
2963 |
|
2964 | NUM_THREE: 99,
|
2965 | |
2966 |
|
2967 |
|
2968 | NUM_FOUR: 100,
|
2969 | |
2970 |
|
2971 |
|
2972 | NUM_FIVE: 101,
|
2973 | |
2974 |
|
2975 |
|
2976 | NUM_SIX: 102,
|
2977 | |
2978 |
|
2979 |
|
2980 | NUM_SEVEN: 103,
|
2981 | |
2982 |
|
2983 |
|
2984 | NUM_EIGHT: 104,
|
2985 | |
2986 |
|
2987 |
|
2988 | NUM_NINE: 105,
|
2989 | |
2990 |
|
2991 |
|
2992 | NUM_MULTIPLY: 106,
|
2993 | |
2994 |
|
2995 |
|
2996 | NUM_PLUS: 107,
|
2997 | |
2998 |
|
2999 |
|
3000 | NUM_MINUS: 109,
|
3001 | |
3002 |
|
3003 |
|
3004 | NUM_PERIOD: 110,
|
3005 | |
3006 |
|
3007 |
|
3008 | NUM_DIVISION: 111,
|
3009 | |
3010 |
|
3011 |
|
3012 | F1: 112,
|
3013 | |
3014 |
|
3015 |
|
3016 | F2: 113,
|
3017 | |
3018 |
|
3019 |
|
3020 | F3: 114,
|
3021 | |
3022 |
|
3023 |
|
3024 | F4: 115,
|
3025 | |
3026 |
|
3027 |
|
3028 | F5: 116,
|
3029 | |
3030 |
|
3031 |
|
3032 | F6: 117,
|
3033 | |
3034 |
|
3035 |
|
3036 | F7: 118,
|
3037 | |
3038 |
|
3039 |
|
3040 | F8: 119,
|
3041 | |
3042 |
|
3043 |
|
3044 | F9: 120,
|
3045 | |
3046 |
|
3047 |
|
3048 | F10: 121,
|
3049 | |
3050 |
|
3051 |
|
3052 | F11: 122,
|
3053 | |
3054 |
|
3055 |
|
3056 | F12: 123,
|
3057 | |
3058 |
|
3059 |
|
3060 | NUMLOCK: 144,
|
3061 | |
3062 |
|
3063 |
|
3064 | SEMICOLON: 186,
|
3065 | |
3066 |
|
3067 |
|
3068 | DASH: 189,
|
3069 | |
3070 |
|
3071 |
|
3072 | EQUALS: 187,
|
3073 | |
3074 |
|
3075 |
|
3076 | COMMA: 188,
|
3077 | |
3078 |
|
3079 |
|
3080 | PERIOD: 190,
|
3081 | |
3082 |
|
3083 |
|
3084 | SLASH: 191,
|
3085 | |
3086 |
|
3087 |
|
3088 | APOSTROPHE: 192,
|
3089 | |
3090 |
|
3091 |
|
3092 | SINGLE_QUOTE: 222,
|
3093 | |
3094 |
|
3095 |
|
3096 | OPEN_SQUARE_BRACKET: 219,
|
3097 | |
3098 |
|
3099 |
|
3100 | BACKSLASH: 220,
|
3101 | |
3102 |
|
3103 |
|
3104 | CLOSE_SQUARE_BRACKET: 221,
|
3105 | |
3106 |
|
3107 |
|
3108 | WIN_KEY: 224,
|
3109 | |
3110 |
|
3111 |
|
3112 | MAC_FF_META: 224,
|
3113 | |
3114 |
|
3115 |
|
3116 | WIN_IME: 229
|
3117 | };
|
3118 |
|
3119 | |
3120 |
|
3121 |
|
3122 | KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) {
|
3123 | var keyCode = e.keyCode;
|
3124 | if (e.altKey && !e.ctrlKey || e.metaKey ||
|
3125 |
|
3126 | keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
|
3127 | return false;
|
3128 | }
|
3129 |
|
3130 |
|
3131 |
|
3132 | switch (keyCode) {
|
3133 | case KeyCode.ALT:
|
3134 | case KeyCode.CAPS_LOCK:
|
3135 | case KeyCode.CONTEXT_MENU:
|
3136 | case KeyCode.CTRL:
|
3137 | case KeyCode.DOWN:
|
3138 | case KeyCode.END:
|
3139 | case KeyCode.ESC:
|
3140 | case KeyCode.HOME:
|
3141 | case KeyCode.INSERT:
|
3142 | case KeyCode.LEFT:
|
3143 | case KeyCode.MAC_FF_META:
|
3144 | case KeyCode.META:
|
3145 | case KeyCode.NUMLOCK:
|
3146 | case KeyCode.NUM_CENTER:
|
3147 | case KeyCode.PAGE_DOWN:
|
3148 | case KeyCode.PAGE_UP:
|
3149 | case KeyCode.PAUSE:
|
3150 | case KeyCode.PRINT_SCREEN:
|
3151 | case KeyCode.RIGHT:
|
3152 | case KeyCode.SHIFT:
|
3153 | case KeyCode.UP:
|
3154 | case KeyCode.WIN_KEY:
|
3155 | case KeyCode.WIN_KEY_RIGHT:
|
3156 | return false;
|
3157 | default:
|
3158 | return true;
|
3159 | }
|
3160 | };
|
3161 |
|
3162 | |
3163 |
|
3164 |
|
3165 | KeyCode.isCharacterKey = function isCharacterKey(keyCode) {
|
3166 | if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
|
3167 | return true;
|
3168 | }
|
3169 |
|
3170 | if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
|
3171 | return true;
|
3172 | }
|
3173 |
|
3174 | if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
|
3175 | return true;
|
3176 | }
|
3177 |
|
3178 |
|
3179 | if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {
|
3180 | return true;
|
3181 | }
|
3182 |
|
3183 | switch (keyCode) {
|
3184 | case KeyCode.SPACE:
|
3185 | case KeyCode.QUESTION_MARK:
|
3186 | case KeyCode.NUM_PLUS:
|
3187 | case KeyCode.NUM_MINUS:
|
3188 | case KeyCode.NUM_PERIOD:
|
3189 | case KeyCode.NUM_DIVISION:
|
3190 | case KeyCode.SEMICOLON:
|
3191 | case KeyCode.DASH:
|
3192 | case KeyCode.EQUALS:
|
3193 | case KeyCode.COMMA:
|
3194 | case KeyCode.PERIOD:
|
3195 | case KeyCode.SLASH:
|
3196 | case KeyCode.APOSTROPHE:
|
3197 | case KeyCode.SINGLE_QUOTE:
|
3198 | case KeyCode.OPEN_SQUARE_BRACKET:
|
3199 | case KeyCode.BACKSLASH:
|
3200 | case KeyCode.CLOSE_SQUARE_BRACKET:
|
3201 | return true;
|
3202 | default:
|
3203 | return false;
|
3204 | }
|
3205 | };
|
3206 |
|
3207 | module.exports = KeyCode;
|
3208 |
|
3209 | }),
|
3210 |
|
3211 | (function(module, exports) {
|
3212 |
|
3213 | "use strict";
|
3214 |
|
3215 | exports.__esModule = true;
|
3216 | exports.default = contains;
|
3217 | |
3218 |
|
3219 |
|
3220 |
|
3221 | function contains(root, n) {
|
3222 | var node = n;
|
3223 | while (node) {
|
3224 | if (node === root) {
|
3225 | return true;
|
3226 | }
|
3227 | node = node.parentNode;
|
3228 | }
|
3229 |
|
3230 | return false;
|
3231 | }
|
3232 |
|
3233 | }),
|
3234 |
|
3235 | (function(module, exports, __webpack_require__) {
|
3236 |
|
3237 | 'use strict';
|
3238 |
|
3239 | exports.__esModule = true;
|
3240 | exports.default = addEventListenerWrap;
|
3241 |
|
3242 | var _addDomEventListener = __webpack_require__(41);
|
3243 |
|
3244 | var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener);
|
3245 |
|
3246 | var _reactDom = __webpack_require__(12);
|
3247 |
|
3248 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
3249 |
|
3250 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3251 |
|
3252 | |
3253 |
|
3254 |
|
3255 |
|
3256 | function addEventListenerWrap(target, eventType, cb) {
|
3257 |
|
3258 | var callback = _reactDom2.default.unstable_batchedUpdates ? function run(e) {
|
3259 | _reactDom2.default.unstable_batchedUpdates(cb, e);
|
3260 | } : cb;
|
3261 | return (0, _addDomEventListener2.default)(target, eventType, callback);
|
3262 | }
|
3263 |
|
3264 | }),
|
3265 |
|
3266 | (function(module, exports, __webpack_require__) {
|
3267 |
|
3268 | 'use strict';
|
3269 |
|
3270 | Object.defineProperty(exports, '__esModule', {
|
3271 | value: true
|
3272 | });
|
3273 | exports['default'] = addEventListener;
|
3274 |
|
3275 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
3276 |
|
3277 | var _EventObject = __webpack_require__(42);
|
3278 |
|
3279 | var _EventObject2 = _interopRequireDefault(_EventObject);
|
3280 |
|
3281 | function addEventListener(target, eventType, callback, option) {
|
3282 | function wrapCallback(e) {
|
3283 | var ne = new _EventObject2['default'](e);
|
3284 | callback.call(target, ne);
|
3285 | }
|
3286 |
|
3287 | if (target.addEventListener) {
|
3288 | var _ret = (function () {
|
3289 | var useCapture = false;
|
3290 | if (typeof option === 'object') {
|
3291 | useCapture = option.capture || false;
|
3292 | } else if (typeof option === 'boolean') {
|
3293 | useCapture = option;
|
3294 | }
|
3295 |
|
3296 | target.addEventListener(eventType, wrapCallback, option || false);
|
3297 |
|
3298 | return {
|
3299 | v: {
|
3300 | remove: function remove() {
|
3301 | target.removeEventListener(eventType, wrapCallback, useCapture);
|
3302 | }
|
3303 | }
|
3304 | };
|
3305 | })();
|
3306 |
|
3307 | if (typeof _ret === 'object') return _ret.v;
|
3308 | } else if (target.attachEvent) {
|
3309 | target.attachEvent('on' + eventType, wrapCallback);
|
3310 | return {
|
3311 | remove: function remove() {
|
3312 | target.detachEvent('on' + eventType, wrapCallback);
|
3313 | }
|
3314 | };
|
3315 | }
|
3316 | }
|
3317 |
|
3318 | module.exports = exports['default'];
|
3319 |
|
3320 | }),
|
3321 |
|
3322 | (function(module, exports, __webpack_require__) {
|
3323 |
|
3324 | |
3325 |
|
3326 |
|
3327 |
|
3328 |
|
3329 |
|
3330 | 'use strict';
|
3331 |
|
3332 | Object.defineProperty(exports, '__esModule', {
|
3333 | value: true
|
3334 | });
|
3335 |
|
3336 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
3337 |
|
3338 | var _EventBaseObject = __webpack_require__(43);
|
3339 |
|
3340 | var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject);
|
3341 |
|
3342 | var _objectAssign = __webpack_require__(44);
|
3343 |
|
3344 | var _objectAssign2 = _interopRequireDefault(_objectAssign);
|
3345 |
|
3346 | var TRUE = true;
|
3347 | var FALSE = false;
|
3348 | var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type'];
|
3349 |
|
3350 | function isNullOrUndefined(w) {
|
3351 | return w === null || w === undefined;
|
3352 | }
|
3353 |
|
3354 | var eventNormalizers = [{
|
3355 | reg: /^key/,
|
3356 | props: ['char', 'charCode', 'key', 'keyCode', 'which'],
|
3357 | fix: function fix(event, nativeEvent) {
|
3358 | if (isNullOrUndefined(event.which)) {
|
3359 | event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode;
|
3360 | }
|
3361 |
|
3362 |
|
3363 | if (event.metaKey === undefined) {
|
3364 | event.metaKey = event.ctrlKey;
|
3365 | }
|
3366 | }
|
3367 | }, {
|
3368 | reg: /^touch/,
|
3369 | props: ['touches', 'changedTouches', 'targetTouches']
|
3370 | }, {
|
3371 | reg: /^hashchange$/,
|
3372 | props: ['newURL', 'oldURL']
|
3373 | }, {
|
3374 | reg: /^gesturechange$/i,
|
3375 | props: ['rotation', 'scale']
|
3376 | }, {
|
3377 | reg: /^(mousewheel|DOMMouseScroll)$/,
|
3378 | props: [],
|
3379 | fix: function fix(event, nativeEvent) {
|
3380 | var deltaX = undefined;
|
3381 | var deltaY = undefined;
|
3382 | var delta = undefined;
|
3383 | var wheelDelta = nativeEvent.wheelDelta;
|
3384 | var axis = nativeEvent.axis;
|
3385 | var wheelDeltaY = nativeEvent.wheelDeltaY;
|
3386 | var wheelDeltaX = nativeEvent.wheelDeltaX;
|
3387 | var detail = nativeEvent.detail;
|
3388 |
|
3389 |
|
3390 | if (wheelDelta) {
|
3391 | delta = wheelDelta / 120;
|
3392 | }
|
3393 |
|
3394 |
|
3395 | if (detail) {
|
3396 |
|
3397 | delta = 0 - (detail % 3 === 0 ? detail / 3 : detail);
|
3398 | }
|
3399 |
|
3400 |
|
3401 | if (axis !== undefined) {
|
3402 | if (axis === event.HORIZONTAL_AXIS) {
|
3403 | deltaY = 0;
|
3404 | deltaX = 0 - delta;
|
3405 | } else if (axis === event.VERTICAL_AXIS) {
|
3406 | deltaX = 0;
|
3407 | deltaY = delta;
|
3408 | }
|
3409 | }
|
3410 |
|
3411 |
|
3412 | if (wheelDeltaY !== undefined) {
|
3413 | deltaY = wheelDeltaY / 120;
|
3414 | }
|
3415 | if (wheelDeltaX !== undefined) {
|
3416 | deltaX = -1 * wheelDeltaX / 120;
|
3417 | }
|
3418 |
|
3419 |
|
3420 | if (!deltaX && !deltaY) {
|
3421 | deltaY = delta;
|
3422 | }
|
3423 |
|
3424 | if (deltaX !== undefined) {
|
3425 | |
3426 |
|
3427 |
|
3428 |
|
3429 |
|
3430 | event.deltaX = deltaX;
|
3431 | }
|
3432 |
|
3433 | if (deltaY !== undefined) {
|
3434 | |
3435 |
|
3436 |
|
3437 |
|
3438 |
|
3439 | event.deltaY = deltaY;
|
3440 | }
|
3441 |
|
3442 | if (delta !== undefined) {
|
3443 | |
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 | event.delta = delta;
|
3449 | }
|
3450 | }
|
3451 | }, {
|
3452 | reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,
|
3453 | props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'],
|
3454 | fix: function fix(event, nativeEvent) {
|
3455 | var eventDoc = undefined;
|
3456 | var doc = undefined;
|
3457 | var body = undefined;
|
3458 | var target = event.target;
|
3459 | var button = nativeEvent.button;
|
3460 |
|
3461 |
|
3462 | if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) {
|
3463 | eventDoc = target.ownerDocument || document;
|
3464 | doc = eventDoc.documentElement;
|
3465 | body = eventDoc.body;
|
3466 | event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
|
3467 | event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
|
3468 | }
|
3469 |
|
3470 |
|
3471 |
|
3472 | if (!event.which && button !== undefined) {
|
3473 | if (button & 1) {
|
3474 | event.which = 1;
|
3475 | } else if (button & 2) {
|
3476 | event.which = 3;
|
3477 | } else if (button & 4) {
|
3478 | event.which = 2;
|
3479 | } else {
|
3480 | event.which = 0;
|
3481 | }
|
3482 | }
|
3483 |
|
3484 |
|
3485 | if (!event.relatedTarget && event.fromElement) {
|
3486 | event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement;
|
3487 | }
|
3488 |
|
3489 | return event;
|
3490 | }
|
3491 | }];
|
3492 |
|
3493 | function retTrue() {
|
3494 | return TRUE;
|
3495 | }
|
3496 |
|
3497 | function retFalse() {
|
3498 | return FALSE;
|
3499 | }
|
3500 |
|
3501 | function DomEventObject(nativeEvent) {
|
3502 | var type = nativeEvent.type;
|
3503 |
|
3504 | var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean';
|
3505 |
|
3506 | _EventBaseObject2['default'].call(this);
|
3507 |
|
3508 | this.nativeEvent = nativeEvent;
|
3509 |
|
3510 |
|
3511 | var isDefaultPrevented = retFalse;
|
3512 | if ('defaultPrevented' in nativeEvent) {
|
3513 | isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse;
|
3514 | } else if ('getPreventDefault' in nativeEvent) {
|
3515 |
|
3516 | isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse;
|
3517 | } else if ('returnValue' in nativeEvent) {
|
3518 | isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse;
|
3519 | }
|
3520 |
|
3521 | this.isDefaultPrevented = isDefaultPrevented;
|
3522 |
|
3523 | var fixFns = [];
|
3524 | var fixFn = undefined;
|
3525 | var l = undefined;
|
3526 | var prop = undefined;
|
3527 | var props = commonProps.concat();
|
3528 |
|
3529 | eventNormalizers.forEach(function (normalizer) {
|
3530 | if (type.match(normalizer.reg)) {
|
3531 | props = props.concat(normalizer.props);
|
3532 | if (normalizer.fix) {
|
3533 | fixFns.push(normalizer.fix);
|
3534 | }
|
3535 | }
|
3536 | });
|
3537 |
|
3538 | l = props.length;
|
3539 |
|
3540 |
|
3541 | while (l) {
|
3542 | prop = props[--l];
|
3543 | this[prop] = nativeEvent[prop];
|
3544 | }
|
3545 |
|
3546 |
|
3547 | if (!this.target && isNative) {
|
3548 | this.target = nativeEvent.srcElement || document;
|
3549 | }
|
3550 |
|
3551 |
|
3552 | if (this.target && this.target.nodeType === 3) {
|
3553 | this.target = this.target.parentNode;
|
3554 | }
|
3555 |
|
3556 | l = fixFns.length;
|
3557 |
|
3558 | while (l) {
|
3559 | fixFn = fixFns[--l];
|
3560 | fixFn(this, nativeEvent);
|
3561 | }
|
3562 |
|
3563 | this.timeStamp = nativeEvent.timeStamp || Date.now();
|
3564 | }
|
3565 |
|
3566 | var EventBaseObjectProto = _EventBaseObject2['default'].prototype;
|
3567 |
|
3568 | (0, _objectAssign2['default'])(DomEventObject.prototype, EventBaseObjectProto, {
|
3569 | constructor: DomEventObject,
|
3570 |
|
3571 | preventDefault: function preventDefault() {
|
3572 | var e = this.nativeEvent;
|
3573 |
|
3574 |
|
3575 | if (e.preventDefault) {
|
3576 | e.preventDefault();
|
3577 | } else {
|
3578 |
|
3579 | e.returnValue = FALSE;
|
3580 | }
|
3581 |
|
3582 | EventBaseObjectProto.preventDefault.call(this);
|
3583 | },
|
3584 |
|
3585 | stopPropagation: function stopPropagation() {
|
3586 | var e = this.nativeEvent;
|
3587 |
|
3588 |
|
3589 | if (e.stopPropagation) {
|
3590 | e.stopPropagation();
|
3591 | } else {
|
3592 |
|
3593 | e.cancelBubble = TRUE;
|
3594 | }
|
3595 |
|
3596 | EventBaseObjectProto.stopPropagation.call(this);
|
3597 | }
|
3598 | });
|
3599 |
|
3600 | exports['default'] = DomEventObject;
|
3601 | module.exports = exports['default'];
|
3602 |
|
3603 | }),
|
3604 |
|
3605 | (function(module, exports) {
|
3606 |
|
3607 | |
3608 |
|
3609 |
|
3610 |
|
3611 |
|
3612 |
|
3613 | "use strict";
|
3614 |
|
3615 | Object.defineProperty(exports, "__esModule", {
|
3616 | value: true
|
3617 | });
|
3618 | function returnFalse() {
|
3619 | return false;
|
3620 | }
|
3621 |
|
3622 | function returnTrue() {
|
3623 | return true;
|
3624 | }
|
3625 |
|
3626 | function EventBaseObject() {
|
3627 | this.timeStamp = Date.now();
|
3628 | this.target = undefined;
|
3629 | this.currentTarget = undefined;
|
3630 | }
|
3631 |
|
3632 | EventBaseObject.prototype = {
|
3633 | isEventObject: 1,
|
3634 |
|
3635 | constructor: EventBaseObject,
|
3636 |
|
3637 | isDefaultPrevented: returnFalse,
|
3638 |
|
3639 | isPropagationStopped: returnFalse,
|
3640 |
|
3641 | isImmediatePropagationStopped: returnFalse,
|
3642 |
|
3643 | preventDefault: function preventDefault() {
|
3644 | this.isDefaultPrevented = returnTrue;
|
3645 | },
|
3646 |
|
3647 | stopPropagation: function stopPropagation() {
|
3648 | this.isPropagationStopped = returnTrue;
|
3649 | },
|
3650 |
|
3651 | stopImmediatePropagation: function stopImmediatePropagation() {
|
3652 | this.isImmediatePropagationStopped = returnTrue;
|
3653 |
|
3654 |
|
3655 | this.stopPropagation();
|
3656 | },
|
3657 |
|
3658 | halt: function halt(immediate) {
|
3659 | if (immediate) {
|
3660 | this.stopImmediatePropagation();
|
3661 | } else {
|
3662 | this.stopPropagation();
|
3663 | }
|
3664 | this.preventDefault();
|
3665 | }
|
3666 | };
|
3667 |
|
3668 | exports["default"] = EventBaseObject;
|
3669 | module.exports = exports["default"];
|
3670 |
|
3671 | }),
|
3672 |
|
3673 | (function(module, exports) {
|
3674 |
|
3675 | |
3676 |
|
3677 |
|
3678 |
|
3679 |
|
3680 |
|
3681 | 'use strict';
|
3682 |
|
3683 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
3684 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
3685 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
3686 |
|
3687 | function toObject(val) {
|
3688 | if (val === null || val === undefined) {
|
3689 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
3690 | }
|
3691 |
|
3692 | return Object(val);
|
3693 | }
|
3694 |
|
3695 | function shouldUseNative() {
|
3696 | try {
|
3697 | if (!Object.assign) {
|
3698 | return false;
|
3699 | }
|
3700 |
|
3701 |
|
3702 |
|
3703 |
|
3704 | var test1 = new String('abc');
|
3705 | test1[5] = 'de';
|
3706 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
3707 | return false;
|
3708 | }
|
3709 |
|
3710 |
|
3711 | var test2 = {};
|
3712 | for (var i = 0; i < 10; i++) {
|
3713 | test2['_' + String.fromCharCode(i)] = i;
|
3714 | }
|
3715 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
3716 | return test2[n];
|
3717 | });
|
3718 | if (order2.join('') !== '0123456789') {
|
3719 | return false;
|
3720 | }
|
3721 |
|
3722 |
|
3723 | var test3 = {};
|
3724 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
3725 | test3[letter] = letter;
|
3726 | });
|
3727 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
3728 | 'abcdefghijklmnopqrst') {
|
3729 | return false;
|
3730 | }
|
3731 |
|
3732 | return true;
|
3733 | } catch (err) {
|
3734 |
|
3735 | return false;
|
3736 | }
|
3737 | }
|
3738 |
|
3739 | module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
3740 | var from;
|
3741 | var to = toObject(target);
|
3742 | var symbols;
|
3743 |
|
3744 | for (var s = 1; s < arguments.length; s++) {
|
3745 | from = Object(arguments[s]);
|
3746 |
|
3747 | for (var key in from) {
|
3748 | if (hasOwnProperty.call(from, key)) {
|
3749 | to[key] = from[key];
|
3750 | }
|
3751 | }
|
3752 |
|
3753 | if (getOwnPropertySymbols) {
|
3754 | symbols = getOwnPropertySymbols(from);
|
3755 | for (var i = 0; i < symbols.length; i++) {
|
3756 | if (propIsEnumerable.call(from, symbols[i])) {
|
3757 | to[symbols[i]] = from[symbols[i]];
|
3758 | }
|
3759 | }
|
3760 | }
|
3761 | }
|
3762 |
|
3763 | return to;
|
3764 | };
|
3765 |
|
3766 |
|
3767 | }),
|
3768 |
|
3769 | (function(module, exports, __webpack_require__) {
|
3770 |
|
3771 | 'use strict';
|
3772 |
|
3773 | exports.__esModule = true;
|
3774 |
|
3775 | 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; }; |
3776 |
|
3777 |
|
3778 |
|
3779 |
|
3780 |
|
3781 | var _Event = __webpack_require__(46);
|
3782 |
|
3783 | var _Event2 = _interopRequireDefault(_Event);
|
3784 |
|
3785 | var _componentClasses = __webpack_require__(47);
|
3786 |
|
3787 | var _componentClasses2 = _interopRequireDefault(_componentClasses);
|
3788 |
|
3789 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3790 |
|
3791 | var isCssAnimationSupported = _Event2.default.endEvents.length !== 0;
|
3792 |
|
3793 |
|
3794 | var capitalPrefixes = ['Webkit', 'Moz', 'O',
|
3795 |
|
3796 | 'ms'];
|
3797 | var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];
|
3798 |
|
3799 | function getStyleProperty(node, name) {
|
3800 | var style = window.getComputedStyle(node);
|
3801 |
|
3802 | var ret = '';
|
3803 | for (var i = 0; i < prefixes.length; i++) {
|
3804 | ret = style.getPropertyValue(prefixes[i] + name);
|
3805 | if (ret) {
|
3806 | break;
|
3807 | }
|
3808 | }
|
3809 | return ret;
|
3810 | }
|
3811 |
|
3812 | function fixBrowserByTimeout(node) {
|
3813 | if (isCssAnimationSupported) {
|
3814 | var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0;
|
3815 | var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0;
|
3816 | var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0;
|
3817 | var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0;
|
3818 | var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay);
|
3819 |
|
3820 | node.rcEndAnimTimeout = setTimeout(function () {
|
3821 | node.rcEndAnimTimeout = null;
|
3822 | if (node.rcEndListener) {
|
3823 | node.rcEndListener();
|
3824 | }
|
3825 | }, time * 1000 + 200);
|
3826 | }
|
3827 | }
|
3828 |
|
3829 | function clearBrowserBugTimeout(node) {
|
3830 | if (node.rcEndAnimTimeout) {
|
3831 | clearTimeout(node.rcEndAnimTimeout);
|
3832 | node.rcEndAnimTimeout = null;
|
3833 | }
|
3834 | }
|
3835 |
|
3836 | var cssAnimation = function cssAnimation(node, transitionName, endCallback) {
|
3837 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
|
3838 | var className = nameIsObj ? transitionName.name : transitionName;
|
3839 | var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active';
|
3840 | var end = endCallback;
|
3841 | var start = void 0;
|
3842 | var active = void 0;
|
3843 | var nodeClasses = (0, _componentClasses2.default)(node);
|
3844 |
|
3845 | if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') {
|
3846 | end = endCallback.end;
|
3847 | start = endCallback.start;
|
3848 | active = endCallback.active;
|
3849 | }
|
3850 |
|
3851 | if (node.rcEndListener) {
|
3852 | node.rcEndListener();
|
3853 | }
|
3854 |
|
3855 | node.rcEndListener = function (e) {
|
3856 | if (e && e.target !== node) {
|
3857 | return;
|
3858 | }
|
3859 |
|
3860 | if (node.rcAnimTimeout) {
|
3861 | clearTimeout(node.rcAnimTimeout);
|
3862 | node.rcAnimTimeout = null;
|
3863 | }
|
3864 |
|
3865 | clearBrowserBugTimeout(node);
|
3866 |
|
3867 | nodeClasses.remove(className);
|
3868 | nodeClasses.remove(activeClassName);
|
3869 |
|
3870 | _Event2.default.removeEndEventListener(node, node.rcEndListener);
|
3871 | node.rcEndListener = null;
|
3872 |
|
3873 |
|
3874 |
|
3875 | if (end) {
|
3876 | end();
|
3877 | }
|
3878 | };
|
3879 |
|
3880 | _Event2.default.addEndEventListener(node, node.rcEndListener);
|
3881 |
|
3882 | if (start) {
|
3883 | start();
|
3884 | }
|
3885 | nodeClasses.add(className);
|
3886 |
|
3887 | node.rcAnimTimeout = setTimeout(function () {
|
3888 | node.rcAnimTimeout = null;
|
3889 | nodeClasses.add(activeClassName);
|
3890 | if (active) {
|
3891 | setTimeout(active, 0);
|
3892 | }
|
3893 | fixBrowserByTimeout(node);
|
3894 |
|
3895 | }, 30);
|
3896 |
|
3897 | return {
|
3898 | stop: function stop() {
|
3899 | if (node.rcEndListener) {
|
3900 | node.rcEndListener();
|
3901 | }
|
3902 | }
|
3903 | };
|
3904 | };
|
3905 |
|
3906 | cssAnimation.style = function (node, style, callback) {
|
3907 | if (node.rcEndListener) {
|
3908 | node.rcEndListener();
|
3909 | }
|
3910 |
|
3911 | node.rcEndListener = function (e) {
|
3912 | if (e && e.target !== node) {
|
3913 | return;
|
3914 | }
|
3915 |
|
3916 | if (node.rcAnimTimeout) {
|
3917 | clearTimeout(node.rcAnimTimeout);
|
3918 | node.rcAnimTimeout = null;
|
3919 | }
|
3920 |
|
3921 | clearBrowserBugTimeout(node);
|
3922 |
|
3923 | _Event2.default.removeEndEventListener(node, node.rcEndListener);
|
3924 | node.rcEndListener = null;
|
3925 |
|
3926 |
|
3927 |
|
3928 | if (callback) {
|
3929 | callback();
|
3930 | }
|
3931 | };
|
3932 |
|
3933 | _Event2.default.addEndEventListener(node, node.rcEndListener);
|
3934 |
|
3935 | node.rcAnimTimeout = setTimeout(function () {
|
3936 | for (var s in style) {
|
3937 | if (style.hasOwnProperty(s)) {
|
3938 | node.style[s] = style[s];
|
3939 | }
|
3940 | }
|
3941 | node.rcAnimTimeout = null;
|
3942 | fixBrowserByTimeout(node);
|
3943 | }, 0);
|
3944 | };
|
3945 |
|
3946 | cssAnimation.setTransition = function (node, p, value) {
|
3947 | var property = p;
|
3948 | var v = value;
|
3949 | if (value === undefined) {
|
3950 | v = property;
|
3951 | property = '';
|
3952 | }
|
3953 | property = property || '';
|
3954 | capitalPrefixes.forEach(function (prefix) {
|
3955 | node.style[prefix + 'Transition' + property] = v;
|
3956 | });
|
3957 | };
|
3958 |
|
3959 | cssAnimation.isCssAnimationSupported = isCssAnimationSupported;
|
3960 |
|
3961 | exports.default = cssAnimation;
|
3962 |
|
3963 | }),
|
3964 |
|
3965 | (function(module, exports) {
|
3966 |
|
3967 | 'use strict';
|
3968 |
|
3969 | exports.__esModule = true;
|
3970 | |
3971 |
|
3972 |
|
3973 |
|
3974 | var EVENT_NAME_MAP = {
|
3975 | transitionend: {
|
3976 | transition: 'transitionend',
|
3977 | WebkitTransition: 'webkitTransitionEnd',
|
3978 | MozTransition: 'mozTransitionEnd',
|
3979 | OTransition: 'oTransitionEnd',
|
3980 | msTransition: 'MSTransitionEnd'
|
3981 | },
|
3982 |
|
3983 | animationend: {
|
3984 | animation: 'animationend',
|
3985 | WebkitAnimation: 'webkitAnimationEnd',
|
3986 | MozAnimation: 'mozAnimationEnd',
|
3987 | OAnimation: 'oAnimationEnd',
|
3988 | msAnimation: 'MSAnimationEnd'
|
3989 | }
|
3990 | };
|
3991 |
|
3992 | var endEvents = [];
|
3993 |
|
3994 | function detectEvents() {
|
3995 | var testEl = document.createElement('div');
|
3996 | var style = testEl.style;
|
3997 |
|
3998 | if (!('AnimationEvent' in window)) {
|
3999 | delete EVENT_NAME_MAP.animationend.animation;
|
4000 | }
|
4001 |
|
4002 | if (!('TransitionEvent' in window)) {
|
4003 | delete EVENT_NAME_MAP.transitionend.transition;
|
4004 | }
|
4005 |
|
4006 | for (var baseEventName in EVENT_NAME_MAP) {
|
4007 | if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
|
4008 | var baseEvents = EVENT_NAME_MAP[baseEventName];
|
4009 | for (var styleName in baseEvents) {
|
4010 | if (styleName in style) {
|
4011 | endEvents.push(baseEvents[styleName]);
|
4012 | break;
|
4013 | }
|
4014 | }
|
4015 | }
|
4016 | }
|
4017 | }
|
4018 |
|
4019 | if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
4020 | detectEvents();
|
4021 | }
|
4022 |
|
4023 | function addEventListener(node, eventName, eventListener) {
|
4024 | node.addEventListener(eventName, eventListener, false);
|
4025 | }
|
4026 |
|
4027 | function removeEventListener(node, eventName, eventListener) {
|
4028 | node.removeEventListener(eventName, eventListener, false);
|
4029 | }
|
4030 |
|
4031 | var TransitionEvents = {
|
4032 | addEndEventListener: function addEndEventListener(node, eventListener) {
|
4033 | if (endEvents.length === 0) {
|
4034 | window.setTimeout(eventListener, 0);
|
4035 | return;
|
4036 | }
|
4037 | endEvents.forEach(function (endEvent) {
|
4038 | addEventListener(node, endEvent, eventListener);
|
4039 | });
|
4040 | },
|
4041 |
|
4042 |
|
4043 | endEvents: endEvents,
|
4044 |
|
4045 | removeEndEventListener: function removeEndEventListener(node, eventListener) {
|
4046 | if (endEvents.length === 0) {
|
4047 | return;
|
4048 | }
|
4049 | endEvents.forEach(function (endEvent) {
|
4050 | removeEventListener(node, endEvent, eventListener);
|
4051 | });
|
4052 | }
|
4053 | };
|
4054 |
|
4055 | exports.default = TransitionEvents;
|
4056 |
|
4057 | }),
|
4058 |
|
4059 | (function(module, exports, __webpack_require__) {
|
4060 |
|
4061 | |
4062 |
|
4063 |
|
4064 |
|
4065 | try {
|
4066 | var index = __webpack_require__(48);
|
4067 | } catch (err) {
|
4068 | var index = __webpack_require__(48);
|
4069 | }
|
4070 |
|
4071 | |
4072 |
|
4073 |
|
4074 |
|
4075 | var re = /\s+/;
|
4076 |
|
4077 | |
4078 |
|
4079 |
|
4080 |
|
4081 | var toString = Object.prototype.toString;
|
4082 |
|
4083 | |
4084 |
|
4085 |
|
4086 |
|
4087 |
|
4088 |
|
4089 |
|
4090 |
|
4091 | module.exports = function(el){
|
4092 | return new ClassList(el);
|
4093 | };
|
4094 |
|
4095 | |
4096 |
|
4097 |
|
4098 |
|
4099 |
|
4100 |
|
4101 |
|
4102 | function ClassList(el) {
|
4103 | if (!el || !el.nodeType) {
|
4104 | throw new Error('A DOM element reference is required');
|
4105 | }
|
4106 | this.el = el;
|
4107 | this.list = el.classList;
|
4108 | }
|
4109 |
|
4110 | |
4111 |
|
4112 |
|
4113 |
|
4114 |
|
4115 |
|
4116 |
|
4117 |
|
4118 | ClassList.prototype.add = function(name){
|
4119 |
|
4120 | if (this.list) {
|
4121 | this.list.add(name);
|
4122 | return this;
|
4123 | }
|
4124 |
|
4125 |
|
4126 | var arr = this.array();
|
4127 | var i = index(arr, name);
|
4128 | if (!~i) arr.push(name);
|
4129 | this.el.className = arr.join(' ');
|
4130 | return this;
|
4131 | };
|
4132 |
|
4133 | |
4134 |
|
4135 |
|
4136 |
|
4137 |
|
4138 |
|
4139 |
|
4140 |
|
4141 |
|
4142 |
|
4143 | ClassList.prototype.remove = function(name){
|
4144 | if ('[object RegExp]' == toString.call(name)) {
|
4145 | return this.removeMatching(name);
|
4146 | }
|
4147 |
|
4148 |
|
4149 | if (this.list) {
|
4150 | this.list.remove(name);
|
4151 | return this;
|
4152 | }
|
4153 |
|
4154 |
|
4155 | var arr = this.array();
|
4156 | var i = index(arr, name);
|
4157 | if (~i) arr.splice(i, 1);
|
4158 | this.el.className = arr.join(' ');
|
4159 | return this;
|
4160 | };
|
4161 |
|
4162 | |
4163 |
|
4164 |
|
4165 |
|
4166 |
|
4167 |
|
4168 |
|
4169 |
|
4170 | ClassList.prototype.removeMatching = function(re){
|
4171 | var arr = this.array();
|
4172 | for (var i = 0; i < arr.length; i++) {
|
4173 | if (re.test(arr[i])) {
|
4174 | this.remove(arr[i]);
|
4175 | }
|
4176 | }
|
4177 | return this;
|
4178 | };
|
4179 |
|
4180 | |
4181 |
|
4182 |
|
4183 |
|
4184 |
|
4185 |
|
4186 |
|
4187 |
|
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 | ClassList.prototype.toggle = function(name, force){
|
4193 |
|
4194 | if (this.list) {
|
4195 | if ("undefined" !== typeof force) {
|
4196 | if (force !== this.list.toggle(name, force)) {
|
4197 | this.list.toggle(name);
|
4198 | }
|
4199 | } else {
|
4200 | this.list.toggle(name);
|
4201 | }
|
4202 | return this;
|
4203 | }
|
4204 |
|
4205 |
|
4206 | if ("undefined" !== typeof force) {
|
4207 | if (!force) {
|
4208 | this.remove(name);
|
4209 | } else {
|
4210 | this.add(name);
|
4211 | }
|
4212 | } else {
|
4213 | if (this.has(name)) {
|
4214 | this.remove(name);
|
4215 | } else {
|
4216 | this.add(name);
|
4217 | }
|
4218 | }
|
4219 |
|
4220 | return this;
|
4221 | };
|
4222 |
|
4223 | |
4224 |
|
4225 |
|
4226 |
|
4227 |
|
4228 |
|
4229 |
|
4230 | ClassList.prototype.array = function(){
|
4231 | var className = this.el.getAttribute('class') || '';
|
4232 | var str = className.replace(/^\s+|\s+$/g, '');
|
4233 | var arr = str.split(re);
|
4234 | if ('' === arr[0]) arr.shift();
|
4235 | return arr;
|
4236 | };
|
4237 |
|
4238 | |
4239 |
|
4240 |
|
4241 |
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 | ClassList.prototype.has =
|
4247 | ClassList.prototype.contains = function(name){
|
4248 | return this.list
|
4249 | ? this.list.contains(name)
|
4250 | : !! ~index(this.array(), name);
|
4251 | };
|
4252 |
|
4253 |
|
4254 | }),
|
4255 |
|
4256 | (function(module, exports) {
|
4257 |
|
4258 | module.exports = function(arr, obj){
|
4259 | if (arr.indexOf) return arr.indexOf(obj);
|
4260 | for (var i = 0; i < arr.length; ++i) {
|
4261 | if (arr[i] === obj) return i;
|
4262 | }
|
4263 | return -1;
|
4264 | };
|
4265 |
|
4266 | }),
|
4267 |
|
4268 | (function(module, exports, __webpack_require__) {
|
4269 |
|
4270 | 'use strict';
|
4271 |
|
4272 | exports.__esModule = true;
|
4273 | exports.default = toArray;
|
4274 |
|
4275 | var _react = __webpack_require__(4);
|
4276 |
|
4277 | var _react2 = _interopRequireDefault(_react);
|
4278 |
|
4279 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4280 |
|
4281 | function toArray(children) {
|
4282 | var ret = [];
|
4283 | _react2.default.Children.forEach(children, function (c) {
|
4284 | ret.push(c);
|
4285 | });
|
4286 | return ret;
|
4287 | } |
4288 |
|
4289 |
|
4290 |
|
4291 |
|
4292 | }),
|
4293 |
|
4294 | (function(module, exports, __webpack_require__) {
|
4295 |
|
4296 | 'use strict';
|
4297 |
|
4298 | exports.__esModule = true;
|
4299 |
|
4300 | var _react = __webpack_require__(4);
|
4301 |
|
4302 | var _react2 = _interopRequireDefault(_react);
|
4303 |
|
4304 | var _propTypes = __webpack_require__(5);
|
4305 |
|
4306 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
4307 |
|
4308 | var _reactDom = __webpack_require__(12);
|
4309 |
|
4310 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
4311 |
|
4312 | var _domAlign = __webpack_require__(51);
|
4313 |
|
4314 | var _domAlign2 = _interopRequireDefault(_domAlign);
|
4315 |
|
4316 | var _addEventListener = __webpack_require__(40);
|
4317 |
|
4318 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
4319 |
|
4320 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4321 |
|
4322 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
4323 |
|
4324 | 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; }
|
4325 |
|
4326 | 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; } |
4327 |
|
4328 |
|
4329 |
|
4330 |
|
4331 |
|
4332 |
|
4333 |
|
4334 | function isWindow(obj) {
|
4335 |
|
4336 |
|
4337 | return obj != null && obj == obj.window;
|
4338 | }
|
4339 |
|
4340 | function buffer(fn, ms) {
|
4341 | var timer = void 0;
|
4342 |
|
4343 | function clear() {
|
4344 | if (timer) {
|
4345 | clearTimeout(timer);
|
4346 | timer = null;
|
4347 | }
|
4348 | }
|
4349 |
|
4350 | function bufferFn() {
|
4351 | clear();
|
4352 | timer = setTimeout(fn, ms);
|
4353 | }
|
4354 |
|
4355 | bufferFn.clear = clear;
|
4356 |
|
4357 | return bufferFn;
|
4358 | }
|
4359 |
|
4360 | var propTypes = {
|
4361 | childrenProps: _propTypes2.default.object,
|
4362 | align: _propTypes2.default.object.isRequired,
|
4363 | target: _propTypes2.default.func,
|
4364 | onAlign: _propTypes2.default.func,
|
4365 | monitorBufferTime: _propTypes2.default.number,
|
4366 | monitorWindowResize: _propTypes2.default.bool,
|
4367 | disabled: _propTypes2.default.bool,
|
4368 | children: _propTypes2.default.any
|
4369 | };
|
4370 |
|
4371 | var defaultProps = {
|
4372 | target: function target() {
|
4373 | return window;
|
4374 | },
|
4375 | onAlign: function onAlign() {},
|
4376 |
|
4377 | monitorBufferTime: 50,
|
4378 | monitorWindowResize: false,
|
4379 | disabled: false
|
4380 | };
|
4381 |
|
4382 | var Align = function (_React$Component) {
|
4383 | _inherits(Align, _React$Component);
|
4384 |
|
4385 | function Align(props) {
|
4386 | _classCallCheck(this, Align);
|
4387 |
|
4388 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
4389 |
|
4390 | _initialiseProps.call(_this);
|
4391 |
|
4392 | return _this;
|
4393 | }
|
4394 |
|
4395 | Align.prototype.componentDidMount = function componentDidMount() {
|
4396 | var props = this.props;
|
4397 |
|
4398 | this.forceAlign();
|
4399 | if (!props.disabled && props.monitorWindowResize) {
|
4400 | this.startMonitorWindowResize();
|
4401 | }
|
4402 | };
|
4403 |
|
4404 | Align.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
4405 | var reAlign = false;
|
4406 | var props = this.props;
|
4407 |
|
4408 | if (!props.disabled) {
|
4409 | if (prevProps.disabled || prevProps.align !== props.align) {
|
4410 | reAlign = true;
|
4411 | } else {
|
4412 | var lastTarget = prevProps.target();
|
4413 | var currentTarget = props.target();
|
4414 | if (isWindow(lastTarget) && isWindow(currentTarget)) {
|
4415 | reAlign = false;
|
4416 | } else if (lastTarget !== currentTarget) {
|
4417 | reAlign = true;
|
4418 | }
|
4419 | }
|
4420 | }
|
4421 |
|
4422 | if (reAlign) {
|
4423 | this.forceAlign();
|
4424 | }
|
4425 |
|
4426 | if (props.monitorWindowResize && !props.disabled) {
|
4427 | this.startMonitorWindowResize();
|
4428 | } else {
|
4429 | this.stopMonitorWindowResize();
|
4430 | }
|
4431 | };
|
4432 |
|
4433 | Align.prototype.componentWillUnmount = function componentWillUnmount() {
|
4434 | this.stopMonitorWindowResize();
|
4435 | };
|
4436 |
|
4437 | Align.prototype.render = function render() {
|
4438 | var _props = this.props,
|
4439 | childrenProps = _props.childrenProps,
|
4440 | children = _props.children;
|
4441 |
|
4442 | var child = _react2.default.Children.only(children);
|
4443 | if (childrenProps) {
|
4444 | var newProps = {};
|
4445 | for (var prop in childrenProps) {
|
4446 | if (childrenProps.hasOwnProperty(prop)) {
|
4447 | newProps[prop] = this.props[childrenProps[prop]];
|
4448 | }
|
4449 | }
|
4450 | return _react2.default.cloneElement(child, newProps);
|
4451 | }
|
4452 | return child;
|
4453 | };
|
4454 |
|
4455 | return Align;
|
4456 | }(_react2.default.Component);
|
4457 |
|
4458 | var _initialiseProps = function _initialiseProps() {
|
4459 | var _this2 = this;
|
4460 |
|
4461 | this.startMonitorWindowResize = function () {
|
4462 | if (!_this2.resizeHandler) {
|
4463 | _this2.bufferMonitor = buffer(_this2.forceAlign, _this2.props.monitorBufferTime);
|
4464 | _this2.resizeHandler = (0, _addEventListener2.default)(window, 'resize', _this2.bufferMonitor);
|
4465 | }
|
4466 | };
|
4467 |
|
4468 | this.stopMonitorWindowResize = function () {
|
4469 | if (_this2.resizeHandler) {
|
4470 | _this2.bufferMonitor.clear();
|
4471 | _this2.resizeHandler.remove();
|
4472 | _this2.resizeHandler = null;
|
4473 | }
|
4474 | };
|
4475 |
|
4476 | this.forceAlign = function () {
|
4477 | var props = _this2.props;
|
4478 | if (!props.disabled) {
|
4479 | var source = _reactDom2.default.findDOMNode(_this2);
|
4480 | props.onAlign(source, (0, _domAlign2.default)(source, props.target(), props.align));
|
4481 | }
|
4482 | };
|
4483 | };
|
4484 |
|
4485 | ;
|
4486 |
|
4487 | Align.defaultProps = defaultProps;
|
4488 | Align.propTypes = propTypes;
|
4489 |
|
4490 | exports.default = Align;
|
4491 |
|
4492 | }),
|
4493 |
|
4494 | (function(module, exports, __webpack_require__) {
|
4495 |
|
4496 | 'use strict';
|
4497 |
|
4498 | Object.defineProperty(exports, "__esModule", {
|
4499 | value: true
|
4500 | });
|
4501 | exports.alignPoint = exports.alignElement = undefined;
|
4502 |
|
4503 | var _alignElement = __webpack_require__(52);
|
4504 |
|
4505 | var _alignElement2 = _interopRequireDefault(_alignElement);
|
4506 |
|
4507 | var _alignPoint = __webpack_require__(63);
|
4508 |
|
4509 | var _alignPoint2 = _interopRequireDefault(_alignPoint);
|
4510 |
|
4511 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4512 |
|
4513 | exports.alignElement = _alignElement2['default'];
|
4514 | exports.alignPoint = _alignPoint2['default'];
|
4515 | exports['default'] = _alignElement2['default'];
|
4516 |
|
4517 | }),
|
4518 |
|
4519 | (function(module, exports, __webpack_require__) {
|
4520 |
|
4521 | 'use strict';
|
4522 |
|
4523 | Object.defineProperty(exports, "__esModule", {
|
4524 | value: true
|
4525 | });
|
4526 |
|
4527 | var _align = __webpack_require__(53);
|
4528 |
|
4529 | var _align2 = _interopRequireDefault(_align);
|
4530 |
|
4531 | var _getOffsetParent = __webpack_require__(57);
|
4532 |
|
4533 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
|
4534 |
|
4535 | var _getVisibleRectForElement = __webpack_require__(56);
|
4536 |
|
4537 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
|
4538 |
|
4539 | var _getRegion = __webpack_require__(60);
|
4540 |
|
4541 | var _getRegion2 = _interopRequireDefault(_getRegion);
|
4542 |
|
4543 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4544 |
|
4545 | function isOutOfVisibleRect(target) {
|
4546 | var visibleRect = (0, _getVisibleRectForElement2['default'])(target);
|
4547 | var targetRegion = (0, _getRegion2['default'])(target);
|
4548 |
|
4549 | return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom;
|
4550 | }
|
4551 |
|
4552 | function alignElement(el, refNode, align) {
|
4553 | var target = align.target || refNode;
|
4554 | var refNodeRegion = (0, _getRegion2['default'])(target);
|
4555 |
|
4556 | var isTargetNotOutOfVisible = !isOutOfVisibleRect(target);
|
4557 |
|
4558 | return (0, _align2['default'])(el, refNodeRegion, align, isTargetNotOutOfVisible);
|
4559 | }
|
4560 |
|
4561 | alignElement.__getOffsetParent = _getOffsetParent2['default'];
|
4562 |
|
4563 | alignElement.__getVisibleRectForElement = _getVisibleRectForElement2['default'];
|
4564 |
|
4565 | exports['default'] = alignElement;
|
4566 | module.exports = exports['default'];
|
4567 |
|
4568 | }),
|
4569 |
|
4570 | (function(module, exports, __webpack_require__) {
|
4571 |
|
4572 | 'use strict';
|
4573 |
|
4574 | Object.defineProperty(exports, "__esModule", {
|
4575 | value: true
|
4576 | });
|
4577 |
|
4578 | var _utils = __webpack_require__(54);
|
4579 |
|
4580 | var _utils2 = _interopRequireDefault(_utils);
|
4581 |
|
4582 | var _getVisibleRectForElement = __webpack_require__(56);
|
4583 |
|
4584 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
|
4585 |
|
4586 | var _adjustForViewport = __webpack_require__(59);
|
4587 |
|
4588 | var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport);
|
4589 |
|
4590 | var _getRegion = __webpack_require__(60);
|
4591 |
|
4592 | var _getRegion2 = _interopRequireDefault(_getRegion);
|
4593 |
|
4594 | var _getElFuturePos = __webpack_require__(61);
|
4595 |
|
4596 | var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos);
|
4597 |
|
4598 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4599 |
|
4600 |
|
4601 |
|
4602 | function isFailX(elFuturePos, elRegion, visibleRect) {
|
4603 | return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;
|
4604 | } |
4605 |
|
4606 |
|
4607 |
|
4608 |
|
4609 | function isFailY(elFuturePos, elRegion, visibleRect) {
|
4610 | return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom;
|
4611 | }
|
4612 |
|
4613 | function isCompleteFailX(elFuturePos, elRegion, visibleRect) {
|
4614 | return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;
|
4615 | }
|
4616 |
|
4617 | function isCompleteFailY(elFuturePos, elRegion, visibleRect) {
|
4618 | return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;
|
4619 | }
|
4620 |
|
4621 | function flip(points, reg, map) {
|
4622 | var ret = [];
|
4623 | _utils2['default'].each(points, function (p) {
|
4624 | ret.push(p.replace(reg, function (m) {
|
4625 | return map[m];
|
4626 | }));
|
4627 | });
|
4628 | return ret;
|
4629 | }
|
4630 |
|
4631 | function flipOffset(offset, index) {
|
4632 | offset[index] = -offset[index];
|
4633 | return offset;
|
4634 | }
|
4635 |
|
4636 | function convertOffset(str, offsetLen) {
|
4637 | var n = void 0;
|
4638 | if (/%$/.test(str)) {
|
4639 | n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen;
|
4640 | } else {
|
4641 | n = parseInt(str, 10);
|
4642 | }
|
4643 | return n || 0;
|
4644 | }
|
4645 |
|
4646 | function normalizeOffset(offset, el) {
|
4647 | offset[0] = convertOffset(offset[0], el.width);
|
4648 | offset[1] = convertOffset(offset[1], el.height);
|
4649 | }
|
4650 |
|
4651 | |
4652 |
|
4653 |
|
4654 |
|
4655 |
|
4656 | function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
4657 | var points = align.points;
|
4658 | var offset = align.offset || [0, 0];
|
4659 | var targetOffset = align.targetOffset || [0, 0];
|
4660 | var overflow = align.overflow;
|
4661 | var source = align.source || el;
|
4662 | offset = [].concat(offset);
|
4663 | targetOffset = [].concat(targetOffset);
|
4664 | overflow = overflow || {};
|
4665 | var newOverflowCfg = {};
|
4666 | var fail = 0;
|
4667 |
|
4668 | var visibleRect = (0, _getVisibleRectForElement2['default'])(source);
|
4669 |
|
4670 | var elRegion = (0, _getRegion2['default'])(source);
|
4671 |
|
4672 | normalizeOffset(offset, elRegion);
|
4673 | normalizeOffset(targetOffset, tgtRegion);
|
4674 |
|
4675 | var elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
|
4676 |
|
4677 | var newElRegion = _utils2['default'].merge(elRegion, elFuturePos);
|
4678 |
|
4679 |
|
4680 | if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTgtRegionVisible) {
|
4681 | if (overflow.adjustX) {
|
4682 |
|
4683 | if (isFailX(elFuturePos, elRegion, visibleRect)) {
|
4684 |
|
4685 | var newPoints = flip(points, /[lr]/ig, {
|
4686 | l: 'r',
|
4687 | r: 'l'
|
4688 | });
|
4689 |
|
4690 | var newOffset = flipOffset(offset, 0);
|
4691 | var newTargetOffset = flipOffset(targetOffset, 0);
|
4692 | var newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, newPoints, newOffset, newTargetOffset);
|
4693 |
|
4694 | if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {
|
4695 | fail = 1;
|
4696 | points = newPoints;
|
4697 | offset = newOffset;
|
4698 | targetOffset = newTargetOffset;
|
4699 | }
|
4700 | }
|
4701 | }
|
4702 |
|
4703 | if (overflow.adjustY) {
|
4704 |
|
4705 | if (isFailY(elFuturePos, elRegion, visibleRect)) {
|
4706 |
|
4707 | var _newPoints = flip(points, /[tb]/ig, {
|
4708 | t: 'b',
|
4709 | b: 't'
|
4710 | });
|
4711 |
|
4712 | var _newOffset = flipOffset(offset, 1);
|
4713 | var _newTargetOffset = flipOffset(targetOffset, 1);
|
4714 | var _newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, _newPoints, _newOffset, _newTargetOffset);
|
4715 |
|
4716 | if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) {
|
4717 | fail = 1;
|
4718 | points = _newPoints;
|
4719 | offset = _newOffset;
|
4720 | targetOffset = _newTargetOffset;
|
4721 | }
|
4722 | }
|
4723 | }
|
4724 |
|
4725 |
|
4726 | if (fail) {
|
4727 | elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
|
4728 | _utils2['default'].mix(newElRegion, elFuturePos);
|
4729 | }
|
4730 | var isStillFailX = isFailX(elFuturePos, elRegion, visibleRect);
|
4731 | var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect);
|
4732 |
|
4733 |
|
4734 | if (isStillFailX || isStillFailY) {
|
4735 | points = align.points;
|
4736 | offset = align.offset || [0, 0];
|
4737 | targetOffset = align.targetOffset || [0, 0];
|
4738 | }
|
4739 |
|
4740 | newOverflowCfg.adjustX = overflow.adjustX && isStillFailX;
|
4741 | newOverflowCfg.adjustY = overflow.adjustY && isStillFailY;
|
4742 |
|
4743 |
|
4744 | if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) {
|
4745 | newElRegion = (0, _adjustForViewport2['default'])(elFuturePos, elRegion, visibleRect, newOverflowCfg);
|
4746 | }
|
4747 | }
|
4748 |
|
4749 |
|
4750 | if (newElRegion.width !== elRegion.width) {
|
4751 | _utils2['default'].css(source, 'width', _utils2['default'].width(source) + newElRegion.width - elRegion.width);
|
4752 | }
|
4753 |
|
4754 | if (newElRegion.height !== elRegion.height) {
|
4755 | _utils2['default'].css(source, 'height', _utils2['default'].height(source) + newElRegion.height - elRegion.height);
|
4756 | }
|
4757 |
|
4758 |
|
4759 |
|
4760 |
|
4761 | _utils2['default'].offset(source, {
|
4762 | left: newElRegion.left,
|
4763 | top: newElRegion.top
|
4764 | }, {
|
4765 | useCssRight: align.useCssRight,
|
4766 | useCssBottom: align.useCssBottom,
|
4767 | useCssTransform: align.useCssTransform,
|
4768 | ignoreShake: align.ignoreShake
|
4769 | });
|
4770 |
|
4771 | return {
|
4772 | points: points,
|
4773 | offset: offset,
|
4774 | targetOffset: targetOffset,
|
4775 | overflow: newOverflowCfg
|
4776 | };
|
4777 | }
|
4778 |
|
4779 | exports['default'] = doAlign;
|
4780 | |
4781 |
|
4782 |
|
4783 |
|
4784 |
|
4785 |
|
4786 |
|
4787 |
|
4788 |
|
4789 | module.exports = exports['default'];
|
4790 |
|
4791 | }),
|
4792 |
|
4793 | (function(module, exports, __webpack_require__) {
|
4794 |
|
4795 | 'use strict';
|
4796 |
|
4797 | Object.defineProperty(exports, "__esModule", {
|
4798 | value: true
|
4799 | });
|
4800 |
|
4801 | 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; };
|
4802 |
|
4803 | var _propertyUtils = __webpack_require__(55);
|
4804 |
|
4805 | var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
|
4806 |
|
4807 | var getComputedStyleX = void 0;
|
4808 |
|
4809 |
|
4810 | function forceRelayout(elem) {
|
4811 | var originalStyle = elem.style.display;
|
4812 | elem.style.display = 'none';
|
4813 | elem.offsetHeight;
|
4814 | elem.style.display = originalStyle;
|
4815 | }
|
4816 |
|
4817 | function css(el, name, v) {
|
4818 | var value = v;
|
4819 | if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
|
4820 | for (var i in name) {
|
4821 | if (name.hasOwnProperty(i)) {
|
4822 | css(el, i, name[i]);
|
4823 | }
|
4824 | }
|
4825 | return undefined;
|
4826 | }
|
4827 | if (typeof value !== 'undefined') {
|
4828 | if (typeof value === 'number') {
|
4829 | value = value + 'px';
|
4830 | }
|
4831 | el.style[name] = value;
|
4832 | return undefined;
|
4833 | }
|
4834 | return getComputedStyleX(el, name);
|
4835 | }
|
4836 |
|
4837 | function getClientPosition(elem) {
|
4838 | var box = void 0;
|
4839 | var x = void 0;
|
4840 | var y = void 0;
|
4841 | var doc = elem.ownerDocument;
|
4842 | var body = doc.body;
|
4843 | var docElem = doc && doc.documentElement;
|
4844 |
|
4845 | box = elem.getBoundingClientRect();
|
4846 |
|
4847 |
|
4848 |
|
4849 |
|
4850 |
|
4851 | x = box.left;
|
4852 | y = box.top;
|
4853 |
|
4854 |
|
4855 |
|
4856 |
|
4857 |
|
4858 |
|
4859 |
|
4860 |
|
4861 |
|
4862 |
|
4863 |
|
4864 |
|
4865 |
|
4866 |
|
4867 |
|
4868 |
|
4869 |
|
4870 |
|
4871 |
|
4872 |
|
4873 |
|
4874 | x -= docElem.clientLeft || body.clientLeft || 0;
|
4875 | y -= docElem.clientTop || body.clientTop || 0;
|
4876 |
|
4877 | return {
|
4878 | left: x,
|
4879 | top: y
|
4880 | };
|
4881 | }
|
4882 |
|
4883 | function getScroll(w, top) {
|
4884 | var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
|
4885 | var method = 'scroll' + (top ? 'Top' : 'Left');
|
4886 | if (typeof ret !== 'number') {
|
4887 | var d = w.document;
|
4888 |
|
4889 | ret = d.documentElement[method];
|
4890 | if (typeof ret !== 'number') {
|
4891 |
|
4892 | ret = d.body[method];
|
4893 | }
|
4894 | }
|
4895 | return ret;
|
4896 | }
|
4897 |
|
4898 | function getScrollLeft(w) {
|
4899 | return getScroll(w);
|
4900 | }
|
4901 |
|
4902 | function getScrollTop(w) {
|
4903 | return getScroll(w, true);
|
4904 | }
|
4905 |
|
4906 | function getOffset(el) {
|
4907 | var pos = getClientPosition(el);
|
4908 | var doc = el.ownerDocument;
|
4909 | var w = doc.defaultView || doc.parentWindow;
|
4910 | pos.left += getScrollLeft(w);
|
4911 | pos.top += getScrollTop(w);
|
4912 | return pos;
|
4913 | }
|
4914 |
|
4915 | |
4916 |
|
4917 |
|
4918 |
|
4919 | function isWindow(obj) {
|
4920 |
|
4921 |
|
4922 | return obj !== null && obj !== undefined && obj == obj.window;
|
4923 | }
|
4924 |
|
4925 | function getDocument(node) {
|
4926 | if (isWindow(node)) {
|
4927 | return node.document;
|
4928 | }
|
4929 | if (node.nodeType === 9) {
|
4930 | return node;
|
4931 | }
|
4932 | return node.ownerDocument;
|
4933 | }
|
4934 |
|
4935 | function _getComputedStyle(elem, name, cs) {
|
4936 | var computedStyle = cs;
|
4937 | var val = '';
|
4938 | var d = getDocument(elem);
|
4939 | computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null);
|
4940 |
|
4941 |
|
4942 | if (computedStyle) {
|
4943 | val = computedStyle.getPropertyValue(name) || computedStyle[name];
|
4944 | }
|
4945 |
|
4946 | return val;
|
4947 | }
|
4948 |
|
4949 | var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
|
4950 | var RE_POS = /^(top|right|bottom|left)$/;
|
4951 | var CURRENT_STYLE = 'currentStyle';
|
4952 | var RUNTIME_STYLE = 'runtimeStyle';
|
4953 | var LEFT = 'left';
|
4954 | var PX = 'px';
|
4955 |
|
4956 | function _getComputedStyleIE(elem, name) {
|
4957 |
|
4958 |
|
4959 | var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
|
4960 |
|
4961 |
|
4962 |
|
4963 |
|
4964 |
|
4965 |
|
4966 |
|
4967 |
|
4968 |
|
4969 |
|
4970 |
|
4971 | if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
|
4972 |
|
4973 | var style = elem.style;
|
4974 | var left = style[LEFT];
|
4975 | var rsLeft = elem[RUNTIME_STYLE][LEFT];
|
4976 |
|
4977 |
|
4978 | elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
|
4979 |
|
4980 |
|
4981 | style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
|
4982 | ret = style.pixelLeft + PX;
|
4983 |
|
4984 |
|
4985 | style[LEFT] = left;
|
4986 |
|
4987 | elem[RUNTIME_STYLE][LEFT] = rsLeft;
|
4988 | }
|
4989 | return ret === '' ? 'auto' : ret;
|
4990 | }
|
4991 |
|
4992 | if (typeof window !== 'undefined') {
|
4993 | getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
|
4994 | }
|
4995 |
|
4996 | function getOffsetDirection(dir, option) {
|
4997 | if (dir === 'left') {
|
4998 | return option.useCssRight ? 'right' : dir;
|
4999 | }
|
5000 | return option.useCssBottom ? 'bottom' : dir;
|
5001 | }
|
5002 |
|
5003 | function oppositeOffsetDirection(dir) {
|
5004 | if (dir === 'left') {
|
5005 | return 'right';
|
5006 | } else if (dir === 'right') {
|
5007 | return 'left';
|
5008 | } else if (dir === 'top') {
|
5009 | return 'bottom';
|
5010 | } else if (dir === 'bottom') {
|
5011 | return 'top';
|
5012 | }
|
5013 | }
|
5014 |
|
5015 |
|
5016 | function setLeftTop(elem, offset, option) {
|
5017 |
|
5018 | if (css(elem, 'position') === 'static') {
|
5019 | elem.style.position = 'relative';
|
5020 | }
|
5021 | var presetH = -999;
|
5022 | var presetV = -999;
|
5023 | var horizontalProperty = getOffsetDirection('left', option);
|
5024 | var verticalProperty = getOffsetDirection('top', option);
|
5025 | var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
|
5026 | var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);
|
5027 |
|
5028 | if (horizontalProperty !== 'left') {
|
5029 | presetH = 999;
|
5030 | }
|
5031 |
|
5032 | if (verticalProperty !== 'top') {
|
5033 | presetV = 999;
|
5034 | }
|
5035 | var originalTransition = '';
|
5036 | var originalOffset = getOffset(elem);
|
5037 | if ('left' in offset || 'top' in offset) {
|
5038 | originalTransition = (0, _propertyUtils.getTransitionProperty)(elem) || '';
|
5039 | (0, _propertyUtils.setTransitionProperty)(elem, 'none');
|
5040 | }
|
5041 | if ('left' in offset) {
|
5042 | elem.style[oppositeHorizontalProperty] = '';
|
5043 | elem.style[horizontalProperty] = presetH + 'px';
|
5044 | }
|
5045 | if ('top' in offset) {
|
5046 | elem.style[oppositeVerticalProperty] = '';
|
5047 | elem.style[verticalProperty] = presetV + 'px';
|
5048 | }
|
5049 |
|
5050 | forceRelayout(elem);
|
5051 | var old = getOffset(elem);
|
5052 | var originalStyle = {};
|
5053 | for (var key in offset) {
|
5054 | if (offset.hasOwnProperty(key)) {
|
5055 | var dir = getOffsetDirection(key, option);
|
5056 | var preset = key === 'left' ? presetH : presetV;
|
5057 | var off = originalOffset[key] - old[key];
|
5058 | if (dir === key) {
|
5059 | originalStyle[dir] = preset + off;
|
5060 | } else {
|
5061 | originalStyle[dir] = preset - off;
|
5062 | }
|
5063 | }
|
5064 | }
|
5065 | css(elem, originalStyle);
|
5066 |
|
5067 | forceRelayout(elem);
|
5068 | if ('left' in offset || 'top' in offset) {
|
5069 | (0, _propertyUtils.setTransitionProperty)(elem, originalTransition);
|
5070 | }
|
5071 | var ret = {};
|
5072 | for (var _key in offset) {
|
5073 | if (offset.hasOwnProperty(_key)) {
|
5074 | var _dir = getOffsetDirection(_key, option);
|
5075 | var _off = offset[_key] - originalOffset[_key];
|
5076 | if (_key === _dir) {
|
5077 | ret[_dir] = originalStyle[_dir] + _off;
|
5078 | } else {
|
5079 | ret[_dir] = originalStyle[_dir] - _off;
|
5080 | }
|
5081 | }
|
5082 | }
|
5083 | css(elem, ret);
|
5084 | }
|
5085 |
|
5086 | function setTransform(elem, offset) {
|
5087 | var originalOffset = getOffset(elem);
|
5088 | var originalXY = (0, _propertyUtils.getTransformXY)(elem);
|
5089 | var resultXY = { x: originalXY.x, y: originalXY.y };
|
5090 | if ('left' in offset) {
|
5091 | resultXY.x = originalXY.x + offset.left - originalOffset.left;
|
5092 | }
|
5093 | if ('top' in offset) {
|
5094 | resultXY.y = originalXY.y + offset.top - originalOffset.top;
|
5095 | }
|
5096 | (0, _propertyUtils.setTransformXY)(elem, resultXY);
|
5097 | }
|
5098 |
|
5099 | function setOffset(elem, offset, option) {
|
5100 | if (option.ignoreShake) {
|
5101 | var oriOffset = getOffset(elem);
|
5102 |
|
5103 | var oLeft = oriOffset.left.toFixed(0);
|
5104 | var oTop = oriOffset.top.toFixed(0);
|
5105 | var tLeft = offset.left.toFixed(0);
|
5106 | var tTop = offset.top.toFixed(0);
|
5107 |
|
5108 | if (oLeft === tLeft && oTop === tTop) {
|
5109 | return;
|
5110 | }
|
5111 | }
|
5112 |
|
5113 | if (option.useCssRight || option.useCssBottom) {
|
5114 | setLeftTop(elem, offset, option);
|
5115 | } else if (option.useCssTransform && (0, _propertyUtils.getTransformName)() in document.body.style) {
|
5116 | setTransform(elem, offset, option);
|
5117 | } else {
|
5118 | setLeftTop(elem, offset, option);
|
5119 | }
|
5120 | }
|
5121 |
|
5122 | function each(arr, fn) {
|
5123 | for (var i = 0; i < arr.length; i++) {
|
5124 | fn(arr[i]);
|
5125 | }
|
5126 | }
|
5127 |
|
5128 | function isBorderBoxFn(elem) {
|
5129 | return getComputedStyleX(elem, 'boxSizing') === 'border-box';
|
5130 | }
|
5131 |
|
5132 | var BOX_MODELS = ['margin', 'border', 'padding'];
|
5133 | var CONTENT_INDEX = -1;
|
5134 | var PADDING_INDEX = 2;
|
5135 | var BORDER_INDEX = 1;
|
5136 | var MARGIN_INDEX = 0;
|
5137 |
|
5138 | function swap(elem, options, callback) {
|
5139 | var old = {};
|
5140 | var style = elem.style;
|
5141 | var name = void 0;
|
5142 |
|
5143 |
|
5144 | for (name in options) {
|
5145 | if (options.hasOwnProperty(name)) {
|
5146 | old[name] = style[name];
|
5147 | style[name] = options[name];
|
5148 | }
|
5149 | }
|
5150 |
|
5151 | callback.call(elem);
|
5152 |
|
5153 |
|
5154 | for (name in options) {
|
5155 | if (options.hasOwnProperty(name)) {
|
5156 | style[name] = old[name];
|
5157 | }
|
5158 | }
|
5159 | }
|
5160 |
|
5161 | function getPBMWidth(elem, props, which) {
|
5162 | var value = 0;
|
5163 | var prop = void 0;
|
5164 | var j = void 0;
|
5165 | var i = void 0;
|
5166 | for (j = 0; j < props.length; j++) {
|
5167 | prop = props[j];
|
5168 | if (prop) {
|
5169 | for (i = 0; i < which.length; i++) {
|
5170 | var cssProp = void 0;
|
5171 | if (prop === 'border') {
|
5172 | cssProp = '' + prop + which[i] + 'Width';
|
5173 | } else {
|
5174 | cssProp = prop + which[i];
|
5175 | }
|
5176 | value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
|
5177 | }
|
5178 | }
|
5179 | }
|
5180 | return value;
|
5181 | }
|
5182 |
|
5183 | var domUtils = {};
|
5184 |
|
5185 | each(['Width', 'Height'], function (name) {
|
5186 | domUtils['doc' + name] = function (refWin) {
|
5187 | var d = refWin.document;
|
5188 | return Math.max(
|
5189 |
|
5190 |
|
5191 | d.documentElement['scroll' + name],
|
5192 |
|
5193 | d.body['scroll' + name], domUtils['viewport' + name](d));
|
5194 | };
|
5195 |
|
5196 | domUtils['viewport' + name] = function (win) {
|
5197 |
|
5198 | var prop = 'client' + name;
|
5199 | var doc = win.document;
|
5200 | var body = doc.body;
|
5201 | var documentElement = doc.documentElement;
|
5202 | var documentElementProp = documentElement[prop];
|
5203 |
|
5204 |
|
5205 | return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
|
5206 | };
|
5207 | });
|
5208 |
|
5209 | |
5210 |
|
5211 |
|
5212 |
|
5213 |
|
5214 |
|
5215 |
|
5216 |
|
5217 | function getWH(elem, name, ex) {
|
5218 | var extra = ex;
|
5219 | if (isWindow(elem)) {
|
5220 | return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
|
5221 | } else if (elem.nodeType === 9) {
|
5222 | return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
|
5223 | }
|
5224 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
5225 | var borderBoxValue = name === 'width' ? elem.getBoundingClientRect().width : elem.getBoundingClientRect().height;
|
5226 | var computedStyle = getComputedStyleX(elem);
|
5227 | var isBorderBox = isBorderBoxFn(elem, computedStyle);
|
5228 | var cssBoxValue = 0;
|
5229 | if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) {
|
5230 | borderBoxValue = undefined;
|
5231 |
|
5232 | cssBoxValue = getComputedStyleX(elem, name);
|
5233 | if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) {
|
5234 | cssBoxValue = elem.style[name] || 0;
|
5235 | }
|
5236 |
|
5237 | cssBoxValue = parseFloat(cssBoxValue) || 0;
|
5238 | }
|
5239 | if (extra === undefined) {
|
5240 | extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
|
5241 | }
|
5242 | var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
|
5243 | var val = borderBoxValue || cssBoxValue;
|
5244 | if (extra === CONTENT_INDEX) {
|
5245 | if (borderBoxValueOrIsBorderBox) {
|
5246 | return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
|
5247 | }
|
5248 | return cssBoxValue;
|
5249 | } else if (borderBoxValueOrIsBorderBox) {
|
5250 | if (extra === BORDER_INDEX) {
|
5251 | return val;
|
5252 | }
|
5253 | return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle));
|
5254 | }
|
5255 | return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
|
5256 | }
|
5257 |
|
5258 | var cssShow = {
|
5259 | position: 'absolute',
|
5260 | visibility: 'hidden',
|
5261 | display: 'block'
|
5262 | };
|
5263 |
|
5264 |
|
5265 | function getWHIgnoreDisplay() {
|
5266 | for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
5267 | args[_key2] = arguments[_key2];
|
5268 | }
|
5269 |
|
5270 | var val = void 0;
|
5271 | var elem = args[0];
|
5272 |
|
5273 |
|
5274 | if (elem.offsetWidth !== 0) {
|
5275 | val = getWH.apply(undefined, args);
|
5276 | } else {
|
5277 | swap(elem, cssShow, function () {
|
5278 | val = getWH.apply(undefined, args);
|
5279 | });
|
5280 | }
|
5281 | return val;
|
5282 | }
|
5283 |
|
5284 | each(['width', 'height'], function (name) {
|
5285 | var first = name.charAt(0).toUpperCase() + name.slice(1);
|
5286 | domUtils['outer' + first] = function (el, includeMargin) {
|
5287 | return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
|
5288 | };
|
5289 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
5290 |
|
5291 | domUtils[name] = function (elem, v) {
|
5292 | var val = v;
|
5293 | if (val !== undefined) {
|
5294 | if (elem) {
|
5295 | var computedStyle = getComputedStyleX(elem);
|
5296 | var isBorderBox = isBorderBoxFn(elem);
|
5297 | if (isBorderBox) {
|
5298 | val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
|
5299 | }
|
5300 | return css(elem, name, val);
|
5301 | }
|
5302 | return undefined;
|
5303 | }
|
5304 | return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
|
5305 | };
|
5306 | });
|
5307 |
|
5308 | function mix(to, from) {
|
5309 | for (var i in from) {
|
5310 | if (from.hasOwnProperty(i)) {
|
5311 | to[i] = from[i];
|
5312 | }
|
5313 | }
|
5314 | return to;
|
5315 | }
|
5316 |
|
5317 | var utils = {
|
5318 | getWindow: function getWindow(node) {
|
5319 | if (node && node.document && node.setTimeout) {
|
5320 | return node;
|
5321 | }
|
5322 | var doc = node.ownerDocument || node;
|
5323 | return doc.defaultView || doc.parentWindow;
|
5324 | },
|
5325 |
|
5326 | getDocument: getDocument,
|
5327 | offset: function offset(el, value, option) {
|
5328 | if (typeof value !== 'undefined') {
|
5329 | setOffset(el, value, option || {});
|
5330 | } else {
|
5331 | return getOffset(el);
|
5332 | }
|
5333 | },
|
5334 |
|
5335 | isWindow: isWindow,
|
5336 | each: each,
|
5337 | css: css,
|
5338 | clone: function clone(obj) {
|
5339 | var i = void 0;
|
5340 | var ret = {};
|
5341 | for (i in obj) {
|
5342 | if (obj.hasOwnProperty(i)) {
|
5343 | ret[i] = obj[i];
|
5344 | }
|
5345 | }
|
5346 | var overflow = obj.overflow;
|
5347 | if (overflow) {
|
5348 | for (i in obj) {
|
5349 | if (obj.hasOwnProperty(i)) {
|
5350 | ret.overflow[i] = obj.overflow[i];
|
5351 | }
|
5352 | }
|
5353 | }
|
5354 | return ret;
|
5355 | },
|
5356 |
|
5357 | mix: mix,
|
5358 | getWindowScrollLeft: function getWindowScrollLeft(w) {
|
5359 | return getScrollLeft(w);
|
5360 | },
|
5361 | getWindowScrollTop: function getWindowScrollTop(w) {
|
5362 | return getScrollTop(w);
|
5363 | },
|
5364 | merge: function merge() {
|
5365 | var ret = {};
|
5366 |
|
5367 | for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
|
5368 | args[_key3] = arguments[_key3];
|
5369 | }
|
5370 |
|
5371 | for (var i = 0; i < args.length; i++) {
|
5372 | utils.mix(ret, args[i]);
|
5373 | }
|
5374 | return ret;
|
5375 | },
|
5376 |
|
5377 | viewportWidth: 0,
|
5378 | viewportHeight: 0
|
5379 | };
|
5380 |
|
5381 | mix(utils, domUtils);
|
5382 |
|
5383 | exports['default'] = utils;
|
5384 | module.exports = exports['default'];
|
5385 |
|
5386 | }),
|
5387 |
|
5388 | (function(module, exports) {
|
5389 |
|
5390 | 'use strict';
|
5391 |
|
5392 | Object.defineProperty(exports, "__esModule", {
|
5393 | value: true
|
5394 | });
|
5395 | exports.getTransformName = getTransformName;
|
5396 | exports.setTransitionProperty = setTransitionProperty;
|
5397 | exports.getTransitionProperty = getTransitionProperty;
|
5398 | exports.getTransformXY = getTransformXY;
|
5399 | exports.setTransformXY = setTransformXY;
|
5400 | var vendorPrefix = void 0;
|
5401 |
|
5402 | var jsCssMap = {
|
5403 | Webkit: '-webkit-',
|
5404 | Moz: '-moz-',
|
5405 |
|
5406 | ms: '-ms-',
|
5407 | O: '-o-'
|
5408 | };
|
5409 |
|
5410 | function getVendorPrefix() {
|
5411 | if (vendorPrefix !== undefined) {
|
5412 | return vendorPrefix;
|
5413 | }
|
5414 | vendorPrefix = '';
|
5415 | var style = document.createElement('p').style;
|
5416 | var testProp = 'Transform';
|
5417 | for (var key in jsCssMap) {
|
5418 | if (key + testProp in style) {
|
5419 | vendorPrefix = key;
|
5420 | }
|
5421 | }
|
5422 | return vendorPrefix;
|
5423 | }
|
5424 |
|
5425 | function getTransitionName() {
|
5426 | return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty';
|
5427 | }
|
5428 |
|
5429 | function getTransformName() {
|
5430 | return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform';
|
5431 | }
|
5432 |
|
5433 | function setTransitionProperty(node, value) {
|
5434 | var name = getTransitionName();
|
5435 | if (name) {
|
5436 | node.style[name] = value;
|
5437 | if (name !== 'transitionProperty') {
|
5438 | node.style.transitionProperty = value;
|
5439 | }
|
5440 | }
|
5441 | }
|
5442 |
|
5443 | function setTransform(node, value) {
|
5444 | var name = getTransformName();
|
5445 | if (name) {
|
5446 | node.style[name] = value;
|
5447 | if (name !== 'transform') {
|
5448 | node.style.transform = value;
|
5449 | }
|
5450 | }
|
5451 | }
|
5452 |
|
5453 | function getTransitionProperty(node) {
|
5454 | return node.style.transitionProperty || node.style[getTransitionName()];
|
5455 | }
|
5456 |
|
5457 | function getTransformXY(node) {
|
5458 | var style = window.getComputedStyle(node, null);
|
5459 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
5460 | if (transform && transform !== 'none') {
|
5461 | var matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
|
5462 | return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) };
|
5463 | }
|
5464 | return {
|
5465 | x: 0,
|
5466 | y: 0
|
5467 | };
|
5468 | }
|
5469 |
|
5470 | var matrix2d = /matrix\((.*)\)/;
|
5471 | var matrix3d = /matrix3d\((.*)\)/;
|
5472 |
|
5473 | function setTransformXY(node, xy) {
|
5474 | var style = window.getComputedStyle(node, null);
|
5475 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
5476 | if (transform && transform !== 'none') {
|
5477 | var arr = void 0;
|
5478 | var match2d = transform.match(matrix2d);
|
5479 | if (match2d) {
|
5480 | match2d = match2d[1];
|
5481 | arr = match2d.split(',').map(function (item) {
|
5482 | return parseFloat(item, 10);
|
5483 | });
|
5484 | arr[4] = xy.x;
|
5485 | arr[5] = xy.y;
|
5486 | setTransform(node, 'matrix(' + arr.join(',') + ')');
|
5487 | } else {
|
5488 | var match3d = transform.match(matrix3d)[1];
|
5489 | arr = match3d.split(',').map(function (item) {
|
5490 | return parseFloat(item, 10);
|
5491 | });
|
5492 | arr[12] = xy.x;
|
5493 | arr[13] = xy.y;
|
5494 | setTransform(node, 'matrix3d(' + arr.join(',') + ')');
|
5495 | }
|
5496 | } else {
|
5497 | setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)');
|
5498 | }
|
5499 | }
|
5500 |
|
5501 | }),
|
5502 |
|
5503 | (function(module, exports, __webpack_require__) {
|
5504 |
|
5505 | 'use strict';
|
5506 |
|
5507 | Object.defineProperty(exports, "__esModule", {
|
5508 | value: true
|
5509 | });
|
5510 |
|
5511 | var _utils = __webpack_require__(54);
|
5512 |
|
5513 | var _utils2 = _interopRequireDefault(_utils);
|
5514 |
|
5515 | var _getOffsetParent = __webpack_require__(57);
|
5516 |
|
5517 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
|
5518 |
|
5519 | var _isAncestorFixed = __webpack_require__(58);
|
5520 |
|
5521 | var _isAncestorFixed2 = _interopRequireDefault(_isAncestorFixed);
|
5522 |
|
5523 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5524 |
|
5525 | |
5526 |
|
5527 |
|
5528 | function getVisibleRectForElement(element) {
|
5529 | var visibleRect = {
|
5530 | left: 0,
|
5531 | right: Infinity,
|
5532 | top: 0,
|
5533 | bottom: Infinity
|
5534 | };
|
5535 | var el = (0, _getOffsetParent2['default'])(element);
|
5536 | var doc = _utils2['default'].getDocument(element);
|
5537 | var win = doc.defaultView || doc.parentWindow;
|
5538 | var body = doc.body;
|
5539 | var documentElement = doc.documentElement;
|
5540 |
|
5541 |
|
5542 |
|
5543 | while (el) {
|
5544 |
|
5545 | if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) &&
|
5546 |
|
5547 |
|
5548 |
|
5549 | el !== body && el !== documentElement && _utils2['default'].css(el, 'overflow') !== 'visible') {
|
5550 | var pos = _utils2['default'].offset(el);
|
5551 |
|
5552 | pos.left += el.clientLeft;
|
5553 | pos.top += el.clientTop;
|
5554 | visibleRect.top = Math.max(visibleRect.top, pos.top);
|
5555 | visibleRect.right = Math.min(visibleRect.right,
|
5556 |
|
5557 | pos.left + el.clientWidth);
|
5558 | visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight);
|
5559 | visibleRect.left = Math.max(visibleRect.left, pos.left);
|
5560 | } else if (el === body || el === documentElement) {
|
5561 | break;
|
5562 | }
|
5563 | el = (0, _getOffsetParent2['default'])(el);
|
5564 | }
|
5565 |
|
5566 |
|
5567 |
|
5568 |
|
5569 | var originalPosition = null;
|
5570 | if (!_utils2['default'].isWindow(element) && element.nodeType !== 9) {
|
5571 | originalPosition = element.style.position;
|
5572 | var position = _utils2['default'].css(element, 'position');
|
5573 | if (position === 'absolute') {
|
5574 | element.style.position = 'fixed';
|
5575 | }
|
5576 | }
|
5577 |
|
5578 | var scrollX = _utils2['default'].getWindowScrollLeft(win);
|
5579 | var scrollY = _utils2['default'].getWindowScrollTop(win);
|
5580 | var viewportWidth = _utils2['default'].viewportWidth(win);
|
5581 | var viewportHeight = _utils2['default'].viewportHeight(win);
|
5582 | var documentWidth = documentElement.scrollWidth;
|
5583 | var documentHeight = documentElement.scrollHeight;
|
5584 |
|
5585 |
|
5586 |
|
5587 | var bodyStyle = window.getComputedStyle(body);
|
5588 | if (bodyStyle.overflowX === 'hidden') {
|
5589 | documentWidth = win.innerWidth;
|
5590 | }
|
5591 | if (bodyStyle.overflowY === 'hidden') {
|
5592 | documentHeight = win.innerHeight;
|
5593 | }
|
5594 |
|
5595 |
|
5596 | if (element.style) {
|
5597 | element.style.position = originalPosition;
|
5598 | }
|
5599 |
|
5600 | if ((0, _isAncestorFixed2['default'])(element)) {
|
5601 |
|
5602 | visibleRect.left = Math.max(visibleRect.left, scrollX);
|
5603 | visibleRect.top = Math.max(visibleRect.top, scrollY);
|
5604 | visibleRect.right = Math.min(visibleRect.right, scrollX + viewportWidth);
|
5605 | visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + viewportHeight);
|
5606 | } else {
|
5607 |
|
5608 | var maxVisibleWidth = Math.max(documentWidth, scrollX + viewportWidth);
|
5609 | visibleRect.right = Math.min(visibleRect.right, maxVisibleWidth);
|
5610 |
|
5611 | var maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight);
|
5612 | visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight);
|
5613 | }
|
5614 |
|
5615 | return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;
|
5616 | }
|
5617 |
|
5618 | exports['default'] = getVisibleRectForElement;
|
5619 | module.exports = exports['default'];
|
5620 |
|
5621 | }),
|
5622 |
|
5623 | (function(module, exports, __webpack_require__) {
|
5624 |
|
5625 | 'use strict';
|
5626 |
|
5627 | Object.defineProperty(exports, "__esModule", {
|
5628 | value: true
|
5629 | });
|
5630 |
|
5631 | var _utils = __webpack_require__(54);
|
5632 |
|
5633 | var _utils2 = _interopRequireDefault(_utils);
|
5634 |
|
5635 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5636 |
|
5637 | |
5638 |
|
5639 |
|
5640 |
|
5641 | function getOffsetParent(element) {
|
5642 | if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
|
5643 | return null;
|
5644 | }
|
5645 |
|
5646 | |
5647 |
|
5648 |
|
5649 |
|
5650 |
|
5651 |
|
5652 |
|
5653 |
|
5654 |
|
5655 |
|
5656 |
|
5657 |
|
5658 |
|
5659 |
|
5660 | var doc = _utils2['default'].getDocument(element);
|
5661 | var body = doc.body;
|
5662 | var parent = void 0;
|
5663 | var positionStyle = _utils2['default'].css(element, 'position');
|
5664 | var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute';
|
5665 |
|
5666 | if (!skipStatic) {
|
5667 | return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode;
|
5668 | }
|
5669 |
|
5670 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
|
5671 | positionStyle = _utils2['default'].css(parent, 'position');
|
5672 | if (positionStyle !== 'static') {
|
5673 | return parent;
|
5674 | }
|
5675 | }
|
5676 | return null;
|
5677 | }
|
5678 |
|
5679 | exports['default'] = getOffsetParent;
|
5680 | module.exports = exports['default'];
|
5681 |
|
5682 | }),
|
5683 |
|
5684 | (function(module, exports, __webpack_require__) {
|
5685 |
|
5686 | 'use strict';
|
5687 |
|
5688 | Object.defineProperty(exports, "__esModule", {
|
5689 | value: true
|
5690 | });
|
5691 | exports['default'] = isAncestorFixed;
|
5692 |
|
5693 | var _utils = __webpack_require__(54);
|
5694 |
|
5695 | var _utils2 = _interopRequireDefault(_utils);
|
5696 |
|
5697 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5698 |
|
5699 | function isAncestorFixed(element) {
|
5700 | if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
|
5701 | return false;
|
5702 | }
|
5703 |
|
5704 | var doc = _utils2['default'].getDocument(element);
|
5705 | var body = doc.body;
|
5706 | var parent = null;
|
5707 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
|
5708 | var positionStyle = _utils2['default'].css(parent, 'position');
|
5709 | if (positionStyle === 'fixed') {
|
5710 | return true;
|
5711 | }
|
5712 | }
|
5713 | return false;
|
5714 | }
|
5715 | module.exports = exports['default'];
|
5716 |
|
5717 | }),
|
5718 |
|
5719 | (function(module, exports, __webpack_require__) {
|
5720 |
|
5721 | 'use strict';
|
5722 |
|
5723 | Object.defineProperty(exports, "__esModule", {
|
5724 | value: true
|
5725 | });
|
5726 |
|
5727 | var _utils = __webpack_require__(54);
|
5728 |
|
5729 | var _utils2 = _interopRequireDefault(_utils);
|
5730 |
|
5731 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5732 |
|
5733 | function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {
|
5734 | var pos = _utils2['default'].clone(elFuturePos);
|
5735 | var size = {
|
5736 | width: elRegion.width,
|
5737 | height: elRegion.height
|
5738 | };
|
5739 |
|
5740 | if (overflow.adjustX && pos.left < visibleRect.left) {
|
5741 | pos.left = visibleRect.left;
|
5742 | }
|
5743 |
|
5744 |
|
5745 | if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) {
|
5746 | size.width -= pos.left + size.width - visibleRect.right;
|
5747 | }
|
5748 |
|
5749 |
|
5750 | if (overflow.adjustX && pos.left + size.width > visibleRect.right) {
|
5751 |
|
5752 | pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);
|
5753 | }
|
5754 |
|
5755 |
|
5756 | if (overflow.adjustY && pos.top < visibleRect.top) {
|
5757 | pos.top = visibleRect.top;
|
5758 | }
|
5759 |
|
5760 |
|
5761 | if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) {
|
5762 | size.height -= pos.top + size.height - visibleRect.bottom;
|
5763 | }
|
5764 |
|
5765 |
|
5766 | if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {
|
5767 |
|
5768 | pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);
|
5769 | }
|
5770 |
|
5771 | return _utils2['default'].mix(pos, size);
|
5772 | }
|
5773 |
|
5774 | exports['default'] = adjustForViewport;
|
5775 | module.exports = exports['default'];
|
5776 |
|
5777 | }),
|
5778 |
|
5779 | (function(module, exports, __webpack_require__) {
|
5780 |
|
5781 | 'use strict';
|
5782 |
|
5783 | Object.defineProperty(exports, "__esModule", {
|
5784 | value: true
|
5785 | });
|
5786 |
|
5787 | var _utils = __webpack_require__(54);
|
5788 |
|
5789 | var _utils2 = _interopRequireDefault(_utils);
|
5790 |
|
5791 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5792 |
|
5793 | function getRegion(node) {
|
5794 | var offset = void 0;
|
5795 | var w = void 0;
|
5796 | var h = void 0;
|
5797 | if (!_utils2['default'].isWindow(node) && node.nodeType !== 9) {
|
5798 | offset = _utils2['default'].offset(node);
|
5799 | w = _utils2['default'].outerWidth(node);
|
5800 | h = _utils2['default'].outerHeight(node);
|
5801 | } else {
|
5802 | var win = _utils2['default'].getWindow(node);
|
5803 | offset = {
|
5804 | left: _utils2['default'].getWindowScrollLeft(win),
|
5805 | top: _utils2['default'].getWindowScrollTop(win)
|
5806 | };
|
5807 | w = _utils2['default'].viewportWidth(win);
|
5808 | h = _utils2['default'].viewportHeight(win);
|
5809 | }
|
5810 | offset.width = w;
|
5811 | offset.height = h;
|
5812 | return offset;
|
5813 | }
|
5814 |
|
5815 | exports['default'] = getRegion;
|
5816 | module.exports = exports['default'];
|
5817 |
|
5818 | }),
|
5819 |
|
5820 | (function(module, exports, __webpack_require__) {
|
5821 |
|
5822 | 'use strict';
|
5823 |
|
5824 | Object.defineProperty(exports, "__esModule", {
|
5825 | value: true
|
5826 | });
|
5827 |
|
5828 | var _getAlignOffset = __webpack_require__(62);
|
5829 |
|
5830 | var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset);
|
5831 |
|
5832 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5833 |
|
5834 | function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {
|
5835 | var p1 = (0, _getAlignOffset2['default'])(refNodeRegion, points[1]);
|
5836 | var p2 = (0, _getAlignOffset2['default'])(elRegion, points[0]);
|
5837 | var diff = [p2.left - p1.left, p2.top - p1.top];
|
5838 |
|
5839 | return {
|
5840 | left: elRegion.left - diff[0] + offset[0] - targetOffset[0],
|
5841 | top: elRegion.top - diff[1] + offset[1] - targetOffset[1]
|
5842 | };
|
5843 | }
|
5844 |
|
5845 | exports['default'] = getElFuturePos;
|
5846 | module.exports = exports['default'];
|
5847 |
|
5848 | }),
|
5849 |
|
5850 | (function(module, exports) {
|
5851 |
|
5852 | 'use strict';
|
5853 |
|
5854 | Object.defineProperty(exports, "__esModule", {
|
5855 | value: true
|
5856 | });
|
5857 | |
5858 |
|
5859 |
|
5860 |
|
5861 | function getAlignOffset(region, align) {
|
5862 | var V = align.charAt(0);
|
5863 | var H = align.charAt(1);
|
5864 | var w = region.width;
|
5865 | var h = region.height;
|
5866 |
|
5867 | var x = region.left;
|
5868 | var y = region.top;
|
5869 |
|
5870 | if (V === 'c') {
|
5871 | y += h / 2;
|
5872 | } else if (V === 'b') {
|
5873 | y += h;
|
5874 | }
|
5875 |
|
5876 | if (H === 'c') {
|
5877 | x += w / 2;
|
5878 | } else if (H === 'r') {
|
5879 | x += w;
|
5880 | }
|
5881 |
|
5882 | return {
|
5883 | left: x,
|
5884 | top: y
|
5885 | };
|
5886 | }
|
5887 |
|
5888 | exports['default'] = getAlignOffset;
|
5889 | module.exports = exports['default'];
|
5890 |
|
5891 | }),
|
5892 |
|
5893 | (function(module, exports, __webpack_require__) {
|
5894 |
|
5895 | 'use strict';
|
5896 |
|
5897 | Object.defineProperty(exports, "__esModule", {
|
5898 | value: true
|
5899 | });
|
5900 |
|
5901 | 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; };
|
5902 |
|
5903 | var _utils = __webpack_require__(54);
|
5904 |
|
5905 | var _utils2 = _interopRequireDefault(_utils);
|
5906 |
|
5907 | var _align = __webpack_require__(53);
|
5908 |
|
5909 | var _align2 = _interopRequireDefault(_align);
|
5910 |
|
5911 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5912 |
|
5913 | |
5914 |
|
5915 |
|
5916 |
|
5917 |
|
5918 | function alignPoint(el, tgtPoint, align) {
|
5919 | var pageX = void 0;
|
5920 | var pageY = void 0;
|
5921 |
|
5922 | var doc = _utils2['default'].getDocument(el);
|
5923 | var win = doc.defaultView || doc.parentWindow;
|
5924 |
|
5925 | var scrollX = _utils2['default'].getWindowScrollLeft(win);
|
5926 | var scrollY = _utils2['default'].getWindowScrollTop(win);
|
5927 | var viewportWidth = _utils2['default'].viewportWidth(win);
|
5928 | var viewportHeight = _utils2['default'].viewportHeight(win);
|
5929 |
|
5930 | if ('pageX' in tgtPoint) {
|
5931 | pageX = tgtPoint.pageX;
|
5932 | } else {
|
5933 | pageX = scrollX + tgtPoint.clientX;
|
5934 | }
|
5935 |
|
5936 | if ('pageY' in tgtPoint) {
|
5937 | pageY = tgtPoint.pageY;
|
5938 | } else {
|
5939 | pageY = scrollY + tgtPoint.clientY;
|
5940 | }
|
5941 |
|
5942 | var tgtRegion = {
|
5943 | left: pageX,
|
5944 | top: pageY,
|
5945 | width: 0,
|
5946 | height: 0
|
5947 | };
|
5948 |
|
5949 | var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight;
|
5950 |
|
5951 |
|
5952 | var points = [align.points[0], 'cc'];
|
5953 |
|
5954 | return (0, _align2['default'])(el, tgtRegion, _extends({}, align, { points: points }), pointInView);
|
5955 | }
|
5956 |
|
5957 | exports['default'] = alignPoint;
|
5958 | module.exports = exports['default'];
|
5959 |
|
5960 | }),
|
5961 |
|
5962 | (function(module, exports, __webpack_require__) {
|
5963 |
|
5964 | 'use strict';
|
5965 |
|
5966 | Object.defineProperty(exports, "__esModule", {
|
5967 | value: true
|
5968 | });
|
5969 |
|
5970 | 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; };
|
5971 |
|
5972 | var _classnames = __webpack_require__(3);
|
5973 |
|
5974 | var _classnames2 = _interopRequireDefault(_classnames);
|
5975 |
|
5976 | var _react = __webpack_require__(4);
|
5977 |
|
5978 | var _react2 = _interopRequireDefault(_react);
|
5979 |
|
5980 | var _propTypes = __webpack_require__(5);
|
5981 |
|
5982 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
5983 |
|
5984 | var _Transition = __webpack_require__(11);
|
5985 |
|
5986 | var _Transition2 = _interopRequireDefault(_Transition);
|
5987 |
|
5988 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
5989 |
|
5990 | 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; }
|
5991 |
|
5992 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
5993 |
|
5994 | 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; }
|
5995 |
|
5996 | 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); }
|
5997 |
|
5998 | var propTypes = {
|
5999 | |
6000 |
|
6001 |
|
6002 | "in": _propTypes2["default"].bool,
|
6003 |
|
6004 | |
6005 |
|
6006 |
|
6007 | unmountOnExit: _propTypes2["default"].bool,
|
6008 |
|
6009 | |
6010 |
|
6011 |
|
6012 |
|
6013 | transitionAppear: _propTypes2["default"].bool,
|
6014 |
|
6015 | |
6016 |
|
6017 |
|
6018 |
|
6019 |
|
6020 | timeout: _propTypes2["default"].number,
|
6021 |
|
6022 | |
6023 |
|
6024 |
|
6025 | onEnter: _propTypes2["default"].func,
|
6026 | |
6027 |
|
6028 |
|
6029 | onEntering: _propTypes2["default"].func,
|
6030 | |
6031 |
|
6032 |
|
6033 | onEntered: _propTypes2["default"].func,
|
6034 | |
6035 |
|
6036 |
|
6037 | onExit: _propTypes2["default"].func,
|
6038 | |
6039 |
|
6040 |
|
6041 | onExiting: _propTypes2["default"].func,
|
6042 | |
6043 |
|
6044 |
|
6045 | onExited: _propTypes2["default"].func
|
6046 | };
|
6047 |
|
6048 | var defaultProps = {
|
6049 | "in": false,
|
6050 | timeout: 300,
|
6051 | unmountOnExit: false,
|
6052 | transitionAppear: false
|
6053 | };
|
6054 |
|
6055 | var Fade = function (_React$Component) {
|
6056 | _inherits(Fade, _React$Component);
|
6057 |
|
6058 | function Fade() {
|
6059 | _classCallCheck(this, Fade);
|
6060 |
|
6061 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
6062 | }
|
6063 |
|
6064 | Fade.prototype.render = function render() {
|
6065 | return _react2["default"].createElement(_Transition2["default"], _extends({}, this.props, {
|
6066 | className: (0, _classnames2["default"])(this.props.className, 'fade'),
|
6067 | enteredClassName: 'in',
|
6068 | enteringClassName: 'in'
|
6069 | }));
|
6070 | };
|
6071 |
|
6072 | return Fade;
|
6073 | }(_react2["default"].Component);
|
6074 |
|
6075 | Fade.propTypes = propTypes;
|
6076 | Fade.defaultProps = defaultProps;
|
6077 |
|
6078 | exports["default"] = Fade;
|
6079 | module.exports = exports['default'];
|
6080 |
|
6081 | }),
|
6082 |
|
6083 | (function(module, exports, __webpack_require__) {
|
6084 |
|
6085 | 'use strict';
|
6086 |
|
6087 | Object.defineProperty(exports, "__esModule", {
|
6088 | value: true
|
6089 | });
|
6090 |
|
6091 | var _Message = __webpack_require__(66);
|
6092 |
|
6093 | var _Message2 = _interopRequireDefault(_Message);
|
6094 |
|
6095 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6096 |
|
6097 | exports["default"] = _Message2["default"];
|
6098 | module.exports = exports['default'];
|
6099 |
|
6100 | }),
|
6101 |
|
6102 | (function(module, exports, __webpack_require__) {
|
6103 |
|
6104 | 'use strict';
|
6105 |
|
6106 | Object.defineProperty(exports, "__esModule", {
|
6107 | value: true
|
6108 | });
|
6109 |
|
6110 | 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; };
|
6111 |
|
6112 | 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; };
|
6113 |
|
6114 | var _react = __webpack_require__(4);
|
6115 |
|
6116 | var _react2 = _interopRequireDefault(_react);
|
6117 |
|
6118 | var _beeNotification = __webpack_require__(67);
|
6119 |
|
6120 | var _beeNotification2 = _interopRequireDefault(_beeNotification);
|
6121 |
|
6122 | var _classnames = __webpack_require__(3);
|
6123 |
|
6124 | var _classnames2 = _interopRequireDefault(_classnames);
|
6125 |
|
6126 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6127 |
|
6128 | var defaultDuration = 1.5;
|
6129 | var defaultTop = 0;
|
6130 | var defaultBottom = 48;
|
6131 | var bottom = 90;
|
6132 | var padding = 30;
|
6133 | var width = 200;
|
6134 | var messageInstance = void 0;
|
6135 | var key = 1;
|
6136 | var clsPrefix = 'u-message';
|
6137 | var noop = function noop() {};
|
6138 |
|
6139 | var positionObj = {
|
6140 | "top": {
|
6141 | messageStyle: {
|
6142 | width: "100%"
|
6143 | },
|
6144 | notificationStyle: {
|
6145 | top: defaultTop,
|
6146 | width: "100%"
|
6147 | },
|
6148 | transitionName: 'top'
|
6149 | },
|
6150 | "bottom": {
|
6151 | messageStyle: {
|
6152 | width: "100%"
|
6153 | },
|
6154 | notificationStyle: {
|
6155 | bottom: defaultBottom,
|
6156 | width: "100%"
|
6157 | },
|
6158 | transitionName: 'bottom'
|
6159 | },
|
6160 | "topRight": {
|
6161 | messageStyle: {
|
6162 | width: width
|
6163 | },
|
6164 | notificationStyle: {
|
6165 | top: padding,
|
6166 | right: padding,
|
6167 | width: width
|
6168 | },
|
6169 | transitionName: 'right'
|
6170 | },
|
6171 | "bottomRight": {
|
6172 | messageStyle: {
|
6173 | width: width
|
6174 | },
|
6175 | notificationStyle: {
|
6176 | bottom: bottom,
|
6177 | right: padding,
|
6178 | width: width
|
6179 | },
|
6180 | transitionName: 'right'
|
6181 | },
|
6182 | "topLeft": {
|
6183 | messageStyle: {
|
6184 | width: width
|
6185 | },
|
6186 | notificationStyle: {
|
6187 | top: padding,
|
6188 | left: padding,
|
6189 | width: width
|
6190 | },
|
6191 | transitionName: 'left'
|
6192 | },
|
6193 | "bottomLeft": {
|
6194 | messageStyle: {
|
6195 | width: width
|
6196 | },
|
6197 | notificationStyle: {
|
6198 | bottom: bottom,
|
6199 | left: padding,
|
6200 | width: width
|
6201 | },
|
6202 | transitionName: 'left'
|
6203 | }
|
6204 | };
|
6205 |
|
6206 | function getMessageInstance() {
|
6207 | var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'top';
|
6208 | var callback = arguments[1];
|
6209 | var keyboard = arguments[2];
|
6210 | var onEscapeKeyUp = arguments[3];
|
6211 |
|
6212 | if (messageInstance) {
|
6213 | callback(messageInstance);
|
6214 | return;
|
6215 | }
|
6216 | var style = positionObj[position].notificationStyle;
|
6217 | var instanceObj = {
|
6218 | clsPrefix: clsPrefix,
|
6219 | transitionName: clsPrefix + '-' + positionObj[position].transitionName,
|
6220 | style: style,
|
6221 | position: ''
|
6222 | };
|
6223 | if (typeof keyboard === 'boolean') {
|
6224 | instanceObj.keyboard = keyboard;
|
6225 | }
|
6226 | if (typeof onEscapeKeyUp === 'function') {
|
6227 | instanceObj.onEscapeKeyUp = onEscapeKeyUp;
|
6228 | }
|
6229 | _beeNotification2["default"].newInstance(instanceObj, function (instance) {
|
6230 | messageInstance = instance;
|
6231 | callback(instance);
|
6232 | });
|
6233 | }
|
6234 |
|
6235 | function notice(content, duration, type, onClose, position, style, keyboard, onEscapeKeyUp, showIcon) {
|
6236 | var iconType = {
|
6237 | info: 'uf uf-i-c-2',
|
6238 | success: 'uf uf-correct',
|
6239 | danger: 'uf uf-close-c',
|
6240 | warning: 'uf uf-exc-t',
|
6241 | light: 'uf uf-notification',
|
6242 | dark: 'uf uf-bubble',
|
6243 | news: 'uf uf-bell',
|
6244 | infolight: 'uf uf-i-c-2',
|
6245 | successlight: 'uf uf-correct',
|
6246 | dangerlight: 'uf uf-close-c',
|
6247 | warninglight: 'uf uf-exc-t'
|
6248 | }[type];
|
6249 |
|
6250 | var positionStyle = positionObj[position].messageStyle;
|
6251 |
|
6252 | getMessageInstance(position, function (instance) {
|
6253 | instance.notice({
|
6254 | key: key,
|
6255 | duration: duration,
|
6256 | color: type,
|
6257 | style: _extends({}, positionStyle, style),
|
6258 | content: _react2["default"].createElement(
|
6259 | 'div',
|
6260 | null,
|
6261 | showIcon ? _react2["default"].createElement(
|
6262 | 'div',
|
6263 | { className: clsPrefix + '-notice-description-icon' },
|
6264 | _react2["default"].createElement('i', { className: (0, _classnames2["default"])(iconType) })
|
6265 | ) : null,
|
6266 | _react2["default"].createElement(
|
6267 | 'div',
|
6268 | { className: clsPrefix + '-notice-description-content' },
|
6269 | content
|
6270 | )
|
6271 | ),
|
6272 | onClose: onClose
|
6273 | });
|
6274 | }, keyboard, onEscapeKeyUp);
|
6275 | return function () {
|
6276 | var target = key++;
|
6277 | return function () {
|
6278 | if (messageInstance) {
|
6279 | messageInstance.removeNotice(target);
|
6280 | }
|
6281 | };
|
6282 | }();
|
6283 | }
|
6284 |
|
6285 | exports["default"] = {
|
6286 | create: function create(obj) {
|
6287 | var content = obj.content || '';
|
6288 | var duration = _typeof(obj.duration) == undefined ? defaultDuration : obj.duration;
|
6289 | var color = obj.color || 'dark';
|
6290 | var onClose = obj.onClose || noop;
|
6291 | var position = obj.position || "top";
|
6292 | var style = obj.style || {};
|
6293 | var showIcon = obj.showIcon || false;
|
6294 | return notice(content, duration, color, onClose, position, style, obj.keyboard, obj.onEscapeKeyUp, showIcon);
|
6295 | },
|
6296 | config: function config(options) {
|
6297 | if (options.top !== undefined) {
|
6298 | defaultTop = options.top;
|
6299 | }
|
6300 | if (options.duration !== undefined) {
|
6301 | defaultDuration = options.duration;
|
6302 | }
|
6303 | if (options.clsPrefix !== undefined) {
|
6304 | clsPrefix = options.clsPrefix;
|
6305 | }
|
6306 | if (options.defaultBottom !== undefined) {
|
6307 | defaultBottom = options.defaultBottom;
|
6308 | }
|
6309 | if (options.bottom !== undefined) {
|
6310 | bottom = options.bottom;
|
6311 | }
|
6312 | if (options.width !== undefined) {
|
6313 | bottom = options.width;
|
6314 | }
|
6315 | },
|
6316 | destroy: function destroy() {
|
6317 | if (messageInstance) {
|
6318 | messageInstance.destroy();
|
6319 | messageInstance = null;
|
6320 | }
|
6321 | }
|
6322 | };
|
6323 | module.exports = exports['default'];
|
6324 |
|
6325 | }),
|
6326 |
|
6327 | (function(module, exports, __webpack_require__) {
|
6328 |
|
6329 | 'use strict';
|
6330 |
|
6331 | Object.defineProperty(exports, "__esModule", {
|
6332 | value: true
|
6333 | });
|
6334 |
|
6335 | var _Notification = __webpack_require__(68);
|
6336 |
|
6337 | var _Notification2 = _interopRequireDefault(_Notification);
|
6338 |
|
6339 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6340 |
|
6341 | exports["default"] = _Notification2["default"];
|
6342 | module.exports = exports['default'];
|
6343 |
|
6344 | }),
|
6345 |
|
6346 | (function(module, exports, __webpack_require__) {
|
6347 |
|
6348 | 'use strict';
|
6349 |
|
6350 | Object.defineProperty(exports, "__esModule", {
|
6351 | value: true
|
6352 | });
|
6353 |
|
6354 | 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; };
|
6355 |
|
6356 | var _react = __webpack_require__(4);
|
6357 |
|
6358 | var _react2 = _interopRequireDefault(_react);
|
6359 |
|
6360 | var _propTypes = __webpack_require__(5);
|
6361 |
|
6362 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6363 |
|
6364 | var _reactDom = __webpack_require__(12);
|
6365 |
|
6366 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
6367 |
|
6368 | var _beeAnimate = __webpack_require__(69);
|
6369 |
|
6370 | var _beeAnimate2 = _interopRequireDefault(_beeAnimate);
|
6371 |
|
6372 | var _createChainedFunction = __webpack_require__(37);
|
6373 |
|
6374 | var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
|
6375 |
|
6376 | var _ownerDocument = __webpack_require__(74);
|
6377 |
|
6378 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
6379 |
|
6380 | var _addEventListener = __webpack_require__(76);
|
6381 |
|
6382 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
6383 |
|
6384 | var _classnames = __webpack_require__(3);
|
6385 |
|
6386 | var _classnames2 = _interopRequireDefault(_classnames);
|
6387 |
|
6388 | var _Notice = __webpack_require__(78);
|
6389 |
|
6390 | var _Notice2 = _interopRequireDefault(_Notice);
|
6391 |
|
6392 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6393 |
|
6394 | 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; }
|
6395 |
|
6396 | 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; }
|
6397 |
|
6398 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6399 |
|
6400 | 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; }
|
6401 |
|
6402 | 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); }
|
6403 |
|
6404 | var seed = 0;
|
6405 | var now = Date.now();
|
6406 |
|
6407 | function getUuid() {
|
6408 | return 'uNotification_' + now + '_' + seed++;
|
6409 | }
|
6410 |
|
6411 | var propTypes = {
|
6412 | show: _propTypes2["default"].bool,
|
6413 | clsPrefix: _propTypes2["default"].string,
|
6414 | style: _propTypes2["default"].object,
|
6415 | position: _propTypes2["default"].oneOf(['topRight', 'bottomRight', '']),
|
6416 | transitionName: _propTypes2["default"].string,
|
6417 | keyboard: _propTypes2["default"].bool,
|
6418 | onEscapeKeyUp: _propTypes2["default"].func,
|
6419 | animation: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object])
|
6420 | };
|
6421 |
|
6422 | var defaultProps = {
|
6423 | clsPrefix: 'u-notification',
|
6424 | animation: 'fade',
|
6425 | keyboard: true,
|
6426 | position: 'topRight'
|
6427 | };
|
6428 |
|
6429 | var Notification = function (_Component) {
|
6430 | _inherits(Notification, _Component);
|
6431 |
|
6432 | function Notification(props) {
|
6433 | _classCallCheck(this, Notification);
|
6434 |
|
6435 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
6436 |
|
6437 | _this.handleDocumentKeyUp = function (e) {
|
6438 | if (_this.props.keyboard && e.keyCode === 27 && _this.state.notices.length) {
|
6439 | _this.setState(function (previousState) {
|
6440 | previousState.notices.shift();
|
6441 | return {
|
6442 | notices: previousState.notices
|
6443 | };
|
6444 | });
|
6445 | if (_this.props.onEscapeKeyUp) {
|
6446 | _this.props.onEscapeKeyUp(e);
|
6447 | }
|
6448 | }
|
6449 | };
|
6450 |
|
6451 | _this.state = {
|
6452 | notices: []
|
6453 | };
|
6454 | _this.add = _this.add.bind(_this);
|
6455 | _this.remove = _this.remove.bind(_this);
|
6456 |
|
6457 | return _this;
|
6458 | }
|
6459 |
|
6460 | Notification.prototype.componentDidMount = function componentDidMount() {
|
6461 |
|
6462 | var doc = (0, _ownerDocument2["default"])(this);
|
6463 | this._onDocumentKeyupListener = (0, _addEventListener2["default"])(doc, 'keyup', this.handleDocumentKeyUp);
|
6464 | };
|
6465 |
|
6466 | Notification.prototype.componentWillUnmount = function componentWillUnmount() {
|
6467 | this._onDocumentKeyupListener.remove();
|
6468 | };
|
6469 |
|
6470 | Notification.prototype.getTransitionName = function getTransitionName() {
|
6471 | var props = this.props;
|
6472 | var transitionName = props.transitionName;
|
6473 | if (!transitionName && props.animation) {
|
6474 | transitionName = props.clsPrefix + '-' + props.animation;
|
6475 | }
|
6476 | return transitionName;
|
6477 | };
|
6478 |
|
6479 | Notification.prototype.add = function add(notice) {
|
6480 | var key = notice.key = notice.key || getUuid();
|
6481 | this.setState(function (previousState) {
|
6482 | var notices = previousState.notices;
|
6483 | if (!notices.filter(function (v) {
|
6484 | return v.key === key;
|
6485 | }).length) {
|
6486 | return {
|
6487 | notices: notices.concat(notice)
|
6488 | };
|
6489 | }
|
6490 | });
|
6491 | };
|
6492 |
|
6493 | Notification.prototype.remove = function remove(key) {
|
6494 | this.setState(function (previousState) {
|
6495 | return {
|
6496 | notices: previousState.notices.filter(function (notice) {
|
6497 | return notice.key !== key;
|
6498 | })
|
6499 | };
|
6500 | });
|
6501 | };
|
6502 |
|
6503 | |
6504 |
|
6505 |
|
6506 |
|
6507 |
|
6508 | Notification.prototype.render = function render() {
|
6509 | var _this2 = this,
|
6510 | _classes;
|
6511 |
|
6512 | var _props = this.props,
|
6513 | clsPrefix = _props.clsPrefix,
|
6514 | className = _props.className,
|
6515 | position = _props.position,
|
6516 | style = _props.style;
|
6517 |
|
6518 | var noticeNodes = this.state.notices.map(function (notice) {
|
6519 | var onClose = (0, _createChainedFunction2["default"])(_this2.remove.bind(_this2, notice.key), notice.onClose);
|
6520 | return _react2["default"].createElement(
|
6521 | _Notice2["default"],
|
6522 | _extends({
|
6523 | clsPrefix: clsPrefix
|
6524 | }, notice, {
|
6525 | onClose: onClose
|
6526 | }),
|
6527 | notice.content
|
6528 | );
|
6529 | });
|
6530 | var classes = (_classes = {}, _defineProperty(_classes, clsPrefix, 1), _defineProperty(_classes, className, !!className), _classes);
|
6531 | if (position) {
|
6532 | classes[clsPrefix + '-' + position] = !!position;
|
6533 | }
|
6534 |
|
6535 | return _react2["default"].createElement(
|
6536 | 'div',
|
6537 | { className: (0, _classnames2["default"])(className, classes), style: style },
|
6538 | _react2["default"].createElement(
|
6539 | _beeAnimate2["default"],
|
6540 | { transitionName: this.getTransitionName() },
|
6541 | noticeNodes
|
6542 | )
|
6543 | );
|
6544 | };
|
6545 |
|
6546 | return Notification;
|
6547 | }(_react.Component);
|
6548 |
|
6549 | ;
|
6550 |
|
6551 | Notification.propTypes = propTypes;
|
6552 | Notification.defaultProps = defaultProps;
|
6553 |
|
6554 | Notification.newInstance = function newNotificationInstance(properties, callback) {
|
6555 | if (typeof callback !== 'function') {
|
6556 | console.error('You must introduce callback as the second parameter of Notification.newInstance().');
|
6557 | return;
|
6558 | }
|
6559 | var props = properties || {};
|
6560 | var div = document.createElement('div');
|
6561 | document.body.appendChild(div);
|
6562 |
|
6563 | var called = false;
|
6564 | function ref(notification) {
|
6565 | if (called) {
|
6566 | return;
|
6567 | }
|
6568 | called = true;
|
6569 | callback({
|
6570 | notice: function notice(noticeProps) {
|
6571 | notification.add(noticeProps);
|
6572 | },
|
6573 | removeNotice: function removeNotice(key) {
|
6574 | notification.remove(key);
|
6575 | },
|
6576 |
|
6577 | component: notification,
|
6578 | destroy: function destroy() {
|
6579 | _reactDom2["default"].unmountComponentAtNode(div);
|
6580 | document.body.removeChild(div);
|
6581 | }
|
6582 | });
|
6583 | }
|
6584 | _reactDom2["default"].render(_react2["default"].createElement(Notification, _extends({}, props, { ref: ref })), div);
|
6585 | };
|
6586 |
|
6587 | exports["default"] = Notification;
|
6588 | module.exports = exports['default'];
|
6589 |
|
6590 | }),
|
6591 |
|
6592 | (function(module, exports, __webpack_require__) {
|
6593 |
|
6594 | 'use strict';
|
6595 |
|
6596 | Object.defineProperty(exports, "__esModule", {
|
6597 | value: true
|
6598 | });
|
6599 |
|
6600 | var _Animate = __webpack_require__(70);
|
6601 |
|
6602 | var _Animate2 = _interopRequireDefault(_Animate);
|
6603 |
|
6604 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6605 |
|
6606 | exports["default"] = _Animate2["default"];
|
6607 | module.exports = exports['default'];
|
6608 |
|
6609 | }),
|
6610 |
|
6611 | (function(module, exports, __webpack_require__) {
|
6612 |
|
6613 | 'use strict';
|
6614 |
|
6615 | Object.defineProperty(exports, "__esModule", {
|
6616 | value: true
|
6617 | });
|
6618 |
|
6619 | var _react = __webpack_require__(4);
|
6620 |
|
6621 | var _react2 = _interopRequireDefault(_react);
|
6622 |
|
6623 | var _propTypes = __webpack_require__(5);
|
6624 |
|
6625 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6626 |
|
6627 | var _ChildrenUtils = __webpack_require__(71);
|
6628 |
|
6629 | var _AnimateChild = __webpack_require__(72);
|
6630 |
|
6631 | var _AnimateChild2 = _interopRequireDefault(_AnimateChild);
|
6632 |
|
6633 | var _util = __webpack_require__(73);
|
6634 |
|
6635 | var _util2 = _interopRequireDefault(_util);
|
6636 |
|
6637 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6638 |
|
6639 | 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; }
|
6640 |
|
6641 | 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; }
|
6642 |
|
6643 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6644 |
|
6645 | 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; }
|
6646 |
|
6647 | 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); }
|
6648 |
|
6649 | var defaultKey = 'u_animate_' + Date.now();
|
6650 |
|
6651 |
|
6652 | function getChildrenFromProps(props) {
|
6653 | var children = props.children;
|
6654 | if (_react2["default"].isValidElement(children)) {
|
6655 | if (!children.key) {
|
6656 | return _react2["default"].cloneElement(children, {
|
6657 | key: defaultKey
|
6658 | });
|
6659 | }
|
6660 | }
|
6661 | return children;
|
6662 | }
|
6663 |
|
6664 | function noop() {}
|
6665 |
|
6666 | var propTypes = {
|
6667 | component: _propTypes2["default"].any,
|
6668 | animation: _propTypes2["default"].object,
|
6669 | transitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
|
6670 | transitionEnter: _propTypes2["default"].bool,
|
6671 | transitionAppear: _propTypes2["default"].bool,
|
6672 | exclusive: _propTypes2["default"].bool,
|
6673 | transitionLeave: _propTypes2["default"].bool,
|
6674 | onEnd: _propTypes2["default"].func,
|
6675 | onEnter: _propTypes2["default"].func,
|
6676 | onLeave: _propTypes2["default"].func,
|
6677 | onAppear: _propTypes2["default"].func,
|
6678 | showProp: _propTypes2["default"].string
|
6679 | };
|
6680 |
|
6681 | var defaultProps = {
|
6682 | animation: {},
|
6683 | component: 'span',
|
6684 | transitionEnter: true,
|
6685 | transitionLeave: true,
|
6686 | transitionAppear: false,
|
6687 | onEnd: noop,
|
6688 | onEnter: noop,
|
6689 | onLeave: noop,
|
6690 | onAppear: noop
|
6691 | };
|
6692 |
|
6693 | var Animate = function (_Component) {
|
6694 | _inherits(Animate, _Component);
|
6695 |
|
6696 | function Animate(props) {
|
6697 | _classCallCheck(this, Animate);
|
6698 |
|
6699 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
6700 |
|
6701 | _this.currentlyAnimatingKeys = {};
|
6702 | _this.keysToEnter = [];
|
6703 | _this.keysToLeave = [];
|
6704 | _this.state = {
|
6705 | children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(_this.props))
|
6706 | };
|
6707 |
|
6708 | _this.performEnter = _this.performEnter.bind(_this);
|
6709 | _this.performAppear = _this.performAppear.bind(_this);
|
6710 | _this.handleDoneAdding = _this.handleDoneAdding.bind(_this);
|
6711 | _this.performLeave = _this.performLeave.bind(_this);
|
6712 |
|
6713 | _this.performLeave = _this.performLeave.bind(_this);
|
6714 | _this.handleDoneLeaving = _this.handleDoneLeaving.bind(_this);
|
6715 | _this.isValidChildByKey = _this.isValidChildByKey.bind(_this);
|
6716 | _this.stop = _this.stop.bind(_this);
|
6717 | return _this;
|
6718 | }
|
6719 |
|
6720 | Animate.prototype.componentDidMount = function componentDidMount() {
|
6721 | var _this2 = this;
|
6722 |
|
6723 | this.mounted = true;
|
6724 | var showProp = this.props.showProp;
|
6725 | var children = this.state.children;
|
6726 | if (showProp) {
|
6727 | children = children.filter(function (child) {
|
6728 | return !!child.props[showProp];
|
6729 | });
|
6730 | }
|
6731 | children.forEach(function (child) {
|
6732 | if (child) {
|
6733 | _this2.performAppear(child.key);
|
6734 | }
|
6735 | });
|
6736 | };
|
6737 |
|
6738 | Animate.prototype.componentWillUnmount = function componentWillUnmount() {
|
6739 | this.mounted = false;
|
6740 | };
|
6741 |
|
6742 | Animate.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
6743 | var _this3 = this;
|
6744 |
|
6745 | this.nextProps = nextProps;
|
6746 | var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps));
|
6747 | var props = this.props;
|
6748 |
|
6749 | if (props.exclusive) {
|
6750 | Object.keys(this.currentlyAnimatingKeys).forEach(function (key) {
|
6751 | _this3.stop(key);
|
6752 | });
|
6753 | }
|
6754 | var showProp = props.showProp;
|
6755 | var currentlyAnimatingKeys = this.currentlyAnimatingKeys;
|
6756 |
|
6757 | var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children;
|
6758 |
|
6759 | var newChildren = [];
|
6760 | if (showProp) {
|
6761 | currentChildren.forEach(function (currentChild) {
|
6762 | var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key);
|
6763 | var newChild = void 0;
|
6764 | if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) {
|
6765 | newChild = _react2["default"].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true));
|
6766 | } else {
|
6767 | newChild = nextChild;
|
6768 | }
|
6769 | if (newChild) {
|
6770 | newChildren.push(newChild);
|
6771 | }
|
6772 | });
|
6773 | nextChildren.forEach(function (nextChild) {
|
6774 | if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) {
|
6775 | newChildren.push(nextChild);
|
6776 | }
|
6777 | });
|
6778 | } else {
|
6779 | newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren);
|
6780 | }
|
6781 |
|
6782 |
|
6783 | this.setState({
|
6784 | children: newChildren
|
6785 | });
|
6786 |
|
6787 | nextChildren.forEach(function (child) {
|
6788 | var key = child && child.key;
|
6789 | if (child && currentlyAnimatingKeys[key]) {
|
6790 | return;
|
6791 | }
|
6792 | var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
6793 | if (showProp) {
|
6794 | var showInNext = child.props[showProp];
|
6795 | if (hasPrev) {
|
6796 | var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
6797 | if (!showInNow && showInNext) {
|
6798 | _this3.keysToEnter.push(key);
|
6799 | }
|
6800 | } else if (showInNext) {
|
6801 | _this3.keysToEnter.push(key);
|
6802 | }
|
6803 | } else if (!hasPrev) {
|
6804 | _this3.keysToEnter.push(key);
|
6805 | }
|
6806 | });
|
6807 |
|
6808 | currentChildren.forEach(function (child) {
|
6809 | var key = child && child.key;
|
6810 | if (child && currentlyAnimatingKeys[key]) {
|
6811 | return;
|
6812 | }
|
6813 | var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key);
|
6814 | if (showProp) {
|
6815 | var showInNow = child.props[showProp];
|
6816 | if (hasNext) {
|
6817 | var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp);
|
6818 | if (!showInNext && showInNow) {
|
6819 | _this3.keysToLeave.push(key);
|
6820 | }
|
6821 | } else if (showInNow) {
|
6822 | _this3.keysToLeave.push(key);
|
6823 | }
|
6824 | } else if (!hasNext) {
|
6825 | _this3.keysToLeave.push(key);
|
6826 | }
|
6827 | });
|
6828 | };
|
6829 |
|
6830 | Animate.prototype.componentDidUpdate = function componentDidUpdate() {
|
6831 | var keysToEnter = this.keysToEnter;
|
6832 | this.keysToEnter = [];
|
6833 | keysToEnter.forEach(this.performEnter);
|
6834 | var keysToLeave = this.keysToLeave;
|
6835 | this.keysToLeave = [];
|
6836 | keysToLeave.forEach(this.performLeave);
|
6837 | };
|
6838 |
|
6839 | Animate.prototype.performEnter = function performEnter(key) {
|
6840 |
|
6841 | if (this.refs[key]) {
|
6842 | this.currentlyAnimatingKeys[key] = true;
|
6843 | this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter'));
|
6844 | }
|
6845 | };
|
6846 |
|
6847 | Animate.prototype.performAppear = function performAppear(key) {
|
6848 | if (this.refs[key]) {
|
6849 | this.currentlyAnimatingKeys[key] = true;
|
6850 | this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear'));
|
6851 | }
|
6852 | };
|
6853 |
|
6854 | Animate.prototype.handleDoneAdding = function handleDoneAdding(key, type) {
|
6855 | var props = this.props;
|
6856 | delete this.currentlyAnimatingKeys[key];
|
6857 |
|
6858 | if (props.exclusive && props !== this.nextProps) {
|
6859 | return;
|
6860 | }
|
6861 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
6862 | if (!this.isValidChildByKey(currentChildren, key)) {
|
6863 |
|
6864 | this.performLeave(key);
|
6865 | } else {
|
6866 | if (type === 'appear') {
|
6867 | if (_util2["default"].allowAppearCallback(props)) {
|
6868 | props.onAppear(key);
|
6869 | props.onEnd(key, true);
|
6870 | }
|
6871 | } else {
|
6872 | if (_util2["default"].allowEnterCallback(props)) {
|
6873 | props.onEnter(key);
|
6874 | props.onEnd(key, true);
|
6875 | }
|
6876 | }
|
6877 | }
|
6878 | };
|
6879 |
|
6880 | Animate.prototype.performLeave = function performLeave(key) {
|
6881 |
|
6882 | if (this.refs[key]) {
|
6883 | this.currentlyAnimatingKeys[key] = true;
|
6884 | this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key));
|
6885 | }
|
6886 | };
|
6887 |
|
6888 | Animate.prototype.handleDoneLeaving = function handleDoneLeaving(key) {
|
6889 | var props = this.props;
|
6890 | delete this.currentlyAnimatingKeys[key];
|
6891 |
|
6892 | if (props.exclusive && props !== this.nextProps) {
|
6893 | return;
|
6894 | }
|
6895 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
6896 |
|
6897 | if (this.isValidChildByKey(currentChildren, key)) {
|
6898 | this.performEnter(key);
|
6899 | } else {
|
6900 | var end = function end() {
|
6901 | if (_util2["default"].allowLeaveCallback(props)) {
|
6902 | props.onLeave(key);
|
6903 | props.onEnd(key, false);
|
6904 | }
|
6905 | };
|
6906 |
|
6907 | if (this.mounted && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) {
|
6908 | this.setState({
|
6909 | children: currentChildren
|
6910 | }, end);
|
6911 | } else {
|
6912 | end();
|
6913 | }
|
6914 | }
|
6915 | };
|
6916 |
|
6917 | Animate.prototype.isValidChildByKey = function isValidChildByKey(currentChildren, key) {
|
6918 | var showProp = this.props.showProp;
|
6919 | if (showProp) {
|
6920 | return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
6921 | }
|
6922 | return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
6923 | };
|
6924 |
|
6925 | Animate.prototype.stop = function stop(key) {
|
6926 | delete this.currentlyAnimatingKeys[key];
|
6927 | var component = this.refs[key];
|
6928 | if (component) {
|
6929 | component.stop();
|
6930 | }
|
6931 | };
|
6932 |
|
6933 | Animate.prototype.render = function render() {
|
6934 | var props = this.props;
|
6935 | this.nextProps = props;
|
6936 | var stateChildren = this.state.children;
|
6937 | var children = null;
|
6938 | if (stateChildren) {
|
6939 | children = stateChildren.map(function (child) {
|
6940 | if (child === null || child === undefined) {
|
6941 | return child;
|
6942 | }
|
6943 | if (!child.key) {
|
6944 | throw new Error('must set key for <rc-animate> children');
|
6945 | }
|
6946 | return _react2["default"].createElement(
|
6947 | _AnimateChild2["default"],
|
6948 | {
|
6949 | key: child.key,
|
6950 | ref: child.key,
|
6951 | animation: props.animation,
|
6952 | transitionName: props.transitionName,
|
6953 | transitionEnter: props.transitionEnter,
|
6954 | transitionAppear: props.transitionAppear,
|
6955 | transitionLeave: props.transitionLeave
|
6956 | },
|
6957 | child
|
6958 | );
|
6959 | });
|
6960 | }
|
6961 | var Component = props.component;
|
6962 | if (Component) {
|
6963 | var passedProps = props;
|
6964 | if (typeof Component === 'string') {
|
6965 | passedProps = {
|
6966 | className: props.className,
|
6967 | style: props.style
|
6968 | };
|
6969 | }
|
6970 | return _react2["default"].createElement(
|
6971 | Component,
|
6972 | passedProps,
|
6973 | children
|
6974 | );
|
6975 | }
|
6976 | return children[0] || null;
|
6977 | };
|
6978 |
|
6979 | return Animate;
|
6980 | }(_react.Component);
|
6981 |
|
6982 | ;
|
6983 | Animate.defaultProps = defaultProps;
|
6984 | Animate.propTypes = Animate.propTypes;
|
6985 |
|
6986 | exports["default"] = Animate;
|
6987 | module.exports = exports['default'];
|
6988 |
|
6989 | }),
|
6990 |
|
6991 | (function(module, exports, __webpack_require__) {
|
6992 |
|
6993 | 'use strict';
|
6994 |
|
6995 | Object.defineProperty(exports, "__esModule", {
|
6996 | value: true
|
6997 | });
|
6998 | exports.toArrayChildren = toArrayChildren;
|
6999 | exports.findChildInChildrenByKey = findChildInChildrenByKey;
|
7000 | exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey;
|
7001 | exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey;
|
7002 | exports.isSameChildren = isSameChildren;
|
7003 | exports.mergeChildren = mergeChildren;
|
7004 |
|
7005 | var _react = __webpack_require__(4);
|
7006 |
|
7007 | var _react2 = _interopRequireDefault(_react);
|
7008 |
|
7009 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7010 |
|
7011 | function toArrayChildren(children) {
|
7012 | var ret = [];
|
7013 | _react2["default"].Children.forEach(children, function (child) {
|
7014 | ret.push(child);
|
7015 | });
|
7016 | return ret;
|
7017 | }
|
7018 |
|
7019 | function findChildInChildrenByKey(children, key) {
|
7020 | var ret = null;
|
7021 | if (children) {
|
7022 | children.forEach(function (child) {
|
7023 | if (ret) {
|
7024 | return;
|
7025 | }
|
7026 | if (child && child.key === key) {
|
7027 | ret = child;
|
7028 | }
|
7029 | });
|
7030 | }
|
7031 | return ret;
|
7032 | }
|
7033 |
|
7034 | function findShownChildInChildrenByKey(children, key, showProp) {
|
7035 | var ret = null;
|
7036 | if (children) {
|
7037 | children.forEach(function (child) {
|
7038 | if (child && child.key === key && child.props[showProp]) {
|
7039 | if (ret) {
|
7040 | throw new Error('two child with same key for <rc-animate> children');
|
7041 | }
|
7042 | ret = child;
|
7043 | }
|
7044 | });
|
7045 | }
|
7046 | return ret;
|
7047 | }
|
7048 |
|
7049 | function findHiddenChildInChildrenByKey(children, key, showProp) {
|
7050 | var found = 0;
|
7051 | if (children) {
|
7052 | children.forEach(function (child) {
|
7053 | if (found) {
|
7054 | return;
|
7055 | }
|
7056 | found = child && child.key === key && !child.props[showProp];
|
7057 | });
|
7058 | }
|
7059 | return found;
|
7060 | }
|
7061 |
|
7062 | function isSameChildren(c1, c2, showProp) {
|
7063 | var same = c1.length === c2.length;
|
7064 | if (same) {
|
7065 | c1.forEach(function (child, index) {
|
7066 | var child2 = c2[index];
|
7067 | if (child && child2) {
|
7068 | if (child && !child2 || !child && child2) {
|
7069 | same = false;
|
7070 | } else if (child.key !== child2.key) {
|
7071 | same = false;
|
7072 | } else if (showProp && child.props[showProp] !== child2.props[showProp]) {
|
7073 | same = false;
|
7074 | }
|
7075 | }
|
7076 | });
|
7077 | }
|
7078 | return same;
|
7079 | }
|
7080 |
|
7081 | function mergeChildren(prev, next) {
|
7082 | var ret = [];
|
7083 |
|
7084 |
|
7085 |
|
7086 | var nextChildrenPending = {};
|
7087 | var pendingChildren = [];
|
7088 | prev.forEach(function (child) {
|
7089 | if (child && findChildInChildrenByKey(next, child.key)) {
|
7090 | if (pendingChildren.length) {
|
7091 | nextChildrenPending[child.key] = pendingChildren;
|
7092 | pendingChildren = [];
|
7093 | }
|
7094 | } else {
|
7095 | pendingChildren.push(child);
|
7096 | }
|
7097 | });
|
7098 |
|
7099 | next.forEach(function (child) {
|
7100 | if (child && nextChildrenPending.hasOwnProperty(child.key)) {
|
7101 | ret = ret.concat(nextChildrenPending[child.key]);
|
7102 | }
|
7103 | ret.push(child);
|
7104 | });
|
7105 |
|
7106 | ret = ret.concat(pendingChildren);
|
7107 |
|
7108 | return ret;
|
7109 | }
|
7110 |
|
7111 | }),
|
7112 |
|
7113 | (function(module, exports, __webpack_require__) {
|
7114 |
|
7115 | 'use strict';
|
7116 |
|
7117 | Object.defineProperty(exports, "__esModule", {
|
7118 | value: true
|
7119 | });
|
7120 |
|
7121 | 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; };
|
7122 |
|
7123 | var _react = __webpack_require__(4);
|
7124 |
|
7125 | var _react2 = _interopRequireDefault(_react);
|
7126 |
|
7127 | var _propTypes = __webpack_require__(5);
|
7128 |
|
7129 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7130 |
|
7131 | var _reactDom = __webpack_require__(12);
|
7132 |
|
7133 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7134 |
|
7135 | var _tinperBeeCore = __webpack_require__(27);
|
7136 |
|
7137 | var _util = __webpack_require__(73);
|
7138 |
|
7139 | var _util2 = _interopRequireDefault(_util);
|
7140 |
|
7141 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7142 |
|
7143 | 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; }
|
7144 |
|
7145 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7146 |
|
7147 | 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; }
|
7148 |
|
7149 | 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); }
|
7150 |
|
7151 | var transitionMap = {
|
7152 | enter: 'transitionEnter',
|
7153 | appear: 'transitionAppear',
|
7154 | leave: 'transitionLeave'
|
7155 | };
|
7156 |
|
7157 | var propTypes = {
|
7158 | children: _propTypes2["default"].any
|
7159 | };
|
7160 |
|
7161 | var AnimateChild = function (_Component) {
|
7162 | _inherits(AnimateChild, _Component);
|
7163 |
|
7164 | function AnimateChild(props) {
|
7165 | _classCallCheck(this, AnimateChild);
|
7166 |
|
7167 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
7168 |
|
7169 | _this.transition = _this.transition.bind(_this);
|
7170 | _this.stop = _this.stop.bind(_this);
|
7171 | return _this;
|
7172 | }
|
7173 |
|
7174 | AnimateChild.prototype.componentWillUnmount = function componentWillUnmount() {
|
7175 | this.stop();
|
7176 | };
|
7177 |
|
7178 | AnimateChild.prototype.componentWillEnter = function componentWillEnter(done) {
|
7179 | if (_util2["default"].isEnterSupported(this.props)) {
|
7180 | this.transition('enter', done);
|
7181 | } else {
|
7182 | done();
|
7183 | }
|
7184 | };
|
7185 |
|
7186 | AnimateChild.prototype.componentWillAppear = function componentWillAppear(done) {
|
7187 | if (_util2["default"].isAppearSupported(this.props)) {
|
7188 | this.transition('appear', done);
|
7189 | } else {
|
7190 | done();
|
7191 | }
|
7192 | };
|
7193 |
|
7194 | AnimateChild.prototype.componentWillLeave = function componentWillLeave(done) {
|
7195 | if (_util2["default"].isLeaveSupported(this.props)) {
|
7196 | this.transition('leave', done);
|
7197 | } else {
|
7198 |
|
7199 |
|
7200 |
|
7201 | done();
|
7202 | }
|
7203 | };
|
7204 |
|
7205 | AnimateChild.prototype.transition = function transition(animationType, finishCallback) {
|
7206 | var _this2 = this;
|
7207 |
|
7208 | var node = _reactDom2["default"].findDOMNode(this);
|
7209 | var props = this.props;
|
7210 | var transitionName = props.transitionName;
|
7211 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
|
7212 | this.stop();
|
7213 | var end = function end() {
|
7214 | _this2.stopper = null;
|
7215 | finishCallback();
|
7216 | };
|
7217 | if ((_tinperBeeCore.cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {
|
7218 | var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType;
|
7219 | var activeName = name + '-active';
|
7220 | if (nameIsObj && transitionName[animationType + 'Active']) {
|
7221 | activeName = transitionName[animationType + 'Active'];
|
7222 | }
|
7223 | this.stopper = (0, _tinperBeeCore.cssAnimation)(node, {
|
7224 | name: name,
|
7225 | active: activeName
|
7226 | }, end);
|
7227 | } else {
|
7228 | this.stopper = props.animation[animationType](node, end);
|
7229 | }
|
7230 | };
|
7231 |
|
7232 | AnimateChild.prototype.stop = function stop() {
|
7233 | var stopper = this.stopper;
|
7234 | if (stopper) {
|
7235 | this.stopper = null;
|
7236 | stopper.stop();
|
7237 | }
|
7238 | };
|
7239 |
|
7240 | AnimateChild.prototype.render = function render() {
|
7241 | return this.props.children;
|
7242 | };
|
7243 |
|
7244 | return AnimateChild;
|
7245 | }(_react.Component);
|
7246 |
|
7247 | ;
|
7248 |
|
7249 | AnimateChild.propTypes = propTypes;
|
7250 |
|
7251 | exports["default"] = AnimateChild;
|
7252 | module.exports = exports['default'];
|
7253 |
|
7254 | }),
|
7255 |
|
7256 | (function(module, exports) {
|
7257 |
|
7258 | "use strict";
|
7259 |
|
7260 | Object.defineProperty(exports, "__esModule", {
|
7261 | value: true
|
7262 | });
|
7263 | var util = {
|
7264 | isAppearSupported: function isAppearSupported(props) {
|
7265 | return props.transitionName && props.transitionAppear || props.animation.appear;
|
7266 | },
|
7267 | isEnterSupported: function isEnterSupported(props) {
|
7268 | return props.transitionName && props.transitionEnter || props.animation.enter;
|
7269 | },
|
7270 | isLeaveSupported: function isLeaveSupported(props) {
|
7271 | return props.transitionName && props.transitionLeave || props.animation.leave;
|
7272 | },
|
7273 | allowAppearCallback: function allowAppearCallback(props) {
|
7274 | return props.transitionAppear || props.animation.appear;
|
7275 | },
|
7276 | allowEnterCallback: function allowEnterCallback(props) {
|
7277 | return props.transitionEnter || props.animation.enter;
|
7278 | },
|
7279 | allowLeaveCallback: function allowLeaveCallback(props) {
|
7280 | return props.transitionLeave || props.animation.leave;
|
7281 | }
|
7282 | };
|
7283 | exports["default"] = util;
|
7284 | module.exports = exports["default"];
|
7285 |
|
7286 | }),
|
7287 |
|
7288 | (function(module, exports, __webpack_require__) {
|
7289 |
|
7290 | 'use strict';
|
7291 |
|
7292 | Object.defineProperty(exports, "__esModule", {
|
7293 | value: true
|
7294 | });
|
7295 |
|
7296 | exports["default"] = function (componentOrElement) {
|
7297 | return (0, _ownerDocument2["default"])(_reactDom2["default"].findDOMNode(componentOrElement));
|
7298 | };
|
7299 |
|
7300 | var _reactDom = __webpack_require__(12);
|
7301 |
|
7302 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7303 |
|
7304 | var _ownerDocument = __webpack_require__(75);
|
7305 |
|
7306 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
7307 |
|
7308 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7309 |
|
7310 | module.exports = exports['default'];
|
7311 |
|
7312 | }),
|
7313 |
|
7314 | (function(module, exports) {
|
7315 |
|
7316 | "use strict";
|
7317 |
|
7318 | exports.__esModule = true;
|
7319 | exports.default = ownerDocument;
|
7320 |
|
7321 | function ownerDocument(node) {
|
7322 | return node && node.ownerDocument || document;
|
7323 | }
|
7324 |
|
7325 | module.exports = exports["default"];
|
7326 |
|
7327 | }),
|
7328 |
|
7329 | (function(module, exports, __webpack_require__) {
|
7330 |
|
7331 | 'use strict';
|
7332 |
|
7333 | Object.defineProperty(exports, "__esModule", {
|
7334 | value: true
|
7335 | });
|
7336 |
|
7337 | exports["default"] = function (node, event, handler, capture) {
|
7338 | (0, _on2["default"])(node, event, handler, capture);
|
7339 |
|
7340 | return {
|
7341 | remove: function remove() {
|
7342 | (0, _off2["default"])(node, event, handler, capture);
|
7343 | }
|
7344 | };
|
7345 | };
|
7346 |
|
7347 | var _on = __webpack_require__(16);
|
7348 |
|
7349 | var _on2 = _interopRequireDefault(_on);
|
7350 |
|
7351 | var _off = __webpack_require__(77);
|
7352 |
|
7353 | var _off2 = _interopRequireDefault(_off);
|
7354 |
|
7355 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7356 |
|
7357 | module.exports = exports['default'];
|
7358 |
|
7359 | }),
|
7360 |
|
7361 | (function(module, exports, __webpack_require__) {
|
7362 |
|
7363 | "use strict";
|
7364 |
|
7365 | var _interopRequireDefault = __webpack_require__(14);
|
7366 |
|
7367 | exports.__esModule = true;
|
7368 | exports.default = void 0;
|
7369 |
|
7370 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
7371 |
|
7372 | var off = function off() {};
|
7373 |
|
7374 | if (_inDOM.default) {
|
7375 | off = function () {
|
7376 | if (document.addEventListener) return function (node, eventName, handler, capture) {
|
7377 | return node.removeEventListener(eventName, handler, capture || false);
|
7378 | };else if (document.attachEvent) return function (node, eventName, handler) {
|
7379 | return node.detachEvent('on' + eventName, handler);
|
7380 | };
|
7381 | }();
|
7382 | }
|
7383 |
|
7384 | var _default = off;
|
7385 | exports.default = _default;
|
7386 | module.exports = exports["default"];
|
7387 |
|
7388 | }),
|
7389 |
|
7390 | (function(module, exports, __webpack_require__) {
|
7391 |
|
7392 | 'use strict';
|
7393 |
|
7394 | Object.defineProperty(exports, "__esModule", {
|
7395 | value: true
|
7396 | });
|
7397 |
|
7398 | var _react = __webpack_require__(4);
|
7399 |
|
7400 | var _react2 = _interopRequireDefault(_react);
|
7401 |
|
7402 | var _classnames = __webpack_require__(3);
|
7403 |
|
7404 | var _classnames2 = _interopRequireDefault(_classnames);
|
7405 |
|
7406 | var _propTypes = __webpack_require__(5);
|
7407 |
|
7408 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7409 |
|
7410 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7411 |
|
7412 | 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; }
|
7413 |
|
7414 | 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; }
|
7415 |
|
7416 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7417 |
|
7418 | 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; }
|
7419 |
|
7420 | 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); }
|
7421 |
|
7422 | var propTypes = {
|
7423 | duration: _propTypes2["default"].number,
|
7424 | onClose: _propTypes2["default"].func,
|
7425 | children: _propTypes2["default"].any,
|
7426 | color: _propTypes2["default"].oneOf(['info', 'success', 'danger', 'warning', 'light', 'dark', 'news', 'infolight', 'successlight', 'dangerlight', 'warninglight']),
|
7427 | title: _propTypes2["default"].any
|
7428 | };
|
7429 |
|
7430 | function noop() {}
|
7431 |
|
7432 | var defaultProps = {
|
7433 | onEnd: noop,
|
7434 | onClose: noop,
|
7435 | duration: 4.5,
|
7436 | closable: true
|
7437 | };
|
7438 |
|
7439 | var Notice = function (_React$Component) {
|
7440 | _inherits(Notice, _React$Component);
|
7441 |
|
7442 | function Notice(props) {
|
7443 | _classCallCheck(this, Notice);
|
7444 |
|
7445 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
7446 |
|
7447 | _this.clearCloseTimer = _this.clearCloseTimer.bind(_this);
|
7448 | _this.close = _this.close.bind(_this);
|
7449 | return _this;
|
7450 | }
|
7451 |
|
7452 | Notice.prototype.componentDidMount = function componentDidMount() {
|
7453 | var _this2 = this;
|
7454 |
|
7455 | if (this.props.duration) {
|
7456 | this.closeTimer = setTimeout(function () {
|
7457 | _this2.close();
|
7458 | }, this.props.duration * 1000);
|
7459 | }
|
7460 | };
|
7461 |
|
7462 | Notice.prototype.componentWillUnmount = function componentWillUnmount() {
|
7463 | this.clearCloseTimer();
|
7464 | };
|
7465 |
|
7466 | Notice.prototype.clearCloseTimer = function clearCloseTimer() {
|
7467 | if (this.closeTimer) {
|
7468 | clearTimeout(this.closeTimer);
|
7469 | this.closeTimer = null;
|
7470 | }
|
7471 | };
|
7472 |
|
7473 | Notice.prototype.close = function close() {
|
7474 | this.clearCloseTimer();
|
7475 | this.props.onClose();
|
7476 | };
|
7477 |
|
7478 | Notice.prototype.render = function render() {
|
7479 | var _classes;
|
7480 |
|
7481 | var _props = this.props,
|
7482 | closable = _props.closable,
|
7483 | clsPrefix = _props.clsPrefix,
|
7484 | className = _props.className,
|
7485 | style = _props.style,
|
7486 | children = _props.children,
|
7487 | color = _props.color,
|
7488 | title = _props.title;
|
7489 |
|
7490 | var componentClass = clsPrefix + '-notice';
|
7491 | var classes = (_classes = {}, _defineProperty(_classes, '' + componentClass, 1), _defineProperty(_classes, componentClass + '-closable', closable), _defineProperty(_classes, className, !!className), _classes);
|
7492 | if (color) {
|
7493 | classes[componentClass + '-' + color] = true;
|
7494 | }
|
7495 | return _react2["default"].createElement(
|
7496 | 'div',
|
7497 | { className: (0, _classnames2["default"])(classes), style: style, onClick: this.close },
|
7498 | _react2["default"].createElement(
|
7499 | 'div',
|
7500 | { className: componentClass + '-content' },
|
7501 | title && _react2["default"].createElement(
|
7502 | 'div',
|
7503 | { className: componentClass + '-title' },
|
7504 | title
|
7505 | ),
|
7506 | _react2["default"].createElement(
|
7507 | 'div',
|
7508 | { className: componentClass + '-description' },
|
7509 | children
|
7510 | )
|
7511 | ),
|
7512 | closable ? _react2["default"].createElement(
|
7513 | 'a',
|
7514 | { tabIndex: '0', onClick: this.close, className: componentClass + '-close' },
|
7515 | _react2["default"].createElement('span', { className: componentClass + '-close-x' })
|
7516 | ) : null
|
7517 | );
|
7518 | };
|
7519 |
|
7520 | return Notice;
|
7521 | }(_react2["default"].Component);
|
7522 |
|
7523 | ;
|
7524 |
|
7525 | Notice.propTypes = propTypes;
|
7526 | Notice.defaultProps = defaultProps;
|
7527 |
|
7528 | exports["default"] = Notice;
|
7529 | module.exports = exports['default'];
|
7530 |
|
7531 | }),
|
7532 |
|
7533 | (function(module, exports, __webpack_require__) {
|
7534 |
|
7535 | 'use strict';
|
7536 |
|
7537 | var deselectCurrent = __webpack_require__(80);
|
7538 |
|
7539 | var defaultMessage = 'Copy to clipboard: #{key}, Enter';
|
7540 |
|
7541 | function format(message) {
|
7542 | var copyKey = (/mac os x/i.test(navigator.userAgent) ? '⌘' : 'Ctrl') + '+C';
|
7543 | return message.replace(/#{\s*key\s*}/g, copyKey);
|
7544 | }
|
7545 |
|
7546 | function copy(text, options) {
|
7547 | var debug, message, reselectPrevious, range, selection, mark, success = false;
|
7548 | if (!options) { options = {}; }
|
7549 | debug = options.debug || false;
|
7550 | try {
|
7551 | reselectPrevious = deselectCurrent();
|
7552 |
|
7553 | range = document.createRange();
|
7554 | selection = document.getSelection();
|
7555 |
|
7556 | mark = document.createElement('span');
|
7557 | mark.textContent = text;
|
7558 |
|
7559 | mark.style.all = 'unset';
|
7560 |
|
7561 | mark.style.position = 'fixed';
|
7562 | mark.style.top = 0;
|
7563 | mark.style.clip = 'rect(0, 0, 0, 0)';
|
7564 |
|
7565 | mark.style.whiteSpace = 'pre';
|
7566 |
|
7567 | mark.style.webkitUserSelect = 'text';
|
7568 | mark.style.MozUserSelect = 'text';
|
7569 | mark.style.msUserSelect = 'text';
|
7570 | mark.style.userSelect = 'text';
|
7571 |
|
7572 | document.body.appendChild(mark);
|
7573 |
|
7574 | range.selectNode(mark);
|
7575 | selection.addRange(range);
|
7576 |
|
7577 | var successful = document.execCommand('copy');
|
7578 | if (!successful) {
|
7579 | throw new Error('copy command was unsuccessful');
|
7580 | }
|
7581 | success = true;
|
7582 | } catch (err) {
|
7583 | debug && console.error('unable to copy using execCommand: ', err);
|
7584 | debug && console.warn('trying IE specific stuff');
|
7585 | try {
|
7586 | window.clipboardData.setData('text', text);
|
7587 | success = true;
|
7588 | } catch (err) {
|
7589 | debug && console.error('unable to copy using clipboardData: ', err);
|
7590 | debug && console.error('falling back to prompt');
|
7591 | message = format('message' in options ? options.message : defaultMessage);
|
7592 | window.prompt(message, text);
|
7593 | }
|
7594 | } finally {
|
7595 | if (selection) {
|
7596 | if (typeof selection.removeRange == 'function') {
|
7597 | selection.removeRange(range);
|
7598 | } else {
|
7599 | selection.removeAllRanges();
|
7600 | }
|
7601 | }
|
7602 |
|
7603 | if (mark) {
|
7604 | document.body.removeChild(mark);
|
7605 | }
|
7606 | reselectPrevious();
|
7607 | }
|
7608 |
|
7609 | return success;
|
7610 | }
|
7611 |
|
7612 | module.exports = copy;
|
7613 |
|
7614 |
|
7615 | }),
|
7616 |
|
7617 | (function(module, exports) {
|
7618 |
|
7619 |
|
7620 | module.exports = function () {
|
7621 | var selection = document.getSelection();
|
7622 | if (!selection.rangeCount) {
|
7623 | return function () {};
|
7624 | }
|
7625 | var active = document.activeElement;
|
7626 |
|
7627 | var ranges = [];
|
7628 | for (var i = 0; i < selection.rangeCount; i++) {
|
7629 | ranges.push(selection.getRangeAt(i));
|
7630 | }
|
7631 |
|
7632 | switch (active.tagName.toUpperCase()) {
|
7633 | case 'INPUT':
|
7634 | case 'TEXTAREA':
|
7635 | active.blur();
|
7636 | break;
|
7637 |
|
7638 | default:
|
7639 | active = null;
|
7640 | break;
|
7641 | }
|
7642 |
|
7643 | selection.removeAllRanges();
|
7644 | return function () {
|
7645 | selection.type === 'Caret' &&
|
7646 | selection.removeAllRanges();
|
7647 |
|
7648 | if (!selection.rangeCount) {
|
7649 | ranges.forEach(function(range) {
|
7650 | selection.addRange(range);
|
7651 | });
|
7652 | }
|
7653 |
|
7654 | active &&
|
7655 | active.focus();
|
7656 | };
|
7657 | };
|
7658 |
|
7659 |
|
7660 | }),
|
7661 |
|
7662 | (function(module, exports, __webpack_require__) {
|
7663 |
|
7664 | 'use strict';
|
7665 |
|
7666 | Object.defineProperty(exports, "__esModule", {
|
7667 | value: true
|
7668 | });
|
7669 |
|
7670 | 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; };
|
7671 |
|
7672 | var _classnames = __webpack_require__(3);
|
7673 |
|
7674 | var _classnames2 = _interopRequireDefault(_classnames);
|
7675 |
|
7676 | var _react = __webpack_require__(4);
|
7677 |
|
7678 | var _react2 = _interopRequireDefault(_react);
|
7679 |
|
7680 | var _propTypes = __webpack_require__(5);
|
7681 |
|
7682 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7683 |
|
7684 | var _tinperBeeCore = __webpack_require__(27);
|
7685 |
|
7686 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7687 |
|
7688 | 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; }
|
7689 |
|
7690 | 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; }
|
7691 |
|
7692 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7693 |
|
7694 | 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; }
|
7695 |
|
7696 | 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); }
|
7697 |
|
7698 | var propTypes = {
|
7699 |
|
7700 | accordion: _propTypes2["default"].bool,
|
7701 |
|
7702 | activeKey: _propTypes2["default"].any,
|
7703 |
|
7704 | defaultActiveKey: _propTypes2["default"].any,
|
7705 |
|
7706 | onSelect: _propTypes2["default"].func,
|
7707 | role: _propTypes2["default"].string
|
7708 | };
|
7709 |
|
7710 | var defaultProps = {
|
7711 | accordion: false,
|
7712 | clsPrefix: 'u-panel-group'
|
7713 | };
|
7714 |
|
7715 |
|
7716 |
|
7717 | var PanelGroup = function (_React$Component) {
|
7718 | _inherits(PanelGroup, _React$Component);
|
7719 |
|
7720 | function PanelGroup(props, context) {
|
7721 | _classCallCheck(this, PanelGroup);
|
7722 |
|
7723 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
7724 |
|
7725 | _this.handleSelect = _this.handleSelect.bind(_this);
|
7726 |
|
7727 | _this.state = {
|
7728 | activeKey: props.defaultActiveKey
|
7729 | };
|
7730 | return _this;
|
7731 | }
|
7732 |
|
7733 | PanelGroup.prototype.handleSelect = function handleSelect(key, e) {
|
7734 | e.preventDefault();
|
7735 |
|
7736 | if (this.props.onSelect) {
|
7737 | this.props.onSelect(key, e);
|
7738 | }
|
7739 |
|
7740 | if (this.state.activeKey === key) {
|
7741 | key = null;
|
7742 | }
|
7743 |
|
7744 | this.setState({ activeKey: key });
|
7745 | };
|
7746 |
|
7747 | PanelGroup.prototype.render = function render() {
|
7748 | var _this2 = this;
|
7749 |
|
7750 | var _props = this.props,
|
7751 | accordion = _props.accordion,
|
7752 | propsActiveKey = _props.activeKey,
|
7753 | className = _props.className,
|
7754 | children = _props.children,
|
7755 | defaultActiveKey = _props.defaultActiveKey,
|
7756 | onSelect = _props.onSelect,
|
7757 | style = _props.style,
|
7758 | clsPrefix = _props.clsPrefix,
|
7759 | others = _objectWithoutProperties(_props, ['accordion', 'activeKey', 'className', 'children', 'defaultActiveKey', 'onSelect', 'style', 'clsPrefix']);
|
7760 |
|
7761 | var activeKey = void 0;
|
7762 | if (accordion) {
|
7763 | activeKey = propsActiveKey != null ? propsActiveKey : this.state.activeKey;
|
7764 | others.role = others.role || 'tablist';
|
7765 | }
|
7766 |
|
7767 | var classes = {};
|
7768 | classes['' + clsPrefix] = true;
|
7769 |
|
7770 | return _react2["default"].createElement(
|
7771 | 'div',
|
7772 | _extends({}, others, {
|
7773 | className: (0, _classnames2["default"])(className, classes)
|
7774 | }),
|
7775 | _react2["default"].Children.map(children, function (child) {
|
7776 | if (!_react2["default"].isValidElement(child)) {
|
7777 | return child;
|
7778 | }
|
7779 | var childProps = {
|
7780 | style: child.props.style
|
7781 | };
|
7782 |
|
7783 | if (accordion) {
|
7784 | _extends(childProps, {
|
7785 | headerRole: 'tab',
|
7786 | panelRole: 'tabpanel',
|
7787 | collapsible: true,
|
7788 | expanded: child.props.eventKey === activeKey,
|
7789 | onSelect: (0, _tinperBeeCore.createChainedFunction)(_this2.handleSelect, child.props.onSelect)
|
7790 | });
|
7791 | }
|
7792 |
|
7793 | return (0, _react.cloneElement)(child, childProps);
|
7794 | })
|
7795 | );
|
7796 | };
|
7797 |
|
7798 | return PanelGroup;
|
7799 | }(_react2["default"].Component);
|
7800 |
|
7801 | PanelGroup.propTypes = propTypes;
|
7802 | PanelGroup.defaultProps = defaultProps;
|
7803 |
|
7804 | exports["default"] = PanelGroup;
|
7805 | module.exports = exports['default'];
|
7806 |
|
7807 | }),
|
7808 |
|
7809 | (function(module, exports, __webpack_require__) {
|
7810 |
|
7811 | 'use strict';
|
7812 |
|
7813 | Object.defineProperty(exports, "__esModule", {
|
7814 | value: true
|
7815 | });
|
7816 |
|
7817 | var _Button = __webpack_require__(83);
|
7818 |
|
7819 | var _Button2 = _interopRequireDefault(_Button);
|
7820 |
|
7821 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7822 |
|
7823 | exports["default"] = _Button2["default"];
|
7824 | module.exports = exports['default'];
|
7825 |
|
7826 | }),
|
7827 |
|
7828 | (function(module, exports, __webpack_require__) {
|
7829 |
|
7830 | 'use strict';
|
7831 |
|
7832 | Object.defineProperty(exports, "__esModule", {
|
7833 | value: true
|
7834 | });
|
7835 |
|
7836 | 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; };
|
7837 |
|
7838 | var _react = __webpack_require__(4);
|
7839 |
|
7840 | var _react2 = _interopRequireDefault(_react);
|
7841 |
|
7842 | var _reactDom = __webpack_require__(12);
|
7843 |
|
7844 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7845 |
|
7846 | var _propTypes = __webpack_require__(5);
|
7847 |
|
7848 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7849 |
|
7850 | var _classnames = __webpack_require__(3);
|
7851 |
|
7852 | var _classnames2 = _interopRequireDefault(_classnames);
|
7853 |
|
7854 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7855 |
|
7856 | 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; }
|
7857 |
|
7858 | 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; }
|
7859 |
|
7860 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7861 |
|
7862 | 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; }
|
7863 |
|
7864 | 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); }
|
7865 |
|
7866 | var propTypes = {
|
7867 | |
7868 |
|
7869 |
|
7870 | size: _propTypes2["default"].oneOf(['sm', 'md', 'xg', 'lg']),
|
7871 | |
7872 |
|
7873 |
|
7874 | style: _propTypes2["default"].object,
|
7875 | |
7876 |
|
7877 |
|
7878 | shape: _propTypes2["default"].oneOf(['block', 'round', 'border', 'squared', 'floating', 'pillRight', 'pillLeft', 'icon']),
|
7879 |
|
7880 | bordered: _propTypes2["default"].bool,
|
7881 | |
7882 |
|
7883 |
|
7884 | colors: _propTypes2["default"].oneOf(['primary', 'secondary', 'accent', 'success', 'info', 'warning', 'danger', 'dark', 'light', 'default']),
|
7885 | |
7886 |
|
7887 |
|
7888 |
|
7889 | disabled: _propTypes2["default"].bool,
|
7890 | |
7891 |
|
7892 |
|
7893 |
|
7894 | className: _propTypes2["default"].string,
|
7895 |
|
7896 | |
7897 |
|
7898 |
|
7899 |
|
7900 | htmlType: _propTypes2["default"].oneOf(['submit', 'button', 'reset']),
|
7901 | isSubmit: _propTypes2["default"].bool
|
7902 | };
|
7903 |
|
7904 | var defaultProps = {
|
7905 | disabled: false,
|
7906 | htmlType: 'button',
|
7907 | clsPrefix: 'u-button',
|
7908 | bordered: false,
|
7909 | isSubmit: false
|
7910 | };
|
7911 |
|
7912 | var sizeMap = {
|
7913 | sm: 'sm',
|
7914 | md: 'md',
|
7915 | xg: 'xg',
|
7916 | lg: 'lg'
|
7917 | },
|
7918 | colorsMap = {
|
7919 | primary: 'primary',
|
7920 | secondary: 'secondary',
|
7921 | accent: 'accent',
|
7922 | success: 'success',
|
7923 | info: 'info',
|
7924 | warning: 'warning',
|
7925 | danger: 'danger',
|
7926 | dark: 'dark',
|
7927 | light: 'light'
|
7928 | },
|
7929 | shapeMap = {
|
7930 | block: 'block',
|
7931 | round: 'round',
|
7932 | border: 'border',
|
7933 | squared: 'squared',
|
7934 | floating: 'floating',
|
7935 | pillRight: 'pill-right',
|
7936 | pillLeft: 'pill-left',
|
7937 | icon: 'icon'
|
7938 | };
|
7939 |
|
7940 | var Button = function (_Component) {
|
7941 | _inherits(Button, _Component);
|
7942 |
|
7943 | function Button(props) {
|
7944 | _classCallCheck(this, Button);
|
7945 |
|
7946 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
7947 | }
|
7948 |
|
7949 | Button.prototype.render = function render() {
|
7950 | var _props = this.props,
|
7951 | colors = _props.colors,
|
7952 | shape = _props.shape,
|
7953 | disabled = _props.disabled,
|
7954 | className = _props.className,
|
7955 | size = _props.size,
|
7956 | bordered = _props.bordered,
|
7957 | children = _props.children,
|
7958 | htmlType = _props.htmlType,
|
7959 | clsPrefix = _props.clsPrefix,
|
7960 | isSubmit = _props.isSubmit,
|
7961 | others = _objectWithoutProperties(_props, ['colors', 'shape', 'disabled', 'className', 'size', 'bordered', 'children', 'htmlType', 'clsPrefix', 'isSubmit']);
|
7962 |
|
7963 | var clsObj = {};
|
7964 | if (className) {
|
7965 | clsObj[className] = true;
|
7966 | }
|
7967 | if (sizeMap[size]) {
|
7968 | clsObj[clsPrefix + '-' + sizeMap[size]] = true;
|
7969 | }
|
7970 |
|
7971 | if (shapeMap[shape]) {
|
7972 | clsObj[clsPrefix + '-' + shapeMap[shape]] = true;
|
7973 | }
|
7974 | if (colorsMap[colors]) {
|
7975 | clsObj[clsPrefix + '-' + colorsMap[colors]] = true;
|
7976 | }
|
7977 |
|
7978 | var classes = (0, _classnames2["default"])(clsPrefix, clsObj);
|
7979 | return _react2["default"].createElement(
|
7980 | 'button',
|
7981 | _extends({
|
7982 | type: htmlType,
|
7983 | className: classes,
|
7984 | disabled: disabled
|
7985 | }, others),
|
7986 | this.props.children
|
7987 | );
|
7988 | };
|
7989 |
|
7990 | return Button;
|
7991 | }(_react.Component);
|
7992 |
|
7993 | Button.propTypes = propTypes;
|
7994 | Button.defaultProps = defaultProps;
|
7995 |
|
7996 | exports["default"] = Button;
|
7997 | module.exports = exports['default'];
|
7998 |
|
7999 | }),
|
8000 |
|
8001 | (function(module, exports, __webpack_require__) {
|
8002 |
|
8003 | 'use strict';
|
8004 |
|
8005 | Object.defineProperty(exports, "__esModule", {
|
8006 | value: true
|
8007 | });
|
8008 |
|
8009 | var _react = __webpack_require__(4);
|
8010 |
|
8011 | var _react2 = _interopRequireDefault(_react);
|
8012 |
|
8013 | var _src = __webpack_require__(85);
|
8014 |
|
8015 | var _src2 = _interopRequireDefault(_src);
|
8016 |
|
8017 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
8018 |
|
8019 | 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; }
|
8020 |
|
8021 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8022 |
|
8023 | 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; }
|
8024 |
|
8025 | 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); } |
8026 |
|
8027 |
|
8028 |
|
8029 |
|
8030 | var Demo1 = function (_React$Component) {
|
8031 | _inherits(Demo1, _React$Component);
|
8032 |
|
8033 | function Demo1(props) {
|
8034 | _classCallCheck(this, Demo1);
|
8035 |
|
8036 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
8037 |
|
8038 | _this.dataNumSelect = function (index, value) {
|
8039 | console.log(index, value);
|
8040 | };
|
8041 |
|
8042 | _this.state = {
|
8043 | activePage: 1
|
8044 | };
|
8045 | return _this;
|
8046 | }
|
8047 |
|
8048 | Demo1.prototype.handleSelect = function handleSelect(eventKey) {
|
8049 | console.log(eventKey);
|
8050 | this.setState({
|
8051 | activePage: eventKey
|
8052 | });
|
8053 | };
|
8054 |
|
8055 | Demo1.prototype.render = function render() {
|
8056 | return _react2['default'].createElement(
|
8057 | 'div',
|
8058 | null,
|
8059 | _react2['default'].createElement(_src2['default'], {
|
8060 | first: true,
|
8061 | last: true,
|
8062 | prev: true,
|
8063 | next: true,
|
8064 | maxButtons: 5,
|
8065 | boundaryLinks: true,
|
8066 | activePage: this.state.activePage,
|
8067 | onSelect: this.handleSelect.bind(this),
|
8068 | onDataNumSelect: this.dataNumSelect,
|
8069 | showJump: true,
|
8070 | total: 100,
|
8071 | dataNum: 2
|
8072 | })
|
8073 | );
|
8074 | };
|
8075 |
|
8076 | return Demo1;
|
8077 | }(_react2['default'].Component);
|
8078 |
|
8079 | exports['default'] = Demo1;
|
8080 | module.exports = exports['default'];
|
8081 |
|
8082 | }),
|
8083 |
|
8084 | (function(module, exports, __webpack_require__) {
|
8085 |
|
8086 | 'use strict';
|
8087 |
|
8088 | Object.defineProperty(exports, "__esModule", {
|
8089 | value: true
|
8090 | });
|
8091 |
|
8092 | var _Pagination = __webpack_require__(86);
|
8093 |
|
8094 | var _Pagination2 = _interopRequireDefault(_Pagination);
|
8095 |
|
8096 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
8097 |
|
8098 | exports['default'] = _Pagination2['default'];
|
8099 | module.exports = exports['default'];
|
8100 |
|
8101 | }),
|
8102 |
|
8103 | (function(module, exports, __webpack_require__) {
|
8104 |
|
8105 | "use strict";
|
8106 |
|
8107 | Object.defineProperty(exports, "__esModule", {
|
8108 | value: true
|
8109 | });
|
8110 |
|
8111 | 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; };
|
8112 |
|
8113 | var _classnames2 = __webpack_require__(3);
|
8114 |
|
8115 | var _classnames3 = _interopRequireDefault(_classnames2);
|
8116 |
|
8117 | var _react = __webpack_require__(4);
|
8118 |
|
8119 | var _react2 = _interopRequireDefault(_react);
|
8120 |
|
8121 | var _PaginationButton = __webpack_require__(87);
|
8122 |
|
8123 | var _PaginationButton2 = _interopRequireDefault(_PaginationButton);
|
8124 |
|
8125 | var _beeButton = __webpack_require__(82);
|
8126 |
|
8127 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
8128 |
|
8129 | var _beeSelect = __webpack_require__(88);
|
8130 |
|
8131 | var _beeSelect2 = _interopRequireDefault(_beeSelect);
|
8132 |
|
8133 | var _beeIcon = __webpack_require__(241);
|
8134 |
|
8135 | var _beeIcon2 = _interopRequireDefault(_beeIcon);
|
8136 |
|
8137 | var _objectAssign = __webpack_require__(44);
|
8138 |
|
8139 | var _objectAssign2 = _interopRequireDefault(_objectAssign);
|
8140 |
|
8141 | var _propTypes = __webpack_require__(5);
|
8142 |
|
8143 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
8144 |
|
8145 | var _i18n = __webpack_require__(243);
|
8146 |
|
8147 | var _i18n2 = _interopRequireDefault(_i18n);
|
8148 |
|
8149 | var _tool = __webpack_require__(244);
|
8150 |
|
8151 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
8152 |
|
8153 | 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; }
|
8154 |
|
8155 | 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; }
|
8156 |
|
8157 | 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; }
|
8158 |
|
8159 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8160 |
|
8161 | 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; }
|
8162 |
|
8163 | 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); }
|
8164 |
|
8165 | var Option = _beeSelect2["default"].Option;
|
8166 |
|
8167 | var propTypes = {
|
8168 | |
8169 |
|
8170 |
|
8171 | activePage: _propTypes2["default"].number,
|
8172 | |
8173 |
|
8174 |
|
8175 | items: _propTypes2["default"].number,
|
8176 | |
8177 |
|
8178 |
|
8179 | maxButtons: _propTypes2["default"].number,
|
8180 |
|
8181 | |
8182 |
|
8183 |
|
8184 | boundaryLinks: _propTypes2["default"].bool,
|
8185 |
|
8186 | |
8187 |
|
8188 |
|
8189 |
|
8190 | ellipsis: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].node]),
|
8191 |
|
8192 | |
8193 |
|
8194 |
|
8195 | first: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].node]),
|
8196 |
|
8197 | |
8198 |
|
8199 |
|
8200 | last: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].node]),
|
8201 |
|
8202 | |
8203 |
|
8204 |
|
8205 | prev: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].node]),
|
8206 |
|
8207 | |
8208 |
|
8209 |
|
8210 | next: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].node]),
|
8211 |
|
8212 | |
8213 |
|
8214 |
|
8215 | onSelect: _propTypes2["default"].func,
|
8216 |
|
8217 | |
8218 |
|
8219 |
|
8220 | buttonComponentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]),
|
8221 | |
8222 |
|
8223 |
|
8224 | dataNumSelect: _propTypes2["default"].array,
|
8225 | |
8226 |
|
8227 |
|
8228 | dataNum: _propTypes2["default"].number,
|
8229 | |
8230 |
|
8231 |
|
8232 | showJump: _propTypes2["default"].bool,
|
8233 | |
8234 |
|
8235 |
|
8236 | total: _propTypes2["default"].number,
|
8237 | |
8238 |
|
8239 |
|
8240 | disabled: _propTypes2["default"].bool,
|
8241 | |
8242 |
|
8243 |
|
8244 | btnType: _propTypes2["default"].object,
|
8245 | |
8246 |
|
8247 |
|
8248 | confirmBtn: _propTypes2["default"].func
|
8249 | };
|
8250 |
|
8251 | var defaultProps = {
|
8252 | activePage: 1,
|
8253 | maxButtons: 0,
|
8254 | first: false,
|
8255 | last: false,
|
8256 | prev: false,
|
8257 | next: false,
|
8258 | ellipsis: true,
|
8259 | boundaryLinks: false,
|
8260 | clsPrefix: "u-pagination",
|
8261 | gap: false,
|
8262 | noBorder: true,
|
8263 | dataNumSelect: ['5', '10', '15', '20'],
|
8264 | dataNum: 1,
|
8265 | showJump: false,
|
8266 | locale: {},
|
8267 | disabled: false,
|
8268 | btnType: { shape: 'border' },
|
8269 | confirmBtn: function confirmBtn() {}
|
8270 | };
|
8271 |
|
8272 | var Pagination = function (_React$Component) {
|
8273 | _inherits(Pagination, _React$Component);
|
8274 |
|
8275 | function Pagination(props, context) {
|
8276 | _classCallCheck(this, Pagination);
|
8277 |
|
8278 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
8279 |
|
8280 | _this.onKeyup = function (e) {
|
8281 | e.keyCode === 13 && _this.handleEnsurePageJump();
|
8282 | };
|
8283 |
|
8284 | _this.setPageJump = function (e) {
|
8285 | var value = e.target.value;
|
8286 |
|
8287 | if (value !== '' && (isNaN(Number(value)) || value > _this.state.items || value <= 0)) {
|
8288 | return false;
|
8289 | } else {
|
8290 | _this.setState({
|
8291 | jumpPageState: value
|
8292 | });
|
8293 | }
|
8294 | };
|
8295 |
|
8296 | _this.handleEnsurePageJump = function () {
|
8297 | var jumpPageState = _this.state.jumpPageState;
|
8298 | var onSelect = _this.props.onSelect;
|
8299 |
|
8300 | if (jumpPageState === '') {
|
8301 | return;
|
8302 | }
|
8303 | _this.setState({
|
8304 | activePage: jumpPageState * 1,
|
8305 | jumpPageState: ''
|
8306 | });
|
8307 | if (typeof onSelect === 'function') {
|
8308 | onSelect(jumpPageState * 1);
|
8309 | }
|
8310 | };
|
8311 |
|
8312 | _this.dataNumSelect = function (value) {
|
8313 |
|
8314 | var _this$props = _this.props,
|
8315 | onDataNumSelect = _this$props.onDataNumSelect,
|
8316 | total = _this$props.total;
|
8317 |
|
8318 | var dataNumValue = _this.props.dataNumSelect[value];
|
8319 |
|
8320 | if (total) {
|
8321 | _this.setState({
|
8322 |
|
8323 | items: Number.isNaN(parseInt(dataNumValue)) ? 1 : Math.ceil(total / dataNumValue)
|
8324 | });
|
8325 | }
|
8326 | _this.setState({
|
8327 | dataNum: value
|
8328 | });
|
8329 | if (typeof onDataNumSelect === 'function') {
|
8330 | onDataNumSelect(value, dataNumValue);
|
8331 | }
|
8332 | };
|
8333 |
|
8334 | _this.state = {
|
8335 | activePage: _this.props.activePage,
|
8336 | dataNum: props.dataNum,
|
8337 | items: props.items ? props.items : props.total ? Math.ceil(props.total / props.dataNumSelect[props.dataNum]) : 1,
|
8338 | jumpPageState: ''
|
8339 | };
|
8340 | return _this;
|
8341 | }
|
8342 |
|
8343 | Pagination.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
8344 | if (this.state.activePage !== nextProps.activePage) {
|
8345 | this.setState({
|
8346 | activePage: nextProps.activePage
|
8347 | });
|
8348 | }
|
8349 | if (nextProps.dataNum && this.props.dataNum !== nextProps.dataNum) {
|
8350 | this.setState({
|
8351 | dataNum: nextProps.dataNum,
|
8352 |
|
8353 | items: Number.isNaN(parseInt(nextProps.dataNumSelect[nextProps.dataNum])) ? 1 : Math.ceil(nextProps.total / nextProps.dataNumSelect[nextProps.dataNum])
|
8354 | });
|
8355 | }
|
8356 | if (nextProps.items && this.props.items !== nextProps.items) {
|
8357 | this.setState({
|
8358 | items: nextProps.items
|
8359 | });
|
8360 | }
|
8361 | };
|
8362 |
|
8363 | |
8364 |
|
8365 |
|
8366 |
|
8367 |
|
8368 | |
8369 |
|
8370 |
|
8371 |
|
8372 |
|
8373 |
|
8374 | |
8375 |
|
8376 |
|
8377 |
|
8378 |
|
8379 |
|
8380 |
|
8381 |
|
8382 |
|
8383 |
|
8384 | Pagination.prototype.renderPageButtons = function renderPageButtons(activePage, items, maxButtons, boundaryLinks, ellipsis, buttonProps) {
|
8385 | var pageButtons = [];
|
8386 |
|
8387 | var startPage = void 0;
|
8388 | var endPage = void 0;
|
8389 | var hasHiddenPagesAfter = void 0;
|
8390 |
|
8391 | if (maxButtons) {
|
8392 |
|
8393 | var hiddenPagesBefore = activePage - parseInt(maxButtons / 2, 10);
|
8394 | startPage = hiddenPagesBefore > 2 ? hiddenPagesBefore : 1;
|
8395 |
|
8396 | hasHiddenPagesAfter = startPage + maxButtons < items + 1;
|
8397 |
|
8398 | if (!hasHiddenPagesAfter) {
|
8399 | endPage = items;
|
8400 | startPage = items - maxButtons + 1;
|
8401 | if (startPage < 1) {
|
8402 | startPage = 1;
|
8403 | }
|
8404 | } else {
|
8405 | endPage = startPage + maxButtons - 1;
|
8406 | }
|
8407 | } else {
|
8408 | startPage = 1;
|
8409 | endPage = items;
|
8410 | }
|
8411 |
|
8412 | for (var pagenumber = startPage; pagenumber <= endPage; pagenumber++) {
|
8413 | pageButtons.push(_react2["default"].createElement(
|
8414 | _PaginationButton2["default"],
|
8415 | _extends({}, buttonProps, {
|
8416 | key: pagenumber,
|
8417 | eventKey: pagenumber,
|
8418 | active: pagenumber === activePage
|
8419 | }),
|
8420 | pagenumber
|
8421 | ));
|
8422 | }
|
8423 |
|
8424 | if (boundaryLinks && ellipsis && startPage !== 1) {
|
8425 | if (startPage > 2) {
|
8426 | pageButtons.unshift(_react2["default"].createElement(
|
8427 | _PaginationButton2["default"],
|
8428 | {
|
8429 | key: "ellipsisFirst",
|
8430 | disabled: true,
|
8431 | componentClass: buttonProps.componentClass
|
8432 | },
|
8433 | _react2["default"].createElement(
|
8434 | "span",
|
8435 | { "aria-label": "More" },
|
8436 | ellipsis === true ? "\u2026" : ellipsis
|
8437 | )
|
8438 | ));
|
8439 | }
|
8440 |
|
8441 | pageButtons.unshift(_react2["default"].createElement(
|
8442 | _PaginationButton2["default"],
|
8443 | _extends({}, buttonProps, { key: 1, eventKey: 1, active: false }),
|
8444 | "1"
|
8445 | ));
|
8446 | }
|
8447 |
|
8448 | if (maxButtons && hasHiddenPagesAfter && ellipsis) {
|
8449 | if (!boundaryLinks || boundaryLinks && items > 1 + endPage) {
|
8450 | pageButtons.push(_react2["default"].createElement(
|
8451 | _PaginationButton2["default"],
|
8452 | {
|
8453 | key: "ellipsis",
|
8454 | disabled: true,
|
8455 | componentClass: buttonProps.componentClass
|
8456 | },
|
8457 | _react2["default"].createElement(
|
8458 | "span",
|
8459 | { "aria-label": "More" },
|
8460 | ellipsis === true ? "\u2026" : ellipsis
|
8461 | )
|
8462 | ));
|
8463 | }
|
8464 |
|
8465 | if (boundaryLinks && endPage !== items) {
|
8466 | pageButtons.push(_react2["default"].createElement(
|
8467 | _PaginationButton2["default"],
|
8468 | _extends({}, buttonProps, {
|
8469 | key: items,
|
8470 | eventKey: items,
|
8471 | active: false
|
8472 | }),
|
8473 | items
|
8474 | ));
|
8475 | }
|
8476 | }
|
8477 |
|
8478 | return pageButtons;
|
8479 | };
|
8480 |
|
8481 | Pagination.prototype.render = function render() {
|
8482 | var local = (0, _tool.getComponentLocale)(this.props, this.context, 'Pagination', function () {
|
8483 | return _i18n2["default"];
|
8484 | });
|
8485 |
|
8486 | var _props = this.props,
|
8487 | items = _props.items,
|
8488 | maxButtons = _props.maxButtons,
|
8489 | boundaryLinks = _props.boundaryLinks,
|
8490 | ellipsis = _props.ellipsis,
|
8491 | first = _props.first,
|
8492 | last = _props.last,
|
8493 | prev = _props.prev,
|
8494 | next = _props.next,
|
8495 | onSelect = _props.onSelect,
|
8496 | buttonComponentClass = _props.buttonComponentClass,
|
8497 | noBorder = _props.noBorder,
|
8498 | className = _props.className,
|
8499 | clsPrefix = _props.clsPrefix,
|
8500 | size = _props.size,
|
8501 | gap = _props.gap,
|
8502 | onDataNumSelect = _props.onDataNumSelect,
|
8503 | dataNumSelect = _props.dataNumSelect,
|
8504 | dataNum = _props.dataNum,
|
8505 | activePage = _props.activePage,
|
8506 | showJump = _props.showJump,
|
8507 | total = _props.total,
|
8508 | disabled = _props.disabled,
|
8509 | btnType = _props.btnType,
|
8510 | confirmBtn = _props.confirmBtn,
|
8511 | others = _objectWithoutProperties(_props, ["items", "maxButtons", "boundaryLinks", "ellipsis", "first", "last", "prev", "next", "onSelect", "buttonComponentClass", "noBorder", "className", "clsPrefix", "size", "gap", "onDataNumSelect", "dataNumSelect", "dataNum", "activePage", "showJump", "total", "disabled", "btnType", "confirmBtn"]);
|
8512 |
|
8513 | var activePageState = this.state.activePage;
|
8514 | var jumpPageState = this.state.jumpPageState;
|
8515 |
|
8516 | var btnDom = confirmBtn((0, _objectAssign2["default"])({}, this.props));
|
8517 |
|
8518 | var classes = {};
|
8519 | if (noBorder) {
|
8520 | classes[clsPrefix + "-no-border"] = true;
|
8521 | }
|
8522 | if (size) {
|
8523 | classes[clsPrefix + "-" + size] = true;
|
8524 | }
|
8525 | if (gap) {
|
8526 | classes[clsPrefix + "-gap"] = true;
|
8527 | }
|
8528 | if (!!btnDom) {
|
8529 | classes[clsPrefix + "-with-jumpbtn"] = true;
|
8530 | }
|
8531 |
|
8532 | var classNames = (0, _classnames3["default"])(clsPrefix + "-list", classes);
|
8533 | var wrapperClass = (0, _classnames3["default"])(clsPrefix, _defineProperty({}, clsPrefix + "-disabled", disabled));
|
8534 | |
8535 |
|
8536 |
|
8537 |
|
8538 |
|
8539 | var buttonProps = {
|
8540 | onSelect: onSelect,
|
8541 | componentClass: buttonComponentClass
|
8542 | };
|
8543 | var jumpBtn = btnDom ? _react2["default"].createElement(
|
8544 | "div",
|
8545 | { className: "page_jump_btn", onClick: this.handleEnsurePageJump },
|
8546 | btnDom
|
8547 | ) : null;
|
8548 | return _react2["default"].createElement(
|
8549 | "div",
|
8550 | { className: (0, _classnames3["default"])(wrapperClass, className) },
|
8551 | disabled && _react2["default"].createElement("div", { className: clsPrefix + "-disabled-mask" }),
|
8552 | _react2["default"].createElement(
|
8553 | "ul",
|
8554 | _extends({}, others, { className: classNames }),
|
8555 | first && _react2["default"].createElement(
|
8556 | _PaginationButton2["default"],
|
8557 | _extends({}, buttonProps, {
|
8558 | eventKey: 1,
|
8559 | disabled: activePageState === 1,
|
8560 | iconBtn: true
|
8561 |
|
8562 | }),
|
8563 | _react2["default"].createElement(_beeIcon2["default"], { type: "uf-2arrow-left" })
|
8564 | ),
|
8565 | prev && _react2["default"].createElement(
|
8566 | _PaginationButton2["default"],
|
8567 | _extends({}, buttonProps, {
|
8568 | eventKey: activePageState - 1,
|
8569 | disabled: activePageState === 1,
|
8570 | iconBtn: true
|
8571 |
|
8572 | }),
|
8573 | _react2["default"].createElement(_beeIcon2["default"], { type: "uf-arrow-left" })
|
8574 | ),
|
8575 | this.renderPageButtons(activePageState, this.state.items, maxButtons, boundaryLinks, ellipsis, buttonProps),
|
8576 | next && _react2["default"].createElement(
|
8577 | _PaginationButton2["default"],
|
8578 | _extends({}, buttonProps, {
|
8579 | eventKey: activePageState + 1,
|
8580 | disabled: activePageState >= this.state.items,
|
8581 | iconBtn: true
|
8582 | }),
|
8583 | _react2["default"].createElement(_beeIcon2["default"], { type: "uf-arrow-right" })
|
8584 | ),
|
8585 | last && _react2["default"].createElement(
|
8586 | _PaginationButton2["default"],
|
8587 | _extends({}, buttonProps, {
|
8588 | eventKey: this.state.items,
|
8589 | disabled: activePageState >= this.state.items,
|
8590 | iconBtn: true
|
8591 | }),
|
8592 | _react2["default"].createElement(_beeIcon2["default"], { type: "uf-2arrow-right" })
|
8593 | )
|
8594 | ),
|
8595 | total != null ? _react2["default"].createElement(
|
8596 | "div",
|
8597 | { className: clsPrefix + "-total" },
|
8598 | local['total'],
|
8599 | _react2["default"].createElement(
|
8600 | "span",
|
8601 | null,
|
8602 | total
|
8603 | ),
|
8604 | local['items']
|
8605 | ) : null,
|
8606 | showJump ? _react2["default"].createElement(
|
8607 | "div",
|
8608 | { className: "data_per_select" },
|
8609 | _react2["default"].createElement(
|
8610 | "span",
|
8611 | null,
|
8612 | local['show']
|
8613 | ),
|
8614 | _react2["default"].createElement(
|
8615 | _beeSelect2["default"]
|
8616 |
|
8617 | ,
|
8618 | { value: this.state.dataNum,
|
8619 | onChange: this.dataNumSelect },
|
8620 | dataNumSelect.length > 0 && dataNumSelect.map(function (item, i) {
|
8621 | return _react2["default"].createElement(
|
8622 | Option,
|
8623 | { key: i, value: i },
|
8624 | item
|
8625 | );
|
8626 | })
|
8627 | ),
|
8628 | _react2["default"].createElement(
|
8629 | "span",
|
8630 | null,
|
8631 | local['items']
|
8632 | )
|
8633 | ) : null,
|
8634 | showJump ? _react2["default"].createElement(
|
8635 | "div",
|
8636 | { className: "page_jump" },
|
8637 | _react2["default"].createElement(
|
8638 | "span",
|
8639 | null,
|
8640 | local['goto']
|
8641 | ),
|
8642 | _react2["default"].createElement("input", {
|
8643 | className: "page_jump_value",
|
8644 | value: jumpPageState,
|
8645 | onKeyDown: this.onKeyup,
|
8646 | onChange: this.setPageJump
|
8647 | }),
|
8648 | _react2["default"].createElement(
|
8649 | "span",
|
8650 | null,
|
8651 | local['page']
|
8652 | ),
|
8653 | jumpBtn
|
8654 | ) : null
|
8655 | );
|
8656 | };
|
8657 |
|
8658 | return Pagination;
|
8659 | }(_react2["default"].Component);
|
8660 |
|
8661 | Pagination.propTypes = propTypes;
|
8662 | Pagination.defaultProps = defaultProps;
|
8663 | Pagination.contextTypes = {
|
8664 | beeLocale: _propTypes2["default"].object
|
8665 | };
|
8666 | exports["default"] = Pagination;
|
8667 | module.exports = exports["default"];
|
8668 |
|
8669 | }),
|
8670 |
|
8671 | (function(module, exports, __webpack_require__) {
|
8672 |
|
8673 | 'use strict';
|
8674 |
|
8675 | Object.defineProperty(exports, "__esModule", {
|
8676 | value: true
|
8677 | });
|
8678 |
|
8679 | 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; };
|
8680 |
|
8681 | var _classnames = __webpack_require__(3);
|
8682 |
|
8683 | var _classnames2 = _interopRequireDefault(_classnames);
|
8684 |
|
8685 | var _react = __webpack_require__(4);
|
8686 |
|
8687 | var _react2 = _interopRequireDefault(_react);
|
8688 |
|
8689 | var _propTypes = __webpack_require__(5);
|
8690 |
|
8691 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
8692 |
|
8693 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
8694 |
|
8695 | 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; }
|
8696 |
|
8697 | 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; }
|
8698 |
|
8699 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8700 |
|
8701 | 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; }
|
8702 |
|
8703 | 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); }
|
8704 |
|
8705 | var propTypes = {
|
8706 | className: _propTypes2['default'].string,
|
8707 | eventKey: _propTypes2['default'].any,
|
8708 | onSelect: _propTypes2['default'].func,
|
8709 | disabled: _propTypes2['default'].bool,
|
8710 | active: _propTypes2['default'].bool,
|
8711 | onClick: _propTypes2['default'].func
|
8712 | };
|
8713 |
|
8714 | var defaultProps = {
|
8715 | componentClass: 'a',
|
8716 | active: false,
|
8717 | disabled: false
|
8718 | };
|
8719 |
|
8720 | var PaginationButton = function (_React$Component) {
|
8721 | _inherits(PaginationButton, _React$Component);
|
8722 |
|
8723 | function PaginationButton(props, context) {
|
8724 | _classCallCheck(this, PaginationButton);
|
8725 |
|
8726 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
8727 |
|
8728 | _this.handleClick = _this.handleClick.bind(_this);
|
8729 | return _this;
|
8730 | }
|
8731 |
|
8732 | PaginationButton.prototype.handleClick = function handleClick(event) {
|
8733 | var _props = this.props,
|
8734 | disabled = _props.disabled,
|
8735 | onSelect = _props.onSelect,
|
8736 | eventKey = _props.eventKey;
|
8737 |
|
8738 |
|
8739 | if (disabled) {
|
8740 | return;
|
8741 | }
|
8742 |
|
8743 | if (onSelect) {
|
8744 | onSelect(eventKey, event);
|
8745 | }
|
8746 | };
|
8747 |
|
8748 | PaginationButton.prototype.render = function render() {
|
8749 | var _props2 = this.props,
|
8750 | Component = _props2.componentClass,
|
8751 | active = _props2.active,
|
8752 | disabled = _props2.disabled,
|
8753 | onClick = _props2.onClick,
|
8754 | eventKey = _props2.eventKey,
|
8755 | className = _props2.className,
|
8756 | style = _props2.style,
|
8757 | iconBtn = _props2.iconBtn,
|
8758 | props = _objectWithoutProperties(_props2, ['componentClass', 'active', 'disabled', 'onClick', 'eventKey', 'className', 'style', 'iconBtn']);
|
8759 |
|
8760 | delete props.onSelect;
|
8761 | return _react2['default'].createElement(
|
8762 | 'li',
|
8763 | {
|
8764 | className: (0, _classnames2['default'])(className, { active: active, disabled: disabled, iconBtn: iconBtn }),
|
8765 | style: style
|
8766 | },
|
8767 | _react2['default'].createElement(Component, _extends({}, props, {
|
8768 | disabled: disabled,
|
8769 | onClick: this.handleClick
|
8770 | }))
|
8771 | );
|
8772 | };
|
8773 |
|
8774 | return PaginationButton;
|
8775 | }(_react2['default'].Component);
|
8776 |
|
8777 | PaginationButton.propTypes = propTypes;
|
8778 | PaginationButton.defaultProps = defaultProps;
|
8779 |
|
8780 | exports['default'] = PaginationButton;
|
8781 | module.exports = exports['default'];
|
8782 |
|
8783 | }),
|
8784 |
|
8785 | (function(module, exports, __webpack_require__) {
|
8786 |
|
8787 | 'use strict';
|
8788 |
|
8789 | Object.defineProperty(exports, "__esModule", {
|
8790 | value: true
|
8791 | });
|
8792 |
|
8793 | var _Select = __webpack_require__(89);
|
8794 |
|
8795 | var _Select2 = _interopRequireDefault(_Select);
|
8796 |
|
8797 | var _Option = __webpack_require__(226);
|
8798 |
|
8799 | var _Option2 = _interopRequireDefault(_Option);
|
8800 |
|
8801 | var _PropTypes = __webpack_require__(239);
|
8802 |
|
8803 | var _OptGroup = __webpack_require__(240);
|
8804 |
|
8805 | var _OptGroup2 = _interopRequireDefault(_OptGroup);
|
8806 |
|
8807 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
8808 |
|
8809 | _Select2["default"].Option = _Option2["default"];
|
8810 | _Select2["default"].OptGroup = _OptGroup2["default"];
|
8811 | exports["default"] = _Select2["default"];
|
8812 | module.exports = exports['default'];
|
8813 |
|
8814 | }),
|
8815 |
|
8816 | (function(module, exports, __webpack_require__) {
|
8817 |
|
8818 | "use strict";
|
8819 |
|
8820 | Object.defineProperty(exports, "__esModule", {
|
8821 | value: true
|
8822 | });
|
8823 |
|
8824 | 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; };
|
8825 |
|
8826 | var _react = __webpack_require__(4);
|
8827 |
|
8828 | var _react2 = _interopRequireDefault(_react);
|
8829 |
|
8830 | var _propTypes = __webpack_require__(5);
|
8831 |
|
8832 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
8833 |
|
8834 | var _RcSelect = __webpack_require__(90);
|
8835 |
|
8836 | var _RcSelect2 = _interopRequireDefault(_RcSelect);
|
8837 |
|
8838 | var _Option = __webpack_require__(226);
|
8839 |
|
8840 | var _Option2 = _interopRequireDefault(_Option);
|
8841 |
|
8842 | var _OptGroup = __webpack_require__(240);
|
8843 |
|
8844 | var _OptGroup2 = _interopRequireDefault(_OptGroup);
|
8845 |
|
8846 | var _classnames = __webpack_require__(3);
|
8847 |
|
8848 | var _classnames2 = _interopRequireDefault(_classnames);
|
8849 |
|
8850 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
8851 |
|
8852 | 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; }
|
8853 |
|
8854 | 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; }
|
8855 |
|
8856 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8857 |
|
8858 | 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; }
|
8859 |
|
8860 | 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); } |
8861 |
|
8862 |
|
8863 |
|
8864 |
|
8865 |
|
8866 | var SelectContext = {
|
8867 | antLocale: {
|
8868 | Select: _propTypes2["default"].any
|
8869 | }
|
8870 | };
|
8871 |
|
8872 | var defaultProps = {
|
8873 | clsPrefix: "u-select",
|
8874 | showSearch: false,
|
8875 | transitionName: "slide-up",
|
8876 | choiceTransitionName: "zoom"
|
8877 | };
|
8878 |
|
8879 | var propTypes = {
|
8880 | clsPrefix: _propTypes2["default"].string,
|
8881 | className: _propTypes2["default"].string,
|
8882 | value: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].any]),
|
8883 | defaultValue: _propTypes2["default"].oneOfType([_propTypes2["default"].node, _propTypes2["default"].array, _propTypes2["default"].any]),
|
8884 | size: _propTypes2["default"].oneOf(["default", "lg", "sm"]),
|
8885 | combobox: _propTypes2["default"].bool,
|
8886 | notFoundContent: _propTypes2["default"].oneOfType([_propTypes2["default"].node, _propTypes2["default"].array, _propTypes2["default"].any]),
|
8887 | showSearch: _propTypes2["default"].bool,
|
8888 | open: _propTypes2["default"].bool,
|
8889 | transitionName: _propTypes2["default"].string,
|
8890 | choiceTransitionName: _propTypes2["default"].string,
|
8891 | multiple: _propTypes2["default"].bool,
|
8892 | allowClear: _propTypes2["default"].bool,
|
8893 | filterOption: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].func]),
|
8894 | tags: _propTypes2["default"].bool,
|
8895 | onSelect: _propTypes2["default"].func,
|
8896 | onDeselect: _propTypes2["default"].func,
|
8897 | onSearch: _propTypes2["default"].func,
|
8898 | placeholder: _propTypes2["default"].string,
|
8899 | dropdownMatchSelectWidth: _propTypes2["default"].bool,
|
8900 | optionFilterProp: _propTypes2["default"].string,
|
8901 | optionLabelProp: _propTypes2["default"].string,
|
8902 | disabled: _propTypes2["default"].bool,
|
8903 | defaultActiveFirstOption: _propTypes2["default"].bool,
|
8904 | labelInValue: _propTypes2["default"].bool,
|
8905 | getPopupContainer: _propTypes2["default"].func,
|
8906 | style: _propTypes2["default"].object,
|
8907 | dropdownStyle: _propTypes2["default"].object,
|
8908 | dropdownMenuStyle: _propTypes2["default"].object,
|
8909 | onChange: _propTypes2["default"].func,
|
8910 | scrollToEnd: _propTypes2["default"].func
|
8911 | };
|
8912 |
|
8913 | var Select = function (_Component) {
|
8914 | _inherits(Select, _Component);
|
8915 |
|
8916 | function Select(props) {
|
8917 | _classCallCheck(this, Select);
|
8918 |
|
8919 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
8920 | }
|
8921 |
|
8922 | Select.prototype.render = function render() {
|
8923 | var _classNames;
|
8924 |
|
8925 | var _props = this.props,
|
8926 | clsPrefix = _props.clsPrefix,
|
8927 | _props$className = _props.className,
|
8928 | className = _props$className === undefined ? "" : _props$className,
|
8929 | size = _props.size,
|
8930 | data = _props.data,
|
8931 | showSearch = _props.showSearch,
|
8932 | combobox = _props.combobox;
|
8933 | var _props2 = this.props,
|
8934 | _props2$notFoundConte = _props2.notFoundContent,
|
8935 | notFoundContent = _props2$notFoundConte === undefined ? "Not Found" : _props2$notFoundConte,
|
8936 | optionLabelProp = _props2.optionLabelProp;
|
8937 |
|
8938 |
|
8939 | var cls = (0, _classnames2["default"])((_classNames = {}, _defineProperty(_classNames, clsPrefix + "-lg", size === "lg"), _defineProperty(_classNames, clsPrefix + "-sm", size === "sm"), _defineProperty(_classNames, clsPrefix + "-show-search", showSearch), _classNames), className);
|
8940 |
|
8941 | var antLocale = this.context.antLocale;
|
8942 |
|
8943 | if (antLocale && antLocale.Select) {
|
8944 | notFoundContent = "notFoundContent" in this.props ? notFoundContent : antLocale.Select.notFoundContent;
|
8945 | }
|
8946 |
|
8947 | if (combobox) {
|
8948 | notFoundContent = null;
|
8949 |
|
8950 | optionLabelProp = optionLabelProp || "value";
|
8951 | }
|
8952 | if (data) {
|
8953 | data.map(function (item) {
|
8954 | return _react2["default"].createElement(
|
8955 | _Option2["default"],
|
8956 | { value: item.value },
|
8957 | item.key
|
8958 | );
|
8959 | });
|
8960 | }
|
8961 | return data ? _react2["default"].createElement(
|
8962 | _RcSelect2["default"],
|
8963 | _extends({}, this.props, {
|
8964 | className: cls,
|
8965 | optionLabelProp: optionLabelProp || "children",
|
8966 | notFoundContent: notFoundContent
|
8967 | }),
|
8968 | data.map(function (item) {
|
8969 | return _react2["default"].createElement(
|
8970 | _Option2["default"],
|
8971 | { key: item.value, value: item.value, disabled: item.disabled ? true : false },
|
8972 | item.key
|
8973 | );
|
8974 | })
|
8975 | ) : _react2["default"].createElement(_RcSelect2["default"], _extends({}, this.props, {
|
8976 | className: cls,
|
8977 | optionLabelProp: optionLabelProp || "children",
|
8978 | notFoundContent: notFoundContent
|
8979 | }));
|
8980 | };
|
8981 |
|
8982 | return Select;
|
8983 | }(_react.Component);
|
8984 |
|
8985 | Select.context = SelectContext;
|
8986 | Select.propTypes = propTypes;
|
8987 | Select.defaultProps = defaultProps;
|
8988 | Select.Option = _Option2["default"];
|
8989 | Select.OptGroup = _OptGroup2["default"];
|
8990 |
|
8991 | exports["default"] = Select;
|
8992 | module.exports = exports["default"];
|
8993 |
|
8994 | }),
|
8995 |
|
8996 | (function(module, exports, __webpack_require__) {
|
8997 |
|
8998 | 'use strict';
|
8999 |
|
9000 | Object.defineProperty(exports, "__esModule", {
|
9001 | value: true
|
9002 | });
|
9003 |
|
9004 | 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; };
|
9005 |
|
9006 | var _react = __webpack_require__(4);
|
9007 |
|
9008 | var _react2 = _interopRequireDefault(_react);
|
9009 |
|
9010 | var _reactDom = __webpack_require__(12);
|
9011 |
|
9012 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
9013 |
|
9014 | var _reactLifecyclesCompat = __webpack_require__(91);
|
9015 |
|
9016 | var _tinperBeeCore = __webpack_require__(27);
|
9017 |
|
9018 | var _classnames2 = __webpack_require__(3);
|
9019 |
|
9020 | var _classnames3 = _interopRequireDefault(_classnames2);
|
9021 |
|
9022 | var _beeAnimate = __webpack_require__(69);
|
9023 |
|
9024 | var _beeAnimate2 = _interopRequireDefault(_beeAnimate);
|
9025 |
|
9026 | var _componentClasses = __webpack_require__(47);
|
9027 |
|
9028 | var _componentClasses2 = _interopRequireDefault(_componentClasses);
|
9029 |
|
9030 | var _rcMenu = __webpack_require__(92);
|
9031 |
|
9032 | var _warning = __webpack_require__(32);
|
9033 |
|
9034 | var _warning2 = _interopRequireDefault(_warning);
|
9035 |
|
9036 | var _Option = __webpack_require__(226);
|
9037 |
|
9038 | var _Option2 = _interopRequireDefault(_Option);
|
9039 |
|
9040 | var _util = __webpack_require__(227);
|
9041 |
|
9042 | var _SelectTrigger = __webpack_require__(228);
|
9043 |
|
9044 | var _SelectTrigger2 = _interopRequireDefault(_SelectTrigger);
|
9045 |
|
9046 | var _PropTypes = __webpack_require__(239);
|
9047 |
|
9048 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
9049 |
|
9050 | 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; }
|
9051 |
|
9052 | 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; }
|
9053 |
|
9054 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
9055 |
|
9056 | 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; }
|
9057 |
|
9058 | 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); } |
9059 |
|
9060 |
|
9061 |
|
9062 |
|
9063 |
|
9064 | function noop() {}
|
9065 |
|
9066 | function chaining() {
|
9067 | for (var _len = arguments.length, fns = Array(_len), _key = 0; _key < _len; _key++) {
|
9068 | fns[_key] = arguments[_key];
|
9069 | }
|
9070 |
|
9071 | return function () {
|
9072 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
9073 | args[_key2] = arguments[_key2];
|
9074 | }
|
9075 |
|
9076 |
|
9077 |
|
9078 | for (var i = 0; i < fns.length; i++) {
|
9079 | if (fns[i] && typeof fns[i] === 'function') {
|
9080 | fns[i].apply(this, args);
|
9081 | }
|
9082 | }
|
9083 | };
|
9084 | }
|
9085 |
|
9086 | var Select = function (_React$Component) {
|
9087 | _inherits(Select, _React$Component);
|
9088 |
|
9089 | function Select(props) {
|
9090 | _classCallCheck(this, Select);
|
9091 |
|
9092 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
9093 |
|
9094 | _initialiseProps.call(_this);
|
9095 |
|
9096 | var optionsInfo = Select.getOptionsInfoFromProps(props);
|
9097 | _this.state = {
|
9098 | value: Select.getValueFromProps(props, true),
|
9099 | inputValue: props.combobox ? Select.getInputValueForCombobox(props, optionsInfo, true
|
9100 | ) : '',
|
9101 | open: props.defaultOpen,
|
9102 | optionsInfo: optionsInfo,
|
9103 |
|
9104 | skipBuildOptionsInfo: true
|
9105 | };
|
9106 |
|
9107 | _this.saveInputRef = (0, _util.saveRef)(_this, 'inputRef');
|
9108 | _this.saveInputMirrorRef = (0, _util.saveRef)(_this, 'inputMirrorRef');
|
9109 | _this.saveTopCtrlRef = (0, _util.saveRef)(_this, 'topCtrlRef');
|
9110 | _this.saveSelectTriggerRef = (0, _util.saveRef)(_this, 'selectTriggerRef');
|
9111 | _this.saveRootRef = (0, _util.saveRef)(_this, 'rootRef');
|
9112 | _this.saveSelectionRef = (0, _util.saveRef)(_this, 'selectionRef');
|
9113 | return _this;
|
9114 | }
|
9115 |
|
9116 | Select.prototype.componentDidMount = function componentDidMount() {
|
9117 | if (this.props.autoFocus) {
|
9118 | this.focus();
|
9119 | }
|
9120 | };
|
9121 |
|
9122 | Select.prototype.componentDidUpdate = function componentDidUpdate() {
|
9123 | if ((0, _util.isMultipleOrTags)(this.props)) {
|
9124 | var inputNode = this.getInputDOMNode();
|
9125 | var mirrorNode = this.getInputMirrorDOMNode();
|
9126 | if (inputNode.value) {
|
9127 | inputNode.style.width = '';
|
9128 | inputNode.style.width = mirrorNode.clientWidth + 'px';
|
9129 | } else {
|
9130 | inputNode.style.width = '';
|
9131 | }
|
9132 | }
|
9133 | this.forcePopupAlign();
|
9134 | };
|
9135 |
|
9136 | Select.prototype.componentWillUnmount = function componentWillUnmount() {
|
9137 | this.clearFocusTime();
|
9138 | this.clearBlurTime();
|
9139 | if (this.dropdownContainer) {
|
9140 | _reactDom2["default"].unmountComponentAtNode(this.dropdownContainer);
|
9141 | document.body.removeChild(this.dropdownContainer);
|
9142 | this.dropdownContainer = null;
|
9143 | }
|
9144 | };
|
9145 |
|
9146 |
|
9147 |
|
9148 |
|
9149 | Select.prototype.focus = function focus() {
|
9150 | if ((0, _util.isSingleMode)(this.props)) {
|
9151 | this.selectionRef.focus();
|
9152 | } else {
|
9153 | this.getInputDOMNode().focus();
|
9154 | }
|
9155 | };
|
9156 |
|
9157 | Select.prototype.blur = function blur() {
|
9158 | if ((0, _util.isSingleMode)(this.props)) {
|
9159 | this.selectionRef.blur();
|
9160 | } else {
|
9161 | this.getInputDOMNode().blur();
|
9162 | }
|
9163 | };
|
9164 |
|
9165 | Select.prototype.renderClear = function renderClear() {
|
9166 | var _props = this.props,
|
9167 | prefixCls = _props.prefixCls,
|
9168 | allowClear = _props.allowClear,
|
9169 | clearIcon = _props.clearIcon;
|
9170 | var _state = this.state,
|
9171 | value = _state.value,
|
9172 | inputValue = _state.inputValue;
|
9173 |
|
9174 | var clear = _react2["default"].createElement(
|
9175 | 'span',
|
9176 | _extends({
|
9177 | key: 'clear',
|
9178 | className: prefixCls + '-selection-clear',
|
9179 | onMouseDown: _util.preventDefaultEvent,
|
9180 | style: _util.UNSELECTABLE_STYLE
|
9181 | }, _util.UNSELECTABLE_ATTRIBUTE, {
|
9182 | onClick: this.onClearSelection
|
9183 | }),
|
9184 | clearIcon || _react2["default"].createElement(
|
9185 | 'i',
|
9186 | { className: prefixCls + '-selection-clear-icon' },
|
9187 | '\xD7'
|
9188 | )
|
9189 | );
|
9190 | if (!allowClear) {
|
9191 | return null;
|
9192 | }
|
9193 | if ((0, _util.isCombobox)(this.props)) {
|
9194 | if (inputValue) {
|
9195 | return clear;
|
9196 | }
|
9197 | return null;
|
9198 | }
|
9199 | if (inputValue || value.length) {
|
9200 | return clear;
|
9201 | }
|
9202 | return null;
|
9203 | };
|
9204 |
|
9205 | Select.prototype.render = function render() {
|
9206 | var _rootCls;
|
9207 |
|
9208 | var props = this.props;
|
9209 | var multiple = (0, _util.isMultipleOrTags)(props);
|
9210 | var state = this.state;
|
9211 | var className = props.className,
|
9212 | disabled = props.disabled,
|
9213 | prefixCls = props.prefixCls,
|
9214 | inputIcon = props.inputIcon;
|
9215 |
|
9216 | var ctrlNode = this.renderTopControlNode();
|
9217 | var open = this.state.open;
|
9218 |
|
9219 | if (open) {
|
9220 | this._options = this.renderFilterOptions();
|
9221 | }
|
9222 | var realOpen = this.getRealOpenState();
|
9223 | var options = this._options || [];
|
9224 | var dataOrAriaAttributeProps = {};
|
9225 | for (var key in props) {
|
9226 | if (Object.prototype.hasOwnProperty.call(props, key) && (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role')) {
|
9227 | dataOrAriaAttributeProps[key] = props[key];
|
9228 | }
|
9229 | }
|
9230 | var extraSelectionProps = _extends({}, dataOrAriaAttributeProps);
|
9231 | if (!(0, _util.isMultipleOrTagsOrCombobox)(props)) {
|
9232 | extraSelectionProps = _extends({}, extraSelectionProps, {
|
9233 | onKeyDown: this.onKeyDown,
|
9234 | tabIndex: props.disabled ? -1 : 0
|
9235 | });
|
9236 | }
|
9237 | var rootCls = (_rootCls = {}, _defineProperty(_rootCls, className, !!className), _defineProperty(_rootCls, prefixCls, 1), _defineProperty(_rootCls, prefixCls + '-open', open), _defineProperty(_rootCls, prefixCls + '-focused', open || !!this._focused), _defineProperty(_rootCls, prefixCls + '-combobox', (0, _util.isCombobox)(props)), _defineProperty(_rootCls, prefixCls + '-disabled', disabled), _defineProperty(_rootCls, prefixCls + '-enabled', !disabled), _defineProperty(_rootCls, prefixCls + '-allow-clear', !!props.allowClear), _defineProperty(_rootCls, prefixCls + '-no-arrow', !props.showArrow), _rootCls);
|
9238 | return _react2["default"].createElement(
|
9239 | _SelectTrigger2["default"],
|
9240 | {
|
9241 | open: props.open,
|
9242 | onPopupFocus: this.onPopupFocus,
|
9243 | onMouseEnter: this.props.onMouseEnter,
|
9244 | onMouseLeave: this.props.onMouseLeave,
|
9245 | dropdownAlign: props.dropdownAlign,
|
9246 | dropdownClassName: props.dropdownClassName,
|
9247 | dropdownMatchSelectWidth: props.dropdownMatchSelectWidth,
|
9248 | defaultActiveFirstOption: props.defaultActiveFirstOption,
|
9249 | dropdownMenuStyle: props.dropdownMenuStyle,
|
9250 | transitionName: props.transitionName,
|
9251 | animation: props.animation,
|
9252 | prefixCls: props.prefixCls,
|
9253 | dropdownStyle: props.dropdownStyle,
|
9254 | combobox: props.combobox,
|
9255 | showSearch: props.showSearch,
|
9256 | options: options,
|
9257 | multiple: multiple,
|
9258 | disabled: disabled,
|
9259 | visible: realOpen,
|
9260 | inputValue: state.inputValue,
|
9261 | value: state.value,
|
9262 | backfillValue: state.backfillValue,
|
9263 | firstActiveValue: props.firstActiveValue,
|
9264 | onDropdownVisibleChange: this.onDropdownVisibleChange,
|
9265 | getPopupContainer: props.getPopupContainer,
|
9266 | onMenuSelect: this.onMenuSelect,
|
9267 | onMenuDeselect: this.onMenuDeselect,
|
9268 | onPopupScroll: props.onPopupScroll,
|
9269 | showAction: props.showAction,
|
9270 | ref: this.saveSelectTriggerRef,
|
9271 | clsPrefix: props.clsPrefix + '-dropdown',
|
9272 | menuItemSelectedIcon: props.menuItemSelectedIcon
|
9273 | },
|
9274 | _react2["default"].createElement(
|
9275 | 'div',
|
9276 | {
|
9277 | id: props.id,
|
9278 | style: props.style,
|
9279 | ref: this.saveRootRef,
|
9280 | onBlur: this.onOuterBlur,
|
9281 | onFocus: this.onOuterFocus,
|
9282 | onClick: this.onOuterClick
|
9283 | , className: (0, _classnames3["default"])(rootCls),
|
9284 | onMouseDown: this.markMouseDown,
|
9285 | onMouseUp: this.markMouseLeave,
|
9286 | onMouseOut: this.markMouseLeave
|
9287 | },
|
9288 | _react2["default"].createElement(
|
9289 | 'div',
|
9290 | _extends({
|
9291 | ref: this.saveSelectionRef,
|
9292 | key: 'selection',
|
9293 | className: prefixCls + '-selection\n ' + prefixCls + '-selection--' + (multiple ? 'multiple' : 'single'),
|
9294 | role: 'combobox',
|
9295 | 'aria-autocomplete': 'list',
|
9296 | 'aria-haspopup': 'true',
|
9297 | 'aria-expanded': realOpen
|
9298 | }, extraSelectionProps),
|
9299 | ctrlNode,
|
9300 | this.renderClear(),
|
9301 | !props.showArrow ? null :
|
9302 | _react2["default"].createElement(
|
9303 | 'span',
|
9304 | _extends({
|
9305 | key: 'arrow',
|
9306 | className: prefixCls + '-arrow',
|
9307 | style: _util.UNSELECTABLE_STYLE
|
9308 | }, _util.UNSELECTABLE_ATTRIBUTE, {
|
9309 | onClick: this.onArrowClick
|
9310 | }),
|
9311 | inputIcon || _react2["default"].createElement('i', { className: prefixCls + '-arrow-icon' })
|
9312 | )
|
9313 | )
|
9314 | )
|
9315 | );
|
9316 | };
|
9317 |
|
9318 | return Select;
|
9319 | }(_react2["default"].Component);
|
9320 |
|
9321 | Select.propTypes = _PropTypes.SelectPropTypes;
|
9322 | Select.defaultProps = {
|
9323 | prefixCls: 'u-select',
|
9324 | defaultOpen: false,
|
9325 | labelInValue: false,
|
9326 | defaultActiveFirstOption: true,
|
9327 | showSearch: true,
|
9328 | allowClear: false,
|
9329 | placeholder: '',
|
9330 | onChange: noop,
|
9331 | onFocus: noop,
|
9332 | onBlur: noop,
|
9333 | onSelect: noop,
|
9334 | onSearch: noop,
|
9335 | onDeselect: noop,
|
9336 | onInputKeyDown: noop,
|
9337 | showArrow: true,
|
9338 | dropdownMatchSelectWidth: true,
|
9339 | dropdownStyle: {},
|
9340 | dropdownMenuStyle: {},
|
9341 | optionFilterProp: 'value',
|
9342 | optionLabelProp: 'value',
|
9343 | notFoundContent: 'Not Found',
|
9344 | backfill: false,
|
9345 | showAction: ['click'],
|
9346 | tokenSeparators: [],
|
9347 | autoClearSearchValue: true,
|
9348 | onKeyDown: noop
|
9349 | };
|
9350 |
|
9351 | Select.getDerivedStateFromProps = function (nextProps, prevState) {
|
9352 | var optionsInfo = prevState.skipBuildOptionsInfo ? prevState.optionsInfo : Select.getOptionsInfoFromProps(nextProps, prevState);
|
9353 |
|
9354 | var newState = {
|
9355 | optionsInfo: optionsInfo,
|
9356 | skipBuildOptionsInfo: false
|
9357 | };
|
9358 |
|
9359 | if ('open' in nextProps) {
|
9360 | newState.open = nextProps.open;
|
9361 | }
|
9362 |
|
9363 | if ('value' in nextProps) {
|
9364 | var value = Select.getValueFromProps(nextProps);
|
9365 | newState.value = value;
|
9366 | if (nextProps.combobox) {
|
9367 | newState.inputValue = Select.getInputValueForCombobox(nextProps, optionsInfo);
|
9368 | }
|
9369 | }
|
9370 | return newState;
|
9371 | };
|
9372 |
|
9373 | Select.getOptionsFromChildren = function (children) {
|
9374 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
9375 |
|
9376 | _react2["default"].Children.forEach(children, function (child) {
|
9377 | if (!child) {
|
9378 | return;
|
9379 | }
|
9380 | if (child.type.isSelectOptGroup) {
|
9381 | Select.getOptionsFromChildren(child.props.children, options);
|
9382 | } else {
|
9383 | options.push(child);
|
9384 | }
|
9385 | });
|
9386 | return options;
|
9387 | };
|
9388 |
|
9389 | Select.getInputValueForCombobox = function (props, optionsInfo, useDefaultValue) {
|
9390 | var value = [];
|
9391 | if ('value' in props && !useDefaultValue) {
|
9392 | value = (0, _util.toArray)(props.value);
|
9393 | }
|
9394 | if ('defaultValue' in props && useDefaultValue) {
|
9395 | value = (0, _util.toArray)(props.defaultValue);
|
9396 | }
|
9397 | if (value.length) {
|
9398 | value = value[0];
|
9399 | } else {
|
9400 | return '';
|
9401 | }
|
9402 | var label = value;
|
9403 | if (props.labelInValue) {
|
9404 | label = value.label;
|
9405 | } else if (optionsInfo[(0, _util.getMapKey)(value)]) {
|
9406 | label = optionsInfo[(0, _util.getMapKey)(value)].label;
|
9407 | }
|
9408 | if (label === undefined) {
|
9409 | label = '';
|
9410 | }
|
9411 | return label;
|
9412 | };
|
9413 |
|
9414 | Select.getLabelFromOption = function (props, option) {
|
9415 | return (0, _util.getPropValue)(option, props.optionLabelProp);
|
9416 | };
|
9417 |
|
9418 | Select.getOptionsInfoFromProps = function (props, preState) {
|
9419 | var options = Select.getOptionsFromChildren(props.children);
|
9420 | var optionsInfo = {};
|
9421 | options.forEach(function (option) {
|
9422 | var singleValue = (0, _util.getValuePropValue)(option);
|
9423 | optionsInfo[(0, _util.getMapKey)(singleValue)] = {
|
9424 | option: option,
|
9425 | value: singleValue,
|
9426 | label: Select.getLabelFromOption(props, option),
|
9427 | title: option.props.title
|
9428 | };
|
9429 | });
|
9430 | if (preState) {
|
9431 |
|
9432 | var oldOptionsInfo = preState.optionsInfo;
|
9433 | var value = preState.value;
|
9434 | value.forEach(function (v) {
|
9435 | var key = (0, _util.getMapKey)(v);
|
9436 | if (!optionsInfo[key] && oldOptionsInfo[key] !== undefined) {
|
9437 | optionsInfo[key] = oldOptionsInfo[key];
|
9438 | }
|
9439 | });
|
9440 | }
|
9441 | return optionsInfo;
|
9442 | };
|
9443 |
|
9444 | Select.getValueFromProps = function (props, useDefaultValue) {
|
9445 | var value = [];
|
9446 | if ('value' in props && !useDefaultValue) {
|
9447 | value = (0, _util.toArray)(props.value);
|
9448 | }
|
9449 | if ('defaultValue' in props && useDefaultValue) {
|
9450 | value = (0, _util.toArray)(props.defaultValue);
|
9451 | }
|
9452 | if (props.labelInValue) {
|
9453 | value = value.map(function (v) {
|
9454 | return v.key;
|
9455 | });
|
9456 | }
|
9457 | return value;
|
9458 | };
|
9459 |
|
9460 | var _initialiseProps = function _initialiseProps() {
|
9461 | var _this2 = this;
|
9462 |
|
9463 | this.onInputChange = function (event) {
|
9464 | var tokenSeparators = _this2.props.tokenSeparators;
|
9465 |
|
9466 | var val = event.target.value;
|
9467 | if ((0, _util.isMultipleOrTags)(_this2.props) && tokenSeparators.length && (0, _util.includesSeparators)(val, tokenSeparators)) {
|
9468 | var nextValue = _this2.getValueByInput(val);
|
9469 | if (nextValue !== undefined) {
|
9470 | _this2.fireChange(nextValue);
|
9471 | }
|
9472 | _this2.setOpenState(false, true);
|
9473 | _this2.setInputValue('', false);
|
9474 | return;
|
9475 | }
|
9476 | _this2.setInputValue(val);
|
9477 | _this2.setState({
|
9478 | open: true
|
9479 | });
|
9480 | if ((0, _util.isCombobox)(_this2.props)) {
|
9481 | _this2.fireChange([val]);
|
9482 | }
|
9483 | };
|
9484 |
|
9485 | this.onDropdownVisibleChange = function (open) {
|
9486 | if (open && !_this2._focused) {
|
9487 | _this2.clearBlurTime();
|
9488 | _this2.timeoutFocus();
|
9489 | _this2._focused = true;
|
9490 | _this2.updateFocusClassName();
|
9491 | }
|
9492 | _this2.setOpenState(open);
|
9493 | };
|
9494 |
|
9495 | this.onKeyDown = function (event) {
|
9496 | var open = _this2.state.open;
|
9497 | var _props2 = _this2.props,
|
9498 | disabled = _props2.disabled,
|
9499 | onKeyDown = _props2.onKeyDown;
|
9500 |
|
9501 | if (disabled) {
|
9502 | return;
|
9503 | }
|
9504 | var keyCode = event.keyCode;
|
9505 | if (open && !_this2.getInputDOMNode()) {
|
9506 | _this2.onInputKeyDown(event);
|
9507 | } else if (keyCode === _tinperBeeCore.KeyCode.ENTER || keyCode === _tinperBeeCore.KeyCode.DOWN || keyCode === _tinperBeeCore.KeyCode.SPACE) {
|
9508 | if (!open) _this2.setOpenState(true);
|
9509 | event.preventDefault();
|
9510 | }
|
9511 | onKeyDown(event);
|
9512 | };
|
9513 |
|
9514 | this.onInputKeyDown = function (event) {
|
9515 | var props = _this2.props;
|
9516 | if (props.disabled) {
|
9517 | return;
|
9518 | }
|
9519 | var state = _this2.state;
|
9520 | var keyCode = event.keyCode;
|
9521 | if ((0, _util.isMultipleOrTags)(props) && !event.target.value && keyCode === _tinperBeeCore.KeyCode.BACKSPACE) {
|
9522 | event.preventDefault();
|
9523 | var value = state.value;
|
9524 |
|
9525 | if (value.length) {
|
9526 | _this2.removeSelected(value[value.length - 1]);
|
9527 | }
|
9528 | return;
|
9529 | }
|
9530 | if (keyCode === _tinperBeeCore.KeyCode.DOWN) {
|
9531 | if (!state.open) {
|
9532 | _this2.openIfHasChildren();
|
9533 | event.preventDefault();
|
9534 | event.stopPropagation();
|
9535 | return;
|
9536 | }
|
9537 | } else if (keyCode === _tinperBeeCore.KeyCode.ENTER && state.open) {
|
9538 |
|
9539 |
|
9540 | event.preventDefault();
|
9541 | } else if (keyCode === _tinperBeeCore.KeyCode.ESC) {
|
9542 | if (state.open) {
|
9543 | _this2.setOpenState(false);
|
9544 | event.preventDefault();
|
9545 | event.stopPropagation();
|
9546 | }
|
9547 | if (props.showSearch) props.onKeyDown(event);
|
9548 | return;
|
9549 | }
|
9550 |
|
9551 | if (_this2.getRealOpenState(state)) {
|
9552 | var menu = _this2.selectTriggerRef.getInnerMenu();
|
9553 | if (menu && menu.onKeyDown(event, _this2.handleBackfill)) {
|
9554 | event.preventDefault();
|
9555 | event.stopPropagation();
|
9556 | }
|
9557 | }
|
9558 | };
|
9559 |
|
9560 | this.onMenuSelect = function (_ref) {
|
9561 | var item = _ref.item;
|
9562 |
|
9563 | if (!item) {
|
9564 | return;
|
9565 | }
|
9566 |
|
9567 | var value = _this2.state.value;
|
9568 | var props = _this2.props;
|
9569 | var selectedValue = (0, _util.getValuePropValue)(item);
|
9570 | var lastValue = value[value.length - 1];
|
9571 | _this2.fireSelect(selectedValue);
|
9572 | if ((0, _util.isMultipleOrTags)(props)) {
|
9573 | if ((0, _util.findIndexInValueBySingleValue)(value, selectedValue) !== -1) {
|
9574 | return;
|
9575 | }
|
9576 | value = value.concat([selectedValue]);
|
9577 | } else {
|
9578 | if (lastValue !== undefined && lastValue === selectedValue && selectedValue !== _this2.state.backfillValue) {
|
9579 | _this2.setOpenState(false, true);
|
9580 | return;
|
9581 | }
|
9582 | value = [selectedValue];
|
9583 | _this2.setOpenState(false, true);
|
9584 | }
|
9585 | _this2.fireChange(value);
|
9586 | var inputValue = void 0;
|
9587 | if ((0, _util.isCombobox)(props)) {
|
9588 | inputValue = (0, _util.getPropValue)(item, props.optionLabelProp);
|
9589 | } else {
|
9590 | inputValue = '';
|
9591 | }
|
9592 | if (props.autoClearSearchValue) {
|
9593 | _this2.setInputValue(inputValue, false);
|
9594 | }
|
9595 | };
|
9596 |
|
9597 | this.onMenuDeselect = function (_ref2) {
|
9598 | var item = _ref2.item,
|
9599 | domEvent = _ref2.domEvent;
|
9600 |
|
9601 | if (domEvent.type === 'keydown' && domEvent.keyCode === _tinperBeeCore.KeyCode.ENTER) {
|
9602 | _this2.removeSelected((0, _util.getValuePropValue)(item));
|
9603 | return;
|
9604 | }
|
9605 | if (domEvent.type === 'click') {
|
9606 | _this2.removeSelected((0, _util.getValuePropValue)(item));
|
9607 | }
|
9608 | var props = _this2.props;
|
9609 |
|
9610 | if (props.autoClearSearchValue) {
|
9611 | _this2.setInputValue('', false);
|
9612 | }
|
9613 | };
|
9614 |
|
9615 | this.onArrowClick = function (e) {
|
9616 | e.stopPropagation();
|
9617 | e.preventDefault();
|
9618 | _this2.props.onFocus(_this2.state.value);
|
9619 | if (!_this2.props.disabled) {
|
9620 | _this2.setOpenState(!_this2.state.open, !_this2.state.open);
|
9621 | }
|
9622 | };
|
9623 |
|
9624 | this.onPlaceholderClick = function () {
|
9625 | if (_this2.getInputDOMNode()) {
|
9626 | _this2.getInputDOMNode().focus();
|
9627 | }
|
9628 | };
|
9629 |
|
9630 | this.onOuterFocus = function (e) {
|
9631 | if (_this2.props.disabled) {
|
9632 | e.preventDefault();
|
9633 | return;
|
9634 | }
|
9635 | _this2.clearBlurTime();
|
9636 | if (!(0, _util.isMultipleOrTagsOrCombobox)(_this2.props) && e.target === _this2.getInputDOMNode()) {
|
9637 | return;
|
9638 | }
|
9639 | if (_this2._focused) {
|
9640 | return;
|
9641 | }
|
9642 | _this2._focused = true;
|
9643 | _this2.updateFocusClassName();
|
9644 | if (!_this2._mouseDown) {
|
9645 | _this2.timeoutFocus();
|
9646 | }
|
9647 | };
|
9648 |
|
9649 | this.onPopupFocus = function () {
|
9650 |
|
9651 | _this2.maybeFocus(true, true);
|
9652 | };
|
9653 |
|
9654 | this.onOuterBlur = function (e) {
|
9655 | if (_this2.props.disabled) {
|
9656 | e.preventDefault();
|
9657 | return;
|
9658 | }
|
9659 | _this2.blurTimer = setTimeout(function () {
|
9660 | _this2._focused = false;
|
9661 | _this2.updateFocusClassName();
|
9662 | var props = _this2.props;
|
9663 | var value = _this2.state.value;
|
9664 | var inputValue = _this2.state.inputValue;
|
9665 |
|
9666 | if ((0, _util.isSingleMode)(props) && props.showSearch && inputValue && props.defaultActiveFirstOption) {
|
9667 | var options = _this2._options || [];
|
9668 | if (options.length) {
|
9669 | var firstOption = (0, _util.findFirstMenuItem)(options);
|
9670 | if (firstOption) {
|
9671 | value = [(0, _util.getValuePropValue)(firstOption)];
|
9672 | _this2.fireChange(value);
|
9673 | }
|
9674 | }
|
9675 | } else if ((0, _util.isMultipleOrTags)(props) && inputValue) {
|
9676 | if (_this2._mouseDown) {
|
9677 |
|
9678 | _this2.setInputValue('');
|
9679 | } else {
|
9680 |
|
9681 | _this2.state.inputValue = _this2.getInputDOMNode().value = '';
|
9682 | }
|
9683 |
|
9684 | value = _this2.getValueByInput(inputValue);
|
9685 | if (value !== undefined) {
|
9686 | _this2.fireChange(value);
|
9687 | }
|
9688 | }
|
9689 |
|
9690 |
|
9691 | if ((0, _util.isMultipleOrTags)(props) && _this2._mouseDown) {
|
9692 | _this2.maybeFocus(true, true);
|
9693 | _this2._mouseDown = false;
|
9694 | return;
|
9695 | }
|
9696 | _this2.setOpenState(false);
|
9697 | props.onBlur(_this2.getVLForOnChange(value));
|
9698 | }, 10);
|
9699 | };
|
9700 |
|
9701 | this.onClearSelection = function (event) {
|
9702 | var props = _this2.props;
|
9703 | var state = _this2.state;
|
9704 | if (props.disabled) {
|
9705 | return;
|
9706 | }
|
9707 | var inputValue = state.inputValue,
|
9708 | value = state.value;
|
9709 |
|
9710 | event.stopPropagation();
|
9711 | if (inputValue || value.length) {
|
9712 | if (value.length) {
|
9713 | _this2.fireChange([]);
|
9714 | }
|
9715 | _this2.setOpenState(false, true);
|
9716 | if (inputValue) {
|
9717 | _this2.setInputValue('');
|
9718 | }
|
9719 | }
|
9720 | };
|
9721 |
|
9722 | this.onChoiceAnimationLeave = function () {
|
9723 | _this2.forcePopupAlign();
|
9724 | };
|
9725 |
|
9726 | this.getOptionInfoBySingleValue = function (value, optionsInfo) {
|
9727 | var info = void 0;
|
9728 | optionsInfo = optionsInfo || _this2.state.optionsInfo;
|
9729 | if (optionsInfo[(0, _util.getMapKey)(value)]) {
|
9730 | info = optionsInfo[(0, _util.getMapKey)(value)];
|
9731 | }
|
9732 | if (info) {
|
9733 | return info;
|
9734 | }
|
9735 | var defaultLabel = value;
|
9736 | if (_this2.props.labelInValue) {
|
9737 | var label = (0, _util.getLabelFromPropsValue)(_this2.props.value, value);
|
9738 | if (label !== undefined) {
|
9739 | defaultLabel = label;
|
9740 | }
|
9741 | }
|
9742 | var defaultInfo = {
|
9743 | option: _react2["default"].createElement(
|
9744 | _Option2["default"],
|
9745 | { value: value, key: value },
|
9746 | value
|
9747 | ),
|
9748 | value: value,
|
9749 | label: defaultLabel
|
9750 | };
|
9751 | return defaultInfo;
|
9752 | };
|
9753 |
|
9754 | this.getOptionBySingleValue = function (value) {
|
9755 | var _getOptionInfoBySingl = _this2.getOptionInfoBySingleValue(value),
|
9756 | option = _getOptionInfoBySingl.option;
|
9757 |
|
9758 | return option;
|
9759 | };
|
9760 |
|
9761 | this.getOptionsBySingleValue = function (values) {
|
9762 | return values.map(function (value) {
|
9763 | return _this2.getOptionBySingleValue(value);
|
9764 | });
|
9765 | };
|
9766 |
|
9767 | this.getValueByLabel = function (label) {
|
9768 | if (label === undefined) {
|
9769 | return null;
|
9770 | }
|
9771 | var value = null;
|
9772 | Object.keys(_this2.state.optionsInfo).forEach(function (key) {
|
9773 | var info = _this2.state.optionsInfo[key];
|
9774 | if ((0, _util.toArray)(info.label).join('') === label) {
|
9775 | value = info.value;
|
9776 | }
|
9777 | });
|
9778 | return value;
|
9779 | };
|
9780 |
|
9781 | this.getVLBySingleValue = function (value) {
|
9782 | if (_this2.props.labelInValue) {
|
9783 | return {
|
9784 | key: value,
|
9785 | label: _this2.getLabelBySingleValue(value)
|
9786 | };
|
9787 | }
|
9788 | return value;
|
9789 | };
|
9790 |
|
9791 | this.getVLForOnChange = function (vls_) {
|
9792 | var vls = vls_;
|
9793 | if (vls !== undefined) {
|
9794 | if (!_this2.props.labelInValue) {
|
9795 | vls = vls.map(function (v) {
|
9796 | return v;
|
9797 | });
|
9798 | } else {
|
9799 | vls = vls.map(function (vl) {
|
9800 | return {
|
9801 | key: vl,
|
9802 | label: _this2.getLabelBySingleValue(vl)
|
9803 | };
|
9804 | });
|
9805 | }
|
9806 | return (0, _util.isMultipleOrTags)(_this2.props) ? vls : vls[0];
|
9807 | }
|
9808 | return vls;
|
9809 | };
|
9810 |
|
9811 | this.getLabelBySingleValue = function (value, optionsInfo) {
|
9812 | var _getOptionInfoBySingl2 = _this2.getOptionInfoBySingleValue(value, optionsInfo),
|
9813 | label = _getOptionInfoBySingl2.label;
|
9814 |
|
9815 | return label;
|
9816 | };
|
9817 |
|
9818 | this.getDropdownContainer = function () {
|
9819 | if (!_this2.dropdownContainer) {
|
9820 | _this2.dropdownContainer = document.createElement('div');
|
9821 | document.body.appendChild(_this2.dropdownContainer);
|
9822 | }
|
9823 | return _this2.dropdownContainer;
|
9824 | };
|
9825 |
|
9826 | this.getPlaceholderElement = function () {
|
9827 | var props = _this2.props,
|
9828 | state = _this2.state;
|
9829 |
|
9830 | var hidden = false;
|
9831 | if (state.inputValue) {
|
9832 | hidden = true;
|
9833 | }
|
9834 | if (state.value.length) {
|
9835 | hidden = true;
|
9836 | }
|
9837 | if ((0, _util.isCombobox)(props) && state.value.length === 1 && !state.value[0]) {
|
9838 | hidden = false;
|
9839 | }
|
9840 | var placeholder = props.placeholder;
|
9841 | if (placeholder) {
|
9842 | return _react2["default"].createElement(
|
9843 | 'div',
|
9844 | _extends({
|
9845 | onMouseDown: _util.preventDefaultEvent,
|
9846 | style: _extends({
|
9847 | display: hidden ? 'none' : 'block'
|
9848 | }, _util.UNSELECTABLE_STYLE)
|
9849 | }, _util.UNSELECTABLE_ATTRIBUTE, {
|
9850 | onClick: _this2.onPlaceholderClick,
|
9851 | className: props.prefixCls + '-selection-placeholder'
|
9852 | }),
|
9853 | placeholder
|
9854 | );
|
9855 | }
|
9856 | return null;
|
9857 | };
|
9858 |
|
9859 | this.getInputElement = function () {
|
9860 | var props = _this2.props;
|
9861 | var inputElement = props.getInputElement ? props.getInputElement() : _react2["default"].createElement('input', { id: props.id, autoComplete: 'off' });
|
9862 | var inputCls = (0, _classnames3["default"])(inputElement.props.className, _defineProperty({}, props.prefixCls + '-search-field', true));
|
9863 |
|
9864 |
|
9865 | return _react2["default"].createElement(
|
9866 | 'div',
|
9867 | { className: props.prefixCls + '-search-field-wrap' },
|
9868 | _react2["default"].cloneElement(inputElement, {
|
9869 | ref: _this2.saveInputRef,
|
9870 | onChange: _this2.onInputChange,
|
9871 | onKeyDown: chaining(_this2.onInputKeyDown, inputElement.props.onKeyDown, _this2.props.onInputKeyDown),
|
9872 | value: _this2.state.inputValue,
|
9873 | disabled: props.disabled,
|
9874 | className: inputCls
|
9875 | }),
|
9876 | _react2["default"].createElement(
|
9877 | 'span',
|
9878 | {
|
9879 | ref: _this2.saveInputMirrorRef,
|
9880 | className: props.prefixCls + '-search-field-mirror'
|
9881 | },
|
9882 | _this2.state.inputValue,
|
9883 | '\xA0'
|
9884 | )
|
9885 | );
|
9886 | };
|
9887 |
|
9888 | this.getInputDOMNode = function () {
|
9889 | return _this2.topCtrlRef ? _this2.topCtrlRef.querySelector('input,textarea,div[contentEditable]') : _this2.inputRef;
|
9890 | };
|
9891 |
|
9892 | this.getInputMirrorDOMNode = function () {
|
9893 | return _this2.inputMirrorRef;
|
9894 | };
|
9895 |
|
9896 | this.getPopupDOMNode = function () {
|
9897 | return _this2.selectTriggerRef.getPopupDOMNode();
|
9898 | };
|
9899 |
|
9900 | this.getPopupMenuComponent = function () {
|
9901 | return _this2.selectTriggerRef.getInnerMenu();
|
9902 | };
|
9903 |
|
9904 | this.setOpenState = function (open, needFocus) {
|
9905 | var props = _this2.props,
|
9906 | state = _this2.state;
|
9907 |
|
9908 | if (state.open === open) {
|
9909 | _this2.maybeFocus(open, needFocus);
|
9910 | return;
|
9911 | }
|
9912 |
|
9913 | if (_this2.props.onDropdownVisibleChange) {
|
9914 | _this2.props.onDropdownVisibleChange(open);
|
9915 | }
|
9916 |
|
9917 | var nextState = {
|
9918 | open: open,
|
9919 | backfillValue: undefined
|
9920 | };
|
9921 |
|
9922 | if (!open && (0, _util.isSingleMode)(props) && props.showSearch) {
|
9923 | _this2.setInputValue('', false);
|
9924 | }
|
9925 | if (!open) {
|
9926 | _this2.maybeFocus(open, needFocus);
|
9927 | }
|
9928 | _this2.setState(nextState, function () {
|
9929 | if (open) {
|
9930 | _this2.maybeFocus(open, needFocus);
|
9931 | }
|
9932 | });
|
9933 | };
|
9934 |
|
9935 | this.setInputValue = function (inputValue) {
|
9936 | var fireSearch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
9937 |
|
9938 | if (inputValue !== _this2.state.inputValue) {
|
9939 | _this2.setState({
|
9940 | inputValue: inputValue
|
9941 | }, _this2.forcePopupAlign);
|
9942 | if (fireSearch) {
|
9943 | _this2.props.onSearch(inputValue);
|
9944 | }
|
9945 | }
|
9946 | };
|
9947 |
|
9948 | this.getValueByInput = function (string) {
|
9949 | var _props3 = _this2.props,
|
9950 | multiple = _props3.multiple,
|
9951 | tokenSeparators = _props3.tokenSeparators;
|
9952 |
|
9953 | var nextValue = _this2.state.value;
|
9954 | var hasNewValue = false;
|
9955 | (0, _util.splitBySeparators)(string, tokenSeparators).forEach(function (label) {
|
9956 | var selectedValue = [label];
|
9957 | if (multiple) {
|
9958 | var value = _this2.getValueByLabel(label);
|
9959 | if (value && (0, _util.findIndexInValueBySingleValue)(nextValue, value) === -1) {
|
9960 | nextValue = nextValue.concat(value);
|
9961 | hasNewValue = true;
|
9962 | _this2.fireSelect(value);
|
9963 | }
|
9964 | } else {
|
9965 |
|
9966 | if ((0, _util.findIndexInValueBySingleValue)(nextValue, label) === -1) {
|
9967 | nextValue = nextValue.concat(selectedValue);
|
9968 | hasNewValue = true;
|
9969 | _this2.fireSelect(label);
|
9970 | }
|
9971 | }
|
9972 | });
|
9973 | return hasNewValue ? nextValue : undefined;
|
9974 | };
|
9975 |
|
9976 | this.getRealOpenState = function (state) {
|
9977 | var _open = _this2.props.open;
|
9978 |
|
9979 | if (typeof _open === 'boolean') {
|
9980 | return _open;
|
9981 | }
|
9982 | var open = (state || _this2.state).open;
|
9983 | var options = _this2._options || [];
|
9984 | if ((0, _util.isMultipleOrTagsOrCombobox)(_this2.props) || !_this2.props.showSearch) {
|
9985 | if (open && !options.length) {
|
9986 | open = false;
|
9987 | }
|
9988 | }
|
9989 | return open;
|
9990 | };
|
9991 |
|
9992 | this.markMouseDown = function () {
|
9993 | _this2._mouseDown = true;
|
9994 | };
|
9995 |
|
9996 | this.markMouseLeave = function () {
|
9997 | _this2._mouseDown = false;
|
9998 | };
|
9999 |
|
10000 | this.handleBackfill = function (item) {
|
10001 | if (!_this2.props.backfill || !((0, _util.isSingleMode)(_this2.props) || (0, _util.isCombobox)(_this2.props))) {
|
10002 | return;
|
10003 | }
|
10004 |
|
10005 | var key = (0, _util.getValuePropValue)(item);
|
10006 |
|
10007 | if ((0, _util.isCombobox)(_this2.props)) {
|
10008 | _this2.setInputValue(key, false);
|
10009 | }
|
10010 |
|
10011 | _this2.setState({
|
10012 | value: [key],
|
10013 | backfillValue: key
|
10014 | });
|
10015 | };
|
10016 |
|
10017 | this.filterOption = function (input, child) {
|
10018 | var defaultFilter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _util.defaultFilterFn;
|
10019 | var value = _this2.state.value;
|
10020 |
|
10021 | var lastValue = value[value.length - 1];
|
10022 | if (!input || lastValue && lastValue === _this2.state.backfillValue) {
|
10023 | return true;
|
10024 | }
|
10025 | var filterFn = _this2.props.filterOption;
|
10026 | if ('filterOption' in _this2.props) {
|
10027 | if (_this2.props.filterOption === true) {
|
10028 | filterFn = defaultFilter;
|
10029 | }
|
10030 | } else {
|
10031 | filterFn = defaultFilter;
|
10032 | }
|
10033 |
|
10034 | if (!filterFn) {
|
10035 | return true;
|
10036 | } else if (typeof filterFn === 'function') {
|
10037 | return filterFn.call(_this2, input, child);
|
10038 | } else if (child.props.disabled) {
|
10039 | return false;
|
10040 | }
|
10041 | return true;
|
10042 | };
|
10043 |
|
10044 | this.timeoutFocus = function () {
|
10045 | if (_this2.focusTimer) {
|
10046 | _this2.clearFocusTime();
|
10047 | }
|
10048 | _this2.focusTimer = setTimeout(function () {
|
10049 | _this2.props.onFocus();
|
10050 | }, 10);
|
10051 | };
|
10052 |
|
10053 | this.clearFocusTime = function () {
|
10054 | if (_this2.focusTimer) {
|
10055 | clearTimeout(_this2.focusTimer);
|
10056 | _this2.focusTimer = null;
|
10057 | }
|
10058 | };
|
10059 |
|
10060 | this.clearBlurTime = function () {
|
10061 | if (_this2.blurTimer) {
|
10062 | clearTimeout(_this2.blurTimer);
|
10063 | _this2.blurTimer = null;
|
10064 | }
|
10065 | };
|
10066 |
|
10067 | this.updateFocusClassName = function () {
|
10068 | var rootRef = _this2.rootRef,
|
10069 | props = _this2.props;
|
10070 |
|
10071 |
|
10072 | if (_this2._focused) {
|
10073 | (0, _componentClasses2["default"])(rootRef).add(props.prefixCls + '-focused');
|
10074 | } else {
|
10075 | (0, _componentClasses2["default"])(rootRef).remove(props.prefixCls + '-focused');
|
10076 | }
|
10077 | };
|
10078 |
|
10079 | this.maybeFocus = function (open, needFocus) {
|
10080 | if (needFocus || open) {
|
10081 | var input = _this2.getInputDOMNode();
|
10082 | var _document = document,
|
10083 | activeElement = _document.activeElement;
|
10084 |
|
10085 | if (input && (open || (0, _util.isMultipleOrTagsOrCombobox)(_this2.props))) {
|
10086 | if (activeElement !== input) {
|
10087 | input.focus();
|
10088 | _this2._focused = true;
|
10089 | }
|
10090 | } else if (activeElement !== _this2.selectionRef) {
|
10091 | _this2.selectionRef.focus();
|
10092 | _this2._focused = true;
|
10093 | }
|
10094 | }
|
10095 | };
|
10096 |
|
10097 | this.removeSelected = function (selectedKey, e) {
|
10098 | var props = _this2.props;
|
10099 | if (props.disabled || _this2.isChildDisabled(selectedKey)) {
|
10100 | return;
|
10101 | }
|
10102 |
|
10103 |
|
10104 | if (e && e.stopPropagation) {
|
10105 | e.stopPropagation();
|
10106 | }
|
10107 |
|
10108 | var value = _this2.state.value.filter(function (singleValue) {
|
10109 | return singleValue !== selectedKey;
|
10110 | });
|
10111 | var canMultiple = (0, _util.isMultipleOrTags)(props);
|
10112 |
|
10113 | if (canMultiple) {
|
10114 | var event = selectedKey;
|
10115 | if (props.labelInValue) {
|
10116 | event = {
|
10117 | key: selectedKey,
|
10118 | label: _this2.getLabelBySingleValue(selectedKey)
|
10119 | };
|
10120 | }
|
10121 | props.onDeselect(event, _this2.getOptionBySingleValue(selectedKey));
|
10122 | }
|
10123 | _this2.fireChange(value);
|
10124 | };
|
10125 |
|
10126 | this.openIfHasChildren = function () {
|
10127 | var props = _this2.props;
|
10128 | if (_react2["default"].Children.count(props.children) || (0, _util.isSingleMode)(props)) {
|
10129 | _this2.setOpenState(true);
|
10130 | }
|
10131 | };
|
10132 |
|
10133 | this.fireSelect = function (value) {
|
10134 | _this2.props.onSelect(_this2.getVLBySingleValue(value), _this2.getOptionBySingleValue(value));
|
10135 | };
|
10136 |
|
10137 | this.fireChange = function (value) {
|
10138 | var props = _this2.props;
|
10139 | if (!('value' in props)) {
|
10140 | _this2.setState({
|
10141 | value: value
|
10142 | }, _this2.forcePopupAlign);
|
10143 | }
|
10144 | var vls = _this2.getVLForOnChange(value);
|
10145 | var options = _this2.getOptionsBySingleValue(value);
|
10146 | props.onChange(vls, (0, _util.isMultipleOrTags)(_this2.props) ? options : options[0]);
|
10147 | };
|
10148 |
|
10149 | this.isChildDisabled = function (key) {
|
10150 | return (0, _tinperBeeCore.toArray)(_this2.props.children).some(function (child) {
|
10151 | var childValue = (0, _util.getValuePropValue)(child);
|
10152 | return childValue === key && child.props && child.props.disabled;
|
10153 | });
|
10154 | };
|
10155 |
|
10156 | this.forcePopupAlign = function () {
|
10157 | if (!_this2.state.open) {
|
10158 | return;
|
10159 | }
|
10160 | _this2.selectTriggerRef.triggerRef.forcePopupAlign();
|
10161 | };
|
10162 |
|
10163 | this.renderFilterOptions = function () {
|
10164 | var inputValue = _this2.state.inputValue;
|
10165 | var _props4 = _this2.props,
|
10166 | children = _props4.children,
|
10167 | tags = _props4.tags,
|
10168 | filterOption = _props4.filterOption,
|
10169 | notFoundContent = _props4.notFoundContent;
|
10170 |
|
10171 | var menuItems = [];
|
10172 | var childrenKeys = [];
|
10173 | var options = _this2.renderFilterOptionsFromChildren(children, childrenKeys, menuItems);
|
10174 | if (tags) {
|
10175 |
|
10176 | var value = _this2.state.value;
|
10177 | value = value.filter(function (singleValue) {
|
10178 | return childrenKeys.indexOf(singleValue) === -1 && (!inputValue || String(singleValue).indexOf(String(inputValue)) > -1);
|
10179 | });
|
10180 | value.forEach(function (singleValue) {
|
10181 | var key = singleValue;
|
10182 | var menuItem = _react2["default"].createElement(
|
10183 | _rcMenu.Item,
|
10184 | {
|
10185 | style: _util.UNSELECTABLE_STYLE,
|
10186 | role: 'option',
|
10187 | attribute: _util.UNSELECTABLE_ATTRIBUTE,
|
10188 | value: key,
|
10189 | key: key
|
10190 | },
|
10191 | key
|
10192 | );
|
10193 | options.push(menuItem);
|
10194 | menuItems.push(menuItem);
|
10195 | });
|
10196 | if (inputValue) {
|
10197 | var notFindInputItem = menuItems.every(function (option) {
|
10198 |
|
10199 |
|
10200 |
|
10201 |
|
10202 | var filterFn = function filterFn() {
|
10203 | return (0, _util.getValuePropValue)(option) === inputValue;
|
10204 | };
|
10205 | if (filterOption !== false) {
|
10206 | return !_this2.filterOption.call(_this2, inputValue, option, filterFn);
|
10207 | }
|
10208 | return !filterFn();
|
10209 | });
|
10210 | if (notFindInputItem) {
|
10211 | options.unshift(_react2["default"].createElement(
|
10212 | _rcMenu.Item,
|
10213 | {
|
10214 | style: _util.UNSELECTABLE_STYLE,
|
10215 | role: 'option',
|
10216 | attribute: _util.UNSELECTABLE_ATTRIBUTE,
|
10217 | value: inputValue,
|
10218 | key: inputValue
|
10219 | },
|
10220 | inputValue
|
10221 | ));
|
10222 | }
|
10223 | }
|
10224 | }
|
10225 |
|
10226 | if (!options.length && notFoundContent) {
|
10227 | options = [_react2["default"].createElement(
|
10228 | _rcMenu.Item,
|
10229 | {
|
10230 | style: _util.UNSELECTABLE_STYLE,
|
10231 | attribute: _util.UNSELECTABLE_ATTRIBUTE,
|
10232 | disabled: true,
|
10233 | role: 'option',
|
10234 | value: 'NOT_FOUND',
|
10235 | key: 'NOT_FOUND'
|
10236 | },
|
10237 | notFoundContent
|
10238 | )];
|
10239 | }
|
10240 | return options;
|
10241 | };
|
10242 |
|
10243 | this.renderFilterOptionsFromChildren = function (children, childrenKeys, menuItems) {
|
10244 | var sel = [];
|
10245 | var props = _this2.props;
|
10246 | var inputValue = _this2.state.inputValue;
|
10247 |
|
10248 | var tags = props.tags;
|
10249 | _react2["default"].Children.forEach(children, function (child) {
|
10250 | if (!child) {
|
10251 | return;
|
10252 | }
|
10253 | if (child.type.isSelectOptGroup) {
|
10254 | var innerItems = _this2.renderFilterOptionsFromChildren(child.props.children, childrenKeys, menuItems);
|
10255 | if (innerItems.length) {
|
10256 | var label = child.props.label;
|
10257 | var key = child.key;
|
10258 | if (!key && typeof label === 'string') {
|
10259 | key = label;
|
10260 | } else if (!label && key) {
|
10261 | label = key;
|
10262 | }
|
10263 | sel.push(_react2["default"].createElement(
|
10264 | _rcMenu.ItemGroup,
|
10265 | { key: key, title: label },
|
10266 | innerItems
|
10267 | ));
|
10268 | }
|
10269 | return;
|
10270 | }
|
10271 |
|
10272 | (0, _warning2["default"])(child.type.isSelectOption, 'the children of `Select` should be `Select.Option` or `Select.OptGroup`, ' + ('instead of `' + (child.type.name || child.type.displayName || child.type) + '`.'));
|
10273 |
|
10274 | var childValue = (0, _util.getValuePropValue)(child);
|
10275 |
|
10276 | (0, _util.validateOptionValue)(childValue, _this2.props);
|
10277 |
|
10278 | if (_this2.filterOption(inputValue, child)) {
|
10279 | var menuItem = _react2["default"].createElement(_rcMenu.Item, _extends({
|
10280 | style: _util.UNSELECTABLE_STYLE,
|
10281 | attribute: _util.UNSELECTABLE_ATTRIBUTE,
|
10282 | value: childValue,
|
10283 | key: childValue,
|
10284 | role: 'option'
|
10285 | }, child.props));
|
10286 | sel.push(menuItem);
|
10287 | menuItems.push(menuItem);
|
10288 | }
|
10289 |
|
10290 | if (tags) {
|
10291 | childrenKeys.push(childValue);
|
10292 | }
|
10293 | });
|
10294 |
|
10295 | return sel;
|
10296 | };
|
10297 |
|
10298 | this.renderTopControlNode = function () {
|
10299 | var _state2 = _this2.state,
|
10300 | value = _state2.value,
|
10301 | open = _state2.open,
|
10302 | inputValue = _state2.inputValue;
|
10303 |
|
10304 | var props = _this2.props;
|
10305 | var choiceTransitionName = props.choiceTransitionName,
|
10306 | prefixCls = props.prefixCls,
|
10307 | maxTagTextLength = props.maxTagTextLength,
|
10308 | maxTagCount = props.maxTagCount,
|
10309 | maxTagPlaceholder = props.maxTagPlaceholder,
|
10310 | showSearch = props.showSearch,
|
10311 | removeIcon = props.removeIcon;
|
10312 |
|
10313 | var className = prefixCls + '-selection-rendered';
|
10314 |
|
10315 | var innerNode = null;
|
10316 | if ((0, _util.isSingleMode)(props)) {
|
10317 | var selectedValue = null;
|
10318 | if (value.length) {
|
10319 | var showSelectedValue = false;
|
10320 | var opacity = 1;
|
10321 | if (!showSearch) {
|
10322 | showSelectedValue = true;
|
10323 | } else if (open) {
|
10324 | showSelectedValue = !inputValue;
|
10325 | if (showSelectedValue) {
|
10326 | opacity = 0.4;
|
10327 | }
|
10328 | } else {
|
10329 | showSelectedValue = true;
|
10330 | }
|
10331 | var singleValue = value[0];
|
10332 |
|
10333 | var _getOptionInfoBySingl3 = _this2.getOptionInfoBySingleValue(singleValue),
|
10334 | label = _getOptionInfoBySingl3.label,
|
10335 | title = _getOptionInfoBySingl3.title;
|
10336 |
|
10337 | selectedValue = _react2["default"].createElement(
|
10338 | 'div',
|
10339 | {
|
10340 | key: 'value',
|
10341 | className: prefixCls + '-selection-selected-value',
|
10342 | title: (0, _util.toTitle)(title || label),
|
10343 | style: {
|
10344 | display: showSelectedValue ? 'block' : 'none',
|
10345 | opacity: opacity
|
10346 | }
|
10347 | },
|
10348 | label
|
10349 | );
|
10350 | }
|
10351 | if (!showSearch) {
|
10352 | innerNode = [selectedValue];
|
10353 | } else {
|
10354 | innerNode = [selectedValue, _react2["default"].createElement(
|
10355 | 'div',
|
10356 | {
|
10357 | className: prefixCls + '-search ' + prefixCls + '-search--inline',
|
10358 | key: 'input',
|
10359 | style: {
|
10360 | display: open ? 'block' : 'none'
|
10361 | }
|
10362 | },
|
10363 | _this2.getInputElement()
|
10364 | )];
|
10365 | }
|
10366 | } else {
|
10367 | var selectedValueNodes = [];
|
10368 | var limitedCountValue = value;
|
10369 | var maxTagPlaceholderEl = void 0;
|
10370 | if (maxTagCount !== undefined && value.length > maxTagCount) {
|
10371 | limitedCountValue = limitedCountValue.slice(0, maxTagCount);
|
10372 | var omittedValues = _this2.getVLForOnChange(value.slice(maxTagCount, value.length));
|
10373 | var content = '+ ' + (value.length - maxTagCount) + ' ...';
|
10374 | if (maxTagPlaceholder) {
|
10375 | content = typeof maxTagPlaceholder === 'function' ? maxTagPlaceholder(omittedValues) : maxTagPlaceholder;
|
10376 | }
|
10377 | maxTagPlaceholderEl = _react2["default"].createElement(
|
10378 | 'li',
|
10379 | _extends({
|
10380 | style: _util.UNSELECTABLE_STYLE
|
10381 | }, _util.UNSELECTABLE_ATTRIBUTE, {
|
10382 | onMouseDown: _util.preventDefaultEvent,
|
10383 | className: prefixCls + '-selection-choice ' + prefixCls + '-selection-choice-disabled',
|
10384 | key: 'maxTagPlaceholder',
|
10385 | title: (0, _util.toTitle)(content)
|
10386 | }),
|
10387 | _react2["default"].createElement(
|
10388 | 'div',
|
10389 | { className: prefixCls + '-selection-choice-content' },
|
10390 | content
|
10391 | )
|
10392 | );
|
10393 | }
|
10394 | if ((0, _util.isMultipleOrTags)(props)) {
|
10395 | selectedValueNodes = limitedCountValue.map(function (singleValue) {
|
10396 | var info = _this2.getOptionInfoBySingleValue(singleValue);
|
10397 | var content = info.label;
|
10398 | var title = info.title || content;
|
10399 | if (maxTagTextLength && typeof content === 'string' && content.length > maxTagTextLength) {
|
10400 | content = content.slice(0, maxTagTextLength) + '...';
|
10401 | }
|
10402 | var disabled = _this2.isChildDisabled(singleValue);
|
10403 | var choiceClassName = disabled ? prefixCls + '-selection-choice ' + prefixCls + '-selection-choice-disabled' : prefixCls + '-selection-choice';
|
10404 | return _react2["default"].createElement(
|
10405 | 'li',
|
10406 | _extends({
|
10407 | style: _util.UNSELECTABLE_STYLE
|
10408 | }, _util.UNSELECTABLE_ATTRIBUTE, {
|
10409 | onMouseDown: _util.preventDefaultEvent,
|
10410 | className: choiceClassName,
|
10411 | key: singleValue,
|
10412 | title: (0, _util.toTitle)(title)
|
10413 | }),
|
10414 | _react2["default"].createElement(
|
10415 | 'div',
|
10416 | { className: prefixCls + '-selection-choice-content' },
|
10417 | content
|
10418 | ),
|
10419 | disabled ? null : _react2["default"].createElement(
|
10420 | 'span',
|
10421 | {
|
10422 | onClick: function onClick(event) {
|
10423 | _this2.removeSelected(singleValue, event);
|
10424 | },
|
10425 | className: prefixCls + '-selection-choice-remove'
|
10426 | },
|
10427 | removeIcon || _react2["default"].createElement(
|
10428 | 'i',
|
10429 | { className: prefixCls + '-selection-choice-remove-icon' },
|
10430 | '\xD7'
|
10431 | )
|
10432 | )
|
10433 | );
|
10434 | });
|
10435 | }
|
10436 | if (maxTagPlaceholderEl) {
|
10437 | selectedValueNodes.push(maxTagPlaceholderEl);
|
10438 | }
|
10439 | selectedValueNodes.push(_react2["default"].createElement(
|
10440 | 'li',
|
10441 | {
|
10442 | className: prefixCls + '-search ' + prefixCls + '-search--inline',
|
10443 | key: '-input'
|
10444 | },
|
10445 | _this2.getInputElement()
|
10446 | ));
|
10447 |
|
10448 | if ((0, _util.isMultipleOrTags)(props) && choiceTransitionName) {
|
10449 | innerNode = _react2["default"].createElement(
|
10450 | _beeAnimate2["default"],
|
10451 | {
|
10452 | onLeave: _this2.onChoiceAnimationLeave,
|
10453 | component: 'ul',
|
10454 | transitionName: choiceTransitionName
|
10455 | },
|
10456 | selectedValueNodes
|
10457 | );
|
10458 | } else {
|
10459 | innerNode = _react2["default"].createElement(
|
10460 | 'ul',
|
10461 | null,
|
10462 | selectedValueNodes
|
10463 | );
|
10464 | }
|
10465 | }
|
10466 | return _react2["default"].createElement(
|
10467 | 'div',
|
10468 | { className: className, ref: _this2.saveTopCtrlRef },
|
10469 | _this2.getPlaceholderElement(),
|
10470 | innerNode
|
10471 | );
|
10472 | };
|
10473 |
|
10474 | this.onOuterClick = function (event) {
|
10475 |
|
10476 | _this2._focused = true;
|
10477 | _this2.updateFocusClassName();
|
10478 | _this2.props.onFocus(_this2.state.value);
|
10479 | };
|
10480 | };
|
10481 |
|
10482 | Select.displayName = 'Select';
|
10483 |
|
10484 | (0, _reactLifecyclesCompat.polyfill)(Select);
|
10485 |
|
10486 | exports["default"] = Select;
|
10487 | module.exports = exports['default'];
|
10488 |
|
10489 | }),
|
10490 |
|
10491 | (function(module, exports) {
|
10492 |
|
10493 | 'use strict';
|
10494 |
|
10495 | Object.defineProperty(exports, '__esModule', { value: true });
|
10496 |
|
10497 | |
10498 |
|
10499 |
|
10500 |
|
10501 |
|
10502 |
|
10503 |
|
10504 | function componentWillMount() {
|
10505 |
|
10506 | var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
|
10507 | if (state !== null && state !== undefined) {
|
10508 | this.setState(state);
|
10509 | }
|
10510 | }
|
10511 |
|
10512 | function componentWillReceiveProps(nextProps) {
|
10513 |
|
10514 |
|
10515 | function updater(prevState) {
|
10516 | var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
|
10517 | return state !== null && state !== undefined ? state : null;
|
10518 | }
|
10519 |
|
10520 | this.setState(updater.bind(this));
|
10521 | }
|
10522 |
|
10523 | function componentWillUpdate(nextProps, nextState) {
|
10524 | try {
|
10525 | var prevProps = this.props;
|
10526 | var prevState = this.state;
|
10527 | this.props = nextProps;
|
10528 | this.state = nextState;
|
10529 | this.__reactInternalSnapshotFlag = true;
|
10530 | this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
|
10531 | prevProps,
|
10532 | prevState
|
10533 | );
|
10534 | } finally {
|
10535 | this.props = prevProps;
|
10536 | this.state = prevState;
|
10537 | }
|
10538 | }
|
10539 |
|
10540 |
|
10541 |
|
10542 | componentWillMount.__suppressDeprecationWarning = true;
|
10543 | componentWillReceiveProps.__suppressDeprecationWarning = true;
|
10544 | componentWillUpdate.__suppressDeprecationWarning = true;
|
10545 |
|
10546 | function polyfill(Component) {
|
10547 | var prototype = Component.prototype;
|
10548 |
|
10549 | if (!prototype || !prototype.isReactComponent) {
|
10550 | throw new Error('Can only polyfill class components');
|
10551 | }
|
10552 |
|
10553 | if (
|
10554 | typeof Component.getDerivedStateFromProps !== 'function' &&
|
10555 | typeof prototype.getSnapshotBeforeUpdate !== 'function'
|
10556 | ) {
|
10557 | return Component;
|
10558 | }
|
10559 |
|
10560 |
|
10561 |
|
10562 |
|
10563 | var foundWillMountName = null;
|
10564 | var foundWillReceivePropsName = null;
|
10565 | var foundWillUpdateName = null;
|
10566 | if (typeof prototype.componentWillMount === 'function') {
|
10567 | foundWillMountName = 'componentWillMount';
|
10568 | } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
|
10569 | foundWillMountName = 'UNSAFE_componentWillMount';
|
10570 | }
|
10571 | if (typeof prototype.componentWillReceiveProps === 'function') {
|
10572 | foundWillReceivePropsName = 'componentWillReceiveProps';
|
10573 | } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
|
10574 | foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
10575 | }
|
10576 | if (typeof prototype.componentWillUpdate === 'function') {
|
10577 | foundWillUpdateName = 'componentWillUpdate';
|
10578 | } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
|
10579 | foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
10580 | }
|
10581 | if (
|
10582 | foundWillMountName !== null ||
|
10583 | foundWillReceivePropsName !== null ||
|
10584 | foundWillUpdateName !== null
|
10585 | ) {
|
10586 | var componentName = Component.displayName || Component.name;
|
10587 | var newApiName =
|
10588 | typeof Component.getDerivedStateFromProps === 'function'
|
10589 | ? 'getDerivedStateFromProps()'
|
10590 | : 'getSnapshotBeforeUpdate()';
|
10591 |
|
10592 | throw Error(
|
10593 | 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
|
10594 | componentName +
|
10595 | ' uses ' +
|
10596 | newApiName +
|
10597 | ' but also contains the following legacy lifecycles:' +
|
10598 | (foundWillMountName !== null ? '\n ' + foundWillMountName : '') +
|
10599 | (foundWillReceivePropsName !== null
|
10600 | ? '\n ' + foundWillReceivePropsName
|
10601 | : '') +
|
10602 | (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') +
|
10603 | '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' +
|
10604 | 'https://fb.me/react-async-component-lifecycle-hooks'
|
10605 | );
|
10606 | }
|
10607 |
|
10608 |
|
10609 |
|
10610 |
|
10611 | if (typeof Component.getDerivedStateFromProps === 'function') {
|
10612 | prototype.componentWillMount = componentWillMount;
|
10613 | prototype.componentWillReceiveProps = componentWillReceiveProps;
|
10614 | }
|
10615 |
|
10616 |
|
10617 |
|
10618 |
|
10619 | if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
|
10620 | if (typeof prototype.componentDidUpdate !== 'function') {
|
10621 | throw new Error(
|
10622 | 'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'
|
10623 | );
|
10624 | }
|
10625 |
|
10626 | prototype.componentWillUpdate = componentWillUpdate;
|
10627 |
|
10628 | var componentDidUpdate = prototype.componentDidUpdate;
|
10629 |
|
10630 | prototype.componentDidUpdate = function componentDidUpdatePolyfill(
|
10631 | prevProps,
|
10632 | prevState,
|
10633 | maybeSnapshot
|
10634 | ) {
|
10635 |
|
10636 |
|
10637 |
|
10638 |
|
10639 |
|
10640 |
|
10641 |
|
10642 |
|
10643 | var snapshot = this.__reactInternalSnapshotFlag
|
10644 | ? this.__reactInternalSnapshot
|
10645 | : maybeSnapshot;
|
10646 |
|
10647 | componentDidUpdate.call(this, prevProps, prevState, snapshot);
|
10648 | };
|
10649 | }
|
10650 |
|
10651 | return Component;
|
10652 | }
|
10653 |
|
10654 | exports.polyfill = polyfill;
|
10655 |
|
10656 |
|
10657 | }),
|
10658 |
|
10659 | (function(module, exports, __webpack_require__) {
|
10660 |
|
10661 | 'use strict';
|
10662 |
|
10663 | exports.__esModule = true;
|
10664 | exports.Divider = exports.ItemGroup = exports.MenuItemGroup = exports.MenuItem = exports.Item = exports.SubMenu = undefined;
|
10665 |
|
10666 | var _Menu = __webpack_require__(93);
|
10667 |
|
10668 | var _Menu2 = _interopRequireDefault(_Menu);
|
10669 |
|
10670 | var _SubMenu = __webpack_require__(194);
|
10671 |
|
10672 | var _SubMenu2 = _interopRequireDefault(_SubMenu);
|
10673 |
|
10674 | var _MenuItem = __webpack_require__(220);
|
10675 |
|
10676 | var _MenuItem2 = _interopRequireDefault(_MenuItem);
|
10677 |
|
10678 | var _MenuItemGroup = __webpack_require__(224);
|
10679 |
|
10680 | var _MenuItemGroup2 = _interopRequireDefault(_MenuItemGroup);
|
10681 |
|
10682 | var _Divider = __webpack_require__(225);
|
10683 |
|
10684 | var _Divider2 = _interopRequireDefault(_Divider);
|
10685 |
|
10686 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
10687 |
|
10688 | exports.SubMenu = _SubMenu2['default'];
|
10689 | exports.Item = _MenuItem2['default'];
|
10690 | exports.MenuItem = _MenuItem2['default'];
|
10691 | exports.MenuItemGroup = _MenuItemGroup2['default'];
|
10692 | exports.ItemGroup = _MenuItemGroup2['default'];
|
10693 | exports.Divider = _Divider2['default'];
|
10694 | exports['default'] = _Menu2['default'];
|
10695 |
|
10696 | }),
|
10697 |
|
10698 | (function(module, exports, __webpack_require__) {
|
10699 |
|
10700 | 'use strict';
|
10701 |
|
10702 | exports.__esModule = true;
|
10703 |
|
10704 | var _extends2 = __webpack_require__(94);
|
10705 |
|
10706 | var _extends3 = _interopRequireDefault(_extends2);
|
10707 |
|
10708 | var _objectWithoutProperties2 = __webpack_require__(133);
|
10709 |
|
10710 | var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
10711 |
|
10712 | var _classCallCheck2 = __webpack_require__(134);
|
10713 |
|
10714 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
10715 |
|
10716 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
10717 |
|
10718 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
10719 |
|
10720 | var _inherits2 = __webpack_require__(169);
|
10721 |
|
10722 | var _inherits3 = _interopRequireDefault(_inherits2);
|
10723 |
|
10724 | var _react = __webpack_require__(4);
|
10725 |
|
10726 | var _react2 = _interopRequireDefault(_react);
|
10727 |
|
10728 | var _propTypes = __webpack_require__(5);
|
10729 |
|
10730 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
10731 |
|
10732 | var _miniStore = __webpack_require__(177);
|
10733 |
|
10734 | var _SubPopupMenu = __webpack_require__(187);
|
10735 |
|
10736 | var _SubPopupMenu2 = _interopRequireDefault(_SubPopupMenu);
|
10737 |
|
10738 | var _util = __webpack_require__(190);
|
10739 |
|
10740 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
10741 |
|
10742 | var Menu = function (_React$Component) {
|
10743 | (0, _inherits3['default'])(Menu, _React$Component);
|
10744 |
|
10745 | function Menu(props) {
|
10746 | (0, _classCallCheck3['default'])(this, Menu);
|
10747 |
|
10748 | var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
|
10749 |
|
10750 | _initialiseProps.call(_this);
|
10751 |
|
10752 | _this.isRootMenu = true;
|
10753 |
|
10754 | var selectedKeys = props.defaultSelectedKeys;
|
10755 | var openKeys = props.defaultOpenKeys;
|
10756 | if ('selectedKeys' in props) {
|
10757 | selectedKeys = props.selectedKeys || [];
|
10758 | }
|
10759 | if ('openKeys' in props) {
|
10760 | openKeys = props.openKeys || [];
|
10761 | }
|
10762 |
|
10763 | _this.store = (0, _miniStore.create)({
|
10764 | selectedKeys: selectedKeys,
|
10765 | openKeys: openKeys,
|
10766 | activeKey: { '0-menu-': (0, _SubPopupMenu.getActiveKey)(props, props.activeKey) }
|
10767 | });
|
10768 | return _this;
|
10769 | }
|
10770 |
|
10771 | Menu.prototype.componentDidMount = function componentDidMount() {
|
10772 | this.updateMiniStore();
|
10773 | };
|
10774 |
|
10775 | Menu.prototype.componentDidUpdate = function componentDidUpdate() {
|
10776 | this.updateMiniStore();
|
10777 | };
|
10778 |
|
10779 |
|
10780 |
|
10781 |
|
10782 |
|
10783 |
|
10784 | Menu.prototype.updateMiniStore = function updateMiniStore() {
|
10785 | if ('selectedKeys' in this.props) {
|
10786 | this.store.setState({
|
10787 | selectedKeys: this.props.selectedKeys || []
|
10788 | });
|
10789 | }
|
10790 | if ('openKeys' in this.props) {
|
10791 | this.store.setState({
|
10792 | openKeys: this.props.openKeys || []
|
10793 | });
|
10794 | }
|
10795 | };
|
10796 |
|
10797 | Menu.prototype.render = function render() {
|
10798 | var _this2 = this;
|
10799 |
|
10800 | var props = (0, _objectWithoutProperties3['default'])(this.props, []);
|
10801 |
|
10802 | props.className += ' ' + props.prefixCls + '-root';
|
10803 | props = (0, _extends3['default'])({}, props, {
|
10804 | onClick: this.onClick,
|
10805 | onOpenChange: this.onOpenChange,
|
10806 | onDeselect: this.onDeselect,
|
10807 | onSelect: this.onSelect,
|
10808 | openTransitionName: this.getOpenTransitionName(),
|
10809 | parentMenu: this
|
10810 | });
|
10811 | return _react2['default'].createElement(
|
10812 | _miniStore.Provider,
|
10813 | { store: this.store },
|
10814 | _react2['default'].createElement(
|
10815 | _SubPopupMenu2['default'],
|
10816 | (0, _extends3['default'])({}, props, { ref: function ref(c) {
|
10817 | return _this2.innerMenu = c;
|
10818 | } }),
|
10819 | this.props.children
|
10820 | )
|
10821 | );
|
10822 | };
|
10823 |
|
10824 | return Menu;
|
10825 | }(_react2['default'].Component);
|
10826 |
|
10827 | Menu.propTypes = {
|
10828 | defaultSelectedKeys: _propTypes2['default'].arrayOf(_propTypes2['default'].string),
|
10829 | defaultActiveFirst: _propTypes2['default'].bool,
|
10830 | selectedKeys: _propTypes2['default'].arrayOf(_propTypes2['default'].string),
|
10831 | defaultOpenKeys: _propTypes2['default'].arrayOf(_propTypes2['default'].string),
|
10832 | openKeys: _propTypes2['default'].arrayOf(_propTypes2['default'].string),
|
10833 | mode: _propTypes2['default'].oneOf(['horizontal', 'vertical', 'vertical-left', 'vertical-right', 'inline']),
|
10834 | getPopupContainer: _propTypes2['default'].func,
|
10835 | onClick: _propTypes2['default'].func,
|
10836 | onSelect: _propTypes2['default'].func,
|
10837 | onDeselect: _propTypes2['default'].func,
|
10838 | onDestroy: _propTypes2['default'].func,
|
10839 | openTransitionName: _propTypes2['default'].string,
|
10840 | openAnimation: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].object]),
|
10841 | subMenuOpenDelay: _propTypes2['default'].number,
|
10842 | subMenuCloseDelay: _propTypes2['default'].number,
|
10843 | forceSubMenuRender: _propTypes2['default'].bool,
|
10844 | triggerSubMenuAction: _propTypes2['default'].string,
|
10845 | level: _propTypes2['default'].number,
|
10846 | selectable: _propTypes2['default'].bool,
|
10847 | multiple: _propTypes2['default'].bool,
|
10848 | children: _propTypes2['default'].any,
|
10849 | className: _propTypes2['default'].string,
|
10850 | style: _propTypes2['default'].object,
|
10851 | activeKey: _propTypes2['default'].string,
|
10852 | prefixCls: _propTypes2['default'].string,
|
10853 | builtinPlacements: _propTypes2['default'].object,
|
10854 | itemIcon: _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].node]),
|
10855 | expandIcon: _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].node]),
|
10856 | overflowedIndicator: _propTypes2['default'].node
|
10857 | };
|
10858 | Menu.defaultProps = {
|
10859 | selectable: true,
|
10860 | onClick: _util.noop,
|
10861 | onSelect: _util.noop,
|
10862 | onOpenChange: _util.noop,
|
10863 | onDeselect: _util.noop,
|
10864 | defaultSelectedKeys: [],
|
10865 | defaultOpenKeys: [],
|
10866 | subMenuOpenDelay: 0.1,
|
10867 | subMenuCloseDelay: 0.1,
|
10868 | triggerSubMenuAction: 'hover',
|
10869 | prefixCls: 'rc-menu',
|
10870 | className: '',
|
10871 | mode: 'vertical',
|
10872 | style: {},
|
10873 | builtinPlacements: {},
|
10874 | overflowedIndicator: _react2['default'].createElement(
|
10875 | 'span',
|
10876 | null,
|
10877 | '\xB7\xB7\xB7'
|
10878 | )
|
10879 | };
|
10880 |
|
10881 | var _initialiseProps = function _initialiseProps() {
|
10882 | var _this3 = this;
|
10883 |
|
10884 | this.onSelect = function (selectInfo) {
|
10885 | var props = _this3.props;
|
10886 | if (props.selectable) {
|
10887 |
|
10888 | var selectedKeys = _this3.store.getState().selectedKeys;
|
10889 | var selectedKey = selectInfo.key;
|
10890 | if (props.multiple) {
|
10891 | selectedKeys = selectedKeys.concat([selectedKey]);
|
10892 | } else {
|
10893 | selectedKeys = [selectedKey];
|
10894 | }
|
10895 | if (!('selectedKeys' in props)) {
|
10896 | _this3.store.setState({
|
10897 | selectedKeys: selectedKeys
|
10898 | });
|
10899 | }
|
10900 | props.onSelect((0, _extends3['default'])({}, selectInfo, {
|
10901 | selectedKeys: selectedKeys
|
10902 | }));
|
10903 | }
|
10904 | };
|
10905 |
|
10906 | this.onClick = function (e) {
|
10907 | _this3.props.onClick(e);
|
10908 | };
|
10909 |
|
10910 | this.onKeyDown = function (e, callback) {
|
10911 | _this3.innerMenu.getWrappedInstance().onKeyDown(e, callback);
|
10912 | };
|
10913 |
|
10914 | this.onOpenChange = function (event) {
|
10915 | var props = _this3.props;
|
10916 | var openKeys = _this3.store.getState().openKeys.concat();
|
10917 | var changed = false;
|
10918 | var processSingle = function processSingle(e) {
|
10919 | var oneChanged = false;
|
10920 | if (e.open) {
|
10921 | oneChanged = openKeys.indexOf(e.key) === -1;
|
10922 | if (oneChanged) {
|
10923 | openKeys.push(e.key);
|
10924 | }
|
10925 | } else {
|
10926 | var index = openKeys.indexOf(e.key);
|
10927 | oneChanged = index !== -1;
|
10928 | if (oneChanged) {
|
10929 | openKeys.splice(index, 1);
|
10930 | }
|
10931 | }
|
10932 | changed = changed || oneChanged;
|
10933 | };
|
10934 | if (Array.isArray(event)) {
|
10935 |
|
10936 | event.forEach(processSingle);
|
10937 | } else {
|
10938 | processSingle(event);
|
10939 | }
|
10940 | if (changed) {
|
10941 | if (!('openKeys' in _this3.props)) {
|
10942 | _this3.store.setState({ openKeys: openKeys });
|
10943 | }
|
10944 | props.onOpenChange(openKeys);
|
10945 | }
|
10946 | };
|
10947 |
|
10948 | this.onDeselect = function (selectInfo) {
|
10949 | var props = _this3.props;
|
10950 | if (props.selectable) {
|
10951 | var selectedKeys = _this3.store.getState().selectedKeys.concat();
|
10952 | var selectedKey = selectInfo.key;
|
10953 | var index = selectedKeys.indexOf(selectedKey);
|
10954 | if (index !== -1) {
|
10955 | selectedKeys.splice(index, 1);
|
10956 | }
|
10957 | if (!('selectedKeys' in props)) {
|
10958 | _this3.store.setState({
|
10959 | selectedKeys: selectedKeys
|
10960 | });
|
10961 | }
|
10962 | props.onDeselect((0, _extends3['default'])({}, selectInfo, {
|
10963 | selectedKeys: selectedKeys
|
10964 | }));
|
10965 | }
|
10966 | };
|
10967 |
|
10968 | this.getOpenTransitionName = function () {
|
10969 | var props = _this3.props;
|
10970 | var transitionName = props.openTransitionName;
|
10971 | var animationName = props.openAnimation;
|
10972 | if (!transitionName && typeof animationName === 'string') {
|
10973 | transitionName = props.prefixCls + '-open-' + animationName;
|
10974 | }
|
10975 | return transitionName;
|
10976 | };
|
10977 | };
|
10978 |
|
10979 | exports['default'] = Menu;
|
10980 | module.exports = exports['default'];
|
10981 |
|
10982 | }),
|
10983 |
|
10984 | (function(module, exports, __webpack_require__) {
|
10985 |
|
10986 | "use strict";
|
10987 |
|
10988 | exports.__esModule = true;
|
10989 |
|
10990 | var _assign = __webpack_require__(95);
|
10991 |
|
10992 | var _assign2 = _interopRequireDefault(_assign);
|
10993 |
|
10994 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10995 |
|
10996 | exports.default = _assign2.default || function (target) {
|
10997 | for (var i = 1; i < arguments.length; i++) {
|
10998 | var source = arguments[i];
|
10999 |
|
11000 | for (var key in source) {
|
11001 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
11002 | target[key] = source[key];
|
11003 | }
|
11004 | }
|
11005 | }
|
11006 |
|
11007 | return target;
|
11008 | };
|
11009 |
|
11010 | }),
|
11011 |
|
11012 | (function(module, exports, __webpack_require__) {
|
11013 |
|
11014 | module.exports = { "default": __webpack_require__(96), __esModule: true };
|
11015 |
|
11016 | }),
|
11017 |
|
11018 | (function(module, exports, __webpack_require__) {
|
11019 |
|
11020 | __webpack_require__(97);
|
11021 | module.exports = __webpack_require__(100).Object.assign;
|
11022 |
|
11023 |
|
11024 | }),
|
11025 |
|
11026 | (function(module, exports, __webpack_require__) {
|
11027 |
|
11028 |
|
11029 | var $export = __webpack_require__(98);
|
11030 |
|
11031 | $export($export.S + $export.F, 'Object', { assign: __webpack_require__(114) });
|
11032 |
|
11033 |
|
11034 | }),
|
11035 |
|
11036 | (function(module, exports, __webpack_require__) {
|
11037 |
|
11038 | var global = __webpack_require__(99);
|
11039 | var core = __webpack_require__(100);
|
11040 | var ctx = __webpack_require__(101);
|
11041 | var hide = __webpack_require__(103);
|
11042 | var has = __webpack_require__(113);
|
11043 | var PROTOTYPE = 'prototype';
|
11044 |
|
11045 | var $export = function (type, name, source) {
|
11046 | var IS_FORCED = type & $export.F;
|
11047 | var IS_GLOBAL = type & $export.G;
|
11048 | var IS_STATIC = type & $export.S;
|
11049 | var IS_PROTO = type & $export.P;
|
11050 | var IS_BIND = type & $export.B;
|
11051 | var IS_WRAP = type & $export.W;
|
11052 | var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
|
11053 | var expProto = exports[PROTOTYPE];
|
11054 | var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
|
11055 | var key, own, out;
|
11056 | if (IS_GLOBAL) source = name;
|
11057 | for (key in source) {
|
11058 |
|
11059 | own = !IS_FORCED && target && target[key] !== undefined;
|
11060 | if (own && has(exports, key)) continue;
|
11061 |
|
11062 | out = own ? target[key] : source[key];
|
11063 |
|
11064 | exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
|
11065 |
|
11066 | : IS_BIND && own ? ctx(out, global)
|
11067 |
|
11068 | : IS_WRAP && target[key] == out ? (function (C) {
|
11069 | var F = function (a, b, c) {
|
11070 | if (this instanceof C) {
|
11071 | switch (arguments.length) {
|
11072 | case 0: return new C();
|
11073 | case 1: return new C(a);
|
11074 | case 2: return new C(a, b);
|
11075 | } return new C(a, b, c);
|
11076 | } return C.apply(this, arguments);
|
11077 | };
|
11078 | F[PROTOTYPE] = C[PROTOTYPE];
|
11079 | return F;
|
11080 |
|
11081 | })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
|
11082 |
|
11083 | if (IS_PROTO) {
|
11084 | (exports.virtual || (exports.virtual = {}))[key] = out;
|
11085 |
|
11086 | if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
|
11087 | }
|
11088 | }
|
11089 | };
|
11090 |
|
11091 | $export.F = 1;
|
11092 | $export.G = 2;
|
11093 | $export.S = 4;
|
11094 | $export.P = 8;
|
11095 | $export.B = 16;
|
11096 | $export.W = 32;
|
11097 | $export.U = 64;
|
11098 | $export.R = 128;
|
11099 | module.exports = $export;
|
11100 |
|
11101 |
|
11102 | }),
|
11103 |
|
11104 | (function(module, exports) {
|
11105 |
|
11106 |
|
11107 | var global = module.exports = typeof window != 'undefined' && window.Math == Math
|
11108 | ? window : typeof self != 'undefined' && self.Math == Math ? self
|
11109 |
|
11110 | : Function('return this')();
|
11111 | if (typeof __g == 'number') __g = global;
|
11112 |
|
11113 |
|
11114 | }),
|
11115 |
|
11116 | (function(module, exports) {
|
11117 |
|
11118 | var core = module.exports = { version: '2.6.5' };
|
11119 | if (typeof __e == 'number') __e = core;
|
11120 |
|
11121 |
|
11122 | }),
|
11123 |
|
11124 | (function(module, exports, __webpack_require__) {
|
11125 |
|
11126 |
|
11127 | var aFunction = __webpack_require__(102);
|
11128 | module.exports = function (fn, that, length) {
|
11129 | aFunction(fn);
|
11130 | if (that === undefined) return fn;
|
11131 | switch (length) {
|
11132 | case 1: return function (a) {
|
11133 | return fn.call(that, a);
|
11134 | };
|
11135 | case 2: return function (a, b) {
|
11136 | return fn.call(that, a, b);
|
11137 | };
|
11138 | case 3: return function (a, b, c) {
|
11139 | return fn.call(that, a, b, c);
|
11140 | };
|
11141 | }
|
11142 | return function (/* ...args */) {
|
11143 | return fn.apply(that, arguments);
|
11144 | };
|
11145 | };
|
11146 |
|
11147 |
|
11148 | }),
|
11149 |
|
11150 | (function(module, exports) {
|
11151 |
|
11152 | module.exports = function (it) {
|
11153 | if (typeof it != 'function') throw TypeError(it + ' is not a function!');
|
11154 | return it;
|
11155 | };
|
11156 |
|
11157 |
|
11158 | }),
|
11159 |
|
11160 | (function(module, exports, __webpack_require__) {
|
11161 |
|
11162 | var dP = __webpack_require__(104);
|
11163 | var createDesc = __webpack_require__(112);
|
11164 | module.exports = __webpack_require__(108) ? function (object, key, value) {
|
11165 | return dP.f(object, key, createDesc(1, value));
|
11166 | } : function (object, key, value) {
|
11167 | object[key] = value;
|
11168 | return object;
|
11169 | };
|
11170 |
|
11171 |
|
11172 | }),
|
11173 |
|
11174 | (function(module, exports, __webpack_require__) {
|
11175 |
|
11176 | var anObject = __webpack_require__(105);
|
11177 | var IE8_DOM_DEFINE = __webpack_require__(107);
|
11178 | var toPrimitive = __webpack_require__(111);
|
11179 | var dP = Object.defineProperty;
|
11180 |
|
11181 | exports.f = __webpack_require__(108) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
|
11182 | anObject(O);
|
11183 | P = toPrimitive(P, true);
|
11184 | anObject(Attributes);
|
11185 | if (IE8_DOM_DEFINE) try {
|
11186 | return dP(O, P, Attributes);
|
11187 | } catch (e) { }
|
11188 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
|
11189 | if ('value' in Attributes) O[P] = Attributes.value;
|
11190 | return O;
|
11191 | };
|
11192 |
|
11193 |
|
11194 | }),
|
11195 |
|
11196 | (function(module, exports, __webpack_require__) {
|
11197 |
|
11198 | var isObject = __webpack_require__(106);
|
11199 | module.exports = function (it) {
|
11200 | if (!isObject(it)) throw TypeError(it + ' is not an object!');
|
11201 | return it;
|
11202 | };
|
11203 |
|
11204 |
|
11205 | }),
|
11206 |
|
11207 | (function(module, exports) {
|
11208 |
|
11209 | module.exports = function (it) {
|
11210 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
11211 | };
|
11212 |
|
11213 |
|
11214 | }),
|
11215 |
|
11216 | (function(module, exports, __webpack_require__) {
|
11217 |
|
11218 | module.exports = !__webpack_require__(108) && !__webpack_require__(109)(function () {
|
11219 | return Object.defineProperty(__webpack_require__(110)('div'), 'a', { get: function () { return 7; } }).a != 7;
|
11220 | });
|
11221 |
|
11222 |
|
11223 | }),
|
11224 |
|
11225 | (function(module, exports, __webpack_require__) {
|
11226 |
|
11227 |
|
11228 | module.exports = !__webpack_require__(109)(function () {
|
11229 | return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
11230 | });
|
11231 |
|
11232 |
|
11233 | }),
|
11234 |
|
11235 | (function(module, exports) {
|
11236 |
|
11237 | module.exports = function (exec) {
|
11238 | try {
|
11239 | return !!exec();
|
11240 | } catch (e) {
|
11241 | return true;
|
11242 | }
|
11243 | };
|
11244 |
|
11245 |
|
11246 | }),
|
11247 |
|
11248 | (function(module, exports, __webpack_require__) {
|
11249 |
|
11250 | var isObject = __webpack_require__(106);
|
11251 | var document = __webpack_require__(99).document;
|
11252 |
|
11253 | var is = isObject(document) && isObject(document.createElement);
|
11254 | module.exports = function (it) {
|
11255 | return is ? document.createElement(it) : {};
|
11256 | };
|
11257 |
|
11258 |
|
11259 | }),
|
11260 |
|
11261 | (function(module, exports, __webpack_require__) {
|
11262 |
|
11263 |
|
11264 | var isObject = __webpack_require__(106);
|
11265 |
|
11266 |
|
11267 | module.exports = function (it, S) {
|
11268 | if (!isObject(it)) return it;
|
11269 | var fn, val;
|
11270 | if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
11271 | if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
|
11272 | if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
11273 | throw TypeError("Can't convert object to primitive value");
|
11274 | };
|
11275 |
|
11276 |
|
11277 | }),
|
11278 |
|
11279 | (function(module, exports) {
|
11280 |
|
11281 | module.exports = function (bitmap, value) {
|
11282 | return {
|
11283 | enumerable: !(bitmap & 1),
|
11284 | configurable: !(bitmap & 2),
|
11285 | writable: !(bitmap & 4),
|
11286 | value: value
|
11287 | };
|
11288 | };
|
11289 |
|
11290 |
|
11291 | }),
|
11292 |
|
11293 | (function(module, exports) {
|
11294 |
|
11295 | var hasOwnProperty = {}.hasOwnProperty;
|
11296 | module.exports = function (it, key) {
|
11297 | return hasOwnProperty.call(it, key);
|
11298 | };
|
11299 |
|
11300 |
|
11301 | }),
|
11302 |
|
11303 | (function(module, exports, __webpack_require__) {
|
11304 |
|
11305 | 'use strict';
|
11306 |
|
11307 | var getKeys = __webpack_require__(115);
|
11308 | var gOPS = __webpack_require__(130);
|
11309 | var pIE = __webpack_require__(131);
|
11310 | var toObject = __webpack_require__(132);
|
11311 | var IObject = __webpack_require__(118);
|
11312 | var $assign = Object.assign;
|
11313 |
|
11314 |
|
11315 | module.exports = !$assign || __webpack_require__(109)(function () {
|
11316 | var A = {};
|
11317 | var B = {};
|
11318 |
|
11319 | var S = Symbol();
|
11320 | var K = 'abcdefghijklmnopqrst';
|
11321 | A[S] = 7;
|
11322 | K.split('').forEach(function (k) { B[k] = k; });
|
11323 | return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
11324 | }) ? function assign(target, source) {
|
11325 | var T = toObject(target);
|
11326 | var aLen = arguments.length;
|
11327 | var index = 1;
|
11328 | var getSymbols = gOPS.f;
|
11329 | var isEnum = pIE.f;
|
11330 | while (aLen > index) {
|
11331 | var S = IObject(arguments[index++]);
|
11332 | var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
|
11333 | var length = keys.length;
|
11334 | var j = 0;
|
11335 | var key;
|
11336 | while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
|
11337 | } return T;
|
11338 | } : $assign;
|
11339 |
|
11340 |
|
11341 | }),
|
11342 |
|
11343 | (function(module, exports, __webpack_require__) {
|
11344 |
|
11345 |
|
11346 | var $keys = __webpack_require__(116);
|
11347 | var enumBugKeys = __webpack_require__(129);
|
11348 |
|
11349 | module.exports = Object.keys || function keys(O) {
|
11350 | return $keys(O, enumBugKeys);
|
11351 | };
|
11352 |
|
11353 |
|
11354 | }),
|
11355 |
|
11356 | (function(module, exports, __webpack_require__) {
|
11357 |
|
11358 | var has = __webpack_require__(113);
|
11359 | var toIObject = __webpack_require__(117);
|
11360 | var arrayIndexOf = __webpack_require__(121)(false);
|
11361 | var IE_PROTO = __webpack_require__(125)('IE_PROTO');
|
11362 |
|
11363 | module.exports = function (object, names) {
|
11364 | var O = toIObject(object);
|
11365 | var i = 0;
|
11366 | var result = [];
|
11367 | var key;
|
11368 | for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
|
11369 |
|
11370 | while (names.length > i) if (has(O, key = names[i++])) {
|
11371 | ~arrayIndexOf(result, key) || result.push(key);
|
11372 | }
|
11373 | return result;
|
11374 | };
|
11375 |
|
11376 |
|
11377 | }),
|
11378 |
|
11379 | (function(module, exports, __webpack_require__) {
|
11380 |
|
11381 |
|
11382 | var IObject = __webpack_require__(118);
|
11383 | var defined = __webpack_require__(120);
|
11384 | module.exports = function (it) {
|
11385 | return IObject(defined(it));
|
11386 | };
|
11387 |
|
11388 |
|
11389 | }),
|
11390 |
|
11391 | (function(module, exports, __webpack_require__) {
|
11392 |
|
11393 |
|
11394 | var cof = __webpack_require__(119);
|
11395 |
|
11396 | module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
|
11397 | return cof(it) == 'String' ? it.split('') : Object(it);
|
11398 | };
|
11399 |
|
11400 |
|
11401 | }),
|
11402 |
|
11403 | (function(module, exports) {
|
11404 |
|
11405 | var toString = {}.toString;
|
11406 |
|
11407 | module.exports = function (it) {
|
11408 | return toString.call(it).slice(8, -1);
|
11409 | };
|
11410 |
|
11411 |
|
11412 | }),
|
11413 |
|
11414 | (function(module, exports) {
|
11415 |
|
11416 |
|
11417 | module.exports = function (it) {
|
11418 | if (it == undefined) throw TypeError("Can't call method on " + it);
|
11419 | return it;
|
11420 | };
|
11421 |
|
11422 |
|
11423 | }),
|
11424 |
|
11425 | (function(module, exports, __webpack_require__) {
|
11426 |
|
11427 |
|
11428 |
|
11429 | var toIObject = __webpack_require__(117);
|
11430 | var toLength = __webpack_require__(122);
|
11431 | var toAbsoluteIndex = __webpack_require__(124);
|
11432 | module.exports = function (IS_INCLUDES) {
|
11433 | return function ($this, el, fromIndex) {
|
11434 | var O = toIObject($this);
|
11435 | var length = toLength(O.length);
|
11436 | var index = toAbsoluteIndex(fromIndex, length);
|
11437 | var value;
|
11438 |
|
11439 |
|
11440 | if (IS_INCLUDES && el != el) while (length > index) {
|
11441 | value = O[index++];
|
11442 |
|
11443 | if (value != value) return true;
|
11444 |
|
11445 | } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
|
11446 | if (O[index] === el) return IS_INCLUDES || index || 0;
|
11447 | } return !IS_INCLUDES && -1;
|
11448 | };
|
11449 | };
|
11450 |
|
11451 |
|
11452 | }),
|
11453 |
|
11454 | (function(module, exports, __webpack_require__) {
|
11455 |
|
11456 |
|
11457 | var toInteger = __webpack_require__(123);
|
11458 | var min = Math.min;
|
11459 | module.exports = function (it) {
|
11460 | return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0;
|
11461 | };
|
11462 |
|
11463 |
|
11464 | }),
|
11465 |
|
11466 | (function(module, exports) {
|
11467 |
|
11468 |
|
11469 | var ceil = Math.ceil;
|
11470 | var floor = Math.floor;
|
11471 | module.exports = function (it) {
|
11472 | return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
11473 | };
|
11474 |
|
11475 |
|
11476 | }),
|
11477 |
|
11478 | (function(module, exports, __webpack_require__) {
|
11479 |
|
11480 | var toInteger = __webpack_require__(123);
|
11481 | var max = Math.max;
|
11482 | var min = Math.min;
|
11483 | module.exports = function (index, length) {
|
11484 | index = toInteger(index);
|
11485 | return index < 0 ? max(index + length, 0) : min(index, length);
|
11486 | };
|
11487 |
|
11488 |
|
11489 | }),
|
11490 |
|
11491 | (function(module, exports, __webpack_require__) {
|
11492 |
|
11493 | var shared = __webpack_require__(126)('keys');
|
11494 | var uid = __webpack_require__(128);
|
11495 | module.exports = function (key) {
|
11496 | return shared[key] || (shared[key] = uid(key));
|
11497 | };
|
11498 |
|
11499 |
|
11500 | }),
|
11501 |
|
11502 | (function(module, exports, __webpack_require__) {
|
11503 |
|
11504 | var core = __webpack_require__(100);
|
11505 | var global = __webpack_require__(99);
|
11506 | var SHARED = '__core-js_shared__';
|
11507 | var store = global[SHARED] || (global[SHARED] = {});
|
11508 |
|
11509 | (module.exports = function (key, value) {
|
11510 | return store[key] || (store[key] = value !== undefined ? value : {});
|
11511 | })('versions', []).push({
|
11512 | version: core.version,
|
11513 | mode: __webpack_require__(127) ? 'pure' : 'global',
|
11514 | copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
|
11515 | });
|
11516 |
|
11517 |
|
11518 | }),
|
11519 |
|
11520 | (function(module, exports) {
|
11521 |
|
11522 | module.exports = true;
|
11523 |
|
11524 |
|
11525 | }),
|
11526 |
|
11527 | (function(module, exports) {
|
11528 |
|
11529 | var id = 0;
|
11530 | var px = Math.random();
|
11531 | module.exports = function (key) {
|
11532 | return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
11533 | };
|
11534 |
|
11535 |
|
11536 | }),
|
11537 |
|
11538 | (function(module, exports) {
|
11539 |
|
11540 |
|
11541 | module.exports = (
|
11542 | 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
|
11543 | ).split(',');
|
11544 |
|
11545 |
|
11546 | }),
|
11547 |
|
11548 | (function(module, exports) {
|
11549 |
|
11550 | exports.f = Object.getOwnPropertySymbols;
|
11551 |
|
11552 |
|
11553 | }),
|
11554 |
|
11555 | (function(module, exports) {
|
11556 |
|
11557 | exports.f = {}.propertyIsEnumerable;
|
11558 |
|
11559 |
|
11560 | }),
|
11561 |
|
11562 | (function(module, exports, __webpack_require__) {
|
11563 |
|
11564 |
|
11565 | var defined = __webpack_require__(120);
|
11566 | module.exports = function (it) {
|
11567 | return Object(defined(it));
|
11568 | };
|
11569 |
|
11570 |
|
11571 | }),
|
11572 |
|
11573 | (function(module, exports) {
|
11574 |
|
11575 | "use strict";
|
11576 |
|
11577 | exports.__esModule = true;
|
11578 |
|
11579 | exports.default = function (obj, keys) {
|
11580 | var target = {};
|
11581 |
|
11582 | for (var i in obj) {
|
11583 | if (keys.indexOf(i) >= 0) continue;
|
11584 | if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
|
11585 | target[i] = obj[i];
|
11586 | }
|
11587 |
|
11588 | return target;
|
11589 | };
|
11590 |
|
11591 | }),
|
11592 |
|
11593 | (function(module, exports) {
|
11594 |
|
11595 | "use strict";
|
11596 |
|
11597 | exports.__esModule = true;
|
11598 |
|
11599 | exports.default = function (instance, Constructor) {
|
11600 | if (!(instance instanceof Constructor)) {
|
11601 | throw new TypeError("Cannot call a class as a function");
|
11602 | }
|
11603 | };
|
11604 |
|
11605 | }),
|
11606 |
|
11607 | (function(module, exports, __webpack_require__) {
|
11608 |
|
11609 | "use strict";
|
11610 |
|
11611 | exports.__esModule = true;
|
11612 |
|
11613 | var _typeof2 = __webpack_require__(136);
|
11614 |
|
11615 | var _typeof3 = _interopRequireDefault(_typeof2);
|
11616 |
|
11617 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11618 |
|
11619 | exports.default = function (self, call) {
|
11620 | if (!self) {
|
11621 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
11622 | }
|
11623 |
|
11624 | return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
|
11625 | };
|
11626 |
|
11627 | }),
|
11628 |
|
11629 | (function(module, exports, __webpack_require__) {
|
11630 |
|
11631 | "use strict";
|
11632 |
|
11633 | exports.__esModule = true;
|
11634 |
|
11635 | var _iterator = __webpack_require__(137);
|
11636 |
|
11637 | var _iterator2 = _interopRequireDefault(_iterator);
|
11638 |
|
11639 | var _symbol = __webpack_require__(156);
|
11640 |
|
11641 | var _symbol2 = _interopRequireDefault(_symbol);
|
11642 |
|
11643 | var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
|
11644 |
|
11645 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11646 |
|
11647 | exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
|
11648 | return typeof obj === "undefined" ? "undefined" : _typeof(obj);
|
11649 | } : function (obj) {
|
11650 | return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
|
11651 | };
|
11652 |
|
11653 | }),
|
11654 |
|
11655 | (function(module, exports, __webpack_require__) {
|
11656 |
|
11657 | module.exports = { "default": __webpack_require__(138), __esModule: true };
|
11658 |
|
11659 | }),
|
11660 |
|
11661 | (function(module, exports, __webpack_require__) {
|
11662 |
|
11663 | __webpack_require__(139);
|
11664 | __webpack_require__(151);
|
11665 | module.exports = __webpack_require__(155).f('iterator');
|
11666 |
|
11667 |
|
11668 | }),
|
11669 |
|
11670 | (function(module, exports, __webpack_require__) {
|
11671 |
|
11672 | 'use strict';
|
11673 | var $at = __webpack_require__(140)(true);
|
11674 |
|
11675 |
|
11676 | __webpack_require__(141)(String, 'String', function (iterated) {
|
11677 | this._t = String(iterated);
|
11678 | this._i = 0;
|
11679 |
|
11680 | }, function () {
|
11681 | var O = this._t;
|
11682 | var index = this._i;
|
11683 | var point;
|
11684 | if (index >= O.length) return { value: undefined, done: true };
|
11685 | point = $at(O, index);
|
11686 | this._i += point.length;
|
11687 | return { value: point, done: false };
|
11688 | });
|
11689 |
|
11690 |
|
11691 | }),
|
11692 |
|
11693 | (function(module, exports, __webpack_require__) {
|
11694 |
|
11695 | var toInteger = __webpack_require__(123);
|
11696 | var defined = __webpack_require__(120);
|
11697 |
|
11698 |
|
11699 | module.exports = function (TO_STRING) {
|
11700 | return function (that, pos) {
|
11701 | var s = String(defined(that));
|
11702 | var i = toInteger(pos);
|
11703 | var l = s.length;
|
11704 | var a, b;
|
11705 | if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
|
11706 | a = s.charCodeAt(i);
|
11707 | return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
|
11708 | ? TO_STRING ? s.charAt(i) : a
|
11709 | : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
|
11710 | };
|
11711 | };
|
11712 |
|
11713 |
|
11714 | }),
|
11715 |
|
11716 | (function(module, exports, __webpack_require__) {
|
11717 |
|
11718 | 'use strict';
|
11719 | var LIBRARY = __webpack_require__(127);
|
11720 | var $export = __webpack_require__(98);
|
11721 | var redefine = __webpack_require__(142);
|
11722 | var hide = __webpack_require__(103);
|
11723 | var Iterators = __webpack_require__(143);
|
11724 | var $iterCreate = __webpack_require__(144);
|
11725 | var setToStringTag = __webpack_require__(148);
|
11726 | var getPrototypeOf = __webpack_require__(150);
|
11727 | var ITERATOR = __webpack_require__(149)('iterator');
|
11728 | var BUGGY = !([].keys && 'next' in [].keys());
|
11729 | var FF_ITERATOR = '@@iterator';
|
11730 | var KEYS = 'keys';
|
11731 | var VALUES = 'values';
|
11732 |
|
11733 | var returnThis = function () { return this; };
|
11734 |
|
11735 | module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
|
11736 | $iterCreate(Constructor, NAME, next);
|
11737 | var getMethod = function (kind) {
|
11738 | if (!BUGGY && kind in proto) return proto[kind];
|
11739 | switch (kind) {
|
11740 | case KEYS: return function keys() { return new Constructor(this, kind); };
|
11741 | case VALUES: return function values() { return new Constructor(this, kind); };
|
11742 | } return function entries() { return new Constructor(this, kind); };
|
11743 | };
|
11744 | var TAG = NAME + ' Iterator';
|
11745 | var DEF_VALUES = DEFAULT == VALUES;
|
11746 | var VALUES_BUG = false;
|
11747 | var proto = Base.prototype;
|
11748 | var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
|
11749 | var $default = $native || getMethod(DEFAULT);
|
11750 | var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
|
11751 | var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
|
11752 | var methods, key, IteratorPrototype;
|
11753 |
|
11754 | if ($anyNative) {
|
11755 | IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
|
11756 | if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
|
11757 |
|
11758 | setToStringTag(IteratorPrototype, TAG, true);
|
11759 |
|
11760 | if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
|
11761 | }
|
11762 | }
|
11763 |
|
11764 | if (DEF_VALUES && $native && $native.name !== VALUES) {
|
11765 | VALUES_BUG = true;
|
11766 | $default = function values() { return $native.call(this); };
|
11767 | }
|
11768 |
|
11769 | if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
|
11770 | hide(proto, ITERATOR, $default);
|
11771 | }
|
11772 |
|
11773 | Iterators[NAME] = $default;
|
11774 | Iterators[TAG] = returnThis;
|
11775 | if (DEFAULT) {
|
11776 | methods = {
|
11777 | values: DEF_VALUES ? $default : getMethod(VALUES),
|
11778 | keys: IS_SET ? $default : getMethod(KEYS),
|
11779 | entries: $entries
|
11780 | };
|
11781 | if (FORCED) for (key in methods) {
|
11782 | if (!(key in proto)) redefine(proto, key, methods[key]);
|
11783 | } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
|
11784 | }
|
11785 | return methods;
|
11786 | };
|
11787 |
|
11788 |
|
11789 | }),
|
11790 |
|
11791 | (function(module, exports, __webpack_require__) {
|
11792 |
|
11793 | module.exports = __webpack_require__(103);
|
11794 |
|
11795 |
|
11796 | }),
|
11797 |
|
11798 | (function(module, exports) {
|
11799 |
|
11800 | module.exports = {};
|
11801 |
|
11802 |
|
11803 | }),
|
11804 |
|
11805 | (function(module, exports, __webpack_require__) {
|
11806 |
|
11807 | 'use strict';
|
11808 | var create = __webpack_require__(145);
|
11809 | var descriptor = __webpack_require__(112);
|
11810 | var setToStringTag = __webpack_require__(148);
|
11811 | var IteratorPrototype = {};
|
11812 |
|
11813 |
|
11814 | __webpack_require__(103)(IteratorPrototype, __webpack_require__(149)('iterator'), function () { return this; });
|
11815 |
|
11816 | module.exports = function (Constructor, NAME, next) {
|
11817 | Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
|
11818 | setToStringTag(Constructor, NAME + ' Iterator');
|
11819 | };
|
11820 |
|
11821 |
|
11822 | }),
|
11823 |
|
11824 | (function(module, exports, __webpack_require__) {
|
11825 |
|
11826 |
|
11827 | var anObject = __webpack_require__(105);
|
11828 | var dPs = __webpack_require__(146);
|
11829 | var enumBugKeys = __webpack_require__(129);
|
11830 | var IE_PROTO = __webpack_require__(125)('IE_PROTO');
|
11831 | var Empty = function () { };
|
11832 | var PROTOTYPE = 'prototype';
|
11833 |
|
11834 |
|
11835 | var createDict = function () {
|
11836 |
|
11837 | var iframe = __webpack_require__(110)('iframe');
|
11838 | var i = enumBugKeys.length;
|
11839 | var lt = '<';
|
11840 | var gt = '>';
|
11841 | var iframeDocument;
|
11842 | iframe.style.display = 'none';
|
11843 | __webpack_require__(147).appendChild(iframe);
|
11844 | iframe.src = 'javascript:';
|
11845 |
|
11846 |
|
11847 | iframeDocument = iframe.contentWindow.document;
|
11848 | iframeDocument.open();
|
11849 | iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
|
11850 | iframeDocument.close();
|
11851 | createDict = iframeDocument.F;
|
11852 | while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
|
11853 | return createDict();
|
11854 | };
|
11855 |
|
11856 | module.exports = Object.create || function create(O, Properties) {
|
11857 | var result;
|
11858 | if (O !== null) {
|
11859 | Empty[PROTOTYPE] = anObject(O);
|
11860 | result = new Empty();
|
11861 | Empty[PROTOTYPE] = null;
|
11862 |
|
11863 | result[IE_PROTO] = O;
|
11864 | } else result = createDict();
|
11865 | return Properties === undefined ? result : dPs(result, Properties);
|
11866 | };
|
11867 |
|
11868 |
|
11869 | }),
|
11870 |
|
11871 | (function(module, exports, __webpack_require__) {
|
11872 |
|
11873 | var dP = __webpack_require__(104);
|
11874 | var anObject = __webpack_require__(105);
|
11875 | var getKeys = __webpack_require__(115);
|
11876 |
|
11877 | module.exports = __webpack_require__(108) ? Object.defineProperties : function defineProperties(O, Properties) {
|
11878 | anObject(O);
|
11879 | var keys = getKeys(Properties);
|
11880 | var length = keys.length;
|
11881 | var i = 0;
|
11882 | var P;
|
11883 | while (length > i) dP.f(O, P = keys[i++], Properties[P]);
|
11884 | return O;
|
11885 | };
|
11886 |
|
11887 |
|
11888 | }),
|
11889 |
|
11890 | (function(module, exports, __webpack_require__) {
|
11891 |
|
11892 | var document = __webpack_require__(99).document;
|
11893 | module.exports = document && document.documentElement;
|
11894 |
|
11895 |
|
11896 | }),
|
11897 |
|
11898 | (function(module, exports, __webpack_require__) {
|
11899 |
|
11900 | var def = __webpack_require__(104).f;
|
11901 | var has = __webpack_require__(113);
|
11902 | var TAG = __webpack_require__(149)('toStringTag');
|
11903 |
|
11904 | module.exports = function (it, tag, stat) {
|
11905 | if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
|
11906 | };
|
11907 |
|
11908 |
|
11909 | }),
|
11910 |
|
11911 | (function(module, exports, __webpack_require__) {
|
11912 |
|
11913 | var store = __webpack_require__(126)('wks');
|
11914 | var uid = __webpack_require__(128);
|
11915 | var Symbol = __webpack_require__(99).Symbol;
|
11916 | var USE_SYMBOL = typeof Symbol == 'function';
|
11917 |
|
11918 | var $exports = module.exports = function (name) {
|
11919 | return store[name] || (store[name] =
|
11920 | USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
|
11921 | };
|
11922 |
|
11923 | $exports.store = store;
|
11924 |
|
11925 |
|
11926 | }),
|
11927 |
|
11928 | (function(module, exports, __webpack_require__) {
|
11929 |
|
11930 |
|
11931 | var has = __webpack_require__(113);
|
11932 | var toObject = __webpack_require__(132);
|
11933 | var IE_PROTO = __webpack_require__(125)('IE_PROTO');
|
11934 | var ObjectProto = Object.prototype;
|
11935 |
|
11936 | module.exports = Object.getPrototypeOf || function (O) {
|
11937 | O = toObject(O);
|
11938 | if (has(O, IE_PROTO)) return O[IE_PROTO];
|
11939 | if (typeof O.constructor == 'function' && O instanceof O.constructor) {
|
11940 | return O.constructor.prototype;
|
11941 | } return O instanceof Object ? ObjectProto : null;
|
11942 | };
|
11943 |
|
11944 |
|
11945 | }),
|
11946 |
|
11947 | (function(module, exports, __webpack_require__) {
|
11948 |
|
11949 | __webpack_require__(152);
|
11950 | var global = __webpack_require__(99);
|
11951 | var hide = __webpack_require__(103);
|
11952 | var Iterators = __webpack_require__(143);
|
11953 | var TO_STRING_TAG = __webpack_require__(149)('toStringTag');
|
11954 |
|
11955 | var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
|
11956 | 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
|
11957 | 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
|
11958 | 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
|
11959 | 'TextTrackList,TouchList').split(',');
|
11960 |
|
11961 | for (var i = 0; i < DOMIterables.length; i++) {
|
11962 | var NAME = DOMIterables[i];
|
11963 | var Collection = global[NAME];
|
11964 | var proto = Collection && Collection.prototype;
|
11965 | if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
|
11966 | Iterators[NAME] = Iterators.Array;
|
11967 | }
|
11968 |
|
11969 |
|
11970 | }),
|
11971 |
|
11972 | (function(module, exports, __webpack_require__) {
|
11973 |
|
11974 | 'use strict';
|
11975 | var addToUnscopables = __webpack_require__(153);
|
11976 | var step = __webpack_require__(154);
|
11977 | var Iterators = __webpack_require__(143);
|
11978 | var toIObject = __webpack_require__(117);
|
11979 |
|
11980 |
|
11981 |
|
11982 |
|
11983 |
|
11984 | module.exports = __webpack_require__(141)(Array, 'Array', function (iterated, kind) {
|
11985 | this._t = toIObject(iterated);
|
11986 | this._i = 0;
|
11987 | this._k = kind;
|
11988 |
|
11989 | }, function () {
|
11990 | var O = this._t;
|
11991 | var kind = this._k;
|
11992 | var index = this._i++;
|
11993 | if (!O || index >= O.length) {
|
11994 | this._t = undefined;
|
11995 | return step(1);
|
11996 | }
|
11997 | if (kind == 'keys') return step(0, index);
|
11998 | if (kind == 'values') return step(0, O[index]);
|
11999 | return step(0, [index, O[index]]);
|
12000 | }, 'values');
|
12001 |
|
12002 |
|
12003 | Iterators.Arguments = Iterators.Array;
|
12004 |
|
12005 | addToUnscopables('keys');
|
12006 | addToUnscopables('values');
|
12007 | addToUnscopables('entries');
|
12008 |
|
12009 |
|
12010 | }),
|
12011 |
|
12012 | (function(module, exports) {
|
12013 |
|
12014 | module.exports = function () { };
|
12015 |
|
12016 |
|
12017 | }),
|
12018 |
|
12019 | (function(module, exports) {
|
12020 |
|
12021 | module.exports = function (done, value) {
|
12022 | return { value: value, done: !!done };
|
12023 | };
|
12024 |
|
12025 |
|
12026 | }),
|
12027 |
|
12028 | (function(module, exports, __webpack_require__) {
|
12029 |
|
12030 | exports.f = __webpack_require__(149);
|
12031 |
|
12032 |
|
12033 | }),
|
12034 |
|
12035 | (function(module, exports, __webpack_require__) {
|
12036 |
|
12037 | module.exports = { "default": __webpack_require__(157), __esModule: true };
|
12038 |
|
12039 | }),
|
12040 |
|
12041 | (function(module, exports, __webpack_require__) {
|
12042 |
|
12043 | __webpack_require__(158);
|
12044 | __webpack_require__(166);
|
12045 | __webpack_require__(167);
|
12046 | __webpack_require__(168);
|
12047 | module.exports = __webpack_require__(100).Symbol;
|
12048 |
|
12049 |
|
12050 | }),
|
12051 |
|
12052 | (function(module, exports, __webpack_require__) {
|
12053 |
|
12054 | 'use strict';
|
12055 |
|
12056 | var global = __webpack_require__(99);
|
12057 | var has = __webpack_require__(113);
|
12058 | var DESCRIPTORS = __webpack_require__(108);
|
12059 | var $export = __webpack_require__(98);
|
12060 | var redefine = __webpack_require__(142);
|
12061 | var META = __webpack_require__(159).KEY;
|
12062 | var $fails = __webpack_require__(109);
|
12063 | var shared = __webpack_require__(126);
|
12064 | var setToStringTag = __webpack_require__(148);
|
12065 | var uid = __webpack_require__(128);
|
12066 | var wks = __webpack_require__(149);
|
12067 | var wksExt = __webpack_require__(155);
|
12068 | var wksDefine = __webpack_require__(160);
|
12069 | var enumKeys = __webpack_require__(161);
|
12070 | var isArray = __webpack_require__(162);
|
12071 | var anObject = __webpack_require__(105);
|
12072 | var isObject = __webpack_require__(106);
|
12073 | var toIObject = __webpack_require__(117);
|
12074 | var toPrimitive = __webpack_require__(111);
|
12075 | var createDesc = __webpack_require__(112);
|
12076 | var _create = __webpack_require__(145);
|
12077 | var gOPNExt = __webpack_require__(163);
|
12078 | var $GOPD = __webpack_require__(165);
|
12079 | var $DP = __webpack_require__(104);
|
12080 | var $keys = __webpack_require__(115);
|
12081 | var gOPD = $GOPD.f;
|
12082 | var dP = $DP.f;
|
12083 | var gOPN = gOPNExt.f;
|
12084 | var $Symbol = global.Symbol;
|
12085 | var $JSON = global.JSON;
|
12086 | var _stringify = $JSON && $JSON.stringify;
|
12087 | var PROTOTYPE = 'prototype';
|
12088 | var HIDDEN = wks('_hidden');
|
12089 | var TO_PRIMITIVE = wks('toPrimitive');
|
12090 | var isEnum = {}.propertyIsEnumerable;
|
12091 | var SymbolRegistry = shared('symbol-registry');
|
12092 | var AllSymbols = shared('symbols');
|
12093 | var OPSymbols = shared('op-symbols');
|
12094 | var ObjectProto = Object[PROTOTYPE];
|
12095 | var USE_NATIVE = typeof $Symbol == 'function';
|
12096 | var QObject = global.QObject;
|
12097 |
|
12098 | var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
|
12099 |
|
12100 |
|
12101 | var setSymbolDesc = DESCRIPTORS && $fails(function () {
|
12102 | return _create(dP({}, 'a', {
|
12103 | get: function () { return dP(this, 'a', { value: 7 }).a; }
|
12104 | })).a != 7;
|
12105 | }) ? function (it, key, D) {
|
12106 | var protoDesc = gOPD(ObjectProto, key);
|
12107 | if (protoDesc) delete ObjectProto[key];
|
12108 | dP(it, key, D);
|
12109 | if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
|
12110 | } : dP;
|
12111 |
|
12112 | var wrap = function (tag) {
|
12113 | var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
|
12114 | sym._k = tag;
|
12115 | return sym;
|
12116 | };
|
12117 |
|
12118 | var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
|
12119 | return typeof it == 'symbol';
|
12120 | } : function (it) {
|
12121 | return it instanceof $Symbol;
|
12122 | };
|
12123 |
|
12124 | var $defineProperty = function defineProperty(it, key, D) {
|
12125 | if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
|
12126 | anObject(it);
|
12127 | key = toPrimitive(key, true);
|
12128 | anObject(D);
|
12129 | if (has(AllSymbols, key)) {
|
12130 | if (!D.enumerable) {
|
12131 | if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
|
12132 | it[HIDDEN][key] = true;
|
12133 | } else {
|
12134 | if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
|
12135 | D = _create(D, { enumerable: createDesc(0, false) });
|
12136 | } return setSymbolDesc(it, key, D);
|
12137 | } return dP(it, key, D);
|
12138 | };
|
12139 | var $defineProperties = function defineProperties(it, P) {
|
12140 | anObject(it);
|
12141 | var keys = enumKeys(P = toIObject(P));
|
12142 | var i = 0;
|
12143 | var l = keys.length;
|
12144 | var key;
|
12145 | while (l > i) $defineProperty(it, key = keys[i++], P[key]);
|
12146 | return it;
|
12147 | };
|
12148 | var $create = function create(it, P) {
|
12149 | return P === undefined ? _create(it) : $defineProperties(_create(it), P);
|
12150 | };
|
12151 | var $propertyIsEnumerable = function propertyIsEnumerable(key) {
|
12152 | var E = isEnum.call(this, key = toPrimitive(key, true));
|
12153 | if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
|
12154 | return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
|
12155 | };
|
12156 | var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
|
12157 | it = toIObject(it);
|
12158 | key = toPrimitive(key, true);
|
12159 | if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
|
12160 | var D = gOPD(it, key);
|
12161 | if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
|
12162 | return D;
|
12163 | };
|
12164 | var $getOwnPropertyNames = function getOwnPropertyNames(it) {
|
12165 | var names = gOPN(toIObject(it));
|
12166 | var result = [];
|
12167 | var i = 0;
|
12168 | var key;
|
12169 | while (names.length > i) {
|
12170 | if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
|
12171 | } return result;
|
12172 | };
|
12173 | var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
|
12174 | var IS_OP = it === ObjectProto;
|
12175 | var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
|
12176 | var result = [];
|
12177 | var i = 0;
|
12178 | var key;
|
12179 | while (names.length > i) {
|
12180 | if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
|
12181 | } return result;
|
12182 | };
|
12183 |
|
12184 |
|
12185 | if (!USE_NATIVE) {
|
12186 | $Symbol = function Symbol() {
|
12187 | if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
|
12188 | var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
|
12189 | var $set = function (value) {
|
12190 | if (this === ObjectProto) $set.call(OPSymbols, value);
|
12191 | if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
|
12192 | setSymbolDesc(this, tag, createDesc(1, value));
|
12193 | };
|
12194 | if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
|
12195 | return wrap(tag);
|
12196 | };
|
12197 | redefine($Symbol[PROTOTYPE], 'toString', function toString() {
|
12198 | return this._k;
|
12199 | });
|
12200 |
|
12201 | $GOPD.f = $getOwnPropertyDescriptor;
|
12202 | $DP.f = $defineProperty;
|
12203 | __webpack_require__(164).f = gOPNExt.f = $getOwnPropertyNames;
|
12204 | __webpack_require__(131).f = $propertyIsEnumerable;
|
12205 | __webpack_require__(130).f = $getOwnPropertySymbols;
|
12206 |
|
12207 | if (DESCRIPTORS && !__webpack_require__(127)) {
|
12208 | redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
|
12209 | }
|
12210 |
|
12211 | wksExt.f = function (name) {
|
12212 | return wrap(wks(name));
|
12213 | };
|
12214 | }
|
12215 |
|
12216 | $export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
|
12217 |
|
12218 | for (var es6Symbols = (
|
12219 |
|
12220 | 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
|
12221 | ).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);
|
12222 |
|
12223 | for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
|
12224 |
|
12225 | $export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
|
12226 |
|
12227 | 'for': function (key) {
|
12228 | return has(SymbolRegistry, key += '')
|
12229 | ? SymbolRegistry[key]
|
12230 | : SymbolRegistry[key] = $Symbol(key);
|
12231 | },
|
12232 |
|
12233 | keyFor: function keyFor(sym) {
|
12234 | if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
|
12235 | for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
|
12236 | },
|
12237 | useSetter: function () { setter = true; },
|
12238 | useSimple: function () { setter = false; }
|
12239 | });
|
12240 |
|
12241 | $export($export.S + $export.F * !USE_NATIVE, 'Object', {
|
12242 |
|
12243 | create: $create,
|
12244 |
|
12245 | defineProperty: $defineProperty,
|
12246 |
|
12247 | defineProperties: $defineProperties,
|
12248 |
|
12249 | getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
|
12250 |
|
12251 | getOwnPropertyNames: $getOwnPropertyNames,
|
12252 |
|
12253 | getOwnPropertySymbols: $getOwnPropertySymbols
|
12254 | });
|
12255 |
|
12256 |
|
12257 | $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
|
12258 | var S = $Symbol();
|
12259 |
|
12260 |
|
12261 |
|
12262 | return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
|
12263 | })), 'JSON', {
|
12264 | stringify: function stringify(it) {
|
12265 | var args = [it];
|
12266 | var i = 1;
|
12267 | var replacer, $replacer;
|
12268 | while (arguments.length > i) args.push(arguments[i++]);
|
12269 | $replacer = replacer = args[1];
|
12270 | if (!isObject(replacer) && it === undefined || isSymbol(it)) return;
|
12271 | if (!isArray(replacer)) replacer = function (key, value) {
|
12272 | if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
|
12273 | if (!isSymbol(value)) return value;
|
12274 | };
|
12275 | args[1] = replacer;
|
12276 | return _stringify.apply($JSON, args);
|
12277 | }
|
12278 | });
|
12279 |
|
12280 |
|
12281 | $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(103)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
|
12282 |
|
12283 | setToStringTag($Symbol, 'Symbol');
|
12284 |
|
12285 | setToStringTag(Math, 'Math', true);
|
12286 |
|
12287 | setToStringTag(global.JSON, 'JSON', true);
|
12288 |
|
12289 |
|
12290 | }),
|
12291 |
|
12292 | (function(module, exports, __webpack_require__) {
|
12293 |
|
12294 | var META = __webpack_require__(128)('meta');
|
12295 | var isObject = __webpack_require__(106);
|
12296 | var has = __webpack_require__(113);
|
12297 | var setDesc = __webpack_require__(104).f;
|
12298 | var id = 0;
|
12299 | var isExtensible = Object.isExtensible || function () {
|
12300 | return true;
|
12301 | };
|
12302 | var FREEZE = !__webpack_require__(109)(function () {
|
12303 | return isExtensible(Object.preventExtensions({}));
|
12304 | });
|
12305 | var setMeta = function (it) {
|
12306 | setDesc(it, META, { value: {
|
12307 | i: 'O' + ++id,
|
12308 | w: {}
|
12309 | } });
|
12310 | };
|
12311 | var fastKey = function (it, create) {
|
12312 |
|
12313 | if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
|
12314 | if (!has(it, META)) {
|
12315 |
|
12316 | if (!isExtensible(it)) return 'F';
|
12317 |
|
12318 | if (!create) return 'E';
|
12319 |
|
12320 | setMeta(it);
|
12321 |
|
12322 | } return it[META].i;
|
12323 | };
|
12324 | var getWeak = function (it, create) {
|
12325 | if (!has(it, META)) {
|
12326 |
|
12327 | if (!isExtensible(it)) return true;
|
12328 |
|
12329 | if (!create) return false;
|
12330 |
|
12331 | setMeta(it);
|
12332 |
|
12333 | } return it[META].w;
|
12334 | };
|
12335 |
|
12336 | var onFreeze = function (it) {
|
12337 | if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
|
12338 | return it;
|
12339 | };
|
12340 | var meta = module.exports = {
|
12341 | KEY: META,
|
12342 | NEED: false,
|
12343 | fastKey: fastKey,
|
12344 | getWeak: getWeak,
|
12345 | onFreeze: onFreeze
|
12346 | };
|
12347 |
|
12348 |
|
12349 | }),
|
12350 |
|
12351 | (function(module, exports, __webpack_require__) {
|
12352 |
|
12353 | var global = __webpack_require__(99);
|
12354 | var core = __webpack_require__(100);
|
12355 | var LIBRARY = __webpack_require__(127);
|
12356 | var wksExt = __webpack_require__(155);
|
12357 | var defineProperty = __webpack_require__(104).f;
|
12358 | module.exports = function (name) {
|
12359 | var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
|
12360 | if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
|
12361 | };
|
12362 |
|
12363 |
|
12364 | }),
|
12365 |
|
12366 | (function(module, exports, __webpack_require__) {
|
12367 |
|
12368 |
|
12369 | var getKeys = __webpack_require__(115);
|
12370 | var gOPS = __webpack_require__(130);
|
12371 | var pIE = __webpack_require__(131);
|
12372 | module.exports = function (it) {
|
12373 | var result = getKeys(it);
|
12374 | var getSymbols = gOPS.f;
|
12375 | if (getSymbols) {
|
12376 | var symbols = getSymbols(it);
|
12377 | var isEnum = pIE.f;
|
12378 | var i = 0;
|
12379 | var key;
|
12380 | while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
|
12381 | } return result;
|
12382 | };
|
12383 |
|
12384 |
|
12385 | }),
|
12386 |
|
12387 | (function(module, exports, __webpack_require__) {
|
12388 |
|
12389 |
|
12390 | var cof = __webpack_require__(119);
|
12391 | module.exports = Array.isArray || function isArray(arg) {
|
12392 | return cof(arg) == 'Array';
|
12393 | };
|
12394 |
|
12395 |
|
12396 | }),
|
12397 |
|
12398 | (function(module, exports, __webpack_require__) {
|
12399 |
|
12400 |
|
12401 | var toIObject = __webpack_require__(117);
|
12402 | var gOPN = __webpack_require__(164).f;
|
12403 | var toString = {}.toString;
|
12404 |
|
12405 | var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
|
12406 | ? Object.getOwnPropertyNames(window) : [];
|
12407 |
|
12408 | var getWindowNames = function (it) {
|
12409 | try {
|
12410 | return gOPN(it);
|
12411 | } catch (e) {
|
12412 | return windowNames.slice();
|
12413 | }
|
12414 | };
|
12415 |
|
12416 | module.exports.f = function getOwnPropertyNames(it) {
|
12417 | return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
|
12418 | };
|
12419 |
|
12420 |
|
12421 | }),
|
12422 |
|
12423 | (function(module, exports, __webpack_require__) {
|
12424 |
|
12425 |
|
12426 | var $keys = __webpack_require__(116);
|
12427 | var hiddenKeys = __webpack_require__(129).concat('length', 'prototype');
|
12428 |
|
12429 | exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
12430 | return $keys(O, hiddenKeys);
|
12431 | };
|
12432 |
|
12433 |
|
12434 | }),
|
12435 |
|
12436 | (function(module, exports, __webpack_require__) {
|
12437 |
|
12438 | var pIE = __webpack_require__(131);
|
12439 | var createDesc = __webpack_require__(112);
|
12440 | var toIObject = __webpack_require__(117);
|
12441 | var toPrimitive = __webpack_require__(111);
|
12442 | var has = __webpack_require__(113);
|
12443 | var IE8_DOM_DEFINE = __webpack_require__(107);
|
12444 | var gOPD = Object.getOwnPropertyDescriptor;
|
12445 |
|
12446 | exports.f = __webpack_require__(108) ? gOPD : function getOwnPropertyDescriptor(O, P) {
|
12447 | O = toIObject(O);
|
12448 | P = toPrimitive(P, true);
|
12449 | if (IE8_DOM_DEFINE) try {
|
12450 | return gOPD(O, P);
|
12451 | } catch (e) { }
|
12452 | if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
|
12453 | };
|
12454 |
|
12455 |
|
12456 | }),
|
12457 |
|
12458 | (function(module, exports) {
|
12459 |
|
12460 |
|
12461 |
|
12462 | }),
|
12463 |
|
12464 | (function(module, exports, __webpack_require__) {
|
12465 |
|
12466 | __webpack_require__(160)('asyncIterator');
|
12467 |
|
12468 |
|
12469 | }),
|
12470 |
|
12471 | (function(module, exports, __webpack_require__) {
|
12472 |
|
12473 | __webpack_require__(160)('observable');
|
12474 |
|
12475 |
|
12476 | }),
|
12477 |
|
12478 | (function(module, exports, __webpack_require__) {
|
12479 |
|
12480 | "use strict";
|
12481 |
|
12482 | exports.__esModule = true;
|
12483 |
|
12484 | var _setPrototypeOf = __webpack_require__(170);
|
12485 |
|
12486 | var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
|
12487 |
|
12488 | var _create = __webpack_require__(174);
|
12489 |
|
12490 | var _create2 = _interopRequireDefault(_create);
|
12491 |
|
12492 | var _typeof2 = __webpack_require__(136);
|
12493 |
|
12494 | var _typeof3 = _interopRequireDefault(_typeof2);
|
12495 |
|
12496 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12497 |
|
12498 | exports.default = function (subClass, superClass) {
|
12499 | if (typeof superClass !== "function" && superClass !== null) {
|
12500 | throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
|
12501 | }
|
12502 |
|
12503 | subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
|
12504 | constructor: {
|
12505 | value: subClass,
|
12506 | enumerable: false,
|
12507 | writable: true,
|
12508 | configurable: true
|
12509 | }
|
12510 | });
|
12511 | if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
|
12512 | };
|
12513 |
|
12514 | }),
|
12515 |
|
12516 | (function(module, exports, __webpack_require__) {
|
12517 |
|
12518 | module.exports = { "default": __webpack_require__(171), __esModule: true };
|
12519 |
|
12520 | }),
|
12521 |
|
12522 | (function(module, exports, __webpack_require__) {
|
12523 |
|
12524 | __webpack_require__(172);
|
12525 | module.exports = __webpack_require__(100).Object.setPrototypeOf;
|
12526 |
|
12527 |
|
12528 | }),
|
12529 |
|
12530 | (function(module, exports, __webpack_require__) {
|
12531 |
|
12532 |
|
12533 | var $export = __webpack_require__(98);
|
12534 | $export($export.S, 'Object', { setPrototypeOf: __webpack_require__(173).set });
|
12535 |
|
12536 |
|
12537 | }),
|
12538 |
|
12539 | (function(module, exports, __webpack_require__) {
|
12540 |
|
12541 |
|
12542 |
|
12543 | var isObject = __webpack_require__(106);
|
12544 | var anObject = __webpack_require__(105);
|
12545 | var check = function (O, proto) {
|
12546 | anObject(O);
|
12547 | if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
|
12548 | };
|
12549 | module.exports = {
|
12550 | set: Object.setPrototypeOf || ('__proto__' in {} ?
|
12551 | function (test, buggy, set) {
|
12552 | try {
|
12553 | set = __webpack_require__(101)(Function.call, __webpack_require__(165).f(Object.prototype, '__proto__').set, 2);
|
12554 | set(test, []);
|
12555 | buggy = !(test instanceof Array);
|
12556 | } catch (e) { buggy = true; }
|
12557 | return function setPrototypeOf(O, proto) {
|
12558 | check(O, proto);
|
12559 | if (buggy) O.__proto__ = proto;
|
12560 | else set(O, proto);
|
12561 | return O;
|
12562 | };
|
12563 | }({}, false) : undefined),
|
12564 | check: check
|
12565 | };
|
12566 |
|
12567 |
|
12568 | }),
|
12569 |
|
12570 | (function(module, exports, __webpack_require__) {
|
12571 |
|
12572 | module.exports = { "default": __webpack_require__(175), __esModule: true };
|
12573 |
|
12574 | }),
|
12575 |
|
12576 | (function(module, exports, __webpack_require__) {
|
12577 |
|
12578 | __webpack_require__(176);
|
12579 | var $Object = __webpack_require__(100).Object;
|
12580 | module.exports = function create(P, D) {
|
12581 | return $Object.create(P, D);
|
12582 | };
|
12583 |
|
12584 |
|
12585 | }),
|
12586 |
|
12587 | (function(module, exports, __webpack_require__) {
|
12588 |
|
12589 | var $export = __webpack_require__(98);
|
12590 |
|
12591 | $export($export.S, 'Object', { create: __webpack_require__(145) });
|
12592 |
|
12593 |
|
12594 | }),
|
12595 |
|
12596 | (function(module, exports, __webpack_require__) {
|
12597 |
|
12598 | 'use strict';
|
12599 |
|
12600 | Object.defineProperty(exports, "__esModule", {
|
12601 | value: true
|
12602 | });
|
12603 | exports.create = exports.connect = exports.Provider = undefined;
|
12604 |
|
12605 | var _Provider2 = __webpack_require__(178);
|
12606 |
|
12607 | var _Provider3 = _interopRequireDefault(_Provider2);
|
12608 |
|
12609 | var _connect2 = __webpack_require__(180);
|
12610 |
|
12611 | var _connect3 = _interopRequireDefault(_connect2);
|
12612 |
|
12613 | var _create2 = __webpack_require__(186);
|
12614 |
|
12615 | var _create3 = _interopRequireDefault(_create2);
|
12616 |
|
12617 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12618 |
|
12619 | exports.Provider = _Provider3.default;
|
12620 | exports.connect = _connect3.default;
|
12621 | exports.create = _create3.default;
|
12622 |
|
12623 | }),
|
12624 |
|
12625 | (function(module, exports, __webpack_require__) {
|
12626 |
|
12627 | 'use strict';
|
12628 |
|
12629 | Object.defineProperty(exports, "__esModule", {
|
12630 | value: true
|
12631 | });
|
12632 |
|
12633 | 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; }; }();
|
12634 |
|
12635 | var _react = __webpack_require__(4);
|
12636 |
|
12637 | var _react2 = _interopRequireDefault(_react);
|
12638 |
|
12639 | var _PropTypes = __webpack_require__(179);
|
12640 |
|
12641 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12642 |
|
12643 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12644 |
|
12645 | 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; }
|
12646 |
|
12647 | 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; }
|
12648 |
|
12649 | var Provider = function (_Component) {
|
12650 | _inherits(Provider, _Component);
|
12651 |
|
12652 | function Provider() {
|
12653 | _classCallCheck(this, Provider);
|
12654 |
|
12655 | return _possibleConstructorReturn(this, (Provider.__proto__ || Object.getPrototypeOf(Provider)).apply(this, arguments));
|
12656 | }
|
12657 |
|
12658 | _createClass(Provider, [{
|
12659 | key: 'getChildContext',
|
12660 | value: function getChildContext() {
|
12661 | return {
|
12662 | miniStore: this.props.store
|
12663 | };
|
12664 | }
|
12665 | }, {
|
12666 | key: 'render',
|
12667 | value: function render() {
|
12668 | return _react.Children.only(this.props.children);
|
12669 | }
|
12670 | }]);
|
12671 |
|
12672 | return Provider;
|
12673 | }(_react.Component);
|
12674 |
|
12675 | Provider.propTypes = {
|
12676 | store: _PropTypes.storeShape.isRequired
|
12677 | };
|
12678 | Provider.childContextTypes = {
|
12679 | miniStore: _PropTypes.storeShape.isRequired
|
12680 | };
|
12681 | exports.default = Provider;
|
12682 |
|
12683 | }),
|
12684 |
|
12685 | (function(module, exports, __webpack_require__) {
|
12686 |
|
12687 | 'use strict';
|
12688 |
|
12689 | Object.defineProperty(exports, "__esModule", {
|
12690 | value: true
|
12691 | });
|
12692 | exports.storeShape = undefined;
|
12693 |
|
12694 | var _propTypes = __webpack_require__(5);
|
12695 |
|
12696 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
12697 |
|
12698 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12699 |
|
12700 | var storeShape = exports.storeShape = _propTypes2.default.shape({
|
12701 | subscribe: _propTypes2.default.func.isRequired,
|
12702 | setState: _propTypes2.default.func.isRequired,
|
12703 | getState: _propTypes2.default.func.isRequired
|
12704 | });
|
12705 |
|
12706 | }),
|
12707 |
|
12708 | (function(module, exports, __webpack_require__) {
|
12709 |
|
12710 | 'use strict';
|
12711 |
|
12712 | Object.defineProperty(exports, "__esModule", {
|
12713 | value: true
|
12714 | });
|
12715 |
|
12716 | 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; };
|
12717 |
|
12718 | 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; }; }();
|
12719 |
|
12720 | exports.default = connect;
|
12721 |
|
12722 | var _react = __webpack_require__(4);
|
12723 |
|
12724 | var _react2 = _interopRequireDefault(_react);
|
12725 |
|
12726 | var _shallowequal = __webpack_require__(181);
|
12727 |
|
12728 | var _shallowequal2 = _interopRequireDefault(_shallowequal);
|
12729 |
|
12730 | var _hoistNonReactStatics = __webpack_require__(182);
|
12731 |
|
12732 | var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
|
12733 |
|
12734 | var _reactLifecyclesCompat = __webpack_require__(91);
|
12735 |
|
12736 | var _PropTypes = __webpack_require__(179);
|
12737 |
|
12738 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12739 |
|
12740 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12741 |
|
12742 | 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; }
|
12743 |
|
12744 | 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; }
|
12745 |
|
12746 | function getDisplayName(WrappedComponent) {
|
12747 | return WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
12748 | }
|
12749 |
|
12750 | function isStateless(Component) {
|
12751 | return !Component.prototype.render;
|
12752 | }
|
12753 |
|
12754 | var defaultMapStateToProps = function defaultMapStateToProps() {
|
12755 | return {};
|
12756 | };
|
12757 |
|
12758 | function connect(mapStateToProps) {
|
12759 | var shouldSubscribe = !!mapStateToProps;
|
12760 | var finnalMapStateToProps = mapStateToProps || defaultMapStateToProps;
|
12761 |
|
12762 | return function wrapWithConnect(WrappedComponent) {
|
12763 | var Connect = function (_Component) {
|
12764 | _inherits(Connect, _Component);
|
12765 |
|
12766 | _createClass(Connect, null, [{
|
12767 | key: 'getDerivedStateFromProps',
|
12768 | value: function getDerivedStateFromProps(props, prevState) {
|
12769 |
|
12770 | if (mapStateToProps && mapStateToProps.length === 2 && props !== prevState.props) {
|
12771 | return {
|
12772 | subscribed: finnalMapStateToProps(prevState.store.getState(), props),
|
12773 | props: props
|
12774 | };
|
12775 | }
|
12776 | return { props: props };
|
12777 | }
|
12778 | }]);
|
12779 |
|
12780 | function Connect(props, context) {
|
12781 | _classCallCheck(this, Connect);
|
12782 |
|
12783 | var _this = _possibleConstructorReturn(this, (Connect.__proto__ || Object.getPrototypeOf(Connect)).call(this, props, context));
|
12784 |
|
12785 | _this.handleChange = function () {
|
12786 | if (!_this.unsubscribe) {
|
12787 | return;
|
12788 | }
|
12789 | var nextState = finnalMapStateToProps(_this.store.getState(), _this.props);
|
12790 | _this.setState({ subscribed: nextState });
|
12791 | };
|
12792 |
|
12793 | _this.store = context.miniStore;
|
12794 | _this.state = {
|
12795 | subscribed: finnalMapStateToProps(_this.store.getState(), props),
|
12796 | store: _this.store,
|
12797 | props: props
|
12798 | };
|
12799 | return _this;
|
12800 | }
|
12801 |
|
12802 | _createClass(Connect, [{
|
12803 | key: 'componentDidMount',
|
12804 | value: function componentDidMount() {
|
12805 | this.trySubscribe();
|
12806 | }
|
12807 | }, {
|
12808 | key: 'componentWillUnmount',
|
12809 | value: function componentWillUnmount() {
|
12810 | this.tryUnsubscribe();
|
12811 | }
|
12812 | }, {
|
12813 | key: 'shouldComponentUpdate',
|
12814 | value: function shouldComponentUpdate(nextProps, nextState) {
|
12815 | return !(0, _shallowequal2.default)(this.props, nextProps) || !(0, _shallowequal2.default)(this.state.subscribed, nextState.subscribed);
|
12816 | }
|
12817 | }, {
|
12818 | key: 'trySubscribe',
|
12819 | value: function trySubscribe() {
|
12820 | if (shouldSubscribe) {
|
12821 | this.unsubscribe = this.store.subscribe(this.handleChange);
|
12822 | this.handleChange();
|
12823 | }
|
12824 | }
|
12825 | }, {
|
12826 | key: 'tryUnsubscribe',
|
12827 | value: function tryUnsubscribe() {
|
12828 | if (this.unsubscribe) {
|
12829 | this.unsubscribe();
|
12830 | this.unsubscribe = null;
|
12831 | }
|
12832 | }
|
12833 | }, {
|
12834 | key: 'getWrappedInstance',
|
12835 | value: function getWrappedInstance() {
|
12836 | return this.wrappedInstance;
|
12837 | }
|
12838 | }, {
|
12839 | key: 'render',
|
12840 | value: function render() {
|
12841 | var _this2 = this;
|
12842 |
|
12843 | var props = _extends({}, this.props, this.state.subscribed, {
|
12844 | store: this.store
|
12845 | });
|
12846 |
|
12847 | if (!isStateless(WrappedComponent)) {
|
12848 | props = _extends({}, props, {
|
12849 | ref: function ref(c) {
|
12850 | return _this2.wrappedInstance = c;
|
12851 | }
|
12852 | });
|
12853 | }
|
12854 |
|
12855 | return _react2.default.createElement(WrappedComponent, props);
|
12856 | }
|
12857 | }]);
|
12858 |
|
12859 | return Connect;
|
12860 | }(_react.Component);
|
12861 |
|
12862 | Connect.displayName = 'Connect(' + getDisplayName(WrappedComponent) + ')';
|
12863 | Connect.contextTypes = {
|
12864 | miniStore: _PropTypes.storeShape.isRequired
|
12865 | };
|
12866 |
|
12867 |
|
12868 | (0, _reactLifecyclesCompat.polyfill)(Connect);
|
12869 |
|
12870 | return (0, _hoistNonReactStatics2.default)(Connect, WrappedComponent);
|
12871 | };
|
12872 | }
|
12873 |
|
12874 | }),
|
12875 |
|
12876 | (function(module, exports) {
|
12877 |
|
12878 |
|
12879 |
|
12880 | module.exports = function shallowEqual(objA, objB, compare, compareContext) {
|
12881 | var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
|
12882 |
|
12883 | if (ret !== void 0) {
|
12884 | return !!ret;
|
12885 | }
|
12886 |
|
12887 | if (objA === objB) {
|
12888 | return true;
|
12889 | }
|
12890 |
|
12891 | if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) {
|
12892 | return false;
|
12893 | }
|
12894 |
|
12895 | var keysA = Object.keys(objA);
|
12896 | var keysB = Object.keys(objB);
|
12897 |
|
12898 | if (keysA.length !== keysB.length) {
|
12899 | return false;
|
12900 | }
|
12901 |
|
12902 | var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
12903 |
|
12904 |
|
12905 | for (var idx = 0; idx < keysA.length; idx++) {
|
12906 | var key = keysA[idx];
|
12907 |
|
12908 | if (!bHasOwnProperty(key)) {
|
12909 | return false;
|
12910 | }
|
12911 |
|
12912 | var valueA = objA[key];
|
12913 | var valueB = objB[key];
|
12914 |
|
12915 | ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
|
12916 |
|
12917 | if (ret === false || (ret === void 0 && valueA !== valueB)) {
|
12918 | return false;
|
12919 | }
|
12920 | }
|
12921 |
|
12922 | return true;
|
12923 | };
|
12924 |
|
12925 |
|
12926 | }),
|
12927 |
|
12928 | (function(module, exports, __webpack_require__) {
|
12929 |
|
12930 | 'use strict';
|
12931 |
|
12932 | |
12933 |
|
12934 |
|
12935 |
|
12936 | var ReactIs = __webpack_require__(183);
|
12937 | var REACT_STATICS = {
|
12938 | childContextTypes: true,
|
12939 | contextType: true,
|
12940 | contextTypes: true,
|
12941 | defaultProps: true,
|
12942 | displayName: true,
|
12943 | getDefaultProps: true,
|
12944 | getDerivedStateFromError: true,
|
12945 | getDerivedStateFromProps: true,
|
12946 | mixins: true,
|
12947 | propTypes: true,
|
12948 | type: true
|
12949 | };
|
12950 |
|
12951 | var KNOWN_STATICS = {
|
12952 | name: true,
|
12953 | length: true,
|
12954 | prototype: true,
|
12955 | caller: true,
|
12956 | callee: true,
|
12957 | arguments: true,
|
12958 | arity: true
|
12959 | };
|
12960 |
|
12961 | var FORWARD_REF_STATICS = {
|
12962 | '$$typeof': true,
|
12963 | render: true,
|
12964 | defaultProps: true,
|
12965 | displayName: true,
|
12966 | propTypes: true
|
12967 | };
|
12968 |
|
12969 | var MEMO_STATICS = {
|
12970 | '$$typeof': true,
|
12971 | compare: true,
|
12972 | defaultProps: true,
|
12973 | displayName: true,
|
12974 | propTypes: true,
|
12975 | type: true
|
12976 | };
|
12977 |
|
12978 | var TYPE_STATICS = {};
|
12979 | TYPE_STATICS[ReactIs.ForwardRef] = FORWARD_REF_STATICS;
|
12980 |
|
12981 | function getStatics(component) {
|
12982 | if (ReactIs.isMemo(component)) {
|
12983 | return MEMO_STATICS;
|
12984 | }
|
12985 | return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
|
12986 | }
|
12987 |
|
12988 | var defineProperty = Object.defineProperty;
|
12989 | var getOwnPropertyNames = Object.getOwnPropertyNames;
|
12990 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
12991 | var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
12992 | var getPrototypeOf = Object.getPrototypeOf;
|
12993 | var objectPrototype = Object.prototype;
|
12994 |
|
12995 | function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
12996 | if (typeof sourceComponent !== 'string') {
|
12997 |
|
12998 |
|
12999 | if (objectPrototype) {
|
13000 | var inheritedComponent = getPrototypeOf(sourceComponent);
|
13001 | if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
13002 | hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
13003 | }
|
13004 | }
|
13005 |
|
13006 | var keys = getOwnPropertyNames(sourceComponent);
|
13007 |
|
13008 | if (getOwnPropertySymbols) {
|
13009 | keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
13010 | }
|
13011 |
|
13012 | var targetStatics = getStatics(targetComponent);
|
13013 | var sourceStatics = getStatics(sourceComponent);
|
13014 |
|
13015 | for (var i = 0; i < keys.length; ++i) {
|
13016 | var key = keys[i];
|
13017 | if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
13018 | var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
13019 | try {
|
13020 |
|
13021 | defineProperty(targetComponent, key, descriptor);
|
13022 | } catch (e) {}
|
13023 | }
|
13024 | }
|
13025 |
|
13026 | return targetComponent;
|
13027 | }
|
13028 |
|
13029 | return targetComponent;
|
13030 | }
|
13031 |
|
13032 | module.exports = hoistNonReactStatics;
|
13033 |
|
13034 |
|
13035 | }),
|
13036 |
|
13037 | (function(module, exports, __webpack_require__) {
|
13038 |
|
13039 | (function(process) {'use strict';
|
13040 |
|
13041 | if (process.env.NODE_ENV === 'production') {
|
13042 | module.exports = __webpack_require__(184);
|
13043 | } else {
|
13044 | module.exports = __webpack_require__(185);
|
13045 | }
|
13046 |
|
13047 | }.call(exports, __webpack_require__(33)))
|
13048 |
|
13049 | }),
|
13050 |
|
13051 | (function(module, exports) {
|
13052 |
|
13053 | |
13054 |
|
13055 |
|
13056 |
|
13057 |
|
13058 |
|
13059 |
|
13060 |
|
13061 |
|
13062 | 'use strict';Object.defineProperty(exports,"__esModule",{value:!0});
|
13063 | var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.memo"):
|
13064 | 60115,r=b?Symbol.for("react.lazy"):60116;function t(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return u}}case r:case q:case d:return u}}}function v(a){return t(a)===m}exports.typeOf=t;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;
|
13065 | exports.Fragment=e;exports.Lazy=r;exports.Memo=q;exports.Portal=d;exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||"object"===typeof a&&null!==a&&(a.$$typeof===r||a.$$typeof===q||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n)};exports.isAsyncMode=function(a){return v(a)||t(a)===l};exports.isConcurrentMode=v;exports.isContextConsumer=function(a){return t(a)===k};
|
13066 | exports.isContextProvider=function(a){return t(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return t(a)===n};exports.isFragment=function(a){return t(a)===e};exports.isLazy=function(a){return t(a)===r};exports.isMemo=function(a){return t(a)===q};exports.isPortal=function(a){return t(a)===d};exports.isProfiler=function(a){return t(a)===g};exports.isStrictMode=function(a){return t(a)===f};
|
13067 | exports.isSuspense=function(a){return t(a)===p};
|
13068 |
|
13069 |
|
13070 | }),
|
13071 |
|
13072 | (function(module, exports, __webpack_require__) {
|
13073 |
|
13074 | (function(process) { |
13075 |
|
13076 |
|
13077 |
|
13078 |
|
13079 |
|
13080 |
|
13081 |
|
13082 |
|
13083 | 'use strict';
|
13084 |
|
13085 |
|
13086 |
|
13087 | if (process.env.NODE_ENV !== "production") {
|
13088 | (function() {
|
13089 | 'use strict';
|
13090 |
|
13091 | Object.defineProperty(exports, '__esModule', { value: true });
|
13092 |
|
13093 |
|
13094 |
|
13095 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
13096 |
|
13097 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
13098 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
13099 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
13100 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
13101 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
13102 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
13103 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
13104 | var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
13105 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
13106 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
13107 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
13108 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
13109 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
13110 |
|
13111 | function isValidElementType(type) {
|
13112 | return typeof type === 'string' || typeof type === 'function' ||
|
13113 |
|
13114 | 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);
|
13115 | }
|
13116 |
|
13117 | |
13118 |
|
13119 |
|
13120 |
|
13121 |
|
13122 |
|
13123 |
|
13124 |
|
13125 |
|
13126 |
|
13127 |
|
13128 |
|
13129 |
|
13130 |
|
13131 | var lowPriorityWarning = function () {};
|
13132 |
|
13133 | {
|
13134 | var printWarning = function (format) {
|
13135 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
13136 | args[_key - 1] = arguments[_key];
|
13137 | }
|
13138 |
|
13139 | var argIndex = 0;
|
13140 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
13141 | return args[argIndex++];
|
13142 | });
|
13143 | if (typeof console !== 'undefined') {
|
13144 | console.warn(message);
|
13145 | }
|
13146 | try {
|
13147 |
|
13148 |
|
13149 |
|
13150 | throw new Error(message);
|
13151 | } catch (x) {}
|
13152 | };
|
13153 |
|
13154 | lowPriorityWarning = function (condition, format) {
|
13155 | if (format === undefined) {
|
13156 | throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
13157 | }
|
13158 | if (!condition) {
|
13159 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
13160 | args[_key2 - 2] = arguments[_key2];
|
13161 | }
|
13162 |
|
13163 | printWarning.apply(undefined, [format].concat(args));
|
13164 | }
|
13165 | };
|
13166 | }
|
13167 |
|
13168 | var lowPriorityWarning$1 = lowPriorityWarning;
|
13169 |
|
13170 | function typeOf(object) {
|
13171 | if (typeof object === 'object' && object !== null) {
|
13172 | var $$typeof = object.$$typeof;
|
13173 | switch ($$typeof) {
|
13174 | case REACT_ELEMENT_TYPE:
|
13175 | var type = object.type;
|
13176 |
|
13177 | switch (type) {
|
13178 | case REACT_ASYNC_MODE_TYPE:
|
13179 | case REACT_CONCURRENT_MODE_TYPE:
|
13180 | case REACT_FRAGMENT_TYPE:
|
13181 | case REACT_PROFILER_TYPE:
|
13182 | case REACT_STRICT_MODE_TYPE:
|
13183 | case REACT_SUSPENSE_TYPE:
|
13184 | return type;
|
13185 | default:
|
13186 | var $$typeofType = type && type.$$typeof;
|
13187 |
|
13188 | switch ($$typeofType) {
|
13189 | case REACT_CONTEXT_TYPE:
|
13190 | case REACT_FORWARD_REF_TYPE:
|
13191 | case REACT_PROVIDER_TYPE:
|
13192 | return $$typeofType;
|
13193 | default:
|
13194 | return $$typeof;
|
13195 | }
|
13196 | }
|
13197 | case REACT_LAZY_TYPE:
|
13198 | case REACT_MEMO_TYPE:
|
13199 | case REACT_PORTAL_TYPE:
|
13200 | return $$typeof;
|
13201 | }
|
13202 | }
|
13203 |
|
13204 | return undefined;
|
13205 | }
|
13206 |
|
13207 |
|
13208 | var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
13209 | var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
13210 | var ContextConsumer = REACT_CONTEXT_TYPE;
|
13211 | var ContextProvider = REACT_PROVIDER_TYPE;
|
13212 | var Element = REACT_ELEMENT_TYPE;
|
13213 | var ForwardRef = REACT_FORWARD_REF_TYPE;
|
13214 | var Fragment = REACT_FRAGMENT_TYPE;
|
13215 | var Lazy = REACT_LAZY_TYPE;
|
13216 | var Memo = REACT_MEMO_TYPE;
|
13217 | var Portal = REACT_PORTAL_TYPE;
|
13218 | var Profiler = REACT_PROFILER_TYPE;
|
13219 | var StrictMode = REACT_STRICT_MODE_TYPE;
|
13220 | var Suspense = REACT_SUSPENSE_TYPE;
|
13221 |
|
13222 | var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
13223 |
|
13224 |
|
13225 | function isAsyncMode(object) {
|
13226 | {
|
13227 | if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
13228 | hasWarnedAboutDeprecatedIsAsyncMode = true;
|
13229 | 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.');
|
13230 | }
|
13231 | }
|
13232 | return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
13233 | }
|
13234 | function isConcurrentMode(object) {
|
13235 | return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
13236 | }
|
13237 | function isContextConsumer(object) {
|
13238 | return typeOf(object) === REACT_CONTEXT_TYPE;
|
13239 | }
|
13240 | function isContextProvider(object) {
|
13241 | return typeOf(object) === REACT_PROVIDER_TYPE;
|
13242 | }
|
13243 | function isElement(object) {
|
13244 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
13245 | }
|
13246 | function isForwardRef(object) {
|
13247 | return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
13248 | }
|
13249 | function isFragment(object) {
|
13250 | return typeOf(object) === REACT_FRAGMENT_TYPE;
|
13251 | }
|
13252 | function isLazy(object) {
|
13253 | return typeOf(object) === REACT_LAZY_TYPE;
|
13254 | }
|
13255 | function isMemo(object) {
|
13256 | return typeOf(object) === REACT_MEMO_TYPE;
|
13257 | }
|
13258 | function isPortal(object) {
|
13259 | return typeOf(object) === REACT_PORTAL_TYPE;
|
13260 | }
|
13261 | function isProfiler(object) {
|
13262 | return typeOf(object) === REACT_PROFILER_TYPE;
|
13263 | }
|
13264 | function isStrictMode(object) {
|
13265 | return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
13266 | }
|
13267 | function isSuspense(object) {
|
13268 | return typeOf(object) === REACT_SUSPENSE_TYPE;
|
13269 | }
|
13270 |
|
13271 | exports.typeOf = typeOf;
|
13272 | exports.AsyncMode = AsyncMode;
|
13273 | exports.ConcurrentMode = ConcurrentMode;
|
13274 | exports.ContextConsumer = ContextConsumer;
|
13275 | exports.ContextProvider = ContextProvider;
|
13276 | exports.Element = Element;
|
13277 | exports.ForwardRef = ForwardRef;
|
13278 | exports.Fragment = Fragment;
|
13279 | exports.Lazy = Lazy;
|
13280 | exports.Memo = Memo;
|
13281 | exports.Portal = Portal;
|
13282 | exports.Profiler = Profiler;
|
13283 | exports.StrictMode = StrictMode;
|
13284 | exports.Suspense = Suspense;
|
13285 | exports.isValidElementType = isValidElementType;
|
13286 | exports.isAsyncMode = isAsyncMode;
|
13287 | exports.isConcurrentMode = isConcurrentMode;
|
13288 | exports.isContextConsumer = isContextConsumer;
|
13289 | exports.isContextProvider = isContextProvider;
|
13290 | exports.isElement = isElement;
|
13291 | exports.isForwardRef = isForwardRef;
|
13292 | exports.isFragment = isFragment;
|
13293 | exports.isLazy = isLazy;
|
13294 | exports.isMemo = isMemo;
|
13295 | exports.isPortal = isPortal;
|
13296 | exports.isProfiler = isProfiler;
|
13297 | exports.isStrictMode = isStrictMode;
|
13298 | exports.isSuspense = isSuspense;
|
13299 | })();
|
13300 | }
|
13301 |
|
13302 | }.call(exports, __webpack_require__(33)))
|
13303 |
|
13304 | }),
|
13305 |
|
13306 | (function(module, exports) {
|
13307 |
|
13308 | "use strict";
|
13309 |
|
13310 | Object.defineProperty(exports, "__esModule", {
|
13311 | value: true
|
13312 | });
|
13313 |
|
13314 | 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; };
|
13315 |
|
13316 | exports.default = create;
|
13317 | function create(initialState) {
|
13318 | var state = initialState;
|
13319 | var listeners = [];
|
13320 |
|
13321 | function setState(partial) {
|
13322 | state = _extends({}, state, partial);
|
13323 | for (var i = 0; i < listeners.length; i++) {
|
13324 | listeners[i]();
|
13325 | }
|
13326 | }
|
13327 |
|
13328 | function getState() {
|
13329 | return state;
|
13330 | }
|
13331 |
|
13332 | function subscribe(listener) {
|
13333 | listeners.push(listener);
|
13334 |
|
13335 | return function unsubscribe() {
|
13336 | var index = listeners.indexOf(listener);
|
13337 | listeners.splice(index, 1);
|
13338 | };
|
13339 | }
|
13340 |
|
13341 | return {
|
13342 | setState: setState,
|
13343 | getState: getState,
|
13344 | subscribe: subscribe
|
13345 | };
|
13346 | }
|
13347 |
|
13348 | }),
|
13349 |
|
13350 | (function(module, exports, __webpack_require__) {
|
13351 |
|
13352 | 'use strict';
|
13353 |
|
13354 | exports.__esModule = true;
|
13355 | exports.SubPopupMenu = undefined;
|
13356 |
|
13357 | var _objectWithoutProperties2 = __webpack_require__(133);
|
13358 |
|
13359 | var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
13360 |
|
13361 | var _classCallCheck2 = __webpack_require__(134);
|
13362 |
|
13363 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
13364 |
|
13365 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
13366 |
|
13367 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
13368 |
|
13369 | var _inherits2 = __webpack_require__(169);
|
13370 |
|
13371 | var _inherits3 = _interopRequireDefault(_inherits2);
|
13372 |
|
13373 | var _extends4 = __webpack_require__(94);
|
13374 |
|
13375 | var _extends5 = _interopRequireDefault(_extends4);
|
13376 |
|
13377 | exports.getActiveKey = getActiveKey;
|
13378 | exports.saveRef = saveRef;
|
13379 |
|
13380 | var _react = __webpack_require__(4);
|
13381 |
|
13382 | var _react2 = _interopRequireDefault(_react);
|
13383 |
|
13384 | var _propTypes = __webpack_require__(5);
|
13385 |
|
13386 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
13387 |
|
13388 | var _miniStore = __webpack_require__(177);
|
13389 |
|
13390 | var _KeyCode = __webpack_require__(188);
|
13391 |
|
13392 | var _KeyCode2 = _interopRequireDefault(_KeyCode);
|
13393 |
|
13394 | var _createChainedFunction = __webpack_require__(189);
|
13395 |
|
13396 | var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
|
13397 |
|
13398 | var _classnames = __webpack_require__(3);
|
13399 |
|
13400 | var _classnames2 = _interopRequireDefault(_classnames);
|
13401 |
|
13402 | var _util = __webpack_require__(190);
|
13403 |
|
13404 | var _DOMWrap = __webpack_require__(192);
|
13405 |
|
13406 | var _DOMWrap2 = _interopRequireDefault(_DOMWrap);
|
13407 |
|
13408 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
13409 |
|
13410 | function allDisabled(arr) {
|
13411 | if (!arr.length) {
|
13412 | return true;
|
13413 | }
|
13414 | return arr.every(function (c) {
|
13415 | return !!c.props.disabled;
|
13416 | });
|
13417 | }
|
13418 |
|
13419 | function updateActiveKey(store, menuId, activeKey) {
|
13420 | var _extends2;
|
13421 |
|
13422 | var state = store.getState();
|
13423 | store.setState({
|
13424 | activeKey: (0, _extends5['default'])({}, state.activeKey, (_extends2 = {}, _extends2[menuId] = activeKey, _extends2))
|
13425 | });
|
13426 | }
|
13427 |
|
13428 | function getEventKey(props) {
|
13429 |
|
13430 | return props.eventKey || '0-menu-';
|
13431 | }
|
13432 |
|
13433 | function getActiveKey(props, originalActiveKey) {
|
13434 | var activeKey = originalActiveKey;
|
13435 | var children = props.children,
|
13436 | eventKey = props.eventKey;
|
13437 |
|
13438 | if (activeKey) {
|
13439 | var found = void 0;
|
13440 | (0, _util.loopMenuItem)(children, function (c, i) {
|
13441 | if (c && !c.props.disabled && activeKey === (0, _util.getKeyFromChildrenIndex)(c, eventKey, i)) {
|
13442 | found = true;
|
13443 | }
|
13444 | });
|
13445 | if (found) {
|
13446 | return activeKey;
|
13447 | }
|
13448 | }
|
13449 | activeKey = null;
|
13450 | if (props.defaultActiveFirst) {
|
13451 | (0, _util.loopMenuItem)(children, function (c, i) {
|
13452 | if (!activeKey && c && !c.props.disabled) {
|
13453 | activeKey = (0, _util.getKeyFromChildrenIndex)(c, eventKey, i);
|
13454 | }
|
13455 | });
|
13456 | return activeKey;
|
13457 | }
|
13458 | return activeKey;
|
13459 | }
|
13460 |
|
13461 | function saveRef(c) {
|
13462 | if (c) {
|
13463 | var index = this.instanceArray.indexOf(c);
|
13464 | if (index !== -1) {
|
13465 |
|
13466 | this.instanceArray[index] = c;
|
13467 | } else {
|
13468 |
|
13469 | this.instanceArray.push(c);
|
13470 | }
|
13471 | }
|
13472 | }
|
13473 |
|
13474 | var SubPopupMenu = exports.SubPopupMenu = function (_React$Component) {
|
13475 | (0, _inherits3['default'])(SubPopupMenu, _React$Component);
|
13476 |
|
13477 | function SubPopupMenu(props) {
|
13478 | var _extends3;
|
13479 |
|
13480 | (0, _classCallCheck3['default'])(this, SubPopupMenu);
|
13481 |
|
13482 | var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
|
13483 |
|
13484 | _initialiseProps.call(_this);
|
13485 |
|
13486 | props.store.setState({
|
13487 | activeKey: (0, _extends5['default'])({}, props.store.getState().activeKey, (_extends3 = {}, _extends3[props.eventKey] = getActiveKey(props, props.activeKey), _extends3))
|
13488 | });
|
13489 |
|
13490 | _this.instanceArray = [];
|
13491 | return _this;
|
13492 | }
|
13493 |
|
13494 | SubPopupMenu.prototype.componentDidMount = function componentDidMount() {
|
13495 |
|
13496 | if (this.props.manualRef) {
|
13497 | this.props.manualRef(this);
|
13498 | }
|
13499 | };
|
13500 |
|
13501 | SubPopupMenu.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
13502 | return this.props.visible || nextProps.visible;
|
13503 | };
|
13504 |
|
13505 | SubPopupMenu.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
13506 | var props = this.props;
|
13507 | var originalActiveKey = 'activeKey' in props ? props.activeKey : props.store.getState().activeKey[getEventKey(props)];
|
13508 | var activeKey = getActiveKey(props, originalActiveKey);
|
13509 | if (activeKey !== originalActiveKey) {
|
13510 | updateActiveKey(props.store, getEventKey(props), activeKey);
|
13511 | } else if ('activeKey' in prevProps) {
|
13512 |
|
13513 |
|
13514 | var prevActiveKey = getActiveKey(prevProps, prevProps.activeKey);
|
13515 | if (activeKey !== prevActiveKey) {
|
13516 | updateActiveKey(props.store, getEventKey(props), activeKey);
|
13517 | }
|
13518 | }
|
13519 | };
|
13520 |
|
13521 |
|
13522 |
|
13523 |
|
13524 | SubPopupMenu.prototype.render = function render() {
|
13525 | var _this2 = this;
|
13526 |
|
13527 | var props = (0, _objectWithoutProperties3['default'])(this.props, []);
|
13528 |
|
13529 | this.instanceArray = [];
|
13530 | var className = (0, _classnames2['default'])(props.prefixCls, props.className, props.prefixCls + '-' + props.mode);
|
13531 | var domProps = {
|
13532 | className: className,
|
13533 |
|
13534 | role: props.role || 'menu'
|
13535 | };
|
13536 | if (props.id) {
|
13537 | domProps.id = props.id;
|
13538 | }
|
13539 | if (props.focusable) {
|
13540 | domProps.tabIndex = '0';
|
13541 | domProps.onKeyDown = this.onKeyDown;
|
13542 | }
|
13543 | var prefixCls = props.prefixCls,
|
13544 | eventKey = props.eventKey,
|
13545 | visible = props.visible,
|
13546 | level = props.level,
|
13547 | mode = props.mode,
|
13548 | overflowedIndicator = props.overflowedIndicator,
|
13549 | theme = props.theme;
|
13550 |
|
13551 | _util.menuAllProps.forEach(function (key) {
|
13552 | return delete props[key];
|
13553 | });
|
13554 |
|
13555 |
|
13556 | delete props.onClick;
|
13557 |
|
13558 | return (
|
13559 |
|
13560 |
|
13561 | _react2['default'].createElement(
|
13562 | _DOMWrap2['default'],
|
13563 | (0, _extends5['default'])({}, props, {
|
13564 | prefixCls: prefixCls,
|
13565 | mode: mode,
|
13566 | tag: 'ul',
|
13567 | level: level,
|
13568 | theme: theme,
|
13569 | hiddenClassName: prefixCls + '-hidden',
|
13570 | visible: visible,
|
13571 | overflowedIndicator: overflowedIndicator
|
13572 | }, domProps),
|
13573 | _react2['default'].Children.map(props.children, function (c, i) {
|
13574 | return _this2.renderMenuItem(c, i, eventKey || '0-menu-');
|
13575 | })
|
13576 | )
|
13577 |
|
13578 |
|
13579 | );
|
13580 | };
|
13581 |
|
13582 | return SubPopupMenu;
|
13583 | }(_react2['default'].Component);
|
13584 |
|
13585 | SubPopupMenu.propTypes = {
|
13586 | onSelect: _propTypes2['default'].func,
|
13587 | onClick: _propTypes2['default'].func,
|
13588 | onDeselect: _propTypes2['default'].func,
|
13589 | onOpenChange: _propTypes2['default'].func,
|
13590 | onDestroy: _propTypes2['default'].func,
|
13591 | openTransitionName: _propTypes2['default'].string,
|
13592 | openAnimation: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].object]),
|
13593 | openKeys: _propTypes2['default'].arrayOf(_propTypes2['default'].string),
|
13594 | visible: _propTypes2['default'].bool,
|
13595 | children: _propTypes2['default'].any,
|
13596 | parentMenu: _propTypes2['default'].object,
|
13597 | eventKey: _propTypes2['default'].string,
|
13598 | store: _propTypes2['default'].shape({
|
13599 | getState: _propTypes2['default'].func,
|
13600 | setState: _propTypes2['default'].func
|
13601 | }),
|
13602 |
|
13603 |
|
13604 | focusable: _propTypes2['default'].bool,
|
13605 | multiple: _propTypes2['default'].bool,
|
13606 | style: _propTypes2['default'].object,
|
13607 | defaultActiveFirst: _propTypes2['default'].bool,
|
13608 | activeKey: _propTypes2['default'].string,
|
13609 | selectedKeys: _propTypes2['default'].arrayOf(_propTypes2['default'].string),
|
13610 | defaultSelectedKeys: _propTypes2['default'].arrayOf(_propTypes2['default'].string),
|
13611 | defaultOpenKeys: _propTypes2['default'].arrayOf(_propTypes2['default'].string),
|
13612 | level: _propTypes2['default'].number,
|
13613 | mode: _propTypes2['default'].oneOf(['horizontal', 'vertical', 'vertical-left', 'vertical-right', 'inline']),
|
13614 | triggerSubMenuAction: _propTypes2['default'].oneOf(['click', 'hover']),
|
13615 | inlineIndent: _propTypes2['default'].oneOfType([_propTypes2['default'].number, _propTypes2['default'].string]),
|
13616 | manualRef: _propTypes2['default'].func,
|
13617 | itemIcon: _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].node]),
|
13618 | expandIcon: _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].node])
|
13619 | };
|
13620 | SubPopupMenu.defaultProps = {
|
13621 | prefixCls: 'rc-menu',
|
13622 | className: '',
|
13623 | mode: 'vertical',
|
13624 | level: 1,
|
13625 | inlineIndent: 24,
|
13626 | visible: true,
|
13627 | focusable: true,
|
13628 | style: {},
|
13629 | manualRef: _util.noop
|
13630 | };
|
13631 |
|
13632 | var _initialiseProps = function _initialiseProps() {
|
13633 | var _this3 = this;
|
13634 |
|
13635 | this.onKeyDown = function (e, callback) {
|
13636 | var keyCode = e.keyCode;
|
13637 | var handled = void 0;
|
13638 | _this3.getFlatInstanceArray().forEach(function (obj) {
|
13639 | if (obj && obj.props.active && obj.onKeyDown) {
|
13640 | handled = obj.onKeyDown(e);
|
13641 | }
|
13642 | });
|
13643 | if (handled) {
|
13644 | return 1;
|
13645 | }
|
13646 | var activeItem = null;
|
13647 | if (keyCode === _KeyCode2['default'].UP || keyCode === _KeyCode2['default'].DOWN) {
|
13648 | activeItem = _this3.step(keyCode === _KeyCode2['default'].UP ? -1 : 1);
|
13649 | }
|
13650 | if (activeItem) {
|
13651 | e.preventDefault();
|
13652 | updateActiveKey(_this3.props.store, getEventKey(_this3.props), activeItem.props.eventKey);
|
13653 |
|
13654 | if (typeof callback === 'function') {
|
13655 | callback(activeItem);
|
13656 | }
|
13657 |
|
13658 | return 1;
|
13659 | }
|
13660 | };
|
13661 |
|
13662 | this.onItemHover = function (e) {
|
13663 | var key = e.key,
|
13664 | hover = e.hover;
|
13665 |
|
13666 | updateActiveKey(_this3.props.store, getEventKey(_this3.props), hover ? key : null);
|
13667 | };
|
13668 |
|
13669 | this.onDeselect = function (selectInfo) {
|
13670 | _this3.props.onDeselect(selectInfo);
|
13671 | };
|
13672 |
|
13673 | this.onSelect = function (selectInfo) {
|
13674 | _this3.props.onSelect(selectInfo);
|
13675 | };
|
13676 |
|
13677 | this.onClick = function (e) {
|
13678 | _this3.props.onClick(e);
|
13679 | };
|
13680 |
|
13681 | this.onOpenChange = function (e) {
|
13682 | _this3.props.onOpenChange(e);
|
13683 | };
|
13684 |
|
13685 | this.onDestroy = function (key) {
|
13686 |
|
13687 | _this3.props.onDestroy(key);
|
13688 | };
|
13689 |
|
13690 | this.getFlatInstanceArray = function () {
|
13691 | return _this3.instanceArray;
|
13692 | };
|
13693 |
|
13694 | this.getOpenTransitionName = function () {
|
13695 | return _this3.props.openTransitionName;
|
13696 | };
|
13697 |
|
13698 | this.step = function (direction) {
|
13699 | var children = _this3.getFlatInstanceArray();
|
13700 | var activeKey = _this3.props.store.getState().activeKey[getEventKey(_this3.props)];
|
13701 | var len = children.length;
|
13702 | if (!len) {
|
13703 | return null;
|
13704 | }
|
13705 | if (direction < 0) {
|
13706 | children = children.concat().reverse();
|
13707 | }
|
13708 |
|
13709 | var activeIndex = -1;
|
13710 | children.every(function (c, ci) {
|
13711 | if (c && c.props.eventKey === activeKey) {
|
13712 | activeIndex = ci;
|
13713 | return false;
|
13714 | }
|
13715 | return true;
|
13716 | });
|
13717 | if (!_this3.props.defaultActiveFirst && activeIndex !== -1 && allDisabled(children.slice(activeIndex, len - 1))) {
|
13718 | return undefined;
|
13719 | }
|
13720 | var start = (activeIndex + 1) % len;
|
13721 | var i = start;
|
13722 |
|
13723 | do {
|
13724 | var child = children[i];
|
13725 | if (!child || child.props.disabled) {
|
13726 | i = (i + 1) % len;
|
13727 | } else {
|
13728 | return child;
|
13729 | }
|
13730 | } while (i !== start);
|
13731 |
|
13732 | return null;
|
13733 | };
|
13734 |
|
13735 | this.renderCommonMenuItem = function (child, i, extraProps) {
|
13736 | var state = _this3.props.store.getState();
|
13737 | var props = _this3.props;
|
13738 | var key = (0, _util.getKeyFromChildrenIndex)(child, props.eventKey, i);
|
13739 | var childProps = child.props;
|
13740 | var isActive = key === state.activeKey;
|
13741 | var newChildProps = (0, _extends5['default'])({
|
13742 | mode: childProps.mode || props.mode,
|
13743 | level: props.level,
|
13744 | inlineIndent: props.inlineIndent,
|
13745 | renderMenuItem: _this3.renderMenuItem,
|
13746 | rootPrefixCls: props.prefixCls,
|
13747 | index: i,
|
13748 | parentMenu: props.parentMenu,
|
13749 |
|
13750 | manualRef: childProps.disabled ? undefined : (0, _createChainedFunction2['default'])(child.ref, saveRef.bind(_this3)),
|
13751 | eventKey: key,
|
13752 | active: !childProps.disabled && isActive,
|
13753 | multiple: props.multiple,
|
13754 | onClick: function onClick(e) {
|
13755 | (childProps.onClick || _util.noop)(e);
|
13756 | _this3.onClick(e);
|
13757 | },
|
13758 | onItemHover: _this3.onItemHover,
|
13759 | openTransitionName: _this3.getOpenTransitionName(),
|
13760 | openAnimation: props.openAnimation,
|
13761 | subMenuOpenDelay: props.subMenuOpenDelay,
|
13762 | subMenuCloseDelay: props.subMenuCloseDelay,
|
13763 | forceSubMenuRender: props.forceSubMenuRender,
|
13764 | onOpenChange: _this3.onOpenChange,
|
13765 | onDeselect: _this3.onDeselect,
|
13766 | onSelect: _this3.onSelect,
|
13767 | builtinPlacements: props.builtinPlacements,
|
13768 | itemIcon: childProps.itemIcon || _this3.props.itemIcon,
|
13769 | expandIcon: childProps.expandIcon || _this3.props.expandIcon
|
13770 | }, extraProps);
|
13771 |
|
13772 | if (props.mode === 'inline' || (0, _util.isMobileDevice)()) {
|
13773 | newChildProps.triggerSubMenuAction = 'click';
|
13774 | }
|
13775 | return _react2['default'].cloneElement(child, newChildProps);
|
13776 | };
|
13777 |
|
13778 | this.renderMenuItem = function (c, i, subMenuKey) {
|
13779 |
|
13780 | if (!c) {
|
13781 | return null;
|
13782 | }
|
13783 | var state = _this3.props.store.getState();
|
13784 | var extraProps = {
|
13785 | openKeys: state.openKeys,
|
13786 | selectedKeys: state.selectedKeys,
|
13787 | triggerSubMenuAction: _this3.props.triggerSubMenuAction,
|
13788 | subMenuKey: subMenuKey
|
13789 | };
|
13790 | return _this3.renderCommonMenuItem(c, i, extraProps);
|
13791 | };
|
13792 | };
|
13793 |
|
13794 | var connected = (0, _miniStore.connect)()(SubPopupMenu);
|
13795 |
|
13796 | exports['default'] = connected;
|
13797 |
|
13798 | }),
|
13799 |
|
13800 | (function(module, exports) {
|
13801 |
|
13802 | 'use strict';
|
13803 |
|
13804 | Object.defineProperty(exports, "__esModule", {
|
13805 | value: true
|
13806 | });
|
13807 | |
13808 |
|
13809 |
|
13810 |
|
13811 |
|
13812 |
|
13813 | var KeyCode = {
|
13814 | |
13815 |
|
13816 |
|
13817 | MAC_ENTER: 3,
|
13818 | |
13819 |
|
13820 |
|
13821 | BACKSPACE: 8,
|
13822 | |
13823 |
|
13824 |
|
13825 | TAB: 9,
|
13826 | |
13827 |
|
13828 |
|
13829 | NUM_CENTER: 12,
|
13830 | |
13831 |
|
13832 |
|
13833 | ENTER: 13,
|
13834 | |
13835 |
|
13836 |
|
13837 | SHIFT: 16,
|
13838 | |
13839 |
|
13840 |
|
13841 | CTRL: 17,
|
13842 | |
13843 |
|
13844 |
|
13845 | ALT: 18,
|
13846 | |
13847 |
|
13848 |
|
13849 | PAUSE: 19,
|
13850 | |
13851 |
|
13852 |
|
13853 | CAPS_LOCK: 20,
|
13854 | |
13855 |
|
13856 |
|
13857 | ESC: 27,
|
13858 | |
13859 |
|
13860 |
|
13861 | SPACE: 32,
|
13862 | |
13863 |
|
13864 |
|
13865 | PAGE_UP: 33,
|
13866 | |
13867 |
|
13868 |
|
13869 | PAGE_DOWN: 34,
|
13870 | |
13871 |
|
13872 |
|
13873 | END: 35,
|
13874 | |
13875 |
|
13876 |
|
13877 | HOME: 36,
|
13878 | |
13879 |
|
13880 |
|
13881 | LEFT: 37,
|
13882 | |
13883 |
|
13884 |
|
13885 | UP: 38,
|
13886 | |
13887 |
|
13888 |
|
13889 | RIGHT: 39,
|
13890 | |
13891 |
|
13892 |
|
13893 | DOWN: 40,
|
13894 | |
13895 |
|
13896 |
|
13897 | PRINT_SCREEN: 44,
|
13898 | |
13899 |
|
13900 |
|
13901 | INSERT: 45,
|
13902 | |
13903 |
|
13904 |
|
13905 | DELETE: 46,
|
13906 | |
13907 |
|
13908 |
|
13909 | ZERO: 48,
|
13910 | |
13911 |
|
13912 |
|
13913 | ONE: 49,
|
13914 | |
13915 |
|
13916 |
|
13917 | TWO: 50,
|
13918 | |
13919 |
|
13920 |
|
13921 | THREE: 51,
|
13922 | |
13923 |
|
13924 |
|
13925 | FOUR: 52,
|
13926 | |
13927 |
|
13928 |
|
13929 | FIVE: 53,
|
13930 | |
13931 |
|
13932 |
|
13933 | SIX: 54,
|
13934 | |
13935 |
|
13936 |
|
13937 | SEVEN: 55,
|
13938 | |
13939 |
|
13940 |
|
13941 | EIGHT: 56,
|
13942 | |
13943 |
|
13944 |
|
13945 | NINE: 57,
|
13946 | |
13947 |
|
13948 |
|
13949 | QUESTION_MARK: 63,
|
13950 | |
13951 |
|
13952 |
|
13953 | A: 65,
|
13954 | |
13955 |
|
13956 |
|
13957 | B: 66,
|
13958 | |
13959 |
|
13960 |
|
13961 | C: 67,
|
13962 | |
13963 |
|
13964 |
|
13965 | D: 68,
|
13966 | |
13967 |
|
13968 |
|
13969 | E: 69,
|
13970 | |
13971 |
|
13972 |
|
13973 | F: 70,
|
13974 | |
13975 |
|
13976 |
|
13977 | G: 71,
|
13978 | |
13979 |
|
13980 |
|
13981 | H: 72,
|
13982 | |
13983 |
|
13984 |
|
13985 | I: 73,
|
13986 | |
13987 |
|
13988 |
|
13989 | J: 74,
|
13990 | |
13991 |
|
13992 |
|
13993 | K: 75,
|
13994 | |
13995 |
|
13996 |
|
13997 | L: 76,
|
13998 | |
13999 |
|
14000 |
|
14001 | M: 77,
|
14002 | |
14003 |
|
14004 |
|
14005 | N: 78,
|
14006 | |
14007 |
|
14008 |
|
14009 | O: 79,
|
14010 | |
14011 |
|
14012 |
|
14013 | P: 80,
|
14014 | |
14015 |
|
14016 |
|
14017 | Q: 81,
|
14018 | |
14019 |
|
14020 |
|
14021 | R: 82,
|
14022 | |
14023 |
|
14024 |
|
14025 | S: 83,
|
14026 | |
14027 |
|
14028 |
|
14029 | T: 84,
|
14030 | |
14031 |
|
14032 |
|
14033 | U: 85,
|
14034 | |
14035 |
|
14036 |
|
14037 | V: 86,
|
14038 | |
14039 |
|
14040 |
|
14041 | W: 87,
|
14042 | |
14043 |
|
14044 |
|
14045 | X: 88,
|
14046 | |
14047 |
|
14048 |
|
14049 | Y: 89,
|
14050 | |
14051 |
|
14052 |
|
14053 | Z: 90,
|
14054 | |
14055 |
|
14056 |
|
14057 | META: 91,
|
14058 | |
14059 |
|
14060 |
|
14061 | WIN_KEY_RIGHT: 92,
|
14062 | |
14063 |
|
14064 |
|
14065 | CONTEXT_MENU: 93,
|
14066 | |
14067 |
|
14068 |
|
14069 | NUM_ZERO: 96,
|
14070 | |
14071 |
|
14072 |
|
14073 | NUM_ONE: 97,
|
14074 | |
14075 |
|
14076 |
|
14077 | NUM_TWO: 98,
|
14078 | |
14079 |
|
14080 |
|
14081 | NUM_THREE: 99,
|
14082 | |
14083 |
|
14084 |
|
14085 | NUM_FOUR: 100,
|
14086 | |
14087 |
|
14088 |
|
14089 | NUM_FIVE: 101,
|
14090 | |
14091 |
|
14092 |
|
14093 | NUM_SIX: 102,
|
14094 | |
14095 |
|
14096 |
|
14097 | NUM_SEVEN: 103,
|
14098 | |
14099 |
|
14100 |
|
14101 | NUM_EIGHT: 104,
|
14102 | |
14103 |
|
14104 |
|
14105 | NUM_NINE: 105,
|
14106 | |
14107 |
|
14108 |
|
14109 | NUM_MULTIPLY: 106,
|
14110 | |
14111 |
|
14112 |
|
14113 | NUM_PLUS: 107,
|
14114 | |
14115 |
|
14116 |
|
14117 | NUM_MINUS: 109,
|
14118 | |
14119 |
|
14120 |
|
14121 | NUM_PERIOD: 110,
|
14122 | |
14123 |
|
14124 |
|
14125 | NUM_DIVISION: 111,
|
14126 | |
14127 |
|
14128 |
|
14129 | F1: 112,
|
14130 | |
14131 |
|
14132 |
|
14133 | F2: 113,
|
14134 | |
14135 |
|
14136 |
|
14137 | F3: 114,
|
14138 | |
14139 |
|
14140 |
|
14141 | F4: 115,
|
14142 | |
14143 |
|
14144 |
|
14145 | F5: 116,
|
14146 | |
14147 |
|
14148 |
|
14149 | F6: 117,
|
14150 | |
14151 |
|
14152 |
|
14153 | F7: 118,
|
14154 | |
14155 |
|
14156 |
|
14157 | F8: 119,
|
14158 | |
14159 |
|
14160 |
|
14161 | F9: 120,
|
14162 | |
14163 |
|
14164 |
|
14165 | F10: 121,
|
14166 | |
14167 |
|
14168 |
|
14169 | F11: 122,
|
14170 | |
14171 |
|
14172 |
|
14173 | F12: 123,
|
14174 | |
14175 |
|
14176 |
|
14177 | NUMLOCK: 144,
|
14178 | |
14179 |
|
14180 |
|
14181 | SEMICOLON: 186,
|
14182 | |
14183 |
|
14184 |
|
14185 | DASH: 189,
|
14186 | |
14187 |
|
14188 |
|
14189 | EQUALS: 187,
|
14190 | |
14191 |
|
14192 |
|
14193 | COMMA: 188,
|
14194 | |
14195 |
|
14196 |
|
14197 | PERIOD: 190,
|
14198 | |
14199 |
|
14200 |
|
14201 | SLASH: 191,
|
14202 | |
14203 |
|
14204 |
|
14205 | APOSTROPHE: 192,
|
14206 | |
14207 |
|
14208 |
|
14209 | SINGLE_QUOTE: 222,
|
14210 | |
14211 |
|
14212 |
|
14213 | OPEN_SQUARE_BRACKET: 219,
|
14214 | |
14215 |
|
14216 |
|
14217 | BACKSLASH: 220,
|
14218 | |
14219 |
|
14220 |
|
14221 | CLOSE_SQUARE_BRACKET: 221,
|
14222 | |
14223 |
|
14224 |
|
14225 | WIN_KEY: 224,
|
14226 | |
14227 |
|
14228 |
|
14229 | MAC_FF_META: 224,
|
14230 | |
14231 |
|
14232 |
|
14233 | WIN_IME: 229
|
14234 | };
|
14235 |
|
14236 | |
14237 |
|
14238 |
|
14239 | KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) {
|
14240 | var keyCode = e.keyCode;
|
14241 | if (e.altKey && !e.ctrlKey || e.metaKey ||
|
14242 |
|
14243 | keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
|
14244 | return false;
|
14245 | }
|
14246 |
|
14247 |
|
14248 |
|
14249 | switch (keyCode) {
|
14250 | case KeyCode.ALT:
|
14251 | case KeyCode.CAPS_LOCK:
|
14252 | case KeyCode.CONTEXT_MENU:
|
14253 | case KeyCode.CTRL:
|
14254 | case KeyCode.DOWN:
|
14255 | case KeyCode.END:
|
14256 | case KeyCode.ESC:
|
14257 | case KeyCode.HOME:
|
14258 | case KeyCode.INSERT:
|
14259 | case KeyCode.LEFT:
|
14260 | case KeyCode.MAC_FF_META:
|
14261 | case KeyCode.META:
|
14262 | case KeyCode.NUMLOCK:
|
14263 | case KeyCode.NUM_CENTER:
|
14264 | case KeyCode.PAGE_DOWN:
|
14265 | case KeyCode.PAGE_UP:
|
14266 | case KeyCode.PAUSE:
|
14267 | case KeyCode.PRINT_SCREEN:
|
14268 | case KeyCode.RIGHT:
|
14269 | case KeyCode.SHIFT:
|
14270 | case KeyCode.UP:
|
14271 | case KeyCode.WIN_KEY:
|
14272 | case KeyCode.WIN_KEY_RIGHT:
|
14273 | return false;
|
14274 | default:
|
14275 | return true;
|
14276 | }
|
14277 | };
|
14278 |
|
14279 | |
14280 |
|
14281 |
|
14282 | KeyCode.isCharacterKey = function isCharacterKey(keyCode) {
|
14283 | if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
|
14284 | return true;
|
14285 | }
|
14286 |
|
14287 | if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
|
14288 | return true;
|
14289 | }
|
14290 |
|
14291 | if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
|
14292 | return true;
|
14293 | }
|
14294 |
|
14295 |
|
14296 | if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {
|
14297 | return true;
|
14298 | }
|
14299 |
|
14300 | switch (keyCode) {
|
14301 | case KeyCode.SPACE:
|
14302 | case KeyCode.QUESTION_MARK:
|
14303 | case KeyCode.NUM_PLUS:
|
14304 | case KeyCode.NUM_MINUS:
|
14305 | case KeyCode.NUM_PERIOD:
|
14306 | case KeyCode.NUM_DIVISION:
|
14307 | case KeyCode.SEMICOLON:
|
14308 | case KeyCode.DASH:
|
14309 | case KeyCode.EQUALS:
|
14310 | case KeyCode.COMMA:
|
14311 | case KeyCode.PERIOD:
|
14312 | case KeyCode.SLASH:
|
14313 | case KeyCode.APOSTROPHE:
|
14314 | case KeyCode.SINGLE_QUOTE:
|
14315 | case KeyCode.OPEN_SQUARE_BRACKET:
|
14316 | case KeyCode.BACKSLASH:
|
14317 | case KeyCode.CLOSE_SQUARE_BRACKET:
|
14318 | return true;
|
14319 | default:
|
14320 | return false;
|
14321 | }
|
14322 | };
|
14323 |
|
14324 | exports['default'] = KeyCode;
|
14325 | module.exports = exports['default'];
|
14326 |
|
14327 | }),
|
14328 |
|
14329 | (function(module, exports) {
|
14330 |
|
14331 | "use strict";
|
14332 |
|
14333 | Object.defineProperty(exports, "__esModule", {
|
14334 | value: true
|
14335 | });
|
14336 | exports["default"] = createChainedFunction;
|
14337 | |
14338 |
|
14339 |
|
14340 |
|
14341 |
|
14342 |
|
14343 |
|
14344 |
|
14345 | function createChainedFunction() {
|
14346 | var args = [].slice.call(arguments, 0);
|
14347 | if (args.length === 1) {
|
14348 | return args[0];
|
14349 | }
|
14350 |
|
14351 | return function chainedFunction() {
|
14352 | for (var i = 0; i < args.length; i++) {
|
14353 | if (args[i] && args[i].apply) {
|
14354 | args[i].apply(this, arguments);
|
14355 | }
|
14356 | }
|
14357 | };
|
14358 | }
|
14359 | module.exports = exports['default'];
|
14360 |
|
14361 | }),
|
14362 |
|
14363 | (function(module, exports, __webpack_require__) {
|
14364 |
|
14365 | 'use strict';
|
14366 |
|
14367 | exports.__esModule = true;
|
14368 | exports.isMobileDevice = exports.setStyle = exports.getWidth = exports.menuAllProps = undefined;
|
14369 | exports.noop = noop;
|
14370 | exports.getKeyFromChildrenIndex = getKeyFromChildrenIndex;
|
14371 | exports.getMenuIdFromSubMenuEventKey = getMenuIdFromSubMenuEventKey;
|
14372 | exports.loopMenuItem = loopMenuItem;
|
14373 | exports.loopMenuItemRecursively = loopMenuItemRecursively;
|
14374 |
|
14375 | var _react = __webpack_require__(4);
|
14376 |
|
14377 | var _react2 = _interopRequireDefault(_react);
|
14378 |
|
14379 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
14380 |
|
14381 | var isMobile = __webpack_require__(191);
|
14382 |
|
14383 | function noop() {}
|
14384 |
|
14385 | function getKeyFromChildrenIndex(child, menuEventKey, index) {
|
14386 | var prefix = menuEventKey || '';
|
14387 | return child.key || prefix + 'item_' + index;
|
14388 | }
|
14389 |
|
14390 | function getMenuIdFromSubMenuEventKey(eventKey) {
|
14391 | return eventKey + '-menu-';
|
14392 | }
|
14393 |
|
14394 | function loopMenuItem(children, cb) {
|
14395 | var index = -1;
|
14396 | _react2['default'].Children.forEach(children, function (c) {
|
14397 | index++;
|
14398 | if (c && c.type && c.type.isMenuItemGroup) {
|
14399 | _react2['default'].Children.forEach(c.props.children, function (c2) {
|
14400 | index++;
|
14401 | cb(c2, index);
|
14402 | });
|
14403 | } else {
|
14404 | cb(c, index);
|
14405 | }
|
14406 | });
|
14407 | }
|
14408 |
|
14409 | function loopMenuItemRecursively(children, keys, ret) {
|
14410 |
|
14411 | if (!children || ret.find) {
|
14412 | return;
|
14413 | }
|
14414 | _react2['default'].Children.forEach(children, function (c) {
|
14415 | if (c) {
|
14416 | var construct = c.type;
|
14417 | if (!construct || !(construct.isSubMenu || construct.isMenuItem || construct.isMenuItemGroup)) {
|
14418 | return;
|
14419 | }
|
14420 | if (keys.indexOf(c.key) !== -1) {
|
14421 | ret.find = true;
|
14422 | } else if (c.props.children) {
|
14423 | loopMenuItemRecursively(c.props.children, keys, ret);
|
14424 | }
|
14425 | }
|
14426 | });
|
14427 | }
|
14428 |
|
14429 | var menuAllProps = exports.menuAllProps = ['defaultSelectedKeys', 'selectedKeys', 'defaultOpenKeys', 'openKeys', 'mode', 'getPopupContainer', 'onSelect', 'onDeselect', 'onDestroy', 'openTransitionName', 'openAnimation', 'subMenuOpenDelay', 'subMenuCloseDelay', 'forceSubMenuRender', 'triggerSubMenuAction', 'level', 'selectable', 'multiple', 'onOpenChange', 'visible', 'focusable', 'defaultActiveFirst', 'prefixCls', 'inlineIndent', 'parentMenu', 'title', 'rootPrefixCls', 'eventKey', 'active', 'onItemHover', 'onTitleMouseEnter', 'onTitleMouseLeave', 'onTitleClick', 'popupAlign', 'popupOffset', 'isOpen', 'renderMenuItem', 'manualRef', 'subMenuKey', 'disabled', 'index', 'isSelected', 'store', 'activeKey', 'builtinPlacements', 'overflowedIndicator',
|
14430 |
|
14431 |
|
14432 | 'attribute', 'value', 'popupClassName', 'inlineCollapsed', 'menu', 'theme', 'itemIcon', 'expandIcon'];
|
14433 |
|
14434 |
|
14435 |
|
14436 |
|
14437 |
|
14438 |
|
14439 | var getWidth = exports.getWidth = function getWidth(elem) {
|
14440 | var width = elem && typeof elem.getBoundingClientRect === 'function' && elem.getBoundingClientRect().width;
|
14441 | if (width) {
|
14442 | width = +width.toFixed(6);
|
14443 | }
|
14444 | return width || 0;
|
14445 | };
|
14446 |
|
14447 | var setStyle = exports.setStyle = function setStyle(elem, styleProperty, value) {
|
14448 | if (elem && typeof elem.style === 'object') {
|
14449 | elem.style[styleProperty] = value;
|
14450 | }
|
14451 | };
|
14452 |
|
14453 | var isMobileDevice = exports.isMobileDevice = function isMobileDevice() {
|
14454 | return isMobile.any;
|
14455 | };
|
14456 |
|
14457 | }),
|
14458 |
|
14459 | (function(module, exports, __webpack_require__) {
|
14460 |
|
14461 | var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!function(e){var n=/iPhone/i,t=/iPod/i,r=/iPad/i,a=/\bAndroid(?:.+)Mobile\b/i,p=/Android/i,l=/\bAndroid(?:.+)SD4930UR\b/i,b=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,f=/Windows Phone/i,u=/\bWindows(?:.+)ARM\b/i,c=/BlackBerry/i,s=/BB10/i,v=/Opera Mini/i,h=/\b(CriOS|Chrome)(?:.+)Mobile/i,w=/\Mobile(?:.+)Firefox\b/i;function m(e,i){return e.test(i)}function i(e){var i=e||("undefined"!=typeof navigator?navigator.userAgent:""),o=i.split("[FBAN");void 0!==o[1]&&(i=o[0]),void 0!==(o=i.split("Twitter"))[1]&&(i=o[0]);var d={apple:{phone:m(n,i)&&!m(f,i),ipod:m(t,i),tablet:!m(n,i)&&m(r,i)&&!m(f,i),device:(m(n,i)||m(t,i)||m(r,i))&&!m(f,i)},amazon:{phone:m(l,i),tablet:!m(l,i)&&m(b,i),device:m(l,i)||m(b,i)},android:{phone:!m(f,i)&&m(l,i)||!m(f,i)&&m(a,i),tablet:!m(f,i)&&!m(l,i)&&!m(a,i)&&(m(b,i)||m(p,i)),device:!m(f,i)&&(m(l,i)||m(b,i)||m(a,i)||m(p,i))},windows:{phone:m(f,i),tablet:m(u,i),device:m(f,i)||m(u,i)},other:{blackberry:m(c,i),blackberry10:m(s,i),opera:m(v,i),firefox:m(w,i),chrome:m(h,i),device:m(c,i)||m(s,i)||m(v,i)||m(w,i)||m(h,i)}};return d.any=d.apple.device||d.android.device||d.windows.device||d.other.device,d.phone=d.apple.phone||d.android.phone||d.windows.phone,d.tablet=d.apple.tablet||d.android.tablet||d.windows.tablet,d}"undefined"!=typeof module&&module.exports&&"undefined"==typeof window?module.exports=i:"undefined"!=typeof module&&module.exports&&"undefined"!=typeof window?module.exports=i(): true?!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (e.isMobile=i()), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):e.isMobile=i()}(this);
|
14462 |
|
14463 | }),
|
14464 |
|
14465 | (function(module, exports, __webpack_require__) {
|
14466 |
|
14467 | 'use strict';
|
14468 |
|
14469 | exports.__esModule = true;
|
14470 |
|
14471 | var _extends2 = __webpack_require__(94);
|
14472 |
|
14473 | var _extends3 = _interopRequireDefault(_extends2);
|
14474 |
|
14475 | var _objectWithoutProperties2 = __webpack_require__(133);
|
14476 |
|
14477 | var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
14478 |
|
14479 | var _classCallCheck2 = __webpack_require__(134);
|
14480 |
|
14481 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
14482 |
|
14483 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
14484 |
|
14485 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
14486 |
|
14487 | var _inherits2 = __webpack_require__(169);
|
14488 |
|
14489 | var _inherits3 = _interopRequireDefault(_inherits2);
|
14490 |
|
14491 | var _react = __webpack_require__(4);
|
14492 |
|
14493 | var _react2 = _interopRequireDefault(_react);
|
14494 |
|
14495 | var _reactDom = __webpack_require__(12);
|
14496 |
|
14497 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
14498 |
|
14499 | var _propTypes = __webpack_require__(5);
|
14500 |
|
14501 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
14502 |
|
14503 | var _resizeObserverPolyfill = __webpack_require__(193);
|
14504 |
|
14505 | var _resizeObserverPolyfill2 = _interopRequireDefault(_resizeObserverPolyfill);
|
14506 |
|
14507 | var _SubMenu = __webpack_require__(194);
|
14508 |
|
14509 | var _SubMenu2 = _interopRequireDefault(_SubMenu);
|
14510 |
|
14511 | var _util = __webpack_require__(190);
|
14512 |
|
14513 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
14514 |
|
14515 | var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
14516 |
|
14517 | var MENUITEM_OVERFLOWED_CLASSNAME = 'menuitem-overflowed';
|
14518 | var FLOAT_PRECISION_ADJUST = 0.5;
|
14519 |
|
14520 |
|
14521 | if (canUseDOM) {
|
14522 | __webpack_require__(219);
|
14523 | }
|
14524 |
|
14525 | var DOMWrap = function (_React$Component) {
|
14526 | (0, _inherits3['default'])(DOMWrap, _React$Component);
|
14527 |
|
14528 | function DOMWrap() {
|
14529 | var _temp, _this, _ret;
|
14530 |
|
14531 | (0, _classCallCheck3['default'])(this, DOMWrap);
|
14532 |
|
14533 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
14534 | args[_key] = arguments[_key];
|
14535 | }
|
14536 |
|
14537 | return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
|
14538 | lastVisibleIndex: undefined
|
14539 | }, _this.getMenuItemNodes = function () {
|
14540 | var prefixCls = _this.props.prefixCls;
|
14541 |
|
14542 | var ul = _reactDom2['default'].findDOMNode(_this);
|
14543 | if (!ul) {
|
14544 | return [];
|
14545 | }
|
14546 |
|
14547 |
|
14548 | return [].slice.call(ul.children).filter(function (node) {
|
14549 | return node.className.split(' ').indexOf(prefixCls + '-overflowed-submenu') < 0;
|
14550 | });
|
14551 | }, _this.getOverflowedSubMenuItem = function (keyPrefix, overflowedItems, renderPlaceholder) {
|
14552 | var _this$props = _this.props,
|
14553 | overflowedIndicator = _this$props.overflowedIndicator,
|
14554 | level = _this$props.level,
|
14555 | mode = _this$props.mode,
|
14556 | prefixCls = _this$props.prefixCls,
|
14557 | theme = _this$props.theme,
|
14558 | propStyle = _this$props.style;
|
14559 |
|
14560 | if (level !== 1 || mode !== 'horizontal') {
|
14561 | return null;
|
14562 | }
|
14563 |
|
14564 |
|
14565 | var copy = _this.props.children[0];
|
14566 | var _copy$props = copy.props,
|
14567 | throwAway = _copy$props.children,
|
14568 | title = _copy$props.title,
|
14569 | eventKey = _copy$props.eventKey,
|
14570 | rest = (0, _objectWithoutProperties3['default'])(_copy$props, ['children', 'title', 'eventKey']);
|
14571 |
|
14572 |
|
14573 | var style = (0, _extends3['default'])({}, propStyle);
|
14574 | var key = keyPrefix + '-overflowed-indicator';
|
14575 |
|
14576 | if (overflowedItems.length === 0 && renderPlaceholder !== true) {
|
14577 | style = (0, _extends3['default'])({}, style, {
|
14578 | display: 'none'
|
14579 | });
|
14580 | } else if (renderPlaceholder) {
|
14581 | style = (0, _extends3['default'])({}, style, {
|
14582 | visibility: 'hidden',
|
14583 |
|
14584 | position: 'absolute'
|
14585 | });
|
14586 | key = key + '-placeholder';
|
14587 | }
|
14588 |
|
14589 | var popupClassName = theme ? prefixCls + '-' + theme : '';
|
14590 | var props = {};
|
14591 | _util.menuAllProps.forEach(function (k) {
|
14592 | if (rest[k] !== undefined) {
|
14593 | props[k] = rest[k];
|
14594 | }
|
14595 | });
|
14596 |
|
14597 | return _react2['default'].createElement(
|
14598 | _SubMenu2['default'],
|
14599 | (0, _extends3['default'])({
|
14600 | title: overflowedIndicator,
|
14601 | className: prefixCls + '-overflowed-submenu',
|
14602 | popupClassName: popupClassName
|
14603 | }, props, {
|
14604 | key: key,
|
14605 | eventKey: keyPrefix + '-overflowed-indicator',
|
14606 | disabled: false,
|
14607 | style: style
|
14608 | }),
|
14609 | overflowedItems
|
14610 | );
|
14611 | }, _this.setChildrenWidthAndResize = function () {
|
14612 | if (_this.props.mode !== 'horizontal') {
|
14613 | return;
|
14614 | }
|
14615 | var ul = _reactDom2['default'].findDOMNode(_this);
|
14616 |
|
14617 | if (!ul) {
|
14618 | return;
|
14619 | }
|
14620 |
|
14621 | var ulChildrenNodes = ul.children;
|
14622 |
|
14623 | if (!ulChildrenNodes || ulChildrenNodes.length === 0) {
|
14624 | return;
|
14625 | }
|
14626 |
|
14627 | var lastOverflowedIndicatorPlaceholder = ul.children[ulChildrenNodes.length - 1];
|
14628 |
|
14629 |
|
14630 | (0, _util.setStyle)(lastOverflowedIndicatorPlaceholder, 'display', 'inline-block');
|
14631 |
|
14632 | var menuItemNodes = _this.getMenuItemNodes();
|
14633 |
|
14634 |
|
14635 |
|
14636 |
|
14637 | var overflowedItems = menuItemNodes.filter(function (c) {
|
14638 | return c.className.split(' ').indexOf(MENUITEM_OVERFLOWED_CLASSNAME) >= 0;
|
14639 | });
|
14640 |
|
14641 | overflowedItems.forEach(function (c) {
|
14642 | (0, _util.setStyle)(c, 'display', 'inline-block');
|
14643 | });
|
14644 |
|
14645 | _this.menuItemSizes = menuItemNodes.map(function (c) {
|
14646 | return (0, _util.getWidth)(c);
|
14647 | });
|
14648 |
|
14649 | overflowedItems.forEach(function (c) {
|
14650 | (0, _util.setStyle)(c, 'display', 'none');
|
14651 | });
|
14652 | _this.overflowedIndicatorWidth = (0, _util.getWidth)(ul.children[ul.children.length - 1]);
|
14653 | _this.originalTotalWidth = _this.menuItemSizes.reduce(function (acc, cur) {
|
14654 | return acc + cur;
|
14655 | }, 0);
|
14656 | _this.handleResize();
|
14657 |
|
14658 | (0, _util.setStyle)(lastOverflowedIndicatorPlaceholder, 'display', 'none');
|
14659 | }, _this.resizeObserver = null, _this.mutationObserver = null, _this.originalTotalWidth = 0, _this.overflowedItems = [], _this.menuItemSizes = [], _this.handleResize = function () {
|
14660 | if (_this.props.mode !== 'horizontal') {
|
14661 | return;
|
14662 | }
|
14663 |
|
14664 | var ul = _reactDom2['default'].findDOMNode(_this);
|
14665 | if (!ul) {
|
14666 | return;
|
14667 | }
|
14668 | var width = (0, _util.getWidth)(ul);
|
14669 |
|
14670 | _this.overflowedItems = [];
|
14671 | var currentSumWidth = 0;
|
14672 |
|
14673 |
|
14674 | var lastVisibleIndex = undefined;
|
14675 |
|
14676 |
|
14677 |
|
14678 |
|
14679 | if (_this.originalTotalWidth > width + FLOAT_PRECISION_ADJUST) {
|
14680 | lastVisibleIndex = -1;
|
14681 |
|
14682 | _this.menuItemSizes.forEach(function (liWidth) {
|
14683 | currentSumWidth += liWidth;
|
14684 | if (currentSumWidth + _this.overflowedIndicatorWidth <= width) {
|
14685 | lastVisibleIndex++;
|
14686 | }
|
14687 | });
|
14688 | }
|
14689 |
|
14690 | _this.setState({ lastVisibleIndex: lastVisibleIndex });
|
14691 | }, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret);
|
14692 | }
|
14693 |
|
14694 | DOMWrap.prototype.componentDidMount = function componentDidMount() {
|
14695 | var _this2 = this;
|
14696 |
|
14697 | this.setChildrenWidthAndResize();
|
14698 | if (this.props.level === 1 && this.props.mode === 'horizontal') {
|
14699 | var menuUl = _reactDom2['default'].findDOMNode(this);
|
14700 | if (!menuUl) {
|
14701 | return;
|
14702 | }
|
14703 | this.resizeObserver = new _resizeObserverPolyfill2['default'](function (entries) {
|
14704 | entries.forEach(_this2.setChildrenWidthAndResize);
|
14705 | });
|
14706 |
|
14707 | [].slice.call(menuUl.children).concat(menuUl).forEach(function (el) {
|
14708 | _this2.resizeObserver.observe(el);
|
14709 | });
|
14710 |
|
14711 | if (typeof MutationObserver !== 'undefined') {
|
14712 | this.mutationObserver = new MutationObserver(function () {
|
14713 | _this2.resizeObserver.disconnect();
|
14714 | [].slice.call(menuUl.children).concat(menuUl).forEach(function (el) {
|
14715 | _this2.resizeObserver.observe(el);
|
14716 | });
|
14717 | _this2.setChildrenWidthAndResize();
|
14718 | });
|
14719 | this.mutationObserver.observe(menuUl, { attributes: false, childList: true, subTree: false });
|
14720 | }
|
14721 | }
|
14722 | };
|
14723 |
|
14724 | DOMWrap.prototype.componentWillUnmount = function componentWillUnmount() {
|
14725 | if (this.resizeObserver) {
|
14726 | this.resizeObserver.disconnect();
|
14727 | }
|
14728 | if (this.mutationObserver) {
|
14729 | this.resizeObserver.disconnect();
|
14730 | }
|
14731 | };
|
14732 |
|
14733 |
|
14734 |
|
14735 |
|
14736 |
|
14737 |
|
14738 |
|
14739 |
|
14740 |
|
14741 |
|
14742 |
|
14743 |
|
14744 |
|
14745 |
|
14746 |
|
14747 |
|
14748 | DOMWrap.prototype.renderChildren = function renderChildren(children) {
|
14749 | var _this3 = this;
|
14750 |
|
14751 |
|
14752 | var lastVisibleIndex = this.state.lastVisibleIndex;
|
14753 |
|
14754 | return (children || []).reduce(function (acc, childNode, index) {
|
14755 | var item = childNode;
|
14756 | if (_this3.props.mode === 'horizontal') {
|
14757 | var overflowed = _this3.getOverflowedSubMenuItem(childNode.props.eventKey, []);
|
14758 | if (lastVisibleIndex !== undefined && _this3.props.className.indexOf(_this3.props.prefixCls + '-root') !== -1) {
|
14759 | if (index > lastVisibleIndex) {
|
14760 | item = _react2['default'].cloneElement(childNode,
|
14761 |
|
14762 | {
|
14763 | style: { display: 'none' },
|
14764 | eventKey: childNode.props.eventKey + '-hidden',
|
14765 | className: childNode.className + ' ' + MENUITEM_OVERFLOWED_CLASSNAME
|
14766 | });
|
14767 | }
|
14768 | if (index === lastVisibleIndex + 1) {
|
14769 | _this3.overflowedItems = children.slice(lastVisibleIndex + 1).map(function (c) {
|
14770 | return _react2['default'].cloneElement(c,
|
14771 |
|
14772 |
|
14773 | { key: c.props.eventKey, mode: 'vertical-left' });
|
14774 | });
|
14775 |
|
14776 | overflowed = _this3.getOverflowedSubMenuItem(childNode.props.eventKey, _this3.overflowedItems);
|
14777 | }
|
14778 | }
|
14779 |
|
14780 | var ret = [].concat(acc, [overflowed, item]);
|
14781 |
|
14782 | if (index === children.length - 1) {
|
14783 |
|
14784 | ret.push(_this3.getOverflowedSubMenuItem(childNode.props.eventKey, [], true));
|
14785 | }
|
14786 | return ret;
|
14787 | }
|
14788 | return [].concat(acc, [item]);
|
14789 | }, []);
|
14790 | };
|
14791 |
|
14792 | DOMWrap.prototype.render = function render() {
|
14793 | var _props = this.props,
|
14794 | hiddenClassName = _props.hiddenClassName,
|
14795 | visible = _props.visible,
|
14796 | prefixCls = _props.prefixCls,
|
14797 | overflowedIndicator = _props.overflowedIndicator,
|
14798 | mode = _props.mode,
|
14799 | level = _props.level,
|
14800 | Tag = _props.tag,
|
14801 | children = _props.children,
|
14802 | theme = _props.theme,
|
14803 | rest = (0, _objectWithoutProperties3['default'])(_props, ['hiddenClassName', 'visible', 'prefixCls', 'overflowedIndicator', 'mode', 'level', 'tag', 'children', 'theme']);
|
14804 |
|
14805 |
|
14806 | if (!visible) {
|
14807 | rest.className += ' ' + hiddenClassName;
|
14808 | }
|
14809 |
|
14810 | return _react2['default'].createElement(
|
14811 | Tag,
|
14812 | rest,
|
14813 | this.renderChildren(this.props.children)
|
14814 | );
|
14815 | };
|
14816 |
|
14817 | return DOMWrap;
|
14818 | }(_react2['default'].Component);
|
14819 |
|
14820 | DOMWrap.propTypes = {
|
14821 | className: _propTypes2['default'].string,
|
14822 | children: _propTypes2['default'].node,
|
14823 | mode: _propTypes2['default'].oneOf(['horizontal', 'vertical', 'vertical-left', 'vertical-right', 'inline']),
|
14824 | prefixCls: _propTypes2['default'].string,
|
14825 | level: _propTypes2['default'].number,
|
14826 | theme: _propTypes2['default'].string,
|
14827 | overflowedIndicator: _propTypes2['default'].node,
|
14828 | visible: _propTypes2['default'].bool,
|
14829 | hiddenClassName: _propTypes2['default'].string,
|
14830 | tag: _propTypes2['default'].string,
|
14831 | style: _propTypes2['default'].object
|
14832 | };
|
14833 |
|
14834 | DOMWrap.defaultProps = {
|
14835 | tag: 'div',
|
14836 | className: ''
|
14837 | };
|
14838 |
|
14839 | exports['default'] = DOMWrap;
|
14840 | module.exports = exports['default'];
|
14841 |
|
14842 | }),
|
14843 |
|
14844 | (function(module, exports, __webpack_require__) {
|
14845 |
|
14846 | (function(global) {(function (global, factory) {
|
14847 | true ? module.exports = factory() :
|
14848 | typeof define === 'function' && define.amd ? define(factory) :
|
14849 | (global.ResizeObserver = factory());
|
14850 | }(this, (function () { 'use strict';
|
14851 |
|
14852 | |
14853 |
|
14854 |
|
14855 |
|
14856 |
|
14857 |
|
14858 |
|
14859 | var MapShim = (function () {
|
14860 | if (typeof Map !== 'undefined') {
|
14861 | return Map;
|
14862 | }
|
14863 | |
14864 |
|
14865 |
|
14866 |
|
14867 |
|
14868 |
|
14869 |
|
14870 | function getIndex(arr, key) {
|
14871 | var result = -1;
|
14872 | arr.some(function (entry, index) {
|
14873 | if (entry[0] === key) {
|
14874 | result = index;
|
14875 | return true;
|
14876 | }
|
14877 | return false;
|
14878 | });
|
14879 | return result;
|
14880 | }
|
14881 | return (function () {
|
14882 | function class_1() {
|
14883 | this.__entries__ = [];
|
14884 | }
|
14885 | Object.defineProperty(class_1.prototype, "size", {
|
14886 | |
14887 |
|
14888 |
|
14889 | get: function () {
|
14890 | return this.__entries__.length;
|
14891 | },
|
14892 | enumerable: true,
|
14893 | configurable: true
|
14894 | });
|
14895 | |
14896 |
|
14897 |
|
14898 |
|
14899 | class_1.prototype.get = function (key) {
|
14900 | var index = getIndex(this.__entries__, key);
|
14901 | var entry = this.__entries__[index];
|
14902 | return entry && entry[1];
|
14903 | };
|
14904 | |
14905 |
|
14906 |
|
14907 |
|
14908 |
|
14909 | class_1.prototype.set = function (key, value) {
|
14910 | var index = getIndex(this.__entries__, key);
|
14911 | if (~index) {
|
14912 | this.__entries__[index][1] = value;
|
14913 | }
|
14914 | else {
|
14915 | this.__entries__.push([key, value]);
|
14916 | }
|
14917 | };
|
14918 | |
14919 |
|
14920 |
|
14921 |
|
14922 | class_1.prototype.delete = function (key) {
|
14923 | var entries = this.__entries__;
|
14924 | var index = getIndex(entries, key);
|
14925 | if (~index) {
|
14926 | entries.splice(index, 1);
|
14927 | }
|
14928 | };
|
14929 | |
14930 |
|
14931 |
|
14932 |
|
14933 | class_1.prototype.has = function (key) {
|
14934 | return !!~getIndex(this.__entries__, key);
|
14935 | };
|
14936 | |
14937 |
|
14938 |
|
14939 | class_1.prototype.clear = function () {
|
14940 | this.__entries__.splice(0);
|
14941 | };
|
14942 | |
14943 |
|
14944 |
|
14945 |
|
14946 |
|
14947 | class_1.prototype.forEach = function (callback, ctx) {
|
14948 | if (ctx === void 0) { ctx = null; }
|
14949 | for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
|
14950 | var entry = _a[_i];
|
14951 | callback.call(ctx, entry[1], entry[0]);
|
14952 | }
|
14953 | };
|
14954 | return class_1;
|
14955 | }());
|
14956 | })();
|
14957 |
|
14958 | |
14959 |
|
14960 |
|
14961 | var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
|
14962 |
|
14963 |
|
14964 | var global$1 = (function () {
|
14965 | if (typeof global !== 'undefined' && global.Math === Math) {
|
14966 | return global;
|
14967 | }
|
14968 | if (typeof self !== 'undefined' && self.Math === Math) {
|
14969 | return self;
|
14970 | }
|
14971 | if (typeof window !== 'undefined' && window.Math === Math) {
|
14972 | return window;
|
14973 | }
|
14974 |
|
14975 | return Function('return this')();
|
14976 | })();
|
14977 |
|
14978 | |
14979 |
|
14980 |
|
14981 |
|
14982 |
|
14983 |
|
14984 | var requestAnimationFrame$1 = (function () {
|
14985 | if (typeof requestAnimationFrame === 'function') {
|
14986 |
|
14987 |
|
14988 |
|
14989 | return requestAnimationFrame.bind(global$1);
|
14990 | }
|
14991 | return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };
|
14992 | })();
|
14993 |
|
14994 |
|
14995 | var trailingTimeout = 2;
|
14996 | |
14997 |
|
14998 |
|
14999 |
|
15000 |
|
15001 |
|
15002 |
|
15003 |
|
15004 | function throttle (callback, delay) {
|
15005 | var leadingCall = false, trailingCall = false, lastCallTime = 0;
|
15006 | |
15007 |
|
15008 |
|
15009 |
|
15010 |
|
15011 |
|
15012 | function resolvePending() {
|
15013 | if (leadingCall) {
|
15014 | leadingCall = false;
|
15015 | callback();
|
15016 | }
|
15017 | if (trailingCall) {
|
15018 | proxy();
|
15019 | }
|
15020 | }
|
15021 | |
15022 |
|
15023 |
|
15024 |
|
15025 |
|
15026 |
|
15027 |
|
15028 | function timeoutCallback() {
|
15029 | requestAnimationFrame$1(resolvePending);
|
15030 | }
|
15031 | |
15032 |
|
15033 |
|
15034 |
|
15035 |
|
15036 | function proxy() {
|
15037 | var timeStamp = Date.now();
|
15038 | if (leadingCall) {
|
15039 |
|
15040 | if (timeStamp - lastCallTime < trailingTimeout) {
|
15041 | return;
|
15042 | }
|
15043 |
|
15044 |
|
15045 |
|
15046 |
|
15047 | trailingCall = true;
|
15048 | }
|
15049 | else {
|
15050 | leadingCall = true;
|
15051 | trailingCall = false;
|
15052 | setTimeout(timeoutCallback, delay);
|
15053 | }
|
15054 | lastCallTime = timeStamp;
|
15055 | }
|
15056 | return proxy;
|
15057 | }
|
15058 |
|
15059 |
|
15060 | var REFRESH_DELAY = 20;
|
15061 |
|
15062 |
|
15063 | var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
|
15064 |
|
15065 | var mutationObserverSupported = typeof MutationObserver !== 'undefined';
|
15066 | |
15067 |
|
15068 |
|
15069 | var ResizeObserverController = (function () {
|
15070 | |
15071 |
|
15072 |
|
15073 |
|
15074 |
|
15075 | function ResizeObserverController() {
|
15076 | |
15077 |
|
15078 |
|
15079 |
|
15080 |
|
15081 | this.connected_ = false;
|
15082 | |
15083 |
|
15084 |
|
15085 |
|
15086 |
|
15087 | this.mutationEventsAdded_ = false;
|
15088 | |
15089 |
|
15090 |
|
15091 |
|
15092 |
|
15093 | this.mutationsObserver_ = null;
|
15094 | |
15095 |
|
15096 |
|
15097 |
|
15098 |
|
15099 | this.observers_ = [];
|
15100 | this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
|
15101 | this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
|
15102 | }
|
15103 | |
15104 |
|
15105 |
|
15106 |
|
15107 |
|
15108 |
|
15109 | ResizeObserverController.prototype.addObserver = function (observer) {
|
15110 | if (!~this.observers_.indexOf(observer)) {
|
15111 | this.observers_.push(observer);
|
15112 | }
|
15113 |
|
15114 | if (!this.connected_) {
|
15115 | this.connect_();
|
15116 | }
|
15117 | };
|
15118 | |
15119 |
|
15120 |
|
15121 |
|
15122 |
|
15123 |
|
15124 | ResizeObserverController.prototype.removeObserver = function (observer) {
|
15125 | var observers = this.observers_;
|
15126 | var index = observers.indexOf(observer);
|
15127 |
|
15128 | if (~index) {
|
15129 | observers.splice(index, 1);
|
15130 | }
|
15131 |
|
15132 | if (!observers.length && this.connected_) {
|
15133 | this.disconnect_();
|
15134 | }
|
15135 | };
|
15136 | |
15137 |
|
15138 |
|
15139 |
|
15140 |
|
15141 |
|
15142 | ResizeObserverController.prototype.refresh = function () {
|
15143 | var changesDetected = this.updateObservers_();
|
15144 |
|
15145 |
|
15146 | if (changesDetected) {
|
15147 | this.refresh();
|
15148 | }
|
15149 | };
|
15150 | |
15151 |
|
15152 |
|
15153 |
|
15154 |
|
15155 |
|
15156 |
|
15157 |
|
15158 | ResizeObserverController.prototype.updateObservers_ = function () {
|
15159 |
|
15160 | var activeObservers = this.observers_.filter(function (observer) {
|
15161 | return observer.gatherActive(), observer.hasActive();
|
15162 | });
|
15163 |
|
15164 |
|
15165 |
|
15166 |
|
15167 |
|
15168 | activeObservers.forEach(function (observer) { return observer.broadcastActive(); });
|
15169 | return activeObservers.length > 0;
|
15170 | };
|
15171 | |
15172 |
|
15173 |
|
15174 |
|
15175 |
|
15176 |
|
15177 | ResizeObserverController.prototype.connect_ = function () {
|
15178 |
|
15179 |
|
15180 | if (!isBrowser || this.connected_) {
|
15181 | return;
|
15182 | }
|
15183 |
|
15184 |
|
15185 |
|
15186 | document.addEventListener('transitionend', this.onTransitionEnd_);
|
15187 | window.addEventListener('resize', this.refresh);
|
15188 | if (mutationObserverSupported) {
|
15189 | this.mutationsObserver_ = new MutationObserver(this.refresh);
|
15190 | this.mutationsObserver_.observe(document, {
|
15191 | attributes: true,
|
15192 | childList: true,
|
15193 | characterData: true,
|
15194 | subtree: true
|
15195 | });
|
15196 | }
|
15197 | else {
|
15198 | document.addEventListener('DOMSubtreeModified', this.refresh);
|
15199 | this.mutationEventsAdded_ = true;
|
15200 | }
|
15201 | this.connected_ = true;
|
15202 | };
|
15203 | |
15204 |
|
15205 |
|
15206 |
|
15207 |
|
15208 |
|
15209 | ResizeObserverController.prototype.disconnect_ = function () {
|
15210 |
|
15211 |
|
15212 | if (!isBrowser || !this.connected_) {
|
15213 | return;
|
15214 | }
|
15215 | document.removeEventListener('transitionend', this.onTransitionEnd_);
|
15216 | window.removeEventListener('resize', this.refresh);
|
15217 | if (this.mutationsObserver_) {
|
15218 | this.mutationsObserver_.disconnect();
|
15219 | }
|
15220 | if (this.mutationEventsAdded_) {
|
15221 | document.removeEventListener('DOMSubtreeModified', this.refresh);
|
15222 | }
|
15223 | this.mutationsObserver_ = null;
|
15224 | this.mutationEventsAdded_ = false;
|
15225 | this.connected_ = false;
|
15226 | };
|
15227 | |
15228 |
|
15229 |
|
15230 |
|
15231 |
|
15232 |
|
15233 |
|
15234 | ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {
|
15235 | var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b;
|
15236 |
|
15237 | var isReflowProperty = transitionKeys.some(function (key) {
|
15238 | return !!~propertyName.indexOf(key);
|
15239 | });
|
15240 | if (isReflowProperty) {
|
15241 | this.refresh();
|
15242 | }
|
15243 | };
|
15244 | |
15245 |
|
15246 |
|
15247 |
|
15248 |
|
15249 | ResizeObserverController.getInstance = function () {
|
15250 | if (!this.instance_) {
|
15251 | this.instance_ = new ResizeObserverController();
|
15252 | }
|
15253 | return this.instance_;
|
15254 | };
|
15255 | |
15256 |
|
15257 |
|
15258 |
|
15259 |
|
15260 | ResizeObserverController.instance_ = null;
|
15261 | return ResizeObserverController;
|
15262 | }());
|
15263 |
|
15264 | |
15265 |
|
15266 |
|
15267 |
|
15268 |
|
15269 |
|
15270 |
|
15271 | var defineConfigurable = (function (target, props) {
|
15272 | for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
|
15273 | var key = _a[_i];
|
15274 | Object.defineProperty(target, key, {
|
15275 | value: props[key],
|
15276 | enumerable: false,
|
15277 | writable: false,
|
15278 | configurable: true
|
15279 | });
|
15280 | }
|
15281 | return target;
|
15282 | });
|
15283 |
|
15284 | |
15285 |
|
15286 |
|
15287 |
|
15288 |
|
15289 |
|
15290 | var getWindowOf = (function (target) {
|
15291 |
|
15292 |
|
15293 |
|
15294 | var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
|
15295 |
|
15296 |
|
15297 | return ownerGlobal || global$1;
|
15298 | });
|
15299 |
|
15300 |
|
15301 | var emptyRect = createRectInit(0, 0, 0, 0);
|
15302 | |
15303 |
|
15304 |
|
15305 |
|
15306 |
|
15307 |
|
15308 | function toFloat(value) {
|
15309 | return parseFloat(value) || 0;
|
15310 | }
|
15311 | |
15312 |
|
15313 |
|
15314 |
|
15315 |
|
15316 |
|
15317 |
|
15318 | function getBordersSize(styles) {
|
15319 | var positions = [];
|
15320 | for (var _i = 1; _i < arguments.length; _i++) {
|
15321 | positions[_i - 1] = arguments[_i];
|
15322 | }
|
15323 | return positions.reduce(function (size, position) {
|
15324 | var value = styles['border-' + position + '-width'];
|
15325 | return size + toFloat(value);
|
15326 | }, 0);
|
15327 | }
|
15328 | |
15329 |
|
15330 |
|
15331 |
|
15332 |
|
15333 |
|
15334 | function getPaddings(styles) {
|
15335 | var positions = ['top', 'right', 'bottom', 'left'];
|
15336 | var paddings = {};
|
15337 | for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
15338 | var position = positions_1[_i];
|
15339 | var value = styles['padding-' + position];
|
15340 | paddings[position] = toFloat(value);
|
15341 | }
|
15342 | return paddings;
|
15343 | }
|
15344 | |
15345 |
|
15346 |
|
15347 |
|
15348 |
|
15349 |
|
15350 |
|
15351 | function getSVGContentRect(target) {
|
15352 | var bbox = target.getBBox();
|
15353 | return createRectInit(0, 0, bbox.width, bbox.height);
|
15354 | }
|
15355 | |
15356 |
|
15357 |
|
15358 |
|
15359 |
|
15360 |
|
15361 | function getHTMLElementContentRect(target) {
|
15362 |
|
15363 |
|
15364 | var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
|
15365 |
|
15366 |
|
15367 |
|
15368 |
|
15369 |
|
15370 |
|
15371 |
|
15372 |
|
15373 | if (!clientWidth && !clientHeight) {
|
15374 | return emptyRect;
|
15375 | }
|
15376 | var styles = getWindowOf(target).getComputedStyle(target);
|
15377 | var paddings = getPaddings(styles);
|
15378 | var horizPad = paddings.left + paddings.right;
|
15379 | var vertPad = paddings.top + paddings.bottom;
|
15380 |
|
15381 |
|
15382 |
|
15383 |
|
15384 | var width = toFloat(styles.width), height = toFloat(styles.height);
|
15385 |
|
15386 |
|
15387 | if (styles.boxSizing === 'border-box') {
|
15388 |
|
15389 |
|
15390 |
|
15391 |
|
15392 |
|
15393 |
|
15394 | if (Math.round(width + horizPad) !== clientWidth) {
|
15395 | width -= getBordersSize(styles, 'left', 'right') + horizPad;
|
15396 | }
|
15397 | if (Math.round(height + vertPad) !== clientHeight) {
|
15398 | height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
|
15399 | }
|
15400 | }
|
15401 |
|
15402 |
|
15403 |
|
15404 |
|
15405 | if (!isDocumentElement(target)) {
|
15406 |
|
15407 |
|
15408 |
|
15409 |
|
15410 | var vertScrollbar = Math.round(width + horizPad) - clientWidth;
|
15411 | var horizScrollbar = Math.round(height + vertPad) - clientHeight;
|
15412 |
|
15413 |
|
15414 |
|
15415 |
|
15416 |
|
15417 | if (Math.abs(vertScrollbar) !== 1) {
|
15418 | width -= vertScrollbar;
|
15419 | }
|
15420 | if (Math.abs(horizScrollbar) !== 1) {
|
15421 | height -= horizScrollbar;
|
15422 | }
|
15423 | }
|
15424 | return createRectInit(paddings.left, paddings.top, width, height);
|
15425 | }
|
15426 | |
15427 |
|
15428 |
|
15429 |
|
15430 |
|
15431 |
|
15432 | var isSVGGraphicsElement = (function () {
|
15433 |
|
15434 |
|
15435 | if (typeof SVGGraphicsElement !== 'undefined') {
|
15436 | return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };
|
15437 | }
|
15438 |
|
15439 |
|
15440 |
|
15441 | return function (target) { return (target instanceof getWindowOf(target).SVGElement &&
|
15442 | typeof target.getBBox === 'function'); };
|
15443 | })();
|
15444 | |
15445 |
|
15446 |
|
15447 |
|
15448 |
|
15449 |
|
15450 | function isDocumentElement(target) {
|
15451 | return target === getWindowOf(target).document.documentElement;
|
15452 | }
|
15453 | |
15454 |
|
15455 |
|
15456 |
|
15457 |
|
15458 |
|
15459 | function getContentRect(target) {
|
15460 | if (!isBrowser) {
|
15461 | return emptyRect;
|
15462 | }
|
15463 | if (isSVGGraphicsElement(target)) {
|
15464 | return getSVGContentRect(target);
|
15465 | }
|
15466 | return getHTMLElementContentRect(target);
|
15467 | }
|
15468 | |
15469 |
|
15470 |
|
15471 |
|
15472 |
|
15473 |
|
15474 |
|
15475 | function createReadOnlyRect(_a) {
|
15476 | var x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
15477 |
|
15478 | var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
|
15479 | var rect = Object.create(Constr.prototype);
|
15480 |
|
15481 | defineConfigurable(rect, {
|
15482 | x: x, y: y, width: width, height: height,
|
15483 | top: y,
|
15484 | right: x + width,
|
15485 | bottom: height + y,
|
15486 | left: x
|
15487 | });
|
15488 | return rect;
|
15489 | }
|
15490 | |
15491 |
|
15492 |
|
15493 |
|
15494 |
|
15495 |
|
15496 |
|
15497 |
|
15498 |
|
15499 |
|
15500 | function createRectInit(x, y, width, height) {
|
15501 | return { x: x, y: y, width: width, height: height };
|
15502 | }
|
15503 |
|
15504 | |
15505 |
|
15506 |
|
15507 |
|
15508 | var ResizeObservation = (function () {
|
15509 | |
15510 |
|
15511 |
|
15512 |
|
15513 |
|
15514 | function ResizeObservation(target) {
|
15515 | |
15516 |
|
15517 |
|
15518 |
|
15519 |
|
15520 | this.broadcastWidth = 0;
|
15521 | |
15522 |
|
15523 |
|
15524 |
|
15525 |
|
15526 | this.broadcastHeight = 0;
|
15527 | |
15528 |
|
15529 |
|
15530 |
|
15531 |
|
15532 | this.contentRect_ = createRectInit(0, 0, 0, 0);
|
15533 | this.target = target;
|
15534 | }
|
15535 | |
15536 |
|
15537 |
|
15538 |
|
15539 |
|
15540 |
|
15541 | ResizeObservation.prototype.isActive = function () {
|
15542 | var rect = getContentRect(this.target);
|
15543 | this.contentRect_ = rect;
|
15544 | return (rect.width !== this.broadcastWidth ||
|
15545 | rect.height !== this.broadcastHeight);
|
15546 | };
|
15547 | |
15548 |
|
15549 |
|
15550 |
|
15551 |
|
15552 |
|
15553 | ResizeObservation.prototype.broadcastRect = function () {
|
15554 | var rect = this.contentRect_;
|
15555 | this.broadcastWidth = rect.width;
|
15556 | this.broadcastHeight = rect.height;
|
15557 | return rect;
|
15558 | };
|
15559 | return ResizeObservation;
|
15560 | }());
|
15561 |
|
15562 | var ResizeObserverEntry = (function () {
|
15563 | |
15564 |
|
15565 |
|
15566 |
|
15567 |
|
15568 |
|
15569 | function ResizeObserverEntry(target, rectInit) {
|
15570 | var contentRect = createReadOnlyRect(rectInit);
|
15571 |
|
15572 |
|
15573 |
|
15574 |
|
15575 |
|
15576 |
|
15577 | defineConfigurable(this, { target: target, contentRect: contentRect });
|
15578 | }
|
15579 | return ResizeObserverEntry;
|
15580 | }());
|
15581 |
|
15582 | var ResizeObserverSPI = (function () {
|
15583 | |
15584 |
|
15585 |
|
15586 |
|
15587 |
|
15588 |
|
15589 |
|
15590 |
|
15591 |
|
15592 |
|
15593 | function ResizeObserverSPI(callback, controller, callbackCtx) {
|
15594 | |
15595 |
|
15596 |
|
15597 |
|
15598 |
|
15599 |
|
15600 | this.activeObservations_ = [];
|
15601 | |
15602 |
|
15603 |
|
15604 |
|
15605 |
|
15606 | this.observations_ = new MapShim();
|
15607 | if (typeof callback !== 'function') {
|
15608 | throw new TypeError('The callback provided as parameter 1 is not a function.');
|
15609 | }
|
15610 | this.callback_ = callback;
|
15611 | this.controller_ = controller;
|
15612 | this.callbackCtx_ = callbackCtx;
|
15613 | }
|
15614 | |
15615 |
|
15616 |
|
15617 |
|
15618 |
|
15619 |
|
15620 | ResizeObserverSPI.prototype.observe = function (target) {
|
15621 | if (!arguments.length) {
|
15622 | throw new TypeError('1 argument required, but only 0 present.');
|
15623 | }
|
15624 |
|
15625 | if (typeof Element === 'undefined' || !(Element instanceof Object)) {
|
15626 | return;
|
15627 | }
|
15628 | if (!(target instanceof getWindowOf(target).Element)) {
|
15629 | throw new TypeError('parameter 1 is not of type "Element".');
|
15630 | }
|
15631 | var observations = this.observations_;
|
15632 |
|
15633 | if (observations.has(target)) {
|
15634 | return;
|
15635 | }
|
15636 | observations.set(target, new ResizeObservation(target));
|
15637 | this.controller_.addObserver(this);
|
15638 |
|
15639 | this.controller_.refresh();
|
15640 | };
|
15641 | |
15642 |
|
15643 |
|
15644 |
|
15645 |
|
15646 |
|
15647 | ResizeObserverSPI.prototype.unobserve = function (target) {
|
15648 | if (!arguments.length) {
|
15649 | throw new TypeError('1 argument required, but only 0 present.');
|
15650 | }
|
15651 |
|
15652 | if (typeof Element === 'undefined' || !(Element instanceof Object)) {
|
15653 | return;
|
15654 | }
|
15655 | if (!(target instanceof getWindowOf(target).Element)) {
|
15656 | throw new TypeError('parameter 1 is not of type "Element".');
|
15657 | }
|
15658 | var observations = this.observations_;
|
15659 |
|
15660 | if (!observations.has(target)) {
|
15661 | return;
|
15662 | }
|
15663 | observations.delete(target);
|
15664 | if (!observations.size) {
|
15665 | this.controller_.removeObserver(this);
|
15666 | }
|
15667 | };
|
15668 | |
15669 |
|
15670 |
|
15671 |
|
15672 |
|
15673 | ResizeObserverSPI.prototype.disconnect = function () {
|
15674 | this.clearActive();
|
15675 | this.observations_.clear();
|
15676 | this.controller_.removeObserver(this);
|
15677 | };
|
15678 | |
15679 |
|
15680 |
|
15681 |
|
15682 |
|
15683 |
|
15684 | ResizeObserverSPI.prototype.gatherActive = function () {
|
15685 | var _this = this;
|
15686 | this.clearActive();
|
15687 | this.observations_.forEach(function (observation) {
|
15688 | if (observation.isActive()) {
|
15689 | _this.activeObservations_.push(observation);
|
15690 | }
|
15691 | });
|
15692 | };
|
15693 | |
15694 |
|
15695 |
|
15696 |
|
15697 |
|
15698 |
|
15699 | ResizeObserverSPI.prototype.broadcastActive = function () {
|
15700 |
|
15701 | if (!this.hasActive()) {
|
15702 | return;
|
15703 | }
|
15704 | var ctx = this.callbackCtx_;
|
15705 |
|
15706 | var entries = this.activeObservations_.map(function (observation) {
|
15707 | return new ResizeObserverEntry(observation.target, observation.broadcastRect());
|
15708 | });
|
15709 | this.callback_.call(ctx, entries, ctx);
|
15710 | this.clearActive();
|
15711 | };
|
15712 | |
15713 |
|
15714 |
|
15715 |
|
15716 |
|
15717 | ResizeObserverSPI.prototype.clearActive = function () {
|
15718 | this.activeObservations_.splice(0);
|
15719 | };
|
15720 | |
15721 |
|
15722 |
|
15723 |
|
15724 |
|
15725 | ResizeObserverSPI.prototype.hasActive = function () {
|
15726 | return this.activeObservations_.length > 0;
|
15727 | };
|
15728 | return ResizeObserverSPI;
|
15729 | }());
|
15730 |
|
15731 |
|
15732 |
|
15733 |
|
15734 | var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
|
15735 | |
15736 |
|
15737 |
|
15738 |
|
15739 | var ResizeObserver = (function () {
|
15740 | |
15741 |
|
15742 |
|
15743 |
|
15744 |
|
15745 |
|
15746 | function ResizeObserver(callback) {
|
15747 | if (!(this instanceof ResizeObserver)) {
|
15748 | throw new TypeError('Cannot call a class as a function.');
|
15749 | }
|
15750 | if (!arguments.length) {
|
15751 | throw new TypeError('1 argument required, but only 0 present.');
|
15752 | }
|
15753 | var controller = ResizeObserverController.getInstance();
|
15754 | var observer = new ResizeObserverSPI(callback, controller, this);
|
15755 | observers.set(this, observer);
|
15756 | }
|
15757 | return ResizeObserver;
|
15758 | }());
|
15759 |
|
15760 | [
|
15761 | 'observe',
|
15762 | 'unobserve',
|
15763 | 'disconnect'
|
15764 | ].forEach(function (method) {
|
15765 | ResizeObserver.prototype[method] = function () {
|
15766 | var _a;
|
15767 | return (_a = observers.get(this))[method].apply(_a, arguments);
|
15768 | };
|
15769 | });
|
15770 |
|
15771 | var index = (function () {
|
15772 |
|
15773 | if (typeof global$1.ResizeObserver !== 'undefined') {
|
15774 | return global$1.ResizeObserver;
|
15775 | }
|
15776 | return ResizeObserver;
|
15777 | })();
|
15778 |
|
15779 | return index;
|
15780 |
|
15781 | })));
|
15782 |
|
15783 | }.call(exports, (function() { return this; }())))
|
15784 |
|
15785 | }),
|
15786 |
|
15787 | (function(module, exports, __webpack_require__) {
|
15788 |
|
15789 | 'use strict';
|
15790 |
|
15791 | exports.__esModule = true;
|
15792 | exports.SubMenu = undefined;
|
15793 |
|
15794 | var _classCallCheck2 = __webpack_require__(134);
|
15795 |
|
15796 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
15797 |
|
15798 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
15799 |
|
15800 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
15801 |
|
15802 | var _inherits2 = __webpack_require__(169);
|
15803 |
|
15804 | var _inherits3 = _interopRequireDefault(_inherits2);
|
15805 |
|
15806 | var _extends3 = __webpack_require__(94);
|
15807 |
|
15808 | var _extends4 = _interopRequireDefault(_extends3);
|
15809 |
|
15810 | var _react = __webpack_require__(4);
|
15811 |
|
15812 | var _react2 = _interopRequireDefault(_react);
|
15813 |
|
15814 | var _reactDom = __webpack_require__(12);
|
15815 |
|
15816 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
15817 |
|
15818 | var _propTypes = __webpack_require__(5);
|
15819 |
|
15820 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
15821 |
|
15822 | var _rcTrigger = __webpack_require__(195);
|
15823 |
|
15824 | var _rcTrigger2 = _interopRequireDefault(_rcTrigger);
|
15825 |
|
15826 | var _KeyCode = __webpack_require__(188);
|
15827 |
|
15828 | var _KeyCode2 = _interopRequireDefault(_KeyCode);
|
15829 |
|
15830 | var _classnames = __webpack_require__(3);
|
15831 |
|
15832 | var _classnames2 = _interopRequireDefault(_classnames);
|
15833 |
|
15834 | var _miniStore = __webpack_require__(177);
|
15835 |
|
15836 | var _SubPopupMenu = __webpack_require__(187);
|
15837 |
|
15838 | var _SubPopupMenu2 = _interopRequireDefault(_SubPopupMenu);
|
15839 |
|
15840 | var _placements = __webpack_require__(218);
|
15841 |
|
15842 | var _placements2 = _interopRequireDefault(_placements);
|
15843 |
|
15844 | var _rcAnimate = __webpack_require__(209);
|
15845 |
|
15846 | var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
|
15847 |
|
15848 | var _util = __webpack_require__(190);
|
15849 |
|
15850 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
15851 |
|
15852 | var guid = 0;
|
15853 |
|
15854 | var popupPlacementMap = {
|
15855 | horizontal: 'bottomLeft',
|
15856 | vertical: 'rightTop',
|
15857 | 'vertical-left': 'rightTop',
|
15858 | 'vertical-right': 'leftTop'
|
15859 | };
|
15860 |
|
15861 | var updateDefaultActiveFirst = function updateDefaultActiveFirst(store, eventKey, defaultActiveFirst) {
|
15862 | var _extends2;
|
15863 |
|
15864 | var menuId = (0, _util.getMenuIdFromSubMenuEventKey)(eventKey);
|
15865 | var state = store.getState();
|
15866 | store.setState({
|
15867 | defaultActiveFirst: (0, _extends4['default'])({}, state.defaultActiveFirst, (_extends2 = {}, _extends2[menuId] = defaultActiveFirst, _extends2))
|
15868 | });
|
15869 | };
|
15870 |
|
15871 | var SubMenu = exports.SubMenu = function (_React$Component) {
|
15872 | (0, _inherits3['default'])(SubMenu, _React$Component);
|
15873 |
|
15874 | function SubMenu(props) {
|
15875 | (0, _classCallCheck3['default'])(this, SubMenu);
|
15876 |
|
15877 | var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
|
15878 |
|
15879 | _initialiseProps.call(_this);
|
15880 |
|
15881 | var store = props.store;
|
15882 | var eventKey = props.eventKey;
|
15883 | var defaultActiveFirst = store.getState().defaultActiveFirst;
|
15884 |
|
15885 | _this.isRootMenu = false;
|
15886 |
|
15887 | var value = false;
|
15888 |
|
15889 | if (defaultActiveFirst) {
|
15890 | value = defaultActiveFirst[eventKey];
|
15891 | }
|
15892 |
|
15893 | updateDefaultActiveFirst(store, eventKey, value);
|
15894 | return _this;
|
15895 | }
|
15896 |
|
15897 | SubMenu.prototype.componentDidMount = function componentDidMount() {
|
15898 | this.componentDidUpdate();
|
15899 | };
|
15900 |
|
15901 | SubMenu.prototype.componentDidUpdate = function componentDidUpdate() {
|
15902 | var _this2 = this;
|
15903 |
|
15904 | var _props = this.props,
|
15905 | mode = _props.mode,
|
15906 | parentMenu = _props.parentMenu,
|
15907 | manualRef = _props.manualRef;
|
15908 |
|
15909 |
|
15910 |
|
15911 | if (manualRef) {
|
15912 | manualRef(this);
|
15913 | }
|
15914 |
|
15915 | if (mode !== 'horizontal' || !parentMenu.isRootMenu || !this.props.isOpen) {
|
15916 | return;
|
15917 | }
|
15918 |
|
15919 | this.minWidthTimeout = setTimeout(function () {
|
15920 | return _this2.adjustWidth();
|
15921 | }, 0);
|
15922 | };
|
15923 |
|
15924 | SubMenu.prototype.componentWillUnmount = function componentWillUnmount() {
|
15925 | var _props2 = this.props,
|
15926 | onDestroy = _props2.onDestroy,
|
15927 | eventKey = _props2.eventKey;
|
15928 |
|
15929 | if (onDestroy) {
|
15930 | onDestroy(eventKey);
|
15931 | }
|
15932 |
|
15933 |
|
15934 | if (this.minWidthTimeout) {
|
15935 | clearTimeout(this.minWidthTimeout);
|
15936 | }
|
15937 |
|
15938 |
|
15939 | if (this.mouseenterTimeout) {
|
15940 | clearTimeout(this.mouseenterTimeout);
|
15941 | }
|
15942 | };
|
15943 |
|
15944 | SubMenu.prototype.renderChildren = function renderChildren(children) {
|
15945 | var props = this.props;
|
15946 | var baseProps = {
|
15947 | mode: props.mode === 'horizontal' ? 'vertical' : props.mode,
|
15948 | visible: this.props.isOpen,
|
15949 | level: props.level + 1,
|
15950 | inlineIndent: props.inlineIndent,
|
15951 | focusable: false,
|
15952 | onClick: this.onSubMenuClick,
|
15953 | onSelect: this.onSelect,
|
15954 | onDeselect: this.onDeselect,
|
15955 | onDestroy: this.onDestroy,
|
15956 | selectedKeys: props.selectedKeys,
|
15957 | eventKey: props.eventKey + '-menu-',
|
15958 | openKeys: props.openKeys,
|
15959 | openTransitionName: props.openTransitionName,
|
15960 | openAnimation: props.openAnimation,
|
15961 | onOpenChange: this.onOpenChange,
|
15962 | subMenuOpenDelay: props.subMenuOpenDelay,
|
15963 | parentMenu: this,
|
15964 | subMenuCloseDelay: props.subMenuCloseDelay,
|
15965 | forceSubMenuRender: props.forceSubMenuRender,
|
15966 | triggerSubMenuAction: props.triggerSubMenuAction,
|
15967 | builtinPlacements: props.builtinPlacements,
|
15968 | defaultActiveFirst: props.store.getState().defaultActiveFirst[(0, _util.getMenuIdFromSubMenuEventKey)(props.eventKey)],
|
15969 | multiple: props.multiple,
|
15970 | prefixCls: props.rootPrefixCls,
|
15971 | id: this._menuId,
|
15972 | manualRef: this.saveMenuInstance,
|
15973 | itemIcon: props.itemIcon,
|
15974 | expandIcon: props.expandIcon
|
15975 | };
|
15976 |
|
15977 | var haveRendered = this.haveRendered;
|
15978 | this.haveRendered = true;
|
15979 |
|
15980 | this.haveOpened = this.haveOpened || baseProps.visible || baseProps.forceSubMenuRender;
|
15981 |
|
15982 | if (!this.haveOpened) {
|
15983 | return _react2['default'].createElement('div', null);
|
15984 | }
|
15985 |
|
15986 |
|
15987 |
|
15988 |
|
15989 | var transitionAppear = haveRendered || !baseProps.visible || !baseProps.mode === 'inline';
|
15990 |
|
15991 | baseProps.className = ' ' + baseProps.prefixCls + '-sub';
|
15992 | var animProps = {};
|
15993 |
|
15994 | if (baseProps.openTransitionName) {
|
15995 | animProps.transitionName = baseProps.openTransitionName;
|
15996 | } else if (typeof baseProps.openAnimation === 'object') {
|
15997 | animProps.animation = (0, _extends4['default'])({}, baseProps.openAnimation);
|
15998 | if (!transitionAppear) {
|
15999 | delete animProps.animation.appear;
|
16000 | }
|
16001 | }
|
16002 |
|
16003 | return _react2['default'].createElement(
|
16004 | _rcAnimate2['default'],
|
16005 | (0, _extends4['default'])({}, animProps, {
|
16006 | showProp: 'visible',
|
16007 | component: '',
|
16008 | transitionAppear: transitionAppear
|
16009 | }),
|
16010 | _react2['default'].createElement(
|
16011 | _SubPopupMenu2['default'],
|
16012 | (0, _extends4['default'])({}, baseProps, { id: this._menuId }),
|
16013 | children
|
16014 | )
|
16015 | );
|
16016 | };
|
16017 |
|
16018 | SubMenu.prototype.render = function render() {
|
16019 | var _classNames;
|
16020 |
|
16021 | var props = (0, _extends4['default'])({}, this.props);
|
16022 | var isOpen = props.isOpen;
|
16023 | var prefixCls = this.getPrefixCls();
|
16024 | var isInlineMode = props.mode === 'inline';
|
16025 | var className = (0, _classnames2['default'])(prefixCls, prefixCls + '-' + props.mode, (_classNames = {}, _classNames[props.className] = !!props.className, _classNames[this.getOpenClassName()] = isOpen, _classNames[this.getActiveClassName()] = props.active || isOpen && !isInlineMode, _classNames[this.getDisabledClassName()] = props.disabled, _classNames[this.getSelectedClassName()] = this.isChildrenSelected(), _classNames));
|
16026 |
|
16027 | if (!this._menuId) {
|
16028 | if (props.eventKey) {
|
16029 | this._menuId = props.eventKey + '$Menu';
|
16030 | } else {
|
16031 | this._menuId = '$__$' + ++guid + '$Menu';
|
16032 | }
|
16033 | }
|
16034 |
|
16035 | var mouseEvents = {};
|
16036 | var titleClickEvents = {};
|
16037 | var titleMouseEvents = {};
|
16038 | if (!props.disabled) {
|
16039 | mouseEvents = {
|
16040 | onMouseLeave: this.onMouseLeave,
|
16041 | onMouseEnter: this.onMouseEnter
|
16042 | };
|
16043 |
|
16044 |
|
16045 | titleClickEvents = {
|
16046 | onClick: this.onTitleClick
|
16047 | };
|
16048 | titleMouseEvents = {
|
16049 | onMouseEnter: this.onTitleMouseEnter,
|
16050 | onMouseLeave: this.onTitleMouseLeave
|
16051 | };
|
16052 | }
|
16053 |
|
16054 | var style = {};
|
16055 | if (isInlineMode) {
|
16056 | style.paddingLeft = props.inlineIndent * props.level;
|
16057 | }
|
16058 |
|
16059 | var ariaOwns = {};
|
16060 |
|
16061 |
|
16062 |
|
16063 | if (this.props.isOpen) {
|
16064 | ariaOwns = {
|
16065 | 'aria-owns': this._menuId
|
16066 | };
|
16067 | }
|
16068 |
|
16069 |
|
16070 | var icon = null;
|
16071 | if (props.mode !== 'horizontal') {
|
16072 | icon = this.props.expandIcon;
|
16073 | if (typeof this.props.expandIcon === 'function') {
|
16074 | icon = _react2['default'].createElement(this.props.expandIcon, (0, _extends4['default'])({}, this.props));
|
16075 | }
|
16076 | }
|
16077 |
|
16078 | var title = _react2['default'].createElement(
|
16079 | 'div',
|
16080 | (0, _extends4['default'])({
|
16081 | ref: this.saveSubMenuTitle,
|
16082 | style: style,
|
16083 | className: prefixCls + '-title'
|
16084 | }, titleMouseEvents, titleClickEvents, {
|
16085 | 'aria-expanded': isOpen
|
16086 | }, ariaOwns, {
|
16087 | 'aria-haspopup': 'true',
|
16088 | title: typeof props.title === 'string' ? props.title : undefined
|
16089 | }),
|
16090 | props.title,
|
16091 | icon || _react2['default'].createElement('i', { className: prefixCls + '-arrow' })
|
16092 | );
|
16093 | var children = this.renderChildren(props.children);
|
16094 |
|
16095 | var getPopupContainer = props.parentMenu.isRootMenu ? props.parentMenu.props.getPopupContainer : function (triggerNode) {
|
16096 | return triggerNode.parentNode;
|
16097 | };
|
16098 | var popupPlacement = popupPlacementMap[props.mode];
|
16099 | var popupAlign = props.popupOffset ? { offset: props.popupOffset } : {};
|
16100 | var popupClassName = props.mode === 'inline' ? '' : props.popupClassName;
|
16101 | var disabled = props.disabled,
|
16102 | triggerSubMenuAction = props.triggerSubMenuAction,
|
16103 | subMenuOpenDelay = props.subMenuOpenDelay,
|
16104 | forceSubMenuRender = props.forceSubMenuRender,
|
16105 | subMenuCloseDelay = props.subMenuCloseDelay,
|
16106 | builtinPlacements = props.builtinPlacements;
|
16107 |
|
16108 | _util.menuAllProps.forEach(function (key) {
|
16109 | return delete props[key];
|
16110 | });
|
16111 |
|
16112 | delete props.onClick;
|
16113 |
|
16114 | return _react2['default'].createElement(
|
16115 | 'li',
|
16116 | (0, _extends4['default'])({}, props, mouseEvents, {
|
16117 | className: className,
|
16118 | role: 'menuitem'
|
16119 | }),
|
16120 | isInlineMode && title,
|
16121 | isInlineMode && children,
|
16122 | !isInlineMode && _react2['default'].createElement(
|
16123 | _rcTrigger2['default'],
|
16124 | {
|
16125 | prefixCls: prefixCls,
|
16126 | popupClassName: prefixCls + '-popup ' + popupClassName,
|
16127 | getPopupContainer: getPopupContainer,
|
16128 | builtinPlacements: (0, _extends4['default'])({}, _placements2['default'], builtinPlacements),
|
16129 | popupPlacement: popupPlacement,
|
16130 | popupVisible: isOpen,
|
16131 | popupAlign: popupAlign,
|
16132 | popup: children,
|
16133 | action: disabled ? [] : [triggerSubMenuAction],
|
16134 | mouseEnterDelay: subMenuOpenDelay,
|
16135 | mouseLeaveDelay: subMenuCloseDelay,
|
16136 | onPopupVisibleChange: this.onPopupVisibleChange,
|
16137 | forceRender: forceSubMenuRender
|
16138 | },
|
16139 | title
|
16140 | )
|
16141 | );
|
16142 | };
|
16143 |
|
16144 | return SubMenu;
|
16145 | }(_react2['default'].Component);
|
16146 |
|
16147 | SubMenu.propTypes = {
|
16148 | parentMenu: _propTypes2['default'].object,
|
16149 | title: _propTypes2['default'].node,
|
16150 | children: _propTypes2['default'].any,
|
16151 | selectedKeys: _propTypes2['default'].array,
|
16152 | openKeys: _propTypes2['default'].array,
|
16153 | onClick: _propTypes2['default'].func,
|
16154 | onOpenChange: _propTypes2['default'].func,
|
16155 | rootPrefixCls: _propTypes2['default'].string,
|
16156 | eventKey: _propTypes2['default'].string,
|
16157 | multiple: _propTypes2['default'].bool,
|
16158 | active: _propTypes2['default'].bool,
|
16159 | onItemHover: _propTypes2['default'].func,
|
16160 | onSelect: _propTypes2['default'].func,
|
16161 | triggerSubMenuAction: _propTypes2['default'].string,
|
16162 | onDeselect: _propTypes2['default'].func,
|
16163 | onDestroy: _propTypes2['default'].func,
|
16164 | onMouseEnter: _propTypes2['default'].func,
|
16165 | onMouseLeave: _propTypes2['default'].func,
|
16166 | onTitleMouseEnter: _propTypes2['default'].func,
|
16167 | onTitleMouseLeave: _propTypes2['default'].func,
|
16168 | onTitleClick: _propTypes2['default'].func,
|
16169 | popupOffset: _propTypes2['default'].array,
|
16170 | isOpen: _propTypes2['default'].bool,
|
16171 | store: _propTypes2['default'].object,
|
16172 | mode: _propTypes2['default'].oneOf(['horizontal', 'vertical', 'vertical-left', 'vertical-right', 'inline']),
|
16173 | manualRef: _propTypes2['default'].func,
|
16174 | itemIcon: _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].node]),
|
16175 | expandIcon: _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].node])
|
16176 | };
|
16177 | SubMenu.defaultProps = {
|
16178 | onMouseEnter: _util.noop,
|
16179 | onMouseLeave: _util.noop,
|
16180 | onTitleMouseEnter: _util.noop,
|
16181 | onTitleMouseLeave: _util.noop,
|
16182 | onTitleClick: _util.noop,
|
16183 | manualRef: _util.noop,
|
16184 | mode: 'vertical',
|
16185 | title: ''
|
16186 | };
|
16187 |
|
16188 | var _initialiseProps = function _initialiseProps() {
|
16189 | var _this3 = this;
|
16190 |
|
16191 | this.onDestroy = function (key) {
|
16192 | _this3.props.onDestroy(key);
|
16193 | };
|
16194 |
|
16195 | this.onKeyDown = function (e) {
|
16196 | var keyCode = e.keyCode;
|
16197 | var menu = _this3.menuInstance;
|
16198 | var _props3 = _this3.props,
|
16199 | isOpen = _props3.isOpen,
|
16200 | store = _props3.store;
|
16201 |
|
16202 |
|
16203 | if (keyCode === _KeyCode2['default'].ENTER) {
|
16204 | _this3.onTitleClick(e);
|
16205 | updateDefaultActiveFirst(store, _this3.props.eventKey, true);
|
16206 | return true;
|
16207 | }
|
16208 |
|
16209 | if (keyCode === _KeyCode2['default'].RIGHT) {
|
16210 | if (isOpen) {
|
16211 | menu.onKeyDown(e);
|
16212 | } else {
|
16213 | _this3.triggerOpenChange(true);
|
16214 |
|
16215 | updateDefaultActiveFirst(store, _this3.props.eventKey, true);
|
16216 | }
|
16217 | return true;
|
16218 | }
|
16219 | if (keyCode === _KeyCode2['default'].LEFT) {
|
16220 | var handled = void 0;
|
16221 | if (isOpen) {
|
16222 | handled = menu.onKeyDown(e);
|
16223 | } else {
|
16224 | return undefined;
|
16225 | }
|
16226 | if (!handled) {
|
16227 | _this3.triggerOpenChange(false);
|
16228 | handled = true;
|
16229 | }
|
16230 | return handled;
|
16231 | }
|
16232 |
|
16233 | if (isOpen && (keyCode === _KeyCode2['default'].UP || keyCode === _KeyCode2['default'].DOWN)) {
|
16234 | return menu.onKeyDown(e);
|
16235 | }
|
16236 | };
|
16237 |
|
16238 | this.onOpenChange = function (e) {
|
16239 | _this3.props.onOpenChange(e);
|
16240 | };
|
16241 |
|
16242 | this.onPopupVisibleChange = function (visible) {
|
16243 | _this3.triggerOpenChange(visible, visible ? 'mouseenter' : 'mouseleave');
|
16244 | };
|
16245 |
|
16246 | this.onMouseEnter = function (e) {
|
16247 | var _props4 = _this3.props,
|
16248 | key = _props4.eventKey,
|
16249 | onMouseEnter = _props4.onMouseEnter,
|
16250 | store = _props4.store;
|
16251 |
|
16252 | updateDefaultActiveFirst(store, _this3.props.eventKey, false);
|
16253 | onMouseEnter({
|
16254 | key: key,
|
16255 | domEvent: e
|
16256 | });
|
16257 | };
|
16258 |
|
16259 | this.onMouseLeave = function (e) {
|
16260 | var _props5 = _this3.props,
|
16261 | parentMenu = _props5.parentMenu,
|
16262 | eventKey = _props5.eventKey,
|
16263 | onMouseLeave = _props5.onMouseLeave;
|
16264 |
|
16265 | parentMenu.subMenuInstance = _this3;
|
16266 | onMouseLeave({
|
16267 | key: eventKey,
|
16268 | domEvent: e
|
16269 | });
|
16270 | };
|
16271 |
|
16272 | this.onTitleMouseEnter = function (domEvent) {
|
16273 | var _props6 = _this3.props,
|
16274 | key = _props6.eventKey,
|
16275 | onItemHover = _props6.onItemHover,
|
16276 | onTitleMouseEnter = _props6.onTitleMouseEnter;
|
16277 |
|
16278 | onItemHover({
|
16279 | key: key,
|
16280 | hover: true
|
16281 | });
|
16282 | onTitleMouseEnter({
|
16283 | key: key,
|
16284 | domEvent: domEvent
|
16285 | });
|
16286 | };
|
16287 |
|
16288 | this.onTitleMouseLeave = function (e) {
|
16289 | var _props7 = _this3.props,
|
16290 | parentMenu = _props7.parentMenu,
|
16291 | eventKey = _props7.eventKey,
|
16292 | onItemHover = _props7.onItemHover,
|
16293 | onTitleMouseLeave = _props7.onTitleMouseLeave;
|
16294 |
|
16295 | parentMenu.subMenuInstance = _this3;
|
16296 | onItemHover({
|
16297 | key: eventKey,
|
16298 | hover: false
|
16299 | });
|
16300 | onTitleMouseLeave({
|
16301 | key: eventKey,
|
16302 | domEvent: e
|
16303 | });
|
16304 | };
|
16305 |
|
16306 | this.onTitleClick = function (e) {
|
16307 | var props = _this3.props;
|
16308 |
|
16309 | props.onTitleClick({
|
16310 | key: props.eventKey,
|
16311 | domEvent: e
|
16312 | });
|
16313 | if (props.triggerSubMenuAction === 'hover') {
|
16314 | return;
|
16315 | }
|
16316 | _this3.triggerOpenChange(!props.isOpen, 'click');
|
16317 | updateDefaultActiveFirst(props.store, _this3.props.eventKey, false);
|
16318 | };
|
16319 |
|
16320 | this.onSubMenuClick = function (info) {
|
16321 |
|
16322 |
|
16323 | if (typeof _this3.props.onClick === 'function') {
|
16324 | _this3.props.onClick(_this3.addKeyPath(info));
|
16325 | }
|
16326 | };
|
16327 |
|
16328 | this.onSelect = function (info) {
|
16329 | _this3.props.onSelect(info);
|
16330 | };
|
16331 |
|
16332 | this.onDeselect = function (info) {
|
16333 | _this3.props.onDeselect(info);
|
16334 | };
|
16335 |
|
16336 | this.getPrefixCls = function () {
|
16337 | return _this3.props.rootPrefixCls + '-submenu';
|
16338 | };
|
16339 |
|
16340 | this.getActiveClassName = function () {
|
16341 | return _this3.getPrefixCls() + '-active';
|
16342 | };
|
16343 |
|
16344 | this.getDisabledClassName = function () {
|
16345 | return _this3.getPrefixCls() + '-disabled';
|
16346 | };
|
16347 |
|
16348 | this.getSelectedClassName = function () {
|
16349 | return _this3.getPrefixCls() + '-selected';
|
16350 | };
|
16351 |
|
16352 | this.getOpenClassName = function () {
|
16353 | return _this3.props.rootPrefixCls + '-submenu-open';
|
16354 | };
|
16355 |
|
16356 | this.saveMenuInstance = function (c) {
|
16357 |
|
16358 | _this3.menuInstance = c;
|
16359 | };
|
16360 |
|
16361 | this.addKeyPath = function (info) {
|
16362 | return (0, _extends4['default'])({}, info, {
|
16363 | keyPath: (info.keyPath || []).concat(_this3.props.eventKey)
|
16364 | });
|
16365 | };
|
16366 |
|
16367 | this.triggerOpenChange = function (open, type) {
|
16368 | var key = _this3.props.eventKey;
|
16369 | var openChange = function openChange() {
|
16370 | _this3.onOpenChange({
|
16371 | key: key,
|
16372 | item: _this3,
|
16373 | trigger: type,
|
16374 | open: open
|
16375 | });
|
16376 | };
|
16377 | if (type === 'mouseenter') {
|
16378 |
|
16379 | _this3.mouseenterTimeout = setTimeout(function () {
|
16380 | openChange();
|
16381 | }, 0);
|
16382 | } else {
|
16383 | openChange();
|
16384 | }
|
16385 | };
|
16386 |
|
16387 | this.isChildrenSelected = function () {
|
16388 | var ret = { find: false };
|
16389 | (0, _util.loopMenuItemRecursively)(_this3.props.children, _this3.props.selectedKeys, ret);
|
16390 | return ret.find;
|
16391 | };
|
16392 |
|
16393 | this.isOpen = function () {
|
16394 | return _this3.props.openKeys.indexOf(_this3.props.eventKey) !== -1;
|
16395 | };
|
16396 |
|
16397 | this.adjustWidth = function () {
|
16398 |
|
16399 | if (!_this3.subMenuTitle || !_this3.menuInstance) {
|
16400 | return;
|
16401 | }
|
16402 | var popupMenu = _reactDom2['default'].findDOMNode(_this3.menuInstance);
|
16403 | if (popupMenu.offsetWidth >= _this3.subMenuTitle.offsetWidth) {
|
16404 | return;
|
16405 | }
|
16406 |
|
16407 |
|
16408 | popupMenu.style.minWidth = _this3.subMenuTitle.offsetWidth + 'px';
|
16409 | };
|
16410 |
|
16411 | this.saveSubMenuTitle = function (subMenuTitle) {
|
16412 | _this3.subMenuTitle = subMenuTitle;
|
16413 | };
|
16414 | };
|
16415 |
|
16416 | var connected = (0, _miniStore.connect)(function (_ref, _ref2) {
|
16417 | var openKeys = _ref.openKeys,
|
16418 | activeKey = _ref.activeKey,
|
16419 | selectedKeys = _ref.selectedKeys;
|
16420 | var eventKey = _ref2.eventKey,
|
16421 | subMenuKey = _ref2.subMenuKey;
|
16422 | return {
|
16423 | isOpen: openKeys.indexOf(eventKey) > -1,
|
16424 | active: activeKey[subMenuKey] === eventKey,
|
16425 | selectedKeys: selectedKeys
|
16426 | };
|
16427 | })(SubMenu);
|
16428 |
|
16429 | connected.isSubMenu = true;
|
16430 |
|
16431 | exports['default'] = connected;
|
16432 |
|
16433 | }),
|
16434 |
|
16435 | (function(module, exports, __webpack_require__) {
|
16436 |
|
16437 | 'use strict';
|
16438 |
|
16439 | exports.__esModule = true;
|
16440 |
|
16441 | var _extends2 = __webpack_require__(94);
|
16442 |
|
16443 | var _extends3 = _interopRequireDefault(_extends2);
|
16444 |
|
16445 | var _classCallCheck2 = __webpack_require__(134);
|
16446 |
|
16447 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
16448 |
|
16449 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
16450 |
|
16451 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
16452 |
|
16453 | var _inherits2 = __webpack_require__(169);
|
16454 |
|
16455 | var _inherits3 = _interopRequireDefault(_inherits2);
|
16456 |
|
16457 | var _react = __webpack_require__(4);
|
16458 |
|
16459 | var _react2 = _interopRequireDefault(_react);
|
16460 |
|
16461 | var _propTypes = __webpack_require__(5);
|
16462 |
|
16463 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16464 |
|
16465 | var _reactDom = __webpack_require__(12);
|
16466 |
|
16467 | var _contains = __webpack_require__(196);
|
16468 |
|
16469 | var _contains2 = _interopRequireDefault(_contains);
|
16470 |
|
16471 | var _addEventListener = __webpack_require__(197);
|
16472 |
|
16473 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
16474 |
|
16475 | var _ContainerRender = __webpack_require__(198);
|
16476 |
|
16477 | var _ContainerRender2 = _interopRequireDefault(_ContainerRender);
|
16478 |
|
16479 | var _Portal = __webpack_require__(203);
|
16480 |
|
16481 | var _Portal2 = _interopRequireDefault(_Portal);
|
16482 |
|
16483 | var _classnames = __webpack_require__(3);
|
16484 |
|
16485 | var _classnames2 = _interopRequireDefault(_classnames);
|
16486 |
|
16487 | var _utils = __webpack_require__(204);
|
16488 |
|
16489 | var _Popup = __webpack_require__(205);
|
16490 |
|
16491 | var _Popup2 = _interopRequireDefault(_Popup);
|
16492 |
|
16493 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16494 |
|
16495 | function noop() {}
|
16496 |
|
16497 | function returnEmptyString() {
|
16498 | return '';
|
16499 | }
|
16500 |
|
16501 | function returnDocument() {
|
16502 | return window.document;
|
16503 | }
|
16504 |
|
16505 | var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur', 'onContextMenu'];
|
16506 |
|
16507 | var IS_REACT_16 = !!_reactDom.createPortal;
|
16508 |
|
16509 | var contextTypes = {
|
16510 | rcTrigger: _propTypes2['default'].shape({
|
16511 | onPopupMouseDown: _propTypes2['default'].func
|
16512 | })
|
16513 | };
|
16514 |
|
16515 | var Trigger = function (_React$Component) {
|
16516 | (0, _inherits3['default'])(Trigger, _React$Component);
|
16517 |
|
16518 | function Trigger(props) {
|
16519 | (0, _classCallCheck3['default'])(this, Trigger);
|
16520 |
|
16521 | var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
|
16522 |
|
16523 | _initialiseProps.call(_this);
|
16524 |
|
16525 | var popupVisible = void 0;
|
16526 | if ('popupVisible' in props) {
|
16527 | popupVisible = !!props.popupVisible;
|
16528 | } else {
|
16529 | popupVisible = !!props.defaultPopupVisible;
|
16530 | }
|
16531 |
|
16532 | _this.prevPopupVisible = popupVisible;
|
16533 |
|
16534 | _this.state = {
|
16535 | popupVisible: popupVisible
|
16536 | };
|
16537 | return _this;
|
16538 | }
|
16539 |
|
16540 | Trigger.prototype.getChildContext = function getChildContext() {
|
16541 | return {
|
16542 | rcTrigger: {
|
16543 | onPopupMouseDown: this.onPopupMouseDown
|
16544 | }
|
16545 | };
|
16546 | };
|
16547 |
|
16548 | Trigger.prototype.componentWillMount = function componentWillMount() {
|
16549 | var _this2 = this;
|
16550 |
|
16551 | ALL_HANDLERS.forEach(function (h) {
|
16552 | _this2['fire' + h] = function (e) {
|
16553 | _this2.fireEvents(h, e);
|
16554 | };
|
16555 | });
|
16556 | };
|
16557 |
|
16558 | Trigger.prototype.componentDidMount = function componentDidMount() {
|
16559 | this.componentDidUpdate({}, {
|
16560 | popupVisible: this.state.popupVisible
|
16561 | });
|
16562 | };
|
16563 |
|
16564 | Trigger.prototype.componentWillReceiveProps = function componentWillReceiveProps(_ref) {
|
16565 | var popupVisible = _ref.popupVisible;
|
16566 |
|
16567 | if (popupVisible !== undefined) {
|
16568 | this.setState({
|
16569 | popupVisible: popupVisible
|
16570 | });
|
16571 | }
|
16572 | };
|
16573 |
|
16574 | Trigger.prototype.componentDidUpdate = function componentDidUpdate(_, prevState) {
|
16575 | var props = this.props;
|
16576 | var state = this.state;
|
16577 | var triggerAfterPopupVisibleChange = function triggerAfterPopupVisibleChange() {
|
16578 | if (prevState.popupVisible !== state.popupVisible) {
|
16579 | props.afterPopupVisibleChange(state.popupVisible);
|
16580 | }
|
16581 | };
|
16582 | if (!IS_REACT_16) {
|
16583 | this.renderComponent(null, triggerAfterPopupVisibleChange);
|
16584 | }
|
16585 |
|
16586 | this.prevPopupVisible = prevState.popupVisible;
|
16587 |
|
16588 |
|
16589 |
|
16590 |
|
16591 |
|
16592 | if (state.popupVisible) {
|
16593 | var currentDocument = void 0;
|
16594 | if (!this.clickOutsideHandler && (this.isClickToHide() || this.isContextMenuToShow())) {
|
16595 | currentDocument = props.getDocument();
|
16596 | this.clickOutsideHandler = (0, _addEventListener2['default'])(currentDocument, 'mousedown', this.onDocumentClick);
|
16597 | }
|
16598 |
|
16599 | if (!this.touchOutsideHandler) {
|
16600 | currentDocument = currentDocument || props.getDocument();
|
16601 | this.touchOutsideHandler = (0, _addEventListener2['default'])(currentDocument, 'touchstart', this.onDocumentClick);
|
16602 | }
|
16603 |
|
16604 | if (!this.contextMenuOutsideHandler1 && this.isContextMenuToShow()) {
|
16605 | currentDocument = currentDocument || props.getDocument();
|
16606 | this.contextMenuOutsideHandler1 = (0, _addEventListener2['default'])(currentDocument, 'scroll', this.onContextMenuClose);
|
16607 | }
|
16608 |
|
16609 | if (!this.contextMenuOutsideHandler2 && this.isContextMenuToShow()) {
|
16610 | this.contextMenuOutsideHandler2 = (0, _addEventListener2['default'])(window, 'blur', this.onContextMenuClose);
|
16611 | }
|
16612 | return;
|
16613 | }
|
16614 |
|
16615 | this.clearOutsideHandler();
|
16616 | };
|
16617 |
|
16618 | Trigger.prototype.componentWillUnmount = function componentWillUnmount() {
|
16619 | this.clearDelayTimer();
|
16620 | this.clearOutsideHandler();
|
16621 | clearTimeout(this.mouseDownTimeout);
|
16622 | };
|
16623 |
|
16624 | Trigger.prototype.getPopupDomNode = function getPopupDomNode() {
|
16625 |
|
16626 | if (this._component && this._component.getPopupDomNode) {
|
16627 | return this._component.getPopupDomNode();
|
16628 | }
|
16629 | return null;
|
16630 | };
|
16631 |
|
16632 | Trigger.prototype.getPopupAlign = function getPopupAlign() {
|
16633 | var props = this.props;
|
16634 | var popupPlacement = props.popupPlacement,
|
16635 | popupAlign = props.popupAlign,
|
16636 | builtinPlacements = props.builtinPlacements;
|
16637 |
|
16638 | if (popupPlacement && builtinPlacements) {
|
16639 | return (0, _utils.getAlignFromPlacement)(builtinPlacements, popupPlacement, popupAlign);
|
16640 | }
|
16641 | return popupAlign;
|
16642 | };
|
16643 |
|
16644 | |
16645 |
|
16646 |
|
16647 |
|
16648 | Trigger.prototype.setPopupVisible = function setPopupVisible(popupVisible, event) {
|
16649 | var alignPoint = this.props.alignPoint;
|
16650 |
|
16651 |
|
16652 | this.clearDelayTimer();
|
16653 |
|
16654 | if (this.state.popupVisible !== popupVisible) {
|
16655 | if (!('popupVisible' in this.props)) {
|
16656 | this.setState({ popupVisible: popupVisible });
|
16657 | }
|
16658 | this.props.onPopupVisibleChange(popupVisible);
|
16659 | }
|
16660 |
|
16661 |
|
16662 | if (alignPoint && event) {
|
16663 | this.setPoint(event);
|
16664 | }
|
16665 | };
|
16666 |
|
16667 | Trigger.prototype.delaySetPopupVisible = function delaySetPopupVisible(visible, delayS, event) {
|
16668 | var _this3 = this;
|
16669 |
|
16670 | var delay = delayS * 1000;
|
16671 | this.clearDelayTimer();
|
16672 | if (delay) {
|
16673 | var point = event ? { pageX: event.pageX, pageY: event.pageY } : null;
|
16674 | this.delayTimer = setTimeout(function () {
|
16675 | _this3.setPopupVisible(visible, point);
|
16676 | _this3.clearDelayTimer();
|
16677 | }, delay);
|
16678 | } else {
|
16679 | this.setPopupVisible(visible, event);
|
16680 | }
|
16681 | };
|
16682 |
|
16683 | Trigger.prototype.clearDelayTimer = function clearDelayTimer() {
|
16684 | if (this.delayTimer) {
|
16685 | clearTimeout(this.delayTimer);
|
16686 | this.delayTimer = null;
|
16687 | }
|
16688 | };
|
16689 |
|
16690 | Trigger.prototype.clearOutsideHandler = function clearOutsideHandler() {
|
16691 | if (this.clickOutsideHandler) {
|
16692 | this.clickOutsideHandler.remove();
|
16693 | this.clickOutsideHandler = null;
|
16694 | }
|
16695 |
|
16696 | if (this.contextMenuOutsideHandler1) {
|
16697 | this.contextMenuOutsideHandler1.remove();
|
16698 | this.contextMenuOutsideHandler1 = null;
|
16699 | }
|
16700 |
|
16701 | if (this.contextMenuOutsideHandler2) {
|
16702 | this.contextMenuOutsideHandler2.remove();
|
16703 | this.contextMenuOutsideHandler2 = null;
|
16704 | }
|
16705 |
|
16706 | if (this.touchOutsideHandler) {
|
16707 | this.touchOutsideHandler.remove();
|
16708 | this.touchOutsideHandler = null;
|
16709 | }
|
16710 | };
|
16711 |
|
16712 | Trigger.prototype.createTwoChains = function createTwoChains(event) {
|
16713 | var childPros = this.props.children.props;
|
16714 | var props = this.props;
|
16715 | if (childPros[event] && props[event]) {
|
16716 | return this['fire' + event];
|
16717 | }
|
16718 | return childPros[event] || props[event];
|
16719 | };
|
16720 |
|
16721 | Trigger.prototype.isClickToShow = function isClickToShow() {
|
16722 | var _props = this.props,
|
16723 | action = _props.action,
|
16724 | showAction = _props.showAction;
|
16725 |
|
16726 | return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1;
|
16727 | };
|
16728 |
|
16729 | Trigger.prototype.isContextMenuToShow = function isContextMenuToShow() {
|
16730 | var _props2 = this.props,
|
16731 | action = _props2.action,
|
16732 | showAction = _props2.showAction;
|
16733 |
|
16734 | return action.indexOf('contextMenu') !== -1 || showAction.indexOf('contextMenu') !== -1;
|
16735 | };
|
16736 |
|
16737 | Trigger.prototype.isClickToHide = function isClickToHide() {
|
16738 | var _props3 = this.props,
|
16739 | action = _props3.action,
|
16740 | hideAction = _props3.hideAction;
|
16741 |
|
16742 | return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1;
|
16743 | };
|
16744 |
|
16745 | Trigger.prototype.isMouseEnterToShow = function isMouseEnterToShow() {
|
16746 | var _props4 = this.props,
|
16747 | action = _props4.action,
|
16748 | showAction = _props4.showAction;
|
16749 |
|
16750 | return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1;
|
16751 | };
|
16752 |
|
16753 | Trigger.prototype.isMouseLeaveToHide = function isMouseLeaveToHide() {
|
16754 | var _props5 = this.props,
|
16755 | action = _props5.action,
|
16756 | hideAction = _props5.hideAction;
|
16757 |
|
16758 | return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1;
|
16759 | };
|
16760 |
|
16761 | Trigger.prototype.isFocusToShow = function isFocusToShow() {
|
16762 | var _props6 = this.props,
|
16763 | action = _props6.action,
|
16764 | showAction = _props6.showAction;
|
16765 |
|
16766 | return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1;
|
16767 | };
|
16768 |
|
16769 | Trigger.prototype.isBlurToHide = function isBlurToHide() {
|
16770 | var _props7 = this.props,
|
16771 | action = _props7.action,
|
16772 | hideAction = _props7.hideAction;
|
16773 |
|
16774 | return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1;
|
16775 | };
|
16776 |
|
16777 | Trigger.prototype.forcePopupAlign = function forcePopupAlign() {
|
16778 | if (this.state.popupVisible && this._component && this._component.alignInstance) {
|
16779 | this._component.alignInstance.forceAlign();
|
16780 | }
|
16781 | };
|
16782 |
|
16783 | Trigger.prototype.fireEvents = function fireEvents(type, e) {
|
16784 | var childCallback = this.props.children.props[type];
|
16785 | if (childCallback) {
|
16786 | childCallback(e);
|
16787 | }
|
16788 | var callback = this.props[type];
|
16789 | if (callback) {
|
16790 | callback(e);
|
16791 | }
|
16792 | };
|
16793 |
|
16794 | Trigger.prototype.close = function close() {
|
16795 | this.setPopupVisible(false);
|
16796 | };
|
16797 |
|
16798 | Trigger.prototype.render = function render() {
|
16799 | var _this4 = this;
|
16800 |
|
16801 | var popupVisible = this.state.popupVisible;
|
16802 | var _props8 = this.props,
|
16803 | children = _props8.children,
|
16804 | forceRender = _props8.forceRender,
|
16805 | alignPoint = _props8.alignPoint,
|
16806 | className = _props8.className;
|
16807 |
|
16808 | var child = _react2['default'].Children.only(children);
|
16809 | var newChildProps = { key: 'trigger' };
|
16810 |
|
16811 | if (this.isContextMenuToShow()) {
|
16812 | newChildProps.onContextMenu = this.onContextMenu;
|
16813 | } else {
|
16814 | newChildProps.onContextMenu = this.createTwoChains('onContextMenu');
|
16815 | }
|
16816 |
|
16817 | if (this.isClickToHide() || this.isClickToShow()) {
|
16818 | newChildProps.onClick = this.onClick;
|
16819 | newChildProps.onMouseDown = this.onMouseDown;
|
16820 | newChildProps.onTouchStart = this.onTouchStart;
|
16821 | } else {
|
16822 | newChildProps.onClick = this.createTwoChains('onClick');
|
16823 | newChildProps.onMouseDown = this.createTwoChains('onMouseDown');
|
16824 | newChildProps.onTouchStart = this.createTwoChains('onTouchStart');
|
16825 | }
|
16826 | if (this.isMouseEnterToShow()) {
|
16827 | newChildProps.onMouseEnter = this.onMouseEnter;
|
16828 | if (alignPoint) {
|
16829 | newChildProps.onMouseMove = this.onMouseMove;
|
16830 | }
|
16831 | } else {
|
16832 | newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter');
|
16833 | }
|
16834 | if (this.isMouseLeaveToHide()) {
|
16835 | newChildProps.onMouseLeave = this.onMouseLeave;
|
16836 | } else {
|
16837 | newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave');
|
16838 | }
|
16839 | if (this.isFocusToShow() || this.isBlurToHide()) {
|
16840 | newChildProps.onFocus = this.onFocus;
|
16841 | newChildProps.onBlur = this.onBlur;
|
16842 | } else {
|
16843 | newChildProps.onFocus = this.createTwoChains('onFocus');
|
16844 | newChildProps.onBlur = this.createTwoChains('onBlur');
|
16845 | }
|
16846 |
|
16847 | var childrenClassName = (0, _classnames2['default'])(child && child.props && child.props.className, className);
|
16848 | if (childrenClassName) {
|
16849 | newChildProps.className = childrenClassName;
|
16850 | }
|
16851 | var trigger = _react2['default'].cloneElement(child, newChildProps);
|
16852 |
|
16853 | if (!IS_REACT_16) {
|
16854 | return _react2['default'].createElement(
|
16855 | _ContainerRender2['default'],
|
16856 | {
|
16857 | parent: this,
|
16858 | visible: popupVisible,
|
16859 | autoMount: false,
|
16860 | forceRender: forceRender,
|
16861 | getComponent: this.getComponent,
|
16862 | getContainer: this.getContainer
|
16863 | },
|
16864 | function (_ref2) {
|
16865 | var renderComponent = _ref2.renderComponent;
|
16866 |
|
16867 | _this4.renderComponent = renderComponent;
|
16868 | return trigger;
|
16869 | }
|
16870 | );
|
16871 | }
|
16872 |
|
16873 | var portal = void 0;
|
16874 |
|
16875 | if (popupVisible || this._component || forceRender) {
|
16876 | portal = _react2['default'].createElement(
|
16877 | _Portal2['default'],
|
16878 | {
|
16879 | key: 'portal',
|
16880 | getContainer: this.getContainer,
|
16881 | didUpdate: this.handlePortalUpdate
|
16882 | },
|
16883 | this.getComponent()
|
16884 | );
|
16885 | }
|
16886 |
|
16887 | return [trigger, portal];
|
16888 | };
|
16889 |
|
16890 | return Trigger;
|
16891 | }(_react2['default'].Component);
|
16892 |
|
16893 | Trigger.propTypes = {
|
16894 | children: _propTypes2['default'].any,
|
16895 | action: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].arrayOf(_propTypes2['default'].string)]),
|
16896 | showAction: _propTypes2['default'].any,
|
16897 | hideAction: _propTypes2['default'].any,
|
16898 | getPopupClassNameFromAlign: _propTypes2['default'].any,
|
16899 | onPopupVisibleChange: _propTypes2['default'].func,
|
16900 | afterPopupVisibleChange: _propTypes2['default'].func,
|
16901 | popup: _propTypes2['default'].oneOfType([_propTypes2['default'].node, _propTypes2['default'].func]).isRequired,
|
16902 | popupStyle: _propTypes2['default'].object,
|
16903 | prefixCls: _propTypes2['default'].string,
|
16904 | popupClassName: _propTypes2['default'].string,
|
16905 | className: _propTypes2['default'].string,
|
16906 | popupPlacement: _propTypes2['default'].string,
|
16907 | builtinPlacements: _propTypes2['default'].object,
|
16908 | popupTransitionName: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].object]),
|
16909 | popupAnimation: _propTypes2['default'].any,
|
16910 | mouseEnterDelay: _propTypes2['default'].number,
|
16911 | mouseLeaveDelay: _propTypes2['default'].number,
|
16912 | zIndex: _propTypes2['default'].number,
|
16913 | focusDelay: _propTypes2['default'].number,
|
16914 | blurDelay: _propTypes2['default'].number,
|
16915 | getPopupContainer: _propTypes2['default'].func,
|
16916 | getDocument: _propTypes2['default'].func,
|
16917 | forceRender: _propTypes2['default'].bool,
|
16918 | destroyPopupOnHide: _propTypes2['default'].bool,
|
16919 | mask: _propTypes2['default'].bool,
|
16920 | maskClosable: _propTypes2['default'].bool,
|
16921 | onPopupAlign: _propTypes2['default'].func,
|
16922 | popupAlign: _propTypes2['default'].object,
|
16923 | popupVisible: _propTypes2['default'].bool,
|
16924 | defaultPopupVisible: _propTypes2['default'].bool,
|
16925 | maskTransitionName: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].object]),
|
16926 | maskAnimation: _propTypes2['default'].string,
|
16927 | stretch: _propTypes2['default'].string,
|
16928 | alignPoint: _propTypes2['default'].bool
|
16929 | };
|
16930 | Trigger.contextTypes = contextTypes;
|
16931 | Trigger.childContextTypes = contextTypes;
|
16932 | Trigger.defaultProps = {
|
16933 | prefixCls: 'rc-trigger-popup',
|
16934 | getPopupClassNameFromAlign: returnEmptyString,
|
16935 | getDocument: returnDocument,
|
16936 | onPopupVisibleChange: noop,
|
16937 | afterPopupVisibleChange: noop,
|
16938 | onPopupAlign: noop,
|
16939 | popupClassName: '',
|
16940 | mouseEnterDelay: 0,
|
16941 | mouseLeaveDelay: 0.1,
|
16942 | focusDelay: 0,
|
16943 | blurDelay: 0.15,
|
16944 | popupStyle: {},
|
16945 | destroyPopupOnHide: false,
|
16946 | popupAlign: {},
|
16947 | defaultPopupVisible: false,
|
16948 | mask: false,
|
16949 | maskClosable: true,
|
16950 | action: [],
|
16951 | showAction: [],
|
16952 | hideAction: []
|
16953 | };
|
16954 |
|
16955 | var _initialiseProps = function _initialiseProps() {
|
16956 | var _this5 = this;
|
16957 |
|
16958 | this.onMouseEnter = function (e) {
|
16959 | var mouseEnterDelay = _this5.props.mouseEnterDelay;
|
16960 |
|
16961 | _this5.fireEvents('onMouseEnter', e);
|
16962 | _this5.delaySetPopupVisible(true, mouseEnterDelay, mouseEnterDelay ? null : e);
|
16963 | };
|
16964 |
|
16965 | this.onMouseMove = function (e) {
|
16966 | _this5.fireEvents('onMouseMove', e);
|
16967 | _this5.setPoint(e);
|
16968 | };
|
16969 |
|
16970 | this.onMouseLeave = function (e) {
|
16971 | _this5.fireEvents('onMouseLeave', e);
|
16972 | _this5.delaySetPopupVisible(false, _this5.props.mouseLeaveDelay);
|
16973 | };
|
16974 |
|
16975 | this.onPopupMouseEnter = function () {
|
16976 | _this5.clearDelayTimer();
|
16977 | };
|
16978 |
|
16979 | this.onPopupMouseLeave = function (e) {
|
16980 |
|
16981 |
|
16982 | if (e.relatedTarget && !e.relatedTarget.setTimeout && _this5._component && _this5._component.getPopupDomNode && (0, _contains2['default'])(_this5._component.getPopupDomNode(), e.relatedTarget)) {
|
16983 | return;
|
16984 | }
|
16985 | _this5.delaySetPopupVisible(false, _this5.props.mouseLeaveDelay);
|
16986 | };
|
16987 |
|
16988 | this.onFocus = function (e) {
|
16989 | _this5.fireEvents('onFocus', e);
|
16990 |
|
16991 | _this5.clearDelayTimer();
|
16992 | if (_this5.isFocusToShow()) {
|
16993 | _this5.focusTime = Date.now();
|
16994 | _this5.delaySetPopupVisible(true, _this5.props.focusDelay);
|
16995 | }
|
16996 | };
|
16997 |
|
16998 | this.onMouseDown = function (e) {
|
16999 | _this5.fireEvents('onMouseDown', e);
|
17000 | _this5.preClickTime = Date.now();
|
17001 | };
|
17002 |
|
17003 | this.onTouchStart = function (e) {
|
17004 | _this5.fireEvents('onTouchStart', e);
|
17005 | _this5.preTouchTime = Date.now();
|
17006 | };
|
17007 |
|
17008 | this.onBlur = function (e) {
|
17009 | _this5.fireEvents('onBlur', e);
|
17010 | _this5.clearDelayTimer();
|
17011 | if (_this5.isBlurToHide()) {
|
17012 | _this5.delaySetPopupVisible(false, _this5.props.blurDelay);
|
17013 | }
|
17014 | };
|
17015 |
|
17016 | this.onContextMenu = function (e) {
|
17017 | e.preventDefault();
|
17018 | _this5.fireEvents('onContextMenu', e);
|
17019 | _this5.setPopupVisible(true, e);
|
17020 | };
|
17021 |
|
17022 | this.onContextMenuClose = function () {
|
17023 | if (_this5.isContextMenuToShow()) {
|
17024 | _this5.close();
|
17025 | }
|
17026 | };
|
17027 |
|
17028 | this.onClick = function (event) {
|
17029 | _this5.fireEvents('onClick', event);
|
17030 |
|
17031 | if (_this5.focusTime) {
|
17032 | var preTime = void 0;
|
17033 | if (_this5.preClickTime && _this5.preTouchTime) {
|
17034 | preTime = Math.min(_this5.preClickTime, _this5.preTouchTime);
|
17035 | } else if (_this5.preClickTime) {
|
17036 | preTime = _this5.preClickTime;
|
17037 | } else if (_this5.preTouchTime) {
|
17038 | preTime = _this5.preTouchTime;
|
17039 | }
|
17040 | if (Math.abs(preTime - _this5.focusTime) < 20) {
|
17041 | return;
|
17042 | }
|
17043 | _this5.focusTime = 0;
|
17044 | }
|
17045 | _this5.preClickTime = 0;
|
17046 | _this5.preTouchTime = 0;
|
17047 | if (event && event.preventDefault) {
|
17048 | event.preventDefault();
|
17049 | }
|
17050 | var nextVisible = !_this5.state.popupVisible;
|
17051 | if (_this5.isClickToHide() && !nextVisible || nextVisible && _this5.isClickToShow()) {
|
17052 | _this5.setPopupVisible(!_this5.state.popupVisible, event);
|
17053 | }
|
17054 | };
|
17055 |
|
17056 | this.onPopupMouseDown = function () {
|
17057 | var _context$rcTrigger = _this5.context.rcTrigger,
|
17058 | rcTrigger = _context$rcTrigger === undefined ? {} : _context$rcTrigger;
|
17059 |
|
17060 | _this5.hasPopupMouseDown = true;
|
17061 |
|
17062 | clearTimeout(_this5.mouseDownTimeout);
|
17063 | _this5.mouseDownTimeout = setTimeout(function () {
|
17064 | _this5.hasPopupMouseDown = false;
|
17065 | }, 0);
|
17066 |
|
17067 | if (rcTrigger.onPopupMouseDown) {
|
17068 | rcTrigger.onPopupMouseDown.apply(rcTrigger, arguments);
|
17069 | }
|
17070 | };
|
17071 |
|
17072 | this.onDocumentClick = function (event) {
|
17073 | if (_this5.props.mask && !_this5.props.maskClosable) {
|
17074 | return;
|
17075 | }
|
17076 |
|
17077 | var target = event.target;
|
17078 | var root = (0, _reactDom.findDOMNode)(_this5);
|
17079 | if (!(0, _contains2['default'])(root, target) && !_this5.hasPopupMouseDown) {
|
17080 | _this5.close();
|
17081 | }
|
17082 | };
|
17083 |
|
17084 | this.getRootDomNode = function () {
|
17085 | return (0, _reactDom.findDOMNode)(_this5);
|
17086 | };
|
17087 |
|
17088 | this.getPopupClassNameFromAlign = function (align) {
|
17089 | var className = [];
|
17090 | var _props9 = _this5.props,
|
17091 | popupPlacement = _props9.popupPlacement,
|
17092 | builtinPlacements = _props9.builtinPlacements,
|
17093 | prefixCls = _props9.prefixCls,
|
17094 | alignPoint = _props9.alignPoint,
|
17095 | getPopupClassNameFromAlign = _props9.getPopupClassNameFromAlign;
|
17096 |
|
17097 | if (popupPlacement && builtinPlacements) {
|
17098 | className.push((0, _utils.getAlignPopupClassName)(builtinPlacements, prefixCls, align, alignPoint));
|
17099 | }
|
17100 | if (getPopupClassNameFromAlign) {
|
17101 | className.push(getPopupClassNameFromAlign(align));
|
17102 | }
|
17103 | return className.join(' ');
|
17104 | };
|
17105 |
|
17106 | this.getComponent = function () {
|
17107 | var _props10 = _this5.props,
|
17108 | prefixCls = _props10.prefixCls,
|
17109 | destroyPopupOnHide = _props10.destroyPopupOnHide,
|
17110 | popupClassName = _props10.popupClassName,
|
17111 | action = _props10.action,
|
17112 | onPopupAlign = _props10.onPopupAlign,
|
17113 | popupAnimation = _props10.popupAnimation,
|
17114 | popupTransitionName = _props10.popupTransitionName,
|
17115 | popupStyle = _props10.popupStyle,
|
17116 | mask = _props10.mask,
|
17117 | maskAnimation = _props10.maskAnimation,
|
17118 | maskTransitionName = _props10.maskTransitionName,
|
17119 | zIndex = _props10.zIndex,
|
17120 | popup = _props10.popup,
|
17121 | stretch = _props10.stretch,
|
17122 | alignPoint = _props10.alignPoint;
|
17123 | var _state = _this5.state,
|
17124 | popupVisible = _state.popupVisible,
|
17125 | point = _state.point;
|
17126 |
|
17127 |
|
17128 | var align = _this5.getPopupAlign();
|
17129 |
|
17130 | var mouseProps = {};
|
17131 | if (_this5.isMouseEnterToShow()) {
|
17132 | mouseProps.onMouseEnter = _this5.onPopupMouseEnter;
|
17133 | }
|
17134 | if (_this5.isMouseLeaveToHide()) {
|
17135 | mouseProps.onMouseLeave = _this5.onPopupMouseLeave;
|
17136 | }
|
17137 |
|
17138 | mouseProps.onMouseDown = _this5.onPopupMouseDown;
|
17139 | mouseProps.onTouchStart = _this5.onPopupMouseDown;
|
17140 |
|
17141 | return _react2['default'].createElement(
|
17142 | _Popup2['default'],
|
17143 | (0, _extends3['default'])({
|
17144 | prefixCls: prefixCls,
|
17145 | destroyPopupOnHide: destroyPopupOnHide,
|
17146 | visible: popupVisible,
|
17147 | point: alignPoint && point,
|
17148 | className: popupClassName,
|
17149 | action: action,
|
17150 | align: align,
|
17151 | onAlign: onPopupAlign,
|
17152 | animation: popupAnimation,
|
17153 | getClassNameFromAlign: _this5.getPopupClassNameFromAlign
|
17154 | }, mouseProps, {
|
17155 | stretch: stretch,
|
17156 | getRootDomNode: _this5.getRootDomNode,
|
17157 | style: popupStyle,
|
17158 | mask: mask,
|
17159 | zIndex: zIndex,
|
17160 | transitionName: popupTransitionName,
|
17161 | maskAnimation: maskAnimation,
|
17162 | maskTransitionName: maskTransitionName,
|
17163 | ref: _this5.savePopup
|
17164 | }),
|
17165 | typeof popup === 'function' ? popup() : popup
|
17166 | );
|
17167 | };
|
17168 |
|
17169 | this.getContainer = function () {
|
17170 | var props = _this5.props;
|
17171 |
|
17172 | var popupContainer = document.createElement('div');
|
17173 |
|
17174 |
|
17175 | popupContainer.style.position = 'absolute';
|
17176 | popupContainer.style.top = '0';
|
17177 | popupContainer.style.left = '0';
|
17178 | popupContainer.style.width = '100%';
|
17179 | var mountNode = props.getPopupContainer ? props.getPopupContainer((0, _reactDom.findDOMNode)(_this5)) : props.getDocument().body;
|
17180 | mountNode.appendChild(popupContainer);
|
17181 | return popupContainer;
|
17182 | };
|
17183 |
|
17184 | this.setPoint = function (point) {
|
17185 | var alignPoint = _this5.props.alignPoint;
|
17186 |
|
17187 | if (!alignPoint || !point) return;
|
17188 |
|
17189 | _this5.setState({
|
17190 | point: {
|
17191 | pageX: point.pageX,
|
17192 | pageY: point.pageY
|
17193 | }
|
17194 | });
|
17195 | };
|
17196 |
|
17197 | this.handlePortalUpdate = function () {
|
17198 | if (_this5.prevPopupVisible !== _this5.state.popupVisible) {
|
17199 | _this5.props.afterPopupVisibleChange(_this5.state.popupVisible);
|
17200 | }
|
17201 | };
|
17202 |
|
17203 | this.savePopup = function (node) {
|
17204 | _this5._component = node;
|
17205 | };
|
17206 | };
|
17207 |
|
17208 | exports['default'] = Trigger;
|
17209 | module.exports = exports['default'];
|
17210 |
|
17211 | }),
|
17212 |
|
17213 | (function(module, exports) {
|
17214 |
|
17215 | "use strict";
|
17216 |
|
17217 | Object.defineProperty(exports, "__esModule", {
|
17218 | value: true
|
17219 | });
|
17220 | exports["default"] = contains;
|
17221 | function contains(root, n) {
|
17222 | var node = n;
|
17223 | while (node) {
|
17224 | if (node === root) {
|
17225 | return true;
|
17226 | }
|
17227 | node = node.parentNode;
|
17228 | }
|
17229 |
|
17230 | return false;
|
17231 | }
|
17232 | module.exports = exports['default'];
|
17233 |
|
17234 | }),
|
17235 |
|
17236 | (function(module, exports, __webpack_require__) {
|
17237 |
|
17238 | 'use strict';
|
17239 |
|
17240 | Object.defineProperty(exports, "__esModule", {
|
17241 | value: true
|
17242 | });
|
17243 | exports['default'] = addEventListenerWrap;
|
17244 |
|
17245 | var _addDomEventListener = __webpack_require__(41);
|
17246 |
|
17247 | var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener);
|
17248 |
|
17249 | var _reactDom = __webpack_require__(12);
|
17250 |
|
17251 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
17252 |
|
17253 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
17254 |
|
17255 | function addEventListenerWrap(target, eventType, cb, option) {
|
17256 |
|
17257 | var callback = _reactDom2['default'].unstable_batchedUpdates ? function run(e) {
|
17258 | _reactDom2['default'].unstable_batchedUpdates(cb, e);
|
17259 | } : cb;
|
17260 | return (0, _addDomEventListener2['default'])(target, eventType, callback, option);
|
17261 | }
|
17262 | module.exports = exports['default'];
|
17263 |
|
17264 | }),
|
17265 |
|
17266 | (function(module, exports, __webpack_require__) {
|
17267 |
|
17268 | 'use strict';
|
17269 |
|
17270 | Object.defineProperty(exports, "__esModule", {
|
17271 | value: true
|
17272 | });
|
17273 |
|
17274 | var _classCallCheck2 = __webpack_require__(134);
|
17275 |
|
17276 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
17277 |
|
17278 | var _createClass2 = __webpack_require__(199);
|
17279 |
|
17280 | var _createClass3 = _interopRequireDefault(_createClass2);
|
17281 |
|
17282 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
17283 |
|
17284 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
17285 |
|
17286 | var _inherits2 = __webpack_require__(169);
|
17287 |
|
17288 | var _inherits3 = _interopRequireDefault(_inherits2);
|
17289 |
|
17290 | var _react = __webpack_require__(4);
|
17291 |
|
17292 | var _react2 = _interopRequireDefault(_react);
|
17293 |
|
17294 | var _reactDom = __webpack_require__(12);
|
17295 |
|
17296 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
17297 |
|
17298 | var _propTypes = __webpack_require__(5);
|
17299 |
|
17300 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
17301 |
|
17302 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
17303 |
|
17304 | var ContainerRender = function (_React$Component) {
|
17305 | (0, _inherits3['default'])(ContainerRender, _React$Component);
|
17306 |
|
17307 | function ContainerRender() {
|
17308 | var _ref;
|
17309 |
|
17310 | var _temp, _this, _ret;
|
17311 |
|
17312 | (0, _classCallCheck3['default'])(this, ContainerRender);
|
17313 |
|
17314 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
17315 | args[_key] = arguments[_key];
|
17316 | }
|
17317 |
|
17318 | return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, (_ref = ContainerRender.__proto__ || Object.getPrototypeOf(ContainerRender)).call.apply(_ref, [this].concat(args))), _this), _this.removeContainer = function () {
|
17319 | if (_this.container) {
|
17320 | _reactDom2['default'].unmountComponentAtNode(_this.container);
|
17321 | _this.container.parentNode.removeChild(_this.container);
|
17322 | _this.container = null;
|
17323 | }
|
17324 | }, _this.renderComponent = function (props, ready) {
|
17325 | var _this$props = _this.props,
|
17326 | visible = _this$props.visible,
|
17327 | getComponent = _this$props.getComponent,
|
17328 | forceRender = _this$props.forceRender,
|
17329 | getContainer = _this$props.getContainer,
|
17330 | parent = _this$props.parent;
|
17331 |
|
17332 | if (visible || parent._component || forceRender) {
|
17333 | if (!_this.container) {
|
17334 | _this.container = getContainer();
|
17335 | }
|
17336 | _reactDom2['default'].unstable_renderSubtreeIntoContainer(parent, getComponent(props), _this.container, function callback() {
|
17337 | if (ready) {
|
17338 | ready.call(this);
|
17339 | }
|
17340 | });
|
17341 | }
|
17342 | }, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret);
|
17343 | }
|
17344 |
|
17345 | (0, _createClass3['default'])(ContainerRender, [{
|
17346 | key: 'componentDidMount',
|
17347 | value: function componentDidMount() {
|
17348 | if (this.props.autoMount) {
|
17349 | this.renderComponent();
|
17350 | }
|
17351 | }
|
17352 | }, {
|
17353 | key: 'componentDidUpdate',
|
17354 | value: function componentDidUpdate() {
|
17355 | if (this.props.autoMount) {
|
17356 | this.renderComponent();
|
17357 | }
|
17358 | }
|
17359 | }, {
|
17360 | key: 'componentWillUnmount',
|
17361 | value: function componentWillUnmount() {
|
17362 | if (this.props.autoDestroy) {
|
17363 | this.removeContainer();
|
17364 | }
|
17365 | }
|
17366 | }, {
|
17367 | key: 'render',
|
17368 | value: function render() {
|
17369 | return this.props.children({
|
17370 | renderComponent: this.renderComponent,
|
17371 | removeContainer: this.removeContainer
|
17372 | });
|
17373 | }
|
17374 | }]);
|
17375 | return ContainerRender;
|
17376 | }(_react2['default'].Component);
|
17377 |
|
17378 | ContainerRender.propTypes = {
|
17379 | autoMount: _propTypes2['default'].bool,
|
17380 | autoDestroy: _propTypes2['default'].bool,
|
17381 | visible: _propTypes2['default'].bool,
|
17382 | forceRender: _propTypes2['default'].bool,
|
17383 | parent: _propTypes2['default'].any,
|
17384 | getComponent: _propTypes2['default'].func.isRequired,
|
17385 | getContainer: _propTypes2['default'].func.isRequired,
|
17386 | children: _propTypes2['default'].func.isRequired
|
17387 | };
|
17388 | ContainerRender.defaultProps = {
|
17389 | autoMount: true,
|
17390 | autoDestroy: true,
|
17391 | forceRender: false
|
17392 | };
|
17393 | exports['default'] = ContainerRender;
|
17394 | module.exports = exports['default'];
|
17395 |
|
17396 | }),
|
17397 |
|
17398 | (function(module, exports, __webpack_require__) {
|
17399 |
|
17400 | "use strict";
|
17401 |
|
17402 | exports.__esModule = true;
|
17403 |
|
17404 | var _defineProperty = __webpack_require__(200);
|
17405 |
|
17406 | var _defineProperty2 = _interopRequireDefault(_defineProperty);
|
17407 |
|
17408 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17409 |
|
17410 | exports.default = function () {
|
17411 | function defineProperties(target, props) {
|
17412 | for (var i = 0; i < props.length; i++) {
|
17413 | var descriptor = props[i];
|
17414 | descriptor.enumerable = descriptor.enumerable || false;
|
17415 | descriptor.configurable = true;
|
17416 | if ("value" in descriptor) descriptor.writable = true;
|
17417 | (0, _defineProperty2.default)(target, descriptor.key, descriptor);
|
17418 | }
|
17419 | }
|
17420 |
|
17421 | return function (Constructor, protoProps, staticProps) {
|
17422 | if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
17423 | if (staticProps) defineProperties(Constructor, staticProps);
|
17424 | return Constructor;
|
17425 | };
|
17426 | }();
|
17427 |
|
17428 | }),
|
17429 |
|
17430 | (function(module, exports, __webpack_require__) {
|
17431 |
|
17432 | module.exports = { "default": __webpack_require__(201), __esModule: true };
|
17433 |
|
17434 | }),
|
17435 |
|
17436 | (function(module, exports, __webpack_require__) {
|
17437 |
|
17438 | __webpack_require__(202);
|
17439 | var $Object = __webpack_require__(100).Object;
|
17440 | module.exports = function defineProperty(it, key, desc) {
|
17441 | return $Object.defineProperty(it, key, desc);
|
17442 | };
|
17443 |
|
17444 |
|
17445 | }),
|
17446 |
|
17447 | (function(module, exports, __webpack_require__) {
|
17448 |
|
17449 | var $export = __webpack_require__(98);
|
17450 |
|
17451 | $export($export.S + $export.F * !__webpack_require__(108), 'Object', { defineProperty: __webpack_require__(104).f });
|
17452 |
|
17453 |
|
17454 | }),
|
17455 |
|
17456 | (function(module, exports, __webpack_require__) {
|
17457 |
|
17458 | 'use strict';
|
17459 |
|
17460 | Object.defineProperty(exports, "__esModule", {
|
17461 | value: true
|
17462 | });
|
17463 |
|
17464 | var _classCallCheck2 = __webpack_require__(134);
|
17465 |
|
17466 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
17467 |
|
17468 | var _createClass2 = __webpack_require__(199);
|
17469 |
|
17470 | var _createClass3 = _interopRequireDefault(_createClass2);
|
17471 |
|
17472 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
17473 |
|
17474 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
17475 |
|
17476 | var _inherits2 = __webpack_require__(169);
|
17477 |
|
17478 | var _inherits3 = _interopRequireDefault(_inherits2);
|
17479 |
|
17480 | var _react = __webpack_require__(4);
|
17481 |
|
17482 | var _react2 = _interopRequireDefault(_react);
|
17483 |
|
17484 | var _reactDom = __webpack_require__(12);
|
17485 |
|
17486 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
17487 |
|
17488 | var _propTypes = __webpack_require__(5);
|
17489 |
|
17490 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
17491 |
|
17492 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
17493 |
|
17494 | var Portal = function (_React$Component) {
|
17495 | (0, _inherits3['default'])(Portal, _React$Component);
|
17496 |
|
17497 | function Portal() {
|
17498 | (0, _classCallCheck3['default'])(this, Portal);
|
17499 | return (0, _possibleConstructorReturn3['default'])(this, (Portal.__proto__ || Object.getPrototypeOf(Portal)).apply(this, arguments));
|
17500 | }
|
17501 |
|
17502 | (0, _createClass3['default'])(Portal, [{
|
17503 | key: 'componentDidMount',
|
17504 | value: function componentDidMount() {
|
17505 | this.createContainer();
|
17506 | }
|
17507 | }, {
|
17508 | key: 'componentDidUpdate',
|
17509 | value: function componentDidUpdate(prevProps) {
|
17510 | var didUpdate = this.props.didUpdate;
|
17511 |
|
17512 | if (didUpdate) {
|
17513 | didUpdate(prevProps);
|
17514 | }
|
17515 | }
|
17516 | }, {
|
17517 | key: 'componentWillUnmount',
|
17518 | value: function componentWillUnmount() {
|
17519 | this.removeContainer();
|
17520 | }
|
17521 | }, {
|
17522 | key: 'createContainer',
|
17523 | value: function createContainer() {
|
17524 | this._container = this.props.getContainer();
|
17525 | this.forceUpdate();
|
17526 | }
|
17527 | }, {
|
17528 | key: 'removeContainer',
|
17529 | value: function removeContainer() {
|
17530 | if (this._container) {
|
17531 | this._container.parentNode.removeChild(this._container);
|
17532 | }
|
17533 | }
|
17534 | }, {
|
17535 | key: 'render',
|
17536 | value: function render() {
|
17537 | if (this._container) {
|
17538 | return _reactDom2['default'].createPortal(this.props.children, this._container);
|
17539 | }
|
17540 | return null;
|
17541 | }
|
17542 | }]);
|
17543 | return Portal;
|
17544 | }(_react2['default'].Component);
|
17545 |
|
17546 | Portal.propTypes = {
|
17547 | getContainer: _propTypes2['default'].func.isRequired,
|
17548 | children: _propTypes2['default'].node.isRequired,
|
17549 | didUpdate: _propTypes2['default'].func
|
17550 | };
|
17551 | exports['default'] = Portal;
|
17552 | module.exports = exports['default'];
|
17553 |
|
17554 | }),
|
17555 |
|
17556 | (function(module, exports, __webpack_require__) {
|
17557 |
|
17558 | 'use strict';
|
17559 |
|
17560 | exports.__esModule = true;
|
17561 |
|
17562 | var _extends2 = __webpack_require__(94);
|
17563 |
|
17564 | var _extends3 = _interopRequireDefault(_extends2);
|
17565 |
|
17566 | exports.getAlignFromPlacement = getAlignFromPlacement;
|
17567 | exports.getAlignPopupClassName = getAlignPopupClassName;
|
17568 | exports.saveRef = saveRef;
|
17569 |
|
17570 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
17571 |
|
17572 | function isPointsEq(a1, a2, isAlignPoint) {
|
17573 | if (isAlignPoint) {
|
17574 | return a1[0] === a2[0];
|
17575 | }
|
17576 | return a1[0] === a2[0] && a1[1] === a2[1];
|
17577 | }
|
17578 |
|
17579 | function getAlignFromPlacement(builtinPlacements, placementStr, align) {
|
17580 | var baseAlign = builtinPlacements[placementStr] || {};
|
17581 | return (0, _extends3['default'])({}, baseAlign, align);
|
17582 | }
|
17583 |
|
17584 | function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
|
17585 | var points = align.points;
|
17586 | for (var placement in builtinPlacements) {
|
17587 | if (builtinPlacements.hasOwnProperty(placement)) {
|
17588 | if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {
|
17589 | return prefixCls + '-placement-' + placement;
|
17590 | }
|
17591 | }
|
17592 | }
|
17593 | return '';
|
17594 | }
|
17595 |
|
17596 | function saveRef(name, component) {
|
17597 | this[name] = component;
|
17598 | }
|
17599 |
|
17600 | }),
|
17601 |
|
17602 | (function(module, exports, __webpack_require__) {
|
17603 |
|
17604 | 'use strict';
|
17605 |
|
17606 | exports.__esModule = true;
|
17607 |
|
17608 | var _extends2 = __webpack_require__(94);
|
17609 |
|
17610 | var _extends3 = _interopRequireDefault(_extends2);
|
17611 |
|
17612 | var _classCallCheck2 = __webpack_require__(134);
|
17613 |
|
17614 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
17615 |
|
17616 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
17617 |
|
17618 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
17619 |
|
17620 | var _inherits2 = __webpack_require__(169);
|
17621 |
|
17622 | var _inherits3 = _interopRequireDefault(_inherits2);
|
17623 |
|
17624 | var _react = __webpack_require__(4);
|
17625 |
|
17626 | var _react2 = _interopRequireDefault(_react);
|
17627 |
|
17628 | var _propTypes = __webpack_require__(5);
|
17629 |
|
17630 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
17631 |
|
17632 | var _reactDom = __webpack_require__(12);
|
17633 |
|
17634 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
17635 |
|
17636 | var _rcAlign = __webpack_require__(206);
|
17637 |
|
17638 | var _rcAlign2 = _interopRequireDefault(_rcAlign);
|
17639 |
|
17640 | var _rcAnimate = __webpack_require__(209);
|
17641 |
|
17642 | var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
|
17643 |
|
17644 | var _PopupInner = __webpack_require__(216);
|
17645 |
|
17646 | var _PopupInner2 = _interopRequireDefault(_PopupInner);
|
17647 |
|
17648 | var _LazyRenderBox = __webpack_require__(217);
|
17649 |
|
17650 | var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox);
|
17651 |
|
17652 | var _utils = __webpack_require__(204);
|
17653 |
|
17654 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
17655 |
|
17656 | var Popup = function (_Component) {
|
17657 | (0, _inherits3['default'])(Popup, _Component);
|
17658 |
|
17659 | function Popup(props) {
|
17660 | (0, _classCallCheck3['default'])(this, Popup);
|
17661 |
|
17662 | var _this = (0, _possibleConstructorReturn3['default'])(this, _Component.call(this, props));
|
17663 |
|
17664 | _initialiseProps.call(_this);
|
17665 |
|
17666 | _this.state = {
|
17667 |
|
17668 | stretchChecked: false,
|
17669 | targetWidth: undefined,
|
17670 | targetHeight: undefined
|
17671 | };
|
17672 |
|
17673 | _this.savePopupRef = _utils.saveRef.bind(_this, 'popupInstance');
|
17674 | _this.saveAlignRef = _utils.saveRef.bind(_this, 'alignInstance');
|
17675 | return _this;
|
17676 | }
|
17677 |
|
17678 | Popup.prototype.componentDidMount = function componentDidMount() {
|
17679 | this.rootNode = this.getPopupDomNode();
|
17680 | this.setStretchSize();
|
17681 | };
|
17682 |
|
17683 | Popup.prototype.componentDidUpdate = function componentDidUpdate() {
|
17684 | this.setStretchSize();
|
17685 | };
|
17686 |
|
17687 |
|
17688 |
|
17689 |
|
17690 | Popup.prototype.getPopupDomNode = function getPopupDomNode() {
|
17691 | return _reactDom2['default'].findDOMNode(this.popupInstance);
|
17692 | };
|
17693 |
|
17694 |
|
17695 |
|
17696 |
|
17697 |
|
17698 | Popup.prototype.getMaskTransitionName = function getMaskTransitionName() {
|
17699 | var props = this.props;
|
17700 | var transitionName = props.maskTransitionName;
|
17701 | var animation = props.maskAnimation;
|
17702 | if (!transitionName && animation) {
|
17703 | transitionName = props.prefixCls + '-' + animation;
|
17704 | }
|
17705 | return transitionName;
|
17706 | };
|
17707 |
|
17708 | Popup.prototype.getTransitionName = function getTransitionName() {
|
17709 | var props = this.props;
|
17710 | var transitionName = props.transitionName;
|
17711 | if (!transitionName && props.animation) {
|
17712 | transitionName = props.prefixCls + '-' + props.animation;
|
17713 | }
|
17714 | return transitionName;
|
17715 | };
|
17716 |
|
17717 | Popup.prototype.getClassName = function getClassName(currentAlignClassName) {
|
17718 | return this.props.prefixCls + ' ' + this.props.className + ' ' + currentAlignClassName;
|
17719 | };
|
17720 |
|
17721 | Popup.prototype.getPopupElement = function getPopupElement() {
|
17722 | var _this2 = this;
|
17723 |
|
17724 | var savePopupRef = this.savePopupRef;
|
17725 | var _state = this.state,
|
17726 | stretchChecked = _state.stretchChecked,
|
17727 | targetHeight = _state.targetHeight,
|
17728 | targetWidth = _state.targetWidth;
|
17729 | var _props = this.props,
|
17730 | align = _props.align,
|
17731 | visible = _props.visible,
|
17732 | prefixCls = _props.prefixCls,
|
17733 | style = _props.style,
|
17734 | getClassNameFromAlign = _props.getClassNameFromAlign,
|
17735 | destroyPopupOnHide = _props.destroyPopupOnHide,
|
17736 | stretch = _props.stretch,
|
17737 | children = _props.children,
|
17738 | onMouseEnter = _props.onMouseEnter,
|
17739 | onMouseLeave = _props.onMouseLeave,
|
17740 | onMouseDown = _props.onMouseDown,
|
17741 | onTouchStart = _props.onTouchStart;
|
17742 |
|
17743 | var className = this.getClassName(this.currentAlignClassName || getClassNameFromAlign(align));
|
17744 | var hiddenClassName = prefixCls + '-hidden';
|
17745 |
|
17746 | if (!visible) {
|
17747 | this.currentAlignClassName = null;
|
17748 | }
|
17749 |
|
17750 | var sizeStyle = {};
|
17751 | if (stretch) {
|
17752 |
|
17753 | if (stretch.indexOf('height') !== -1) {
|
17754 | sizeStyle.height = targetHeight;
|
17755 | } else if (stretch.indexOf('minHeight') !== -1) {
|
17756 | sizeStyle.minHeight = targetHeight;
|
17757 | }
|
17758 | if (stretch.indexOf('width') !== -1) {
|
17759 | sizeStyle.width = targetWidth;
|
17760 | } else if (stretch.indexOf('minWidth') !== -1) {
|
17761 | sizeStyle.minWidth = targetWidth;
|
17762 | }
|
17763 |
|
17764 |
|
17765 | if (!stretchChecked) {
|
17766 | sizeStyle.visibility = 'hidden';
|
17767 | setTimeout(function () {
|
17768 | if (_this2.alignInstance) {
|
17769 | _this2.alignInstance.forceAlign();
|
17770 | }
|
17771 | }, 0);
|
17772 | }
|
17773 | }
|
17774 |
|
17775 | var newStyle = (0, _extends3['default'])({}, sizeStyle, style, this.getZIndexStyle());
|
17776 |
|
17777 | var popupInnerProps = {
|
17778 | className: className,
|
17779 | prefixCls: prefixCls,
|
17780 | ref: savePopupRef,
|
17781 | onMouseEnter: onMouseEnter,
|
17782 | onMouseLeave: onMouseLeave,
|
17783 | onMouseDown: onMouseDown,
|
17784 | onTouchStart: onTouchStart,
|
17785 | style: newStyle
|
17786 | };
|
17787 | if (destroyPopupOnHide) {
|
17788 | return _react2['default'].createElement(
|
17789 | _rcAnimate2['default'],
|
17790 | {
|
17791 | component: '',
|
17792 | exclusive: true,
|
17793 | transitionAppear: true,
|
17794 | transitionName: this.getTransitionName()
|
17795 | },
|
17796 | visible ? _react2['default'].createElement(
|
17797 | _rcAlign2['default'],
|
17798 | {
|
17799 | target: this.getAlignTarget(),
|
17800 | key: 'popup',
|
17801 | ref: this.saveAlignRef,
|
17802 | monitorWindowResize: true,
|
17803 | align: align,
|
17804 | onAlign: this.onAlign
|
17805 | },
|
17806 | _react2['default'].createElement(
|
17807 | _PopupInner2['default'],
|
17808 | (0, _extends3['default'])({
|
17809 | visible: true
|
17810 | }, popupInnerProps),
|
17811 | children
|
17812 | )
|
17813 | ) : null
|
17814 | );
|
17815 | }
|
17816 |
|
17817 | return _react2['default'].createElement(
|
17818 | _rcAnimate2['default'],
|
17819 | {
|
17820 | component: '',
|
17821 | exclusive: true,
|
17822 | transitionAppear: true,
|
17823 | transitionName: this.getTransitionName(),
|
17824 | showProp: 'xVisible'
|
17825 | },
|
17826 | _react2['default'].createElement(
|
17827 | _rcAlign2['default'],
|
17828 | {
|
17829 | target: this.getAlignTarget(),
|
17830 | key: 'popup',
|
17831 | ref: this.saveAlignRef,
|
17832 | monitorWindowResize: true,
|
17833 | xVisible: visible,
|
17834 | childrenProps: { visible: 'xVisible' },
|
17835 | disabled: !visible,
|
17836 | align: align,
|
17837 | onAlign: this.onAlign
|
17838 | },
|
17839 | _react2['default'].createElement(
|
17840 | _PopupInner2['default'],
|
17841 | (0, _extends3['default'])({
|
17842 | hiddenClassName: hiddenClassName
|
17843 | }, popupInnerProps),
|
17844 | children
|
17845 | )
|
17846 | )
|
17847 | );
|
17848 | };
|
17849 |
|
17850 | Popup.prototype.getZIndexStyle = function getZIndexStyle() {
|
17851 | var style = {};
|
17852 | var props = this.props;
|
17853 | if (props.zIndex !== undefined) {
|
17854 | style.zIndex = props.zIndex;
|
17855 | }
|
17856 | return style;
|
17857 | };
|
17858 |
|
17859 | Popup.prototype.getMaskElement = function getMaskElement() {
|
17860 | var props = this.props;
|
17861 | var maskElement = void 0;
|
17862 | if (props.mask) {
|
17863 | var maskTransition = this.getMaskTransitionName();
|
17864 | maskElement = _react2['default'].createElement(_LazyRenderBox2['default'], {
|
17865 | style: this.getZIndexStyle(),
|
17866 | key: 'mask',
|
17867 | className: props.prefixCls + '-mask',
|
17868 | hiddenClassName: props.prefixCls + '-mask-hidden',
|
17869 | visible: props.visible
|
17870 | });
|
17871 | if (maskTransition) {
|
17872 | maskElement = _react2['default'].createElement(
|
17873 | _rcAnimate2['default'],
|
17874 | {
|
17875 | key: 'mask',
|
17876 | showProp: 'visible',
|
17877 | transitionAppear: true,
|
17878 | component: '',
|
17879 | transitionName: maskTransition
|
17880 | },
|
17881 | maskElement
|
17882 | );
|
17883 | }
|
17884 | }
|
17885 | return maskElement;
|
17886 | };
|
17887 |
|
17888 | Popup.prototype.render = function render() {
|
17889 | return _react2['default'].createElement(
|
17890 | 'div',
|
17891 | null,
|
17892 | this.getMaskElement(),
|
17893 | this.getPopupElement()
|
17894 | );
|
17895 | };
|
17896 |
|
17897 | return Popup;
|
17898 | }(_react.Component);
|
17899 |
|
17900 | Popup.propTypes = {
|
17901 | visible: _propTypes2['default'].bool,
|
17902 | style: _propTypes2['default'].object,
|
17903 | getClassNameFromAlign: _propTypes2['default'].func,
|
17904 | onAlign: _propTypes2['default'].func,
|
17905 | getRootDomNode: _propTypes2['default'].func,
|
17906 | align: _propTypes2['default'].any,
|
17907 | destroyPopupOnHide: _propTypes2['default'].bool,
|
17908 | className: _propTypes2['default'].string,
|
17909 | prefixCls: _propTypes2['default'].string,
|
17910 | onMouseEnter: _propTypes2['default'].func,
|
17911 | onMouseLeave: _propTypes2['default'].func,
|
17912 | onMouseDown: _propTypes2['default'].func,
|
17913 | onTouchStart: _propTypes2['default'].func,
|
17914 | stretch: _propTypes2['default'].string,
|
17915 | children: _propTypes2['default'].node,
|
17916 | point: _propTypes2['default'].shape({
|
17917 | pageX: _propTypes2['default'].number,
|
17918 | pageY: _propTypes2['default'].number
|
17919 | })
|
17920 | };
|
17921 |
|
17922 | var _initialiseProps = function _initialiseProps() {
|
17923 | var _this3 = this;
|
17924 |
|
17925 | this.onAlign = function (popupDomNode, align) {
|
17926 | var props = _this3.props;
|
17927 | var currentAlignClassName = props.getClassNameFromAlign(align);
|
17928 |
|
17929 |
|
17930 | if (_this3.currentAlignClassName !== currentAlignClassName) {
|
17931 | _this3.currentAlignClassName = currentAlignClassName;
|
17932 | popupDomNode.className = _this3.getClassName(currentAlignClassName);
|
17933 | }
|
17934 | props.onAlign(popupDomNode, align);
|
17935 | };
|
17936 |
|
17937 | this.setStretchSize = function () {
|
17938 | var _props2 = _this3.props,
|
17939 | stretch = _props2.stretch,
|
17940 | getRootDomNode = _props2.getRootDomNode,
|
17941 | visible = _props2.visible;
|
17942 | var _state2 = _this3.state,
|
17943 | stretchChecked = _state2.stretchChecked,
|
17944 | targetHeight = _state2.targetHeight,
|
17945 | targetWidth = _state2.targetWidth;
|
17946 |
|
17947 |
|
17948 | if (!stretch || !visible) {
|
17949 | if (stretchChecked) {
|
17950 | _this3.setState({ stretchChecked: false });
|
17951 | }
|
17952 | return;
|
17953 | }
|
17954 |
|
17955 | var $ele = getRootDomNode();
|
17956 | if (!$ele) return;
|
17957 |
|
17958 | var height = $ele.offsetHeight;
|
17959 | var width = $ele.offsetWidth;
|
17960 |
|
17961 | if (targetHeight !== height || targetWidth !== width || !stretchChecked) {
|
17962 | _this3.setState({
|
17963 | stretchChecked: true,
|
17964 | targetHeight: height,
|
17965 | targetWidth: width
|
17966 | });
|
17967 | }
|
17968 | };
|
17969 |
|
17970 | this.getTargetElement = function () {
|
17971 | return _this3.props.getRootDomNode();
|
17972 | };
|
17973 |
|
17974 | this.getAlignTarget = function () {
|
17975 | var point = _this3.props.point;
|
17976 |
|
17977 | if (point) {
|
17978 | return point;
|
17979 | }
|
17980 | return _this3.getTargetElement;
|
17981 | };
|
17982 | };
|
17983 |
|
17984 | exports['default'] = Popup;
|
17985 | module.exports = exports['default'];
|
17986 |
|
17987 | }),
|
17988 |
|
17989 | (function(module, exports, __webpack_require__) {
|
17990 |
|
17991 | 'use strict';
|
17992 |
|
17993 | Object.defineProperty(exports, "__esModule", {
|
17994 | value: true
|
17995 | });
|
17996 |
|
17997 | var _Align = __webpack_require__(207);
|
17998 |
|
17999 | var _Align2 = _interopRequireDefault(_Align);
|
18000 |
|
18001 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18002 |
|
18003 | exports['default'] = _Align2['default'];
|
18004 |
|
18005 | module.exports = exports['default'];
|
18006 |
|
18007 | }),
|
18008 |
|
18009 | (function(module, exports, __webpack_require__) {
|
18010 |
|
18011 | 'use strict';
|
18012 |
|
18013 | Object.defineProperty(exports, "__esModule", {
|
18014 | value: true
|
18015 | });
|
18016 |
|
18017 | var _classCallCheck2 = __webpack_require__(134);
|
18018 |
|
18019 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
18020 |
|
18021 | var _createClass2 = __webpack_require__(199);
|
18022 |
|
18023 | var _createClass3 = _interopRequireDefault(_createClass2);
|
18024 |
|
18025 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
18026 |
|
18027 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
18028 |
|
18029 | var _inherits2 = __webpack_require__(169);
|
18030 |
|
18031 | var _inherits3 = _interopRequireDefault(_inherits2);
|
18032 |
|
18033 | var _react = __webpack_require__(4);
|
18034 |
|
18035 | var _react2 = _interopRequireDefault(_react);
|
18036 |
|
18037 | var _propTypes = __webpack_require__(5);
|
18038 |
|
18039 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
18040 |
|
18041 | var _reactDom = __webpack_require__(12);
|
18042 |
|
18043 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
18044 |
|
18045 | var _domAlign = __webpack_require__(51);
|
18046 |
|
18047 | var _addEventListener = __webpack_require__(197);
|
18048 |
|
18049 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
18050 |
|
18051 | var _util = __webpack_require__(208);
|
18052 |
|
18053 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18054 |
|
18055 | function getElement(func) {
|
18056 | if (typeof func !== 'function' || !func) return null;
|
18057 | return func();
|
18058 | }
|
18059 |
|
18060 | function getPoint(point) {
|
18061 | if (typeof point !== 'object' || !point) return null;
|
18062 | return point;
|
18063 | }
|
18064 |
|
18065 | var Align = function (_Component) {
|
18066 | (0, _inherits3['default'])(Align, _Component);
|
18067 |
|
18068 | function Align() {
|
18069 | var _ref;
|
18070 |
|
18071 | var _temp, _this, _ret;
|
18072 |
|
18073 | (0, _classCallCheck3['default'])(this, Align);
|
18074 |
|
18075 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
18076 | args[_key] = arguments[_key];
|
18077 | }
|
18078 |
|
18079 | return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, (_ref = Align.__proto__ || Object.getPrototypeOf(Align)).call.apply(_ref, [this].concat(args))), _this), _this.forceAlign = function () {
|
18080 | var _this$props = _this.props,
|
18081 | disabled = _this$props.disabled,
|
18082 | target = _this$props.target,
|
18083 | align = _this$props.align,
|
18084 | onAlign = _this$props.onAlign;
|
18085 |
|
18086 | if (!disabled && target) {
|
18087 | var source = _reactDom2['default'].findDOMNode(_this);
|
18088 |
|
18089 | var result = void 0;
|
18090 | var element = getElement(target);
|
18091 | var point = getPoint(target);
|
18092 |
|
18093 |
|
18094 |
|
18095 | var activeElement = document.activeElement;
|
18096 |
|
18097 | if (element) {
|
18098 | result = (0, _domAlign.alignElement)(source, element, align);
|
18099 | } else if (point) {
|
18100 | result = (0, _domAlign.alignPoint)(source, point, align);
|
18101 | }
|
18102 |
|
18103 | (0, _util.restoreFocus)(activeElement, source);
|
18104 |
|
18105 | if (onAlign) {
|
18106 | onAlign(source, result);
|
18107 | }
|
18108 | }
|
18109 | }, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret);
|
18110 | }
|
18111 |
|
18112 | (0, _createClass3['default'])(Align, [{
|
18113 | key: 'componentDidMount',
|
18114 | value: function componentDidMount() {
|
18115 | var props = this.props;
|
18116 |
|
18117 | this.forceAlign();
|
18118 | if (!props.disabled && props.monitorWindowResize) {
|
18119 | this.startMonitorWindowResize();
|
18120 | }
|
18121 | }
|
18122 | }, {
|
18123 | key: 'componentDidUpdate',
|
18124 | value: function componentDidUpdate(prevProps) {
|
18125 | var reAlign = false;
|
18126 | var props = this.props;
|
18127 |
|
18128 | if (!props.disabled) {
|
18129 | var source = _reactDom2['default'].findDOMNode(this);
|
18130 | var sourceRect = source ? source.getBoundingClientRect() : null;
|
18131 |
|
18132 | if (prevProps.disabled) {
|
18133 | reAlign = true;
|
18134 | } else {
|
18135 | var lastElement = getElement(prevProps.target);
|
18136 | var currentElement = getElement(props.target);
|
18137 | var lastPoint = getPoint(prevProps.target);
|
18138 | var currentPoint = getPoint(props.target);
|
18139 |
|
18140 | if ((0, _util.isWindow)(lastElement) && (0, _util.isWindow)(currentElement)) {
|
18141 |
|
18142 | reAlign = false;
|
18143 | } else if (lastElement !== currentElement ||
|
18144 | lastElement && !currentElement && currentPoint ||
|
18145 | lastPoint && currentPoint && currentElement ||
|
18146 | currentPoint && !(0, _util.isSamePoint)(lastPoint, currentPoint)) {
|
18147 | reAlign = true;
|
18148 | }
|
18149 |
|
18150 |
|
18151 | var preRect = this.sourceRect || {};
|
18152 | if (!reAlign && source && (!(0, _util.isSimilarValue)(preRect.width, sourceRect.width) || !(0, _util.isSimilarValue)(preRect.height, sourceRect.height))) {
|
18153 | reAlign = true;
|
18154 | }
|
18155 | }
|
18156 |
|
18157 | this.sourceRect = sourceRect;
|
18158 | }
|
18159 |
|
18160 | if (reAlign) {
|
18161 | this.forceAlign();
|
18162 | }
|
18163 |
|
18164 | if (props.monitorWindowResize && !props.disabled) {
|
18165 | this.startMonitorWindowResize();
|
18166 | } else {
|
18167 | this.stopMonitorWindowResize();
|
18168 | }
|
18169 | }
|
18170 | }, {
|
18171 | key: 'componentWillUnmount',
|
18172 | value: function componentWillUnmount() {
|
18173 | this.stopMonitorWindowResize();
|
18174 | }
|
18175 | }, {
|
18176 | key: 'startMonitorWindowResize',
|
18177 | value: function startMonitorWindowResize() {
|
18178 | if (!this.resizeHandler) {
|
18179 | this.bufferMonitor = (0, _util.buffer)(this.forceAlign, this.props.monitorBufferTime);
|
18180 | this.resizeHandler = (0, _addEventListener2['default'])(window, 'resize', this.bufferMonitor);
|
18181 | }
|
18182 | }
|
18183 | }, {
|
18184 | key: 'stopMonitorWindowResize',
|
18185 | value: function stopMonitorWindowResize() {
|
18186 | if (this.resizeHandler) {
|
18187 | this.bufferMonitor.clear();
|
18188 | this.resizeHandler.remove();
|
18189 | this.resizeHandler = null;
|
18190 | }
|
18191 | }
|
18192 | }, {
|
18193 | key: 'render',
|
18194 | value: function render() {
|
18195 | var _this2 = this;
|
18196 |
|
18197 | var _props = this.props,
|
18198 | childrenProps = _props.childrenProps,
|
18199 | children = _props.children;
|
18200 |
|
18201 | var child = _react2['default'].Children.only(children);
|
18202 | if (childrenProps) {
|
18203 | var newProps = {};
|
18204 | var propList = Object.keys(childrenProps);
|
18205 | propList.forEach(function (prop) {
|
18206 | newProps[prop] = _this2.props[childrenProps[prop]];
|
18207 | });
|
18208 |
|
18209 | return _react2['default'].cloneElement(child, newProps);
|
18210 | }
|
18211 | return child;
|
18212 | }
|
18213 | }]);
|
18214 | return Align;
|
18215 | }(_react.Component);
|
18216 |
|
18217 | Align.propTypes = {
|
18218 | childrenProps: _propTypes2['default'].object,
|
18219 | align: _propTypes2['default'].object.isRequired,
|
18220 | target: _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].shape({
|
18221 | clientX: _propTypes2['default'].number,
|
18222 | clientY: _propTypes2['default'].number,
|
18223 | pageX: _propTypes2['default'].number,
|
18224 | pageY: _propTypes2['default'].number
|
18225 | })]),
|
18226 | onAlign: _propTypes2['default'].func,
|
18227 | monitorBufferTime: _propTypes2['default'].number,
|
18228 | monitorWindowResize: _propTypes2['default'].bool,
|
18229 | disabled: _propTypes2['default'].bool,
|
18230 | children: _propTypes2['default'].any
|
18231 | };
|
18232 | Align.defaultProps = {
|
18233 | target: function target() {
|
18234 | return window;
|
18235 | },
|
18236 | monitorBufferTime: 50,
|
18237 | monitorWindowResize: false,
|
18238 | disabled: false
|
18239 | };
|
18240 | exports['default'] = Align;
|
18241 | module.exports = exports['default'];
|
18242 |
|
18243 | }),
|
18244 |
|
18245 | (function(module, exports, __webpack_require__) {
|
18246 |
|
18247 | 'use strict';
|
18248 |
|
18249 | Object.defineProperty(exports, "__esModule", {
|
18250 | value: true
|
18251 | });
|
18252 | exports.buffer = buffer;
|
18253 | exports.isSamePoint = isSamePoint;
|
18254 | exports.isWindow = isWindow;
|
18255 | exports.isSimilarValue = isSimilarValue;
|
18256 | exports.restoreFocus = restoreFocus;
|
18257 |
|
18258 | var _contains = __webpack_require__(196);
|
18259 |
|
18260 | var _contains2 = _interopRequireDefault(_contains);
|
18261 |
|
18262 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18263 |
|
18264 | function buffer(fn, ms) {
|
18265 | var timer = void 0;
|
18266 |
|
18267 | function clear() {
|
18268 | if (timer) {
|
18269 | clearTimeout(timer);
|
18270 | timer = null;
|
18271 | }
|
18272 | }
|
18273 |
|
18274 | function bufferFn() {
|
18275 | clear();
|
18276 | timer = setTimeout(fn, ms);
|
18277 | }
|
18278 |
|
18279 | bufferFn.clear = clear;
|
18280 |
|
18281 | return bufferFn;
|
18282 | }
|
18283 |
|
18284 | function isSamePoint(prev, next) {
|
18285 | if (prev === next) return true;
|
18286 | if (!prev || !next) return false;
|
18287 |
|
18288 | if ('pageX' in next && 'pageY' in next) {
|
18289 | return prev.pageX === next.pageX && prev.pageY === next.pageY;
|
18290 | }
|
18291 |
|
18292 | if ('clientX' in next && 'clientY' in next) {
|
18293 | return prev.clientX === next.clientX && prev.clientY === next.clientY;
|
18294 | }
|
18295 |
|
18296 | return false;
|
18297 | }
|
18298 |
|
18299 | function isWindow(obj) {
|
18300 | return obj && typeof obj === 'object' && obj.window === obj;
|
18301 | }
|
18302 |
|
18303 | function isSimilarValue(val1, val2) {
|
18304 | var int1 = Math.floor(val1);
|
18305 | var int2 = Math.floor(val2);
|
18306 | return Math.abs(int1 - int2) <= 1;
|
18307 | }
|
18308 |
|
18309 | function restoreFocus(activeElement, container) {
|
18310 |
|
18311 | if (activeElement !== document.activeElement && (0, _contains2['default'])(container, activeElement)) {
|
18312 | activeElement.focus();
|
18313 | }
|
18314 | }
|
18315 |
|
18316 | }),
|
18317 |
|
18318 | (function(module, exports, __webpack_require__) {
|
18319 |
|
18320 | 'use strict';
|
18321 |
|
18322 | Object.defineProperty(exports, "__esModule", {
|
18323 | value: true
|
18324 | });
|
18325 |
|
18326 | var _extends2 = __webpack_require__(94);
|
18327 |
|
18328 | var _extends3 = _interopRequireDefault(_extends2);
|
18329 |
|
18330 | var _defineProperty2 = __webpack_require__(210);
|
18331 |
|
18332 | var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
18333 |
|
18334 | var _classCallCheck2 = __webpack_require__(134);
|
18335 |
|
18336 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
18337 |
|
18338 | var _createClass2 = __webpack_require__(199);
|
18339 |
|
18340 | var _createClass3 = _interopRequireDefault(_createClass2);
|
18341 |
|
18342 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
18343 |
|
18344 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
18345 |
|
18346 | var _inherits2 = __webpack_require__(169);
|
18347 |
|
18348 | var _inherits3 = _interopRequireDefault(_inherits2);
|
18349 |
|
18350 | var _react = __webpack_require__(4);
|
18351 |
|
18352 | var _react2 = _interopRequireDefault(_react);
|
18353 |
|
18354 | var _propTypes = __webpack_require__(5);
|
18355 |
|
18356 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
18357 |
|
18358 | var _ChildrenUtils = __webpack_require__(211);
|
18359 |
|
18360 | var _AnimateChild = __webpack_require__(212);
|
18361 |
|
18362 | var _AnimateChild2 = _interopRequireDefault(_AnimateChild);
|
18363 |
|
18364 | var _animate = __webpack_require__(215);
|
18365 |
|
18366 | var _animate2 = _interopRequireDefault(_animate);
|
18367 |
|
18368 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18369 |
|
18370 | var defaultKey = 'rc_animate_' + Date.now();
|
18371 |
|
18372 | function getChildrenFromProps(props) {
|
18373 | var children = props.children;
|
18374 | if (_react2['default'].isValidElement(children)) {
|
18375 | if (!children.key) {
|
18376 | return _react2['default'].cloneElement(children, {
|
18377 | key: defaultKey
|
18378 | });
|
18379 | }
|
18380 | }
|
18381 | return children;
|
18382 | }
|
18383 |
|
18384 | function noop() {}
|
18385 |
|
18386 | var Animate = function (_React$Component) {
|
18387 | (0, _inherits3['default'])(Animate, _React$Component);
|
18388 |
|
18389 |
|
18390 |
|
18391 | function Animate(props) {
|
18392 | (0, _classCallCheck3['default'])(this, Animate);
|
18393 |
|
18394 | var _this = (0, _possibleConstructorReturn3['default'])(this, (Animate.__proto__ || Object.getPrototypeOf(Animate)).call(this, props));
|
18395 |
|
18396 | _initialiseProps.call(_this);
|
18397 |
|
18398 | _this.currentlyAnimatingKeys = {};
|
18399 | _this.keysToEnter = [];
|
18400 | _this.keysToLeave = [];
|
18401 |
|
18402 | _this.state = {
|
18403 | children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props))
|
18404 | };
|
18405 |
|
18406 | _this.childrenRefs = {};
|
18407 | return _this;
|
18408 | }
|
18409 |
|
18410 | (0, _createClass3['default'])(Animate, [{
|
18411 | key: 'componentDidMount',
|
18412 | value: function componentDidMount() {
|
18413 | var _this2 = this;
|
18414 |
|
18415 | var showProp = this.props.showProp;
|
18416 | var children = this.state.children;
|
18417 | if (showProp) {
|
18418 | children = children.filter(function (child) {
|
18419 | return !!child.props[showProp];
|
18420 | });
|
18421 | }
|
18422 | children.forEach(function (child) {
|
18423 | if (child) {
|
18424 | _this2.performAppear(child.key);
|
18425 | }
|
18426 | });
|
18427 | }
|
18428 | }, {
|
18429 | key: 'componentWillReceiveProps',
|
18430 | value: function componentWillReceiveProps(nextProps) {
|
18431 | var _this3 = this;
|
18432 |
|
18433 | this.nextProps = nextProps;
|
18434 | var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps));
|
18435 | var props = this.props;
|
18436 |
|
18437 | if (props.exclusive) {
|
18438 | Object.keys(this.currentlyAnimatingKeys).forEach(function (key) {
|
18439 | _this3.stop(key);
|
18440 | });
|
18441 | }
|
18442 | var showProp = props.showProp;
|
18443 | var currentlyAnimatingKeys = this.currentlyAnimatingKeys;
|
18444 |
|
18445 | var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children;
|
18446 |
|
18447 | var newChildren = [];
|
18448 | if (showProp) {
|
18449 | currentChildren.forEach(function (currentChild) {
|
18450 | var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key);
|
18451 | var newChild = void 0;
|
18452 | if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) {
|
18453 | newChild = _react2['default'].cloneElement(nextChild || currentChild, (0, _defineProperty3['default'])({}, showProp, true));
|
18454 | } else {
|
18455 | newChild = nextChild;
|
18456 | }
|
18457 | if (newChild) {
|
18458 | newChildren.push(newChild);
|
18459 | }
|
18460 | });
|
18461 | nextChildren.forEach(function (nextChild) {
|
18462 | if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) {
|
18463 | newChildren.push(nextChild);
|
18464 | }
|
18465 | });
|
18466 | } else {
|
18467 | newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren);
|
18468 | }
|
18469 |
|
18470 |
|
18471 | this.setState({
|
18472 | children: newChildren
|
18473 | });
|
18474 |
|
18475 | nextChildren.forEach(function (child) {
|
18476 | var key = child && child.key;
|
18477 | if (child && currentlyAnimatingKeys[key]) {
|
18478 | return;
|
18479 | }
|
18480 | var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
18481 | if (showProp) {
|
18482 | var showInNext = child.props[showProp];
|
18483 | if (hasPrev) {
|
18484 | var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
18485 | if (!showInNow && showInNext) {
|
18486 | _this3.keysToEnter.push(key);
|
18487 | }
|
18488 | } else if (showInNext) {
|
18489 | _this3.keysToEnter.push(key);
|
18490 | }
|
18491 | } else if (!hasPrev) {
|
18492 | _this3.keysToEnter.push(key);
|
18493 | }
|
18494 | });
|
18495 |
|
18496 | currentChildren.forEach(function (child) {
|
18497 | var key = child && child.key;
|
18498 | if (child && currentlyAnimatingKeys[key]) {
|
18499 | return;
|
18500 | }
|
18501 | var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key);
|
18502 | if (showProp) {
|
18503 | var showInNow = child.props[showProp];
|
18504 | if (hasNext) {
|
18505 | var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp);
|
18506 | if (!showInNext && showInNow) {
|
18507 | _this3.keysToLeave.push(key);
|
18508 | }
|
18509 | } else if (showInNow) {
|
18510 | _this3.keysToLeave.push(key);
|
18511 | }
|
18512 | } else if (!hasNext) {
|
18513 | _this3.keysToLeave.push(key);
|
18514 | }
|
18515 | });
|
18516 | }
|
18517 | }, {
|
18518 | key: 'componentDidUpdate',
|
18519 | value: function componentDidUpdate() {
|
18520 | var keysToEnter = this.keysToEnter;
|
18521 | this.keysToEnter = [];
|
18522 | keysToEnter.forEach(this.performEnter);
|
18523 | var keysToLeave = this.keysToLeave;
|
18524 | this.keysToLeave = [];
|
18525 | keysToLeave.forEach(this.performLeave);
|
18526 | }
|
18527 | }, {
|
18528 | key: 'isValidChildByKey',
|
18529 | value: function isValidChildByKey(currentChildren, key) {
|
18530 | var showProp = this.props.showProp;
|
18531 | if (showProp) {
|
18532 | return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
18533 | }
|
18534 | return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
18535 | }
|
18536 | }, {
|
18537 | key: 'stop',
|
18538 | value: function stop(key) {
|
18539 | delete this.currentlyAnimatingKeys[key];
|
18540 | var component = this.childrenRefs[key];
|
18541 | if (component) {
|
18542 | component.stop();
|
18543 | }
|
18544 | }
|
18545 | }, {
|
18546 | key: 'render',
|
18547 | value: function render() {
|
18548 | var _this4 = this;
|
18549 |
|
18550 | var props = this.props;
|
18551 | this.nextProps = props;
|
18552 | var stateChildren = this.state.children;
|
18553 | var children = null;
|
18554 | if (stateChildren) {
|
18555 | children = stateChildren.map(function (child) {
|
18556 | if (child === null || child === undefined) {
|
18557 | return child;
|
18558 | }
|
18559 | if (!child.key) {
|
18560 | throw new Error('must set key for <rc-animate> children');
|
18561 | }
|
18562 | return _react2['default'].createElement(
|
18563 | _AnimateChild2['default'],
|
18564 | {
|
18565 | key: child.key,
|
18566 | ref: function ref(node) {
|
18567 | _this4.childrenRefs[child.key] = node;
|
18568 | },
|
18569 | animation: props.animation,
|
18570 | transitionName: props.transitionName,
|
18571 | transitionEnter: props.transitionEnter,
|
18572 | transitionAppear: props.transitionAppear,
|
18573 | transitionLeave: props.transitionLeave
|
18574 | },
|
18575 | child
|
18576 | );
|
18577 | });
|
18578 | }
|
18579 | var Component = props.component;
|
18580 | if (Component) {
|
18581 | var passedProps = props;
|
18582 | if (typeof Component === 'string') {
|
18583 | passedProps = (0, _extends3['default'])({
|
18584 | className: props.className,
|
18585 | style: props.style
|
18586 | }, props.componentProps);
|
18587 | }
|
18588 | return _react2['default'].createElement(
|
18589 | Component,
|
18590 | passedProps,
|
18591 | children
|
18592 | );
|
18593 | }
|
18594 | return children[0] || null;
|
18595 | }
|
18596 | }]);
|
18597 | return Animate;
|
18598 | }(_react2['default'].Component);
|
18599 |
|
18600 | Animate.isAnimate = true;
|
18601 | Animate.propTypes = {
|
18602 | component: _propTypes2['default'].any,
|
18603 | componentProps: _propTypes2['default'].object,
|
18604 | animation: _propTypes2['default'].object,
|
18605 | transitionName: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].object]),
|
18606 | transitionEnter: _propTypes2['default'].bool,
|
18607 | transitionAppear: _propTypes2['default'].bool,
|
18608 | exclusive: _propTypes2['default'].bool,
|
18609 | transitionLeave: _propTypes2['default'].bool,
|
18610 | onEnd: _propTypes2['default'].func,
|
18611 | onEnter: _propTypes2['default'].func,
|
18612 | onLeave: _propTypes2['default'].func,
|
18613 | onAppear: _propTypes2['default'].func,
|
18614 | showProp: _propTypes2['default'].string,
|
18615 | children: _propTypes2['default'].node
|
18616 | };
|
18617 | Animate.defaultProps = {
|
18618 | animation: {},
|
18619 | component: 'span',
|
18620 | componentProps: {},
|
18621 | transitionEnter: true,
|
18622 | transitionLeave: true,
|
18623 | transitionAppear: false,
|
18624 | onEnd: noop,
|
18625 | onEnter: noop,
|
18626 | onLeave: noop,
|
18627 | onAppear: noop
|
18628 | };
|
18629 |
|
18630 | var _initialiseProps = function _initialiseProps() {
|
18631 | var _this5 = this;
|
18632 |
|
18633 | this.performEnter = function (key) {
|
18634 |
|
18635 | if (_this5.childrenRefs[key]) {
|
18636 | _this5.currentlyAnimatingKeys[key] = true;
|
18637 | _this5.childrenRefs[key].componentWillEnter(_this5.handleDoneAdding.bind(_this5, key, 'enter'));
|
18638 | }
|
18639 | };
|
18640 |
|
18641 | this.performAppear = function (key) {
|
18642 | if (_this5.childrenRefs[key]) {
|
18643 | _this5.currentlyAnimatingKeys[key] = true;
|
18644 | _this5.childrenRefs[key].componentWillAppear(_this5.handleDoneAdding.bind(_this5, key, 'appear'));
|
18645 | }
|
18646 | };
|
18647 |
|
18648 | this.handleDoneAdding = function (key, type) {
|
18649 | var props = _this5.props;
|
18650 | delete _this5.currentlyAnimatingKeys[key];
|
18651 |
|
18652 | if (props.exclusive && props !== _this5.nextProps) {
|
18653 | return;
|
18654 | }
|
18655 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
18656 | if (!_this5.isValidChildByKey(currentChildren, key)) {
|
18657 |
|
18658 | _this5.performLeave(key);
|
18659 | } else if (type === 'appear') {
|
18660 | if (_animate2['default'].allowAppearCallback(props)) {
|
18661 | props.onAppear(key);
|
18662 | props.onEnd(key, true);
|
18663 | }
|
18664 | } else if (_animate2['default'].allowEnterCallback(props)) {
|
18665 | props.onEnter(key);
|
18666 | props.onEnd(key, true);
|
18667 | }
|
18668 | };
|
18669 |
|
18670 | this.performLeave = function (key) {
|
18671 |
|
18672 | if (_this5.childrenRefs[key]) {
|
18673 | _this5.currentlyAnimatingKeys[key] = true;
|
18674 | _this5.childrenRefs[key].componentWillLeave(_this5.handleDoneLeaving.bind(_this5, key));
|
18675 | }
|
18676 | };
|
18677 |
|
18678 | this.handleDoneLeaving = function (key) {
|
18679 | var props = _this5.props;
|
18680 | delete _this5.currentlyAnimatingKeys[key];
|
18681 |
|
18682 | if (props.exclusive && props !== _this5.nextProps) {
|
18683 | return;
|
18684 | }
|
18685 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
18686 |
|
18687 | if (_this5.isValidChildByKey(currentChildren, key)) {
|
18688 | _this5.performEnter(key);
|
18689 | } else {
|
18690 | var end = function end() {
|
18691 | if (_animate2['default'].allowLeaveCallback(props)) {
|
18692 | props.onLeave(key);
|
18693 | props.onEnd(key, false);
|
18694 | }
|
18695 | };
|
18696 | if (!(0, _ChildrenUtils.isSameChildren)(_this5.state.children, currentChildren, props.showProp)) {
|
18697 | _this5.setState({
|
18698 | children: currentChildren
|
18699 | }, end);
|
18700 | } else {
|
18701 | end();
|
18702 | }
|
18703 | }
|
18704 | };
|
18705 | };
|
18706 |
|
18707 | exports['default'] = Animate;
|
18708 | module.exports = exports['default'];
|
18709 |
|
18710 | }),
|
18711 |
|
18712 | (function(module, exports, __webpack_require__) {
|
18713 |
|
18714 | "use strict";
|
18715 |
|
18716 | exports.__esModule = true;
|
18717 |
|
18718 | var _defineProperty = __webpack_require__(200);
|
18719 |
|
18720 | var _defineProperty2 = _interopRequireDefault(_defineProperty);
|
18721 |
|
18722 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18723 |
|
18724 | exports.default = function (obj, key, value) {
|
18725 | if (key in obj) {
|
18726 | (0, _defineProperty2.default)(obj, key, {
|
18727 | value: value,
|
18728 | enumerable: true,
|
18729 | configurable: true,
|
18730 | writable: true
|
18731 | });
|
18732 | } else {
|
18733 | obj[key] = value;
|
18734 | }
|
18735 |
|
18736 | return obj;
|
18737 | };
|
18738 |
|
18739 | }),
|
18740 |
|
18741 | (function(module, exports, __webpack_require__) {
|
18742 |
|
18743 | 'use strict';
|
18744 |
|
18745 | Object.defineProperty(exports, "__esModule", {
|
18746 | value: true
|
18747 | });
|
18748 | exports.toArrayChildren = toArrayChildren;
|
18749 | exports.findChildInChildrenByKey = findChildInChildrenByKey;
|
18750 | exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey;
|
18751 | exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey;
|
18752 | exports.isSameChildren = isSameChildren;
|
18753 | exports.mergeChildren = mergeChildren;
|
18754 |
|
18755 | var _react = __webpack_require__(4);
|
18756 |
|
18757 | var _react2 = _interopRequireDefault(_react);
|
18758 |
|
18759 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18760 |
|
18761 | function toArrayChildren(children) {
|
18762 | var ret = [];
|
18763 | _react2['default'].Children.forEach(children, function (child) {
|
18764 | ret.push(child);
|
18765 | });
|
18766 | return ret;
|
18767 | }
|
18768 |
|
18769 | function findChildInChildrenByKey(children, key) {
|
18770 | var ret = null;
|
18771 | if (children) {
|
18772 | children.forEach(function (child) {
|
18773 | if (ret) {
|
18774 | return;
|
18775 | }
|
18776 | if (child && child.key === key) {
|
18777 | ret = child;
|
18778 | }
|
18779 | });
|
18780 | }
|
18781 | return ret;
|
18782 | }
|
18783 |
|
18784 | function findShownChildInChildrenByKey(children, key, showProp) {
|
18785 | var ret = null;
|
18786 | if (children) {
|
18787 | children.forEach(function (child) {
|
18788 | if (child && child.key === key && child.props[showProp]) {
|
18789 | if (ret) {
|
18790 | throw new Error('two child with same key for <rc-animate> children');
|
18791 | }
|
18792 | ret = child;
|
18793 | }
|
18794 | });
|
18795 | }
|
18796 | return ret;
|
18797 | }
|
18798 |
|
18799 | function findHiddenChildInChildrenByKey(children, key, showProp) {
|
18800 | var found = 0;
|
18801 | if (children) {
|
18802 | children.forEach(function (child) {
|
18803 | if (found) {
|
18804 | return;
|
18805 | }
|
18806 | found = child && child.key === key && !child.props[showProp];
|
18807 | });
|
18808 | }
|
18809 | return found;
|
18810 | }
|
18811 |
|
18812 | function isSameChildren(c1, c2, showProp) {
|
18813 | var same = c1.length === c2.length;
|
18814 | if (same) {
|
18815 | c1.forEach(function (child, index) {
|
18816 | var child2 = c2[index];
|
18817 | if (child && child2) {
|
18818 | if (child && !child2 || !child && child2) {
|
18819 | same = false;
|
18820 | } else if (child.key !== child2.key) {
|
18821 | same = false;
|
18822 | } else if (showProp && child.props[showProp] !== child2.props[showProp]) {
|
18823 | same = false;
|
18824 | }
|
18825 | }
|
18826 | });
|
18827 | }
|
18828 | return same;
|
18829 | }
|
18830 |
|
18831 | function mergeChildren(prev, next) {
|
18832 | var ret = [];
|
18833 |
|
18834 |
|
18835 |
|
18836 | var nextChildrenPending = {};
|
18837 | var pendingChildren = [];
|
18838 | prev.forEach(function (child) {
|
18839 | if (child && findChildInChildrenByKey(next, child.key)) {
|
18840 | if (pendingChildren.length) {
|
18841 | nextChildrenPending[child.key] = pendingChildren;
|
18842 | pendingChildren = [];
|
18843 | }
|
18844 | } else {
|
18845 | pendingChildren.push(child);
|
18846 | }
|
18847 | });
|
18848 |
|
18849 | next.forEach(function (child) {
|
18850 | if (child && Object.prototype.hasOwnProperty.call(nextChildrenPending, child.key)) {
|
18851 | ret = ret.concat(nextChildrenPending[child.key]);
|
18852 | }
|
18853 | ret.push(child);
|
18854 | });
|
18855 |
|
18856 | ret = ret.concat(pendingChildren);
|
18857 |
|
18858 | return ret;
|
18859 | }
|
18860 |
|
18861 | }),
|
18862 |
|
18863 | (function(module, exports, __webpack_require__) {
|
18864 |
|
18865 | 'use strict';
|
18866 |
|
18867 | Object.defineProperty(exports, "__esModule", {
|
18868 | value: true
|
18869 | });
|
18870 |
|
18871 | var _classCallCheck2 = __webpack_require__(134);
|
18872 |
|
18873 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
18874 |
|
18875 | var _createClass2 = __webpack_require__(199);
|
18876 |
|
18877 | var _createClass3 = _interopRequireDefault(_createClass2);
|
18878 |
|
18879 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
18880 |
|
18881 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
18882 |
|
18883 | var _inherits2 = __webpack_require__(169);
|
18884 |
|
18885 | var _inherits3 = _interopRequireDefault(_inherits2);
|
18886 |
|
18887 | var _react = __webpack_require__(4);
|
18888 |
|
18889 | var _react2 = _interopRequireDefault(_react);
|
18890 |
|
18891 | var _reactDom = __webpack_require__(12);
|
18892 |
|
18893 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
18894 |
|
18895 | var _propTypes = __webpack_require__(5);
|
18896 |
|
18897 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
18898 |
|
18899 | var _cssAnimation = __webpack_require__(213);
|
18900 |
|
18901 | var _cssAnimation2 = _interopRequireDefault(_cssAnimation);
|
18902 |
|
18903 | var _animate = __webpack_require__(215);
|
18904 |
|
18905 | var _animate2 = _interopRequireDefault(_animate);
|
18906 |
|
18907 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18908 |
|
18909 | var transitionMap = {
|
18910 | enter: 'transitionEnter',
|
18911 | appear: 'transitionAppear',
|
18912 | leave: 'transitionLeave'
|
18913 | };
|
18914 |
|
18915 | var AnimateChild = function (_React$Component) {
|
18916 | (0, _inherits3['default'])(AnimateChild, _React$Component);
|
18917 |
|
18918 | function AnimateChild() {
|
18919 | (0, _classCallCheck3['default'])(this, AnimateChild);
|
18920 | return (0, _possibleConstructorReturn3['default'])(this, (AnimateChild.__proto__ || Object.getPrototypeOf(AnimateChild)).apply(this, arguments));
|
18921 | }
|
18922 |
|
18923 | (0, _createClass3['default'])(AnimateChild, [{
|
18924 | key: 'componentWillUnmount',
|
18925 | value: function componentWillUnmount() {
|
18926 | this.stop();
|
18927 | }
|
18928 | }, {
|
18929 | key: 'componentWillEnter',
|
18930 | value: function componentWillEnter(done) {
|
18931 | if (_animate2['default'].isEnterSupported(this.props)) {
|
18932 | this.transition('enter', done);
|
18933 | } else {
|
18934 | done();
|
18935 | }
|
18936 | }
|
18937 | }, {
|
18938 | key: 'componentWillAppear',
|
18939 | value: function componentWillAppear(done) {
|
18940 | if (_animate2['default'].isAppearSupported(this.props)) {
|
18941 | this.transition('appear', done);
|
18942 | } else {
|
18943 | done();
|
18944 | }
|
18945 | }
|
18946 | }, {
|
18947 | key: 'componentWillLeave',
|
18948 | value: function componentWillLeave(done) {
|
18949 | if (_animate2['default'].isLeaveSupported(this.props)) {
|
18950 | this.transition('leave', done);
|
18951 | } else {
|
18952 |
|
18953 |
|
18954 |
|
18955 | done();
|
18956 | }
|
18957 | }
|
18958 | }, {
|
18959 | key: 'transition',
|
18960 | value: function transition(animationType, finishCallback) {
|
18961 | var _this2 = this;
|
18962 |
|
18963 | var node = _reactDom2['default'].findDOMNode(this);
|
18964 | var props = this.props;
|
18965 | var transitionName = props.transitionName;
|
18966 | var nameIsObj = typeof transitionName === 'object';
|
18967 | this.stop();
|
18968 | var end = function end() {
|
18969 | _this2.stopper = null;
|
18970 | finishCallback();
|
18971 | };
|
18972 | if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {
|
18973 | var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType;
|
18974 | var activeName = name + '-active';
|
18975 | if (nameIsObj && transitionName[animationType + 'Active']) {
|
18976 | activeName = transitionName[animationType + 'Active'];
|
18977 | }
|
18978 | this.stopper = (0, _cssAnimation2['default'])(node, {
|
18979 | name: name,
|
18980 | active: activeName
|
18981 | }, end);
|
18982 | } else {
|
18983 | this.stopper = props.animation[animationType](node, end);
|
18984 | }
|
18985 | }
|
18986 | }, {
|
18987 | key: 'stop',
|
18988 | value: function stop() {
|
18989 | var stopper = this.stopper;
|
18990 | if (stopper) {
|
18991 | this.stopper = null;
|
18992 | stopper.stop();
|
18993 | }
|
18994 | }
|
18995 | }, {
|
18996 | key: 'render',
|
18997 | value: function render() {
|
18998 | return this.props.children;
|
18999 | }
|
19000 | }]);
|
19001 | return AnimateChild;
|
19002 | }(_react2['default'].Component);
|
19003 |
|
19004 | AnimateChild.propTypes = {
|
19005 | children: _propTypes2['default'].any
|
19006 | };
|
19007 | exports['default'] = AnimateChild;
|
19008 | module.exports = exports['default'];
|
19009 |
|
19010 | }),
|
19011 |
|
19012 | (function(module, exports, __webpack_require__) {
|
19013 |
|
19014 | 'use strict';
|
19015 |
|
19016 | Object.defineProperty(exports, "__esModule", {
|
19017 | value: true
|
19018 | });
|
19019 | exports.isCssAnimationSupported = undefined;
|
19020 |
|
19021 | var _typeof2 = __webpack_require__(136);
|
19022 |
|
19023 | var _typeof3 = _interopRequireDefault(_typeof2);
|
19024 |
|
19025 | var _Event = __webpack_require__(214);
|
19026 |
|
19027 | var _Event2 = _interopRequireDefault(_Event);
|
19028 |
|
19029 | var _componentClasses = __webpack_require__(47);
|
19030 |
|
19031 | var _componentClasses2 = _interopRequireDefault(_componentClasses);
|
19032 |
|
19033 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19034 |
|
19035 | var isCssAnimationSupported = _Event2['default'].endEvents.length !== 0;
|
19036 | var capitalPrefixes = ['Webkit', 'Moz', 'O',
|
19037 |
|
19038 | 'ms'];
|
19039 | var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];
|
19040 |
|
19041 | function getStyleProperty(node, name) {
|
19042 |
|
19043 | var style = window.getComputedStyle(node, null);
|
19044 | var ret = '';
|
19045 | for (var i = 0; i < prefixes.length; i++) {
|
19046 | ret = style.getPropertyValue(prefixes[i] + name);
|
19047 | if (ret) {
|
19048 | break;
|
19049 | }
|
19050 | }
|
19051 | return ret;
|
19052 | }
|
19053 |
|
19054 | function fixBrowserByTimeout(node) {
|
19055 | if (isCssAnimationSupported) {
|
19056 | var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0;
|
19057 | var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0;
|
19058 | var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0;
|
19059 | var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0;
|
19060 | var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay);
|
19061 |
|
19062 | node.rcEndAnimTimeout = setTimeout(function () {
|
19063 | node.rcEndAnimTimeout = null;
|
19064 | if (node.rcEndListener) {
|
19065 | node.rcEndListener();
|
19066 | }
|
19067 | }, time * 1000 + 200);
|
19068 | }
|
19069 | }
|
19070 |
|
19071 | function clearBrowserBugTimeout(node) {
|
19072 | if (node.rcEndAnimTimeout) {
|
19073 | clearTimeout(node.rcEndAnimTimeout);
|
19074 | node.rcEndAnimTimeout = null;
|
19075 | }
|
19076 | }
|
19077 |
|
19078 | var cssAnimation = function cssAnimation(node, transitionName, endCallback) {
|
19079 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : (0, _typeof3['default'])(transitionName)) === 'object';
|
19080 | var className = nameIsObj ? transitionName.name : transitionName;
|
19081 | var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active';
|
19082 | var end = endCallback;
|
19083 | var start = void 0;
|
19084 | var active = void 0;
|
19085 | var nodeClasses = (0, _componentClasses2['default'])(node);
|
19086 |
|
19087 | if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') {
|
19088 | end = endCallback.end;
|
19089 | start = endCallback.start;
|
19090 | active = endCallback.active;
|
19091 | }
|
19092 |
|
19093 | if (node.rcEndListener) {
|
19094 | node.rcEndListener();
|
19095 | }
|
19096 |
|
19097 | node.rcEndListener = function (e) {
|
19098 | if (e && e.target !== node) {
|
19099 | return;
|
19100 | }
|
19101 |
|
19102 | if (node.rcAnimTimeout) {
|
19103 | clearTimeout(node.rcAnimTimeout);
|
19104 | node.rcAnimTimeout = null;
|
19105 | }
|
19106 |
|
19107 | clearBrowserBugTimeout(node);
|
19108 |
|
19109 | nodeClasses.remove(className);
|
19110 | nodeClasses.remove(activeClassName);
|
19111 |
|
19112 | _Event2['default'].removeEndEventListener(node, node.rcEndListener);
|
19113 | node.rcEndListener = null;
|
19114 |
|
19115 |
|
19116 |
|
19117 | if (end) {
|
19118 | end();
|
19119 | }
|
19120 | };
|
19121 |
|
19122 | _Event2['default'].addEndEventListener(node, node.rcEndListener);
|
19123 |
|
19124 | if (start) {
|
19125 | start();
|
19126 | }
|
19127 | nodeClasses.add(className);
|
19128 |
|
19129 | node.rcAnimTimeout = setTimeout(function () {
|
19130 | node.rcAnimTimeout = null;
|
19131 | nodeClasses.add(activeClassName);
|
19132 | if (active) {
|
19133 | setTimeout(active, 0);
|
19134 | }
|
19135 | fixBrowserByTimeout(node);
|
19136 |
|
19137 | }, 30);
|
19138 |
|
19139 | return {
|
19140 | stop: function stop() {
|
19141 | if (node.rcEndListener) {
|
19142 | node.rcEndListener();
|
19143 | }
|
19144 | }
|
19145 | };
|
19146 | };
|
19147 |
|
19148 | cssAnimation.style = function (node, style, callback) {
|
19149 | if (node.rcEndListener) {
|
19150 | node.rcEndListener();
|
19151 | }
|
19152 |
|
19153 | node.rcEndListener = function (e) {
|
19154 | if (e && e.target !== node) {
|
19155 | return;
|
19156 | }
|
19157 |
|
19158 | if (node.rcAnimTimeout) {
|
19159 | clearTimeout(node.rcAnimTimeout);
|
19160 | node.rcAnimTimeout = null;
|
19161 | }
|
19162 |
|
19163 | clearBrowserBugTimeout(node);
|
19164 |
|
19165 | _Event2['default'].removeEndEventListener(node, node.rcEndListener);
|
19166 | node.rcEndListener = null;
|
19167 |
|
19168 |
|
19169 |
|
19170 | if (callback) {
|
19171 | callback();
|
19172 | }
|
19173 | };
|
19174 |
|
19175 | _Event2['default'].addEndEventListener(node, node.rcEndListener);
|
19176 |
|
19177 | node.rcAnimTimeout = setTimeout(function () {
|
19178 | for (var s in style) {
|
19179 | if (style.hasOwnProperty(s)) {
|
19180 | node.style[s] = style[s];
|
19181 | }
|
19182 | }
|
19183 | node.rcAnimTimeout = null;
|
19184 | fixBrowserByTimeout(node);
|
19185 | }, 0);
|
19186 | };
|
19187 |
|
19188 | cssAnimation.setTransition = function (node, p, value) {
|
19189 | var property = p;
|
19190 | var v = value;
|
19191 | if (value === undefined) {
|
19192 | v = property;
|
19193 | property = '';
|
19194 | }
|
19195 | property = property || '';
|
19196 | capitalPrefixes.forEach(function (prefix) {
|
19197 | node.style[prefix + 'Transition' + property] = v;
|
19198 | });
|
19199 | };
|
19200 |
|
19201 | cssAnimation.isCssAnimationSupported = isCssAnimationSupported;
|
19202 |
|
19203 | exports.isCssAnimationSupported = isCssAnimationSupported;
|
19204 | exports['default'] = cssAnimation;
|
19205 |
|
19206 | }),
|
19207 |
|
19208 | (function(module, exports) {
|
19209 |
|
19210 | 'use strict';
|
19211 |
|
19212 | Object.defineProperty(exports, "__esModule", {
|
19213 | value: true
|
19214 | });
|
19215 | var START_EVENT_NAME_MAP = {
|
19216 | transitionstart: {
|
19217 | transition: 'transitionstart',
|
19218 | WebkitTransition: 'webkitTransitionStart',
|
19219 | MozTransition: 'mozTransitionStart',
|
19220 | OTransition: 'oTransitionStart',
|
19221 | msTransition: 'MSTransitionStart'
|
19222 | },
|
19223 |
|
19224 | animationstart: {
|
19225 | animation: 'animationstart',
|
19226 | WebkitAnimation: 'webkitAnimationStart',
|
19227 | MozAnimation: 'mozAnimationStart',
|
19228 | OAnimation: 'oAnimationStart',
|
19229 | msAnimation: 'MSAnimationStart'
|
19230 | }
|
19231 | };
|
19232 |
|
19233 | var END_EVENT_NAME_MAP = {
|
19234 | transitionend: {
|
19235 | transition: 'transitionend',
|
19236 | WebkitTransition: 'webkitTransitionEnd',
|
19237 | MozTransition: 'mozTransitionEnd',
|
19238 | OTransition: 'oTransitionEnd',
|
19239 | msTransition: 'MSTransitionEnd'
|
19240 | },
|
19241 |
|
19242 | animationend: {
|
19243 | animation: 'animationend',
|
19244 | WebkitAnimation: 'webkitAnimationEnd',
|
19245 | MozAnimation: 'mozAnimationEnd',
|
19246 | OAnimation: 'oAnimationEnd',
|
19247 | msAnimation: 'MSAnimationEnd'
|
19248 | }
|
19249 | };
|
19250 |
|
19251 | var startEvents = [];
|
19252 | var endEvents = [];
|
19253 |
|
19254 | function detectEvents() {
|
19255 | var testEl = document.createElement('div');
|
19256 | var style = testEl.style;
|
19257 |
|
19258 | if (!('AnimationEvent' in window)) {
|
19259 | delete START_EVENT_NAME_MAP.animationstart.animation;
|
19260 | delete END_EVENT_NAME_MAP.animationend.animation;
|
19261 | }
|
19262 |
|
19263 | if (!('TransitionEvent' in window)) {
|
19264 | delete START_EVENT_NAME_MAP.transitionstart.transition;
|
19265 | delete END_EVENT_NAME_MAP.transitionend.transition;
|
19266 | }
|
19267 |
|
19268 | function process(EVENT_NAME_MAP, events) {
|
19269 | for (var baseEventName in EVENT_NAME_MAP) {
|
19270 | if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
|
19271 | var baseEvents = EVENT_NAME_MAP[baseEventName];
|
19272 | for (var styleName in baseEvents) {
|
19273 | if (styleName in style) {
|
19274 | events.push(baseEvents[styleName]);
|
19275 | break;
|
19276 | }
|
19277 | }
|
19278 | }
|
19279 | }
|
19280 | }
|
19281 |
|
19282 | process(START_EVENT_NAME_MAP, startEvents);
|
19283 | process(END_EVENT_NAME_MAP, endEvents);
|
19284 | }
|
19285 |
|
19286 | if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
19287 | detectEvents();
|
19288 | }
|
19289 |
|
19290 | function addEventListener(node, eventName, eventListener) {
|
19291 | node.addEventListener(eventName, eventListener, false);
|
19292 | }
|
19293 |
|
19294 | function removeEventListener(node, eventName, eventListener) {
|
19295 | node.removeEventListener(eventName, eventListener, false);
|
19296 | }
|
19297 |
|
19298 | var TransitionEvents = {
|
19299 |
|
19300 | startEvents: startEvents,
|
19301 |
|
19302 | addStartEventListener: function addStartEventListener(node, eventListener) {
|
19303 | if (startEvents.length === 0) {
|
19304 | window.setTimeout(eventListener, 0);
|
19305 | return;
|
19306 | }
|
19307 | startEvents.forEach(function (startEvent) {
|
19308 | addEventListener(node, startEvent, eventListener);
|
19309 | });
|
19310 | },
|
19311 | removeStartEventListener: function removeStartEventListener(node, eventListener) {
|
19312 | if (startEvents.length === 0) {
|
19313 | return;
|
19314 | }
|
19315 | startEvents.forEach(function (startEvent) {
|
19316 | removeEventListener(node, startEvent, eventListener);
|
19317 | });
|
19318 | },
|
19319 |
|
19320 |
|
19321 |
|
19322 | endEvents: endEvents,
|
19323 |
|
19324 | addEndEventListener: function addEndEventListener(node, eventListener) {
|
19325 | if (endEvents.length === 0) {
|
19326 | window.setTimeout(eventListener, 0);
|
19327 | return;
|
19328 | }
|
19329 | endEvents.forEach(function (endEvent) {
|
19330 | addEventListener(node, endEvent, eventListener);
|
19331 | });
|
19332 | },
|
19333 | removeEndEventListener: function removeEndEventListener(node, eventListener) {
|
19334 | if (endEvents.length === 0) {
|
19335 | return;
|
19336 | }
|
19337 | endEvents.forEach(function (endEvent) {
|
19338 | removeEventListener(node, endEvent, eventListener);
|
19339 | });
|
19340 | }
|
19341 | };
|
19342 |
|
19343 | exports['default'] = TransitionEvents;
|
19344 | module.exports = exports['default'];
|
19345 |
|
19346 | }),
|
19347 |
|
19348 | (function(module, exports) {
|
19349 |
|
19350 | "use strict";
|
19351 |
|
19352 | Object.defineProperty(exports, "__esModule", {
|
19353 | value: true
|
19354 | });
|
19355 | var util = {
|
19356 | isAppearSupported: function isAppearSupported(props) {
|
19357 | return props.transitionName && props.transitionAppear || props.animation.appear;
|
19358 | },
|
19359 | isEnterSupported: function isEnterSupported(props) {
|
19360 | return props.transitionName && props.transitionEnter || props.animation.enter;
|
19361 | },
|
19362 | isLeaveSupported: function isLeaveSupported(props) {
|
19363 | return props.transitionName && props.transitionLeave || props.animation.leave;
|
19364 | },
|
19365 | allowAppearCallback: function allowAppearCallback(props) {
|
19366 | return props.transitionAppear || props.animation.appear;
|
19367 | },
|
19368 | allowEnterCallback: function allowEnterCallback(props) {
|
19369 | return props.transitionEnter || props.animation.enter;
|
19370 | },
|
19371 | allowLeaveCallback: function allowLeaveCallback(props) {
|
19372 | return props.transitionLeave || props.animation.leave;
|
19373 | }
|
19374 | };
|
19375 | exports["default"] = util;
|
19376 | module.exports = exports['default'];
|
19377 |
|
19378 | }),
|
19379 |
|
19380 | (function(module, exports, __webpack_require__) {
|
19381 |
|
19382 | 'use strict';
|
19383 |
|
19384 | exports.__esModule = true;
|
19385 |
|
19386 | var _classCallCheck2 = __webpack_require__(134);
|
19387 |
|
19388 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
19389 |
|
19390 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
19391 |
|
19392 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
19393 |
|
19394 | var _inherits2 = __webpack_require__(169);
|
19395 |
|
19396 | var _inherits3 = _interopRequireDefault(_inherits2);
|
19397 |
|
19398 | var _react = __webpack_require__(4);
|
19399 |
|
19400 | var _react2 = _interopRequireDefault(_react);
|
19401 |
|
19402 | var _propTypes = __webpack_require__(5);
|
19403 |
|
19404 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
19405 |
|
19406 | var _LazyRenderBox = __webpack_require__(217);
|
19407 |
|
19408 | var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox);
|
19409 |
|
19410 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19411 |
|
19412 | var PopupInner = function (_Component) {
|
19413 | (0, _inherits3['default'])(PopupInner, _Component);
|
19414 |
|
19415 | function PopupInner() {
|
19416 | (0, _classCallCheck3['default'])(this, PopupInner);
|
19417 | return (0, _possibleConstructorReturn3['default'])(this, _Component.apply(this, arguments));
|
19418 | }
|
19419 |
|
19420 | PopupInner.prototype.render = function render() {
|
19421 | var props = this.props;
|
19422 | var className = props.className;
|
19423 | if (!props.visible) {
|
19424 | className += ' ' + props.hiddenClassName;
|
19425 | }
|
19426 | return _react2['default'].createElement(
|
19427 | 'div',
|
19428 | {
|
19429 | className: className,
|
19430 | onMouseEnter: props.onMouseEnter,
|
19431 | onMouseLeave: props.onMouseLeave,
|
19432 | onMouseDown: props.onMouseDown,
|
19433 | onTouchStart: props.onTouchStart,
|
19434 | style: props.style
|
19435 | },
|
19436 | _react2['default'].createElement(
|
19437 | _LazyRenderBox2['default'],
|
19438 | { className: props.prefixCls + '-content', visible: props.visible },
|
19439 | props.children
|
19440 | )
|
19441 | );
|
19442 | };
|
19443 |
|
19444 | return PopupInner;
|
19445 | }(_react.Component);
|
19446 |
|
19447 | PopupInner.propTypes = {
|
19448 | hiddenClassName: _propTypes2['default'].string,
|
19449 | className: _propTypes2['default'].string,
|
19450 | prefixCls: _propTypes2['default'].string,
|
19451 | onMouseEnter: _propTypes2['default'].func,
|
19452 | onMouseLeave: _propTypes2['default'].func,
|
19453 | onMouseDown: _propTypes2['default'].func,
|
19454 | onTouchStart: _propTypes2['default'].func,
|
19455 | children: _propTypes2['default'].any
|
19456 | };
|
19457 | exports['default'] = PopupInner;
|
19458 | module.exports = exports['default'];
|
19459 |
|
19460 | }),
|
19461 |
|
19462 | (function(module, exports, __webpack_require__) {
|
19463 |
|
19464 | 'use strict';
|
19465 |
|
19466 | exports.__esModule = true;
|
19467 |
|
19468 | var _objectWithoutProperties2 = __webpack_require__(133);
|
19469 |
|
19470 | var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
19471 |
|
19472 | var _classCallCheck2 = __webpack_require__(134);
|
19473 |
|
19474 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
19475 |
|
19476 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
19477 |
|
19478 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
19479 |
|
19480 | var _inherits2 = __webpack_require__(169);
|
19481 |
|
19482 | var _inherits3 = _interopRequireDefault(_inherits2);
|
19483 |
|
19484 | var _react = __webpack_require__(4);
|
19485 |
|
19486 | var _react2 = _interopRequireDefault(_react);
|
19487 |
|
19488 | var _propTypes = __webpack_require__(5);
|
19489 |
|
19490 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
19491 |
|
19492 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19493 |
|
19494 | var LazyRenderBox = function (_Component) {
|
19495 | (0, _inherits3['default'])(LazyRenderBox, _Component);
|
19496 |
|
19497 | function LazyRenderBox() {
|
19498 | (0, _classCallCheck3['default'])(this, LazyRenderBox);
|
19499 | return (0, _possibleConstructorReturn3['default'])(this, _Component.apply(this, arguments));
|
19500 | }
|
19501 |
|
19502 | LazyRenderBox.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
19503 | return nextProps.hiddenClassName || nextProps.visible;
|
19504 | };
|
19505 |
|
19506 | LazyRenderBox.prototype.render = function render() {
|
19507 | var _props = this.props,
|
19508 | hiddenClassName = _props.hiddenClassName,
|
19509 | visible = _props.visible,
|
19510 | props = (0, _objectWithoutProperties3['default'])(_props, ['hiddenClassName', 'visible']);
|
19511 |
|
19512 |
|
19513 | if (hiddenClassName || _react2['default'].Children.count(props.children) > 1) {
|
19514 | if (!visible && hiddenClassName) {
|
19515 | props.className += ' ' + hiddenClassName;
|
19516 | }
|
19517 | return _react2['default'].createElement('div', props);
|
19518 | }
|
19519 |
|
19520 | return _react2['default'].Children.only(props.children);
|
19521 | };
|
19522 |
|
19523 | return LazyRenderBox;
|
19524 | }(_react.Component);
|
19525 |
|
19526 | LazyRenderBox.propTypes = {
|
19527 | children: _propTypes2['default'].any,
|
19528 | className: _propTypes2['default'].string,
|
19529 | visible: _propTypes2['default'].bool,
|
19530 | hiddenClassName: _propTypes2['default'].string
|
19531 | };
|
19532 | exports['default'] = LazyRenderBox;
|
19533 | module.exports = exports['default'];
|
19534 |
|
19535 | }),
|
19536 |
|
19537 | (function(module, exports) {
|
19538 |
|
19539 | 'use strict';
|
19540 |
|
19541 | exports.__esModule = true;
|
19542 | var autoAdjustOverflow = {
|
19543 | adjustX: 1,
|
19544 | adjustY: 1
|
19545 | };
|
19546 |
|
19547 | var placements = exports.placements = {
|
19548 | topLeft: {
|
19549 | points: ['bl', 'tl'],
|
19550 | overflow: autoAdjustOverflow,
|
19551 | offset: [0, -7]
|
19552 | },
|
19553 | bottomLeft: {
|
19554 | points: ['tl', 'bl'],
|
19555 | overflow: autoAdjustOverflow,
|
19556 | offset: [0, 7]
|
19557 | },
|
19558 | leftTop: {
|
19559 | points: ['tr', 'tl'],
|
19560 | overflow: autoAdjustOverflow,
|
19561 | offset: [-4, 0]
|
19562 | },
|
19563 | rightTop: {
|
19564 | points: ['tl', 'tr'],
|
19565 | overflow: autoAdjustOverflow,
|
19566 | offset: [4, 0]
|
19567 | }
|
19568 | };
|
19569 |
|
19570 | exports['default'] = placements;
|
19571 |
|
19572 | }),
|
19573 |
|
19574 | (function(module, exports) {
|
19575 |
|
19576 |
|
19577 |
|
19578 | window.MutationObserver=window.MutationObserver||function(w){function v(a){this.i=[];this.m=a}function I(a){(function c(){var d=a.takeRecords();d.length&&a.m(d,a);a.h=setTimeout(c,v._period)})()}function p(a){var b={type:null,target:null,addedNodes:[],removedNodes:[],previousSibling:null,nextSibling:null,attributeName:null,attributeNamespace:null,oldValue:null},c;for(c in a)b[c]!==w&&a[c]!==w&&(b[c]=a[c]);return b}function J(a,b){var c=C(a,b);return function(d){var f=d.length,n;b.a&&3===a.nodeType&&
|
19579 | a.nodeValue!==c.a&&d.push(new p({type:"characterData",target:a,oldValue:c.a}));b.b&&c.b&&A(d,a,c.b,b.f);if(b.c||b.g)n=K(d,a,c,b);if(n||d.length!==f)c=C(a,b)}}function L(a,b){return b.value}function M(a,b){return"style"!==b.name?b.value:a.style.cssText}function A(a,b,c,d){for(var f={},n=b.attributes,k,g,x=n.length;x--;)k=n[x],g=k.name,d&&d[g]===w||(D(b,k)!==c[g]&&a.push(p({type:"attributes",target:b,attributeName:g,oldValue:c[g],attributeNamespace:k.namespaceURI})),f[g]=!0);for(g in c)f[g]||a.push(p({target:b,
|
19580 | type:"attributes",attributeName:g,oldValue:c[g]}))}function K(a,b,c,d){function f(b,c,f,k,y){var g=b.length-1;y=-~((g-y)/2);for(var h,l,e;e=b.pop();)h=f[e.j],l=k[e.l],d.c&&y&&Math.abs(e.j-e.l)>=g&&(a.push(p({type:"childList",target:c,addedNodes:[h],removedNodes:[h],nextSibling:h.nextSibling,previousSibling:h.previousSibling})),y--),d.b&&l.b&&A(a,h,l.b,d.f),d.a&&3===h.nodeType&&h.nodeValue!==l.a&&a.push(p({type:"characterData",target:h,oldValue:l.a})),d.g&&n(h,l)}function n(b,c){for(var g=b.childNodes,
|
19581 | q=c.c,x=g.length,v=q?q.length:0,h,l,e,m,t,z=0,u=0,r=0;u<x||r<v;)m=g[u],t=(e=q[r])&&e.node,m===t?(d.b&&e.b&&A(a,m,e.b,d.f),d.a&&e.a!==w&&m.nodeValue!==e.a&&a.push(p({type:"characterData",target:m,oldValue:e.a})),l&&f(l,b,g,q,z),d.g&&(m.childNodes.length||e.c&&e.c.length)&&n(m,e),u++,r++):(k=!0,h||(h={},l=[]),m&&(h[e=E(m)]||(h[e]=!0,-1===(e=F(q,m,r,"node"))?d.c&&(a.push(p({type:"childList",target:b,addedNodes:[m],nextSibling:m.nextSibling,previousSibling:m.previousSibling})),z++):l.push({j:u,l:e})),
|
19582 | u++),t&&t!==g[u]&&(h[e=E(t)]||(h[e]=!0,-1===(e=F(g,t,u))?d.c&&(a.push(p({type:"childList",target:c.node,removedNodes:[t],nextSibling:q[r+1],previousSibling:q[r-1]})),z--):l.push({j:e,l:r})),r++));l&&f(l,b,g,q,z)}var k;n(b,c);return k}function C(a,b){var c=!0;return function f(a){var k={node:a};!b.a||3!==a.nodeType&&8!==a.nodeType?(b.b&&c&&1===a.nodeType&&(k.b=G(a.attributes,function(c,f){if(!b.f||b.f[f.name])c[f.name]=D(a,f);return c})),c&&(b.c||b.a||b.b&&b.g)&&(k.c=N(a.childNodes,f)),c=b.g):k.a=
|
19583 | a.nodeValue;return k}(a)}function E(a){try{return a.id||(a.mo_id=a.mo_id||H++)}catch(b){try{return a.nodeValue}catch(c){return H++}}}function N(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d,a);return c}function G(a,b){for(var c={},d=0;d<a.length;d++)c=b(c,a[d],d,a);return c}function F(a,b,c,d){for(;c<a.length;c++)if((d?a[c][d]:a[c])===b)return c;return-1}v._period=30;v.prototype={observe:function(a,b){for(var c={b:!!(b.attributes||b.attributeFilter||b.attributeOldValue),c:!!b.childList,g:!!b.subtree,
|
19584 | a:!(!b.characterData&&!b.characterDataOldValue)},d=this.i,f=0;f<d.length;f++)d[f].s===a&&d.splice(f,1);b.attributeFilter&&(c.f=G(b.attributeFilter,function(a,b){a[b]=!0;return a}));d.push({s:a,o:J(a,c)});this.h||I(this)},takeRecords:function(){for(var a=[],b=this.i,c=0;c<b.length;c++)b[c].o(a);return a},disconnect:function(){this.i=[];clearTimeout(this.h);this.h=null}};var B=document.createElement("i");B.style.top=0;var D=(B="null"!=B.attributes.style.value)?L:M,H=1;return v}(void 0);
|
19585 |
|
19586 |
|
19587 | }),
|
19588 |
|
19589 | (function(module, exports, __webpack_require__) {
|
19590 |
|
19591 | 'use strict';
|
19592 |
|
19593 | exports.__esModule = true;
|
19594 | exports.MenuItem = undefined;
|
19595 |
|
19596 | var _extends2 = __webpack_require__(94);
|
19597 |
|
19598 | var _extends3 = _interopRequireDefault(_extends2);
|
19599 |
|
19600 | var _classCallCheck2 = __webpack_require__(134);
|
19601 |
|
19602 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
19603 |
|
19604 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
19605 |
|
19606 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
19607 |
|
19608 | var _inherits2 = __webpack_require__(169);
|
19609 |
|
19610 | var _inherits3 = _interopRequireDefault(_inherits2);
|
19611 |
|
19612 | var _react = __webpack_require__(4);
|
19613 |
|
19614 | var _react2 = _interopRequireDefault(_react);
|
19615 |
|
19616 | var _reactDom = __webpack_require__(12);
|
19617 |
|
19618 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
19619 |
|
19620 | var _propTypes = __webpack_require__(5);
|
19621 |
|
19622 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
19623 |
|
19624 | var _KeyCode = __webpack_require__(188);
|
19625 |
|
19626 | var _KeyCode2 = _interopRequireDefault(_KeyCode);
|
19627 |
|
19628 | var _classnames = __webpack_require__(3);
|
19629 |
|
19630 | var _classnames2 = _interopRequireDefault(_classnames);
|
19631 |
|
19632 | var _domScrollIntoView = __webpack_require__(221);
|
19633 |
|
19634 | var _domScrollIntoView2 = _interopRequireDefault(_domScrollIntoView);
|
19635 |
|
19636 | var _miniStore = __webpack_require__(177);
|
19637 |
|
19638 | var _util = __webpack_require__(190);
|
19639 |
|
19640 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19641 |
|
19642 |
|
19643 |
|
19644 | var MenuItem = exports.MenuItem = function (_React$Component) {
|
19645 | (0, _inherits3['default'])(MenuItem, _React$Component);
|
19646 |
|
19647 | function MenuItem(props) {
|
19648 | (0, _classCallCheck3['default'])(this, MenuItem);
|
19649 |
|
19650 | var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
|
19651 |
|
19652 | _this.onKeyDown = function (e) {
|
19653 | var keyCode = e.keyCode;
|
19654 | if (keyCode === _KeyCode2['default'].ENTER) {
|
19655 | _this.onClick(e);
|
19656 | return true;
|
19657 | }
|
19658 | };
|
19659 |
|
19660 | _this.onMouseLeave = function (e) {
|
19661 | var _this$props = _this.props,
|
19662 | eventKey = _this$props.eventKey,
|
19663 | onItemHover = _this$props.onItemHover,
|
19664 | onMouseLeave = _this$props.onMouseLeave;
|
19665 |
|
19666 | onItemHover({
|
19667 | key: eventKey,
|
19668 | hover: false
|
19669 | });
|
19670 | onMouseLeave({
|
19671 | key: eventKey,
|
19672 | domEvent: e
|
19673 | });
|
19674 | };
|
19675 |
|
19676 | _this.onMouseEnter = function (e) {
|
19677 | var _this$props2 = _this.props,
|
19678 | eventKey = _this$props2.eventKey,
|
19679 | onItemHover = _this$props2.onItemHover,
|
19680 | onMouseEnter = _this$props2.onMouseEnter;
|
19681 |
|
19682 | onItemHover({
|
19683 | key: eventKey,
|
19684 | hover: true
|
19685 | });
|
19686 | onMouseEnter({
|
19687 | key: eventKey,
|
19688 | domEvent: e
|
19689 | });
|
19690 | };
|
19691 |
|
19692 | _this.onClick = function (e) {
|
19693 | var _this$props3 = _this.props,
|
19694 | eventKey = _this$props3.eventKey,
|
19695 | multiple = _this$props3.multiple,
|
19696 | onClick = _this$props3.onClick,
|
19697 | onSelect = _this$props3.onSelect,
|
19698 | onDeselect = _this$props3.onDeselect,
|
19699 | isSelected = _this$props3.isSelected;
|
19700 |
|
19701 | var info = {
|
19702 | key: eventKey,
|
19703 | keyPath: [eventKey],
|
19704 | item: _this,
|
19705 | domEvent: e
|
19706 | };
|
19707 | onClick(info);
|
19708 | if (multiple) {
|
19709 | if (isSelected) {
|
19710 | onDeselect(info);
|
19711 | } else {
|
19712 | onSelect(info);
|
19713 | }
|
19714 | } else if (!isSelected) {
|
19715 | onSelect(info);
|
19716 | }
|
19717 | };
|
19718 |
|
19719 | return _this;
|
19720 | }
|
19721 |
|
19722 | MenuItem.prototype.componentDidMount = function componentDidMount() {
|
19723 |
|
19724 | this.callRef();
|
19725 | };
|
19726 |
|
19727 | MenuItem.prototype.componentDidUpdate = function componentDidUpdate() {
|
19728 | if (this.props.active) {
|
19729 | (0, _domScrollIntoView2['default'])(_reactDom2['default'].findDOMNode(this), _reactDom2['default'].findDOMNode(this.props.parentMenu), {
|
19730 | onlyScrollIfNeeded: true
|
19731 | });
|
19732 | }
|
19733 | this.callRef();
|
19734 | };
|
19735 |
|
19736 | MenuItem.prototype.componentWillUnmount = function componentWillUnmount() {
|
19737 | var props = this.props;
|
19738 | if (props.onDestroy) {
|
19739 | props.onDestroy(props.eventKey);
|
19740 | }
|
19741 | };
|
19742 |
|
19743 | MenuItem.prototype.getPrefixCls = function getPrefixCls() {
|
19744 | return this.props.rootPrefixCls + '-item';
|
19745 | };
|
19746 |
|
19747 | MenuItem.prototype.getActiveClassName = function getActiveClassName() {
|
19748 | return this.getPrefixCls() + '-active';
|
19749 | };
|
19750 |
|
19751 | MenuItem.prototype.getSelectedClassName = function getSelectedClassName() {
|
19752 | return this.getPrefixCls() + '-selected';
|
19753 | };
|
19754 |
|
19755 | MenuItem.prototype.getDisabledClassName = function getDisabledClassName() {
|
19756 | return this.getPrefixCls() + '-disabled';
|
19757 | };
|
19758 |
|
19759 | MenuItem.prototype.callRef = function callRef() {
|
19760 | if (this.props.manualRef) {
|
19761 | this.props.manualRef(this);
|
19762 | }
|
19763 | };
|
19764 |
|
19765 | MenuItem.prototype.render = function render() {
|
19766 | var _classNames;
|
19767 |
|
19768 | var props = (0, _extends3['default'])({}, this.props);
|
19769 | var className = (0, _classnames2['default'])(this.getPrefixCls(), props.className, (_classNames = {}, _classNames[this.getActiveClassName()] = !props.disabled && props.active, _classNames[this.getSelectedClassName()] = props.isSelected, _classNames[this.getDisabledClassName()] = props.disabled, _classNames));
|
19770 | var attrs = (0, _extends3['default'])({}, props.attribute, {
|
19771 | title: props.title,
|
19772 | className: className,
|
19773 |
|
19774 | role: props.role || 'menuitem',
|
19775 | 'aria-disabled': props.disabled
|
19776 | });
|
19777 |
|
19778 | if (props.role === 'option') {
|
19779 |
|
19780 | attrs = (0, _extends3['default'])({}, attrs, {
|
19781 | role: 'option',
|
19782 | 'aria-selected': props.isSelected
|
19783 | });
|
19784 | } else if (props.role === null || props.role === 'none') {
|
19785 |
|
19786 |
|
19787 |
|
19788 |
|
19789 |
|
19790 | attrs.role = 'none';
|
19791 | }
|
19792 |
|
19793 | var mouseEvent = {
|
19794 | onClick: props.disabled ? null : this.onClick,
|
19795 | onMouseLeave: props.disabled ? null : this.onMouseLeave,
|
19796 | onMouseEnter: props.disabled ? null : this.onMouseEnter
|
19797 | };
|
19798 | var style = (0, _extends3['default'])({}, props.style);
|
19799 | if (props.mode === 'inline') {
|
19800 | style.paddingLeft = props.inlineIndent * props.level;
|
19801 | }
|
19802 | _util.menuAllProps.forEach(function (key) {
|
19803 | return delete props[key];
|
19804 | });
|
19805 | var icon = this.props.itemIcon;
|
19806 | if (typeof this.props.itemIcon === 'function') {
|
19807 | icon = _react2['default'].createElement(this.props.itemIcon, this.props);
|
19808 | }
|
19809 | return _react2['default'].createElement(
|
19810 | 'li',
|
19811 | (0, _extends3['default'])({}, props, attrs, mouseEvent, {
|
19812 | style: style
|
19813 | }),
|
19814 | props.children,
|
19815 | icon
|
19816 | );
|
19817 | };
|
19818 |
|
19819 | return MenuItem;
|
19820 | }(_react2['default'].Component);
|
19821 |
|
19822 | MenuItem.propTypes = {
|
19823 | attribute: _propTypes2['default'].object,
|
19824 | rootPrefixCls: _propTypes2['default'].string,
|
19825 | eventKey: _propTypes2['default'].string,
|
19826 | active: _propTypes2['default'].bool,
|
19827 | children: _propTypes2['default'].any,
|
19828 | selectedKeys: _propTypes2['default'].array,
|
19829 | disabled: _propTypes2['default'].bool,
|
19830 | title: _propTypes2['default'].string,
|
19831 | onItemHover: _propTypes2['default'].func,
|
19832 | onSelect: _propTypes2['default'].func,
|
19833 | onClick: _propTypes2['default'].func,
|
19834 | onDeselect: _propTypes2['default'].func,
|
19835 | parentMenu: _propTypes2['default'].object,
|
19836 | onDestroy: _propTypes2['default'].func,
|
19837 | onMouseEnter: _propTypes2['default'].func,
|
19838 | onMouseLeave: _propTypes2['default'].func,
|
19839 | multiple: _propTypes2['default'].bool,
|
19840 | isSelected: _propTypes2['default'].bool,
|
19841 | manualRef: _propTypes2['default'].func,
|
19842 | itemIcon: _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].node])
|
19843 | };
|
19844 | MenuItem.defaultProps = {
|
19845 | onSelect: _util.noop,
|
19846 | onMouseEnter: _util.noop,
|
19847 | onMouseLeave: _util.noop,
|
19848 | manualRef: _util.noop
|
19849 | };
|
19850 |
|
19851 |
|
19852 | MenuItem.isMenuItem = true;
|
19853 |
|
19854 | var connected = (0, _miniStore.connect)(function (_ref, _ref2) {
|
19855 | var activeKey = _ref.activeKey,
|
19856 | selectedKeys = _ref.selectedKeys;
|
19857 | var eventKey = _ref2.eventKey,
|
19858 | subMenuKey = _ref2.subMenuKey;
|
19859 | return {
|
19860 | active: activeKey[subMenuKey] === eventKey,
|
19861 | isSelected: selectedKeys.indexOf(eventKey) !== -1
|
19862 | };
|
19863 | })(MenuItem);
|
19864 |
|
19865 | exports['default'] = connected;
|
19866 |
|
19867 | }),
|
19868 |
|
19869 | (function(module, exports, __webpack_require__) {
|
19870 |
|
19871 | 'use strict';
|
19872 |
|
19873 | module.exports = __webpack_require__(222);
|
19874 |
|
19875 | }),
|
19876 |
|
19877 | (function(module, exports, __webpack_require__) {
|
19878 |
|
19879 | 'use strict';
|
19880 |
|
19881 | var util = __webpack_require__(223);
|
19882 |
|
19883 | function scrollIntoView(elem, container, config) {
|
19884 | config = config || {};
|
19885 |
|
19886 | if (container.nodeType === 9) {
|
19887 | container = util.getWindow(container);
|
19888 | }
|
19889 |
|
19890 | var allowHorizontalScroll = config.allowHorizontalScroll;
|
19891 | var onlyScrollIfNeeded = config.onlyScrollIfNeeded;
|
19892 | var alignWithTop = config.alignWithTop;
|
19893 | var alignWithLeft = config.alignWithLeft;
|
19894 | var offsetTop = config.offsetTop || 0;
|
19895 | var offsetLeft = config.offsetLeft || 0;
|
19896 | var offsetBottom = config.offsetBottom || 0;
|
19897 | var offsetRight = config.offsetRight || 0;
|
19898 |
|
19899 | allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;
|
19900 |
|
19901 | var isWin = util.isWindow(container);
|
19902 | var elemOffset = util.offset(elem);
|
19903 | var eh = util.outerHeight(elem);
|
19904 | var ew = util.outerWidth(elem);
|
19905 | var containerOffset = undefined;
|
19906 | var ch = undefined;
|
19907 | var cw = undefined;
|
19908 | var containerScroll = undefined;
|
19909 | var diffTop = undefined;
|
19910 | var diffBottom = undefined;
|
19911 | var win = undefined;
|
19912 | var winScroll = undefined;
|
19913 | var ww = undefined;
|
19914 | var wh = undefined;
|
19915 |
|
19916 | if (isWin) {
|
19917 | win = container;
|
19918 | wh = util.height(win);
|
19919 | ww = util.width(win);
|
19920 | winScroll = {
|
19921 | left: util.scrollLeft(win),
|
19922 | top: util.scrollTop(win)
|
19923 | };
|
19924 |
|
19925 | diffTop = {
|
19926 | left: elemOffset.left - winScroll.left - offsetLeft,
|
19927 | top: elemOffset.top - winScroll.top - offsetTop
|
19928 | };
|
19929 | diffBottom = {
|
19930 | left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,
|
19931 | top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom
|
19932 | };
|
19933 | containerScroll = winScroll;
|
19934 | } else {
|
19935 | containerOffset = util.offset(container);
|
19936 | ch = container.clientHeight;
|
19937 | cw = container.clientWidth;
|
19938 | containerScroll = {
|
19939 | left: container.scrollLeft,
|
19940 | top: container.scrollTop
|
19941 | };
|
19942 |
|
19943 |
|
19944 | diffTop = {
|
19945 | left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,
|
19946 | top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop
|
19947 | };
|
19948 | diffBottom = {
|
19949 | left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,
|
19950 | top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom
|
19951 | };
|
19952 | }
|
19953 |
|
19954 | if (diffTop.top < 0 || diffBottom.top > 0) {
|
19955 |
|
19956 | if (alignWithTop === true) {
|
19957 | util.scrollTop(container, containerScroll.top + diffTop.top);
|
19958 | } else if (alignWithTop === false) {
|
19959 | util.scrollTop(container, containerScroll.top + diffBottom.top);
|
19960 | } else {
|
19961 |
|
19962 | if (diffTop.top < 0) {
|
19963 | util.scrollTop(container, containerScroll.top + diffTop.top);
|
19964 | } else {
|
19965 | util.scrollTop(container, containerScroll.top + diffBottom.top);
|
19966 | }
|
19967 | }
|
19968 | } else {
|
19969 | if (!onlyScrollIfNeeded) {
|
19970 | alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;
|
19971 | if (alignWithTop) {
|
19972 | util.scrollTop(container, containerScroll.top + diffTop.top);
|
19973 | } else {
|
19974 | util.scrollTop(container, containerScroll.top + diffBottom.top);
|
19975 | }
|
19976 | }
|
19977 | }
|
19978 |
|
19979 | if (allowHorizontalScroll) {
|
19980 | if (diffTop.left < 0 || diffBottom.left > 0) {
|
19981 |
|
19982 | if (alignWithLeft === true) {
|
19983 | util.scrollLeft(container, containerScroll.left + diffTop.left);
|
19984 | } else if (alignWithLeft === false) {
|
19985 | util.scrollLeft(container, containerScroll.left + diffBottom.left);
|
19986 | } else {
|
19987 |
|
19988 | if (diffTop.left < 0) {
|
19989 | util.scrollLeft(container, containerScroll.left + diffTop.left);
|
19990 | } else {
|
19991 | util.scrollLeft(container, containerScroll.left + diffBottom.left);
|
19992 | }
|
19993 | }
|
19994 | } else {
|
19995 | if (!onlyScrollIfNeeded) {
|
19996 | alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;
|
19997 | if (alignWithLeft) {
|
19998 | util.scrollLeft(container, containerScroll.left + diffTop.left);
|
19999 | } else {
|
20000 | util.scrollLeft(container, containerScroll.left + diffBottom.left);
|
20001 | }
|
20002 | }
|
20003 | }
|
20004 | }
|
20005 | }
|
20006 |
|
20007 | module.exports = scrollIntoView;
|
20008 |
|
20009 | }),
|
20010 |
|
20011 | (function(module, exports) {
|
20012 |
|
20013 | 'use strict';
|
20014 |
|
20015 | 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; };
|
20016 |
|
20017 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
20018 |
|
20019 | var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
|
20020 |
|
20021 | function getClientPosition(elem) {
|
20022 | var box = undefined;
|
20023 | var x = undefined;
|
20024 | var y = undefined;
|
20025 | var doc = elem.ownerDocument;
|
20026 | var body = doc.body;
|
20027 | var docElem = doc && doc.documentElement;
|
20028 |
|
20029 | box = elem.getBoundingClientRect();
|
20030 |
|
20031 |
|
20032 |
|
20033 |
|
20034 |
|
20035 | x = box.left;
|
20036 | y = box.top;
|
20037 |
|
20038 |
|
20039 |
|
20040 |
|
20041 |
|
20042 |
|
20043 |
|
20044 |
|
20045 |
|
20046 |
|
20047 |
|
20048 |
|
20049 |
|
20050 |
|
20051 |
|
20052 |
|
20053 |
|
20054 |
|
20055 |
|
20056 |
|
20057 |
|
20058 | x -= docElem.clientLeft || body.clientLeft || 0;
|
20059 | y -= docElem.clientTop || body.clientTop || 0;
|
20060 |
|
20061 | return {
|
20062 | left: x,
|
20063 | top: y
|
20064 | };
|
20065 | }
|
20066 |
|
20067 | function getScroll(w, top) {
|
20068 | var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
|
20069 | var method = 'scroll' + (top ? 'Top' : 'Left');
|
20070 | if (typeof ret !== 'number') {
|
20071 | var d = w.document;
|
20072 |
|
20073 | ret = d.documentElement[method];
|
20074 | if (typeof ret !== 'number') {
|
20075 |
|
20076 | ret = d.body[method];
|
20077 | }
|
20078 | }
|
20079 | return ret;
|
20080 | }
|
20081 |
|
20082 | function getScrollLeft(w) {
|
20083 | return getScroll(w);
|
20084 | }
|
20085 |
|
20086 | function getScrollTop(w) {
|
20087 | return getScroll(w, true);
|
20088 | }
|
20089 |
|
20090 | function getOffset(el) {
|
20091 | var pos = getClientPosition(el);
|
20092 | var doc = el.ownerDocument;
|
20093 | var w = doc.defaultView || doc.parentWindow;
|
20094 | pos.left += getScrollLeft(w);
|
20095 | pos.top += getScrollTop(w);
|
20096 | return pos;
|
20097 | }
|
20098 | function _getComputedStyle(elem, name, computedStyle_) {
|
20099 | var val = '';
|
20100 | var d = elem.ownerDocument;
|
20101 | var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);
|
20102 |
|
20103 |
|
20104 | if (computedStyle) {
|
20105 | val = computedStyle.getPropertyValue(name) || computedStyle[name];
|
20106 | }
|
20107 |
|
20108 | return val;
|
20109 | }
|
20110 |
|
20111 | var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
|
20112 | var RE_POS = /^(top|right|bottom|left)$/;
|
20113 | var CURRENT_STYLE = 'currentStyle';
|
20114 | var RUNTIME_STYLE = 'runtimeStyle';
|
20115 | var LEFT = 'left';
|
20116 | var PX = 'px';
|
20117 |
|
20118 | function _getComputedStyleIE(elem, name) {
|
20119 |
|
20120 |
|
20121 | var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
|
20122 |
|
20123 |
|
20124 |
|
20125 |
|
20126 |
|
20127 |
|
20128 |
|
20129 |
|
20130 |
|
20131 |
|
20132 |
|
20133 | if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
|
20134 |
|
20135 | var style = elem.style;
|
20136 | var left = style[LEFT];
|
20137 | var rsLeft = elem[RUNTIME_STYLE][LEFT];
|
20138 |
|
20139 |
|
20140 | elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
|
20141 |
|
20142 |
|
20143 | style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
|
20144 | ret = style.pixelLeft + PX;
|
20145 |
|
20146 |
|
20147 | style[LEFT] = left;
|
20148 |
|
20149 | elem[RUNTIME_STYLE][LEFT] = rsLeft;
|
20150 | }
|
20151 | return ret === '' ? 'auto' : ret;
|
20152 | }
|
20153 |
|
20154 | var getComputedStyleX = undefined;
|
20155 | if (typeof window !== 'undefined') {
|
20156 | getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
|
20157 | }
|
20158 |
|
20159 | function each(arr, fn) {
|
20160 | for (var i = 0; i < arr.length; i++) {
|
20161 | fn(arr[i]);
|
20162 | }
|
20163 | }
|
20164 |
|
20165 | function isBorderBoxFn(elem) {
|
20166 | return getComputedStyleX(elem, 'boxSizing') === 'border-box';
|
20167 | }
|
20168 |
|
20169 | var BOX_MODELS = ['margin', 'border', 'padding'];
|
20170 | var CONTENT_INDEX = -1;
|
20171 | var PADDING_INDEX = 2;
|
20172 | var BORDER_INDEX = 1;
|
20173 | var MARGIN_INDEX = 0;
|
20174 |
|
20175 | function swap(elem, options, callback) {
|
20176 | var old = {};
|
20177 | var style = elem.style;
|
20178 | var name = undefined;
|
20179 |
|
20180 |
|
20181 | for (name in options) {
|
20182 | if (options.hasOwnProperty(name)) {
|
20183 | old[name] = style[name];
|
20184 | style[name] = options[name];
|
20185 | }
|
20186 | }
|
20187 |
|
20188 | callback.call(elem);
|
20189 |
|
20190 |
|
20191 | for (name in options) {
|
20192 | if (options.hasOwnProperty(name)) {
|
20193 | style[name] = old[name];
|
20194 | }
|
20195 | }
|
20196 | }
|
20197 |
|
20198 | function getPBMWidth(elem, props, which) {
|
20199 | var value = 0;
|
20200 | var prop = undefined;
|
20201 | var j = undefined;
|
20202 | var i = undefined;
|
20203 | for (j = 0; j < props.length; j++) {
|
20204 | prop = props[j];
|
20205 | if (prop) {
|
20206 | for (i = 0; i < which.length; i++) {
|
20207 | var cssProp = undefined;
|
20208 | if (prop === 'border') {
|
20209 | cssProp = prop + which[i] + 'Width';
|
20210 | } else {
|
20211 | cssProp = prop + which[i];
|
20212 | }
|
20213 | value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
|
20214 | }
|
20215 | }
|
20216 | }
|
20217 | return value;
|
20218 | }
|
20219 |
|
20220 | |
20221 |
|
20222 |
|
20223 |
|
20224 | function isWindow(obj) {
|
20225 |
|
20226 |
|
20227 | return obj != null && obj == obj.window;
|
20228 | }
|
20229 |
|
20230 | var domUtils = {};
|
20231 |
|
20232 | each(['Width', 'Height'], function (name) {
|
20233 | domUtils['doc' + name] = function (refWin) {
|
20234 | var d = refWin.document;
|
20235 | return Math.max(
|
20236 |
|
20237 |
|
20238 | d.documentElement['scroll' + name],
|
20239 |
|
20240 | d.body['scroll' + name], domUtils['viewport' + name](d));
|
20241 | };
|
20242 |
|
20243 | domUtils['viewport' + name] = function (win) {
|
20244 |
|
20245 | var prop = 'client' + name;
|
20246 | var doc = win.document;
|
20247 | var body = doc.body;
|
20248 | var documentElement = doc.documentElement;
|
20249 | var documentElementProp = documentElement[prop];
|
20250 |
|
20251 |
|
20252 | return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
|
20253 | };
|
20254 | });
|
20255 |
|
20256 | |
20257 |
|
20258 |
|
20259 |
|
20260 |
|
20261 |
|
20262 |
|
20263 |
|
20264 | function getWH(elem, name, extra) {
|
20265 | if (isWindow(elem)) {
|
20266 | return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
|
20267 | } else if (elem.nodeType === 9) {
|
20268 | return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
|
20269 | }
|
20270 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
20271 | var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;
|
20272 | var computedStyle = getComputedStyleX(elem);
|
20273 | var isBorderBox = isBorderBoxFn(elem, computedStyle);
|
20274 | var cssBoxValue = 0;
|
20275 | if (borderBoxValue == null || borderBoxValue <= 0) {
|
20276 | borderBoxValue = undefined;
|
20277 |
|
20278 | cssBoxValue = getComputedStyleX(elem, name);
|
20279 | if (cssBoxValue == null || Number(cssBoxValue) < 0) {
|
20280 | cssBoxValue = elem.style[name] || 0;
|
20281 | }
|
20282 |
|
20283 | cssBoxValue = parseFloat(cssBoxValue) || 0;
|
20284 | }
|
20285 | if (extra === undefined) {
|
20286 | extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
|
20287 | }
|
20288 | var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
|
20289 | var val = borderBoxValue || cssBoxValue;
|
20290 | if (extra === CONTENT_INDEX) {
|
20291 | if (borderBoxValueOrIsBorderBox) {
|
20292 | return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
|
20293 | }
|
20294 | return cssBoxValue;
|
20295 | }
|
20296 | if (borderBoxValueOrIsBorderBox) {
|
20297 | var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);
|
20298 | return val + (extra === BORDER_INDEX ? 0 : padding);
|
20299 | }
|
20300 | return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
|
20301 | }
|
20302 |
|
20303 | var cssShow = {
|
20304 | position: 'absolute',
|
20305 | visibility: 'hidden',
|
20306 | display: 'block'
|
20307 | };
|
20308 |
|
20309 |
|
20310 | function getWHIgnoreDisplay(elem) {
|
20311 | var val = undefined;
|
20312 | var args = arguments;
|
20313 |
|
20314 |
|
20315 | if (elem.offsetWidth !== 0) {
|
20316 | val = getWH.apply(undefined, args);
|
20317 | } else {
|
20318 | swap(elem, cssShow, function () {
|
20319 | val = getWH.apply(undefined, args);
|
20320 | });
|
20321 | }
|
20322 | return val;
|
20323 | }
|
20324 |
|
20325 | function css(el, name, v) {
|
20326 | var value = v;
|
20327 | if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
|
20328 | for (var i in name) {
|
20329 | if (name.hasOwnProperty(i)) {
|
20330 | css(el, i, name[i]);
|
20331 | }
|
20332 | }
|
20333 | return undefined;
|
20334 | }
|
20335 | if (typeof value !== 'undefined') {
|
20336 | if (typeof value === 'number') {
|
20337 | value += 'px';
|
20338 | }
|
20339 | el.style[name] = value;
|
20340 | return undefined;
|
20341 | }
|
20342 | return getComputedStyleX(el, name);
|
20343 | }
|
20344 |
|
20345 | each(['width', 'height'], function (name) {
|
20346 | var first = name.charAt(0).toUpperCase() + name.slice(1);
|
20347 | domUtils['outer' + first] = function (el, includeMargin) {
|
20348 | return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
|
20349 | };
|
20350 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
20351 |
|
20352 | domUtils[name] = function (elem, val) {
|
20353 | if (val !== undefined) {
|
20354 | if (elem) {
|
20355 | var computedStyle = getComputedStyleX(elem);
|
20356 | var isBorderBox = isBorderBoxFn(elem);
|
20357 | if (isBorderBox) {
|
20358 | val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
|
20359 | }
|
20360 | return css(elem, name, val);
|
20361 | }
|
20362 | return undefined;
|
20363 | }
|
20364 | return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
|
20365 | };
|
20366 | });
|
20367 |
|
20368 |
|
20369 | function setOffset(elem, offset) {
|
20370 |
|
20371 | if (css(elem, 'position') === 'static') {
|
20372 | elem.style.position = 'relative';
|
20373 | }
|
20374 |
|
20375 | var old = getOffset(elem);
|
20376 | var ret = {};
|
20377 | var current = undefined;
|
20378 | var key = undefined;
|
20379 |
|
20380 | for (key in offset) {
|
20381 | if (offset.hasOwnProperty(key)) {
|
20382 | current = parseFloat(css(elem, key)) || 0;
|
20383 | ret[key] = current + offset[key] - old[key];
|
20384 | }
|
20385 | }
|
20386 | css(elem, ret);
|
20387 | }
|
20388 |
|
20389 | module.exports = _extends({
|
20390 | getWindow: function getWindow(node) {
|
20391 | var doc = node.ownerDocument || node;
|
20392 | return doc.defaultView || doc.parentWindow;
|
20393 | },
|
20394 | offset: function offset(el, value) {
|
20395 | if (typeof value !== 'undefined') {
|
20396 | setOffset(el, value);
|
20397 | } else {
|
20398 | return getOffset(el);
|
20399 | }
|
20400 | },
|
20401 |
|
20402 | isWindow: isWindow,
|
20403 | each: each,
|
20404 | css: css,
|
20405 | clone: function clone(obj) {
|
20406 | var ret = {};
|
20407 | for (var i in obj) {
|
20408 | if (obj.hasOwnProperty(i)) {
|
20409 | ret[i] = obj[i];
|
20410 | }
|
20411 | }
|
20412 | var overflow = obj.overflow;
|
20413 | if (overflow) {
|
20414 | for (var i in obj) {
|
20415 | if (obj.hasOwnProperty(i)) {
|
20416 | ret.overflow[i] = obj.overflow[i];
|
20417 | }
|
20418 | }
|
20419 | }
|
20420 | return ret;
|
20421 | },
|
20422 | scrollLeft: function scrollLeft(w, v) {
|
20423 | if (isWindow(w)) {
|
20424 | if (v === undefined) {
|
20425 | return getScrollLeft(w);
|
20426 | }
|
20427 | window.scrollTo(v, getScrollTop(w));
|
20428 | } else {
|
20429 | if (v === undefined) {
|
20430 | return w.scrollLeft;
|
20431 | }
|
20432 | w.scrollLeft = v;
|
20433 | }
|
20434 | },
|
20435 | scrollTop: function scrollTop(w, v) {
|
20436 | if (isWindow(w)) {
|
20437 | if (v === undefined) {
|
20438 | return getScrollTop(w);
|
20439 | }
|
20440 | window.scrollTo(getScrollLeft(w), v);
|
20441 | } else {
|
20442 | if (v === undefined) {
|
20443 | return w.scrollTop;
|
20444 | }
|
20445 | w.scrollTop = v;
|
20446 | }
|
20447 | },
|
20448 |
|
20449 | viewportWidth: 0,
|
20450 | viewportHeight: 0
|
20451 | }, domUtils);
|
20452 |
|
20453 | }),
|
20454 |
|
20455 | (function(module, exports, __webpack_require__) {
|
20456 |
|
20457 | 'use strict';
|
20458 |
|
20459 | exports.__esModule = true;
|
20460 |
|
20461 | var _extends2 = __webpack_require__(94);
|
20462 |
|
20463 | var _extends3 = _interopRequireDefault(_extends2);
|
20464 |
|
20465 | var _objectWithoutProperties2 = __webpack_require__(133);
|
20466 |
|
20467 | var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
20468 |
|
20469 | var _classCallCheck2 = __webpack_require__(134);
|
20470 |
|
20471 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
20472 |
|
20473 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
20474 |
|
20475 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
20476 |
|
20477 | var _inherits2 = __webpack_require__(169);
|
20478 |
|
20479 | var _inherits3 = _interopRequireDefault(_inherits2);
|
20480 |
|
20481 | var _react = __webpack_require__(4);
|
20482 |
|
20483 | var _react2 = _interopRequireDefault(_react);
|
20484 |
|
20485 | var _propTypes = __webpack_require__(5);
|
20486 |
|
20487 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
20488 |
|
20489 | var _util = __webpack_require__(190);
|
20490 |
|
20491 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
20492 |
|
20493 | var MenuItemGroup = function (_React$Component) {
|
20494 | (0, _inherits3['default'])(MenuItemGroup, _React$Component);
|
20495 |
|
20496 | function MenuItemGroup() {
|
20497 | var _temp, _this, _ret;
|
20498 |
|
20499 | (0, _classCallCheck3['default'])(this, MenuItemGroup);
|
20500 |
|
20501 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
20502 | args[_key] = arguments[_key];
|
20503 | }
|
20504 |
|
20505 | return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.renderInnerMenuItem = function (item) {
|
20506 | var _this$props = _this.props,
|
20507 | renderMenuItem = _this$props.renderMenuItem,
|
20508 | index = _this$props.index;
|
20509 |
|
20510 | return renderMenuItem(item, index, _this.props.subMenuKey);
|
20511 | }, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret);
|
20512 | }
|
20513 |
|
20514 | MenuItemGroup.prototype.render = function render() {
|
20515 | var props = (0, _objectWithoutProperties3['default'])(this.props, []);
|
20516 | var _props$className = props.className,
|
20517 | className = _props$className === undefined ? '' : _props$className,
|
20518 | rootPrefixCls = props.rootPrefixCls;
|
20519 |
|
20520 | var titleClassName = rootPrefixCls + '-item-group-title';
|
20521 | var listClassName = rootPrefixCls + '-item-group-list';
|
20522 | var title = props.title,
|
20523 | children = props.children;
|
20524 |
|
20525 | _util.menuAllProps.forEach(function (key) {
|
20526 | return delete props[key];
|
20527 | });
|
20528 |
|
20529 |
|
20530 | delete props.onClick;
|
20531 |
|
20532 | return _react2['default'].createElement(
|
20533 | 'li',
|
20534 | (0, _extends3['default'])({}, props, { className: className + ' ' + rootPrefixCls + '-item-group' }),
|
20535 | _react2['default'].createElement(
|
20536 | 'div',
|
20537 | {
|
20538 | className: titleClassName,
|
20539 | title: typeof title === 'string' ? title : undefined
|
20540 | },
|
20541 | title
|
20542 | ),
|
20543 | _react2['default'].createElement(
|
20544 | 'ul',
|
20545 | { className: listClassName },
|
20546 | _react2['default'].Children.map(children, this.renderInnerMenuItem)
|
20547 | )
|
20548 | );
|
20549 | };
|
20550 |
|
20551 | return MenuItemGroup;
|
20552 | }(_react2['default'].Component);
|
20553 |
|
20554 | MenuItemGroup.propTypes = {
|
20555 | renderMenuItem: _propTypes2['default'].func,
|
20556 | index: _propTypes2['default'].number,
|
20557 | className: _propTypes2['default'].string,
|
20558 | subMenuKey: _propTypes2['default'].string,
|
20559 | rootPrefixCls: _propTypes2['default'].string
|
20560 | };
|
20561 | MenuItemGroup.defaultProps = {
|
20562 | disabled: true
|
20563 | };
|
20564 |
|
20565 |
|
20566 | MenuItemGroup.isMenuItemGroup = true;
|
20567 |
|
20568 | exports['default'] = MenuItemGroup;
|
20569 | module.exports = exports['default'];
|
20570 |
|
20571 | }),
|
20572 |
|
20573 | (function(module, exports, __webpack_require__) {
|
20574 |
|
20575 | 'use strict';
|
20576 |
|
20577 | exports.__esModule = true;
|
20578 |
|
20579 | var _classCallCheck2 = __webpack_require__(134);
|
20580 |
|
20581 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
20582 |
|
20583 | var _possibleConstructorReturn2 = __webpack_require__(135);
|
20584 |
|
20585 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
20586 |
|
20587 | var _inherits2 = __webpack_require__(169);
|
20588 |
|
20589 | var _inherits3 = _interopRequireDefault(_inherits2);
|
20590 |
|
20591 | var _react = __webpack_require__(4);
|
20592 |
|
20593 | var _react2 = _interopRequireDefault(_react);
|
20594 |
|
20595 | var _propTypes = __webpack_require__(5);
|
20596 |
|
20597 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
20598 |
|
20599 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
20600 |
|
20601 | var Divider = function (_React$Component) {
|
20602 | (0, _inherits3['default'])(Divider, _React$Component);
|
20603 |
|
20604 | function Divider() {
|
20605 | (0, _classCallCheck3['default'])(this, Divider);
|
20606 | return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
|
20607 | }
|
20608 |
|
20609 | Divider.prototype.render = function render() {
|
20610 | var _props = this.props,
|
20611 | className = _props.className,
|
20612 | rootPrefixCls = _props.rootPrefixCls,
|
20613 | style = _props.style;
|
20614 |
|
20615 | return _react2['default'].createElement('li', {
|
20616 | className: className + ' ' + rootPrefixCls + '-item-divider',
|
20617 | style: style
|
20618 | });
|
20619 | };
|
20620 |
|
20621 | return Divider;
|
20622 | }(_react2['default'].Component);
|
20623 |
|
20624 | Divider.propTypes = {
|
20625 | className: _propTypes2['default'].string,
|
20626 | rootPrefixCls: _propTypes2['default'].string,
|
20627 | style: _propTypes2['default'].object
|
20628 | };
|
20629 | Divider.defaultProps = {
|
20630 |
|
20631 | disabled: true,
|
20632 | className: '',
|
20633 | style: {}
|
20634 | };
|
20635 | exports['default'] = Divider;
|
20636 | module.exports = exports['default'];
|
20637 |
|
20638 | }),
|
20639 |
|
20640 | (function(module, exports, __webpack_require__) {
|
20641 |
|
20642 | 'use strict';
|
20643 |
|
20644 | Object.defineProperty(exports, "__esModule", {
|
20645 | value: true
|
20646 | });
|
20647 |
|
20648 | var _react = __webpack_require__(4);
|
20649 |
|
20650 | var _react2 = _interopRequireDefault(_react);
|
20651 |
|
20652 | var _propTypes = __webpack_require__(5);
|
20653 |
|
20654 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
20655 |
|
20656 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
20657 |
|
20658 | 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; }
|
20659 |
|
20660 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
20661 |
|
20662 | 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; }
|
20663 |
|
20664 | 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); } |
20665 |
|
20666 |
|
20667 |
|
20668 |
|
20669 |
|
20670 | var Option = function (_React$Component) {
|
20671 | _inherits(Option, _React$Component);
|
20672 |
|
20673 | function Option() {
|
20674 | _classCallCheck(this, Option);
|
20675 |
|
20676 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
20677 | }
|
20678 |
|
20679 | return Option;
|
20680 | }(_react2["default"].Component);
|
20681 |
|
20682 | Option.propTypes = {
|
20683 | value: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number])
|
20684 | };
|
20685 | Option.isSelectOption = true;
|
20686 | exports["default"] = Option;
|
20687 | module.exports = exports['default'];
|
20688 |
|
20689 | }),
|
20690 |
|
20691 | (function(module, exports, __webpack_require__) {
|
20692 |
|
20693 | 'use strict';
|
20694 |
|
20695 | Object.defineProperty(exports, "__esModule", {
|
20696 | value: true
|
20697 | });
|
20698 | exports.UNSELECTABLE_ATTRIBUTE = exports.UNSELECTABLE_STYLE = undefined;
|
20699 |
|
20700 | 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; };
|
20701 |
|
20702 | exports.toTitle = toTitle;
|
20703 | exports.getValuePropValue = getValuePropValue;
|
20704 | exports.getPropValue = getPropValue;
|
20705 | exports.isMultiple = isMultiple;
|
20706 | exports.isCombobox = isCombobox;
|
20707 | exports.isMultipleOrTags = isMultipleOrTags;
|
20708 | exports.isMultipleOrTagsOrCombobox = isMultipleOrTagsOrCombobox;
|
20709 | exports.isSingleMode = isSingleMode;
|
20710 | exports.toArray = toArray;
|
20711 | exports.getMapKey = getMapKey;
|
20712 | exports.preventDefaultEvent = preventDefaultEvent;
|
20713 | exports.findIndexInValueBySingleValue = findIndexInValueBySingleValue;
|
20714 | exports.getLabelFromPropsValue = getLabelFromPropsValue;
|
20715 | exports.getSelectKeys = getSelectKeys;
|
20716 | exports.findFirstMenuItem = findFirstMenuItem;
|
20717 | exports.includesSeparators = includesSeparators;
|
20718 | exports.splitBySeparators = splitBySeparators;
|
20719 | exports.defaultFilterFn = defaultFilterFn;
|
20720 | exports.validateOptionValue = validateOptionValue;
|
20721 | exports.saveRef = saveRef;
|
20722 |
|
20723 | var _react = __webpack_require__(4);
|
20724 |
|
20725 | var _react2 = _interopRequireDefault(_react);
|
20726 |
|
20727 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
20728 |
|
20729 | function toTitle(title) {
|
20730 | if (typeof title === 'string') {
|
20731 | return title;
|
20732 | }
|
20733 | return null;
|
20734 | }
|
20735 |
|
20736 | function getValuePropValue(child) {
|
20737 | if (!child) {
|
20738 | return null;
|
20739 | }
|
20740 |
|
20741 | var props = child.props;
|
20742 | if ('value' in props) {
|
20743 | return props.value;
|
20744 | }
|
20745 | if (child.key) {
|
20746 | return child.key;
|
20747 | }
|
20748 | if (child.type && child.type.isSelectOptGroup && props.label) {
|
20749 | return props.label;
|
20750 | }
|
20751 | throw new Error('Need at least a key or a value or a label (only for OptGroup) for ' + child);
|
20752 | }
|
20753 |
|
20754 | function getPropValue(child, prop) {
|
20755 | if (prop === 'value') {
|
20756 | return getValuePropValue(child);
|
20757 | }
|
20758 | return child.props[prop];
|
20759 | }
|
20760 |
|
20761 | function isMultiple(props) {
|
20762 | return props.multiple;
|
20763 | }
|
20764 |
|
20765 | function isCombobox(props) {
|
20766 | return props.combobox;
|
20767 | }
|
20768 |
|
20769 | function isMultipleOrTags(props) {
|
20770 | return props.multiple || props.tags;
|
20771 | }
|
20772 |
|
20773 | function isMultipleOrTagsOrCombobox(props) {
|
20774 | return isMultipleOrTags(props) || isCombobox(props);
|
20775 | }
|
20776 |
|
20777 | function isSingleMode(props) {
|
20778 | return !isMultipleOrTagsOrCombobox(props);
|
20779 | }
|
20780 |
|
20781 | function toArray(value) {
|
20782 | var ret = value;
|
20783 | if (value === undefined) {
|
20784 | ret = [];
|
20785 | } else if (!Array.isArray(value)) {
|
20786 | ret = [value];
|
20787 | }
|
20788 | return ret;
|
20789 | }
|
20790 |
|
20791 | function getMapKey(value) {
|
20792 | return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) + '-' + value;
|
20793 | }
|
20794 |
|
20795 | function preventDefaultEvent(e) {
|
20796 | e.preventDefault();
|
20797 | }
|
20798 |
|
20799 | function findIndexInValueBySingleValue(value, singleValue) {
|
20800 | var index = -1;
|
20801 | for (var i = 0; i < value.length; i++) {
|
20802 | if (value[i] === singleValue) {
|
20803 | index = i;
|
20804 | break;
|
20805 | }
|
20806 | }
|
20807 | return index;
|
20808 | }
|
20809 |
|
20810 | function getLabelFromPropsValue(value, key) {
|
20811 | var label = void 0;
|
20812 | value = toArray(value);
|
20813 | for (var i = 0; i < value.length; i++) {
|
20814 | if (value[i].key === key) {
|
20815 | label = value[i].label;
|
20816 | break;
|
20817 | }
|
20818 | }
|
20819 | return label;
|
20820 | }
|
20821 |
|
20822 | function getSelectKeys(menuItems, value) {
|
20823 | if (value === null || value === undefined) {
|
20824 | return [];
|
20825 | }
|
20826 | var selectedKeys = [];
|
20827 | _react2["default"].Children.forEach(menuItems, function (item) {
|
20828 | if (item.type.isMenuItemGroup) {
|
20829 | selectedKeys = selectedKeys.concat(getSelectKeys(item.props.children, value));
|
20830 | } else {
|
20831 | var itemValue = getValuePropValue(item);
|
20832 | var itemKey = item.key;
|
20833 | if (findIndexInValueBySingleValue(value, itemValue) !== -1 && itemKey) {
|
20834 | selectedKeys.push(itemKey);
|
20835 | }
|
20836 | }
|
20837 | });
|
20838 | return selectedKeys;
|
20839 | }
|
20840 |
|
20841 | var UNSELECTABLE_STYLE = exports.UNSELECTABLE_STYLE = {
|
20842 | userSelect: 'none',
|
20843 | WebkitUserSelect: 'none'
|
20844 | };
|
20845 |
|
20846 | var UNSELECTABLE_ATTRIBUTE = exports.UNSELECTABLE_ATTRIBUTE = {
|
20847 | unselectable: 'on'
|
20848 | };
|
20849 |
|
20850 | function findFirstMenuItem(children) {
|
20851 | for (var i = 0; i < children.length; i++) {
|
20852 | var child = children[i];
|
20853 | if (child.type.isMenuItemGroup) {
|
20854 | var found = findFirstMenuItem(child.props.children);
|
20855 | if (found) {
|
20856 | return found;
|
20857 | }
|
20858 | } else if (!child.props.disabled) {
|
20859 | return child;
|
20860 | }
|
20861 | }
|
20862 | return null;
|
20863 | }
|
20864 |
|
20865 | function includesSeparators(string, separators) {
|
20866 | for (var i = 0; i < separators.length; ++i) {
|
20867 | if (string.lastIndexOf(separators[i]) > 0) {
|
20868 | return true;
|
20869 | }
|
20870 | }
|
20871 | return false;
|
20872 | }
|
20873 |
|
20874 | function splitBySeparators(string, separators) {
|
20875 | var reg = new RegExp('[' + separators.join() + ']');
|
20876 | return string.split(reg).filter(function (token) {
|
20877 | return token;
|
20878 | });
|
20879 | }
|
20880 |
|
20881 | function defaultFilterFn(input, child) {
|
20882 | if (child.props.disabled) {
|
20883 | return false;
|
20884 | }
|
20885 | var value = toArray(getPropValue(child, this.props.optionFilterProp)).join('');
|
20886 | return value.toLowerCase().indexOf(input.toLowerCase()) > -1;
|
20887 | }
|
20888 |
|
20889 | function validateOptionValue(value, props) {
|
20890 | if (isSingleMode(props) || isMultiple(props)) {
|
20891 | return;
|
20892 | }
|
20893 | if (typeof value !== 'string') {
|
20894 | throw new Error('Invalid `value` of type `' + (typeof value === 'undefined' ? 'undefined' : _typeof(value)) + '` supplied to Option, ' + 'expected `string` when `tags/combobox` is `true`.');
|
20895 | }
|
20896 | }
|
20897 |
|
20898 | function saveRef(instance, name) {
|
20899 | return function (node) {
|
20900 | instance[name] = node;
|
20901 | };
|
20902 | }
|
20903 |
|
20904 | }),
|
20905 |
|
20906 | (function(module, exports, __webpack_require__) {
|
20907 |
|
20908 | 'use strict';
|
20909 |
|
20910 | Object.defineProperty(exports, "__esModule", {
|
20911 | value: true
|
20912 | });
|
20913 |
|
20914 | 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; };
|
20915 |
|
20916 | var _trigger = __webpack_require__(229);
|
20917 |
|
20918 | var _trigger2 = _interopRequireDefault(_trigger);
|
20919 |
|
20920 | var _react = __webpack_require__(4);
|
20921 |
|
20922 | var _react2 = _interopRequireDefault(_react);
|
20923 |
|
20924 | var _propTypes = __webpack_require__(5);
|
20925 |
|
20926 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
20927 |
|
20928 | var _classnames = __webpack_require__(3);
|
20929 |
|
20930 | var _classnames2 = _interopRequireDefault(_classnames);
|
20931 |
|
20932 | var _reactDom = __webpack_require__(12);
|
20933 |
|
20934 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
20935 |
|
20936 | var _util = __webpack_require__(227);
|
20937 |
|
20938 | var _DropdownMenu = __webpack_require__(236);
|
20939 |
|
20940 | var _DropdownMenu2 = _interopRequireDefault(_DropdownMenu);
|
20941 |
|
20942 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
20943 |
|
20944 | 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; }
|
20945 |
|
20946 | 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; }
|
20947 |
|
20948 | 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; }
|
20949 |
|
20950 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
20951 |
|
20952 | 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; }
|
20953 |
|
20954 | 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); } |
20955 |
|
20956 |
|
20957 |
|
20958 |
|
20959 |
|
20960 | _trigger2["default"].displayName = 'Trigger';
|
20961 |
|
20962 | var BUILT_IN_PLACEMENTS = {
|
20963 | bottomLeft: {
|
20964 | points: ['tl', 'bl'],
|
20965 | offset: [0, 4],
|
20966 | overflow: {
|
20967 | adjustX: 0,
|
20968 | adjustY: 1
|
20969 | }
|
20970 | },
|
20971 | topLeft: {
|
20972 | points: ['bl', 'tl'],
|
20973 | offset: [0, -4],
|
20974 | overflow: {
|
20975 | adjustX: 0,
|
20976 | adjustY: 1
|
20977 | }
|
20978 | }
|
20979 | };
|
20980 |
|
20981 | var SelectTrigger = function (_React$Component) {
|
20982 | _inherits(SelectTrigger, _React$Component);
|
20983 |
|
20984 | function SelectTrigger(props) {
|
20985 | _classCallCheck(this, SelectTrigger);
|
20986 |
|
20987 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
20988 |
|
20989 | _initialiseProps.call(_this);
|
20990 |
|
20991 | _this.saveDropdownMenuRef = (0, _util.saveRef)(_this, 'dropdownMenuRef');
|
20992 | _this.saveTriggerRef = (0, _util.saveRef)(_this, 'triggerRef');
|
20993 |
|
20994 | _this.state = {
|
20995 | dropdownWidth: null
|
20996 | };
|
20997 | return _this;
|
20998 | }
|
20999 |
|
21000 | SelectTrigger.prototype.componentDidMount = function componentDidMount() {
|
21001 | if (this.props.open) {
|
21002 |
|
21003 | this.setDropdownWidth();
|
21004 | }
|
21005 | };
|
21006 |
|
21007 | SelectTrigger.prototype.componentDidUpdate = function componentDidUpdate() {
|
21008 | if (this.props.visible) {
|
21009 |
|
21010 | this.setDropdownWidth();
|
21011 | }
|
21012 | };
|
21013 |
|
21014 | SelectTrigger.prototype.render = function render() {
|
21015 | var _popupClassName;
|
21016 |
|
21017 | var _props = this.props,
|
21018 | onPopupFocus = _props.onPopupFocus,
|
21019 | props = _objectWithoutProperties(_props, ['onPopupFocus']);
|
21020 |
|
21021 | var multiple = props.multiple,
|
21022 | visible = props.visible,
|
21023 | inputValue = props.inputValue,
|
21024 | dropdownAlign = props.dropdownAlign,
|
21025 | disabled = props.disabled,
|
21026 | showSearch = props.showSearch,
|
21027 | dropdownClassName = props.dropdownClassName,
|
21028 | dropdownStyle = props.dropdownStyle,
|
21029 | dropdownMatchSelectWidth = props.dropdownMatchSelectWidth;
|
21030 |
|
21031 | var dropdownPrefixCls = this.getDropdownPrefixCls();
|
21032 | var popupClassName = (_popupClassName = {}, _defineProperty(_popupClassName, dropdownClassName, !!dropdownClassName), _defineProperty(_popupClassName, dropdownPrefixCls + '--' + (multiple ? 'multiple' : 'single'), 1), _popupClassName);
|
21033 | var popupElement = this.getDropdownElement({
|
21034 | menuItems: props.options,
|
21035 | onPopupFocus: onPopupFocus,
|
21036 | multiple: multiple,
|
21037 | inputValue: inputValue,
|
21038 | visible: visible
|
21039 | });
|
21040 | var hideAction = void 0;
|
21041 | if (disabled) {
|
21042 | hideAction = [];
|
21043 | } else if ((0, _util.isSingleMode)(props) && !showSearch) {
|
21044 | hideAction = ['click'];
|
21045 | } else {
|
21046 | hideAction = ['blur'];
|
21047 | }
|
21048 | var popupStyle = _extends({}, dropdownStyle);
|
21049 | var widthProp = dropdownMatchSelectWidth ? 'width' : 'minWidth';
|
21050 | if (this.state.dropdownWidth) {
|
21051 | popupStyle[widthProp] = this.state.dropdownWidth + 'px';
|
21052 | }
|
21053 |
|
21054 | return _react2["default"].createElement(
|
21055 | _trigger2["default"],
|
21056 | _extends({}, props, {
|
21057 | showAction: disabled ? [] : this.props.showAction,
|
21058 | hideAction: hideAction,
|
21059 | ref: this.saveTriggerRef,
|
21060 | popupPlacement: 'bottomLeft',
|
21061 | builtinPlacements: BUILT_IN_PLACEMENTS,
|
21062 | prefixCls: dropdownPrefixCls,
|
21063 | popupTransitionName: this.getDropdownTransitionName(),
|
21064 | onPopupVisibleChange: props.onDropdownVisibleChange,
|
21065 | popup: popupElement,
|
21066 | popupAlign: dropdownAlign,
|
21067 | popupVisible: visible,
|
21068 | getPopupContainer: props.getPopupContainer,
|
21069 | popupClassName: (0, _classnames2["default"])(popupClassName),
|
21070 | popupStyle: popupStyle
|
21071 | }),
|
21072 | props.children
|
21073 | );
|
21074 | };
|
21075 |
|
21076 | return SelectTrigger;
|
21077 | }(_react2["default"].Component);
|
21078 |
|
21079 | SelectTrigger.propTypes = {
|
21080 | onPopupFocus: _propTypes2["default"].func,
|
21081 | onPopupScroll: _propTypes2["default"].func,
|
21082 | dropdownMatchSelectWidth: _propTypes2["default"].bool,
|
21083 | dropdownAlign: _propTypes2["default"].object,
|
21084 | visible: _propTypes2["default"].bool,
|
21085 | disabled: _propTypes2["default"].bool,
|
21086 | showSearch: _propTypes2["default"].bool,
|
21087 | dropdownClassName: _propTypes2["default"].string,
|
21088 | multiple: _propTypes2["default"].bool,
|
21089 | inputValue: _propTypes2["default"].string,
|
21090 | filterOption: _propTypes2["default"].any,
|
21091 | options: _propTypes2["default"].any,
|
21092 | prefixCls: _propTypes2["default"].string,
|
21093 | popupClassName: _propTypes2["default"].string,
|
21094 | children: _propTypes2["default"].any,
|
21095 | showAction: _propTypes2["default"].arrayOf(_propTypes2["default"].string),
|
21096 | menuItemSelectedIcon: _propTypes2["default"].oneOfType([_propTypes2["default"].func, _propTypes2["default"].node])
|
21097 | };
|
21098 |
|
21099 | var _initialiseProps = function _initialiseProps() {
|
21100 | var _this2 = this;
|
21101 |
|
21102 | this.setDropdownWidth = function () {
|
21103 | if (!_this2.props.dropdownMatchSelectWidth) {
|
21104 | return;
|
21105 | }
|
21106 | var width = _reactDom2["default"].findDOMNode(_this2).offsetWidth;
|
21107 | if (width !== _this2.state.dropdownWidth) {
|
21108 | _this2.setState({ dropdownWidth: width });
|
21109 | }
|
21110 | };
|
21111 |
|
21112 | this.getInnerMenu = function () {
|
21113 | return _this2.dropdownMenuRef && _this2.dropdownMenuRef.menuRef;
|
21114 | };
|
21115 |
|
21116 | this.getPopupDOMNode = function () {
|
21117 | return _this2.triggerRef.getPopupDomNode();
|
21118 | };
|
21119 |
|
21120 | this.getDropdownElement = function (newProps) {
|
21121 | var props = _this2.props;
|
21122 | return _react2["default"].createElement(_DropdownMenu2["default"], _extends({
|
21123 | ref: _this2.saveDropdownMenuRef
|
21124 | }, newProps, {
|
21125 | clsPrefix: _this2.getDropdownPrefixCls(),
|
21126 | onMenuSelect: props.onMenuSelect,
|
21127 | onMenuDeselect: props.onMenuDeselect,
|
21128 | onPopupScroll: props.onPopupScroll,
|
21129 | value: props.value,
|
21130 | backfillValue: props.backfillValue,
|
21131 | firstActiveValue: props.firstActiveValue,
|
21132 | defaultActiveFirstOption: props.defaultActiveFirstOption,
|
21133 | dropdownMenuStyle: props.dropdownMenuStyle,
|
21134 | menuItemSelectedIcon: props.menuItemSelectedIcon
|
21135 | }));
|
21136 | };
|
21137 |
|
21138 | this.getDropdownTransitionName = function () {
|
21139 | var props = _this2.props;
|
21140 | var transitionName = props.transitionName;
|
21141 | if (!transitionName && props.animation) {
|
21142 | transitionName = _this2.getDropdownPrefixCls() + '-' + props.animation;
|
21143 | }
|
21144 | return transitionName;
|
21145 | };
|
21146 |
|
21147 | this.getDropdownPrefixCls = function () {
|
21148 | return _this2.props.prefixCls + '-dropdown';
|
21149 | };
|
21150 | };
|
21151 |
|
21152 | exports["default"] = SelectTrigger;
|
21153 |
|
21154 |
|
21155 | SelectTrigger.displayName = 'SelectTrigger';
|
21156 | module.exports = exports['default'];
|
21157 |
|
21158 | }),
|
21159 |
|
21160 | (function(module, exports, __webpack_require__) {
|
21161 |
|
21162 | 'use strict';
|
21163 |
|
21164 | module.exports = __webpack_require__(230);
|
21165 |
|
21166 | }),
|
21167 |
|
21168 | (function(module, exports, __webpack_require__) {
|
21169 |
|
21170 | 'use strict';
|
21171 |
|
21172 | Object.defineProperty(exports, "__esModule", {
|
21173 | value: true
|
21174 | });
|
21175 |
|
21176 | 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; };
|
21177 |
|
21178 | var _react = __webpack_require__(4);
|
21179 |
|
21180 | var _react2 = _interopRequireDefault(_react);
|
21181 |
|
21182 | var _propTypes = __webpack_require__(5);
|
21183 |
|
21184 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
21185 |
|
21186 | var _reactDom = __webpack_require__(12);
|
21187 |
|
21188 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
21189 |
|
21190 | var _contains = __webpack_require__(231);
|
21191 |
|
21192 | var _contains2 = _interopRequireDefault(_contains);
|
21193 |
|
21194 | var _tinperBeeCore = __webpack_require__(27);
|
21195 |
|
21196 | var _Popup = __webpack_require__(232);
|
21197 |
|
21198 | var _Popup2 = _interopRequireDefault(_Popup);
|
21199 |
|
21200 | var _utils = __webpack_require__(235);
|
21201 |
|
21202 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
21203 |
|
21204 | 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; }
|
21205 |
|
21206 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
21207 |
|
21208 | 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; }
|
21209 |
|
21210 | 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); }
|
21211 |
|
21212 |
|
21213 |
|
21214 | function noop() {}
|
21215 |
|
21216 | function returnEmptyString() {
|
21217 | return '';
|
21218 | }
|
21219 |
|
21220 | var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur'];
|
21221 |
|
21222 | var propTypes = {
|
21223 | children: _propTypes2["default"].any,
|
21224 | action: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].arrayOf(_propTypes2["default"].string)]),
|
21225 | showAction: _propTypes2["default"].any,
|
21226 | hideAction: _propTypes2["default"].any,
|
21227 | getPopupClassNameFromAlign: _propTypes2["default"].any,
|
21228 | onPopupVisibleChange: _propTypes2["default"].func,
|
21229 | afterPopupVisibleChange: _propTypes2["default"].func,
|
21230 | popup: _propTypes2["default"].oneOfType([_propTypes2["default"].node, _propTypes2["default"].func]).isRequired,
|
21231 | popupStyle: _propTypes2["default"].object,
|
21232 | clsPrefix: _propTypes2["default"].string,
|
21233 | popupClassName: _propTypes2["default"].string,
|
21234 | popupPlacement: _propTypes2["default"].string,
|
21235 | builtinPlacements: _propTypes2["default"].object,
|
21236 | popupTransitionName: _propTypes2["default"].string,
|
21237 | popupAnimation: _propTypes2["default"].any,
|
21238 | mouseEnterDelay: _propTypes2["default"].number,
|
21239 | mouseLeaveDelay: _propTypes2["default"].number,
|
21240 | zIndex: _propTypes2["default"].number,
|
21241 | focusDelay: _propTypes2["default"].number,
|
21242 | blurDelay: _propTypes2["default"].number,
|
21243 | getPopupContainer: _propTypes2["default"].func,
|
21244 | destroyPopupOnHide: _propTypes2["default"].bool,
|
21245 | mask: _propTypes2["default"].bool,
|
21246 | maskClosable: _propTypes2["default"].bool,
|
21247 | onPopupAlign: _propTypes2["default"].func,
|
21248 | popupAlign: _propTypes2["default"].object,
|
21249 | popupVisible: _propTypes2["default"].bool,
|
21250 | maskTransitionName: _propTypes2["default"].string,
|
21251 | maskAnimation: _propTypes2["default"].string,
|
21252 | getDocument: _propTypes2["default"].func
|
21253 | };
|
21254 |
|
21255 | var defaultProps = {
|
21256 | clsPrefix: 'rc-trigger-popup',
|
21257 | getPopupClassNameFromAlign: returnEmptyString,
|
21258 | onPopupVisibleChange: noop,
|
21259 | afterPopupVisibleChange: noop,
|
21260 | onPopupAlign: noop,
|
21261 | popupClassName: '',
|
21262 | mouseEnterDelay: 0,
|
21263 | mouseLeaveDelay: 0.1,
|
21264 | focusDelay: 0,
|
21265 | blurDelay: 0.15,
|
21266 | popupStyle: {},
|
21267 | destroyPopupOnHide: false,
|
21268 | popupAlign: {},
|
21269 | defaultPopupVisible: false,
|
21270 | mask: false,
|
21271 | maskClosable: true,
|
21272 | action: [],
|
21273 | showAction: [],
|
21274 | hideAction: [],
|
21275 | getDocument: function getDocument() {
|
21276 | return document;
|
21277 | }
|
21278 | };
|
21279 |
|
21280 | var Trigger = function (_Component) {
|
21281 | _inherits(Trigger, _Component);
|
21282 |
|
21283 | function Trigger(props) {
|
21284 | _classCallCheck(this, Trigger);
|
21285 |
|
21286 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
21287 |
|
21288 | _this.getDocument = function () {
|
21289 | var doc = document;
|
21290 | if (_this.props.getDocument) doc = _this.props.getDocument();
|
21291 | return doc;
|
21292 | };
|
21293 |
|
21294 | _this.state = {
|
21295 | popupVisible: !!_this.props.popupVisible || _this.props.defaultPopupVisible
|
21296 |
|
21297 | };_this.getContainer = _this.getContainer.bind(_this);
|
21298 | _this.renderComponent = _this.renderComponent.bind(_this);
|
21299 | _this.isVisible = _this.isVisible.bind(_this);
|
21300 |
|
21301 | _this.onMouseEnter = _this.onMouseEnter.bind(_this);
|
21302 | _this.onMouseLeave = _this.onMouseLeave.bind(_this);
|
21303 | _this.onPopupMouseEnter = _this.onPopupMouseEnter.bind(_this);
|
21304 | _this.onPopupMouseLeave = _this.onPopupMouseLeave.bind(_this);
|
21305 | _this.onFocus = _this.onFocus.bind(_this);
|
21306 |
|
21307 | _this.onMouseDown = _this.onMouseDown.bind(_this);
|
21308 | _this.onTouchStart = _this.onTouchStart.bind(_this);
|
21309 | _this.onBlur = _this.onBlur.bind(_this);
|
21310 | _this.onDocumentClick = _this.onDocumentClick.bind(_this);
|
21311 | _this.getPopupDomNode = _this.getPopupDomNode.bind(_this);
|
21312 |
|
21313 | _this.getRootDomNode = _this.getRootDomNode.bind(_this);
|
21314 | _this.getPopupClassNameFromAlign = _this.getPopupClassNameFromAlign.bind(_this);
|
21315 | _this.getPopupAlign = _this.getPopupAlign.bind(_this);
|
21316 | _this.getComponent = _this.getComponent.bind(_this);
|
21317 | _this.setPopupVisible = _this.setPopupVisible.bind(_this);
|
21318 |
|
21319 | _this.delaySetPopupVisible = _this.delaySetPopupVisible.bind(_this);
|
21320 | _this.clearDelayTimer = _this.clearDelayTimer.bind(_this);
|
21321 | _this.createTwoChains = _this.createTwoChains.bind(_this);
|
21322 | _this.isClickToShow = _this.isClickToShow.bind(_this);
|
21323 | _this.isClickToHide = _this.isClickToHide.bind(_this);
|
21324 |
|
21325 | _this.isMouseEnterToShow = _this.isMouseEnterToShow.bind(_this);
|
21326 | _this.isMouseLeaveToHide = _this.isMouseLeaveToHide.bind(_this);
|
21327 | _this.isFocusToShow = _this.isFocusToShow.bind(_this);
|
21328 | _this.isBlurToHide = _this.isBlurToHide.bind(_this);
|
21329 | _this.forcePopupAlign = _this.forcePopupAlign.bind(_this);
|
21330 |
|
21331 | _this.fireEvents = _this.fireEvents.bind(_this);
|
21332 | _this.close = _this.close.bind(_this);
|
21333 | _this.onClick = _this.onClick.bind(_this);
|
21334 | return _this;
|
21335 | }
|
21336 |
|
21337 | Trigger.prototype.isVisible = function isVisible(instance) {
|
21338 | return instance.state.popupVisible;
|
21339 | };
|
21340 |
|
21341 | Trigger.prototype.getContainer = function getContainer(instance) {
|
21342 | var popupContainer = document.createElement('div');
|
21343 | var mountNode = instance.props.getPopupContainer ? instance.props.getPopupContainer((0, _reactDom.findDOMNode)(instance)) : document.body;
|
21344 | mountNode.appendChild(popupContainer);
|
21345 | return popupContainer;
|
21346 | };
|
21347 |
|
21348 | Trigger.prototype.renderComponent = function renderComponent(instance, componentArg, ready) {
|
21349 | if (instance._component || this.isVisible(instance)) {
|
21350 | if (!instance._container) {
|
21351 | instance._container = this.getContainer(instance);
|
21352 | }
|
21353 | var component = instance.getComponent(componentArg);
|
21354 | _reactDom2["default"].unstable_renderSubtreeIntoContainer(instance, component, instance._container, function callback() {
|
21355 | instance._component = this;
|
21356 | if (ready) {
|
21357 | ready.call(this);
|
21358 | }
|
21359 | });
|
21360 | }
|
21361 | };
|
21362 |
|
21363 | Trigger.prototype.componentWillMount = function componentWillMount() {
|
21364 | var _this2 = this;
|
21365 |
|
21366 | this.mounted = false;
|
21367 | ALL_HANDLERS.forEach(function (h) {
|
21368 | _this2['fire' + h] = function (e) {
|
21369 | _this2.fireEvents(h, e);
|
21370 | };
|
21371 | });
|
21372 | };
|
21373 |
|
21374 | Trigger.prototype.componentDidMount = function componentDidMount() {
|
21375 | this.mounted = true;
|
21376 | this.componentDidUpdate({}, {
|
21377 | popupVisible: this.state.popupVisible
|
21378 | });
|
21379 | };
|
21380 |
|
21381 | Trigger.prototype.componentWillReceiveProps = function componentWillReceiveProps(_ref) {
|
21382 | var popupVisible = _ref.popupVisible;
|
21383 |
|
21384 | if (popupVisible !== undefined) {
|
21385 | this.setState({
|
21386 | popupVisible: popupVisible
|
21387 | });
|
21388 | }
|
21389 | };
|
21390 |
|
21391 | Trigger.prototype.componentDidUpdate = function componentDidUpdate(_, prevState) {
|
21392 | var props = this.props;
|
21393 | var state = this.state;
|
21394 | this.renderComponent(this, null, function () {
|
21395 | if (prevState.popupVisible !== state.popupVisible) {
|
21396 | props.afterPopupVisibleChange(state.popupVisible);
|
21397 | }
|
21398 | });
|
21399 | if (this.isClickToHide()) {
|
21400 | if (state.popupVisible) {
|
21401 | if (!this.clickOutsideHandler) {
|
21402 | this.clickOutsideHandler = (0, _tinperBeeCore.addEventListener)(this.getDocument(), 'mousedown', this.onDocumentClick);
|
21403 | this.touchOutsideHandler = (0, _tinperBeeCore.addEventListener)(this.getDocument(), 'touchstart', this.onDocumentClick);
|
21404 | this.mouseWheelOutsideHandler = (0, _tinperBeeCore.addEventListener)(this.getDocument(), 'mousewheel', this.onDocumentClick);
|
21405 | }
|
21406 | return;
|
21407 | }
|
21408 | }
|
21409 | if (this.clickOutsideHandler) {
|
21410 | this.clickOutsideHandler.remove();
|
21411 | this.touchOutsideHandler.remove();
|
21412 | this.mouseWheelOutsideHandler.remove();
|
21413 | this.clickOutsideHandler = null;
|
21414 | this.touchOutsideHandler = null;
|
21415 | this.mouseWheelOutsideHandler = null;
|
21416 | }
|
21417 | };
|
21418 |
|
21419 | Trigger.prototype.componentWillUnmount = function componentWillUnmount() {
|
21420 | this.clearDelayTimer();
|
21421 | if (this.clickOutsideHandler) {
|
21422 | this.clickOutsideHandler.remove();
|
21423 | this.touchOutsideHandler.remove();
|
21424 | this.mouseWheelOutsideHandler.remove();
|
21425 | this.clickOutsideHandler = null;
|
21426 | this.touchOutsideHandler = null;
|
21427 | this.mouseWheelOutsideHandler = null;
|
21428 | }
|
21429 | if (this._container) {
|
21430 | _reactDom2["default"].unmountComponentAtNode(this._container);
|
21431 | }
|
21432 |
|
21433 |
|
21434 | };
|
21435 |
|
21436 | Trigger.prototype.onMouseEnter = function onMouseEnter(e) {
|
21437 | this.fireEvents('onMouseEnter', e);
|
21438 | this.delaySetPopupVisible(true, this.props.mouseEnterDelay);
|
21439 | };
|
21440 |
|
21441 | Trigger.prototype.onMouseLeave = function onMouseLeave(e) {
|
21442 | this.fireEvents('onMouseLeave', e);
|
21443 | this.delaySetPopupVisible(false, this.props.mouseLeaveDelay);
|
21444 | };
|
21445 |
|
21446 | Trigger.prototype.onPopupMouseEnter = function onPopupMouseEnter() {
|
21447 | this.clearDelayTimer();
|
21448 | };
|
21449 |
|
21450 | Trigger.prototype.onPopupMouseLeave = function onPopupMouseLeave(e) {
|
21451 |
|
21452 |
|
21453 | if (e.relatedTarget && !e.relatedTarget.setTimeout && this._component && (0, _contains2["default"])(this._component.getPopupDomNode(), e.relatedTarget)) {
|
21454 | return;
|
21455 | }
|
21456 | this.delaySetPopupVisible(false, this.props.mouseLeaveDelay);
|
21457 | };
|
21458 |
|
21459 | Trigger.prototype.onFocus = function onFocus(e) {
|
21460 | this.fireEvents('onFocus', e);
|
21461 |
|
21462 | this.clearDelayTimer();
|
21463 | if (this.isFocusToShow()) {
|
21464 | this.focusTime = Date.now();
|
21465 | this.delaySetPopupVisible(true, this.props.focusDelay);
|
21466 | }
|
21467 | };
|
21468 |
|
21469 | Trigger.prototype.onMouseDown = function onMouseDown(e) {
|
21470 | this.fireEvents('onMouseDown', e);
|
21471 | this.preClickTime = Date.now();
|
21472 | };
|
21473 |
|
21474 | Trigger.prototype.onTouchStart = function onTouchStart(e) {
|
21475 | this.fireEvents('onTouchStart', e);
|
21476 | this.preTouchTime = Date.now();
|
21477 | };
|
21478 |
|
21479 | Trigger.prototype.onBlur = function onBlur(e) {
|
21480 | this.fireEvents('onBlur', e);
|
21481 | this.clearDelayTimer();
|
21482 | if (this.isBlurToHide()) {
|
21483 | this.delaySetPopupVisible(false, this.props.blurDelay);
|
21484 | }
|
21485 | };
|
21486 |
|
21487 | Trigger.prototype.onClick = function onClick(event) {
|
21488 | this.fireEvents('onClick', event);
|
21489 |
|
21490 | if (this.focusTime) {
|
21491 | var preTime = void 0;
|
21492 | if (this.preClickTime && this.preTouchTime) {
|
21493 | preTime = Math.min(this.preClickTime, this.preTouchTime);
|
21494 | } else if (this.preClickTime) {
|
21495 | preTime = this.preClickTime;
|
21496 | } else if (this.preTouchTime) {
|
21497 | preTime = this.preTouchTime;
|
21498 | }
|
21499 | if (Math.abs(preTime - this.focusTime) < 20) {
|
21500 | return;
|
21501 | }
|
21502 | this.focusTime = 0;
|
21503 | }
|
21504 | this.preClickTime = 0;
|
21505 | this.preTouchTime = 0;
|
21506 | event.preventDefault();
|
21507 | var nextVisible = !this.state.popupVisible;
|
21508 | if (this.isClickToHide() && !nextVisible || nextVisible && this.isClickToShow()) {
|
21509 | this.setPopupVisible(!this.state.popupVisible);
|
21510 | }
|
21511 | };
|
21512 |
|
21513 | Trigger.prototype.onDocumentClick = function onDocumentClick(event) {
|
21514 | if (this.props.mask && !this.props.maskClosable) {
|
21515 | return;
|
21516 | }
|
21517 | var target = event.target;
|
21518 | var root = (0, _reactDom.findDOMNode)(this);
|
21519 | var popupNode = this.getPopupDomNode();
|
21520 | if (!(0, _contains2["default"])(root, target) && !(0, _contains2["default"])(popupNode, target)) {
|
21521 | this.close();
|
21522 | }
|
21523 | };
|
21524 |
|
21525 | Trigger.prototype.getPopupDomNode = function getPopupDomNode() {
|
21526 |
|
21527 | if (this._component) {
|
21528 | return this.mounted ? this._component.getPopupDomNode() : null;
|
21529 | }
|
21530 | return null;
|
21531 | };
|
21532 |
|
21533 | Trigger.prototype.getRootDomNode = function getRootDomNode() {
|
21534 | return _reactDom2["default"].findDOMNode(this);
|
21535 | };
|
21536 |
|
21537 | Trigger.prototype.getPopupClassNameFromAlign = function getPopupClassNameFromAlign(align) {
|
21538 | var className = [];
|
21539 | var props = this.props;
|
21540 | var popupPlacement = props.popupPlacement,
|
21541 | builtinPlacements = props.builtinPlacements,
|
21542 | clsPrefix = props.clsPrefix;
|
21543 |
|
21544 | if (popupPlacement && builtinPlacements) {
|
21545 | className.push((0, _utils.getPopupClassNameFromAlign)(builtinPlacements, clsPrefix, align));
|
21546 | }
|
21547 | if (props.getPopupClassNameFromAlign) {
|
21548 | className.push(props.getPopupClassNameFromAlign(align));
|
21549 | }
|
21550 | return className.join(' ');
|
21551 | };
|
21552 |
|
21553 | Trigger.prototype.getPopupAlign = function getPopupAlign() {
|
21554 | var props = this.props;
|
21555 | var popupPlacement = props.popupPlacement,
|
21556 | popupAlign = props.popupAlign,
|
21557 | builtinPlacements = props.builtinPlacements;
|
21558 |
|
21559 | if (popupPlacement && builtinPlacements) {
|
21560 | return (0, _utils.getAlignFromPlacement)(builtinPlacements, popupPlacement, popupAlign);
|
21561 | }
|
21562 | return popupAlign;
|
21563 | };
|
21564 |
|
21565 | Trigger.prototype.getComponent = function getComponent() {
|
21566 | var props = this.props,
|
21567 | state = this.state;
|
21568 |
|
21569 | var mouseProps = {};
|
21570 | if (this.isMouseEnterToShow()) {
|
21571 | mouseProps.onMouseEnter = this.onPopupMouseEnter;
|
21572 | }
|
21573 | if (this.isMouseLeaveToHide()) {
|
21574 | mouseProps.onMouseLeave = this.onPopupMouseLeave;
|
21575 | }
|
21576 | return _react2["default"].createElement(
|
21577 | _Popup2["default"],
|
21578 | _extends({
|
21579 | clsPrefix: props.clsPrefix,
|
21580 | destroyPopupOnHide: props.destroyPopupOnHide,
|
21581 | visible: state.popupVisible,
|
21582 | className: props.popupClassName,
|
21583 | action: props.action,
|
21584 | align: this.getPopupAlign(),
|
21585 | onAlign: props.onPopupAlign,
|
21586 | animation: props.popupAnimation,
|
21587 | getClassNameFromAlign: this.getPopupClassNameFromAlign
|
21588 | }, mouseProps, {
|
21589 | getRootDomNode: this.getRootDomNode,
|
21590 | style: props.popupStyle,
|
21591 | mask: props.mask,
|
21592 | zIndex: props.zIndex,
|
21593 | transitionName: props.popupTransitionName,
|
21594 | maskAnimation: props.maskAnimation,
|
21595 | maskTransitionName: props.maskTransitionName
|
21596 | }),
|
21597 | typeof props.popup === 'function' ? props.popup() : props.popup
|
21598 | );
|
21599 | };
|
21600 |
|
21601 | Trigger.prototype.setPopupVisible = function setPopupVisible(popupVisible) {
|
21602 | this.clearDelayTimer();
|
21603 | if (this.state.popupVisible !== popupVisible) {
|
21604 | if (!('popupVisible' in this.props)) {
|
21605 | this.setState({
|
21606 | popupVisible: popupVisible
|
21607 | });
|
21608 | }
|
21609 | this.props.onPopupVisibleChange(popupVisible);
|
21610 | }
|
21611 | };
|
21612 |
|
21613 | Trigger.prototype.delaySetPopupVisible = function delaySetPopupVisible(visible, delayS) {
|
21614 | var _this3 = this;
|
21615 |
|
21616 | var delay = delayS * 1000;
|
21617 | this.clearDelayTimer();
|
21618 | if (delay) {
|
21619 | this.delayTimer = setTimeout(function () {
|
21620 | _this3.setPopupVisible(visible);
|
21621 | _this3.clearDelayTimer();
|
21622 | }, delay);
|
21623 | } else {
|
21624 | this.setPopupVisible(visible);
|
21625 | }
|
21626 | };
|
21627 |
|
21628 | Trigger.prototype.clearDelayTimer = function clearDelayTimer() {
|
21629 | if (this.delayTimer) {
|
21630 | clearTimeout(this.delayTimer);
|
21631 | this.delayTimer = null;
|
21632 | }
|
21633 | };
|
21634 |
|
21635 | Trigger.prototype.createTwoChains = function createTwoChains(event) {
|
21636 | var childPros = this.props.children.props;
|
21637 | var props = this.props;
|
21638 | if (childPros[event] && props[event]) {
|
21639 | return this['fire' + event];
|
21640 | }
|
21641 | return childPros[event] || props[event];
|
21642 | };
|
21643 |
|
21644 | Trigger.prototype.isClickToShow = function isClickToShow() {
|
21645 | var _props = this.props,
|
21646 | action = _props.action,
|
21647 | showAction = _props.showAction;
|
21648 |
|
21649 | return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1;
|
21650 | };
|
21651 |
|
21652 | Trigger.prototype.isClickToHide = function isClickToHide() {
|
21653 | var _props2 = this.props,
|
21654 | action = _props2.action,
|
21655 | hideAction = _props2.hideAction;
|
21656 |
|
21657 | return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1;
|
21658 | };
|
21659 |
|
21660 | Trigger.prototype.isMouseEnterToShow = function isMouseEnterToShow() {
|
21661 | var _props3 = this.props,
|
21662 | action = _props3.action,
|
21663 | showAction = _props3.showAction;
|
21664 |
|
21665 | return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1;
|
21666 | };
|
21667 |
|
21668 | Trigger.prototype.isMouseLeaveToHide = function isMouseLeaveToHide() {
|
21669 | var _props4 = this.props,
|
21670 | action = _props4.action,
|
21671 | hideAction = _props4.hideAction;
|
21672 |
|
21673 | return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1;
|
21674 | };
|
21675 |
|
21676 | Trigger.prototype.isFocusToShow = function isFocusToShow() {
|
21677 | var _props5 = this.props,
|
21678 | action = _props5.action,
|
21679 | showAction = _props5.showAction;
|
21680 |
|
21681 | return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1;
|
21682 | };
|
21683 |
|
21684 | Trigger.prototype.isBlurToHide = function isBlurToHide() {
|
21685 | var _props6 = this.props,
|
21686 | action = _props6.action,
|
21687 | hideAction = _props6.hideAction;
|
21688 |
|
21689 | return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1;
|
21690 | };
|
21691 |
|
21692 | Trigger.prototype.forcePopupAlign = function forcePopupAlign() {
|
21693 | if (this.state.popupVisible && this.popupInstance && this.popupInstance.alignInstance) {
|
21694 | this.popupInstance.alignInstance.forceAlign();
|
21695 | }
|
21696 | };
|
21697 |
|
21698 | Trigger.prototype.fireEvents = function fireEvents(type, e) {
|
21699 | var childCallback = this.props.children.props[type];
|
21700 | if (childCallback) {
|
21701 | childCallback(e);
|
21702 | }
|
21703 | var callback = this.props[type];
|
21704 | if (callback) {
|
21705 | callback(e);
|
21706 | }
|
21707 | };
|
21708 |
|
21709 | Trigger.prototype.close = function close() {
|
21710 | this.setPopupVisible(false);
|
21711 | };
|
21712 |
|
21713 | Trigger.prototype.render = function render() {
|
21714 | var props = this.props;
|
21715 | var children = props.children;
|
21716 | var child = _react2["default"].Children.only(children);
|
21717 | var newChildProps = {};
|
21718 |
|
21719 | if (this.isClickToHide() || this.isClickToShow()) {
|
21720 | newChildProps.onClick = this.onClick;
|
21721 | newChildProps.onMouseDown = this.onMouseDown;
|
21722 | newChildProps.onTouchStart = this.onTouchStart;
|
21723 | } else {
|
21724 | newChildProps.onClick = this.createTwoChains('onClick');
|
21725 | newChildProps.onMouseDown = this.createTwoChains('onMouseDown');
|
21726 | newChildProps.onTouchStart = this.createTwoChains('onTouchStart');
|
21727 | }
|
21728 | if (this.isMouseEnterToShow()) {
|
21729 | newChildProps.onMouseEnter = this.onMouseEnter;
|
21730 | } else {
|
21731 | newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter');
|
21732 | }
|
21733 | if (this.isMouseLeaveToHide()) {
|
21734 | newChildProps.onMouseLeave = this.onMouseLeave;
|
21735 | } else {
|
21736 | newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave');
|
21737 | }
|
21738 | if (this.isFocusToShow() || this.isBlurToHide()) {
|
21739 | newChildProps.onFocus = this.onFocus;
|
21740 | newChildProps.onBlur = this.onBlur;
|
21741 | } else {
|
21742 | newChildProps.onFocus = this.createTwoChains('onFocus');
|
21743 | newChildProps.onBlur = this.createTwoChains('onBlur');
|
21744 | }
|
21745 |
|
21746 | return _react2["default"].cloneElement(child, newChildProps);
|
21747 | };
|
21748 |
|
21749 | return Trigger;
|
21750 | }(_react.Component);
|
21751 |
|
21752 | ;
|
21753 |
|
21754 | Trigger.propTypes = propTypes;
|
21755 | Trigger.defaultProps = defaultProps;
|
21756 | exports["default"] = Trigger;
|
21757 | module.exports = exports['default'];
|
21758 |
|
21759 | }),
|
21760 |
|
21761 | (function(module, exports, __webpack_require__) {
|
21762 |
|
21763 | "use strict";
|
21764 |
|
21765 | var _interopRequireDefault = __webpack_require__(14);
|
21766 |
|
21767 | exports.__esModule = true;
|
21768 | exports.default = void 0;
|
21769 |
|
21770 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
21771 |
|
21772 | var _default = function () {
|
21773 |
|
21774 |
|
21775 | return _inDOM.default ? function (context, node) {
|
21776 | if (context.contains) {
|
21777 | return context.contains(node);
|
21778 | } else if (context.compareDocumentPosition) {
|
21779 | return context === node || !!(context.compareDocumentPosition(node) & 16);
|
21780 | } else {
|
21781 | return fallback(context, node);
|
21782 | }
|
21783 | } : fallback;
|
21784 | }();
|
21785 |
|
21786 | exports.default = _default;
|
21787 |
|
21788 | function fallback(context, node) {
|
21789 | if (node) do {
|
21790 | if (node === context) return true;
|
21791 | } while (node = node.parentNode);
|
21792 | return false;
|
21793 | }
|
21794 |
|
21795 | module.exports = exports["default"];
|
21796 |
|
21797 | }),
|
21798 |
|
21799 | (function(module, exports, __webpack_require__) {
|
21800 |
|
21801 | 'use strict';
|
21802 |
|
21803 | Object.defineProperty(exports, "__esModule", {
|
21804 | value: true
|
21805 | });
|
21806 |
|
21807 | 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; };
|
21808 |
|
21809 | var _react = __webpack_require__(4);
|
21810 |
|
21811 | var _react2 = _interopRequireDefault(_react);
|
21812 |
|
21813 | var _propTypes = __webpack_require__(5);
|
21814 |
|
21815 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
21816 |
|
21817 | var _reactDom = __webpack_require__(12);
|
21818 |
|
21819 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
21820 |
|
21821 | var _Align = __webpack_require__(50);
|
21822 |
|
21823 | var _Align2 = _interopRequireDefault(_Align);
|
21824 |
|
21825 | var _beeAnimate = __webpack_require__(69);
|
21826 |
|
21827 | var _beeAnimate2 = _interopRequireDefault(_beeAnimate);
|
21828 |
|
21829 | var _PopupInner = __webpack_require__(233);
|
21830 |
|
21831 | var _PopupInner2 = _interopRequireDefault(_PopupInner);
|
21832 |
|
21833 | var _LazyRenderBox = __webpack_require__(234);
|
21834 |
|
21835 | var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox);
|
21836 |
|
21837 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
21838 |
|
21839 | 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; }
|
21840 |
|
21841 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
21842 |
|
21843 | 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; }
|
21844 |
|
21845 | 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); }
|
21846 |
|
21847 | var propTypes = {
|
21848 | visible: _propTypes2["default"].bool,
|
21849 | style: _propTypes2["default"].object,
|
21850 | getClassNameFromAlign: _propTypes2["default"].func,
|
21851 | onAlign: _propTypes2["default"].func,
|
21852 | getRootDomNode: _propTypes2["default"].func,
|
21853 | onMouseEnter: _propTypes2["default"].func,
|
21854 | align: _propTypes2["default"].any,
|
21855 | destroyPopupOnHide: _propTypes2["default"].bool,
|
21856 | className: _propTypes2["default"].string,
|
21857 | clsPrefix: _propTypes2["default"].string,
|
21858 | onMouseLeave: _propTypes2["default"].func
|
21859 | };
|
21860 |
|
21861 | var Popup = function (_Component) {
|
21862 | _inherits(Popup, _Component);
|
21863 |
|
21864 | function Popup() {
|
21865 | _classCallCheck(this, Popup);
|
21866 |
|
21867 | var _this = _possibleConstructorReturn(this, _Component.call(this));
|
21868 |
|
21869 | _this.onAlign = _this.onAlign.bind(_this);
|
21870 | _this.getPopupDomNode = _this.getPopupDomNode.bind(_this);
|
21871 | _this.getTarget = _this.getTarget.bind(_this);
|
21872 | _this.getMaskTransitionName = _this.getMaskTransitionName.bind(_this);
|
21873 | _this.getTransitionName = _this.getTransitionName.bind(_this);
|
21874 | _this.getClassName = _this.getClassName.bind(_this);
|
21875 | _this.getPopupElement = _this.getPopupElement.bind(_this);
|
21876 | _this.getZIndexStyle = _this.getZIndexStyle.bind(_this);
|
21877 | _this.getMaskElement = _this.getMaskElement.bind(_this);
|
21878 | _this.saveAlign = _this.saveAlign.bind(_this);
|
21879 | return _this;
|
21880 | }
|
21881 |
|
21882 | Popup.prototype.componentDidMount = function componentDidMount() {
|
21883 | this.rootNode = this.getPopupDomNode();
|
21884 | };
|
21885 |
|
21886 | Popup.prototype.onAlign = function onAlign(popupDomNode, align) {
|
21887 | var props = this.props;
|
21888 | var alignClassName = props.getClassNameFromAlign(props.align);
|
21889 | var currentAlignClassName = props.getClassNameFromAlign(align);
|
21890 | if (alignClassName !== currentAlignClassName) {
|
21891 | this.currentAlignClassName = currentAlignClassName;
|
21892 | popupDomNode.className = this.getClassName(currentAlignClassName);
|
21893 | }
|
21894 | props.onAlign(popupDomNode, align);
|
21895 | };
|
21896 |
|
21897 | Popup.prototype.getPopupDomNode = function getPopupDomNode() {
|
21898 | return _reactDom2["default"].findDOMNode(this.refs.popup);
|
21899 | };
|
21900 |
|
21901 | Popup.prototype.getTarget = function getTarget() {
|
21902 | return this.props.getRootDomNode();
|
21903 | };
|
21904 |
|
21905 | Popup.prototype.getMaskTransitionName = function getMaskTransitionName() {
|
21906 | var props = this.props;
|
21907 | var transitionName = props.maskTransitionName;
|
21908 | var animation = props.maskAnimation;
|
21909 | if (!transitionName && animation) {
|
21910 | transitionName = props.clsPrefix + '-' + animation;
|
21911 | }
|
21912 | return transitionName;
|
21913 | };
|
21914 |
|
21915 | Popup.prototype.getTransitionName = function getTransitionName() {
|
21916 | var props = this.props;
|
21917 | var transitionName = props.transitionName;
|
21918 | if (!transitionName && props.animation) {
|
21919 | transitionName = props.clsPrefix + '-' + props.animation;
|
21920 | }
|
21921 | return transitionName;
|
21922 | };
|
21923 |
|
21924 | Popup.prototype.getClassName = function getClassName(currentAlignClassName) {
|
21925 | return this.props.clsPrefix + ' ' + this.props.className + ' ' + currentAlignClassName;
|
21926 | };
|
21927 |
|
21928 | Popup.prototype.getPopupElement = function getPopupElement() {
|
21929 | var props = this.props;
|
21930 | var align = props.align,
|
21931 | style = props.style,
|
21932 | visible = props.visible,
|
21933 | clsPrefix = props.clsPrefix,
|
21934 | destroyPopupOnHide = props.destroyPopupOnHide;
|
21935 |
|
21936 | var className = this.getClassName(this.currentAlignClassName || props.getClassNameFromAlign(align));
|
21937 | var hiddenClassName = clsPrefix + '-hidden';
|
21938 | if (!visible) {
|
21939 | this.currentAlignClassName = null;
|
21940 | }
|
21941 | var newStyle = _extends({}, style, this.getZIndexStyle());
|
21942 | var popupInnerProps = {
|
21943 | className: className,
|
21944 | clsPrefix: clsPrefix,
|
21945 | ref: 'popup',
|
21946 | onMouseEnter: props.onMouseEnter,
|
21947 | onMouseLeave: props.onMouseLeave,
|
21948 | style: newStyle
|
21949 | };
|
21950 | if (destroyPopupOnHide) {
|
21951 | return _react2["default"].createElement(
|
21952 | _beeAnimate2["default"],
|
21953 | {
|
21954 | component: '',
|
21955 | exclusive: true,
|
21956 | transitionAppear: true,
|
21957 | transitionName: this.getTransitionName()
|
21958 | },
|
21959 | visible ? _react2["default"].createElement(
|
21960 | _Align2["default"],
|
21961 | {
|
21962 | target: this.getTarget,
|
21963 | key: 'popup',
|
21964 | ref: this.saveAlign,
|
21965 | monitorWindowResize: true,
|
21966 | align: align,
|
21967 | onAlign: this.onAlign
|
21968 | },
|
21969 | _react2["default"].createElement(
|
21970 | _PopupInner2["default"],
|
21971 | _extends({
|
21972 | visible: true
|
21973 | }, popupInnerProps),
|
21974 | props.children
|
21975 | )
|
21976 | ) : null
|
21977 | );
|
21978 | }
|
21979 | return _react2["default"].createElement(
|
21980 | _beeAnimate2["default"],
|
21981 | {
|
21982 | component: '',
|
21983 | exclusive: true,
|
21984 | transitionAppear: true,
|
21985 | transitionName: this.getTransitionName(),
|
21986 | showProp: 'xVisible'
|
21987 | },
|
21988 | _react2["default"].createElement(
|
21989 | _Align2["default"],
|
21990 | {
|
21991 | target: this.getTarget,
|
21992 | key: 'popup',
|
21993 | ref: this.saveAlign,
|
21994 | monitorWindowResize: true,
|
21995 | xVisible: visible,
|
21996 | childrenProps: { visible: 'xVisible' },
|
21997 | disabled: !visible,
|
21998 | align: align,
|
21999 | onAlign: this.onAlign
|
22000 | },
|
22001 | _react2["default"].createElement(
|
22002 | _PopupInner2["default"],
|
22003 | _extends({
|
22004 | hiddenClassName: hiddenClassName
|
22005 | }, popupInnerProps),
|
22006 | props.children
|
22007 | )
|
22008 | )
|
22009 | );
|
22010 | };
|
22011 |
|
22012 | Popup.prototype.getZIndexStyle = function getZIndexStyle() {
|
22013 | var style = {};
|
22014 | var props = this.props;
|
22015 | if (props.zIndex !== undefined) {
|
22016 | style.zIndex = props.zIndex;
|
22017 | }
|
22018 | return style;
|
22019 | };
|
22020 |
|
22021 | Popup.prototype.getMaskElement = function getMaskElement() {
|
22022 | var props = this.props;
|
22023 | var maskElement = void 0;
|
22024 | if (props.mask) {
|
22025 | var maskTransition = this.getMaskTransitionName();
|
22026 | maskElement = _react2["default"].createElement(_LazyRenderBox2["default"], {
|
22027 | style: this.getZIndexStyle(),
|
22028 | key: 'mask',
|
22029 | className: props.clsPrefix + '-mask',
|
22030 | hiddenClassName: props.clsPrefix + '-mask-hidden',
|
22031 | visible: props.visible
|
22032 | });
|
22033 | if (maskTransition) {
|
22034 | maskElement = _react2["default"].createElement(
|
22035 | _beeAnimate2["default"],
|
22036 | {
|
22037 | key: 'mask',
|
22038 | showProp: 'visible',
|
22039 | transitionAppear: true,
|
22040 | component: '',
|
22041 | transitionName: maskTransition
|
22042 | },
|
22043 | maskElement
|
22044 | );
|
22045 | }
|
22046 | }
|
22047 | return maskElement;
|
22048 | };
|
22049 |
|
22050 | Popup.prototype.saveAlign = function saveAlign(align) {
|
22051 | this.alignInstance = align;
|
22052 | };
|
22053 |
|
22054 | Popup.prototype.render = function render() {
|
22055 | return _react2["default"].createElement(
|
22056 | 'div',
|
22057 | null,
|
22058 | this.getMaskElement(),
|
22059 | this.getPopupElement()
|
22060 | );
|
22061 | };
|
22062 |
|
22063 | return Popup;
|
22064 | }(_react.Component);
|
22065 |
|
22066 | ;
|
22067 |
|
22068 | Popup.propTypes = propTypes;
|
22069 | exports["default"] = Popup;
|
22070 | module.exports = exports['default'];
|
22071 |
|
22072 | }),
|
22073 |
|
22074 | (function(module, exports, __webpack_require__) {
|
22075 |
|
22076 | 'use strict';
|
22077 |
|
22078 | Object.defineProperty(exports, "__esModule", {
|
22079 | value: true
|
22080 | });
|
22081 |
|
22082 | var _react = __webpack_require__(4);
|
22083 |
|
22084 | var _react2 = _interopRequireDefault(_react);
|
22085 |
|
22086 | var _propTypes = __webpack_require__(5);
|
22087 |
|
22088 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
22089 |
|
22090 | var _LazyRenderBox = __webpack_require__(234);
|
22091 |
|
22092 | var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox);
|
22093 |
|
22094 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
22095 |
|
22096 | 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; }
|
22097 |
|
22098 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
22099 |
|
22100 | 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; }
|
22101 |
|
22102 | 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); }
|
22103 |
|
22104 | var propTypes = {
|
22105 | hiddenClassName: _propTypes2["default"].string,
|
22106 | className: _propTypes2["default"].string,
|
22107 | clsPrefix: _propTypes2["default"].string,
|
22108 | onMouseEnter: _propTypes2["default"].func,
|
22109 | onMouseLeave: _propTypes2["default"].func,
|
22110 | children: _propTypes2["default"].any
|
22111 | };
|
22112 |
|
22113 | var PopupInner = function (_Component) {
|
22114 | _inherits(PopupInner, _Component);
|
22115 |
|
22116 | function PopupInner() {
|
22117 | _classCallCheck(this, PopupInner);
|
22118 |
|
22119 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
22120 | }
|
22121 |
|
22122 | PopupInner.prototype.render = function render() {
|
22123 | var props = this.props;
|
22124 | var className = props.className;
|
22125 | if (!props.visible) {
|
22126 | className += ' ' + props.hiddenClassName;
|
22127 | }
|
22128 | return _react2["default"].createElement(
|
22129 | 'div',
|
22130 | {
|
22131 | className: className,
|
22132 | onMouseEnter: props.onMouseEnter,
|
22133 | onMouseLeave: props.onMouseLeave,
|
22134 | style: props.style
|
22135 | },
|
22136 | _react2["default"].createElement(
|
22137 | _LazyRenderBox2["default"],
|
22138 | { className: props.clsPrefix + '-content', visible: props.visible },
|
22139 | props.children
|
22140 | )
|
22141 | );
|
22142 | };
|
22143 |
|
22144 | return PopupInner;
|
22145 | }(_react.Component);
|
22146 |
|
22147 | ;
|
22148 |
|
22149 | PopupInner.propTypes = propTypes;
|
22150 | exports["default"] = PopupInner;
|
22151 | module.exports = exports['default'];
|
22152 |
|
22153 | }),
|
22154 |
|
22155 | (function(module, exports, __webpack_require__) {
|
22156 |
|
22157 | 'use strict';
|
22158 |
|
22159 | Object.defineProperty(exports, "__esModule", {
|
22160 | value: true
|
22161 | });
|
22162 |
|
22163 | var _react = __webpack_require__(4);
|
22164 |
|
22165 | var _react2 = _interopRequireDefault(_react);
|
22166 |
|
22167 | var _propTypes = __webpack_require__(5);
|
22168 |
|
22169 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
22170 |
|
22171 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
22172 |
|
22173 | 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; }
|
22174 |
|
22175 | 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; }
|
22176 |
|
22177 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
22178 |
|
22179 | 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; }
|
22180 |
|
22181 | 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); }
|
22182 |
|
22183 | var propTypes = {
|
22184 | children: _propTypes2["default"].any,
|
22185 | className: _propTypes2["default"].string,
|
22186 | visible: _propTypes2["default"].bool,
|
22187 | hiddenClassName: _propTypes2["default"].string
|
22188 | };
|
22189 |
|
22190 | var LazyRenderBox = function (_Component) {
|
22191 | _inherits(LazyRenderBox, _Component);
|
22192 |
|
22193 | function LazyRenderBox() {
|
22194 | _classCallCheck(this, LazyRenderBox);
|
22195 |
|
22196 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
22197 | }
|
22198 |
|
22199 | LazyRenderBox.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
22200 | return nextProps.hiddenClassName || nextProps.visible;
|
22201 | };
|
22202 |
|
22203 | LazyRenderBox.prototype.render = function render() {
|
22204 | var _props = this.props,
|
22205 | hiddenClassName = _props.hiddenClassName,
|
22206 | visible = _props.visible,
|
22207 | props = _objectWithoutProperties(_props, ['hiddenClassName', 'visible']);
|
22208 |
|
22209 | if (hiddenClassName || _react2["default"].Children.count(props.children) > 1) {
|
22210 | if (!visible && hiddenClassName) {
|
22211 | props.className += ' ' + hiddenClassName;
|
22212 | }
|
22213 | return _react2["default"].createElement('div', props);
|
22214 | }
|
22215 |
|
22216 | return _react2["default"].Children.only(props.children);
|
22217 | };
|
22218 |
|
22219 | return LazyRenderBox;
|
22220 | }(_react.Component);
|
22221 |
|
22222 | ;
|
22223 | LazyRenderBox.propTypes = propTypes;
|
22224 |
|
22225 | exports["default"] = LazyRenderBox;
|
22226 | module.exports = exports['default'];
|
22227 |
|
22228 | }),
|
22229 |
|
22230 | (function(module, exports) {
|
22231 |
|
22232 | 'use strict';
|
22233 |
|
22234 | Object.defineProperty(exports, "__esModule", {
|
22235 | value: true
|
22236 | });
|
22237 |
|
22238 | 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; };
|
22239 |
|
22240 | exports.getAlignFromPlacement = getAlignFromPlacement;
|
22241 | exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign;
|
22242 | function isPointsEq(a1, a2) {
|
22243 | return a1[0] === a2[0] && a1[1] === a2[1];
|
22244 | }
|
22245 |
|
22246 | function getAlignFromPlacement(builtinPlacements, placementStr, align) {
|
22247 | var baseAlign = builtinPlacements[placementStr] || {};
|
22248 | return _extends({}, baseAlign, align);
|
22249 | }
|
22250 |
|
22251 | function getPopupClassNameFromAlign(builtinPlacements, clsPrefix, align) {
|
22252 | var points = align.points;
|
22253 | for (var placement in builtinPlacements) {
|
22254 | if (builtinPlacements.hasOwnProperty(placement)) {
|
22255 | if (isPointsEq(builtinPlacements[placement].points, points)) {
|
22256 | return clsPrefix + '-placement-' + placement;
|
22257 | }
|
22258 | }
|
22259 | }
|
22260 | return '';
|
22261 | }
|
22262 |
|
22263 | }),
|
22264 |
|
22265 | (function(module, exports, __webpack_require__) {
|
22266 |
|
22267 | 'use strict';
|
22268 |
|
22269 | Object.defineProperty(exports, "__esModule", {
|
22270 | value: true
|
22271 | });
|
22272 |
|
22273 | 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; };
|
22274 |
|
22275 | var _react = __webpack_require__(4);
|
22276 |
|
22277 | var _react2 = _interopRequireDefault(_react);
|
22278 |
|
22279 | var _reactDom = __webpack_require__(12);
|
22280 |
|
22281 | var _propTypes = __webpack_require__(5);
|
22282 |
|
22283 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
22284 |
|
22285 | var _tinperBeeCore = __webpack_require__(27);
|
22286 |
|
22287 | var _rcMenu = __webpack_require__(92);
|
22288 |
|
22289 | var _rcMenu2 = _interopRequireDefault(_rcMenu);
|
22290 |
|
22291 | var _domScrollIntoView = __webpack_require__(221);
|
22292 |
|
22293 | var _domScrollIntoView2 = _interopRequireDefault(_domScrollIntoView);
|
22294 |
|
22295 | var _raf = __webpack_require__(237);
|
22296 |
|
22297 | var _raf2 = _interopRequireDefault(_raf);
|
22298 |
|
22299 | var _util = __webpack_require__(227);
|
22300 |
|
22301 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
22302 |
|
22303 | 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; }
|
22304 |
|
22305 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
22306 |
|
22307 | 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; }
|
22308 |
|
22309 | 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); } |
22310 |
|
22311 |
|
22312 |
|
22313 |
|
22314 |
|
22315 | var DropdownMenu = function (_React$Component) {
|
22316 | _inherits(DropdownMenu, _React$Component);
|
22317 |
|
22318 | function DropdownMenu(props) {
|
22319 | _classCallCheck(this, DropdownMenu);
|
22320 |
|
22321 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
22322 |
|
22323 | _this.scrollActiveItemToView = function () {
|
22324 |
|
22325 | var itemComponent = (0, _reactDom.findDOMNode)(_this.firstActiveItem);
|
22326 | var _this$props = _this.props,
|
22327 | value = _this$props.value,
|
22328 | visible = _this$props.visible,
|
22329 | firstActiveValue = _this$props.firstActiveValue;
|
22330 |
|
22331 |
|
22332 | if (!itemComponent || !visible) {
|
22333 | return;
|
22334 | }
|
22335 | var scrollIntoViewOpts = {
|
22336 | onlyScrollIfNeeded: true
|
22337 | };
|
22338 | if ((!value || value.length === 0) && firstActiveValue) {
|
22339 | scrollIntoViewOpts.alignWithTop = true;
|
22340 | }
|
22341 |
|
22342 |
|
22343 |
|
22344 | _this.rafInstance = (0, _raf2["default"])(function () {
|
22345 | (0, _domScrollIntoView2["default"])(itemComponent, (0, _reactDom.findDOMNode)(_this.menuRef), scrollIntoViewOpts);
|
22346 | });
|
22347 | };
|
22348 |
|
22349 | _this.lastInputValue = props.inputValue;
|
22350 | _this.saveMenuRef = (0, _util.saveRef)(_this, 'menuRef');
|
22351 | return _this;
|
22352 | }
|
22353 |
|
22354 | DropdownMenu.prototype.componentDidMount = function componentDidMount() {
|
22355 | this.scrollActiveItemToView();
|
22356 | this.lastVisible = this.props.visible;
|
22357 | };
|
22358 |
|
22359 | DropdownMenu.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
22360 | if (!nextProps.visible) {
|
22361 | this.lastVisible = false;
|
22362 | }
|
22363 |
|
22364 | return nextProps.visible || nextProps.inputValue !== this.props.inputValue;
|
22365 | };
|
22366 |
|
22367 | DropdownMenu.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
22368 | var props = this.props;
|
22369 | if (!prevProps.visible && props.visible) {
|
22370 | this.scrollActiveItemToView();
|
22371 | }
|
22372 | this.lastVisible = props.visible;
|
22373 | this.lastInputValue = props.inputValue;
|
22374 | };
|
22375 |
|
22376 | DropdownMenu.prototype.componentWillUnmount = function componentWillUnmount() {
|
22377 | if (this.rafInstance && this.rafInstance.cancel) {
|
22378 | this.rafInstance.cancel();
|
22379 | }
|
22380 | };
|
22381 |
|
22382 | DropdownMenu.prototype.renderMenu = function renderMenu() {
|
22383 | var _this2 = this;
|
22384 |
|
22385 | var props = this.props;
|
22386 | var menuItems = props.menuItems,
|
22387 | menuItemSelectedIcon = props.menuItemSelectedIcon,
|
22388 | defaultActiveFirstOption = props.defaultActiveFirstOption,
|
22389 | value = props.value,
|
22390 | prefixCls = props.prefixCls,
|
22391 | multiple = props.multiple,
|
22392 | onMenuSelect = props.onMenuSelect,
|
22393 | inputValue = props.inputValue,
|
22394 | firstActiveValue = props.firstActiveValue,
|
22395 | backfillValue = props.backfillValue,
|
22396 | clsPrefix = props.clsPrefix;
|
22397 |
|
22398 | if (menuItems && menuItems.length) {
|
22399 | var menuProps = {};
|
22400 | if (multiple) {
|
22401 | menuProps.onDeselect = props.onMenuDeselect;
|
22402 | menuProps.onSelect = onMenuSelect;
|
22403 | } else {
|
22404 | menuProps.onClick = onMenuSelect;
|
22405 | }
|
22406 |
|
22407 | var selectedKeys = (0, _util.getSelectKeys)(menuItems, value);
|
22408 | var activeKeyProps = {};
|
22409 |
|
22410 | var clonedMenuItems = menuItems;
|
22411 | if (selectedKeys.length || firstActiveValue) {
|
22412 | if (props.visible && !this.lastVisible) {
|
22413 | activeKeyProps.activeKey = selectedKeys[0] || firstActiveValue;
|
22414 | }
|
22415 | var foundFirst = false;
|
22416 |
|
22417 |
|
22418 | var clone = function clone(item) {
|
22419 | if (!foundFirst && selectedKeys.indexOf(item.key) !== -1 || !foundFirst && !selectedKeys.length && firstActiveValue.indexOf(item.key) !== -1) {
|
22420 | foundFirst = true;
|
22421 | return (0, _react.cloneElement)(item, {
|
22422 | ref: function ref(_ref) {
|
22423 | _this2.firstActiveItem = _ref;
|
22424 | }
|
22425 | });
|
22426 | }
|
22427 | return item;
|
22428 | };
|
22429 |
|
22430 | clonedMenuItems = menuItems.map(function (item) {
|
22431 | if (item.type.isMenuItemGroup) {
|
22432 | var children = (0, _tinperBeeCore.toArray)(item.props.children).map(clone);
|
22433 | return (0, _react.cloneElement)(item, {}, children);
|
22434 | }
|
22435 | return clone(item);
|
22436 | });
|
22437 | } else {
|
22438 |
|
22439 |
|
22440 |
|
22441 | this.firstActiveItem = null;
|
22442 | }
|
22443 |
|
22444 |
|
22445 | var lastValue = value && value[value.length - 1];
|
22446 | if (inputValue !== this.lastInputValue && (!lastValue || lastValue !== backfillValue)) {
|
22447 | activeKeyProps.activeKey = '';
|
22448 | }
|
22449 | return _react2["default"].createElement(
|
22450 | _rcMenu2["default"],
|
22451 | _extends({
|
22452 | ref: this.saveMenuRef,
|
22453 | style: this.props.dropdownMenuStyle,
|
22454 | defaultActiveFirst: defaultActiveFirstOption,
|
22455 | role: 'listbox',
|
22456 | itemIcon: multiple ? menuItemSelectedIcon : null
|
22457 | }, activeKeyProps, {
|
22458 | multiple: multiple
|
22459 | }, menuProps, {
|
22460 | selectedKeys: selectedKeys,
|
22461 | prefixCls: clsPrefix + '-menu'
|
22462 | }),
|
22463 | clonedMenuItems
|
22464 | );
|
22465 | }
|
22466 | return null;
|
22467 | };
|
22468 |
|
22469 | DropdownMenu.prototype.render = function render() {
|
22470 | var renderMenu = this.renderMenu();
|
22471 | return renderMenu ? _react2["default"].createElement(
|
22472 | 'div',
|
22473 | {
|
22474 | style: {
|
22475 | overflow: 'auto',
|
22476 | transform: 'translateZ(0)'
|
22477 | },
|
22478 | onFocus: this.props.onPopupFocus,
|
22479 | onMouseDown: _util.preventDefaultEvent,
|
22480 | onScroll: this.props.onPopupScroll
|
22481 | },
|
22482 | renderMenu
|
22483 | ) : null;
|
22484 | };
|
22485 |
|
22486 | return DropdownMenu;
|
22487 | }(_react2["default"].Component);
|
22488 |
|
22489 | DropdownMenu.displayName = 'DropdownMenu';
|
22490 | DropdownMenu.propTypes = {
|
22491 | defaultActiveFirstOption: _propTypes2["default"].bool,
|
22492 | value: _propTypes2["default"].any,
|
22493 | dropdownMenuStyle: _propTypes2["default"].object,
|
22494 | multiple: _propTypes2["default"].bool,
|
22495 | onPopupFocus: _propTypes2["default"].func,
|
22496 | onPopupScroll: _propTypes2["default"].func,
|
22497 | onMenuDeSelect: _propTypes2["default"].func,
|
22498 | onMenuSelect: _propTypes2["default"].func,
|
22499 | prefixCls: _propTypes2["default"].string,
|
22500 | menuItems: _propTypes2["default"].any,
|
22501 | inputValue: _propTypes2["default"].string,
|
22502 | visible: _propTypes2["default"].bool,
|
22503 | firstActiveValue: _propTypes2["default"].string,
|
22504 | menuItemSelectedIcon: _propTypes2["default"].oneOfType([_propTypes2["default"].func, _propTypes2["default"].node])
|
22505 | };
|
22506 | exports["default"] = DropdownMenu;
|
22507 | module.exports = exports['default'];
|
22508 |
|
22509 | }),
|
22510 |
|
22511 | (function(module, exports, __webpack_require__) {
|
22512 |
|
22513 | (function(global) {var now = __webpack_require__(238)
|
22514 | , root = typeof window === 'undefined' ? global : window
|
22515 | , vendors = ['moz', 'webkit']
|
22516 | , suffix = 'AnimationFrame'
|
22517 | , raf = root['request' + suffix]
|
22518 | , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]
|
22519 |
|
22520 | for(var i = 0; !raf && i < vendors.length; i++) {
|
22521 | raf = root[vendors[i] + 'Request' + suffix]
|
22522 | caf = root[vendors[i] + 'Cancel' + suffix]
|
22523 | || root[vendors[i] + 'CancelRequest' + suffix]
|
22524 | }
|
22525 |
|
22526 |
|
22527 | if(!raf || !caf) {
|
22528 | var last = 0
|
22529 | , id = 0
|
22530 | , queue = []
|
22531 | , frameDuration = 1000 / 60
|
22532 |
|
22533 | raf = function(callback) {
|
22534 | if(queue.length === 0) {
|
22535 | var _now = now()
|
22536 | , next = Math.max(0, frameDuration - (_now - last))
|
22537 | last = next + _now
|
22538 | setTimeout(function() {
|
22539 | var cp = queue.slice(0)
|
22540 |
|
22541 |
|
22542 |
|
22543 | queue.length = 0
|
22544 | for(var i = 0; i < cp.length; i++) {
|
22545 | if(!cp[i].cancelled) {
|
22546 | try{
|
22547 | cp[i].callback(last)
|
22548 | } catch(e) {
|
22549 | setTimeout(function() { throw e }, 0)
|
22550 | }
|
22551 | }
|
22552 | }
|
22553 | }, Math.round(next))
|
22554 | }
|
22555 | queue.push({
|
22556 | handle: ++id,
|
22557 | callback: callback,
|
22558 | cancelled: false
|
22559 | })
|
22560 | return id
|
22561 | }
|
22562 |
|
22563 | caf = function(handle) {
|
22564 | for(var i = 0; i < queue.length; i++) {
|
22565 | if(queue[i].handle === handle) {
|
22566 | queue[i].cancelled = true
|
22567 | }
|
22568 | }
|
22569 | }
|
22570 | }
|
22571 |
|
22572 | module.exports = function(fn) {
|
22573 |
|
22574 |
|
22575 |
|
22576 | return raf.call(root, fn)
|
22577 | }
|
22578 | module.exports.cancel = function() {
|
22579 | caf.apply(root, arguments)
|
22580 | }
|
22581 | module.exports.polyfill = function(object) {
|
22582 | if (!object) {
|
22583 | object = root;
|
22584 | }
|
22585 | object.requestAnimationFrame = raf
|
22586 | object.cancelAnimationFrame = caf
|
22587 | }
|
22588 |
|
22589 | }.call(exports, (function() { return this; }())))
|
22590 |
|
22591 | }),
|
22592 |
|
22593 | (function(module, exports, __webpack_require__) {
|
22594 |
|
22595 | (function(process) {
|
22596 | (function() {
|
22597 | var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime;
|
22598 |
|
22599 | if ((typeof performance !== "undefined" && performance !== null) && performance.now) {
|
22600 | module.exports = function() {
|
22601 | return performance.now();
|
22602 | };
|
22603 | } else if ((typeof process !== "undefined" && process !== null) && process.hrtime) {
|
22604 | module.exports = function() {
|
22605 | return (getNanoSeconds() - nodeLoadTime) / 1e6;
|
22606 | };
|
22607 | hrtime = process.hrtime;
|
22608 | getNanoSeconds = function() {
|
22609 | var hr;
|
22610 | hr = hrtime();
|
22611 | return hr[0] * 1e9 + hr[1];
|
22612 | };
|
22613 | moduleLoadTime = getNanoSeconds();
|
22614 | upTime = process.uptime() * 1e9;
|
22615 | nodeLoadTime = moduleLoadTime - upTime;
|
22616 | } else if (Date.now) {
|
22617 | module.exports = function() {
|
22618 | return Date.now() - loadTime;
|
22619 | };
|
22620 | loadTime = Date.now();
|
22621 | } else {
|
22622 | module.exports = function() {
|
22623 | return new Date().getTime() - loadTime;
|
22624 | };
|
22625 | loadTime = new Date().getTime();
|
22626 | }
|
22627 |
|
22628 | }).call(this);
|
22629 |
|
22630 |
|
22631 |
|
22632 | }.call(exports, __webpack_require__(33)))
|
22633 |
|
22634 | }),
|
22635 |
|
22636 | (function(module, exports, __webpack_require__) {
|
22637 |
|
22638 | 'use strict';
|
22639 |
|
22640 | Object.defineProperty(exports, "__esModule", {
|
22641 | value: true
|
22642 | });
|
22643 | exports.SelectPropTypes = undefined;
|
22644 |
|
22645 | var _propTypes = __webpack_require__(5);
|
22646 |
|
22647 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
22648 |
|
22649 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
22650 |
|
22651 | function valueType(props, propName, componentName) {
|
22652 | var basicType = _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]);
|
22653 |
|
22654 | var labelInValueShape = _propTypes2["default"].shape({
|
22655 | key: basicType.isRequired,
|
22656 | label: _propTypes2["default"].node
|
22657 | });
|
22658 | if (props.labelInValue) {
|
22659 | var validate = _propTypes2["default"].oneOfType([_propTypes2["default"].arrayOf(labelInValueShape), labelInValueShape]);
|
22660 | var error = validate.apply(undefined, arguments);
|
22661 | if (error) {
|
22662 | return new Error('Invalid prop `' + propName + '` supplied to `' + componentName + '`, ' + ('when you set `labelInValue` to `true`, `' + propName + '` should in ') + 'shape of `{ key: string | number, label?: ReactNode }`.');
|
22663 | }
|
22664 | } else if ((props.mode === 'multiple' || props.mode === 'tags' || props.multiple || props.tags) && props[propName] === '') {
|
22665 | return new Error('Invalid prop `' + propName + '` of type `string` supplied to `' + componentName + '`, ' + 'expected `array` when `multiple` or `tags` is `true`.');
|
22666 | } else {
|
22667 | var _validate = _propTypes2["default"].oneOfType([_propTypes2["default"].arrayOf(basicType), basicType]);
|
22668 | return _validate.apply(undefined, arguments);
|
22669 | }
|
22670 | } |
22671 |
|
22672 |
|
22673 |
|
22674 | var SelectPropTypes = exports.SelectPropTypes = {
|
22675 | id: _propTypes2["default"].string,
|
22676 | defaultActiveFirstOption: _propTypes2["default"].bool,
|
22677 | multiple: _propTypes2["default"].bool,
|
22678 | filterOption: _propTypes2["default"].any,
|
22679 | children: _propTypes2["default"].any,
|
22680 | showSearch: _propTypes2["default"].bool,
|
22681 | disabled: _propTypes2["default"].bool,
|
22682 | allowClear: _propTypes2["default"].bool,
|
22683 | showArrow: _propTypes2["default"].bool,
|
22684 | tags: _propTypes2["default"].bool,
|
22685 | prefixCls: _propTypes2["default"].string,
|
22686 | className: _propTypes2["default"].string,
|
22687 | transitionName: _propTypes2["default"].string,
|
22688 | optionLabelProp: _propTypes2["default"].string,
|
22689 | optionFilterProp: _propTypes2["default"].string,
|
22690 | animation: _propTypes2["default"].string,
|
22691 | choiceTransitionName: _propTypes2["default"].string,
|
22692 | open: _propTypes2["default"].bool,
|
22693 | defaultOpen: _propTypes2["default"].bool,
|
22694 | onChange: _propTypes2["default"].func,
|
22695 | onBlur: _propTypes2["default"].func,
|
22696 | onFocus: _propTypes2["default"].func,
|
22697 | onSelect: _propTypes2["default"].func,
|
22698 | onSearch: _propTypes2["default"].func,
|
22699 | onPopupScroll: _propTypes2["default"].func,
|
22700 | onMouseEnter: _propTypes2["default"].func,
|
22701 | onMouseLeave: _propTypes2["default"].func,
|
22702 | onInputKeyDown: _propTypes2["default"].func,
|
22703 | placeholder: _propTypes2["default"].any,
|
22704 | onDeselect: _propTypes2["default"].func,
|
22705 | labelInValue: _propTypes2["default"].bool,
|
22706 | value: valueType,
|
22707 | defaultValue: valueType,
|
22708 | dropdownStyle: _propTypes2["default"].object,
|
22709 | maxTagTextLength: _propTypes2["default"].number,
|
22710 | maxTagCount: _propTypes2["default"].number,
|
22711 | maxTagPlaceholder: _propTypes2["default"].oneOfType([_propTypes2["default"].node, _propTypes2["default"].func]),
|
22712 | tokenSeparators: _propTypes2["default"].arrayOf(_propTypes2["default"].string),
|
22713 | getInputElement: _propTypes2["default"].func,
|
22714 | showAction: _propTypes2["default"].arrayOf(_propTypes2["default"].string),
|
22715 | clearIcon: _propTypes2["default"].node,
|
22716 | inputIcon: _propTypes2["default"].node,
|
22717 | removeIcon: _propTypes2["default"].node,
|
22718 | menuItemSelectedIcon: _propTypes2["default"].oneOfType([_propTypes2["default"].func, _propTypes2["default"].node])
|
22719 | };
|
22720 |
|
22721 | }),
|
22722 |
|
22723 | (function(module, exports, __webpack_require__) {
|
22724 |
|
22725 | 'use strict';
|
22726 |
|
22727 | Object.defineProperty(exports, "__esModule", {
|
22728 | value: true
|
22729 | });
|
22730 |
|
22731 | var _react = __webpack_require__(4);
|
22732 |
|
22733 | var _react2 = _interopRequireDefault(_react);
|
22734 |
|
22735 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
22736 |
|
22737 | 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; }
|
22738 |
|
22739 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
22740 |
|
22741 | 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; }
|
22742 |
|
22743 | 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); }
|
22744 |
|
22745 | var OptGroup = function (_React$Component) {
|
22746 | _inherits(OptGroup, _React$Component);
|
22747 |
|
22748 | function OptGroup() {
|
22749 | _classCallCheck(this, OptGroup);
|
22750 |
|
22751 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
22752 | }
|
22753 |
|
22754 | return OptGroup;
|
22755 | }(_react2["default"].Component);
|
22756 |
|
22757 | OptGroup.isSelectOptGroup = true;
|
22758 | exports["default"] = OptGroup;
|
22759 | module.exports = exports['default'];
|
22760 |
|
22761 | }),
|
22762 |
|
22763 | (function(module, exports, __webpack_require__) {
|
22764 |
|
22765 | 'use strict';
|
22766 |
|
22767 | Object.defineProperty(exports, "__esModule", {
|
22768 | value: true
|
22769 | });
|
22770 |
|
22771 | var _Icon = __webpack_require__(242);
|
22772 |
|
22773 | var _Icon2 = _interopRequireDefault(_Icon);
|
22774 |
|
22775 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
22776 |
|
22777 | exports["default"] = _Icon2["default"];
|
22778 | module.exports = exports['default'];
|
22779 |
|
22780 | }),
|
22781 |
|
22782 | (function(module, exports, __webpack_require__) {
|
22783 |
|
22784 | 'use strict';
|
22785 |
|
22786 | Object.defineProperty(exports, "__esModule", {
|
22787 | value: true
|
22788 | });
|
22789 |
|
22790 | 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; };
|
22791 |
|
22792 | var _react = __webpack_require__(4);
|
22793 |
|
22794 | var _react2 = _interopRequireDefault(_react);
|
22795 |
|
22796 | var _classnames = __webpack_require__(3);
|
22797 |
|
22798 | var _classnames2 = _interopRequireDefault(_classnames);
|
22799 |
|
22800 | var _propTypes = __webpack_require__(5);
|
22801 |
|
22802 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
22803 |
|
22804 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
22805 |
|
22806 | 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; }
|
22807 |
|
22808 | 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; }
|
22809 |
|
22810 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
22811 |
|
22812 | 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; }
|
22813 |
|
22814 | 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); }
|
22815 |
|
22816 | var propTypes = {
|
22817 | type: _propTypes2["default"].string
|
22818 |
|
22819 | };
|
22820 | |
22821 |
|
22822 |
|
22823 | var defaultProps = {
|
22824 | clsPrefix: 'uf'
|
22825 | };
|
22826 |
|
22827 | var Icon = function (_Component) {
|
22828 | _inherits(Icon, _Component);
|
22829 |
|
22830 | function Icon(props) {
|
22831 | _classCallCheck(this, Icon);
|
22832 |
|
22833 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
22834 | }
|
22835 |
|
22836 | Icon.prototype.render = function render() {
|
22837 | var _props = this.props,
|
22838 | type = _props.type,
|
22839 | className = _props.className,
|
22840 | clsPrefix = _props.clsPrefix,
|
22841 | others = _objectWithoutProperties(_props, ['type', 'className', 'clsPrefix']);
|
22842 |
|
22843 | var clsObj = {};
|
22844 |
|
22845 | var classNames = (0, _classnames2["default"])(clsPrefix, type);
|
22846 |
|
22847 | return _react2["default"].createElement('i', _extends({}, others, { className: (0, _classnames2["default"])(classNames, className) }));
|
22848 | };
|
22849 |
|
22850 | return Icon;
|
22851 | }(_react.Component);
|
22852 |
|
22853 | Icon.defaultProps = defaultProps;
|
22854 | Icon.propTypes = propTypes;
|
22855 |
|
22856 | exports["default"] = Icon;
|
22857 | module.exports = exports['default'];
|
22858 |
|
22859 | }),
|
22860 |
|
22861 | (function(module, exports) {
|
22862 |
|
22863 | 'use strict';
|
22864 |
|
22865 | module.exports = {
|
22866 | 'lang': 'zh-cn',
|
22867 | 'total': '共',
|
22868 | 'items': '条',
|
22869 | 'show': '显示',
|
22870 | 'goto': '跳至',
|
22871 | 'page': '页',
|
22872 | 'ok': '确认',
|
22873 | 'en-us': {
|
22874 | 'total': 'total',
|
22875 | 'items': 'items',
|
22876 | 'show': 'page',
|
22877 | 'goto': 'goto',
|
22878 | 'ok': 'ok'
|
22879 | },
|
22880 | 'zh-tw': {
|
22881 | 'total': '共',
|
22882 | 'items': '條',
|
22883 | 'show': '顯示',
|
22884 | 'goto': '跳至',
|
22885 | 'ok': '確認'
|
22886 | }
|
22887 | };
|
22888 |
|
22889 | }),
|
22890 |
|
22891 | (function(module, exports) {
|
22892 |
|
22893 | 'use strict';
|
22894 |
|
22895 | Object.defineProperty(exports, "__esModule", {
|
22896 | value: true
|
22897 | });
|
22898 |
|
22899 | 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; };
|
22900 |
|
22901 | exports.getComponentLocale = getComponentLocale;
|
22902 | exports.getLocaleCode = getLocaleCode;
|
22903 | function getComponentLocale(props, context, componentName, getDefaultLocale) {
|
22904 | var locale = {};
|
22905 | if (context && context.beeLocale && context.beeLocale[componentName]) {
|
22906 | locale = context.beeLocale[componentName];
|
22907 | } else {
|
22908 | var defaultLocale = getDefaultLocale();
|
22909 |
|
22910 | locale = defaultLocale["default"] || defaultLocale;
|
22911 | }
|
22912 |
|
22913 | var result = _extends({}, locale, props.locale);
|
22914 | result.lang = _extends({}, locale.lang, props.locale.lang);
|
22915 | return result;
|
22916 | }
|
22917 |
|
22918 | function getLocaleCode(context) {
|
22919 | var localeCode = context.beeLocale && context.beeLocale.lang;
|
22920 |
|
22921 | if (context.beeLocale && context.beeLocale.exist && !localeCode) {
|
22922 | return 'zh-cn';
|
22923 | }
|
22924 | return localeCode;
|
22925 | }
|
22926 |
|
22927 | }),
|
22928 |
|
22929 | (function(module, exports, __webpack_require__) {
|
22930 |
|
22931 | 'use strict';
|
22932 |
|
22933 | Object.defineProperty(exports, "__esModule", {
|
22934 | value: true
|
22935 | });
|
22936 |
|
22937 | var _react = __webpack_require__(4);
|
22938 |
|
22939 | var _react2 = _interopRequireDefault(_react);
|
22940 |
|
22941 | var _src = __webpack_require__(85);
|
22942 |
|
22943 | var _src2 = _interopRequireDefault(_src);
|
22944 |
|
22945 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
22946 |
|
22947 | 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; }
|
22948 |
|
22949 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
22950 |
|
22951 | 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; }
|
22952 |
|
22953 | 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); } |
22954 |
|
22955 |
|
22956 |
|
22957 |
|
22958 | var Demo2 = function (_React$Component) {
|
22959 | _inherits(Demo2, _React$Component);
|
22960 |
|
22961 | function Demo2(props) {
|
22962 | _classCallCheck(this, Demo2);
|
22963 |
|
22964 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
22965 |
|
22966 | _this.state = {
|
22967 | activePage: 1
|
22968 | };
|
22969 | return _this;
|
22970 | }
|
22971 |
|
22972 | Demo2.prototype.handleSelect = function handleSelect(eventKey) {
|
22973 | this.setState({
|
22974 | activePage: eventKey
|
22975 | });
|
22976 | };
|
22977 |
|
22978 | Demo2.prototype.render = function render() {
|
22979 | return _react2['default'].createElement(
|
22980 | 'div',
|
22981 | null,
|
22982 | _react2['default'].createElement(_src2['default'], {
|
22983 | first: true,
|
22984 | last: true,
|
22985 | prev: true,
|
22986 | next: true,
|
22987 | boundaryLinks: true,
|
22988 | items: 11,
|
22989 | maxButtons: 5,
|
22990 | activePage: this.state.activePage,
|
22991 | onSelect: this.handleSelect.bind(this)
|
22992 | })
|
22993 | );
|
22994 | };
|
22995 |
|
22996 | return Demo2;
|
22997 | }(_react2['default'].Component);
|
22998 |
|
22999 | exports['default'] = Demo2;
|
23000 | module.exports = exports['default'];
|
23001 |
|
23002 | }),
|
23003 |
|
23004 | (function(module, exports, __webpack_require__) {
|
23005 |
|
23006 | "use strict";
|
23007 |
|
23008 | Object.defineProperty(exports, "__esModule", {
|
23009 | value: true
|
23010 | });
|
23011 |
|
23012 | var _react = __webpack_require__(4);
|
23013 |
|
23014 | var _react2 = _interopRequireDefault(_react);
|
23015 |
|
23016 | var _src = __webpack_require__(85);
|
23017 |
|
23018 | var _src2 = _interopRequireDefault(_src);
|
23019 |
|
23020 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
23021 |
|
23022 | 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; }
|
23023 |
|
23024 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
23025 |
|
23026 | 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; }
|
23027 |
|
23028 | 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); } |
23029 |
|
23030 |
|
23031 |
|
23032 |
|
23033 | var Demo3 = function (_React$Component) {
|
23034 | _inherits(Demo3, _React$Component);
|
23035 |
|
23036 | function Demo3(props) {
|
23037 | _classCallCheck(this, Demo3);
|
23038 |
|
23039 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
23040 |
|
23041 | _this.state = {
|
23042 | activePage: 1
|
23043 | };
|
23044 | return _this;
|
23045 | }
|
23046 |
|
23047 | Demo3.prototype.handleSelect = function handleSelect(eventKey) {
|
23048 | this.setState({
|
23049 | activePage: eventKey
|
23050 | });
|
23051 | };
|
23052 |
|
23053 | Demo3.prototype.render = function render() {
|
23054 | return _react2["default"].createElement(_src2["default"], {
|
23055 | prev: true,
|
23056 | next: true,
|
23057 | size: "sm",
|
23058 | gap: true,
|
23059 | items: 5,
|
23060 | maxButtons: 5,
|
23061 | activePage: this.state.activePage,
|
23062 | onSelect: this.handleSelect.bind(this)
|
23063 | });
|
23064 | };
|
23065 |
|
23066 | return Demo3;
|
23067 | }(_react2["default"].Component);
|
23068 |
|
23069 | exports["default"] = Demo3;
|
23070 | module.exports = exports["default"];
|
23071 |
|
23072 | }),
|
23073 |
|
23074 | (function(module, exports, __webpack_require__) {
|
23075 |
|
23076 | 'use strict';
|
23077 |
|
23078 | Object.defineProperty(exports, "__esModule", {
|
23079 | value: true
|
23080 | });
|
23081 |
|
23082 | var _react = __webpack_require__(4);
|
23083 |
|
23084 | var _react2 = _interopRequireDefault(_react);
|
23085 |
|
23086 | var _src = __webpack_require__(85);
|
23087 |
|
23088 | var _src2 = _interopRequireDefault(_src);
|
23089 |
|
23090 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23091 |
|
23092 | 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; }
|
23093 |
|
23094 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
23095 |
|
23096 | 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; }
|
23097 |
|
23098 | 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); } |
23099 |
|
23100 |
|
23101 |
|
23102 |
|
23103 | var Demo4 = function (_React$Component) {
|
23104 | _inherits(Demo4, _React$Component);
|
23105 |
|
23106 | function Demo4(props) {
|
23107 | _classCallCheck(this, Demo4);
|
23108 |
|
23109 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
23110 |
|
23111 | _this.dataNumSelect = function (index, value) {
|
23112 | console.log(index, value);
|
23113 | };
|
23114 |
|
23115 | _this.state = {
|
23116 | activePage: 1
|
23117 | };
|
23118 | return _this;
|
23119 | }
|
23120 |
|
23121 | Demo4.prototype.handleSelect = function handleSelect(eventKey) {
|
23122 | this.setState({
|
23123 | activePage: eventKey
|
23124 | });
|
23125 | };
|
23126 |
|
23127 | Demo4.prototype.render = function render() {
|
23128 | var local = {
|
23129 | 'lang': 'en',
|
23130 | 'total': 'Total',
|
23131 | 'items': 'Items',
|
23132 | 'show': 'page',
|
23133 | 'goto': 'goto',
|
23134 | 'page': '',
|
23135 | 'ok': 'ok'
|
23136 | };
|
23137 | return _react2['default'].createElement(
|
23138 | 'div',
|
23139 | null,
|
23140 | _react2['default'].createElement(_src2['default'], {
|
23141 | first: true,
|
23142 | last: true,
|
23143 | prev: true,
|
23144 | next: true,
|
23145 | maxButtons: 5,
|
23146 | boundaryLinks: true,
|
23147 | activePage: this.state.activePage,
|
23148 | onSelect: this.handleSelect.bind(this),
|
23149 | onDataNumSelect: this.dataNumSelect,
|
23150 | showJump: true,
|
23151 | total: 100,
|
23152 | dataNum: 2,
|
23153 | locale: local
|
23154 | })
|
23155 | );
|
23156 | };
|
23157 |
|
23158 | return Demo4;
|
23159 | }(_react2['default'].Component);
|
23160 |
|
23161 | exports['default'] = Demo4;
|
23162 | module.exports = exports['default'];
|
23163 |
|
23164 | }),
|
23165 |
|
23166 | (function(module, exports, __webpack_require__) {
|
23167 |
|
23168 | 'use strict';
|
23169 |
|
23170 | Object.defineProperty(exports, "__esModule", {
|
23171 | value: true
|
23172 | });
|
23173 |
|
23174 | var _react = __webpack_require__(4);
|
23175 |
|
23176 | var _react2 = _interopRequireDefault(_react);
|
23177 |
|
23178 | var _src = __webpack_require__(85);
|
23179 |
|
23180 | var _src2 = _interopRequireDefault(_src);
|
23181 |
|
23182 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23183 |
|
23184 | 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; }
|
23185 |
|
23186 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
23187 |
|
23188 | 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; }
|
23189 |
|
23190 | 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); } |
23191 |
|
23192 |
|
23193 |
|
23194 |
|
23195 | var Demo5 = function (_React$Component) {
|
23196 | _inherits(Demo5, _React$Component);
|
23197 |
|
23198 | function Demo5(props) {
|
23199 | _classCallCheck(this, Demo5);
|
23200 |
|
23201 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
23202 |
|
23203 | _this.dataNumSelect = function (index, value) {
|
23204 | console.log(index, value);
|
23205 | };
|
23206 |
|
23207 | _this.state = {
|
23208 | activePage: 1
|
23209 | };
|
23210 | return _this;
|
23211 | }
|
23212 |
|
23213 | Demo5.prototype.handleSelect = function handleSelect(eventKey) {
|
23214 | console.log(eventKey);
|
23215 | this.setState({
|
23216 | activePage: eventKey
|
23217 | });
|
23218 | };
|
23219 |
|
23220 | Demo5.prototype.render = function render() {
|
23221 | return _react2['default'].createElement(
|
23222 | 'div',
|
23223 | null,
|
23224 | _react2['default'].createElement(_src2['default'], {
|
23225 | first: true,
|
23226 | last: true,
|
23227 | prev: true,
|
23228 | next: true,
|
23229 | maxButtons: 5,
|
23230 | boundaryLinks: true,
|
23231 | activePage: this.state.activePage,
|
23232 | onSelect: this.handleSelect.bind(this),
|
23233 | onDataNumSelect: this.dataNumSelect,
|
23234 | showJump: true,
|
23235 | total: 100,
|
23236 | dataNum: 2,
|
23237 | disabled: true
|
23238 | })
|
23239 | );
|
23240 | };
|
23241 |
|
23242 | return Demo5;
|
23243 | }(_react2['default'].Component);
|
23244 |
|
23245 | exports['default'] = Demo5;
|
23246 | module.exports = exports['default'];
|
23247 |
|
23248 | }),
|
23249 |
|
23250 | (function(module, exports, __webpack_require__) {
|
23251 |
|
23252 | 'use strict';
|
23253 |
|
23254 | Object.defineProperty(exports, "__esModule", {
|
23255 | value: true
|
23256 | });
|
23257 |
|
23258 | var _react = __webpack_require__(4);
|
23259 |
|
23260 | var _react2 = _interopRequireDefault(_react);
|
23261 |
|
23262 | var _src = __webpack_require__(85);
|
23263 |
|
23264 | var _src2 = _interopRequireDefault(_src);
|
23265 |
|
23266 | var _beeButton = __webpack_require__(82);
|
23267 |
|
23268 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
23269 |
|
23270 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23271 |
|
23272 | 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; }
|
23273 |
|
23274 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
23275 |
|
23276 | 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; }
|
23277 |
|
23278 | 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); } |
23279 |
|
23280 |
|
23281 |
|
23282 |
|
23283 | var Demo6 = function (_React$Component) {
|
23284 | _inherits(Demo6, _React$Component);
|
23285 |
|
23286 | function Demo6(props) {
|
23287 | _classCallCheck(this, Demo6);
|
23288 |
|
23289 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
23290 |
|
23291 | _this.dataNumSelect = function (index, value) {
|
23292 | console.log(index, value);
|
23293 | };
|
23294 |
|
23295 | _this.renderConfirmBtn = function () {
|
23296 | return _react2['default'].createElement(
|
23297 | _beeButton2['default'],
|
23298 | {
|
23299 | colors: 'dark',
|
23300 | shape: 'border'
|
23301 | },
|
23302 | '\u786E\u8BA4'
|
23303 | );
|
23304 | };
|
23305 |
|
23306 | _this.state = {
|
23307 | activePage: 1
|
23308 | };
|
23309 | return _this;
|
23310 | }
|
23311 |
|
23312 | Demo6.prototype.handleSelect = function handleSelect(eventKey) {
|
23313 | console.log(eventKey);
|
23314 | this.setState({
|
23315 | activePage: eventKey
|
23316 | });
|
23317 | };
|
23318 |
|
23319 | Demo6.prototype.render = function render() {
|
23320 | return _react2['default'].createElement(
|
23321 | 'div',
|
23322 | null,
|
23323 | _react2['default'].createElement(_src2['default'], {
|
23324 | first: true,
|
23325 | last: true,
|
23326 | prev: true,
|
23327 | next: true,
|
23328 | maxButtons: 5,
|
23329 | boundaryLinks: true,
|
23330 | activePage: this.state.activePage,
|
23331 | onSelect: this.handleSelect.bind(this),
|
23332 | onDataNumSelect: this.dataNumSelect,
|
23333 | showJump: true,
|
23334 | total: 100,
|
23335 | dataNum: 2,
|
23336 | confirmBtn: this.renderConfirmBtn
|
23337 | })
|
23338 | );
|
23339 | };
|
23340 |
|
23341 | return Demo6;
|
23342 | }(_react2['default'].Component);
|
23343 |
|
23344 | exports['default'] = Demo6;
|
23345 | module.exports = exports['default'];
|
23346 |
|
23347 | }),
|
23348 |
|
23349 | (function(module, exports, __webpack_require__) {
|
23350 |
|
23351 | 'use strict';
|
23352 |
|
23353 | Object.defineProperty(exports, "__esModule", {
|
23354 | value: true
|
23355 | });
|
23356 |
|
23357 | var _react = __webpack_require__(4);
|
23358 |
|
23359 | var _react2 = _interopRequireDefault(_react);
|
23360 |
|
23361 | var _src = __webpack_require__(85);
|
23362 |
|
23363 | var _src2 = _interopRequireDefault(_src);
|
23364 |
|
23365 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23366 |
|
23367 | 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; }
|
23368 |
|
23369 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
23370 |
|
23371 | 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; }
|
23372 |
|
23373 | 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); } |
23374 |
|
23375 |
|
23376 |
|
23377 |
|
23378 | var Demo1 = function (_React$Component) {
|
23379 | _inherits(Demo1, _React$Component);
|
23380 |
|
23381 | function Demo1(props) {
|
23382 | _classCallCheck(this, Demo1);
|
23383 |
|
23384 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
23385 |
|
23386 | _this.dataNumSelect = function (index, value) {
|
23387 | console.log(index, value);
|
23388 | };
|
23389 |
|
23390 | _this.state = {
|
23391 | activePage: 1
|
23392 | };
|
23393 | return _this;
|
23394 | }
|
23395 |
|
23396 | Demo1.prototype.handleSelect = function handleSelect(eventKey) {
|
23397 | console.log(eventKey);
|
23398 | this.setState({
|
23399 | activePage: eventKey
|
23400 | });
|
23401 | };
|
23402 |
|
23403 | Demo1.prototype.render = function render() {
|
23404 | return _react2['default'].createElement(
|
23405 | 'div',
|
23406 | null,
|
23407 | _react2['default'].createElement(_src2['default'], {
|
23408 | first: true,
|
23409 | last: true,
|
23410 | prev: true,
|
23411 | next: true,
|
23412 | maxButtons: 5,
|
23413 | boundaryLinks: true,
|
23414 | activePage: this.state.activePage,
|
23415 | onSelect: this.handleSelect.bind(this),
|
23416 | onDataNumSelect: this.dataNumSelect,
|
23417 | showJump: true,
|
23418 | noBorder: false,
|
23419 | total: 100,
|
23420 | dataNum: 2
|
23421 | })
|
23422 | );
|
23423 | };
|
23424 |
|
23425 | return Demo1;
|
23426 | }(_react2['default'].Component);
|
23427 |
|
23428 | exports['default'] = Demo1;
|
23429 | module.exports = exports['default'];
|
23430 |
|
23431 | }),
|
23432 |
|
23433 | (function(module, exports, __webpack_require__) {
|
23434 |
|
23435 | 'use strict';
|
23436 |
|
23437 | Object.defineProperty(exports, "__esModule", {
|
23438 | value: true
|
23439 | });
|
23440 |
|
23441 | var _react = __webpack_require__(4);
|
23442 |
|
23443 | var _react2 = _interopRequireDefault(_react);
|
23444 |
|
23445 | var _src = __webpack_require__(85);
|
23446 |
|
23447 | var _src2 = _interopRequireDefault(_src);
|
23448 |
|
23449 | var _beeButton = __webpack_require__(82);
|
23450 |
|
23451 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
23452 |
|
23453 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23454 |
|
23455 | 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; }
|
23456 |
|
23457 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
23458 |
|
23459 | 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; }
|
23460 |
|
23461 | 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); } |
23462 |
|
23463 |
|
23464 |
|
23465 |
|
23466 | var Demo8 = function (_React$Component) {
|
23467 | _inherits(Demo8, _React$Component);
|
23468 |
|
23469 | function Demo8(props) {
|
23470 | _classCallCheck(this, Demo8);
|
23471 |
|
23472 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
23473 |
|
23474 | _this.dataNumSelect = function (index, value) {
|
23475 | console.log(index, value);
|
23476 | };
|
23477 |
|
23478 | _this.state = {
|
23479 | activePage: 1
|
23480 | };
|
23481 | return _this;
|
23482 | }
|
23483 |
|
23484 | Demo8.prototype.handleSelect = function handleSelect(eventKey) {
|
23485 | console.log(eventKey);
|
23486 | this.setState({
|
23487 | activePage: eventKey
|
23488 | });
|
23489 | };
|
23490 |
|
23491 | Demo8.prototype.render = function render() {
|
23492 | return _react2['default'].createElement(
|
23493 | 'div',
|
23494 | { className: 'demo8' },
|
23495 | _react2['default'].createElement(_src2['default'], {
|
23496 | className: 'demo8-pagination',
|
23497 | first: true,
|
23498 | last: true,
|
23499 | prev: true,
|
23500 | next: true,
|
23501 | maxButtons: 5,
|
23502 | boundaryLinks: true,
|
23503 | activePage: this.state.activePage,
|
23504 | onSelect: this.handleSelect.bind(this),
|
23505 | onDataNumSelect: this.dataNumSelect,
|
23506 | showJump: true,
|
23507 | total: 100,
|
23508 | dataNum: 2,
|
23509 | size: 'sm'
|
23510 | }),
|
23511 | _react2['default'].createElement(_src2['default'], {
|
23512 | className: 'demo8-pagination',
|
23513 | first: true,
|
23514 | last: true,
|
23515 | prev: true,
|
23516 | next: true,
|
23517 | maxButtons: 5,
|
23518 | boundaryLinks: true,
|
23519 | activePage: this.state.activePage,
|
23520 | onSelect: this.handleSelect.bind(this),
|
23521 | onDataNumSelect: this.dataNumSelect,
|
23522 | showJump: true,
|
23523 | total: 100,
|
23524 | dataNum: 2
|
23525 | }),
|
23526 | _react2['default'].createElement(_src2['default'], {
|
23527 | className: 'demo8-pagination',
|
23528 | first: true,
|
23529 | last: true,
|
23530 | prev: true,
|
23531 | next: true,
|
23532 | maxButtons: 5,
|
23533 | boundaryLinks: true,
|
23534 | activePage: this.state.activePage,
|
23535 | onSelect: this.handleSelect.bind(this),
|
23536 | onDataNumSelect: this.dataNumSelect,
|
23537 | showJump: true,
|
23538 | total: 100,
|
23539 | dataNum: 2,
|
23540 | size: 'lg'
|
23541 | })
|
23542 | );
|
23543 | };
|
23544 |
|
23545 | return Demo8;
|
23546 | }(_react2['default'].Component);
|
23547 |
|
23548 | exports['default'] = Demo8;
|
23549 | module.exports = exports['default'];
|
23550 |
|
23551 | })
|
23552 | ]);
|
23553 |
|
\ | No newline at end of file |