1 | (function(modules) {
|
2 |
|
3 | var installedModules = {};
|
4 |
|
5 |
|
6 | function __webpack_require__(moduleId) {
|
7 |
|
8 |
|
9 | if(installedModules[moduleId])
|
10 | return installedModules[moduleId].exports;
|
11 |
|
12 |
|
13 | var module = installedModules[moduleId] = {
|
14 | exports: {},
|
15 | id: moduleId,
|
16 | loaded: false
|
17 | };
|
18 |
|
19 |
|
20 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21 |
|
22 |
|
23 | module.loaded = true;
|
24 |
|
25 |
|
26 | return module.exports;
|
27 | }
|
28 |
|
29 |
|
30 |
|
31 | __webpack_require__.m = modules;
|
32 |
|
33 |
|
34 | __webpack_require__.c = installedModules;
|
35 |
|
36 |
|
37 | __webpack_require__.p = "";
|
38 |
|
39 |
|
40 | return __webpack_require__(0);
|
41 | })
|
42 |
|
43 | ([
|
44 |
|
45 | (function(module, exports, __webpack_require__) {
|
46 |
|
47 | 'use strict';
|
48 |
|
49 | var _react = __webpack_require__(1);
|
50 |
|
51 | var _react2 = _interopRequireDefault(_react);
|
52 |
|
53 | var _reactDom = __webpack_require__(2);
|
54 |
|
55 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
56 |
|
57 | var _beeLayout = __webpack_require__(3);
|
58 |
|
59 | var _beePanel = __webpack_require__(9);
|
60 |
|
61 | var _beeDrawer = __webpack_require__(84);
|
62 |
|
63 | var _beeDrawer2 = _interopRequireDefault(_beeDrawer);
|
64 |
|
65 | var _beeClipboard = __webpack_require__(98);
|
66 |
|
67 | var _beeClipboard2 = _interopRequireDefault(_beeClipboard);
|
68 |
|
69 | var _src = __webpack_require__(157);
|
70 |
|
71 | var _src2 = _interopRequireDefault(_src);
|
72 |
|
73 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
74 |
|
75 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
76 |
|
77 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
78 |
|
79 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
80 |
|
81 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
82 |
|
83 | var Demo1 = __webpack_require__(162);var Demo2 = __webpack_require__(163);var Demo3 = __webpack_require__(164);var Demo4 = __webpack_require__(165);var Demo5 = __webpack_require__(166);var Demo6 = __webpack_require__(336);var Demo7 = __webpack_require__(337);var DemoArray = [{ "example": _react2['default'].createElement(Demo1, null), "title": " 基本用法", "code": "/**\r\n * @title 基本用法\r\n * @description `checked` 参数设置是否选中,`disabled`设置是否可用,`onDoubleClick`定义双击事件。\r\n */\r\n\r\n\r\nimport React, {Component} from 'react';\nimport { Checkbox } from 'tinper-bee';\r\n\r\n\r\nclass Demo1 extends Component {\r\n constructor(props) {\r\n super(props);\r\n this.state = {\r\n checkedFlag: true\r\n }\r\n this.onChange = this.onChange.bind(this);\r\n }\r\n\r\n onChange(e) {\r\n console.log(e);\r\n this.setState({checkedFlag: e});\r\n }\r\n\r\n handleDblClick = (state) => {\r\n\t\tconsole.log(state);\r\n }\r\n\r\n render() {\r\n return (\r\n <div className=\"demo-checkbox\">\r\n <Checkbox\r\n disabled\r\n className=\"test\" >\r\n </Checkbox>\r\n <Checkbox\r\n disabled\r\n checked={true}\r\n className=\"test\" >\r\n </Checkbox>\r\n <Checkbox\r\n // onDoubleClick={ this.handleDblClick }\r\n ref=\"test\"\r\n checked={this.state.checkedFlag}\r\n onChange={this.onChange}>\r\n Checkbox\r\n </Checkbox>\r\n </div>\r\n )\r\n }\r\n}\r\n\r\nexport default Demo1;", "desc": " `checked` 参数设置是否选中,`disabled`设置是否可用,`onDoubleClick`定义双击事件。", "scss_code": "" }, { "example": _react2['default'].createElement(Demo2, null), "title": " 不同颜色的 Checkbox", "code": "/**\r\n * @title 不同颜色的 Checkbox\r\n * @description `colors`参数控制背景色\r\n */\r\n\r\nimport React, { Component } from 'react';\nimport { Checkbox } from 'tinper-bee';\r\n\r\n\r\nclass Demo2 extends Component {\r\n\trender(){\r\n\t\treturn (\r\n\t\t\t<div className=\"demo-checkbox\">\r\n\t\t\t\t<Checkbox colors=\"primary\">primary</Checkbox>\r\n\t\t\t\t<Checkbox colors=\"success\">success</Checkbox>\r\n\t\t\t\t<Checkbox colors=\"info\">info</Checkbox>\r\n\t\t\t\t<Checkbox colors=\"danger\">danger</Checkbox>\r\n\t\t\t\t<Checkbox colors=\"warning\">warning</Checkbox>\r\n\t\t\t\t<Checkbox colors=\"dark\">dark</Checkbox>\r\n\t\t\t</div>\r\n\t\t)\r\n\t}\r\n}\r\nexport default Demo2;\r\n", "desc": " `colors`参数控制背景色", "scss_code": "" }, { "example": _react2['default'].createElement(Demo3, null), "title": " 受控的 Checkbox", "code": "/**\r\n * @title 受控的 Checkbox\r\n * @description `checked` 参数设置是否选中,`disabled`设置是否可用。\r\n */\r\n\r\nimport React, { Component } from 'react';\nimport { Button, Checkbox } from 'tinper-bee';\r\n\r\n\n\r\nclass Demo3 extends Component {\r\n\tconstructor(props) {\r\n\t\tsuper(props);\r\n\t\tthis.state = {\r\n\t\t\tchecked: false,\r\n\t\t\tdisabled: false\r\n\t\t}\r\n\t}\r\n\tchangeCheck=()=> {\r\n\t\tthis.setState({checked:!this.state.checked});\r\n\t}\r\n\tchangeDisabled=()=> {\r\n\t\tthis.setState({disabled:!this.state.disabled});\r\n\t}\r\n\trender () {\r\n\t\tconst label = `${this.state.checked ? 'Checked' : 'Unchecked'}-${this.state.disabled ? 'Disabled' : 'Enabled'}`;\r\n\t\treturn (\r\n\t\t\t<div className=\"demo-checkbox\">\r\n\t\t\t\t<p>\r\n\t\t\t\t\t<Button \r\n\t\t\t\t\t\tcolors=\"secondary\" \r\n\t\t\t\t\t\tonClick={this.changeCheck.bind(this)}\r\n\t\t\t\t\t\tstyle={{marginRight:\"8px\"}}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t{!this.state.checked ? 'Check' : 'Uncheck'}\r\n\t\t\t\t\t</Button>\r\n\t\t\t\t\t<Button \r\n\t\t\t\t\t\tcolors=\"secondary\" \r\n\t\t\t\t\t\tonClick={this.changeDisabled.bind(this)}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t{!this.state.disabled ? 'Disable' : 'Enable'}\r\n\t\t\t\t\t</Button>\r\n\t\t\t\t</p>\t\r\n\t\t\t\t<p>\r\n\t\t\t\t\t<Checkbox \r\n\t\t\t\t\t\tchecked={this.state.checked} \r\n\t\t\t\t\t\tdisabled={this.state.disabled} \r\n\t\t\t\t\t\tonChange={this.changeCheck}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t{label }\r\n\t\t\t\t\t</Checkbox>\r\n\t\t\t\t</p>\r\n\t\t\t</div>\r\n\t\t)\r\n\t}\r\n}\r\nexport default Demo3;", "desc": " `checked` 参数设置是否选中,`disabled`设置是否可用。", "scss_code": "" }, { "example": _react2['default'].createElement(Demo4, null), "title": " CheckboxGroup基本使用", "code": "/**\r\n * @title CheckboxGroup基本使用\r\n * @description 方便的从数组生成 Checkbox 组。\r\n */\r\n\r\nimport React, { Component } from 'react';\nimport { Checkbox } from 'tinper-bee';\r\n\r\nconst CheckboxGroup = Checkbox.CheckboxGroup;\r\n\r\nconst plainOptions = ['Apple', 'Pear', 'Orange'];\r\nconst options = [\r\n { label: 'Apple', value: 'Apple' },\r\n { label: 'Pear', value: 'Pear' },\r\n { label: 'Orange', value: 'Orange' },\r\n];\r\nconst optionsWithDisabled = [\r\n { label: 'Apple', value: 'Apple' },\r\n { label: 'Pear', value: 'Pear' },\r\n { label: 'Orange', value: 'Orange', disabled: false },\r\n];\r\n\r\nclass Demo4 extends Component {\r\n\tconstructor(props) {\r\n\t\tsuper(props);\r\n\t}\r\n\tonChange(checkedValues) {\r\n\t\tconsole.log('checked = ', checkedValues);\r\n\t}\r\n\trender () {\r\n\t\treturn (\r\n\t\t\t<div className=\"demo-checkbox\">\r\n\t\t\t\t<CheckboxGroup options={plainOptions} defaultValue={['Apple']} onChange={this.onChange} />\r\n\t\t\r\n\t\t\t\t<CheckboxGroup options={options} defaultValue={['Pear']} onChange={this.onChange} />\r\n\t\t\t\r\n\t\t\t\t<CheckboxGroup\r\n\t\t\t\toptions={optionsWithDisabled}\r\n\t\t\t\tdisabled\r\n\t\t\t\tdefaultValue={['Apple']}\r\n\t\t\t\tonChange={this.onChange}\r\n\t\t\t\t/>\r\n\t\t\t</div>\r\n\t\t)\r\n\t}\r\n}\r\nexport default Demo4;", "desc": " 方便的从数组生成 Checkbox 组。" }, { "example": _react2['default'].createElement(Demo5, null), "title": " CheckboxGroup在form中使用", "code": "/**\n * @title CheckboxGroup在form中使用\n * @description `value` 参数设置默认值,`onChange`设置值改变的回调。\n */\n\nimport React, { Component } from 'react';\nimport { Button, Form, Checkbox } from 'tinper-bee';\n\n\n\nconst CheckboxGroup = Checkbox.CheckboxGroup;\n\nclass Demo4 extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tvalue:['3','4']\n\t\t}\n\t}\n\tchange=(value)=>{\n\t\tthis.setState({\n\t\t\tvalue\n\t\t})\n\t}\n\tclick=()=>{\n\t\tthis.props.form.validateFields((error,values)=>{\n\t\t\tconsole.log(values)\n\t\t})\n\t}\n\trender () {\n\t\tconst self = this;\n\t\tconst { getFieldProps, getFieldError } = this.props.form;\n\t\treturn (\n\t\t\t<div className=\"demo-checkbox\">\n\t\t\t\t<CheckboxGroup \n\t\t\t\t\t{\n\t\t\t\t\t\t...getFieldProps('name',{\n\t\t\t\t\t\t\tinitialValue:['2','3'],\n\t\t\t\t\t\t\tonChange:self.change\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Checkbox value='1'>\n\t\t\t\t\t\t1\n\t\t\t\t\t</Checkbox>\n\t\t\t\t\t<Checkbox value='2'>\n\t\t\t\t\t\t2\n\t\t\t\t\t</Checkbox>\n\t\t\t\t\t<Checkbox value='3'>\n\t\t\t\t\t\t3\n\t\t\t\t\t</Checkbox>\n\t\t\t\t\t<Checkbox value='4'>\n\t\t\t\t\t\t4\n\t\t\t\t\t</Checkbox>\n\t\t\t\t\t<Checkbox value='5'>\n\t\t\t\t\t\t5\n\t\t\t\t\t</Checkbox>\n\t\t\t\t</CheckboxGroup>\n\t\t\t\t<Button colors=\"secondary\" onClick={this.click}>submit</Button>\n\t\t\t</div>\n\t\t)\n\t}\n}\nexport default Form.createForm()(Demo4);", "desc": " `value` 参数设置默认值,`onChange`设置值改变的回调。" }, { "example": _react2['default'].createElement(Demo6, null), "title": " 全选", "code": "/**\r\n * @title 全选\r\n * @description `indeterminate` 参数设置部分选中状态。\r\n */\r\n\r\n\r\nimport React, {Component} from 'react';\nimport { Checkbox } from 'tinper-bee';\r\n\r\n\r\nconst CheckboxGroup = Checkbox.CheckboxGroup;\r\n\r\nconst plainOptions = ['1','2','3','4','5'];\r\nconst defaultCheckedList = ['2','3'];\r\n\r\nclass Demo7 extends Component {\r\n constructor(props) {\r\n super(props);\r\n this.state = {\r\n checkedList: defaultCheckedList,\r\n indeterminate: true,\r\n checkAll: false\r\n }\r\n this.onChange = this.onChange.bind(this);\r\n }\r\n\r\n onCheckAllChange = (e) => {\r\n console.log(e);\r\n this.setState({\r\n checkedList: e ? plainOptions : [],\r\n indeterminate: false,\r\n checkAll: e,\r\n });\r\n }\r\n\r\n onChange(checkedList) {\r\n console.log(checkedList)\r\n this.setState({\r\n checkedList: checkedList,\r\n indeterminate: !!checkedList.length && (checkedList.length < plainOptions.length),\r\n checkAll: checkedList.length === plainOptions.length\r\n });\r\n }\r\n\r\n render() {\r\n return (\r\n <div className=\"demo-checkbox\">\r\n <Checkbox\r\n ref=\"test\"\r\n indeterminate={this.state.indeterminate}\r\n onChange={this.onCheckAllChange}\r\n checked={this.state.checkAll}>\r\n 全选\r\n </Checkbox>\r\n <br/>\r\n <CheckboxGroup value={this.state.checkedList} onChange={this.onChange}>\r\n <Checkbox value='1'>1</Checkbox>\r\n <Checkbox value='2'>2</Checkbox>\r\n <Checkbox value='3'>3</Checkbox>\r\n <Checkbox value='4'>4</Checkbox>\r\n <Checkbox value='5'>5</Checkbox>\r\n </CheckboxGroup>\r\n </div>\r\n )\r\n }\r\n}\r\n\r\nexport default Demo7;", "desc": " `indeterminate` 参数设置部分选中状态。" }, { "example": _react2['default'].createElement(Demo7, null), "title": " 红色填充的 Checkbox", "code": "/**\r\n * @title 红色填充的 Checkbox\r\n * @description `inverse` 参数设置选中为红色填充。\r\n */\r\n\r\n\r\nimport React, {Component} from 'react';\nimport { Checkbox } from 'tinper-bee';\r\n\r\n\r\nclass Demo7 extends Component {\r\n constructor(props) {\r\n super(props);\r\n this.state = {\r\n checkedFlag: false\r\n }\r\n this.onChange = this.onChange.bind(this);\r\n }\r\n\r\n onChange(e) {\r\n console.log(e);\r\n this.setState({checkedFlag: e});\r\n }\r\n\r\n render() {\r\n return (\r\n <div className=\"demo-checkbox\">\r\n <Checkbox\r\n disabled\r\n inverse\r\n checked={true}>\r\n 禁用\r\n </Checkbox>\r\n <Checkbox\r\n inverse\r\n checked={this.state.checkedFlag}\r\n onChange={this.onChange}>\r\n 全选\r\n </Checkbox>\r\n <Checkbox\r\n inverse\r\n indeterminate>\r\n 半选\r\n </Checkbox>\r\n </div>\r\n )\r\n }\r\n}\r\n\r\nexport default Demo7;", "desc": " `inverse` 参数设置选中为红色填充。" }];
|
84 |
|
85 | var Demo = function (_Component) {
|
86 | _inherits(Demo, _Component);
|
87 |
|
88 | function Demo(props) {
|
89 | _classCallCheck(this, Demo);
|
90 |
|
91 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
92 |
|
93 | _this.handleClick = function () {
|
94 | _this.setState({ open: !_this.state.open });
|
95 | };
|
96 |
|
97 | _this.fCloseDrawer = function () {
|
98 | _this.setState({
|
99 | open: false
|
100 | });
|
101 | };
|
102 |
|
103 | _this.state = {
|
104 | open: false
|
105 | };
|
106 | return _this;
|
107 | }
|
108 |
|
109 | Demo.prototype.render = function render() {
|
110 | var _props = this.props,
|
111 | title = _props.title,
|
112 | example = _props.example,
|
113 | code = _props.code,
|
114 | desc = _props.desc,
|
115 | scss_code = _props.scss_code;
|
116 |
|
117 |
|
118 | var header = _react2['default'].createElement(
|
119 | 'div',
|
120 | null,
|
121 | _react2['default'].createElement(
|
122 | 'p',
|
123 | { className: 'component-title' },
|
124 | title
|
125 | ),
|
126 | _react2['default'].createElement(
|
127 | 'p',
|
128 | null,
|
129 | desc
|
130 | ),
|
131 | _react2['default'].createElement(
|
132 | 'span',
|
133 | { className: 'component-code', onClick: this.handleClick },
|
134 | ' \u67E5\u770B\u6E90\u7801 ',
|
135 | _react2['default'].createElement('i', { className: 'uf uf-arrow-right' }),
|
136 | ' '
|
137 | )
|
138 | );
|
139 | return _react2['default'].createElement(
|
140 | _beeLayout.Col,
|
141 | { md: 12, id: title.trim(), className: 'component-demo' },
|
142 | _react2['default'].createElement(
|
143 | _beePanel.Panel,
|
144 | { header: header },
|
145 | example
|
146 | ),
|
147 | _react2['default'].createElement(
|
148 | _beeDrawer2['default'],
|
149 | { className: 'component-drawerc', title: title, show: this.state.open, placement: 'right', onClose: this.fCloseDrawer },
|
150 | _react2['default'].createElement(
|
151 | 'div',
|
152 | { className: 'component-code-copy' },
|
153 | ' JS\u4EE3\u7801',
|
154 | _react2['default'].createElement(_beeClipboard2['default'], { action: 'copy', text: code })
|
155 | ),
|
156 | _react2['default'].createElement(
|
157 | 'pre',
|
158 | { className: 'pre-js' },
|
159 | _react2['default'].createElement(
|
160 | 'code',
|
161 | { className: 'hljs javascript' },
|
162 | code
|
163 | )
|
164 | ),
|
165 | !!scss_code ? _react2['default'].createElement(
|
166 | 'div',
|
167 | { className: 'component-code-copy copy-css' },
|
168 | ' SCSS\u4EE3\u7801',
|
169 | _react2['default'].createElement(_beeClipboard2['default'], { action: 'copy', text: scss_code })
|
170 | ) : null,
|
171 | !!scss_code ? _react2['default'].createElement(
|
172 | 'pre',
|
173 | { className: 'pre-css' },
|
174 | _react2['default'].createElement(
|
175 | 'code',
|
176 | { className: 'hljs css' },
|
177 | scss_code
|
178 | )
|
179 | ) : null
|
180 | )
|
181 | );
|
182 | };
|
183 |
|
184 | return Demo;
|
185 | }(_react.Component);
|
186 |
|
187 | var DemoGroup = function (_Component2) {
|
188 | _inherits(DemoGroup, _Component2);
|
189 |
|
190 | function DemoGroup(props) {
|
191 | _classCallCheck(this, DemoGroup);
|
192 |
|
193 | return _possibleConstructorReturn(this, _Component2.call(this, props));
|
194 | }
|
195 |
|
196 | DemoGroup.prototype.render = function render() {
|
197 | return _react2['default'].createElement(
|
198 | _beeLayout.Row,
|
199 | null,
|
200 | DemoArray.map(function (child, index) {
|
201 |
|
202 | return _react2['default'].createElement(Demo, { example: child.example, title: child.title, code: child.code, scss_code: child.scss_code, desc: child.desc, key: index });
|
203 | })
|
204 | );
|
205 | };
|
206 |
|
207 | return DemoGroup;
|
208 | }(_react.Component);
|
209 |
|
210 | _reactDom2['default'].render(_react2['default'].createElement(DemoGroup, null), document.getElementById('tinperBeeDemo'));
|
211 |
|
212 | }),
|
213 |
|
214 | (function(module, exports) {
|
215 |
|
216 | module.exports = React;
|
217 |
|
218 | }),
|
219 |
|
220 | (function(module, exports) {
|
221 |
|
222 | module.exports = ReactDOM;
|
223 |
|
224 | }),
|
225 |
|
226 | (function(module, exports, __webpack_require__) {
|
227 |
|
228 | 'use strict';
|
229 |
|
230 | Object.defineProperty(exports, "__esModule", {
|
231 | value: true
|
232 | });
|
233 | exports.Con = exports.Row = exports.Col = undefined;
|
234 |
|
235 | var _Col2 = __webpack_require__(4);
|
236 |
|
237 | var _Col3 = _interopRequireDefault(_Col2);
|
238 |
|
239 | var _Row2 = __webpack_require__(7);
|
240 |
|
241 | var _Row3 = _interopRequireDefault(_Row2);
|
242 |
|
243 | var _Layout = __webpack_require__(8);
|
244 |
|
245 | var _Layout2 = _interopRequireDefault(_Layout);
|
246 |
|
247 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
248 |
|
249 | exports.Col = _Col3["default"];
|
250 | exports.Row = _Row3["default"];
|
251 | exports.Con = _Layout2["default"];
|
252 |
|
253 | }),
|
254 |
|
255 | (function(module, exports, __webpack_require__) {
|
256 |
|
257 | 'use strict';
|
258 |
|
259 | Object.defineProperty(exports, "__esModule", {
|
260 | value: true
|
261 | });
|
262 |
|
263 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
264 |
|
265 | var _classnames = __webpack_require__(5);
|
266 |
|
267 | var _classnames2 = _interopRequireDefault(_classnames);
|
268 |
|
269 | var _react = __webpack_require__(1);
|
270 |
|
271 | var _react2 = _interopRequireDefault(_react);
|
272 |
|
273 | var _propTypes = __webpack_require__(6);
|
274 |
|
275 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
276 |
|
277 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
278 |
|
279 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
280 |
|
281 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
282 |
|
283 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
284 |
|
285 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
286 |
|
287 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
288 |
|
289 | var propTypes = {
|
290 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]),
|
291 |
|
292 | |
293 |
|
294 |
|
295 | xs: _propTypes2["default"].number,
|
296 | |
297 |
|
298 |
|
299 | sm: _propTypes2["default"].number,
|
300 | |
301 |
|
302 |
|
303 | md: _propTypes2["default"].number,
|
304 | |
305 |
|
306 |
|
307 | lg: _propTypes2["default"].number,
|
308 | |
309 |
|
310 |
|
311 | xsOffset: _propTypes2["default"].number,
|
312 | |
313 |
|
314 |
|
315 | smOffset: _propTypes2["default"].number,
|
316 | |
317 |
|
318 |
|
319 | mdOffset: _propTypes2["default"].number,
|
320 | |
321 |
|
322 |
|
323 | lgOffset: _propTypes2["default"].number,
|
324 | |
325 |
|
326 |
|
327 | xsPush: _propTypes2["default"].number,
|
328 | |
329 |
|
330 |
|
331 | smPush: _propTypes2["default"].number,
|
332 | |
333 |
|
334 |
|
335 | mdPush: _propTypes2["default"].number,
|
336 | |
337 |
|
338 |
|
339 | lgPush: _propTypes2["default"].number,
|
340 | |
341 |
|
342 |
|
343 | xsPull: _propTypes2["default"].number,
|
344 | |
345 |
|
346 |
|
347 | smPull: _propTypes2["default"].number,
|
348 | |
349 |
|
350 |
|
351 | mdPull: _propTypes2["default"].number,
|
352 | |
353 |
|
354 |
|
355 | lgPull: _propTypes2["default"].number
|
356 | };
|
357 |
|
358 | var defaultProps = {
|
359 | componentClass: 'div',
|
360 | clsPrefix: 'u-col'
|
361 | };
|
362 |
|
363 | var DEVICE_SIZES = ['lg', 'md', 'sm', 'xs'];
|
364 |
|
365 | var Col = function (_Component) {
|
366 | _inherits(Col, _Component);
|
367 |
|
368 | function Col() {
|
369 | _classCallCheck(this, Col);
|
370 |
|
371 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
372 | }
|
373 |
|
374 | Col.prototype.render = function render() {
|
375 | var _props = this.props,
|
376 | Component = _props.componentClass,
|
377 | className = _props.className,
|
378 | clsPrefix = _props.clsPrefix,
|
379 | others = _objectWithoutProperties(_props, ['componentClass', 'className', 'clsPrefix']);
|
380 |
|
381 | var tbClass = [];
|
382 | |
383 |
|
384 |
|
385 |
|
386 | DEVICE_SIZES.forEach(function (size) {
|
387 | function popProp(propSuffix, modifier) {
|
388 | var propName = '' + size + propSuffix;
|
389 | var propValue = others[propName];
|
390 |
|
391 | if (propValue != undefined && propValue != null) {
|
392 | tbClass.push(clsPrefix + '-' + size + modifier + '-' + propValue);
|
393 | }
|
394 |
|
395 | delete others[propName];
|
396 | }
|
397 |
|
398 | popProp('', '');
|
399 | popProp('Offset', '-offset');
|
400 | popProp('Push', '-push');
|
401 | popProp('Pull', '-pull');
|
402 | });
|
403 |
|
404 | return _react2["default"].createElement(
|
405 | Component,
|
406 | _extends({
|
407 | className: (0, _classnames2["default"])(tbClass, className)
|
408 | }, others),
|
409 | this.props.children
|
410 | );
|
411 | };
|
412 |
|
413 | return Col;
|
414 | }(_react.Component);
|
415 |
|
416 | Col.defaultProps = defaultProps;
|
417 | Col.propTypes = propTypes;
|
418 |
|
419 | exports["default"] = Col;
|
420 | module.exports = exports['default'];
|
421 |
|
422 | }),
|
423 |
|
424 | (function(module, exports, __webpack_require__) {
|
425 |
|
426 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; |
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 | (function () {
|
434 | 'use strict';
|
435 |
|
436 | var hasOwn = {}.hasOwnProperty;
|
437 |
|
438 | function classNames () {
|
439 | var classes = [];
|
440 |
|
441 | for (var i = 0; i < arguments.length; i++) {
|
442 | var arg = arguments[i];
|
443 | if (!arg) continue;
|
444 |
|
445 | var argType = typeof arg;
|
446 |
|
447 | if (argType === 'string' || argType === 'number') {
|
448 | classes.push(arg);
|
449 | } else if (Array.isArray(arg) && arg.length) {
|
450 | var inner = classNames.apply(null, arg);
|
451 | if (inner) {
|
452 | classes.push(inner);
|
453 | }
|
454 | } else if (argType === 'object') {
|
455 | for (var key in arg) {
|
456 | if (hasOwn.call(arg, key) && arg[key]) {
|
457 | classes.push(key);
|
458 | }
|
459 | }
|
460 | }
|
461 | }
|
462 |
|
463 | return classes.join(' ');
|
464 | }
|
465 |
|
466 | if (typeof module !== 'undefined' && module.exports) {
|
467 | classNames.default = classNames;
|
468 | module.exports = classNames;
|
469 | } else if (true) {
|
470 |
|
471 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
|
472 | return classNames;
|
473 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
474 | } else {
|
475 | window.classNames = classNames;
|
476 | }
|
477 | }());
|
478 |
|
479 |
|
480 | }),
|
481 |
|
482 | (function(module, exports) {
|
483 |
|
484 | module.exports = PropTypes;
|
485 |
|
486 | }),
|
487 |
|
488 | (function(module, exports, __webpack_require__) {
|
489 |
|
490 | 'use strict';
|
491 |
|
492 | Object.defineProperty(exports, "__esModule", {
|
493 | value: true
|
494 | });
|
495 |
|
496 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
497 |
|
498 | var _classnames = __webpack_require__(5);
|
499 |
|
500 | var _classnames2 = _interopRequireDefault(_classnames);
|
501 |
|
502 | var _react = __webpack_require__(1);
|
503 |
|
504 | var _react2 = _interopRequireDefault(_react);
|
505 |
|
506 | var _propTypes = __webpack_require__(6);
|
507 |
|
508 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
509 |
|
510 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
511 |
|
512 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
513 |
|
514 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
515 |
|
516 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
517 |
|
518 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
519 |
|
520 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
521 |
|
522 | var propTypes = {
|
523 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string])
|
524 | };
|
525 |
|
526 | var defaultProps = {
|
527 | componentClass: 'div',
|
528 | clsPrefix: 'u-row'
|
529 | };
|
530 |
|
531 | var Row = function (_Component) {
|
532 | _inherits(Row, _Component);
|
533 |
|
534 | function Row() {
|
535 | _classCallCheck(this, Row);
|
536 |
|
537 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
538 | }
|
539 |
|
540 | Row.prototype.render = function render() {
|
541 | var _props = this.props,
|
542 | Component = _props.componentClass,
|
543 | clsPrefix = _props.clsPrefix,
|
544 | className = _props.className,
|
545 | others = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
|
546 |
|
547 | var bsclass = '' + clsPrefix;
|
548 |
|
549 | return _react2["default"].createElement(
|
550 | Component,
|
551 | _extends({}, others, {
|
552 | className: (0, _classnames2["default"])(bsclass, className)
|
553 | }),
|
554 | this.props.children
|
555 | );
|
556 | };
|
557 |
|
558 | return Row;
|
559 | }(_react.Component);
|
560 |
|
561 | Row.propTypes = propTypes;
|
562 | Row.defaultProps = defaultProps;
|
563 |
|
564 | exports["default"] = Row;
|
565 | module.exports = exports['default'];
|
566 |
|
567 | }),
|
568 |
|
569 | (function(module, exports, __webpack_require__) {
|
570 |
|
571 | 'use strict';
|
572 |
|
573 | Object.defineProperty(exports, "__esModule", {
|
574 | value: true
|
575 | });
|
576 |
|
577 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
578 |
|
579 | var _classnames = __webpack_require__(5);
|
580 |
|
581 | var _classnames2 = _interopRequireDefault(_classnames);
|
582 |
|
583 | var _react = __webpack_require__(1);
|
584 |
|
585 | var _react2 = _interopRequireDefault(_react);
|
586 |
|
587 | var _propTypes = __webpack_require__(6);
|
588 |
|
589 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
590 |
|
591 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
592 |
|
593 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
594 |
|
595 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
596 |
|
597 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
598 |
|
599 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
600 |
|
601 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
602 |
|
603 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
604 |
|
605 | var propTypes = {
|
606 | |
607 |
|
608 |
|
609 | fluid: _propTypes2["default"].bool,
|
610 | |
611 |
|
612 |
|
613 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string])
|
614 | };
|
615 |
|
616 | var defaultProps = {
|
617 | componentClass: 'div',
|
618 | fluid: false,
|
619 | clsPrefix: 'u-container'
|
620 | };
|
621 |
|
622 | var Con = function (_React$Component) {
|
623 | _inherits(Con, _React$Component);
|
624 |
|
625 | function Con() {
|
626 | _classCallCheck(this, Con);
|
627 |
|
628 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
629 | }
|
630 |
|
631 | Con.prototype.render = function render() {
|
632 | var _tbclass;
|
633 |
|
634 | var _props = this.props,
|
635 | fluid = _props.fluid,
|
636 | Component = _props.componentClass,
|
637 | clsPrefix = _props.clsPrefix,
|
638 | className = _props.className,
|
639 | others = _objectWithoutProperties(_props, ['fluid', 'componentClass', 'clsPrefix', 'className']);
|
640 |
|
641 | var tbclass = (_tbclass = {}, _defineProperty(_tbclass, '' + clsPrefix, !fluid), _defineProperty(_tbclass, clsPrefix + '-fluid', fluid), _tbclass);
|
642 |
|
643 | return _react2["default"].createElement(
|
644 | Component,
|
645 | _extends({}, others, {
|
646 | className: (0, _classnames2["default"])(tbclass, className)
|
647 | }),
|
648 | this.props.children
|
649 | );
|
650 | };
|
651 |
|
652 | return Con;
|
653 | }(_react2["default"].Component);
|
654 |
|
655 | Con.propTypes = propTypes;
|
656 | Con.defaultProps = defaultProps;
|
657 |
|
658 | exports["default"] = Con;
|
659 | module.exports = exports['default'];
|
660 |
|
661 | }),
|
662 |
|
663 | (function(module, exports, __webpack_require__) {
|
664 |
|
665 | 'use strict';
|
666 |
|
667 | Object.defineProperty(exports, "__esModule", {
|
668 | value: true
|
669 | });
|
670 | exports.PanelGroup = exports.Panel = undefined;
|
671 |
|
672 | var _Panel2 = __webpack_require__(10);
|
673 |
|
674 | var _Panel3 = _interopRequireDefault(_Panel2);
|
675 |
|
676 | var _PanelGroup2 = __webpack_require__(83);
|
677 |
|
678 | var _PanelGroup3 = _interopRequireDefault(_PanelGroup2);
|
679 |
|
680 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
681 |
|
682 | exports.Panel = _Panel3["default"];
|
683 | exports.PanelGroup = _PanelGroup3["default"];
|
684 |
|
685 | }),
|
686 |
|
687 | (function(module, exports, __webpack_require__) {
|
688 |
|
689 | 'use strict';
|
690 |
|
691 | Object.defineProperty(exports, "__esModule", {
|
692 | value: true
|
693 | });
|
694 |
|
695 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
696 |
|
697 | var _classnames = __webpack_require__(5);
|
698 |
|
699 | var _classnames2 = _interopRequireDefault(_classnames);
|
700 |
|
701 | var _react = __webpack_require__(1);
|
702 |
|
703 | var _react2 = _interopRequireDefault(_react);
|
704 |
|
705 | var _beeTransition = __webpack_require__(11);
|
706 |
|
707 | var _beeMessage = __webpack_require__(65);
|
708 |
|
709 | var _beeMessage2 = _interopRequireDefault(_beeMessage);
|
710 |
|
711 | var _propTypes = __webpack_require__(6);
|
712 |
|
713 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
714 |
|
715 | var _copyToClipboard = __webpack_require__(81);
|
716 |
|
717 | var _copyToClipboard2 = _interopRequireDefault(_copyToClipboard);
|
718 |
|
719 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
720 |
|
721 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
722 |
|
723 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
724 |
|
725 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
726 |
|
727 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
728 |
|
729 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
730 |
|
731 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
732 |
|
733 | var propTypes = {
|
734 |
|
735 | collapsible: _propTypes2["default"].bool,
|
736 | onSelect: _propTypes2["default"].func,
|
737 |
|
738 | header: _propTypes2["default"].node,
|
739 | headerStyle: _propTypes2["default"].object,
|
740 | id: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
741 | headerContent: _propTypes2["default"].bool,
|
742 |
|
743 | footer: _propTypes2["default"].node,
|
744 | footerStyle: _propTypes2["default"].object,
|
745 |
|
746 | defaultExpanded: _propTypes2["default"].bool,
|
747 |
|
748 | expanded: _propTypes2["default"].bool,
|
749 |
|
750 | eventKey: _propTypes2["default"].any,
|
751 | headerRole: _propTypes2["default"].string,
|
752 | panelRole: _propTypes2["default"].string,
|
753 |
|
754 | colors: _propTypes2["default"].oneOf(['primary', 'accent', 'success', 'info', 'warning', 'danger', 'default', 'bordered']),
|
755 |
|
756 |
|
757 | onEnter: _propTypes2["default"].func,
|
758 | onEntering: _propTypes2["default"].func,
|
759 | onEntered: _propTypes2["default"].func,
|
760 | onExit: _propTypes2["default"].func,
|
761 | onExiting: _propTypes2["default"].func,
|
762 | onExited: _propTypes2["default"].func,
|
763 |
|
764 | copyable: _propTypes2["default"].bool
|
765 | };
|
766 |
|
767 | var defaultProps = {
|
768 | defaultExpanded: false,
|
769 | clsPrefix: "u-panel",
|
770 | colors: "default"
|
771 | };
|
772 |
|
773 | var Panel = function (_React$Component) {
|
774 | _inherits(Panel, _React$Component);
|
775 |
|
776 | function Panel(props, context) {
|
777 | _classCallCheck(this, Panel);
|
778 |
|
779 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
780 |
|
781 | _this.handleClickTitle = _this.handleClickTitle.bind(_this);
|
782 |
|
783 | _this.state = {
|
784 | expanded: _this.props.defaultExpanded
|
785 | };
|
786 | return _this;
|
787 | }
|
788 |
|
789 |
|
790 |
|
791 |
|
792 | Panel.prototype.handleClickTitle = function handleClickTitle(e) {
|
793 |
|
794 | e.persist();
|
795 | e.selected = true;
|
796 |
|
797 | if (this.props.onSelect) {
|
798 | this.props.onSelect(this.props.eventKey, e);
|
799 | } else {
|
800 | e.preventDefault();
|
801 | }
|
802 |
|
803 | if (e.selected) {
|
804 | this.setState({ expanded: !this.state.expanded });
|
805 | }
|
806 | };
|
807 |
|
808 |
|
809 |
|
810 |
|
811 | Panel.prototype.renderHeader = function renderHeader(collapsible, header, id, role, expanded, clsPrefix) {
|
812 | var titleClassName = clsPrefix + '-title';
|
813 |
|
814 | if (!collapsible) {
|
815 | if (!_react2["default"].isValidElement(header)) {
|
816 | return header;
|
817 | }
|
818 |
|
819 | return (0, _react.cloneElement)(header, {
|
820 | className: (0, _classnames2["default"])(header.props.className, titleClassName)
|
821 | });
|
822 | }
|
823 |
|
824 | if (!_react2["default"].isValidElement(header)) {
|
825 | return _react2["default"].createElement(
|
826 | 'h4',
|
827 | { role: 'presentation', className: titleClassName },
|
828 | this.renderAnchor(header, id, role, expanded)
|
829 | );
|
830 | }
|
831 | if (this.props.headerContent) {
|
832 | return (0, _react.cloneElement)(header, {
|
833 | className: (0, _classnames2["default"])(header.props.className, titleClassName)
|
834 | });
|
835 | }
|
836 |
|
837 | return (0, _react.cloneElement)(header, {
|
838 | className: (0, _classnames2["default"])(header.props.className, titleClassName),
|
839 | children: this.renderAnchor(header.props.children, id, role, expanded)
|
840 | });
|
841 | };
|
842 |
|
843 |
|
844 |
|
845 |
|
846 | Panel.prototype.renderAnchor = function renderAnchor(header, id, role, expanded) {
|
847 | return _react2["default"].createElement(
|
848 | 'a',
|
849 | {
|
850 | role: role,
|
851 | href: id && '#' + id,
|
852 | 'aria-controls': id,
|
853 | 'aria-expanded': expanded,
|
854 | 'aria-selected': expanded,
|
855 | className: expanded ? null : 'collapsed'
|
856 | },
|
857 | header
|
858 | );
|
859 | };
|
860 |
|
861 |
|
862 |
|
863 |
|
864 | Panel.prototype.copyDemo = function copyDemo(e) {
|
865 | var panelTarget = e.target.parentNode;
|
866 | var clipBoardContent = panelTarget.firstChild.innerText;
|
867 | (0, _copyToClipboard2["default"])(clipBoardContent);
|
868 | _beeMessage2["default"].create({ content: '复制成功!', color: 'success', duration: 2 });
|
869 | };
|
870 |
|
871 |
|
872 |
|
873 |
|
874 | Panel.prototype.renderCollapsibleBody = function renderCollapsibleBody(id, expanded, role, children, clsPrefix, copyable, animationHooks) {
|
875 | return _react2["default"].createElement(
|
876 | _beeTransition.Collapse,
|
877 | _extends({ 'in': expanded }, animationHooks),
|
878 | _react2["default"].createElement(
|
879 | 'div',
|
880 | {
|
881 | id: id,
|
882 | role: role,
|
883 | className: clsPrefix + '-collapse',
|
884 | 'aria-hidden': !expanded
|
885 | },
|
886 | this.renderBody(children, clsPrefix, copyable)
|
887 | )
|
888 | );
|
889 | };
|
890 |
|
891 |
|
892 |
|
893 |
|
894 | Panel.prototype.renderBody = function renderBody(rawChildren, clsPrefix, copyable) {
|
895 | var self = this;
|
896 | var children = [];
|
897 | var bodyChildren = [];
|
898 |
|
899 | var bodyClassName = clsPrefix + '-body';
|
900 |
|
901 | function maybeAddBody(self) {
|
902 | if (!bodyChildren.length) {
|
903 | return;
|
904 | }
|
905 |
|
906 | children.push(_react2["default"].createElement(
|
907 | 'div',
|
908 | { key: children.length, className: bodyClassName },
|
909 | bodyChildren,
|
910 | copyable && _react2["default"].createElement('i', { className: clsPrefix + '-copy uf uf-files-o', onClick: self.copyDemo })
|
911 | ));
|
912 | bodyChildren = [];
|
913 | }
|
914 |
|
915 |
|
916 | _react2["default"].Children.toArray(rawChildren).forEach(function (child) {
|
917 | if (_react2["default"].isValidElement(child) && child.props.fill) {
|
918 | maybeAddBody(self);
|
919 |
|
920 |
|
921 | children.push((0, _react.cloneElement)(child, { fill: undefined }));
|
922 |
|
923 | return;
|
924 | }
|
925 | bodyChildren.push(child);
|
926 | });
|
927 |
|
928 | maybeAddBody(self);
|
929 |
|
930 | return children;
|
931 | };
|
932 |
|
933 | Panel.prototype.render = function render() {
|
934 | var _props = this.props,
|
935 | collapsible = _props.collapsible,
|
936 | header = _props.header,
|
937 | id = _props.id,
|
938 | footer = _props.footer,
|
939 | propsExpanded = _props.expanded,
|
940 | footerStyle = _props.footerStyle,
|
941 | headerStyle = _props.headerStyle,
|
942 | headerRole = _props.headerRole,
|
943 | panelRole = _props.panelRole,
|
944 | className = _props.className,
|
945 | colors = _props.colors,
|
946 | children = _props.children,
|
947 | onEnter = _props.onEnter,
|
948 | onEntering = _props.onEntering,
|
949 | onEntered = _props.onEntered,
|
950 | clsPrefix = _props.clsPrefix,
|
951 | onExit = _props.onExit,
|
952 | headerContent = _props.headerContent,
|
953 | onExiting = _props.onExiting,
|
954 | onExited = _props.onExited,
|
955 | defaultExpanded = _props.defaultExpanded,
|
956 | eventKey = _props.eventKey,
|
957 | onSelect = _props.onSelect,
|
958 | copyable = _props.copyable,
|
959 | props = _objectWithoutProperties(_props, ['collapsible', 'header', 'id', 'footer', 'expanded', 'footerStyle', 'headerStyle', 'headerRole', 'panelRole', 'className', 'colors', 'children', 'onEnter', 'onEntering', 'onEntered', 'clsPrefix', 'onExit', 'headerContent', 'onExiting', 'onExited', 'defaultExpanded', 'eventKey', 'onSelect', 'copyable']);
|
960 |
|
961 | var expanded = propsExpanded != null ? propsExpanded : this.state.expanded;
|
962 |
|
963 | var classes = {};
|
964 | classes['' + clsPrefix] = true;
|
965 | classes[clsPrefix + '-' + colors] = true;
|
966 |
|
967 | var headerClass = _defineProperty({}, clsPrefix + '-heading', true);
|
968 |
|
969 | copyable === false ? false : true;
|
970 | return _react2["default"].createElement(
|
971 | 'div',
|
972 | _extends({}, props, {
|
973 | className: (0, _classnames2["default"])(className, classes),
|
974 | id: collapsible ? null : id
|
975 | }),
|
976 | header && _react2["default"].createElement(
|
977 | 'div',
|
978 | { className: (0, _classnames2["default"])(headerClass), style: headerStyle, onClick: this.handleClickTitle },
|
979 | this.renderHeader(collapsible, header, id, headerRole, expanded, clsPrefix)
|
980 | ),
|
981 | collapsible ? this.renderCollapsibleBody(id, expanded, panelRole, children, clsPrefix, copyable, { onEnter: onEnter, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited }) : this.renderBody(children, clsPrefix, copyable),
|
982 | footer && _react2["default"].createElement(
|
983 | 'div',
|
984 | { className: clsPrefix + '-footer', style: footerStyle },
|
985 | footer
|
986 | )
|
987 | );
|
988 | };
|
989 |
|
990 | return Panel;
|
991 | }(_react2["default"].Component);
|
992 |
|
993 | Panel.propTypes = propTypes;
|
994 | Panel.defaultProps = defaultProps;
|
995 |
|
996 | exports["default"] = Panel;
|
997 | module.exports = exports['default'];
|
998 |
|
999 | }),
|
1000 |
|
1001 | (function(module, exports, __webpack_require__) {
|
1002 |
|
1003 | 'use strict';
|
1004 |
|
1005 | Object.defineProperty(exports, "__esModule", {
|
1006 | value: true
|
1007 | });
|
1008 | exports.Fade = exports.Collapse = exports.Transition = undefined;
|
1009 |
|
1010 | var _Transition2 = __webpack_require__(12);
|
1011 |
|
1012 | var _Transition3 = _interopRequireDefault(_Transition2);
|
1013 |
|
1014 | var _Collapse2 = __webpack_require__(17);
|
1015 |
|
1016 | var _Collapse3 = _interopRequireDefault(_Collapse2);
|
1017 |
|
1018 | var _Fade2 = __webpack_require__(64);
|
1019 |
|
1020 | var _Fade3 = _interopRequireDefault(_Fade2);
|
1021 |
|
1022 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1023 |
|
1024 | exports.Transition = _Transition3["default"];
|
1025 | exports.Collapse = _Collapse3["default"];
|
1026 | exports.Fade = _Fade3["default"];
|
1027 |
|
1028 | }),
|
1029 |
|
1030 | (function(module, exports, __webpack_require__) {
|
1031 |
|
1032 | 'use strict';
|
1033 |
|
1034 | Object.defineProperty(exports, "__esModule", {
|
1035 | value: true
|
1036 | });
|
1037 | exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined;
|
1038 |
|
1039 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
1040 |
|
1041 | var _react = __webpack_require__(1);
|
1042 |
|
1043 | var _react2 = _interopRequireDefault(_react);
|
1044 |
|
1045 | var _reactDom = __webpack_require__(2);
|
1046 |
|
1047 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
1048 |
|
1049 | var _properties = __webpack_require__(13);
|
1050 |
|
1051 | var _properties2 = _interopRequireDefault(_properties);
|
1052 |
|
1053 | var _on = __webpack_require__(16);
|
1054 |
|
1055 | var _on2 = _interopRequireDefault(_on);
|
1056 |
|
1057 | var _classnames = __webpack_require__(5);
|
1058 |
|
1059 | var _classnames2 = _interopRequireDefault(_classnames);
|
1060 |
|
1061 | var _propTypes = __webpack_require__(6);
|
1062 |
|
1063 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
1064 |
|
1065 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1066 |
|
1067 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
1068 |
|
1069 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
1070 |
|
1071 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1072 |
|
1073 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
1074 |
|
1075 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
1076 |
|
1077 | var transitionEndEvent = _properties2["default"].end;
|
1078 |
|
1079 |
|
1080 | var UNMOUNTED = exports.UNMOUNTED = 0;
|
1081 | var EXITED = exports.EXITED = 1;
|
1082 | var ENTERING = exports.ENTERING = 2;
|
1083 | var ENTERED = exports.ENTERED = 3;
|
1084 | var EXITING = exports.EXITING = 4;
|
1085 |
|
1086 | var propTypes = {
|
1087 | |
1088 |
|
1089 |
|
1090 | "in": _propTypes2["default"].bool,
|
1091 |
|
1092 | |
1093 |
|
1094 |
|
1095 | unmountOnExit: _propTypes2["default"].bool,
|
1096 |
|
1097 | |
1098 |
|
1099 |
|
1100 | transitionAppear: _propTypes2["default"].bool,
|
1101 |
|
1102 | |
1103 |
|
1104 |
|
1105 | timeout: _propTypes2["default"].number,
|
1106 |
|
1107 | |
1108 |
|
1109 |
|
1110 | exitedClassName: _propTypes2["default"].string,
|
1111 | |
1112 |
|
1113 |
|
1114 | exitingClassName: _propTypes2["default"].string,
|
1115 | |
1116 |
|
1117 |
|
1118 | enteredClassName: _propTypes2["default"].string,
|
1119 | |
1120 |
|
1121 |
|
1122 | enteringClassName: _propTypes2["default"].string,
|
1123 |
|
1124 | |
1125 |
|
1126 |
|
1127 | onEnter: _propTypes2["default"].func,
|
1128 | |
1129 |
|
1130 |
|
1131 | onEntering: _propTypes2["default"].func,
|
1132 | |
1133 |
|
1134 |
|
1135 | onEntered: _propTypes2["default"].func,
|
1136 | |
1137 |
|
1138 |
|
1139 | onExit: _propTypes2["default"].func,
|
1140 | |
1141 |
|
1142 |
|
1143 | onExiting: _propTypes2["default"].func,
|
1144 | |
1145 |
|
1146 |
|
1147 | onExited: _propTypes2["default"].func
|
1148 | };
|
1149 |
|
1150 | function noop() {}
|
1151 |
|
1152 | var defaultProps = {
|
1153 | "in": false,
|
1154 | unmountOnExit: false,
|
1155 | transitionAppear: false,
|
1156 | timeout: 5000,
|
1157 | onEnter: noop,
|
1158 | onEntering: noop,
|
1159 | onEntered: noop,
|
1160 | onExit: noop,
|
1161 | onExiting: noop,
|
1162 | onExited: noop
|
1163 | };
|
1164 |
|
1165 | |
1166 |
|
1167 |
|
1168 |
|
1169 | var Transition = function (_Component) {
|
1170 | _inherits(Transition, _Component);
|
1171 |
|
1172 | function Transition(props, context) {
|
1173 | _classCallCheck(this, Transition);
|
1174 |
|
1175 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
1176 |
|
1177 | var initialStatus = void 0;
|
1178 | if (props["in"]) {
|
1179 |
|
1180 | initialStatus = props.transitionAppear ? EXITED : ENTERED;
|
1181 | } else {
|
1182 | initialStatus = props.unmountOnExit ? UNMOUNTED : EXITED;
|
1183 | }
|
1184 | _this.state = { status: initialStatus };
|
1185 |
|
1186 | _this.nextCallback = null;
|
1187 | return _this;
|
1188 | }
|
1189 |
|
1190 | Transition.prototype.componentDidMount = function componentDidMount() {
|
1191 | if (this.props.transitionAppear && this.props["in"]) {
|
1192 | this.performEnter(this.props);
|
1193 | }
|
1194 | };
|
1195 |
|
1196 | Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
1197 | if (nextProps["in"] && this.props.unmountOnExit) {
|
1198 | if (this.state.status === UNMOUNTED) {
|
1199 |
|
1200 | this.setState({ status: EXITED });
|
1201 | }
|
1202 | } else {
|
1203 | this._needsUpdate = true;
|
1204 | }
|
1205 | };
|
1206 |
|
1207 | Transition.prototype.componentDidUpdate = function componentDidUpdate() {
|
1208 | var status = this.state.status;
|
1209 |
|
1210 | if (this.props.unmountOnExit && status === EXITED) {
|
1211 |
|
1212 | if (this.props["in"]) {
|
1213 | this.performEnter(this.props);
|
1214 | } else {
|
1215 | this.setState({ status: UNMOUNTED });
|
1216 | }
|
1217 |
|
1218 | return;
|
1219 | }
|
1220 |
|
1221 |
|
1222 | if (this._needsUpdate) {
|
1223 | this._needsUpdate = false;
|
1224 |
|
1225 | if (this.props["in"]) {
|
1226 | if (status === EXITING) {
|
1227 | this.performEnter(this.props);
|
1228 | } else if (status === EXITED) {
|
1229 | this.performEnter(this.props);
|
1230 | }
|
1231 |
|
1232 | } else {
|
1233 | if (status === ENTERING || status === ENTERED) {
|
1234 | this.performExit(this.props);
|
1235 | }
|
1236 |
|
1237 | }
|
1238 | }
|
1239 | };
|
1240 |
|
1241 | Transition.prototype.componentWillUnmount = function componentWillUnmount() {
|
1242 | this.cancelNextCallback();
|
1243 | };
|
1244 |
|
1245 | Transition.prototype.performEnter = function performEnter(props) {
|
1246 | var _this2 = this;
|
1247 |
|
1248 | this.cancelNextCallback();
|
1249 | var node = _reactDom2["default"].findDOMNode(this);
|
1250 |
|
1251 |
|
1252 | props.onEnter(node);
|
1253 |
|
1254 | this.safeSetState({ status: ENTERING }, function () {
|
1255 | _this2.props.onEntering(node);
|
1256 |
|
1257 | _this2.onTransitionEnd(node, function () {
|
1258 | _this2.safeSetState({ status: ENTERED }, function () {
|
1259 | _this2.props.onEntered(node);
|
1260 | });
|
1261 | });
|
1262 | });
|
1263 | };
|
1264 |
|
1265 | Transition.prototype.performExit = function performExit(props) {
|
1266 | var _this3 = this;
|
1267 |
|
1268 | this.cancelNextCallback();
|
1269 | var node = _reactDom2["default"].findDOMNode(this);
|
1270 |
|
1271 | props.onExit(node);
|
1272 |
|
1273 | this.safeSetState({ status: EXITING }, function () {
|
1274 | _this3.props.onExiting(node);
|
1275 |
|
1276 | _this3.onTransitionEnd(node, function () {
|
1277 | _this3.safeSetState({ status: EXITED }, function () {
|
1278 | _this3.props.onExited(node);
|
1279 | });
|
1280 | });
|
1281 | });
|
1282 | };
|
1283 |
|
1284 | Transition.prototype.cancelNextCallback = function cancelNextCallback() {
|
1285 | if (this.nextCallback !== null) {
|
1286 | this.nextCallback.cancel();
|
1287 | this.nextCallback = null;
|
1288 | }
|
1289 | };
|
1290 |
|
1291 | Transition.prototype.safeSetState = function safeSetState(nextState, callback) {
|
1292 |
|
1293 | this.setState(nextState, this.setNextCallback(callback));
|
1294 | };
|
1295 |
|
1296 | Transition.prototype.setNextCallback = function setNextCallback(callback) {
|
1297 | var _this4 = this;
|
1298 |
|
1299 | var active = true;
|
1300 |
|
1301 | this.nextCallback = function (event) {
|
1302 | if (active) {
|
1303 | active = false;
|
1304 | _this4.nextCallback = null;
|
1305 |
|
1306 | callback(event);
|
1307 | }
|
1308 | };
|
1309 |
|
1310 | this.nextCallback.cancel = function () {
|
1311 | active = false;
|
1312 | };
|
1313 |
|
1314 | return this.nextCallback;
|
1315 | };
|
1316 |
|
1317 | Transition.prototype.onTransitionEnd = function onTransitionEnd(node, handler) {
|
1318 | this.setNextCallback(handler);
|
1319 |
|
1320 | if (node) {
|
1321 | if (transitionEndEvent == undefined) {
|
1322 | this.nextCallback();
|
1323 | } else {
|
1324 | (0, _on2["default"])(node, transitionEndEvent, this.nextCallback);
|
1325 | }
|
1326 | setTimeout(this.nextCallback, this.props.timeout);
|
1327 | } else {
|
1328 | setTimeout(this.nextCallback, 0);
|
1329 | }
|
1330 | };
|
1331 |
|
1332 | Transition.prototype.render = function render() {
|
1333 | var status = this.state.status;
|
1334 | if (status === UNMOUNTED) {
|
1335 | return null;
|
1336 | }
|
1337 |
|
1338 | var _props = this.props,
|
1339 | children = _props.children,
|
1340 | className = _props.className,
|
1341 | childProps = _objectWithoutProperties(_props, ['children', 'className']);
|
1342 |
|
1343 | Object.keys(Transition.propTypes).forEach(function (key) {
|
1344 | return delete childProps[key];
|
1345 | });
|
1346 |
|
1347 | var transitionClassName = void 0;
|
1348 | if (status === EXITED) {
|
1349 | transitionClassName = this.props.exitedClassName;
|
1350 | } else if (status === ENTERING) {
|
1351 | transitionClassName = this.props.enteringClassName;
|
1352 | } else if (status === ENTERED) {
|
1353 | transitionClassName = this.props.enteredClassName;
|
1354 | } else if (status === EXITING) {
|
1355 | transitionClassName = this.props.exitingClassName;
|
1356 | }
|
1357 |
|
1358 | var child = _react2["default"].Children.only(children);
|
1359 | return _react2["default"].cloneElement(child, _extends({}, childProps, {
|
1360 | className: (0, _classnames2["default"])(child.props.className, className, transitionClassName)
|
1361 | }));
|
1362 | };
|
1363 |
|
1364 | return Transition;
|
1365 | }(_react.Component);
|
1366 |
|
1367 | Transition.propTypes = propTypes;
|
1368 |
|
1369 | Transition.defaultProps = defaultProps;
|
1370 |
|
1371 | exports["default"] = Transition;
|
1372 |
|
1373 | }),
|
1374 |
|
1375 | (function(module, exports, __webpack_require__) {
|
1376 |
|
1377 | "use strict";
|
1378 |
|
1379 | var _interopRequireDefault = __webpack_require__(14);
|
1380 |
|
1381 | exports.__esModule = true;
|
1382 | exports.default = exports.animationEnd = exports.animationDelay = exports.animationTiming = exports.animationDuration = exports.animationName = exports.transitionEnd = exports.transitionDuration = exports.transitionDelay = exports.transitionTiming = exports.transitionProperty = exports.transform = void 0;
|
1383 |
|
1384 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
1385 |
|
1386 | var transform = 'transform';
|
1387 | exports.transform = transform;
|
1388 | var prefix, transitionEnd, animationEnd;
|
1389 | exports.animationEnd = animationEnd;
|
1390 | exports.transitionEnd = transitionEnd;
|
1391 | var transitionProperty, transitionDuration, transitionTiming, transitionDelay;
|
1392 | exports.transitionDelay = transitionDelay;
|
1393 | exports.transitionTiming = transitionTiming;
|
1394 | exports.transitionDuration = transitionDuration;
|
1395 | exports.transitionProperty = transitionProperty;
|
1396 | var animationName, animationDuration, animationTiming, animationDelay;
|
1397 | exports.animationDelay = animationDelay;
|
1398 | exports.animationTiming = animationTiming;
|
1399 | exports.animationDuration = animationDuration;
|
1400 | exports.animationName = animationName;
|
1401 |
|
1402 | if (_inDOM.default) {
|
1403 | var _getTransitionPropert = getTransitionProperties();
|
1404 |
|
1405 | prefix = _getTransitionPropert.prefix;
|
1406 | exports.transitionEnd = transitionEnd = _getTransitionPropert.transitionEnd;
|
1407 | exports.animationEnd = animationEnd = _getTransitionPropert.animationEnd;
|
1408 | exports.transform = transform = prefix + "-" + transform;
|
1409 | exports.transitionProperty = transitionProperty = prefix + "-transition-property";
|
1410 | exports.transitionDuration = transitionDuration = prefix + "-transition-duration";
|
1411 | exports.transitionDelay = transitionDelay = prefix + "-transition-delay";
|
1412 | exports.transitionTiming = transitionTiming = prefix + "-transition-timing-function";
|
1413 | exports.animationName = animationName = prefix + "-animation-name";
|
1414 | exports.animationDuration = animationDuration = prefix + "-animation-duration";
|
1415 | exports.animationTiming = animationTiming = prefix + "-animation-delay";
|
1416 | exports.animationDelay = animationDelay = prefix + "-animation-timing-function";
|
1417 | }
|
1418 |
|
1419 | var _default = {
|
1420 | transform: transform,
|
1421 | end: transitionEnd,
|
1422 | property: transitionProperty,
|
1423 | timing: transitionTiming,
|
1424 | delay: transitionDelay,
|
1425 | duration: transitionDuration
|
1426 | };
|
1427 | exports.default = _default;
|
1428 |
|
1429 | function getTransitionProperties() {
|
1430 | var style = document.createElement('div').style;
|
1431 | var vendorMap = {
|
1432 | O: function O(e) {
|
1433 | return "o" + e.toLowerCase();
|
1434 | },
|
1435 | Moz: function Moz(e) {
|
1436 | return e.toLowerCase();
|
1437 | },
|
1438 | Webkit: function Webkit(e) {
|
1439 | return "webkit" + e;
|
1440 | },
|
1441 | ms: function ms(e) {
|
1442 | return "MS" + e;
|
1443 | }
|
1444 | };
|
1445 | var vendors = Object.keys(vendorMap);
|
1446 | var transitionEnd, animationEnd;
|
1447 | var prefix = '';
|
1448 |
|
1449 | for (var i = 0; i < vendors.length; i++) {
|
1450 | var vendor = vendors[i];
|
1451 |
|
1452 | if (vendor + "TransitionProperty" in style) {
|
1453 | prefix = "-" + vendor.toLowerCase();
|
1454 | transitionEnd = vendorMap[vendor]('TransitionEnd');
|
1455 | animationEnd = vendorMap[vendor]('AnimationEnd');
|
1456 | break;
|
1457 | }
|
1458 | }
|
1459 |
|
1460 | if (!transitionEnd && 'transitionProperty' in style) transitionEnd = 'transitionend';
|
1461 | if (!animationEnd && 'animationName' in style) animationEnd = 'animationend';
|
1462 | style = null;
|
1463 | return {
|
1464 | animationEnd: animationEnd,
|
1465 | transitionEnd: transitionEnd,
|
1466 | prefix: prefix
|
1467 | };
|
1468 | }
|
1469 |
|
1470 | }),
|
1471 |
|
1472 | (function(module, exports) {
|
1473 |
|
1474 | function _interopRequireDefault(obj) {
|
1475 | return obj && obj.__esModule ? obj : {
|
1476 | "default": obj
|
1477 | };
|
1478 | }
|
1479 |
|
1480 | module.exports = _interopRequireDefault;
|
1481 |
|
1482 | }),
|
1483 |
|
1484 | (function(module, exports) {
|
1485 |
|
1486 | "use strict";
|
1487 |
|
1488 | exports.__esModule = true;
|
1489 | exports.default = void 0;
|
1490 |
|
1491 | var _default = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
1492 |
|
1493 | exports.default = _default;
|
1494 | module.exports = exports["default"];
|
1495 |
|
1496 | }),
|
1497 |
|
1498 | (function(module, exports, __webpack_require__) {
|
1499 |
|
1500 | "use strict";
|
1501 |
|
1502 | var _interopRequireDefault = __webpack_require__(14);
|
1503 |
|
1504 | exports.__esModule = true;
|
1505 | exports.default = void 0;
|
1506 |
|
1507 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
1508 |
|
1509 | var on = function on() {};
|
1510 |
|
1511 | if (_inDOM.default) {
|
1512 | on = function () {
|
1513 | if (document.addEventListener) return function (node, eventName, handler, capture) {
|
1514 | return node.addEventListener(eventName, handler, capture || false);
|
1515 | };else if (document.attachEvent) return function (node, eventName, handler) {
|
1516 | return node.attachEvent('on' + eventName, function (e) {
|
1517 | e = e || window.event;
|
1518 | e.target = e.target || e.srcElement;
|
1519 | e.currentTarget = node;
|
1520 | handler.call(node, e);
|
1521 | });
|
1522 | };
|
1523 | }();
|
1524 | }
|
1525 |
|
1526 | var _default = on;
|
1527 | exports.default = _default;
|
1528 | module.exports = exports["default"];
|
1529 |
|
1530 | }),
|
1531 |
|
1532 | (function(module, exports, __webpack_require__) {
|
1533 |
|
1534 | 'use strict';
|
1535 |
|
1536 | Object.defineProperty(exports, "__esModule", {
|
1537 | value: true
|
1538 | });
|
1539 |
|
1540 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
1541 |
|
1542 | var _classnames = __webpack_require__(5);
|
1543 |
|
1544 | var _classnames2 = _interopRequireDefault(_classnames);
|
1545 |
|
1546 | var _style = __webpack_require__(18);
|
1547 |
|
1548 | var _style2 = _interopRequireDefault(_style);
|
1549 |
|
1550 | var _react = __webpack_require__(1);
|
1551 |
|
1552 | var _react2 = _interopRequireDefault(_react);
|
1553 |
|
1554 | var _propTypes = __webpack_require__(6);
|
1555 |
|
1556 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
1557 |
|
1558 | var _Transition = __webpack_require__(12);
|
1559 |
|
1560 | var _Transition2 = _interopRequireDefault(_Transition);
|
1561 |
|
1562 | var _capitalize = __webpack_require__(26);
|
1563 |
|
1564 | var _capitalize2 = _interopRequireDefault(_capitalize);
|
1565 |
|
1566 | var _tinperBeeCore = __webpack_require__(27);
|
1567 |
|
1568 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
1569 |
|
1570 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
1571 |
|
1572 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
1573 |
|
1574 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1575 |
|
1576 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
1577 |
|
1578 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
1579 |
|
1580 | var MARGINS = {
|
1581 | height: ['marginTop', 'marginBottom'],
|
1582 | width: ['marginLeft', 'marginRight']
|
1583 | };
|
1584 |
|
1585 |
|
1586 |
|
1587 | function triggerBrowserReflow(node) {
|
1588 | node.offsetHeight;
|
1589 | }
|
1590 |
|
1591 | function getDimensionValue(dimension, elem) {
|
1592 | var value = elem['offset' + (0, _capitalize2["default"])(dimension)];
|
1593 | var margins = MARGINS[dimension];
|
1594 |
|
1595 | return value + parseInt((0, _style2["default"])(elem, margins[0]), 10) + parseInt((0, _style2["default"])(elem, margins[1]), 10);
|
1596 | }
|
1597 |
|
1598 | var propTypes = {
|
1599 | |
1600 |
|
1601 |
|
1602 | "in": _propTypes2["default"].bool,
|
1603 |
|
1604 | |
1605 |
|
1606 |
|
1607 | unmountOnExit: _propTypes2["default"].bool,
|
1608 |
|
1609 | |
1610 |
|
1611 |
|
1612 |
|
1613 | transitionAppear: _propTypes2["default"].bool,
|
1614 |
|
1615 | |
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 | timeout: _propTypes2["default"].number,
|
1621 |
|
1622 | |
1623 |
|
1624 |
|
1625 | onEnter: _propTypes2["default"].func,
|
1626 | |
1627 |
|
1628 |
|
1629 | onEntering: _propTypes2["default"].func,
|
1630 | |
1631 |
|
1632 |
|
1633 | onEntered: _propTypes2["default"].func,
|
1634 | |
1635 |
|
1636 |
|
1637 | onExit: _propTypes2["default"].func,
|
1638 | |
1639 |
|
1640 |
|
1641 | onExiting: _propTypes2["default"].func,
|
1642 | |
1643 |
|
1644 |
|
1645 | onExited: _propTypes2["default"].func,
|
1646 |
|
1647 | |
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 | dimension: _propTypes2["default"].oneOfType([_propTypes2["default"].oneOf(['height', 'width']), _propTypes2["default"].func]),
|
1655 |
|
1656 | |
1657 |
|
1658 |
|
1659 |
|
1660 |
|
1661 |
|
1662 |
|
1663 | getDimensionValue: _propTypes2["default"].func,
|
1664 |
|
1665 | |
1666 |
|
1667 |
|
1668 | role: _propTypes2["default"].string
|
1669 | };
|
1670 |
|
1671 | var defaultProps = {
|
1672 | "in": false,
|
1673 | timeout: 300,
|
1674 | unmountOnExit: false,
|
1675 | transitionAppear: false,
|
1676 |
|
1677 | dimension: 'height',
|
1678 | getDimensionValue: getDimensionValue
|
1679 | };
|
1680 |
|
1681 | var Collapse = function (_React$Component) {
|
1682 | _inherits(Collapse, _React$Component);
|
1683 |
|
1684 | function Collapse(props, context) {
|
1685 | _classCallCheck(this, Collapse);
|
1686 |
|
1687 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
1688 |
|
1689 | _this.handleEnter = _this.handleEnter.bind(_this);
|
1690 | _this.handleEntering = _this.handleEntering.bind(_this);
|
1691 | _this.handleEntered = _this.handleEntered.bind(_this);
|
1692 | _this.handleExit = _this.handleExit.bind(_this);
|
1693 | _this.handleExiting = _this.handleExiting.bind(_this);
|
1694 | return _this;
|
1695 | }
|
1696 |
|
1697 |
|
1698 |
|
1699 |
|
1700 | Collapse.prototype.handleEnter = function handleEnter(elem) {
|
1701 | var dimension = this._dimension();
|
1702 | elem.style[dimension] = '0';
|
1703 | };
|
1704 |
|
1705 | Collapse.prototype.handleEntering = function handleEntering(elem) {
|
1706 | var dimension = this._dimension();
|
1707 | elem.style[dimension] = this._getScrollDimensionValue(elem, dimension);
|
1708 | };
|
1709 |
|
1710 | Collapse.prototype.handleEntered = function handleEntered(elem) {
|
1711 | var dimension = this._dimension();
|
1712 | elem.style[dimension] = null;
|
1713 | };
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 | Collapse.prototype.handleExit = function handleExit(elem) {
|
1719 | var dimension = this._dimension();
|
1720 | elem.style[dimension] = this.props.getDimensionValue(dimension, elem) + 'px';
|
1721 | triggerBrowserReflow(elem);
|
1722 | };
|
1723 |
|
1724 | Collapse.prototype.handleExiting = function handleExiting(elem) {
|
1725 | var dimension = this._dimension();
|
1726 | elem.style[dimension] = '0';
|
1727 | };
|
1728 |
|
1729 | Collapse.prototype._dimension = function _dimension() {
|
1730 | return typeof this.props.dimension === 'function' ? this.props.dimension() : this.props.dimension;
|
1731 | };
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 | Collapse.prototype._getScrollDimensionValue = function _getScrollDimensionValue(elem, dimension) {
|
1737 | return elem['scroll' + (0, _capitalize2["default"])(dimension)] + 'px';
|
1738 | };
|
1739 |
|
1740 | Collapse.prototype.render = function render() {
|
1741 | var _props = this.props,
|
1742 | onEnter = _props.onEnter,
|
1743 | onEntering = _props.onEntering,
|
1744 | onEntered = _props.onEntered,
|
1745 | onExit = _props.onExit,
|
1746 | onExiting = _props.onExiting,
|
1747 | className = _props.className,
|
1748 | props = _objectWithoutProperties(_props, ['onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'className']);
|
1749 |
|
1750 | delete props.dimension;
|
1751 | delete props.getDimensionValue;
|
1752 |
|
1753 | var handleEnter = (0, _tinperBeeCore.createChainedFunction)(this.handleEnter, onEnter);
|
1754 | var handleEntering = (0, _tinperBeeCore.createChainedFunction)(this.handleEntering, onEntering);
|
1755 | var handleEntered = (0, _tinperBeeCore.createChainedFunction)(this.handleEntered, onEntered);
|
1756 | var handleExit = (0, _tinperBeeCore.createChainedFunction)(this.handleExit, onExit);
|
1757 | var handleExiting = (0, _tinperBeeCore.createChainedFunction)(this.handleExiting, onExiting);
|
1758 |
|
1759 | var classes = {
|
1760 | width: this._dimension() === 'width'
|
1761 | };
|
1762 |
|
1763 | return _react2["default"].createElement(_Transition2["default"], _extends({}, props, {
|
1764 | 'aria-expanded': props.role ? props["in"] : null,
|
1765 | className: (0, _classnames2["default"])(className, classes),
|
1766 | exitedClassName: 'collapse',
|
1767 | exitingClassName: 'collapsing',
|
1768 | enteredClassName: 'collapse in',
|
1769 | enteringClassName: 'collapsing',
|
1770 | onEnter: handleEnter,
|
1771 | onEntering: handleEntering,
|
1772 | onEntered: handleEntered,
|
1773 | onExit: handleExit,
|
1774 | onExiting: handleExiting
|
1775 | }));
|
1776 | };
|
1777 |
|
1778 | return Collapse;
|
1779 | }(_react2["default"].Component);
|
1780 |
|
1781 | Collapse.propTypes = propTypes;
|
1782 | Collapse.defaultProps = defaultProps;
|
1783 |
|
1784 | exports["default"] = Collapse;
|
1785 | module.exports = exports['default'];
|
1786 |
|
1787 | }),
|
1788 |
|
1789 | (function(module, exports, __webpack_require__) {
|
1790 |
|
1791 | "use strict";
|
1792 |
|
1793 | var _interopRequireDefault = __webpack_require__(14);
|
1794 |
|
1795 | exports.__esModule = true;
|
1796 | exports.default = style;
|
1797 |
|
1798 | var _camelizeStyle = _interopRequireDefault(__webpack_require__(19));
|
1799 |
|
1800 | var _hyphenateStyle = _interopRequireDefault(__webpack_require__(21));
|
1801 |
|
1802 | var _getComputedStyle2 = _interopRequireDefault(__webpack_require__(23));
|
1803 |
|
1804 | var _removeStyle = _interopRequireDefault(__webpack_require__(24));
|
1805 |
|
1806 | var _properties = __webpack_require__(13);
|
1807 |
|
1808 | var _isTransform = _interopRequireDefault(__webpack_require__(25));
|
1809 |
|
1810 | function style(node, property, value) {
|
1811 | var css = '';
|
1812 | var transforms = '';
|
1813 | var props = property;
|
1814 |
|
1815 | if (typeof property === 'string') {
|
1816 | if (value === undefined) {
|
1817 | return node.style[(0, _camelizeStyle.default)(property)] || (0, _getComputedStyle2.default)(node).getPropertyValue((0, _hyphenateStyle.default)(property));
|
1818 | } else {
|
1819 | (props = {})[property] = value;
|
1820 | }
|
1821 | }
|
1822 |
|
1823 | Object.keys(props).forEach(function (key) {
|
1824 | var value = props[key];
|
1825 |
|
1826 | if (!value && value !== 0) {
|
1827 | (0, _removeStyle.default)(node, (0, _hyphenateStyle.default)(key));
|
1828 | } else if ((0, _isTransform.default)(key)) {
|
1829 | transforms += key + "(" + value + ") ";
|
1830 | } else {
|
1831 | css += (0, _hyphenateStyle.default)(key) + ": " + value + ";";
|
1832 | }
|
1833 | });
|
1834 |
|
1835 | if (transforms) {
|
1836 | css += _properties.transform + ": " + transforms + ";";
|
1837 | }
|
1838 |
|
1839 | node.style.cssText += ';' + css;
|
1840 | }
|
1841 |
|
1842 | module.exports = exports["default"];
|
1843 |
|
1844 | }),
|
1845 |
|
1846 | (function(module, exports, __webpack_require__) {
|
1847 |
|
1848 | "use strict";
|
1849 |
|
1850 | var _interopRequireDefault = __webpack_require__(14);
|
1851 |
|
1852 | exports.__esModule = true;
|
1853 | exports.default = camelizeStyleName;
|
1854 |
|
1855 | var _camelize = _interopRequireDefault(__webpack_require__(20));
|
1856 |
|
1857 | |
1858 |
|
1859 |
|
1860 |
|
1861 |
|
1862 | var msPattern = /^-ms-/;
|
1863 |
|
1864 | function camelizeStyleName(string) {
|
1865 | return (0, _camelize.default)(string.replace(msPattern, 'ms-'));
|
1866 | }
|
1867 |
|
1868 | module.exports = exports["default"];
|
1869 |
|
1870 | }),
|
1871 |
|
1872 | (function(module, exports) {
|
1873 |
|
1874 | "use strict";
|
1875 |
|
1876 | exports.__esModule = true;
|
1877 | exports.default = camelize;
|
1878 | var rHyphen = /-(.)/g;
|
1879 |
|
1880 | function camelize(string) {
|
1881 | return string.replace(rHyphen, function (_, chr) {
|
1882 | return chr.toUpperCase();
|
1883 | });
|
1884 | }
|
1885 |
|
1886 | module.exports = exports["default"];
|
1887 |
|
1888 | }),
|
1889 |
|
1890 | (function(module, exports, __webpack_require__) {
|
1891 |
|
1892 | "use strict";
|
1893 |
|
1894 | var _interopRequireDefault = __webpack_require__(14);
|
1895 |
|
1896 | exports.__esModule = true;
|
1897 | exports.default = hyphenateStyleName;
|
1898 |
|
1899 | var _hyphenate = _interopRequireDefault(__webpack_require__(22));
|
1900 |
|
1901 | |
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 | var msPattern = /^ms-/;
|
1907 |
|
1908 | function hyphenateStyleName(string) {
|
1909 | return (0, _hyphenate.default)(string).replace(msPattern, '-ms-');
|
1910 | }
|
1911 |
|
1912 | module.exports = exports["default"];
|
1913 |
|
1914 | }),
|
1915 |
|
1916 | (function(module, exports) {
|
1917 |
|
1918 | "use strict";
|
1919 |
|
1920 | exports.__esModule = true;
|
1921 | exports.default = hyphenate;
|
1922 | var rUpper = /([A-Z])/g;
|
1923 |
|
1924 | function hyphenate(string) {
|
1925 | return string.replace(rUpper, '-$1').toLowerCase();
|
1926 | }
|
1927 |
|
1928 | module.exports = exports["default"];
|
1929 |
|
1930 | }),
|
1931 |
|
1932 | (function(module, exports, __webpack_require__) {
|
1933 |
|
1934 | "use strict";
|
1935 |
|
1936 | var _interopRequireDefault = __webpack_require__(14);
|
1937 |
|
1938 | exports.__esModule = true;
|
1939 | exports.default = _getComputedStyle;
|
1940 |
|
1941 | var _camelizeStyle = _interopRequireDefault(__webpack_require__(19));
|
1942 |
|
1943 | var rposition = /^(top|right|bottom|left)$/;
|
1944 | var rnumnonpx = /^([+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/i;
|
1945 |
|
1946 | function _getComputedStyle(node) {
|
1947 | if (!node) throw new TypeError('No Element passed to `getComputedStyle()`');
|
1948 | var doc = node.ownerDocument;
|
1949 | return 'defaultView' in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : {
|
1950 |
|
1951 | getPropertyValue: function getPropertyValue(prop) {
|
1952 | var style = node.style;
|
1953 | prop = (0, _camelizeStyle.default)(prop);
|
1954 | if (prop == 'float') prop = 'styleFloat';
|
1955 | var current = node.currentStyle[prop] || null;
|
1956 | if (current == null && style && style[prop]) current = style[prop];
|
1957 |
|
1958 | if (rnumnonpx.test(current) && !rposition.test(prop)) {
|
1959 |
|
1960 | var left = style.left;
|
1961 | var runStyle = node.runtimeStyle;
|
1962 | var rsLeft = runStyle && runStyle.left;
|
1963 |
|
1964 | if (rsLeft) runStyle.left = node.currentStyle.left;
|
1965 | style.left = prop === 'fontSize' ? '1em' : current;
|
1966 | current = style.pixelLeft + 'px';
|
1967 |
|
1968 | style.left = left;
|
1969 | if (rsLeft) runStyle.left = rsLeft;
|
1970 | }
|
1971 |
|
1972 | return current;
|
1973 | }
|
1974 | };
|
1975 | }
|
1976 |
|
1977 | module.exports = exports["default"];
|
1978 |
|
1979 | }),
|
1980 |
|
1981 | (function(module, exports) {
|
1982 |
|
1983 | "use strict";
|
1984 |
|
1985 | exports.__esModule = true;
|
1986 | exports.default = removeStyle;
|
1987 |
|
1988 | function removeStyle(node, key) {
|
1989 | return 'removeProperty' in node.style ? node.style.removeProperty(key) : node.style.removeAttribute(key);
|
1990 | }
|
1991 |
|
1992 | module.exports = exports["default"];
|
1993 |
|
1994 | }),
|
1995 |
|
1996 | (function(module, exports) {
|
1997 |
|
1998 | "use strict";
|
1999 |
|
2000 | exports.__esModule = true;
|
2001 | exports.default = isTransform;
|
2002 | var supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;
|
2003 |
|
2004 | function isTransform(property) {
|
2005 | return !!(property && supportedTransforms.test(property));
|
2006 | }
|
2007 |
|
2008 | module.exports = exports["default"];
|
2009 |
|
2010 | }),
|
2011 |
|
2012 | (function(module, exports) {
|
2013 |
|
2014 | "use strict";
|
2015 |
|
2016 | Object.defineProperty(exports, "__esModule", {
|
2017 | value: true
|
2018 | });
|
2019 | exports["default"] = capitalize;
|
2020 | function capitalize(string) {
|
2021 | return "" + string.charAt(0).toUpperCase() + string.slice(1);
|
2022 | }
|
2023 | module.exports = exports["default"];
|
2024 |
|
2025 | }),
|
2026 |
|
2027 | (function(module, exports, __webpack_require__) {
|
2028 |
|
2029 | 'use strict';
|
2030 |
|
2031 | exports.__esModule = true;
|
2032 | exports.Align = exports.toArray = exports.cssAnimation = exports.addEventListener = exports.contains = exports.KeyCode = exports.createChainedFunction = exports.splitComponent = exports.isRequiredForA11y = exports.elementType = exports.deprecated = exports.componentOrElement = exports.all = undefined;
|
2033 |
|
2034 | var _all2 = __webpack_require__(28);
|
2035 |
|
2036 | var _all3 = _interopRequireDefault(_all2);
|
2037 |
|
2038 | var _componentOrElement2 = __webpack_require__(30);
|
2039 |
|
2040 | var _componentOrElement3 = _interopRequireDefault(_componentOrElement2);
|
2041 |
|
2042 | var _deprecated2 = __webpack_require__(31);
|
2043 |
|
2044 | var _deprecated3 = _interopRequireDefault(_deprecated2);
|
2045 |
|
2046 | var _elementType2 = __webpack_require__(34);
|
2047 |
|
2048 | var _elementType3 = _interopRequireDefault(_elementType2);
|
2049 |
|
2050 | var _isRequiredForA11y2 = __webpack_require__(35);
|
2051 |
|
2052 | var _isRequiredForA11y3 = _interopRequireDefault(_isRequiredForA11y2);
|
2053 |
|
2054 | var _splitComponent2 = __webpack_require__(36);
|
2055 |
|
2056 | var _splitComponent3 = _interopRequireDefault(_splitComponent2);
|
2057 |
|
2058 | var _createChainedFunction2 = __webpack_require__(37);
|
2059 |
|
2060 | var _createChainedFunction3 = _interopRequireDefault(_createChainedFunction2);
|
2061 |
|
2062 | var _keyCode = __webpack_require__(38);
|
2063 |
|
2064 | var _keyCode2 = _interopRequireDefault(_keyCode);
|
2065 |
|
2066 | var _contains2 = __webpack_require__(39);
|
2067 |
|
2068 | var _contains3 = _interopRequireDefault(_contains2);
|
2069 |
|
2070 | var _addEventListener2 = __webpack_require__(40);
|
2071 |
|
2072 | var _addEventListener3 = _interopRequireDefault(_addEventListener2);
|
2073 |
|
2074 | var _cssAnimation2 = __webpack_require__(45);
|
2075 |
|
2076 | var _cssAnimation3 = _interopRequireDefault(_cssAnimation2);
|
2077 |
|
2078 | var _toArray2 = __webpack_require__(49);
|
2079 |
|
2080 | var _toArray3 = _interopRequireDefault(_toArray2);
|
2081 |
|
2082 | var _Align2 = __webpack_require__(50);
|
2083 |
|
2084 | var _Align3 = _interopRequireDefault(_Align2);
|
2085 |
|
2086 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2087 |
|
2088 | exports.all = _all3.default;
|
2089 | exports.componentOrElement = _componentOrElement3.default;
|
2090 | exports.deprecated = _deprecated3.default;
|
2091 | exports.elementType = _elementType3.default;
|
2092 | exports.isRequiredForA11y = _isRequiredForA11y3.default;
|
2093 | exports.splitComponent = _splitComponent3.default;
|
2094 | exports.createChainedFunction = _createChainedFunction3.default;
|
2095 | exports.KeyCode = _keyCode2.default;
|
2096 | exports.contains = _contains3.default;
|
2097 | exports.addEventListener = _addEventListener3.default;
|
2098 | exports.cssAnimation = _cssAnimation3.default;
|
2099 | exports.toArray = _toArray3.default;
|
2100 |
|
2101 |
|
2102 | exports.Align = _Align3.default;
|
2103 |
|
2104 | }),
|
2105 |
|
2106 | (function(module, exports, __webpack_require__) {
|
2107 |
|
2108 | 'use strict';
|
2109 |
|
2110 | exports.__esModule = true;
|
2111 | exports.default = all;
|
2112 |
|
2113 | var _createChainableTypeChecker = __webpack_require__(29);
|
2114 |
|
2115 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2116 |
|
2117 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2118 |
|
2119 | function all() {
|
2120 | for (var _len = arguments.length, validators = Array(_len), _key = 0; _key < _len; _key++) {
|
2121 | validators[_key] = arguments[_key];
|
2122 | }
|
2123 |
|
2124 | function allPropTypes() {
|
2125 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2126 | args[_key2] = arguments[_key2];
|
2127 | }
|
2128 |
|
2129 | var error = null;
|
2130 |
|
2131 | validators.forEach(function (validator) {
|
2132 | if (error != null) {
|
2133 | return;
|
2134 | }
|
2135 |
|
2136 | var result = validator.apply(undefined, args);
|
2137 | if (result != null) {
|
2138 | error = result;
|
2139 | }
|
2140 | });
|
2141 |
|
2142 | return error;
|
2143 | }
|
2144 |
|
2145 | return (0, _createChainableTypeChecker2.default)(allPropTypes);
|
2146 | } |
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 | }),
|
2152 |
|
2153 | (function(module, exports) {
|
2154 |
|
2155 | 'use strict';
|
2156 |
|
2157 | exports.__esModule = true;
|
2158 | exports.default = createChainableTypeChecker;
|
2159 | |
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 | |
2171 |
|
2172 |
|
2173 |
|
2174 | function createChainableTypeChecker(validate) {
|
2175 | function checkType(isRequired, props, propName, componentName, location, propFullName) {
|
2176 | var componentNameSafe = componentName || '<<anonymous>>';
|
2177 | var propFullNameSafe = propFullName || propName;
|
2178 |
|
2179 | if (props[propName] == null) {
|
2180 | if (isRequired) {
|
2181 | return new Error('Required ' + location + ' `' + propFullNameSafe + '` was not specified ' + ('in `' + componentNameSafe + '`.'));
|
2182 | }
|
2183 |
|
2184 | return null;
|
2185 | }
|
2186 |
|
2187 | for (var _len = arguments.length, args = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) {
|
2188 | args[_key - 6] = arguments[_key];
|
2189 | }
|
2190 |
|
2191 | return validate.apply(undefined, [props, propName, componentNameSafe, location, propFullNameSafe].concat(args));
|
2192 | }
|
2193 |
|
2194 | var chainedCheckType = checkType.bind(null, false);
|
2195 | chainedCheckType.isRequired = checkType.bind(null, true);
|
2196 |
|
2197 | return chainedCheckType;
|
2198 | }
|
2199 |
|
2200 | }),
|
2201 |
|
2202 | (function(module, exports, __webpack_require__) {
|
2203 |
|
2204 | 'use strict';
|
2205 |
|
2206 | exports.__esModule = true;
|
2207 |
|
2208 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 |
|
2214 | var _react = __webpack_require__(1);
|
2215 |
|
2216 | var _react2 = _interopRequireDefault(_react);
|
2217 |
|
2218 | var _createChainableTypeChecker = __webpack_require__(29);
|
2219 |
|
2220 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2221 |
|
2222 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2223 |
|
2224 | function validate(props, propName, componentName, location, propFullName) {
|
2225 | var propValue = props[propName];
|
2226 | var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
|
2227 |
|
2228 | if (_react2.default.isValidElement(propValue)) {
|
2229 | return new Error('Invalid ' + location + ' `' + propFullName + '` of type ReactElement ' + ('supplied to `' + componentName + '`, expected a ReactComponent or a ') + 'DOMElement. You can usually obtain a ReactComponent or DOMElement ' + 'from a ReactElement by attaching a ref to it.');
|
2230 | }
|
2231 |
|
2232 | if ((propType !== 'object' || typeof propValue.render !== 'function') && propValue.nodeType !== 1) {
|
2233 | return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected a ReactComponent or a ') + 'DOMElement.');
|
2234 | }
|
2235 |
|
2236 | return null;
|
2237 | }
|
2238 |
|
2239 | exports.default = (0, _createChainableTypeChecker2.default)(validate);
|
2240 |
|
2241 | }),
|
2242 |
|
2243 | (function(module, exports, __webpack_require__) {
|
2244 |
|
2245 | 'use strict';
|
2246 |
|
2247 | exports.__esModule = true;
|
2248 | exports.default = deprecated;
|
2249 |
|
2250 | var _warning = __webpack_require__(32);
|
2251 |
|
2252 | var _warning2 = _interopRequireDefault(_warning);
|
2253 |
|
2254 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2255 |
|
2256 | var warned = {}; |
2257 |
|
2258 |
|
2259 |
|
2260 | function deprecated(validator, reason) {
|
2261 | return function validate(props, propName, componentName, location, propFullName) {
|
2262 | var componentNameSafe = componentName || '<<anonymous>>';
|
2263 | var propFullNameSafe = propFullName || propName;
|
2264 |
|
2265 | if (props[propName] != null) {
|
2266 | var messageKey = componentName + '.' + propName;
|
2267 |
|
2268 | (0, _warning2.default)(warned[messageKey], 'The ' + location + ' `' + propFullNameSafe + '` of ' + ('`' + componentNameSafe + '` is deprecated. ' + reason + '.'));
|
2269 |
|
2270 | warned[messageKey] = true;
|
2271 | }
|
2272 |
|
2273 | for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
2274 | args[_key - 5] = arguments[_key];
|
2275 | }
|
2276 |
|
2277 | return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
|
2278 | };
|
2279 | }
|
2280 |
|
2281 |
|
2282 | function _resetWarned() {
|
2283 | warned = {};
|
2284 | }
|
2285 |
|
2286 | deprecated._resetWarned = _resetWarned;
|
2287 |
|
2288 |
|
2289 | }),
|
2290 |
|
2291 | (function(module, exports, __webpack_require__) {
|
2292 |
|
2293 | (function(process) { |
2294 |
|
2295 |
|
2296 |
|
2297 |
|
2298 |
|
2299 |
|
2300 |
|
2301 |
|
2302 | 'use strict';
|
2303 |
|
2304 | |
2305 |
|
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 | var warning = function() {};
|
2312 |
|
2313 | if (process.env.NODE_ENV !== 'production') {
|
2314 | warning = function(condition, format, args) {
|
2315 | var len = arguments.length;
|
2316 | args = new Array(len > 2 ? len - 2 : 0);
|
2317 | for (var key = 2; key < len; key++) {
|
2318 | args[key - 2] = arguments[key];
|
2319 | }
|
2320 | if (format === undefined) {
|
2321 | throw new Error(
|
2322 | '`warning(condition, format, ...args)` requires a warning ' +
|
2323 | 'message argument'
|
2324 | );
|
2325 | }
|
2326 |
|
2327 | if (format.length < 10 || (/^[s\W]*$/).test(format)) {
|
2328 | throw new Error(
|
2329 | 'The warning format should be able to uniquely identify this ' +
|
2330 | 'warning. Please, use a more descriptive format than: ' + format
|
2331 | );
|
2332 | }
|
2333 |
|
2334 | if (!condition) {
|
2335 | var argIndex = 0;
|
2336 | var message = 'Warning: ' +
|
2337 | format.replace(/%s/g, function() {
|
2338 | return args[argIndex++];
|
2339 | });
|
2340 | if (typeof console !== 'undefined') {
|
2341 | console.error(message);
|
2342 | }
|
2343 | try {
|
2344 |
|
2345 |
|
2346 | throw new Error(message);
|
2347 | } catch(x) {}
|
2348 | }
|
2349 | };
|
2350 | }
|
2351 |
|
2352 | module.exports = warning;
|
2353 |
|
2354 | }.call(exports, __webpack_require__(33)))
|
2355 |
|
2356 | }),
|
2357 |
|
2358 | (function(module, exports) {
|
2359 |
|
2360 |
|
2361 | var process = module.exports = {};
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 | var cachedSetTimeout;
|
2369 | var cachedClearTimeout;
|
2370 |
|
2371 | function defaultSetTimout() {
|
2372 | throw new Error('setTimeout has not been defined');
|
2373 | }
|
2374 | function defaultClearTimeout () {
|
2375 | throw new Error('clearTimeout has not been defined');
|
2376 | }
|
2377 | (function () {
|
2378 | try {
|
2379 | if (typeof setTimeout === 'function') {
|
2380 | cachedSetTimeout = setTimeout;
|
2381 | } else {
|
2382 | cachedSetTimeout = defaultSetTimout;
|
2383 | }
|
2384 | } catch (e) {
|
2385 | cachedSetTimeout = defaultSetTimout;
|
2386 | }
|
2387 | try {
|
2388 | if (typeof clearTimeout === 'function') {
|
2389 | cachedClearTimeout = clearTimeout;
|
2390 | } else {
|
2391 | cachedClearTimeout = defaultClearTimeout;
|
2392 | }
|
2393 | } catch (e) {
|
2394 | cachedClearTimeout = defaultClearTimeout;
|
2395 | }
|
2396 | } ())
|
2397 | function runTimeout(fun) {
|
2398 | if (cachedSetTimeout === setTimeout) {
|
2399 |
|
2400 | return setTimeout(fun, 0);
|
2401 | }
|
2402 |
|
2403 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
2404 | cachedSetTimeout = setTimeout;
|
2405 | return setTimeout(fun, 0);
|
2406 | }
|
2407 | try {
|
2408 |
|
2409 | return cachedSetTimeout(fun, 0);
|
2410 | } catch(e){
|
2411 | try {
|
2412 |
|
2413 | return cachedSetTimeout.call(null, fun, 0);
|
2414 | } catch(e){
|
2415 |
|
2416 | return cachedSetTimeout.call(this, fun, 0);
|
2417 | }
|
2418 | }
|
2419 |
|
2420 |
|
2421 | }
|
2422 | function runClearTimeout(marker) {
|
2423 | if (cachedClearTimeout === clearTimeout) {
|
2424 |
|
2425 | return clearTimeout(marker);
|
2426 | }
|
2427 |
|
2428 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
2429 | cachedClearTimeout = clearTimeout;
|
2430 | return clearTimeout(marker);
|
2431 | }
|
2432 | try {
|
2433 |
|
2434 | return cachedClearTimeout(marker);
|
2435 | } catch (e){
|
2436 | try {
|
2437 |
|
2438 | return cachedClearTimeout.call(null, marker);
|
2439 | } catch (e){
|
2440 |
|
2441 |
|
2442 | return cachedClearTimeout.call(this, marker);
|
2443 | }
|
2444 | }
|
2445 |
|
2446 |
|
2447 |
|
2448 | }
|
2449 | var queue = [];
|
2450 | var draining = false;
|
2451 | var currentQueue;
|
2452 | var queueIndex = -1;
|
2453 |
|
2454 | function cleanUpNextTick() {
|
2455 | if (!draining || !currentQueue) {
|
2456 | return;
|
2457 | }
|
2458 | draining = false;
|
2459 | if (currentQueue.length) {
|
2460 | queue = currentQueue.concat(queue);
|
2461 | } else {
|
2462 | queueIndex = -1;
|
2463 | }
|
2464 | if (queue.length) {
|
2465 | drainQueue();
|
2466 | }
|
2467 | }
|
2468 |
|
2469 | function drainQueue() {
|
2470 | if (draining) {
|
2471 | return;
|
2472 | }
|
2473 | var timeout = runTimeout(cleanUpNextTick);
|
2474 | draining = true;
|
2475 |
|
2476 | var len = queue.length;
|
2477 | while(len) {
|
2478 | currentQueue = queue;
|
2479 | queue = [];
|
2480 | while (++queueIndex < len) {
|
2481 | if (currentQueue) {
|
2482 | currentQueue[queueIndex].run();
|
2483 | }
|
2484 | }
|
2485 | queueIndex = -1;
|
2486 | len = queue.length;
|
2487 | }
|
2488 | currentQueue = null;
|
2489 | draining = false;
|
2490 | runClearTimeout(timeout);
|
2491 | }
|
2492 |
|
2493 | process.nextTick = function (fun) {
|
2494 | var args = new Array(arguments.length - 1);
|
2495 | if (arguments.length > 1) {
|
2496 | for (var i = 1; i < arguments.length; i++) {
|
2497 | args[i - 1] = arguments[i];
|
2498 | }
|
2499 | }
|
2500 | queue.push(new Item(fun, args));
|
2501 | if (queue.length === 1 && !draining) {
|
2502 | runTimeout(drainQueue);
|
2503 | }
|
2504 | };
|
2505 |
|
2506 |
|
2507 | function Item(fun, array) {
|
2508 | this.fun = fun;
|
2509 | this.array = array;
|
2510 | }
|
2511 | Item.prototype.run = function () {
|
2512 | this.fun.apply(null, this.array);
|
2513 | };
|
2514 | process.title = 'browser';
|
2515 | process.browser = true;
|
2516 | process.env = {};
|
2517 | process.argv = [];
|
2518 | process.version = '';
|
2519 | process.versions = {};
|
2520 |
|
2521 | function noop() {}
|
2522 |
|
2523 | process.on = noop;
|
2524 | process.addListener = noop;
|
2525 | process.once = noop;
|
2526 | process.off = noop;
|
2527 | process.removeListener = noop;
|
2528 | process.removeAllListeners = noop;
|
2529 | process.emit = noop;
|
2530 | process.prependListener = noop;
|
2531 | process.prependOnceListener = noop;
|
2532 |
|
2533 | process.listeners = function (name) { return [] }
|
2534 |
|
2535 | process.binding = function (name) {
|
2536 | throw new Error('process.binding is not supported');
|
2537 | };
|
2538 |
|
2539 | process.cwd = function () { return '/' };
|
2540 | process.chdir = function (dir) {
|
2541 | throw new Error('process.chdir is not supported');
|
2542 | };
|
2543 | process.umask = function() { return 0; };
|
2544 |
|
2545 |
|
2546 | }),
|
2547 |
|
2548 | (function(module, exports, __webpack_require__) {
|
2549 |
|
2550 | 'use strict';
|
2551 |
|
2552 | exports.__esModule = true;
|
2553 |
|
2554 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
2555 |
|
2556 |
|
2557 |
|
2558 |
|
2559 |
|
2560 | var _react = __webpack_require__(1);
|
2561 |
|
2562 | var _react2 = _interopRequireDefault(_react);
|
2563 |
|
2564 | var _createChainableTypeChecker = __webpack_require__(29);
|
2565 |
|
2566 | var _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);
|
2567 |
|
2568 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2569 |
|
2570 | function elementType(props, propName, componentName, location, propFullName) {
|
2571 | var propValue = props[propName];
|
2572 | var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue);
|
2573 |
|
2574 | if (_react2.default.isValidElement(propValue)) {
|
2575 | return new Error('Invalid ' + location + ' `' + propFullName + '` of type ReactElement ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
|
2576 | }
|
2577 |
|
2578 | if (propType !== 'function' && propType !== 'string') {
|
2579 | return new Error('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected an element type (a string ') + 'or a ReactClass).');
|
2580 | }
|
2581 |
|
2582 | return null;
|
2583 | }
|
2584 |
|
2585 | exports.default = (0, _createChainableTypeChecker2.default)(elementType);
|
2586 |
|
2587 | }),
|
2588 |
|
2589 | (function(module, exports) {
|
2590 |
|
2591 | 'use strict';
|
2592 |
|
2593 | exports.__esModule = true;
|
2594 | exports.default = isRequiredForA11y;
|
2595 | |
2596 |
|
2597 |
|
2598 |
|
2599 | function isRequiredForA11y(validator) {
|
2600 | return function validate(props, propName, componentName, location, propFullName) {
|
2601 | var componentNameSafe = componentName || '<<anonymous>>';
|
2602 | var propFullNameSafe = propFullName || propName;
|
2603 |
|
2604 | if (props[propName] == null) {
|
2605 | return new Error('The ' + location + ' `' + propFullNameSafe + '` is required to make ' + ('`' + componentNameSafe + '` accessible for users of assistive ') + 'technologies such as screen readers.');
|
2606 | }
|
2607 |
|
2608 | for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
2609 | args[_key - 5] = arguments[_key];
|
2610 | }
|
2611 |
|
2612 | return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));
|
2613 | };
|
2614 | }
|
2615 |
|
2616 | }),
|
2617 |
|
2618 | (function(module, exports) {
|
2619 |
|
2620 | "use strict";
|
2621 |
|
2622 | exports.__esModule = true;
|
2623 | exports.default = splitComponentProps;
|
2624 | |
2625 |
|
2626 |
|
2627 |
|
2628 | function _objectEntries(obj) {
|
2629 | var entries = [];
|
2630 | var keys = Object.keys(obj);
|
2631 |
|
2632 | for (var k = 0; k < keys.length; ++k) {
|
2633 | entries.push([keys[k], obj[keys[k]]]);
|
2634 | }return entries;
|
2635 | }
|
2636 |
|
2637 | |
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 | function splitComponentProps(props, Component) {
|
2644 | var componentPropTypes = Component.propTypes;
|
2645 |
|
2646 | var parentProps = {};
|
2647 | var childProps = {};
|
2648 |
|
2649 | _objectEntries(props).forEach(function (_ref) {
|
2650 | var propName = _ref[0],
|
2651 | propValue = _ref[1];
|
2652 |
|
2653 | if (componentPropTypes[propName]) {
|
2654 | parentProps[propName] = propValue;
|
2655 | } else {
|
2656 | childProps[propName] = propValue;
|
2657 | }
|
2658 | });
|
2659 |
|
2660 | return [parentProps, childProps];
|
2661 | }
|
2662 |
|
2663 | }),
|
2664 |
|
2665 | (function(module, exports) {
|
2666 |
|
2667 | 'use strict';
|
2668 |
|
2669 | exports.__esModule = true;
|
2670 | |
2671 |
|
2672 |
|
2673 |
|
2674 | function createChainedFunction() {
|
2675 | for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
|
2676 | funcs[_key] = arguments[_key];
|
2677 | }
|
2678 |
|
2679 | return funcs.filter(function (f) {
|
2680 | return f != null;
|
2681 | }).reduce(function (acc, f) {
|
2682 | if (typeof f !== 'function') {
|
2683 | throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
|
2684 | }
|
2685 |
|
2686 | if (acc === null) {
|
2687 | return f;
|
2688 | }
|
2689 |
|
2690 | return function chainedFunction() {
|
2691 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2692 | args[_key2] = arguments[_key2];
|
2693 | }
|
2694 |
|
2695 | acc.apply(this, args);
|
2696 | f.apply(this, args);
|
2697 | };
|
2698 | }, null);
|
2699 | }
|
2700 | exports.default = createChainedFunction;
|
2701 |
|
2702 | }),
|
2703 |
|
2704 | (function(module, exports) {
|
2705 |
|
2706 | |
2707 |
|
2708 |
|
2709 |
|
2710 | 'use strict';
|
2711 |
|
2712 | |
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 |
|
2718 | var KeyCode = {
|
2719 | |
2720 |
|
2721 |
|
2722 | MAC_ENTER: 3,
|
2723 | |
2724 |
|
2725 |
|
2726 | BACKSPACE: 8,
|
2727 | |
2728 |
|
2729 |
|
2730 | TAB: 9,
|
2731 | |
2732 |
|
2733 |
|
2734 | NUM_CENTER: 12,
|
2735 | |
2736 |
|
2737 |
|
2738 | ENTER: 13,
|
2739 | |
2740 |
|
2741 |
|
2742 | SHIFT: 16,
|
2743 | |
2744 |
|
2745 |
|
2746 | CTRL: 17,
|
2747 | |
2748 |
|
2749 |
|
2750 | ALT: 18,
|
2751 | |
2752 |
|
2753 |
|
2754 | PAUSE: 19,
|
2755 | |
2756 |
|
2757 |
|
2758 | CAPS_LOCK: 20,
|
2759 | |
2760 |
|
2761 |
|
2762 | ESC: 27,
|
2763 | |
2764 |
|
2765 |
|
2766 | SPACE: 32,
|
2767 | |
2768 |
|
2769 |
|
2770 | PAGE_UP: 33,
|
2771 | |
2772 |
|
2773 |
|
2774 | PAGE_DOWN: 34,
|
2775 | |
2776 |
|
2777 |
|
2778 | END: 35,
|
2779 | |
2780 |
|
2781 |
|
2782 | HOME: 36,
|
2783 | |
2784 |
|
2785 |
|
2786 | LEFT: 37,
|
2787 | |
2788 |
|
2789 |
|
2790 | UP: 38,
|
2791 | |
2792 |
|
2793 |
|
2794 | RIGHT: 39,
|
2795 | |
2796 |
|
2797 |
|
2798 | DOWN: 40,
|
2799 | |
2800 |
|
2801 |
|
2802 | PRINT_SCREEN: 44,
|
2803 | |
2804 |
|
2805 |
|
2806 | INSERT: 45,
|
2807 | |
2808 |
|
2809 |
|
2810 | DELETE: 46,
|
2811 | |
2812 |
|
2813 |
|
2814 | ZERO: 48,
|
2815 | |
2816 |
|
2817 |
|
2818 | ONE: 49,
|
2819 | |
2820 |
|
2821 |
|
2822 | TWO: 50,
|
2823 | |
2824 |
|
2825 |
|
2826 | THREE: 51,
|
2827 | |
2828 |
|
2829 |
|
2830 | FOUR: 52,
|
2831 | |
2832 |
|
2833 |
|
2834 | FIVE: 53,
|
2835 | |
2836 |
|
2837 |
|
2838 | SIX: 54,
|
2839 | |
2840 |
|
2841 |
|
2842 | SEVEN: 55,
|
2843 | |
2844 |
|
2845 |
|
2846 | EIGHT: 56,
|
2847 | |
2848 |
|
2849 |
|
2850 | NINE: 57,
|
2851 | |
2852 |
|
2853 |
|
2854 | QUESTION_MARK: 63,
|
2855 | |
2856 |
|
2857 |
|
2858 | A: 65,
|
2859 | |
2860 |
|
2861 |
|
2862 | B: 66,
|
2863 | |
2864 |
|
2865 |
|
2866 | C: 67,
|
2867 | |
2868 |
|
2869 |
|
2870 | D: 68,
|
2871 | |
2872 |
|
2873 |
|
2874 | E: 69,
|
2875 | |
2876 |
|
2877 |
|
2878 | F: 70,
|
2879 | |
2880 |
|
2881 |
|
2882 | G: 71,
|
2883 | |
2884 |
|
2885 |
|
2886 | H: 72,
|
2887 | |
2888 |
|
2889 |
|
2890 | I: 73,
|
2891 | |
2892 |
|
2893 |
|
2894 | J: 74,
|
2895 | |
2896 |
|
2897 |
|
2898 | K: 75,
|
2899 | |
2900 |
|
2901 |
|
2902 | L: 76,
|
2903 | |
2904 |
|
2905 |
|
2906 | M: 77,
|
2907 | |
2908 |
|
2909 |
|
2910 | N: 78,
|
2911 | |
2912 |
|
2913 |
|
2914 | O: 79,
|
2915 | |
2916 |
|
2917 |
|
2918 | P: 80,
|
2919 | |
2920 |
|
2921 |
|
2922 | Q: 81,
|
2923 | |
2924 |
|
2925 |
|
2926 | R: 82,
|
2927 | |
2928 |
|
2929 |
|
2930 | S: 83,
|
2931 | |
2932 |
|
2933 |
|
2934 | T: 84,
|
2935 | |
2936 |
|
2937 |
|
2938 | U: 85,
|
2939 | |
2940 |
|
2941 |
|
2942 | V: 86,
|
2943 | |
2944 |
|
2945 |
|
2946 | W: 87,
|
2947 | |
2948 |
|
2949 |
|
2950 | X: 88,
|
2951 | |
2952 |
|
2953 |
|
2954 | Y: 89,
|
2955 | |
2956 |
|
2957 |
|
2958 | Z: 90,
|
2959 | |
2960 |
|
2961 |
|
2962 | META: 91,
|
2963 | |
2964 |
|
2965 |
|
2966 | WIN_KEY_RIGHT: 92,
|
2967 | |
2968 |
|
2969 |
|
2970 | CONTEXT_MENU: 93,
|
2971 | |
2972 |
|
2973 |
|
2974 | NUM_ZERO: 96,
|
2975 | |
2976 |
|
2977 |
|
2978 | NUM_ONE: 97,
|
2979 | |
2980 |
|
2981 |
|
2982 | NUM_TWO: 98,
|
2983 | |
2984 |
|
2985 |
|
2986 | NUM_THREE: 99,
|
2987 | |
2988 |
|
2989 |
|
2990 | NUM_FOUR: 100,
|
2991 | |
2992 |
|
2993 |
|
2994 | NUM_FIVE: 101,
|
2995 | |
2996 |
|
2997 |
|
2998 | NUM_SIX: 102,
|
2999 | |
3000 |
|
3001 |
|
3002 | NUM_SEVEN: 103,
|
3003 | |
3004 |
|
3005 |
|
3006 | NUM_EIGHT: 104,
|
3007 | |
3008 |
|
3009 |
|
3010 | NUM_NINE: 105,
|
3011 | |
3012 |
|
3013 |
|
3014 | NUM_MULTIPLY: 106,
|
3015 | |
3016 |
|
3017 |
|
3018 | NUM_PLUS: 107,
|
3019 | |
3020 |
|
3021 |
|
3022 | NUM_MINUS: 109,
|
3023 | |
3024 |
|
3025 |
|
3026 | NUM_PERIOD: 110,
|
3027 | |
3028 |
|
3029 |
|
3030 | NUM_DIVISION: 111,
|
3031 | |
3032 |
|
3033 |
|
3034 | F1: 112,
|
3035 | |
3036 |
|
3037 |
|
3038 | F2: 113,
|
3039 | |
3040 |
|
3041 |
|
3042 | F3: 114,
|
3043 | |
3044 |
|
3045 |
|
3046 | F4: 115,
|
3047 | |
3048 |
|
3049 |
|
3050 | F5: 116,
|
3051 | |
3052 |
|
3053 |
|
3054 | F6: 117,
|
3055 | |
3056 |
|
3057 |
|
3058 | F7: 118,
|
3059 | |
3060 |
|
3061 |
|
3062 | F8: 119,
|
3063 | |
3064 |
|
3065 |
|
3066 | F9: 120,
|
3067 | |
3068 |
|
3069 |
|
3070 | F10: 121,
|
3071 | |
3072 |
|
3073 |
|
3074 | F11: 122,
|
3075 | |
3076 |
|
3077 |
|
3078 | F12: 123,
|
3079 | |
3080 |
|
3081 |
|
3082 | NUMLOCK: 144,
|
3083 | |
3084 |
|
3085 |
|
3086 | SEMICOLON: 186,
|
3087 | |
3088 |
|
3089 |
|
3090 | DASH: 189,
|
3091 | |
3092 |
|
3093 |
|
3094 | EQUALS: 187,
|
3095 | |
3096 |
|
3097 |
|
3098 | COMMA: 188,
|
3099 | |
3100 |
|
3101 |
|
3102 | PERIOD: 190,
|
3103 | |
3104 |
|
3105 |
|
3106 | SLASH: 191,
|
3107 | |
3108 |
|
3109 |
|
3110 | APOSTROPHE: 192,
|
3111 | |
3112 |
|
3113 |
|
3114 | SINGLE_QUOTE: 222,
|
3115 | |
3116 |
|
3117 |
|
3118 | OPEN_SQUARE_BRACKET: 219,
|
3119 | |
3120 |
|
3121 |
|
3122 | BACKSLASH: 220,
|
3123 | |
3124 |
|
3125 |
|
3126 | CLOSE_SQUARE_BRACKET: 221,
|
3127 | |
3128 |
|
3129 |
|
3130 | WIN_KEY: 224,
|
3131 | |
3132 |
|
3133 |
|
3134 | MAC_FF_META: 224,
|
3135 | |
3136 |
|
3137 |
|
3138 | WIN_IME: 229
|
3139 | };
|
3140 |
|
3141 | |
3142 |
|
3143 |
|
3144 | KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) {
|
3145 | var keyCode = e.keyCode;
|
3146 | if (e.altKey && !e.ctrlKey || e.metaKey ||
|
3147 |
|
3148 | keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
|
3149 | return false;
|
3150 | }
|
3151 |
|
3152 |
|
3153 |
|
3154 | switch (keyCode) {
|
3155 | case KeyCode.ALT:
|
3156 | case KeyCode.CAPS_LOCK:
|
3157 | case KeyCode.CONTEXT_MENU:
|
3158 | case KeyCode.CTRL:
|
3159 | case KeyCode.DOWN:
|
3160 | case KeyCode.END:
|
3161 | case KeyCode.ESC:
|
3162 | case KeyCode.HOME:
|
3163 | case KeyCode.INSERT:
|
3164 | case KeyCode.LEFT:
|
3165 | case KeyCode.MAC_FF_META:
|
3166 | case KeyCode.META:
|
3167 | case KeyCode.NUMLOCK:
|
3168 | case KeyCode.NUM_CENTER:
|
3169 | case KeyCode.PAGE_DOWN:
|
3170 | case KeyCode.PAGE_UP:
|
3171 | case KeyCode.PAUSE:
|
3172 | case KeyCode.PRINT_SCREEN:
|
3173 | case KeyCode.RIGHT:
|
3174 | case KeyCode.SHIFT:
|
3175 | case KeyCode.UP:
|
3176 | case KeyCode.WIN_KEY:
|
3177 | case KeyCode.WIN_KEY_RIGHT:
|
3178 | return false;
|
3179 | default:
|
3180 | return true;
|
3181 | }
|
3182 | };
|
3183 |
|
3184 | |
3185 |
|
3186 |
|
3187 | KeyCode.isCharacterKey = function isCharacterKey(keyCode) {
|
3188 | if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
|
3189 | return true;
|
3190 | }
|
3191 |
|
3192 | if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
|
3193 | return true;
|
3194 | }
|
3195 |
|
3196 | if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
|
3197 | return true;
|
3198 | }
|
3199 |
|
3200 |
|
3201 | if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {
|
3202 | return true;
|
3203 | }
|
3204 |
|
3205 | switch (keyCode) {
|
3206 | case KeyCode.SPACE:
|
3207 | case KeyCode.QUESTION_MARK:
|
3208 | case KeyCode.NUM_PLUS:
|
3209 | case KeyCode.NUM_MINUS:
|
3210 | case KeyCode.NUM_PERIOD:
|
3211 | case KeyCode.NUM_DIVISION:
|
3212 | case KeyCode.SEMICOLON:
|
3213 | case KeyCode.DASH:
|
3214 | case KeyCode.EQUALS:
|
3215 | case KeyCode.COMMA:
|
3216 | case KeyCode.PERIOD:
|
3217 | case KeyCode.SLASH:
|
3218 | case KeyCode.APOSTROPHE:
|
3219 | case KeyCode.SINGLE_QUOTE:
|
3220 | case KeyCode.OPEN_SQUARE_BRACKET:
|
3221 | case KeyCode.BACKSLASH:
|
3222 | case KeyCode.CLOSE_SQUARE_BRACKET:
|
3223 | return true;
|
3224 | default:
|
3225 | return false;
|
3226 | }
|
3227 | };
|
3228 |
|
3229 | module.exports = KeyCode;
|
3230 |
|
3231 | }),
|
3232 |
|
3233 | (function(module, exports) {
|
3234 |
|
3235 | "use strict";
|
3236 |
|
3237 | exports.__esModule = true;
|
3238 | exports.default = contains;
|
3239 | |
3240 |
|
3241 |
|
3242 |
|
3243 | function contains(root, n) {
|
3244 | var node = n;
|
3245 | while (node) {
|
3246 | if (node === root) {
|
3247 | return true;
|
3248 | }
|
3249 | node = node.parentNode;
|
3250 | }
|
3251 |
|
3252 | return false;
|
3253 | }
|
3254 |
|
3255 | }),
|
3256 |
|
3257 | (function(module, exports, __webpack_require__) {
|
3258 |
|
3259 | 'use strict';
|
3260 |
|
3261 | exports.__esModule = true;
|
3262 | exports.default = addEventListenerWrap;
|
3263 |
|
3264 | var _addDomEventListener = __webpack_require__(41);
|
3265 |
|
3266 | var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener);
|
3267 |
|
3268 | var _reactDom = __webpack_require__(2);
|
3269 |
|
3270 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
3271 |
|
3272 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3273 |
|
3274 | |
3275 |
|
3276 |
|
3277 |
|
3278 | function addEventListenerWrap(target, eventType, cb) {
|
3279 |
|
3280 | var callback = _reactDom2.default.unstable_batchedUpdates ? function run(e) {
|
3281 | _reactDom2.default.unstable_batchedUpdates(cb, e);
|
3282 | } : cb;
|
3283 | return (0, _addDomEventListener2.default)(target, eventType, callback);
|
3284 | }
|
3285 |
|
3286 | }),
|
3287 |
|
3288 | (function(module, exports, __webpack_require__) {
|
3289 |
|
3290 | 'use strict';
|
3291 |
|
3292 | Object.defineProperty(exports, '__esModule', {
|
3293 | value: true
|
3294 | });
|
3295 | exports['default'] = addEventListener;
|
3296 |
|
3297 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
3298 |
|
3299 | var _EventObject = __webpack_require__(42);
|
3300 |
|
3301 | var _EventObject2 = _interopRequireDefault(_EventObject);
|
3302 |
|
3303 | function addEventListener(target, eventType, callback, option) {
|
3304 | function wrapCallback(e) {
|
3305 | var ne = new _EventObject2['default'](e);
|
3306 | callback.call(target, ne);
|
3307 | }
|
3308 |
|
3309 | if (target.addEventListener) {
|
3310 | var _ret = (function () {
|
3311 | var useCapture = false;
|
3312 | if (typeof option === 'object') {
|
3313 | useCapture = option.capture || false;
|
3314 | } else if (typeof option === 'boolean') {
|
3315 | useCapture = option;
|
3316 | }
|
3317 |
|
3318 | target.addEventListener(eventType, wrapCallback, option || false);
|
3319 |
|
3320 | return {
|
3321 | v: {
|
3322 | remove: function remove() {
|
3323 | target.removeEventListener(eventType, wrapCallback, useCapture);
|
3324 | }
|
3325 | }
|
3326 | };
|
3327 | })();
|
3328 |
|
3329 | if (typeof _ret === 'object') return _ret.v;
|
3330 | } else if (target.attachEvent) {
|
3331 | target.attachEvent('on' + eventType, wrapCallback);
|
3332 | return {
|
3333 | remove: function remove() {
|
3334 | target.detachEvent('on' + eventType, wrapCallback);
|
3335 | }
|
3336 | };
|
3337 | }
|
3338 | }
|
3339 |
|
3340 | module.exports = exports['default'];
|
3341 |
|
3342 | }),
|
3343 |
|
3344 | (function(module, exports, __webpack_require__) {
|
3345 |
|
3346 | |
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 | 'use strict';
|
3353 |
|
3354 | Object.defineProperty(exports, '__esModule', {
|
3355 | value: true
|
3356 | });
|
3357 |
|
3358 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
3359 |
|
3360 | var _EventBaseObject = __webpack_require__(43);
|
3361 |
|
3362 | var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject);
|
3363 |
|
3364 | var _objectAssign = __webpack_require__(44);
|
3365 |
|
3366 | var _objectAssign2 = _interopRequireDefault(_objectAssign);
|
3367 |
|
3368 | var TRUE = true;
|
3369 | var FALSE = false;
|
3370 | var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type'];
|
3371 |
|
3372 | function isNullOrUndefined(w) {
|
3373 | return w === null || w === undefined;
|
3374 | }
|
3375 |
|
3376 | var eventNormalizers = [{
|
3377 | reg: /^key/,
|
3378 | props: ['char', 'charCode', 'key', 'keyCode', 'which'],
|
3379 | fix: function fix(event, nativeEvent) {
|
3380 | if (isNullOrUndefined(event.which)) {
|
3381 | event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode;
|
3382 | }
|
3383 |
|
3384 |
|
3385 | if (event.metaKey === undefined) {
|
3386 | event.metaKey = event.ctrlKey;
|
3387 | }
|
3388 | }
|
3389 | }, {
|
3390 | reg: /^touch/,
|
3391 | props: ['touches', 'changedTouches', 'targetTouches']
|
3392 | }, {
|
3393 | reg: /^hashchange$/,
|
3394 | props: ['newURL', 'oldURL']
|
3395 | }, {
|
3396 | reg: /^gesturechange$/i,
|
3397 | props: ['rotation', 'scale']
|
3398 | }, {
|
3399 | reg: /^(mousewheel|DOMMouseScroll)$/,
|
3400 | props: [],
|
3401 | fix: function fix(event, nativeEvent) {
|
3402 | var deltaX = undefined;
|
3403 | var deltaY = undefined;
|
3404 | var delta = undefined;
|
3405 | var wheelDelta = nativeEvent.wheelDelta;
|
3406 | var axis = nativeEvent.axis;
|
3407 | var wheelDeltaY = nativeEvent.wheelDeltaY;
|
3408 | var wheelDeltaX = nativeEvent.wheelDeltaX;
|
3409 | var detail = nativeEvent.detail;
|
3410 |
|
3411 |
|
3412 | if (wheelDelta) {
|
3413 | delta = wheelDelta / 120;
|
3414 | }
|
3415 |
|
3416 |
|
3417 | if (detail) {
|
3418 |
|
3419 | delta = 0 - (detail % 3 === 0 ? detail / 3 : detail);
|
3420 | }
|
3421 |
|
3422 |
|
3423 | if (axis !== undefined) {
|
3424 | if (axis === event.HORIZONTAL_AXIS) {
|
3425 | deltaY = 0;
|
3426 | deltaX = 0 - delta;
|
3427 | } else if (axis === event.VERTICAL_AXIS) {
|
3428 | deltaX = 0;
|
3429 | deltaY = delta;
|
3430 | }
|
3431 | }
|
3432 |
|
3433 |
|
3434 | if (wheelDeltaY !== undefined) {
|
3435 | deltaY = wheelDeltaY / 120;
|
3436 | }
|
3437 | if (wheelDeltaX !== undefined) {
|
3438 | deltaX = -1 * wheelDeltaX / 120;
|
3439 | }
|
3440 |
|
3441 |
|
3442 | if (!deltaX && !deltaY) {
|
3443 | deltaY = delta;
|
3444 | }
|
3445 |
|
3446 | if (deltaX !== undefined) {
|
3447 | |
3448 |
|
3449 |
|
3450 |
|
3451 |
|
3452 | event.deltaX = deltaX;
|
3453 | }
|
3454 |
|
3455 | if (deltaY !== undefined) {
|
3456 | |
3457 |
|
3458 |
|
3459 |
|
3460 |
|
3461 | event.deltaY = deltaY;
|
3462 | }
|
3463 |
|
3464 | if (delta !== undefined) {
|
3465 | |
3466 |
|
3467 |
|
3468 |
|
3469 |
|
3470 | event.delta = delta;
|
3471 | }
|
3472 | }
|
3473 | }, {
|
3474 | reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,
|
3475 | props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'],
|
3476 | fix: function fix(event, nativeEvent) {
|
3477 | var eventDoc = undefined;
|
3478 | var doc = undefined;
|
3479 | var body = undefined;
|
3480 | var target = event.target;
|
3481 | var button = nativeEvent.button;
|
3482 |
|
3483 |
|
3484 | if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) {
|
3485 | eventDoc = target.ownerDocument || document;
|
3486 | doc = eventDoc.documentElement;
|
3487 | body = eventDoc.body;
|
3488 | event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
|
3489 | event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
|
3490 | }
|
3491 |
|
3492 |
|
3493 |
|
3494 | if (!event.which && button !== undefined) {
|
3495 | if (button & 1) {
|
3496 | event.which = 1;
|
3497 | } else if (button & 2) {
|
3498 | event.which = 3;
|
3499 | } else if (button & 4) {
|
3500 | event.which = 2;
|
3501 | } else {
|
3502 | event.which = 0;
|
3503 | }
|
3504 | }
|
3505 |
|
3506 |
|
3507 | if (!event.relatedTarget && event.fromElement) {
|
3508 | event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement;
|
3509 | }
|
3510 |
|
3511 | return event;
|
3512 | }
|
3513 | }];
|
3514 |
|
3515 | function retTrue() {
|
3516 | return TRUE;
|
3517 | }
|
3518 |
|
3519 | function retFalse() {
|
3520 | return FALSE;
|
3521 | }
|
3522 |
|
3523 | function DomEventObject(nativeEvent) {
|
3524 | var type = nativeEvent.type;
|
3525 |
|
3526 | var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean';
|
3527 |
|
3528 | _EventBaseObject2['default'].call(this);
|
3529 |
|
3530 | this.nativeEvent = nativeEvent;
|
3531 |
|
3532 |
|
3533 | var isDefaultPrevented = retFalse;
|
3534 | if ('defaultPrevented' in nativeEvent) {
|
3535 | isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse;
|
3536 | } else if ('getPreventDefault' in nativeEvent) {
|
3537 |
|
3538 | isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse;
|
3539 | } else if ('returnValue' in nativeEvent) {
|
3540 | isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse;
|
3541 | }
|
3542 |
|
3543 | this.isDefaultPrevented = isDefaultPrevented;
|
3544 |
|
3545 | var fixFns = [];
|
3546 | var fixFn = undefined;
|
3547 | var l = undefined;
|
3548 | var prop = undefined;
|
3549 | var props = commonProps.concat();
|
3550 |
|
3551 | eventNormalizers.forEach(function (normalizer) {
|
3552 | if (type.match(normalizer.reg)) {
|
3553 | props = props.concat(normalizer.props);
|
3554 | if (normalizer.fix) {
|
3555 | fixFns.push(normalizer.fix);
|
3556 | }
|
3557 | }
|
3558 | });
|
3559 |
|
3560 | l = props.length;
|
3561 |
|
3562 |
|
3563 | while (l) {
|
3564 | prop = props[--l];
|
3565 | this[prop] = nativeEvent[prop];
|
3566 | }
|
3567 |
|
3568 |
|
3569 | if (!this.target && isNative) {
|
3570 | this.target = nativeEvent.srcElement || document;
|
3571 | }
|
3572 |
|
3573 |
|
3574 | if (this.target && this.target.nodeType === 3) {
|
3575 | this.target = this.target.parentNode;
|
3576 | }
|
3577 |
|
3578 | l = fixFns.length;
|
3579 |
|
3580 | while (l) {
|
3581 | fixFn = fixFns[--l];
|
3582 | fixFn(this, nativeEvent);
|
3583 | }
|
3584 |
|
3585 | this.timeStamp = nativeEvent.timeStamp || Date.now();
|
3586 | }
|
3587 |
|
3588 | var EventBaseObjectProto = _EventBaseObject2['default'].prototype;
|
3589 |
|
3590 | (0, _objectAssign2['default'])(DomEventObject.prototype, EventBaseObjectProto, {
|
3591 | constructor: DomEventObject,
|
3592 |
|
3593 | preventDefault: function preventDefault() {
|
3594 | var e = this.nativeEvent;
|
3595 |
|
3596 |
|
3597 | if (e.preventDefault) {
|
3598 | e.preventDefault();
|
3599 | } else {
|
3600 |
|
3601 | e.returnValue = FALSE;
|
3602 | }
|
3603 |
|
3604 | EventBaseObjectProto.preventDefault.call(this);
|
3605 | },
|
3606 |
|
3607 | stopPropagation: function stopPropagation() {
|
3608 | var e = this.nativeEvent;
|
3609 |
|
3610 |
|
3611 | if (e.stopPropagation) {
|
3612 | e.stopPropagation();
|
3613 | } else {
|
3614 |
|
3615 | e.cancelBubble = TRUE;
|
3616 | }
|
3617 |
|
3618 | EventBaseObjectProto.stopPropagation.call(this);
|
3619 | }
|
3620 | });
|
3621 |
|
3622 | exports['default'] = DomEventObject;
|
3623 | module.exports = exports['default'];
|
3624 |
|
3625 | }),
|
3626 |
|
3627 | (function(module, exports) {
|
3628 |
|
3629 | |
3630 |
|
3631 |
|
3632 |
|
3633 |
|
3634 |
|
3635 | "use strict";
|
3636 |
|
3637 | Object.defineProperty(exports, "__esModule", {
|
3638 | value: true
|
3639 | });
|
3640 | function returnFalse() {
|
3641 | return false;
|
3642 | }
|
3643 |
|
3644 | function returnTrue() {
|
3645 | return true;
|
3646 | }
|
3647 |
|
3648 | function EventBaseObject() {
|
3649 | this.timeStamp = Date.now();
|
3650 | this.target = undefined;
|
3651 | this.currentTarget = undefined;
|
3652 | }
|
3653 |
|
3654 | EventBaseObject.prototype = {
|
3655 | isEventObject: 1,
|
3656 |
|
3657 | constructor: EventBaseObject,
|
3658 |
|
3659 | isDefaultPrevented: returnFalse,
|
3660 |
|
3661 | isPropagationStopped: returnFalse,
|
3662 |
|
3663 | isImmediatePropagationStopped: returnFalse,
|
3664 |
|
3665 | preventDefault: function preventDefault() {
|
3666 | this.isDefaultPrevented = returnTrue;
|
3667 | },
|
3668 |
|
3669 | stopPropagation: function stopPropagation() {
|
3670 | this.isPropagationStopped = returnTrue;
|
3671 | },
|
3672 |
|
3673 | stopImmediatePropagation: function stopImmediatePropagation() {
|
3674 | this.isImmediatePropagationStopped = returnTrue;
|
3675 |
|
3676 |
|
3677 | this.stopPropagation();
|
3678 | },
|
3679 |
|
3680 | halt: function halt(immediate) {
|
3681 | if (immediate) {
|
3682 | this.stopImmediatePropagation();
|
3683 | } else {
|
3684 | this.stopPropagation();
|
3685 | }
|
3686 | this.preventDefault();
|
3687 | }
|
3688 | };
|
3689 |
|
3690 | exports["default"] = EventBaseObject;
|
3691 | module.exports = exports["default"];
|
3692 |
|
3693 | }),
|
3694 |
|
3695 | (function(module, exports) {
|
3696 |
|
3697 | |
3698 |
|
3699 |
|
3700 |
|
3701 |
|
3702 |
|
3703 | 'use strict';
|
3704 |
|
3705 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
3706 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
3707 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
3708 |
|
3709 | function toObject(val) {
|
3710 | if (val === null || val === undefined) {
|
3711 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
3712 | }
|
3713 |
|
3714 | return Object(val);
|
3715 | }
|
3716 |
|
3717 | function shouldUseNative() {
|
3718 | try {
|
3719 | if (!Object.assign) {
|
3720 | return false;
|
3721 | }
|
3722 |
|
3723 |
|
3724 |
|
3725 |
|
3726 | var test1 = new String('abc');
|
3727 | test1[5] = 'de';
|
3728 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
3729 | return false;
|
3730 | }
|
3731 |
|
3732 |
|
3733 | var test2 = {};
|
3734 | for (var i = 0; i < 10; i++) {
|
3735 | test2['_' + String.fromCharCode(i)] = i;
|
3736 | }
|
3737 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
3738 | return test2[n];
|
3739 | });
|
3740 | if (order2.join('') !== '0123456789') {
|
3741 | return false;
|
3742 | }
|
3743 |
|
3744 |
|
3745 | var test3 = {};
|
3746 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
3747 | test3[letter] = letter;
|
3748 | });
|
3749 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
3750 | 'abcdefghijklmnopqrst') {
|
3751 | return false;
|
3752 | }
|
3753 |
|
3754 | return true;
|
3755 | } catch (err) {
|
3756 |
|
3757 | return false;
|
3758 | }
|
3759 | }
|
3760 |
|
3761 | module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
3762 | var from;
|
3763 | var to = toObject(target);
|
3764 | var symbols;
|
3765 |
|
3766 | for (var s = 1; s < arguments.length; s++) {
|
3767 | from = Object(arguments[s]);
|
3768 |
|
3769 | for (var key in from) {
|
3770 | if (hasOwnProperty.call(from, key)) {
|
3771 | to[key] = from[key];
|
3772 | }
|
3773 | }
|
3774 |
|
3775 | if (getOwnPropertySymbols) {
|
3776 | symbols = getOwnPropertySymbols(from);
|
3777 | for (var i = 0; i < symbols.length; i++) {
|
3778 | if (propIsEnumerable.call(from, symbols[i])) {
|
3779 | to[symbols[i]] = from[symbols[i]];
|
3780 | }
|
3781 | }
|
3782 | }
|
3783 | }
|
3784 |
|
3785 | return to;
|
3786 | };
|
3787 |
|
3788 |
|
3789 | }),
|
3790 |
|
3791 | (function(module, exports, __webpack_require__) {
|
3792 |
|
3793 | 'use strict';
|
3794 |
|
3795 | exports.__esModule = true;
|
3796 |
|
3797 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
3798 |
|
3799 |
|
3800 |
|
3801 |
|
3802 |
|
3803 | var _Event = __webpack_require__(46);
|
3804 |
|
3805 | var _Event2 = _interopRequireDefault(_Event);
|
3806 |
|
3807 | var _componentClasses = __webpack_require__(47);
|
3808 |
|
3809 | var _componentClasses2 = _interopRequireDefault(_componentClasses);
|
3810 |
|
3811 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3812 |
|
3813 | var isCssAnimationSupported = _Event2.default.endEvents.length !== 0;
|
3814 |
|
3815 |
|
3816 | var capitalPrefixes = ['Webkit', 'Moz', 'O',
|
3817 |
|
3818 | 'ms'];
|
3819 | var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];
|
3820 |
|
3821 | function getStyleProperty(node, name) {
|
3822 | var style = window.getComputedStyle(node);
|
3823 |
|
3824 | var ret = '';
|
3825 | for (var i = 0; i < prefixes.length; i++) {
|
3826 | ret = style.getPropertyValue(prefixes[i] + name);
|
3827 | if (ret) {
|
3828 | break;
|
3829 | }
|
3830 | }
|
3831 | return ret;
|
3832 | }
|
3833 |
|
3834 | function fixBrowserByTimeout(node) {
|
3835 | if (isCssAnimationSupported) {
|
3836 | var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0;
|
3837 | var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0;
|
3838 | var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0;
|
3839 | var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0;
|
3840 | var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay);
|
3841 |
|
3842 | node.rcEndAnimTimeout = setTimeout(function () {
|
3843 | node.rcEndAnimTimeout = null;
|
3844 | if (node.rcEndListener) {
|
3845 | node.rcEndListener();
|
3846 | }
|
3847 | }, time * 1000 + 200);
|
3848 | }
|
3849 | }
|
3850 |
|
3851 | function clearBrowserBugTimeout(node) {
|
3852 | if (node.rcEndAnimTimeout) {
|
3853 | clearTimeout(node.rcEndAnimTimeout);
|
3854 | node.rcEndAnimTimeout = null;
|
3855 | }
|
3856 | }
|
3857 |
|
3858 | var cssAnimation = function cssAnimation(node, transitionName, endCallback) {
|
3859 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
|
3860 | var className = nameIsObj ? transitionName.name : transitionName;
|
3861 | var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active';
|
3862 | var end = endCallback;
|
3863 | var start = void 0;
|
3864 | var active = void 0;
|
3865 | var nodeClasses = (0, _componentClasses2.default)(node);
|
3866 |
|
3867 | if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') {
|
3868 | end = endCallback.end;
|
3869 | start = endCallback.start;
|
3870 | active = endCallback.active;
|
3871 | }
|
3872 |
|
3873 | if (node.rcEndListener) {
|
3874 | node.rcEndListener();
|
3875 | }
|
3876 |
|
3877 | node.rcEndListener = function (e) {
|
3878 | if (e && e.target !== node) {
|
3879 | return;
|
3880 | }
|
3881 |
|
3882 | if (node.rcAnimTimeout) {
|
3883 | clearTimeout(node.rcAnimTimeout);
|
3884 | node.rcAnimTimeout = null;
|
3885 | }
|
3886 |
|
3887 | clearBrowserBugTimeout(node);
|
3888 |
|
3889 | nodeClasses.remove(className);
|
3890 | nodeClasses.remove(activeClassName);
|
3891 |
|
3892 | _Event2.default.removeEndEventListener(node, node.rcEndListener);
|
3893 | node.rcEndListener = null;
|
3894 |
|
3895 |
|
3896 |
|
3897 | if (end) {
|
3898 | end();
|
3899 | }
|
3900 | };
|
3901 |
|
3902 | _Event2.default.addEndEventListener(node, node.rcEndListener);
|
3903 |
|
3904 | if (start) {
|
3905 | start();
|
3906 | }
|
3907 | nodeClasses.add(className);
|
3908 |
|
3909 | node.rcAnimTimeout = setTimeout(function () {
|
3910 | node.rcAnimTimeout = null;
|
3911 | nodeClasses.add(activeClassName);
|
3912 | if (active) {
|
3913 | setTimeout(active, 0);
|
3914 | }
|
3915 | fixBrowserByTimeout(node);
|
3916 |
|
3917 | }, 30);
|
3918 |
|
3919 | return {
|
3920 | stop: function stop() {
|
3921 | if (node.rcEndListener) {
|
3922 | node.rcEndListener();
|
3923 | }
|
3924 | }
|
3925 | };
|
3926 | };
|
3927 |
|
3928 | cssAnimation.style = function (node, style, callback) {
|
3929 | if (node.rcEndListener) {
|
3930 | node.rcEndListener();
|
3931 | }
|
3932 |
|
3933 | node.rcEndListener = function (e) {
|
3934 | if (e && e.target !== node) {
|
3935 | return;
|
3936 | }
|
3937 |
|
3938 | if (node.rcAnimTimeout) {
|
3939 | clearTimeout(node.rcAnimTimeout);
|
3940 | node.rcAnimTimeout = null;
|
3941 | }
|
3942 |
|
3943 | clearBrowserBugTimeout(node);
|
3944 |
|
3945 | _Event2.default.removeEndEventListener(node, node.rcEndListener);
|
3946 | node.rcEndListener = null;
|
3947 |
|
3948 |
|
3949 |
|
3950 | if (callback) {
|
3951 | callback();
|
3952 | }
|
3953 | };
|
3954 |
|
3955 | _Event2.default.addEndEventListener(node, node.rcEndListener);
|
3956 |
|
3957 | node.rcAnimTimeout = setTimeout(function () {
|
3958 | for (var s in style) {
|
3959 | if (style.hasOwnProperty(s)) {
|
3960 | node.style[s] = style[s];
|
3961 | }
|
3962 | }
|
3963 | node.rcAnimTimeout = null;
|
3964 | fixBrowserByTimeout(node);
|
3965 | }, 0);
|
3966 | };
|
3967 |
|
3968 | cssAnimation.setTransition = function (node, p, value) {
|
3969 | var property = p;
|
3970 | var v = value;
|
3971 | if (value === undefined) {
|
3972 | v = property;
|
3973 | property = '';
|
3974 | }
|
3975 | property = property || '';
|
3976 | capitalPrefixes.forEach(function (prefix) {
|
3977 | node.style[prefix + 'Transition' + property] = v;
|
3978 | });
|
3979 | };
|
3980 |
|
3981 | cssAnimation.isCssAnimationSupported = isCssAnimationSupported;
|
3982 |
|
3983 | exports.default = cssAnimation;
|
3984 |
|
3985 | }),
|
3986 |
|
3987 | (function(module, exports) {
|
3988 |
|
3989 | 'use strict';
|
3990 |
|
3991 | exports.__esModule = true;
|
3992 | |
3993 |
|
3994 |
|
3995 |
|
3996 | var EVENT_NAME_MAP = {
|
3997 | transitionend: {
|
3998 | transition: 'transitionend',
|
3999 | WebkitTransition: 'webkitTransitionEnd',
|
4000 | MozTransition: 'mozTransitionEnd',
|
4001 | OTransition: 'oTransitionEnd',
|
4002 | msTransition: 'MSTransitionEnd'
|
4003 | },
|
4004 |
|
4005 | animationend: {
|
4006 | animation: 'animationend',
|
4007 | WebkitAnimation: 'webkitAnimationEnd',
|
4008 | MozAnimation: 'mozAnimationEnd',
|
4009 | OAnimation: 'oAnimationEnd',
|
4010 | msAnimation: 'MSAnimationEnd'
|
4011 | }
|
4012 | };
|
4013 |
|
4014 | var endEvents = [];
|
4015 |
|
4016 | function detectEvents() {
|
4017 | var testEl = document.createElement('div');
|
4018 | var style = testEl.style;
|
4019 |
|
4020 | if (!('AnimationEvent' in window)) {
|
4021 | delete EVENT_NAME_MAP.animationend.animation;
|
4022 | }
|
4023 |
|
4024 | if (!('TransitionEvent' in window)) {
|
4025 | delete EVENT_NAME_MAP.transitionend.transition;
|
4026 | }
|
4027 |
|
4028 | for (var baseEventName in EVENT_NAME_MAP) {
|
4029 | if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
|
4030 | var baseEvents = EVENT_NAME_MAP[baseEventName];
|
4031 | for (var styleName in baseEvents) {
|
4032 | if (styleName in style) {
|
4033 | endEvents.push(baseEvents[styleName]);
|
4034 | break;
|
4035 | }
|
4036 | }
|
4037 | }
|
4038 | }
|
4039 | }
|
4040 |
|
4041 | if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
4042 | detectEvents();
|
4043 | }
|
4044 |
|
4045 | function addEventListener(node, eventName, eventListener) {
|
4046 | node.addEventListener(eventName, eventListener, false);
|
4047 | }
|
4048 |
|
4049 | function removeEventListener(node, eventName, eventListener) {
|
4050 | node.removeEventListener(eventName, eventListener, false);
|
4051 | }
|
4052 |
|
4053 | var TransitionEvents = {
|
4054 | addEndEventListener: function addEndEventListener(node, eventListener) {
|
4055 | if (endEvents.length === 0) {
|
4056 | window.setTimeout(eventListener, 0);
|
4057 | return;
|
4058 | }
|
4059 | endEvents.forEach(function (endEvent) {
|
4060 | addEventListener(node, endEvent, eventListener);
|
4061 | });
|
4062 | },
|
4063 |
|
4064 |
|
4065 | endEvents: endEvents,
|
4066 |
|
4067 | removeEndEventListener: function removeEndEventListener(node, eventListener) {
|
4068 | if (endEvents.length === 0) {
|
4069 | return;
|
4070 | }
|
4071 | endEvents.forEach(function (endEvent) {
|
4072 | removeEventListener(node, endEvent, eventListener);
|
4073 | });
|
4074 | }
|
4075 | };
|
4076 |
|
4077 | exports.default = TransitionEvents;
|
4078 |
|
4079 | }),
|
4080 |
|
4081 | (function(module, exports, __webpack_require__) {
|
4082 |
|
4083 | |
4084 |
|
4085 |
|
4086 |
|
4087 | try {
|
4088 | var index = __webpack_require__(48);
|
4089 | } catch (err) {
|
4090 | var index = __webpack_require__(48);
|
4091 | }
|
4092 |
|
4093 | |
4094 |
|
4095 |
|
4096 |
|
4097 | var re = /\s+/;
|
4098 |
|
4099 | |
4100 |
|
4101 |
|
4102 |
|
4103 | var toString = Object.prototype.toString;
|
4104 |
|
4105 | |
4106 |
|
4107 |
|
4108 |
|
4109 |
|
4110 |
|
4111 |
|
4112 |
|
4113 | module.exports = function(el){
|
4114 | return new ClassList(el);
|
4115 | };
|
4116 |
|
4117 | |
4118 |
|
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 | function ClassList(el) {
|
4125 | if (!el || !el.nodeType) {
|
4126 | throw new Error('A DOM element reference is required');
|
4127 | }
|
4128 | this.el = el;
|
4129 | this.list = el.classList;
|
4130 | }
|
4131 |
|
4132 | |
4133 |
|
4134 |
|
4135 |
|
4136 |
|
4137 |
|
4138 |
|
4139 |
|
4140 | ClassList.prototype.add = function(name){
|
4141 |
|
4142 | if (this.list) {
|
4143 | this.list.add(name);
|
4144 | return this;
|
4145 | }
|
4146 |
|
4147 |
|
4148 | var arr = this.array();
|
4149 | var i = index(arr, name);
|
4150 | if (!~i) arr.push(name);
|
4151 | this.el.className = arr.join(' ');
|
4152 | return this;
|
4153 | };
|
4154 |
|
4155 | |
4156 |
|
4157 |
|
4158 |
|
4159 |
|
4160 |
|
4161 |
|
4162 |
|
4163 |
|
4164 |
|
4165 | ClassList.prototype.remove = function(name){
|
4166 | if ('[object RegExp]' == toString.call(name)) {
|
4167 | return this.removeMatching(name);
|
4168 | }
|
4169 |
|
4170 |
|
4171 | if (this.list) {
|
4172 | this.list.remove(name);
|
4173 | return this;
|
4174 | }
|
4175 |
|
4176 |
|
4177 | var arr = this.array();
|
4178 | var i = index(arr, name);
|
4179 | if (~i) arr.splice(i, 1);
|
4180 | this.el.className = arr.join(' ');
|
4181 | return this;
|
4182 | };
|
4183 |
|
4184 | |
4185 |
|
4186 |
|
4187 |
|
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 | ClassList.prototype.removeMatching = function(re){
|
4193 | var arr = this.array();
|
4194 | for (var i = 0; i < arr.length; i++) {
|
4195 | if (re.test(arr[i])) {
|
4196 | this.remove(arr[i]);
|
4197 | }
|
4198 | }
|
4199 | return this;
|
4200 | };
|
4201 |
|
4202 | |
4203 |
|
4204 |
|
4205 |
|
4206 |
|
4207 |
|
4208 |
|
4209 |
|
4210 |
|
4211 |
|
4212 |
|
4213 |
|
4214 | ClassList.prototype.toggle = function(name, force){
|
4215 |
|
4216 | if (this.list) {
|
4217 | if ("undefined" !== typeof force) {
|
4218 | if (force !== this.list.toggle(name, force)) {
|
4219 | this.list.toggle(name);
|
4220 | }
|
4221 | } else {
|
4222 | this.list.toggle(name);
|
4223 | }
|
4224 | return this;
|
4225 | }
|
4226 |
|
4227 |
|
4228 | if ("undefined" !== typeof force) {
|
4229 | if (!force) {
|
4230 | this.remove(name);
|
4231 | } else {
|
4232 | this.add(name);
|
4233 | }
|
4234 | } else {
|
4235 | if (this.has(name)) {
|
4236 | this.remove(name);
|
4237 | } else {
|
4238 | this.add(name);
|
4239 | }
|
4240 | }
|
4241 |
|
4242 | return this;
|
4243 | };
|
4244 |
|
4245 | |
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 |
|
4252 | ClassList.prototype.array = function(){
|
4253 | var className = this.el.getAttribute('class') || '';
|
4254 | var str = className.replace(/^\s+|\s+$/g, '');
|
4255 | var arr = str.split(re);
|
4256 | if ('' === arr[0]) arr.shift();
|
4257 | return arr;
|
4258 | };
|
4259 |
|
4260 | |
4261 |
|
4262 |
|
4263 |
|
4264 |
|
4265 |
|
4266 |
|
4267 |
|
4268 | ClassList.prototype.has =
|
4269 | ClassList.prototype.contains = function(name){
|
4270 | return this.list
|
4271 | ? this.list.contains(name)
|
4272 | : !! ~index(this.array(), name);
|
4273 | };
|
4274 |
|
4275 |
|
4276 | }),
|
4277 |
|
4278 | (function(module, exports) {
|
4279 |
|
4280 | module.exports = function(arr, obj){
|
4281 | if (arr.indexOf) return arr.indexOf(obj);
|
4282 | for (var i = 0; i < arr.length; ++i) {
|
4283 | if (arr[i] === obj) return i;
|
4284 | }
|
4285 | return -1;
|
4286 | };
|
4287 |
|
4288 | }),
|
4289 |
|
4290 | (function(module, exports, __webpack_require__) {
|
4291 |
|
4292 | 'use strict';
|
4293 |
|
4294 | exports.__esModule = true;
|
4295 | exports.default = toArray;
|
4296 |
|
4297 | var _react = __webpack_require__(1);
|
4298 |
|
4299 | var _react2 = _interopRequireDefault(_react);
|
4300 |
|
4301 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4302 |
|
4303 | function toArray(children) {
|
4304 | var ret = [];
|
4305 | _react2.default.Children.forEach(children, function (c) {
|
4306 | ret.push(c);
|
4307 | });
|
4308 | return ret;
|
4309 | } |
4310 |
|
4311 |
|
4312 |
|
4313 |
|
4314 | }),
|
4315 |
|
4316 | (function(module, exports, __webpack_require__) {
|
4317 |
|
4318 | 'use strict';
|
4319 |
|
4320 | exports.__esModule = true;
|
4321 |
|
4322 | var _react = __webpack_require__(1);
|
4323 |
|
4324 | var _react2 = _interopRequireDefault(_react);
|
4325 |
|
4326 | var _propTypes = __webpack_require__(6);
|
4327 |
|
4328 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
4329 |
|
4330 | var _reactDom = __webpack_require__(2);
|
4331 |
|
4332 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
4333 |
|
4334 | var _domAlign = __webpack_require__(51);
|
4335 |
|
4336 | var _domAlign2 = _interopRequireDefault(_domAlign);
|
4337 |
|
4338 | var _addEventListener = __webpack_require__(40);
|
4339 |
|
4340 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
4341 |
|
4342 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4343 |
|
4344 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
4345 |
|
4346 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
4347 |
|
4348 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } |
4349 |
|
4350 |
|
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 | function isWindow(obj) {
|
4357 |
|
4358 |
|
4359 | return obj != null && obj == obj.window;
|
4360 | }
|
4361 |
|
4362 | function buffer(fn, ms) {
|
4363 | var timer = void 0;
|
4364 |
|
4365 | function clear() {
|
4366 | if (timer) {
|
4367 | clearTimeout(timer);
|
4368 | timer = null;
|
4369 | }
|
4370 | }
|
4371 |
|
4372 | function bufferFn() {
|
4373 | clear();
|
4374 | timer = setTimeout(fn, ms);
|
4375 | }
|
4376 |
|
4377 | bufferFn.clear = clear;
|
4378 |
|
4379 | return bufferFn;
|
4380 | }
|
4381 |
|
4382 | var propTypes = {
|
4383 | childrenProps: _propTypes2.default.object,
|
4384 | align: _propTypes2.default.object.isRequired,
|
4385 | target: _propTypes2.default.func,
|
4386 | onAlign: _propTypes2.default.func,
|
4387 | monitorBufferTime: _propTypes2.default.number,
|
4388 | monitorWindowResize: _propTypes2.default.bool,
|
4389 | disabled: _propTypes2.default.bool,
|
4390 | children: _propTypes2.default.any
|
4391 | };
|
4392 |
|
4393 | var defaultProps = {
|
4394 | target: function target() {
|
4395 | return window;
|
4396 | },
|
4397 | onAlign: function onAlign() {},
|
4398 |
|
4399 | monitorBufferTime: 50,
|
4400 | monitorWindowResize: false,
|
4401 | disabled: false
|
4402 | };
|
4403 |
|
4404 | var Align = function (_React$Component) {
|
4405 | _inherits(Align, _React$Component);
|
4406 |
|
4407 | function Align(props) {
|
4408 | _classCallCheck(this, Align);
|
4409 |
|
4410 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
4411 |
|
4412 | _initialiseProps.call(_this);
|
4413 |
|
4414 | return _this;
|
4415 | }
|
4416 |
|
4417 | Align.prototype.componentDidMount = function componentDidMount() {
|
4418 | var props = this.props;
|
4419 |
|
4420 | this.forceAlign();
|
4421 | if (!props.disabled && props.monitorWindowResize) {
|
4422 | this.startMonitorWindowResize();
|
4423 | }
|
4424 | };
|
4425 |
|
4426 | Align.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
4427 | var reAlign = false;
|
4428 | var props = this.props;
|
4429 |
|
4430 | if (!props.disabled) {
|
4431 | if (prevProps.disabled || prevProps.align !== props.align) {
|
4432 | reAlign = true;
|
4433 | } else {
|
4434 | var lastTarget = prevProps.target();
|
4435 | var currentTarget = props.target();
|
4436 | if (isWindow(lastTarget) && isWindow(currentTarget)) {
|
4437 | reAlign = false;
|
4438 | } else if (lastTarget !== currentTarget) {
|
4439 | reAlign = true;
|
4440 | }
|
4441 | }
|
4442 | }
|
4443 |
|
4444 | if (reAlign) {
|
4445 | this.forceAlign();
|
4446 | }
|
4447 |
|
4448 | if (props.monitorWindowResize && !props.disabled) {
|
4449 | this.startMonitorWindowResize();
|
4450 | } else {
|
4451 | this.stopMonitorWindowResize();
|
4452 | }
|
4453 | };
|
4454 |
|
4455 | Align.prototype.componentWillUnmount = function componentWillUnmount() {
|
4456 | this.stopMonitorWindowResize();
|
4457 | };
|
4458 |
|
4459 | Align.prototype.render = function render() {
|
4460 | var _props = this.props,
|
4461 | childrenProps = _props.childrenProps,
|
4462 | children = _props.children;
|
4463 |
|
4464 | var child = _react2.default.Children.only(children);
|
4465 | if (childrenProps) {
|
4466 | var newProps = {};
|
4467 | for (var prop in childrenProps) {
|
4468 | if (childrenProps.hasOwnProperty(prop)) {
|
4469 | newProps[prop] = this.props[childrenProps[prop]];
|
4470 | }
|
4471 | }
|
4472 | return _react2.default.cloneElement(child, newProps);
|
4473 | }
|
4474 | return child;
|
4475 | };
|
4476 |
|
4477 | return Align;
|
4478 | }(_react2.default.Component);
|
4479 |
|
4480 | var _initialiseProps = function _initialiseProps() {
|
4481 | var _this2 = this;
|
4482 |
|
4483 | this.startMonitorWindowResize = function () {
|
4484 | if (!_this2.resizeHandler) {
|
4485 | _this2.bufferMonitor = buffer(_this2.forceAlign, _this2.props.monitorBufferTime);
|
4486 | _this2.resizeHandler = (0, _addEventListener2.default)(window, 'resize', _this2.bufferMonitor);
|
4487 | }
|
4488 | };
|
4489 |
|
4490 | this.stopMonitorWindowResize = function () {
|
4491 | if (_this2.resizeHandler) {
|
4492 | _this2.bufferMonitor.clear();
|
4493 | _this2.resizeHandler.remove();
|
4494 | _this2.resizeHandler = null;
|
4495 | }
|
4496 | };
|
4497 |
|
4498 | this.forceAlign = function () {
|
4499 | var props = _this2.props;
|
4500 | if (!props.disabled) {
|
4501 | var source = _reactDom2.default.findDOMNode(_this2);
|
4502 | props.onAlign(source, (0, _domAlign2.default)(source, props.target(), props.align));
|
4503 | }
|
4504 | };
|
4505 | };
|
4506 |
|
4507 | ;
|
4508 |
|
4509 | Align.defaultProps = defaultProps;
|
4510 | Align.propTypes = propTypes;
|
4511 |
|
4512 | exports.default = Align;
|
4513 |
|
4514 | }),
|
4515 |
|
4516 | (function(module, exports, __webpack_require__) {
|
4517 |
|
4518 | 'use strict';
|
4519 |
|
4520 | Object.defineProperty(exports, "__esModule", {
|
4521 | value: true
|
4522 | });
|
4523 | exports.alignPoint = exports.alignElement = undefined;
|
4524 |
|
4525 | var _alignElement = __webpack_require__(52);
|
4526 |
|
4527 | var _alignElement2 = _interopRequireDefault(_alignElement);
|
4528 |
|
4529 | var _alignPoint = __webpack_require__(63);
|
4530 |
|
4531 | var _alignPoint2 = _interopRequireDefault(_alignPoint);
|
4532 |
|
4533 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4534 |
|
4535 | exports.alignElement = _alignElement2['default'];
|
4536 | exports.alignPoint = _alignPoint2['default'];
|
4537 | exports['default'] = _alignElement2['default'];
|
4538 |
|
4539 | }),
|
4540 |
|
4541 | (function(module, exports, __webpack_require__) {
|
4542 |
|
4543 | 'use strict';
|
4544 |
|
4545 | Object.defineProperty(exports, "__esModule", {
|
4546 | value: true
|
4547 | });
|
4548 |
|
4549 | var _align = __webpack_require__(53);
|
4550 |
|
4551 | var _align2 = _interopRequireDefault(_align);
|
4552 |
|
4553 | var _getOffsetParent = __webpack_require__(57);
|
4554 |
|
4555 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
|
4556 |
|
4557 | var _getVisibleRectForElement = __webpack_require__(56);
|
4558 |
|
4559 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
|
4560 |
|
4561 | var _getRegion = __webpack_require__(60);
|
4562 |
|
4563 | var _getRegion2 = _interopRequireDefault(_getRegion);
|
4564 |
|
4565 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4566 |
|
4567 | function isOutOfVisibleRect(target) {
|
4568 | var visibleRect = (0, _getVisibleRectForElement2['default'])(target);
|
4569 | var targetRegion = (0, _getRegion2['default'])(target);
|
4570 |
|
4571 | return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom;
|
4572 | }
|
4573 |
|
4574 | function alignElement(el, refNode, align) {
|
4575 | var target = align.target || refNode;
|
4576 | var refNodeRegion = (0, _getRegion2['default'])(target);
|
4577 |
|
4578 | var isTargetNotOutOfVisible = !isOutOfVisibleRect(target);
|
4579 |
|
4580 | return (0, _align2['default'])(el, refNodeRegion, align, isTargetNotOutOfVisible);
|
4581 | }
|
4582 |
|
4583 | alignElement.__getOffsetParent = _getOffsetParent2['default'];
|
4584 |
|
4585 | alignElement.__getVisibleRectForElement = _getVisibleRectForElement2['default'];
|
4586 |
|
4587 | exports['default'] = alignElement;
|
4588 | module.exports = exports['default'];
|
4589 |
|
4590 | }),
|
4591 |
|
4592 | (function(module, exports, __webpack_require__) {
|
4593 |
|
4594 | 'use strict';
|
4595 |
|
4596 | Object.defineProperty(exports, "__esModule", {
|
4597 | value: true
|
4598 | });
|
4599 |
|
4600 | var _utils = __webpack_require__(54);
|
4601 |
|
4602 | var _utils2 = _interopRequireDefault(_utils);
|
4603 |
|
4604 | var _getVisibleRectForElement = __webpack_require__(56);
|
4605 |
|
4606 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
|
4607 |
|
4608 | var _adjustForViewport = __webpack_require__(59);
|
4609 |
|
4610 | var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport);
|
4611 |
|
4612 | var _getRegion = __webpack_require__(60);
|
4613 |
|
4614 | var _getRegion2 = _interopRequireDefault(_getRegion);
|
4615 |
|
4616 | var _getElFuturePos = __webpack_require__(61);
|
4617 |
|
4618 | var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos);
|
4619 |
|
4620 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
4621 |
|
4622 |
|
4623 |
|
4624 | function isFailX(elFuturePos, elRegion, visibleRect) {
|
4625 | return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;
|
4626 | } |
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 | function isFailY(elFuturePos, elRegion, visibleRect) {
|
4632 | return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom;
|
4633 | }
|
4634 |
|
4635 | function isCompleteFailX(elFuturePos, elRegion, visibleRect) {
|
4636 | return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;
|
4637 | }
|
4638 |
|
4639 | function isCompleteFailY(elFuturePos, elRegion, visibleRect) {
|
4640 | return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;
|
4641 | }
|
4642 |
|
4643 | function flip(points, reg, map) {
|
4644 | var ret = [];
|
4645 | _utils2['default'].each(points, function (p) {
|
4646 | ret.push(p.replace(reg, function (m) {
|
4647 | return map[m];
|
4648 | }));
|
4649 | });
|
4650 | return ret;
|
4651 | }
|
4652 |
|
4653 | function flipOffset(offset, index) {
|
4654 | offset[index] = -offset[index];
|
4655 | return offset;
|
4656 | }
|
4657 |
|
4658 | function convertOffset(str, offsetLen) {
|
4659 | var n = void 0;
|
4660 | if (/%$/.test(str)) {
|
4661 | n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen;
|
4662 | } else {
|
4663 | n = parseInt(str, 10);
|
4664 | }
|
4665 | return n || 0;
|
4666 | }
|
4667 |
|
4668 | function normalizeOffset(offset, el) {
|
4669 | offset[0] = convertOffset(offset[0], el.width);
|
4670 | offset[1] = convertOffset(offset[1], el.height);
|
4671 | }
|
4672 |
|
4673 | |
4674 |
|
4675 |
|
4676 |
|
4677 |
|
4678 | function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
4679 | var points = align.points;
|
4680 | var offset = align.offset || [0, 0];
|
4681 | var targetOffset = align.targetOffset || [0, 0];
|
4682 | var overflow = align.overflow;
|
4683 | var source = align.source || el;
|
4684 | offset = [].concat(offset);
|
4685 | targetOffset = [].concat(targetOffset);
|
4686 | overflow = overflow || {};
|
4687 | var newOverflowCfg = {};
|
4688 | var fail = 0;
|
4689 |
|
4690 | var visibleRect = (0, _getVisibleRectForElement2['default'])(source);
|
4691 |
|
4692 | var elRegion = (0, _getRegion2['default'])(source);
|
4693 |
|
4694 | normalizeOffset(offset, elRegion);
|
4695 | normalizeOffset(targetOffset, tgtRegion);
|
4696 |
|
4697 | var elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
|
4698 |
|
4699 | var newElRegion = _utils2['default'].merge(elRegion, elFuturePos);
|
4700 |
|
4701 |
|
4702 | if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTgtRegionVisible) {
|
4703 | if (overflow.adjustX) {
|
4704 |
|
4705 | if (isFailX(elFuturePos, elRegion, visibleRect)) {
|
4706 |
|
4707 | var newPoints = flip(points, /[lr]/ig, {
|
4708 | l: 'r',
|
4709 | r: 'l'
|
4710 | });
|
4711 |
|
4712 | var newOffset = flipOffset(offset, 0);
|
4713 | var newTargetOffset = flipOffset(targetOffset, 0);
|
4714 | var newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, newPoints, newOffset, newTargetOffset);
|
4715 |
|
4716 | if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {
|
4717 | fail = 1;
|
4718 | points = newPoints;
|
4719 | offset = newOffset;
|
4720 | targetOffset = newTargetOffset;
|
4721 | }
|
4722 | }
|
4723 | }
|
4724 |
|
4725 | if (overflow.adjustY) {
|
4726 |
|
4727 | if (isFailY(elFuturePos, elRegion, visibleRect)) {
|
4728 |
|
4729 | var _newPoints = flip(points, /[tb]/ig, {
|
4730 | t: 'b',
|
4731 | b: 't'
|
4732 | });
|
4733 |
|
4734 | var _newOffset = flipOffset(offset, 1);
|
4735 | var _newTargetOffset = flipOffset(targetOffset, 1);
|
4736 | var _newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, _newPoints, _newOffset, _newTargetOffset);
|
4737 |
|
4738 | if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) {
|
4739 | fail = 1;
|
4740 | points = _newPoints;
|
4741 | offset = _newOffset;
|
4742 | targetOffset = _newTargetOffset;
|
4743 | }
|
4744 | }
|
4745 | }
|
4746 |
|
4747 |
|
4748 | if (fail) {
|
4749 | elFuturePos = (0, _getElFuturePos2['default'])(elRegion, tgtRegion, points, offset, targetOffset);
|
4750 | _utils2['default'].mix(newElRegion, elFuturePos);
|
4751 | }
|
4752 | var isStillFailX = isFailX(elFuturePos, elRegion, visibleRect);
|
4753 | var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect);
|
4754 |
|
4755 |
|
4756 | if (isStillFailX || isStillFailY) {
|
4757 | points = align.points;
|
4758 | offset = align.offset || [0, 0];
|
4759 | targetOffset = align.targetOffset || [0, 0];
|
4760 | }
|
4761 |
|
4762 | newOverflowCfg.adjustX = overflow.adjustX && isStillFailX;
|
4763 | newOverflowCfg.adjustY = overflow.adjustY && isStillFailY;
|
4764 |
|
4765 |
|
4766 | if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) {
|
4767 | newElRegion = (0, _adjustForViewport2['default'])(elFuturePos, elRegion, visibleRect, newOverflowCfg);
|
4768 | }
|
4769 | }
|
4770 |
|
4771 |
|
4772 | if (newElRegion.width !== elRegion.width) {
|
4773 | _utils2['default'].css(source, 'width', _utils2['default'].width(source) + newElRegion.width - elRegion.width);
|
4774 | }
|
4775 |
|
4776 | if (newElRegion.height !== elRegion.height) {
|
4777 | _utils2['default'].css(source, 'height', _utils2['default'].height(source) + newElRegion.height - elRegion.height);
|
4778 | }
|
4779 |
|
4780 |
|
4781 |
|
4782 |
|
4783 | _utils2['default'].offset(source, {
|
4784 | left: newElRegion.left,
|
4785 | top: newElRegion.top
|
4786 | }, {
|
4787 | useCssRight: align.useCssRight,
|
4788 | useCssBottom: align.useCssBottom,
|
4789 | useCssTransform: align.useCssTransform,
|
4790 | ignoreShake: align.ignoreShake
|
4791 | });
|
4792 |
|
4793 | return {
|
4794 | points: points,
|
4795 | offset: offset,
|
4796 | targetOffset: targetOffset,
|
4797 | overflow: newOverflowCfg
|
4798 | };
|
4799 | }
|
4800 |
|
4801 | exports['default'] = doAlign;
|
4802 | |
4803 |
|
4804 |
|
4805 |
|
4806 |
|
4807 |
|
4808 |
|
4809 |
|
4810 |
|
4811 | module.exports = exports['default'];
|
4812 |
|
4813 | }),
|
4814 |
|
4815 | (function(module, exports, __webpack_require__) {
|
4816 |
|
4817 | 'use strict';
|
4818 |
|
4819 | Object.defineProperty(exports, "__esModule", {
|
4820 | value: true
|
4821 | });
|
4822 |
|
4823 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
4824 |
|
4825 | var _propertyUtils = __webpack_require__(55);
|
4826 |
|
4827 | var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
|
4828 |
|
4829 | var getComputedStyleX = void 0;
|
4830 |
|
4831 |
|
4832 | function forceRelayout(elem) {
|
4833 | var originalStyle = elem.style.display;
|
4834 | elem.style.display = 'none';
|
4835 | elem.offsetHeight;
|
4836 | elem.style.display = originalStyle;
|
4837 | }
|
4838 |
|
4839 | function css(el, name, v) {
|
4840 | var value = v;
|
4841 | if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
|
4842 | for (var i in name) {
|
4843 | if (name.hasOwnProperty(i)) {
|
4844 | css(el, i, name[i]);
|
4845 | }
|
4846 | }
|
4847 | return undefined;
|
4848 | }
|
4849 | if (typeof value !== 'undefined') {
|
4850 | if (typeof value === 'number') {
|
4851 | value = value + 'px';
|
4852 | }
|
4853 | el.style[name] = value;
|
4854 | return undefined;
|
4855 | }
|
4856 | return getComputedStyleX(el, name);
|
4857 | }
|
4858 |
|
4859 | function getClientPosition(elem) {
|
4860 | var box = void 0;
|
4861 | var x = void 0;
|
4862 | var y = void 0;
|
4863 | var doc = elem.ownerDocument;
|
4864 | var body = doc.body;
|
4865 | var docElem = doc && doc.documentElement;
|
4866 |
|
4867 | box = elem.getBoundingClientRect();
|
4868 |
|
4869 |
|
4870 |
|
4871 |
|
4872 |
|
4873 | x = box.left;
|
4874 | y = box.top;
|
4875 |
|
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 |
|
4884 |
|
4885 |
|
4886 |
|
4887 |
|
4888 |
|
4889 |
|
4890 |
|
4891 |
|
4892 |
|
4893 |
|
4894 |
|
4895 |
|
4896 | x -= docElem.clientLeft || body.clientLeft || 0;
|
4897 | y -= docElem.clientTop || body.clientTop || 0;
|
4898 |
|
4899 | return {
|
4900 | left: x,
|
4901 | top: y
|
4902 | };
|
4903 | }
|
4904 |
|
4905 | function getScroll(w, top) {
|
4906 | var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
|
4907 | var method = 'scroll' + (top ? 'Top' : 'Left');
|
4908 | if (typeof ret !== 'number') {
|
4909 | var d = w.document;
|
4910 |
|
4911 | ret = d.documentElement[method];
|
4912 | if (typeof ret !== 'number') {
|
4913 |
|
4914 | ret = d.body[method];
|
4915 | }
|
4916 | }
|
4917 | return ret;
|
4918 | }
|
4919 |
|
4920 | function getScrollLeft(w) {
|
4921 | return getScroll(w);
|
4922 | }
|
4923 |
|
4924 | function getScrollTop(w) {
|
4925 | return getScroll(w, true);
|
4926 | }
|
4927 |
|
4928 | function getOffset(el) {
|
4929 | var pos = getClientPosition(el);
|
4930 | var doc = el.ownerDocument;
|
4931 | var w = doc.defaultView || doc.parentWindow;
|
4932 | pos.left += getScrollLeft(w);
|
4933 | pos.top += getScrollTop(w);
|
4934 | return pos;
|
4935 | }
|
4936 |
|
4937 | |
4938 |
|
4939 |
|
4940 |
|
4941 | function isWindow(obj) {
|
4942 |
|
4943 |
|
4944 | return obj !== null && obj !== undefined && obj == obj.window;
|
4945 | }
|
4946 |
|
4947 | function getDocument(node) {
|
4948 | if (isWindow(node)) {
|
4949 | return node.document;
|
4950 | }
|
4951 | if (node.nodeType === 9) {
|
4952 | return node;
|
4953 | }
|
4954 | return node.ownerDocument;
|
4955 | }
|
4956 |
|
4957 | function _getComputedStyle(elem, name, cs) {
|
4958 | var computedStyle = cs;
|
4959 | var val = '';
|
4960 | var d = getDocument(elem);
|
4961 | computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null);
|
4962 |
|
4963 |
|
4964 | if (computedStyle) {
|
4965 | val = computedStyle.getPropertyValue(name) || computedStyle[name];
|
4966 | }
|
4967 |
|
4968 | return val;
|
4969 | }
|
4970 |
|
4971 | var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
|
4972 | var RE_POS = /^(top|right|bottom|left)$/;
|
4973 | var CURRENT_STYLE = 'currentStyle';
|
4974 | var RUNTIME_STYLE = 'runtimeStyle';
|
4975 | var LEFT = 'left';
|
4976 | var PX = 'px';
|
4977 |
|
4978 | function _getComputedStyleIE(elem, name) {
|
4979 |
|
4980 |
|
4981 | var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
|
4982 |
|
4983 |
|
4984 |
|
4985 |
|
4986 |
|
4987 |
|
4988 |
|
4989 |
|
4990 |
|
4991 |
|
4992 |
|
4993 | if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
|
4994 |
|
4995 | var style = elem.style;
|
4996 | var left = style[LEFT];
|
4997 | var rsLeft = elem[RUNTIME_STYLE][LEFT];
|
4998 |
|
4999 |
|
5000 | elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
|
5001 |
|
5002 |
|
5003 | style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
|
5004 | ret = style.pixelLeft + PX;
|
5005 |
|
5006 |
|
5007 | style[LEFT] = left;
|
5008 |
|
5009 | elem[RUNTIME_STYLE][LEFT] = rsLeft;
|
5010 | }
|
5011 | return ret === '' ? 'auto' : ret;
|
5012 | }
|
5013 |
|
5014 | if (typeof window !== 'undefined') {
|
5015 | getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
|
5016 | }
|
5017 |
|
5018 | function getOffsetDirection(dir, option) {
|
5019 | if (dir === 'left') {
|
5020 | return option.useCssRight ? 'right' : dir;
|
5021 | }
|
5022 | return option.useCssBottom ? 'bottom' : dir;
|
5023 | }
|
5024 |
|
5025 | function oppositeOffsetDirection(dir) {
|
5026 | if (dir === 'left') {
|
5027 | return 'right';
|
5028 | } else if (dir === 'right') {
|
5029 | return 'left';
|
5030 | } else if (dir === 'top') {
|
5031 | return 'bottom';
|
5032 | } else if (dir === 'bottom') {
|
5033 | return 'top';
|
5034 | }
|
5035 | }
|
5036 |
|
5037 |
|
5038 | function setLeftTop(elem, offset, option) {
|
5039 |
|
5040 | if (css(elem, 'position') === 'static') {
|
5041 | elem.style.position = 'relative';
|
5042 | }
|
5043 | var presetH = -999;
|
5044 | var presetV = -999;
|
5045 | var horizontalProperty = getOffsetDirection('left', option);
|
5046 | var verticalProperty = getOffsetDirection('top', option);
|
5047 | var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
|
5048 | var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);
|
5049 |
|
5050 | if (horizontalProperty !== 'left') {
|
5051 | presetH = 999;
|
5052 | }
|
5053 |
|
5054 | if (verticalProperty !== 'top') {
|
5055 | presetV = 999;
|
5056 | }
|
5057 | var originalTransition = '';
|
5058 | var originalOffset = getOffset(elem);
|
5059 | if ('left' in offset || 'top' in offset) {
|
5060 | originalTransition = (0, _propertyUtils.getTransitionProperty)(elem) || '';
|
5061 | (0, _propertyUtils.setTransitionProperty)(elem, 'none');
|
5062 | }
|
5063 | if ('left' in offset) {
|
5064 | elem.style[oppositeHorizontalProperty] = '';
|
5065 | elem.style[horizontalProperty] = presetH + 'px';
|
5066 | }
|
5067 | if ('top' in offset) {
|
5068 | elem.style[oppositeVerticalProperty] = '';
|
5069 | elem.style[verticalProperty] = presetV + 'px';
|
5070 | }
|
5071 |
|
5072 | forceRelayout(elem);
|
5073 | var old = getOffset(elem);
|
5074 | var originalStyle = {};
|
5075 | for (var key in offset) {
|
5076 | if (offset.hasOwnProperty(key)) {
|
5077 | var dir = getOffsetDirection(key, option);
|
5078 | var preset = key === 'left' ? presetH : presetV;
|
5079 | var off = originalOffset[key] - old[key];
|
5080 | if (dir === key) {
|
5081 | originalStyle[dir] = preset + off;
|
5082 | } else {
|
5083 | originalStyle[dir] = preset - off;
|
5084 | }
|
5085 | }
|
5086 | }
|
5087 | css(elem, originalStyle);
|
5088 |
|
5089 | forceRelayout(elem);
|
5090 | if ('left' in offset || 'top' in offset) {
|
5091 | (0, _propertyUtils.setTransitionProperty)(elem, originalTransition);
|
5092 | }
|
5093 | var ret = {};
|
5094 | for (var _key in offset) {
|
5095 | if (offset.hasOwnProperty(_key)) {
|
5096 | var _dir = getOffsetDirection(_key, option);
|
5097 | var _off = offset[_key] - originalOffset[_key];
|
5098 | if (_key === _dir) {
|
5099 | ret[_dir] = originalStyle[_dir] + _off;
|
5100 | } else {
|
5101 | ret[_dir] = originalStyle[_dir] - _off;
|
5102 | }
|
5103 | }
|
5104 | }
|
5105 | css(elem, ret);
|
5106 | }
|
5107 |
|
5108 | function setTransform(elem, offset) {
|
5109 | var originalOffset = getOffset(elem);
|
5110 | var originalXY = (0, _propertyUtils.getTransformXY)(elem);
|
5111 | var resultXY = { x: originalXY.x, y: originalXY.y };
|
5112 | if ('left' in offset) {
|
5113 | resultXY.x = originalXY.x + offset.left - originalOffset.left;
|
5114 | }
|
5115 | if ('top' in offset) {
|
5116 | resultXY.y = originalXY.y + offset.top - originalOffset.top;
|
5117 | }
|
5118 | (0, _propertyUtils.setTransformXY)(elem, resultXY);
|
5119 | }
|
5120 |
|
5121 | function setOffset(elem, offset, option) {
|
5122 | if (option.ignoreShake) {
|
5123 | var oriOffset = getOffset(elem);
|
5124 |
|
5125 | var oLeft = oriOffset.left.toFixed(0);
|
5126 | var oTop = oriOffset.top.toFixed(0);
|
5127 | var tLeft = offset.left.toFixed(0);
|
5128 | var tTop = offset.top.toFixed(0);
|
5129 |
|
5130 | if (oLeft === tLeft && oTop === tTop) {
|
5131 | return;
|
5132 | }
|
5133 | }
|
5134 |
|
5135 | if (option.useCssRight || option.useCssBottom) {
|
5136 | setLeftTop(elem, offset, option);
|
5137 | } else if (option.useCssTransform && (0, _propertyUtils.getTransformName)() in document.body.style) {
|
5138 | setTransform(elem, offset, option);
|
5139 | } else {
|
5140 | setLeftTop(elem, offset, option);
|
5141 | }
|
5142 | }
|
5143 |
|
5144 | function each(arr, fn) {
|
5145 | for (var i = 0; i < arr.length; i++) {
|
5146 | fn(arr[i]);
|
5147 | }
|
5148 | }
|
5149 |
|
5150 | function isBorderBoxFn(elem) {
|
5151 | return getComputedStyleX(elem, 'boxSizing') === 'border-box';
|
5152 | }
|
5153 |
|
5154 | var BOX_MODELS = ['margin', 'border', 'padding'];
|
5155 | var CONTENT_INDEX = -1;
|
5156 | var PADDING_INDEX = 2;
|
5157 | var BORDER_INDEX = 1;
|
5158 | var MARGIN_INDEX = 0;
|
5159 |
|
5160 | function swap(elem, options, callback) {
|
5161 | var old = {};
|
5162 | var style = elem.style;
|
5163 | var name = void 0;
|
5164 |
|
5165 |
|
5166 | for (name in options) {
|
5167 | if (options.hasOwnProperty(name)) {
|
5168 | old[name] = style[name];
|
5169 | style[name] = options[name];
|
5170 | }
|
5171 | }
|
5172 |
|
5173 | callback.call(elem);
|
5174 |
|
5175 |
|
5176 | for (name in options) {
|
5177 | if (options.hasOwnProperty(name)) {
|
5178 | style[name] = old[name];
|
5179 | }
|
5180 | }
|
5181 | }
|
5182 |
|
5183 | function getPBMWidth(elem, props, which) {
|
5184 | var value = 0;
|
5185 | var prop = void 0;
|
5186 | var j = void 0;
|
5187 | var i = void 0;
|
5188 | for (j = 0; j < props.length; j++) {
|
5189 | prop = props[j];
|
5190 | if (prop) {
|
5191 | for (i = 0; i < which.length; i++) {
|
5192 | var cssProp = void 0;
|
5193 | if (prop === 'border') {
|
5194 | cssProp = '' + prop + which[i] + 'Width';
|
5195 | } else {
|
5196 | cssProp = prop + which[i];
|
5197 | }
|
5198 | value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
|
5199 | }
|
5200 | }
|
5201 | }
|
5202 | return value;
|
5203 | }
|
5204 |
|
5205 | var domUtils = {};
|
5206 |
|
5207 | each(['Width', 'Height'], function (name) {
|
5208 | domUtils['doc' + name] = function (refWin) {
|
5209 | var d = refWin.document;
|
5210 | return Math.max(
|
5211 |
|
5212 |
|
5213 | d.documentElement['scroll' + name],
|
5214 |
|
5215 | d.body['scroll' + name], domUtils['viewport' + name](d));
|
5216 | };
|
5217 |
|
5218 | domUtils['viewport' + name] = function (win) {
|
5219 |
|
5220 | var prop = 'client' + name;
|
5221 | var doc = win.document;
|
5222 | var body = doc.body;
|
5223 | var documentElement = doc.documentElement;
|
5224 | var documentElementProp = documentElement[prop];
|
5225 |
|
5226 |
|
5227 | return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
|
5228 | };
|
5229 | });
|
5230 |
|
5231 | |
5232 |
|
5233 |
|
5234 |
|
5235 |
|
5236 |
|
5237 |
|
5238 |
|
5239 | function getWH(elem, name, ex) {
|
5240 | var extra = ex;
|
5241 | if (isWindow(elem)) {
|
5242 | return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
|
5243 | } else if (elem.nodeType === 9) {
|
5244 | return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
|
5245 | }
|
5246 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
5247 | var borderBoxValue = name === 'width' ? elem.getBoundingClientRect().width : elem.getBoundingClientRect().height;
|
5248 | var computedStyle = getComputedStyleX(elem);
|
5249 | var isBorderBox = isBorderBoxFn(elem, computedStyle);
|
5250 | var cssBoxValue = 0;
|
5251 | if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) {
|
5252 | borderBoxValue = undefined;
|
5253 |
|
5254 | cssBoxValue = getComputedStyleX(elem, name);
|
5255 | if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) {
|
5256 | cssBoxValue = elem.style[name] || 0;
|
5257 | }
|
5258 |
|
5259 | cssBoxValue = parseFloat(cssBoxValue) || 0;
|
5260 | }
|
5261 | if (extra === undefined) {
|
5262 | extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
|
5263 | }
|
5264 | var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
|
5265 | var val = borderBoxValue || cssBoxValue;
|
5266 | if (extra === CONTENT_INDEX) {
|
5267 | if (borderBoxValueOrIsBorderBox) {
|
5268 | return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
|
5269 | }
|
5270 | return cssBoxValue;
|
5271 | } else if (borderBoxValueOrIsBorderBox) {
|
5272 | if (extra === BORDER_INDEX) {
|
5273 | return val;
|
5274 | }
|
5275 | return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle));
|
5276 | }
|
5277 | return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
|
5278 | }
|
5279 |
|
5280 | var cssShow = {
|
5281 | position: 'absolute',
|
5282 | visibility: 'hidden',
|
5283 | display: 'block'
|
5284 | };
|
5285 |
|
5286 |
|
5287 | function getWHIgnoreDisplay() {
|
5288 | for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
5289 | args[_key2] = arguments[_key2];
|
5290 | }
|
5291 |
|
5292 | var val = void 0;
|
5293 | var elem = args[0];
|
5294 |
|
5295 |
|
5296 | if (elem.offsetWidth !== 0) {
|
5297 | val = getWH.apply(undefined, args);
|
5298 | } else {
|
5299 | swap(elem, cssShow, function () {
|
5300 | val = getWH.apply(undefined, args);
|
5301 | });
|
5302 | }
|
5303 | return val;
|
5304 | }
|
5305 |
|
5306 | each(['width', 'height'], function (name) {
|
5307 | var first = name.charAt(0).toUpperCase() + name.slice(1);
|
5308 | domUtils['outer' + first] = function (el, includeMargin) {
|
5309 | return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
|
5310 | };
|
5311 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
5312 |
|
5313 | domUtils[name] = function (elem, v) {
|
5314 | var val = v;
|
5315 | if (val !== undefined) {
|
5316 | if (elem) {
|
5317 | var computedStyle = getComputedStyleX(elem);
|
5318 | var isBorderBox = isBorderBoxFn(elem);
|
5319 | if (isBorderBox) {
|
5320 | val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
|
5321 | }
|
5322 | return css(elem, name, val);
|
5323 | }
|
5324 | return undefined;
|
5325 | }
|
5326 | return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
|
5327 | };
|
5328 | });
|
5329 |
|
5330 | function mix(to, from) {
|
5331 | for (var i in from) {
|
5332 | if (from.hasOwnProperty(i)) {
|
5333 | to[i] = from[i];
|
5334 | }
|
5335 | }
|
5336 | return to;
|
5337 | }
|
5338 |
|
5339 | var utils = {
|
5340 | getWindow: function getWindow(node) {
|
5341 | if (node && node.document && node.setTimeout) {
|
5342 | return node;
|
5343 | }
|
5344 | var doc = node.ownerDocument || node;
|
5345 | return doc.defaultView || doc.parentWindow;
|
5346 | },
|
5347 |
|
5348 | getDocument: getDocument,
|
5349 | offset: function offset(el, value, option) {
|
5350 | if (typeof value !== 'undefined') {
|
5351 | setOffset(el, value, option || {});
|
5352 | } else {
|
5353 | return getOffset(el);
|
5354 | }
|
5355 | },
|
5356 |
|
5357 | isWindow: isWindow,
|
5358 | each: each,
|
5359 | css: css,
|
5360 | clone: function clone(obj) {
|
5361 | var i = void 0;
|
5362 | var ret = {};
|
5363 | for (i in obj) {
|
5364 | if (obj.hasOwnProperty(i)) {
|
5365 | ret[i] = obj[i];
|
5366 | }
|
5367 | }
|
5368 | var overflow = obj.overflow;
|
5369 | if (overflow) {
|
5370 | for (i in obj) {
|
5371 | if (obj.hasOwnProperty(i)) {
|
5372 | ret.overflow[i] = obj.overflow[i];
|
5373 | }
|
5374 | }
|
5375 | }
|
5376 | return ret;
|
5377 | },
|
5378 |
|
5379 | mix: mix,
|
5380 | getWindowScrollLeft: function getWindowScrollLeft(w) {
|
5381 | return getScrollLeft(w);
|
5382 | },
|
5383 | getWindowScrollTop: function getWindowScrollTop(w) {
|
5384 | return getScrollTop(w);
|
5385 | },
|
5386 | merge: function merge() {
|
5387 | var ret = {};
|
5388 |
|
5389 | for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
|
5390 | args[_key3] = arguments[_key3];
|
5391 | }
|
5392 |
|
5393 | for (var i = 0; i < args.length; i++) {
|
5394 | utils.mix(ret, args[i]);
|
5395 | }
|
5396 | return ret;
|
5397 | },
|
5398 |
|
5399 | viewportWidth: 0,
|
5400 | viewportHeight: 0
|
5401 | };
|
5402 |
|
5403 | mix(utils, domUtils);
|
5404 |
|
5405 | exports['default'] = utils;
|
5406 | module.exports = exports['default'];
|
5407 |
|
5408 | }),
|
5409 |
|
5410 | (function(module, exports) {
|
5411 |
|
5412 | 'use strict';
|
5413 |
|
5414 | Object.defineProperty(exports, "__esModule", {
|
5415 | value: true
|
5416 | });
|
5417 | exports.getTransformName = getTransformName;
|
5418 | exports.setTransitionProperty = setTransitionProperty;
|
5419 | exports.getTransitionProperty = getTransitionProperty;
|
5420 | exports.getTransformXY = getTransformXY;
|
5421 | exports.setTransformXY = setTransformXY;
|
5422 | var vendorPrefix = void 0;
|
5423 |
|
5424 | var jsCssMap = {
|
5425 | Webkit: '-webkit-',
|
5426 | Moz: '-moz-',
|
5427 |
|
5428 | ms: '-ms-',
|
5429 | O: '-o-'
|
5430 | };
|
5431 |
|
5432 | function getVendorPrefix() {
|
5433 | if (vendorPrefix !== undefined) {
|
5434 | return vendorPrefix;
|
5435 | }
|
5436 | vendorPrefix = '';
|
5437 | var style = document.createElement('p').style;
|
5438 | var testProp = 'Transform';
|
5439 | for (var key in jsCssMap) {
|
5440 | if (key + testProp in style) {
|
5441 | vendorPrefix = key;
|
5442 | }
|
5443 | }
|
5444 | return vendorPrefix;
|
5445 | }
|
5446 |
|
5447 | function getTransitionName() {
|
5448 | return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty';
|
5449 | }
|
5450 |
|
5451 | function getTransformName() {
|
5452 | return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform';
|
5453 | }
|
5454 |
|
5455 | function setTransitionProperty(node, value) {
|
5456 | var name = getTransitionName();
|
5457 | if (name) {
|
5458 | node.style[name] = value;
|
5459 | if (name !== 'transitionProperty') {
|
5460 | node.style.transitionProperty = value;
|
5461 | }
|
5462 | }
|
5463 | }
|
5464 |
|
5465 | function setTransform(node, value) {
|
5466 | var name = getTransformName();
|
5467 | if (name) {
|
5468 | node.style[name] = value;
|
5469 | if (name !== 'transform') {
|
5470 | node.style.transform = value;
|
5471 | }
|
5472 | }
|
5473 | }
|
5474 |
|
5475 | function getTransitionProperty(node) {
|
5476 | return node.style.transitionProperty || node.style[getTransitionName()];
|
5477 | }
|
5478 |
|
5479 | function getTransformXY(node) {
|
5480 | var style = window.getComputedStyle(node, null);
|
5481 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
5482 | if (transform && transform !== 'none') {
|
5483 | var matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
|
5484 | return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) };
|
5485 | }
|
5486 | return {
|
5487 | x: 0,
|
5488 | y: 0
|
5489 | };
|
5490 | }
|
5491 |
|
5492 | var matrix2d = /matrix\((.*)\)/;
|
5493 | var matrix3d = /matrix3d\((.*)\)/;
|
5494 |
|
5495 | function setTransformXY(node, xy) {
|
5496 | var style = window.getComputedStyle(node, null);
|
5497 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
5498 | if (transform && transform !== 'none') {
|
5499 | var arr = void 0;
|
5500 | var match2d = transform.match(matrix2d);
|
5501 | if (match2d) {
|
5502 | match2d = match2d[1];
|
5503 | arr = match2d.split(',').map(function (item) {
|
5504 | return parseFloat(item, 10);
|
5505 | });
|
5506 | arr[4] = xy.x;
|
5507 | arr[5] = xy.y;
|
5508 | setTransform(node, 'matrix(' + arr.join(',') + ')');
|
5509 | } else {
|
5510 | var match3d = transform.match(matrix3d)[1];
|
5511 | arr = match3d.split(',').map(function (item) {
|
5512 | return parseFloat(item, 10);
|
5513 | });
|
5514 | arr[12] = xy.x;
|
5515 | arr[13] = xy.y;
|
5516 | setTransform(node, 'matrix3d(' + arr.join(',') + ')');
|
5517 | }
|
5518 | } else {
|
5519 | setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)');
|
5520 | }
|
5521 | }
|
5522 |
|
5523 | }),
|
5524 |
|
5525 | (function(module, exports, __webpack_require__) {
|
5526 |
|
5527 | 'use strict';
|
5528 |
|
5529 | Object.defineProperty(exports, "__esModule", {
|
5530 | value: true
|
5531 | });
|
5532 |
|
5533 | var _utils = __webpack_require__(54);
|
5534 |
|
5535 | var _utils2 = _interopRequireDefault(_utils);
|
5536 |
|
5537 | var _getOffsetParent = __webpack_require__(57);
|
5538 |
|
5539 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
|
5540 |
|
5541 | var _isAncestorFixed = __webpack_require__(58);
|
5542 |
|
5543 | var _isAncestorFixed2 = _interopRequireDefault(_isAncestorFixed);
|
5544 |
|
5545 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5546 |
|
5547 | |
5548 |
|
5549 |
|
5550 | function getVisibleRectForElement(element) {
|
5551 | var visibleRect = {
|
5552 | left: 0,
|
5553 | right: Infinity,
|
5554 | top: 0,
|
5555 | bottom: Infinity
|
5556 | };
|
5557 | var el = (0, _getOffsetParent2['default'])(element);
|
5558 | var doc = _utils2['default'].getDocument(element);
|
5559 | var win = doc.defaultView || doc.parentWindow;
|
5560 | var body = doc.body;
|
5561 | var documentElement = doc.documentElement;
|
5562 |
|
5563 |
|
5564 |
|
5565 | while (el) {
|
5566 |
|
5567 | if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) &&
|
5568 |
|
5569 |
|
5570 |
|
5571 | el !== body && el !== documentElement && _utils2['default'].css(el, 'overflow') !== 'visible') {
|
5572 | var pos = _utils2['default'].offset(el);
|
5573 |
|
5574 | pos.left += el.clientLeft;
|
5575 | pos.top += el.clientTop;
|
5576 | visibleRect.top = Math.max(visibleRect.top, pos.top);
|
5577 | visibleRect.right = Math.min(visibleRect.right,
|
5578 |
|
5579 | pos.left + el.clientWidth);
|
5580 | visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight);
|
5581 | visibleRect.left = Math.max(visibleRect.left, pos.left);
|
5582 | } else if (el === body || el === documentElement) {
|
5583 | break;
|
5584 | }
|
5585 | el = (0, _getOffsetParent2['default'])(el);
|
5586 | }
|
5587 |
|
5588 |
|
5589 |
|
5590 |
|
5591 | var originalPosition = null;
|
5592 | if (!_utils2['default'].isWindow(element) && element.nodeType !== 9) {
|
5593 | originalPosition = element.style.position;
|
5594 | var position = _utils2['default'].css(element, 'position');
|
5595 | if (position === 'absolute') {
|
5596 | element.style.position = 'fixed';
|
5597 | }
|
5598 | }
|
5599 |
|
5600 | var scrollX = _utils2['default'].getWindowScrollLeft(win);
|
5601 | var scrollY = _utils2['default'].getWindowScrollTop(win);
|
5602 | var viewportWidth = _utils2['default'].viewportWidth(win);
|
5603 | var viewportHeight = _utils2['default'].viewportHeight(win);
|
5604 | var documentWidth = documentElement.scrollWidth;
|
5605 | var documentHeight = documentElement.scrollHeight;
|
5606 |
|
5607 |
|
5608 |
|
5609 | var bodyStyle = window.getComputedStyle(body);
|
5610 | if (bodyStyle.overflowX === 'hidden') {
|
5611 | documentWidth = win.innerWidth;
|
5612 | }
|
5613 | if (bodyStyle.overflowY === 'hidden') {
|
5614 | documentHeight = win.innerHeight;
|
5615 | }
|
5616 |
|
5617 |
|
5618 | if (element.style) {
|
5619 | element.style.position = originalPosition;
|
5620 | }
|
5621 |
|
5622 | if ((0, _isAncestorFixed2['default'])(element)) {
|
5623 |
|
5624 | visibleRect.left = Math.max(visibleRect.left, scrollX);
|
5625 | visibleRect.top = Math.max(visibleRect.top, scrollY);
|
5626 | visibleRect.right = Math.min(visibleRect.right, scrollX + viewportWidth);
|
5627 | visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + viewportHeight);
|
5628 | } else {
|
5629 |
|
5630 | var maxVisibleWidth = Math.max(documentWidth, scrollX + viewportWidth);
|
5631 | visibleRect.right = Math.min(visibleRect.right, maxVisibleWidth);
|
5632 |
|
5633 | var maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight);
|
5634 | visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight);
|
5635 | }
|
5636 |
|
5637 | return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;
|
5638 | }
|
5639 |
|
5640 | exports['default'] = getVisibleRectForElement;
|
5641 | module.exports = exports['default'];
|
5642 |
|
5643 | }),
|
5644 |
|
5645 | (function(module, exports, __webpack_require__) {
|
5646 |
|
5647 | 'use strict';
|
5648 |
|
5649 | Object.defineProperty(exports, "__esModule", {
|
5650 | value: true
|
5651 | });
|
5652 |
|
5653 | var _utils = __webpack_require__(54);
|
5654 |
|
5655 | var _utils2 = _interopRequireDefault(_utils);
|
5656 |
|
5657 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5658 |
|
5659 | |
5660 |
|
5661 |
|
5662 |
|
5663 | function getOffsetParent(element) {
|
5664 | if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
|
5665 | return null;
|
5666 | }
|
5667 |
|
5668 | |
5669 |
|
5670 |
|
5671 |
|
5672 |
|
5673 |
|
5674 |
|
5675 |
|
5676 |
|
5677 |
|
5678 |
|
5679 |
|
5680 |
|
5681 |
|
5682 | var doc = _utils2['default'].getDocument(element);
|
5683 | var body = doc.body;
|
5684 | var parent = void 0;
|
5685 | var positionStyle = _utils2['default'].css(element, 'position');
|
5686 | var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute';
|
5687 |
|
5688 | if (!skipStatic) {
|
5689 | return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode;
|
5690 | }
|
5691 |
|
5692 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
|
5693 | positionStyle = _utils2['default'].css(parent, 'position');
|
5694 | if (positionStyle !== 'static') {
|
5695 | return parent;
|
5696 | }
|
5697 | }
|
5698 | return null;
|
5699 | }
|
5700 |
|
5701 | exports['default'] = getOffsetParent;
|
5702 | module.exports = exports['default'];
|
5703 |
|
5704 | }),
|
5705 |
|
5706 | (function(module, exports, __webpack_require__) {
|
5707 |
|
5708 | 'use strict';
|
5709 |
|
5710 | Object.defineProperty(exports, "__esModule", {
|
5711 | value: true
|
5712 | });
|
5713 | exports['default'] = isAncestorFixed;
|
5714 |
|
5715 | var _utils = __webpack_require__(54);
|
5716 |
|
5717 | var _utils2 = _interopRequireDefault(_utils);
|
5718 |
|
5719 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5720 |
|
5721 | function isAncestorFixed(element) {
|
5722 | if (_utils2['default'].isWindow(element) || element.nodeType === 9) {
|
5723 | return false;
|
5724 | }
|
5725 |
|
5726 | var doc = _utils2['default'].getDocument(element);
|
5727 | var body = doc.body;
|
5728 | var parent = null;
|
5729 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
|
5730 | var positionStyle = _utils2['default'].css(parent, 'position');
|
5731 | if (positionStyle === 'fixed') {
|
5732 | return true;
|
5733 | }
|
5734 | }
|
5735 | return false;
|
5736 | }
|
5737 | module.exports = exports['default'];
|
5738 |
|
5739 | }),
|
5740 |
|
5741 | (function(module, exports, __webpack_require__) {
|
5742 |
|
5743 | 'use strict';
|
5744 |
|
5745 | Object.defineProperty(exports, "__esModule", {
|
5746 | value: true
|
5747 | });
|
5748 |
|
5749 | var _utils = __webpack_require__(54);
|
5750 |
|
5751 | var _utils2 = _interopRequireDefault(_utils);
|
5752 |
|
5753 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5754 |
|
5755 | function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {
|
5756 | var pos = _utils2['default'].clone(elFuturePos);
|
5757 | var size = {
|
5758 | width: elRegion.width,
|
5759 | height: elRegion.height
|
5760 | };
|
5761 |
|
5762 | if (overflow.adjustX && pos.left < visibleRect.left) {
|
5763 | pos.left = visibleRect.left;
|
5764 | }
|
5765 |
|
5766 |
|
5767 | if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) {
|
5768 | size.width -= pos.left + size.width - visibleRect.right;
|
5769 | }
|
5770 |
|
5771 |
|
5772 | if (overflow.adjustX && pos.left + size.width > visibleRect.right) {
|
5773 |
|
5774 | pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);
|
5775 | }
|
5776 |
|
5777 |
|
5778 | if (overflow.adjustY && pos.top < visibleRect.top) {
|
5779 | pos.top = visibleRect.top;
|
5780 | }
|
5781 |
|
5782 |
|
5783 | if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) {
|
5784 | size.height -= pos.top + size.height - visibleRect.bottom;
|
5785 | }
|
5786 |
|
5787 |
|
5788 | if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {
|
5789 |
|
5790 | pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);
|
5791 | }
|
5792 |
|
5793 | return _utils2['default'].mix(pos, size);
|
5794 | }
|
5795 |
|
5796 | exports['default'] = adjustForViewport;
|
5797 | module.exports = exports['default'];
|
5798 |
|
5799 | }),
|
5800 |
|
5801 | (function(module, exports, __webpack_require__) {
|
5802 |
|
5803 | 'use strict';
|
5804 |
|
5805 | Object.defineProperty(exports, "__esModule", {
|
5806 | value: true
|
5807 | });
|
5808 |
|
5809 | var _utils = __webpack_require__(54);
|
5810 |
|
5811 | var _utils2 = _interopRequireDefault(_utils);
|
5812 |
|
5813 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5814 |
|
5815 | function getRegion(node) {
|
5816 | var offset = void 0;
|
5817 | var w = void 0;
|
5818 | var h = void 0;
|
5819 | if (!_utils2['default'].isWindow(node) && node.nodeType !== 9) {
|
5820 | offset = _utils2['default'].offset(node);
|
5821 | w = _utils2['default'].outerWidth(node);
|
5822 | h = _utils2['default'].outerHeight(node);
|
5823 | } else {
|
5824 | var win = _utils2['default'].getWindow(node);
|
5825 | offset = {
|
5826 | left: _utils2['default'].getWindowScrollLeft(win),
|
5827 | top: _utils2['default'].getWindowScrollTop(win)
|
5828 | };
|
5829 | w = _utils2['default'].viewportWidth(win);
|
5830 | h = _utils2['default'].viewportHeight(win);
|
5831 | }
|
5832 | offset.width = w;
|
5833 | offset.height = h;
|
5834 | return offset;
|
5835 | }
|
5836 |
|
5837 | exports['default'] = getRegion;
|
5838 | module.exports = exports['default'];
|
5839 |
|
5840 | }),
|
5841 |
|
5842 | (function(module, exports, __webpack_require__) {
|
5843 |
|
5844 | 'use strict';
|
5845 |
|
5846 | Object.defineProperty(exports, "__esModule", {
|
5847 | value: true
|
5848 | });
|
5849 |
|
5850 | var _getAlignOffset = __webpack_require__(62);
|
5851 |
|
5852 | var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset);
|
5853 |
|
5854 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5855 |
|
5856 | function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {
|
5857 | var p1 = (0, _getAlignOffset2['default'])(refNodeRegion, points[1]);
|
5858 | var p2 = (0, _getAlignOffset2['default'])(elRegion, points[0]);
|
5859 | var diff = [p2.left - p1.left, p2.top - p1.top];
|
5860 |
|
5861 | return {
|
5862 | left: elRegion.left - diff[0] + offset[0] - targetOffset[0],
|
5863 | top: elRegion.top - diff[1] + offset[1] - targetOffset[1]
|
5864 | };
|
5865 | }
|
5866 |
|
5867 | exports['default'] = getElFuturePos;
|
5868 | module.exports = exports['default'];
|
5869 |
|
5870 | }),
|
5871 |
|
5872 | (function(module, exports) {
|
5873 |
|
5874 | 'use strict';
|
5875 |
|
5876 | Object.defineProperty(exports, "__esModule", {
|
5877 | value: true
|
5878 | });
|
5879 | |
5880 |
|
5881 |
|
5882 |
|
5883 | function getAlignOffset(region, align) {
|
5884 | var V = align.charAt(0);
|
5885 | var H = align.charAt(1);
|
5886 | var w = region.width;
|
5887 | var h = region.height;
|
5888 |
|
5889 | var x = region.left;
|
5890 | var y = region.top;
|
5891 |
|
5892 | if (V === 'c') {
|
5893 | y += h / 2;
|
5894 | } else if (V === 'b') {
|
5895 | y += h;
|
5896 | }
|
5897 |
|
5898 | if (H === 'c') {
|
5899 | x += w / 2;
|
5900 | } else if (H === 'r') {
|
5901 | x += w;
|
5902 | }
|
5903 |
|
5904 | return {
|
5905 | left: x,
|
5906 | top: y
|
5907 | };
|
5908 | }
|
5909 |
|
5910 | exports['default'] = getAlignOffset;
|
5911 | module.exports = exports['default'];
|
5912 |
|
5913 | }),
|
5914 |
|
5915 | (function(module, exports, __webpack_require__) {
|
5916 |
|
5917 | 'use strict';
|
5918 |
|
5919 | Object.defineProperty(exports, "__esModule", {
|
5920 | value: true
|
5921 | });
|
5922 |
|
5923 | 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; };
|
5924 |
|
5925 | var _utils = __webpack_require__(54);
|
5926 |
|
5927 | var _utils2 = _interopRequireDefault(_utils);
|
5928 |
|
5929 | var _align = __webpack_require__(53);
|
5930 |
|
5931 | var _align2 = _interopRequireDefault(_align);
|
5932 |
|
5933 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
5934 |
|
5935 | |
5936 |
|
5937 |
|
5938 |
|
5939 |
|
5940 | function alignPoint(el, tgtPoint, align) {
|
5941 | var pageX = void 0;
|
5942 | var pageY = void 0;
|
5943 |
|
5944 | var doc = _utils2['default'].getDocument(el);
|
5945 | var win = doc.defaultView || doc.parentWindow;
|
5946 |
|
5947 | var scrollX = _utils2['default'].getWindowScrollLeft(win);
|
5948 | var scrollY = _utils2['default'].getWindowScrollTop(win);
|
5949 | var viewportWidth = _utils2['default'].viewportWidth(win);
|
5950 | var viewportHeight = _utils2['default'].viewportHeight(win);
|
5951 |
|
5952 | if ('pageX' in tgtPoint) {
|
5953 | pageX = tgtPoint.pageX;
|
5954 | } else {
|
5955 | pageX = scrollX + tgtPoint.clientX;
|
5956 | }
|
5957 |
|
5958 | if ('pageY' in tgtPoint) {
|
5959 | pageY = tgtPoint.pageY;
|
5960 | } else {
|
5961 | pageY = scrollY + tgtPoint.clientY;
|
5962 | }
|
5963 |
|
5964 | var tgtRegion = {
|
5965 | left: pageX,
|
5966 | top: pageY,
|
5967 | width: 0,
|
5968 | height: 0
|
5969 | };
|
5970 |
|
5971 | var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight;
|
5972 |
|
5973 |
|
5974 | var points = [align.points[0], 'cc'];
|
5975 |
|
5976 | return (0, _align2['default'])(el, tgtRegion, _extends({}, align, { points: points }), pointInView);
|
5977 | }
|
5978 |
|
5979 | exports['default'] = alignPoint;
|
5980 | module.exports = exports['default'];
|
5981 |
|
5982 | }),
|
5983 |
|
5984 | (function(module, exports, __webpack_require__) {
|
5985 |
|
5986 | 'use strict';
|
5987 |
|
5988 | Object.defineProperty(exports, "__esModule", {
|
5989 | value: true
|
5990 | });
|
5991 |
|
5992 | 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; };
|
5993 |
|
5994 | var _classnames = __webpack_require__(5);
|
5995 |
|
5996 | var _classnames2 = _interopRequireDefault(_classnames);
|
5997 |
|
5998 | var _react = __webpack_require__(1);
|
5999 |
|
6000 | var _react2 = _interopRequireDefault(_react);
|
6001 |
|
6002 | var _propTypes = __webpack_require__(6);
|
6003 |
|
6004 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6005 |
|
6006 | var _Transition = __webpack_require__(12);
|
6007 |
|
6008 | var _Transition2 = _interopRequireDefault(_Transition);
|
6009 |
|
6010 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6011 |
|
6012 | 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; }
|
6013 |
|
6014 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6015 |
|
6016 | 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; }
|
6017 |
|
6018 | 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); }
|
6019 |
|
6020 | var propTypes = {
|
6021 | |
6022 |
|
6023 |
|
6024 | "in": _propTypes2["default"].bool,
|
6025 |
|
6026 | |
6027 |
|
6028 |
|
6029 | unmountOnExit: _propTypes2["default"].bool,
|
6030 |
|
6031 | |
6032 |
|
6033 |
|
6034 |
|
6035 | transitionAppear: _propTypes2["default"].bool,
|
6036 |
|
6037 | |
6038 |
|
6039 |
|
6040 |
|
6041 |
|
6042 | timeout: _propTypes2["default"].number,
|
6043 |
|
6044 | |
6045 |
|
6046 |
|
6047 | onEnter: _propTypes2["default"].func,
|
6048 | |
6049 |
|
6050 |
|
6051 | onEntering: _propTypes2["default"].func,
|
6052 | |
6053 |
|
6054 |
|
6055 | onEntered: _propTypes2["default"].func,
|
6056 | |
6057 |
|
6058 |
|
6059 | onExit: _propTypes2["default"].func,
|
6060 | |
6061 |
|
6062 |
|
6063 | onExiting: _propTypes2["default"].func,
|
6064 | |
6065 |
|
6066 |
|
6067 | onExited: _propTypes2["default"].func
|
6068 | };
|
6069 |
|
6070 | var defaultProps = {
|
6071 | "in": false,
|
6072 | timeout: 300,
|
6073 | unmountOnExit: false,
|
6074 | transitionAppear: false
|
6075 | };
|
6076 |
|
6077 | var Fade = function (_React$Component) {
|
6078 | _inherits(Fade, _React$Component);
|
6079 |
|
6080 | function Fade() {
|
6081 | _classCallCheck(this, Fade);
|
6082 |
|
6083 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
6084 | }
|
6085 |
|
6086 | Fade.prototype.render = function render() {
|
6087 | return _react2["default"].createElement(_Transition2["default"], _extends({}, this.props, {
|
6088 | className: (0, _classnames2["default"])(this.props.className, 'fade'),
|
6089 | enteredClassName: 'in',
|
6090 | enteringClassName: 'in'
|
6091 | }));
|
6092 | };
|
6093 |
|
6094 | return Fade;
|
6095 | }(_react2["default"].Component);
|
6096 |
|
6097 | Fade.propTypes = propTypes;
|
6098 | Fade.defaultProps = defaultProps;
|
6099 |
|
6100 | exports["default"] = Fade;
|
6101 | module.exports = exports['default'];
|
6102 |
|
6103 | }),
|
6104 |
|
6105 | (function(module, exports, __webpack_require__) {
|
6106 |
|
6107 | 'use strict';
|
6108 |
|
6109 | Object.defineProperty(exports, "__esModule", {
|
6110 | value: true
|
6111 | });
|
6112 |
|
6113 | var _Message = __webpack_require__(66);
|
6114 |
|
6115 | var _Message2 = _interopRequireDefault(_Message);
|
6116 |
|
6117 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6118 |
|
6119 | exports["default"] = _Message2["default"];
|
6120 | module.exports = exports['default'];
|
6121 |
|
6122 | }),
|
6123 |
|
6124 | (function(module, exports, __webpack_require__) {
|
6125 |
|
6126 | 'use strict';
|
6127 |
|
6128 | Object.defineProperty(exports, "__esModule", {
|
6129 | value: true
|
6130 | });
|
6131 |
|
6132 | 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; };
|
6133 |
|
6134 | var _react = __webpack_require__(1);
|
6135 |
|
6136 | var _react2 = _interopRequireDefault(_react);
|
6137 |
|
6138 | var _beeNotification = __webpack_require__(67);
|
6139 |
|
6140 | var _beeNotification2 = _interopRequireDefault(_beeNotification);
|
6141 |
|
6142 | var _classnames = __webpack_require__(5);
|
6143 |
|
6144 | var _classnames2 = _interopRequireDefault(_classnames);
|
6145 |
|
6146 | var _warning = __webpack_require__(32);
|
6147 |
|
6148 | var _warning2 = _interopRequireDefault(_warning);
|
6149 |
|
6150 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6151 |
|
6152 | var defaultDuration = 1.5;
|
6153 | var newDuration = void 0;
|
6154 | var defaultTop = 24;
|
6155 | var defaultBottom = 48;
|
6156 | var bottom = 90;
|
6157 | var padding = 30;
|
6158 | var width = 240;
|
6159 | var messageInstance = void 0;
|
6160 | var key = 1;
|
6161 | var clsPrefix = 'u-message';
|
6162 | var noop = function noop() {};
|
6163 | var notificationStyle_copy = {};
|
6164 | var messageStyle_copy = {};
|
6165 | var positionType = ['topRight', 'bottomRight', 'top', 'bottom', 'topLeft', 'bottomLeft', ''];
|
6166 | var defaultStyle = {};
|
6167 |
|
6168 | var positionObj = {
|
6169 | "top": {
|
6170 | messageStyle: {},
|
6171 | notificationStyle: {
|
6172 | top: defaultTop,
|
6173 | left: '50%',
|
6174 | transform: 'translateX( -50%)'
|
6175 | },
|
6176 | transitionName: 'top'
|
6177 | },
|
6178 | "bottom": {
|
6179 | messageStyle: {},
|
6180 | notificationStyle: {
|
6181 | bottom: defaultBottom,
|
6182 | left: '50%',
|
6183 | transform: 'translateX( -50%)'
|
6184 | },
|
6185 | transitionName: 'bottom'
|
6186 | },
|
6187 | "topRight": {
|
6188 | messageStyle: {
|
6189 | width: width
|
6190 | },
|
6191 | notificationStyle: {
|
6192 | top: padding,
|
6193 | right: padding,
|
6194 | width: width
|
6195 | },
|
6196 | transitionName: 'right'
|
6197 | },
|
6198 | "bottomRight": {
|
6199 | messageStyle: {
|
6200 | width: width
|
6201 | },
|
6202 | notificationStyle: {
|
6203 | bottom: bottom,
|
6204 | right: padding,
|
6205 | width: width
|
6206 | },
|
6207 | transitionName: 'right'
|
6208 | },
|
6209 | "topLeft": {
|
6210 | messageStyle: {
|
6211 | width: width
|
6212 | },
|
6213 | notificationStyle: {
|
6214 | top: padding,
|
6215 | left: padding,
|
6216 | width: width
|
6217 | },
|
6218 | transitionName: 'left'
|
6219 | },
|
6220 | "bottomLeft": {
|
6221 | messageStyle: {
|
6222 | width: width
|
6223 | },
|
6224 | notificationStyle: {
|
6225 | bottom: bottom,
|
6226 | left: padding,
|
6227 | width: width
|
6228 | },
|
6229 | transitionName: 'left'
|
6230 | }
|
6231 | };
|
6232 |
|
6233 | function getMessageInstance() {
|
6234 | var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'top';
|
6235 | var callback = arguments[1];
|
6236 | var keyboard = arguments[2];
|
6237 | var onEscapeKeyUp = arguments[3];
|
6238 |
|
6239 | if (messageInstance) {
|
6240 | callback(messageInstance);
|
6241 | return;
|
6242 | }
|
6243 | switch (position) {
|
6244 | case 'top':
|
6245 | notificationStyle_copy.top = defaultTop;
|
6246 | break;
|
6247 | case 'bottom':
|
6248 | notificationStyle_copy.bottom = defaultBottom;
|
6249 | break;
|
6250 | case 'bottomRight':
|
6251 | notificationStyle_copy.bottom = bottom;
|
6252 | break;
|
6253 | case 'bottomLeft':
|
6254 | notificationStyle_copy.bottom = bottom;
|
6255 | break;
|
6256 | default:
|
6257 | break;
|
6258 | }
|
6259 | if (position !== 'top' && position !== 'bottom') {
|
6260 | messageStyle_copy.width = width;
|
6261 | }
|
6262 | var style = JSON.stringify(notificationStyle_copy) == "{}" ? positionObj[position].notificationStyle : notificationStyle_copy;
|
6263 | var instanceObj = {
|
6264 | clsPrefix: clsPrefix,
|
6265 | transitionName: clsPrefix + '-' + positionObj[position].transitionName,
|
6266 | style: _extends({}, style, defaultStyle),
|
6267 | position: position
|
6268 | };
|
6269 | if (typeof keyboard === 'boolean') {
|
6270 | instanceObj.keyboard = keyboard;
|
6271 | }
|
6272 | if (typeof onEscapeKeyUp === 'function') {
|
6273 | instanceObj.onEscapeKeyUp = onEscapeKeyUp;
|
6274 | }
|
6275 | _beeNotification2["default"].newInstance(instanceObj, function (instance) {
|
6276 | messageInstance = instance;
|
6277 | callback(instance);
|
6278 | });
|
6279 | }
|
6280 |
|
6281 | function notice(content, duration_arg, type, onClose, position, style, keyboard, onEscapeKeyUp, showIcon, icon, props) {
|
6282 | if (positionType.findIndex(function (item) {
|
6283 | return item === position;
|
6284 | }) < 0) {
|
6285 | (0, _warning2["default"])(false, 'Failed prop type: Invalid prop `position` supplied to `Message`, expected one of ["top","bottom","topRight","topLeft","bottomRight","bottomLeft"].');
|
6286 | return;
|
6287 | }
|
6288 | var duration = duration_arg !== undefined ? duration_arg : defaultDuration;
|
6289 | notificationStyle_copy = _extends({}, positionObj[position].notificationStyle);
|
6290 | messageStyle_copy = _extends({}, positionObj[position].messageStyle);
|
6291 |
|
6292 | var iconType = {
|
6293 | info: 'uf uf-i-c-2',
|
6294 | success: 'uf uf-correct',
|
6295 | danger: 'uf uf-exc-c',
|
6296 | warning: 'uf uf-exc-t',
|
6297 | light: 'uf uf-notification',
|
6298 | dark: 'uf uf-notification',
|
6299 | news: 'uf uf-bell',
|
6300 | infolight: 'uf uf-i-c-2',
|
6301 | successlight: 'uf uf-correct',
|
6302 | dangerlight: 'uf uf-exc-c',
|
6303 | warninglight: 'uf uf-exc-t'
|
6304 | }[type];
|
6305 |
|
6306 | var positionStyle = JSON.stringify(messageStyle_copy) == "{}" ? positionObj[position].messageStyle : messageStyle_copy;
|
6307 | defaultStyle = _extends({}, positionStyle, style);
|
6308 | getMessageInstance(position, function (instance) {
|
6309 | instance.notice(_extends({}, props, {
|
6310 | key: key,
|
6311 | duration: duration,
|
6312 | color: type,
|
6313 | style: _extends({}, positionStyle, style),
|
6314 | content: _react2["default"].createElement(
|
6315 | 'div',
|
6316 | null,
|
6317 | showIcon ? _react2["default"].createElement(
|
6318 | 'div',
|
6319 | { className: clsPrefix + '-notice-description-icon' },
|
6320 | icon ? _react2["default"].createElement('i', { className: (0, _classnames2["default"])('' + icon) }) : _react2["default"].createElement('i', { className: (0, _classnames2["default"])(iconType) })
|
6321 | ) : null,
|
6322 | _react2["default"].createElement(
|
6323 | 'div',
|
6324 | { className: clsPrefix + '-notice-description-content' },
|
6325 | content
|
6326 | )
|
6327 | ),
|
6328 | onClose: onClose
|
6329 | }));
|
6330 | }, keyboard, onEscapeKeyUp);
|
6331 | return function () {
|
6332 | var target = key++;
|
6333 | return function () {
|
6334 | if (messageInstance) {
|
6335 | messageInstance.removeNotice(target);
|
6336 | }
|
6337 | };
|
6338 | }();
|
6339 | }
|
6340 |
|
6341 | exports["default"] = {
|
6342 | create: function create(obj) {
|
6343 | if (newDuration) {
|
6344 |
|
6345 | obj.duration = newDuration;
|
6346 | }
|
6347 | var content = obj.content || '';
|
6348 | var duration = typeof obj.duration == 'undefined' ? defaultDuration : obj.duration;
|
6349 | var color = obj.color || 'light';
|
6350 | var onClose = obj.onClose || noop;
|
6351 | var position = obj.position || "top";
|
6352 | var style = obj.style || {};
|
6353 | var showIcon = obj.hasOwnProperty('showIcon') ? obj.showIcon : true;
|
6354 | var icon = obj.hasOwnProperty('icon') ? obj.icon : false;
|
6355 | return notice(content, duration, color, onClose, position, style, obj.keyboard, obj.onEscapeKeyUp, showIcon, icon, obj);
|
6356 | },
|
6357 | config: function config(options) {
|
6358 | if (options.top !== undefined) {
|
6359 | defaultTop = options.top;
|
6360 | }
|
6361 | if (options.duration !== undefined) {
|
6362 | defaultDuration = options.duration;
|
6363 | newDuration = defaultDuration;
|
6364 | }
|
6365 | if (options.clsPrefix !== undefined) {
|
6366 | clsPrefix = options.clsPrefix;
|
6367 | }
|
6368 | if (options.defaultBottom !== undefined) {
|
6369 | defaultBottom = options.defaultBottom;
|
6370 | }
|
6371 | if (options.bottom !== undefined) {
|
6372 | bottom = options.bottom;
|
6373 | }
|
6374 | if (options.width !== undefined) {
|
6375 | width = options.width;
|
6376 | }
|
6377 | },
|
6378 | destroy: function destroy() {
|
6379 | if (messageInstance) {
|
6380 | messageInstance.destroy();
|
6381 | messageInstance = null;
|
6382 | defaultDuration = 1.5;
|
6383 | newDuration = undefined;
|
6384 | defaultTop = 24;
|
6385 | defaultBottom = 48;
|
6386 | bottom = 90;
|
6387 | padding = 30;
|
6388 | width = 240;
|
6389 | notificationStyle_copy = null;
|
6390 | messageStyle_copy = null;
|
6391 | defaultStyle = null;
|
6392 | }
|
6393 | }
|
6394 | };
|
6395 | module.exports = exports['default'];
|
6396 |
|
6397 | }),
|
6398 |
|
6399 | (function(module, exports, __webpack_require__) {
|
6400 |
|
6401 | 'use strict';
|
6402 |
|
6403 | Object.defineProperty(exports, "__esModule", {
|
6404 | value: true
|
6405 | });
|
6406 |
|
6407 | var _Notification = __webpack_require__(68);
|
6408 |
|
6409 | var _Notification2 = _interopRequireDefault(_Notification);
|
6410 |
|
6411 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6412 |
|
6413 | exports["default"] = _Notification2["default"];
|
6414 | module.exports = exports['default'];
|
6415 |
|
6416 | }),
|
6417 |
|
6418 | (function(module, exports, __webpack_require__) {
|
6419 |
|
6420 | 'use strict';
|
6421 |
|
6422 | Object.defineProperty(exports, "__esModule", {
|
6423 | value: true
|
6424 | });
|
6425 |
|
6426 | 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; };
|
6427 |
|
6428 | var _react = __webpack_require__(1);
|
6429 |
|
6430 | var _react2 = _interopRequireDefault(_react);
|
6431 |
|
6432 | var _propTypes = __webpack_require__(6);
|
6433 |
|
6434 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6435 |
|
6436 | var _reactDom = __webpack_require__(2);
|
6437 |
|
6438 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
6439 |
|
6440 | var _beeAnimate = __webpack_require__(69);
|
6441 |
|
6442 | var _beeAnimate2 = _interopRequireDefault(_beeAnimate);
|
6443 |
|
6444 | var _createChainedFunction = __webpack_require__(37);
|
6445 |
|
6446 | var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
|
6447 |
|
6448 | var _ownerDocument = __webpack_require__(74);
|
6449 |
|
6450 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
6451 |
|
6452 | var _addEventListener = __webpack_require__(76);
|
6453 |
|
6454 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
6455 |
|
6456 | var _classnames = __webpack_require__(5);
|
6457 |
|
6458 | var _classnames2 = _interopRequireDefault(_classnames);
|
6459 |
|
6460 | var _Notice = __webpack_require__(78);
|
6461 |
|
6462 | var _Notice2 = _interopRequireDefault(_Notice);
|
6463 |
|
6464 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6465 |
|
6466 | 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; }
|
6467 |
|
6468 | 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; }
|
6469 |
|
6470 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6471 |
|
6472 | 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; }
|
6473 |
|
6474 | 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); }
|
6475 |
|
6476 | var seed = 0;
|
6477 | var now = Date.now();
|
6478 |
|
6479 | function getUuid() {
|
6480 | return 'uNotification_' + now + '_' + seed++;
|
6481 | }
|
6482 |
|
6483 | var propTypes = {
|
6484 | show: _propTypes2["default"].bool,
|
6485 | clsPrefix: _propTypes2["default"].string,
|
6486 | style: _propTypes2["default"].object,
|
6487 | position: _propTypes2["default"].oneOf(['topRight', 'bottomRight', 'top', 'bottom', 'topLeft', 'bottomLeft', '']),
|
6488 | transitionName: _propTypes2["default"].string,
|
6489 | keyboard: _propTypes2["default"].bool,
|
6490 | onEscapeKeyUp: _propTypes2["default"].func,
|
6491 | animation: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object])
|
6492 | };
|
6493 |
|
6494 | var defaultProps = {
|
6495 | clsPrefix: 'u-notification',
|
6496 | animation: 'fade',
|
6497 | keyboard: true,
|
6498 | position: 'topRight'
|
6499 | };
|
6500 |
|
6501 | var Notification = function (_Component) {
|
6502 | _inherits(Notification, _Component);
|
6503 |
|
6504 | function Notification(props) {
|
6505 | _classCallCheck(this, Notification);
|
6506 |
|
6507 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
6508 |
|
6509 | _this.handleDocumentKeyUp = function (e) {
|
6510 | if (_this.props.keyboard && e.keyCode === 27 && _this.state.notices.length) {
|
6511 | _this.setState(function (previousState) {
|
6512 | previousState.notices.shift();
|
6513 | return {
|
6514 | notices: previousState.notices
|
6515 | };
|
6516 | });
|
6517 | if (_this.props.onEscapeKeyUp) {
|
6518 | _this.props.onEscapeKeyUp(e);
|
6519 | }
|
6520 | }
|
6521 | };
|
6522 |
|
6523 | _this.state = {
|
6524 | notices: []
|
6525 | };
|
6526 | _this.add = _this.add.bind(_this);
|
6527 | _this.remove = _this.remove.bind(_this);
|
6528 |
|
6529 | return _this;
|
6530 | }
|
6531 |
|
6532 | Notification.prototype.componentDidMount = function componentDidMount() {
|
6533 |
|
6534 | var doc = (0, _ownerDocument2["default"])(this);
|
6535 | this._onDocumentKeyupListener = (0, _addEventListener2["default"])(doc, 'keyup', this.handleDocumentKeyUp);
|
6536 | };
|
6537 |
|
6538 | Notification.prototype.componentWillUnmount = function componentWillUnmount() {
|
6539 | this._onDocumentKeyupListener.remove();
|
6540 | };
|
6541 |
|
6542 | Notification.prototype.getTransitionName = function getTransitionName() {
|
6543 | var props = this.props;
|
6544 | var transitionName = props.transitionName;
|
6545 | if (!transitionName && props.animation) {
|
6546 | transitionName = props.clsPrefix + '-' + props.animation;
|
6547 | }
|
6548 | return transitionName;
|
6549 | };
|
6550 |
|
6551 | Notification.prototype.add = function add(notice) {
|
6552 | var key = notice.key = notice.key || getUuid();
|
6553 | this.setState(function (previousState) {
|
6554 | var notices = previousState.notices;
|
6555 | if (!notices.filter(function (v) {
|
6556 | return v.key === key;
|
6557 | }).length) {
|
6558 | return {
|
6559 | notices: notices.concat(notice)
|
6560 | };
|
6561 | }
|
6562 | });
|
6563 | };
|
6564 |
|
6565 | Notification.prototype.remove = function remove(key) {
|
6566 | this.setState(function (previousState) {
|
6567 | return {
|
6568 | notices: previousState.notices.filter(function (notice) {
|
6569 | return notice.key !== key;
|
6570 | })
|
6571 | };
|
6572 | });
|
6573 | };
|
6574 |
|
6575 | |
6576 |
|
6577 |
|
6578 |
|
6579 |
|
6580 | Notification.prototype.render = function render() {
|
6581 | var _this2 = this,
|
6582 | _classes;
|
6583 |
|
6584 | var _props = this.props,
|
6585 | clsPrefix = _props.clsPrefix,
|
6586 | className = _props.className,
|
6587 | position = _props.position,
|
6588 | style = _props.style;
|
6589 |
|
6590 | var noticeNodes = this.state.notices.map(function (notice) {
|
6591 | var onClose = (0, _createChainedFunction2["default"])(_this2.remove.bind(_this2, notice.key), notice.onClose);
|
6592 | return _react2["default"].createElement(
|
6593 | _Notice2["default"],
|
6594 | _extends({
|
6595 | clsPrefix: clsPrefix
|
6596 | }, notice, {
|
6597 | onClose: onClose
|
6598 | }),
|
6599 | notice.content
|
6600 | );
|
6601 | });
|
6602 | var classes = (_classes = {}, _defineProperty(_classes, clsPrefix, 1), _defineProperty(_classes, className, !!className), _classes);
|
6603 | if (position) {
|
6604 | classes[clsPrefix + '-' + position] = !!position;
|
6605 | }
|
6606 |
|
6607 | return _react2["default"].createElement(
|
6608 | 'div',
|
6609 | { className: (0, _classnames2["default"])(className, classes), style: style },
|
6610 | _react2["default"].createElement(
|
6611 | _beeAnimate2["default"],
|
6612 | { transitionName: this.getTransitionName() },
|
6613 | noticeNodes
|
6614 | )
|
6615 | );
|
6616 | };
|
6617 |
|
6618 | return Notification;
|
6619 | }(_react.Component);
|
6620 |
|
6621 | ;
|
6622 |
|
6623 | Notification.propTypes = propTypes;
|
6624 | Notification.defaultProps = defaultProps;
|
6625 |
|
6626 | Notification.newInstance = function newNotificationInstance(properties, callback) {
|
6627 | if (typeof callback !== 'function') {
|
6628 | console.error('You must introduce callback as the second parameter of Notification.newInstance().');
|
6629 | return;
|
6630 | }
|
6631 | var props = properties || {};
|
6632 | var div = document.createElement('div');
|
6633 | document.body.appendChild(div);
|
6634 |
|
6635 | var called = false;
|
6636 | function ref(notification) {
|
6637 | if (called) {
|
6638 | return;
|
6639 | }
|
6640 | called = true;
|
6641 | callback({
|
6642 | notice: function notice(noticeProps) {
|
6643 | notification.add(noticeProps);
|
6644 | },
|
6645 | removeNotice: function removeNotice(key) {
|
6646 | notification.remove(key);
|
6647 | },
|
6648 |
|
6649 | component: notification,
|
6650 | destroy: function destroy() {
|
6651 | _reactDom2["default"].unmountComponentAtNode(div);
|
6652 | document.body.removeChild(div);
|
6653 | }
|
6654 | });
|
6655 | }
|
6656 | _reactDom2["default"].render(_react2["default"].createElement(Notification, _extends({}, props, { ref: ref })), div);
|
6657 | };
|
6658 |
|
6659 | exports["default"] = Notification;
|
6660 | module.exports = exports['default'];
|
6661 |
|
6662 | }),
|
6663 |
|
6664 | (function(module, exports, __webpack_require__) {
|
6665 |
|
6666 | 'use strict';
|
6667 |
|
6668 | Object.defineProperty(exports, "__esModule", {
|
6669 | value: true
|
6670 | });
|
6671 |
|
6672 | var _Animate = __webpack_require__(70);
|
6673 |
|
6674 | var _Animate2 = _interopRequireDefault(_Animate);
|
6675 |
|
6676 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6677 |
|
6678 | exports["default"] = _Animate2["default"];
|
6679 | module.exports = exports['default'];
|
6680 |
|
6681 | }),
|
6682 |
|
6683 | (function(module, exports, __webpack_require__) {
|
6684 |
|
6685 | 'use strict';
|
6686 |
|
6687 | Object.defineProperty(exports, "__esModule", {
|
6688 | value: true
|
6689 | });
|
6690 |
|
6691 | var _react = __webpack_require__(1);
|
6692 |
|
6693 | var _react2 = _interopRequireDefault(_react);
|
6694 |
|
6695 | var _propTypes = __webpack_require__(6);
|
6696 |
|
6697 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
6698 |
|
6699 | var _ChildrenUtils = __webpack_require__(71);
|
6700 |
|
6701 | var _AnimateChild = __webpack_require__(72);
|
6702 |
|
6703 | var _AnimateChild2 = _interopRequireDefault(_AnimateChild);
|
6704 |
|
6705 | var _util = __webpack_require__(73);
|
6706 |
|
6707 | var _util2 = _interopRequireDefault(_util);
|
6708 |
|
6709 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
6710 |
|
6711 | 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; }
|
6712 |
|
6713 | 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; }
|
6714 |
|
6715 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6716 |
|
6717 | 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; }
|
6718 |
|
6719 | 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); }
|
6720 |
|
6721 | var defaultKey = 'u_animate_' + Date.now();
|
6722 |
|
6723 |
|
6724 | function getChildrenFromProps(props) {
|
6725 | var children = props.children;
|
6726 | if (_react2["default"].isValidElement(children)) {
|
6727 | if (!children.key) {
|
6728 | return _react2["default"].cloneElement(children, {
|
6729 | key: defaultKey
|
6730 | });
|
6731 | }
|
6732 | }
|
6733 | return children;
|
6734 | }
|
6735 |
|
6736 | function noop() {}
|
6737 |
|
6738 | var propTypes = {
|
6739 | component: _propTypes2["default"].any,
|
6740 | animation: _propTypes2["default"].object,
|
6741 | transitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
|
6742 | transitionEnter: _propTypes2["default"].bool,
|
6743 | transitionAppear: _propTypes2["default"].bool,
|
6744 | exclusive: _propTypes2["default"].bool,
|
6745 | transitionLeave: _propTypes2["default"].bool,
|
6746 | onEnd: _propTypes2["default"].func,
|
6747 | onEnter: _propTypes2["default"].func,
|
6748 | onLeave: _propTypes2["default"].func,
|
6749 | onAppear: _propTypes2["default"].func,
|
6750 | showProp: _propTypes2["default"].string
|
6751 | };
|
6752 |
|
6753 | var defaultProps = {
|
6754 | animation: {},
|
6755 | component: 'span',
|
6756 | transitionEnter: true,
|
6757 | transitionLeave: true,
|
6758 | transitionAppear: false,
|
6759 | onEnd: noop,
|
6760 | onEnter: noop,
|
6761 | onLeave: noop,
|
6762 | onAppear: noop
|
6763 | };
|
6764 |
|
6765 | var Animate = function (_Component) {
|
6766 | _inherits(Animate, _Component);
|
6767 |
|
6768 | function Animate(props) {
|
6769 | _classCallCheck(this, Animate);
|
6770 |
|
6771 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
6772 |
|
6773 | _this.currentlyAnimatingKeys = {};
|
6774 | _this.keysToEnter = [];
|
6775 | _this.keysToLeave = [];
|
6776 | _this.state = {
|
6777 | children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(_this.props))
|
6778 | };
|
6779 |
|
6780 | _this.performEnter = _this.performEnter.bind(_this);
|
6781 | _this.performAppear = _this.performAppear.bind(_this);
|
6782 | _this.handleDoneAdding = _this.handleDoneAdding.bind(_this);
|
6783 | _this.performLeave = _this.performLeave.bind(_this);
|
6784 |
|
6785 | _this.performLeave = _this.performLeave.bind(_this);
|
6786 | _this.handleDoneLeaving = _this.handleDoneLeaving.bind(_this);
|
6787 | _this.isValidChildByKey = _this.isValidChildByKey.bind(_this);
|
6788 | _this.stop = _this.stop.bind(_this);
|
6789 | return _this;
|
6790 | }
|
6791 |
|
6792 | Animate.prototype.componentDidMount = function componentDidMount() {
|
6793 | var _this2 = this;
|
6794 |
|
6795 | this.mounted = true;
|
6796 | var showProp = this.props.showProp;
|
6797 | var children = this.state.children;
|
6798 | if (showProp) {
|
6799 | children = children.filter(function (child) {
|
6800 | return !!child.props[showProp];
|
6801 | });
|
6802 | }
|
6803 | children.forEach(function (child) {
|
6804 | if (child) {
|
6805 | _this2.performAppear(child.key);
|
6806 | }
|
6807 | });
|
6808 | };
|
6809 |
|
6810 | Animate.prototype.componentWillUnmount = function componentWillUnmount() {
|
6811 | this.mounted = false;
|
6812 | };
|
6813 |
|
6814 | Animate.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
6815 | var _this3 = this;
|
6816 |
|
6817 | this.nextProps = nextProps;
|
6818 | var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps));
|
6819 | var props = this.props;
|
6820 |
|
6821 | if (props.exclusive) {
|
6822 | Object.keys(this.currentlyAnimatingKeys).forEach(function (key) {
|
6823 | _this3.stop(key);
|
6824 | });
|
6825 | }
|
6826 | var showProp = props.showProp;
|
6827 | var currentlyAnimatingKeys = this.currentlyAnimatingKeys;
|
6828 |
|
6829 | var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children;
|
6830 |
|
6831 | var newChildren = [];
|
6832 | if (showProp) {
|
6833 | currentChildren.forEach(function (currentChild) {
|
6834 | var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key);
|
6835 | var newChild = void 0;
|
6836 | if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) {
|
6837 | newChild = _react2["default"].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true));
|
6838 | } else {
|
6839 | newChild = nextChild;
|
6840 | }
|
6841 | if (newChild) {
|
6842 | newChildren.push(newChild);
|
6843 | }
|
6844 | });
|
6845 | nextChildren.forEach(function (nextChild) {
|
6846 | if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) {
|
6847 | newChildren.push(nextChild);
|
6848 | }
|
6849 | });
|
6850 | } else {
|
6851 | newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren);
|
6852 | }
|
6853 |
|
6854 |
|
6855 | this.setState({
|
6856 | children: newChildren
|
6857 | });
|
6858 |
|
6859 | nextChildren.forEach(function (child) {
|
6860 | var key = child && child.key;
|
6861 | if (child && currentlyAnimatingKeys[key]) {
|
6862 | return;
|
6863 | }
|
6864 | var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
6865 | if (showProp) {
|
6866 | var showInNext = child.props[showProp];
|
6867 | if (hasPrev) {
|
6868 | var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
6869 | if (!showInNow && showInNext) {
|
6870 | _this3.keysToEnter.push(key);
|
6871 | }
|
6872 | } else if (showInNext) {
|
6873 | _this3.keysToEnter.push(key);
|
6874 | }
|
6875 | } else if (!hasPrev) {
|
6876 | _this3.keysToEnter.push(key);
|
6877 | }
|
6878 | });
|
6879 |
|
6880 | currentChildren.forEach(function (child) {
|
6881 | var key = child && child.key;
|
6882 | if (child && currentlyAnimatingKeys[key]) {
|
6883 | return;
|
6884 | }
|
6885 | var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key);
|
6886 | if (showProp) {
|
6887 | var showInNow = child.props[showProp];
|
6888 | if (hasNext) {
|
6889 | var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp);
|
6890 | if (!showInNext && showInNow) {
|
6891 | _this3.keysToLeave.push(key);
|
6892 | }
|
6893 | } else if (showInNow) {
|
6894 | _this3.keysToLeave.push(key);
|
6895 | }
|
6896 | } else if (!hasNext) {
|
6897 | _this3.keysToLeave.push(key);
|
6898 | }
|
6899 | });
|
6900 | };
|
6901 |
|
6902 | Animate.prototype.componentDidUpdate = function componentDidUpdate() {
|
6903 | var keysToEnter = this.keysToEnter;
|
6904 | this.keysToEnter = [];
|
6905 | keysToEnter.forEach(this.performEnter);
|
6906 | var keysToLeave = this.keysToLeave;
|
6907 | this.keysToLeave = [];
|
6908 | keysToLeave.forEach(this.performLeave);
|
6909 | };
|
6910 |
|
6911 | Animate.prototype.performEnter = function performEnter(key) {
|
6912 |
|
6913 | if (this.refs[key]) {
|
6914 | this.currentlyAnimatingKeys[key] = true;
|
6915 | this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter'));
|
6916 | }
|
6917 | };
|
6918 |
|
6919 | Animate.prototype.performAppear = function performAppear(key) {
|
6920 | if (this.refs[key]) {
|
6921 | this.currentlyAnimatingKeys[key] = true;
|
6922 | this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear'));
|
6923 | }
|
6924 | };
|
6925 |
|
6926 | Animate.prototype.handleDoneAdding = function handleDoneAdding(key, type) {
|
6927 | var props = this.props;
|
6928 | delete this.currentlyAnimatingKeys[key];
|
6929 |
|
6930 | if (props.exclusive && props !== this.nextProps) {
|
6931 | return;
|
6932 | }
|
6933 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
6934 | if (!this.isValidChildByKey(currentChildren, key)) {
|
6935 |
|
6936 | this.performLeave(key);
|
6937 | } else {
|
6938 | if (type === 'appear') {
|
6939 | if (_util2["default"].allowAppearCallback(props)) {
|
6940 | props.onAppear(key);
|
6941 | props.onEnd(key, true);
|
6942 | }
|
6943 | } else {
|
6944 | if (_util2["default"].allowEnterCallback(props)) {
|
6945 | props.onEnter(key);
|
6946 | props.onEnd(key, true);
|
6947 | }
|
6948 | }
|
6949 | }
|
6950 | };
|
6951 |
|
6952 | Animate.prototype.performLeave = function performLeave(key) {
|
6953 |
|
6954 | if (this.refs[key]) {
|
6955 | this.currentlyAnimatingKeys[key] = true;
|
6956 | this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key));
|
6957 | }
|
6958 | };
|
6959 |
|
6960 | Animate.prototype.handleDoneLeaving = function handleDoneLeaving(key) {
|
6961 | var props = this.props;
|
6962 | delete this.currentlyAnimatingKeys[key];
|
6963 |
|
6964 | if (props.exclusive && props !== this.nextProps) {
|
6965 | return;
|
6966 | }
|
6967 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
|
6968 |
|
6969 | if (this.isValidChildByKey(currentChildren, key)) {
|
6970 | this.performEnter(key);
|
6971 | } else {
|
6972 | var end = function end() {
|
6973 | if (_util2["default"].allowLeaveCallback(props)) {
|
6974 | props.onLeave(key);
|
6975 | props.onEnd(key, false);
|
6976 | }
|
6977 | };
|
6978 |
|
6979 | if (this.mounted && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) {
|
6980 | this.setState({
|
6981 | children: currentChildren
|
6982 | }, end);
|
6983 | } else {
|
6984 | end();
|
6985 | }
|
6986 | }
|
6987 | };
|
6988 |
|
6989 | Animate.prototype.isValidChildByKey = function isValidChildByKey(currentChildren, key) {
|
6990 | var showProp = this.props.showProp;
|
6991 | if (showProp) {
|
6992 | return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
|
6993 | }
|
6994 | return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
|
6995 | };
|
6996 |
|
6997 | Animate.prototype.stop = function stop(key) {
|
6998 | delete this.currentlyAnimatingKeys[key];
|
6999 | var component = this.refs[key];
|
7000 | if (component) {
|
7001 | component.stop();
|
7002 | }
|
7003 | };
|
7004 |
|
7005 | Animate.prototype.render = function render() {
|
7006 | var props = this.props;
|
7007 | this.nextProps = props;
|
7008 | var stateChildren = this.state.children;
|
7009 | var children = null;
|
7010 | if (stateChildren) {
|
7011 | children = stateChildren.map(function (child) {
|
7012 | if (child === null || child === undefined) {
|
7013 | return child;
|
7014 | }
|
7015 | if (!child.key) {
|
7016 | throw new Error('must set key for <rc-animate> children');
|
7017 | }
|
7018 | return _react2["default"].createElement(
|
7019 | _AnimateChild2["default"],
|
7020 | {
|
7021 | key: child.key,
|
7022 | ref: child.key,
|
7023 | animation: props.animation,
|
7024 | transitionName: props.transitionName,
|
7025 | transitionEnter: props.transitionEnter,
|
7026 | transitionAppear: props.transitionAppear,
|
7027 | transitionLeave: props.transitionLeave
|
7028 | },
|
7029 | child
|
7030 | );
|
7031 | });
|
7032 | }
|
7033 | var Component = props.component;
|
7034 | if (Component) {
|
7035 | var passedProps = props;
|
7036 | if (typeof Component === 'string') {
|
7037 | passedProps = {
|
7038 | className: props.className,
|
7039 | style: props.style
|
7040 | };
|
7041 | }
|
7042 | return _react2["default"].createElement(
|
7043 | Component,
|
7044 | passedProps,
|
7045 | children
|
7046 | );
|
7047 | }
|
7048 | return children[0] || null;
|
7049 | };
|
7050 |
|
7051 | return Animate;
|
7052 | }(_react.Component);
|
7053 |
|
7054 | ;
|
7055 | Animate.defaultProps = defaultProps;
|
7056 | Animate.propTypes = Animate.propTypes;
|
7057 |
|
7058 | exports["default"] = Animate;
|
7059 | module.exports = exports['default'];
|
7060 |
|
7061 | }),
|
7062 |
|
7063 | (function(module, exports, __webpack_require__) {
|
7064 |
|
7065 | 'use strict';
|
7066 |
|
7067 | Object.defineProperty(exports, "__esModule", {
|
7068 | value: true
|
7069 | });
|
7070 | exports.toArrayChildren = toArrayChildren;
|
7071 | exports.findChildInChildrenByKey = findChildInChildrenByKey;
|
7072 | exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey;
|
7073 | exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey;
|
7074 | exports.isSameChildren = isSameChildren;
|
7075 | exports.mergeChildren = mergeChildren;
|
7076 |
|
7077 | var _react = __webpack_require__(1);
|
7078 |
|
7079 | var _react2 = _interopRequireDefault(_react);
|
7080 |
|
7081 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7082 |
|
7083 | function toArrayChildren(children) {
|
7084 | var ret = [];
|
7085 | _react2["default"].Children.forEach(children, function (child) {
|
7086 | ret.push(child);
|
7087 | });
|
7088 | return ret;
|
7089 | }
|
7090 |
|
7091 | function findChildInChildrenByKey(children, key) {
|
7092 | var ret = null;
|
7093 | if (children) {
|
7094 | children.forEach(function (child) {
|
7095 | if (ret) {
|
7096 | return;
|
7097 | }
|
7098 | if (child && child.key === key) {
|
7099 | ret = child;
|
7100 | }
|
7101 | });
|
7102 | }
|
7103 | return ret;
|
7104 | }
|
7105 |
|
7106 | function findShownChildInChildrenByKey(children, key, showProp) {
|
7107 | var ret = null;
|
7108 | if (children) {
|
7109 | children.forEach(function (child) {
|
7110 | if (child && child.key === key && child.props[showProp]) {
|
7111 | if (ret) {
|
7112 | throw new Error('two child with same key for <rc-animate> children');
|
7113 | }
|
7114 | ret = child;
|
7115 | }
|
7116 | });
|
7117 | }
|
7118 | return ret;
|
7119 | }
|
7120 |
|
7121 | function findHiddenChildInChildrenByKey(children, key, showProp) {
|
7122 | var found = 0;
|
7123 | if (children) {
|
7124 | children.forEach(function (child) {
|
7125 | if (found) {
|
7126 | return;
|
7127 | }
|
7128 | found = child && child.key === key && !child.props[showProp];
|
7129 | });
|
7130 | }
|
7131 | return found;
|
7132 | }
|
7133 |
|
7134 | function isSameChildren(c1, c2, showProp) {
|
7135 | var same = c1.length === c2.length;
|
7136 | if (same) {
|
7137 | c1.forEach(function (child, index) {
|
7138 | var child2 = c2[index];
|
7139 | if (child && child2) {
|
7140 | if (child && !child2 || !child && child2) {
|
7141 | same = false;
|
7142 | } else if (child.key !== child2.key) {
|
7143 | same = false;
|
7144 | } else if (showProp && child.props[showProp] !== child2.props[showProp]) {
|
7145 | same = false;
|
7146 | }
|
7147 | }
|
7148 | });
|
7149 | }
|
7150 | return same;
|
7151 | }
|
7152 |
|
7153 | function mergeChildren(prev, next) {
|
7154 | var ret = [];
|
7155 |
|
7156 |
|
7157 |
|
7158 | var nextChildrenPending = {};
|
7159 | var pendingChildren = [];
|
7160 | prev.forEach(function (child) {
|
7161 | if (child && findChildInChildrenByKey(next, child.key)) {
|
7162 | if (pendingChildren.length) {
|
7163 | nextChildrenPending[child.key] = pendingChildren;
|
7164 | pendingChildren = [];
|
7165 | }
|
7166 | } else {
|
7167 | pendingChildren.push(child);
|
7168 | }
|
7169 | });
|
7170 |
|
7171 | next.forEach(function (child) {
|
7172 | if (child && nextChildrenPending.hasOwnProperty(child.key)) {
|
7173 | ret = ret.concat(nextChildrenPending[child.key]);
|
7174 | }
|
7175 | ret.push(child);
|
7176 | });
|
7177 |
|
7178 | ret = ret.concat(pendingChildren);
|
7179 |
|
7180 | return ret;
|
7181 | }
|
7182 |
|
7183 | }),
|
7184 |
|
7185 | (function(module, exports, __webpack_require__) {
|
7186 |
|
7187 | 'use strict';
|
7188 |
|
7189 | Object.defineProperty(exports, "__esModule", {
|
7190 | value: true
|
7191 | });
|
7192 |
|
7193 | 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; };
|
7194 |
|
7195 | var _react = __webpack_require__(1);
|
7196 |
|
7197 | var _react2 = _interopRequireDefault(_react);
|
7198 |
|
7199 | var _propTypes = __webpack_require__(6);
|
7200 |
|
7201 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7202 |
|
7203 | var _reactDom = __webpack_require__(2);
|
7204 |
|
7205 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7206 |
|
7207 | var _tinperBeeCore = __webpack_require__(27);
|
7208 |
|
7209 | var _util = __webpack_require__(73);
|
7210 |
|
7211 | var _util2 = _interopRequireDefault(_util);
|
7212 |
|
7213 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7214 |
|
7215 | 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; }
|
7216 |
|
7217 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7218 |
|
7219 | 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; }
|
7220 |
|
7221 | 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); }
|
7222 |
|
7223 | var transitionMap = {
|
7224 | enter: 'transitionEnter',
|
7225 | appear: 'transitionAppear',
|
7226 | leave: 'transitionLeave'
|
7227 | };
|
7228 |
|
7229 | var propTypes = {
|
7230 | children: _propTypes2["default"].any
|
7231 | };
|
7232 |
|
7233 | var AnimateChild = function (_Component) {
|
7234 | _inherits(AnimateChild, _Component);
|
7235 |
|
7236 | function AnimateChild(props) {
|
7237 | _classCallCheck(this, AnimateChild);
|
7238 |
|
7239 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
7240 |
|
7241 | _this.transition = _this.transition.bind(_this);
|
7242 | _this.stop = _this.stop.bind(_this);
|
7243 | return _this;
|
7244 | }
|
7245 |
|
7246 | AnimateChild.prototype.componentWillUnmount = function componentWillUnmount() {
|
7247 | this.stop();
|
7248 | };
|
7249 |
|
7250 | AnimateChild.prototype.componentWillEnter = function componentWillEnter(done) {
|
7251 | if (_util2["default"].isEnterSupported(this.props)) {
|
7252 | this.transition('enter', done);
|
7253 | } else {
|
7254 | done();
|
7255 | }
|
7256 | };
|
7257 |
|
7258 | AnimateChild.prototype.componentWillAppear = function componentWillAppear(done) {
|
7259 | if (_util2["default"].isAppearSupported(this.props)) {
|
7260 | this.transition('appear', done);
|
7261 | } else {
|
7262 | done();
|
7263 | }
|
7264 | };
|
7265 |
|
7266 | AnimateChild.prototype.componentWillLeave = function componentWillLeave(done) {
|
7267 | if (_util2["default"].isLeaveSupported(this.props)) {
|
7268 | this.transition('leave', done);
|
7269 | } else {
|
7270 |
|
7271 |
|
7272 |
|
7273 | done();
|
7274 | }
|
7275 | };
|
7276 |
|
7277 | AnimateChild.prototype.transition = function transition(animationType, finishCallback) {
|
7278 | var _this2 = this;
|
7279 |
|
7280 | var node = _reactDom2["default"].findDOMNode(this);
|
7281 | var props = this.props;
|
7282 | var transitionName = props.transitionName;
|
7283 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
|
7284 | this.stop();
|
7285 | var end = function end() {
|
7286 | _this2.stopper = null;
|
7287 | finishCallback();
|
7288 | };
|
7289 | if ((_tinperBeeCore.cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {
|
7290 | var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType;
|
7291 | var activeName = name + '-active';
|
7292 | if (nameIsObj && transitionName[animationType + 'Active']) {
|
7293 | activeName = transitionName[animationType + 'Active'];
|
7294 | }
|
7295 | this.stopper = (0, _tinperBeeCore.cssAnimation)(node, {
|
7296 | name: name,
|
7297 | active: activeName
|
7298 | }, end);
|
7299 | } else {
|
7300 | this.stopper = props.animation[animationType](node, end);
|
7301 | }
|
7302 | };
|
7303 |
|
7304 | AnimateChild.prototype.stop = function stop() {
|
7305 | var stopper = this.stopper;
|
7306 | if (stopper) {
|
7307 | this.stopper = null;
|
7308 | stopper.stop();
|
7309 | }
|
7310 | };
|
7311 |
|
7312 | AnimateChild.prototype.render = function render() {
|
7313 | return this.props.children;
|
7314 | };
|
7315 |
|
7316 | return AnimateChild;
|
7317 | }(_react.Component);
|
7318 |
|
7319 | ;
|
7320 |
|
7321 | AnimateChild.propTypes = propTypes;
|
7322 |
|
7323 | exports["default"] = AnimateChild;
|
7324 | module.exports = exports['default'];
|
7325 |
|
7326 | }),
|
7327 |
|
7328 | (function(module, exports) {
|
7329 |
|
7330 | "use strict";
|
7331 |
|
7332 | Object.defineProperty(exports, "__esModule", {
|
7333 | value: true
|
7334 | });
|
7335 | var util = {
|
7336 | isAppearSupported: function isAppearSupported(props) {
|
7337 | return props.transitionName && props.transitionAppear || props.animation.appear;
|
7338 | },
|
7339 | isEnterSupported: function isEnterSupported(props) {
|
7340 | return props.transitionName && props.transitionEnter || props.animation.enter;
|
7341 | },
|
7342 | isLeaveSupported: function isLeaveSupported(props) {
|
7343 | return props.transitionName && props.transitionLeave || props.animation.leave;
|
7344 | },
|
7345 | allowAppearCallback: function allowAppearCallback(props) {
|
7346 | return props.transitionAppear || props.animation.appear;
|
7347 | },
|
7348 | allowEnterCallback: function allowEnterCallback(props) {
|
7349 | return props.transitionEnter || props.animation.enter;
|
7350 | },
|
7351 | allowLeaveCallback: function allowLeaveCallback(props) {
|
7352 | return props.transitionLeave || props.animation.leave;
|
7353 | }
|
7354 | };
|
7355 | exports["default"] = util;
|
7356 | module.exports = exports["default"];
|
7357 |
|
7358 | }),
|
7359 |
|
7360 | (function(module, exports, __webpack_require__) {
|
7361 |
|
7362 | 'use strict';
|
7363 |
|
7364 | Object.defineProperty(exports, "__esModule", {
|
7365 | value: true
|
7366 | });
|
7367 |
|
7368 | exports["default"] = function (componentOrElement) {
|
7369 | return (0, _ownerDocument2["default"])(_reactDom2["default"].findDOMNode(componentOrElement));
|
7370 | };
|
7371 |
|
7372 | var _reactDom = __webpack_require__(2);
|
7373 |
|
7374 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
7375 |
|
7376 | var _ownerDocument = __webpack_require__(75);
|
7377 |
|
7378 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
7379 |
|
7380 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7381 |
|
7382 | module.exports = exports['default'];
|
7383 |
|
7384 | }),
|
7385 |
|
7386 | (function(module, exports) {
|
7387 |
|
7388 | "use strict";
|
7389 |
|
7390 | exports.__esModule = true;
|
7391 | exports.default = ownerDocument;
|
7392 |
|
7393 | function ownerDocument(node) {
|
7394 | return node && node.ownerDocument || document;
|
7395 | }
|
7396 |
|
7397 | module.exports = exports["default"];
|
7398 |
|
7399 | }),
|
7400 |
|
7401 | (function(module, exports, __webpack_require__) {
|
7402 |
|
7403 | 'use strict';
|
7404 |
|
7405 | Object.defineProperty(exports, "__esModule", {
|
7406 | value: true
|
7407 | });
|
7408 |
|
7409 | exports["default"] = function (node, event, handler, capture) {
|
7410 | (0, _on2["default"])(node, event, handler, capture);
|
7411 |
|
7412 | return {
|
7413 | remove: function remove() {
|
7414 | (0, _off2["default"])(node, event, handler, capture);
|
7415 | }
|
7416 | };
|
7417 | };
|
7418 |
|
7419 | var _on = __webpack_require__(16);
|
7420 |
|
7421 | var _on2 = _interopRequireDefault(_on);
|
7422 |
|
7423 | var _off = __webpack_require__(77);
|
7424 |
|
7425 | var _off2 = _interopRequireDefault(_off);
|
7426 |
|
7427 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7428 |
|
7429 | module.exports = exports['default'];
|
7430 |
|
7431 | }),
|
7432 |
|
7433 | (function(module, exports, __webpack_require__) {
|
7434 |
|
7435 | "use strict";
|
7436 |
|
7437 | var _interopRequireDefault = __webpack_require__(14);
|
7438 |
|
7439 | exports.__esModule = true;
|
7440 | exports.default = void 0;
|
7441 |
|
7442 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
7443 |
|
7444 | var off = function off() {};
|
7445 |
|
7446 | if (_inDOM.default) {
|
7447 | off = function () {
|
7448 | if (document.addEventListener) return function (node, eventName, handler, capture) {
|
7449 | return node.removeEventListener(eventName, handler, capture || false);
|
7450 | };else if (document.attachEvent) return function (node, eventName, handler) {
|
7451 | return node.detachEvent('on' + eventName, handler);
|
7452 | };
|
7453 | }();
|
7454 | }
|
7455 |
|
7456 | var _default = off;
|
7457 | exports.default = _default;
|
7458 | module.exports = exports["default"];
|
7459 |
|
7460 | }),
|
7461 |
|
7462 | (function(module, exports, __webpack_require__) {
|
7463 |
|
7464 | 'use strict';
|
7465 |
|
7466 | Object.defineProperty(exports, "__esModule", {
|
7467 | value: true
|
7468 | });
|
7469 |
|
7470 | 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; };
|
7471 |
|
7472 | var _react = __webpack_require__(1);
|
7473 |
|
7474 | var _react2 = _interopRequireDefault(_react);
|
7475 |
|
7476 | var _classnames = __webpack_require__(5);
|
7477 |
|
7478 | var _classnames2 = _interopRequireDefault(_classnames);
|
7479 |
|
7480 | var _propTypes = __webpack_require__(6);
|
7481 |
|
7482 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7483 |
|
7484 | var _beeIcon = __webpack_require__(79);
|
7485 |
|
7486 | var _beeIcon2 = _interopRequireDefault(_beeIcon);
|
7487 |
|
7488 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7489 |
|
7490 | 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; }
|
7491 |
|
7492 | 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; }
|
7493 |
|
7494 | 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; }
|
7495 |
|
7496 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7497 |
|
7498 | 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; }
|
7499 |
|
7500 | 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); }
|
7501 |
|
7502 | var propTypes = {
|
7503 | duration: _propTypes2["default"].number,
|
7504 | onClose: _propTypes2["default"].func,
|
7505 | children: _propTypes2["default"].any,
|
7506 | color: _propTypes2["default"].oneOf(['info', 'success', 'danger', 'warning', 'light', 'dark', 'news', 'infolight', 'successlight', 'dangerlight', 'warninglight']),
|
7507 | title: _propTypes2["default"].any
|
7508 | };
|
7509 |
|
7510 | function noop() {}
|
7511 |
|
7512 | var defaultProps = {
|
7513 | onEnd: noop,
|
7514 | onClose: noop,
|
7515 | duration: 4.5,
|
7516 | closable: true
|
7517 | };
|
7518 |
|
7519 | var Notice = function (_React$Component) {
|
7520 | _inherits(Notice, _React$Component);
|
7521 |
|
7522 | function Notice(props) {
|
7523 | _classCallCheck(this, Notice);
|
7524 |
|
7525 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
7526 |
|
7527 | _this.clearCloseTimer = _this.clearCloseTimer.bind(_this);
|
7528 | _this.close = _this.close.bind(_this);
|
7529 | return _this;
|
7530 | }
|
7531 |
|
7532 | Notice.prototype.componentDidMount = function componentDidMount() {
|
7533 | var _this2 = this;
|
7534 |
|
7535 | if (this.props.duration) {
|
7536 | this.closeTimer = setTimeout(function () {
|
7537 | _this2.close();
|
7538 | }, this.props.duration * 1000);
|
7539 | }
|
7540 | };
|
7541 |
|
7542 | Notice.prototype.componentWillUnmount = function componentWillUnmount() {
|
7543 | this.clearCloseTimer();
|
7544 | };
|
7545 |
|
7546 | Notice.prototype.clearCloseTimer = function clearCloseTimer() {
|
7547 | if (this.closeTimer) {
|
7548 | clearTimeout(this.closeTimer);
|
7549 | this.closeTimer = null;
|
7550 | }
|
7551 | };
|
7552 |
|
7553 | Notice.prototype.close = function close() {
|
7554 | this.clearCloseTimer();
|
7555 | this.props.onClose();
|
7556 | };
|
7557 |
|
7558 | Notice.prototype.render = function render() {
|
7559 | var _classes;
|
7560 |
|
7561 | var _props = this.props,
|
7562 | closable = _props.closable,
|
7563 | clsPrefix = _props.clsPrefix,
|
7564 | className = _props.className,
|
7565 | style = _props.style,
|
7566 | children = _props.children,
|
7567 | color = _props.color,
|
7568 | title = _props.title,
|
7569 | content = _props.content,
|
7570 | onEnd = _props.onEnd,
|
7571 | onClose = _props.onClose,
|
7572 | duration = _props.duration,
|
7573 | others = _objectWithoutProperties(_props, ['closable', 'clsPrefix', 'className', 'style', 'children', 'color', 'title', 'content', 'onEnd', 'onClose', 'duration']);
|
7574 |
|
7575 | var componentClass = clsPrefix + '-notice';
|
7576 | var classes = (_classes = {}, _defineProperty(_classes, '' + componentClass, 1), _defineProperty(_classes, componentClass + '-closable', closable), _defineProperty(_classes, className, !!className), _classes);
|
7577 | if (color) {
|
7578 | classes[componentClass + '-' + color] = true;
|
7579 | }
|
7580 | return _react2["default"].createElement(
|
7581 | 'div',
|
7582 | _extends({ className: (0, _classnames2["default"])(classes), style: style, onClick: this.close }, others),
|
7583 | _react2["default"].createElement(
|
7584 | 'div',
|
7585 | { className: componentClass + '-content' },
|
7586 | title && _react2["default"].createElement(
|
7587 | 'div',
|
7588 | { className: componentClass + '-title' },
|
7589 | title
|
7590 | ),
|
7591 | _react2["default"].createElement(
|
7592 | 'div',
|
7593 | { className: componentClass + '-description' },
|
7594 | children
|
7595 | )
|
7596 | ),
|
7597 | closable ? _react2["default"].createElement(
|
7598 | 'a',
|
7599 | { tabIndex: '0', onClick: this.close, className: componentClass + '-close' },
|
7600 | _react2["default"].createElement(
|
7601 | 'span',
|
7602 | { className: componentClass + '-close-x' },
|
7603 | _react2["default"].createElement(_beeIcon2["default"], { type: 'uf-close' })
|
7604 | )
|
7605 | ) : null
|
7606 | );
|
7607 | };
|
7608 |
|
7609 | return Notice;
|
7610 | }(_react2["default"].Component);
|
7611 |
|
7612 | ;
|
7613 |
|
7614 | Notice.propTypes = propTypes;
|
7615 | Notice.defaultProps = defaultProps;
|
7616 |
|
7617 | exports["default"] = Notice;
|
7618 | module.exports = exports['default'];
|
7619 |
|
7620 | }),
|
7621 |
|
7622 | (function(module, exports, __webpack_require__) {
|
7623 |
|
7624 | 'use strict';
|
7625 |
|
7626 | Object.defineProperty(exports, "__esModule", {
|
7627 | value: true
|
7628 | });
|
7629 |
|
7630 | var _Icon = __webpack_require__(80);
|
7631 |
|
7632 | var _Icon2 = _interopRequireDefault(_Icon);
|
7633 |
|
7634 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7635 |
|
7636 | exports["default"] = _Icon2["default"];
|
7637 | module.exports = exports['default'];
|
7638 |
|
7639 | }),
|
7640 |
|
7641 | (function(module, exports, __webpack_require__) {
|
7642 |
|
7643 | 'use strict';
|
7644 |
|
7645 | Object.defineProperty(exports, "__esModule", {
|
7646 | value: true
|
7647 | });
|
7648 |
|
7649 | 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; };
|
7650 |
|
7651 | var _react = __webpack_require__(1);
|
7652 |
|
7653 | var _react2 = _interopRequireDefault(_react);
|
7654 |
|
7655 | var _classnames = __webpack_require__(5);
|
7656 |
|
7657 | var _classnames2 = _interopRequireDefault(_classnames);
|
7658 |
|
7659 | var _propTypes = __webpack_require__(6);
|
7660 |
|
7661 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7662 |
|
7663 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7664 |
|
7665 | 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; }
|
7666 |
|
7667 | 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; }
|
7668 |
|
7669 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7670 |
|
7671 | 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; }
|
7672 |
|
7673 | 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); }
|
7674 |
|
7675 | var propTypes = {
|
7676 | type: _propTypes2["default"].string
|
7677 |
|
7678 | };
|
7679 | |
7680 |
|
7681 |
|
7682 | var defaultProps = {
|
7683 | clsPrefix: 'uf'
|
7684 | };
|
7685 |
|
7686 | var Icon = function (_Component) {
|
7687 | _inherits(Icon, _Component);
|
7688 |
|
7689 | function Icon(props) {
|
7690 | _classCallCheck(this, Icon);
|
7691 |
|
7692 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
7693 | }
|
7694 |
|
7695 | Icon.prototype.render = function render() {
|
7696 | var _props = this.props,
|
7697 | type = _props.type,
|
7698 | className = _props.className,
|
7699 | clsPrefix = _props.clsPrefix,
|
7700 | others = _objectWithoutProperties(_props, ['type', 'className', 'clsPrefix']);
|
7701 |
|
7702 | var clsObj = {};
|
7703 |
|
7704 | var classNames = (0, _classnames2["default"])(clsPrefix, type);
|
7705 |
|
7706 | return _react2["default"].createElement('i', _extends({}, others, { className: (0, _classnames2["default"])(classNames, className) }));
|
7707 | };
|
7708 |
|
7709 | return Icon;
|
7710 | }(_react.Component);
|
7711 |
|
7712 | Icon.defaultProps = defaultProps;
|
7713 | Icon.propTypes = propTypes;
|
7714 |
|
7715 | exports["default"] = Icon;
|
7716 | module.exports = exports['default'];
|
7717 |
|
7718 | }),
|
7719 |
|
7720 | (function(module, exports, __webpack_require__) {
|
7721 |
|
7722 | "use strict";
|
7723 |
|
7724 | var deselectCurrent = __webpack_require__(82);
|
7725 |
|
7726 | var defaultMessage = "Copy to clipboard: #{key}, Enter";
|
7727 |
|
7728 | function format(message) {
|
7729 | var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
|
7730 | return message.replace(/#{\s*key\s*}/g, copyKey);
|
7731 | }
|
7732 |
|
7733 | function copy(text, options) {
|
7734 | var debug,
|
7735 | message,
|
7736 | reselectPrevious,
|
7737 | range,
|
7738 | selection,
|
7739 | mark,
|
7740 | success = false;
|
7741 | if (!options) {
|
7742 | options = {};
|
7743 | }
|
7744 | debug = options.debug || false;
|
7745 | try {
|
7746 | reselectPrevious = deselectCurrent();
|
7747 |
|
7748 | range = document.createRange();
|
7749 | selection = document.getSelection();
|
7750 |
|
7751 | mark = document.createElement("span");
|
7752 | mark.textContent = text;
|
7753 |
|
7754 | mark.style.all = "unset";
|
7755 |
|
7756 | mark.style.position = "fixed";
|
7757 | mark.style.top = 0;
|
7758 | mark.style.clip = "rect(0, 0, 0, 0)";
|
7759 |
|
7760 | mark.style.whiteSpace = "pre";
|
7761 |
|
7762 | mark.style.webkitUserSelect = "text";
|
7763 | mark.style.MozUserSelect = "text";
|
7764 | mark.style.msUserSelect = "text";
|
7765 | mark.style.userSelect = "text";
|
7766 | mark.addEventListener("copy", function(e) {
|
7767 | e.stopPropagation();
|
7768 | if (options.format) {
|
7769 | e.preventDefault();
|
7770 | e.clipboardData.clearData();
|
7771 | e.clipboardData.setData(options.format, text);
|
7772 | }
|
7773 | });
|
7774 |
|
7775 | document.body.appendChild(mark);
|
7776 |
|
7777 | range.selectNodeContents(mark);
|
7778 | selection.addRange(range);
|
7779 |
|
7780 | var successful = document.execCommand("copy");
|
7781 | if (!successful) {
|
7782 | throw new Error("copy command was unsuccessful");
|
7783 | }
|
7784 | success = true;
|
7785 | } catch (err) {
|
7786 | debug && console.error("unable to copy using execCommand: ", err);
|
7787 | debug && console.warn("trying IE specific stuff");
|
7788 | try {
|
7789 | window.clipboardData.setData(options.format || "text", text);
|
7790 | success = true;
|
7791 | } catch (err) {
|
7792 | debug && console.error("unable to copy using clipboardData: ", err);
|
7793 | debug && console.error("falling back to prompt");
|
7794 | message = format("message" in options ? options.message : defaultMessage);
|
7795 | window.prompt(message, text);
|
7796 | }
|
7797 | } finally {
|
7798 | if (selection) {
|
7799 | if (typeof selection.removeRange == "function") {
|
7800 | selection.removeRange(range);
|
7801 | } else {
|
7802 | selection.removeAllRanges();
|
7803 | }
|
7804 | }
|
7805 |
|
7806 | if (mark) {
|
7807 | document.body.removeChild(mark);
|
7808 | }
|
7809 | reselectPrevious();
|
7810 | }
|
7811 |
|
7812 | return success;
|
7813 | }
|
7814 |
|
7815 | module.exports = copy;
|
7816 |
|
7817 |
|
7818 | }),
|
7819 |
|
7820 | (function(module, exports) {
|
7821 |
|
7822 |
|
7823 | module.exports = function () {
|
7824 | var selection = document.getSelection();
|
7825 | if (!selection.rangeCount) {
|
7826 | return function () {};
|
7827 | }
|
7828 | var active = document.activeElement;
|
7829 |
|
7830 | var ranges = [];
|
7831 | for (var i = 0; i < selection.rangeCount; i++) {
|
7832 | ranges.push(selection.getRangeAt(i));
|
7833 | }
|
7834 |
|
7835 | switch (active.tagName.toUpperCase()) {
|
7836 | case 'INPUT':
|
7837 | case 'TEXTAREA':
|
7838 | active.blur();
|
7839 | break;
|
7840 |
|
7841 | default:
|
7842 | active = null;
|
7843 | break;
|
7844 | }
|
7845 |
|
7846 | selection.removeAllRanges();
|
7847 | return function () {
|
7848 | selection.type === 'Caret' &&
|
7849 | selection.removeAllRanges();
|
7850 |
|
7851 | if (!selection.rangeCount) {
|
7852 | ranges.forEach(function(range) {
|
7853 | selection.addRange(range);
|
7854 | });
|
7855 | }
|
7856 |
|
7857 | active &&
|
7858 | active.focus();
|
7859 | };
|
7860 | };
|
7861 |
|
7862 |
|
7863 | }),
|
7864 |
|
7865 | (function(module, exports, __webpack_require__) {
|
7866 |
|
7867 | 'use strict';
|
7868 |
|
7869 | Object.defineProperty(exports, "__esModule", {
|
7870 | value: true
|
7871 | });
|
7872 |
|
7873 | 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; };
|
7874 |
|
7875 | var _classnames = __webpack_require__(5);
|
7876 |
|
7877 | var _classnames2 = _interopRequireDefault(_classnames);
|
7878 |
|
7879 | var _react = __webpack_require__(1);
|
7880 |
|
7881 | var _react2 = _interopRequireDefault(_react);
|
7882 |
|
7883 | var _propTypes = __webpack_require__(6);
|
7884 |
|
7885 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
7886 |
|
7887 | var _tinperBeeCore = __webpack_require__(27);
|
7888 |
|
7889 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
7890 |
|
7891 | 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; }
|
7892 |
|
7893 | 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; }
|
7894 |
|
7895 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7896 |
|
7897 | 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; }
|
7898 |
|
7899 | 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); }
|
7900 |
|
7901 | var propTypes = {
|
7902 |
|
7903 | accordion: _propTypes2["default"].bool,
|
7904 |
|
7905 | activeKey: _propTypes2["default"].any,
|
7906 |
|
7907 | defaultActiveKey: _propTypes2["default"].any,
|
7908 |
|
7909 | onSelect: _propTypes2["default"].func,
|
7910 | role: _propTypes2["default"].string
|
7911 | };
|
7912 |
|
7913 | var defaultProps = {
|
7914 | accordion: false,
|
7915 | clsPrefix: 'u-panel-group'
|
7916 | };
|
7917 |
|
7918 |
|
7919 |
|
7920 | var PanelGroup = function (_React$Component) {
|
7921 | _inherits(PanelGroup, _React$Component);
|
7922 |
|
7923 | function PanelGroup(props, context) {
|
7924 | _classCallCheck(this, PanelGroup);
|
7925 |
|
7926 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
7927 |
|
7928 | _this.handleSelect = _this.handleSelect.bind(_this);
|
7929 |
|
7930 | _this.state = {
|
7931 | activeKey: props.defaultActiveKey
|
7932 | };
|
7933 | return _this;
|
7934 | }
|
7935 |
|
7936 | PanelGroup.prototype.handleSelect = function handleSelect(key, e) {
|
7937 | e.preventDefault();
|
7938 |
|
7939 | if (this.props.onSelect) {
|
7940 | this.props.onSelect(key, e);
|
7941 | }
|
7942 |
|
7943 | if (this.state.activeKey === key) {
|
7944 | key = null;
|
7945 | }
|
7946 |
|
7947 | this.setState({ activeKey: key });
|
7948 | };
|
7949 |
|
7950 | PanelGroup.prototype.render = function render() {
|
7951 | var _this2 = this;
|
7952 |
|
7953 | var _props = this.props,
|
7954 | accordion = _props.accordion,
|
7955 | propsActiveKey = _props.activeKey,
|
7956 | className = _props.className,
|
7957 | children = _props.children,
|
7958 | defaultActiveKey = _props.defaultActiveKey,
|
7959 | onSelect = _props.onSelect,
|
7960 | style = _props.style,
|
7961 | clsPrefix = _props.clsPrefix,
|
7962 | others = _objectWithoutProperties(_props, ['accordion', 'activeKey', 'className', 'children', 'defaultActiveKey', 'onSelect', 'style', 'clsPrefix']);
|
7963 |
|
7964 | var activeKey = void 0;
|
7965 | if (accordion) {
|
7966 | activeKey = propsActiveKey != null ? propsActiveKey : this.state.activeKey;
|
7967 | others.role = others.role || 'tablist';
|
7968 | }
|
7969 |
|
7970 | var classes = {};
|
7971 | classes['' + clsPrefix] = true;
|
7972 |
|
7973 | return _react2["default"].createElement(
|
7974 | 'div',
|
7975 | _extends({}, others, {
|
7976 | className: (0, _classnames2["default"])(className, classes)
|
7977 | }),
|
7978 | _react2["default"].Children.map(children, function (child) {
|
7979 | if (!_react2["default"].isValidElement(child)) {
|
7980 | return child;
|
7981 | }
|
7982 | var childProps = {
|
7983 | style: child.props.style
|
7984 | };
|
7985 |
|
7986 | if (accordion) {
|
7987 | _extends(childProps, {
|
7988 | headerRole: 'tab',
|
7989 | panelRole: 'tabpanel',
|
7990 | collapsible: true,
|
7991 | expanded: child.props.eventKey === activeKey,
|
7992 | onSelect: (0, _tinperBeeCore.createChainedFunction)(_this2.handleSelect, child.props.onSelect)
|
7993 | });
|
7994 | }
|
7995 |
|
7996 | return (0, _react.cloneElement)(child, childProps);
|
7997 | })
|
7998 | );
|
7999 | };
|
8000 |
|
8001 | return PanelGroup;
|
8002 | }(_react2["default"].Component);
|
8003 |
|
8004 | PanelGroup.propTypes = propTypes;
|
8005 | PanelGroup.defaultProps = defaultProps;
|
8006 |
|
8007 | exports["default"] = PanelGroup;
|
8008 | module.exports = exports['default'];
|
8009 |
|
8010 | }),
|
8011 |
|
8012 | (function(module, exports, __webpack_require__) {
|
8013 |
|
8014 | 'use strict';
|
8015 |
|
8016 | Object.defineProperty(exports, "__esModule", {
|
8017 | value: true
|
8018 | });
|
8019 |
|
8020 | var _Drawer = __webpack_require__(85);
|
8021 |
|
8022 | var _Drawer2 = _interopRequireDefault(_Drawer);
|
8023 |
|
8024 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
8025 |
|
8026 | exports["default"] = _Drawer2["default"];
|
8027 | module.exports = exports['default'];
|
8028 |
|
8029 | }),
|
8030 |
|
8031 | (function(module, exports, __webpack_require__) {
|
8032 |
|
8033 | 'use strict';
|
8034 |
|
8035 | Object.defineProperty(exports, "__esModule", {
|
8036 | value: true
|
8037 | });
|
8038 |
|
8039 | var _react = __webpack_require__(1);
|
8040 |
|
8041 | var _react2 = _interopRequireDefault(_react);
|
8042 |
|
8043 | var _reactDom = __webpack_require__(2);
|
8044 |
|
8045 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
8046 |
|
8047 | var _propTypes = __webpack_require__(6);
|
8048 |
|
8049 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
8050 |
|
8051 | var _classnames = __webpack_require__(5);
|
8052 |
|
8053 | var _classnames2 = _interopRequireDefault(_classnames);
|
8054 |
|
8055 | var _common = __webpack_require__(86);
|
8056 |
|
8057 | var _reactTransitionGroup = __webpack_require__(87);
|
8058 |
|
8059 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
8060 |
|
8061 | 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; }
|
8062 |
|
8063 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8064 |
|
8065 | 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; }
|
8066 |
|
8067 | 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); }
|
8068 |
|
8069 | var propTypes = {
|
8070 | placement: _propTypes2["default"].oneOf(['left', 'right', 'top', 'bottom']),
|
8071 | hasHeader: _propTypes2["default"].bool,
|
8072 | show: _propTypes2["default"].bool,
|
8073 | title: _propTypes2["default"].string,
|
8074 | className: _propTypes2["default"].string,
|
8075 | showMask: _propTypes2["default"].bool,
|
8076 | maskClosable: _propTypes2["default"].bool,
|
8077 | zIndex: _propTypes2["default"].number,
|
8078 | showClose: _propTypes2["default"].bool,
|
8079 | width: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
8080 | height: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
8081 | destroyOnClose: _propTypes2["default"].bool,
|
8082 | container: _propTypes2["default"].string
|
8083 | };
|
8084 |
|
8085 | var defaultProps = {
|
8086 | placement: 'left',
|
8087 | hasHeader: true,
|
8088 | show: false,
|
8089 | showMask: true,
|
8090 | maskClosable: true,
|
8091 | zIndex: 100000,
|
8092 | showClose: false,
|
8093 | width: 'auto',
|
8094 | height: 'auto',
|
8095 | destroyOnClose: false,
|
8096 | container: 'body'
|
8097 | };
|
8098 |
|
8099 | var DrawerContext = _react2["default"].createContext(null);
|
8100 |
|
8101 | var Drawer = function (_Component) {
|
8102 | _inherits(Drawer, _Component);
|
8103 |
|
8104 | function Drawer(props) {
|
8105 | _classCallCheck(this, Drawer);
|
8106 |
|
8107 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
8108 |
|
8109 | _this.state = {
|
8110 | showDrawer: true,
|
8111 | width: '0',
|
8112 | push: false
|
8113 | };
|
8114 | _this.drawer = null;
|
8115 | _this.parentDrawer = null;
|
8116 | (0, _common.bindAll)(_this, ['fMaskClick', 'fDrawerTransitionEnd', 'renderMask', 'renderClose', 'fCloseClick', 'renderBody', 'renderAll']);
|
8117 | return _this;
|
8118 | }
|
8119 |
|
8120 | Drawer.prototype.componentDidUpdate = function componentDidUpdate(preProps) {
|
8121 |
|
8122 | if (preProps.show != this.props.show && this.parentDrawer) {
|
8123 | if (this.props.show) {
|
8124 | this.parentDrawer.push();
|
8125 | } else {
|
8126 | this.parentDrawer.pull();
|
8127 | }
|
8128 | }
|
8129 | };
|
8130 |
|
8131 | Drawer.prototype.push = function push() {
|
8132 | this.setState({
|
8133 | push: true
|
8134 | });
|
8135 | };
|
8136 |
|
8137 | Drawer.prototype.pull = function pull() {
|
8138 | this.setState({
|
8139 | push: false
|
8140 | });
|
8141 | };
|
8142 |
|
8143 | Drawer.prototype.fMaskClick = function fMaskClick() {
|
8144 | var maskClosable = this.props.maskClosable;
|
8145 |
|
8146 | if (maskClosable) {
|
8147 | var onClose = this.props.onClose;
|
8148 |
|
8149 | onClose && onClose();
|
8150 | }
|
8151 | };
|
8152 |
|
8153 | Drawer.prototype.fCloseClick = function fCloseClick() {
|
8154 | var onClose = this.props.onClose;
|
8155 |
|
8156 | onClose && onClose();
|
8157 | };
|
8158 |
|
8159 | Drawer.prototype.fDrawerTransitionEnd = function fDrawerTransitionEnd(e) {};
|
8160 |
|
8161 | Drawer.prototype.renderMask = function renderMask() {
|
8162 | var _props = this.props,
|
8163 | show = _props.show,
|
8164 | showMask = _props.showMask,
|
8165 | fMaskClick = _props.fMaskClick;
|
8166 |
|
8167 |
|
8168 | var maskStyle = void 0;
|
8169 | if (show) {
|
8170 | maskStyle = {
|
8171 | opacity: 1,
|
8172 | width: '100%'
|
8173 | };
|
8174 | } else {
|
8175 | maskStyle = {
|
8176 | opacity: 0,
|
8177 | width: 0
|
8178 | };
|
8179 | }
|
8180 | return showMask ? _react2["default"].createElement('div', { className: 'drawer-mask', style: maskStyle, onClick: this.fMaskClick }) : null;
|
8181 | };
|
8182 |
|
8183 | Drawer.prototype.renderClose = function renderClose() {
|
8184 | var showClose = this.props.showClose;
|
8185 |
|
8186 | return showClose ? _react2["default"].createElement(
|
8187 | 'i',
|
8188 | { className: 'drawer-close', onClick: this.fCloseClick },
|
8189 | '\xD7'
|
8190 | ) : null;
|
8191 | };
|
8192 |
|
8193 | Drawer.prototype.renderBody = function renderBody() {
|
8194 | var _this2 = this;
|
8195 |
|
8196 | var _props2 = this.props,
|
8197 | destroyOnClose = _props2.destroyOnClose,
|
8198 | show = _props2.show;
|
8199 |
|
8200 | if (destroyOnClose && !show) {
|
8201 | return null;
|
8202 | }
|
8203 | var _props3 = this.props,
|
8204 | hasHeader = _props3.hasHeader,
|
8205 | title = _props3.title,
|
8206 | children = _props3.children,
|
8207 | width = _props3.width,
|
8208 | height = _props3.height,
|
8209 | placement = _props3.placement;
|
8210 | var push = this.state.push;
|
8211 |
|
8212 |
|
8213 | var drawerClass = (0, _classnames2["default"])('drawer', 'drawer-' + placement);
|
8214 |
|
8215 | var translateHideMap = {
|
8216 | left: 'translateX(-100%)',
|
8217 | right: 'translateX(100%)',
|
8218 | top: 'translateY(-100%)',
|
8219 | bottom: 'translateY(100%)'
|
8220 | };
|
8221 | var translateShow = 'translate(0,0)';
|
8222 | if (push) {
|
8223 | var pushNum = 50;
|
8224 | var translateShowMap = {
|
8225 | left: 'translate(' + pushNum + 'px,0)',
|
8226 | right: 'translate(-' + pushNum + 'px,0)',
|
8227 | top: 'translate(0,' + pushNum + 'px)',
|
8228 | bottom: 'translate(0,-' + pushNum + 'px)'
|
8229 | };
|
8230 | translateShow = translateShowMap[placement];
|
8231 | }
|
8232 | var translate = show ? translateShow : translateHideMap[placement];
|
8233 |
|
8234 | if ((0, _common.isNumber)(width)) {
|
8235 | width = width + 'px';
|
8236 | }
|
8237 | if ((0, _common.isNumber)(height)) {
|
8238 | height = height + 'px';
|
8239 | }
|
8240 | if (placement == 'top' || placement == 'bottom') {
|
8241 | if (width == 'auto') {
|
8242 | width = '100%';
|
8243 | }
|
8244 | }
|
8245 | if (placement == 'left' || placement == 'right') {
|
8246 | if (height == 'auto') {
|
8247 | height = '100%';
|
8248 | }
|
8249 | }
|
8250 | var drawerStyle = {
|
8251 | transform: translate,
|
8252 | WebkitTransform: translate,
|
8253 | width: width,
|
8254 | height: height
|
8255 | };
|
8256 | var closer = this.renderClose();
|
8257 | var header = hasHeader ? _react2["default"].createElement(
|
8258 | 'div',
|
8259 | { className: 'drawer-header' },
|
8260 | _react2["default"].createElement(
|
8261 | 'div',
|
8262 | { className: 'drawer-header-title' },
|
8263 | title
|
8264 | )
|
8265 | ) : '';
|
8266 | return _react2["default"].createElement(
|
8267 | DrawerContext.Provider,
|
8268 | { value: this },
|
8269 | _react2["default"].createElement(
|
8270 | 'div',
|
8271 | { ref: function ref(drawer) {
|
8272 | _this2.drawer = drawer;
|
8273 | }, onTransitionEnd: this.fDrawerTransitionEnd, className: drawerClass, style: drawerStyle },
|
8274 | closer,
|
8275 | header,
|
8276 | _react2["default"].createElement(
|
8277 | 'div',
|
8278 | { className: 'drawer-body' },
|
8279 | children
|
8280 | )
|
8281 | )
|
8282 | );
|
8283 | };
|
8284 |
|
8285 | Drawer.prototype.renderAll = function renderAll(value) {
|
8286 | var _props4 = this.props,
|
8287 | show = _props4.show,
|
8288 | className = _props4.className,
|
8289 | zIndex = _props4.zIndex;
|
8290 |
|
8291 |
|
8292 | var drawercClass = (0, _classnames2["default"])('drawerc', className);
|
8293 |
|
8294 | var drawercStyle = { zIndex: zIndex };
|
8295 | if (show) {
|
8296 | drawercStyle.width = '100%';
|
8297 | } else {
|
8298 | drawercStyle.width = 0;
|
8299 | }
|
8300 |
|
8301 | this.parentDrawer = value;
|
8302 |
|
8303 | return _react2["default"].createElement(
|
8304 | 'div',
|
8305 | { className: drawercClass, style: drawercStyle },
|
8306 | this.renderMask(),
|
8307 | this.renderBody()
|
8308 | );
|
8309 | };
|
8310 |
|
8311 | Drawer.prototype.render = function render() {
|
8312 | var container = this.props.container;
|
8313 |
|
8314 | var conDom = document.querySelector(container);
|
8315 |
|
8316 | return _reactDom2["default"].createPortal(_react2["default"].createElement(
|
8317 | DrawerContext.Consumer,
|
8318 | null,
|
8319 | this.renderAll
|
8320 | ), conDom);
|
8321 | };
|
8322 |
|
8323 | return Drawer;
|
8324 | }(_react.Component);
|
8325 |
|
8326 | Drawer.propTypes = propTypes;
|
8327 | Drawer.defaultProps = defaultProps;
|
8328 |
|
8329 | exports["default"] = Drawer;
|
8330 | module.exports = exports['default'];
|
8331 |
|
8332 | }),
|
8333 |
|
8334 | (function(module, exports) {
|
8335 |
|
8336 | 'use strict';
|
8337 |
|
8338 | Object.defineProperty(exports, "__esModule", {
|
8339 | value: true
|
8340 | });
|
8341 | exports.bindAll = bindAll;
|
8342 | exports.type = type;
|
8343 | exports.isNumber = isNumber;
|
8344 | function bindAll(context, arrFunc) {
|
8345 | arrFunc.forEach(function (item) {
|
8346 | context[item] = context[item].bind(context);
|
8347 | });
|
8348 | }
|
8349 |
|
8350 | function type(obj) {
|
8351 | var toString = Object.prototype.toString;
|
8352 | return toString.call(obj);
|
8353 | }
|
8354 |
|
8355 | function isNumber(obj) {
|
8356 | return type(obj) == '[object Number]';
|
8357 | }
|
8358 |
|
8359 | }),
|
8360 |
|
8361 | (function(module, exports, __webpack_require__) {
|
8362 |
|
8363 | "use strict";
|
8364 |
|
8365 | var _CSSTransition = _interopRequireDefault(__webpack_require__(88));
|
8366 |
|
8367 | var _ReplaceTransition = _interopRequireDefault(__webpack_require__(95));
|
8368 |
|
8369 | var _TransitionGroup = _interopRequireDefault(__webpack_require__(96));
|
8370 |
|
8371 | var _Transition = _interopRequireDefault(__webpack_require__(92));
|
8372 |
|
8373 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8374 |
|
8375 | module.exports = {
|
8376 | Transition: _Transition.default,
|
8377 | TransitionGroup: _TransitionGroup.default,
|
8378 | ReplaceTransition: _ReplaceTransition.default,
|
8379 | CSSTransition: _CSSTransition.default
|
8380 | };
|
8381 |
|
8382 | }),
|
8383 |
|
8384 | (function(module, exports, __webpack_require__) {
|
8385 |
|
8386 | (function(process) {"use strict";
|
8387 |
|
8388 | exports.__esModule = true;
|
8389 | exports.default = void 0;
|
8390 |
|
8391 | var PropTypes = _interopRequireWildcard(__webpack_require__(6));
|
8392 |
|
8393 | var _addClass = _interopRequireDefault(__webpack_require__(89));
|
8394 |
|
8395 | var _removeClass = _interopRequireDefault(__webpack_require__(91));
|
8396 |
|
8397 | var _react = _interopRequireDefault(__webpack_require__(1));
|
8398 |
|
8399 | var _Transition = _interopRequireDefault(__webpack_require__(92));
|
8400 |
|
8401 | var _PropTypes = __webpack_require__(94);
|
8402 |
|
8403 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8404 |
|
8405 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
8406 |
|
8407 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
8408 |
|
8409 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
8410 |
|
8411 | var addClass = function addClass(node, classes) {
|
8412 | return node && classes && classes.split(' ').forEach(function (c) {
|
8413 | return (0, _addClass.default)(node, c);
|
8414 | });
|
8415 | };
|
8416 |
|
8417 | var removeClass = function removeClass(node, classes) {
|
8418 | return node && classes && classes.split(' ').forEach(function (c) {
|
8419 | return (0, _removeClass.default)(node, c);
|
8420 | });
|
8421 | };
|
8422 | |
8423 |
|
8424 |
|
8425 |
|
8426 |
|
8427 |
|
8428 |
|
8429 |
|
8430 |
|
8431 |
|
8432 |
|
8433 |
|
8434 |
|
8435 |
|
8436 |
|
8437 |
|
8438 |
|
8439 |
|
8440 |
|
8441 |
|
8442 |
|
8443 |
|
8444 |
|
8445 |
|
8446 |
|
8447 |
|
8448 |
|
8449 |
|
8450 |
|
8451 |
|
8452 |
|
8453 |
|
8454 |
|
8455 |
|
8456 |
|
8457 |
|
8458 |
|
8459 |
|
8460 |
|
8461 |
|
8462 |
|
8463 |
|
8464 |
|
8465 |
|
8466 |
|
8467 |
|
8468 |
|
8469 |
|
8470 |
|
8471 |
|
8472 |
|
8473 |
|
8474 |
|
8475 |
|
8476 |
|
8477 |
|
8478 |
|
8479 |
|
8480 |
|
8481 |
|
8482 |
|
8483 |
|
8484 | var CSSTransition =
|
8485 |
|
8486 | function (_React$Component) {
|
8487 | _inheritsLoose(CSSTransition, _React$Component);
|
8488 |
|
8489 | function CSSTransition() {
|
8490 | var _this;
|
8491 |
|
8492 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
8493 | args[_key] = arguments[_key];
|
8494 | }
|
8495 |
|
8496 | _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
8497 |
|
8498 | _this.onEnter = function (node, appearing) {
|
8499 | var _this$getClassNames = _this.getClassNames(appearing ? 'appear' : 'enter'),
|
8500 | className = _this$getClassNames.className;
|
8501 |
|
8502 | _this.removeClasses(node, 'exit');
|
8503 |
|
8504 | addClass(node, className);
|
8505 |
|
8506 | if (_this.props.onEnter) {
|
8507 | _this.props.onEnter(node, appearing);
|
8508 | }
|
8509 | };
|
8510 |
|
8511 | _this.onEntering = function (node, appearing) {
|
8512 | var _this$getClassNames2 = _this.getClassNames(appearing ? 'appear' : 'enter'),
|
8513 | activeClassName = _this$getClassNames2.activeClassName;
|
8514 |
|
8515 | _this.reflowAndAddClass(node, activeClassName);
|
8516 |
|
8517 | if (_this.props.onEntering) {
|
8518 | _this.props.onEntering(node, appearing);
|
8519 | }
|
8520 | };
|
8521 |
|
8522 | _this.onEntered = function (node, appearing) {
|
8523 | var _this$getClassNames3 = _this.getClassNames('enter'),
|
8524 | doneClassName = _this$getClassNames3.doneClassName;
|
8525 |
|
8526 | _this.removeClasses(node, appearing ? 'appear' : 'enter');
|
8527 |
|
8528 | addClass(node, doneClassName);
|
8529 |
|
8530 | if (_this.props.onEntered) {
|
8531 | _this.props.onEntered(node, appearing);
|
8532 | }
|
8533 | };
|
8534 |
|
8535 | _this.onExit = function (node) {
|
8536 | var _this$getClassNames4 = _this.getClassNames('exit'),
|
8537 | className = _this$getClassNames4.className;
|
8538 |
|
8539 | _this.removeClasses(node, 'appear');
|
8540 |
|
8541 | _this.removeClasses(node, 'enter');
|
8542 |
|
8543 | addClass(node, className);
|
8544 |
|
8545 | if (_this.props.onExit) {
|
8546 | _this.props.onExit(node);
|
8547 | }
|
8548 | };
|
8549 |
|
8550 | _this.onExiting = function (node) {
|
8551 | var _this$getClassNames5 = _this.getClassNames('exit'),
|
8552 | activeClassName = _this$getClassNames5.activeClassName;
|
8553 |
|
8554 | _this.reflowAndAddClass(node, activeClassName);
|
8555 |
|
8556 | if (_this.props.onExiting) {
|
8557 | _this.props.onExiting(node);
|
8558 | }
|
8559 | };
|
8560 |
|
8561 | _this.onExited = function (node) {
|
8562 | var _this$getClassNames6 = _this.getClassNames('exit'),
|
8563 | doneClassName = _this$getClassNames6.doneClassName;
|
8564 |
|
8565 | _this.removeClasses(node, 'exit');
|
8566 |
|
8567 | addClass(node, doneClassName);
|
8568 |
|
8569 | if (_this.props.onExited) {
|
8570 | _this.props.onExited(node);
|
8571 | }
|
8572 | };
|
8573 |
|
8574 | _this.getClassNames = function (type) {
|
8575 | var classNames = _this.props.classNames;
|
8576 | var className = typeof classNames !== 'string' ? classNames[type] : classNames + '-' + type;
|
8577 | var activeClassName = typeof classNames !== 'string' ? classNames[type + 'Active'] : className + '-active';
|
8578 | var doneClassName = typeof classNames !== 'string' ? classNames[type + 'Done'] : className + '-done';
|
8579 | return {
|
8580 | className: className,
|
8581 | activeClassName: activeClassName,
|
8582 | doneClassName: doneClassName
|
8583 | };
|
8584 | };
|
8585 |
|
8586 | return _this;
|
8587 | }
|
8588 |
|
8589 | var _proto = CSSTransition.prototype;
|
8590 |
|
8591 | _proto.removeClasses = function removeClasses(node, type) {
|
8592 | var _this$getClassNames7 = this.getClassNames(type),
|
8593 | className = _this$getClassNames7.className,
|
8594 | activeClassName = _this$getClassNames7.activeClassName,
|
8595 | doneClassName = _this$getClassNames7.doneClassName;
|
8596 |
|
8597 | className && removeClass(node, className);
|
8598 | activeClassName && removeClass(node, activeClassName);
|
8599 | doneClassName && removeClass(node, doneClassName);
|
8600 | };
|
8601 |
|
8602 | _proto.reflowAndAddClass = function reflowAndAddClass(node, className) {
|
8603 |
|
8604 |
|
8605 | if (className) {
|
8606 |
|
8607 | node && node.scrollTop;
|
8608 |
|
8609 |
|
8610 | addClass(node, className);
|
8611 | }
|
8612 | };
|
8613 |
|
8614 | _proto.render = function render() {
|
8615 | var props = _extends({}, this.props);
|
8616 |
|
8617 | delete props.classNames;
|
8618 | return _react.default.createElement(_Transition.default, _extends({}, props, {
|
8619 | onEnter: this.onEnter,
|
8620 | onEntered: this.onEntered,
|
8621 | onEntering: this.onEntering,
|
8622 | onExit: this.onExit,
|
8623 | onExiting: this.onExiting,
|
8624 | onExited: this.onExited
|
8625 | }));
|
8626 | };
|
8627 |
|
8628 | return CSSTransition;
|
8629 | }(_react.default.Component);
|
8630 |
|
8631 | CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, _Transition.default.propTypes, {
|
8632 | |
8633 |
|
8634 |
|
8635 |
|
8636 |
|
8637 |
|
8638 |
|
8639 |
|
8640 |
|
8641 |
|
8642 |
|
8643 |
|
8644 |
|
8645 |
|
8646 |
|
8647 |
|
8648 |
|
8649 |
|
8650 |
|
8651 |
|
8652 |
|
8653 |
|
8654 |
|
8655 |
|
8656 |
|
8657 |
|
8658 |
|
8659 |
|
8660 |
|
8661 |
|
8662 |
|
8663 |
|
8664 |
|
8665 |
|
8666 |
|
8667 |
|
8668 |
|
8669 |
|
8670 |
|
8671 |
|
8672 |
|
8673 |
|
8674 |
|
8675 |
|
8676 |
|
8677 | classNames: _PropTypes.classNamesShape,
|
8678 |
|
8679 | |
8680 |
|
8681 |
|
8682 |
|
8683 |
|
8684 |
|
8685 | onEnter: PropTypes.func,
|
8686 |
|
8687 | |
8688 |
|
8689 |
|
8690 |
|
8691 |
|
8692 |
|
8693 | onEntering: PropTypes.func,
|
8694 |
|
8695 | |
8696 |
|
8697 |
|
8698 |
|
8699 |
|
8700 |
|
8701 | onEntered: PropTypes.func,
|
8702 |
|
8703 | |
8704 |
|
8705 |
|
8706 |
|
8707 |
|
8708 |
|
8709 | onExit: PropTypes.func,
|
8710 |
|
8711 | |
8712 |
|
8713 |
|
8714 |
|
8715 |
|
8716 | onExiting: PropTypes.func,
|
8717 |
|
8718 | |
8719 |
|
8720 |
|
8721 |
|
8722 |
|
8723 |
|
8724 | onExited: PropTypes.func
|
8725 | }) : {};
|
8726 | var _default = CSSTransition;
|
8727 | exports.default = _default;
|
8728 | module.exports = exports["default"];
|
8729 | }.call(exports, __webpack_require__(33)))
|
8730 |
|
8731 | }),
|
8732 |
|
8733 | (function(module, exports, __webpack_require__) {
|
8734 |
|
8735 | "use strict";
|
8736 |
|
8737 | var _interopRequireDefault = __webpack_require__(14);
|
8738 |
|
8739 | exports.__esModule = true;
|
8740 | exports.default = addClass;
|
8741 |
|
8742 | var _hasClass = _interopRequireDefault(__webpack_require__(90));
|
8743 |
|
8744 | function addClass(element, className) {
|
8745 | if (element.classList) element.classList.add(className);else if (!(0, _hasClass.default)(element, className)) if (typeof element.className === 'string') element.className = element.className + ' ' + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + ' ' + className);
|
8746 | }
|
8747 |
|
8748 | module.exports = exports["default"];
|
8749 |
|
8750 | }),
|
8751 |
|
8752 | (function(module, exports) {
|
8753 |
|
8754 | "use strict";
|
8755 |
|
8756 | exports.__esModule = true;
|
8757 | exports.default = hasClass;
|
8758 |
|
8759 | function hasClass(element, className) {
|
8760 | if (element.classList) return !!className && element.classList.contains(className);else return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
|
8761 | }
|
8762 |
|
8763 | module.exports = exports["default"];
|
8764 |
|
8765 | }),
|
8766 |
|
8767 | (function(module, exports) {
|
8768 |
|
8769 | 'use strict';
|
8770 |
|
8771 | function replaceClassName(origClass, classToRemove) {
|
8772 | return origClass.replace(new RegExp('(^|\\s)' + classToRemove + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
|
8773 | }
|
8774 |
|
8775 | module.exports = function removeClass(element, className) {
|
8776 | if (element.classList) element.classList.remove(className);else if (typeof element.className === 'string') element.className = replaceClassName(element.className, className);else element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
|
8777 | };
|
8778 |
|
8779 | }),
|
8780 |
|
8781 | (function(module, exports, __webpack_require__) {
|
8782 |
|
8783 | (function(process) {"use strict";
|
8784 |
|
8785 | exports.__esModule = true;
|
8786 | exports.default = exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = void 0;
|
8787 |
|
8788 | var PropTypes = _interopRequireWildcard(__webpack_require__(6));
|
8789 |
|
8790 | var _react = _interopRequireDefault(__webpack_require__(1));
|
8791 |
|
8792 | var _reactDom = _interopRequireDefault(__webpack_require__(2));
|
8793 |
|
8794 | var _reactLifecyclesCompat = __webpack_require__(93);
|
8795 |
|
8796 | var _PropTypes = __webpack_require__(94);
|
8797 |
|
8798 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8799 |
|
8800 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
8801 |
|
8802 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
8803 |
|
8804 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
8805 |
|
8806 | var UNMOUNTED = 'unmounted';
|
8807 | exports.UNMOUNTED = UNMOUNTED;
|
8808 | var EXITED = 'exited';
|
8809 | exports.EXITED = EXITED;
|
8810 | var ENTERING = 'entering';
|
8811 | exports.ENTERING = ENTERING;
|
8812 | var ENTERED = 'entered';
|
8813 | exports.ENTERED = ENTERED;
|
8814 | var EXITING = 'exiting';
|
8815 | |
8816 |
|
8817 |
|
8818 |
|
8819 |
|
8820 |
|
8821 |
|
8822 |
|
8823 |
|
8824 |
|
8825 |
|
8826 |
|
8827 |
|
8828 |
|
8829 |
|
8830 |
|
8831 |
|
8832 |
|
8833 |
|
8834 |
|
8835 |
|
8836 |
|
8837 |
|
8838 |
|
8839 |
|
8840 |
|
8841 |
|
8842 |
|
8843 |
|
8844 |
|
8845 |
|
8846 |
|
8847 |
|
8848 |
|
8849 |
|
8850 |
|
8851 |
|
8852 |
|
8853 |
|
8854 |
|
8855 |
|
8856 |
|
8857 |
|
8858 |
|
8859 |
|
8860 |
|
8861 |
|
8862 |
|
8863 |
|
8864 |
|
8865 |
|
8866 |
|
8867 |
|
8868 |
|
8869 |
|
8870 |
|
8871 |
|
8872 |
|
8873 |
|
8874 |
|
8875 |
|
8876 |
|
8877 |
|
8878 |
|
8879 |
|
8880 |
|
8881 |
|
8882 |
|
8883 |
|
8884 |
|
8885 |
|
8886 |
|
8887 |
|
8888 |
|
8889 |
|
8890 |
|
8891 |
|
8892 |
|
8893 |
|
8894 |
|
8895 |
|
8896 |
|
8897 |
|
8898 |
|
8899 |
|
8900 |
|
8901 |
|
8902 |
|
8903 |
|
8904 |
|
8905 | exports.EXITING = EXITING;
|
8906 |
|
8907 | var Transition =
|
8908 |
|
8909 | function (_React$Component) {
|
8910 | _inheritsLoose(Transition, _React$Component);
|
8911 |
|
8912 | function Transition(props, context) {
|
8913 | var _this;
|
8914 |
|
8915 | _this = _React$Component.call(this, props, context) || this;
|
8916 | var parentGroup = context.transitionGroup;
|
8917 |
|
8918 | var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
|
8919 | var initialStatus;
|
8920 | _this.appearStatus = null;
|
8921 |
|
8922 | if (props.in) {
|
8923 | if (appear) {
|
8924 | initialStatus = EXITED;
|
8925 | _this.appearStatus = ENTERING;
|
8926 | } else {
|
8927 | initialStatus = ENTERED;
|
8928 | }
|
8929 | } else {
|
8930 | if (props.unmountOnExit || props.mountOnEnter) {
|
8931 | initialStatus = UNMOUNTED;
|
8932 | } else {
|
8933 | initialStatus = EXITED;
|
8934 | }
|
8935 | }
|
8936 |
|
8937 | _this.state = {
|
8938 | status: initialStatus
|
8939 | };
|
8940 | _this.nextCallback = null;
|
8941 | return _this;
|
8942 | }
|
8943 |
|
8944 | var _proto = Transition.prototype;
|
8945 |
|
8946 | _proto.getChildContext = function getChildContext() {
|
8947 | return {
|
8948 | transitionGroup: null
|
8949 |
|
8950 | };
|
8951 | };
|
8952 |
|
8953 | Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
|
8954 | var nextIn = _ref.in;
|
8955 |
|
8956 | if (nextIn && prevState.status === UNMOUNTED) {
|
8957 | return {
|
8958 | status: EXITED
|
8959 | };
|
8960 | }
|
8961 |
|
8962 | return null;
|
8963 | };
|
8964 |
|
8965 |
|
8966 |
|
8967 |
|
8968 |
|
8969 |
|
8970 |
|
8971 |
|
8972 |
|
8973 |
|
8974 |
|
8975 |
|
8976 |
|
8977 |
|
8978 |
|
8979 |
|
8980 |
|
8981 | _proto.componentDidMount = function componentDidMount() {
|
8982 | this.updateStatus(true, this.appearStatus);
|
8983 | };
|
8984 |
|
8985 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
8986 | var nextStatus = null;
|
8987 |
|
8988 | if (prevProps !== this.props) {
|
8989 | var status = this.state.status;
|
8990 |
|
8991 | if (this.props.in) {
|
8992 | if (status !== ENTERING && status !== ENTERED) {
|
8993 | nextStatus = ENTERING;
|
8994 | }
|
8995 | } else {
|
8996 | if (status === ENTERING || status === ENTERED) {
|
8997 | nextStatus = EXITING;
|
8998 | }
|
8999 | }
|
9000 | }
|
9001 |
|
9002 | this.updateStatus(false, nextStatus);
|
9003 | };
|
9004 |
|
9005 | _proto.componentWillUnmount = function componentWillUnmount() {
|
9006 | this.cancelNextCallback();
|
9007 | };
|
9008 |
|
9009 | _proto.getTimeouts = function getTimeouts() {
|
9010 | var timeout = this.props.timeout;
|
9011 | var exit, enter, appear;
|
9012 | exit = enter = appear = timeout;
|
9013 |
|
9014 | if (timeout != null && typeof timeout !== 'number') {
|
9015 | exit = timeout.exit;
|
9016 | enter = timeout.enter;
|
9017 |
|
9018 | appear = timeout.appear !== undefined ? timeout.appear : enter;
|
9019 | }
|
9020 |
|
9021 | return {
|
9022 | exit: exit,
|
9023 | enter: enter,
|
9024 | appear: appear
|
9025 | };
|
9026 | };
|
9027 |
|
9028 | _proto.updateStatus = function updateStatus(mounting, nextStatus) {
|
9029 | if (mounting === void 0) {
|
9030 | mounting = false;
|
9031 | }
|
9032 |
|
9033 | if (nextStatus !== null) {
|
9034 |
|
9035 | this.cancelNextCallback();
|
9036 |
|
9037 | var node = _reactDom.default.findDOMNode(this);
|
9038 |
|
9039 | if (nextStatus === ENTERING) {
|
9040 | this.performEnter(node, mounting);
|
9041 | } else {
|
9042 | this.performExit(node);
|
9043 | }
|
9044 | } else if (this.props.unmountOnExit && this.state.status === EXITED) {
|
9045 | this.setState({
|
9046 | status: UNMOUNTED
|
9047 | });
|
9048 | }
|
9049 | };
|
9050 |
|
9051 | _proto.performEnter = function performEnter(node, mounting) {
|
9052 | var _this2 = this;
|
9053 |
|
9054 | var enter = this.props.enter;
|
9055 | var appearing = this.context.transitionGroup ? this.context.transitionGroup.isMounting : mounting;
|
9056 | var timeouts = this.getTimeouts();
|
9057 | var enterTimeout = appearing ? timeouts.appear : timeouts.enter;
|
9058 |
|
9059 |
|
9060 | if (!mounting && !enter) {
|
9061 | this.safeSetState({
|
9062 | status: ENTERED
|
9063 | }, function () {
|
9064 | _this2.props.onEntered(node);
|
9065 | });
|
9066 | return;
|
9067 | }
|
9068 |
|
9069 | this.props.onEnter(node, appearing);
|
9070 | this.safeSetState({
|
9071 | status: ENTERING
|
9072 | }, function () {
|
9073 | _this2.props.onEntering(node, appearing);
|
9074 |
|
9075 | _this2.onTransitionEnd(node, enterTimeout, function () {
|
9076 | _this2.safeSetState({
|
9077 | status: ENTERED
|
9078 | }, function () {
|
9079 | _this2.props.onEntered(node, appearing);
|
9080 | });
|
9081 | });
|
9082 | });
|
9083 | };
|
9084 |
|
9085 | _proto.performExit = function performExit(node) {
|
9086 | var _this3 = this;
|
9087 |
|
9088 | var exit = this.props.exit;
|
9089 | var timeouts = this.getTimeouts();
|
9090 |
|
9091 | if (!exit) {
|
9092 | this.safeSetState({
|
9093 | status: EXITED
|
9094 | }, function () {
|
9095 | _this3.props.onExited(node);
|
9096 | });
|
9097 | return;
|
9098 | }
|
9099 |
|
9100 | this.props.onExit(node);
|
9101 | this.safeSetState({
|
9102 | status: EXITING
|
9103 | }, function () {
|
9104 | _this3.props.onExiting(node);
|
9105 |
|
9106 | _this3.onTransitionEnd(node, timeouts.exit, function () {
|
9107 | _this3.safeSetState({
|
9108 | status: EXITED
|
9109 | }, function () {
|
9110 | _this3.props.onExited(node);
|
9111 | });
|
9112 | });
|
9113 | });
|
9114 | };
|
9115 |
|
9116 | _proto.cancelNextCallback = function cancelNextCallback() {
|
9117 | if (this.nextCallback !== null) {
|
9118 | this.nextCallback.cancel();
|
9119 | this.nextCallback = null;
|
9120 | }
|
9121 | };
|
9122 |
|
9123 | _proto.safeSetState = function safeSetState(nextState, callback) {
|
9124 |
|
9125 |
|
9126 |
|
9127 | callback = this.setNextCallback(callback);
|
9128 | this.setState(nextState, callback);
|
9129 | };
|
9130 |
|
9131 | _proto.setNextCallback = function setNextCallback(callback) {
|
9132 | var _this4 = this;
|
9133 |
|
9134 | var active = true;
|
9135 |
|
9136 | this.nextCallback = function (event) {
|
9137 | if (active) {
|
9138 | active = false;
|
9139 | _this4.nextCallback = null;
|
9140 | callback(event);
|
9141 | }
|
9142 | };
|
9143 |
|
9144 | this.nextCallback.cancel = function () {
|
9145 | active = false;
|
9146 | };
|
9147 |
|
9148 | return this.nextCallback;
|
9149 | };
|
9150 |
|
9151 | _proto.onTransitionEnd = function onTransitionEnd(node, timeout, handler) {
|
9152 | this.setNextCallback(handler);
|
9153 | var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
|
9154 |
|
9155 | if (!node || doesNotHaveTimeoutOrListener) {
|
9156 | setTimeout(this.nextCallback, 0);
|
9157 | return;
|
9158 | }
|
9159 |
|
9160 | if (this.props.addEndListener) {
|
9161 | this.props.addEndListener(node, this.nextCallback);
|
9162 | }
|
9163 |
|
9164 | if (timeout != null) {
|
9165 | setTimeout(this.nextCallback, timeout);
|
9166 | }
|
9167 | };
|
9168 |
|
9169 | _proto.render = function render() {
|
9170 | var status = this.state.status;
|
9171 |
|
9172 | if (status === UNMOUNTED) {
|
9173 | return null;
|
9174 | }
|
9175 |
|
9176 | var _this$props = this.props,
|
9177 | children = _this$props.children,
|
9178 | childProps = _objectWithoutPropertiesLoose(_this$props, ["children"]);
|
9179 |
|
9180 |
|
9181 | delete childProps.in;
|
9182 | delete childProps.mountOnEnter;
|
9183 | delete childProps.unmountOnExit;
|
9184 | delete childProps.appear;
|
9185 | delete childProps.enter;
|
9186 | delete childProps.exit;
|
9187 | delete childProps.timeout;
|
9188 | delete childProps.addEndListener;
|
9189 | delete childProps.onEnter;
|
9190 | delete childProps.onEntering;
|
9191 | delete childProps.onEntered;
|
9192 | delete childProps.onExit;
|
9193 | delete childProps.onExiting;
|
9194 | delete childProps.onExited;
|
9195 |
|
9196 | if (typeof children === 'function') {
|
9197 | return children(status, childProps);
|
9198 | }
|
9199 |
|
9200 | var child = _react.default.Children.only(children);
|
9201 |
|
9202 | return _react.default.cloneElement(child, childProps);
|
9203 | };
|
9204 |
|
9205 | return Transition;
|
9206 | }(_react.default.Component);
|
9207 |
|
9208 | Transition.contextTypes = {
|
9209 | transitionGroup: PropTypes.object
|
9210 | };
|
9211 | Transition.childContextTypes = {
|
9212 | transitionGroup: function transitionGroup() {}
|
9213 | };
|
9214 | Transition.propTypes = process.env.NODE_ENV !== "production" ? {
|
9215 | |
9216 |
|
9217 |
|
9218 |
|
9219 |
|
9220 |
|
9221 |
|
9222 |
|
9223 |
|
9224 |
|
9225 |
|
9226 |
|
9227 |
|
9228 |
|
9229 | children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,
|
9230 |
|
9231 | |
9232 |
|
9233 |
|
9234 | in: PropTypes.bool,
|
9235 |
|
9236 | |
9237 |
|
9238 |
|
9239 |
|
9240 |
|
9241 |
|
9242 | mountOnEnter: PropTypes.bool,
|
9243 |
|
9244 | |
9245 |
|
9246 |
|
9247 |
|
9248 | unmountOnExit: PropTypes.bool,
|
9249 |
|
9250 | |
9251 |
|
9252 |
|
9253 |
|
9254 |
|
9255 |
|
9256 |
|
9257 | appear: PropTypes.bool,
|
9258 |
|
9259 | |
9260 |
|
9261 |
|
9262 | enter: PropTypes.bool,
|
9263 |
|
9264 | |
9265 |
|
9266 |
|
9267 | exit: PropTypes.bool,
|
9268 |
|
9269 | |
9270 |
|
9271 |
|
9272 |
|
9273 |
|
9274 |
|
9275 |
|
9276 |
|
9277 |
|
9278 |
|
9279 |
|
9280 |
|
9281 |
|
9282 |
|
9283 |
|
9284 |
|
9285 |
|
9286 |
|
9287 |
|
9288 |
|
9289 |
|
9290 |
|
9291 |
|
9292 |
|
9293 |
|
9294 |
|
9295 | timeout: function timeout(props) {
|
9296 | var pt = process.env.NODE_ENV !== "production" ? _PropTypes.timeoutsShape : {};;
|
9297 | if (!props.addEndListener) pt = pt.isRequired;
|
9298 |
|
9299 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
9300 | args[_key - 1] = arguments[_key];
|
9301 | }
|
9302 |
|
9303 | return pt.apply(void 0, [props].concat(args));
|
9304 | },
|
9305 |
|
9306 | |
9307 |
|
9308 |
|
9309 |
|
9310 |
|
9311 |
|
9312 |
|
9313 |
|
9314 |
|
9315 |
|
9316 |
|
9317 |
|
9318 | addEndListener: PropTypes.func,
|
9319 |
|
9320 | |
9321 |
|
9322 |
|
9323 |
|
9324 |
|
9325 |
|
9326 | onEnter: PropTypes.func,
|
9327 |
|
9328 | |
9329 |
|
9330 |
|
9331 |
|
9332 |
|
9333 |
|
9334 | onEntering: PropTypes.func,
|
9335 |
|
9336 | |
9337 |
|
9338 |
|
9339 |
|
9340 |
|
9341 |
|
9342 | onEntered: PropTypes.func,
|
9343 |
|
9344 | |
9345 |
|
9346 |
|
9347 |
|
9348 |
|
9349 | onExit: PropTypes.func,
|
9350 |
|
9351 | |
9352 |
|
9353 |
|
9354 |
|
9355 |
|
9356 | onExiting: PropTypes.func,
|
9357 |
|
9358 | |
9359 |
|
9360 |
|
9361 |
|
9362 |
|
9363 | onExited: PropTypes.func
|
9364 |
|
9365 | } : {};
|
9366 |
|
9367 | function noop() {}
|
9368 |
|
9369 | Transition.defaultProps = {
|
9370 | in: false,
|
9371 | mountOnEnter: false,
|
9372 | unmountOnExit: false,
|
9373 | appear: false,
|
9374 | enter: true,
|
9375 | exit: true,
|
9376 | onEnter: noop,
|
9377 | onEntering: noop,
|
9378 | onEntered: noop,
|
9379 | onExit: noop,
|
9380 | onExiting: noop,
|
9381 | onExited: noop
|
9382 | };
|
9383 | Transition.UNMOUNTED = 0;
|
9384 | Transition.EXITED = 1;
|
9385 | Transition.ENTERING = 2;
|
9386 | Transition.ENTERED = 3;
|
9387 | Transition.EXITING = 4;
|
9388 |
|
9389 | var _default = (0, _reactLifecyclesCompat.polyfill)(Transition);
|
9390 |
|
9391 | exports.default = _default;
|
9392 | }.call(exports, __webpack_require__(33)))
|
9393 |
|
9394 | }),
|
9395 |
|
9396 | (function(module, exports) {
|
9397 |
|
9398 | 'use strict';
|
9399 |
|
9400 | Object.defineProperty(exports, '__esModule', { value: true });
|
9401 |
|
9402 | |
9403 |
|
9404 |
|
9405 |
|
9406 |
|
9407 |
|
9408 |
|
9409 | function componentWillMount() {
|
9410 |
|
9411 | var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
|
9412 | if (state !== null && state !== undefined) {
|
9413 | this.setState(state);
|
9414 | }
|
9415 | }
|
9416 |
|
9417 | function componentWillReceiveProps(nextProps) {
|
9418 |
|
9419 |
|
9420 | function updater(prevState) {
|
9421 | var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
|
9422 | return state !== null && state !== undefined ? state : null;
|
9423 | }
|
9424 |
|
9425 | this.setState(updater.bind(this));
|
9426 | }
|
9427 |
|
9428 | function componentWillUpdate(nextProps, nextState) {
|
9429 | try {
|
9430 | var prevProps = this.props;
|
9431 | var prevState = this.state;
|
9432 | this.props = nextProps;
|
9433 | this.state = nextState;
|
9434 | this.__reactInternalSnapshotFlag = true;
|
9435 | this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
|
9436 | prevProps,
|
9437 | prevState
|
9438 | );
|
9439 | } finally {
|
9440 | this.props = prevProps;
|
9441 | this.state = prevState;
|
9442 | }
|
9443 | }
|
9444 |
|
9445 |
|
9446 |
|
9447 | componentWillMount.__suppressDeprecationWarning = true;
|
9448 | componentWillReceiveProps.__suppressDeprecationWarning = true;
|
9449 | componentWillUpdate.__suppressDeprecationWarning = true;
|
9450 |
|
9451 | function polyfill(Component) {
|
9452 | var prototype = Component.prototype;
|
9453 |
|
9454 | if (!prototype || !prototype.isReactComponent) {
|
9455 | throw new Error('Can only polyfill class components');
|
9456 | }
|
9457 |
|
9458 | if (
|
9459 | typeof Component.getDerivedStateFromProps !== 'function' &&
|
9460 | typeof prototype.getSnapshotBeforeUpdate !== 'function'
|
9461 | ) {
|
9462 | return Component;
|
9463 | }
|
9464 |
|
9465 |
|
9466 |
|
9467 |
|
9468 | var foundWillMountName = null;
|
9469 | var foundWillReceivePropsName = null;
|
9470 | var foundWillUpdateName = null;
|
9471 | if (typeof prototype.componentWillMount === 'function') {
|
9472 | foundWillMountName = 'componentWillMount';
|
9473 | } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
|
9474 | foundWillMountName = 'UNSAFE_componentWillMount';
|
9475 | }
|
9476 | if (typeof prototype.componentWillReceiveProps === 'function') {
|
9477 | foundWillReceivePropsName = 'componentWillReceiveProps';
|
9478 | } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
|
9479 | foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
9480 | }
|
9481 | if (typeof prototype.componentWillUpdate === 'function') {
|
9482 | foundWillUpdateName = 'componentWillUpdate';
|
9483 | } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
|
9484 | foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
9485 | }
|
9486 | if (
|
9487 | foundWillMountName !== null ||
|
9488 | foundWillReceivePropsName !== null ||
|
9489 | foundWillUpdateName !== null
|
9490 | ) {
|
9491 | var componentName = Component.displayName || Component.name;
|
9492 | var newApiName =
|
9493 | typeof Component.getDerivedStateFromProps === 'function'
|
9494 | ? 'getDerivedStateFromProps()'
|
9495 | : 'getSnapshotBeforeUpdate()';
|
9496 |
|
9497 | throw Error(
|
9498 | 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
|
9499 | componentName +
|
9500 | ' uses ' +
|
9501 | newApiName +
|
9502 | ' but also contains the following legacy lifecycles:' +
|
9503 | (foundWillMountName !== null ? '\n ' + foundWillMountName : '') +
|
9504 | (foundWillReceivePropsName !== null
|
9505 | ? '\n ' + foundWillReceivePropsName
|
9506 | : '') +
|
9507 | (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') +
|
9508 | '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' +
|
9509 | 'https://fb.me/react-async-component-lifecycle-hooks'
|
9510 | );
|
9511 | }
|
9512 |
|
9513 |
|
9514 |
|
9515 |
|
9516 | if (typeof Component.getDerivedStateFromProps === 'function') {
|
9517 | prototype.componentWillMount = componentWillMount;
|
9518 | prototype.componentWillReceiveProps = componentWillReceiveProps;
|
9519 | }
|
9520 |
|
9521 |
|
9522 |
|
9523 |
|
9524 | if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
|
9525 | if (typeof prototype.componentDidUpdate !== 'function') {
|
9526 | throw new Error(
|
9527 | 'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'
|
9528 | );
|
9529 | }
|
9530 |
|
9531 | prototype.componentWillUpdate = componentWillUpdate;
|
9532 |
|
9533 | var componentDidUpdate = prototype.componentDidUpdate;
|
9534 |
|
9535 | prototype.componentDidUpdate = function componentDidUpdatePolyfill(
|
9536 | prevProps,
|
9537 | prevState,
|
9538 | maybeSnapshot
|
9539 | ) {
|
9540 |
|
9541 |
|
9542 |
|
9543 |
|
9544 |
|
9545 |
|
9546 |
|
9547 |
|
9548 | var snapshot = this.__reactInternalSnapshotFlag
|
9549 | ? this.__reactInternalSnapshot
|
9550 | : maybeSnapshot;
|
9551 |
|
9552 | componentDidUpdate.call(this, prevProps, prevState, snapshot);
|
9553 | };
|
9554 | }
|
9555 |
|
9556 | return Component;
|
9557 | }
|
9558 |
|
9559 | exports.polyfill = polyfill;
|
9560 |
|
9561 |
|
9562 | }),
|
9563 |
|
9564 | (function(module, exports, __webpack_require__) {
|
9565 |
|
9566 | (function(process) {"use strict";
|
9567 |
|
9568 | exports.__esModule = true;
|
9569 | exports.classNamesShape = exports.timeoutsShape = void 0;
|
9570 |
|
9571 | var _propTypes = _interopRequireDefault(__webpack_require__(6));
|
9572 |
|
9573 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9574 |
|
9575 | var timeoutsShape = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
9576 | enter: _propTypes.default.number,
|
9577 | exit: _propTypes.default.number,
|
9578 | appear: _propTypes.default.number
|
9579 | }).isRequired]) : null;
|
9580 | exports.timeoutsShape = timeoutsShape;
|
9581 | var classNamesShape = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({
|
9582 | enter: _propTypes.default.string,
|
9583 | exit: _propTypes.default.string,
|
9584 | active: _propTypes.default.string
|
9585 | }), _propTypes.default.shape({
|
9586 | enter: _propTypes.default.string,
|
9587 | enterDone: _propTypes.default.string,
|
9588 | enterActive: _propTypes.default.string,
|
9589 | exit: _propTypes.default.string,
|
9590 | exitDone: _propTypes.default.string,
|
9591 | exitActive: _propTypes.default.string
|
9592 | })]) : null;
|
9593 | exports.classNamesShape = classNamesShape;
|
9594 | }.call(exports, __webpack_require__(33)))
|
9595 |
|
9596 | }),
|
9597 |
|
9598 | (function(module, exports, __webpack_require__) {
|
9599 |
|
9600 | (function(process) {"use strict";
|
9601 |
|
9602 | exports.__esModule = true;
|
9603 | exports.default = void 0;
|
9604 |
|
9605 | var _propTypes = _interopRequireDefault(__webpack_require__(6));
|
9606 |
|
9607 | var _react = _interopRequireDefault(__webpack_require__(1));
|
9608 |
|
9609 | var _reactDom = __webpack_require__(2);
|
9610 |
|
9611 | var _TransitionGroup = _interopRequireDefault(__webpack_require__(96));
|
9612 |
|
9613 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9614 |
|
9615 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
9616 |
|
9617 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
9618 |
|
9619 | |
9620 |
|
9621 |
|
9622 |
|
9623 |
|
9624 |
|
9625 |
|
9626 |
|
9627 |
|
9628 |
|
9629 |
|
9630 | var ReplaceTransition =
|
9631 |
|
9632 | function (_React$Component) {
|
9633 | _inheritsLoose(ReplaceTransition, _React$Component);
|
9634 |
|
9635 | function ReplaceTransition() {
|
9636 | var _this;
|
9637 |
|
9638 | for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
|
9639 | _args[_key] = arguments[_key];
|
9640 | }
|
9641 |
|
9642 | _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
|
9643 |
|
9644 | _this.handleEnter = function () {
|
9645 | for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
9646 | args[_key2] = arguments[_key2];
|
9647 | }
|
9648 |
|
9649 | return _this.handleLifecycle('onEnter', 0, args);
|
9650 | };
|
9651 |
|
9652 | _this.handleEntering = function () {
|
9653 | for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
9654 | args[_key3] = arguments[_key3];
|
9655 | }
|
9656 |
|
9657 | return _this.handleLifecycle('onEntering', 0, args);
|
9658 | };
|
9659 |
|
9660 | _this.handleEntered = function () {
|
9661 | for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
9662 | args[_key4] = arguments[_key4];
|
9663 | }
|
9664 |
|
9665 | return _this.handleLifecycle('onEntered', 0, args);
|
9666 | };
|
9667 |
|
9668 | _this.handleExit = function () {
|
9669 | for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
9670 | args[_key5] = arguments[_key5];
|
9671 | }
|
9672 |
|
9673 | return _this.handleLifecycle('onExit', 1, args);
|
9674 | };
|
9675 |
|
9676 | _this.handleExiting = function () {
|
9677 | for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
9678 | args[_key6] = arguments[_key6];
|
9679 | }
|
9680 |
|
9681 | return _this.handleLifecycle('onExiting', 1, args);
|
9682 | };
|
9683 |
|
9684 | _this.handleExited = function () {
|
9685 | for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
9686 | args[_key7] = arguments[_key7];
|
9687 | }
|
9688 |
|
9689 | return _this.handleLifecycle('onExited', 1, args);
|
9690 | };
|
9691 |
|
9692 | return _this;
|
9693 | }
|
9694 |
|
9695 | var _proto = ReplaceTransition.prototype;
|
9696 |
|
9697 | _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
|
9698 | var _child$props;
|
9699 |
|
9700 | var children = this.props.children;
|
9701 |
|
9702 | var child = _react.default.Children.toArray(children)[idx];
|
9703 |
|
9704 | if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
|
9705 | if (this.props[handler]) this.props[handler]((0, _reactDom.findDOMNode)(this));
|
9706 | };
|
9707 |
|
9708 | _proto.render = function render() {
|
9709 | var _this$props = this.props,
|
9710 | children = _this$props.children,
|
9711 | inProp = _this$props.in,
|
9712 | props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
|
9713 |
|
9714 | var _React$Children$toArr = _react.default.Children.toArray(children),
|
9715 | first = _React$Children$toArr[0],
|
9716 | second = _React$Children$toArr[1];
|
9717 |
|
9718 | delete props.onEnter;
|
9719 | delete props.onEntering;
|
9720 | delete props.onEntered;
|
9721 | delete props.onExit;
|
9722 | delete props.onExiting;
|
9723 | delete props.onExited;
|
9724 | return _react.default.createElement(_TransitionGroup.default, props, inProp ? _react.default.cloneElement(first, {
|
9725 | key: 'first',
|
9726 | onEnter: this.handleEnter,
|
9727 | onEntering: this.handleEntering,
|
9728 | onEntered: this.handleEntered
|
9729 | }) : _react.default.cloneElement(second, {
|
9730 | key: 'second',
|
9731 | onEnter: this.handleExit,
|
9732 | onEntering: this.handleExiting,
|
9733 | onEntered: this.handleExited
|
9734 | }));
|
9735 | };
|
9736 |
|
9737 | return ReplaceTransition;
|
9738 | }(_react.default.Component);
|
9739 |
|
9740 | ReplaceTransition.propTypes = process.env.NODE_ENV !== "production" ? {
|
9741 | in: _propTypes.default.bool.isRequired,
|
9742 | children: function children(props, propName) {
|
9743 | if (_react.default.Children.count(props[propName]) !== 2) return new Error("\"" + propName + "\" must be exactly two transition components.");
|
9744 | return null;
|
9745 | }
|
9746 | } : {};
|
9747 | var _default = ReplaceTransition;
|
9748 | exports.default = _default;
|
9749 | module.exports = exports["default"];
|
9750 | }.call(exports, __webpack_require__(33)))
|
9751 |
|
9752 | }),
|
9753 |
|
9754 | (function(module, exports, __webpack_require__) {
|
9755 |
|
9756 | (function(process) {"use strict";
|
9757 |
|
9758 | exports.__esModule = true;
|
9759 | exports.default = void 0;
|
9760 |
|
9761 | var _propTypes = _interopRequireDefault(__webpack_require__(6));
|
9762 |
|
9763 | var _react = _interopRequireDefault(__webpack_require__(1));
|
9764 |
|
9765 | var _reactLifecyclesCompat = __webpack_require__(93);
|
9766 |
|
9767 | var _ChildMapping = __webpack_require__(97);
|
9768 |
|
9769 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9770 |
|
9771 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
9772 |
|
9773 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
9774 |
|
9775 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
9776 |
|
9777 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
9778 |
|
9779 | var values = Object.values || function (obj) {
|
9780 | return Object.keys(obj).map(function (k) {
|
9781 | return obj[k];
|
9782 | });
|
9783 | };
|
9784 |
|
9785 | var defaultProps = {
|
9786 | component: 'div',
|
9787 | childFactory: function childFactory(child) {
|
9788 | return child;
|
9789 | }
|
9790 | |
9791 |
|
9792 |
|
9793 |
|
9794 |
|
9795 |
|
9796 |
|
9797 |
|
9798 |
|
9799 |
|
9800 |
|
9801 |
|
9802 |
|
9803 |
|
9804 |
|
9805 | };
|
9806 |
|
9807 | var TransitionGroup =
|
9808 |
|
9809 | function (_React$Component) {
|
9810 | _inheritsLoose(TransitionGroup, _React$Component);
|
9811 |
|
9812 | function TransitionGroup(props, context) {
|
9813 | var _this;
|
9814 |
|
9815 | _this = _React$Component.call(this, props, context) || this;
|
9816 |
|
9817 | var handleExited = _this.handleExited.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
9818 |
|
9819 |
|
9820 | _this.state = {
|
9821 | handleExited: handleExited,
|
9822 | firstRender: true
|
9823 | };
|
9824 | return _this;
|
9825 | }
|
9826 |
|
9827 | var _proto = TransitionGroup.prototype;
|
9828 |
|
9829 | _proto.getChildContext = function getChildContext() {
|
9830 | return {
|
9831 | transitionGroup: {
|
9832 | isMounting: !this.appeared
|
9833 | }
|
9834 | };
|
9835 | };
|
9836 |
|
9837 | _proto.componentDidMount = function componentDidMount() {
|
9838 | this.appeared = true;
|
9839 | this.mounted = true;
|
9840 | };
|
9841 |
|
9842 | _proto.componentWillUnmount = function componentWillUnmount() {
|
9843 | this.mounted = false;
|
9844 | };
|
9845 |
|
9846 | TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
|
9847 | var prevChildMapping = _ref.children,
|
9848 | handleExited = _ref.handleExited,
|
9849 | firstRender = _ref.firstRender;
|
9850 | return {
|
9851 | children: firstRender ? (0, _ChildMapping.getInitialChildMapping)(nextProps, handleExited) : (0, _ChildMapping.getNextChildMapping)(nextProps, prevChildMapping, handleExited),
|
9852 | firstRender: false
|
9853 | };
|
9854 | };
|
9855 |
|
9856 | _proto.handleExited = function handleExited(child, node) {
|
9857 | var currentChildMapping = (0, _ChildMapping.getChildMapping)(this.props.children);
|
9858 | if (child.key in currentChildMapping) return;
|
9859 |
|
9860 | if (child.props.onExited) {
|
9861 | child.props.onExited(node);
|
9862 | }
|
9863 |
|
9864 | if (this.mounted) {
|
9865 | this.setState(function (state) {
|
9866 | var children = _extends({}, state.children);
|
9867 |
|
9868 | delete children[child.key];
|
9869 | return {
|
9870 | children: children
|
9871 | };
|
9872 | });
|
9873 | }
|
9874 | };
|
9875 |
|
9876 | _proto.render = function render() {
|
9877 | var _this$props = this.props,
|
9878 | Component = _this$props.component,
|
9879 | childFactory = _this$props.childFactory,
|
9880 | props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
|
9881 |
|
9882 | var children = values(this.state.children).map(childFactory);
|
9883 | delete props.appear;
|
9884 | delete props.enter;
|
9885 | delete props.exit;
|
9886 |
|
9887 | if (Component === null) {
|
9888 | return children;
|
9889 | }
|
9890 |
|
9891 | return _react.default.createElement(Component, props, children);
|
9892 | };
|
9893 |
|
9894 | return TransitionGroup;
|
9895 | }(_react.default.Component);
|
9896 |
|
9897 | TransitionGroup.childContextTypes = {
|
9898 | transitionGroup: _propTypes.default.object.isRequired
|
9899 | };
|
9900 | TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? {
|
9901 | |
9902 |
|
9903 |
|
9904 |
|
9905 |
|
9906 |
|
9907 |
|
9908 | component: _propTypes.default.any,
|
9909 |
|
9910 | |
9911 |
|
9912 |
|
9913 |
|
9914 |
|
9915 |
|
9916 |
|
9917 |
|
9918 |
|
9919 |
|
9920 |
|
9921 |
|
9922 |
|
9923 | children: _propTypes.default.node,
|
9924 |
|
9925 | |
9926 |
|
9927 |
|
9928 |
|
9929 |
|
9930 | appear: _propTypes.default.bool,
|
9931 |
|
9932 | |
9933 |
|
9934 |
|
9935 |
|
9936 |
|
9937 | enter: _propTypes.default.bool,
|
9938 |
|
9939 | |
9940 |
|
9941 |
|
9942 |
|
9943 |
|
9944 | exit: _propTypes.default.bool,
|
9945 |
|
9946 | |
9947 |
|
9948 |
|
9949 |
|
9950 |
|
9951 |
|
9952 |
|
9953 |
|
9954 |
|
9955 |
|
9956 | childFactory: _propTypes.default.func
|
9957 | } : {};
|
9958 | TransitionGroup.defaultProps = defaultProps;
|
9959 |
|
9960 | var _default = (0, _reactLifecyclesCompat.polyfill)(TransitionGroup);
|
9961 |
|
9962 | exports.default = _default;
|
9963 | module.exports = exports["default"];
|
9964 | }.call(exports, __webpack_require__(33)))
|
9965 |
|
9966 | }),
|
9967 |
|
9968 | (function(module, exports, __webpack_require__) {
|
9969 |
|
9970 | "use strict";
|
9971 |
|
9972 | exports.__esModule = true;
|
9973 | exports.getChildMapping = getChildMapping;
|
9974 | exports.mergeChildMappings = mergeChildMappings;
|
9975 | exports.getInitialChildMapping = getInitialChildMapping;
|
9976 | exports.getNextChildMapping = getNextChildMapping;
|
9977 |
|
9978 | var _react = __webpack_require__(1);
|
9979 |
|
9980 | |
9981 |
|
9982 |
|
9983 |
|
9984 |
|
9985 |
|
9986 | function getChildMapping(children, mapFn) {
|
9987 | var mapper = function mapper(child) {
|
9988 | return mapFn && (0, _react.isValidElement)(child) ? mapFn(child) : child;
|
9989 | };
|
9990 |
|
9991 | var result = Object.create(null);
|
9992 | if (children) _react.Children.map(children, function (c) {
|
9993 | return c;
|
9994 | }).forEach(function (child) {
|
9995 |
|
9996 | result[child.key] = mapper(child);
|
9997 | });
|
9998 | return result;
|
9999 | }
|
10000 | |
10001 |
|
10002 |
|
10003 |
|
10004 |
|
10005 |
|
10006 |
|
10007 |
|
10008 |
|
10009 |
|
10010 |
|
10011 |
|
10012 |
|
10013 |
|
10014 |
|
10015 |
|
10016 |
|
10017 |
|
10018 |
|
10019 | function mergeChildMappings(prev, next) {
|
10020 | prev = prev || {};
|
10021 | next = next || {};
|
10022 |
|
10023 | function getValueForKey(key) {
|
10024 | return key in next ? next[key] : prev[key];
|
10025 | }
|
10026 |
|
10027 |
|
10028 |
|
10029 | var nextKeysPending = Object.create(null);
|
10030 | var pendingKeys = [];
|
10031 |
|
10032 | for (var prevKey in prev) {
|
10033 | if (prevKey in next) {
|
10034 | if (pendingKeys.length) {
|
10035 | nextKeysPending[prevKey] = pendingKeys;
|
10036 | pendingKeys = [];
|
10037 | }
|
10038 | } else {
|
10039 | pendingKeys.push(prevKey);
|
10040 | }
|
10041 | }
|
10042 |
|
10043 | var i;
|
10044 | var childMapping = {};
|
10045 |
|
10046 | for (var nextKey in next) {
|
10047 | if (nextKeysPending[nextKey]) {
|
10048 | for (i = 0; i < nextKeysPending[nextKey].length; i++) {
|
10049 | var pendingNextKey = nextKeysPending[nextKey][i];
|
10050 | childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
|
10051 | }
|
10052 | }
|
10053 |
|
10054 | childMapping[nextKey] = getValueForKey(nextKey);
|
10055 | }
|
10056 |
|
10057 |
|
10058 | for (i = 0; i < pendingKeys.length; i++) {
|
10059 | childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
|
10060 | }
|
10061 |
|
10062 | return childMapping;
|
10063 | }
|
10064 |
|
10065 | function getProp(child, prop, props) {
|
10066 | return props[prop] != null ? props[prop] : child.props[prop];
|
10067 | }
|
10068 |
|
10069 | function getInitialChildMapping(props, onExited) {
|
10070 | return getChildMapping(props.children, function (child) {
|
10071 | return (0, _react.cloneElement)(child, {
|
10072 | onExited: onExited.bind(null, child),
|
10073 | in: true,
|
10074 | appear: getProp(child, 'appear', props),
|
10075 | enter: getProp(child, 'enter', props),
|
10076 | exit: getProp(child, 'exit', props)
|
10077 | });
|
10078 | });
|
10079 | }
|
10080 |
|
10081 | function getNextChildMapping(nextProps, prevChildMapping, onExited) {
|
10082 | var nextChildMapping = getChildMapping(nextProps.children);
|
10083 | var children = mergeChildMappings(prevChildMapping, nextChildMapping);
|
10084 | Object.keys(children).forEach(function (key) {
|
10085 | var child = children[key];
|
10086 | if (!(0, _react.isValidElement)(child)) return;
|
10087 | var hasPrev = key in prevChildMapping;
|
10088 | var hasNext = key in nextChildMapping;
|
10089 | var prevChild = prevChildMapping[key];
|
10090 | var isLeaving = (0, _react.isValidElement)(prevChild) && !prevChild.props.in;
|
10091 |
|
10092 | if (hasNext && (!hasPrev || isLeaving)) {
|
10093 |
|
10094 | children[key] = (0, _react.cloneElement)(child, {
|
10095 | onExited: onExited.bind(null, child),
|
10096 | in: true,
|
10097 | exit: getProp(child, 'exit', nextProps),
|
10098 | enter: getProp(child, 'enter', nextProps)
|
10099 | });
|
10100 | } else if (!hasNext && hasPrev && !isLeaving) {
|
10101 |
|
10102 |
|
10103 | children[key] = (0, _react.cloneElement)(child, {
|
10104 | in: false
|
10105 | });
|
10106 | } else if (hasNext && hasPrev && (0, _react.isValidElement)(prevChild)) {
|
10107 |
|
10108 |
|
10109 |
|
10110 | children[key] = (0, _react.cloneElement)(child, {
|
10111 | onExited: onExited.bind(null, child),
|
10112 | in: prevChild.props.in,
|
10113 | exit: getProp(child, 'exit', nextProps),
|
10114 | enter: getProp(child, 'enter', nextProps)
|
10115 | });
|
10116 | }
|
10117 | });
|
10118 | return children;
|
10119 | }
|
10120 |
|
10121 | }),
|
10122 |
|
10123 | (function(module, exports, __webpack_require__) {
|
10124 |
|
10125 | 'use strict';
|
10126 |
|
10127 | Object.defineProperty(exports, "__esModule", {
|
10128 | value: true
|
10129 | });
|
10130 |
|
10131 | var _Clipboard = __webpack_require__(99);
|
10132 |
|
10133 | var _Clipboard2 = _interopRequireDefault(_Clipboard);
|
10134 |
|
10135 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10136 |
|
10137 | exports["default"] = _Clipboard2["default"];
|
10138 | module.exports = exports['default'];
|
10139 |
|
10140 | }),
|
10141 |
|
10142 | (function(module, exports, __webpack_require__) {
|
10143 |
|
10144 | 'use strict';
|
10145 |
|
10146 | Object.defineProperty(exports, "__esModule", {
|
10147 | value: true
|
10148 | });
|
10149 |
|
10150 | var _react = __webpack_require__(1);
|
10151 |
|
10152 | var _react2 = _interopRequireDefault(_react);
|
10153 |
|
10154 | var _clipboard = __webpack_require__(100);
|
10155 |
|
10156 | var _clipboard2 = _interopRequireDefault(_clipboard);
|
10157 |
|
10158 | var _classnames = __webpack_require__(5);
|
10159 |
|
10160 | var _classnames2 = _interopRequireDefault(_classnames);
|
10161 |
|
10162 | var _beeIcon = __webpack_require__(79);
|
10163 |
|
10164 | var _beeIcon2 = _interopRequireDefault(_beeIcon);
|
10165 |
|
10166 | var _reactDom = __webpack_require__(2);
|
10167 |
|
10168 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
10169 |
|
10170 | var _beeTooltip = __webpack_require__(108);
|
10171 |
|
10172 | var _beeTooltip2 = _interopRequireDefault(_beeTooltip);
|
10173 |
|
10174 | var _propTypes = __webpack_require__(6);
|
10175 |
|
10176 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
10177 |
|
10178 | var _tool = __webpack_require__(132);
|
10179 |
|
10180 | var _i18n = __webpack_require__(133);
|
10181 |
|
10182 | var _i18n2 = _interopRequireDefault(_i18n);
|
10183 |
|
10184 | var _beeModal = __webpack_require__(134);
|
10185 |
|
10186 | var _beeModal2 = _interopRequireDefault(_beeModal);
|
10187 |
|
10188 | var _beeFormControl = __webpack_require__(153);
|
10189 |
|
10190 | var _beeFormControl2 = _interopRequireDefault(_beeFormControl);
|
10191 |
|
10192 | var _beeButton = __webpack_require__(155);
|
10193 |
|
10194 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
10195 |
|
10196 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10197 |
|
10198 | 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; }
|
10199 |
|
10200 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
10201 |
|
10202 | 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; }
|
10203 |
|
10204 | 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); }
|
10205 |
|
10206 |
|
10207 |
|
10208 | var propTypes = {
|
10209 | action: _propTypes2["default"].oneOf(['copy', 'cut', null]),
|
10210 | text: _propTypes2["default"].string,
|
10211 | success: _propTypes2["default"].func,
|
10212 | error: _propTypes2["default"].func,
|
10213 | locale: _propTypes2["default"].object
|
10214 | };
|
10215 | var defaultProps = {
|
10216 | action: 'copy',
|
10217 | text: '',
|
10218 | target: '',
|
10219 | success: function success() {},
|
10220 | error: function error() {},
|
10221 | locale: {}
|
10222 | };
|
10223 |
|
10224 | var Clipboard = function (_Component) {
|
10225 | _inherits(Clipboard, _Component);
|
10226 |
|
10227 | function Clipboard(props, context) {
|
10228 | _classCallCheck(this, Clipboard);
|
10229 |
|
10230 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
10231 |
|
10232 | _this.blur = function () {
|
10233 | _this.setState({
|
10234 | currect: false,
|
10235 | ready: false
|
10236 | });
|
10237 | };
|
10238 |
|
10239 | _this.close = function () {
|
10240 | _this.setState({
|
10241 | modalShow: false
|
10242 | });
|
10243 | };
|
10244 |
|
10245 | _this.state = {
|
10246 | currect: false,
|
10247 | html: '',
|
10248 | ready: false,
|
10249 | id: 'id' + Math.round(Math.random() * 1000 + 1) + new Date().getTime(),
|
10250 | modalShow: false
|
10251 | };
|
10252 | return _this;
|
10253 | }
|
10254 |
|
10255 | Clipboard.prototype.componentWillMount = function componentWillMount() {
|
10256 | var self = this;
|
10257 | var _props = this.props,
|
10258 | success = _props.success,
|
10259 | error = _props.error;
|
10260 |
|
10261 |
|
10262 | var id = this.state.id;
|
10263 | var cb = new _clipboard2["default"]('#' + id);
|
10264 | cb.on('success', function (e) {
|
10265 | self.setState({
|
10266 | currect: true,
|
10267 | ready: true
|
10268 | });
|
10269 | e.clearSelection();
|
10270 | if (success instanceof Function) success();
|
10271 | });
|
10272 | cb.on('error', function (e) {
|
10273 | self.setState({
|
10274 | modalShow: true,
|
10275 | html: e.text
|
10276 | });
|
10277 | _reactDom2["default"].findDOMNode(self.refs.text).select();
|
10278 | if (error instanceof Function) error();
|
10279 | });
|
10280 | };
|
10281 |
|
10282 | Clipboard.prototype.render = function render() {
|
10283 | var _props2 = this.props,
|
10284 | action = _props2.action,
|
10285 | text = _props2.text,
|
10286 | target = _props2.target;
|
10287 |
|
10288 | if (text) action = 'copy';
|
10289 |
|
10290 | var locale = (0, _tool.getComponentLocale)(this.props, this.context, 'Clipboard', function () {
|
10291 | return _i18n2["default"];
|
10292 | });
|
10293 | var tootipContent = locale[action];
|
10294 | if (this.state.ready) {
|
10295 | tootipContent = locale[action + 'Ready'];
|
10296 | }
|
10297 |
|
10298 | return _react2["default"].createElement(
|
10299 | _beeTooltip2["default"],
|
10300 | {
|
10301 | positionTop: '20px',
|
10302 | overlay: tootipContent,
|
10303 | placement: 'top' },
|
10304 | _react2["default"].createElement(
|
10305 | 'span',
|
10306 | {
|
10307 | onMouseOut: this.blur,
|
10308 | className: 'u-clipboard',
|
10309 | id: this.state.id,
|
10310 | 'data-clipboard-action': action,
|
10311 | 'data-clipboard-target': target,
|
10312 | 'data-clipboard-text': text },
|
10313 | this.props.children ? this.props.children : _react2["default"].createElement(_beeIcon2["default"], {
|
10314 | className: (0, _classnames2["default"])({
|
10315 | 'uf-correct': this.state.currect,
|
10316 | 'uf-copy': !this.state.currect
|
10317 | })
|
10318 | }),
|
10319 | _react2["default"].createElement(
|
10320 | _beeModal2["default"],
|
10321 | { show: this.state.modalShow, onHide: this.close },
|
10322 | _react2["default"].createElement(
|
10323 | _beeModal2["default"].Header,
|
10324 | { closeButton: true },
|
10325 | _react2["default"].createElement(
|
10326 | _beeModal2["default"].Title,
|
10327 | null,
|
10328 | ' Ctrl+C ',
|
10329 | locale['copyToClipboard'],
|
10330 | ' '
|
10331 | )
|
10332 | ),
|
10333 | _react2["default"].createElement(
|
10334 | _beeModal2["default"].Body,
|
10335 | null,
|
10336 | _react2["default"].createElement(_beeFormControl2["default"], { ref: 'text', type: 'text', readOnly: true, value: this.state.html })
|
10337 | ),
|
10338 | _react2["default"].createElement(
|
10339 | _beeModal2["default"].Footer,
|
10340 | null,
|
10341 | _react2["default"].createElement(
|
10342 | _beeButton2["default"],
|
10343 | { onClick: this.close },
|
10344 | ' ',
|
10345 | locale['close'],
|
10346 | ' '
|
10347 | )
|
10348 | )
|
10349 | )
|
10350 | )
|
10351 | );
|
10352 | };
|
10353 |
|
10354 | return Clipboard;
|
10355 | }(_react.Component);
|
10356 |
|
10357 | ;
|
10358 | Clipboard.propTypes = propTypes;
|
10359 | Clipboard.defaultProps = defaultProps;
|
10360 | exports["default"] = Clipboard;
|
10361 | module.exports = exports['default'];
|
10362 |
|
10363 | }),
|
10364 |
|
10365 | (function(module, exports, __webpack_require__) {
|
10366 |
|
10367 | var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
|
10368 | if (true) {
|
10369 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, __webpack_require__(101), __webpack_require__(103), __webpack_require__(104)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
10370 | } else if (typeof exports !== "undefined") {
|
10371 | factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));
|
10372 | } else {
|
10373 | var mod = {
|
10374 | exports: {}
|
10375 | };
|
10376 | factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);
|
10377 | global.clipboard = mod.exports;
|
10378 | }
|
10379 | })(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
|
10380 | 'use strict';
|
10381 |
|
10382 | var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
|
10383 |
|
10384 | var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
|
10385 |
|
10386 | var _goodListener2 = _interopRequireDefault(_goodListener);
|
10387 |
|
10388 | function _interopRequireDefault(obj) {
|
10389 | return obj && obj.__esModule ? obj : {
|
10390 | default: obj
|
10391 | };
|
10392 | }
|
10393 |
|
10394 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
10395 | return typeof obj;
|
10396 | } : function (obj) {
|
10397 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
10398 | };
|
10399 |
|
10400 | function _classCallCheck(instance, Constructor) {
|
10401 | if (!(instance instanceof Constructor)) {
|
10402 | throw new TypeError("Cannot call a class as a function");
|
10403 | }
|
10404 | }
|
10405 |
|
10406 | var _createClass = function () {
|
10407 | function defineProperties(target, props) {
|
10408 | for (var i = 0; i < props.length; i++) {
|
10409 | var descriptor = props[i];
|
10410 | descriptor.enumerable = descriptor.enumerable || false;
|
10411 | descriptor.configurable = true;
|
10412 | if ("value" in descriptor) descriptor.writable = true;
|
10413 | Object.defineProperty(target, descriptor.key, descriptor);
|
10414 | }
|
10415 | }
|
10416 |
|
10417 | return function (Constructor, protoProps, staticProps) {
|
10418 | if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
10419 | if (staticProps) defineProperties(Constructor, staticProps);
|
10420 | return Constructor;
|
10421 | };
|
10422 | }();
|
10423 |
|
10424 | function _possibleConstructorReturn(self, call) {
|
10425 | if (!self) {
|
10426 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
10427 | }
|
10428 |
|
10429 | return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
10430 | }
|
10431 |
|
10432 | function _inherits(subClass, superClass) {
|
10433 | if (typeof superClass !== "function" && superClass !== null) {
|
10434 | throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
10435 | }
|
10436 |
|
10437 | subClass.prototype = Object.create(superClass && superClass.prototype, {
|
10438 | constructor: {
|
10439 | value: subClass,
|
10440 | enumerable: false,
|
10441 | writable: true,
|
10442 | configurable: true
|
10443 | }
|
10444 | });
|
10445 | if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
10446 | }
|
10447 |
|
10448 | var Clipboard = function (_Emitter) {
|
10449 | _inherits(Clipboard, _Emitter);
|
10450 |
|
10451 | |
10452 |
|
10453 |
|
10454 |
|
10455 | function Clipboard(trigger, options) {
|
10456 | _classCallCheck(this, Clipboard);
|
10457 |
|
10458 | var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
|
10459 |
|
10460 | _this.resolveOptions(options);
|
10461 | _this.listenClick(trigger);
|
10462 | return _this;
|
10463 | }
|
10464 |
|
10465 | |
10466 |
|
10467 |
|
10468 |
|
10469 |
|
10470 |
|
10471 |
|
10472 | _createClass(Clipboard, [{
|
10473 | key: 'resolveOptions',
|
10474 | value: function resolveOptions() {
|
10475 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
10476 |
|
10477 | this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
10478 | this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
10479 | this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
10480 | this.container = _typeof(options.container) === 'object' ? options.container : document.body;
|
10481 | }
|
10482 | }, {
|
10483 | key: 'listenClick',
|
10484 | value: function listenClick(trigger) {
|
10485 | var _this2 = this;
|
10486 |
|
10487 | this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
|
10488 | return _this2.onClick(e);
|
10489 | });
|
10490 | }
|
10491 | }, {
|
10492 | key: 'onClick',
|
10493 | value: function onClick(e) {
|
10494 | var trigger = e.delegateTarget || e.currentTarget;
|
10495 |
|
10496 | if (this.clipboardAction) {
|
10497 | this.clipboardAction = null;
|
10498 | }
|
10499 |
|
10500 | this.clipboardAction = new _clipboardAction2.default({
|
10501 | action: this.action(trigger),
|
10502 | target: this.target(trigger),
|
10503 | text: this.text(trigger),
|
10504 | container: this.container,
|
10505 | trigger: trigger,
|
10506 | emitter: this
|
10507 | });
|
10508 | }
|
10509 | }, {
|
10510 | key: 'defaultAction',
|
10511 | value: function defaultAction(trigger) {
|
10512 | return getAttributeValue('action', trigger);
|
10513 | }
|
10514 | }, {
|
10515 | key: 'defaultTarget',
|
10516 | value: function defaultTarget(trigger) {
|
10517 | var selector = getAttributeValue('target', trigger);
|
10518 |
|
10519 | if (selector) {
|
10520 | return document.querySelector(selector);
|
10521 | }
|
10522 | }
|
10523 | }, {
|
10524 | key: 'defaultText',
|
10525 | value: function defaultText(trigger) {
|
10526 | return getAttributeValue('text', trigger);
|
10527 | }
|
10528 | }, {
|
10529 | key: 'destroy',
|
10530 | value: function destroy() {
|
10531 | this.listener.destroy();
|
10532 |
|
10533 | if (this.clipboardAction) {
|
10534 | this.clipboardAction.destroy();
|
10535 | this.clipboardAction = null;
|
10536 | }
|
10537 | }
|
10538 | }], [{
|
10539 | key: 'isSupported',
|
10540 | value: function isSupported() {
|
10541 | var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
|
10542 |
|
10543 | var actions = typeof action === 'string' ? [action] : action;
|
10544 | var support = !!document.queryCommandSupported;
|
10545 |
|
10546 | actions.forEach(function (action) {
|
10547 | support = support && !!document.queryCommandSupported(action);
|
10548 | });
|
10549 |
|
10550 | return support;
|
10551 | }
|
10552 | }]);
|
10553 |
|
10554 | return Clipboard;
|
10555 | }(_tinyEmitter2.default);
|
10556 |
|
10557 | |
10558 |
|
10559 |
|
10560 |
|
10561 |
|
10562 | function getAttributeValue(suffix, element) {
|
10563 | var attribute = 'data-clipboard-' + suffix;
|
10564 |
|
10565 | if (!element.hasAttribute(attribute)) {
|
10566 | return;
|
10567 | }
|
10568 |
|
10569 | return element.getAttribute(attribute);
|
10570 | }
|
10571 |
|
10572 | module.exports = Clipboard;
|
10573 | });
|
10574 |
|
10575 | }),
|
10576 |
|
10577 | (function(module, exports, __webpack_require__) {
|
10578 |
|
10579 | var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
|
10580 | if (true) {
|
10581 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, __webpack_require__(102)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
10582 | } else if (typeof exports !== "undefined") {
|
10583 | factory(module, require('select'));
|
10584 | } else {
|
10585 | var mod = {
|
10586 | exports: {}
|
10587 | };
|
10588 | factory(mod, global.select);
|
10589 | global.clipboardAction = mod.exports;
|
10590 | }
|
10591 | })(this, function (module, _select) {
|
10592 | 'use strict';
|
10593 |
|
10594 | var _select2 = _interopRequireDefault(_select);
|
10595 |
|
10596 | function _interopRequireDefault(obj) {
|
10597 | return obj && obj.__esModule ? obj : {
|
10598 | default: obj
|
10599 | };
|
10600 | }
|
10601 |
|
10602 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
10603 | return typeof obj;
|
10604 | } : function (obj) {
|
10605 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
10606 | };
|
10607 |
|
10608 | function _classCallCheck(instance, Constructor) {
|
10609 | if (!(instance instanceof Constructor)) {
|
10610 | throw new TypeError("Cannot call a class as a function");
|
10611 | }
|
10612 | }
|
10613 |
|
10614 | var _createClass = function () {
|
10615 | function defineProperties(target, props) {
|
10616 | for (var i = 0; i < props.length; i++) {
|
10617 | var descriptor = props[i];
|
10618 | descriptor.enumerable = descriptor.enumerable || false;
|
10619 | descriptor.configurable = true;
|
10620 | if ("value" in descriptor) descriptor.writable = true;
|
10621 | Object.defineProperty(target, descriptor.key, descriptor);
|
10622 | }
|
10623 | }
|
10624 |
|
10625 | return function (Constructor, protoProps, staticProps) {
|
10626 | if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
10627 | if (staticProps) defineProperties(Constructor, staticProps);
|
10628 | return Constructor;
|
10629 | };
|
10630 | }();
|
10631 |
|
10632 | var ClipboardAction = function () {
|
10633 | |
10634 |
|
10635 |
|
10636 | function ClipboardAction(options) {
|
10637 | _classCallCheck(this, ClipboardAction);
|
10638 |
|
10639 | this.resolveOptions(options);
|
10640 | this.initSelection();
|
10641 | }
|
10642 |
|
10643 | |
10644 |
|
10645 |
|
10646 |
|
10647 |
|
10648 |
|
10649 | _createClass(ClipboardAction, [{
|
10650 | key: 'resolveOptions',
|
10651 | value: function resolveOptions() {
|
10652 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
10653 |
|
10654 | this.action = options.action;
|
10655 | this.container = options.container;
|
10656 | this.emitter = options.emitter;
|
10657 | this.target = options.target;
|
10658 | this.text = options.text;
|
10659 | this.trigger = options.trigger;
|
10660 |
|
10661 | this.selectedText = '';
|
10662 | }
|
10663 | }, {
|
10664 | key: 'initSelection',
|
10665 | value: function initSelection() {
|
10666 | if (this.text) {
|
10667 | this.selectFake();
|
10668 | } else if (this.target) {
|
10669 | this.selectTarget();
|
10670 | }
|
10671 | }
|
10672 | }, {
|
10673 | key: 'selectFake',
|
10674 | value: function selectFake() {
|
10675 | var _this = this;
|
10676 |
|
10677 | var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
|
10678 |
|
10679 | this.removeFake();
|
10680 |
|
10681 | this.fakeHandlerCallback = function () {
|
10682 | return _this.removeFake();
|
10683 | };
|
10684 | this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
|
10685 |
|
10686 | this.fakeElem = document.createElement('textarea');
|
10687 |
|
10688 | this.fakeElem.style.fontSize = '12pt';
|
10689 |
|
10690 | this.fakeElem.style.border = '0';
|
10691 | this.fakeElem.style.padding = '0';
|
10692 | this.fakeElem.style.margin = '0';
|
10693 |
|
10694 | this.fakeElem.style.position = 'absolute';
|
10695 | this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
10696 |
|
10697 | var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
10698 | this.fakeElem.style.top = yPosition + 'px';
|
10699 |
|
10700 | this.fakeElem.setAttribute('readonly', '');
|
10701 | this.fakeElem.value = this.text;
|
10702 |
|
10703 | this.container.appendChild(this.fakeElem);
|
10704 |
|
10705 | this.selectedText = (0, _select2.default)(this.fakeElem);
|
10706 | this.copyText();
|
10707 | }
|
10708 | }, {
|
10709 | key: 'removeFake',
|
10710 | value: function removeFake() {
|
10711 | if (this.fakeHandler) {
|
10712 | this.container.removeEventListener('click', this.fakeHandlerCallback);
|
10713 | this.fakeHandler = null;
|
10714 | this.fakeHandlerCallback = null;
|
10715 | }
|
10716 |
|
10717 | if (this.fakeElem) {
|
10718 | this.container.removeChild(this.fakeElem);
|
10719 | this.fakeElem = null;
|
10720 | }
|
10721 | }
|
10722 | }, {
|
10723 | key: 'selectTarget',
|
10724 | value: function selectTarget() {
|
10725 | this.selectedText = (0, _select2.default)(this.target);
|
10726 | this.copyText();
|
10727 | }
|
10728 | }, {
|
10729 | key: 'copyText',
|
10730 | value: function copyText() {
|
10731 | var succeeded = void 0;
|
10732 |
|
10733 | try {
|
10734 | succeeded = document.execCommand(this.action);
|
10735 | } catch (err) {
|
10736 | succeeded = false;
|
10737 | }
|
10738 |
|
10739 | this.handleResult(succeeded);
|
10740 | }
|
10741 | }, {
|
10742 | key: 'handleResult',
|
10743 | value: function handleResult(succeeded) {
|
10744 | this.emitter.emit(succeeded ? 'success' : 'error', {
|
10745 | action: this.action,
|
10746 | text: this.selectedText,
|
10747 | trigger: this.trigger,
|
10748 | clearSelection: this.clearSelection.bind(this)
|
10749 | });
|
10750 | }
|
10751 | }, {
|
10752 | key: 'clearSelection',
|
10753 | value: function clearSelection() {
|
10754 | if (this.trigger) {
|
10755 | this.trigger.focus();
|
10756 | }
|
10757 |
|
10758 | window.getSelection().removeAllRanges();
|
10759 | }
|
10760 | }, {
|
10761 | key: 'destroy',
|
10762 | value: function destroy() {
|
10763 | this.removeFake();
|
10764 | }
|
10765 | }, {
|
10766 | key: 'action',
|
10767 | set: function set() {
|
10768 | var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
|
10769 |
|
10770 | this._action = action;
|
10771 |
|
10772 | if (this._action !== 'copy' && this._action !== 'cut') {
|
10773 | throw new Error('Invalid "action" value, use either "copy" or "cut"');
|
10774 | }
|
10775 | },
|
10776 | get: function get() {
|
10777 | return this._action;
|
10778 | }
|
10779 | }, {
|
10780 | key: 'target',
|
10781 | set: function set(target) {
|
10782 | if (target !== undefined) {
|
10783 | if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
|
10784 | if (this.action === 'copy' && target.hasAttribute('disabled')) {
|
10785 | throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
|
10786 | }
|
10787 |
|
10788 | if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
|
10789 | throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
|
10790 | }
|
10791 |
|
10792 | this._target = target;
|
10793 | } else {
|
10794 | throw new Error('Invalid "target" value, use a valid Element');
|
10795 | }
|
10796 | }
|
10797 | },
|
10798 | get: function get() {
|
10799 | return this._target;
|
10800 | }
|
10801 | }]);
|
10802 |
|
10803 | return ClipboardAction;
|
10804 | }();
|
10805 |
|
10806 | module.exports = ClipboardAction;
|
10807 | });
|
10808 |
|
10809 | }),
|
10810 |
|
10811 | (function(module, exports) {
|
10812 |
|
10813 | function select(element) {
|
10814 | var selectedText;
|
10815 |
|
10816 | if (element.nodeName === 'SELECT') {
|
10817 | element.focus();
|
10818 |
|
10819 | selectedText = element.value;
|
10820 | }
|
10821 | else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
|
10822 | var isReadOnly = element.hasAttribute('readonly');
|
10823 |
|
10824 | if (!isReadOnly) {
|
10825 | element.setAttribute('readonly', '');
|
10826 | }
|
10827 |
|
10828 | element.select();
|
10829 | element.setSelectionRange(0, element.value.length);
|
10830 |
|
10831 | if (!isReadOnly) {
|
10832 | element.removeAttribute('readonly');
|
10833 | }
|
10834 |
|
10835 | selectedText = element.value;
|
10836 | }
|
10837 | else {
|
10838 | if (element.hasAttribute('contenteditable')) {
|
10839 | element.focus();
|
10840 | }
|
10841 |
|
10842 | var selection = window.getSelection();
|
10843 | var range = document.createRange();
|
10844 |
|
10845 | range.selectNodeContents(element);
|
10846 | selection.removeAllRanges();
|
10847 | selection.addRange(range);
|
10848 |
|
10849 | selectedText = selection.toString();
|
10850 | }
|
10851 |
|
10852 | return selectedText;
|
10853 | }
|
10854 |
|
10855 | module.exports = select;
|
10856 |
|
10857 |
|
10858 | }),
|
10859 |
|
10860 | (function(module, exports) {
|
10861 |
|
10862 | function E () {
|
10863 |
|
10864 |
|
10865 | }
|
10866 |
|
10867 | E.prototype = {
|
10868 | on: function (name, callback, ctx) {
|
10869 | var e = this.e || (this.e = {});
|
10870 |
|
10871 | (e[name] || (e[name] = [])).push({
|
10872 | fn: callback,
|
10873 | ctx: ctx
|
10874 | });
|
10875 |
|
10876 | return this;
|
10877 | },
|
10878 |
|
10879 | once: function (name, callback, ctx) {
|
10880 | var self = this;
|
10881 | function listener () {
|
10882 | self.off(name, listener);
|
10883 | callback.apply(ctx, arguments);
|
10884 | };
|
10885 |
|
10886 | listener._ = callback
|
10887 | return this.on(name, listener, ctx);
|
10888 | },
|
10889 |
|
10890 | emit: function (name) {
|
10891 | var data = [].slice.call(arguments, 1);
|
10892 | var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
10893 | var i = 0;
|
10894 | var len = evtArr.length;
|
10895 |
|
10896 | for (i; i < len; i++) {
|
10897 | evtArr[i].fn.apply(evtArr[i].ctx, data);
|
10898 | }
|
10899 |
|
10900 | return this;
|
10901 | },
|
10902 |
|
10903 | off: function (name, callback) {
|
10904 | var e = this.e || (this.e = {});
|
10905 | var evts = e[name];
|
10906 | var liveEvents = [];
|
10907 |
|
10908 | if (evts && callback) {
|
10909 | for (var i = 0, len = evts.length; i < len; i++) {
|
10910 | if (evts[i].fn !== callback && evts[i].fn._ !== callback)
|
10911 | liveEvents.push(evts[i]);
|
10912 | }
|
10913 | }
|
10914 |
|
10915 |
|
10916 |
|
10917 |
|
10918 |
|
10919 | (liveEvents.length)
|
10920 | ? e[name] = liveEvents
|
10921 | : delete e[name];
|
10922 |
|
10923 | return this;
|
10924 | }
|
10925 | };
|
10926 |
|
10927 | module.exports = E;
|
10928 | module.exports.TinyEmitter = E;
|
10929 |
|
10930 |
|
10931 | }),
|
10932 |
|
10933 | (function(module, exports, __webpack_require__) {
|
10934 |
|
10935 | var is = __webpack_require__(105);
|
10936 | var delegate = __webpack_require__(106);
|
10937 |
|
10938 | |
10939 |
|
10940 |
|
10941 |
|
10942 |
|
10943 |
|
10944 |
|
10945 |
|
10946 |
|
10947 | function listen(target, type, callback) {
|
10948 | if (!target && !type && !callback) {
|
10949 | throw new Error('Missing required arguments');
|
10950 | }
|
10951 |
|
10952 | if (!is.string(type)) {
|
10953 | throw new TypeError('Second argument must be a String');
|
10954 | }
|
10955 |
|
10956 | if (!is.fn(callback)) {
|
10957 | throw new TypeError('Third argument must be a Function');
|
10958 | }
|
10959 |
|
10960 | if (is.node(target)) {
|
10961 | return listenNode(target, type, callback);
|
10962 | }
|
10963 | else if (is.nodeList(target)) {
|
10964 | return listenNodeList(target, type, callback);
|
10965 | }
|
10966 | else if (is.string(target)) {
|
10967 | return listenSelector(target, type, callback);
|
10968 | }
|
10969 | else {
|
10970 | throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
|
10971 | }
|
10972 | }
|
10973 |
|
10974 | |
10975 |
|
10976 |
|
10977 |
|
10978 |
|
10979 |
|
10980 |
|
10981 |
|
10982 |
|
10983 | function listenNode(node, type, callback) {
|
10984 | node.addEventListener(type, callback);
|
10985 |
|
10986 | return {
|
10987 | destroy: function() {
|
10988 | node.removeEventListener(type, callback);
|
10989 | }
|
10990 | }
|
10991 | }
|
10992 |
|
10993 | |
10994 |
|
10995 |
|
10996 |
|
10997 |
|
10998 |
|
10999 |
|
11000 |
|
11001 |
|
11002 | function listenNodeList(nodeList, type, callback) {
|
11003 | Array.prototype.forEach.call(nodeList, function(node) {
|
11004 | node.addEventListener(type, callback);
|
11005 | });
|
11006 |
|
11007 | return {
|
11008 | destroy: function() {
|
11009 | Array.prototype.forEach.call(nodeList, function(node) {
|
11010 | node.removeEventListener(type, callback);
|
11011 | });
|
11012 | }
|
11013 | }
|
11014 | }
|
11015 |
|
11016 | |
11017 |
|
11018 |
|
11019 |
|
11020 |
|
11021 |
|
11022 |
|
11023 |
|
11024 |
|
11025 | function listenSelector(selector, type, callback) {
|
11026 | return delegate(document.body, selector, type, callback);
|
11027 | }
|
11028 |
|
11029 | module.exports = listen;
|
11030 |
|
11031 |
|
11032 | }),
|
11033 |
|
11034 | (function(module, exports) {
|
11035 |
|
11036 | |
11037 |
|
11038 |
|
11039 |
|
11040 |
|
11041 |
|
11042 | exports.node = function(value) {
|
11043 | return value !== undefined
|
11044 | && value instanceof HTMLElement
|
11045 | && value.nodeType === 1;
|
11046 | };
|
11047 |
|
11048 | |
11049 |
|
11050 |
|
11051 |
|
11052 |
|
11053 |
|
11054 | exports.nodeList = function(value) {
|
11055 | var type = Object.prototype.toString.call(value);
|
11056 |
|
11057 | return value !== undefined
|
11058 | && (type === '[object NodeList]' || type === '[object HTMLCollection]')
|
11059 | && ('length' in value)
|
11060 | && (value.length === 0 || exports.node(value[0]));
|
11061 | };
|
11062 |
|
11063 | |
11064 |
|
11065 |
|
11066 |
|
11067 |
|
11068 |
|
11069 | exports.string = function(value) {
|
11070 | return typeof value === 'string'
|
11071 | || value instanceof String;
|
11072 | };
|
11073 |
|
11074 | |
11075 |
|
11076 |
|
11077 |
|
11078 |
|
11079 |
|
11080 | exports.fn = function(value) {
|
11081 | var type = Object.prototype.toString.call(value);
|
11082 |
|
11083 | return type === '[object Function]';
|
11084 | };
|
11085 |
|
11086 |
|
11087 | }),
|
11088 |
|
11089 | (function(module, exports, __webpack_require__) {
|
11090 |
|
11091 | var closest = __webpack_require__(107);
|
11092 |
|
11093 | |
11094 |
|
11095 |
|
11096 |
|
11097 |
|
11098 |
|
11099 |
|
11100 |
|
11101 |
|
11102 |
|
11103 | function _delegate(element, selector, type, callback, useCapture) {
|
11104 | var listenerFn = listener.apply(this, arguments);
|
11105 |
|
11106 | element.addEventListener(type, listenerFn, useCapture);
|
11107 |
|
11108 | return {
|
11109 | destroy: function() {
|
11110 | element.removeEventListener(type, listenerFn, useCapture);
|
11111 | }
|
11112 | }
|
11113 | }
|
11114 |
|
11115 | |
11116 |
|
11117 |
|
11118 |
|
11119 |
|
11120 |
|
11121 |
|
11122 |
|
11123 |
|
11124 |
|
11125 | function delegate(elements, selector, type, callback, useCapture) {
|
11126 |
|
11127 | if (typeof elements.addEventListener === 'function') {
|
11128 | return _delegate.apply(null, arguments);
|
11129 | }
|
11130 |
|
11131 |
|
11132 | if (typeof type === 'function') {
|
11133 |
|
11134 |
|
11135 | return _delegate.bind(null, document).apply(null, arguments);
|
11136 | }
|
11137 |
|
11138 |
|
11139 | if (typeof elements === 'string') {
|
11140 | elements = document.querySelectorAll(elements);
|
11141 | }
|
11142 |
|
11143 |
|
11144 | return Array.prototype.map.call(elements, function (element) {
|
11145 | return _delegate(element, selector, type, callback, useCapture);
|
11146 | });
|
11147 | }
|
11148 |
|
11149 | |
11150 |
|
11151 |
|
11152 |
|
11153 |
|
11154 |
|
11155 |
|
11156 |
|
11157 |
|
11158 | function listener(element, selector, type, callback) {
|
11159 | return function(e) {
|
11160 | e.delegateTarget = closest(e.target, selector);
|
11161 |
|
11162 | if (e.delegateTarget) {
|
11163 | callback.call(element, e);
|
11164 | }
|
11165 | }
|
11166 | }
|
11167 |
|
11168 | module.exports = delegate;
|
11169 |
|
11170 |
|
11171 | }),
|
11172 |
|
11173 | (function(module, exports) {
|
11174 |
|
11175 | var DOCUMENT_NODE_TYPE = 9;
|
11176 |
|
11177 | |
11178 |
|
11179 |
|
11180 | if (typeof Element !== 'undefined' && !Element.prototype.matches) {
|
11181 | var proto = Element.prototype;
|
11182 |
|
11183 | proto.matches = proto.matchesSelector ||
|
11184 | proto.mozMatchesSelector ||
|
11185 | proto.msMatchesSelector ||
|
11186 | proto.oMatchesSelector ||
|
11187 | proto.webkitMatchesSelector;
|
11188 | }
|
11189 |
|
11190 | |
11191 |
|
11192 |
|
11193 |
|
11194 |
|
11195 |
|
11196 |
|
11197 | function closest (element, selector) {
|
11198 | while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
|
11199 | if (typeof element.matches === 'function' &&
|
11200 | element.matches(selector)) {
|
11201 | return element;
|
11202 | }
|
11203 | element = element.parentNode;
|
11204 | }
|
11205 | }
|
11206 |
|
11207 | module.exports = closest;
|
11208 |
|
11209 |
|
11210 | }),
|
11211 |
|
11212 | (function(module, exports, __webpack_require__) {
|
11213 |
|
11214 | 'use strict';
|
11215 |
|
11216 | Object.defineProperty(exports, "__esModule", {
|
11217 | value: true
|
11218 | });
|
11219 |
|
11220 | var _Tooltip = __webpack_require__(109);
|
11221 |
|
11222 | var _Tooltip2 = _interopRequireDefault(_Tooltip);
|
11223 |
|
11224 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11225 |
|
11226 | exports["default"] = _Tooltip2["default"];
|
11227 | module.exports = exports['default'];
|
11228 |
|
11229 | }),
|
11230 |
|
11231 | (function(module, exports, __webpack_require__) {
|
11232 |
|
11233 | 'use strict';
|
11234 |
|
11235 | Object.defineProperty(exports, "__esModule", {
|
11236 | value: true
|
11237 | });
|
11238 |
|
11239 | 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; };
|
11240 |
|
11241 | var _classnames = __webpack_require__(5);
|
11242 |
|
11243 | var _classnames2 = _interopRequireDefault(_classnames);
|
11244 |
|
11245 | var _react = __webpack_require__(1);
|
11246 |
|
11247 | var _react2 = _interopRequireDefault(_react);
|
11248 |
|
11249 | var _propTypes = __webpack_require__(6);
|
11250 |
|
11251 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
11252 |
|
11253 | var _OverlayTrigger = __webpack_require__(110);
|
11254 |
|
11255 | var _OverlayTrigger2 = _interopRequireDefault(_OverlayTrigger);
|
11256 |
|
11257 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11258 |
|
11259 | 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; }
|
11260 |
|
11261 | 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; }
|
11262 |
|
11263 | 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; }
|
11264 |
|
11265 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11266 |
|
11267 | 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; }
|
11268 |
|
11269 | 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); }
|
11270 |
|
11271 | var propTypes = {
|
11272 | |
11273 |
|
11274 |
|
11275 | id: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
11276 | inverse: _propTypes2["default"].bool,
|
11277 | visible: _propTypes2["default"].bool,
|
11278 | onVisibleChange: _propTypes2["default"].func,
|
11279 | |
11280 |
|
11281 |
|
11282 | placement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
11283 |
|
11284 | |
11285 |
|
11286 |
|
11287 | positionTop: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
|
11288 | |
11289 |
|
11290 |
|
11291 | positionLeft: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
|
11292 |
|
11293 | |
11294 |
|
11295 |
|
11296 | arrowOffsetTop: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
|
11297 | |
11298 |
|
11299 |
|
11300 | arrowOffsetLeft: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string])
|
11301 | };
|
11302 |
|
11303 | var defaultProps = {
|
11304 | placement: 'right',
|
11305 | clsPrefix: 'u-tooltip'
|
11306 | };
|
11307 | function OverlayNode(props) {
|
11308 | var className = props.className,
|
11309 | classNames = props.classNames,
|
11310 | style = props.style,
|
11311 | overlay = props.overlay,
|
11312 | arrowOffsetTop = props.arrowOffsetTop,
|
11313 | arrowOffsetLeft = props.arrowOffsetLeft;
|
11314 |
|
11315 | return _react2["default"].createElement(
|
11316 | 'div',
|
11317 | {
|
11318 | className: (0, _classnames2["default"])(className, classNames),
|
11319 | onMouseEnter: props.onMouseEnter,
|
11320 | onMouseLeave: props.onMouseLeave,
|
11321 | style: style
|
11322 | },
|
11323 | overlay ? _react2["default"].createElement('div', { className: 'tooltip-arrow', style: {
|
11324 | top: arrowOffsetTop,
|
11325 | left: arrowOffsetLeft
|
11326 | } }) : '',
|
11327 | overlay ? _react2["default"].createElement(
|
11328 | 'div',
|
11329 | { className: 'tooltip-inner' },
|
11330 | overlay
|
11331 | ) : ''
|
11332 | );
|
11333 | }
|
11334 |
|
11335 | var Tooltip = function (_React$Component) {
|
11336 | _inherits(Tooltip, _React$Component);
|
11337 |
|
11338 | function Tooltip(props) {
|
11339 | _classCallCheck(this, Tooltip);
|
11340 |
|
11341 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
11342 |
|
11343 | _this.onMouseEnter = function () {
|
11344 | _this.setState({
|
11345 | isHoverShow: true
|
11346 | });
|
11347 | };
|
11348 |
|
11349 | _this.onMouseLeave = function () {
|
11350 | _this.setState({
|
11351 | isHoverShow: false
|
11352 | });
|
11353 | };
|
11354 |
|
11355 | var initState = {
|
11356 | isHoverShow: false
|
11357 | };
|
11358 | if ('visible' in props) {
|
11359 | _extends(initState, {
|
11360 | visible: props.visible
|
11361 | });
|
11362 | }
|
11363 | _this.state = initState;
|
11364 | return _this;
|
11365 | }
|
11366 |
|
11367 | Tooltip.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
11368 | var _props = this.props,
|
11369 | visible = _props.visible,
|
11370 | onVisibleChange = _props.onVisibleChange;
|
11371 |
|
11372 | if ('visible' in this.props && prevProps.visible !== visible) {
|
11373 | this.setState({
|
11374 | visible: visible
|
11375 | });
|
11376 | onVisibleChange && onVisibleChange(visible);
|
11377 | }
|
11378 | };
|
11379 |
|
11380 | |
11381 |
|
11382 |
|
11383 |
|
11384 |
|
11385 | |
11386 |
|
11387 |
|
11388 |
|
11389 |
|
11390 | Tooltip.prototype.render = function render() {
|
11391 | var _classes,
|
11392 | _this2 = this;
|
11393 |
|
11394 | var _props2 = this.props,
|
11395 | placement = _props2.placement,
|
11396 | positionTop = _props2.positionTop,
|
11397 | positionLeft = _props2.positionLeft,
|
11398 | arrowOffsetTop = _props2.arrowOffsetTop,
|
11399 | arrowOffsetLeft = _props2.arrowOffsetLeft,
|
11400 | className = _props2.className,
|
11401 | style = _props2.style,
|
11402 | children = _props2.children,
|
11403 | clsPrefix = _props2.clsPrefix,
|
11404 | overlay = _props2.overlay,
|
11405 | inverse = _props2.inverse,
|
11406 | others = _objectWithoutProperties(_props2, ['placement', 'positionTop', 'positionLeft', 'arrowOffsetTop', 'arrowOffsetLeft', 'className', 'style', 'children', 'clsPrefix', 'overlay', 'inverse']);
|
11407 |
|
11408 | var classes = (_classes = {}, _defineProperty(_classes, placement, true), _defineProperty(_classes, 'inverse', inverse), _classes);
|
11409 |
|
11410 | var outerStyle = _extends({
|
11411 | top: positionTop,
|
11412 | left: positionLeft
|
11413 | }, style);
|
11414 |
|
11415 | var arrowStyle = {
|
11416 | top: arrowOffsetTop,
|
11417 | left: arrowOffsetLeft
|
11418 | };
|
11419 |
|
11420 | var classNames = (0, _classnames2["default"])(clsPrefix, classes);
|
11421 |
|
11422 | var overlayNode = _react2["default"].createElement(OverlayNode, {
|
11423 | className: className,
|
11424 | classNames: classNames,
|
11425 | overlay: overlay,
|
11426 | onMouseEnter: this.onMouseEnter,
|
11427 | onMouseLeave: this.onMouseLeave,
|
11428 | style: true,
|
11429 | arrowOffsetTop: true,
|
11430 | arrowOffsetLeft: true
|
11431 | });
|
11432 | return 'visible' in this.props ? _react2["default"].createElement(
|
11433 | _OverlayTrigger2["default"],
|
11434 | _extends({ visible: this.state.visible, ref: function ref(_ref) {
|
11435 | return _this2.trigger = _ref;
|
11436 | }, shouldUpdatePosition: true, placement: placement }, others, { overlay: overlayNode }),
|
11437 | children
|
11438 | ) : _react2["default"].createElement(
|
11439 | _OverlayTrigger2["default"],
|
11440 | _extends({ isHoverShow: this.state.isHoverShow, ref: function ref(_ref2) {
|
11441 | return _this2.trigger = _ref2;
|
11442 | }, shouldUpdatePosition: true, placement: placement }, others, { overlay: overlayNode }),
|
11443 | children
|
11444 | );
|
11445 | };
|
11446 |
|
11447 | return Tooltip;
|
11448 | }(_react2["default"].Component);
|
11449 |
|
11450 | Tooltip.propTypes = propTypes;
|
11451 | Tooltip.defaultProps = defaultProps;
|
11452 |
|
11453 | exports["default"] = Tooltip;
|
11454 | module.exports = exports['default'];
|
11455 |
|
11456 | }),
|
11457 |
|
11458 | (function(module, exports, __webpack_require__) {
|
11459 |
|
11460 | 'use strict';
|
11461 |
|
11462 | Object.defineProperty(exports, "__esModule", {
|
11463 | value: true
|
11464 | });
|
11465 |
|
11466 | 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; };
|
11467 |
|
11468 | var _contains = __webpack_require__(111);
|
11469 |
|
11470 | var _contains2 = _interopRequireDefault(_contains);
|
11471 |
|
11472 | var _react = __webpack_require__(1);
|
11473 |
|
11474 | var _react2 = _interopRequireDefault(_react);
|
11475 |
|
11476 | var _propTypes = __webpack_require__(6);
|
11477 |
|
11478 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
11479 |
|
11480 | var _reactDom = __webpack_require__(2);
|
11481 |
|
11482 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
11483 |
|
11484 | var _warning = __webpack_require__(32);
|
11485 |
|
11486 | var _warning2 = _interopRequireDefault(_warning);
|
11487 |
|
11488 | var _Portal = __webpack_require__(112);
|
11489 |
|
11490 | var _Portal2 = _interopRequireDefault(_Portal);
|
11491 |
|
11492 | var _Overlay = __webpack_require__(114);
|
11493 |
|
11494 | var _Overlay2 = _interopRequireDefault(_Overlay);
|
11495 |
|
11496 | var _createChainedFunction = __webpack_require__(131);
|
11497 |
|
11498 | var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
|
11499 |
|
11500 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11501 |
|
11502 | 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; }
|
11503 |
|
11504 | 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; }
|
11505 |
|
11506 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11507 |
|
11508 | 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; }
|
11509 |
|
11510 | 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); }
|
11511 |
|
11512 | var isReact16 = _reactDom2["default"].createPortal !== undefined;
|
11513 | var createPortal = isReact16 ? _reactDom2["default"].createPortal : _reactDom2["default"].unstable_renderSubtreeIntoContainer;
|
11514 |
|
11515 | |
11516 |
|
11517 |
|
11518 |
|
11519 |
|
11520 |
|
11521 |
|
11522 | function isOneOf(one, of) {
|
11523 | if (Array.isArray(of)) {
|
11524 | return of.indexOf(one) >= 0;
|
11525 | }
|
11526 | return one === of;
|
11527 | }
|
11528 |
|
11529 | var triggerType = _propTypes2["default"].oneOf(['click', 'hover', 'focus']);
|
11530 |
|
11531 | var propTypes = _extends({}, _Portal2["default"].propTypes, _Overlay2["default"].propTypes, {
|
11532 |
|
11533 | |
11534 |
|
11535 |
|
11536 | trigger: _propTypes2["default"].oneOfType([triggerType, _propTypes2["default"].arrayOf(triggerType)]),
|
11537 |
|
11538 | |
11539 |
|
11540 |
|
11541 | delay: _propTypes2["default"].number,
|
11542 | |
11543 |
|
11544 |
|
11545 | delayShow: _propTypes2["default"].number,
|
11546 | |
11547 |
|
11548 |
|
11549 | delayHide: _propTypes2["default"].number,
|
11550 |
|
11551 |
|
11552 | |
11553 |
|
11554 |
|
11555 | defaultOverlayShown: _propTypes2["default"].bool,
|
11556 | visible: _propTypes2["default"].bool,
|
11557 |
|
11558 | |
11559 |
|
11560 |
|
11561 | overlay: _propTypes2["default"].node.isRequired,
|
11562 |
|
11563 | |
11564 |
|
11565 |
|
11566 | onBlur: _propTypes2["default"].func,
|
11567 | |
11568 |
|
11569 |
|
11570 | onClick: _propTypes2["default"].func,
|
11571 | |
11572 |
|
11573 |
|
11574 | onFocus: _propTypes2["default"].func,
|
11575 | |
11576 |
|
11577 |
|
11578 | onMouseOut: _propTypes2["default"].func,
|
11579 | |
11580 |
|
11581 |
|
11582 | onMouseOver: _propTypes2["default"].func,
|
11583 |
|
11584 |
|
11585 | |
11586 |
|
11587 |
|
11588 | target: _propTypes2["default"].oneOf([null]),
|
11589 | |
11590 |
|
11591 |
|
11592 | onHide: _propTypes2["default"].oneOf([null]),
|
11593 | |
11594 |
|
11595 |
|
11596 | show: _propTypes2["default"].oneOf([null])
|
11597 | });
|
11598 |
|
11599 | var defaultProps = {
|
11600 | defaultOverlayShown: false,
|
11601 | trigger: ['hover', 'focus']
|
11602 | };
|
11603 |
|
11604 | var OverlayTrigger = function (_Component) {
|
11605 | _inherits(OverlayTrigger, _Component);
|
11606 |
|
11607 | function OverlayTrigger(props, context) {
|
11608 | _classCallCheck(this, OverlayTrigger);
|
11609 |
|
11610 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
11611 |
|
11612 | _this.handleToggle = _this.handleToggle.bind(_this);
|
11613 | _this.handleDelayedShow = _this.handleDelayedShow.bind(_this);
|
11614 | _this.handleDelayedHide = _this.handleDelayedHide.bind(_this);
|
11615 | _this.handleHide = _this.handleHide.bind(_this);
|
11616 | _this.makeOverlay = _this.makeOverlay.bind(_this);
|
11617 |
|
11618 | _this.handleMouseOver = function (e) {
|
11619 | return _this.handleMouseOverOut(_this.handleDelayedShow, e);
|
11620 | };
|
11621 | _this.handleMouseOut = function (e) {
|
11622 | return _this.handleMouseOverOut(_this.handleDelayedHide, e);
|
11623 | };
|
11624 |
|
11625 | _this._mountNode = null;
|
11626 |
|
11627 | var visible = void 0;
|
11628 | if ('visible' in props) {
|
11629 | visible = !!props.visible;
|
11630 | } else {
|
11631 | visible = !!props.defaultOverlayShown;
|
11632 | }
|
11633 |
|
11634 | _this.state = {
|
11635 | show: visible
|
11636 | };
|
11637 | return _this;
|
11638 | }
|
11639 |
|
11640 | OverlayTrigger.prototype.componentDidMount = function componentDidMount() {
|
11641 | this._mountNode = document.createElement('div');
|
11642 | !isReact16 && this.renderOverlay();
|
11643 | };
|
11644 |
|
11645 | OverlayTrigger.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
11646 | !isReact16 && this.renderOverlay();
|
11647 | if ('visible' in this.props && prevProps.visible !== this.props.visible) {
|
11648 | this.setState({
|
11649 | show: this.props.visible
|
11650 | });
|
11651 | }
|
11652 | if ('isHoverShow' in this.props && prevProps.isHoverShow !== this.props.isHoverShow) {
|
11653 | this.setState({
|
11654 | show: this.props.isHoverShow
|
11655 | });
|
11656 | }
|
11657 | };
|
11658 |
|
11659 | OverlayTrigger.prototype.componentWillUnmount = function componentWillUnmount() {
|
11660 | !isReact16 && _reactDom2["default"].unmountComponentAtNode(this._mountNode);
|
11661 | this._mountNode = null;
|
11662 |
|
11663 | this._hoverShowDelay && clearTimeout(this._hoverShowDelay);
|
11664 | this._hoverShowDelay && clearTimeout(this._hoverHideDelay);
|
11665 | };
|
11666 |
|
11667 | OverlayTrigger.prototype.handleToggle = function handleToggle() {
|
11668 | if (this.state.show) {
|
11669 | this.hide();
|
11670 | } else {
|
11671 | this.show();
|
11672 | }
|
11673 | };
|
11674 |
|
11675 | OverlayTrigger.prototype.handleDelayedShow = function handleDelayedShow() {
|
11676 | var _this2 = this;
|
11677 |
|
11678 | if (this._hoverHideDelay != null) {
|
11679 | clearTimeout(this._hoverHideDelay);
|
11680 | this._hoverHideDelay = null;
|
11681 | return;
|
11682 | }
|
11683 |
|
11684 | if (this.state.show || this._hoverShowDelay != null) {
|
11685 | return;
|
11686 | }
|
11687 |
|
11688 | var delay = this.props.delayShow != null ? this.props.delayShow : this.props.delay;
|
11689 |
|
11690 | if (!delay) {
|
11691 | this.show();
|
11692 | return;
|
11693 | }
|
11694 |
|
11695 | this._hoverShowDelay = setTimeout(function () {
|
11696 | _this2._hoverShowDelay = null;
|
11697 | _this2.show();
|
11698 | }, delay);
|
11699 | };
|
11700 |
|
11701 | OverlayTrigger.prototype.handleDelayedHide = function handleDelayedHide() {
|
11702 | var _this3 = this;
|
11703 |
|
11704 | if (this._hoverShowDelay != null) {
|
11705 | clearTimeout(this._hoverShowDelay);
|
11706 | this._hoverShowDelay = null;
|
11707 | return;
|
11708 | }
|
11709 |
|
11710 | if (!this.state.show || this._hoverHideDelay != null) {
|
11711 | return;
|
11712 | }
|
11713 |
|
11714 | var delay = this.props.delayHide != null ? this.props.delayHide : this.props.delay;
|
11715 |
|
11716 | if (!delay) {
|
11717 | this.hide();
|
11718 | return;
|
11719 | }
|
11720 |
|
11721 | this._hoverHideDelay = setTimeout(function () {
|
11722 | _this3._hoverHideDelay = null;
|
11723 | _this3.hide();
|
11724 | }, delay);
|
11725 | };
|
11726 |
|
11727 |
|
11728 |
|
11729 |
|
11730 |
|
11731 |
|
11732 |
|
11733 | OverlayTrigger.prototype.handleMouseOverOut = function handleMouseOverOut(handler, e) {
|
11734 | var target = e.currentTarget;
|
11735 | var related = e.relatedTarget || e.nativeEvent.toElement;
|
11736 |
|
11737 | if (!related || related !== target && !(0, _contains2["default"])(target, related)) {
|
11738 | handler(e);
|
11739 | }
|
11740 | };
|
11741 |
|
11742 | OverlayTrigger.prototype.handleHide = function handleHide() {
|
11743 | this.hide();
|
11744 | };
|
11745 |
|
11746 | OverlayTrigger.prototype.show = function show() {
|
11747 | this.setState({ show: true });
|
11748 | };
|
11749 |
|
11750 | OverlayTrigger.prototype.hide = function hide() {
|
11751 | this.setState({ show: false });
|
11752 | };
|
11753 |
|
11754 | OverlayTrigger.prototype.makeOverlay = function makeOverlay(overlay, props) {
|
11755 | return _react2["default"].createElement(
|
11756 | _Overlay2["default"],
|
11757 | _extends({}, props, {
|
11758 | show: this.state.show,
|
11759 | onHide: this.handleHide,
|
11760 | target: this
|
11761 | }),
|
11762 | overlay
|
11763 | );
|
11764 | };
|
11765 |
|
11766 | OverlayTrigger.prototype.renderOverlay = function renderOverlay() {
|
11767 | _reactDom2["default"].unstable_renderSubtreeIntoContainer(this, this._overlay, this._mountNode);
|
11768 | };
|
11769 |
|
11770 | OverlayTrigger.prototype.render = function render() {
|
11771 | var _props = this.props,
|
11772 | trigger = _props.trigger,
|
11773 | overlay = _props.overlay,
|
11774 | children = _props.children,
|
11775 | onBlur = _props.onBlur,
|
11776 | onClick = _props.onClick,
|
11777 | onFocus = _props.onFocus,
|
11778 | onMouseOut = _props.onMouseOut,
|
11779 | onMouseOver = _props.onMouseOver,
|
11780 | props = _objectWithoutProperties(_props, ['trigger', 'overlay', 'children', 'onBlur', 'onClick', 'onFocus', 'onMouseOut', 'onMouseOver']);
|
11781 |
|
11782 | delete props.delay;
|
11783 | delete props.delayShow;
|
11784 | delete props.delayHide;
|
11785 | delete props.defaultOverlayShown;
|
11786 |
|
11787 | var child = _react2["default"].Children.only(children);
|
11788 | var childProps = child.props;
|
11789 |
|
11790 | var triggerProps = {
|
11791 | 'aria-describedby': overlay.props.id
|
11792 | };
|
11793 |
|
11794 |
|
11795 |
|
11796 | triggerProps.onClick = (0, _createChainedFunction2["default"])(childProps.onClick, onClick);
|
11797 |
|
11798 | if (isOneOf('click', trigger) && !('visible' in this.props)) {
|
11799 | triggerProps.onClick = (0, _createChainedFunction2["default"])(triggerProps.onClick, this.handleToggle);
|
11800 | }
|
11801 |
|
11802 | if (isOneOf('hover', trigger) && !('visible' in this.props)) {
|
11803 | (0, _warning2["default"])(!(trigger === 'hover'), '[react-bootstrap] Specifying only the `"hover"` trigger limits the ' + 'visibility of the overlay to just mouse users. Consider also ' + 'including the `"focus"` trigger so that touch and keyboard only ' + 'users can see the overlay as well.');
|
11804 |
|
11805 | triggerProps.onMouseOver = (0, _createChainedFunction2["default"])(childProps.onMouseOver, onMouseOver, this.handleMouseOver);
|
11806 | triggerProps.onMouseOut = (0, _createChainedFunction2["default"])(childProps.onMouseOut, onMouseOut, this.handleMouseOut);
|
11807 | }
|
11808 |
|
11809 | if (isOneOf('focus', trigger) && !('visible' in this.props)) {
|
11810 | triggerProps.onFocus = (0, _createChainedFunction2["default"])(childProps.onFocus, onFocus, this.handleDelayedShow);
|
11811 | triggerProps.onBlur = (0, _createChainedFunction2["default"])(childProps.onBlur, onBlur, this.handleDelayedHide);
|
11812 | }
|
11813 |
|
11814 | this._overlay = this.makeOverlay(overlay, props);
|
11815 |
|
11816 | if (!isReact16) {
|
11817 | return (0, _react.cloneElement)(child, triggerProps);
|
11818 | }
|
11819 | triggerProps.key = 'overlay';
|
11820 |
|
11821 | var portal = _react2["default"].createElement(
|
11822 | _Portal2["default"],
|
11823 | {
|
11824 | key: 'portal',
|
11825 | container: props.container },
|
11826 | this._overlay
|
11827 | );
|
11828 |
|
11829 | return [(0, _react.cloneElement)(child, triggerProps), portal];
|
11830 | };
|
11831 |
|
11832 | return OverlayTrigger;
|
11833 | }(_react.Component);
|
11834 |
|
11835 | OverlayTrigger.propTypes = propTypes;
|
11836 | OverlayTrigger.defaultProps = defaultProps;
|
11837 |
|
11838 | exports["default"] = OverlayTrigger;
|
11839 | module.exports = exports['default'];
|
11840 |
|
11841 | }),
|
11842 |
|
11843 | (function(module, exports, __webpack_require__) {
|
11844 |
|
11845 | "use strict";
|
11846 |
|
11847 | var _interopRequireDefault = __webpack_require__(14);
|
11848 |
|
11849 | exports.__esModule = true;
|
11850 | exports.default = void 0;
|
11851 |
|
11852 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
11853 |
|
11854 | var _default = function () {
|
11855 |
|
11856 |
|
11857 | return _inDOM.default ? function (context, node) {
|
11858 | if (context.contains) {
|
11859 | return context.contains(node);
|
11860 | } else if (context.compareDocumentPosition) {
|
11861 | return context === node || !!(context.compareDocumentPosition(node) & 16);
|
11862 | } else {
|
11863 | return fallback(context, node);
|
11864 | }
|
11865 | } : fallback;
|
11866 | }();
|
11867 |
|
11868 | exports.default = _default;
|
11869 |
|
11870 | function fallback(context, node) {
|
11871 | if (node) do {
|
11872 | if (node === context) return true;
|
11873 | } while (node = node.parentNode);
|
11874 | return false;
|
11875 | }
|
11876 |
|
11877 | module.exports = exports["default"];
|
11878 |
|
11879 | }),
|
11880 |
|
11881 | (function(module, exports, __webpack_require__) {
|
11882 |
|
11883 | 'use strict';
|
11884 |
|
11885 | Object.defineProperty(exports, "__esModule", {
|
11886 | value: true
|
11887 | });
|
11888 |
|
11889 | var _react = __webpack_require__(1);
|
11890 |
|
11891 | var _react2 = _interopRequireDefault(_react);
|
11892 |
|
11893 | var _reactDom = __webpack_require__(2);
|
11894 |
|
11895 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
11896 |
|
11897 | var _propTypes = __webpack_require__(6);
|
11898 |
|
11899 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
11900 |
|
11901 | var _ownerDocument = __webpack_require__(74);
|
11902 |
|
11903 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
11904 |
|
11905 | var _getContainer = __webpack_require__(113);
|
11906 |
|
11907 | var _getContainer2 = _interopRequireDefault(_getContainer);
|
11908 |
|
11909 | var _tinperBeeCore = __webpack_require__(27);
|
11910 |
|
11911 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
11912 |
|
11913 | 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; }
|
11914 |
|
11915 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11916 |
|
11917 | 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; }
|
11918 |
|
11919 | 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); }
|
11920 |
|
11921 | var isReact16 = _reactDom2["default"].createPortal !== undefined;
|
11922 | var createPortal = isReact16 ? _reactDom2["default"].createPortal : _reactDom2["default"].unstable_renderSubtreeIntoContainer;
|
11923 |
|
11924 | var propTypes = {
|
11925 | |
11926 |
|
11927 |
|
11928 | container: _propTypes2["default"].oneOfType([_tinperBeeCore.componentOrElement, _propTypes2["default"].func])
|
11929 | };
|
11930 |
|
11931 | var defaultProps = {};
|
11932 |
|
11933 | |
11934 |
|
11935 |
|
11936 |
|
11937 | var Portal = function (_Component) {
|
11938 | _inherits(Portal, _Component);
|
11939 |
|
11940 | function Portal(props) {
|
11941 | _classCallCheck(this, Portal);
|
11942 |
|
11943 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
11944 |
|
11945 | _this.getMountNode = _this.getMountNode.bind(_this);
|
11946 | _this.getOverlayDOMNode = _this.getOverlayDOMNode.bind(_this);
|
11947 | _this.mountOverlayTarget = _this.mountOverlayTarget.bind(_this);
|
11948 | _this.unmountOverlayTarget = _this.unmountOverlayTarget.bind(_this);
|
11949 | _this.renderOverlay = _this.renderOverlay.bind(_this);
|
11950 | _this.unrenderOverlay = _this.unrenderOverlay.bind(_this);
|
11951 |
|
11952 | _this.overlayTarget = isReact16 ? document.createElement('div') : null;
|
11953 | return _this;
|
11954 | }
|
11955 |
|
11956 | Portal.prototype.componentDidMount = function componentDidMount() {
|
11957 | if (isReact16) {
|
11958 | this.portalContainerNode = (0, _getContainer2["default"])(this.props.container, (0, _ownerDocument2["default"])(this).body);
|
11959 | this.portalContainerNode.appendChild(this.overlayTarget);
|
11960 | } else {
|
11961 | this.renderOverlay();
|
11962 | }
|
11963 |
|
11964 | this.mounted = true;
|
11965 | };
|
11966 |
|
11967 | Portal.prototype.componentDidUpdate = function componentDidUpdate() {
|
11968 | if (isReact16) {
|
11969 | var overlay = !this.props.children ? null : _react2["default"].Children.only(this.props.children);
|
11970 | if (overlay === null) {
|
11971 | this.unrenderOverlay();
|
11972 | this.unmountOverlayTarget();
|
11973 | } else {}
|
11974 | } else {
|
11975 | this.renderOverlay();
|
11976 | }
|
11977 | };
|
11978 |
|
11979 |
|
11980 |
|
11981 | Portal.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
11982 | if (this.overlayTarget && nextProps.container !== this.props.container) {
|
11983 | this.portalContainerNode.removeChild(this.overlayTarget);
|
11984 | this.portalContainerNode = (0, _getContainer2["default"])(nextProps.container, (0, _ownerDocument2["default"])(this).body);
|
11985 | this.portalContainerNode.appendChild(this.overlayTarget);
|
11986 | }
|
11987 | };
|
11988 |
|
11989 | Portal.prototype.componentWillUnmount = function componentWillUnmount() {
|
11990 | this.unrenderOverlay();
|
11991 | this.unmountOverlayTarget();
|
11992 |
|
11993 | this.mounted = false;
|
11994 | };
|
11995 |
|
11996 | Portal.prototype.getMountNode = function getMountNode() {
|
11997 | return this.overlayTarget;
|
11998 | };
|
11999 |
|
12000 | Portal.prototype.getOverlayDOMNode = function getOverlayDOMNode() {
|
12001 | if (!this.mounted) {
|
12002 | throw new Error('getOverlayDOMNode(): A component must be mounted to have a DOM node.');
|
12003 | }
|
12004 |
|
12005 | if (this.overlayInstance) {
|
12006 | return _reactDom2["default"].findDOMNode(this.overlayInstance);
|
12007 | }
|
12008 |
|
12009 | return null;
|
12010 | };
|
12011 |
|
12012 | |
12013 |
|
12014 |
|
12015 |
|
12016 | Portal.prototype.mountOverlayTarget = function mountOverlayTarget() {
|
12017 | if (!this.overlayTarget) {
|
12018 | this.overlayTarget = document.createElement('div');
|
12019 | this.portalContainerNode = (0, _getContainer2["default"])(this.props.container, (0, _ownerDocument2["default"])(this).body);
|
12020 | this.portalContainerNode.appendChild(this.overlayTarget);
|
12021 | }
|
12022 | };
|
12023 | |
12024 |
|
12025 |
|
12026 |
|
12027 |
|
12028 | Portal.prototype.unmountOverlayTarget = function unmountOverlayTarget() {
|
12029 | if (this.overlayTarget) {
|
12030 | this.portalContainerNode.removeChild(this.overlayTarget);
|
12031 | this.overlayTarget = null;
|
12032 | }
|
12033 | this.portalContainerNode = null;
|
12034 | };
|
12035 | |
12036 |
|
12037 |
|
12038 |
|
12039 |
|
12040 | Portal.prototype.renderOverlay = function renderOverlay() {
|
12041 |
|
12042 | var overlay = !this.props.children ? null : _react2["default"].Children.only(this.props.children);
|
12043 |
|
12044 |
|
12045 | if (overlay !== null) {
|
12046 | this.mountOverlayTarget();
|
12047 | this.overlayInstance = _reactDom2["default"].unstable_renderSubtreeIntoContainer(this, overlay, this.overlayTarget);
|
12048 | } else {
|
12049 |
|
12050 | this.unrenderOverlay();
|
12051 | this.unmountOverlayTarget();
|
12052 | }
|
12053 | };
|
12054 | |
12055 |
|
12056 |
|
12057 |
|
12058 |
|
12059 | Portal.prototype.unrenderOverlay = function unrenderOverlay() {
|
12060 | if (this.overlayTarget) {
|
12061 | !isReact16 && _reactDom2["default"].unmountComponentAtNode(this.overlayTarget);
|
12062 | this.overlayInstance = null;
|
12063 | }
|
12064 | };
|
12065 |
|
12066 | Portal.prototype.render = function render() {
|
12067 | if (!isReact16) {
|
12068 | return null;
|
12069 | }
|
12070 |
|
12071 | var overlay = !this.props.children ? null : _react2["default"].Children.only(this.props.children);
|
12072 |
|
12073 | return _reactDom2["default"].createPortal(overlay, this.overlayTarget);
|
12074 | };
|
12075 |
|
12076 | return Portal;
|
12077 | }(_react.Component);
|
12078 |
|
12079 | ;
|
12080 |
|
12081 | Portal.propTypes = propTypes;
|
12082 | Portal.defaultProps = defaultProps;
|
12083 |
|
12084 | exports["default"] = Portal;
|
12085 | module.exports = exports['default'];
|
12086 |
|
12087 | }),
|
12088 |
|
12089 | (function(module, exports, __webpack_require__) {
|
12090 |
|
12091 | 'use strict';
|
12092 |
|
12093 | Object.defineProperty(exports, "__esModule", {
|
12094 | value: true
|
12095 | });
|
12096 | exports["default"] = getContainer;
|
12097 |
|
12098 | var _reactDom = __webpack_require__(2);
|
12099 |
|
12100 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
12101 |
|
12102 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12103 |
|
12104 | |
12105 |
|
12106 |
|
12107 |
|
12108 |
|
12109 |
|
12110 | function getContainer(container, defaultContainer) {
|
12111 | container = typeof container === 'function' ? container() : container;
|
12112 | return _reactDom2["default"].findDOMNode(container) || defaultContainer;
|
12113 | }
|
12114 | module.exports = exports['default'];
|
12115 |
|
12116 | }),
|
12117 |
|
12118 | (function(module, exports, __webpack_require__) {
|
12119 |
|
12120 | 'use strict';
|
12121 |
|
12122 | Object.defineProperty(exports, "__esModule", {
|
12123 | value: true
|
12124 | });
|
12125 |
|
12126 | 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; };
|
12127 |
|
12128 | var _classnames = __webpack_require__(5);
|
12129 |
|
12130 | var _classnames2 = _interopRequireDefault(_classnames);
|
12131 |
|
12132 | var _react = __webpack_require__(1);
|
12133 |
|
12134 | var _react2 = _interopRequireDefault(_react);
|
12135 |
|
12136 | var _propTypes = __webpack_require__(6);
|
12137 |
|
12138 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
12139 |
|
12140 | var _BaseOverlay = __webpack_require__(115);
|
12141 |
|
12142 | var _BaseOverlay2 = _interopRequireDefault(_BaseOverlay);
|
12143 |
|
12144 | var _tinperBeeCore = __webpack_require__(27);
|
12145 |
|
12146 | var _Fade = __webpack_require__(129);
|
12147 |
|
12148 | var _Fade2 = _interopRequireDefault(_Fade);
|
12149 |
|
12150 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12151 |
|
12152 | 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; }
|
12153 |
|
12154 | 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; }
|
12155 |
|
12156 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12157 |
|
12158 | 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; }
|
12159 |
|
12160 | 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); }
|
12161 |
|
12162 | var propTypes = _extends({}, _BaseOverlay2["default"].propTypes, {
|
12163 |
|
12164 | |
12165 |
|
12166 |
|
12167 | show: _propTypes2["default"].bool,
|
12168 | |
12169 |
|
12170 |
|
12171 | rootClose: _propTypes2["default"].bool,
|
12172 | |
12173 |
|
12174 |
|
12175 | onHide: _propTypes2["default"].func,
|
12176 |
|
12177 | |
12178 |
|
12179 |
|
12180 | animation: _propTypes2["default"].oneOfType([_tinperBeeCore.elementType, _propTypes2["default"].func]),
|
12181 |
|
12182 | |
12183 |
|
12184 |
|
12185 | onEnter: _propTypes2["default"].func,
|
12186 |
|
12187 | |
12188 |
|
12189 |
|
12190 | onEntering: _propTypes2["default"].func,
|
12191 |
|
12192 | |
12193 |
|
12194 |
|
12195 | onEntered: _propTypes2["default"].func,
|
12196 |
|
12197 | |
12198 |
|
12199 |
|
12200 | onExit: _propTypes2["default"].func,
|
12201 |
|
12202 | |
12203 |
|
12204 |
|
12205 | onExiting: _propTypes2["default"].func,
|
12206 |
|
12207 | |
12208 |
|
12209 |
|
12210 | onExited: _propTypes2["default"].func,
|
12211 |
|
12212 | |
12213 |
|
12214 |
|
12215 | placement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
12216 |
|
12217 | |
12218 |
|
12219 |
|
12220 | secondPlacement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left'])
|
12221 | });
|
12222 |
|
12223 | var defaultProps = {
|
12224 | animation: _Fade2["default"],
|
12225 | rootClose: false,
|
12226 | show: false,
|
12227 | placement: 'right'
|
12228 | };
|
12229 |
|
12230 | var Overlay = function (_Component) {
|
12231 | _inherits(Overlay, _Component);
|
12232 |
|
12233 | function Overlay() {
|
12234 | _classCallCheck(this, Overlay);
|
12235 |
|
12236 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
12237 | }
|
12238 |
|
12239 | Overlay.prototype.render = function render() {
|
12240 | var _props = this.props,
|
12241 | animation = _props.animation,
|
12242 | children = _props.children,
|
12243 | props = _objectWithoutProperties(_props, ['animation', 'children']);
|
12244 |
|
12245 | var transition = animation === true ? _Fade2["default"] : animation || null;
|
12246 |
|
12247 | var child = void 0;
|
12248 |
|
12249 | if (!transition) {
|
12250 | child = (0, _react.cloneElement)(children, {
|
12251 | className: (0, _classnames2["default"])(children.props.className, 'in')
|
12252 | });
|
12253 | } else {
|
12254 | child = children;
|
12255 | }
|
12256 |
|
12257 | return _react2["default"].createElement(
|
12258 | _BaseOverlay2["default"],
|
12259 | _extends({}, props, {
|
12260 | transition: transition
|
12261 | }),
|
12262 | child
|
12263 | );
|
12264 | };
|
12265 |
|
12266 | return Overlay;
|
12267 | }(_react.Component);
|
12268 |
|
12269 | Overlay.propTypes = propTypes;
|
12270 | Overlay.defaultProps = defaultProps;
|
12271 |
|
12272 | exports["default"] = Overlay;
|
12273 | module.exports = exports['default'];
|
12274 |
|
12275 | }),
|
12276 |
|
12277 | (function(module, exports, __webpack_require__) {
|
12278 |
|
12279 | 'use strict';
|
12280 |
|
12281 | Object.defineProperty(exports, "__esModule", {
|
12282 | value: true
|
12283 | });
|
12284 |
|
12285 | 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; };
|
12286 |
|
12287 | var _react = __webpack_require__(1);
|
12288 |
|
12289 | var _react2 = _interopRequireDefault(_react);
|
12290 |
|
12291 | var _reactDom = __webpack_require__(2);
|
12292 |
|
12293 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
12294 |
|
12295 | var _propTypes = __webpack_require__(6);
|
12296 |
|
12297 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
12298 |
|
12299 | var _Portal = __webpack_require__(112);
|
12300 |
|
12301 | var _Portal2 = _interopRequireDefault(_Portal);
|
12302 |
|
12303 | var _Position = __webpack_require__(116);
|
12304 |
|
12305 | var _Position2 = _interopRequireDefault(_Position);
|
12306 |
|
12307 | var _RootCloseWrapper = __webpack_require__(128);
|
12308 |
|
12309 | var _RootCloseWrapper2 = _interopRequireDefault(_RootCloseWrapper);
|
12310 |
|
12311 | var _tinperBeeCore = __webpack_require__(27);
|
12312 |
|
12313 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12314 |
|
12315 | 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; }
|
12316 |
|
12317 | 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; }
|
12318 |
|
12319 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12320 |
|
12321 | 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; }
|
12322 |
|
12323 | 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); }
|
12324 |
|
12325 | var isReact16 = _reactDom2["default"].createPortal !== undefined;
|
12326 |
|
12327 | var propTypes = _extends({}, _Position2["default"].propTypes, {
|
12328 |
|
12329 | |
12330 |
|
12331 |
|
12332 | show: _propTypes2["default"].bool,
|
12333 |
|
12334 | |
12335 |
|
12336 |
|
12337 | rootClose: _propTypes2["default"].bool,
|
12338 |
|
12339 | |
12340 |
|
12341 |
|
12342 |
|
12343 | onHide: function onHide(props) {
|
12344 | var propType = _propTypes2["default"].func;
|
12345 | if (props.rootClose) {
|
12346 | propType = propType.isRequired;
|
12347 | }
|
12348 |
|
12349 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
12350 | args[_key - 1] = arguments[_key];
|
12351 | }
|
12352 |
|
12353 | return propType.apply(undefined, [props].concat(args));
|
12354 | },
|
12355 |
|
12356 |
|
12357 | |
12358 |
|
12359 |
|
12360 | transition: _propTypes2["default"].oneOfType([_tinperBeeCore.elementType, _propTypes2["default"].func]),
|
12361 |
|
12362 | |
12363 |
|
12364 |
|
12365 | onEnter: _propTypes2["default"].func,
|
12366 |
|
12367 | |
12368 |
|
12369 |
|
12370 | onEntering: _propTypes2["default"].func,
|
12371 |
|
12372 | |
12373 |
|
12374 |
|
12375 | onEntered: _propTypes2["default"].func,
|
12376 |
|
12377 | |
12378 |
|
12379 |
|
12380 | onExit: _propTypes2["default"].func,
|
12381 |
|
12382 | |
12383 |
|
12384 |
|
12385 | onExiting: _propTypes2["default"].func,
|
12386 |
|
12387 | |
12388 |
|
12389 |
|
12390 | onExited: _propTypes2["default"].func
|
12391 | });
|
12392 |
|
12393 | function noop() {}
|
12394 |
|
12395 | var defaultProps = {
|
12396 | show: false,
|
12397 | rootClose: true
|
12398 | };
|
12399 |
|
12400 | |
12401 |
|
12402 |
|
12403 |
|
12404 | var BaseOverlay = function (_Component) {
|
12405 | _inherits(BaseOverlay, _Component);
|
12406 |
|
12407 | function BaseOverlay(props, context) {
|
12408 | _classCallCheck(this, BaseOverlay);
|
12409 |
|
12410 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
12411 |
|
12412 | _this.state = { exited: !props.show };
|
12413 | _this.onHiddenListener = _this.handleHidden.bind(_this);
|
12414 | return _this;
|
12415 | }
|
12416 |
|
12417 | BaseOverlay.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
12418 | if (nextProps.show) {
|
12419 | this.setState({ exited: false });
|
12420 | } else if (!nextProps.transition) {
|
12421 |
|
12422 | this.setState({ exited: true });
|
12423 | }
|
12424 | };
|
12425 |
|
12426 | BaseOverlay.prototype.handleHidden = function handleHidden() {
|
12427 | this.setState({ exited: true });
|
12428 |
|
12429 | if (this.props.onExited) {
|
12430 | var _props;
|
12431 |
|
12432 | (_props = this.props).onExited.apply(_props, arguments);
|
12433 | }
|
12434 | };
|
12435 |
|
12436 | BaseOverlay.prototype.render = function render() {
|
12437 | var _props2 = this.props,
|
12438 | container = _props2.container,
|
12439 | containerPadding = _props2.containerPadding,
|
12440 | target = _props2.target,
|
12441 | placement = _props2.placement,
|
12442 | secondPlacement = _props2.secondPlacement,
|
12443 | shouldUpdatePosition = _props2.shouldUpdatePosition,
|
12444 | rootClose = _props2.rootClose,
|
12445 | positionLeft = _props2.positionLeft,
|
12446 | positionTop = _props2.positionTop,
|
12447 | children = _props2.children,
|
12448 | Transition = _props2.transition,
|
12449 | props = _objectWithoutProperties(_props2, ['container', 'containerPadding', 'target', 'placement', 'secondPlacement', 'shouldUpdatePosition', 'rootClose', 'positionLeft', 'positionTop', 'children', 'transition']);
|
12450 |
|
12451 |
|
12452 |
|
12453 |
|
12454 | var mountOverlay = props.show || Transition && !this.state.exited;
|
12455 | if (!mountOverlay) {
|
12456 |
|
12457 | return null;
|
12458 | }
|
12459 |
|
12460 | var child = children;
|
12461 |
|
12462 |
|
12463 |
|
12464 | child = _react2["default"].createElement(
|
12465 | _Position2["default"],
|
12466 | {
|
12467 | container: container,
|
12468 | containerPadding: containerPadding,
|
12469 | target: target,
|
12470 | positionLeft: positionLeft,
|
12471 | positionTop: positionTop,
|
12472 | placement: placement,
|
12473 | secondPlacement: secondPlacement,
|
12474 | shouldUpdatePosition: shouldUpdatePosition },
|
12475 | child
|
12476 | );
|
12477 |
|
12478 | if (Transition) {
|
12479 | var onExit = props.onExit,
|
12480 | onExiting = props.onExiting,
|
12481 | onEnter = props.onEnter,
|
12482 | onEntering = props.onEntering,
|
12483 | onEntered = props.onEntered;
|
12484 |
|
12485 |
|
12486 |
|
12487 |
|
12488 | child = _react2["default"].createElement(
|
12489 | Transition,
|
12490 | {
|
12491 | 'in': props.show,
|
12492 | transitionAppear: true,
|
12493 | onExit: onExit,
|
12494 | onExiting: onExiting,
|
12495 | onExited: this.onHiddenListener,
|
12496 | onEnter: onEnter,
|
12497 | onEntering: onEntering,
|
12498 | onEntered: onEntered
|
12499 | },
|
12500 | child
|
12501 | );
|
12502 | }
|
12503 |
|
12504 |
|
12505 | if (rootClose) {
|
12506 | child = _react2["default"].createElement(
|
12507 | _RootCloseWrapper2["default"],
|
12508 | { onRootClose: props.onHide },
|
12509 | child
|
12510 | );
|
12511 | }
|
12512 |
|
12513 | if (isReact16) {
|
12514 | return child;
|
12515 | } else {
|
12516 | return _react2["default"].createElement(
|
12517 | _Portal2["default"],
|
12518 | { container: container },
|
12519 | child
|
12520 | );
|
12521 | }
|
12522 | };
|
12523 |
|
12524 | return BaseOverlay;
|
12525 | }(_react.Component);
|
12526 |
|
12527 | BaseOverlay.propTypes = propTypes;
|
12528 | BaseOverlay.defaultProps = defaultProps;
|
12529 |
|
12530 | exports["default"] = BaseOverlay;
|
12531 | module.exports = exports['default'];
|
12532 |
|
12533 | }),
|
12534 |
|
12535 | (function(module, exports, __webpack_require__) {
|
12536 |
|
12537 | 'use strict';
|
12538 |
|
12539 | Object.defineProperty(exports, "__esModule", {
|
12540 | value: true
|
12541 | });
|
12542 |
|
12543 | 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; };
|
12544 |
|
12545 | var _classnames = __webpack_require__(5);
|
12546 |
|
12547 | var _classnames2 = _interopRequireDefault(_classnames);
|
12548 |
|
12549 | var _react = __webpack_require__(1);
|
12550 |
|
12551 | var _react2 = _interopRequireDefault(_react);
|
12552 |
|
12553 | var _propTypes = __webpack_require__(6);
|
12554 |
|
12555 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
12556 |
|
12557 | var _reactDom = __webpack_require__(2);
|
12558 |
|
12559 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
12560 |
|
12561 | var _tinperBeeCore = __webpack_require__(27);
|
12562 |
|
12563 | var _requestAnimationFrame = __webpack_require__(117);
|
12564 |
|
12565 | var _requestAnimationFrame2 = _interopRequireDefault(_requestAnimationFrame);
|
12566 |
|
12567 | var _calculatePosition = __webpack_require__(118);
|
12568 |
|
12569 | var _calculatePosition2 = _interopRequireDefault(_calculatePosition);
|
12570 |
|
12571 | var _getContainer = __webpack_require__(113);
|
12572 |
|
12573 | var _getContainer2 = _interopRequireDefault(_getContainer);
|
12574 |
|
12575 | var _ownerDocument = __webpack_require__(74);
|
12576 |
|
12577 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
12578 |
|
12579 | var _ownerWindow = __webpack_require__(126);
|
12580 |
|
12581 | var _ownerWindow2 = _interopRequireDefault(_ownerWindow);
|
12582 |
|
12583 | var _addEventListener = __webpack_require__(76);
|
12584 |
|
12585 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
12586 |
|
12587 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12588 |
|
12589 | 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; }
|
12590 |
|
12591 | 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; }
|
12592 |
|
12593 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12594 |
|
12595 | 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; }
|
12596 |
|
12597 | 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); }
|
12598 |
|
12599 | var propTypes = {
|
12600 | |
12601 |
|
12602 |
|
12603 | target: _propTypes2["default"].oneOfType([_tinperBeeCore.componentOrElement, _propTypes2["default"].func]),
|
12604 |
|
12605 | |
12606 |
|
12607 |
|
12608 | container: _propTypes2["default"].oneOfType([_tinperBeeCore.componentOrElement, _propTypes2["default"].func]),
|
12609 | |
12610 |
|
12611 |
|
12612 | containerPadding: _propTypes2["default"].number,
|
12613 | |
12614 |
|
12615 |
|
12616 | placement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
12617 |
|
12618 | |
12619 |
|
12620 |
|
12621 | secondPlacement: _propTypes2["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
12622 |
|
12623 | |
12624 |
|
12625 |
|
12626 | shouldUpdatePosition: _propTypes2["default"].bool
|
12627 | };
|
12628 |
|
12629 | var defaultProps = {
|
12630 | containerPadding: 0,
|
12631 | placement: 'right',
|
12632 | shouldUpdatePosition: false
|
12633 | };
|
12634 |
|
12635 | |
12636 |
|
12637 |
|
12638 |
|
12639 | var Position = function (_Component) {
|
12640 | _inherits(Position, _Component);
|
12641 |
|
12642 | function Position(props, context) {
|
12643 | _classCallCheck(this, Position);
|
12644 |
|
12645 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
12646 |
|
12647 | _this.state = {
|
12648 | positionLeft: 0,
|
12649 | positionTop: 0,
|
12650 | arrowOffsetLeft: null,
|
12651 | arrowOffsetTop: null
|
12652 | };
|
12653 |
|
12654 | _this.needsFlush = false;
|
12655 | _this.lastTarget = null;
|
12656 |
|
12657 | _this.getTarget = _this.getTarget.bind(_this);
|
12658 | _this.maybeUpdatePosition = _this.maybeUpdatePosition.bind(_this);
|
12659 | _this.updatePosition = _this.updatePosition.bind(_this);
|
12660 | _this.onWindowResize = _this.onWindowResize.bind(_this);
|
12661 | return _this;
|
12662 | }
|
12663 |
|
12664 | Position.prototype.componentDidMount = function componentDidMount() {
|
12665 | var _this2 = this;
|
12666 |
|
12667 | this._isMounted = true;
|
12668 |
|
12669 | this._windowResizeListener = (0, _addEventListener2["default"])((0, _ownerWindow2["default"])(this), 'resize', function () {
|
12670 | return _this2.onWindowResize();
|
12671 | });
|
12672 |
|
12673 | this.updatePosition(this.getTarget());
|
12674 | };
|
12675 |
|
12676 | Position.prototype.componentWillReceiveProps = function componentWillReceiveProps() {
|
12677 | this.needsFlush = true;
|
12678 | };
|
12679 |
|
12680 | Position.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
12681 | if (this.needsFlush) {
|
12682 | this.needsFlush = false;
|
12683 |
|
12684 | this.maybeUpdatePosition();
|
12685 | }
|
12686 | };
|
12687 |
|
12688 | Position.prototype.componentWillUnmount = function componentWillUnmount() {
|
12689 | this._isMounted = false;
|
12690 |
|
12691 | if (this._windowResizeListener) {
|
12692 | this._windowResizeListener.remove();
|
12693 | }
|
12694 | };
|
12695 |
|
12696 | |
12697 |
|
12698 |
|
12699 |
|
12700 |
|
12701 | Position.prototype.getTarget = function getTarget() {
|
12702 | var target = this.props.target;
|
12703 |
|
12704 | var targetElement = typeof target === 'function' ? target() : target;
|
12705 | return targetElement && _reactDom2["default"].findDOMNode(targetElement) || null;
|
12706 | };
|
12707 |
|
12708 | |
12709 |
|
12710 |
|
12711 |
|
12712 |
|
12713 | Position.prototype.maybeUpdatePosition = function maybeUpdatePosition(placementChanged) {
|
12714 | var target = this.getTarget();
|
12715 | if (!this.props.shouldUpdatePosition && target === this.lastTarget && !placementChanged) {
|
12716 | return;
|
12717 | }
|
12718 |
|
12719 | this.updatePosition(target);
|
12720 | };
|
12721 |
|
12722 | Position.prototype.onWindowResize = function onWindowResize() {
|
12723 | var _this3 = this;
|
12724 |
|
12725 | (0, _requestAnimationFrame2["default"])(function () {
|
12726 | return _this3.updatePosition(_this3.getTarget());
|
12727 | });
|
12728 | };
|
12729 |
|
12730 | |
12731 |
|
12732 |
|
12733 |
|
12734 | Position.prototype.updatePosition = function updatePosition(target) {
|
12735 | var _props = this.props,
|
12736 | placement = _props.placement,
|
12737 | secondPlacement = _props.secondPlacement;
|
12738 |
|
12739 |
|
12740 | if (!this._isMounted) {
|
12741 | return;
|
12742 | }
|
12743 | this.lastTarget = target;
|
12744 |
|
12745 | if (!target) {
|
12746 | this.setState({
|
12747 | positionLeft: 0,
|
12748 | positionTop: 0,
|
12749 | arrowOffsetLeft: null,
|
12750 | arrowOffsetTop: null
|
12751 | });
|
12752 |
|
12753 | return;
|
12754 | }
|
12755 |
|
12756 | var overlay = _reactDom2["default"].findDOMNode(this);
|
12757 | var container = (0, _getContainer2["default"])(this.props.container, (0, _ownerDocument2["default"])(this).body);
|
12758 |
|
12759 |
|
12760 | if ("secondPlacement" in this.props && secondPlacement) {
|
12761 | var initPosition = (0, _calculatePosition2["default"])(placement, overlay, target, container, this.props.containerPadding);
|
12762 | if (initPosition.inverseArrow) {
|
12763 | var secondPosition = (0, _calculatePosition2["default"])(secondPlacement, overlay, target, container, this.props.containerPadding);
|
12764 |
|
12765 | if (secondPosition.inverseArrow) {
|
12766 | this.setState(_extends({}, initPosition, {
|
12767 | renderPlacement: placement
|
12768 | }));
|
12769 | } else {
|
12770 | this.setState(_extends({}, secondPosition, {
|
12771 | renderPlacement: secondPlacement
|
12772 | }));
|
12773 | }
|
12774 | } else {
|
12775 | this.setState(_extends({}, initPosition, {
|
12776 | renderPlacement: placement
|
12777 | }));
|
12778 | }
|
12779 | } else {
|
12780 | this.setState((0, _calculatePosition2["default"])(placement, overlay, target, container, this.props.containerPadding));
|
12781 | }
|
12782 | };
|
12783 |
|
12784 | Position.prototype.render = function render() {
|
12785 | var _props2 = this.props,
|
12786 | children = _props2.children,
|
12787 | className = _props2.className,
|
12788 | props = _objectWithoutProperties(_props2, ['children', 'className']);
|
12789 |
|
12790 | var _state = this.state,
|
12791 | positionLeft = _state.positionLeft,
|
12792 | positionTop = _state.positionTop,
|
12793 | inverseArrow = _state.inverseArrow,
|
12794 | width = _state.width,
|
12795 | arrowPosition = _objectWithoutProperties(_state, ['positionLeft', 'positionTop', 'inverseArrow', 'width']);
|
12796 |
|
12797 |
|
12798 |
|
12799 |
|
12800 | delete props.target;
|
12801 | delete props.container;
|
12802 | delete props.containerPadding;
|
12803 | delete props.shouldUpdatePosition;
|
12804 |
|
12805 | var child = _react2["default"].Children.only(children);
|
12806 | return (0, _react.cloneElement)(child, _extends({
|
12807 | className: (0, _classnames2["default"])(className, child.props.className, { 'inverse-arrow': inverseArrow })
|
12808 | }, arrowPosition, {
|
12809 | style: _extends({}, child.props.style, {
|
12810 | width: width,
|
12811 | left: positionLeft,
|
12812 | top: positionTop
|
12813 | })
|
12814 | }));
|
12815 | };
|
12816 |
|
12817 | return Position;
|
12818 | }(_react.Component);
|
12819 |
|
12820 | Position.propTypes = propTypes;
|
12821 | Position.defaultProps = defaultProps;
|
12822 |
|
12823 | exports["default"] = Position;
|
12824 | module.exports = exports['default'];
|
12825 |
|
12826 | }),
|
12827 |
|
12828 | (function(module, exports, __webpack_require__) {
|
12829 |
|
12830 | "use strict";
|
12831 |
|
12832 | var _interopRequireDefault = __webpack_require__(14);
|
12833 |
|
12834 | exports.__esModule = true;
|
12835 | exports.default = void 0;
|
12836 |
|
12837 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
12838 |
|
12839 | var vendors = ['', 'webkit', 'moz', 'o', 'ms'];
|
12840 | var cancel = 'clearTimeout';
|
12841 | var raf = fallback;
|
12842 | var compatRaf;
|
12843 |
|
12844 | var getKey = function getKey(vendor, k) {
|
12845 | return vendor + (!vendor ? k : k[0].toUpperCase() + k.substr(1)) + 'AnimationFrame';
|
12846 | };
|
12847 |
|
12848 | if (_inDOM.default) {
|
12849 | vendors.some(function (vendor) {
|
12850 | var rafKey = getKey(vendor, 'request');
|
12851 |
|
12852 | if (rafKey in window) {
|
12853 | cancel = getKey(vendor, 'cancel');
|
12854 | return raf = function raf(cb) {
|
12855 | return window[rafKey](cb);
|
12856 | };
|
12857 | }
|
12858 | });
|
12859 | }
|
12860 |
|
12861 |
|
12862 |
|
12863 | var prev = new Date().getTime();
|
12864 |
|
12865 | function fallback(fn) {
|
12866 | var curr = new Date().getTime(),
|
12867 | ms = Math.max(0, 16 - (curr - prev)),
|
12868 | req = setTimeout(fn, ms);
|
12869 | prev = curr;
|
12870 | return req;
|
12871 | }
|
12872 |
|
12873 | compatRaf = function compatRaf(cb) {
|
12874 | return raf(cb);
|
12875 | };
|
12876 |
|
12877 | compatRaf.cancel = function (id) {
|
12878 | window[cancel] && typeof window[cancel] === 'function' && window[cancel](id);
|
12879 | };
|
12880 |
|
12881 | var _default = compatRaf;
|
12882 | exports.default = _default;
|
12883 | module.exports = exports["default"];
|
12884 |
|
12885 | }),
|
12886 |
|
12887 | (function(module, exports, __webpack_require__) {
|
12888 |
|
12889 | 'use strict';
|
12890 |
|
12891 | Object.defineProperty(exports, "__esModule", {
|
12892 | value: true
|
12893 | });
|
12894 | exports["default"] = calculatePosition;
|
12895 |
|
12896 | var _offset = __webpack_require__(119);
|
12897 |
|
12898 | var _offset2 = _interopRequireDefault(_offset);
|
12899 |
|
12900 | var _position = __webpack_require__(121);
|
12901 |
|
12902 | var _position2 = _interopRequireDefault(_position);
|
12903 |
|
12904 | var _scrollTop = __webpack_require__(124);
|
12905 |
|
12906 | var _scrollTop2 = _interopRequireDefault(_scrollTop);
|
12907 |
|
12908 | var _ownerDocument = __webpack_require__(74);
|
12909 |
|
12910 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
12911 |
|
12912 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12913 |
|
12914 | function getContainerDimensions(containerNode) {
|
12915 | var width = void 0,
|
12916 | height = void 0,
|
12917 | scroll = void 0;
|
12918 |
|
12919 | if (containerNode.tagName === 'BODY') {
|
12920 | width = document.body.scrollWidth;
|
12921 | height = document.body.scrollHeight;
|
12922 |
|
12923 | scroll = (0, _scrollTop2["default"])((0, _ownerDocument2["default"])(containerNode).documentElement) || (0, _scrollTop2["default"])(containerNode);
|
12924 | } else {
|
12925 | var _getOffset = (0, _offset2["default"])(containerNode);
|
12926 |
|
12927 | width = _getOffset.width;
|
12928 | height = _getOffset.height;
|
12929 |
|
12930 | scroll = (0, _scrollTop2["default"])(containerNode);
|
12931 | }
|
12932 |
|
12933 | return { width: width, height: height, scroll: scroll };
|
12934 | }
|
12935 |
|
12936 | function getTopDelta(top, overlayHeight, container, padding) {
|
12937 | var containerDimensions = getContainerDimensions(container);
|
12938 | var containerScroll = containerDimensions.scroll;
|
12939 | var containerHeight = containerDimensions.height;
|
12940 |
|
12941 | var topEdgeOffset = top - padding - containerScroll;
|
12942 | var bottomEdgeOffset = top + padding - containerScroll + overlayHeight;
|
12943 |
|
12944 | if (topEdgeOffset < 0) {
|
12945 | return -topEdgeOffset;
|
12946 | } else if (bottomEdgeOffset > containerHeight) {
|
12947 | return containerHeight - bottomEdgeOffset;
|
12948 | } else {
|
12949 | return 0;
|
12950 | }
|
12951 | }
|
12952 |
|
12953 | function getLeftDelta(left, overlayWidth, container, padding) {
|
12954 | var containerDimensions = getContainerDimensions(container);
|
12955 | var containerWidth = containerDimensions.width;
|
12956 |
|
12957 | var leftEdgeOffset = left - padding;
|
12958 | var rightEdgeOffset = left + padding + overlayWidth;
|
12959 |
|
12960 | if (leftEdgeOffset < 0) {
|
12961 | return -leftEdgeOffset;
|
12962 | } else if (rightEdgeOffset > containerWidth) {
|
12963 | return containerWidth - rightEdgeOffset;
|
12964 | }
|
12965 |
|
12966 | return 0;
|
12967 | }
|
12968 |
|
12969 | function calculatePosition(placement, overlayNode, target, container, padding) {
|
12970 | var childOffset = container.tagName === 'BODY' ? (0, _offset2["default"])(target) : (0, _position2["default"])(target, container);
|
12971 |
|
12972 | var _getOffset2 = (0, _offset2["default"])(overlayNode),
|
12973 | overlayHeight = _getOffset2.height,
|
12974 | overlayWidth = _getOffset2.width;
|
12975 |
|
12976 | var positionLeft = void 0,
|
12977 | positionTop = void 0,
|
12978 | arrowOffsetLeft = void 0,
|
12979 | arrowOffsetTop = void 0,
|
12980 | inverseArrow = void 0;
|
12981 |
|
12982 | if (/^left|^right/.test(placement)) {
|
12983 | positionTop = childOffset.top + (childOffset.height - overlayHeight) / 2;
|
12984 |
|
12985 | if (/left/.test(placement)) {
|
12986 | positionLeft = childOffset.left - overlayWidth;
|
12987 | } else {
|
12988 | positionLeft = childOffset.left + childOffset.width;
|
12989 | }
|
12990 |
|
12991 | if (/Top/.test(placement)) {
|
12992 | positionTop = childOffset.top;
|
12993 | } else if (/Bottom/.test(placement)) {
|
12994 | positionTop = childOffset.top + childOffset.height - overlayHeight;
|
12995 | }
|
12996 |
|
12997 | var topDelta = getTopDelta(positionTop, overlayHeight, container, padding);
|
12998 | var leftDelta = getLeftDelta(positionLeft, overlayWidth, container, padding);
|
12999 |
|
13000 | if (leftDelta > 0) {
|
13001 | inverseArrow = true;
|
13002 | positionLeft = childOffset.left + childOffset.width + 6;
|
13003 | } else if (leftDelta < 0) {
|
13004 | inverseArrow = true;
|
13005 | positionLeft = childOffset.left - overlayWidth - 6;
|
13006 | } else {
|
13007 | positionLeft += leftDelta;
|
13008 | }
|
13009 | positionTop += topDelta;
|
13010 | arrowOffsetTop = 50 * (1 - 2 * topDelta / overlayHeight) + '%';
|
13011 | arrowOffsetLeft = void 0;
|
13012 | } else if (/^top|^bottom/.test(placement)) {
|
13013 | positionLeft = childOffset.left + (childOffset.width - overlayWidth) / 2;
|
13014 |
|
13015 | if (/top/.test(placement)) {
|
13016 | positionTop = childOffset.top - overlayHeight;
|
13017 | } else {
|
13018 | positionTop = childOffset.top + childOffset.height;
|
13019 | }
|
13020 |
|
13021 | if (/Left/.test(placement)) {
|
13022 | positionLeft = childOffset.left;
|
13023 | } else if (/Right/.test(placement)) {
|
13024 | positionLeft = childOffset.left + (childOffset.width - overlayWidth);
|
13025 | }
|
13026 |
|
13027 | var _leftDelta = getLeftDelta(positionLeft, overlayWidth, container, padding);
|
13028 | var _topDelta = getTopDelta(positionTop, overlayHeight, container, padding);
|
13029 | positionLeft += _leftDelta;
|
13030 | arrowOffsetLeft = 50 * (1 - 2 * _leftDelta / overlayWidth) + '%';
|
13031 | arrowOffsetTop = void 0;
|
13032 | if (_topDelta > 0) {
|
13033 | inverseArrow = true;
|
13034 | positionTop = childOffset.top + childOffset.height + 6;
|
13035 | } else if (_topDelta < 0) {
|
13036 | inverseArrow = true;
|
13037 | positionTop = childOffset.top - overlayHeight - 6;
|
13038 | } else {
|
13039 | positionTop += _topDelta;
|
13040 | }
|
13041 |
|
13042 |
|
13043 |
|
13044 |
|
13045 |
|
13046 |
|
13047 |
|
13048 |
|
13049 |
|
13050 |
|
13051 |
|
13052 |
|
13053 | } else {
|
13054 | throw new Error('calcOverlayPosition(): No such placement of "' + placement + '" found.');
|
13055 | }
|
13056 |
|
13057 | return { positionLeft: positionLeft, positionTop: positionTop, arrowOffsetLeft: arrowOffsetLeft, arrowOffsetTop: arrowOffsetTop, inverseArrow: inverseArrow, width: overlayWidth };
|
13058 | }
|
13059 | module.exports = exports['default'];
|
13060 |
|
13061 | }),
|
13062 |
|
13063 | (function(module, exports, __webpack_require__) {
|
13064 |
|
13065 | "use strict";
|
13066 |
|
13067 | var _interopRequireDefault = __webpack_require__(14);
|
13068 |
|
13069 | exports.__esModule = true;
|
13070 | exports.default = offset;
|
13071 |
|
13072 | var _contains = _interopRequireDefault(__webpack_require__(111));
|
13073 |
|
13074 | var _isWindow = _interopRequireDefault(__webpack_require__(120));
|
13075 |
|
13076 | var _ownerDocument = _interopRequireDefault(__webpack_require__(75));
|
13077 |
|
13078 | function offset(node) {
|
13079 | var doc = (0, _ownerDocument.default)(node),
|
13080 | win = (0, _isWindow.default)(doc),
|
13081 | docElem = doc && doc.documentElement,
|
13082 | box = {
|
13083 | top: 0,
|
13084 | left: 0,
|
13085 | height: 0,
|
13086 | width: 0
|
13087 | };
|
13088 | if (!doc) return;
|
13089 |
|
13090 | if (!(0, _contains.default)(docElem, node)) return box;
|
13091 | if (node.getBoundingClientRect !== undefined) box = node.getBoundingClientRect();
|
13092 |
|
13093 | box = {
|
13094 | top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
|
13095 | left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0),
|
13096 | width: (box.width == null ? node.offsetWidth : box.width) || 0,
|
13097 | height: (box.height == null ? node.offsetHeight : box.height) || 0
|
13098 | };
|
13099 | return box;
|
13100 | }
|
13101 |
|
13102 | module.exports = exports["default"];
|
13103 |
|
13104 | }),
|
13105 |
|
13106 | (function(module, exports) {
|
13107 |
|
13108 | "use strict";
|
13109 |
|
13110 | exports.__esModule = true;
|
13111 | exports.default = getWindow;
|
13112 |
|
13113 | function getWindow(node) {
|
13114 | return node === node.window ? node : node.nodeType === 9 ? node.defaultView || node.parentWindow : false;
|
13115 | }
|
13116 |
|
13117 | module.exports = exports["default"];
|
13118 |
|
13119 | }),
|
13120 |
|
13121 | (function(module, exports, __webpack_require__) {
|
13122 |
|
13123 | "use strict";
|
13124 |
|
13125 | var _interopRequireDefault = __webpack_require__(14);
|
13126 |
|
13127 | exports.__esModule = true;
|
13128 | exports.default = position;
|
13129 |
|
13130 | var _extends2 = _interopRequireDefault(__webpack_require__(122));
|
13131 |
|
13132 | var _offset = _interopRequireDefault(__webpack_require__(119));
|
13133 |
|
13134 | var _offsetParent = _interopRequireDefault(__webpack_require__(123));
|
13135 |
|
13136 | var _scrollTop = _interopRequireDefault(__webpack_require__(124));
|
13137 |
|
13138 | var _scrollLeft = _interopRequireDefault(__webpack_require__(125));
|
13139 |
|
13140 | var _style = _interopRequireDefault(__webpack_require__(18));
|
13141 |
|
13142 | function nodeName(node) {
|
13143 | return node.nodeName && node.nodeName.toLowerCase();
|
13144 | }
|
13145 |
|
13146 | function position(node, offsetParent) {
|
13147 | var parentOffset = {
|
13148 | top: 0,
|
13149 | left: 0
|
13150 | },
|
13151 | offset;
|
13152 |
|
13153 |
|
13154 | if ((0, _style.default)(node, 'position') === 'fixed') {
|
13155 | offset = node.getBoundingClientRect();
|
13156 | } else {
|
13157 | offsetParent = offsetParent || (0, _offsetParent.default)(node);
|
13158 | offset = (0, _offset.default)(node);
|
13159 | if (nodeName(offsetParent) !== 'html') parentOffset = (0, _offset.default)(offsetParent);
|
13160 | parentOffset.top += parseInt((0, _style.default)(offsetParent, 'borderTopWidth'), 10) - (0, _scrollTop.default)(offsetParent) || 0;
|
13161 | parentOffset.left += parseInt((0, _style.default)(offsetParent, 'borderLeftWidth'), 10) - (0, _scrollLeft.default)(offsetParent) || 0;
|
13162 | }
|
13163 |
|
13164 |
|
13165 | return (0, _extends2.default)({}, offset, {
|
13166 | top: offset.top - parentOffset.top - (parseInt((0, _style.default)(node, 'marginTop'), 10) || 0),
|
13167 | left: offset.left - parentOffset.left - (parseInt((0, _style.default)(node, 'marginLeft'), 10) || 0)
|
13168 | });
|
13169 | }
|
13170 |
|
13171 | module.exports = exports["default"];
|
13172 |
|
13173 | }),
|
13174 |
|
13175 | (function(module, exports) {
|
13176 |
|
13177 | function _extends() {
|
13178 | module.exports = _extends = Object.assign || function (target) {
|
13179 | for (var i = 1; i < arguments.length; i++) {
|
13180 | var source = arguments[i];
|
13181 |
|
13182 | for (var key in source) {
|
13183 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
13184 | target[key] = source[key];
|
13185 | }
|
13186 | }
|
13187 | }
|
13188 |
|
13189 | return target;
|
13190 | };
|
13191 |
|
13192 | return _extends.apply(this, arguments);
|
13193 | }
|
13194 |
|
13195 | module.exports = _extends;
|
13196 |
|
13197 | }),
|
13198 |
|
13199 | (function(module, exports, __webpack_require__) {
|
13200 |
|
13201 | "use strict";
|
13202 |
|
13203 | var _interopRequireDefault = __webpack_require__(14);
|
13204 |
|
13205 | exports.__esModule = true;
|
13206 | exports.default = offsetParent;
|
13207 |
|
13208 | var _ownerDocument = _interopRequireDefault(__webpack_require__(75));
|
13209 |
|
13210 | var _style = _interopRequireDefault(__webpack_require__(18));
|
13211 |
|
13212 | function nodeName(node) {
|
13213 | return node.nodeName && node.nodeName.toLowerCase();
|
13214 | }
|
13215 |
|
13216 | function offsetParent(node) {
|
13217 | var doc = (0, _ownerDocument.default)(node),
|
13218 | offsetParent = node && node.offsetParent;
|
13219 |
|
13220 | while (offsetParent && nodeName(node) !== 'html' && (0, _style.default)(offsetParent, 'position') === 'static') {
|
13221 | offsetParent = offsetParent.offsetParent;
|
13222 | }
|
13223 |
|
13224 | return offsetParent || doc.documentElement;
|
13225 | }
|
13226 |
|
13227 | module.exports = exports["default"];
|
13228 |
|
13229 | }),
|
13230 |
|
13231 | (function(module, exports, __webpack_require__) {
|
13232 |
|
13233 | "use strict";
|
13234 |
|
13235 | var _interopRequireDefault = __webpack_require__(14);
|
13236 |
|
13237 | exports.__esModule = true;
|
13238 | exports.default = scrollTop;
|
13239 |
|
13240 | var _isWindow = _interopRequireDefault(__webpack_require__(120));
|
13241 |
|
13242 | function scrollTop(node, val) {
|
13243 | var win = (0, _isWindow.default)(node);
|
13244 | if (val === undefined) return win ? 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop : node.scrollTop;
|
13245 | if (win) win.scrollTo('pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft, val);else node.scrollTop = val;
|
13246 | }
|
13247 |
|
13248 | module.exports = exports["default"];
|
13249 |
|
13250 | }),
|
13251 |
|
13252 | (function(module, exports, __webpack_require__) {
|
13253 |
|
13254 | "use strict";
|
13255 |
|
13256 | var _interopRequireDefault = __webpack_require__(14);
|
13257 |
|
13258 | exports.__esModule = true;
|
13259 | exports.default = scrollTop;
|
13260 |
|
13261 | var _isWindow = _interopRequireDefault(__webpack_require__(120));
|
13262 |
|
13263 | function scrollTop(node, val) {
|
13264 | var win = (0, _isWindow.default)(node);
|
13265 | if (val === undefined) return win ? 'pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft : node.scrollLeft;
|
13266 | if (win) win.scrollTo(val, 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop);else node.scrollLeft = val;
|
13267 | }
|
13268 |
|
13269 | module.exports = exports["default"];
|
13270 |
|
13271 | }),
|
13272 |
|
13273 | (function(module, exports, __webpack_require__) {
|
13274 |
|
13275 | 'use strict';
|
13276 |
|
13277 | Object.defineProperty(exports, "__esModule", {
|
13278 | value: true
|
13279 | });
|
13280 |
|
13281 | exports["default"] = function (componentOrElement) {
|
13282 | return (0, _ownerWindow2["default"])(_reactDom2["default"].findDOMNode(componentOrElement));
|
13283 | };
|
13284 |
|
13285 | var _reactDom = __webpack_require__(2);
|
13286 |
|
13287 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
13288 |
|
13289 | var _ownerWindow = __webpack_require__(127);
|
13290 |
|
13291 | var _ownerWindow2 = _interopRequireDefault(_ownerWindow);
|
13292 |
|
13293 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13294 |
|
13295 | module.exports = exports['default'];
|
13296 |
|
13297 | }),
|
13298 |
|
13299 | (function(module, exports, __webpack_require__) {
|
13300 |
|
13301 | "use strict";
|
13302 |
|
13303 | var _interopRequireDefault = __webpack_require__(14);
|
13304 |
|
13305 | exports.__esModule = true;
|
13306 | exports.default = ownerWindow;
|
13307 |
|
13308 | var _ownerDocument = _interopRequireDefault(__webpack_require__(75));
|
13309 |
|
13310 | function ownerWindow(node) {
|
13311 | var doc = (0, _ownerDocument.default)(node);
|
13312 | return doc && doc.defaultView || doc.parentWindow;
|
13313 | }
|
13314 |
|
13315 | module.exports = exports["default"];
|
13316 |
|
13317 | }),
|
13318 |
|
13319 | (function(module, exports, __webpack_require__) {
|
13320 |
|
13321 | 'use strict';
|
13322 |
|
13323 | Object.defineProperty(exports, "__esModule", {
|
13324 | value: true
|
13325 | });
|
13326 |
|
13327 | var _contains = __webpack_require__(111);
|
13328 |
|
13329 | var _contains2 = _interopRequireDefault(_contains);
|
13330 |
|
13331 | var _react = __webpack_require__(1);
|
13332 |
|
13333 | var _react2 = _interopRequireDefault(_react);
|
13334 |
|
13335 | var _propTypes = __webpack_require__(6);
|
13336 |
|
13337 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
13338 |
|
13339 | var _reactDom = __webpack_require__(2);
|
13340 |
|
13341 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
13342 |
|
13343 | var _addEventListener = __webpack_require__(76);
|
13344 |
|
13345 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
13346 |
|
13347 | var _ownerDocument = __webpack_require__(74);
|
13348 |
|
13349 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
13350 |
|
13351 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13352 |
|
13353 | 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; }
|
13354 |
|
13355 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13356 |
|
13357 | 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; }
|
13358 |
|
13359 | 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); }
|
13360 |
|
13361 | var propTypes = {
|
13362 | onRootClose: _propTypes2["default"].func,
|
13363 | children: _propTypes2["default"].element,
|
13364 | |
13365 |
|
13366 |
|
13367 | disabled: _propTypes2["default"].bool,
|
13368 | |
13369 |
|
13370 |
|
13371 | event: _propTypes2["default"].oneOf(['click', 'mousedown'])
|
13372 | };
|
13373 |
|
13374 | var defaultProps = {
|
13375 | event: 'click'
|
13376 | };
|
13377 |
|
13378 | function isLeftClickEvent(event) {
|
13379 | return event.button === 0;
|
13380 | }
|
13381 |
|
13382 | function isModifiedEvent(event) {
|
13383 | return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
13384 | }
|
13385 |
|
13386 | var RootCloseWrapper = function (_Component) {
|
13387 | _inherits(RootCloseWrapper, _Component);
|
13388 |
|
13389 | function RootCloseWrapper(props, context) {
|
13390 | _classCallCheck(this, RootCloseWrapper);
|
13391 |
|
13392 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
13393 |
|
13394 | _this.handleMouseCapture = function (e) {
|
13395 | _this.preventMouseRootClose = isModifiedEvent(e) || !isLeftClickEvent(e) || (0, _contains2["default"])(_reactDom2["default"].findDOMNode(_this), e.target);
|
13396 | };
|
13397 |
|
13398 | _this.handleMouse = function () {
|
13399 | if (!_this.preventMouseRootClose && _this.props.onRootClose) {
|
13400 | _this.props.onRootClose();
|
13401 | }
|
13402 | };
|
13403 |
|
13404 | _this.handleKeyUp = function (e) {
|
13405 | if (e.keyCode === 27 && _this.props.onRootClose) {
|
13406 | _this.props.onRootClose();
|
13407 | }
|
13408 | };
|
13409 |
|
13410 | _this.preventMouseRootClose = false;
|
13411 |
|
13412 | _this.addEventListeners = _this.addEventListeners.bind(_this);
|
13413 | _this.removeEventListeners = _this.removeEventListeners.bind(_this);
|
13414 |
|
13415 | return _this;
|
13416 | }
|
13417 |
|
13418 | RootCloseWrapper.prototype.componentDidMount = function componentDidMount() {
|
13419 | if (!this.props.disabled) {
|
13420 | this.addEventListeners();
|
13421 | }
|
13422 | };
|
13423 |
|
13424 | RootCloseWrapper.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
13425 | if (!this.props.disabled && prevProps.disabled) {
|
13426 | this.addEventListeners();
|
13427 | } else if (this.props.disabled && !prevProps.disabled) {
|
13428 | this.removeEventListeners();
|
13429 | }
|
13430 | };
|
13431 |
|
13432 | RootCloseWrapper.prototype.componentWillUnmount = function componentWillUnmount() {
|
13433 | if (!this.props.disabled) {
|
13434 | this.removeEventListeners();
|
13435 | }
|
13436 | };
|
13437 |
|
13438 | RootCloseWrapper.prototype.addEventListeners = function addEventListeners() {
|
13439 | var event = this.props.event;
|
13440 |
|
13441 | var doc = (0, _ownerDocument2["default"])(this);
|
13442 |
|
13443 |
|
13444 | this.documentMouseCaptureListener = (0, _addEventListener2["default"])(doc, event, this.handleMouseCapture, true);
|
13445 |
|
13446 | this.documentMouseListener = (0, _addEventListener2["default"])(doc, event, this.handleMouse);
|
13447 |
|
13448 | this.documentKeyupListener = (0, _addEventListener2["default"])(doc, 'keyup', this.handleKeyUp);
|
13449 | };
|
13450 |
|
13451 | RootCloseWrapper.prototype.removeEventListeners = function removeEventListeners() {
|
13452 | if (this.documentMouseCaptureListener) {
|
13453 | this.documentMouseCaptureListener.remove();
|
13454 | }
|
13455 |
|
13456 | if (this.documentMouseListener) {
|
13457 | this.documentMouseListener.remove();
|
13458 | }
|
13459 |
|
13460 | if (this.documentKeyupListener) {
|
13461 | this.documentKeyupListener.remove();
|
13462 | }
|
13463 | };
|
13464 |
|
13465 | RootCloseWrapper.prototype.render = function render() {
|
13466 | return this.props.children;
|
13467 | };
|
13468 |
|
13469 | return RootCloseWrapper;
|
13470 | }(_react.Component);
|
13471 |
|
13472 | RootCloseWrapper.propTypes = propTypes;
|
13473 |
|
13474 | RootCloseWrapper.defaultProps = defaultProps;
|
13475 |
|
13476 | exports["default"] = RootCloseWrapper;
|
13477 | module.exports = exports['default'];
|
13478 |
|
13479 | }),
|
13480 |
|
13481 | (function(module, exports, __webpack_require__) {
|
13482 |
|
13483 | 'use strict';
|
13484 |
|
13485 | Object.defineProperty(exports, "__esModule", {
|
13486 | value: true
|
13487 | });
|
13488 |
|
13489 | 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; };
|
13490 |
|
13491 | var _classnames = __webpack_require__(5);
|
13492 |
|
13493 | var _classnames2 = _interopRequireDefault(_classnames);
|
13494 |
|
13495 | var _propTypes = __webpack_require__(6);
|
13496 |
|
13497 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
13498 |
|
13499 | var _react = __webpack_require__(1);
|
13500 |
|
13501 | var _react2 = _interopRequireDefault(_react);
|
13502 |
|
13503 | var _Transition = __webpack_require__(130);
|
13504 |
|
13505 | var _Transition2 = _interopRequireDefault(_Transition);
|
13506 |
|
13507 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13508 |
|
13509 | 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; }
|
13510 |
|
13511 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13512 |
|
13513 | 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; }
|
13514 |
|
13515 | 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); }
|
13516 |
|
13517 | var propTypes = {
|
13518 | |
13519 |
|
13520 |
|
13521 | "in": _propTypes2["default"].bool,
|
13522 |
|
13523 | |
13524 |
|
13525 |
|
13526 | unmountOnExit: _propTypes2["default"].bool,
|
13527 |
|
13528 | |
13529 |
|
13530 |
|
13531 |
|
13532 | transitionAppear: _propTypes2["default"].bool,
|
13533 |
|
13534 | |
13535 |
|
13536 |
|
13537 |
|
13538 |
|
13539 | timeout: _propTypes2["default"].number,
|
13540 |
|
13541 | |
13542 |
|
13543 |
|
13544 | onEnter: _propTypes2["default"].func,
|
13545 | |
13546 |
|
13547 |
|
13548 | onEntering: _propTypes2["default"].func,
|
13549 | |
13550 |
|
13551 |
|
13552 | onEntered: _propTypes2["default"].func,
|
13553 | |
13554 |
|
13555 |
|
13556 | onExit: _propTypes2["default"].func,
|
13557 | |
13558 |
|
13559 |
|
13560 | onExiting: _propTypes2["default"].func,
|
13561 | |
13562 |
|
13563 |
|
13564 | onExited: _propTypes2["default"].func
|
13565 | };
|
13566 |
|
13567 | var defaultProps = {
|
13568 | "in": false,
|
13569 | timeout: 300,
|
13570 | unmountOnExit: false,
|
13571 | transitionAppear: false
|
13572 | };
|
13573 |
|
13574 | var Fade = function (_React$Component) {
|
13575 | _inherits(Fade, _React$Component);
|
13576 |
|
13577 | function Fade() {
|
13578 | _classCallCheck(this, Fade);
|
13579 |
|
13580 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
13581 | }
|
13582 |
|
13583 | Fade.prototype.render = function render() {
|
13584 | return _react2["default"].createElement(_Transition2["default"], _extends({}, this.props, {
|
13585 | className: (0, _classnames2["default"])(this.props.className, 'fade'),
|
13586 | enteredClassName: 'in',
|
13587 | enteringClassName: 'in'
|
13588 | }));
|
13589 | };
|
13590 |
|
13591 | return Fade;
|
13592 | }(_react2["default"].Component);
|
13593 |
|
13594 | Fade.propTypes = propTypes;
|
13595 | Fade.defaultProps = defaultProps;
|
13596 |
|
13597 | exports["default"] = Fade;
|
13598 | module.exports = exports['default'];
|
13599 |
|
13600 | }),
|
13601 |
|
13602 | (function(module, exports, __webpack_require__) {
|
13603 |
|
13604 | 'use strict';
|
13605 |
|
13606 | Object.defineProperty(exports, "__esModule", {
|
13607 | value: true
|
13608 | });
|
13609 | exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined;
|
13610 |
|
13611 | 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; };
|
13612 |
|
13613 | var _react = __webpack_require__(1);
|
13614 |
|
13615 | var _react2 = _interopRequireDefault(_react);
|
13616 |
|
13617 | var _propTypes = __webpack_require__(6);
|
13618 |
|
13619 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
13620 |
|
13621 | var _reactDom = __webpack_require__(2);
|
13622 |
|
13623 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
13624 |
|
13625 | var _properties = __webpack_require__(13);
|
13626 |
|
13627 | var _properties2 = _interopRequireDefault(_properties);
|
13628 |
|
13629 | var _on = __webpack_require__(16);
|
13630 |
|
13631 | var _on2 = _interopRequireDefault(_on);
|
13632 |
|
13633 | var _classnames = __webpack_require__(5);
|
13634 |
|
13635 | var _classnames2 = _interopRequireDefault(_classnames);
|
13636 |
|
13637 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13638 |
|
13639 | 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; }
|
13640 |
|
13641 | 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; }
|
13642 |
|
13643 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13644 |
|
13645 | 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; }
|
13646 |
|
13647 | 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); }
|
13648 |
|
13649 | var transitionEndEvent = _properties2["default"].end;
|
13650 |
|
13651 |
|
13652 | var UNMOUNTED = exports.UNMOUNTED = 0;
|
13653 | var EXITED = exports.EXITED = 1;
|
13654 | var ENTERING = exports.ENTERING = 2;
|
13655 | var ENTERED = exports.ENTERED = 3;
|
13656 | var EXITING = exports.EXITING = 4;
|
13657 |
|
13658 | var propTypes = {
|
13659 | |
13660 |
|
13661 |
|
13662 | "in": _propTypes2["default"].bool,
|
13663 |
|
13664 | |
13665 |
|
13666 |
|
13667 | unmountOnExit: _propTypes2["default"].bool,
|
13668 |
|
13669 | |
13670 |
|
13671 |
|
13672 | transitionAppear: _propTypes2["default"].bool,
|
13673 |
|
13674 | |
13675 |
|
13676 |
|
13677 | timeout: _propTypes2["default"].number,
|
13678 |
|
13679 | |
13680 |
|
13681 |
|
13682 | exitedClassName: _propTypes2["default"].string,
|
13683 | |
13684 |
|
13685 |
|
13686 | exitingClassName: _propTypes2["default"].string,
|
13687 | |
13688 |
|
13689 |
|
13690 | enteredClassName: _propTypes2["default"].string,
|
13691 | |
13692 |
|
13693 |
|
13694 | enteringClassName: _propTypes2["default"].string,
|
13695 |
|
13696 | |
13697 |
|
13698 |
|
13699 | onEnter: _propTypes2["default"].func,
|
13700 | |
13701 |
|
13702 |
|
13703 | onEntering: _propTypes2["default"].func,
|
13704 | |
13705 |
|
13706 |
|
13707 | onEntered: _propTypes2["default"].func,
|
13708 | |
13709 |
|
13710 |
|
13711 | onExit: _propTypes2["default"].func,
|
13712 | |
13713 |
|
13714 |
|
13715 | onExiting: _propTypes2["default"].func,
|
13716 | |
13717 |
|
13718 |
|
13719 | onExited: _propTypes2["default"].func
|
13720 | };
|
13721 |
|
13722 | function noop() {}
|
13723 |
|
13724 | var defaultProps = {
|
13725 | "in": false,
|
13726 | unmountOnExit: false,
|
13727 | transitionAppear: false,
|
13728 | timeout: 5000,
|
13729 | onEnter: noop,
|
13730 | onEntering: noop,
|
13731 | onEntered: noop,
|
13732 | onExit: noop,
|
13733 | onExiting: noop,
|
13734 | onExited: noop
|
13735 | };
|
13736 |
|
13737 | |
13738 |
|
13739 |
|
13740 |
|
13741 | var Transition = function (_Component) {
|
13742 | _inherits(Transition, _Component);
|
13743 |
|
13744 | function Transition(props, context) {
|
13745 | _classCallCheck(this, Transition);
|
13746 |
|
13747 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
13748 |
|
13749 | var initialStatus = void 0;
|
13750 | if (props["in"]) {
|
13751 |
|
13752 | initialStatus = props.transitionAppear ? EXITED : ENTERED;
|
13753 | } else {
|
13754 | initialStatus = props.unmountOnExit ? UNMOUNTED : EXITED;
|
13755 | }
|
13756 | _this.state = { status: initialStatus };
|
13757 |
|
13758 | _this.nextCallback = null;
|
13759 |
|
13760 | _this.performEnter = _this.performEnter.bind(_this);
|
13761 | _this.performExit = _this.performExit.bind(_this);
|
13762 | _this.cancelNextCallback = _this.cancelNextCallback.bind(_this);
|
13763 | _this.onTransitionEnd = _this.onTransitionEnd.bind(_this);
|
13764 | _this.safeSetState = _this.safeSetState.bind(_this);
|
13765 | _this.setNextCallback = _this.setNextCallback.bind(_this);
|
13766 |
|
13767 | return _this;
|
13768 | }
|
13769 |
|
13770 | Transition.prototype.componentDidMount = function componentDidMount() {
|
13771 | if (this.props.transitionAppear && this.props["in"]) {
|
13772 | this.performEnter(this.props);
|
13773 | }
|
13774 | };
|
13775 |
|
13776 | Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
13777 | if (nextProps["in"] && this.props.unmountOnExit) {
|
13778 | if (this.state.status === UNMOUNTED) {
|
13779 |
|
13780 | this.setState({ status: EXITED });
|
13781 | }
|
13782 | } else {
|
13783 | this._needsUpdate = true;
|
13784 | }
|
13785 | };
|
13786 |
|
13787 | Transition.prototype.componentDidUpdate = function componentDidUpdate() {
|
13788 | var status = this.state.status;
|
13789 |
|
13790 | if (this.props.unmountOnExit && status === EXITED) {
|
13791 |
|
13792 | if (this.props["in"]) {
|
13793 | this.performEnter(this.props);
|
13794 | } else {
|
13795 | this.setState({ status: UNMOUNTED });
|
13796 | }
|
13797 |
|
13798 | return;
|
13799 | }
|
13800 |
|
13801 |
|
13802 | if (this._needsUpdate) {
|
13803 | this._needsUpdate = false;
|
13804 |
|
13805 | if (this.props["in"]) {
|
13806 | if (status === EXITING) {
|
13807 | this.performEnter(this.props);
|
13808 | } else if (status === EXITED) {
|
13809 | this.performEnter(this.props);
|
13810 | }
|
13811 |
|
13812 | } else {
|
13813 | if (status === ENTERING || status === ENTERED) {
|
13814 | this.performExit(this.props);
|
13815 | }
|
13816 |
|
13817 | }
|
13818 | }
|
13819 | };
|
13820 |
|
13821 | Transition.prototype.componentWillUnmount = function componentWillUnmount() {
|
13822 | this.cancelNextCallback();
|
13823 | };
|
13824 |
|
13825 | Transition.prototype.performEnter = function performEnter(props) {
|
13826 | var _this2 = this;
|
13827 |
|
13828 | this.cancelNextCallback();
|
13829 | var node = _reactDom2["default"].findDOMNode(this);
|
13830 |
|
13831 |
|
13832 | props.onEnter(node);
|
13833 |
|
13834 | this.safeSetState({ status: ENTERING }, function () {
|
13835 | _this2.props.onEntering(node);
|
13836 |
|
13837 | _this2.onTransitionEnd(node, function () {
|
13838 | _this2.safeSetState({ status: ENTERED }, function () {
|
13839 | _this2.props.onEntered(node);
|
13840 | });
|
13841 | });
|
13842 | });
|
13843 | };
|
13844 |
|
13845 | Transition.prototype.performExit = function performExit(props) {
|
13846 | var _this3 = this;
|
13847 |
|
13848 | this.cancelNextCallback();
|
13849 | var node = _reactDom2["default"].findDOMNode(this);
|
13850 |
|
13851 | props.onExit(node);
|
13852 |
|
13853 | this.safeSetState({ status: EXITING }, function () {
|
13854 | _this3.props.onExiting(node);
|
13855 |
|
13856 | _this3.onTransitionEnd(node, function () {
|
13857 | _this3.safeSetState({ status: EXITED }, function () {
|
13858 | _this3.props.onExited(node);
|
13859 | });
|
13860 | });
|
13861 | });
|
13862 | };
|
13863 |
|
13864 | Transition.prototype.cancelNextCallback = function cancelNextCallback() {
|
13865 | if (this.nextCallback !== null) {
|
13866 | this.nextCallback.cancel();
|
13867 | this.nextCallback = null;
|
13868 | }
|
13869 | };
|
13870 |
|
13871 | Transition.prototype.safeSetState = function safeSetState(nextState, callback) {
|
13872 |
|
13873 | this.setState(nextState, this.setNextCallback(callback));
|
13874 | };
|
13875 |
|
13876 | Transition.prototype.setNextCallback = function setNextCallback(callback) {
|
13877 | var _this4 = this;
|
13878 |
|
13879 | var active = true;
|
13880 |
|
13881 | this.nextCallback = function (event) {
|
13882 | if (active) {
|
13883 | active = false;
|
13884 | _this4.nextCallback = null;
|
13885 |
|
13886 | callback(event);
|
13887 | }
|
13888 | };
|
13889 |
|
13890 | this.nextCallback.cancel = function () {
|
13891 | active = false;
|
13892 | };
|
13893 |
|
13894 | return this.nextCallback;
|
13895 | };
|
13896 |
|
13897 | Transition.prototype.onTransitionEnd = function onTransitionEnd(node, handler) {
|
13898 | this.setNextCallback(handler);
|
13899 |
|
13900 | if (node) {
|
13901 | (0, _on2["default"])(node, transitionEndEvent, this.nextCallback);
|
13902 | setTimeout(this.nextCallback, this.props.timeout);
|
13903 | } else {
|
13904 | setTimeout(this.nextCallback, 0);
|
13905 | }
|
13906 | };
|
13907 |
|
13908 | Transition.prototype.render = function render() {
|
13909 | var status = this.state.status;
|
13910 | if (status === UNMOUNTED) {
|
13911 | return null;
|
13912 | }
|
13913 |
|
13914 | var _props = this.props,
|
13915 | children = _props.children,
|
13916 | className = _props.className,
|
13917 | childProps = _objectWithoutProperties(_props, ['children', 'className']);
|
13918 |
|
13919 | Object.keys(Transition.propTypes).forEach(function (key) {
|
13920 | return delete childProps[key];
|
13921 | });
|
13922 |
|
13923 | var transitionClassName = void 0;
|
13924 | if (status === EXITED) {
|
13925 | transitionClassName = this.props.exitedClassName;
|
13926 | } else if (status === ENTERING) {
|
13927 | transitionClassName = this.props.enteringClassName;
|
13928 | } else if (status === ENTERED) {
|
13929 | transitionClassName = this.props.enteredClassName;
|
13930 | } else if (status === EXITING) {
|
13931 | transitionClassName = this.props.exitingClassName;
|
13932 | }
|
13933 |
|
13934 | var child = _react2["default"].Children.only(children);
|
13935 | return _react2["default"].cloneElement(child, _extends({}, childProps, {
|
13936 | className: (0, _classnames2["default"])(child.props.className, className, transitionClassName)
|
13937 | }));
|
13938 | };
|
13939 |
|
13940 | return Transition;
|
13941 | }(_react.Component);
|
13942 |
|
13943 | Transition.propTypes = propTypes;
|
13944 |
|
13945 | Transition.defaultProps = defaultProps;
|
13946 |
|
13947 | exports["default"] = Transition;
|
13948 |
|
13949 | }),
|
13950 |
|
13951 | (function(module, exports) {
|
13952 |
|
13953 | 'use strict';
|
13954 |
|
13955 | Object.defineProperty(exports, "__esModule", {
|
13956 | value: true
|
13957 | });
|
13958 | |
13959 |
|
13960 |
|
13961 |
|
13962 |
|
13963 |
|
13964 |
|
13965 |
|
13966 |
|
13967 | function createChainedFunction() {
|
13968 | for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
|
13969 | funcs[_key] = arguments[_key];
|
13970 | }
|
13971 |
|
13972 | return funcs.filter(function (f) {
|
13973 | return f != null;
|
13974 | }).reduce(function (acc, f) {
|
13975 | if (typeof f !== 'function') {
|
13976 | throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
|
13977 | }
|
13978 |
|
13979 | if (acc === null) {
|
13980 | return f;
|
13981 | }
|
13982 |
|
13983 | return function chainedFunction() {
|
13984 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
13985 | args[_key2] = arguments[_key2];
|
13986 | }
|
13987 |
|
13988 | acc.apply(this, args);
|
13989 | f.apply(this, args);
|
13990 | };
|
13991 | }, null);
|
13992 | }
|
13993 |
|
13994 | exports["default"] = createChainedFunction;
|
13995 | module.exports = exports['default'];
|
13996 |
|
13997 | }),
|
13998 |
|
13999 | (function(module, exports) {
|
14000 |
|
14001 | 'use strict';
|
14002 |
|
14003 | Object.defineProperty(exports, "__esModule", {
|
14004 | value: true
|
14005 | });
|
14006 |
|
14007 | 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; };
|
14008 |
|
14009 | exports.getComponentLocale = getComponentLocale;
|
14010 | exports.getLocaleCode = getLocaleCode;
|
14011 | function getComponentLocale(props, context, componentName, getDefaultLocale) {
|
14012 | var locale = {};
|
14013 | if (context && context.beeLocale && context.beeLocale[componentName]) {
|
14014 | locale = context.beeLocale[componentName];
|
14015 | } else {
|
14016 | var defaultLocale = getDefaultLocale();
|
14017 |
|
14018 | locale = defaultLocale["default"] || defaultLocale;
|
14019 | }
|
14020 |
|
14021 | var result = _extends({}, locale, props.locale);
|
14022 | if (props.locale) {
|
14023 | result.lang = _extends({}, locale.lang, props.locale.lang);
|
14024 | } else {
|
14025 | result.lang = _extends({}, locale.lang);
|
14026 | }
|
14027 |
|
14028 | return result;
|
14029 | }
|
14030 |
|
14031 | function getLocaleCode(context) {
|
14032 | var localeCode = context.beeLocale && context.beeLocale.lang;
|
14033 |
|
14034 | if (context.beeLocale && context.beeLocale.exist && !localeCode) {
|
14035 | return 'zh-cn';
|
14036 | }
|
14037 | return localeCode;
|
14038 | }
|
14039 |
|
14040 | }),
|
14041 |
|
14042 | (function(module, exports) {
|
14043 |
|
14044 | 'use strict';
|
14045 |
|
14046 | module.exports = {
|
14047 | 'lang': 'zh-cn',
|
14048 | 'copy': '复制',
|
14049 | 'cut': '剪切',
|
14050 | 'copyReady': '已复制',
|
14051 | 'cutReady': '已剪切',
|
14052 | 'copyToClipboard': '复制到剪切板',
|
14053 | 'close': '关闭',
|
14054 |
|
14055 | 'en-us': {
|
14056 | 'copy': 'copy',
|
14057 | 'cut': 'cut',
|
14058 | 'copyReady': 'copied',
|
14059 | 'cutReady': 'cut',
|
14060 | 'copyToClipboard': 'copy to clipboard',
|
14061 | 'close': 'close'
|
14062 | },
|
14063 | 'zh-tw': {
|
14064 | 'copy': '複製',
|
14065 | 'cut': '剪切',
|
14066 | 'copyReady': '已複製',
|
14067 | 'cutReady': '已剪切',
|
14068 | 'copyToClipboard': '複製到剪切板',
|
14069 | 'close': '關閉'
|
14070 | }
|
14071 | };
|
14072 |
|
14073 | }),
|
14074 |
|
14075 | (function(module, exports, __webpack_require__) {
|
14076 |
|
14077 | 'use strict';
|
14078 |
|
14079 | Object.defineProperty(exports, "__esModule", {
|
14080 | value: true
|
14081 | });
|
14082 |
|
14083 | var _Modal = __webpack_require__(135);
|
14084 |
|
14085 | var _Modal2 = _interopRequireDefault(_Modal);
|
14086 |
|
14087 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
14088 |
|
14089 | exports["default"] = _Modal2["default"];
|
14090 | module.exports = exports['default'];
|
14091 |
|
14092 | }),
|
14093 |
|
14094 | (function(module, exports, __webpack_require__) {
|
14095 |
|
14096 | 'use strict';
|
14097 |
|
14098 | Object.defineProperty(exports, "__esModule", {
|
14099 | value: true
|
14100 | });
|
14101 |
|
14102 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
14103 |
|
14104 | 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; };
|
14105 |
|
14106 | var _classnames = __webpack_require__(5);
|
14107 |
|
14108 | var _classnames2 = _interopRequireDefault(_classnames);
|
14109 |
|
14110 | var _events = __webpack_require__(136);
|
14111 |
|
14112 | var _events2 = _interopRequireDefault(_events);
|
14113 |
|
14114 | var _ownerDocument = __webpack_require__(75);
|
14115 |
|
14116 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
14117 |
|
14118 | var _inDOM = __webpack_require__(15);
|
14119 |
|
14120 | var _inDOM2 = _interopRequireDefault(_inDOM);
|
14121 |
|
14122 | var _scrollbarSize = __webpack_require__(140);
|
14123 |
|
14124 | var _scrollbarSize2 = _interopRequireDefault(_scrollbarSize);
|
14125 |
|
14126 | var _react = __webpack_require__(1);
|
14127 |
|
14128 | var _react2 = _interopRequireDefault(_react);
|
14129 |
|
14130 | var _reactDom = __webpack_require__(2);
|
14131 |
|
14132 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
14133 |
|
14134 | var _Modal = __webpack_require__(141);
|
14135 |
|
14136 | var _Modal2 = _interopRequireDefault(_Modal);
|
14137 |
|
14138 | var _isOverflowing = __webpack_require__(144);
|
14139 |
|
14140 | var _isOverflowing2 = _interopRequireDefault(_isOverflowing);
|
14141 |
|
14142 | var _tinperBeeCore = __webpack_require__(27);
|
14143 |
|
14144 | var _beeTransition = __webpack_require__(11);
|
14145 |
|
14146 | var _ModalBody = __webpack_require__(148);
|
14147 |
|
14148 | var _ModalBody2 = _interopRequireDefault(_ModalBody);
|
14149 |
|
14150 | var _ModalDialog = __webpack_require__(149);
|
14151 |
|
14152 | var _ModalDialog2 = _interopRequireDefault(_ModalDialog);
|
14153 |
|
14154 | var _ModalFooter = __webpack_require__(150);
|
14155 |
|
14156 | var _ModalFooter2 = _interopRequireDefault(_ModalFooter);
|
14157 |
|
14158 | var _ModalHeader = __webpack_require__(151);
|
14159 |
|
14160 | var _ModalHeader2 = _interopRequireDefault(_ModalHeader);
|
14161 |
|
14162 | var _ModalTitle = __webpack_require__(152);
|
14163 |
|
14164 | var _ModalTitle2 = _interopRequireDefault(_ModalTitle);
|
14165 |
|
14166 | var _propTypes = __webpack_require__(6);
|
14167 |
|
14168 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
14169 |
|
14170 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
14171 |
|
14172 | 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; }
|
14173 |
|
14174 | 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; }
|
14175 |
|
14176 | 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; }
|
14177 |
|
14178 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14179 |
|
14180 | 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; }
|
14181 |
|
14182 | 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); }
|
14183 |
|
14184 | var propTypes = _extends({}, _Modal2["default"].propTypes, _ModalDialog2["default"].propTypes, {
|
14185 |
|
14186 | |
14187 |
|
14188 |
|
14189 | backdrop: _propTypes2["default"].oneOf(['static', true, false]),
|
14190 |
|
14191 | |
14192 |
|
14193 |
|
14194 | backdropClosable: _propTypes2["default"].bool,
|
14195 | |
14196 |
|
14197 |
|
14198 | keyboard: _propTypes2["default"].bool,
|
14199 |
|
14200 | |
14201 |
|
14202 |
|
14203 | animation: _propTypes2["default"].bool,
|
14204 |
|
14205 | |
14206 |
|
14207 |
|
14208 | dialogComponentClass: _tinperBeeCore.elementType,
|
14209 |
|
14210 | |
14211 |
|
14212 |
|
14213 | autoFocus: _propTypes2["default"].bool,
|
14214 |
|
14215 | |
14216 |
|
14217 |
|
14218 | enforceFocus: _propTypes2["default"].bool,
|
14219 |
|
14220 | |
14221 |
|
14222 |
|
14223 | show: _propTypes2["default"].bool,
|
14224 |
|
14225 | |
14226 |
|
14227 |
|
14228 | onHide: _propTypes2["default"].func,
|
14229 |
|
14230 | onEnter: _propTypes2["default"].func,
|
14231 |
|
14232 | onEntering: _propTypes2["default"].func,
|
14233 |
|
14234 | onEntered: _propTypes2["default"].func,
|
14235 |
|
14236 | onExit: _propTypes2["default"].func,
|
14237 |
|
14238 | onExiting: _propTypes2["default"].func,
|
14239 |
|
14240 | onExited: _propTypes2["default"].func,
|
14241 |
|
14242 | |
14243 |
|
14244 |
|
14245 | container: _Modal2["default"].propTypes.container,
|
14246 |
|
14247 | |
14248 |
|
14249 |
|
14250 | size: _propTypes2["default"].oneOf(["sm", "lg", "xlg", ""]),
|
14251 | |
14252 |
|
14253 |
|
14254 | width: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string])
|
14255 | });
|
14256 |
|
14257 | var defaultProps = _extends({}, _Modal2["default"].defaultProps, {
|
14258 | backdropClosable: true,
|
14259 | animation: true,
|
14260 | dialogComponentClass: _ModalDialog2["default"],
|
14261 | clsPrefix: 'u-modal'
|
14262 | });
|
14263 |
|
14264 | var childContextTypes = {
|
14265 | $u_modal: _propTypes2["default"].shape({
|
14266 | onHide: _propTypes2["default"].func
|
14267 | })
|
14268 | };
|
14269 |
|
14270 | var Modal = function (_React$Component) {
|
14271 | _inherits(Modal, _React$Component);
|
14272 |
|
14273 | function Modal(props, context) {
|
14274 | _classCallCheck(this, Modal);
|
14275 |
|
14276 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
14277 |
|
14278 | _this.handleEntering = _this.handleEntering.bind(_this);
|
14279 | _this.handleExited = _this.handleExited.bind(_this);
|
14280 | _this.handleWindowResize = _this.handleWindowResize.bind(_this);
|
14281 | _this.handleDialogClick = _this.handleDialogClick.bind(_this);
|
14282 |
|
14283 | _this.state = {
|
14284 | style: {}
|
14285 | };
|
14286 | return _this;
|
14287 | }
|
14288 |
|
14289 | Modal.prototype.getChildContext = function getChildContext() {
|
14290 | return {
|
14291 | $u_modal: {
|
14292 | onHide: this.props.onHide
|
14293 | }
|
14294 | };
|
14295 | };
|
14296 |
|
14297 | Modal.prototype.componentWillUnmount = function componentWillUnmount() {
|
14298 |
|
14299 | this.handleExited();
|
14300 | };
|
14301 |
|
14302 | Modal.prototype.handleEntering = function handleEntering() {
|
14303 |
|
14304 | _events2["default"].on(window, 'resize', this.handleWindowResize);
|
14305 | this.updateStyle();
|
14306 | };
|
14307 |
|
14308 | Modal.prototype.handleExited = function handleExited() {
|
14309 |
|
14310 | _events2["default"].off(window, 'resize', this.handleWindowResize);
|
14311 | };
|
14312 |
|
14313 | Modal.prototype.handleWindowResize = function handleWindowResize() {
|
14314 | this.updateStyle();
|
14315 | };
|
14316 |
|
14317 | Modal.prototype.handleDialogClick = function handleDialogClick(e) {
|
14318 | if (e.target !== e.currentTarget) {
|
14319 | return;
|
14320 | }
|
14321 |
|
14322 | this.props.onHide();
|
14323 | };
|
14324 |
|
14325 | Modal.prototype.updateStyle = function updateStyle() {
|
14326 | if (!_inDOM2["default"] || !this._modal) {
|
14327 | return;
|
14328 | }
|
14329 |
|
14330 | var dialogNode = this._modal.getDialogElement();
|
14331 | var dialogHeight = dialogNode.scrollHeight;
|
14332 |
|
14333 | var document = (0, _ownerDocument2["default"])(dialogNode);
|
14334 | var bodyIsOverflowing = (0, _isOverflowing2["default"])(_reactDom2["default"].findDOMNode(this.props.container || document.body));
|
14335 | var modalIsOverflowing = dialogHeight > document.documentElement.clientHeight;
|
14336 |
|
14337 | this.setState({
|
14338 | style: {
|
14339 | paddingRight: bodyIsOverflowing && !modalIsOverflowing ? (0, _scrollbarSize2["default"])() : undefined,
|
14340 | paddingLeft: !bodyIsOverflowing && modalIsOverflowing ? (0, _scrollbarSize2["default"])() : undefined
|
14341 | }
|
14342 | });
|
14343 | };
|
14344 |
|
14345 | Modal.prototype.render = function render() {
|
14346 | var _this2 = this;
|
14347 |
|
14348 | var _props = this.props,
|
14349 | backdrop = _props.backdrop,
|
14350 | backdropClosable = _props.backdropClosable,
|
14351 | animation = _props.animation,
|
14352 | show = _props.show,
|
14353 | Dialog = _props.dialogComponentClass,
|
14354 | className = _props.className,
|
14355 | clsPrefix = _props.clsPrefix,
|
14356 | _props$style = _props.style,
|
14357 | style = _props$style === undefined ? {} : _props$style,
|
14358 | size = _props.size,
|
14359 | width = _props.width,
|
14360 | children = _props.children,
|
14361 | onEntering = _props.onEntering,
|
14362 | onExited = _props.onExited,
|
14363 | props = _objectWithoutProperties(_props, ['backdrop', 'backdropClosable', 'animation', 'show', 'dialogComponentClass', 'className', 'clsPrefix', 'style', 'size', 'width', 'children', 'onEntering', 'onExited']);
|
14364 |
|
14365 | var _splitComponent = (0, _tinperBeeCore.splitComponent)(props, _Modal2["default"]),
|
14366 | _splitComponent2 = _slicedToArray(_splitComponent, 2),
|
14367 | baseModalProps = _splitComponent2[0],
|
14368 | dialogProps = _splitComponent2[1];
|
14369 |
|
14370 | var inClassName = show && !animation && 'in';
|
14371 |
|
14372 | var backdropClasses = _defineProperty({}, clsPrefix + '-backdrop', true);
|
14373 | var containerClasses = _defineProperty({}, clsPrefix + '-open', true);
|
14374 | if (Number(width)) width += 'px';
|
14375 |
|
14376 | var styleRes = _extends({}, this.state.style, style);
|
14377 | if (width) {
|
14378 | _extends(styleRes, { width: width });
|
14379 | }
|
14380 | return _react2["default"].createElement(
|
14381 | _Modal2["default"],
|
14382 | _extends({}, baseModalProps, {
|
14383 | ref: function ref(c) {
|
14384 | _this2._modal = c;
|
14385 | },
|
14386 | show: show,
|
14387 | onEntering: (0, _tinperBeeCore.createChainedFunction)(onEntering, this.handleEntering),
|
14388 | onExited: (0, _tinperBeeCore.createChainedFunction)(onExited, this.handleExited),
|
14389 | backdrop: backdrop,
|
14390 | backdropClassName: (0, _classnames2["default"])(backdropClasses, inClassName),
|
14391 | containerClassName: (0, _classnames2["default"])(containerClasses),
|
14392 | transition: animation ? _beeTransition.Fade : undefined,
|
14393 | dialogTransitionTimeout: Modal.TRANSITION_DURATION,
|
14394 | backdropTransitionTimeout: Modal.BACKDROP_TRANSITION_DURATION
|
14395 | }),
|
14396 | _react2["default"].createElement(
|
14397 | Dialog,
|
14398 | _extends({}, dialogProps, {
|
14399 | style: styleRes,
|
14400 | className: (0, _classnames2["default"])(className, inClassName),
|
14401 | onClick: backdrop === true && !!backdropClosable ? this.handleDialogClick : null,
|
14402 | size: size
|
14403 | }),
|
14404 | children
|
14405 | )
|
14406 | );
|
14407 | };
|
14408 |
|
14409 | return Modal;
|
14410 | }(_react2["default"].Component);
|
14411 |
|
14412 | Modal.propTypes = propTypes;
|
14413 | Modal.defaultProps = defaultProps;
|
14414 | Modal.childContextTypes = childContextTypes;
|
14415 |
|
14416 | Modal.Body = _ModalBody2["default"];
|
14417 | Modal.Header = _ModalHeader2["default"];
|
14418 | Modal.Title = _ModalTitle2["default"];
|
14419 | Modal.Footer = _ModalFooter2["default"];
|
14420 |
|
14421 | Modal.Dialog = _ModalDialog2["default"];
|
14422 |
|
14423 | Modal.TRANSITION_DURATION = 200000;
|
14424 | Modal.BACKDROP_TRANSITION_DURATION = 10000;
|
14425 |
|
14426 | exports["default"] = Modal;
|
14427 | module.exports = exports['default'];
|
14428 |
|
14429 | }),
|
14430 |
|
14431 | (function(module, exports, __webpack_require__) {
|
14432 |
|
14433 | "use strict";
|
14434 |
|
14435 | var _interopRequireDefault = __webpack_require__(14);
|
14436 |
|
14437 | exports.__esModule = true;
|
14438 | exports.default = void 0;
|
14439 |
|
14440 | var _on = _interopRequireDefault(__webpack_require__(16));
|
14441 |
|
14442 | exports.on = _on.default;
|
14443 |
|
14444 | var _off = _interopRequireDefault(__webpack_require__(77));
|
14445 |
|
14446 | exports.off = _off.default;
|
14447 |
|
14448 | var _filter = _interopRequireDefault(__webpack_require__(137));
|
14449 |
|
14450 | exports.filter = _filter.default;
|
14451 |
|
14452 | var _listen = _interopRequireDefault(__webpack_require__(139));
|
14453 |
|
14454 | exports.listen = _listen.default;
|
14455 | var _default = {
|
14456 | on: _on.default,
|
14457 | off: _off.default,
|
14458 | filter: _filter.default,
|
14459 | listen: _listen.default
|
14460 | };
|
14461 | exports.default = _default;
|
14462 |
|
14463 | }),
|
14464 |
|
14465 | (function(module, exports, __webpack_require__) {
|
14466 |
|
14467 | "use strict";
|
14468 |
|
14469 | var _interopRequireDefault = __webpack_require__(14);
|
14470 |
|
14471 | exports.__esModule = true;
|
14472 | exports.default = filterEvents;
|
14473 |
|
14474 | var _contains = _interopRequireDefault(__webpack_require__(111));
|
14475 |
|
14476 | var _querySelectorAll = _interopRequireDefault(__webpack_require__(138));
|
14477 |
|
14478 | function filterEvents(selector, handler) {
|
14479 | return function filterHandler(e) {
|
14480 | var top = e.currentTarget,
|
14481 | target = e.target,
|
14482 | matches = (0, _querySelectorAll.default)(top, selector);
|
14483 | if (matches.some(function (match) {
|
14484 | return (0, _contains.default)(match, target);
|
14485 | })) handler.call(this, e);
|
14486 | };
|
14487 | }
|
14488 |
|
14489 | module.exports = exports["default"];
|
14490 |
|
14491 | }),
|
14492 |
|
14493 | (function(module, exports) {
|
14494 |
|
14495 | "use strict";
|
14496 |
|
14497 | exports.__esModule = true;
|
14498 | exports.default = qsa;
|
14499 |
|
14500 |
|
14501 |
|
14502 | var simpleSelectorRE = /^[\w-]*$/;
|
14503 | var toArray = Function.prototype.bind.call(Function.prototype.call, [].slice);
|
14504 |
|
14505 | function qsa(element, selector) {
|
14506 | var maybeID = selector[0] === '#',
|
14507 | maybeClass = selector[0] === '.',
|
14508 | nameOnly = maybeID || maybeClass ? selector.slice(1) : selector,
|
14509 | isSimple = simpleSelectorRE.test(nameOnly),
|
14510 | found;
|
14511 |
|
14512 | if (isSimple) {
|
14513 | if (maybeID) {
|
14514 | element = element.getElementById ? element : document;
|
14515 | return (found = element.getElementById(nameOnly)) ? [found] : [];
|
14516 | }
|
14517 |
|
14518 | if (element.getElementsByClassName && maybeClass) return toArray(element.getElementsByClassName(nameOnly));
|
14519 | return toArray(element.getElementsByTagName(selector));
|
14520 | }
|
14521 |
|
14522 | return toArray(element.querySelectorAll(selector));
|
14523 | }
|
14524 |
|
14525 | module.exports = exports["default"];
|
14526 |
|
14527 | }),
|
14528 |
|
14529 | (function(module, exports, __webpack_require__) {
|
14530 |
|
14531 | "use strict";
|
14532 |
|
14533 | var _interopRequireDefault = __webpack_require__(14);
|
14534 |
|
14535 | exports.__esModule = true;
|
14536 | exports.default = void 0;
|
14537 |
|
14538 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
14539 |
|
14540 | var _on = _interopRequireDefault(__webpack_require__(16));
|
14541 |
|
14542 | var _off = _interopRequireDefault(__webpack_require__(77));
|
14543 |
|
14544 | var listen = function listen() {};
|
14545 |
|
14546 | if (_inDOM.default) {
|
14547 | listen = function listen(node, eventName, handler, capture) {
|
14548 | (0, _on.default)(node, eventName, handler, capture);
|
14549 | return function () {
|
14550 | (0, _off.default)(node, eventName, handler, capture);
|
14551 | };
|
14552 | };
|
14553 | }
|
14554 |
|
14555 | var _default = listen;
|
14556 | exports.default = _default;
|
14557 | module.exports = exports["default"];
|
14558 |
|
14559 | }),
|
14560 |
|
14561 | (function(module, exports, __webpack_require__) {
|
14562 |
|
14563 | "use strict";
|
14564 |
|
14565 | var _interopRequireDefault = __webpack_require__(14);
|
14566 |
|
14567 | exports.__esModule = true;
|
14568 | exports.default = scrollbarSize;
|
14569 |
|
14570 | var _inDOM = _interopRequireDefault(__webpack_require__(15));
|
14571 |
|
14572 | var size;
|
14573 |
|
14574 | function scrollbarSize(recalc) {
|
14575 | if (!size && size !== 0 || recalc) {
|
14576 | if (_inDOM.default) {
|
14577 | var scrollDiv = document.createElement('div');
|
14578 | scrollDiv.style.position = 'absolute';
|
14579 | scrollDiv.style.top = '-9999px';
|
14580 | scrollDiv.style.width = '50px';
|
14581 | scrollDiv.style.height = '50px';
|
14582 | scrollDiv.style.overflow = 'scroll';
|
14583 | document.body.appendChild(scrollDiv);
|
14584 | size = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
14585 | document.body.removeChild(scrollDiv);
|
14586 | }
|
14587 | }
|
14588 |
|
14589 | return size;
|
14590 | }
|
14591 |
|
14592 | module.exports = exports["default"];
|
14593 |
|
14594 | }),
|
14595 |
|
14596 | (function(module, exports, __webpack_require__) {
|
14597 |
|
14598 | 'use strict';
|
14599 |
|
14600 | Object.defineProperty(exports, "__esModule", {
|
14601 | value: true
|
14602 | });
|
14603 |
|
14604 | 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; };
|
14605 |
|
14606 |
|
14607 | var _react = __webpack_require__(1);
|
14608 |
|
14609 | var _react2 = _interopRequireDefault(_react);
|
14610 |
|
14611 | var _propTypes = __webpack_require__(6);
|
14612 |
|
14613 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
14614 |
|
14615 | var _warning = __webpack_require__(32);
|
14616 |
|
14617 | var _warning2 = _interopRequireDefault(_warning);
|
14618 |
|
14619 | var _tinperBeeCore = __webpack_require__(27);
|
14620 |
|
14621 | var _Portal = __webpack_require__(112);
|
14622 |
|
14623 | var _Portal2 = _interopRequireDefault(_Portal);
|
14624 |
|
14625 | var _ModalManager = __webpack_require__(142);
|
14626 |
|
14627 | var _ModalManager2 = _interopRequireDefault(_ModalManager);
|
14628 |
|
14629 | var _ownerDocument = __webpack_require__(74);
|
14630 |
|
14631 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
14632 |
|
14633 | var _addEventListener = __webpack_require__(76);
|
14634 |
|
14635 | var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
14636 |
|
14637 | var _addFocusListener = __webpack_require__(146);
|
14638 |
|
14639 | var _addFocusListener2 = _interopRequireDefault(_addFocusListener);
|
14640 |
|
14641 | var _inDOM = __webpack_require__(15);
|
14642 |
|
14643 | var _inDOM2 = _interopRequireDefault(_inDOM);
|
14644 |
|
14645 | var _activeElement = __webpack_require__(147);
|
14646 |
|
14647 | var _activeElement2 = _interopRequireDefault(_activeElement);
|
14648 |
|
14649 | var _contains = __webpack_require__(111);
|
14650 |
|
14651 | var _contains2 = _interopRequireDefault(_contains);
|
14652 |
|
14653 | var _getContainer = __webpack_require__(113);
|
14654 |
|
14655 | var _getContainer2 = _interopRequireDefault(_getContainer);
|
14656 |
|
14657 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
14658 |
|
14659 | 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; }
|
14660 |
|
14661 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14662 |
|
14663 | 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; }
|
14664 |
|
14665 | 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); }
|
14666 |
|
14667 | var modalManager = new _ModalManager2["default"]();
|
14668 |
|
14669 | |
14670 |
|
14671 |
|
14672 |
|
14673 | var propTypes = _extends({}, _Portal2["default"].propTypes, {
|
14674 |
|
14675 | |
14676 |
|
14677 |
|
14678 | show: _propTypes2["default"].bool,
|
14679 |
|
14680 | |
14681 |
|
14682 |
|
14683 | container: _propTypes2["default"].oneOfType([_tinperBeeCore.componentOrElement, _propTypes2["default"].func]),
|
14684 |
|
14685 | |
14686 |
|
14687 |
|
14688 | onShow: _propTypes2["default"].func,
|
14689 |
|
14690 | |
14691 |
|
14692 |
|
14693 | onHide: _propTypes2["default"].func,
|
14694 |
|
14695 | |
14696 |
|
14697 |
|
14698 | backdrop: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].oneOf(['static'])]),
|
14699 |
|
14700 | |
14701 |
|
14702 |
|
14703 | renderBackdrop: _propTypes2["default"].func,
|
14704 |
|
14705 | |
14706 |
|
14707 |
|
14708 | onEscapeKeyUp: _propTypes2["default"].func,
|
14709 |
|
14710 | |
14711 |
|
14712 |
|
14713 | onBackdropClick: _propTypes2["default"].func,
|
14714 |
|
14715 | |
14716 |
|
14717 |
|
14718 | backdropStyle: _propTypes2["default"].object,
|
14719 |
|
14720 | |
14721 |
|
14722 |
|
14723 | backdropClassName: _propTypes2["default"].string,
|
14724 |
|
14725 | |
14726 |
|
14727 |
|
14728 | containerClassName: _propTypes2["default"].string,
|
14729 |
|
14730 | |
14731 |
|
14732 |
|
14733 | keyboard: _propTypes2["default"].bool,
|
14734 |
|
14735 | |
14736 |
|
14737 |
|
14738 | transition: _tinperBeeCore.elementType,
|
14739 |
|
14740 | |
14741 |
|
14742 |
|
14743 | dialogTransitionTimeout: _propTypes2["default"].number,
|
14744 |
|
14745 | |
14746 |
|
14747 |
|
14748 | backdropTransitionTimeout: _propTypes2["default"].number,
|
14749 |
|
14750 | |
14751 |
|
14752 |
|
14753 | autoFocus: _propTypes2["default"].bool,
|
14754 |
|
14755 | |
14756 |
|
14757 |
|
14758 | enforceFocus: _propTypes2["default"].bool,
|
14759 |
|
14760 | |
14761 |
|
14762 |
|
14763 | onEnter: _propTypes2["default"].func,
|
14764 |
|
14765 | |
14766 |
|
14767 |
|
14768 | onEntering: _propTypes2["default"].func,
|
14769 |
|
14770 | |
14771 |
|
14772 |
|
14773 | onEntered: _propTypes2["default"].func,
|
14774 |
|
14775 | |
14776 |
|
14777 |
|
14778 | onExit: _propTypes2["default"].func,
|
14779 |
|
14780 | |
14781 |
|
14782 |
|
14783 | onExiting: _propTypes2["default"].func,
|
14784 |
|
14785 | |
14786 |
|
14787 |
|
14788 | onExited: _propTypes2["default"].func,
|
14789 |
|
14790 | |
14791 |
|
14792 |
|
14793 | manager: _propTypes2["default"].object.isRequired
|
14794 | });
|
14795 |
|
14796 | var defaultProps = {
|
14797 | show: false,
|
14798 | backdrop: true,
|
14799 | keyboard: true,
|
14800 | autoFocus: true,
|
14801 | enforceFocus: true,
|
14802 | onHide: function onHide() {},
|
14803 | manager: modalManager,
|
14804 | renderBackdrop: function renderBackdrop(props) {
|
14805 | return _react2["default"].createElement('div', props);
|
14806 | }
|
14807 | };
|
14808 |
|
14809 | var BaseModal = function (_Component) {
|
14810 | _inherits(BaseModal, _Component);
|
14811 |
|
14812 | function BaseModal(props, content) {
|
14813 | _classCallCheck(this, BaseModal);
|
14814 |
|
14815 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
14816 |
|
14817 | _this.state = {
|
14818 | exited: !_this.props.show
|
14819 | };
|
14820 |
|
14821 | _this.onShow = _this.onShow.bind(_this);
|
14822 | _this.onHide = _this.onHide.bind(_this);
|
14823 | _this.setMountNode = _this.setMountNode.bind(_this);
|
14824 | _this.handleHidden = _this.handleHidden.bind(_this);
|
14825 | _this.handleBackdropClick = _this.handleBackdropClick.bind(_this);
|
14826 | _this.handleDocumentKeyUp = _this.handleDocumentKeyUp.bind(_this);
|
14827 | _this.checkForFocus = _this.checkForFocus.bind(_this);
|
14828 | _this.focus = _this.focus.bind(_this);
|
14829 | _this.restoreLastFocus = _this.restoreLastFocus.bind(_this);
|
14830 | _this.enforceFocus = _this.enforceFocus.bind(_this);
|
14831 | _this.getDialogElement = _this.getDialogElement.bind(_this);
|
14832 | _this.isTopModal = _this.isTopModal.bind(_this);
|
14833 | _this.renderBackdrop = _this.renderBackdrop.bind(_this);
|
14834 | return _this;
|
14835 | }
|
14836 |
|
14837 | BaseModal.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
14838 | if (nextProps.show) {
|
14839 | this.setState({ exited: false });
|
14840 | } else if (!nextProps.transition) {
|
14841 |
|
14842 | this.setState({ exited: true });
|
14843 | }
|
14844 | };
|
14845 |
|
14846 | BaseModal.prototype.componentWillUpdate = function componentWillUpdate(nextProps) {
|
14847 | if (!this.props.show && nextProps.show) {
|
14848 | this.checkForFocus();
|
14849 | }
|
14850 | };
|
14851 |
|
14852 | BaseModal.prototype.componentDidMount = function componentDidMount() {
|
14853 | if (this.props.show) {
|
14854 | this.onShow();
|
14855 | }
|
14856 | this.mounted = true;
|
14857 | };
|
14858 |
|
14859 | BaseModal.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
14860 | var transition = this.props.transition;
|
14861 |
|
14862 |
|
14863 | if (prevProps.show && !this.props.show && !transition) {
|
14864 |
|
14865 | this.onHide();
|
14866 | } else if (!prevProps.show && this.props.show) {
|
14867 | this.onShow();
|
14868 | }
|
14869 | };
|
14870 |
|
14871 | BaseModal.prototype.componentWillUnmount = function componentWillUnmount() {
|
14872 | var _props = this.props,
|
14873 | show = _props.show,
|
14874 | transition = _props.transition;
|
14875 |
|
14876 |
|
14877 | if (show || transition && !this.state.exited) {
|
14878 | this.onHide();
|
14879 | }
|
14880 |
|
14881 | this.mounted = false;
|
14882 | };
|
14883 |
|
14884 | BaseModal.prototype.onShow = function onShow() {
|
14885 | var doc = (0, _ownerDocument2["default"])(this);
|
14886 | var container = (0, _getContainer2["default"])(this.props.container, doc.body);
|
14887 |
|
14888 | this.props.manager.add(this, container, this.props.containerClassName);
|
14889 |
|
14890 | this._onDocumentKeyupListener = (0, _addEventListener2["default"])(doc, 'keyup', this.handleDocumentKeyUp);
|
14891 |
|
14892 | this._onFocusinListener = (0, _addFocusListener2["default"])(this.enforceFocus);
|
14893 |
|
14894 | this.focus();
|
14895 |
|
14896 | if (this.props.onShow) {
|
14897 | this.props.onShow();
|
14898 | }
|
14899 | };
|
14900 |
|
14901 | BaseModal.prototype.onHide = function onHide() {
|
14902 | this.props.manager.remove(this);
|
14903 |
|
14904 | this._onDocumentKeyupListener.remove();
|
14905 |
|
14906 | this._onFocusinListener.remove();
|
14907 |
|
14908 | this.restoreLastFocus();
|
14909 | };
|
14910 |
|
14911 | BaseModal.prototype.setMountNode = function setMountNode(ref) {
|
14912 | this.mountNode = ref ? ref.getMountNode() : ref;
|
14913 | };
|
14914 |
|
14915 | BaseModal.prototype.handleHidden = function handleHidden() {
|
14916 | this.setState({ exited: true });
|
14917 | this.onHide();
|
14918 |
|
14919 | if (this.props.onExited) {
|
14920 | var _props2;
|
14921 |
|
14922 | (_props2 = this.props).onExited.apply(_props2, arguments);
|
14923 | }
|
14924 | };
|
14925 |
|
14926 | BaseModal.prototype.handleBackdropClick = function handleBackdropClick(e) {
|
14927 | if (e.target !== e.currentTarget) {
|
14928 | return;
|
14929 | }
|
14930 |
|
14931 | if (this.props.onBackdropClick) {
|
14932 | this.props.onBackdropClick(e);
|
14933 | }
|
14934 |
|
14935 | if (this.props.backdrop === true) {
|
14936 | this.props.onHide();
|
14937 | }
|
14938 | };
|
14939 |
|
14940 | BaseModal.prototype.handleDocumentKeyUp = function handleDocumentKeyUp(e) {
|
14941 | if (this.props.keyboard && e.keyCode === 27 && this.isTopModal()) {
|
14942 | if (this.props.onEscapeKeyUp) {
|
14943 | this.props.onEscapeKeyUp(e);
|
14944 | }
|
14945 | this.props.onHide();
|
14946 | }
|
14947 | };
|
14948 |
|
14949 | BaseModal.prototype.checkForFocus = function checkForFocus() {
|
14950 | if (_inDOM2["default"]) {
|
14951 | this.lastFocus = (0, _activeElement2["default"])();
|
14952 | }
|
14953 | };
|
14954 |
|
14955 | BaseModal.prototype.focus = function focus() {
|
14956 | var autoFocus = this.props.autoFocus;
|
14957 | var modalContent = this.getDialogElement();
|
14958 | var current = (0, _activeElement2["default"])((0, _ownerDocument2["default"])(this));
|
14959 | var focusInModal = current && (0, _contains2["default"])(modalContent, current);
|
14960 |
|
14961 | if (modalContent && autoFocus && !focusInModal) {
|
14962 | this.lastFocus = current;
|
14963 |
|
14964 | if (!modalContent.hasAttribute('tabIndex')) {
|
14965 | modalContent.setAttribute('tabIndex', -1);
|
14966 | (0, _warning2["default"])(false, 'The modal content node does not accept focus. ' + 'For the benefit of assistive technologies, the tabIndex of the node is being set to "-1".');
|
14967 | }
|
14968 |
|
14969 | modalContent.focus();
|
14970 | }
|
14971 | };
|
14972 |
|
14973 | BaseModal.prototype.restoreLastFocus = function restoreLastFocus() {
|
14974 |
|
14975 | if (this.lastFocus && this.lastFocus.focus) {
|
14976 | this.lastFocus.focus();
|
14977 | this.lastFocus = null;
|
14978 | }
|
14979 | };
|
14980 |
|
14981 | BaseModal.prototype.enforceFocus = function enforceFocus() {
|
14982 | var enforceFocus = this.props.enforceFocus;
|
14983 |
|
14984 |
|
14985 | if (!enforceFocus || !this.mounted || !this.isTopModal()) {
|
14986 | return;
|
14987 | }
|
14988 |
|
14989 | var active = (0, _activeElement2["default"])((0, _ownerDocument2["default"])(this));
|
14990 | var modal = this.getDialogElement();
|
14991 |
|
14992 | if (modal && modal !== active && !(0, _contains2["default"])(modal, active)) {
|
14993 | modal.focus();
|
14994 | }
|
14995 | };
|
14996 |
|
14997 |
|
14998 |
|
14999 |
|
15000 | BaseModal.prototype.getDialogElement = function getDialogElement() {
|
15001 | var node = this.refs.modal;
|
15002 | return node && node.lastChild;
|
15003 | };
|
15004 |
|
15005 | BaseModal.prototype.isTopModal = function isTopModal() {
|
15006 | return this.props.manager.isTopModal(this);
|
15007 | };
|
15008 |
|
15009 | BaseModal.prototype.renderBackdrop = function renderBackdrop() {
|
15010 | var _this2 = this;
|
15011 |
|
15012 | var _props3 = this.props,
|
15013 | backdropStyle = _props3.backdropStyle,
|
15014 | backdropClassName = _props3.backdropClassName,
|
15015 | renderBackdrop = _props3.renderBackdrop,
|
15016 | Transition = _props3.transition,
|
15017 | backdropTransitionTimeout = _props3.backdropTransitionTimeout;
|
15018 |
|
15019 |
|
15020 | var backdropRef = function backdropRef(ref) {
|
15021 | return _this2.backdrop = ref;
|
15022 | };
|
15023 |
|
15024 | var backdrop = _react2["default"].createElement('div', {
|
15025 | ref: backdropRef,
|
15026 | style: this.props.backdropStyle,
|
15027 | className: this.props.backdropClassName,
|
15028 | onClick: this.handleBackdropClick
|
15029 | });
|
15030 |
|
15031 | if (Transition) {
|
15032 | backdrop = _react2["default"].createElement(
|
15033 | Transition,
|
15034 | { transitionAppear: true,
|
15035 | 'in': this.props.show,
|
15036 | timeout: backdropTransitionTimeout
|
15037 | },
|
15038 | renderBackdrop({
|
15039 | ref: backdropRef,
|
15040 | style: backdropStyle,
|
15041 | className: backdropClassName,
|
15042 | onClick: this.handleBackdropClick
|
15043 | })
|
15044 | );
|
15045 | }
|
15046 |
|
15047 | return backdrop;
|
15048 | };
|
15049 |
|
15050 | BaseModal.prototype.render = function render() {
|
15051 | var _props4 = this.props,
|
15052 | show = _props4.show,
|
15053 | container = _props4.container,
|
15054 | children = _props4.children,
|
15055 | Transition = _props4.transition,
|
15056 | backdrop = _props4.backdrop,
|
15057 | dialogTransitionTimeout = _props4.dialogTransitionTimeout,
|
15058 | className = _props4.className,
|
15059 | style = _props4.style,
|
15060 | onExit = _props4.onExit,
|
15061 | onExiting = _props4.onExiting,
|
15062 | onEnter = _props4.onEnter,
|
15063 | onEntering = _props4.onEntering,
|
15064 | onEntered = _props4.onEntered;
|
15065 |
|
15066 |
|
15067 | var dialog = _react2["default"].Children.only(children);
|
15068 |
|
15069 | var mountModal = show || Transition && !this.state.exited;
|
15070 | if (!mountModal) {
|
15071 | return null;
|
15072 | }
|
15073 |
|
15074 | var _dialog$props = dialog.props,
|
15075 | role = _dialog$props.role,
|
15076 | tabIndex = _dialog$props.tabIndex;
|
15077 |
|
15078 |
|
15079 | if (role === undefined || tabIndex === undefined) {
|
15080 | dialog = (0, _react.cloneElement)(dialog, {
|
15081 | role: role === undefined ? 'document' : role,
|
15082 | tabIndex: tabIndex == null ? '-1' : tabIndex
|
15083 | });
|
15084 | }
|
15085 |
|
15086 | if (Transition) {
|
15087 | dialog = _react2["default"].createElement(
|
15088 | Transition,
|
15089 | {
|
15090 | transitionAppear: true,
|
15091 | unmountOnExit: true,
|
15092 | 'in': show,
|
15093 | timeout: dialogTransitionTimeout,
|
15094 | onExit: onExit,
|
15095 | onExiting: onExiting,
|
15096 | onExited: this.handleHidden,
|
15097 | onEnter: onEnter,
|
15098 | onEntering: onEntering,
|
15099 | onEntered: onEntered
|
15100 | },
|
15101 | dialog
|
15102 | );
|
15103 | }
|
15104 |
|
15105 | return _react2["default"].createElement(
|
15106 | _Portal2["default"],
|
15107 | {
|
15108 | ref: this.setMountNode,
|
15109 | container: container
|
15110 | },
|
15111 | _react2["default"].createElement(
|
15112 | 'div',
|
15113 | {
|
15114 | ref: 'modal',
|
15115 | role: role || 'dialog',
|
15116 | style: style,
|
15117 | className: className
|
15118 | },
|
15119 | backdrop && this.renderBackdrop(),
|
15120 | dialog
|
15121 | )
|
15122 | );
|
15123 | };
|
15124 |
|
15125 | return BaseModal;
|
15126 | }(_react.Component);
|
15127 |
|
15128 | ;
|
15129 |
|
15130 | BaseModal.Manager = _ModalManager2["default"];
|
15131 |
|
15132 | BaseModal.propTypes = propTypes;
|
15133 | BaseModal.defaultProps = defaultProps;
|
15134 |
|
15135 | exports["default"] = BaseModal;
|
15136 | module.exports = exports['default'];
|
15137 |
|
15138 | }),
|
15139 |
|
15140 | (function(module, exports, __webpack_require__) {
|
15141 |
|
15142 | 'use strict';
|
15143 |
|
15144 | Object.defineProperty(exports, "__esModule", {
|
15145 | value: true
|
15146 | });
|
15147 |
|
15148 | var _style = __webpack_require__(18);
|
15149 |
|
15150 | var _style2 = _interopRequireDefault(_style);
|
15151 |
|
15152 | var _class = __webpack_require__(143);
|
15153 |
|
15154 | var _class2 = _interopRequireDefault(_class);
|
15155 |
|
15156 | var _scrollbarSize = __webpack_require__(140);
|
15157 |
|
15158 | var _scrollbarSize2 = _interopRequireDefault(_scrollbarSize);
|
15159 |
|
15160 | var _isOverflowing = __webpack_require__(144);
|
15161 |
|
15162 | var _isOverflowing2 = _interopRequireDefault(_isOverflowing);
|
15163 |
|
15164 | var _manageAriaHidden = __webpack_require__(145);
|
15165 |
|
15166 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15167 |
|
15168 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15169 |
|
15170 | function findIndexOf(arr, cb) {
|
15171 | var idx = -1;
|
15172 | arr.some(function (d, i) {
|
15173 | if (cb(d, i)) {
|
15174 | idx = i;
|
15175 | return true;
|
15176 | }
|
15177 | });
|
15178 | return idx;
|
15179 | }
|
15180 |
|
15181 |
|
15182 | function findContainer(data, modal) {
|
15183 | return findIndexOf(data, function (d) {
|
15184 | return d.modals.indexOf(modal) !== -1;
|
15185 | });
|
15186 | }
|
15187 |
|
15188 |
|
15189 | function setContainerStyle(state, container) {
|
15190 | var style = { overflow: 'hidden' };
|
15191 |
|
15192 | state.style = {
|
15193 | overflow: container.style.overflow,
|
15194 | paddingRight: container.style.paddingRight
|
15195 | };
|
15196 |
|
15197 | if (state.overflowing) {
|
15198 |
|
15199 | style.paddingRight = parseInt((0, _style2["default"])(container, 'paddingRight') || 0, 10) + (0, _scrollbarSize2["default"])() + 'px';
|
15200 | }
|
15201 |
|
15202 | (0, _style2["default"])(container, style);
|
15203 | }
|
15204 |
|
15205 | function removeContainerStyle(_ref, container) {
|
15206 | var style = _ref.style;
|
15207 |
|
15208 |
|
15209 | Object.keys(style).forEach(function (key) {
|
15210 | return container.style[key] = style[key];
|
15211 | });
|
15212 | }
|
15213 | |
15214 |
|
15215 |
|
15216 |
|
15217 | var ModalManager = function () {
|
15218 | function ModalManager() {
|
15219 | var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
15220 | _ref2$hideSiblingNode = _ref2.hideSiblingNodes,
|
15221 | hideSiblingNodes = _ref2$hideSiblingNode === undefined ? true : _ref2$hideSiblingNode,
|
15222 | _ref2$handleContainer = _ref2.handleContainerOverflow,
|
15223 | handleContainerOverflow = _ref2$handleContainer === undefined ? true : _ref2$handleContainer;
|
15224 |
|
15225 | _classCallCheck(this, ModalManager);
|
15226 |
|
15227 | this.hideSiblingNodes = hideSiblingNodes;
|
15228 | this.handleContainerOverflow = handleContainerOverflow;
|
15229 | this.modals = [];
|
15230 | this.containers = [];
|
15231 | this.data = [];
|
15232 | }
|
15233 |
|
15234 | ModalManager.prototype.add = function add(modal, container, className) {
|
15235 | var modalIdx = this.modals.indexOf(modal);
|
15236 | var containerIdx = this.containers.indexOf(container);
|
15237 |
|
15238 | if (modalIdx !== -1) {
|
15239 | return modalIdx;
|
15240 | }
|
15241 |
|
15242 | modalIdx = this.modals.length;
|
15243 | this.modals.push(modal);
|
15244 |
|
15245 | if (this.hideSiblingNodes) {
|
15246 | (0, _manageAriaHidden.hideSiblings)(container, modal.mountNode);
|
15247 | }
|
15248 |
|
15249 | if (containerIdx !== -1) {
|
15250 | this.data[containerIdx].modals.push(modal);
|
15251 | return modalIdx;
|
15252 | }
|
15253 |
|
15254 | var data = {
|
15255 | modals: [modal],
|
15256 |
|
15257 | classes: className ? className.split(/\s+/) : [],
|
15258 |
|
15259 | overflowing: (0, _isOverflowing2["default"])(container)
|
15260 | };
|
15261 |
|
15262 | if (this.handleContainerOverflow) {
|
15263 | setContainerStyle(data, container);
|
15264 | }
|
15265 |
|
15266 | data.classes.forEach(_class2["default"].addClass.bind(null, container));
|
15267 |
|
15268 | this.containers.push(container);
|
15269 | this.data.push(data);
|
15270 |
|
15271 | return modalIdx;
|
15272 | };
|
15273 |
|
15274 | ModalManager.prototype.remove = function remove(modal) {
|
15275 | var modalIdx = this.modals.indexOf(modal);
|
15276 |
|
15277 | if (modalIdx === -1) {
|
15278 | return;
|
15279 | }
|
15280 |
|
15281 | var containerIdx = findContainer(this.data, modal);
|
15282 | var data = this.data[containerIdx];
|
15283 | var container = this.containers[containerIdx];
|
15284 |
|
15285 | data.modals.splice(data.modals.indexOf(modal), 1);
|
15286 |
|
15287 | this.modals.splice(modalIdx, 1);
|
15288 |
|
15289 |
|
15290 |
|
15291 | if (data.modals.length === 0) {
|
15292 | data.classes.forEach(_class2["default"].removeClass.bind(null, container));
|
15293 |
|
15294 | if (this.handleContainerOverflow) {
|
15295 | removeContainerStyle(data, container);
|
15296 | }
|
15297 |
|
15298 | if (this.hideSiblingNodes) {
|
15299 | (0, _manageAriaHidden.showSiblings)(container, modal.mountNode);
|
15300 | }
|
15301 | this.containers.splice(containerIdx, 1);
|
15302 | this.data.splice(containerIdx, 1);
|
15303 | } else if (this.hideSiblingNodes) {
|
15304 |
|
15305 | (0, _manageAriaHidden.ariaHidden)(false, data.modals[data.modals.length - 1].mountNode);
|
15306 | }
|
15307 | };
|
15308 |
|
15309 | ModalManager.prototype.isTopModal = function isTopModal(modal) {
|
15310 | return !!this.modals.length && this.modals[this.modals.length - 1] === modal;
|
15311 | };
|
15312 |
|
15313 | return ModalManager;
|
15314 | }();
|
15315 |
|
15316 | exports["default"] = ModalManager;
|
15317 | module.exports = exports['default'];
|
15318 |
|
15319 | }),
|
15320 |
|
15321 | (function(module, exports, __webpack_require__) {
|
15322 |
|
15323 | "use strict";
|
15324 |
|
15325 | var _interopRequireDefault = __webpack_require__(14);
|
15326 |
|
15327 | exports.__esModule = true;
|
15328 | exports.default = void 0;
|
15329 |
|
15330 | var _addClass = _interopRequireDefault(__webpack_require__(89));
|
15331 |
|
15332 | exports.addClass = _addClass.default;
|
15333 |
|
15334 | var _removeClass = _interopRequireDefault(__webpack_require__(91));
|
15335 |
|
15336 | exports.removeClass = _removeClass.default;
|
15337 |
|
15338 | var _hasClass = _interopRequireDefault(__webpack_require__(90));
|
15339 |
|
15340 | exports.hasClass = _hasClass.default;
|
15341 | var _default = {
|
15342 | addClass: _addClass.default,
|
15343 | removeClass: _removeClass.default,
|
15344 | hasClass: _hasClass.default
|
15345 | };
|
15346 | exports.default = _default;
|
15347 |
|
15348 | }),
|
15349 |
|
15350 | (function(module, exports, __webpack_require__) {
|
15351 |
|
15352 | 'use strict';
|
15353 |
|
15354 | Object.defineProperty(exports, "__esModule", {
|
15355 | value: true
|
15356 | });
|
15357 | exports["default"] = isOverflowing;
|
15358 |
|
15359 | var _isWindow = __webpack_require__(120);
|
15360 |
|
15361 | var _isWindow2 = _interopRequireDefault(_isWindow);
|
15362 |
|
15363 | var _ownerDocument = __webpack_require__(75);
|
15364 |
|
15365 | var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
|
15366 |
|
15367 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15368 |
|
15369 | function isBody(node) {
|
15370 | return node && node.tagName.toLowerCase() === 'body';
|
15371 | }
|
15372 |
|
15373 | function bodyIsOverflowing(node) {
|
15374 | var doc = (0, _ownerDocument2["default"])(node);
|
15375 | var win = (0, _isWindow2["default"])(doc);
|
15376 | var fullWidth = win.innerWidth;
|
15377 |
|
15378 |
|
15379 | if (!fullWidth) {
|
15380 | var documentElementRect = doc.documentElement.getBoundingClientRect();
|
15381 | fullWidth = documentElementRect.right - Math.abs(documentElementRect.left);
|
15382 | }
|
15383 |
|
15384 | return doc.body.clientWidth < fullWidth;
|
15385 | }
|
15386 |
|
15387 | function isOverflowing(container) {
|
15388 | var win = (0, _isWindow2["default"])(container);
|
15389 |
|
15390 | return win || isBody(container) ? bodyIsOverflowing(container) : container.scrollHeight > container.clientHeight;
|
15391 | }
|
15392 | module.exports = exports['default'];
|
15393 |
|
15394 | }),
|
15395 |
|
15396 | (function(module, exports) {
|
15397 |
|
15398 | 'use strict';
|
15399 |
|
15400 | Object.defineProperty(exports, "__esModule", {
|
15401 | value: true
|
15402 | });
|
15403 | exports.ariaHidden = ariaHidden;
|
15404 | exports.hideSiblings = hideSiblings;
|
15405 | exports.showSiblings = showSiblings;
|
15406 |
|
15407 | var BLACKLIST = ['template', 'script', 'style'];
|
15408 |
|
15409 | var isHidable = function isHidable(_ref) {
|
15410 | var nodeType = _ref.nodeType,
|
15411 | tagName = _ref.tagName;
|
15412 | return nodeType === 1 && BLACKLIST.indexOf(tagName.toLowerCase()) === -1;
|
15413 | };
|
15414 |
|
15415 | var siblings = function siblings(container, mount, cb) {
|
15416 | mount = [].concat(mount);
|
15417 |
|
15418 | [].forEach.call(container.children, function (node) {
|
15419 | if (mount.indexOf(node) === -1 && isHidable(node)) {
|
15420 | cb(node);
|
15421 | }
|
15422 | });
|
15423 | };
|
15424 |
|
15425 | function ariaHidden(show, node) {
|
15426 | if (!node) {
|
15427 | return;
|
15428 | }
|
15429 | if (show) {
|
15430 | node.setAttribute('aria-hidden', 'true');
|
15431 | } else {
|
15432 | node.removeAttribute('aria-hidden');
|
15433 | }
|
15434 | }
|
15435 |
|
15436 | function hideSiblings(container, mountNode) {
|
15437 | siblings(container, mountNode, function (node) {
|
15438 | return ariaHidden(true, node);
|
15439 | });
|
15440 | }
|
15441 |
|
15442 | function showSiblings(container, mountNode) {
|
15443 | siblings(container, mountNode, function (node) {
|
15444 | return ariaHidden(false, node);
|
15445 | });
|
15446 | }
|
15447 |
|
15448 | }),
|
15449 |
|
15450 | (function(module, exports) {
|
15451 |
|
15452 | 'use strict';
|
15453 |
|
15454 | Object.defineProperty(exports, "__esModule", {
|
15455 | value: true
|
15456 | });
|
15457 | exports["default"] = addFocusListener;
|
15458 | |
15459 |
|
15460 |
|
15461 |
|
15462 |
|
15463 |
|
15464 | function addFocusListener(handler) {
|
15465 | var useFocusin = !document.addEventListener;
|
15466 | var remove = void 0;
|
15467 |
|
15468 | if (useFocusin) {
|
15469 | document.attachEvent('onfocusin', handler);
|
15470 | remove = function remove() {
|
15471 | return document.detachEvent('onfocusin', handler);
|
15472 | };
|
15473 | } else {
|
15474 | document.addEventListener('focus', handler, true);
|
15475 | remove = function remove() {
|
15476 | return document.removeEventListener('focus', handler, true);
|
15477 | };
|
15478 | }
|
15479 |
|
15480 | return { remove: remove };
|
15481 | }
|
15482 | module.exports = exports['default'];
|
15483 |
|
15484 | }),
|
15485 |
|
15486 | (function(module, exports, __webpack_require__) {
|
15487 |
|
15488 | "use strict";
|
15489 |
|
15490 | var _interopRequireDefault = __webpack_require__(14);
|
15491 |
|
15492 | exports.__esModule = true;
|
15493 | exports.default = activeElement;
|
15494 |
|
15495 | var _ownerDocument = _interopRequireDefault(__webpack_require__(75));
|
15496 |
|
15497 | function activeElement(doc) {
|
15498 | if (doc === void 0) {
|
15499 | doc = (0, _ownerDocument.default)();
|
15500 | }
|
15501 |
|
15502 | try {
|
15503 | return doc.activeElement;
|
15504 | } catch (e) {
|
15505 |
|
15506 | }
|
15507 | }
|
15508 |
|
15509 | module.exports = exports["default"];
|
15510 |
|
15511 | }),
|
15512 |
|
15513 | (function(module, exports, __webpack_require__) {
|
15514 |
|
15515 | 'use strict';
|
15516 |
|
15517 | Object.defineProperty(exports, "__esModule", {
|
15518 | value: true
|
15519 | });
|
15520 |
|
15521 | 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; };
|
15522 |
|
15523 | var _classnames = __webpack_require__(5);
|
15524 |
|
15525 | var _classnames2 = _interopRequireDefault(_classnames);
|
15526 |
|
15527 | var _react = __webpack_require__(1);
|
15528 |
|
15529 | var _react2 = _interopRequireDefault(_react);
|
15530 |
|
15531 | var _tinperBeeCore = __webpack_require__(27);
|
15532 |
|
15533 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15534 |
|
15535 | 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; }
|
15536 |
|
15537 | 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; }
|
15538 |
|
15539 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15540 |
|
15541 | 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; }
|
15542 |
|
15543 | 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); }
|
15544 |
|
15545 | var propTypes = {
|
15546 | componentClass: _tinperBeeCore.elementType
|
15547 | };
|
15548 |
|
15549 | var defaultProps = {
|
15550 | componentClass: 'div',
|
15551 | clsPrefix: 'u-modal-body'
|
15552 | };
|
15553 |
|
15554 | var ModalBody = function (_React$Component) {
|
15555 | _inherits(ModalBody, _React$Component);
|
15556 |
|
15557 | function ModalBody() {
|
15558 | _classCallCheck(this, ModalBody);
|
15559 |
|
15560 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15561 | }
|
15562 |
|
15563 | ModalBody.prototype.render = function render() {
|
15564 | var _props = this.props,
|
15565 | Component = _props.componentClass,
|
15566 | clsPrefix = _props.clsPrefix,
|
15567 | className = _props.className,
|
15568 | props = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
|
15569 |
|
15570 | var classes = {};
|
15571 | classes['' + clsPrefix] = true;
|
15572 |
|
15573 | return _react2["default"].createElement(Component, _extends({}, props, {
|
15574 | className: (0, _classnames2["default"])(className, classes)
|
15575 | }));
|
15576 | };
|
15577 |
|
15578 | return ModalBody;
|
15579 | }(_react2["default"].Component);
|
15580 |
|
15581 | ModalBody.propTypes = propTypes;
|
15582 | ModalBody.defaultProps = defaultProps;
|
15583 |
|
15584 | exports["default"] = ModalBody;
|
15585 | module.exports = exports['default'];
|
15586 |
|
15587 | }),
|
15588 |
|
15589 | (function(module, exports, __webpack_require__) {
|
15590 |
|
15591 | 'use strict';
|
15592 |
|
15593 | Object.defineProperty(exports, "__esModule", {
|
15594 | value: true
|
15595 | });
|
15596 |
|
15597 | 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; };
|
15598 |
|
15599 | var _classnames = __webpack_require__(5);
|
15600 |
|
15601 | var _classnames2 = _interopRequireDefault(_classnames);
|
15602 |
|
15603 | var _react = __webpack_require__(1);
|
15604 |
|
15605 | var _react2 = _interopRequireDefault(_react);
|
15606 |
|
15607 | var _propTypes = __webpack_require__(6);
|
15608 |
|
15609 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
15610 |
|
15611 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15612 |
|
15613 | 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; }
|
15614 |
|
15615 | 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; }
|
15616 |
|
15617 | 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; }
|
15618 |
|
15619 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15620 |
|
15621 | 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; }
|
15622 |
|
15623 | 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); }
|
15624 |
|
15625 | var propTypes = {
|
15626 | |
15627 |
|
15628 |
|
15629 | dialogClassName: _propTypes2["default"].string,
|
15630 | contentStyle: _propTypes2["default"].object
|
15631 |
|
15632 | };
|
15633 |
|
15634 | var defaultProps = {
|
15635 | clsPrefix: 'u-modal'
|
15636 | };
|
15637 |
|
15638 | var ModalDialog = function (_React$Component) {
|
15639 | _inherits(ModalDialog, _React$Component);
|
15640 |
|
15641 | function ModalDialog() {
|
15642 | _classCallCheck(this, ModalDialog);
|
15643 |
|
15644 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15645 | }
|
15646 |
|
15647 | ModalDialog.prototype.render = function render() {
|
15648 | var _dialogClasses;
|
15649 |
|
15650 | var _props = this.props,
|
15651 | dialogClassName = _props.dialogClassName,
|
15652 | className = _props.className,
|
15653 | clsPrefix = _props.clsPrefix,
|
15654 | size = _props.size,
|
15655 | style = _props.style,
|
15656 | contentStyle = _props.contentStyle,
|
15657 | children = _props.children,
|
15658 | props = _objectWithoutProperties(_props, ['dialogClassName', 'className', 'clsPrefix', 'size', 'style', 'contentStyle', 'children']);
|
15659 |
|
15660 |
|
15661 |
|
15662 |
|
15663 | var uClassName = _defineProperty({}, '' + clsPrefix, true);
|
15664 |
|
15665 | var modalStyle = { display: 'block' };
|
15666 |
|
15667 | var dialogClasses = (_dialogClasses = {}, _defineProperty(_dialogClasses, uClassName, false), _defineProperty(_dialogClasses, clsPrefix + '-dialog', true), _dialogClasses);
|
15668 | if (size) {
|
15669 | dialogClasses[clsPrefix + '-' + size] = true;
|
15670 | }
|
15671 |
|
15672 | return _react2["default"].createElement(
|
15673 | 'div',
|
15674 | _extends({}, props, {
|
15675 | tabIndex: '-1',
|
15676 | role: 'dialog',
|
15677 | style: modalStyle,
|
15678 | className: (0, _classnames2["default"])(className, uClassName)
|
15679 | }),
|
15680 | _react2["default"].createElement(
|
15681 | 'div',
|
15682 | { className: (0, _classnames2["default"])(dialogClassName, dialogClasses), style: style },
|
15683 | _react2["default"].createElement(
|
15684 | 'div',
|
15685 | { style: contentStyle, className: (0, _classnames2["default"])([clsPrefix + '-content']), role: 'document' },
|
15686 | children
|
15687 | )
|
15688 | )
|
15689 | );
|
15690 | };
|
15691 |
|
15692 | return ModalDialog;
|
15693 | }(_react2["default"].Component);
|
15694 |
|
15695 | ModalDialog.propTypes = propTypes;
|
15696 | ModalDialog.defaultProps = defaultProps;
|
15697 |
|
15698 | exports["default"] = ModalDialog;
|
15699 | module.exports = exports['default'];
|
15700 |
|
15701 | }),
|
15702 |
|
15703 | (function(module, exports, __webpack_require__) {
|
15704 |
|
15705 | 'use strict';
|
15706 |
|
15707 | Object.defineProperty(exports, "__esModule", {
|
15708 | value: true
|
15709 | });
|
15710 |
|
15711 | 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; };
|
15712 |
|
15713 | var _classnames = __webpack_require__(5);
|
15714 |
|
15715 | var _classnames2 = _interopRequireDefault(_classnames);
|
15716 |
|
15717 | var _react = __webpack_require__(1);
|
15718 |
|
15719 | var _react2 = _interopRequireDefault(_react);
|
15720 |
|
15721 | var _tinperBeeCore = __webpack_require__(27);
|
15722 |
|
15723 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15724 |
|
15725 | 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; }
|
15726 |
|
15727 | 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; }
|
15728 |
|
15729 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15730 |
|
15731 | 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; }
|
15732 |
|
15733 | 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); }
|
15734 |
|
15735 | var propTypes = {
|
15736 | componentClass: _tinperBeeCore.elementType
|
15737 | };
|
15738 |
|
15739 | var defaultProps = {
|
15740 | componentClass: 'div',
|
15741 | clsPrefix: 'u-modal-footer'
|
15742 | };
|
15743 |
|
15744 | var ModalFooter = function (_React$Component) {
|
15745 | _inherits(ModalFooter, _React$Component);
|
15746 |
|
15747 | function ModalFooter() {
|
15748 | _classCallCheck(this, ModalFooter);
|
15749 |
|
15750 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15751 | }
|
15752 |
|
15753 | ModalFooter.prototype.render = function render() {
|
15754 | var _props = this.props,
|
15755 | Component = _props.componentClass,
|
15756 | clsPrefix = _props.clsPrefix,
|
15757 | className = _props.className,
|
15758 | props = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
|
15759 |
|
15760 | var classes = {};
|
15761 | classes['' + clsPrefix] = true;
|
15762 |
|
15763 | return _react2["default"].createElement(Component, _extends({}, props, {
|
15764 | className: (0, _classnames2["default"])(className, classes)
|
15765 | }));
|
15766 | };
|
15767 |
|
15768 | return ModalFooter;
|
15769 | }(_react2["default"].Component);
|
15770 |
|
15771 | ModalFooter.propTypes = propTypes;
|
15772 | ModalFooter.defaultProps = defaultProps;
|
15773 |
|
15774 | exports["default"] = ModalFooter;
|
15775 | module.exports = exports['default'];
|
15776 |
|
15777 | }),
|
15778 |
|
15779 | (function(module, exports, __webpack_require__) {
|
15780 |
|
15781 | 'use strict';
|
15782 |
|
15783 | Object.defineProperty(exports, "__esModule", {
|
15784 | value: true
|
15785 | });
|
15786 |
|
15787 | 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; };
|
15788 |
|
15789 | var _classnames = __webpack_require__(5);
|
15790 |
|
15791 | var _classnames2 = _interopRequireDefault(_classnames);
|
15792 |
|
15793 | var _react = __webpack_require__(1);
|
15794 |
|
15795 | var _react2 = _interopRequireDefault(_react);
|
15796 |
|
15797 | var _propTypes = __webpack_require__(6);
|
15798 |
|
15799 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
15800 |
|
15801 | var _tinperBeeCore = __webpack_require__(27);
|
15802 |
|
15803 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15804 |
|
15805 | 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; }
|
15806 |
|
15807 | 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; }
|
15808 |
|
15809 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15810 |
|
15811 | 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; }
|
15812 |
|
15813 | 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); }
|
15814 |
|
15815 | var propTypes = {
|
15816 |
|
15817 | |
15818 |
|
15819 |
|
15820 | closeButton: _propTypes2["default"].bool,
|
15821 |
|
15822 | |
15823 |
|
15824 |
|
15825 | onHide: _propTypes2["default"].func
|
15826 | };
|
15827 |
|
15828 | var defaultProps = {
|
15829 | 'aria-label': 'Close',
|
15830 | closeButton: false,
|
15831 | clsPrefix: 'u-modal-header'
|
15832 | };
|
15833 |
|
15834 | var contextTypes = {
|
15835 | $u_modal: _propTypes2["default"].shape({
|
15836 | onHide: _propTypes2["default"].func
|
15837 | })
|
15838 | };
|
15839 |
|
15840 | var ModalHeader = function (_React$Component) {
|
15841 | _inherits(ModalHeader, _React$Component);
|
15842 |
|
15843 | function ModalHeader() {
|
15844 | _classCallCheck(this, ModalHeader);
|
15845 |
|
15846 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15847 | }
|
15848 |
|
15849 | ModalHeader.prototype.render = function render() {
|
15850 | var _props = this.props,
|
15851 | label = _props['aria-label'],
|
15852 | closeButton = _props.closeButton,
|
15853 | onHide = _props.onHide,
|
15854 | className = _props.className,
|
15855 | clsPrefix = _props.clsPrefix,
|
15856 | children = _props.children,
|
15857 | props = _objectWithoutProperties(_props, ['aria-label', 'closeButton', 'onHide', 'className', 'clsPrefix', 'children']);
|
15858 |
|
15859 | var modal = this.context.$u_modal;
|
15860 |
|
15861 | var classes = {};
|
15862 | classes['' + clsPrefix] = true;
|
15863 |
|
15864 | return _react2["default"].createElement(
|
15865 | 'div',
|
15866 | _extends({}, props, {
|
15867 | className: (0, _classnames2["default"])(className, classes)
|
15868 | }),
|
15869 | closeButton && _react2["default"].createElement(
|
15870 | 'button',
|
15871 | {
|
15872 | type: 'button',
|
15873 | className: 'u-close',
|
15874 | 'aria-label': label,
|
15875 | onClick: (0, _tinperBeeCore.createChainedFunction)(modal.onHide, onHide)
|
15876 | },
|
15877 | _react2["default"].createElement(
|
15878 | 'span',
|
15879 | { 'aria-hidden': 'true' },
|
15880 | _react2["default"].createElement('i', { className: 'uf uf-close' })
|
15881 | )
|
15882 | ),
|
15883 | children
|
15884 | );
|
15885 | };
|
15886 |
|
15887 | return ModalHeader;
|
15888 | }(_react2["default"].Component);
|
15889 |
|
15890 | ModalHeader.propTypes = propTypes;
|
15891 | ModalHeader.defaultProps = defaultProps;
|
15892 | ModalHeader.contextTypes = contextTypes;
|
15893 |
|
15894 | exports["default"] = ModalHeader;
|
15895 | module.exports = exports['default'];
|
15896 |
|
15897 | }),
|
15898 |
|
15899 | (function(module, exports, __webpack_require__) {
|
15900 |
|
15901 | 'use strict';
|
15902 |
|
15903 | Object.defineProperty(exports, "__esModule", {
|
15904 | value: true
|
15905 | });
|
15906 |
|
15907 | 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; };
|
15908 |
|
15909 | var _classnames = __webpack_require__(5);
|
15910 |
|
15911 | var _classnames2 = _interopRequireDefault(_classnames);
|
15912 |
|
15913 | var _react = __webpack_require__(1);
|
15914 |
|
15915 | var _react2 = _interopRequireDefault(_react);
|
15916 |
|
15917 | var _tinperBeeCore = __webpack_require__(27);
|
15918 |
|
15919 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15920 |
|
15921 | 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; }
|
15922 |
|
15923 | 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; }
|
15924 |
|
15925 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15926 |
|
15927 | 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; }
|
15928 |
|
15929 | 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); }
|
15930 |
|
15931 | var propTypes = {
|
15932 | componentClass: _tinperBeeCore.elementType
|
15933 | };
|
15934 |
|
15935 | var defaultProps = {
|
15936 | componentClass: 'h4',
|
15937 | clsPrefix: 'u-modal-title'
|
15938 | };
|
15939 |
|
15940 | var ModalTitle = function (_React$Component) {
|
15941 | _inherits(ModalTitle, _React$Component);
|
15942 |
|
15943 | function ModalTitle() {
|
15944 | _classCallCheck(this, ModalTitle);
|
15945 |
|
15946 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15947 | }
|
15948 |
|
15949 | ModalTitle.prototype.render = function render() {
|
15950 | var _props = this.props,
|
15951 | Component = _props.componentClass,
|
15952 | className = _props.className,
|
15953 | clsPrefix = _props.clsPrefix,
|
15954 | props = _objectWithoutProperties(_props, ['componentClass', 'className', 'clsPrefix']);
|
15955 |
|
15956 | var classes = {};
|
15957 | classes['' + clsPrefix] = true;
|
15958 |
|
15959 | return _react2["default"].createElement(Component, _extends({}, props, {
|
15960 | className: (0, _classnames2["default"])(className, classes)
|
15961 | }));
|
15962 | };
|
15963 |
|
15964 | return ModalTitle;
|
15965 | }(_react2["default"].Component);
|
15966 |
|
15967 | ModalTitle.propTypes = propTypes;
|
15968 | ModalTitle.defaultProps = defaultProps;
|
15969 |
|
15970 | exports["default"] = ModalTitle;
|
15971 | module.exports = exports['default'];
|
15972 |
|
15973 | }),
|
15974 |
|
15975 | (function(module, exports, __webpack_require__) {
|
15976 |
|
15977 | 'use strict';
|
15978 |
|
15979 | Object.defineProperty(exports, "__esModule", {
|
15980 | value: true
|
15981 | });
|
15982 |
|
15983 | var _FormControl = __webpack_require__(154);
|
15984 |
|
15985 | var _FormControl2 = _interopRequireDefault(_FormControl);
|
15986 |
|
15987 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15988 |
|
15989 | exports["default"] = _FormControl2["default"];
|
15990 | module.exports = exports['default'];
|
15991 |
|
15992 | }),
|
15993 |
|
15994 | (function(module, exports, __webpack_require__) {
|
15995 |
|
15996 | 'use strict';
|
15997 |
|
15998 | Object.defineProperty(exports, "__esModule", {
|
15999 | value: true
|
16000 | });
|
16001 |
|
16002 | 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; };
|
16003 |
|
16004 | var _react = __webpack_require__(1);
|
16005 |
|
16006 | var _react2 = _interopRequireDefault(_react);
|
16007 |
|
16008 | var _classnames = __webpack_require__(5);
|
16009 |
|
16010 | var _classnames2 = _interopRequireDefault(_classnames);
|
16011 |
|
16012 | var _beeIcon = __webpack_require__(79);
|
16013 |
|
16014 | var _beeIcon2 = _interopRequireDefault(_beeIcon);
|
16015 |
|
16016 | var _propTypes = __webpack_require__(6);
|
16017 |
|
16018 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16019 |
|
16020 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
16021 |
|
16022 | 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; }
|
16023 |
|
16024 | 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; }
|
16025 |
|
16026 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16027 |
|
16028 | 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; }
|
16029 |
|
16030 | 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); }
|
16031 |
|
16032 | var propTypes = {
|
16033 | componentClass: _propTypes2["default"].oneOfType([_propTypes2["default"].element, _propTypes2["default"].string]),
|
16034 | type: _propTypes2["default"].string,
|
16035 | size: _propTypes2["default"].oneOf(['sm', 'md', 'lg']),
|
16036 | onSearch: _propTypes2["default"].func,
|
16037 | onChange: _propTypes2["default"].func,
|
16038 | onBlur: _propTypes2["default"].func,
|
16039 | showClose: _propTypes2["default"].bool,
|
16040 | focusSelect: _propTypes2["default"].bool
|
16041 | };
|
16042 |
|
16043 | var defaultProps = {
|
16044 | componentClass: 'input',
|
16045 | clsPrefix: 'u-form-control',
|
16046 | type: 'text',
|
16047 | size: 'md'
|
16048 | };
|
16049 |
|
16050 | var FormControl = function (_React$Component) {
|
16051 | _inherits(FormControl, _React$Component);
|
16052 |
|
16053 | function FormControl(props) {
|
16054 | _classCallCheck(this, FormControl);
|
16055 |
|
16056 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
16057 |
|
16058 | _this.handleSearchChange = function (e) {
|
16059 | var onChange = _this.props.onChange;
|
16060 |
|
16061 | var value = _this.input.value;
|
16062 | _this.setState({
|
16063 | value: value,
|
16064 | showSearch: value == null || value === ""
|
16065 | });
|
16066 | if (onChange) {
|
16067 | onChange(value, e);
|
16068 | }
|
16069 | };
|
16070 |
|
16071 | _this.handleChange = function (e) {
|
16072 | var onChange = _this.props.onChange;
|
16073 |
|
16074 | var value = _this.input.value;
|
16075 | _this.setState({
|
16076 | showClose: true
|
16077 | });
|
16078 | if (onChange) {
|
16079 | onChange(value, e);
|
16080 | }
|
16081 | };
|
16082 |
|
16083 | _this.clearValue = function () {
|
16084 | var onChange = _this.props.onChange;
|
16085 |
|
16086 | _this.setState({
|
16087 | showSearch: true,
|
16088 | value: "",
|
16089 | showClose: false
|
16090 | });
|
16091 | if (onChange) {
|
16092 | onChange("");
|
16093 | }
|
16094 | _this.input.focus();
|
16095 | };
|
16096 |
|
16097 | _this.handleKeyDown = function (e) {
|
16098 | var _this$props = _this.props,
|
16099 | onSearch = _this$props.onSearch,
|
16100 | type = _this$props.type;
|
16101 |
|
16102 | if (e.keyCode === 13 && type === "search") {
|
16103 | if (onSearch) {
|
16104 | onSearch(_this.input.value);
|
16105 | }
|
16106 | }
|
16107 | };
|
16108 |
|
16109 | _this.handleSearch = function (e) {
|
16110 | var onSearch = _this.props.onSearch;
|
16111 |
|
16112 | if (onSearch) onSearch(_this.input.value);
|
16113 | };
|
16114 |
|
16115 | _this.handleBlur = function (e) {
|
16116 | var value = _this.state.value;
|
16117 | var onBlur = _this.props.onBlur;
|
16118 |
|
16119 |
|
16120 | if (onBlur) {
|
16121 | onBlur(value, e);
|
16122 | }
|
16123 | };
|
16124 |
|
16125 | _this.handleFocus = function (e) {
|
16126 | var value = _this.state.value;
|
16127 | var onFocus = _this.props.onFocus;
|
16128 |
|
16129 | if (_this.props.focusSelect) {
|
16130 | _this.input.select();
|
16131 | }
|
16132 | if (onFocus) {
|
16133 | onFocus(value, e);
|
16134 | }
|
16135 | };
|
16136 |
|
16137 | _this.renderInput = function () {
|
16138 | var _this$props2 = _this.props,
|
16139 | Component = _this$props2.componentClass,
|
16140 | type = _this$props2.type,
|
16141 | className = _this$props2.className,
|
16142 | size = _this$props2.size,
|
16143 | clsPrefix = _this$props2.clsPrefix,
|
16144 | value = _this$props2.value,
|
16145 | onChange = _this$props2.onChange,
|
16146 | onSearch = _this$props2.onSearch,
|
16147 | onBlur = _this$props2.onBlur,
|
16148 | showClose = _this$props2.showClose,
|
16149 | focusSelect = _this$props2.focusSelect,
|
16150 | others = _objectWithoutProperties(_this$props2, ['componentClass', 'type', 'className', 'size', 'clsPrefix', 'value', 'onChange', 'onSearch', 'onBlur', 'showClose', 'focusSelect']);
|
16151 |
|
16152 |
|
16153 |
|
16154 | var classes = {};
|
16155 | if (size) {
|
16156 | classes['' + size] = true;
|
16157 | }
|
16158 |
|
16159 | var classNames = void 0;
|
16160 | if (type !== 'file') {
|
16161 | classNames = (0, _classnames2["default"])(clsPrefix, classes);
|
16162 | }
|
16163 |
|
16164 | return showClose ? _react2["default"].createElement(
|
16165 | 'div',
|
16166 | { className: (0, _classnames2["default"])(clsPrefix + '-close', clsPrefix + '-affix-wrapper', className) },
|
16167 | _react2["default"].createElement(Component, _extends({}, others, {
|
16168 | type: type,
|
16169 | ref: function ref(el) {
|
16170 | return _this.input = el;
|
16171 | },
|
16172 | value: value,
|
16173 | onChange: _this.handleChange,
|
16174 | onBlur: _this.handleBlur,
|
16175 | onFocus: _this.handleFocus,
|
16176 | className: (0, _classnames2["default"])(className, classNames)
|
16177 | })),
|
16178 | _react2["default"].createElement(
|
16179 | 'div',
|
16180 | { className: clsPrefix + '-suffix' },
|
16181 | _this.state.showClose ? _react2["default"].createElement(_beeIcon2["default"], { onClick: _this.clearValue, type: 'uf-close-c' }) : ''
|
16182 | )
|
16183 | ) : _react2["default"].createElement(Component, _extends({}, others, {
|
16184 | type: type,
|
16185 | ref: function ref(el) {
|
16186 | return _this.input = el;
|
16187 | },
|
16188 | value: value,
|
16189 | onChange: _this.handleChange,
|
16190 | onBlur: _this.handleBlur,
|
16191 | onFocus: _this.handleFocus,
|
16192 | className: (0, _classnames2["default"])(className, classNames)
|
16193 | }));
|
16194 | };
|
16195 |
|
16196 | _this.renderSearch = function () {
|
16197 | var _this$props3 = _this.props,
|
16198 | Component = _this$props3.componentClass,
|
16199 | type = _this$props3.type,
|
16200 | className = _this$props3.className,
|
16201 | size = _this$props3.size,
|
16202 | clsPrefix = _this$props3.clsPrefix,
|
16203 | value = _this$props3.value,
|
16204 | onChange = _this$props3.onChange,
|
16205 | onSearch = _this$props3.onSearch,
|
16206 | onBlur = _this$props3.onBlur,
|
16207 | others = _objectWithoutProperties(_this$props3, ['componentClass', 'type', 'className', 'size', 'clsPrefix', 'value', 'onChange', 'onSearch', 'onBlur']);
|
16208 |
|
16209 |
|
16210 |
|
16211 | var classes = {};
|
16212 | if (size) {
|
16213 | classes['' + size] = true;
|
16214 | }
|
16215 | classes[clsPrefix + '-search'] = true;
|
16216 |
|
16217 | if (type === "search") {
|
16218 | return _react2["default"].createElement(
|
16219 | 'div',
|
16220 | { className: (0, _classnames2["default"])(clsPrefix + '-search', clsPrefix + '-affix-wrapper', className) },
|
16221 | _react2["default"].createElement(Component, _extends({}, others, {
|
16222 | type: type,
|
16223 | ref: function ref(el) {
|
16224 | return _this.input = el;
|
16225 | },
|
16226 | onChange: _this.handleSearchChange,
|
16227 | value: value,
|
16228 | onKeyDown: _this.handleKeyDown,
|
16229 | onBlur: _this.handleBlur,
|
16230 | onFocus: _this.handleFocus,
|
16231 | className: (0, _classnames2["default"])(className, clsPrefix, classes)
|
16232 | })),
|
16233 | _react2["default"].createElement(
|
16234 | 'div',
|
16235 | { className: clsPrefix + '-suffix' },
|
16236 | _react2["default"].createElement(_beeIcon2["default"], { type: 'uf-search', onClick: _this.handleSearch })
|
16237 | )
|
16238 | );
|
16239 | }
|
16240 | };
|
16241 |
|
16242 | _this.state = {
|
16243 | showSearch: !props.value,
|
16244 | value: props.value == null ? "" : props.value,
|
16245 | showClose: false
|
16246 | };
|
16247 | _this.input = {};
|
16248 | return _this;
|
16249 | }
|
16250 |
|
16251 | FormControl.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProp) {
|
16252 | if (nextProp.value !== this.state.value) {
|
16253 | this.setState({ value: nextProp.value });
|
16254 | }
|
16255 | };
|
16256 |
|
16257 | FormControl.prototype.render = function render() {
|
16258 |
|
16259 | if (this.props.type === "search") {
|
16260 | return this.renderSearch();
|
16261 | }
|
16262 |
|
16263 | return this.renderInput();
|
16264 | };
|
16265 |
|
16266 | return FormControl;
|
16267 | }(_react2["default"].Component);
|
16268 |
|
16269 | FormControl.propTypes = propTypes;
|
16270 | FormControl.defaultProps = defaultProps;
|
16271 |
|
16272 | exports["default"] = FormControl;
|
16273 | module.exports = exports['default'];
|
16274 |
|
16275 | }),
|
16276 |
|
16277 | (function(module, exports, __webpack_require__) {
|
16278 |
|
16279 | 'use strict';
|
16280 |
|
16281 | Object.defineProperty(exports, "__esModule", {
|
16282 | value: true
|
16283 | });
|
16284 |
|
16285 | var _Button = __webpack_require__(156);
|
16286 |
|
16287 | var _Button2 = _interopRequireDefault(_Button);
|
16288 |
|
16289 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
16290 |
|
16291 | exports["default"] = _Button2["default"];
|
16292 | module.exports = exports['default'];
|
16293 |
|
16294 | }),
|
16295 |
|
16296 | (function(module, exports, __webpack_require__) {
|
16297 |
|
16298 | 'use strict';
|
16299 |
|
16300 | Object.defineProperty(exports, "__esModule", {
|
16301 | value: true
|
16302 | });
|
16303 |
|
16304 | 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; };
|
16305 |
|
16306 | var _react = __webpack_require__(1);
|
16307 |
|
16308 | var _react2 = _interopRequireDefault(_react);
|
16309 |
|
16310 | var _reactDom = __webpack_require__(2);
|
16311 |
|
16312 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
16313 |
|
16314 | var _propTypes = __webpack_require__(6);
|
16315 |
|
16316 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16317 |
|
16318 | var _classnames = __webpack_require__(5);
|
16319 |
|
16320 | var _classnames2 = _interopRequireDefault(_classnames);
|
16321 |
|
16322 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
16323 |
|
16324 | 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; }
|
16325 |
|
16326 | 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; }
|
16327 |
|
16328 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16329 |
|
16330 | 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; }
|
16331 |
|
16332 | 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); }
|
16333 |
|
16334 | var propTypes = {
|
16335 | |
16336 |
|
16337 |
|
16338 | size: _propTypes2["default"].oneOf(['sm', 'md', 'xg', 'lg']),
|
16339 | |
16340 |
|
16341 |
|
16342 | style: _propTypes2["default"].object,
|
16343 | |
16344 |
|
16345 |
|
16346 | shape: _propTypes2["default"].oneOf(['block', 'round', 'border', 'squared', 'floating', 'pillRight', 'pillLeft', 'icon']),
|
16347 |
|
16348 | bordered: _propTypes2["default"].bool,
|
16349 | |
16350 |
|
16351 |
|
16352 | colors: _propTypes2["default"].oneOf(['primary', 'secondary', 'accent', 'success', 'info', 'warning', 'danger', 'dark', 'light', 'default']),
|
16353 | |
16354 |
|
16355 |
|
16356 |
|
16357 | disabled: _propTypes2["default"].bool,
|
16358 | |
16359 |
|
16360 |
|
16361 |
|
16362 | className: _propTypes2["default"].string,
|
16363 |
|
16364 | |
16365 |
|
16366 |
|
16367 |
|
16368 | htmlType: _propTypes2["default"].oneOf(['submit', 'button', 'reset']),
|
16369 | isSubmit: _propTypes2["default"].bool
|
16370 | };
|
16371 |
|
16372 | var defaultProps = {
|
16373 | disabled: false,
|
16374 | htmlType: 'button',
|
16375 | clsPrefix: 'u-button',
|
16376 | bordered: false,
|
16377 | isSubmit: false
|
16378 | };
|
16379 |
|
16380 | var sizeMap = {
|
16381 | sm: 'sm',
|
16382 | md: 'md',
|
16383 | xg: 'xg',
|
16384 | lg: 'lg'
|
16385 | },
|
16386 | colorsMap = {
|
16387 | primary: 'primary',
|
16388 | secondary: 'secondary',
|
16389 | accent: 'accent',
|
16390 | success: 'success',
|
16391 | info: 'info',
|
16392 | warning: 'warning',
|
16393 | danger: 'danger',
|
16394 | dark: 'dark',
|
16395 | light: 'light'
|
16396 | },
|
16397 | shapeMap = {
|
16398 | block: 'block',
|
16399 | round: 'round',
|
16400 | border: 'border',
|
16401 | squared: 'squared',
|
16402 | floating: 'floating',
|
16403 | pillRight: 'pill-right',
|
16404 | pillLeft: 'pill-left',
|
16405 | icon: 'icon'
|
16406 | };
|
16407 |
|
16408 | var Button = function (_Component) {
|
16409 | _inherits(Button, _Component);
|
16410 |
|
16411 | function Button(props) {
|
16412 | _classCallCheck(this, Button);
|
16413 |
|
16414 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
16415 | }
|
16416 |
|
16417 | Button.prototype.render = function render() {
|
16418 | var _props = this.props,
|
16419 | colors = _props.colors,
|
16420 | shape = _props.shape,
|
16421 | disabled = _props.disabled,
|
16422 | className = _props.className,
|
16423 | size = _props.size,
|
16424 | bordered = _props.bordered,
|
16425 | children = _props.children,
|
16426 | htmlType = _props.htmlType,
|
16427 | clsPrefix = _props.clsPrefix,
|
16428 | isSubmit = _props.isSubmit,
|
16429 | others = _objectWithoutProperties(_props, ['colors', 'shape', 'disabled', 'className', 'size', 'bordered', 'children', 'htmlType', 'clsPrefix', 'isSubmit']);
|
16430 |
|
16431 | var clsObj = {};
|
16432 | if (className) {
|
16433 | clsObj[className] = true;
|
16434 | }
|
16435 | if (sizeMap[size]) {
|
16436 | clsObj[clsPrefix + '-' + sizeMap[size]] = true;
|
16437 | }
|
16438 |
|
16439 | if (shapeMap[shape]) {
|
16440 | clsObj[clsPrefix + '-' + shapeMap[shape]] = true;
|
16441 | }
|
16442 | if (colorsMap[colors]) {
|
16443 | clsObj[clsPrefix + '-' + colorsMap[colors]] = true;
|
16444 | }
|
16445 | if (bordered) {
|
16446 | clsObj[clsPrefix + '-border'] = bordered;
|
16447 | }
|
16448 | var classes = (0, _classnames2["default"])(clsPrefix, clsObj);
|
16449 | return _react2["default"].createElement(
|
16450 | 'button',
|
16451 | _extends({
|
16452 | type: htmlType,
|
16453 | className: classes,
|
16454 | disabled: disabled
|
16455 | }, others),
|
16456 | this.props.children
|
16457 | );
|
16458 | };
|
16459 |
|
16460 | return Button;
|
16461 | }(_react.Component);
|
16462 |
|
16463 | Button.propTypes = propTypes;
|
16464 | Button.defaultProps = defaultProps;
|
16465 |
|
16466 | exports["default"] = Button;
|
16467 | module.exports = exports['default'];
|
16468 |
|
16469 | }),
|
16470 |
|
16471 | (function(module, exports, __webpack_require__) {
|
16472 |
|
16473 | 'use strict';
|
16474 |
|
16475 | Object.defineProperty(exports, "__esModule", {
|
16476 | value: true
|
16477 | });
|
16478 |
|
16479 | var _Checkbox = __webpack_require__(158);
|
16480 |
|
16481 | var _Checkbox2 = _interopRequireDefault(_Checkbox);
|
16482 |
|
16483 | var _CheckboxGroup = __webpack_require__(159);
|
16484 |
|
16485 | var _CheckboxGroup2 = _interopRequireDefault(_CheckboxGroup);
|
16486 |
|
16487 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16488 |
|
16489 | _Checkbox2['default'].CheckboxGroup = _CheckboxGroup2['default'];
|
16490 | exports['default'] = _Checkbox2['default'];
|
16491 | module.exports = exports['default'];
|
16492 |
|
16493 | }),
|
16494 |
|
16495 | (function(module, exports, __webpack_require__) {
|
16496 |
|
16497 | 'use strict';
|
16498 |
|
16499 | Object.defineProperty(exports, "__esModule", {
|
16500 | value: true
|
16501 | });
|
16502 |
|
16503 | 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; };
|
16504 |
|
16505 | var _classnames = __webpack_require__(5);
|
16506 |
|
16507 | var _classnames2 = _interopRequireDefault(_classnames);
|
16508 |
|
16509 | var _react = __webpack_require__(1);
|
16510 |
|
16511 | var _react2 = _interopRequireDefault(_react);
|
16512 |
|
16513 | var _propTypes = __webpack_require__(6);
|
16514 |
|
16515 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16516 |
|
16517 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16518 |
|
16519 | 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; }
|
16520 |
|
16521 | 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; }
|
16522 |
|
16523 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16524 |
|
16525 | 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; }
|
16526 |
|
16527 | 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); }
|
16528 |
|
16529 | var propTypes = {
|
16530 |
|
16531 | colors: _propTypes2['default'].oneOf(['', 'dark', 'success', 'info', 'warning', 'danger', 'primary']),
|
16532 |
|
16533 | disabled: _propTypes2['default'].bool,
|
16534 |
|
16535 | inverse: _propTypes2['default'].bool
|
16536 |
|
16537 | };
|
16538 |
|
16539 | var defaultProps = {
|
16540 | disabled: false,
|
16541 | inverse: false,
|
16542 | colors: 'primary',
|
16543 | clsPrefix: 'u-checkbox',
|
16544 | defaultChecked: false,
|
16545 | onClick: function onClick() {}
|
16546 | };
|
16547 | var clsPrefix = 'u-checkbox';
|
16548 |
|
16549 | var Checkbox = function (_React$Component) {
|
16550 | _inherits(Checkbox, _React$Component);
|
16551 |
|
16552 | function Checkbox(props) {
|
16553 | _classCallCheck(this, Checkbox);
|
16554 |
|
16555 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
16556 |
|
16557 | _initialiseProps.call(_this);
|
16558 |
|
16559 | _this.state = {
|
16560 | checked: 'checked' in props ? props.checked : props.defaultChecked
|
16561 | };
|
16562 | _this.doubleClickFlag = null;
|
16563 | return _this;
|
16564 | }
|
16565 |
|
16566 | Checkbox.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
16567 | if ('checked' in nextProps) {
|
16568 | this.setState({
|
16569 | checked: nextProps.checked
|
16570 | });
|
16571 | }
|
16572 | };
|
16573 |
|
16574 | Checkbox.prototype.render = function render() {
|
16575 | var _props = this.props,
|
16576 | disabled = _props.disabled,
|
16577 | inverse = _props.inverse,
|
16578 | colors = _props.colors,
|
16579 | size = _props.size,
|
16580 | className = _props.className,
|
16581 | indeterminate = _props.indeterminate,
|
16582 | onClick = _props.onClick,
|
16583 | children = _props.children,
|
16584 | checked = _props.checked,
|
16585 | clsPrefix = _props.clsPrefix,
|
16586 | onDoubleClick = _props.onDoubleClick,
|
16587 | onChange = _props.onChange,
|
16588 | others = _objectWithoutProperties(_props, ['disabled', 'inverse', 'colors', 'size', 'className', 'indeterminate', 'onClick', 'children', 'checked', 'clsPrefix', 'onDoubleClick', 'onChange']);
|
16589 |
|
16590 | var input = _react2['default'].createElement('input', _extends({}, others, {
|
16591 | type: 'checkbox',
|
16592 | disabled: this.props.disabled
|
16593 | }));
|
16594 |
|
16595 | var classes = {
|
16596 | 'is-checked': this.state.checked,
|
16597 | disabled: disabled
|
16598 | };
|
16599 |
|
16600 | if (inverse) {
|
16601 | classes[clsPrefix + '-inverse'] = true;
|
16602 | }
|
16603 |
|
16604 | if (colors) {
|
16605 | classes[clsPrefix + '-' + colors] = true;
|
16606 | }
|
16607 |
|
16608 | if (size) {
|
16609 | classes[clsPrefix + '-' + size] = true;
|
16610 | }
|
16611 |
|
16612 | if (!checked && indeterminate) {
|
16613 | classes[clsPrefix + '-indeterminate'] = true;
|
16614 | }
|
16615 |
|
16616 | var classNames = (0, _classnames2['default'])(clsPrefix, classes);
|
16617 |
|
16618 | return _react2['default'].createElement(
|
16619 | 'label',
|
16620 | {
|
16621 | className: (0, _classnames2['default'])(classNames, className),
|
16622 | onDoubleClick: this.handledbClick,
|
16623 | onClick: this.changeState },
|
16624 | input,
|
16625 | _react2['default'].createElement(
|
16626 | 'label',
|
16627 | { className: clsPrefix + '-label' },
|
16628 | children
|
16629 | )
|
16630 | );
|
16631 | };
|
16632 |
|
16633 | return Checkbox;
|
16634 | }(_react2['default'].Component);
|
16635 |
|
16636 | var _initialiseProps = function _initialiseProps() {
|
16637 | var _this2 = this;
|
16638 |
|
16639 | this.changeState = function (e) {
|
16640 | var props = _this2.props;
|
16641 | var checked = _this2.state.checked;
|
16642 |
|
16643 | clearTimeout(_this2.doubleClickFlag);
|
16644 | if (props.onClick instanceof Function) {
|
16645 | props.onClick(e);
|
16646 | }
|
16647 | if (props.onDoubleClick instanceof Function) {
|
16648 | _this2.doubleClickFlag = setTimeout(function () {
|
16649 |
|
16650 | _this2.change(props, checked);
|
16651 | }, 300);
|
16652 | } else {
|
16653 | _this2.change(props, checked);
|
16654 | }
|
16655 | e.stopPropagation();
|
16656 | e.preventDefault();
|
16657 |
|
16658 | };
|
16659 |
|
16660 | this.change = function (props, checked) {
|
16661 | if (props.disabled) {
|
16662 | return;
|
16663 | }
|
16664 | if (!('checked' in props)) {
|
16665 | _this2.setState({
|
16666 | checked: !checked
|
16667 | });
|
16668 | }
|
16669 |
|
16670 | if (props.onChange instanceof Function) {
|
16671 | props.onChange(!checked);
|
16672 | }
|
16673 | };
|
16674 |
|
16675 | this.handledbClick = function (e) {
|
16676 | var onDoubleClick = _this2.props.onDoubleClick;
|
16677 |
|
16678 | clearTimeout(_this2.doubleClickFlag);
|
16679 | onDoubleClick && onDoubleClick(_this2.state.checked, e);
|
16680 | };
|
16681 | };
|
16682 |
|
16683 | Checkbox.propTypes = propTypes;
|
16684 | Checkbox.defaultProps = defaultProps;
|
16685 |
|
16686 | exports['default'] = Checkbox;
|
16687 | module.exports = exports['default'];
|
16688 |
|
16689 | }),
|
16690 |
|
16691 | (function(module, exports, __webpack_require__) {
|
16692 |
|
16693 | 'use strict';
|
16694 |
|
16695 | Object.defineProperty(exports, "__esModule", {
|
16696 | value: true
|
16697 | });
|
16698 |
|
16699 | var _react = __webpack_require__(1);
|
16700 |
|
16701 | var _react2 = _interopRequireDefault(_react);
|
16702 |
|
16703 | var _propTypes = __webpack_require__(6);
|
16704 |
|
16705 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
16706 |
|
16707 | var _Checkbox = __webpack_require__(158);
|
16708 |
|
16709 | var _Checkbox2 = _interopRequireDefault(_Checkbox);
|
16710 |
|
16711 | var _lodash = __webpack_require__(160);
|
16712 |
|
16713 | var _lodash2 = _interopRequireDefault(_lodash);
|
16714 |
|
16715 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16716 |
|
16717 | 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; }
|
16718 |
|
16719 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16720 |
|
16721 | 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; }
|
16722 |
|
16723 | 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); }
|
16724 |
|
16725 | var propTypes = {
|
16726 | clsPrefix: _propTypes2['default'].string,
|
16727 | value: _propTypes2['default'].array,
|
16728 | onChange: _propTypes2['default'].func,
|
16729 | disabled: _propTypes2['default'].bool,
|
16730 | options: _propTypes2['default'].array,
|
16731 | defaultValue: _propTypes2['default'].array
|
16732 | };
|
16733 |
|
16734 | var defaultProps = {
|
16735 | clsPrefix: 'u-checkbox-group',
|
16736 | onChange: function onChange() {},
|
16737 | disabled: false,
|
16738 | options: []
|
16739 | };
|
16740 |
|
16741 | var CheckboxGroup = function (_React$Component) {
|
16742 | _inherits(CheckboxGroup, _React$Component);
|
16743 |
|
16744 | function CheckboxGroup(props) {
|
16745 | _classCallCheck(this, CheckboxGroup);
|
16746 |
|
16747 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
16748 |
|
16749 | _this.changeHandle = function (v) {
|
16750 | var values = _this.state.values;
|
16751 | if (values.indexOf(v) != -1) {
|
16752 | values.splice(values.indexOf(v), 1);
|
16753 | } else {
|
16754 | values.push(v);
|
16755 | }
|
16756 | _this.setState({
|
16757 | values: values
|
16758 | });
|
16759 | var onChange = _this.props.onChange;
|
16760 |
|
16761 | if (onChange) {
|
16762 | var options = _this.getOptions();
|
16763 | onChange(values.filter(function (val) {
|
16764 | return values.indexOf(val) !== -1;
|
16765 | }).sort(function (a, b) {
|
16766 | var indexA = options.findIndex(function (opt) {
|
16767 | return opt.value === a;
|
16768 | });
|
16769 | var indexB = options.findIndex(function (opt) {
|
16770 | return opt.value === b;
|
16771 | });
|
16772 | return indexA - indexB;
|
16773 | }));
|
16774 | }
|
16775 | };
|
16776 |
|
16777 | _this.state = {
|
16778 | values: props.value || props.defaultValue || []
|
16779 | };
|
16780 | return _this;
|
16781 | }
|
16782 |
|
16783 | CheckboxGroup.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
16784 | if (!(0, _lodash2['default'])(nextProps.value, this.state.values)) {
|
16785 | this.setState({
|
16786 | values: nextProps.value
|
16787 | });
|
16788 | }
|
16789 | };
|
16790 |
|
16791 | CheckboxGroup.prototype.getOptions = function getOptions() {
|
16792 | var options = this.props.options;
|
16793 |
|
16794 | return options.map(function (option) {
|
16795 | if (typeof option === 'string') {
|
16796 | return {
|
16797 | label: option,
|
16798 | value: option
|
16799 | };
|
16800 | }
|
16801 | return option;
|
16802 | });
|
16803 | };
|
16804 |
|
16805 | CheckboxGroup.prototype.render = function render() {
|
16806 | var _this2 = this;
|
16807 |
|
16808 | var state = this.state;
|
16809 | var props = this.props;
|
16810 | var clsPrefix = props.clsPrefix,
|
16811 | className = props.className,
|
16812 | disabled = props.disabled,
|
16813 | children = props.children,
|
16814 | options = props.options;
|
16815 |
|
16816 | var classes = clsPrefix;
|
16817 | if (className) classes += ' ' + className;
|
16818 | if (options && options.length > 0) {
|
16819 | children = this.getOptions().map(function (option) {
|
16820 | return _react2['default'].createElement(
|
16821 | _Checkbox2['default'],
|
16822 | {
|
16823 | key: option.value.toString(),
|
16824 | disabled: 'disabled' in option ? option.disabled : props.disabled,
|
16825 | value: option.value,
|
16826 | checked: state.values.indexOf(option.value) !== -1,
|
16827 | onChange: option.onChange
|
16828 | },
|
16829 | option.label
|
16830 | );
|
16831 | });
|
16832 | }
|
16833 | return _react2['default'].createElement(
|
16834 | 'div',
|
16835 | { className: classes },
|
16836 | _react2['default'].Children.map(children, function (child) {
|
16837 | return _react2['default'].cloneElement(child, {
|
16838 | onChange: function onChange() {
|
16839 | _this2.changeHandle(child.props.value);
|
16840 | },
|
16841 | checked: state.values.indexOf(child.props.value) != -1,
|
16842 | disabled: child.props.disabled || disabled
|
16843 | });
|
16844 | })
|
16845 | );
|
16846 | };
|
16847 |
|
16848 | return CheckboxGroup;
|
16849 | }(_react2['default'].Component);
|
16850 |
|
16851 | CheckboxGroup.propTypes = propTypes;
|
16852 | CheckboxGroup.defaultProps = defaultProps;
|
16853 |
|
16854 | exports['default'] = CheckboxGroup;
|
16855 | module.exports = exports['default'];
|
16856 |
|
16857 | }),
|
16858 |
|
16859 | (function(module, exports, __webpack_require__) {
|
16860 |
|
16861 | (function(global, module) { |
16862 |
|
16863 |
|
16864 |
|
16865 |
|
16866 |
|
16867 |
|
16868 |
|
16869 |
|
16870 |
|
16871 | var LARGE_ARRAY_SIZE = 200;
|
16872 |
|
16873 |
|
16874 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
16875 |
|
16876 |
|
16877 | var COMPARE_PARTIAL_FLAG = 1,
|
16878 | COMPARE_UNORDERED_FLAG = 2;
|
16879 |
|
16880 |
|
16881 | var MAX_SAFE_INTEGER = 9007199254740991;
|
16882 |
|
16883 |
|
16884 | var argsTag = '[object Arguments]',
|
16885 | arrayTag = '[object Array]',
|
16886 | asyncTag = '[object AsyncFunction]',
|
16887 | boolTag = '[object Boolean]',
|
16888 | dateTag = '[object Date]',
|
16889 | errorTag = '[object Error]',
|
16890 | funcTag = '[object Function]',
|
16891 | genTag = '[object GeneratorFunction]',
|
16892 | mapTag = '[object Map]',
|
16893 | numberTag = '[object Number]',
|
16894 | nullTag = '[object Null]',
|
16895 | objectTag = '[object Object]',
|
16896 | promiseTag = '[object Promise]',
|
16897 | proxyTag = '[object Proxy]',
|
16898 | regexpTag = '[object RegExp]',
|
16899 | setTag = '[object Set]',
|
16900 | stringTag = '[object String]',
|
16901 | symbolTag = '[object Symbol]',
|
16902 | undefinedTag = '[object Undefined]',
|
16903 | weakMapTag = '[object WeakMap]';
|
16904 |
|
16905 | var arrayBufferTag = '[object ArrayBuffer]',
|
16906 | dataViewTag = '[object DataView]',
|
16907 | float32Tag = '[object Float32Array]',
|
16908 | float64Tag = '[object Float64Array]',
|
16909 | int8Tag = '[object Int8Array]',
|
16910 | int16Tag = '[object Int16Array]',
|
16911 | int32Tag = '[object Int32Array]',
|
16912 | uint8Tag = '[object Uint8Array]',
|
16913 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
16914 | uint16Tag = '[object Uint16Array]',
|
16915 | uint32Tag = '[object Uint32Array]';
|
16916 |
|
16917 | |
16918 |
|
16919 |
|
16920 |
|
16921 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
16922 |
|
16923 |
|
16924 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
16925 |
|
16926 |
|
16927 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
16928 |
|
16929 |
|
16930 | var typedArrayTags = {};
|
16931 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
16932 | typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
16933 | typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
16934 | typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
16935 | typedArrayTags[uint32Tag] = true;
|
16936 | typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
16937 | typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
16938 | typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
16939 | typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
16940 | typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
16941 | typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
16942 | typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
16943 | typedArrayTags[weakMapTag] = false;
|
16944 |
|
16945 |
|
16946 | var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
16947 |
|
16948 |
|
16949 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
16950 |
|
16951 |
|
16952 | var root = freeGlobal || freeSelf || Function('return this')();
|
16953 |
|
16954 |
|
16955 | var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
16956 |
|
16957 |
|
16958 | var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
16959 |
|
16960 |
|
16961 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
16962 |
|
16963 |
|
16964 | var freeProcess = moduleExports && freeGlobal.process;
|
16965 |
|
16966 |
|
16967 | var nodeUtil = (function() {
|
16968 | try {
|
16969 | return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
16970 | } catch (e) {}
|
16971 | }());
|
16972 |
|
16973 |
|
16974 | var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
16975 |
|
16976 | |
16977 |
|
16978 |
|
16979 |
|
16980 |
|
16981 |
|
16982 |
|
16983 |
|
16984 |
|
16985 | function arrayFilter(array, predicate) {
|
16986 | var index = -1,
|
16987 | length = array == null ? 0 : array.length,
|
16988 | resIndex = 0,
|
16989 | result = [];
|
16990 |
|
16991 | while (++index < length) {
|
16992 | var value = array[index];
|
16993 | if (predicate(value, index, array)) {
|
16994 | result[resIndex++] = value;
|
16995 | }
|
16996 | }
|
16997 | return result;
|
16998 | }
|
16999 |
|
17000 | |
17001 |
|
17002 |
|
17003 |
|
17004 |
|
17005 |
|
17006 |
|
17007 |
|
17008 | function arrayPush(array, values) {
|
17009 | var index = -1,
|
17010 | length = values.length,
|
17011 | offset = array.length;
|
17012 |
|
17013 | while (++index < length) {
|
17014 | array[offset + index] = values[index];
|
17015 | }
|
17016 | return array;
|
17017 | }
|
17018 |
|
17019 | |
17020 |
|
17021 |
|
17022 |
|
17023 |
|
17024 |
|
17025 |
|
17026 |
|
17027 |
|
17028 |
|
17029 | function arraySome(array, predicate) {
|
17030 | var index = -1,
|
17031 | length = array == null ? 0 : array.length;
|
17032 |
|
17033 | while (++index < length) {
|
17034 | if (predicate(array[index], index, array)) {
|
17035 | return true;
|
17036 | }
|
17037 | }
|
17038 | return false;
|
17039 | }
|
17040 |
|
17041 | |
17042 |
|
17043 |
|
17044 |
|
17045 |
|
17046 |
|
17047 |
|
17048 |
|
17049 |
|
17050 | function baseTimes(n, iteratee) {
|
17051 | var index = -1,
|
17052 | result = Array(n);
|
17053 |
|
17054 | while (++index < n) {
|
17055 | result[index] = iteratee(index);
|
17056 | }
|
17057 | return result;
|
17058 | }
|
17059 |
|
17060 | |
17061 |
|
17062 |
|
17063 |
|
17064 |
|
17065 |
|
17066 |
|
17067 | function baseUnary(func) {
|
17068 | return function(value) {
|
17069 | return func(value);
|
17070 | };
|
17071 | }
|
17072 |
|
17073 | |
17074 |
|
17075 |
|
17076 |
|
17077 |
|
17078 |
|
17079 |
|
17080 |
|
17081 | function cacheHas(cache, key) {
|
17082 | return cache.has(key);
|
17083 | }
|
17084 |
|
17085 | |
17086 |
|
17087 |
|
17088 |
|
17089 |
|
17090 |
|
17091 |
|
17092 |
|
17093 | function getValue(object, key) {
|
17094 | return object == null ? undefined : object[key];
|
17095 | }
|
17096 |
|
17097 | |
17098 |
|
17099 |
|
17100 |
|
17101 |
|
17102 |
|
17103 |
|
17104 | function mapToArray(map) {
|
17105 | var index = -1,
|
17106 | result = Array(map.size);
|
17107 |
|
17108 | map.forEach(function(value, key) {
|
17109 | result[++index] = [key, value];
|
17110 | });
|
17111 | return result;
|
17112 | }
|
17113 |
|
17114 | |
17115 |
|
17116 |
|
17117 |
|
17118 |
|
17119 |
|
17120 |
|
17121 |
|
17122 | function overArg(func, transform) {
|
17123 | return function(arg) {
|
17124 | return func(transform(arg));
|
17125 | };
|
17126 | }
|
17127 |
|
17128 | |
17129 |
|
17130 |
|
17131 |
|
17132 |
|
17133 |
|
17134 |
|
17135 | function setToArray(set) {
|
17136 | var index = -1,
|
17137 | result = Array(set.size);
|
17138 |
|
17139 | set.forEach(function(value) {
|
17140 | result[++index] = value;
|
17141 | });
|
17142 | return result;
|
17143 | }
|
17144 |
|
17145 |
|
17146 | var arrayProto = Array.prototype,
|
17147 | funcProto = Function.prototype,
|
17148 | objectProto = Object.prototype;
|
17149 |
|
17150 |
|
17151 | var coreJsData = root['__core-js_shared__'];
|
17152 |
|
17153 |
|
17154 | var funcToString = funcProto.toString;
|
17155 |
|
17156 |
|
17157 | var hasOwnProperty = objectProto.hasOwnProperty;
|
17158 |
|
17159 |
|
17160 | var maskSrcKey = (function() {
|
17161 | var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
17162 | return uid ? ('Symbol(src)_1.' + uid) : '';
|
17163 | }());
|
17164 |
|
17165 | |
17166 |
|
17167 |
|
17168 |
|
17169 |
|
17170 | var nativeObjectToString = objectProto.toString;
|
17171 |
|
17172 |
|
17173 | var reIsNative = RegExp('^' +
|
17174 | funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
17175 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
17176 | );
|
17177 |
|
17178 |
|
17179 | var Buffer = moduleExports ? root.Buffer : undefined,
|
17180 | Symbol = root.Symbol,
|
17181 | Uint8Array = root.Uint8Array,
|
17182 | propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
17183 | splice = arrayProto.splice,
|
17184 | symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
17185 |
|
17186 |
|
17187 | var nativeGetSymbols = Object.getOwnPropertySymbols,
|
17188 | nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
|
17189 | nativeKeys = overArg(Object.keys, Object);
|
17190 |
|
17191 |
|
17192 | var DataView = getNative(root, 'DataView'),
|
17193 | Map = getNative(root, 'Map'),
|
17194 | Promise = getNative(root, 'Promise'),
|
17195 | Set = getNative(root, 'Set'),
|
17196 | WeakMap = getNative(root, 'WeakMap'),
|
17197 | nativeCreate = getNative(Object, 'create');
|
17198 |
|
17199 |
|
17200 | var dataViewCtorString = toSource(DataView),
|
17201 | mapCtorString = toSource(Map),
|
17202 | promiseCtorString = toSource(Promise),
|
17203 | setCtorString = toSource(Set),
|
17204 | weakMapCtorString = toSource(WeakMap);
|
17205 |
|
17206 |
|
17207 | var symbolProto = Symbol ? Symbol.prototype : undefined,
|
17208 | symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
17209 |
|
17210 | |
17211 |
|
17212 |
|
17213 |
|
17214 |
|
17215 |
|
17216 |
|
17217 | function Hash(entries) {
|
17218 | var index = -1,
|
17219 | length = entries == null ? 0 : entries.length;
|
17220 |
|
17221 | this.clear();
|
17222 | while (++index < length) {
|
17223 | var entry = entries[index];
|
17224 | this.set(entry[0], entry[1]);
|
17225 | }
|
17226 | }
|
17227 |
|
17228 | |
17229 |
|
17230 |
|
17231 |
|
17232 |
|
17233 |
|
17234 |
|
17235 | function hashClear() {
|
17236 | this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
17237 | this.size = 0;
|
17238 | }
|
17239 |
|
17240 | |
17241 |
|
17242 |
|
17243 |
|
17244 |
|
17245 |
|
17246 |
|
17247 |
|
17248 |
|
17249 |
|
17250 | function hashDelete(key) {
|
17251 | var result = this.has(key) && delete this.__data__[key];
|
17252 | this.size -= result ? 1 : 0;
|
17253 | return result;
|
17254 | }
|
17255 |
|
17256 | |
17257 |
|
17258 |
|
17259 |
|
17260 |
|
17261 |
|
17262 |
|
17263 |
|
17264 |
|
17265 | function hashGet(key) {
|
17266 | var data = this.__data__;
|
17267 | if (nativeCreate) {
|
17268 | var result = data[key];
|
17269 | return result === HASH_UNDEFINED ? undefined : result;
|
17270 | }
|
17271 | return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
17272 | }
|
17273 |
|
17274 | |
17275 |
|
17276 |
|
17277 |
|
17278 |
|
17279 |
|
17280 |
|
17281 |
|
17282 |
|
17283 | function hashHas(key) {
|
17284 | var data = this.__data__;
|
17285 | return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
17286 | }
|
17287 |
|
17288 | |
17289 |
|
17290 |
|
17291 |
|
17292 |
|
17293 |
|
17294 |
|
17295 |
|
17296 |
|
17297 |
|
17298 | function hashSet(key, value) {
|
17299 | var data = this.__data__;
|
17300 | this.size += this.has(key) ? 0 : 1;
|
17301 | data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
17302 | return this;
|
17303 | }
|
17304 |
|
17305 |
|
17306 | Hash.prototype.clear = hashClear;
|
17307 | Hash.prototype['delete'] = hashDelete;
|
17308 | Hash.prototype.get = hashGet;
|
17309 | Hash.prototype.has = hashHas;
|
17310 | Hash.prototype.set = hashSet;
|
17311 |
|
17312 | |
17313 |
|
17314 |
|
17315 |
|
17316 |
|
17317 |
|
17318 |
|
17319 | function ListCache(entries) {
|
17320 | var index = -1,
|
17321 | length = entries == null ? 0 : entries.length;
|
17322 |
|
17323 | this.clear();
|
17324 | while (++index < length) {
|
17325 | var entry = entries[index];
|
17326 | this.set(entry[0], entry[1]);
|
17327 | }
|
17328 | }
|
17329 |
|
17330 | |
17331 |
|
17332 |
|
17333 |
|
17334 |
|
17335 |
|
17336 |
|
17337 | function listCacheClear() {
|
17338 | this.__data__ = [];
|
17339 | this.size = 0;
|
17340 | }
|
17341 |
|
17342 | |
17343 |
|
17344 |
|
17345 |
|
17346 |
|
17347 |
|
17348 |
|
17349 |
|
17350 |
|
17351 | function listCacheDelete(key) {
|
17352 | var data = this.__data__,
|
17353 | index = assocIndexOf(data, key);
|
17354 |
|
17355 | if (index < 0) {
|
17356 | return false;
|
17357 | }
|
17358 | var lastIndex = data.length - 1;
|
17359 | if (index == lastIndex) {
|
17360 | data.pop();
|
17361 | } else {
|
17362 | splice.call(data, index, 1);
|
17363 | }
|
17364 | --this.size;
|
17365 | return true;
|
17366 | }
|
17367 |
|
17368 | |
17369 |
|
17370 |
|
17371 |
|
17372 |
|
17373 |
|
17374 |
|
17375 |
|
17376 |
|
17377 | function listCacheGet(key) {
|
17378 | var data = this.__data__,
|
17379 | index = assocIndexOf(data, key);
|
17380 |
|
17381 | return index < 0 ? undefined : data[index][1];
|
17382 | }
|
17383 |
|
17384 | |
17385 |
|
17386 |
|
17387 |
|
17388 |
|
17389 |
|
17390 |
|
17391 |
|
17392 |
|
17393 | function listCacheHas(key) {
|
17394 | return assocIndexOf(this.__data__, key) > -1;
|
17395 | }
|
17396 |
|
17397 | |
17398 |
|
17399 |
|
17400 |
|
17401 |
|
17402 |
|
17403 |
|
17404 |
|
17405 |
|
17406 |
|
17407 | function listCacheSet(key, value) {
|
17408 | var data = this.__data__,
|
17409 | index = assocIndexOf(data, key);
|
17410 |
|
17411 | if (index < 0) {
|
17412 | ++this.size;
|
17413 | data.push([key, value]);
|
17414 | } else {
|
17415 | data[index][1] = value;
|
17416 | }
|
17417 | return this;
|
17418 | }
|
17419 |
|
17420 |
|
17421 | ListCache.prototype.clear = listCacheClear;
|
17422 | ListCache.prototype['delete'] = listCacheDelete;
|
17423 | ListCache.prototype.get = listCacheGet;
|
17424 | ListCache.prototype.has = listCacheHas;
|
17425 | ListCache.prototype.set = listCacheSet;
|
17426 |
|
17427 | |
17428 |
|
17429 |
|
17430 |
|
17431 |
|
17432 |
|
17433 |
|
17434 | function MapCache(entries) {
|
17435 | var index = -1,
|
17436 | length = entries == null ? 0 : entries.length;
|
17437 |
|
17438 | this.clear();
|
17439 | while (++index < length) {
|
17440 | var entry = entries[index];
|
17441 | this.set(entry[0], entry[1]);
|
17442 | }
|
17443 | }
|
17444 |
|
17445 | |
17446 |
|
17447 |
|
17448 |
|
17449 |
|
17450 |
|
17451 |
|
17452 | function mapCacheClear() {
|
17453 | this.size = 0;
|
17454 | this.__data__ = {
|
17455 | 'hash': new Hash,
|
17456 | 'map': new (Map || ListCache),
|
17457 | 'string': new Hash
|
17458 | };
|
17459 | }
|
17460 |
|
17461 | |
17462 |
|
17463 |
|
17464 |
|
17465 |
|
17466 |
|
17467 |
|
17468 |
|
17469 |
|
17470 | function mapCacheDelete(key) {
|
17471 | var result = getMapData(this, key)['delete'](key);
|
17472 | this.size -= result ? 1 : 0;
|
17473 | return result;
|
17474 | }
|
17475 |
|
17476 | |
17477 |
|
17478 |
|
17479 |
|
17480 |
|
17481 |
|
17482 |
|
17483 |
|
17484 |
|
17485 | function mapCacheGet(key) {
|
17486 | return getMapData(this, key).get(key);
|
17487 | }
|
17488 |
|
17489 | |
17490 |
|
17491 |
|
17492 |
|
17493 |
|
17494 |
|
17495 |
|
17496 |
|
17497 |
|
17498 | function mapCacheHas(key) {
|
17499 | return getMapData(this, key).has(key);
|
17500 | }
|
17501 |
|
17502 | |
17503 |
|
17504 |
|
17505 |
|
17506 |
|
17507 |
|
17508 |
|
17509 |
|
17510 |
|
17511 |
|
17512 | function mapCacheSet(key, value) {
|
17513 | var data = getMapData(this, key),
|
17514 | size = data.size;
|
17515 |
|
17516 | data.set(key, value);
|
17517 | this.size += data.size == size ? 0 : 1;
|
17518 | return this;
|
17519 | }
|
17520 |
|
17521 |
|
17522 | MapCache.prototype.clear = mapCacheClear;
|
17523 | MapCache.prototype['delete'] = mapCacheDelete;
|
17524 | MapCache.prototype.get = mapCacheGet;
|
17525 | MapCache.prototype.has = mapCacheHas;
|
17526 | MapCache.prototype.set = mapCacheSet;
|
17527 |
|
17528 | |
17529 |
|
17530 |
|
17531 |
|
17532 |
|
17533 |
|
17534 |
|
17535 |
|
17536 | function SetCache(values) {
|
17537 | var index = -1,
|
17538 | length = values == null ? 0 : values.length;
|
17539 |
|
17540 | this.__data__ = new MapCache;
|
17541 | while (++index < length) {
|
17542 | this.add(values[index]);
|
17543 | }
|
17544 | }
|
17545 |
|
17546 | |
17547 |
|
17548 |
|
17549 |
|
17550 |
|
17551 |
|
17552 |
|
17553 |
|
17554 |
|
17555 |
|
17556 | function setCacheAdd(value) {
|
17557 | this.__data__.set(value, HASH_UNDEFINED);
|
17558 | return this;
|
17559 | }
|
17560 |
|
17561 | |
17562 |
|
17563 |
|
17564 |
|
17565 |
|
17566 |
|
17567 |
|
17568 |
|
17569 |
|
17570 | function setCacheHas(value) {
|
17571 | return this.__data__.has(value);
|
17572 | }
|
17573 |
|
17574 |
|
17575 | SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
17576 | SetCache.prototype.has = setCacheHas;
|
17577 |
|
17578 | |
17579 |
|
17580 |
|
17581 |
|
17582 |
|
17583 |
|
17584 |
|
17585 | function Stack(entries) {
|
17586 | var data = this.__data__ = new ListCache(entries);
|
17587 | this.size = data.size;
|
17588 | }
|
17589 |
|
17590 | |
17591 |
|
17592 |
|
17593 |
|
17594 |
|
17595 |
|
17596 |
|
17597 | function stackClear() {
|
17598 | this.__data__ = new ListCache;
|
17599 | this.size = 0;
|
17600 | }
|
17601 |
|
17602 | |
17603 |
|
17604 |
|
17605 |
|
17606 |
|
17607 |
|
17608 |
|
17609 |
|
17610 |
|
17611 | function stackDelete(key) {
|
17612 | var data = this.__data__,
|
17613 | result = data['delete'](key);
|
17614 |
|
17615 | this.size = data.size;
|
17616 | return result;
|
17617 | }
|
17618 |
|
17619 | |
17620 |
|
17621 |
|
17622 |
|
17623 |
|
17624 |
|
17625 |
|
17626 |
|
17627 |
|
17628 | function stackGet(key) {
|
17629 | return this.__data__.get(key);
|
17630 | }
|
17631 |
|
17632 | |
17633 |
|
17634 |
|
17635 |
|
17636 |
|
17637 |
|
17638 |
|
17639 |
|
17640 |
|
17641 | function stackHas(key) {
|
17642 | return this.__data__.has(key);
|
17643 | }
|
17644 |
|
17645 | |
17646 |
|
17647 |
|
17648 |
|
17649 |
|
17650 |
|
17651 |
|
17652 |
|
17653 |
|
17654 |
|
17655 | function stackSet(key, value) {
|
17656 | var data = this.__data__;
|
17657 | if (data instanceof ListCache) {
|
17658 | var pairs = data.__data__;
|
17659 | if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
17660 | pairs.push([key, value]);
|
17661 | this.size = ++data.size;
|
17662 | return this;
|
17663 | }
|
17664 | data = this.__data__ = new MapCache(pairs);
|
17665 | }
|
17666 | data.set(key, value);
|
17667 | this.size = data.size;
|
17668 | return this;
|
17669 | }
|
17670 |
|
17671 |
|
17672 | Stack.prototype.clear = stackClear;
|
17673 | Stack.prototype['delete'] = stackDelete;
|
17674 | Stack.prototype.get = stackGet;
|
17675 | Stack.prototype.has = stackHas;
|
17676 | Stack.prototype.set = stackSet;
|
17677 |
|
17678 | |
17679 |
|
17680 |
|
17681 |
|
17682 |
|
17683 |
|
17684 |
|
17685 |
|
17686 | function arrayLikeKeys(value, inherited) {
|
17687 | var isArr = isArray(value),
|
17688 | isArg = !isArr && isArguments(value),
|
17689 | isBuff = !isArr && !isArg && isBuffer(value),
|
17690 | isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
17691 | skipIndexes = isArr || isArg || isBuff || isType,
|
17692 | result = skipIndexes ? baseTimes(value.length, String) : [],
|
17693 | length = result.length;
|
17694 |
|
17695 | for (var key in value) {
|
17696 | if ((inherited || hasOwnProperty.call(value, key)) &&
|
17697 | !(skipIndexes && (
|
17698 |
|
17699 | key == 'length' ||
|
17700 |
|
17701 | (isBuff && (key == 'offset' || key == 'parent')) ||
|
17702 |
|
17703 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
17704 |
|
17705 | isIndex(key, length)
|
17706 | ))) {
|
17707 | result.push(key);
|
17708 | }
|
17709 | }
|
17710 | return result;
|
17711 | }
|
17712 |
|
17713 | |
17714 |
|
17715 |
|
17716 |
|
17717 |
|
17718 |
|
17719 |
|
17720 |
|
17721 | function assocIndexOf(array, key) {
|
17722 | var length = array.length;
|
17723 | while (length--) {
|
17724 | if (eq(array[length][0], key)) {
|
17725 | return length;
|
17726 | }
|
17727 | }
|
17728 | return -1;
|
17729 | }
|
17730 |
|
17731 | |
17732 |
|
17733 |
|
17734 |
|
17735 |
|
17736 |
|
17737 |
|
17738 |
|
17739 |
|
17740 |
|
17741 |
|
17742 | function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
17743 | var result = keysFunc(object);
|
17744 | return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
17745 | }
|
17746 |
|
17747 | |
17748 |
|
17749 |
|
17750 |
|
17751 |
|
17752 |
|
17753 |
|
17754 | function baseGetTag(value) {
|
17755 | if (value == null) {
|
17756 | return value === undefined ? undefinedTag : nullTag;
|
17757 | }
|
17758 | return (symToStringTag && symToStringTag in Object(value))
|
17759 | ? getRawTag(value)
|
17760 | : objectToString(value);
|
17761 | }
|
17762 |
|
17763 | |
17764 |
|
17765 |
|
17766 |
|
17767 |
|
17768 |
|
17769 |
|
17770 | function baseIsArguments(value) {
|
17771 | return isObjectLike(value) && baseGetTag(value) == argsTag;
|
17772 | }
|
17773 |
|
17774 | |
17775 |
|
17776 |
|
17777 |
|
17778 |
|
17779 |
|
17780 |
|
17781 |
|
17782 |
|
17783 |
|
17784 |
|
17785 |
|
17786 |
|
17787 |
|
17788 | function baseIsEqual(value, other, bitmask, customizer, stack) {
|
17789 | if (value === other) {
|
17790 | return true;
|
17791 | }
|
17792 | if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
17793 | return value !== value && other !== other;
|
17794 | }
|
17795 | return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
17796 | }
|
17797 |
|
17798 | |
17799 |
|
17800 |
|
17801 |
|
17802 |
|
17803 |
|
17804 |
|
17805 |
|
17806 |
|
17807 |
|
17808 |
|
17809 |
|
17810 |
|
17811 |
|
17812 | function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
17813 | var objIsArr = isArray(object),
|
17814 | othIsArr = isArray(other),
|
17815 | objTag = objIsArr ? arrayTag : getTag(object),
|
17816 | othTag = othIsArr ? arrayTag : getTag(other);
|
17817 |
|
17818 | objTag = objTag == argsTag ? objectTag : objTag;
|
17819 | othTag = othTag == argsTag ? objectTag : othTag;
|
17820 |
|
17821 | var objIsObj = objTag == objectTag,
|
17822 | othIsObj = othTag == objectTag,
|
17823 | isSameTag = objTag == othTag;
|
17824 |
|
17825 | if (isSameTag && isBuffer(object)) {
|
17826 | if (!isBuffer(other)) {
|
17827 | return false;
|
17828 | }
|
17829 | objIsArr = true;
|
17830 | objIsObj = false;
|
17831 | }
|
17832 | if (isSameTag && !objIsObj) {
|
17833 | stack || (stack = new Stack);
|
17834 | return (objIsArr || isTypedArray(object))
|
17835 | ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
17836 | : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
17837 | }
|
17838 | if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
17839 | var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
17840 | othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
17841 |
|
17842 | if (objIsWrapped || othIsWrapped) {
|
17843 | var objUnwrapped = objIsWrapped ? object.value() : object,
|
17844 | othUnwrapped = othIsWrapped ? other.value() : other;
|
17845 |
|
17846 | stack || (stack = new Stack);
|
17847 | return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
17848 | }
|
17849 | }
|
17850 | if (!isSameTag) {
|
17851 | return false;
|
17852 | }
|
17853 | stack || (stack = new Stack);
|
17854 | return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
17855 | }
|
17856 |
|
17857 | |
17858 |
|
17859 |
|
17860 |
|
17861 |
|
17862 |
|
17863 |
|
17864 |
|
17865 | function baseIsNative(value) {
|
17866 | if (!isObject(value) || isMasked(value)) {
|
17867 | return false;
|
17868 | }
|
17869 | var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
17870 | return pattern.test(toSource(value));
|
17871 | }
|
17872 |
|
17873 | |
17874 |
|
17875 |
|
17876 |
|
17877 |
|
17878 |
|
17879 |
|
17880 | function baseIsTypedArray(value) {
|
17881 | return isObjectLike(value) &&
|
17882 | isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
17883 | }
|
17884 |
|
17885 | |
17886 |
|
17887 |
|
17888 |
|
17889 |
|
17890 |
|
17891 |
|
17892 | function baseKeys(object) {
|
17893 | if (!isPrototype(object)) {
|
17894 | return nativeKeys(object);
|
17895 | }
|
17896 | var result = [];
|
17897 | for (var key in Object(object)) {
|
17898 | if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
17899 | result.push(key);
|
17900 | }
|
17901 | }
|
17902 | return result;
|
17903 | }
|
17904 |
|
17905 | |
17906 |
|
17907 |
|
17908 |
|
17909 |
|
17910 |
|
17911 |
|
17912 |
|
17913 |
|
17914 |
|
17915 |
|
17916 |
|
17917 |
|
17918 | function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
17919 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
17920 | arrLength = array.length,
|
17921 | othLength = other.length;
|
17922 |
|
17923 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
17924 | return false;
|
17925 | }
|
17926 |
|
17927 | var stacked = stack.get(array);
|
17928 | if (stacked && stack.get(other)) {
|
17929 | return stacked == other;
|
17930 | }
|
17931 | var index = -1,
|
17932 | result = true,
|
17933 | seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
|
17934 |
|
17935 | stack.set(array, other);
|
17936 | stack.set(other, array);
|
17937 |
|
17938 |
|
17939 | while (++index < arrLength) {
|
17940 | var arrValue = array[index],
|
17941 | othValue = other[index];
|
17942 |
|
17943 | if (customizer) {
|
17944 | var compared = isPartial
|
17945 | ? customizer(othValue, arrValue, index, other, array, stack)
|
17946 | : customizer(arrValue, othValue, index, array, other, stack);
|
17947 | }
|
17948 | if (compared !== undefined) {
|
17949 | if (compared) {
|
17950 | continue;
|
17951 | }
|
17952 | result = false;
|
17953 | break;
|
17954 | }
|
17955 |
|
17956 | if (seen) {
|
17957 | if (!arraySome(other, function(othValue, othIndex) {
|
17958 | if (!cacheHas(seen, othIndex) &&
|
17959 | (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
17960 | return seen.push(othIndex);
|
17961 | }
|
17962 | })) {
|
17963 | result = false;
|
17964 | break;
|
17965 | }
|
17966 | } else if (!(
|
17967 | arrValue === othValue ||
|
17968 | equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
17969 | )) {
|
17970 | result = false;
|
17971 | break;
|
17972 | }
|
17973 | }
|
17974 | stack['delete'](array);
|
17975 | stack['delete'](other);
|
17976 | return result;
|
17977 | }
|
17978 |
|
17979 | |
17980 |
|
17981 |
|
17982 |
|
17983 |
|
17984 |
|
17985 |
|
17986 |
|
17987 |
|
17988 |
|
17989 |
|
17990 |
|
17991 |
|
17992 |
|
17993 |
|
17994 |
|
17995 |
|
17996 | function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
17997 | switch (tag) {
|
17998 | case dataViewTag:
|
17999 | if ((object.byteLength != other.byteLength) ||
|
18000 | (object.byteOffset != other.byteOffset)) {
|
18001 | return false;
|
18002 | }
|
18003 | object = object.buffer;
|
18004 | other = other.buffer;
|
18005 |
|
18006 | case arrayBufferTag:
|
18007 | if ((object.byteLength != other.byteLength) ||
|
18008 | !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
18009 | return false;
|
18010 | }
|
18011 | return true;
|
18012 |
|
18013 | case boolTag:
|
18014 | case dateTag:
|
18015 | case numberTag:
|
18016 |
|
18017 |
|
18018 | return eq(+object, +other);
|
18019 |
|
18020 | case errorTag:
|
18021 | return object.name == other.name && object.message == other.message;
|
18022 |
|
18023 | case regexpTag:
|
18024 | case stringTag:
|
18025 |
|
18026 |
|
18027 |
|
18028 | return object == (other + '');
|
18029 |
|
18030 | case mapTag:
|
18031 | var convert = mapToArray;
|
18032 |
|
18033 | case setTag:
|
18034 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
18035 | convert || (convert = setToArray);
|
18036 |
|
18037 | if (object.size != other.size && !isPartial) {
|
18038 | return false;
|
18039 | }
|
18040 |
|
18041 | var stacked = stack.get(object);
|
18042 | if (stacked) {
|
18043 | return stacked == other;
|
18044 | }
|
18045 | bitmask |= COMPARE_UNORDERED_FLAG;
|
18046 |
|
18047 |
|
18048 | stack.set(object, other);
|
18049 | var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
18050 | stack['delete'](object);
|
18051 | return result;
|
18052 |
|
18053 | case symbolTag:
|
18054 | if (symbolValueOf) {
|
18055 | return symbolValueOf.call(object) == symbolValueOf.call(other);
|
18056 | }
|
18057 | }
|
18058 | return false;
|
18059 | }
|
18060 |
|
18061 | |
18062 |
|
18063 |
|
18064 |
|
18065 |
|
18066 |
|
18067 |
|
18068 |
|
18069 |
|
18070 |
|
18071 |
|
18072 |
|
18073 |
|
18074 | function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
18075 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
18076 | objProps = getAllKeys(object),
|
18077 | objLength = objProps.length,
|
18078 | othProps = getAllKeys(other),
|
18079 | othLength = othProps.length;
|
18080 |
|
18081 | if (objLength != othLength && !isPartial) {
|
18082 | return false;
|
18083 | }
|
18084 | var index = objLength;
|
18085 | while (index--) {
|
18086 | var key = objProps[index];
|
18087 | if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
18088 | return false;
|
18089 | }
|
18090 | }
|
18091 |
|
18092 | var stacked = stack.get(object);
|
18093 | if (stacked && stack.get(other)) {
|
18094 | return stacked == other;
|
18095 | }
|
18096 | var result = true;
|
18097 | stack.set(object, other);
|
18098 | stack.set(other, object);
|
18099 |
|
18100 | var skipCtor = isPartial;
|
18101 | while (++index < objLength) {
|
18102 | key = objProps[index];
|
18103 | var objValue = object[key],
|
18104 | othValue = other[key];
|
18105 |
|
18106 | if (customizer) {
|
18107 | var compared = isPartial
|
18108 | ? customizer(othValue, objValue, key, other, object, stack)
|
18109 | : customizer(objValue, othValue, key, object, other, stack);
|
18110 | }
|
18111 |
|
18112 | if (!(compared === undefined
|
18113 | ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
18114 | : compared
|
18115 | )) {
|
18116 | result = false;
|
18117 | break;
|
18118 | }
|
18119 | skipCtor || (skipCtor = key == 'constructor');
|
18120 | }
|
18121 | if (result && !skipCtor) {
|
18122 | var objCtor = object.constructor,
|
18123 | othCtor = other.constructor;
|
18124 |
|
18125 |
|
18126 | if (objCtor != othCtor &&
|
18127 | ('constructor' in object && 'constructor' in other) &&
|
18128 | !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
18129 | typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
18130 | result = false;
|
18131 | }
|
18132 | }
|
18133 | stack['delete'](object);
|
18134 | stack['delete'](other);
|
18135 | return result;
|
18136 | }
|
18137 |
|
18138 | |
18139 |
|
18140 |
|
18141 |
|
18142 |
|
18143 |
|
18144 |
|
18145 | function getAllKeys(object) {
|
18146 | return baseGetAllKeys(object, keys, getSymbols);
|
18147 | }
|
18148 |
|
18149 | |
18150 |
|
18151 |
|
18152 |
|
18153 |
|
18154 |
|
18155 |
|
18156 |
|
18157 | function getMapData(map, key) {
|
18158 | var data = map.__data__;
|
18159 | return isKeyable(key)
|
18160 | ? data[typeof key == 'string' ? 'string' : 'hash']
|
18161 | : data.map;
|
18162 | }
|
18163 |
|
18164 | |
18165 |
|
18166 |
|
18167 |
|
18168 |
|
18169 |
|
18170 |
|
18171 |
|
18172 | function getNative(object, key) {
|
18173 | var value = getValue(object, key);
|
18174 | return baseIsNative(value) ? value : undefined;
|
18175 | }
|
18176 |
|
18177 | |
18178 |
|
18179 |
|
18180 |
|
18181 |
|
18182 |
|
18183 |
|
18184 | function getRawTag(value) {
|
18185 | var isOwn = hasOwnProperty.call(value, symToStringTag),
|
18186 | tag = value[symToStringTag];
|
18187 |
|
18188 | try {
|
18189 | value[symToStringTag] = undefined;
|
18190 | var unmasked = true;
|
18191 | } catch (e) {}
|
18192 |
|
18193 | var result = nativeObjectToString.call(value);
|
18194 | if (unmasked) {
|
18195 | if (isOwn) {
|
18196 | value[symToStringTag] = tag;
|
18197 | } else {
|
18198 | delete value[symToStringTag];
|
18199 | }
|
18200 | }
|
18201 | return result;
|
18202 | }
|
18203 |
|
18204 | |
18205 |
|
18206 |
|
18207 |
|
18208 |
|
18209 |
|
18210 |
|
18211 | var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
18212 | if (object == null) {
|
18213 | return [];
|
18214 | }
|
18215 | object = Object(object);
|
18216 | return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
18217 | return propertyIsEnumerable.call(object, symbol);
|
18218 | });
|
18219 | };
|
18220 |
|
18221 | |
18222 |
|
18223 |
|
18224 |
|
18225 |
|
18226 |
|
18227 |
|
18228 | var getTag = baseGetTag;
|
18229 |
|
18230 |
|
18231 | if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
18232 | (Map && getTag(new Map) != mapTag) ||
|
18233 | (Promise && getTag(Promise.resolve()) != promiseTag) ||
|
18234 | (Set && getTag(new Set) != setTag) ||
|
18235 | (WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
18236 | getTag = function(value) {
|
18237 | var result = baseGetTag(value),
|
18238 | Ctor = result == objectTag ? value.constructor : undefined,
|
18239 | ctorString = Ctor ? toSource(Ctor) : '';
|
18240 |
|
18241 | if (ctorString) {
|
18242 | switch (ctorString) {
|
18243 | case dataViewCtorString: return dataViewTag;
|
18244 | case mapCtorString: return mapTag;
|
18245 | case promiseCtorString: return promiseTag;
|
18246 | case setCtorString: return setTag;
|
18247 | case weakMapCtorString: return weakMapTag;
|
18248 | }
|
18249 | }
|
18250 | return result;
|
18251 | };
|
18252 | }
|
18253 |
|
18254 | |
18255 |
|
18256 |
|
18257 |
|
18258 |
|
18259 |
|
18260 |
|
18261 |
|
18262 | function isIndex(value, length) {
|
18263 | length = length == null ? MAX_SAFE_INTEGER : length;
|
18264 | return !!length &&
|
18265 | (typeof value == 'number' || reIsUint.test(value)) &&
|
18266 | (value > -1 && value % 1 == 0 && value < length);
|
18267 | }
|
18268 |
|
18269 | |
18270 |
|
18271 |
|
18272 |
|
18273 |
|
18274 |
|
18275 |
|
18276 | function isKeyable(value) {
|
18277 | var type = typeof value;
|
18278 | return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
18279 | ? (value !== '__proto__')
|
18280 | : (value === null);
|
18281 | }
|
18282 |
|
18283 | |
18284 |
|
18285 |
|
18286 |
|
18287 |
|
18288 |
|
18289 |
|
18290 | function isMasked(func) {
|
18291 | return !!maskSrcKey && (maskSrcKey in func);
|
18292 | }
|
18293 |
|
18294 | |
18295 |
|
18296 |
|
18297 |
|
18298 |
|
18299 |
|
18300 |
|
18301 | function isPrototype(value) {
|
18302 | var Ctor = value && value.constructor,
|
18303 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
18304 |
|
18305 | return value === proto;
|
18306 | }
|
18307 |
|
18308 | |
18309 |
|
18310 |
|
18311 |
|
18312 |
|
18313 |
|
18314 |
|
18315 | function objectToString(value) {
|
18316 | return nativeObjectToString.call(value);
|
18317 | }
|
18318 |
|
18319 | |
18320 |
|
18321 |
|
18322 |
|
18323 |
|
18324 |
|
18325 |
|
18326 | function toSource(func) {
|
18327 | if (func != null) {
|
18328 | try {
|
18329 | return funcToString.call(func);
|
18330 | } catch (e) {}
|
18331 | try {
|
18332 | return (func + '');
|
18333 | } catch (e) {}
|
18334 | }
|
18335 | return '';
|
18336 | }
|
18337 |
|
18338 | |
18339 |
|
18340 |
|
18341 |
|
18342 |
|
18343 |
|
18344 |
|
18345 |
|
18346 |
|
18347 |
|
18348 |
|
18349 |
|
18350 |
|
18351 |
|
18352 |
|
18353 |
|
18354 |
|
18355 |
|
18356 |
|
18357 |
|
18358 |
|
18359 |
|
18360 |
|
18361 |
|
18362 |
|
18363 |
|
18364 |
|
18365 |
|
18366 |
|
18367 |
|
18368 |
|
18369 |
|
18370 | function eq(value, other) {
|
18371 | return value === other || (value !== value && other !== other);
|
18372 | }
|
18373 |
|
18374 | |
18375 |
|
18376 |
|
18377 |
|
18378 |
|
18379 |
|
18380 |
|
18381 |
|
18382 |
|
18383 |
|
18384 |
|
18385 |
|
18386 |
|
18387 |
|
18388 |
|
18389 |
|
18390 |
|
18391 |
|
18392 | var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
18393 | return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
18394 | !propertyIsEnumerable.call(value, 'callee');
|
18395 | };
|
18396 |
|
18397 | |
18398 |
|
18399 |
|
18400 |
|
18401 |
|
18402 |
|
18403 |
|
18404 |
|
18405 |
|
18406 |
|
18407 |
|
18408 |
|
18409 |
|
18410 |
|
18411 |
|
18412 |
|
18413 |
|
18414 |
|
18415 |
|
18416 |
|
18417 |
|
18418 |
|
18419 |
|
18420 | var isArray = Array.isArray;
|
18421 |
|
18422 | |
18423 |
|
18424 |
|
18425 |
|
18426 |
|
18427 |
|
18428 |
|
18429 |
|
18430 |
|
18431 |
|
18432 |
|
18433 |
|
18434 |
|
18435 |
|
18436 |
|
18437 |
|
18438 |
|
18439 |
|
18440 |
|
18441 |
|
18442 |
|
18443 |
|
18444 |
|
18445 |
|
18446 |
|
18447 | function isArrayLike(value) {
|
18448 | return value != null && isLength(value.length) && !isFunction(value);
|
18449 | }
|
18450 |
|
18451 | |
18452 |
|
18453 |
|
18454 |
|
18455 |
|
18456 |
|
18457 |
|
18458 |
|
18459 |
|
18460 |
|
18461 |
|
18462 |
|
18463 |
|
18464 |
|
18465 |
|
18466 |
|
18467 |
|
18468 | var isBuffer = nativeIsBuffer || stubFalse;
|
18469 |
|
18470 | |
18471 |
|
18472 |
|
18473 |
|
18474 |
|
18475 |
|
18476 |
|
18477 |
|
18478 |
|
18479 |
|
18480 |
|
18481 |
|
18482 |
|
18483 |
|
18484 |
|
18485 |
|
18486 |
|
18487 |
|
18488 |
|
18489 |
|
18490 |
|
18491 |
|
18492 |
|
18493 |
|
18494 |
|
18495 |
|
18496 |
|
18497 |
|
18498 | function isEqual(value, other) {
|
18499 | return baseIsEqual(value, other);
|
18500 | }
|
18501 |
|
18502 | |
18503 |
|
18504 |
|
18505 |
|
18506 |
|
18507 |
|
18508 |
|
18509 |
|
18510 |
|
18511 |
|
18512 |
|
18513 |
|
18514 |
|
18515 |
|
18516 |
|
18517 |
|
18518 |
|
18519 | function isFunction(value) {
|
18520 | if (!isObject(value)) {
|
18521 | return false;
|
18522 | }
|
18523 |
|
18524 |
|
18525 | var tag = baseGetTag(value);
|
18526 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
18527 | }
|
18528 |
|
18529 | |
18530 |
|
18531 |
|
18532 |
|
18533 |
|
18534 |
|
18535 |
|
18536 |
|
18537 |
|
18538 |
|
18539 |
|
18540 |
|
18541 |
|
18542 |
|
18543 |
|
18544 |
|
18545 |
|
18546 |
|
18547 |
|
18548 |
|
18549 |
|
18550 |
|
18551 |
|
18552 |
|
18553 |
|
18554 |
|
18555 | function isLength(value) {
|
18556 | return typeof value == 'number' &&
|
18557 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
18558 | }
|
18559 |
|
18560 | |
18561 |
|
18562 |
|
18563 |
|
18564 |
|
18565 |
|
18566 |
|
18567 |
|
18568 |
|
18569 |
|
18570 |
|
18571 |
|
18572 |
|
18573 |
|
18574 |
|
18575 |
|
18576 |
|
18577 |
|
18578 |
|
18579 |
|
18580 |
|
18581 |
|
18582 |
|
18583 |
|
18584 |
|
18585 | function isObject(value) {
|
18586 | var type = typeof value;
|
18587 | return value != null && (type == 'object' || type == 'function');
|
18588 | }
|
18589 |
|
18590 | |
18591 |
|
18592 |
|
18593 |
|
18594 |
|
18595 |
|
18596 |
|
18597 |
|
18598 |
|
18599 |
|
18600 |
|
18601 |
|
18602 |
|
18603 |
|
18604 |
|
18605 |
|
18606 |
|
18607 |
|
18608 |
|
18609 |
|
18610 |
|
18611 |
|
18612 |
|
18613 |
|
18614 | function isObjectLike(value) {
|
18615 | return value != null && typeof value == 'object';
|
18616 | }
|
18617 |
|
18618 | |
18619 |
|
18620 |
|
18621 |
|
18622 |
|
18623 |
|
18624 |
|
18625 |
|
18626 |
|
18627 |
|
18628 |
|
18629 |
|
18630 |
|
18631 |
|
18632 |
|
18633 |
|
18634 |
|
18635 | var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
18636 |
|
18637 | |
18638 |
|
18639 |
|
18640 |
|
18641 |
|
18642 |
|
18643 |
|
18644 |
|
18645 |
|
18646 |
|
18647 |
|
18648 |
|
18649 |
|
18650 |
|
18651 |
|
18652 |
|
18653 |
|
18654 |
|
18655 |
|
18656 |
|
18657 |
|
18658 |
|
18659 |
|
18660 |
|
18661 |
|
18662 |
|
18663 |
|
18664 |
|
18665 | function keys(object) {
|
18666 | return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
18667 | }
|
18668 |
|
18669 | |
18670 |
|
18671 |
|
18672 |
|
18673 |
|
18674 |
|
18675 |
|
18676 |
|
18677 |
|
18678 |
|
18679 |
|
18680 |
|
18681 |
|
18682 |
|
18683 |
|
18684 |
|
18685 |
|
18686 |
|
18687 | function stubArray() {
|
18688 | return [];
|
18689 | }
|
18690 |
|
18691 | |
18692 |
|
18693 |
|
18694 |
|
18695 |
|
18696 |
|
18697 |
|
18698 |
|
18699 |
|
18700 |
|
18701 |
|
18702 |
|
18703 |
|
18704 | function stubFalse() {
|
18705 | return false;
|
18706 | }
|
18707 |
|
18708 | module.exports = isEqual;
|
18709 |
|
18710 | }.call(exports, (function() { return this; }()), __webpack_require__(161)(module)))
|
18711 |
|
18712 | }),
|
18713 |
|
18714 | (function(module, exports) {
|
18715 |
|
18716 | module.exports = function(module) {
|
18717 | if(!module.webpackPolyfill) {
|
18718 | module.deprecate = function() {};
|
18719 | module.paths = [];
|
18720 |
|
18721 | module.children = [];
|
18722 | module.webpackPolyfill = 1;
|
18723 | }
|
18724 | return module;
|
18725 | }
|
18726 |
|
18727 |
|
18728 | }),
|
18729 |
|
18730 | (function(module, exports, __webpack_require__) {
|
18731 |
|
18732 | 'use strict';
|
18733 |
|
18734 | Object.defineProperty(exports, "__esModule", {
|
18735 | value: true
|
18736 | });
|
18737 |
|
18738 | var _react = __webpack_require__(1);
|
18739 |
|
18740 | var _react2 = _interopRequireDefault(_react);
|
18741 |
|
18742 | var _src = __webpack_require__(157);
|
18743 |
|
18744 | var _src2 = _interopRequireDefault(_src);
|
18745 |
|
18746 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18747 |
|
18748 | 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; }
|
18749 |
|
18750 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
18751 |
|
18752 | 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; }
|
18753 |
|
18754 | 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); } |
18755 |
|
18756 |
|
18757 |
|
18758 |
|
18759 | var Demo1 = function (_Component) {
|
18760 | _inherits(Demo1, _Component);
|
18761 |
|
18762 | function Demo1(props) {
|
18763 | _classCallCheck(this, Demo1);
|
18764 |
|
18765 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
18766 |
|
18767 | _this.handleDblClick = function (state) {
|
18768 | console.log(state);
|
18769 | };
|
18770 |
|
18771 | _this.state = {
|
18772 | checkedFlag: true
|
18773 | };
|
18774 | _this.onChange = _this.onChange.bind(_this);
|
18775 | return _this;
|
18776 | }
|
18777 |
|
18778 | Demo1.prototype.onChange = function onChange(e) {
|
18779 | console.log(e);
|
18780 | this.setState({ checkedFlag: e });
|
18781 | };
|
18782 |
|
18783 | Demo1.prototype.render = function render() {
|
18784 | return _react2['default'].createElement(
|
18785 | 'div',
|
18786 | { className: 'demo-checkbox' },
|
18787 | _react2['default'].createElement(_src2['default'], {
|
18788 | disabled: true,
|
18789 | className: 'test' }),
|
18790 | _react2['default'].createElement(_src2['default'], {
|
18791 | disabled: true,
|
18792 | checked: true,
|
18793 | className: 'test' }),
|
18794 | _react2['default'].createElement(
|
18795 | _src2['default']
|
18796 |
|
18797 | ,
|
18798 | { ref: 'test',
|
18799 | checked: this.state.checkedFlag,
|
18800 | onChange: this.onChange },
|
18801 | 'Checkbox'
|
18802 | )
|
18803 | );
|
18804 | };
|
18805 |
|
18806 | return Demo1;
|
18807 | }(_react.Component);
|
18808 |
|
18809 | exports['default'] = Demo1;
|
18810 | module.exports = exports['default'];
|
18811 |
|
18812 | }),
|
18813 |
|
18814 | (function(module, exports, __webpack_require__) {
|
18815 |
|
18816 | 'use strict';
|
18817 |
|
18818 | Object.defineProperty(exports, "__esModule", {
|
18819 | value: true
|
18820 | });
|
18821 |
|
18822 | var _react = __webpack_require__(1);
|
18823 |
|
18824 | var _react2 = _interopRequireDefault(_react);
|
18825 |
|
18826 | var _src = __webpack_require__(157);
|
18827 |
|
18828 | var _src2 = _interopRequireDefault(_src);
|
18829 |
|
18830 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18831 |
|
18832 | 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; }
|
18833 |
|
18834 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
18835 |
|
18836 | 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; }
|
18837 |
|
18838 | 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); } |
18839 |
|
18840 |
|
18841 |
|
18842 |
|
18843 | var Demo2 = function (_Component) {
|
18844 | _inherits(Demo2, _Component);
|
18845 |
|
18846 | function Demo2() {
|
18847 | _classCallCheck(this, Demo2);
|
18848 |
|
18849 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
18850 | }
|
18851 |
|
18852 | Demo2.prototype.render = function render() {
|
18853 | return _react2['default'].createElement(
|
18854 | 'div',
|
18855 | { className: 'demo-checkbox' },
|
18856 | _react2['default'].createElement(
|
18857 | _src2['default'],
|
18858 | { colors: 'primary' },
|
18859 | 'primary'
|
18860 | ),
|
18861 | _react2['default'].createElement(
|
18862 | _src2['default'],
|
18863 | { colors: 'success' },
|
18864 | 'success'
|
18865 | ),
|
18866 | _react2['default'].createElement(
|
18867 | _src2['default'],
|
18868 | { colors: 'info' },
|
18869 | 'info'
|
18870 | ),
|
18871 | _react2['default'].createElement(
|
18872 | _src2['default'],
|
18873 | { colors: 'danger' },
|
18874 | 'danger'
|
18875 | ),
|
18876 | _react2['default'].createElement(
|
18877 | _src2['default'],
|
18878 | { colors: 'warning' },
|
18879 | 'warning'
|
18880 | ),
|
18881 | _react2['default'].createElement(
|
18882 | _src2['default'],
|
18883 | { colors: 'dark' },
|
18884 | 'dark'
|
18885 | )
|
18886 | );
|
18887 | };
|
18888 |
|
18889 | return Demo2;
|
18890 | }(_react.Component);
|
18891 |
|
18892 | exports['default'] = Demo2;
|
18893 | module.exports = exports['default'];
|
18894 |
|
18895 | }),
|
18896 |
|
18897 | (function(module, exports, __webpack_require__) {
|
18898 |
|
18899 | 'use strict';
|
18900 |
|
18901 | Object.defineProperty(exports, "__esModule", {
|
18902 | value: true
|
18903 | });
|
18904 |
|
18905 | var _react = __webpack_require__(1);
|
18906 |
|
18907 | var _react2 = _interopRequireDefault(_react);
|
18908 |
|
18909 | var _src = __webpack_require__(157);
|
18910 |
|
18911 | var _src2 = _interopRequireDefault(_src);
|
18912 |
|
18913 | var _beeButton = __webpack_require__(155);
|
18914 |
|
18915 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
18916 |
|
18917 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
18918 |
|
18919 | 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; }
|
18920 |
|
18921 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
18922 |
|
18923 | 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; }
|
18924 |
|
18925 | 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); } |
18926 |
|
18927 |
|
18928 |
|
18929 |
|
18930 | var Demo3 = function (_Component) {
|
18931 | _inherits(Demo3, _Component);
|
18932 |
|
18933 | function Demo3(props) {
|
18934 | _classCallCheck(this, Demo3);
|
18935 |
|
18936 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
18937 |
|
18938 | _this.changeCheck = function () {
|
18939 | _this.setState({ checked: !_this.state.checked });
|
18940 | };
|
18941 |
|
18942 | _this.changeDisabled = function () {
|
18943 | _this.setState({ disabled: !_this.state.disabled });
|
18944 | };
|
18945 |
|
18946 | _this.state = {
|
18947 | checked: false,
|
18948 | disabled: false
|
18949 | };
|
18950 | return _this;
|
18951 | }
|
18952 |
|
18953 | Demo3.prototype.render = function render() {
|
18954 | var label = (this.state.checked ? 'Checked' : 'Unchecked') + '-' + (this.state.disabled ? 'Disabled' : 'Enabled');
|
18955 | return _react2['default'].createElement(
|
18956 | 'div',
|
18957 | { className: 'demo-checkbox' },
|
18958 | _react2['default'].createElement(
|
18959 | 'p',
|
18960 | null,
|
18961 | _react2['default'].createElement(
|
18962 | _beeButton2['default'],
|
18963 | {
|
18964 | colors: 'secondary',
|
18965 | onClick: this.changeCheck.bind(this),
|
18966 | style: { marginRight: "8px" }
|
18967 | },
|
18968 | !this.state.checked ? 'Check' : 'Uncheck'
|
18969 | ),
|
18970 | _react2['default'].createElement(
|
18971 | _beeButton2['default'],
|
18972 | {
|
18973 | colors: 'secondary',
|
18974 | onClick: this.changeDisabled.bind(this)
|
18975 | },
|
18976 | !this.state.disabled ? 'Disable' : 'Enable'
|
18977 | )
|
18978 | ),
|
18979 | _react2['default'].createElement(
|
18980 | 'p',
|
18981 | null,
|
18982 | _react2['default'].createElement(
|
18983 | _src2['default'],
|
18984 | {
|
18985 | checked: this.state.checked,
|
18986 | disabled: this.state.disabled,
|
18987 | onChange: this.changeCheck
|
18988 | },
|
18989 | label
|
18990 | )
|
18991 | )
|
18992 | );
|
18993 | };
|
18994 |
|
18995 | return Demo3;
|
18996 | }(_react.Component);
|
18997 |
|
18998 | exports['default'] = Demo3;
|
18999 | module.exports = exports['default'];
|
19000 |
|
19001 | }),
|
19002 |
|
19003 | (function(module, exports, __webpack_require__) {
|
19004 |
|
19005 | 'use strict';
|
19006 |
|
19007 | Object.defineProperty(exports, "__esModule", {
|
19008 | value: true
|
19009 | });
|
19010 |
|
19011 | var _react = __webpack_require__(1);
|
19012 |
|
19013 | var _react2 = _interopRequireDefault(_react);
|
19014 |
|
19015 | var _src = __webpack_require__(157);
|
19016 |
|
19017 | var _src2 = _interopRequireDefault(_src);
|
19018 |
|
19019 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19020 |
|
19021 | 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; }
|
19022 |
|
19023 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
19024 |
|
19025 | 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; }
|
19026 |
|
19027 | 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); } |
19028 |
|
19029 |
|
19030 |
|
19031 |
|
19032 | var CheckboxGroup = _src2['default'].CheckboxGroup;
|
19033 |
|
19034 | var plainOptions = ['Apple', 'Pear', 'Orange'];
|
19035 | var options = [{ label: 'Apple', value: 'Apple' }, { label: 'Pear', value: 'Pear' }, { label: 'Orange', value: 'Orange' }];
|
19036 | var optionsWithDisabled = [{ label: 'Apple', value: 'Apple' }, { label: 'Pear', value: 'Pear' }, { label: 'Orange', value: 'Orange', disabled: false }];
|
19037 |
|
19038 | var Demo4 = function (_Component) {
|
19039 | _inherits(Demo4, _Component);
|
19040 |
|
19041 | function Demo4(props) {
|
19042 | _classCallCheck(this, Demo4);
|
19043 |
|
19044 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
19045 | }
|
19046 |
|
19047 | Demo4.prototype.onChange = function onChange(checkedValues) {
|
19048 | console.log('checked = ', checkedValues);
|
19049 | };
|
19050 |
|
19051 | Demo4.prototype.render = function render() {
|
19052 | return _react2['default'].createElement(
|
19053 | 'div',
|
19054 | { className: 'demo-checkbox' },
|
19055 | _react2['default'].createElement(CheckboxGroup, { options: plainOptions, defaultValue: ['Apple'], onChange: this.onChange }),
|
19056 | _react2['default'].createElement(CheckboxGroup, { options: options, defaultValue: ['Pear'], onChange: this.onChange }),
|
19057 | _react2['default'].createElement(CheckboxGroup, {
|
19058 | options: optionsWithDisabled,
|
19059 | disabled: true,
|
19060 | defaultValue: ['Apple'],
|
19061 | onChange: this.onChange
|
19062 | })
|
19063 | );
|
19064 | };
|
19065 |
|
19066 | return Demo4;
|
19067 | }(_react.Component);
|
19068 |
|
19069 | exports['default'] = Demo4;
|
19070 | module.exports = exports['default'];
|
19071 |
|
19072 | }),
|
19073 |
|
19074 | (function(module, exports, __webpack_require__) {
|
19075 |
|
19076 | 'use strict';
|
19077 |
|
19078 | Object.defineProperty(exports, "__esModule", {
|
19079 | value: true
|
19080 | });
|
19081 |
|
19082 | var _react = __webpack_require__(1);
|
19083 |
|
19084 | var _react2 = _interopRequireDefault(_react);
|
19085 |
|
19086 | var _src = __webpack_require__(157);
|
19087 |
|
19088 | var _src2 = _interopRequireDefault(_src);
|
19089 |
|
19090 | var _beeForm = __webpack_require__(167);
|
19091 |
|
19092 | var _beeForm2 = _interopRequireDefault(_beeForm);
|
19093 |
|
19094 | var _beeButton = __webpack_require__(155);
|
19095 |
|
19096 | var _beeButton2 = _interopRequireDefault(_beeButton);
|
19097 |
|
19098 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19099 |
|
19100 | 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; }
|
19101 |
|
19102 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
19103 |
|
19104 | 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; }
|
19105 |
|
19106 | 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); } |
19107 |
|
19108 |
|
19109 |
|
19110 |
|
19111 | var CheckboxGroup = _src2['default'].CheckboxGroup;
|
19112 |
|
19113 | var Demo4 = function (_Component) {
|
19114 | _inherits(Demo4, _Component);
|
19115 |
|
19116 | function Demo4(props) {
|
19117 | _classCallCheck(this, Demo4);
|
19118 |
|
19119 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
19120 |
|
19121 | _this.change = function (value) {
|
19122 | _this.setState({
|
19123 | value: value
|
19124 | });
|
19125 | };
|
19126 |
|
19127 | _this.click = function () {
|
19128 | _this.props.form.validateFields(function (error, values) {
|
19129 | console.log(values);
|
19130 | });
|
19131 | };
|
19132 |
|
19133 | _this.state = {
|
19134 | value: ['3', '4']
|
19135 | };
|
19136 | return _this;
|
19137 | }
|
19138 |
|
19139 | Demo4.prototype.render = function render() {
|
19140 | var self = this;
|
19141 | var _props$form = this.props.form,
|
19142 | getFieldProps = _props$form.getFieldProps,
|
19143 | getFieldError = _props$form.getFieldError;
|
19144 |
|
19145 | return _react2['default'].createElement(
|
19146 | 'div',
|
19147 | { className: 'demo-checkbox' },
|
19148 | _react2['default'].createElement(
|
19149 | CheckboxGroup,
|
19150 | getFieldProps('name', {
|
19151 | initialValue: ['2', '3'],
|
19152 | onChange: self.change
|
19153 | }),
|
19154 | _react2['default'].createElement(
|
19155 | _src2['default'],
|
19156 | { value: '1' },
|
19157 | '1'
|
19158 | ),
|
19159 | _react2['default'].createElement(
|
19160 | _src2['default'],
|
19161 | { value: '2' },
|
19162 | '2'
|
19163 | ),
|
19164 | _react2['default'].createElement(
|
19165 | _src2['default'],
|
19166 | { value: '3' },
|
19167 | '3'
|
19168 | ),
|
19169 | _react2['default'].createElement(
|
19170 | _src2['default'],
|
19171 | { value: '4' },
|
19172 | '4'
|
19173 | ),
|
19174 | _react2['default'].createElement(
|
19175 | _src2['default'],
|
19176 | { value: '5' },
|
19177 | '5'
|
19178 | )
|
19179 | ),
|
19180 | _react2['default'].createElement(
|
19181 | _beeButton2['default'],
|
19182 | { colors: 'secondary', onClick: this.click },
|
19183 | 'submit'
|
19184 | )
|
19185 | );
|
19186 | };
|
19187 |
|
19188 | return Demo4;
|
19189 | }(_react.Component);
|
19190 |
|
19191 | exports['default'] = _beeForm2['default'].createForm()(Demo4);
|
19192 | module.exports = exports['default'];
|
19193 |
|
19194 | }),
|
19195 |
|
19196 | (function(module, exports, __webpack_require__) {
|
19197 |
|
19198 | 'use strict';
|
19199 |
|
19200 | Object.defineProperty(exports, "__esModule", {
|
19201 | value: true
|
19202 | });
|
19203 |
|
19204 | var _Form = __webpack_require__(168);
|
19205 |
|
19206 | var _Form2 = _interopRequireDefault(_Form);
|
19207 |
|
19208 | var _FormItem = __webpack_require__(335);
|
19209 |
|
19210 | var _FormItem2 = _interopRequireDefault(_FormItem);
|
19211 |
|
19212 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
19213 |
|
19214 | _Form2["default"].FormItem = _FormItem2["default"];
|
19215 | exports["default"] = _Form2["default"];
|
19216 | module.exports = exports['default'];
|
19217 |
|
19218 | }),
|
19219 |
|
19220 | (function(module, exports, __webpack_require__) {
|
19221 |
|
19222 | 'use strict';
|
19223 |
|
19224 | Object.defineProperty(exports, "__esModule", {
|
19225 | value: true
|
19226 | });
|
19227 |
|
19228 | var _react = __webpack_require__(1);
|
19229 |
|
19230 | var _react2 = _interopRequireDefault(_react);
|
19231 |
|
19232 | var _propTypes = __webpack_require__(6);
|
19233 |
|
19234 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
19235 |
|
19236 | var _rcForm = __webpack_require__(169);
|
19237 |
|
19238 | var _classnames = __webpack_require__(5);
|
19239 |
|
19240 | var _classnames2 = _interopRequireDefault(_classnames);
|
19241 |
|
19242 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
19243 |
|
19244 | 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; }
|
19245 |
|
19246 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
19247 |
|
19248 | 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; }
|
19249 |
|
19250 | 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); }
|
19251 |
|
19252 | var propTypes = {
|
19253 | prefixCls: _propTypes2["default"].string,
|
19254 | onSubmit: _propTypes2["default"].func
|
19255 | };
|
19256 | var defaultProps = {
|
19257 | prefixCls: 'u-form',
|
19258 | onSubmit: function onSubmit() {}
|
19259 | };
|
19260 |
|
19261 | var Form = function (_Component) {
|
19262 | _inherits(Form, _Component);
|
19263 |
|
19264 | function Form(props) {
|
19265 | _classCallCheck(this, Form);
|
19266 |
|
19267 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
19268 | }
|
19269 |
|
19270 | Form.prototype.render = function render() {
|
19271 | var _props = this.props,
|
19272 | prefixCls = _props.prefixCls,
|
19273 | _props$className = _props.className,
|
19274 | className = _props$className === undefined ? '' : _props$className,
|
19275 | children = _props.children,
|
19276 | style = _props.style,
|
19277 | onSubmit = _props.onSubmit;
|
19278 |
|
19279 | var formClassName = (0, _classnames2["default"])(prefixCls, className);
|
19280 | return _react2["default"].createElement(
|
19281 | 'form',
|
19282 | { className: prefixCls + ' ' + className, style: style, onSubmit: onSubmit },
|
19283 | children
|
19284 | );
|
19285 | };
|
19286 |
|
19287 | return Form;
|
19288 | }(_react.Component);
|
19289 |
|
19290 | ;
|
19291 | Form.createForm = _rcForm.createForm;
|
19292 | Form.createFormField = _rcForm.createFormField;
|
19293 | Form.propTypes = propTypes;
|
19294 | Form.defaultProps = defaultProps;
|
19295 | exports["default"] = Form;
|
19296 | module.exports = exports['default'];
|
19297 |
|
19298 | }),
|
19299 |
|
19300 | (function(module, exports, __webpack_require__) {
|
19301 |
|
19302 | 'use strict';
|
19303 |
|
19304 | Object.defineProperty(exports, "__esModule", {
|
19305 | value: true
|
19306 | });
|
19307 | exports.createForm = exports.formShape = exports.createFormField = undefined;
|
19308 |
|
19309 | var _createForm = __webpack_require__(170);
|
19310 |
|
19311 | var _createForm2 = _interopRequireDefault(_createForm);
|
19312 |
|
19313 | var _createFormField = __webpack_require__(328);
|
19314 |
|
19315 | var _createFormField2 = _interopRequireDefault(_createFormField);
|
19316 |
|
19317 | var _propTypes = __webpack_require__(334);
|
19318 |
|
19319 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
19320 |
|
19321 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19322 |
|
19323 | exports.createFormField = _createFormField2['default'];
|
19324 | exports.formShape = _propTypes2['default'];
|
19325 | exports.createForm = _createForm2['default'];
|
19326 |
|
19327 | }),
|
19328 |
|
19329 | (function(module, exports, __webpack_require__) {
|
19330 |
|
19331 | 'use strict';
|
19332 |
|
19333 | Object.defineProperty(exports, "__esModule", {
|
19334 | value: true
|
19335 | });
|
19336 | exports.mixin = undefined;
|
19337 |
|
19338 | var _createBaseForm = __webpack_require__(171);
|
19339 |
|
19340 | var _createBaseForm2 = _interopRequireDefault(_createBaseForm);
|
19341 |
|
19342 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19343 |
|
19344 | var mixin = exports.mixin = {
|
19345 | getForm: function getForm() {
|
19346 | return {
|
19347 | getFieldsValue: this.fieldsStore.getFieldsValue,
|
19348 | getFieldValue: this.fieldsStore.getFieldValue,
|
19349 | getFieldInstance: this.getFieldInstance,
|
19350 | setFieldsValue: this.setFieldsValue,
|
19351 | setFields: this.setFields,
|
19352 | setFieldsInitialValue: this.fieldsStore.setFieldsInitialValue,
|
19353 | getFieldDecorator: this.getFieldDecorator,
|
19354 | getFieldProps: this.getFieldProps,
|
19355 | getFieldsError: this.fieldsStore.getFieldsError,
|
19356 | getFieldError: this.fieldsStore.getFieldError,
|
19357 | isFieldValidating: this.fieldsStore.isFieldValidating,
|
19358 | isFieldsValidating: this.fieldsStore.isFieldsValidating,
|
19359 | isFieldsTouched: this.fieldsStore.isFieldsTouched,
|
19360 | isFieldTouched: this.fieldsStore.isFieldTouched,
|
19361 | isSubmitting: this.isSubmitting,
|
19362 | submit: this.submit,
|
19363 | validateFields: this.validateFields,
|
19364 | resetFields: this.resetFields
|
19365 | };
|
19366 | }
|
19367 | };
|
19368 |
|
19369 | function createForm(options) {
|
19370 | return (0, _createBaseForm2['default'])(options, [mixin]);
|
19371 | }
|
19372 |
|
19373 | exports['default'] = createForm;
|
19374 |
|
19375 | }),
|
19376 |
|
19377 | (function(module, exports, __webpack_require__) {
|
19378 |
|
19379 | (function(process) {'use strict';
|
19380 |
|
19381 | Object.defineProperty(exports, "__esModule", {
|
19382 | value: true
|
19383 | });
|
19384 |
|
19385 | var _objectWithoutProperties2 = __webpack_require__(172);
|
19386 |
|
19387 | var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
19388 |
|
19389 | var _defineProperty2 = __webpack_require__(173);
|
19390 |
|
19391 | var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
19392 |
|
19393 | var _extends5 = __webpack_require__(177);
|
19394 |
|
19395 | var _extends6 = _interopRequireDefault(_extends5);
|
19396 |
|
19397 | var _toConsumableArray2 = __webpack_require__(192);
|
19398 |
|
19399 | var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
|
19400 |
|
19401 | var _react = __webpack_require__(1);
|
19402 |
|
19403 | var _react2 = _interopRequireDefault(_react);
|
19404 |
|
19405 | var _createReactClass = __webpack_require__(220);
|
19406 |
|
19407 | var _createReactClass2 = _interopRequireDefault(_createReactClass);
|
19408 |
|
19409 | var _asyncValidator = __webpack_require__(226);
|
19410 |
|
19411 | var _asyncValidator2 = _interopRequireDefault(_asyncValidator);
|
19412 |
|
19413 | var _warning = __webpack_require__(32);
|
19414 |
|
19415 | var _warning2 = _interopRequireDefault(_warning);
|
19416 |
|
19417 | var _get = __webpack_require__(267);
|
19418 |
|
19419 | var _get2 = _interopRequireDefault(_get);
|
19420 |
|
19421 | var _set = __webpack_require__(319);
|
19422 |
|
19423 | var _set2 = _interopRequireDefault(_set);
|
19424 |
|
19425 | var _eq = __webpack_require__(304);
|
19426 |
|
19427 | var _eq2 = _interopRequireDefault(_eq);
|
19428 |
|
19429 | var _createFieldsStore = __webpack_require__(325);
|
19430 |
|
19431 | var _createFieldsStore2 = _interopRequireDefault(_createFieldsStore);
|
19432 |
|
19433 | var _utils = __webpack_require__(329);
|
19434 |
|
19435 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19436 |
|
19437 | var DEFAULT_TRIGGER = 'onChange';
|
19438 |
|
19439 |
|
19440 | function createBaseForm() {
|
19441 | var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
19442 | var mixins = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
19443 | var validateMessages = option.validateMessages,
|
19444 | onFieldsChange = option.onFieldsChange,
|
19445 | onValuesChange = option.onValuesChange,
|
19446 | _option$mapProps = option.mapProps,
|
19447 | mapProps = _option$mapProps === undefined ? _utils.identity : _option$mapProps,
|
19448 | mapPropsToFields = option.mapPropsToFields,
|
19449 | fieldNameProp = option.fieldNameProp,
|
19450 | fieldMetaProp = option.fieldMetaProp,
|
19451 | fieldDataProp = option.fieldDataProp,
|
19452 | _option$formPropName = option.formPropName,
|
19453 | formPropName = _option$formPropName === undefined ? 'form' : _option$formPropName,
|
19454 | formName = option.name,
|
19455 | withRef = option.withRef;
|
19456 |
|
19457 |
|
19458 | return function decorate(WrappedComponent) {
|
19459 | var Form = (0, _createReactClass2['default'])({
|
19460 | displayName: 'Form',
|
19461 |
|
19462 | mixins: mixins,
|
19463 |
|
19464 | getInitialState: function getInitialState() {
|
19465 | var _this = this;
|
19466 |
|
19467 | var fields = mapPropsToFields && mapPropsToFields(this.props);
|
19468 | this.fieldsStore = (0, _createFieldsStore2['default'])(fields || {});
|
19469 |
|
19470 | this.instances = {};
|
19471 | this.cachedBind = {};
|
19472 | this.clearedFieldMetaCache = {};
|
19473 |
|
19474 | this.renderFields = {};
|
19475 | this.domFields = {};
|
19476 |
|
19477 |
|
19478 | ['getFieldsValue', 'getFieldValue', 'setFieldsInitialValue', 'getFieldsError', 'getFieldError', 'isFieldValidating', 'isFieldsValidating', 'isFieldsTouched', 'isFieldTouched'].forEach(function (key) {
|
19479 | _this[key] = function () {
|
19480 | var _fieldsStore;
|
19481 |
|
19482 | if (process.env.NODE_ENV !== 'production') {
|
19483 | (0, _warning2['default'])(false, 'you should not use `ref` on enhanced form, please use `wrappedComponentRef`. ' + 'See: https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140');
|
19484 | }
|
19485 | return (_fieldsStore = _this.fieldsStore)[key].apply(_fieldsStore, arguments);
|
19486 | };
|
19487 | });
|
19488 |
|
19489 | return {
|
19490 | submitting: false
|
19491 | };
|
19492 | },
|
19493 | componentDidMount: function componentDidMount() {
|
19494 | this.cleanUpUselessFields();
|
19495 | },
|
19496 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
|
19497 | if (mapPropsToFields) {
|
19498 | this.fieldsStore.updateFields(mapPropsToFields(nextProps));
|
19499 | }
|
19500 | },
|
19501 | componentDidUpdate: function componentDidUpdate() {
|
19502 | this.cleanUpUselessFields();
|
19503 | },
|
19504 | onCollectCommon: function onCollectCommon(name, action, args) {
|
19505 | var fieldMeta = this.fieldsStore.getFieldMeta(name);
|
19506 | if (fieldMeta[action]) {
|
19507 | fieldMeta[action].apply(fieldMeta, (0, _toConsumableArray3['default'])(args));
|
19508 | } else if (fieldMeta.originalProps && fieldMeta.originalProps[action]) {
|
19509 | var _fieldMeta$originalPr;
|
19510 |
|
19511 | (_fieldMeta$originalPr = fieldMeta.originalProps)[action].apply(_fieldMeta$originalPr, (0, _toConsumableArray3['default'])(args));
|
19512 | }
|
19513 | var value = fieldMeta.getValueFromEvent ? fieldMeta.getValueFromEvent.apply(fieldMeta, (0, _toConsumableArray3['default'])(args)) : _utils.getValueFromEvent.apply(undefined, (0, _toConsumableArray3['default'])(args));
|
19514 | if (onValuesChange && value !== this.fieldsStore.getFieldValue(name)) {
|
19515 | var valuesAll = this.fieldsStore.getAllValues();
|
19516 | var valuesAllSet = {};
|
19517 | valuesAll[name] = value;
|
19518 | Object.keys(valuesAll).forEach(function (key) {
|
19519 | return (0, _set2['default'])(valuesAllSet, key, valuesAll[key]);
|
19520 | });
|
19521 | onValuesChange((0, _extends6['default'])((0, _defineProperty3['default'])({}, formPropName, this.getForm()), this.props), (0, _set2['default'])({}, name, value), valuesAllSet);
|
19522 | }
|
19523 | var field = this.fieldsStore.getField(name);
|
19524 | return { name: name, field: (0, _extends6['default'])({}, field, { value: value, touched: true }), fieldMeta: fieldMeta };
|
19525 | },
|
19526 | onCollect: function onCollect(name_, action) {
|
19527 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
19528 | args[_key - 2] = arguments[_key];
|
19529 | }
|
19530 |
|
19531 | var _onCollectCommon = this.onCollectCommon(name_, action, args),
|
19532 | name = _onCollectCommon.name,
|
19533 | field = _onCollectCommon.field,
|
19534 | fieldMeta = _onCollectCommon.fieldMeta;
|
19535 |
|
19536 | var validate = fieldMeta.validate;
|
19537 |
|
19538 |
|
19539 | this.fieldsStore.setFieldsAsDirty();
|
19540 |
|
19541 | var newField = (0, _extends6['default'])({}, field, {
|
19542 | dirty: (0, _utils.hasRules)(validate)
|
19543 | });
|
19544 | this.setFields((0, _defineProperty3['default'])({}, name, newField));
|
19545 | },
|
19546 | onCollectValidate: function onCollectValidate(name_, action) {
|
19547 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
19548 | args[_key2 - 2] = arguments[_key2];
|
19549 | }
|
19550 |
|
19551 | var _onCollectCommon2 = this.onCollectCommon(name_, action, args),
|
19552 | field = _onCollectCommon2.field,
|
19553 | fieldMeta = _onCollectCommon2.fieldMeta;
|
19554 |
|
19555 | var newField = (0, _extends6['default'])({}, field, {
|
19556 | dirty: true
|
19557 | });
|
19558 |
|
19559 | this.fieldsStore.setFieldsAsDirty();
|
19560 |
|
19561 | this.validateFieldsInternal([newField], {
|
19562 | action: action,
|
19563 | options: {
|
19564 | firstFields: !!fieldMeta.validateFirst
|
19565 | }
|
19566 | });
|
19567 | },
|
19568 | getCacheBind: function getCacheBind(name, action, fn) {
|
19569 | if (!this.cachedBind[name]) {
|
19570 | this.cachedBind[name] = {};
|
19571 | }
|
19572 | var cache = this.cachedBind[name];
|
19573 | if (!cache[action] || cache[action].oriFn !== fn) {
|
19574 | cache[action] = {
|
19575 | fn: fn.bind(this, name, action),
|
19576 | oriFn: fn
|
19577 | };
|
19578 | }
|
19579 | return cache[action].fn;
|
19580 | },
|
19581 | getFieldDecorator: function getFieldDecorator(name, fieldOption) {
|
19582 | var _this2 = this;
|
19583 |
|
19584 | var props = this.getFieldProps(name, fieldOption);
|
19585 | return function (fieldElem) {
|
19586 |
|
19587 | _this2.renderFields[name] = true;
|
19588 |
|
19589 | var fieldMeta = _this2.fieldsStore.getFieldMeta(name);
|
19590 | var originalProps = fieldElem.props;
|
19591 | if (process.env.NODE_ENV !== 'production') {
|
19592 | var valuePropName = fieldMeta.valuePropName;
|
19593 | (0, _warning2['default'])(!(valuePropName in originalProps), '`getFieldDecorator` will override `' + valuePropName + '`, ' + ('so please don\'t set `' + valuePropName + '` directly ') + 'and use `setFieldsValue` to set it.');
|
19594 | var defaultValuePropName = 'default' + valuePropName[0].toUpperCase() + valuePropName.slice(1);
|
19595 | (0, _warning2['default'])(!(defaultValuePropName in originalProps), '`' + defaultValuePropName + '` is invalid ' + ('for `getFieldDecorator` will set `' + valuePropName + '`,') + ' please use `option.initialValue` instead.');
|
19596 | }
|
19597 | fieldMeta.originalProps = originalProps;
|
19598 | fieldMeta.ref = fieldElem.ref;
|
19599 | return _react2['default'].cloneElement(fieldElem, (0, _extends6['default'])({}, props, _this2.fieldsStore.getFieldValuePropValue(fieldMeta)));
|
19600 | };
|
19601 | },
|
19602 | getFieldProps: function getFieldProps(name) {
|
19603 | var _this3 = this;
|
19604 |
|
19605 | var usersFieldOption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
19606 |
|
19607 | if (!name) {
|
19608 | throw new Error('Must call `getFieldProps` with valid name string!');
|
19609 | }
|
19610 | if (process.env.NODE_ENV !== 'production') {
|
19611 | (0, _warning2['default'])(this.fieldsStore.isValidNestedFieldName(name), 'One field name cannot be part of another, e.g. `a` and `a.b`.');
|
19612 | (0, _warning2['default'])(!('exclusive' in usersFieldOption), '`option.exclusive` of `getFieldProps`|`getFieldDecorator` had been remove.');
|
19613 | }
|
19614 |
|
19615 | delete this.clearedFieldMetaCache[name];
|
19616 |
|
19617 | var fieldOption = (0, _extends6['default'])({
|
19618 | name: name,
|
19619 | trigger: DEFAULT_TRIGGER,
|
19620 | valuePropName: 'value',
|
19621 | validate: []
|
19622 | }, usersFieldOption);
|
19623 |
|
19624 | var rules = fieldOption.rules,
|
19625 | trigger = fieldOption.trigger,
|
19626 | _fieldOption$validate = fieldOption.validateTrigger,
|
19627 | validateTrigger = _fieldOption$validate === undefined ? trigger : _fieldOption$validate,
|
19628 | validate = fieldOption.validate;
|
19629 |
|
19630 |
|
19631 | var fieldMeta = this.fieldsStore.getFieldMeta(name);
|
19632 | if ('initialValue' in fieldOption) {
|
19633 | fieldMeta.initialValue = fieldOption.initialValue;
|
19634 | }
|
19635 |
|
19636 | var inputProps = (0, _extends6['default'])({}, this.fieldsStore.getFieldValuePropValue(fieldOption), {
|
19637 | ref: this.getCacheBind(name, name + '__ref', this.saveRef)
|
19638 | });
|
19639 | if (fieldNameProp) {
|
19640 | inputProps[fieldNameProp] = formName ? formName + '_' + name : name;
|
19641 | }
|
19642 |
|
19643 | var validateRules = (0, _utils.normalizeValidateRules)(validate, rules, validateTrigger);
|
19644 | var validateTriggers = (0, _utils.getValidateTriggers)(validateRules);
|
19645 | validateTriggers.forEach(function (action) {
|
19646 | if (inputProps[action]) return;
|
19647 | inputProps[action] = _this3.getCacheBind(name, action, _this3.onCollectValidate);
|
19648 | });
|
19649 |
|
19650 |
|
19651 | if (trigger && validateTriggers.indexOf(trigger) === -1) {
|
19652 | inputProps[trigger] = this.getCacheBind(name, trigger, this.onCollect);
|
19653 | }
|
19654 |
|
19655 | var meta = (0, _extends6['default'])({}, fieldMeta, fieldOption, {
|
19656 | validate: validateRules
|
19657 | });
|
19658 | this.fieldsStore.setFieldMeta(name, meta);
|
19659 | if (fieldMetaProp) {
|
19660 | inputProps[fieldMetaProp] = meta;
|
19661 | }
|
19662 |
|
19663 | if (fieldDataProp) {
|
19664 | inputProps[fieldDataProp] = this.fieldsStore.getField(name);
|
19665 | }
|
19666 |
|
19667 |
|
19668 | this.renderFields[name] = true;
|
19669 |
|
19670 | return inputProps;
|
19671 | },
|
19672 | getFieldInstance: function getFieldInstance(name) {
|
19673 | return this.instances[name];
|
19674 | },
|
19675 | getRules: function getRules(fieldMeta, action) {
|
19676 | var actionRules = fieldMeta.validate.filter(function (item) {
|
19677 | return !action || item.trigger.indexOf(action) >= 0;
|
19678 | }).map(function (item) {
|
19679 | return item.rules;
|
19680 | });
|
19681 | return (0, _utils.flattenArray)(actionRules);
|
19682 | },
|
19683 | setFields: function setFields(maybeNestedFields, callback) {
|
19684 | var _this4 = this;
|
19685 |
|
19686 | var fields = this.fieldsStore.flattenRegisteredFields(maybeNestedFields);
|
19687 | this.fieldsStore.setFields(fields);
|
19688 | if (onFieldsChange) {
|
19689 | var changedFields = Object.keys(fields).reduce(function (acc, name) {
|
19690 | return (0, _set2['default'])(acc, name, _this4.fieldsStore.getField(name));
|
19691 | }, {});
|
19692 | onFieldsChange((0, _extends6['default'])((0, _defineProperty3['default'])({}, formPropName, this.getForm()), this.props), changedFields, this.fieldsStore.getNestedAllFields());
|
19693 | }
|
19694 | this.forceUpdate(callback);
|
19695 | },
|
19696 | setFieldsValue: function setFieldsValue(changedValues, callback) {
|
19697 | var fieldsMeta = this.fieldsStore.fieldsMeta;
|
19698 |
|
19699 | var values = this.fieldsStore.flattenRegisteredFields(changedValues);
|
19700 | var newFields = Object.keys(values).reduce(function (acc, name) {
|
19701 | var isRegistered = fieldsMeta[name];
|
19702 | if (process.env.NODE_ENV !== 'production') {
|
19703 | (0, _warning2['default'])(isRegistered, 'Cannot use `setFieldsValue` until ' + 'you use `getFieldDecorator` or `getFieldProps` to register it.');
|
19704 | }
|
19705 | if (isRegistered) {
|
19706 | var value = values[name];
|
19707 | acc[name] = {
|
19708 | value: value
|
19709 | };
|
19710 | }
|
19711 | return acc;
|
19712 | }, {});
|
19713 | this.setFields(newFields, callback);
|
19714 | if (onValuesChange) {
|
19715 | var allValues = this.fieldsStore.getAllValues();
|
19716 | onValuesChange((0, _extends6['default'])((0, _defineProperty3['default'])({}, formPropName, this.getForm()), this.props), changedValues, allValues);
|
19717 | }
|
19718 | },
|
19719 | saveRef: function saveRef(name, _, component) {
|
19720 | if (!component) {
|
19721 | var _fieldMeta = this.fieldsStore.getFieldMeta(name);
|
19722 | if (!_fieldMeta.preserve) {
|
19723 |
|
19724 | this.clearedFieldMetaCache[name] = {
|
19725 | field: this.fieldsStore.getField(name),
|
19726 | meta: _fieldMeta
|
19727 | };
|
19728 | this.clearField(name);
|
19729 | }
|
19730 | delete this.domFields[name];
|
19731 | return;
|
19732 | }
|
19733 | this.domFields[name] = true;
|
19734 | this.recoverClearedField(name);
|
19735 | var fieldMeta = this.fieldsStore.getFieldMeta(name);
|
19736 | if (fieldMeta) {
|
19737 | var ref = fieldMeta.ref;
|
19738 | if (ref) {
|
19739 | if (typeof ref === 'string') {
|
19740 | throw new Error('can not set ref string for ' + name);
|
19741 | } else if (typeof ref === 'function') {
|
19742 | ref(component);
|
19743 | } else if (Object.prototype.hasOwnProperty.call(ref, 'current')) {
|
19744 | ref.current = component;
|
19745 | }
|
19746 | }
|
19747 | }
|
19748 | this.instances[name] = component;
|
19749 | },
|
19750 | cleanUpUselessFields: function cleanUpUselessFields() {
|
19751 | var _this5 = this;
|
19752 |
|
19753 | var fieldList = this.fieldsStore.getAllFieldsName();
|
19754 | var removedList = fieldList.filter(function (field) {
|
19755 | var fieldMeta = _this5.fieldsStore.getFieldMeta(field);
|
19756 | return !_this5.renderFields[field] && !_this5.domFields[field] && !fieldMeta.preserve;
|
19757 | });
|
19758 | if (removedList.length) {
|
19759 | removedList.forEach(this.clearField);
|
19760 | }
|
19761 | this.renderFields = {};
|
19762 | },
|
19763 | clearField: function clearField(name) {
|
19764 | this.fieldsStore.clearField(name);
|
19765 | delete this.instances[name];
|
19766 | delete this.cachedBind[name];
|
19767 | },
|
19768 | resetFields: function resetFields(ns) {
|
19769 | var _this6 = this;
|
19770 |
|
19771 | var newFields = this.fieldsStore.resetFields(ns);
|
19772 | if (Object.keys(newFields).length > 0) {
|
19773 | this.setFields(newFields);
|
19774 | }
|
19775 | if (ns) {
|
19776 | var names = Array.isArray(ns) ? ns : [ns];
|
19777 | names.forEach(function (name) {
|
19778 | return delete _this6.clearedFieldMetaCache[name];
|
19779 | });
|
19780 | } else {
|
19781 | this.clearedFieldMetaCache = {};
|
19782 | }
|
19783 | },
|
19784 | recoverClearedField: function recoverClearedField(name) {
|
19785 | if (this.clearedFieldMetaCache[name]) {
|
19786 | this.fieldsStore.setFields((0, _defineProperty3['default'])({}, name, this.clearedFieldMetaCache[name].field));
|
19787 | this.fieldsStore.setFieldMeta(name, this.clearedFieldMetaCache[name].meta);
|
19788 | delete this.clearedFieldMetaCache[name];
|
19789 | }
|
19790 | },
|
19791 | validateFieldsInternal: function validateFieldsInternal(fields, _ref, callback) {
|
19792 | var _this7 = this;
|
19793 |
|
19794 | var fieldNames = _ref.fieldNames,
|
19795 | action = _ref.action,
|
19796 | _ref$options = _ref.options,
|
19797 | options = _ref$options === undefined ? {} : _ref$options;
|
19798 |
|
19799 | var allRules = {};
|
19800 | var allValues = {};
|
19801 | var allFields = {};
|
19802 | var alreadyErrors = {};
|
19803 | fields.forEach(function (field) {
|
19804 | var name = field.name;
|
19805 | if (options.force !== true && field.dirty === false) {
|
19806 | if (field.errors) {
|
19807 | (0, _set2['default'])(alreadyErrors, name, { errors: field.errors });
|
19808 | }
|
19809 | return;
|
19810 | }
|
19811 | var fieldMeta = _this7.fieldsStore.getFieldMeta(name);
|
19812 | var newField = (0, _extends6['default'])({}, field);
|
19813 | newField.errors = undefined;
|
19814 | newField.validating = true;
|
19815 | newField.dirty = true;
|
19816 | allRules[name] = _this7.getRules(fieldMeta, action);
|
19817 | allValues[name] = newField.value;
|
19818 | allFields[name] = newField;
|
19819 | });
|
19820 | this.setFields(allFields);
|
19821 |
|
19822 | Object.keys(allValues).forEach(function (f) {
|
19823 | allValues[f] = _this7.fieldsStore.getFieldValue(f);
|
19824 | });
|
19825 | if (callback && (0, _utils.isEmptyObject)(allFields)) {
|
19826 | callback((0, _utils.isEmptyObject)(alreadyErrors) ? null : alreadyErrors, this.fieldsStore.getFieldsValue(fieldNames));
|
19827 | return;
|
19828 | }
|
19829 | var validator = new _asyncValidator2['default'](allRules);
|
19830 | if (validateMessages) {
|
19831 | validator.messages(validateMessages);
|
19832 | }
|
19833 | validator.validate(allValues, options, function (errors) {
|
19834 | var errorsGroup = (0, _extends6['default'])({}, alreadyErrors);
|
19835 | if (errors && errors.length) {
|
19836 | errors.forEach(function (e) {
|
19837 | var errorFieldName = e.field;
|
19838 | var fieldName = errorFieldName;
|
19839 |
|
19840 |
|
19841 |
|
19842 | Object.keys(allRules).some(function (ruleFieldName) {
|
19843 | var rules = allRules[ruleFieldName] || [];
|
19844 |
|
19845 |
|
19846 | if (ruleFieldName === errorFieldName) {
|
19847 | fieldName = ruleFieldName;
|
19848 | return true;
|
19849 | }
|
19850 |
|
19851 |
|
19852 | if (rules.every(function (_ref2) {
|
19853 | var type = _ref2.type;
|
19854 | return type !== 'array';
|
19855 | }) && errorFieldName.indexOf(ruleFieldName) !== 0) {
|
19856 | return false;
|
19857 | }
|
19858 |
|
19859 |
|
19860 | var restPath = errorFieldName.slice(ruleFieldName.length + 1);
|
19861 | if (/\d+/.test(restPath)) {
|
19862 | fieldName = ruleFieldName;
|
19863 | return true;
|
19864 | }
|
19865 |
|
19866 | return false;
|
19867 | });
|
19868 |
|
19869 | var field = (0, _get2['default'])(errorsGroup, fieldName);
|
19870 | if (typeof field !== 'object' || Array.isArray(field)) {
|
19871 | (0, _set2['default'])(errorsGroup, fieldName, { errors: [] });
|
19872 | }
|
19873 | var fieldErrors = (0, _get2['default'])(errorsGroup, fieldName.concat('.errors'));
|
19874 | fieldErrors.push(e);
|
19875 | });
|
19876 | }
|
19877 | var expired = [];
|
19878 | var nowAllFields = {};
|
19879 | Object.keys(allRules).forEach(function (name) {
|
19880 | var fieldErrors = (0, _get2['default'])(errorsGroup, name);
|
19881 | var nowField = _this7.fieldsStore.getField(name);
|
19882 |
|
19883 | if (!(0, _eq2['default'])(nowField.value, allValues[name])) {
|
19884 | expired.push({
|
19885 | name: name
|
19886 | });
|
19887 | } else {
|
19888 | nowField.errors = fieldErrors && fieldErrors.errors;
|
19889 | nowField.value = allValues[name];
|
19890 | nowField.validating = false;
|
19891 | nowField.dirty = false;
|
19892 | nowAllFields[name] = nowField;
|
19893 | }
|
19894 | });
|
19895 | _this7.setFields(nowAllFields);
|
19896 | if (callback) {
|
19897 | if (expired.length) {
|
19898 | expired.forEach(function (_ref3) {
|
19899 | var name = _ref3.name;
|
19900 |
|
19901 | var fieldErrors = [{
|
19902 | message: name + ' need to revalidate',
|
19903 | field: name
|
19904 | }];
|
19905 | (0, _set2['default'])(errorsGroup, name, {
|
19906 | expired: true,
|
19907 | errors: fieldErrors
|
19908 | });
|
19909 | });
|
19910 | }
|
19911 |
|
19912 | callback((0, _utils.isEmptyObject)(errorsGroup) ? null : errorsGroup, _this7.fieldsStore.getFieldsValue(fieldNames));
|
19913 | }
|
19914 | });
|
19915 | },
|
19916 | validateFields: function validateFields(ns, opt, cb) {
|
19917 | var _this8 = this;
|
19918 |
|
19919 | var pending = new Promise(function (resolve, reject) {
|
19920 | var _getParams = (0, _utils.getParams)(ns, opt, cb),
|
19921 | names = _getParams.names,
|
19922 | options = _getParams.options;
|
19923 |
|
19924 | var _getParams2 = (0, _utils.getParams)(ns, opt, cb),
|
19925 | callback = _getParams2.callback;
|
19926 |
|
19927 | if (!callback || typeof callback === 'function') {
|
19928 | var oldCb = callback;
|
19929 | callback = function callback(errors, values) {
|
19930 | if (oldCb) {
|
19931 | oldCb(errors, values);
|
19932 | } else if (errors) {
|
19933 | reject({ errors: errors, values: values });
|
19934 | } else {
|
19935 | resolve(values);
|
19936 | }
|
19937 | };
|
19938 | }
|
19939 | var fieldNames = names ? _this8.fieldsStore.getValidFieldsFullName(names) : _this8.fieldsStore.getValidFieldsName();
|
19940 | var fields = fieldNames.filter(function (name) {
|
19941 | var fieldMeta = _this8.fieldsStore.getFieldMeta(name);
|
19942 | return (0, _utils.hasRules)(fieldMeta.validate);
|
19943 | }).map(function (name) {
|
19944 | var field = _this8.fieldsStore.getField(name);
|
19945 | field.value = _this8.fieldsStore.getFieldValue(name);
|
19946 | return field;
|
19947 | });
|
19948 | if (!fields.length) {
|
19949 | callback(null, _this8.fieldsStore.getFieldsValue(fieldNames));
|
19950 | return;
|
19951 | }
|
19952 | if (!('firstFields' in options)) {
|
19953 | options.firstFields = fieldNames.filter(function (name) {
|
19954 | var fieldMeta = _this8.fieldsStore.getFieldMeta(name);
|
19955 | return !!fieldMeta.validateFirst;
|
19956 | });
|
19957 | }
|
19958 | _this8.validateFieldsInternal(fields, {
|
19959 | fieldNames: fieldNames,
|
19960 | options: options
|
19961 | }, callback);
|
19962 | });
|
19963 | pending['catch'](function (e) {
|
19964 | if (console.error) {
|
19965 |
|
19966 | console.error(e);
|
19967 | }
|
19968 | return e;
|
19969 | });
|
19970 | return pending;
|
19971 | },
|
19972 | isSubmitting: function isSubmitting() {
|
19973 | if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
|
19974 | (0, _warning2['default'])(false, '`isSubmitting` is deprecated. ' + 'Actually, it\'s more convenient to handle submitting status by yourself.');
|
19975 | }
|
19976 | return this.state.submitting;
|
19977 | },
|
19978 | submit: function submit(callback) {
|
19979 | var _this9 = this;
|
19980 |
|
19981 | if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
|
19982 | (0, _warning2['default'])(false, '`submit` is deprecated. ' + 'Actually, it\'s more convenient to handle submitting status by yourself.');
|
19983 | }
|
19984 | var fn = function fn() {
|
19985 | _this9.setState({
|
19986 | submitting: false
|
19987 | });
|
19988 | };
|
19989 | this.setState({
|
19990 | submitting: true
|
19991 | });
|
19992 | callback(fn);
|
19993 | },
|
19994 | render: function render() {
|
19995 | var _props = this.props,
|
19996 | wrappedComponentRef = _props.wrappedComponentRef,
|
19997 | restProps = (0, _objectWithoutProperties3['default'])(_props, ['wrappedComponentRef']);
|
19998 |
|
19999 | var formProps = (0, _defineProperty3['default'])({}, formPropName, this.getForm());
|
20000 | if (withRef) {
|
20001 | if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
|
20002 | (0, _warning2['default'])(false, '`withRef` is deprecated, please use `wrappedComponentRef` instead. ' + 'See: https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140');
|
20003 | }
|
20004 | formProps.ref = 'wrappedComponent';
|
20005 | } else if (wrappedComponentRef) {
|
20006 | formProps.ref = wrappedComponentRef;
|
20007 | }
|
20008 | var props = mapProps.call(this, (0, _extends6['default'])({}, formProps, restProps));
|
20009 | return _react2['default'].createElement(WrappedComponent, props);
|
20010 | }
|
20011 | });
|
20012 |
|
20013 | return (0, _utils.argumentContainer)(Form, WrappedComponent);
|
20014 | };
|
20015 | }
|
20016 |
|
20017 | exports['default'] = createBaseForm;
|
20018 | module.exports = exports['default'];
|
20019 | }.call(exports, __webpack_require__(33)))
|
20020 |
|
20021 | }),
|
20022 |
|
20023 | (function(module, exports) {
|
20024 |
|
20025 | "use strict";
|
20026 |
|
20027 | exports.__esModule = true;
|
20028 |
|
20029 | exports.default = function (obj, keys) {
|
20030 | var target = {};
|
20031 |
|
20032 | for (var i in obj) {
|
20033 | if (keys.indexOf(i) >= 0) continue;
|
20034 | if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
|
20035 | target[i] = obj[i];
|
20036 | }
|
20037 |
|
20038 | return target;
|
20039 | };
|
20040 |
|
20041 | }),
|
20042 |
|
20043 | (function(module, exports, __webpack_require__) {
|
20044 |
|
20045 | "use strict";
|
20046 |
|
20047 | exports.__esModule = true;
|
20048 |
|
20049 | var _defineProperty = __webpack_require__(174);
|
20050 |
|
20051 | var _defineProperty2 = _interopRequireDefault(_defineProperty);
|
20052 |
|
20053 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20054 |
|
20055 | exports.default = function (obj, key, value) {
|
20056 | if (key in obj) {
|
20057 | (0, _defineProperty2.default)(obj, key, {
|
20058 | value: value,
|
20059 | enumerable: true,
|
20060 | configurable: true,
|
20061 | writable: true
|
20062 | });
|
20063 | } else {
|
20064 | obj[key] = value;
|
20065 | }
|
20066 |
|
20067 | return obj;
|
20068 | };
|
20069 |
|
20070 | }),
|
20071 |
|
20072 | (function(module, exports, __webpack_require__) {
|
20073 |
|
20074 | module.exports = { "default": __webpack_require__(175), __esModule: true };
|
20075 |
|
20076 | }),
|
20077 |
|
20078 | (function(module, exports, __webpack_require__) {
|
20079 |
|
20080 | var $ = __webpack_require__(176);
|
20081 | module.exports = function defineProperty(it, key, desc){
|
20082 | return $.setDesc(it, key, desc);
|
20083 | };
|
20084 |
|
20085 | }),
|
20086 |
|
20087 | (function(module, exports) {
|
20088 |
|
20089 | var $Object = Object;
|
20090 | module.exports = {
|
20091 | create: $Object.create,
|
20092 | getProto: $Object.getPrototypeOf,
|
20093 | isEnum: {}.propertyIsEnumerable,
|
20094 | getDesc: $Object.getOwnPropertyDescriptor,
|
20095 | setDesc: $Object.defineProperty,
|
20096 | setDescs: $Object.defineProperties,
|
20097 | getKeys: $Object.keys,
|
20098 | getNames: $Object.getOwnPropertyNames,
|
20099 | getSymbols: $Object.getOwnPropertySymbols,
|
20100 | each: [].forEach
|
20101 | };
|
20102 |
|
20103 | }),
|
20104 |
|
20105 | (function(module, exports, __webpack_require__) {
|
20106 |
|
20107 | "use strict";
|
20108 |
|
20109 | exports.__esModule = true;
|
20110 |
|
20111 | var _assign = __webpack_require__(178);
|
20112 |
|
20113 | var _assign2 = _interopRequireDefault(_assign);
|
20114 |
|
20115 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20116 |
|
20117 | exports.default = _assign2.default || function (target) {
|
20118 | for (var i = 1; i < arguments.length; i++) {
|
20119 | var source = arguments[i];
|
20120 |
|
20121 | for (var key in source) {
|
20122 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
20123 | target[key] = source[key];
|
20124 | }
|
20125 | }
|
20126 | }
|
20127 |
|
20128 | return target;
|
20129 | };
|
20130 |
|
20131 | }),
|
20132 |
|
20133 | (function(module, exports, __webpack_require__) {
|
20134 |
|
20135 | module.exports = { "default": __webpack_require__(179), __esModule: true };
|
20136 |
|
20137 | }),
|
20138 |
|
20139 | (function(module, exports, __webpack_require__) {
|
20140 |
|
20141 | __webpack_require__(180);
|
20142 | module.exports = __webpack_require__(183).Object.assign;
|
20143 |
|
20144 | }),
|
20145 |
|
20146 | (function(module, exports, __webpack_require__) {
|
20147 |
|
20148 |
|
20149 | var $export = __webpack_require__(181);
|
20150 |
|
20151 | $export($export.S + $export.F, 'Object', {assign: __webpack_require__(186)});
|
20152 |
|
20153 | }),
|
20154 |
|
20155 | (function(module, exports, __webpack_require__) {
|
20156 |
|
20157 | var global = __webpack_require__(182)
|
20158 | , core = __webpack_require__(183)
|
20159 | , ctx = __webpack_require__(184)
|
20160 | , PROTOTYPE = 'prototype';
|
20161 |
|
20162 | var $export = function(type, name, source){
|
20163 | var IS_FORCED = type & $export.F
|
20164 | , IS_GLOBAL = type & $export.G
|
20165 | , IS_STATIC = type & $export.S
|
20166 | , IS_PROTO = type & $export.P
|
20167 | , IS_BIND = type & $export.B
|
20168 | , IS_WRAP = type & $export.W
|
20169 | , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
|
20170 | , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
|
20171 | , key, own, out;
|
20172 | if(IS_GLOBAL)source = name;
|
20173 | for(key in source){
|
20174 |
|
20175 | own = !IS_FORCED && target && key in target;
|
20176 | if(own && key in exports)continue;
|
20177 |
|
20178 | out = own ? target[key] : source[key];
|
20179 |
|
20180 | exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
|
20181 |
|
20182 | : IS_BIND && own ? ctx(out, global)
|
20183 |
|
20184 | : IS_WRAP && target[key] == out ? (function(C){
|
20185 | var F = function(param){
|
20186 | return this instanceof C ? new C(param) : C(param);
|
20187 | };
|
20188 | F[PROTOTYPE] = C[PROTOTYPE];
|
20189 | return F;
|
20190 |
|
20191 | })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
|
20192 | if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out;
|
20193 | }
|
20194 | };
|
20195 |
|
20196 | $export.F = 1;
|
20197 | $export.G = 2;
|
20198 | $export.S = 4;
|
20199 | $export.P = 8;
|
20200 | $export.B = 16;
|
20201 | $export.W = 32;
|
20202 | module.exports = $export;
|
20203 |
|
20204 | }),
|
20205 |
|
20206 | (function(module, exports) {
|
20207 |
|
20208 |
|
20209 | var global = module.exports = typeof window != 'undefined' && window.Math == Math
|
20210 | ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
|
20211 | if(typeof __g == 'number')__g = global;
|
20212 |
|
20213 | }),
|
20214 |
|
20215 | (function(module, exports) {
|
20216 |
|
20217 | var core = module.exports = {version: '1.2.6'};
|
20218 | if(typeof __e == 'number')__e = core;
|
20219 |
|
20220 | }),
|
20221 |
|
20222 | (function(module, exports, __webpack_require__) {
|
20223 |
|
20224 |
|
20225 | var aFunction = __webpack_require__(185);
|
20226 | module.exports = function(fn, that, length){
|
20227 | aFunction(fn);
|
20228 | if(that === undefined)return fn;
|
20229 | switch(length){
|
20230 | case 1: return function(a){
|
20231 | return fn.call(that, a);
|
20232 | };
|
20233 | case 2: return function(a, b){
|
20234 | return fn.call(that, a, b);
|
20235 | };
|
20236 | case 3: return function(a, b, c){
|
20237 | return fn.call(that, a, b, c);
|
20238 | };
|
20239 | }
|
20240 | return function(/* ...args */){
|
20241 | return fn.apply(that, arguments);
|
20242 | };
|
20243 | };
|
20244 |
|
20245 | }),
|
20246 |
|
20247 | (function(module, exports) {
|
20248 |
|
20249 | module.exports = function(it){
|
20250 | if(typeof it != 'function')throw TypeError(it + ' is not a function!');
|
20251 | return it;
|
20252 | };
|
20253 |
|
20254 | }),
|
20255 |
|
20256 | (function(module, exports, __webpack_require__) {
|
20257 |
|
20258 |
|
20259 | var $ = __webpack_require__(176)
|
20260 | , toObject = __webpack_require__(187)
|
20261 | , IObject = __webpack_require__(189);
|
20262 |
|
20263 |
|
20264 | module.exports = __webpack_require__(191)(function(){
|
20265 | var a = Object.assign
|
20266 | , A = {}
|
20267 | , B = {}
|
20268 | , S = Symbol()
|
20269 | , K = 'abcdefghijklmnopqrst';
|
20270 | A[S] = 7;
|
20271 | K.split('').forEach(function(k){ B[k] = k; });
|
20272 | return a({}, A)[S] != 7 || Object.keys(a({}, B)).join('') != K;
|
20273 | }) ? function assign(target, source){
|
20274 | var T = toObject(target)
|
20275 | , $$ = arguments
|
20276 | , $$len = $$.length
|
20277 | , index = 1
|
20278 | , getKeys = $.getKeys
|
20279 | , getSymbols = $.getSymbols
|
20280 | , isEnum = $.isEnum;
|
20281 | while($$len > index){
|
20282 | var S = IObject($$[index++])
|
20283 | , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
|
20284 | , length = keys.length
|
20285 | , j = 0
|
20286 | , key;
|
20287 | while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
|
20288 | }
|
20289 | return T;
|
20290 | } : Object.assign;
|
20291 |
|
20292 | }),
|
20293 |
|
20294 | (function(module, exports, __webpack_require__) {
|
20295 |
|
20296 |
|
20297 | var defined = __webpack_require__(188);
|
20298 | module.exports = function(it){
|
20299 | return Object(defined(it));
|
20300 | };
|
20301 |
|
20302 | }),
|
20303 |
|
20304 | (function(module, exports) {
|
20305 |
|
20306 |
|
20307 | module.exports = function(it){
|
20308 | if(it == undefined)throw TypeError("Can't call method on " + it);
|
20309 | return it;
|
20310 | };
|
20311 |
|
20312 | }),
|
20313 |
|
20314 | (function(module, exports, __webpack_require__) {
|
20315 |
|
20316 |
|
20317 | var cof = __webpack_require__(190);
|
20318 | module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
|
20319 | return cof(it) == 'String' ? it.split('') : Object(it);
|
20320 | };
|
20321 |
|
20322 | }),
|
20323 |
|
20324 | (function(module, exports) {
|
20325 |
|
20326 | var toString = {}.toString;
|
20327 |
|
20328 | module.exports = function(it){
|
20329 | return toString.call(it).slice(8, -1);
|
20330 | };
|
20331 |
|
20332 | }),
|
20333 |
|
20334 | (function(module, exports) {
|
20335 |
|
20336 | module.exports = function(exec){
|
20337 | try {
|
20338 | return !!exec();
|
20339 | } catch(e){
|
20340 | return true;
|
20341 | }
|
20342 | };
|
20343 |
|
20344 | }),
|
20345 |
|
20346 | (function(module, exports, __webpack_require__) {
|
20347 |
|
20348 | "use strict";
|
20349 |
|
20350 | exports.__esModule = true;
|
20351 |
|
20352 | var _from = __webpack_require__(193);
|
20353 |
|
20354 | var _from2 = _interopRequireDefault(_from);
|
20355 |
|
20356 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20357 |
|
20358 | exports.default = function (arr) {
|
20359 | if (Array.isArray(arr)) {
|
20360 | for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
|
20361 | arr2[i] = arr[i];
|
20362 | }
|
20363 |
|
20364 | return arr2;
|
20365 | } else {
|
20366 | return (0, _from2.default)(arr);
|
20367 | }
|
20368 | };
|
20369 |
|
20370 | }),
|
20371 |
|
20372 | (function(module, exports, __webpack_require__) {
|
20373 |
|
20374 | module.exports = { "default": __webpack_require__(194), __esModule: true };
|
20375 |
|
20376 | }),
|
20377 |
|
20378 | (function(module, exports, __webpack_require__) {
|
20379 |
|
20380 | __webpack_require__(195);
|
20381 | __webpack_require__(211);
|
20382 | module.exports = __webpack_require__(183).Array.from;
|
20383 |
|
20384 | }),
|
20385 |
|
20386 | (function(module, exports, __webpack_require__) {
|
20387 |
|
20388 | 'use strict';
|
20389 | var $at = __webpack_require__(196)(true);
|
20390 |
|
20391 |
|
20392 | __webpack_require__(198)(String, 'String', function(iterated){
|
20393 | this._t = String(iterated);
|
20394 | this._i = 0;
|
20395 |
|
20396 | }, function(){
|
20397 | var O = this._t
|
20398 | , index = this._i
|
20399 | , point;
|
20400 | if(index >= O.length)return {value: undefined, done: true};
|
20401 | point = $at(O, index);
|
20402 | this._i += point.length;
|
20403 | return {value: point, done: false};
|
20404 | });
|
20405 |
|
20406 | }),
|
20407 |
|
20408 | (function(module, exports, __webpack_require__) {
|
20409 |
|
20410 | var toInteger = __webpack_require__(197)
|
20411 | , defined = __webpack_require__(188);
|
20412 |
|
20413 |
|
20414 | module.exports = function(TO_STRING){
|
20415 | return function(that, pos){
|
20416 | var s = String(defined(that))
|
20417 | , i = toInteger(pos)
|
20418 | , l = s.length
|
20419 | , a, b;
|
20420 | if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
|
20421 | a = s.charCodeAt(i);
|
20422 | return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
|
20423 | ? TO_STRING ? s.charAt(i) : a
|
20424 | : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
|
20425 | };
|
20426 | };
|
20427 |
|
20428 | }),
|
20429 |
|
20430 | (function(module, exports) {
|
20431 |
|
20432 |
|
20433 | var ceil = Math.ceil
|
20434 | , floor = Math.floor;
|
20435 | module.exports = function(it){
|
20436 | return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
20437 | };
|
20438 |
|
20439 | }),
|
20440 |
|
20441 | (function(module, exports, __webpack_require__) {
|
20442 |
|
20443 | 'use strict';
|
20444 | var LIBRARY = __webpack_require__(199)
|
20445 | , $export = __webpack_require__(181)
|
20446 | , redefine = __webpack_require__(200)
|
20447 | , hide = __webpack_require__(201)
|
20448 | , has = __webpack_require__(204)
|
20449 | , Iterators = __webpack_require__(205)
|
20450 | , $iterCreate = __webpack_require__(206)
|
20451 | , setToStringTag = __webpack_require__(207)
|
20452 | , getProto = __webpack_require__(176).getProto
|
20453 | , ITERATOR = __webpack_require__(208)('iterator')
|
20454 | , BUGGY = !([].keys && 'next' in [].keys())
|
20455 | , FF_ITERATOR = '@@iterator'
|
20456 | , KEYS = 'keys'
|
20457 | , VALUES = 'values';
|
20458 |
|
20459 | var returnThis = function(){ return this; };
|
20460 |
|
20461 | module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
|
20462 | $iterCreate(Constructor, NAME, next);
|
20463 | var getMethod = function(kind){
|
20464 | if(!BUGGY && kind in proto)return proto[kind];
|
20465 | switch(kind){
|
20466 | case KEYS: return function keys(){ return new Constructor(this, kind); };
|
20467 | case VALUES: return function values(){ return new Constructor(this, kind); };
|
20468 | } return function entries(){ return new Constructor(this, kind); };
|
20469 | };
|
20470 | var TAG = NAME + ' Iterator'
|
20471 | , DEF_VALUES = DEFAULT == VALUES
|
20472 | , VALUES_BUG = false
|
20473 | , proto = Base.prototype
|
20474 | , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
|
20475 | , $default = $native || getMethod(DEFAULT)
|
20476 | , methods, key;
|
20477 |
|
20478 | if($native){
|
20479 | var IteratorPrototype = getProto($default.call(new Base));
|
20480 |
|
20481 | setToStringTag(IteratorPrototype, TAG, true);
|
20482 |
|
20483 | if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
|
20484 |
|
20485 | if(DEF_VALUES && $native.name !== VALUES){
|
20486 | VALUES_BUG = true;
|
20487 | $default = function values(){ return $native.call(this); };
|
20488 | }
|
20489 | }
|
20490 |
|
20491 | if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
|
20492 | hide(proto, ITERATOR, $default);
|
20493 | }
|
20494 |
|
20495 | Iterators[NAME] = $default;
|
20496 | Iterators[TAG] = returnThis;
|
20497 | if(DEFAULT){
|
20498 | methods = {
|
20499 | values: DEF_VALUES ? $default : getMethod(VALUES),
|
20500 | keys: IS_SET ? $default : getMethod(KEYS),
|
20501 | entries: !DEF_VALUES ? $default : getMethod('entries')
|
20502 | };
|
20503 | if(FORCED)for(key in methods){
|
20504 | if(!(key in proto))redefine(proto, key, methods[key]);
|
20505 | } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
|
20506 | }
|
20507 | return methods;
|
20508 | };
|
20509 |
|
20510 | }),
|
20511 |
|
20512 | (function(module, exports) {
|
20513 |
|
20514 | module.exports = true;
|
20515 |
|
20516 | }),
|
20517 |
|
20518 | (function(module, exports, __webpack_require__) {
|
20519 |
|
20520 | module.exports = __webpack_require__(201);
|
20521 |
|
20522 | }),
|
20523 |
|
20524 | (function(module, exports, __webpack_require__) {
|
20525 |
|
20526 | var $ = __webpack_require__(176)
|
20527 | , createDesc = __webpack_require__(202);
|
20528 | module.exports = __webpack_require__(203) ? function(object, key, value){
|
20529 | return $.setDesc(object, key, createDesc(1, value));
|
20530 | } : function(object, key, value){
|
20531 | object[key] = value;
|
20532 | return object;
|
20533 | };
|
20534 |
|
20535 | }),
|
20536 |
|
20537 | (function(module, exports) {
|
20538 |
|
20539 | module.exports = function(bitmap, value){
|
20540 | return {
|
20541 | enumerable : !(bitmap & 1),
|
20542 | configurable: !(bitmap & 2),
|
20543 | writable : !(bitmap & 4),
|
20544 | value : value
|
20545 | };
|
20546 | };
|
20547 |
|
20548 | }),
|
20549 |
|
20550 | (function(module, exports, __webpack_require__) {
|
20551 |
|
20552 |
|
20553 | module.exports = !__webpack_require__(191)(function(){
|
20554 | return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
|
20555 | });
|
20556 |
|
20557 | }),
|
20558 |
|
20559 | (function(module, exports) {
|
20560 |
|
20561 | var hasOwnProperty = {}.hasOwnProperty;
|
20562 | module.exports = function(it, key){
|
20563 | return hasOwnProperty.call(it, key);
|
20564 | };
|
20565 |
|
20566 | }),
|
20567 |
|
20568 | (function(module, exports) {
|
20569 |
|
20570 | module.exports = {};
|
20571 |
|
20572 | }),
|
20573 |
|
20574 | (function(module, exports, __webpack_require__) {
|
20575 |
|
20576 | 'use strict';
|
20577 | var $ = __webpack_require__(176)
|
20578 | , descriptor = __webpack_require__(202)
|
20579 | , setToStringTag = __webpack_require__(207)
|
20580 | , IteratorPrototype = {};
|
20581 |
|
20582 |
|
20583 | __webpack_require__(201)(IteratorPrototype, __webpack_require__(208)('iterator'), function(){ return this; });
|
20584 |
|
20585 | module.exports = function(Constructor, NAME, next){
|
20586 | Constructor.prototype = $.create(IteratorPrototype, {next: descriptor(1, next)});
|
20587 | setToStringTag(Constructor, NAME + ' Iterator');
|
20588 | };
|
20589 |
|
20590 | }),
|
20591 |
|
20592 | (function(module, exports, __webpack_require__) {
|
20593 |
|
20594 | var def = __webpack_require__(176).setDesc
|
20595 | , has = __webpack_require__(204)
|
20596 | , TAG = __webpack_require__(208)('toStringTag');
|
20597 |
|
20598 | module.exports = function(it, tag, stat){
|
20599 | if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
|
20600 | };
|
20601 |
|
20602 | }),
|
20603 |
|
20604 | (function(module, exports, __webpack_require__) {
|
20605 |
|
20606 | var store = __webpack_require__(209)('wks')
|
20607 | , uid = __webpack_require__(210)
|
20608 | , Symbol = __webpack_require__(182).Symbol;
|
20609 | module.exports = function(name){
|
20610 | return store[name] || (store[name] =
|
20611 | Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name));
|
20612 | };
|
20613 |
|
20614 | }),
|
20615 |
|
20616 | (function(module, exports, __webpack_require__) {
|
20617 |
|
20618 | var global = __webpack_require__(182)
|
20619 | , SHARED = '__core-js_shared__'
|
20620 | , store = global[SHARED] || (global[SHARED] = {});
|
20621 | module.exports = function(key){
|
20622 | return store[key] || (store[key] = {});
|
20623 | };
|
20624 |
|
20625 | }),
|
20626 |
|
20627 | (function(module, exports) {
|
20628 |
|
20629 | var id = 0
|
20630 | , px = Math.random();
|
20631 | module.exports = function(key){
|
20632 | return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
20633 | };
|
20634 |
|
20635 | }),
|
20636 |
|
20637 | (function(module, exports, __webpack_require__) {
|
20638 |
|
20639 | 'use strict';
|
20640 | var ctx = __webpack_require__(184)
|
20641 | , $export = __webpack_require__(181)
|
20642 | , toObject = __webpack_require__(187)
|
20643 | , call = __webpack_require__(212)
|
20644 | , isArrayIter = __webpack_require__(215)
|
20645 | , toLength = __webpack_require__(216)
|
20646 | , getIterFn = __webpack_require__(217);
|
20647 | $export($export.S + $export.F * !__webpack_require__(219)(function(iter){ Array.from(iter); }), 'Array', {
|
20648 |
|
20649 | from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
|
20650 | var O = toObject(arrayLike)
|
20651 | , C = typeof this == 'function' ? this : Array
|
20652 | , $$ = arguments
|
20653 | , $$len = $$.length
|
20654 | , mapfn = $$len > 1 ? $$[1] : undefined
|
20655 | , mapping = mapfn !== undefined
|
20656 | , index = 0
|
20657 | , iterFn = getIterFn(O)
|
20658 | , length, result, step, iterator;
|
20659 | if(mapping)mapfn = ctx(mapfn, $$len > 2 ? $$[2] : undefined, 2);
|
20660 |
|
20661 | if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
|
20662 | for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
|
20663 | result[index] = mapping ? call(iterator, mapfn, [step.value, index], true) : step.value;
|
20664 | }
|
20665 | } else {
|
20666 | length = toLength(O.length);
|
20667 | for(result = new C(length); length > index; index++){
|
20668 | result[index] = mapping ? mapfn(O[index], index) : O[index];
|
20669 | }
|
20670 | }
|
20671 | result.length = index;
|
20672 | return result;
|
20673 | }
|
20674 | });
|
20675 |
|
20676 |
|
20677 | }),
|
20678 |
|
20679 | (function(module, exports, __webpack_require__) {
|
20680 |
|
20681 |
|
20682 | var anObject = __webpack_require__(213);
|
20683 | module.exports = function(iterator, fn, value, entries){
|
20684 | try {
|
20685 | return entries ? fn(anObject(value)[0], value[1]) : fn(value);
|
20686 |
|
20687 | } catch(e){
|
20688 | var ret = iterator['return'];
|
20689 | if(ret !== undefined)anObject(ret.call(iterator));
|
20690 | throw e;
|
20691 | }
|
20692 | };
|
20693 |
|
20694 | }),
|
20695 |
|
20696 | (function(module, exports, __webpack_require__) {
|
20697 |
|
20698 | var isObject = __webpack_require__(214);
|
20699 | module.exports = function(it){
|
20700 | if(!isObject(it))throw TypeError(it + ' is not an object!');
|
20701 | return it;
|
20702 | };
|
20703 |
|
20704 | }),
|
20705 |
|
20706 | (function(module, exports) {
|
20707 |
|
20708 | module.exports = function(it){
|
20709 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
20710 | };
|
20711 |
|
20712 | }),
|
20713 |
|
20714 | (function(module, exports, __webpack_require__) {
|
20715 |
|
20716 |
|
20717 | var Iterators = __webpack_require__(205)
|
20718 | , ITERATOR = __webpack_require__(208)('iterator')
|
20719 | , ArrayProto = Array.prototype;
|
20720 |
|
20721 | module.exports = function(it){
|
20722 | return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
|
20723 | };
|
20724 |
|
20725 | }),
|
20726 |
|
20727 | (function(module, exports, __webpack_require__) {
|
20728 |
|
20729 |
|
20730 | var toInteger = __webpack_require__(197)
|
20731 | , min = Math.min;
|
20732 | module.exports = function(it){
|
20733 | return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0;
|
20734 | };
|
20735 |
|
20736 | }),
|
20737 |
|
20738 | (function(module, exports, __webpack_require__) {
|
20739 |
|
20740 | var classof = __webpack_require__(218)
|
20741 | , ITERATOR = __webpack_require__(208)('iterator')
|
20742 | , Iterators = __webpack_require__(205);
|
20743 | module.exports = __webpack_require__(183).getIteratorMethod = function(it){
|
20744 | if(it != undefined)return it[ITERATOR]
|
20745 | || it['@@iterator']
|
20746 | || Iterators[classof(it)];
|
20747 | };
|
20748 |
|
20749 | }),
|
20750 |
|
20751 | (function(module, exports, __webpack_require__) {
|
20752 |
|
20753 |
|
20754 | var cof = __webpack_require__(190)
|
20755 | , TAG = __webpack_require__(208)('toStringTag')
|
20756 |
|
20757 | , ARG = cof(function(){ return arguments; }()) == 'Arguments';
|
20758 |
|
20759 | module.exports = function(it){
|
20760 | var O, T, B;
|
20761 | return it === undefined ? 'Undefined' : it === null ? 'Null'
|
20762 |
|
20763 | : typeof (T = (O = Object(it))[TAG]) == 'string' ? T
|
20764 |
|
20765 | : ARG ? cof(O)
|
20766 |
|
20767 | : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
|
20768 | };
|
20769 |
|
20770 | }),
|
20771 |
|
20772 | (function(module, exports, __webpack_require__) {
|
20773 |
|
20774 | var ITERATOR = __webpack_require__(208)('iterator')
|
20775 | , SAFE_CLOSING = false;
|
20776 |
|
20777 | try {
|
20778 | var riter = [7][ITERATOR]();
|
20779 | riter['return'] = function(){ SAFE_CLOSING = true; };
|
20780 | Array.from(riter, function(){ throw 2; });
|
20781 | } catch(e){ }
|
20782 |
|
20783 | module.exports = function(exec, skipClosing){
|
20784 | if(!skipClosing && !SAFE_CLOSING)return false;
|
20785 | var safe = false;
|
20786 | try {
|
20787 | var arr = [7]
|
20788 | , iter = arr[ITERATOR]();
|
20789 | iter.next = function(){ return {done: safe = true}; };
|
20790 | arr[ITERATOR] = function(){ return iter; };
|
20791 | exec(arr);
|
20792 | } catch(e){ }
|
20793 | return safe;
|
20794 | };
|
20795 |
|
20796 | }),
|
20797 |
|
20798 | (function(module, exports, __webpack_require__) {
|
20799 |
|
20800 | |
20801 |
|
20802 |
|
20803 |
|
20804 |
|
20805 |
|
20806 |
|
20807 |
|
20808 | 'use strict';
|
20809 |
|
20810 | var React = __webpack_require__(1);
|
20811 | var factory = __webpack_require__(221);
|
20812 |
|
20813 | if (typeof React === 'undefined') {
|
20814 | throw Error(
|
20815 | 'create-react-class could not find the React object. If you are using script tags, ' +
|
20816 | 'make sure that React is being loaded before create-react-class.'
|
20817 | );
|
20818 | }
|
20819 |
|
20820 |
|
20821 | var ReactNoopUpdateQueue = new React.Component().updater;
|
20822 |
|
20823 | module.exports = factory(
|
20824 | React.Component,
|
20825 | React.isValidElement,
|
20826 | ReactNoopUpdateQueue
|
20827 | );
|
20828 |
|
20829 |
|
20830 | }),
|
20831 |
|
20832 | (function(module, exports, __webpack_require__) {
|
20833 |
|
20834 | (function(process) { |
20835 |
|
20836 |
|
20837 |
|
20838 |
|
20839 |
|
20840 |
|
20841 |
|
20842 | 'use strict';
|
20843 |
|
20844 | var _assign = __webpack_require__(44);
|
20845 |
|
20846 | var emptyObject = __webpack_require__(222);
|
20847 | var _invariant = __webpack_require__(223);
|
20848 |
|
20849 | if (process.env.NODE_ENV !== 'production') {
|
20850 | var warning = __webpack_require__(224);
|
20851 | }
|
20852 |
|
20853 | var MIXINS_KEY = 'mixins';
|
20854 |
|
20855 |
|
20856 |
|
20857 | function identity(fn) {
|
20858 | return fn;
|
20859 | }
|
20860 |
|
20861 | var ReactPropTypeLocationNames;
|
20862 | if (process.env.NODE_ENV !== 'production') {
|
20863 | ReactPropTypeLocationNames = {
|
20864 | prop: 'prop',
|
20865 | context: 'context',
|
20866 | childContext: 'child context'
|
20867 | };
|
20868 | } else {
|
20869 | ReactPropTypeLocationNames = {};
|
20870 | }
|
20871 |
|
20872 | function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
20873 | |
20874 |
|
20875 |
|
20876 |
|
20877 | var injectedMixins = [];
|
20878 |
|
20879 | |
20880 |
|
20881 |
|
20882 |
|
20883 |
|
20884 |
|
20885 |
|
20886 |
|
20887 |
|
20888 |
|
20889 |
|
20890 |
|
20891 |
|
20892 |
|
20893 |
|
20894 |
|
20895 |
|
20896 |
|
20897 |
|
20898 |
|
20899 |
|
20900 |
|
20901 | var ReactClassInterface = {
|
20902 | |
20903 |
|
20904 |
|
20905 |
|
20906 |
|
20907 |
|
20908 | mixins: 'DEFINE_MANY',
|
20909 |
|
20910 | |
20911 |
|
20912 |
|
20913 |
|
20914 |
|
20915 |
|
20916 |
|
20917 | statics: 'DEFINE_MANY',
|
20918 |
|
20919 | |
20920 |
|
20921 |
|
20922 |
|
20923 |
|
20924 |
|
20925 | propTypes: 'DEFINE_MANY',
|
20926 |
|
20927 | |
20928 |
|
20929 |
|
20930 |
|
20931 |
|
20932 |
|
20933 | contextTypes: 'DEFINE_MANY',
|
20934 |
|
20935 | |
20936 |
|
20937 |
|
20938 |
|
20939 |
|
20940 |
|
20941 | childContextTypes: 'DEFINE_MANY',
|
20942 |
|
20943 |
|
20944 |
|
20945 | |
20946 |
|
20947 |
|
20948 |
|
20949 |
|
20950 |
|
20951 |
|
20952 |
|
20953 |
|
20954 |
|
20955 | getDefaultProps: 'DEFINE_MANY_MERGED',
|
20956 |
|
20957 | |
20958 |
|
20959 |
|
20960 |
|
20961 |
|
20962 |
|
20963 |
|
20964 |
|
20965 |
|
20966 |
|
20967 |
|
20968 |
|
20969 |
|
20970 |
|
20971 | getInitialState: 'DEFINE_MANY_MERGED',
|
20972 |
|
20973 | |
20974 |
|
20975 |
|
20976 |
|
20977 | getChildContext: 'DEFINE_MANY_MERGED',
|
20978 |
|
20979 | |
20980 |
|
20981 |
|
20982 |
|
20983 |
|
20984 |
|
20985 |
|
20986 |
|
20987 |
|
20988 |
|
20989 |
|
20990 |
|
20991 |
|
20992 |
|
20993 |
|
20994 | render: 'DEFINE_ONCE',
|
20995 |
|
20996 |
|
20997 |
|
20998 | |
20999 |
|
21000 |
|
21001 |
|
21002 |
|
21003 |
|
21004 |
|
21005 | componentWillMount: 'DEFINE_MANY',
|
21006 |
|
21007 | |
21008 |
|
21009 |
|
21010 |
|
21011 |
|
21012 |
|
21013 |
|
21014 |
|
21015 |
|
21016 |
|
21017 | componentDidMount: 'DEFINE_MANY',
|
21018 |
|
21019 | |
21020 |
|
21021 |
|
21022 |
|
21023 |
|
21024 |
|
21025 |
|
21026 |
|
21027 |
|
21028 |
|
21029 |
|
21030 |
|
21031 |
|
21032 |
|
21033 |
|
21034 |
|
21035 |
|
21036 |
|
21037 |
|
21038 | componentWillReceiveProps: 'DEFINE_MANY',
|
21039 |
|
21040 | |
21041 |
|
21042 |
|
21043 |
|
21044 |
|
21045 |
|
21046 |
|
21047 |
|
21048 |
|
21049 |
|
21050 |
|
21051 |
|
21052 |
|
21053 |
|
21054 |
|
21055 |
|
21056 |
|
21057 |
|
21058 |
|
21059 |
|
21060 | shouldComponentUpdate: 'DEFINE_ONCE',
|
21061 |
|
21062 | |
21063 |
|
21064 |
|
21065 |
|
21066 |
|
21067 |
|
21068 |
|
21069 |
|
21070 |
|
21071 |
|
21072 |
|
21073 |
|
21074 |
|
21075 |
|
21076 |
|
21077 | componentWillUpdate: 'DEFINE_MANY',
|
21078 |
|
21079 | |
21080 |
|
21081 |
|
21082 |
|
21083 |
|
21084 |
|
21085 |
|
21086 |
|
21087 |
|
21088 |
|
21089 |
|
21090 |
|
21091 | componentDidUpdate: 'DEFINE_MANY',
|
21092 |
|
21093 | |
21094 |
|
21095 |
|
21096 |
|
21097 |
|
21098 |
|
21099 |
|
21100 |
|
21101 |
|
21102 |
|
21103 |
|
21104 | componentWillUnmount: 'DEFINE_MANY',
|
21105 |
|
21106 | |
21107 |
|
21108 |
|
21109 |
|
21110 |
|
21111 | UNSAFE_componentWillMount: 'DEFINE_MANY',
|
21112 |
|
21113 | |
21114 |
|
21115 |
|
21116 |
|
21117 |
|
21118 | UNSAFE_componentWillReceiveProps: 'DEFINE_MANY',
|
21119 |
|
21120 | |
21121 |
|
21122 |
|
21123 |
|
21124 |
|
21125 | UNSAFE_componentWillUpdate: 'DEFINE_MANY',
|
21126 |
|
21127 |
|
21128 |
|
21129 | |
21130 |
|
21131 |
|
21132 |
|
21133 |
|
21134 |
|
21135 |
|
21136 |
|
21137 |
|
21138 |
|
21139 | updateComponent: 'OVERRIDE_BASE'
|
21140 | };
|
21141 |
|
21142 | |
21143 |
|
21144 |
|
21145 | var ReactClassStaticInterface = {
|
21146 | |
21147 |
|
21148 |
|
21149 |
|
21150 |
|
21151 |
|
21152 |
|
21153 |
|
21154 |
|
21155 |
|
21156 | getDerivedStateFromProps: 'DEFINE_MANY_MERGED'
|
21157 | };
|
21158 |
|
21159 | |
21160 |
|
21161 |
|
21162 |
|
21163 |
|
21164 |
|
21165 |
|
21166 |
|
21167 |
|
21168 | var RESERVED_SPEC_KEYS = {
|
21169 | displayName: function(Constructor, displayName) {
|
21170 | Constructor.displayName = displayName;
|
21171 | },
|
21172 | mixins: function(Constructor, mixins) {
|
21173 | if (mixins) {
|
21174 | for (var i = 0; i < mixins.length; i++) {
|
21175 | mixSpecIntoComponent(Constructor, mixins[i]);
|
21176 | }
|
21177 | }
|
21178 | },
|
21179 | childContextTypes: function(Constructor, childContextTypes) {
|
21180 | if (process.env.NODE_ENV !== 'production') {
|
21181 | validateTypeDef(Constructor, childContextTypes, 'childContext');
|
21182 | }
|
21183 | Constructor.childContextTypes = _assign(
|
21184 | {},
|
21185 | Constructor.childContextTypes,
|
21186 | childContextTypes
|
21187 | );
|
21188 | },
|
21189 | contextTypes: function(Constructor, contextTypes) {
|
21190 | if (process.env.NODE_ENV !== 'production') {
|
21191 | validateTypeDef(Constructor, contextTypes, 'context');
|
21192 | }
|
21193 | Constructor.contextTypes = _assign(
|
21194 | {},
|
21195 | Constructor.contextTypes,
|
21196 | contextTypes
|
21197 | );
|
21198 | },
|
21199 | |
21200 |
|
21201 |
|
21202 |
|
21203 | getDefaultProps: function(Constructor, getDefaultProps) {
|
21204 | if (Constructor.getDefaultProps) {
|
21205 | Constructor.getDefaultProps = createMergedResultFunction(
|
21206 | Constructor.getDefaultProps,
|
21207 | getDefaultProps
|
21208 | );
|
21209 | } else {
|
21210 | Constructor.getDefaultProps = getDefaultProps;
|
21211 | }
|
21212 | },
|
21213 | propTypes: function(Constructor, propTypes) {
|
21214 | if (process.env.NODE_ENV !== 'production') {
|
21215 | validateTypeDef(Constructor, propTypes, 'prop');
|
21216 | }
|
21217 | Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
|
21218 | },
|
21219 | statics: function(Constructor, statics) {
|
21220 | mixStaticSpecIntoComponent(Constructor, statics);
|
21221 | },
|
21222 | autobind: function() {}
|
21223 | };
|
21224 |
|
21225 | function validateTypeDef(Constructor, typeDef, location) {
|
21226 | for (var propName in typeDef) {
|
21227 | if (typeDef.hasOwnProperty(propName)) {
|
21228 |
|
21229 |
|
21230 | if (process.env.NODE_ENV !== 'production') {
|
21231 | warning(
|
21232 | typeof typeDef[propName] === 'function',
|
21233 | '%s: %s type `%s` is invalid; it must be a function, usually from ' +
|
21234 | 'React.PropTypes.',
|
21235 | Constructor.displayName || 'ReactClass',
|
21236 | ReactPropTypeLocationNames[location],
|
21237 | propName
|
21238 | );
|
21239 | }
|
21240 | }
|
21241 | }
|
21242 | }
|
21243 |
|
21244 | function validateMethodOverride(isAlreadyDefined, name) {
|
21245 | var specPolicy = ReactClassInterface.hasOwnProperty(name)
|
21246 | ? ReactClassInterface[name]
|
21247 | : null;
|
21248 |
|
21249 |
|
21250 | if (ReactClassMixin.hasOwnProperty(name)) {
|
21251 | _invariant(
|
21252 | specPolicy === 'OVERRIDE_BASE',
|
21253 | 'ReactClassInterface: You are attempting to override ' +
|
21254 | '`%s` from your class specification. Ensure that your method names ' +
|
21255 | 'do not overlap with React methods.',
|
21256 | name
|
21257 | );
|
21258 | }
|
21259 |
|
21260 |
|
21261 | if (isAlreadyDefined) {
|
21262 | _invariant(
|
21263 | specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED',
|
21264 | 'ReactClassInterface: You are attempting to define ' +
|
21265 | '`%s` on your component more than once. This conflict may be due ' +
|
21266 | 'to a mixin.',
|
21267 | name
|
21268 | );
|
21269 | }
|
21270 | }
|
21271 |
|
21272 | |
21273 |
|
21274 |
|
21275 |
|
21276 | function mixSpecIntoComponent(Constructor, spec) {
|
21277 | if (!spec) {
|
21278 | if (process.env.NODE_ENV !== 'production') {
|
21279 | var typeofSpec = typeof spec;
|
21280 | var isMixinValid = typeofSpec === 'object' && spec !== null;
|
21281 |
|
21282 | if (process.env.NODE_ENV !== 'production') {
|
21283 | warning(
|
21284 | isMixinValid,
|
21285 | "%s: You're attempting to include a mixin that is either null " +
|
21286 | 'or not an object. Check the mixins included by the component, ' +
|
21287 | 'as well as any mixins they include themselves. ' +
|
21288 | 'Expected object but got %s.',
|
21289 | Constructor.displayName || 'ReactClass',
|
21290 | spec === null ? null : typeofSpec
|
21291 | );
|
21292 | }
|
21293 | }
|
21294 |
|
21295 | return;
|
21296 | }
|
21297 |
|
21298 | _invariant(
|
21299 | typeof spec !== 'function',
|
21300 | "ReactClass: You're attempting to " +
|
21301 | 'use a component class or function as a mixin. Instead, just use a ' +
|
21302 | 'regular object.'
|
21303 | );
|
21304 | _invariant(
|
21305 | !isValidElement(spec),
|
21306 | "ReactClass: You're attempting to " +
|
21307 | 'use a component as a mixin. Instead, just use a regular object.'
|
21308 | );
|
21309 |
|
21310 | var proto = Constructor.prototype;
|
21311 | var autoBindPairs = proto.__reactAutoBindPairs;
|
21312 |
|
21313 |
|
21314 |
|
21315 |
|
21316 | if (spec.hasOwnProperty(MIXINS_KEY)) {
|
21317 | RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
|
21318 | }
|
21319 |
|
21320 | for (var name in spec) {
|
21321 | if (!spec.hasOwnProperty(name)) {
|
21322 | continue;
|
21323 | }
|
21324 |
|
21325 | if (name === MIXINS_KEY) {
|
21326 |
|
21327 | continue;
|
21328 | }
|
21329 |
|
21330 | var property = spec[name];
|
21331 | var isAlreadyDefined = proto.hasOwnProperty(name);
|
21332 | validateMethodOverride(isAlreadyDefined, name);
|
21333 |
|
21334 | if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
|
21335 | RESERVED_SPEC_KEYS[name](Constructor, property);
|
21336 | } else {
|
21337 |
|
21338 |
|
21339 |
|
21340 |
|
21341 | var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
|
21342 | var isFunction = typeof property === 'function';
|
21343 | var shouldAutoBind =
|
21344 | isFunction &&
|
21345 | !isReactClassMethod &&
|
21346 | !isAlreadyDefined &&
|
21347 | spec.autobind !== false;
|
21348 |
|
21349 | if (shouldAutoBind) {
|
21350 | autoBindPairs.push(name, property);
|
21351 | proto[name] = property;
|
21352 | } else {
|
21353 | if (isAlreadyDefined) {
|
21354 | var specPolicy = ReactClassInterface[name];
|
21355 |
|
21356 |
|
21357 | _invariant(
|
21358 | isReactClassMethod &&
|
21359 | (specPolicy === 'DEFINE_MANY_MERGED' ||
|
21360 | specPolicy === 'DEFINE_MANY'),
|
21361 | 'ReactClass: Unexpected spec policy %s for key %s ' +
|
21362 | 'when mixing in component specs.',
|
21363 | specPolicy,
|
21364 | name
|
21365 | );
|
21366 |
|
21367 |
|
21368 |
|
21369 | if (specPolicy === 'DEFINE_MANY_MERGED') {
|
21370 | proto[name] = createMergedResultFunction(proto[name], property);
|
21371 | } else if (specPolicy === 'DEFINE_MANY') {
|
21372 | proto[name] = createChainedFunction(proto[name], property);
|
21373 | }
|
21374 | } else {
|
21375 | proto[name] = property;
|
21376 | if (process.env.NODE_ENV !== 'production') {
|
21377 |
|
21378 |
|
21379 | if (typeof property === 'function' && spec.displayName) {
|
21380 | proto[name].displayName = spec.displayName + '_' + name;
|
21381 | }
|
21382 | }
|
21383 | }
|
21384 | }
|
21385 | }
|
21386 | }
|
21387 | }
|
21388 |
|
21389 | function mixStaticSpecIntoComponent(Constructor, statics) {
|
21390 | if (!statics) {
|
21391 | return;
|
21392 | }
|
21393 |
|
21394 | for (var name in statics) {
|
21395 | var property = statics[name];
|
21396 | if (!statics.hasOwnProperty(name)) {
|
21397 | continue;
|
21398 | }
|
21399 |
|
21400 | var isReserved = name in RESERVED_SPEC_KEYS;
|
21401 | _invariant(
|
21402 | !isReserved,
|
21403 | 'ReactClass: You are attempting to define a reserved ' +
|
21404 | 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
|
21405 | 'as an instance property instead; it will still be accessible on the ' +
|
21406 | 'constructor.',
|
21407 | name
|
21408 | );
|
21409 |
|
21410 | var isAlreadyDefined = name in Constructor;
|
21411 | if (isAlreadyDefined) {
|
21412 | var specPolicy = ReactClassStaticInterface.hasOwnProperty(name)
|
21413 | ? ReactClassStaticInterface[name]
|
21414 | : null;
|
21415 |
|
21416 | _invariant(
|
21417 | specPolicy === 'DEFINE_MANY_MERGED',
|
21418 | 'ReactClass: You are attempting to define ' +
|
21419 | '`%s` on your component more than once. This conflict may be ' +
|
21420 | 'due to a mixin.',
|
21421 | name
|
21422 | );
|
21423 |
|
21424 | Constructor[name] = createMergedResultFunction(Constructor[name], property);
|
21425 |
|
21426 | return;
|
21427 | }
|
21428 |
|
21429 | Constructor[name] = property;
|
21430 | }
|
21431 | }
|
21432 |
|
21433 | |
21434 |
|
21435 |
|
21436 |
|
21437 |
|
21438 |
|
21439 |
|
21440 | function mergeIntoWithNoDuplicateKeys(one, two) {
|
21441 | _invariant(
|
21442 | one && two && typeof one === 'object' && typeof two === 'object',
|
21443 | 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
|
21444 | );
|
21445 |
|
21446 | for (var key in two) {
|
21447 | if (two.hasOwnProperty(key)) {
|
21448 | _invariant(
|
21449 | one[key] === undefined,
|
21450 | 'mergeIntoWithNoDuplicateKeys(): ' +
|
21451 | 'Tried to merge two objects with the same key: `%s`. This conflict ' +
|
21452 | 'may be due to a mixin; in particular, this may be caused by two ' +
|
21453 | 'getInitialState() or getDefaultProps() methods returning objects ' +
|
21454 | 'with clashing keys.',
|
21455 | key
|
21456 | );
|
21457 | one[key] = two[key];
|
21458 | }
|
21459 | }
|
21460 | return one;
|
21461 | }
|
21462 |
|
21463 | |
21464 |
|
21465 |
|
21466 |
|
21467 |
|
21468 |
|
21469 |
|
21470 |
|
21471 | function createMergedResultFunction(one, two) {
|
21472 | return function mergedResult() {
|
21473 | var a = one.apply(this, arguments);
|
21474 | var b = two.apply(this, arguments);
|
21475 | if (a == null) {
|
21476 | return b;
|
21477 | } else if (b == null) {
|
21478 | return a;
|
21479 | }
|
21480 | var c = {};
|
21481 | mergeIntoWithNoDuplicateKeys(c, a);
|
21482 | mergeIntoWithNoDuplicateKeys(c, b);
|
21483 | return c;
|
21484 | };
|
21485 | }
|
21486 |
|
21487 | |
21488 |
|
21489 |
|
21490 |
|
21491 |
|
21492 |
|
21493 |
|
21494 |
|
21495 | function createChainedFunction(one, two) {
|
21496 | return function chainedFunction() {
|
21497 | one.apply(this, arguments);
|
21498 | two.apply(this, arguments);
|
21499 | };
|
21500 | }
|
21501 |
|
21502 | |
21503 |
|
21504 |
|
21505 |
|
21506 |
|
21507 |
|
21508 |
|
21509 | function bindAutoBindMethod(component, method) {
|
21510 | var boundMethod = method.bind(component);
|
21511 | if (process.env.NODE_ENV !== 'production') {
|
21512 | boundMethod.__reactBoundContext = component;
|
21513 | boundMethod.__reactBoundMethod = method;
|
21514 | boundMethod.__reactBoundArguments = null;
|
21515 | var componentName = component.constructor.displayName;
|
21516 | var _bind = boundMethod.bind;
|
21517 | boundMethod.bind = function(newThis) {
|
21518 | for (
|
21519 | var _len = arguments.length,
|
21520 | args = Array(_len > 1 ? _len - 1 : 0),
|
21521 | _key = 1;
|
21522 | _key < _len;
|
21523 | _key++
|
21524 | ) {
|
21525 | args[_key - 1] = arguments[_key];
|
21526 | }
|
21527 |
|
21528 |
|
21529 |
|
21530 |
|
21531 | if (newThis !== component && newThis !== null) {
|
21532 | if (process.env.NODE_ENV !== 'production') {
|
21533 | warning(
|
21534 | false,
|
21535 | 'bind(): React component methods may only be bound to the ' +
|
21536 | 'component instance. See %s',
|
21537 | componentName
|
21538 | );
|
21539 | }
|
21540 | } else if (!args.length) {
|
21541 | if (process.env.NODE_ENV !== 'production') {
|
21542 | warning(
|
21543 | false,
|
21544 | 'bind(): You are binding a component method to the component. ' +
|
21545 | 'React does this for you automatically in a high-performance ' +
|
21546 | 'way, so you can safely remove this call. See %s',
|
21547 | componentName
|
21548 | );
|
21549 | }
|
21550 | return boundMethod;
|
21551 | }
|
21552 | var reboundMethod = _bind.apply(boundMethod, arguments);
|
21553 | reboundMethod.__reactBoundContext = component;
|
21554 | reboundMethod.__reactBoundMethod = method;
|
21555 | reboundMethod.__reactBoundArguments = args;
|
21556 | return reboundMethod;
|
21557 | };
|
21558 | }
|
21559 | return boundMethod;
|
21560 | }
|
21561 |
|
21562 | |
21563 |
|
21564 |
|
21565 |
|
21566 |
|
21567 | function bindAutoBindMethods(component) {
|
21568 | var pairs = component.__reactAutoBindPairs;
|
21569 | for (var i = 0; i < pairs.length; i += 2) {
|
21570 | var autoBindKey = pairs[i];
|
21571 | var method = pairs[i + 1];
|
21572 | component[autoBindKey] = bindAutoBindMethod(component, method);
|
21573 | }
|
21574 | }
|
21575 |
|
21576 | var IsMountedPreMixin = {
|
21577 | componentDidMount: function() {
|
21578 | this.__isMounted = true;
|
21579 | }
|
21580 | };
|
21581 |
|
21582 | var IsMountedPostMixin = {
|
21583 | componentWillUnmount: function() {
|
21584 | this.__isMounted = false;
|
21585 | }
|
21586 | };
|
21587 |
|
21588 | |
21589 |
|
21590 |
|
21591 |
|
21592 | var ReactClassMixin = {
|
21593 | |
21594 |
|
21595 |
|
21596 |
|
21597 | replaceState: function(newState, callback) {
|
21598 | this.updater.enqueueReplaceState(this, newState, callback);
|
21599 | },
|
21600 |
|
21601 | |
21602 |
|
21603 |
|
21604 |
|
21605 |
|
21606 |
|
21607 | isMounted: function() {
|
21608 | if (process.env.NODE_ENV !== 'production') {
|
21609 | warning(
|
21610 | this.__didWarnIsMounted,
|
21611 | '%s: isMounted is deprecated. Instead, make sure to clean up ' +
|
21612 | 'subscriptions and pending requests in componentWillUnmount to ' +
|
21613 | 'prevent memory leaks.',
|
21614 | (this.constructor && this.constructor.displayName) ||
|
21615 | this.name ||
|
21616 | 'Component'
|
21617 | );
|
21618 | this.__didWarnIsMounted = true;
|
21619 | }
|
21620 | return !!this.__isMounted;
|
21621 | }
|
21622 | };
|
21623 |
|
21624 | var ReactClassComponent = function() {};
|
21625 | _assign(
|
21626 | ReactClassComponent.prototype,
|
21627 | ReactComponent.prototype,
|
21628 | ReactClassMixin
|
21629 | );
|
21630 |
|
21631 | |
21632 |
|
21633 |
|
21634 |
|
21635 |
|
21636 |
|
21637 |
|
21638 |
|
21639 | function createClass(spec) {
|
21640 |
|
21641 |
|
21642 |
|
21643 | var Constructor = identity(function(props, context, updater) {
|
21644 |
|
21645 |
|
21646 |
|
21647 | if (process.env.NODE_ENV !== 'production') {
|
21648 | warning(
|
21649 | this instanceof Constructor,
|
21650 | 'Something is calling a React component directly. Use a factory or ' +
|
21651 | 'JSX instead. See: https://fb.me/react-legacyfactory'
|
21652 | );
|
21653 | }
|
21654 |
|
21655 |
|
21656 | if (this.__reactAutoBindPairs.length) {
|
21657 | bindAutoBindMethods(this);
|
21658 | }
|
21659 |
|
21660 | this.props = props;
|
21661 | this.context = context;
|
21662 | this.refs = emptyObject;
|
21663 | this.updater = updater || ReactNoopUpdateQueue;
|
21664 |
|
21665 | this.state = null;
|
21666 |
|
21667 |
|
21668 |
|
21669 |
|
21670 | var initialState = this.getInitialState ? this.getInitialState() : null;
|
21671 | if (process.env.NODE_ENV !== 'production') {
|
21672 |
|
21673 | if (
|
21674 | initialState === undefined &&
|
21675 | this.getInitialState._isMockFunction
|
21676 | ) {
|
21677 |
|
21678 |
|
21679 | initialState = null;
|
21680 | }
|
21681 | }
|
21682 | _invariant(
|
21683 | typeof initialState === 'object' && !Array.isArray(initialState),
|
21684 | '%s.getInitialState(): must return an object or null',
|
21685 | Constructor.displayName || 'ReactCompositeComponent'
|
21686 | );
|
21687 |
|
21688 | this.state = initialState;
|
21689 | });
|
21690 | Constructor.prototype = new ReactClassComponent();
|
21691 | Constructor.prototype.constructor = Constructor;
|
21692 | Constructor.prototype.__reactAutoBindPairs = [];
|
21693 |
|
21694 | injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
|
21695 |
|
21696 | mixSpecIntoComponent(Constructor, IsMountedPreMixin);
|
21697 | mixSpecIntoComponent(Constructor, spec);
|
21698 | mixSpecIntoComponent(Constructor, IsMountedPostMixin);
|
21699 |
|
21700 |
|
21701 | if (Constructor.getDefaultProps) {
|
21702 | Constructor.defaultProps = Constructor.getDefaultProps();
|
21703 | }
|
21704 |
|
21705 | if (process.env.NODE_ENV !== 'production') {
|
21706 |
|
21707 |
|
21708 |
|
21709 |
|
21710 | if (Constructor.getDefaultProps) {
|
21711 | Constructor.getDefaultProps.isReactClassApproved = {};
|
21712 | }
|
21713 | if (Constructor.prototype.getInitialState) {
|
21714 | Constructor.prototype.getInitialState.isReactClassApproved = {};
|
21715 | }
|
21716 | }
|
21717 |
|
21718 | _invariant(
|
21719 | Constructor.prototype.render,
|
21720 | 'createClass(...): Class specification must implement a `render` method.'
|
21721 | );
|
21722 |
|
21723 | if (process.env.NODE_ENV !== 'production') {
|
21724 | warning(
|
21725 | !Constructor.prototype.componentShouldUpdate,
|
21726 | '%s has a method called ' +
|
21727 | 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
|
21728 | 'The name is phrased as a question because the function is ' +
|
21729 | 'expected to return a value.',
|
21730 | spec.displayName || 'A component'
|
21731 | );
|
21732 | warning(
|
21733 | !Constructor.prototype.componentWillRecieveProps,
|
21734 | '%s has a method called ' +
|
21735 | 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?',
|
21736 | spec.displayName || 'A component'
|
21737 | );
|
21738 | warning(
|
21739 | !Constructor.prototype.UNSAFE_componentWillRecieveProps,
|
21740 | '%s has a method called UNSAFE_componentWillRecieveProps(). ' +
|
21741 | 'Did you mean UNSAFE_componentWillReceiveProps()?',
|
21742 | spec.displayName || 'A component'
|
21743 | );
|
21744 | }
|
21745 |
|
21746 |
|
21747 | for (var methodName in ReactClassInterface) {
|
21748 | if (!Constructor.prototype[methodName]) {
|
21749 | Constructor.prototype[methodName] = null;
|
21750 | }
|
21751 | }
|
21752 |
|
21753 | return Constructor;
|
21754 | }
|
21755 |
|
21756 | return createClass;
|
21757 | }
|
21758 |
|
21759 | module.exports = factory;
|
21760 |
|
21761 | }.call(exports, __webpack_require__(33)))
|
21762 |
|
21763 | }),
|
21764 |
|
21765 | (function(module, exports, __webpack_require__) {
|
21766 |
|
21767 | (function(process) { |
21768 |
|
21769 |
|
21770 |
|
21771 |
|
21772 |
|
21773 |
|
21774 |
|
21775 | 'use strict';
|
21776 |
|
21777 | var emptyObject = {};
|
21778 |
|
21779 | if (process.env.NODE_ENV !== 'production') {
|
21780 | Object.freeze(emptyObject);
|
21781 | }
|
21782 |
|
21783 | module.exports = emptyObject;
|
21784 | }.call(exports, __webpack_require__(33)))
|
21785 |
|
21786 | }),
|
21787 |
|
21788 | (function(module, exports, __webpack_require__) {
|
21789 |
|
21790 | (function(process) { |
21791 |
|
21792 |
|
21793 |
|
21794 |
|
21795 |
|
21796 |
|
21797 |
|
21798 | 'use strict';
|
21799 |
|
21800 | |
21801 |
|
21802 |
|
21803 |
|
21804 |
|
21805 |
|
21806 |
|
21807 |
|
21808 |
|
21809 |
|
21810 |
|
21811 | var validateFormat = function validateFormat(format) {};
|
21812 |
|
21813 | if (process.env.NODE_ENV !== 'production') {
|
21814 | validateFormat = function validateFormat(format) {
|
21815 | if (format === undefined) {
|
21816 | throw new Error('invariant requires an error message argument');
|
21817 | }
|
21818 | };
|
21819 | }
|
21820 |
|
21821 | function invariant(condition, format, a, b, c, d, e, f) {
|
21822 | validateFormat(format);
|
21823 |
|
21824 | if (!condition) {
|
21825 | var error;
|
21826 | if (format === undefined) {
|
21827 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
21828 | } else {
|
21829 | var args = [a, b, c, d, e, f];
|
21830 | var argIndex = 0;
|
21831 | error = new Error(format.replace(/%s/g, function () {
|
21832 | return args[argIndex++];
|
21833 | }));
|
21834 | error.name = 'Invariant Violation';
|
21835 | }
|
21836 |
|
21837 | error.framesToPop = 1;
|
21838 | throw error;
|
21839 | }
|
21840 | }
|
21841 |
|
21842 | module.exports = invariant;
|
21843 | }.call(exports, __webpack_require__(33)))
|
21844 |
|
21845 | }),
|
21846 |
|
21847 | (function(module, exports, __webpack_require__) {
|
21848 |
|
21849 | (function(process) { |
21850 |
|
21851 |
|
21852 |
|
21853 |
|
21854 |
|
21855 |
|
21856 |
|
21857 | 'use strict';
|
21858 |
|
21859 | var emptyFunction = __webpack_require__(225);
|
21860 |
|
21861 | |
21862 |
|
21863 |
|
21864 |
|
21865 |
|
21866 |
|
21867 |
|
21868 | var warning = emptyFunction;
|
21869 |
|
21870 | if (process.env.NODE_ENV !== 'production') {
|
21871 | var printWarning = function printWarning(format) {
|
21872 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
21873 | args[_key - 1] = arguments[_key];
|
21874 | }
|
21875 |
|
21876 | var argIndex = 0;
|
21877 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
21878 | return args[argIndex++];
|
21879 | });
|
21880 | if (typeof console !== 'undefined') {
|
21881 | console.error(message);
|
21882 | }
|
21883 | try {
|
21884 |
|
21885 |
|
21886 |
|
21887 | throw new Error(message);
|
21888 | } catch (x) {}
|
21889 | };
|
21890 |
|
21891 | warning = function warning(condition, format) {
|
21892 | if (format === undefined) {
|
21893 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
21894 | }
|
21895 |
|
21896 | if (format.indexOf('Failed Composite propType: ') === 0) {
|
21897 | return;
|
21898 | }
|
21899 |
|
21900 | if (!condition) {
|
21901 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
21902 | args[_key2 - 2] = arguments[_key2];
|
21903 | }
|
21904 |
|
21905 | printWarning.apply(undefined, [format].concat(args));
|
21906 | }
|
21907 | };
|
21908 | }
|
21909 |
|
21910 | module.exports = warning;
|
21911 | }.call(exports, __webpack_require__(33)))
|
21912 |
|
21913 | }),
|
21914 |
|
21915 | (function(module, exports) {
|
21916 |
|
21917 | "use strict";
|
21918 |
|
21919 | |
21920 |
|
21921 |
|
21922 |
|
21923 |
|
21924 |
|
21925 |
|
21926 |
|
21927 |
|
21928 | function makeEmptyFunction(arg) {
|
21929 | return function () {
|
21930 | return arg;
|
21931 | };
|
21932 | }
|
21933 |
|
21934 | |
21935 |
|
21936 |
|
21937 |
|
21938 |
|
21939 | var emptyFunction = function emptyFunction() {};
|
21940 |
|
21941 | emptyFunction.thatReturns = makeEmptyFunction;
|
21942 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
21943 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
21944 | emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
21945 | emptyFunction.thatReturnsThis = function () {
|
21946 | return this;
|
21947 | };
|
21948 | emptyFunction.thatReturnsArgument = function (arg) {
|
21949 | return arg;
|
21950 | };
|
21951 |
|
21952 | module.exports = emptyFunction;
|
21953 |
|
21954 | }),
|
21955 |
|
21956 | (function(module, exports, __webpack_require__) {
|
21957 |
|
21958 | 'use strict';
|
21959 |
|
21960 | Object.defineProperty(exports, "__esModule", {
|
21961 | value: true
|
21962 | });
|
21963 |
|
21964 | var _extends2 = __webpack_require__(177);
|
21965 |
|
21966 | var _extends3 = _interopRequireDefault(_extends2);
|
21967 |
|
21968 | var _typeof2 = __webpack_require__(227);
|
21969 |
|
21970 | var _typeof3 = _interopRequireDefault(_typeof2);
|
21971 |
|
21972 | var _util = __webpack_require__(243);
|
21973 |
|
21974 | var _validator = __webpack_require__(244);
|
21975 |
|
21976 | var _validator2 = _interopRequireDefault(_validator);
|
21977 |
|
21978 | var _messages2 = __webpack_require__(266);
|
21979 |
|
21980 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
21981 |
|
21982 | |
21983 |
|
21984 |
|
21985 |
|
21986 |
|
21987 |
|
21988 | function Schema(descriptor) {
|
21989 | this.rules = null;
|
21990 | this._messages = _messages2.messages;
|
21991 | this.define(descriptor);
|
21992 | }
|
21993 |
|
21994 | Schema.prototype = {
|
21995 | messages: function messages(_messages) {
|
21996 | if (_messages) {
|
21997 | this._messages = (0, _util.deepMerge)((0, _messages2.newMessages)(), _messages);
|
21998 | }
|
21999 | return this._messages;
|
22000 | },
|
22001 | define: function define(rules) {
|
22002 | if (!rules) {
|
22003 | throw new Error('Cannot configure a schema with no rules');
|
22004 | }
|
22005 | if ((typeof rules === 'undefined' ? 'undefined' : (0, _typeof3['default'])(rules)) !== 'object' || Array.isArray(rules)) {
|
22006 | throw new Error('Rules must be an object');
|
22007 | }
|
22008 | this.rules = {};
|
22009 | var z = void 0;
|
22010 | var item = void 0;
|
22011 | for (z in rules) {
|
22012 | if (rules.hasOwnProperty(z)) {
|
22013 | item = rules[z];
|
22014 | this.rules[z] = Array.isArray(item) ? item : [item];
|
22015 | }
|
22016 | }
|
22017 | },
|
22018 | validate: function validate(source_) {
|
22019 | var _this = this;
|
22020 |
|
22021 | var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
22022 | var oc = arguments[2];
|
22023 |
|
22024 | var source = source_;
|
22025 | var options = o;
|
22026 | var callback = oc;
|
22027 | if (typeof options === 'function') {
|
22028 | callback = options;
|
22029 | options = {};
|
22030 | }
|
22031 | if (!this.rules || Object.keys(this.rules).length === 0) {
|
22032 | if (callback) {
|
22033 | callback();
|
22034 | }
|
22035 | return;
|
22036 | }
|
22037 | function complete(results) {
|
22038 | var i = void 0;
|
22039 | var field = void 0;
|
22040 | var errors = [];
|
22041 | var fields = {};
|
22042 |
|
22043 | function add(e) {
|
22044 | if (Array.isArray(e)) {
|
22045 | errors = errors.concat.apply(errors, e);
|
22046 | } else {
|
22047 | errors.push(e);
|
22048 | }
|
22049 | }
|
22050 |
|
22051 | for (i = 0; i < results.length; i++) {
|
22052 | add(results[i]);
|
22053 | }
|
22054 | if (!errors.length) {
|
22055 | errors = null;
|
22056 | fields = null;
|
22057 | } else {
|
22058 | for (i = 0; i < errors.length; i++) {
|
22059 | field = errors[i].field;
|
22060 | fields[field] = fields[field] || [];
|
22061 | fields[field].push(errors[i]);
|
22062 | }
|
22063 | }
|
22064 | callback(errors, fields);
|
22065 | }
|
22066 |
|
22067 | if (options.messages) {
|
22068 | var messages = this.messages();
|
22069 | if (messages === _messages2.messages) {
|
22070 | messages = (0, _messages2.newMessages)();
|
22071 | }
|
22072 | (0, _util.deepMerge)(messages, options.messages);
|
22073 | options.messages = messages;
|
22074 | } else {
|
22075 | options.messages = this.messages();
|
22076 | }
|
22077 | var arr = void 0;
|
22078 | var value = void 0;
|
22079 | var series = {};
|
22080 | var keys = options.keys || Object.keys(this.rules);
|
22081 | keys.forEach(function (z) {
|
22082 | arr = _this.rules[z];
|
22083 | value = source[z];
|
22084 | arr.forEach(function (r) {
|
22085 | var rule = r;
|
22086 | if (typeof rule.transform === 'function') {
|
22087 | if (source === source_) {
|
22088 | source = (0, _extends3['default'])({}, source);
|
22089 | }
|
22090 | value = source[z] = rule.transform(value);
|
22091 | }
|
22092 | if (typeof rule === 'function') {
|
22093 | rule = {
|
22094 | validator: rule
|
22095 | };
|
22096 | } else {
|
22097 | rule = (0, _extends3['default'])({}, rule);
|
22098 | }
|
22099 | rule.validator = _this.getValidationMethod(rule);
|
22100 | rule.field = z;
|
22101 | rule.fullField = rule.fullField || z;
|
22102 | rule.type = _this.getType(rule);
|
22103 | if (!rule.validator) {
|
22104 | return;
|
22105 | }
|
22106 | series[z] = series[z] || [];
|
22107 | series[z].push({
|
22108 | rule: rule,
|
22109 | value: value,
|
22110 | source: source,
|
22111 | field: z
|
22112 | });
|
22113 | });
|
22114 | });
|
22115 | var errorFields = {};
|
22116 | (0, _util.asyncMap)(series, options, function (data, doIt) {
|
22117 | var rule = data.rule;
|
22118 | var deep = (rule.type === 'object' || rule.type === 'array') && ((0, _typeof3['default'])(rule.fields) === 'object' || (0, _typeof3['default'])(rule.defaultField) === 'object');
|
22119 | deep = deep && (rule.required || !rule.required && data.value);
|
22120 | rule.field = data.field;
|
22121 | function addFullfield(key, schema) {
|
22122 | return (0, _extends3['default'])({}, schema, {
|
22123 | fullField: rule.fullField + '.' + key
|
22124 | });
|
22125 | }
|
22126 |
|
22127 | function cb() {
|
22128 | var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
22129 |
|
22130 | var errors = e;
|
22131 | if (!Array.isArray(errors)) {
|
22132 | errors = [errors];
|
22133 | }
|
22134 | if (errors.length) {
|
22135 | (0, _util.warning)('async-validator:', errors);
|
22136 | }
|
22137 | if (errors.length && rule.message) {
|
22138 | errors = [].concat(rule.message);
|
22139 | }
|
22140 |
|
22141 | errors = errors.map((0, _util.complementError)(rule));
|
22142 |
|
22143 | if (options.first && errors.length) {
|
22144 | errorFields[rule.field] = 1;
|
22145 | return doIt(errors);
|
22146 | }
|
22147 | if (!deep) {
|
22148 | doIt(errors);
|
22149 | } else {
|
22150 |
|
22151 |
|
22152 |
|
22153 | if (rule.required && !data.value) {
|
22154 | if (rule.message) {
|
22155 | errors = [].concat(rule.message).map((0, _util.complementError)(rule));
|
22156 | } else if (options.error) {
|
22157 | errors = [options.error(rule, (0, _util.format)(options.messages.required, rule.field))];
|
22158 | } else {
|
22159 | errors = [];
|
22160 | }
|
22161 | return doIt(errors);
|
22162 | }
|
22163 |
|
22164 | var fieldsSchema = {};
|
22165 | if (rule.defaultField) {
|
22166 | for (var k in data.value) {
|
22167 | if (data.value.hasOwnProperty(k)) {
|
22168 | fieldsSchema[k] = rule.defaultField;
|
22169 | }
|
22170 | }
|
22171 | }
|
22172 | fieldsSchema = (0, _extends3['default'])({}, fieldsSchema, data.rule.fields);
|
22173 | for (var f in fieldsSchema) {
|
22174 | if (fieldsSchema.hasOwnProperty(f)) {
|
22175 | var fieldSchema = Array.isArray(fieldsSchema[f]) ? fieldsSchema[f] : [fieldsSchema[f]];
|
22176 | fieldsSchema[f] = fieldSchema.map(addFullfield.bind(null, f));
|
22177 | }
|
22178 | }
|
22179 | var schema = new Schema(fieldsSchema);
|
22180 | schema.messages(options.messages);
|
22181 | if (data.rule.options) {
|
22182 | data.rule.options.messages = options.messages;
|
22183 | data.rule.options.error = options.error;
|
22184 | }
|
22185 | schema.validate(data.value, data.rule.options || options, function (errs) {
|
22186 | doIt(errs && errs.length ? errors.concat(errs) : errs);
|
22187 | });
|
22188 | }
|
22189 | }
|
22190 |
|
22191 | var res = rule.validator(rule, data.value, cb, data.source, options);
|
22192 | if (res && res.then) {
|
22193 | res.then(function () {
|
22194 | return cb();
|
22195 | }, function (e) {
|
22196 | return cb(e);
|
22197 | });
|
22198 | }
|
22199 | }, function (results) {
|
22200 | complete(results);
|
22201 | });
|
22202 | },
|
22203 | getType: function getType(rule) {
|
22204 | if (rule.type === undefined && rule.pattern instanceof RegExp) {
|
22205 | rule.type = 'pattern';
|
22206 | }
|
22207 | if (typeof rule.validator !== 'function' && rule.type && !_validator2['default'].hasOwnProperty(rule.type)) {
|
22208 | throw new Error((0, _util.format)('Unknown rule type %s', rule.type));
|
22209 | }
|
22210 | return rule.type || 'string';
|
22211 | },
|
22212 | getValidationMethod: function getValidationMethod(rule) {
|
22213 | if (typeof rule.validator === 'function') {
|
22214 | return rule.validator;
|
22215 | }
|
22216 | var keys = Object.keys(rule);
|
22217 | var messageIndex = keys.indexOf('message');
|
22218 | if (messageIndex !== -1) {
|
22219 | keys.splice(messageIndex, 1);
|
22220 | }
|
22221 | if (keys.length === 1 && keys[0] === 'required') {
|
22222 | return _validator2['default'].required;
|
22223 | }
|
22224 | return _validator2['default'][this.getType(rule)] || false;
|
22225 | }
|
22226 | };
|
22227 |
|
22228 | Schema.register = function register(type, validator) {
|
22229 | if (typeof validator !== 'function') {
|
22230 | throw new Error('Cannot register a validator by type, validator is not a function');
|
22231 | }
|
22232 | _validator2['default'][type] = validator;
|
22233 | };
|
22234 |
|
22235 | Schema.messages = _messages2.messages;
|
22236 |
|
22237 | exports['default'] = Schema;
|
22238 | module.exports = exports['default'];
|
22239 |
|
22240 | }),
|
22241 |
|
22242 | (function(module, exports, __webpack_require__) {
|
22243 |
|
22244 | "use strict";
|
22245 |
|
22246 | exports.__esModule = true;
|
22247 |
|
22248 | var _iterator = __webpack_require__(228);
|
22249 |
|
22250 | var _iterator2 = _interopRequireDefault(_iterator);
|
22251 |
|
22252 | var _symbol = __webpack_require__(235);
|
22253 |
|
22254 | var _symbol2 = _interopRequireDefault(_symbol);
|
22255 |
|
22256 | 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; };
|
22257 |
|
22258 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22259 |
|
22260 | exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
|
22261 | return typeof obj === "undefined" ? "undefined" : _typeof(obj);
|
22262 | } : function (obj) {
|
22263 | return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
|
22264 | };
|
22265 |
|
22266 | }),
|
22267 |
|
22268 | (function(module, exports, __webpack_require__) {
|
22269 |
|
22270 | module.exports = { "default": __webpack_require__(229), __esModule: true };
|
22271 |
|
22272 | }),
|
22273 |
|
22274 | (function(module, exports, __webpack_require__) {
|
22275 |
|
22276 | __webpack_require__(195);
|
22277 | __webpack_require__(230);
|
22278 | module.exports = __webpack_require__(208)('iterator');
|
22279 |
|
22280 | }),
|
22281 |
|
22282 | (function(module, exports, __webpack_require__) {
|
22283 |
|
22284 | __webpack_require__(231);
|
22285 | var Iterators = __webpack_require__(205);
|
22286 | Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array;
|
22287 |
|
22288 | }),
|
22289 |
|
22290 | (function(module, exports, __webpack_require__) {
|
22291 |
|
22292 | 'use strict';
|
22293 | var addToUnscopables = __webpack_require__(232)
|
22294 | , step = __webpack_require__(233)
|
22295 | , Iterators = __webpack_require__(205)
|
22296 | , toIObject = __webpack_require__(234);
|
22297 |
|
22298 |
|
22299 |
|
22300 |
|
22301 |
|
22302 | module.exports = __webpack_require__(198)(Array, 'Array', function(iterated, kind){
|
22303 | this._t = toIObject(iterated);
|
22304 | this._i = 0;
|
22305 | this._k = kind;
|
22306 |
|
22307 | }, function(){
|
22308 | var O = this._t
|
22309 | , kind = this._k
|
22310 | , index = this._i++;
|
22311 | if(!O || index >= O.length){
|
22312 | this._t = undefined;
|
22313 | return step(1);
|
22314 | }
|
22315 | if(kind == 'keys' )return step(0, index);
|
22316 | if(kind == 'values')return step(0, O[index]);
|
22317 | return step(0, [index, O[index]]);
|
22318 | }, 'values');
|
22319 |
|
22320 |
|
22321 | Iterators.Arguments = Iterators.Array;
|
22322 |
|
22323 | addToUnscopables('keys');
|
22324 | addToUnscopables('values');
|
22325 | addToUnscopables('entries');
|
22326 |
|
22327 | }),
|
22328 |
|
22329 | (function(module, exports) {
|
22330 |
|
22331 | module.exports = function(){ };
|
22332 |
|
22333 | }),
|
22334 |
|
22335 | (function(module, exports) {
|
22336 |
|
22337 | module.exports = function(done, value){
|
22338 | return {value: value, done: !!done};
|
22339 | };
|
22340 |
|
22341 | }),
|
22342 |
|
22343 | (function(module, exports, __webpack_require__) {
|
22344 |
|
22345 |
|
22346 | var IObject = __webpack_require__(189)
|
22347 | , defined = __webpack_require__(188);
|
22348 | module.exports = function(it){
|
22349 | return IObject(defined(it));
|
22350 | };
|
22351 |
|
22352 | }),
|
22353 |
|
22354 | (function(module, exports, __webpack_require__) {
|
22355 |
|
22356 | module.exports = { "default": __webpack_require__(236), __esModule: true };
|
22357 |
|
22358 | }),
|
22359 |
|
22360 | (function(module, exports, __webpack_require__) {
|
22361 |
|
22362 | __webpack_require__(237);
|
22363 | __webpack_require__(242);
|
22364 | module.exports = __webpack_require__(183).Symbol;
|
22365 |
|
22366 | }),
|
22367 |
|
22368 | (function(module, exports, __webpack_require__) {
|
22369 |
|
22370 | 'use strict';
|
22371 |
|
22372 | var $ = __webpack_require__(176)
|
22373 | , global = __webpack_require__(182)
|
22374 | , has = __webpack_require__(204)
|
22375 | , DESCRIPTORS = __webpack_require__(203)
|
22376 | , $export = __webpack_require__(181)
|
22377 | , redefine = __webpack_require__(200)
|
22378 | , $fails = __webpack_require__(191)
|
22379 | , shared = __webpack_require__(209)
|
22380 | , setToStringTag = __webpack_require__(207)
|
22381 | , uid = __webpack_require__(210)
|
22382 | , wks = __webpack_require__(208)
|
22383 | , keyOf = __webpack_require__(238)
|
22384 | , $names = __webpack_require__(239)
|
22385 | , enumKeys = __webpack_require__(240)
|
22386 | , isArray = __webpack_require__(241)
|
22387 | , anObject = __webpack_require__(213)
|
22388 | , toIObject = __webpack_require__(234)
|
22389 | , createDesc = __webpack_require__(202)
|
22390 | , getDesc = $.getDesc
|
22391 | , setDesc = $.setDesc
|
22392 | , _create = $.create
|
22393 | , getNames = $names.get
|
22394 | , $Symbol = global.Symbol
|
22395 | , $JSON = global.JSON
|
22396 | , _stringify = $JSON && $JSON.stringify
|
22397 | , setter = false
|
22398 | , HIDDEN = wks('_hidden')
|
22399 | , isEnum = $.isEnum
|
22400 | , SymbolRegistry = shared('symbol-registry')
|
22401 | , AllSymbols = shared('symbols')
|
22402 | , useNative = typeof $Symbol == 'function'
|
22403 | , ObjectProto = Object.prototype;
|
22404 |
|
22405 |
|
22406 | var setSymbolDesc = DESCRIPTORS && $fails(function(){
|
22407 | return _create(setDesc({}, 'a', {
|
22408 | get: function(){ return setDesc(this, 'a', {value: 7}).a; }
|
22409 | })).a != 7;
|
22410 | }) ? function(it, key, D){
|
22411 | var protoDesc = getDesc(ObjectProto, key);
|
22412 | if(protoDesc)delete ObjectProto[key];
|
22413 | setDesc(it, key, D);
|
22414 | if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc);
|
22415 | } : setDesc;
|
22416 |
|
22417 | var wrap = function(tag){
|
22418 | var sym = AllSymbols[tag] = _create($Symbol.prototype);
|
22419 | sym._k = tag;
|
22420 | DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, {
|
22421 | configurable: true,
|
22422 | set: function(value){
|
22423 | if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
|
22424 | setSymbolDesc(this, tag, createDesc(1, value));
|
22425 | }
|
22426 | });
|
22427 | return sym;
|
22428 | };
|
22429 |
|
22430 | var isSymbol = function(it){
|
22431 | return typeof it == 'symbol';
|
22432 | };
|
22433 |
|
22434 | var $defineProperty = function defineProperty(it, key, D){
|
22435 | if(D && has(AllSymbols, key)){
|
22436 | if(!D.enumerable){
|
22437 | if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {}));
|
22438 | it[HIDDEN][key] = true;
|
22439 | } else {
|
22440 | if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
|
22441 | D = _create(D, {enumerable: createDesc(0, false)});
|
22442 | } return setSymbolDesc(it, key, D);
|
22443 | } return setDesc(it, key, D);
|
22444 | };
|
22445 | var $defineProperties = function defineProperties(it, P){
|
22446 | anObject(it);
|
22447 | var keys = enumKeys(P = toIObject(P))
|
22448 | , i = 0
|
22449 | , l = keys.length
|
22450 | , key;
|
22451 | while(l > i)$defineProperty(it, key = keys[i++], P[key]);
|
22452 | return it;
|
22453 | };
|
22454 | var $create = function create(it, P){
|
22455 | return P === undefined ? _create(it) : $defineProperties(_create(it), P);
|
22456 | };
|
22457 | var $propertyIsEnumerable = function propertyIsEnumerable(key){
|
22458 | var E = isEnum.call(this, key);
|
22459 | return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key]
|
22460 | ? E : true;
|
22461 | };
|
22462 | var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
|
22463 | var D = getDesc(it = toIObject(it), key);
|
22464 | if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
|
22465 | return D;
|
22466 | };
|
22467 | var $getOwnPropertyNames = function getOwnPropertyNames(it){
|
22468 | var names = getNames(toIObject(it))
|
22469 | , result = []
|
22470 | , i = 0
|
22471 | , key;
|
22472 | while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key);
|
22473 | return result;
|
22474 | };
|
22475 | var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
|
22476 | var names = getNames(toIObject(it))
|
22477 | , result = []
|
22478 | , i = 0
|
22479 | , key;
|
22480 | while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]);
|
22481 | return result;
|
22482 | };
|
22483 | var $stringify = function stringify(it){
|
22484 | if(it === undefined || isSymbol(it))return;
|
22485 | var args = [it]
|
22486 | , i = 1
|
22487 | , $$ = arguments
|
22488 | , replacer, $replacer;
|
22489 | while($$.length > i)args.push($$[i++]);
|
22490 | replacer = args[1];
|
22491 | if(typeof replacer == 'function')$replacer = replacer;
|
22492 | if($replacer || !isArray(replacer))replacer = function(key, value){
|
22493 | if($replacer)value = $replacer.call(this, key, value);
|
22494 | if(!isSymbol(value))return value;
|
22495 | };
|
22496 | args[1] = replacer;
|
22497 | return _stringify.apply($JSON, args);
|
22498 | };
|
22499 | var buggyJSON = $fails(function(){
|
22500 | var S = $Symbol();
|
22501 |
|
22502 |
|
22503 |
|
22504 | return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
|
22505 | });
|
22506 |
|
22507 |
|
22508 | if(!useNative){
|
22509 | $Symbol = function Symbol(){
|
22510 | if(isSymbol(this))throw TypeError('Symbol is not a constructor');
|
22511 | return wrap(uid(arguments.length > 0 ? arguments[0] : undefined));
|
22512 | };
|
22513 | redefine($Symbol.prototype, 'toString', function toString(){
|
22514 | return this._k;
|
22515 | });
|
22516 |
|
22517 | isSymbol = function(it){
|
22518 | return it instanceof $Symbol;
|
22519 | };
|
22520 |
|
22521 | $.create = $create;
|
22522 | $.isEnum = $propertyIsEnumerable;
|
22523 | $.getDesc = $getOwnPropertyDescriptor;
|
22524 | $.setDesc = $defineProperty;
|
22525 | $.setDescs = $defineProperties;
|
22526 | $.getNames = $names.get = $getOwnPropertyNames;
|
22527 | $.getSymbols = $getOwnPropertySymbols;
|
22528 |
|
22529 | if(DESCRIPTORS && !__webpack_require__(199)){
|
22530 | redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
|
22531 | }
|
22532 | }
|
22533 |
|
22534 | var symbolStatics = {
|
22535 |
|
22536 | 'for': function(key){
|
22537 | return has(SymbolRegistry, key += '')
|
22538 | ? SymbolRegistry[key]
|
22539 | : SymbolRegistry[key] = $Symbol(key);
|
22540 | },
|
22541 |
|
22542 | keyFor: function keyFor(key){
|
22543 | return keyOf(SymbolRegistry, key);
|
22544 | },
|
22545 | useSetter: function(){ setter = true; },
|
22546 | useSimple: function(){ setter = false; }
|
22547 | };
|
22548 |
|
22549 |
|
22550 |
|
22551 |
|
22552 |
|
22553 |
|
22554 |
|
22555 |
|
22556 |
|
22557 |
|
22558 |
|
22559 | $.each.call((
|
22560 | 'hasInstance,isConcatSpreadable,iterator,match,replace,search,' +
|
22561 | 'species,split,toPrimitive,toStringTag,unscopables'
|
22562 | ).split(','), function(it){
|
22563 | var sym = wks(it);
|
22564 | symbolStatics[it] = useNative ? sym : wrap(sym);
|
22565 | });
|
22566 |
|
22567 | setter = true;
|
22568 |
|
22569 | $export($export.G + $export.W, {Symbol: $Symbol});
|
22570 |
|
22571 | $export($export.S, 'Symbol', symbolStatics);
|
22572 |
|
22573 | $export($export.S + $export.F * !useNative, 'Object', {
|
22574 |
|
22575 | create: $create,
|
22576 |
|
22577 | defineProperty: $defineProperty,
|
22578 |
|
22579 | defineProperties: $defineProperties,
|
22580 |
|
22581 | getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
|
22582 |
|
22583 | getOwnPropertyNames: $getOwnPropertyNames,
|
22584 |
|
22585 | getOwnPropertySymbols: $getOwnPropertySymbols
|
22586 | });
|
22587 |
|
22588 |
|
22589 | $JSON && $export($export.S + $export.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify});
|
22590 |
|
22591 |
|
22592 | setToStringTag($Symbol, 'Symbol');
|
22593 |
|
22594 | setToStringTag(Math, 'Math', true);
|
22595 |
|
22596 | setToStringTag(global.JSON, 'JSON', true);
|
22597 |
|
22598 | }),
|
22599 |
|
22600 | (function(module, exports, __webpack_require__) {
|
22601 |
|
22602 | var $ = __webpack_require__(176)
|
22603 | , toIObject = __webpack_require__(234);
|
22604 | module.exports = function(object, el){
|
22605 | var O = toIObject(object)
|
22606 | , keys = $.getKeys(O)
|
22607 | , length = keys.length
|
22608 | , index = 0
|
22609 | , key;
|
22610 | while(length > index)if(O[key = keys[index++]] === el)return key;
|
22611 | };
|
22612 |
|
22613 | }),
|
22614 |
|
22615 | (function(module, exports, __webpack_require__) {
|
22616 |
|
22617 |
|
22618 | var toIObject = __webpack_require__(234)
|
22619 | , getNames = __webpack_require__(176).getNames
|
22620 | , toString = {}.toString;
|
22621 |
|
22622 | var windowNames = typeof window == 'object' && Object.getOwnPropertyNames
|
22623 | ? Object.getOwnPropertyNames(window) : [];
|
22624 |
|
22625 | var getWindowNames = function(it){
|
22626 | try {
|
22627 | return getNames(it);
|
22628 | } catch(e){
|
22629 | return windowNames.slice();
|
22630 | }
|
22631 | };
|
22632 |
|
22633 | module.exports.get = function getOwnPropertyNames(it){
|
22634 | if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it);
|
22635 | return getNames(toIObject(it));
|
22636 | };
|
22637 |
|
22638 | }),
|
22639 |
|
22640 | (function(module, exports, __webpack_require__) {
|
22641 |
|
22642 |
|
22643 | var $ = __webpack_require__(176);
|
22644 | module.exports = function(it){
|
22645 | var keys = $.getKeys(it)
|
22646 | , getSymbols = $.getSymbols;
|
22647 | if(getSymbols){
|
22648 | var symbols = getSymbols(it)
|
22649 | , isEnum = $.isEnum
|
22650 | , i = 0
|
22651 | , key;
|
22652 | while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key);
|
22653 | }
|
22654 | return keys;
|
22655 | };
|
22656 |
|
22657 | }),
|
22658 |
|
22659 | (function(module, exports, __webpack_require__) {
|
22660 |
|
22661 |
|
22662 | var cof = __webpack_require__(190);
|
22663 | module.exports = Array.isArray || function(arg){
|
22664 | return cof(arg) == 'Array';
|
22665 | };
|
22666 |
|
22667 | }),
|
22668 |
|
22669 | (function(module, exports) {
|
22670 |
|
22671 |
|
22672 |
|
22673 | }),
|
22674 |
|
22675 | (function(module, exports, __webpack_require__) {
|
22676 |
|
22677 | (function(process) {'use strict';
|
22678 |
|
22679 | Object.defineProperty(exports, "__esModule", {
|
22680 | value: true
|
22681 | });
|
22682 | exports.warning = undefined;
|
22683 |
|
22684 | var _extends2 = __webpack_require__(177);
|
22685 |
|
22686 | var _extends3 = _interopRequireDefault(_extends2);
|
22687 |
|
22688 | var _typeof2 = __webpack_require__(227);
|
22689 |
|
22690 | var _typeof3 = _interopRequireDefault(_typeof2);
|
22691 |
|
22692 | exports.format = format;
|
22693 | exports.isEmptyValue = isEmptyValue;
|
22694 | exports.isEmptyObject = isEmptyObject;
|
22695 | exports.asyncMap = asyncMap;
|
22696 | exports.complementError = complementError;
|
22697 | exports.deepMerge = deepMerge;
|
22698 |
|
22699 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
22700 |
|
22701 | var formatRegExp = /%[sdj%]/g;
|
22702 |
|
22703 | var warning = exports.warning = function warning() {};
|
22704 |
|
22705 |
|
22706 | if (process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') {
|
22707 | exports.warning = warning = function warning(type, errors) {
|
22708 | if (typeof console !== 'undefined' && console.warn) {
|
22709 | if (errors.every(function (e) {
|
22710 | return typeof e === 'string';
|
22711 | })) {
|
22712 | console.warn(type, errors);
|
22713 | }
|
22714 | }
|
22715 | };
|
22716 | }
|
22717 |
|
22718 | function format() {
|
22719 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
22720 | args[_key] = arguments[_key];
|
22721 | }
|
22722 |
|
22723 | var i = 1;
|
22724 | var f = args[0];
|
22725 | var len = args.length;
|
22726 | if (typeof f === 'function') {
|
22727 | return f.apply(null, args.slice(1));
|
22728 | }
|
22729 | if (typeof f === 'string') {
|
22730 | var str = String(f).replace(formatRegExp, function (x) {
|
22731 | if (x === '%%') {
|
22732 | return '%';
|
22733 | }
|
22734 | if (i >= len) {
|
22735 | return x;
|
22736 | }
|
22737 | switch (x) {
|
22738 | case '%s':
|
22739 | return String(args[i++]);
|
22740 | case '%d':
|
22741 | return Number(args[i++]);
|
22742 | case '%j':
|
22743 | try {
|
22744 | return JSON.stringify(args[i++]);
|
22745 | } catch (_) {
|
22746 | return '[Circular]';
|
22747 | }
|
22748 | break;
|
22749 | default:
|
22750 | return x;
|
22751 | }
|
22752 | });
|
22753 | for (var arg = args[i]; i < len; arg = args[++i]) {
|
22754 | str += ' ' + arg;
|
22755 | }
|
22756 | return str;
|
22757 | }
|
22758 | return f;
|
22759 | }
|
22760 |
|
22761 | function isNativeStringType(type) {
|
22762 | return type === 'string' || type === 'url' || type === 'hex' || type === 'email' || type === 'pattern';
|
22763 | }
|
22764 |
|
22765 | function isEmptyValue(value, type) {
|
22766 | if (value === undefined || value === null) {
|
22767 | return true;
|
22768 | }
|
22769 | if (type === 'array' && Array.isArray(value) && !value.length) {
|
22770 | return true;
|
22771 | }
|
22772 | if (isNativeStringType(type) && typeof value === 'string' && !value) {
|
22773 | return true;
|
22774 | }
|
22775 | return false;
|
22776 | }
|
22777 |
|
22778 | function isEmptyObject(obj) {
|
22779 | return Object.keys(obj).length === 0;
|
22780 | }
|
22781 |
|
22782 | function asyncParallelArray(arr, func, callback) {
|
22783 | var results = [];
|
22784 | var total = 0;
|
22785 | var arrLength = arr.length;
|
22786 |
|
22787 | function count(errors) {
|
22788 | results.push.apply(results, errors);
|
22789 | total++;
|
22790 | if (total === arrLength) {
|
22791 | callback(results);
|
22792 | }
|
22793 | }
|
22794 |
|
22795 | arr.forEach(function (a) {
|
22796 | func(a, count);
|
22797 | });
|
22798 | }
|
22799 |
|
22800 | function asyncSerialArray(arr, func, callback) {
|
22801 | var index = 0;
|
22802 | var arrLength = arr.length;
|
22803 |
|
22804 | function next(errors) {
|
22805 | if (errors && errors.length) {
|
22806 | callback(errors);
|
22807 | return;
|
22808 | }
|
22809 | var original = index;
|
22810 | index = index + 1;
|
22811 | if (original < arrLength) {
|
22812 | func(arr[original], next);
|
22813 | } else {
|
22814 | callback([]);
|
22815 | }
|
22816 | }
|
22817 |
|
22818 | next([]);
|
22819 | }
|
22820 |
|
22821 | function flattenObjArr(objArr) {
|
22822 | var ret = [];
|
22823 | Object.keys(objArr).forEach(function (k) {
|
22824 | ret.push.apply(ret, objArr[k]);
|
22825 | });
|
22826 | return ret;
|
22827 | }
|
22828 |
|
22829 | function asyncMap(objArr, option, func, callback) {
|
22830 | if (option.first) {
|
22831 | var flattenArr = flattenObjArr(objArr);
|
22832 | return asyncSerialArray(flattenArr, func, callback);
|
22833 | }
|
22834 | var firstFields = option.firstFields || [];
|
22835 | if (firstFields === true) {
|
22836 | firstFields = Object.keys(objArr);
|
22837 | }
|
22838 | var objArrKeys = Object.keys(objArr);
|
22839 | var objArrLength = objArrKeys.length;
|
22840 | var total = 0;
|
22841 | var results = [];
|
22842 | var next = function next(errors) {
|
22843 | results.push.apply(results, errors);
|
22844 | total++;
|
22845 | if (total === objArrLength) {
|
22846 | callback(results);
|
22847 | }
|
22848 | };
|
22849 | objArrKeys.forEach(function (key) {
|
22850 | var arr = objArr[key];
|
22851 | if (firstFields.indexOf(key) !== -1) {
|
22852 | asyncSerialArray(arr, func, next);
|
22853 | } else {
|
22854 | asyncParallelArray(arr, func, next);
|
22855 | }
|
22856 | });
|
22857 | }
|
22858 |
|
22859 | function complementError(rule) {
|
22860 | return function (oe) {
|
22861 | if (oe && oe.message) {
|
22862 | oe.field = oe.field || rule.fullField;
|
22863 | return oe;
|
22864 | }
|
22865 | return {
|
22866 | message: oe,
|
22867 | field: oe.field || rule.fullField
|
22868 | };
|
22869 | };
|
22870 | }
|
22871 |
|
22872 | function deepMerge(target, source) {
|
22873 | if (source) {
|
22874 | for (var s in source) {
|
22875 | if (source.hasOwnProperty(s)) {
|
22876 | var value = source[s];
|
22877 | if ((typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value)) === 'object' && (0, _typeof3['default'])(target[s]) === 'object') {
|
22878 | target[s] = (0, _extends3['default'])({}, target[s], value);
|
22879 | } else {
|
22880 | target[s] = value;
|
22881 | }
|
22882 | }
|
22883 | }
|
22884 | }
|
22885 | return target;
|
22886 | }
|
22887 | }.call(exports, __webpack_require__(33)))
|
22888 |
|
22889 | }),
|
22890 |
|
22891 | (function(module, exports, __webpack_require__) {
|
22892 |
|
22893 | 'use strict';
|
22894 |
|
22895 | Object.defineProperty(exports, "__esModule", {
|
22896 | value: true
|
22897 | });
|
22898 |
|
22899 | var _string = __webpack_require__(245);
|
22900 |
|
22901 | var _string2 = _interopRequireDefault(_string);
|
22902 |
|
22903 | var _method = __webpack_require__(253);
|
22904 |
|
22905 | var _method2 = _interopRequireDefault(_method);
|
22906 |
|
22907 | var _number = __webpack_require__(254);
|
22908 |
|
22909 | var _number2 = _interopRequireDefault(_number);
|
22910 |
|
22911 | var _boolean = __webpack_require__(255);
|
22912 |
|
22913 | var _boolean2 = _interopRequireDefault(_boolean);
|
22914 |
|
22915 | var _regexp = __webpack_require__(256);
|
22916 |
|
22917 | var _regexp2 = _interopRequireDefault(_regexp);
|
22918 |
|
22919 | var _integer = __webpack_require__(257);
|
22920 |
|
22921 | var _integer2 = _interopRequireDefault(_integer);
|
22922 |
|
22923 | var _float = __webpack_require__(258);
|
22924 |
|
22925 | var _float2 = _interopRequireDefault(_float);
|
22926 |
|
22927 | var _array = __webpack_require__(259);
|
22928 |
|
22929 | var _array2 = _interopRequireDefault(_array);
|
22930 |
|
22931 | var _object = __webpack_require__(260);
|
22932 |
|
22933 | var _object2 = _interopRequireDefault(_object);
|
22934 |
|
22935 | var _enum = __webpack_require__(261);
|
22936 |
|
22937 | var _enum2 = _interopRequireDefault(_enum);
|
22938 |
|
22939 | var _pattern = __webpack_require__(262);
|
22940 |
|
22941 | var _pattern2 = _interopRequireDefault(_pattern);
|
22942 |
|
22943 | var _date = __webpack_require__(263);
|
22944 |
|
22945 | var _date2 = _interopRequireDefault(_date);
|
22946 |
|
22947 | var _required = __webpack_require__(264);
|
22948 |
|
22949 | var _required2 = _interopRequireDefault(_required);
|
22950 |
|
22951 | var _type = __webpack_require__(265);
|
22952 |
|
22953 | var _type2 = _interopRequireDefault(_type);
|
22954 |
|
22955 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
22956 |
|
22957 | exports['default'] = {
|
22958 | string: _string2['default'],
|
22959 | method: _method2['default'],
|
22960 | number: _number2['default'],
|
22961 | boolean: _boolean2['default'],
|
22962 | regexp: _regexp2['default'],
|
22963 | integer: _integer2['default'],
|
22964 | float: _float2['default'],
|
22965 | array: _array2['default'],
|
22966 | object: _object2['default'],
|
22967 | 'enum': _enum2['default'],
|
22968 | pattern: _pattern2['default'],
|
22969 | date: _date2['default'],
|
22970 | url: _type2['default'],
|
22971 | hex: _type2['default'],
|
22972 | email: _type2['default'],
|
22973 | required: _required2['default']
|
22974 | };
|
22975 | module.exports = exports['default'];
|
22976 |
|
22977 | }),
|
22978 |
|
22979 | (function(module, exports, __webpack_require__) {
|
22980 |
|
22981 | 'use strict';
|
22982 |
|
22983 | Object.defineProperty(exports, "__esModule", {
|
22984 | value: true
|
22985 | });
|
22986 |
|
22987 | var _rule = __webpack_require__(246);
|
22988 |
|
22989 | var _rule2 = _interopRequireDefault(_rule);
|
22990 |
|
22991 | var _util = __webpack_require__(243);
|
22992 |
|
22993 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
22994 |
|
22995 | |
22996 |
|
22997 |
|
22998 |
|
22999 |
|
23000 |
|
23001 |
|
23002 |
|
23003 |
|
23004 |
|
23005 | function string(rule, value, callback, source, options) {
|
23006 | var errors = [];
|
23007 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23008 | if (validate) {
|
23009 | if ((0, _util.isEmptyValue)(value, 'string') && !rule.required) {
|
23010 | return callback();
|
23011 | }
|
23012 | _rule2['default'].required(rule, value, source, errors, options, 'string');
|
23013 | if (!(0, _util.isEmptyValue)(value, 'string')) {
|
23014 | _rule2['default'].type(rule, value, source, errors, options);
|
23015 | _rule2['default'].range(rule, value, source, errors, options);
|
23016 | _rule2['default'].pattern(rule, value, source, errors, options);
|
23017 | if (rule.whitespace === true) {
|
23018 | _rule2['default'].whitespace(rule, value, source, errors, options);
|
23019 | }
|
23020 | }
|
23021 | }
|
23022 | callback(errors);
|
23023 | }
|
23024 |
|
23025 | exports['default'] = string;
|
23026 | module.exports = exports['default'];
|
23027 |
|
23028 | }),
|
23029 |
|
23030 | (function(module, exports, __webpack_require__) {
|
23031 |
|
23032 | 'use strict';
|
23033 |
|
23034 | Object.defineProperty(exports, "__esModule", {
|
23035 | value: true
|
23036 | });
|
23037 |
|
23038 | var _required = __webpack_require__(247);
|
23039 |
|
23040 | var _required2 = _interopRequireDefault(_required);
|
23041 |
|
23042 | var _whitespace = __webpack_require__(248);
|
23043 |
|
23044 | var _whitespace2 = _interopRequireDefault(_whitespace);
|
23045 |
|
23046 | var _type = __webpack_require__(249);
|
23047 |
|
23048 | var _type2 = _interopRequireDefault(_type);
|
23049 |
|
23050 | var _range = __webpack_require__(250);
|
23051 |
|
23052 | var _range2 = _interopRequireDefault(_range);
|
23053 |
|
23054 | var _enum = __webpack_require__(251);
|
23055 |
|
23056 | var _enum2 = _interopRequireDefault(_enum);
|
23057 |
|
23058 | var _pattern = __webpack_require__(252);
|
23059 |
|
23060 | var _pattern2 = _interopRequireDefault(_pattern);
|
23061 |
|
23062 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23063 |
|
23064 | exports['default'] = {
|
23065 | required: _required2['default'],
|
23066 | whitespace: _whitespace2['default'],
|
23067 | type: _type2['default'],
|
23068 | range: _range2['default'],
|
23069 | 'enum': _enum2['default'],
|
23070 | pattern: _pattern2['default']
|
23071 | };
|
23072 | module.exports = exports['default'];
|
23073 |
|
23074 | }),
|
23075 |
|
23076 | (function(module, exports, __webpack_require__) {
|
23077 |
|
23078 | 'use strict';
|
23079 |
|
23080 | Object.defineProperty(exports, "__esModule", {
|
23081 | value: true
|
23082 | });
|
23083 |
|
23084 | var _util = __webpack_require__(243);
|
23085 |
|
23086 | var util = _interopRequireWildcard(_util);
|
23087 |
|
23088 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
|
23089 |
|
23090 | |
23091 |
|
23092 |
|
23093 |
|
23094 |
|
23095 |
|
23096 |
|
23097 |
|
23098 |
|
23099 |
|
23100 |
|
23101 | function required(rule, value, source, errors, options, type) {
|
23102 | if (rule.required && (!source.hasOwnProperty(rule.field) || util.isEmptyValue(value, type || rule.type))) {
|
23103 | errors.push(util.format(options.messages.required, rule.fullField));
|
23104 | }
|
23105 | }
|
23106 |
|
23107 | exports['default'] = required;
|
23108 | module.exports = exports['default'];
|
23109 |
|
23110 | }),
|
23111 |
|
23112 | (function(module, exports, __webpack_require__) {
|
23113 |
|
23114 | 'use strict';
|
23115 |
|
23116 | Object.defineProperty(exports, "__esModule", {
|
23117 | value: true
|
23118 | });
|
23119 |
|
23120 | var _util = __webpack_require__(243);
|
23121 |
|
23122 | var util = _interopRequireWildcard(_util);
|
23123 |
|
23124 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
|
23125 |
|
23126 | |
23127 |
|
23128 |
|
23129 |
|
23130 |
|
23131 |
|
23132 |
|
23133 |
|
23134 |
|
23135 |
|
23136 |
|
23137 | function whitespace(rule, value, source, errors, options) {
|
23138 | if (/^\s+$/.test(value) || value === '') {
|
23139 | errors.push(util.format(options.messages.whitespace, rule.fullField));
|
23140 | }
|
23141 | }
|
23142 |
|
23143 | exports['default'] = whitespace;
|
23144 | module.exports = exports['default'];
|
23145 |
|
23146 | }),
|
23147 |
|
23148 | (function(module, exports, __webpack_require__) {
|
23149 |
|
23150 | 'use strict';
|
23151 |
|
23152 | Object.defineProperty(exports, "__esModule", {
|
23153 | value: true
|
23154 | });
|
23155 |
|
23156 | var _typeof2 = __webpack_require__(227);
|
23157 |
|
23158 | var _typeof3 = _interopRequireDefault(_typeof2);
|
23159 |
|
23160 | var _util = __webpack_require__(243);
|
23161 |
|
23162 | var util = _interopRequireWildcard(_util);
|
23163 |
|
23164 | var _required = __webpack_require__(247);
|
23165 |
|
23166 | var _required2 = _interopRequireDefault(_required);
|
23167 |
|
23168 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
|
23169 |
|
23170 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23171 |
|
23172 |
|
23173 |
|
23174 | var pattern = {
|
23175 |
|
23176 | email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
23177 | url: new RegExp('^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', 'i'),
|
23178 | hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
|
23179 | };
|
23180 |
|
23181 | var types = {
|
23182 | integer: function integer(value) {
|
23183 | return types.number(value) && parseInt(value, 10) === value;
|
23184 | },
|
23185 | float: function float(value) {
|
23186 | return types.number(value) && !types.integer(value);
|
23187 | },
|
23188 | array: function array(value) {
|
23189 | return Array.isArray(value);
|
23190 | },
|
23191 | regexp: function regexp(value) {
|
23192 | if (value instanceof RegExp) {
|
23193 | return true;
|
23194 | }
|
23195 | try {
|
23196 | return !!new RegExp(value);
|
23197 | } catch (e) {
|
23198 | return false;
|
23199 | }
|
23200 | },
|
23201 | date: function date(value) {
|
23202 | return typeof value.getTime === 'function' && typeof value.getMonth === 'function' && typeof value.getYear === 'function';
|
23203 | },
|
23204 | number: function number(value) {
|
23205 | if (isNaN(value)) {
|
23206 | return false;
|
23207 | }
|
23208 | return typeof value === 'number';
|
23209 | },
|
23210 | object: function object(value) {
|
23211 | return (typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value)) === 'object' && !types.array(value);
|
23212 | },
|
23213 | method: function method(value) {
|
23214 | return typeof value === 'function';
|
23215 | },
|
23216 | email: function email(value) {
|
23217 | return typeof value === 'string' && !!value.match(pattern.email) && value.length < 255;
|
23218 | },
|
23219 | url: function url(value) {
|
23220 | return typeof value === 'string' && !!value.match(pattern.url);
|
23221 | },
|
23222 | hex: function hex(value) {
|
23223 | return typeof value === 'string' && !!value.match(pattern.hex);
|
23224 | }
|
23225 | };
|
23226 |
|
23227 | |
23228 |
|
23229 |
|
23230 |
|
23231 |
|
23232 |
|
23233 |
|
23234 |
|
23235 |
|
23236 |
|
23237 |
|
23238 | function type(rule, value, source, errors, options) {
|
23239 | if (rule.required && value === undefined) {
|
23240 | (0, _required2['default'])(rule, value, source, errors, options);
|
23241 | return;
|
23242 | }
|
23243 | var custom = ['integer', 'float', 'array', 'regexp', 'object', 'method', 'email', 'number', 'date', 'url', 'hex'];
|
23244 | var ruleType = rule.type;
|
23245 | if (custom.indexOf(ruleType) > -1) {
|
23246 | if (!types[ruleType](value)) {
|
23247 | errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type));
|
23248 | }
|
23249 |
|
23250 | } else if (ruleType && (typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value)) !== rule.type) {
|
23251 | errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type));
|
23252 | }
|
23253 | }
|
23254 |
|
23255 | exports['default'] = type;
|
23256 | module.exports = exports['default'];
|
23257 |
|
23258 | }),
|
23259 |
|
23260 | (function(module, exports, __webpack_require__) {
|
23261 |
|
23262 | 'use strict';
|
23263 |
|
23264 | Object.defineProperty(exports, "__esModule", {
|
23265 | value: true
|
23266 | });
|
23267 |
|
23268 | var _util = __webpack_require__(243);
|
23269 |
|
23270 | var util = _interopRequireWildcard(_util);
|
23271 |
|
23272 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
|
23273 |
|
23274 | |
23275 |
|
23276 |
|
23277 |
|
23278 |
|
23279 |
|
23280 |
|
23281 |
|
23282 |
|
23283 |
|
23284 |
|
23285 | function range(rule, value, source, errors, options) {
|
23286 | var len = typeof rule.len === 'number';
|
23287 | var min = typeof rule.min === 'number';
|
23288 | var max = typeof rule.max === 'number';
|
23289 |
|
23290 | var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
23291 | var val = value;
|
23292 | var key = null;
|
23293 | var num = typeof value === 'number';
|
23294 | var str = typeof value === 'string';
|
23295 | var arr = Array.isArray(value);
|
23296 | if (num) {
|
23297 | key = 'number';
|
23298 | } else if (str) {
|
23299 | key = 'string';
|
23300 | } else if (arr) {
|
23301 | key = 'array';
|
23302 | }
|
23303 |
|
23304 |
|
23305 |
|
23306 | if (!key) {
|
23307 | return false;
|
23308 | }
|
23309 | if (arr) {
|
23310 | val = value.length;
|
23311 | }
|
23312 | if (str) {
|
23313 |
|
23314 | val = value.replace(spRegexp, '_').length;
|
23315 | }
|
23316 | if (len) {
|
23317 | if (val !== rule.len) {
|
23318 | errors.push(util.format(options.messages[key].len, rule.fullField, rule.len));
|
23319 | }
|
23320 | } else if (min && !max && val < rule.min) {
|
23321 | errors.push(util.format(options.messages[key].min, rule.fullField, rule.min));
|
23322 | } else if (max && !min && val > rule.max) {
|
23323 | errors.push(util.format(options.messages[key].max, rule.fullField, rule.max));
|
23324 | } else if (min && max && (val < rule.min || val > rule.max)) {
|
23325 | errors.push(util.format(options.messages[key].range, rule.fullField, rule.min, rule.max));
|
23326 | }
|
23327 | }
|
23328 |
|
23329 | exports['default'] = range;
|
23330 | module.exports = exports['default'];
|
23331 |
|
23332 | }),
|
23333 |
|
23334 | (function(module, exports, __webpack_require__) {
|
23335 |
|
23336 | 'use strict';
|
23337 |
|
23338 | Object.defineProperty(exports, "__esModule", {
|
23339 | value: true
|
23340 | });
|
23341 |
|
23342 | var _util = __webpack_require__(243);
|
23343 |
|
23344 | var util = _interopRequireWildcard(_util);
|
23345 |
|
23346 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
|
23347 |
|
23348 | var ENUM = 'enum';
|
23349 |
|
23350 | |
23351 |
|
23352 |
|
23353 |
|
23354 |
|
23355 |
|
23356 |
|
23357 |
|
23358 |
|
23359 |
|
23360 |
|
23361 | function enumerable(rule, value, source, errors, options) {
|
23362 | rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : [];
|
23363 | if (rule[ENUM].indexOf(value) === -1) {
|
23364 | errors.push(util.format(options.messages[ENUM], rule.fullField, rule[ENUM].join(', ')));
|
23365 | }
|
23366 | }
|
23367 |
|
23368 | exports['default'] = enumerable;
|
23369 | module.exports = exports['default'];
|
23370 |
|
23371 | }),
|
23372 |
|
23373 | (function(module, exports, __webpack_require__) {
|
23374 |
|
23375 | 'use strict';
|
23376 |
|
23377 | Object.defineProperty(exports, "__esModule", {
|
23378 | value: true
|
23379 | });
|
23380 |
|
23381 | var _util = __webpack_require__(243);
|
23382 |
|
23383 | var util = _interopRequireWildcard(_util);
|
23384 |
|
23385 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
|
23386 |
|
23387 | |
23388 |
|
23389 |
|
23390 |
|
23391 |
|
23392 |
|
23393 |
|
23394 |
|
23395 |
|
23396 |
|
23397 |
|
23398 | function pattern(rule, value, source, errors, options) {
|
23399 | if (rule.pattern) {
|
23400 | if (rule.pattern instanceof RegExp) {
|
23401 |
|
23402 |
|
23403 |
|
23404 | rule.pattern.lastIndex = 0;
|
23405 | if (!rule.pattern.test(value)) {
|
23406 | errors.push(util.format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
|
23407 | }
|
23408 | } else if (typeof rule.pattern === 'string') {
|
23409 | var _pattern = new RegExp(rule.pattern);
|
23410 | if (!_pattern.test(value)) {
|
23411 | errors.push(util.format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
|
23412 | }
|
23413 | }
|
23414 | }
|
23415 | }
|
23416 |
|
23417 | exports['default'] = pattern;
|
23418 | module.exports = exports['default'];
|
23419 |
|
23420 | }),
|
23421 |
|
23422 | (function(module, exports, __webpack_require__) {
|
23423 |
|
23424 | 'use strict';
|
23425 |
|
23426 | Object.defineProperty(exports, "__esModule", {
|
23427 | value: true
|
23428 | });
|
23429 |
|
23430 | var _rule = __webpack_require__(246);
|
23431 |
|
23432 | var _rule2 = _interopRequireDefault(_rule);
|
23433 |
|
23434 | var _util = __webpack_require__(243);
|
23435 |
|
23436 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23437 |
|
23438 | |
23439 |
|
23440 |
|
23441 |
|
23442 |
|
23443 |
|
23444 |
|
23445 |
|
23446 |
|
23447 |
|
23448 | function method(rule, value, callback, source, options) {
|
23449 | var errors = [];
|
23450 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23451 | if (validate) {
|
23452 | if ((0, _util.isEmptyValue)(value) && !rule.required) {
|
23453 | return callback();
|
23454 | }
|
23455 | _rule2['default'].required(rule, value, source, errors, options);
|
23456 | if (value !== undefined) {
|
23457 | _rule2['default'].type(rule, value, source, errors, options);
|
23458 | }
|
23459 | }
|
23460 | callback(errors);
|
23461 | }
|
23462 |
|
23463 | exports['default'] = method;
|
23464 | module.exports = exports['default'];
|
23465 |
|
23466 | }),
|
23467 |
|
23468 | (function(module, exports, __webpack_require__) {
|
23469 |
|
23470 | 'use strict';
|
23471 |
|
23472 | Object.defineProperty(exports, "__esModule", {
|
23473 | value: true
|
23474 | });
|
23475 |
|
23476 | var _rule = __webpack_require__(246);
|
23477 |
|
23478 | var _rule2 = _interopRequireDefault(_rule);
|
23479 |
|
23480 | var _util = __webpack_require__(243);
|
23481 |
|
23482 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23483 |
|
23484 | |
23485 |
|
23486 |
|
23487 |
|
23488 |
|
23489 |
|
23490 |
|
23491 |
|
23492 |
|
23493 |
|
23494 | function number(rule, value, callback, source, options) {
|
23495 | var errors = [];
|
23496 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23497 | if (validate) {
|
23498 | if ((0, _util.isEmptyValue)(value) && !rule.required) {
|
23499 | return callback();
|
23500 | }
|
23501 | _rule2['default'].required(rule, value, source, errors, options);
|
23502 | if (value !== undefined) {
|
23503 | _rule2['default'].type(rule, value, source, errors, options);
|
23504 | _rule2['default'].range(rule, value, source, errors, options);
|
23505 | }
|
23506 | }
|
23507 | callback(errors);
|
23508 | }
|
23509 |
|
23510 | exports['default'] = number;
|
23511 | module.exports = exports['default'];
|
23512 |
|
23513 | }),
|
23514 |
|
23515 | (function(module, exports, __webpack_require__) {
|
23516 |
|
23517 | 'use strict';
|
23518 |
|
23519 | Object.defineProperty(exports, "__esModule", {
|
23520 | value: true
|
23521 | });
|
23522 |
|
23523 | var _util = __webpack_require__(243);
|
23524 |
|
23525 | var _rule = __webpack_require__(246);
|
23526 |
|
23527 | var _rule2 = _interopRequireDefault(_rule);
|
23528 |
|
23529 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23530 |
|
23531 | |
23532 |
|
23533 |
|
23534 |
|
23535 |
|
23536 |
|
23537 |
|
23538 |
|
23539 |
|
23540 |
|
23541 | function boolean(rule, value, callback, source, options) {
|
23542 | var errors = [];
|
23543 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23544 | if (validate) {
|
23545 | if ((0, _util.isEmptyValue)(value) && !rule.required) {
|
23546 | return callback();
|
23547 | }
|
23548 | _rule2['default'].required(rule, value, source, errors, options);
|
23549 | if (value !== undefined) {
|
23550 | _rule2['default'].type(rule, value, source, errors, options);
|
23551 | }
|
23552 | }
|
23553 | callback(errors);
|
23554 | }
|
23555 |
|
23556 | exports['default'] = boolean;
|
23557 | module.exports = exports['default'];
|
23558 |
|
23559 | }),
|
23560 |
|
23561 | (function(module, exports, __webpack_require__) {
|
23562 |
|
23563 | 'use strict';
|
23564 |
|
23565 | Object.defineProperty(exports, "__esModule", {
|
23566 | value: true
|
23567 | });
|
23568 |
|
23569 | var _rule = __webpack_require__(246);
|
23570 |
|
23571 | var _rule2 = _interopRequireDefault(_rule);
|
23572 |
|
23573 | var _util = __webpack_require__(243);
|
23574 |
|
23575 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23576 |
|
23577 | |
23578 |
|
23579 |
|
23580 |
|
23581 |
|
23582 |
|
23583 |
|
23584 |
|
23585 |
|
23586 |
|
23587 | function regexp(rule, value, callback, source, options) {
|
23588 | var errors = [];
|
23589 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23590 | if (validate) {
|
23591 | if ((0, _util.isEmptyValue)(value) && !rule.required) {
|
23592 | return callback();
|
23593 | }
|
23594 | _rule2['default'].required(rule, value, source, errors, options);
|
23595 | if (!(0, _util.isEmptyValue)(value)) {
|
23596 | _rule2['default'].type(rule, value, source, errors, options);
|
23597 | }
|
23598 | }
|
23599 | callback(errors);
|
23600 | }
|
23601 |
|
23602 | exports['default'] = regexp;
|
23603 | module.exports = exports['default'];
|
23604 |
|
23605 | }),
|
23606 |
|
23607 | (function(module, exports, __webpack_require__) {
|
23608 |
|
23609 | 'use strict';
|
23610 |
|
23611 | Object.defineProperty(exports, "__esModule", {
|
23612 | value: true
|
23613 | });
|
23614 |
|
23615 | var _rule = __webpack_require__(246);
|
23616 |
|
23617 | var _rule2 = _interopRequireDefault(_rule);
|
23618 |
|
23619 | var _util = __webpack_require__(243);
|
23620 |
|
23621 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23622 |
|
23623 | |
23624 |
|
23625 |
|
23626 |
|
23627 |
|
23628 |
|
23629 |
|
23630 |
|
23631 |
|
23632 |
|
23633 | function integer(rule, value, callback, source, options) {
|
23634 | var errors = [];
|
23635 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23636 | if (validate) {
|
23637 | if ((0, _util.isEmptyValue)(value) && !rule.required) {
|
23638 | return callback();
|
23639 | }
|
23640 | _rule2['default'].required(rule, value, source, errors, options);
|
23641 | if (value !== undefined) {
|
23642 | _rule2['default'].type(rule, value, source, errors, options);
|
23643 | _rule2['default'].range(rule, value, source, errors, options);
|
23644 | }
|
23645 | }
|
23646 | callback(errors);
|
23647 | }
|
23648 |
|
23649 | exports['default'] = integer;
|
23650 | module.exports = exports['default'];
|
23651 |
|
23652 | }),
|
23653 |
|
23654 | (function(module, exports, __webpack_require__) {
|
23655 |
|
23656 | 'use strict';
|
23657 |
|
23658 | Object.defineProperty(exports, "__esModule", {
|
23659 | value: true
|
23660 | });
|
23661 |
|
23662 | var _rule = __webpack_require__(246);
|
23663 |
|
23664 | var _rule2 = _interopRequireDefault(_rule);
|
23665 |
|
23666 | var _util = __webpack_require__(243);
|
23667 |
|
23668 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23669 |
|
23670 | |
23671 |
|
23672 |
|
23673 |
|
23674 |
|
23675 |
|
23676 |
|
23677 |
|
23678 |
|
23679 |
|
23680 | function floatFn(rule, value, callback, source, options) {
|
23681 | var errors = [];
|
23682 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23683 | if (validate) {
|
23684 | if ((0, _util.isEmptyValue)(value) && !rule.required) {
|
23685 | return callback();
|
23686 | }
|
23687 | _rule2['default'].required(rule, value, source, errors, options);
|
23688 | if (value !== undefined) {
|
23689 | _rule2['default'].type(rule, value, source, errors, options);
|
23690 | _rule2['default'].range(rule, value, source, errors, options);
|
23691 | }
|
23692 | }
|
23693 | callback(errors);
|
23694 | }
|
23695 |
|
23696 | exports['default'] = floatFn;
|
23697 | module.exports = exports['default'];
|
23698 |
|
23699 | }),
|
23700 |
|
23701 | (function(module, exports, __webpack_require__) {
|
23702 |
|
23703 | 'use strict';
|
23704 |
|
23705 | Object.defineProperty(exports, "__esModule", {
|
23706 | value: true
|
23707 | });
|
23708 |
|
23709 | var _rule = __webpack_require__(246);
|
23710 |
|
23711 | var _rule2 = _interopRequireDefault(_rule);
|
23712 |
|
23713 | var _util = __webpack_require__(243);
|
23714 |
|
23715 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23716 |
|
23717 | |
23718 |
|
23719 |
|
23720 |
|
23721 |
|
23722 |
|
23723 |
|
23724 |
|
23725 |
|
23726 |
|
23727 | function array(rule, value, callback, source, options) {
|
23728 | var errors = [];
|
23729 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23730 | if (validate) {
|
23731 | if ((0, _util.isEmptyValue)(value, 'array') && !rule.required) {
|
23732 | return callback();
|
23733 | }
|
23734 | _rule2['default'].required(rule, value, source, errors, options, 'array');
|
23735 | if (!(0, _util.isEmptyValue)(value, 'array')) {
|
23736 | _rule2['default'].type(rule, value, source, errors, options);
|
23737 | _rule2['default'].range(rule, value, source, errors, options);
|
23738 | }
|
23739 | }
|
23740 | callback(errors);
|
23741 | }
|
23742 |
|
23743 | exports['default'] = array;
|
23744 | module.exports = exports['default'];
|
23745 |
|
23746 | }),
|
23747 |
|
23748 | (function(module, exports, __webpack_require__) {
|
23749 |
|
23750 | 'use strict';
|
23751 |
|
23752 | Object.defineProperty(exports, "__esModule", {
|
23753 | value: true
|
23754 | });
|
23755 |
|
23756 | var _rule = __webpack_require__(246);
|
23757 |
|
23758 | var _rule2 = _interopRequireDefault(_rule);
|
23759 |
|
23760 | var _util = __webpack_require__(243);
|
23761 |
|
23762 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23763 |
|
23764 | |
23765 |
|
23766 |
|
23767 |
|
23768 |
|
23769 |
|
23770 |
|
23771 |
|
23772 |
|
23773 |
|
23774 | function object(rule, value, callback, source, options) {
|
23775 | var errors = [];
|
23776 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23777 | if (validate) {
|
23778 | if ((0, _util.isEmptyValue)(value) && !rule.required) {
|
23779 | return callback();
|
23780 | }
|
23781 | _rule2['default'].required(rule, value, source, errors, options);
|
23782 | if (value !== undefined) {
|
23783 | _rule2['default'].type(rule, value, source, errors, options);
|
23784 | }
|
23785 | }
|
23786 | callback(errors);
|
23787 | }
|
23788 |
|
23789 | exports['default'] = object;
|
23790 | module.exports = exports['default'];
|
23791 |
|
23792 | }),
|
23793 |
|
23794 | (function(module, exports, __webpack_require__) {
|
23795 |
|
23796 | 'use strict';
|
23797 |
|
23798 | Object.defineProperty(exports, "__esModule", {
|
23799 | value: true
|
23800 | });
|
23801 |
|
23802 | var _rule = __webpack_require__(246);
|
23803 |
|
23804 | var _rule2 = _interopRequireDefault(_rule);
|
23805 |
|
23806 | var _util = __webpack_require__(243);
|
23807 |
|
23808 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23809 |
|
23810 | var ENUM = 'enum';
|
23811 |
|
23812 | |
23813 |
|
23814 |
|
23815 |
|
23816 |
|
23817 |
|
23818 |
|
23819 |
|
23820 |
|
23821 |
|
23822 | function enumerable(rule, value, callback, source, options) {
|
23823 | var errors = [];
|
23824 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23825 | if (validate) {
|
23826 | if ((0, _util.isEmptyValue)(value) && !rule.required) {
|
23827 | return callback();
|
23828 | }
|
23829 | _rule2['default'].required(rule, value, source, errors, options);
|
23830 | if (value) {
|
23831 | _rule2['default'][ENUM](rule, value, source, errors, options);
|
23832 | }
|
23833 | }
|
23834 | callback(errors);
|
23835 | }
|
23836 |
|
23837 | exports['default'] = enumerable;
|
23838 | module.exports = exports['default'];
|
23839 |
|
23840 | }),
|
23841 |
|
23842 | (function(module, exports, __webpack_require__) {
|
23843 |
|
23844 | 'use strict';
|
23845 |
|
23846 | Object.defineProperty(exports, "__esModule", {
|
23847 | value: true
|
23848 | });
|
23849 |
|
23850 | var _rule = __webpack_require__(246);
|
23851 |
|
23852 | var _rule2 = _interopRequireDefault(_rule);
|
23853 |
|
23854 | var _util = __webpack_require__(243);
|
23855 |
|
23856 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23857 |
|
23858 | |
23859 |
|
23860 |
|
23861 |
|
23862 |
|
23863 |
|
23864 |
|
23865 |
|
23866 |
|
23867 |
|
23868 |
|
23869 |
|
23870 |
|
23871 | function pattern(rule, value, callback, source, options) {
|
23872 | var errors = [];
|
23873 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23874 | if (validate) {
|
23875 | if ((0, _util.isEmptyValue)(value, 'string') && !rule.required) {
|
23876 | return callback();
|
23877 | }
|
23878 | _rule2['default'].required(rule, value, source, errors, options);
|
23879 | if (!(0, _util.isEmptyValue)(value, 'string')) {
|
23880 | _rule2['default'].pattern(rule, value, source, errors, options);
|
23881 | }
|
23882 | }
|
23883 | callback(errors);
|
23884 | }
|
23885 |
|
23886 | exports['default'] = pattern;
|
23887 | module.exports = exports['default'];
|
23888 |
|
23889 | }),
|
23890 |
|
23891 | (function(module, exports, __webpack_require__) {
|
23892 |
|
23893 | 'use strict';
|
23894 |
|
23895 | Object.defineProperty(exports, "__esModule", {
|
23896 | value: true
|
23897 | });
|
23898 |
|
23899 | var _rule = __webpack_require__(246);
|
23900 |
|
23901 | var _rule2 = _interopRequireDefault(_rule);
|
23902 |
|
23903 | var _util = __webpack_require__(243);
|
23904 |
|
23905 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23906 |
|
23907 | function date(rule, value, callback, source, options) {
|
23908 |
|
23909 | var errors = [];
|
23910 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23911 |
|
23912 | if (validate) {
|
23913 | if ((0, _util.isEmptyValue)(value) && !rule.required) {
|
23914 | return callback();
|
23915 | }
|
23916 | _rule2['default'].required(rule, value, source, errors, options);
|
23917 | if (!(0, _util.isEmptyValue)(value)) {
|
23918 | var dateObject = void 0;
|
23919 |
|
23920 | if (typeof value === 'number') {
|
23921 | dateObject = new Date(value);
|
23922 | } else {
|
23923 | dateObject = value;
|
23924 | }
|
23925 |
|
23926 | _rule2['default'].type(rule, dateObject, source, errors, options);
|
23927 | if (dateObject) {
|
23928 | _rule2['default'].range(rule, dateObject.getTime(), source, errors, options);
|
23929 | }
|
23930 | }
|
23931 | }
|
23932 | callback(errors);
|
23933 | }
|
23934 |
|
23935 | exports['default'] = date;
|
23936 | module.exports = exports['default'];
|
23937 |
|
23938 | }),
|
23939 |
|
23940 | (function(module, exports, __webpack_require__) {
|
23941 |
|
23942 | 'use strict';
|
23943 |
|
23944 | Object.defineProperty(exports, "__esModule", {
|
23945 | value: true
|
23946 | });
|
23947 |
|
23948 | var _typeof2 = __webpack_require__(227);
|
23949 |
|
23950 | var _typeof3 = _interopRequireDefault(_typeof2);
|
23951 |
|
23952 | var _rule = __webpack_require__(246);
|
23953 |
|
23954 | var _rule2 = _interopRequireDefault(_rule);
|
23955 |
|
23956 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23957 |
|
23958 | function required(rule, value, callback, source, options) {
|
23959 | var errors = [];
|
23960 | var type = Array.isArray(value) ? 'array' : typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value);
|
23961 | _rule2['default'].required(rule, value, source, errors, options, type);
|
23962 | callback(errors);
|
23963 | }
|
23964 |
|
23965 | exports['default'] = required;
|
23966 | module.exports = exports['default'];
|
23967 |
|
23968 | }),
|
23969 |
|
23970 | (function(module, exports, __webpack_require__) {
|
23971 |
|
23972 | 'use strict';
|
23973 |
|
23974 | Object.defineProperty(exports, "__esModule", {
|
23975 | value: true
|
23976 | });
|
23977 |
|
23978 | var _rule = __webpack_require__(246);
|
23979 |
|
23980 | var _rule2 = _interopRequireDefault(_rule);
|
23981 |
|
23982 | var _util = __webpack_require__(243);
|
23983 |
|
23984 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23985 |
|
23986 | function type(rule, value, callback, source, options) {
|
23987 | var ruleType = rule.type;
|
23988 | var errors = [];
|
23989 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
23990 | if (validate) {
|
23991 | if ((0, _util.isEmptyValue)(value, ruleType) && !rule.required) {
|
23992 | return callback();
|
23993 | }
|
23994 | _rule2['default'].required(rule, value, source, errors, options, ruleType);
|
23995 | if (!(0, _util.isEmptyValue)(value, ruleType)) {
|
23996 | _rule2['default'].type(rule, value, source, errors, options);
|
23997 | }
|
23998 | }
|
23999 | callback(errors);
|
24000 | }
|
24001 |
|
24002 | exports['default'] = type;
|
24003 | module.exports = exports['default'];
|
24004 |
|
24005 | }),
|
24006 |
|
24007 | (function(module, exports) {
|
24008 |
|
24009 | 'use strict';
|
24010 |
|
24011 | Object.defineProperty(exports, "__esModule", {
|
24012 | value: true
|
24013 | });
|
24014 | exports.newMessages = newMessages;
|
24015 | function newMessages() {
|
24016 | return {
|
24017 | 'default': 'Validation error on field %s',
|
24018 | required: '%s is required',
|
24019 | 'enum': '%s must be one of %s',
|
24020 | whitespace: '%s cannot be empty',
|
24021 | date: {
|
24022 | format: '%s date %s is invalid for format %s',
|
24023 | parse: '%s date could not be parsed, %s is invalid ',
|
24024 | invalid: '%s date %s is invalid'
|
24025 | },
|
24026 | types: {
|
24027 | string: '%s is not a %s',
|
24028 | method: '%s is not a %s (function)',
|
24029 | array: '%s is not an %s',
|
24030 | object: '%s is not an %s',
|
24031 | number: '%s is not a %s',
|
24032 | date: '%s is not a %s',
|
24033 | boolean: '%s is not a %s',
|
24034 | integer: '%s is not an %s',
|
24035 | float: '%s is not a %s',
|
24036 | regexp: '%s is not a valid %s',
|
24037 | email: '%s is not a valid %s',
|
24038 | url: '%s is not a valid %s',
|
24039 | hex: '%s is not a valid %s'
|
24040 | },
|
24041 | string: {
|
24042 | len: '%s must be exactly %s characters',
|
24043 | min: '%s must be at least %s characters',
|
24044 | max: '%s cannot be longer than %s characters',
|
24045 | range: '%s must be between %s and %s characters'
|
24046 | },
|
24047 | number: {
|
24048 | len: '%s must equal %s',
|
24049 | min: '%s cannot be less than %s',
|
24050 | max: '%s cannot be greater than %s',
|
24051 | range: '%s must be between %s and %s'
|
24052 | },
|
24053 | array: {
|
24054 | len: '%s must be exactly %s in length',
|
24055 | min: '%s cannot be less than %s in length',
|
24056 | max: '%s cannot be greater than %s in length',
|
24057 | range: '%s must be between %s and %s in length'
|
24058 | },
|
24059 | pattern: {
|
24060 | mismatch: '%s value %s does not match pattern %s'
|
24061 | },
|
24062 | clone: function clone() {
|
24063 | var cloned = JSON.parse(JSON.stringify(this));
|
24064 | cloned.clone = this.clone;
|
24065 | return cloned;
|
24066 | }
|
24067 | };
|
24068 | }
|
24069 |
|
24070 | var messages = exports.messages = newMessages();
|
24071 |
|
24072 | }),
|
24073 |
|
24074 | (function(module, exports, __webpack_require__) {
|
24075 |
|
24076 | var baseGet = __webpack_require__(268);
|
24077 |
|
24078 | |
24079 |
|
24080 |
|
24081 |
|
24082 |
|
24083 |
|
24084 |
|
24085 |
|
24086 |
|
24087 |
|
24088 |
|
24089 |
|
24090 |
|
24091 |
|
24092 |
|
24093 |
|
24094 |
|
24095 |
|
24096 |
|
24097 |
|
24098 |
|
24099 |
|
24100 |
|
24101 |
|
24102 |
|
24103 | function get(object, path, defaultValue) {
|
24104 | var result = object == null ? undefined : baseGet(object, path);
|
24105 | return result === undefined ? defaultValue : result;
|
24106 | }
|
24107 |
|
24108 | module.exports = get;
|
24109 |
|
24110 |
|
24111 | /***/ }),
|
24112 | /* 268 */
|
24113 | /***/ (function(module, exports, __webpack_require__) {
|
24114 |
|
24115 | var castPath = __webpack_require__(269),
|
24116 | toKey = __webpack_require__(318);
|
24117 |
|
24118 | |
24119 |
|
24120 |
|
24121 |
|
24122 |
|
24123 |
|
24124 |
|
24125 |
|
24126 | function baseGet(object, path) {
|
24127 | path = castPath(path, object);
|
24128 |
|
24129 | var index = 0,
|
24130 | length = path.length;
|
24131 |
|
24132 | while (object != null && index < length) {
|
24133 | object = object[toKey(path[index++])];
|
24134 | }
|
24135 | return (index && index == length) ? object : undefined;
|
24136 | }
|
24137 |
|
24138 | module.exports = baseGet;
|
24139 |
|
24140 |
|
24141 | }),
|
24142 |
|
24143 | (function(module, exports, __webpack_require__) {
|
24144 |
|
24145 | var isArray = __webpack_require__(270),
|
24146 | isKey = __webpack_require__(271),
|
24147 | stringToPath = __webpack_require__(280),
|
24148 | toString = __webpack_require__(315);
|
24149 |
|
24150 | |
24151 |
|
24152 |
|
24153 |
|
24154 |
|
24155 |
|
24156 |
|
24157 |
|
24158 | function castPath(value, object) {
|
24159 | if (isArray(value)) {
|
24160 | return value;
|
24161 | }
|
24162 | return isKey(value, object) ? [value] : stringToPath(toString(value));
|
24163 | }
|
24164 |
|
24165 | module.exports = castPath;
|
24166 |
|
24167 |
|
24168 | }),
|
24169 |
|
24170 | (function(module, exports) {
|
24171 |
|
24172 | |
24173 |
|
24174 |
|
24175 |
|
24176 |
|
24177 |
|
24178 |
|
24179 |
|
24180 |
|
24181 |
|
24182 |
|
24183 |
|
24184 |
|
24185 |
|
24186 |
|
24187 |
|
24188 |
|
24189 |
|
24190 |
|
24191 |
|
24192 |
|
24193 |
|
24194 |
|
24195 | var isArray = Array.isArray;
|
24196 |
|
24197 | module.exports = isArray;
|
24198 |
|
24199 |
|
24200 | }),
|
24201 |
|
24202 | (function(module, exports, __webpack_require__) {
|
24203 |
|
24204 | var isArray = __webpack_require__(270),
|
24205 | isSymbol = __webpack_require__(272);
|
24206 |
|
24207 |
|
24208 | var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
24209 | reIsPlainProp = /^\w*$/;
|
24210 |
|
24211 | |
24212 |
|
24213 |
|
24214 |
|
24215 |
|
24216 |
|
24217 |
|
24218 |
|
24219 | function isKey(value, object) {
|
24220 | if (isArray(value)) {
|
24221 | return false;
|
24222 | }
|
24223 | var type = typeof value;
|
24224 | if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
24225 | value == null || isSymbol(value)) {
|
24226 | return true;
|
24227 | }
|
24228 | return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
24229 | (object != null && value in Object(object));
|
24230 | }
|
24231 |
|
24232 | module.exports = isKey;
|
24233 |
|
24234 |
|
24235 | }),
|
24236 |
|
24237 | (function(module, exports, __webpack_require__) {
|
24238 |
|
24239 | var baseGetTag = __webpack_require__(273),
|
24240 | isObjectLike = __webpack_require__(279);
|
24241 |
|
24242 |
|
24243 | var symbolTag = '[object Symbol]';
|
24244 |
|
24245 | |
24246 |
|
24247 |
|
24248 |
|
24249 |
|
24250 |
|
24251 |
|
24252 |
|
24253 |
|
24254 |
|
24255 |
|
24256 |
|
24257 |
|
24258 |
|
24259 |
|
24260 |
|
24261 |
|
24262 | function isSymbol(value) {
|
24263 | return typeof value == 'symbol' ||
|
24264 | (isObjectLike(value) && baseGetTag(value) == symbolTag);
|
24265 | }
|
24266 |
|
24267 | module.exports = isSymbol;
|
24268 |
|
24269 |
|
24270 | }),
|
24271 |
|
24272 | (function(module, exports, __webpack_require__) {
|
24273 |
|
24274 | var Symbol = __webpack_require__(274),
|
24275 | getRawTag = __webpack_require__(277),
|
24276 | objectToString = __webpack_require__(278);
|
24277 |
|
24278 |
|
24279 | var nullTag = '[object Null]',
|
24280 | undefinedTag = '[object Undefined]';
|
24281 |
|
24282 |
|
24283 | var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
24284 |
|
24285 | |
24286 |
|
24287 |
|
24288 |
|
24289 |
|
24290 |
|
24291 |
|
24292 | function baseGetTag(value) {
|
24293 | if (value == null) {
|
24294 | return value === undefined ? undefinedTag : nullTag;
|
24295 | }
|
24296 | return (symToStringTag && symToStringTag in Object(value))
|
24297 | ? getRawTag(value)
|
24298 | : objectToString(value);
|
24299 | }
|
24300 |
|
24301 | module.exports = baseGetTag;
|
24302 |
|
24303 |
|
24304 | }),
|
24305 |
|
24306 | (function(module, exports, __webpack_require__) {
|
24307 |
|
24308 | var root = __webpack_require__(275);
|
24309 |
|
24310 |
|
24311 | var Symbol = root.Symbol;
|
24312 |
|
24313 | module.exports = Symbol;
|
24314 |
|
24315 |
|
24316 | }),
|
24317 |
|
24318 | (function(module, exports, __webpack_require__) {
|
24319 |
|
24320 | var freeGlobal = __webpack_require__(276);
|
24321 |
|
24322 |
|
24323 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
24324 |
|
24325 |
|
24326 | var root = freeGlobal || freeSelf || Function('return this')();
|
24327 |
|
24328 | module.exports = root;
|
24329 |
|
24330 |
|
24331 | }),
|
24332 |
|
24333 | (function(module, exports) {
|
24334 |
|
24335 | (function(global) {
|
24336 | var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
24337 |
|
24338 | module.exports = freeGlobal;
|
24339 |
|
24340 | }.call(exports, (function() { return this; }())))
|
24341 |
|
24342 | }),
|
24343 |
|
24344 | (function(module, exports, __webpack_require__) {
|
24345 |
|
24346 | var Symbol = __webpack_require__(274);
|
24347 |
|
24348 |
|
24349 | var objectProto = Object.prototype;
|
24350 |
|
24351 |
|
24352 | var hasOwnProperty = objectProto.hasOwnProperty;
|
24353 |
|
24354 | |
24355 |
|
24356 |
|
24357 |
|
24358 |
|
24359 | var nativeObjectToString = objectProto.toString;
|
24360 |
|
24361 |
|
24362 | var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
24363 |
|
24364 | |
24365 |
|
24366 |
|
24367 |
|
24368 |
|
24369 |
|
24370 |
|
24371 | function getRawTag(value) {
|
24372 | var isOwn = hasOwnProperty.call(value, symToStringTag),
|
24373 | tag = value[symToStringTag];
|
24374 |
|
24375 | try {
|
24376 | value[symToStringTag] = undefined;
|
24377 | var unmasked = true;
|
24378 | } catch (e) {}
|
24379 |
|
24380 | var result = nativeObjectToString.call(value);
|
24381 | if (unmasked) {
|
24382 | if (isOwn) {
|
24383 | value[symToStringTag] = tag;
|
24384 | } else {
|
24385 | delete value[symToStringTag];
|
24386 | }
|
24387 | }
|
24388 | return result;
|
24389 | }
|
24390 |
|
24391 | module.exports = getRawTag;
|
24392 |
|
24393 |
|
24394 | }),
|
24395 |
|
24396 | (function(module, exports) {
|
24397 |
|
24398 |
|
24399 | var objectProto = Object.prototype;
|
24400 |
|
24401 | |
24402 |
|
24403 |
|
24404 |
|
24405 |
|
24406 | var nativeObjectToString = objectProto.toString;
|
24407 |
|
24408 | |
24409 |
|
24410 |
|
24411 |
|
24412 |
|
24413 |
|
24414 |
|
24415 | function objectToString(value) {
|
24416 | return nativeObjectToString.call(value);
|
24417 | }
|
24418 |
|
24419 | module.exports = objectToString;
|
24420 |
|
24421 |
|
24422 | }),
|
24423 |
|
24424 | (function(module, exports) {
|
24425 |
|
24426 | |
24427 |
|
24428 |
|
24429 |
|
24430 |
|
24431 |
|
24432 |
|
24433 |
|
24434 |
|
24435 |
|
24436 |
|
24437 |
|
24438 |
|
24439 |
|
24440 |
|
24441 |
|
24442 |
|
24443 |
|
24444 |
|
24445 |
|
24446 |
|
24447 |
|
24448 |
|
24449 |
|
24450 | function isObjectLike(value) {
|
24451 | return value != null && typeof value == 'object';
|
24452 | }
|
24453 |
|
24454 | module.exports = isObjectLike;
|
24455 |
|
24456 |
|
24457 | }),
|
24458 |
|
24459 | (function(module, exports, __webpack_require__) {
|
24460 |
|
24461 | var memoizeCapped = __webpack_require__(281);
|
24462 |
|
24463 |
|
24464 | var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
24465 |
|
24466 |
|
24467 | var reEscapeChar = /\\(\\)?/g;
|
24468 |
|
24469 | |
24470 |
|
24471 |
|
24472 |
|
24473 |
|
24474 |
|
24475 |
|
24476 | var stringToPath = memoizeCapped(function(string) {
|
24477 | var result = [];
|
24478 | if (string.charCodeAt(0) === 46 ) {
|
24479 | result.push('');
|
24480 | }
|
24481 | string.replace(rePropName, function(match, number, quote, subString) {
|
24482 | result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
24483 | });
|
24484 | return result;
|
24485 | });
|
24486 |
|
24487 | module.exports = stringToPath;
|
24488 |
|
24489 |
|
24490 | }),
|
24491 |
|
24492 | (function(module, exports, __webpack_require__) {
|
24493 |
|
24494 | var memoize = __webpack_require__(282);
|
24495 |
|
24496 |
|
24497 | var MAX_MEMOIZE_SIZE = 500;
|
24498 |
|
24499 | |
24500 |
|
24501 |
|
24502 |
|
24503 |
|
24504 |
|
24505 |
|
24506 |
|
24507 | function memoizeCapped(func) {
|
24508 | var result = memoize(func, function(key) {
|
24509 | if (cache.size === MAX_MEMOIZE_SIZE) {
|
24510 | cache.clear();
|
24511 | }
|
24512 | return key;
|
24513 | });
|
24514 |
|
24515 | var cache = result.cache;
|
24516 | return result;
|
24517 | }
|
24518 |
|
24519 | module.exports = memoizeCapped;
|
24520 |
|
24521 |
|
24522 | }),
|
24523 |
|
24524 | (function(module, exports, __webpack_require__) {
|
24525 |
|
24526 | var MapCache = __webpack_require__(283);
|
24527 |
|
24528 |
|
24529 | var FUNC_ERROR_TEXT = 'Expected a function';
|
24530 |
|
24531 | |
24532 |
|
24533 |
|
24534 |
|
24535 |
|
24536 |
|
24537 |
|
24538 |
|
24539 |
|
24540 |
|
24541 |
|
24542 |
|
24543 |
|
24544 |
|
24545 |
|
24546 |
|
24547 |
|
24548 |
|
24549 |
|
24550 |
|
24551 |
|
24552 |
|
24553 |
|
24554 |
|
24555 |
|
24556 |
|
24557 |
|
24558 |
|
24559 |
|
24560 |
|
24561 |
|
24562 |
|
24563 |
|
24564 |
|
24565 |
|
24566 |
|
24567 |
|
24568 |
|
24569 |
|
24570 |
|
24571 |
|
24572 |
|
24573 |
|
24574 |
|
24575 | function memoize(func, resolver) {
|
24576 | if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
24577 | throw new TypeError(FUNC_ERROR_TEXT);
|
24578 | }
|
24579 | var memoized = function() {
|
24580 | var args = arguments,
|
24581 | key = resolver ? resolver.apply(this, args) : args[0],
|
24582 | cache = memoized.cache;
|
24583 |
|
24584 | if (cache.has(key)) {
|
24585 | return cache.get(key);
|
24586 | }
|
24587 | var result = func.apply(this, args);
|
24588 | memoized.cache = cache.set(key, result) || cache;
|
24589 | return result;
|
24590 | };
|
24591 | memoized.cache = new (memoize.Cache || MapCache);
|
24592 | return memoized;
|
24593 | }
|
24594 |
|
24595 |
|
24596 | memoize.Cache = MapCache;
|
24597 |
|
24598 | module.exports = memoize;
|
24599 |
|
24600 |
|
24601 | }),
|
24602 |
|
24603 | (function(module, exports, __webpack_require__) {
|
24604 |
|
24605 | var mapCacheClear = __webpack_require__(284),
|
24606 | mapCacheDelete = __webpack_require__(309),
|
24607 | mapCacheGet = __webpack_require__(312),
|
24608 | mapCacheHas = __webpack_require__(313),
|
24609 | mapCacheSet = __webpack_require__(314);
|
24610 |
|
24611 | |
24612 |
|
24613 |
|
24614 |
|
24615 |
|
24616 |
|
24617 |
|
24618 | function MapCache(entries) {
|
24619 | var index = -1,
|
24620 | length = entries == null ? 0 : entries.length;
|
24621 |
|
24622 | this.clear();
|
24623 | while (++index < length) {
|
24624 | var entry = entries[index];
|
24625 | this.set(entry[0], entry[1]);
|
24626 | }
|
24627 | }
|
24628 |
|
24629 |
|
24630 | MapCache.prototype.clear = mapCacheClear;
|
24631 | MapCache.prototype['delete'] = mapCacheDelete;
|
24632 | MapCache.prototype.get = mapCacheGet;
|
24633 | MapCache.prototype.has = mapCacheHas;
|
24634 | MapCache.prototype.set = mapCacheSet;
|
24635 |
|
24636 | module.exports = MapCache;
|
24637 |
|
24638 |
|
24639 | }),
|
24640 |
|
24641 | (function(module, exports, __webpack_require__) {
|
24642 |
|
24643 | var Hash = __webpack_require__(285),
|
24644 | ListCache = __webpack_require__(300),
|
24645 | Map = __webpack_require__(308);
|
24646 |
|
24647 | |
24648 |
|
24649 |
|
24650 |
|
24651 |
|
24652 |
|
24653 |
|
24654 | function mapCacheClear() {
|
24655 | this.size = 0;
|
24656 | this.__data__ = {
|
24657 | 'hash': new Hash,
|
24658 | 'map': new (Map || ListCache),
|
24659 | 'string': new Hash
|
24660 | };
|
24661 | }
|
24662 |
|
24663 | module.exports = mapCacheClear;
|
24664 |
|
24665 |
|
24666 | }),
|
24667 |
|
24668 | (function(module, exports, __webpack_require__) {
|
24669 |
|
24670 | var hashClear = __webpack_require__(286),
|
24671 | hashDelete = __webpack_require__(296),
|
24672 | hashGet = __webpack_require__(297),
|
24673 | hashHas = __webpack_require__(298),
|
24674 | hashSet = __webpack_require__(299);
|
24675 |
|
24676 | |
24677 |
|
24678 |
|
24679 |
|
24680 |
|
24681 |
|
24682 |
|
24683 | function Hash(entries) {
|
24684 | var index = -1,
|
24685 | length = entries == null ? 0 : entries.length;
|
24686 |
|
24687 | this.clear();
|
24688 | while (++index < length) {
|
24689 | var entry = entries[index];
|
24690 | this.set(entry[0], entry[1]);
|
24691 | }
|
24692 | }
|
24693 |
|
24694 |
|
24695 | Hash.prototype.clear = hashClear;
|
24696 | Hash.prototype['delete'] = hashDelete;
|
24697 | Hash.prototype.get = hashGet;
|
24698 | Hash.prototype.has = hashHas;
|
24699 | Hash.prototype.set = hashSet;
|
24700 |
|
24701 | module.exports = Hash;
|
24702 |
|
24703 |
|
24704 | }),
|
24705 |
|
24706 | (function(module, exports, __webpack_require__) {
|
24707 |
|
24708 | var nativeCreate = __webpack_require__(287);
|
24709 |
|
24710 | |
24711 |
|
24712 |
|
24713 |
|
24714 |
|
24715 |
|
24716 |
|
24717 | function hashClear() {
|
24718 | this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
24719 | this.size = 0;
|
24720 | }
|
24721 |
|
24722 | module.exports = hashClear;
|
24723 |
|
24724 |
|
24725 | }),
|
24726 |
|
24727 | (function(module, exports, __webpack_require__) {
|
24728 |
|
24729 | var getNative = __webpack_require__(288);
|
24730 |
|
24731 |
|
24732 | var nativeCreate = getNative(Object, 'create');
|
24733 |
|
24734 | module.exports = nativeCreate;
|
24735 |
|
24736 |
|
24737 | }),
|
24738 |
|
24739 | (function(module, exports, __webpack_require__) {
|
24740 |
|
24741 | var baseIsNative = __webpack_require__(289),
|
24742 | getValue = __webpack_require__(295);
|
24743 |
|
24744 | |
24745 |
|
24746 |
|
24747 |
|
24748 |
|
24749 |
|
24750 |
|
24751 |
|
24752 | function getNative(object, key) {
|
24753 | var value = getValue(object, key);
|
24754 | return baseIsNative(value) ? value : undefined;
|
24755 | }
|
24756 |
|
24757 | module.exports = getNative;
|
24758 |
|
24759 |
|
24760 | }),
|
24761 |
|
24762 | (function(module, exports, __webpack_require__) {
|
24763 |
|
24764 | var isFunction = __webpack_require__(290),
|
24765 | isMasked = __webpack_require__(292),
|
24766 | isObject = __webpack_require__(291),
|
24767 | toSource = __webpack_require__(294);
|
24768 |
|
24769 | |
24770 |
|
24771 |
|
24772 |
|
24773 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
24774 |
|
24775 |
|
24776 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
24777 |
|
24778 |
|
24779 | var funcProto = Function.prototype,
|
24780 | objectProto = Object.prototype;
|
24781 |
|
24782 |
|
24783 | var funcToString = funcProto.toString;
|
24784 |
|
24785 |
|
24786 | var hasOwnProperty = objectProto.hasOwnProperty;
|
24787 |
|
24788 |
|
24789 | var reIsNative = RegExp('^' +
|
24790 | funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
24791 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
24792 | );
|
24793 |
|
24794 | |
24795 |
|
24796 |
|
24797 |
|
24798 |
|
24799 |
|
24800 |
|
24801 |
|
24802 | function baseIsNative(value) {
|
24803 | if (!isObject(value) || isMasked(value)) {
|
24804 | return false;
|
24805 | }
|
24806 | var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
24807 | return pattern.test(toSource(value));
|
24808 | }
|
24809 |
|
24810 | module.exports = baseIsNative;
|
24811 |
|
24812 |
|
24813 | }),
|
24814 |
|
24815 | (function(module, exports, __webpack_require__) {
|
24816 |
|
24817 | var baseGetTag = __webpack_require__(273),
|
24818 | isObject = __webpack_require__(291);
|
24819 |
|
24820 |
|
24821 | var asyncTag = '[object AsyncFunction]',
|
24822 | funcTag = '[object Function]',
|
24823 | genTag = '[object GeneratorFunction]',
|
24824 | proxyTag = '[object Proxy]';
|
24825 |
|
24826 | |
24827 |
|
24828 |
|
24829 |
|
24830 |
|
24831 |
|
24832 |
|
24833 |
|
24834 |
|
24835 |
|
24836 |
|
24837 |
|
24838 |
|
24839 |
|
24840 |
|
24841 |
|
24842 |
|
24843 | function isFunction(value) {
|
24844 | if (!isObject(value)) {
|
24845 | return false;
|
24846 | }
|
24847 |
|
24848 |
|
24849 | var tag = baseGetTag(value);
|
24850 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
24851 | }
|
24852 |
|
24853 | module.exports = isFunction;
|
24854 |
|
24855 |
|
24856 | }),
|
24857 |
|
24858 | (function(module, exports) {
|
24859 |
|
24860 | |
24861 |
|
24862 |
|
24863 |
|
24864 |
|
24865 |
|
24866 |
|
24867 |
|
24868 |
|
24869 |
|
24870 |
|
24871 |
|
24872 |
|
24873 |
|
24874 |
|
24875 |
|
24876 |
|
24877 |
|
24878 |
|
24879 |
|
24880 |
|
24881 |
|
24882 |
|
24883 |
|
24884 |
|
24885 | function isObject(value) {
|
24886 | var type = typeof value;
|
24887 | return value != null && (type == 'object' || type == 'function');
|
24888 | }
|
24889 |
|
24890 | module.exports = isObject;
|
24891 |
|
24892 |
|
24893 | }),
|
24894 |
|
24895 | (function(module, exports, __webpack_require__) {
|
24896 |
|
24897 | var coreJsData = __webpack_require__(293);
|
24898 |
|
24899 |
|
24900 | var maskSrcKey = (function() {
|
24901 | var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
24902 | return uid ? ('Symbol(src)_1.' + uid) : '';
|
24903 | }());
|
24904 |
|
24905 | |
24906 |
|
24907 |
|
24908 |
|
24909 |
|
24910 |
|
24911 |
|
24912 | function isMasked(func) {
|
24913 | return !!maskSrcKey && (maskSrcKey in func);
|
24914 | }
|
24915 |
|
24916 | module.exports = isMasked;
|
24917 |
|
24918 |
|
24919 | }),
|
24920 |
|
24921 | (function(module, exports, __webpack_require__) {
|
24922 |
|
24923 | var root = __webpack_require__(275);
|
24924 |
|
24925 |
|
24926 | var coreJsData = root['__core-js_shared__'];
|
24927 |
|
24928 | module.exports = coreJsData;
|
24929 |
|
24930 |
|
24931 | }),
|
24932 |
|
24933 | (function(module, exports) {
|
24934 |
|
24935 |
|
24936 | var funcProto = Function.prototype;
|
24937 |
|
24938 |
|
24939 | var funcToString = funcProto.toString;
|
24940 |
|
24941 | |
24942 |
|
24943 |
|
24944 |
|
24945 |
|
24946 |
|
24947 |
|
24948 | function toSource(func) {
|
24949 | if (func != null) {
|
24950 | try {
|
24951 | return funcToString.call(func);
|
24952 | } catch (e) {}
|
24953 | try {
|
24954 | return (func + '');
|
24955 | } catch (e) {}
|
24956 | }
|
24957 | return '';
|
24958 | }
|
24959 |
|
24960 | module.exports = toSource;
|
24961 |
|
24962 |
|
24963 | }),
|
24964 |
|
24965 | (function(module, exports) {
|
24966 |
|
24967 | |
24968 |
|
24969 |
|
24970 |
|
24971 |
|
24972 |
|
24973 |
|
24974 |
|
24975 | function getValue(object, key) {
|
24976 | return object == null ? undefined : object[key];
|
24977 | }
|
24978 |
|
24979 | module.exports = getValue;
|
24980 |
|
24981 |
|
24982 | }),
|
24983 |
|
24984 | (function(module, exports) {
|
24985 |
|
24986 | |
24987 |
|
24988 |
|
24989 |
|
24990 |
|
24991 |
|
24992 |
|
24993 |
|
24994 |
|
24995 |
|
24996 | function hashDelete(key) {
|
24997 | var result = this.has(key) && delete this.__data__[key];
|
24998 | this.size -= result ? 1 : 0;
|
24999 | return result;
|
25000 | }
|
25001 |
|
25002 | module.exports = hashDelete;
|
25003 |
|
25004 |
|
25005 | }),
|
25006 |
|
25007 | (function(module, exports, __webpack_require__) {
|
25008 |
|
25009 | var nativeCreate = __webpack_require__(287);
|
25010 |
|
25011 |
|
25012 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
25013 |
|
25014 |
|
25015 | var objectProto = Object.prototype;
|
25016 |
|
25017 |
|
25018 | var hasOwnProperty = objectProto.hasOwnProperty;
|
25019 |
|
25020 | |
25021 |
|
25022 |
|
25023 |
|
25024 |
|
25025 |
|
25026 |
|
25027 |
|
25028 |
|
25029 | function hashGet(key) {
|
25030 | var data = this.__data__;
|
25031 | if (nativeCreate) {
|
25032 | var result = data[key];
|
25033 | return result === HASH_UNDEFINED ? undefined : result;
|
25034 | }
|
25035 | return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
25036 | }
|
25037 |
|
25038 | module.exports = hashGet;
|
25039 |
|
25040 |
|
25041 | }),
|
25042 |
|
25043 | (function(module, exports, __webpack_require__) {
|
25044 |
|
25045 | var nativeCreate = __webpack_require__(287);
|
25046 |
|
25047 |
|
25048 | var objectProto = Object.prototype;
|
25049 |
|
25050 |
|
25051 | var hasOwnProperty = objectProto.hasOwnProperty;
|
25052 |
|
25053 | |
25054 |
|
25055 |
|
25056 |
|
25057 |
|
25058 |
|
25059 |
|
25060 |
|
25061 |
|
25062 | function hashHas(key) {
|
25063 | var data = this.__data__;
|
25064 | return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
25065 | }
|
25066 |
|
25067 | module.exports = hashHas;
|
25068 |
|
25069 |
|
25070 | }),
|
25071 |
|
25072 | (function(module, exports, __webpack_require__) {
|
25073 |
|
25074 | var nativeCreate = __webpack_require__(287);
|
25075 |
|
25076 |
|
25077 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
25078 |
|
25079 | |
25080 |
|
25081 |
|
25082 |
|
25083 |
|
25084 |
|
25085 |
|
25086 |
|
25087 |
|
25088 |
|
25089 | function hashSet(key, value) {
|
25090 | var data = this.__data__;
|
25091 | this.size += this.has(key) ? 0 : 1;
|
25092 | data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
25093 | return this;
|
25094 | }
|
25095 |
|
25096 | module.exports = hashSet;
|
25097 |
|
25098 |
|
25099 | }),
|
25100 |
|
25101 | (function(module, exports, __webpack_require__) {
|
25102 |
|
25103 | var listCacheClear = __webpack_require__(301),
|
25104 | listCacheDelete = __webpack_require__(302),
|
25105 | listCacheGet = __webpack_require__(305),
|
25106 | listCacheHas = __webpack_require__(306),
|
25107 | listCacheSet = __webpack_require__(307);
|
25108 |
|
25109 | |
25110 |
|
25111 |
|
25112 |
|
25113 |
|
25114 |
|
25115 |
|
25116 | function ListCache(entries) {
|
25117 | var index = -1,
|
25118 | length = entries == null ? 0 : entries.length;
|
25119 |
|
25120 | this.clear();
|
25121 | while (++index < length) {
|
25122 | var entry = entries[index];
|
25123 | this.set(entry[0], entry[1]);
|
25124 | }
|
25125 | }
|
25126 |
|
25127 |
|
25128 | ListCache.prototype.clear = listCacheClear;
|
25129 | ListCache.prototype['delete'] = listCacheDelete;
|
25130 | ListCache.prototype.get = listCacheGet;
|
25131 | ListCache.prototype.has = listCacheHas;
|
25132 | ListCache.prototype.set = listCacheSet;
|
25133 |
|
25134 | module.exports = ListCache;
|
25135 |
|
25136 |
|
25137 | }),
|
25138 |
|
25139 | (function(module, exports) {
|
25140 |
|
25141 | |
25142 |
|
25143 |
|
25144 |
|
25145 |
|
25146 |
|
25147 |
|
25148 | function listCacheClear() {
|
25149 | this.__data__ = [];
|
25150 | this.size = 0;
|
25151 | }
|
25152 |
|
25153 | module.exports = listCacheClear;
|
25154 |
|
25155 |
|
25156 | }),
|
25157 |
|
25158 | (function(module, exports, __webpack_require__) {
|
25159 |
|
25160 | var assocIndexOf = __webpack_require__(303);
|
25161 |
|
25162 |
|
25163 | var arrayProto = Array.prototype;
|
25164 |
|
25165 |
|
25166 | var splice = arrayProto.splice;
|
25167 |
|
25168 | |
25169 |
|
25170 |
|
25171 |
|
25172 |
|
25173 |
|
25174 |
|
25175 |
|
25176 |
|
25177 | function listCacheDelete(key) {
|
25178 | var data = this.__data__,
|
25179 | index = assocIndexOf(data, key);
|
25180 |
|
25181 | if (index < 0) {
|
25182 | return false;
|
25183 | }
|
25184 | var lastIndex = data.length - 1;
|
25185 | if (index == lastIndex) {
|
25186 | data.pop();
|
25187 | } else {
|
25188 | splice.call(data, index, 1);
|
25189 | }
|
25190 | --this.size;
|
25191 | return true;
|
25192 | }
|
25193 |
|
25194 | module.exports = listCacheDelete;
|
25195 |
|
25196 |
|
25197 | }),
|
25198 |
|
25199 | (function(module, exports, __webpack_require__) {
|
25200 |
|
25201 | var eq = __webpack_require__(304);
|
25202 |
|
25203 | |
25204 |
|
25205 |
|
25206 |
|
25207 |
|
25208 |
|
25209 |
|
25210 |
|
25211 | function assocIndexOf(array, key) {
|
25212 | var length = array.length;
|
25213 | while (length--) {
|
25214 | if (eq(array[length][0], key)) {
|
25215 | return length;
|
25216 | }
|
25217 | }
|
25218 | return -1;
|
25219 | }
|
25220 |
|
25221 | module.exports = assocIndexOf;
|
25222 |
|
25223 |
|
25224 | }),
|
25225 |
|
25226 | (function(module, exports) {
|
25227 |
|
25228 | |
25229 |
|
25230 |
|
25231 |
|
25232 |
|
25233 |
|
25234 |
|
25235 |
|
25236 |
|
25237 |
|
25238 |
|
25239 |
|
25240 |
|
25241 |
|
25242 |
|
25243 |
|
25244 |
|
25245 |
|
25246 |
|
25247 |
|
25248 |
|
25249 |
|
25250 |
|
25251 |
|
25252 |
|
25253 |
|
25254 |
|
25255 |
|
25256 |
|
25257 |
|
25258 |
|
25259 |
|
25260 | function eq(value, other) {
|
25261 | return value === other || (value !== value && other !== other);
|
25262 | }
|
25263 |
|
25264 | module.exports = eq;
|
25265 |
|
25266 |
|
25267 | }),
|
25268 |
|
25269 | (function(module, exports, __webpack_require__) {
|
25270 |
|
25271 | var assocIndexOf = __webpack_require__(303);
|
25272 |
|
25273 | |
25274 |
|
25275 |
|
25276 |
|
25277 |
|
25278 |
|
25279 |
|
25280 |
|
25281 |
|
25282 | function listCacheGet(key) {
|
25283 | var data = this.__data__,
|
25284 | index = assocIndexOf(data, key);
|
25285 |
|
25286 | return index < 0 ? undefined : data[index][1];
|
25287 | }
|
25288 |
|
25289 | module.exports = listCacheGet;
|
25290 |
|
25291 |
|
25292 | }),
|
25293 |
|
25294 | (function(module, exports, __webpack_require__) {
|
25295 |
|
25296 | var assocIndexOf = __webpack_require__(303);
|
25297 |
|
25298 | |
25299 |
|
25300 |
|
25301 |
|
25302 |
|
25303 |
|
25304 |
|
25305 |
|
25306 |
|
25307 | function listCacheHas(key) {
|
25308 | return assocIndexOf(this.__data__, key) > -1;
|
25309 | }
|
25310 |
|
25311 | module.exports = listCacheHas;
|
25312 |
|
25313 |
|
25314 | }),
|
25315 |
|
25316 | (function(module, exports, __webpack_require__) {
|
25317 |
|
25318 | var assocIndexOf = __webpack_require__(303);
|
25319 |
|
25320 | |
25321 |
|
25322 |
|
25323 |
|
25324 |
|
25325 |
|
25326 |
|
25327 |
|
25328 |
|
25329 |
|
25330 | function listCacheSet(key, value) {
|
25331 | var data = this.__data__,
|
25332 | index = assocIndexOf(data, key);
|
25333 |
|
25334 | if (index < 0) {
|
25335 | ++this.size;
|
25336 | data.push([key, value]);
|
25337 | } else {
|
25338 | data[index][1] = value;
|
25339 | }
|
25340 | return this;
|
25341 | }
|
25342 |
|
25343 | module.exports = listCacheSet;
|
25344 |
|
25345 |
|
25346 | }),
|
25347 |
|
25348 | (function(module, exports, __webpack_require__) {
|
25349 |
|
25350 | var getNative = __webpack_require__(288),
|
25351 | root = __webpack_require__(275);
|
25352 |
|
25353 |
|
25354 | var Map = getNative(root, 'Map');
|
25355 |
|
25356 | module.exports = Map;
|
25357 |
|
25358 |
|
25359 | }),
|
25360 |
|
25361 | (function(module, exports, __webpack_require__) {
|
25362 |
|
25363 | var getMapData = __webpack_require__(310);
|
25364 |
|
25365 | |
25366 |
|
25367 |
|
25368 |
|
25369 |
|
25370 |
|
25371 |
|
25372 |
|
25373 |
|
25374 | function mapCacheDelete(key) {
|
25375 | var result = getMapData(this, key)['delete'](key);
|
25376 | this.size -= result ? 1 : 0;
|
25377 | return result;
|
25378 | }
|
25379 |
|
25380 | module.exports = mapCacheDelete;
|
25381 |
|
25382 |
|
25383 | }),
|
25384 |
|
25385 | (function(module, exports, __webpack_require__) {
|
25386 |
|
25387 | var isKeyable = __webpack_require__(311);
|
25388 |
|
25389 | |
25390 |
|
25391 |
|
25392 |
|
25393 |
|
25394 |
|
25395 |
|
25396 |
|
25397 | function getMapData(map, key) {
|
25398 | var data = map.__data__;
|
25399 | return isKeyable(key)
|
25400 | ? data[typeof key == 'string' ? 'string' : 'hash']
|
25401 | : data.map;
|
25402 | }
|
25403 |
|
25404 | module.exports = getMapData;
|
25405 |
|
25406 |
|
25407 | }),
|
25408 |
|
25409 | (function(module, exports) {
|
25410 |
|
25411 | |
25412 |
|
25413 |
|
25414 |
|
25415 |
|
25416 |
|
25417 |
|
25418 | function isKeyable(value) {
|
25419 | var type = typeof value;
|
25420 | return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
25421 | ? (value !== '__proto__')
|
25422 | : (value === null);
|
25423 | }
|
25424 |
|
25425 | module.exports = isKeyable;
|
25426 |
|
25427 |
|
25428 | }),
|
25429 |
|
25430 | (function(module, exports, __webpack_require__) {
|
25431 |
|
25432 | var getMapData = __webpack_require__(310);
|
25433 |
|
25434 | |
25435 |
|
25436 |
|
25437 |
|
25438 |
|
25439 |
|
25440 |
|
25441 |
|
25442 |
|
25443 | function mapCacheGet(key) {
|
25444 | return getMapData(this, key).get(key);
|
25445 | }
|
25446 |
|
25447 | module.exports = mapCacheGet;
|
25448 |
|
25449 |
|
25450 | }),
|
25451 |
|
25452 | (function(module, exports, __webpack_require__) {
|
25453 |
|
25454 | var getMapData = __webpack_require__(310);
|
25455 |
|
25456 | |
25457 |
|
25458 |
|
25459 |
|
25460 |
|
25461 |
|
25462 |
|
25463 |
|
25464 |
|
25465 | function mapCacheHas(key) {
|
25466 | return getMapData(this, key).has(key);
|
25467 | }
|
25468 |
|
25469 | module.exports = mapCacheHas;
|
25470 |
|
25471 |
|
25472 | }),
|
25473 |
|
25474 | (function(module, exports, __webpack_require__) {
|
25475 |
|
25476 | var getMapData = __webpack_require__(310);
|
25477 |
|
25478 | |
25479 |
|
25480 |
|
25481 |
|
25482 |
|
25483 |
|
25484 |
|
25485 |
|
25486 |
|
25487 |
|
25488 | function mapCacheSet(key, value) {
|
25489 | var data = getMapData(this, key),
|
25490 | size = data.size;
|
25491 |
|
25492 | data.set(key, value);
|
25493 | this.size += data.size == size ? 0 : 1;
|
25494 | return this;
|
25495 | }
|
25496 |
|
25497 | module.exports = mapCacheSet;
|
25498 |
|
25499 |
|
25500 | }),
|
25501 |
|
25502 | (function(module, exports, __webpack_require__) {
|
25503 |
|
25504 | var baseToString = __webpack_require__(316);
|
25505 |
|
25506 | |
25507 |
|
25508 |
|
25509 |
|
25510 |
|
25511 |
|
25512 |
|
25513 |
|
25514 |
|
25515 |
|
25516 |
|
25517 |
|
25518 |
|
25519 |
|
25520 |
|
25521 |
|
25522 |
|
25523 |
|
25524 |
|
25525 |
|
25526 |
|
25527 | function toString(value) {
|
25528 | return value == null ? '' : baseToString(value);
|
25529 | }
|
25530 |
|
25531 | module.exports = toString;
|
25532 |
|
25533 |
|
25534 | }),
|
25535 |
|
25536 | (function(module, exports, __webpack_require__) {
|
25537 |
|
25538 | var Symbol = __webpack_require__(274),
|
25539 | arrayMap = __webpack_require__(317),
|
25540 | isArray = __webpack_require__(270),
|
25541 | isSymbol = __webpack_require__(272);
|
25542 |
|
25543 |
|
25544 | var INFINITY = 1 / 0;
|
25545 |
|
25546 |
|
25547 | var symbolProto = Symbol ? Symbol.prototype : undefined,
|
25548 | symbolToString = symbolProto ? symbolProto.toString : undefined;
|
25549 |
|
25550 | |
25551 |
|
25552 |
|
25553 |
|
25554 |
|
25555 |
|
25556 |
|
25557 |
|
25558 | function baseToString(value) {
|
25559 |
|
25560 | if (typeof value == 'string') {
|
25561 | return value;
|
25562 | }
|
25563 | if (isArray(value)) {
|
25564 |
|
25565 | return arrayMap(value, baseToString) + '';
|
25566 | }
|
25567 | if (isSymbol(value)) {
|
25568 | return symbolToString ? symbolToString.call(value) : '';
|
25569 | }
|
25570 | var result = (value + '');
|
25571 | return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
25572 | }
|
25573 |
|
25574 | module.exports = baseToString;
|
25575 |
|
25576 |
|
25577 | }),
|
25578 |
|
25579 | (function(module, exports) {
|
25580 |
|
25581 | |
25582 |
|
25583 |
|
25584 |
|
25585 |
|
25586 |
|
25587 |
|
25588 |
|
25589 |
|
25590 | function arrayMap(array, iteratee) {
|
25591 | var index = -1,
|
25592 | length = array == null ? 0 : array.length,
|
25593 | result = Array(length);
|
25594 |
|
25595 | while (++index < length) {
|
25596 | result[index] = iteratee(array[index], index, array);
|
25597 | }
|
25598 | return result;
|
25599 | }
|
25600 |
|
25601 | module.exports = arrayMap;
|
25602 |
|
25603 |
|
25604 | }),
|
25605 |
|
25606 | (function(module, exports, __webpack_require__) {
|
25607 |
|
25608 | var isSymbol = __webpack_require__(272);
|
25609 |
|
25610 |
|
25611 | var INFINITY = 1 / 0;
|
25612 |
|
25613 | |
25614 |
|
25615 |
|
25616 |
|
25617 |
|
25618 |
|
25619 |
|
25620 | function toKey(value) {
|
25621 | if (typeof value == 'string' || isSymbol(value)) {
|
25622 | return value;
|
25623 | }
|
25624 | var result = (value + '');
|
25625 | return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
25626 | }
|
25627 |
|
25628 | module.exports = toKey;
|
25629 |
|
25630 |
|
25631 | }),
|
25632 |
|
25633 | (function(module, exports, __webpack_require__) {
|
25634 |
|
25635 | var baseSet = __webpack_require__(320);
|
25636 |
|
25637 | |
25638 |
|
25639 |
|
25640 |
|
25641 |
|
25642 |
|
25643 |
|
25644 |
|
25645 |
|
25646 |
|
25647 |
|
25648 |
|
25649 |
|
25650 |
|
25651 |
|
25652 |
|
25653 |
|
25654 |
|
25655 |
|
25656 |
|
25657 |
|
25658 |
|
25659 |
|
25660 |
|
25661 |
|
25662 |
|
25663 |
|
25664 |
|
25665 | function set(object, path, value) {
|
25666 | return object == null ? object : baseSet(object, path, value);
|
25667 | }
|
25668 |
|
25669 | module.exports = set;
|
25670 |
|
25671 |
|
25672 | /***/ }),
|
25673 | /* 320 */
|
25674 | /***/ (function(module, exports, __webpack_require__) {
|
25675 |
|
25676 | var assignValue = __webpack_require__(321),
|
25677 | castPath = __webpack_require__(269),
|
25678 | isIndex = __webpack_require__(324),
|
25679 | isObject = __webpack_require__(291),
|
25680 | toKey = __webpack_require__(318);
|
25681 |
|
25682 | |
25683 |
|
25684 |
|
25685 |
|
25686 |
|
25687 |
|
25688 |
|
25689 |
|
25690 |
|
25691 |
|
25692 | function baseSet(object, path, value, customizer) {
|
25693 | if (!isObject(object)) {
|
25694 | return object;
|
25695 | }
|
25696 | path = castPath(path, object);
|
25697 |
|
25698 | var index = -1,
|
25699 | length = path.length,
|
25700 | lastIndex = length - 1,
|
25701 | nested = object;
|
25702 |
|
25703 | while (nested != null && ++index < length) {
|
25704 | var key = toKey(path[index]),
|
25705 | newValue = value;
|
25706 |
|
25707 | if (index != lastIndex) {
|
25708 | var objValue = nested[key];
|
25709 | newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
25710 | if (newValue === undefined) {
|
25711 | newValue = isObject(objValue)
|
25712 | ? objValue
|
25713 | : (isIndex(path[index + 1]) ? [] : {});
|
25714 | }
|
25715 | }
|
25716 | assignValue(nested, key, newValue);
|
25717 | nested = nested[key];
|
25718 | }
|
25719 | return object;
|
25720 | }
|
25721 |
|
25722 | module.exports = baseSet;
|
25723 |
|
25724 |
|
25725 | }),
|
25726 |
|
25727 | (function(module, exports, __webpack_require__) {
|
25728 |
|
25729 | var baseAssignValue = __webpack_require__(322),
|
25730 | eq = __webpack_require__(304);
|
25731 |
|
25732 |
|
25733 | var objectProto = Object.prototype;
|
25734 |
|
25735 |
|
25736 | var hasOwnProperty = objectProto.hasOwnProperty;
|
25737 |
|
25738 | |
25739 |
|
25740 |
|
25741 |
|
25742 |
|
25743 |
|
25744 |
|
25745 |
|
25746 |
|
25747 |
|
25748 | function assignValue(object, key, value) {
|
25749 | var objValue = object[key];
|
25750 | if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
25751 | (value === undefined && !(key in object))) {
|
25752 | baseAssignValue(object, key, value);
|
25753 | }
|
25754 | }
|
25755 |
|
25756 | module.exports = assignValue;
|
25757 |
|
25758 |
|
25759 | }),
|
25760 |
|
25761 | (function(module, exports, __webpack_require__) {
|
25762 |
|
25763 | var defineProperty = __webpack_require__(323);
|
25764 |
|
25765 | |
25766 |
|
25767 |
|
25768 |
|
25769 |
|
25770 |
|
25771 |
|
25772 |
|
25773 |
|
25774 | function baseAssignValue(object, key, value) {
|
25775 | if (key == '__proto__' && defineProperty) {
|
25776 | defineProperty(object, key, {
|
25777 | 'configurable': true,
|
25778 | 'enumerable': true,
|
25779 | 'value': value,
|
25780 | 'writable': true
|
25781 | });
|
25782 | } else {
|
25783 | object[key] = value;
|
25784 | }
|
25785 | }
|
25786 |
|
25787 | module.exports = baseAssignValue;
|
25788 |
|
25789 |
|
25790 | }),
|
25791 |
|
25792 | (function(module, exports, __webpack_require__) {
|
25793 |
|
25794 | var getNative = __webpack_require__(288);
|
25795 |
|
25796 | var defineProperty = (function() {
|
25797 | try {
|
25798 | var func = getNative(Object, 'defineProperty');
|
25799 | func({}, '', {});
|
25800 | return func;
|
25801 | } catch (e) {}
|
25802 | }());
|
25803 |
|
25804 | module.exports = defineProperty;
|
25805 |
|
25806 |
|
25807 | }),
|
25808 |
|
25809 | (function(module, exports) {
|
25810 |
|
25811 |
|
25812 | var MAX_SAFE_INTEGER = 9007199254740991;
|
25813 |
|
25814 |
|
25815 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
25816 |
|
25817 | |
25818 |
|
25819 |
|
25820 |
|
25821 |
|
25822 |
|
25823 |
|
25824 |
|
25825 | function isIndex(value, length) {
|
25826 | var type = typeof value;
|
25827 | length = length == null ? MAX_SAFE_INTEGER : length;
|
25828 |
|
25829 | return !!length &&
|
25830 | (type == 'number' ||
|
25831 | (type != 'symbol' && reIsUint.test(value))) &&
|
25832 | (value > -1 && value % 1 == 0 && value < length);
|
25833 | }
|
25834 |
|
25835 | module.exports = isIndex;
|
25836 |
|
25837 |
|
25838 | }),
|
25839 |
|
25840 | (function(module, exports, __webpack_require__) {
|
25841 |
|
25842 | 'use strict';
|
25843 |
|
25844 | Object.defineProperty(exports, "__esModule", {
|
25845 | value: true
|
25846 | });
|
25847 |
|
25848 | var _defineProperty2 = __webpack_require__(173);
|
25849 |
|
25850 | var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
25851 |
|
25852 | var _extends2 = __webpack_require__(177);
|
25853 |
|
25854 | var _extends3 = _interopRequireDefault(_extends2);
|
25855 |
|
25856 | var _classCallCheck2 = __webpack_require__(326);
|
25857 |
|
25858 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
25859 |
|
25860 | var _createClass2 = __webpack_require__(327);
|
25861 |
|
25862 | var _createClass3 = _interopRequireDefault(_createClass2);
|
25863 |
|
25864 | exports['default'] = createFieldsStore;
|
25865 |
|
25866 | var _set = __webpack_require__(319);
|
25867 |
|
25868 | var _set2 = _interopRequireDefault(_set);
|
25869 |
|
25870 | var _createFormField = __webpack_require__(328);
|
25871 |
|
25872 | var _createFormField2 = _interopRequireDefault(_createFormField);
|
25873 |
|
25874 | var _utils = __webpack_require__(329);
|
25875 |
|
25876 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
25877 |
|
25878 | function partOf(a, b) {
|
25879 | return b.indexOf(a) === 0 && ['.', '['].indexOf(b[a.length]) !== -1;
|
25880 | }
|
25881 |
|
25882 | function internalFlattenFields(fields) {
|
25883 | return (0, _utils.flattenFields)(fields, function (_, node) {
|
25884 | return (0, _createFormField.isFormField)(node);
|
25885 | }, 'You must wrap field data with `createFormField`.');
|
25886 | }
|
25887 |
|
25888 | var FieldsStore = function () {
|
25889 | function FieldsStore(fields) {
|
25890 | (0, _classCallCheck3['default'])(this, FieldsStore);
|
25891 |
|
25892 | _initialiseProps.call(this);
|
25893 |
|
25894 | this.fields = internalFlattenFields(fields);
|
25895 | this.fieldsMeta = {};
|
25896 | }
|
25897 |
|
25898 | (0, _createClass3['default'])(FieldsStore, [{
|
25899 | key: 'updateFields',
|
25900 | value: function updateFields(fields) {
|
25901 | this.fields = internalFlattenFields(fields);
|
25902 | }
|
25903 | }, {
|
25904 | key: 'flattenRegisteredFields',
|
25905 | value: function flattenRegisteredFields(fields) {
|
25906 | var validFieldsName = this.getAllFieldsName();
|
25907 | return (0, _utils.flattenFields)(fields, function (path) {
|
25908 | return validFieldsName.indexOf(path) >= 0;
|
25909 | }, 'You cannot set a form field before rendering a field associated with the value.');
|
25910 | }
|
25911 | }, {
|
25912 | key: 'setFields',
|
25913 | value: function setFields(fields) {
|
25914 | var _this = this;
|
25915 |
|
25916 | var fieldsMeta = this.fieldsMeta;
|
25917 | var nowFields = (0, _extends3['default'])({}, this.fields, fields);
|
25918 | var nowValues = {};
|
25919 | Object.keys(fieldsMeta).forEach(function (f) {
|
25920 | nowValues[f] = _this.getValueFromFields(f, nowFields);
|
25921 | });
|
25922 | Object.keys(nowValues).forEach(function (f) {
|
25923 | var value = nowValues[f];
|
25924 | var fieldMeta = _this.getFieldMeta(f);
|
25925 | if (fieldMeta && fieldMeta.normalize) {
|
25926 | var nowValue = fieldMeta.normalize(value, _this.getValueFromFields(f, _this.fields), nowValues);
|
25927 | if (nowValue !== value) {
|
25928 | nowFields[f] = (0, _extends3['default'])({}, nowFields[f], {
|
25929 | value: nowValue
|
25930 | });
|
25931 | }
|
25932 | }
|
25933 | });
|
25934 | this.fields = nowFields;
|
25935 | }
|
25936 | }, {
|
25937 | key: 'resetFields',
|
25938 | value: function resetFields(ns) {
|
25939 | var fields = this.fields;
|
25940 |
|
25941 | var names = ns ? this.getValidFieldsFullName(ns) : this.getAllFieldsName();
|
25942 | return names.reduce(function (acc, name) {
|
25943 | var field = fields[name];
|
25944 | if (field && 'value' in field) {
|
25945 | acc[name] = {};
|
25946 | }
|
25947 | return acc;
|
25948 | }, {});
|
25949 | }
|
25950 | }, {
|
25951 | key: 'setFieldMeta',
|
25952 | value: function setFieldMeta(name, meta) {
|
25953 | this.fieldsMeta[name] = meta;
|
25954 | }
|
25955 | }, {
|
25956 | key: 'setFieldsAsDirty',
|
25957 | value: function setFieldsAsDirty() {
|
25958 | var _this2 = this;
|
25959 |
|
25960 | Object.keys(this.fields).forEach(function (name) {
|
25961 | var field = _this2.fields[name];
|
25962 | var fieldMeta = _this2.fieldsMeta[name];
|
25963 | if (field && fieldMeta && (0, _utils.hasRules)(fieldMeta.validate)) {
|
25964 | _this2.fields[name] = (0, _extends3['default'])({}, field, {
|
25965 | dirty: true
|
25966 | });
|
25967 | }
|
25968 | });
|
25969 | }
|
25970 | }, {
|
25971 | key: 'getFieldMeta',
|
25972 | value: function getFieldMeta(name) {
|
25973 | this.fieldsMeta[name] = this.fieldsMeta[name] || {};
|
25974 | return this.fieldsMeta[name];
|
25975 | }
|
25976 | }, {
|
25977 | key: 'getValueFromFields',
|
25978 | value: function getValueFromFields(name, fields) {
|
25979 | var field = fields[name];
|
25980 | if (field && 'value' in field) {
|
25981 | return field.value;
|
25982 | }
|
25983 | var fieldMeta = this.getFieldMeta(name);
|
25984 | return fieldMeta && fieldMeta.initialValue;
|
25985 | }
|
25986 | }, {
|
25987 | key: 'getValidFieldsName',
|
25988 | value: function getValidFieldsName() {
|
25989 | var _this3 = this;
|
25990 |
|
25991 | var fieldsMeta = this.fieldsMeta;
|
25992 |
|
25993 | return fieldsMeta ? Object.keys(fieldsMeta).filter(function (name) {
|
25994 | return !_this3.getFieldMeta(name).hidden;
|
25995 | }) : [];
|
25996 | }
|
25997 | }, {
|
25998 | key: 'getAllFieldsName',
|
25999 | value: function getAllFieldsName() {
|
26000 | var fieldsMeta = this.fieldsMeta;
|
26001 |
|
26002 | return fieldsMeta ? Object.keys(fieldsMeta) : [];
|
26003 | }
|
26004 | }, {
|
26005 | key: 'getValidFieldsFullName',
|
26006 | value: function getValidFieldsFullName(maybePartialName) {
|
26007 | var maybePartialNames = Array.isArray(maybePartialName) ? maybePartialName : [maybePartialName];
|
26008 | return this.getValidFieldsName().filter(function (fullName) {
|
26009 | return maybePartialNames.some(function (partialName) {
|
26010 | return fullName === partialName || (0, _utils.startsWith)(fullName, partialName) && ['.', '['].indexOf(fullName[partialName.length]) >= 0;
|
26011 | });
|
26012 | });
|
26013 | }
|
26014 | }, {
|
26015 | key: 'getFieldValuePropValue',
|
26016 | value: function getFieldValuePropValue(fieldMeta) {
|
26017 | var name = fieldMeta.name,
|
26018 | getValueProps = fieldMeta.getValueProps,
|
26019 | valuePropName = fieldMeta.valuePropName;
|
26020 |
|
26021 | var field = this.getField(name);
|
26022 | var fieldValue = 'value' in field ? field.value : fieldMeta.initialValue;
|
26023 | if (getValueProps) {
|
26024 | return getValueProps(fieldValue);
|
26025 | }
|
26026 | return (0, _defineProperty3['default'])({}, valuePropName, fieldValue);
|
26027 | }
|
26028 | }, {
|
26029 | key: 'getField',
|
26030 | value: function getField(name) {
|
26031 | return (0, _extends3['default'])({}, this.fields[name], {
|
26032 | name: name
|
26033 | });
|
26034 | }
|
26035 | }, {
|
26036 | key: 'getNotCollectedFields',
|
26037 | value: function getNotCollectedFields() {
|
26038 | var _this4 = this;
|
26039 |
|
26040 | var fieldsName = this.getValidFieldsName();
|
26041 | return fieldsName.filter(function (name) {
|
26042 | return !_this4.fields[name];
|
26043 | }).map(function (name) {
|
26044 | return {
|
26045 | name: name,
|
26046 | dirty: false,
|
26047 | value: _this4.getFieldMeta(name).initialValue
|
26048 | };
|
26049 | }).reduce(function (acc, field) {
|
26050 | return (0, _set2['default'])(acc, field.name, (0, _createFormField2['default'])(field));
|
26051 | }, {});
|
26052 | }
|
26053 | }, {
|
26054 | key: 'getNestedAllFields',
|
26055 | value: function getNestedAllFields() {
|
26056 | var _this5 = this;
|
26057 |
|
26058 | return Object.keys(this.fields).reduce(function (acc, name) {
|
26059 | return (0, _set2['default'])(acc, name, (0, _createFormField2['default'])(_this5.fields[name]));
|
26060 | }, this.getNotCollectedFields());
|
26061 | }
|
26062 | }, {
|
26063 | key: 'getFieldMember',
|
26064 | value: function getFieldMember(name, member) {
|
26065 | return this.getField(name)[member];
|
26066 | }
|
26067 | }, {
|
26068 | key: 'getNestedFields',
|
26069 | value: function getNestedFields(names, getter) {
|
26070 | var fields = names || this.getValidFieldsName();
|
26071 | return fields.reduce(function (acc, f) {
|
26072 | return (0, _set2['default'])(acc, f, getter(f));
|
26073 | }, {});
|
26074 | }
|
26075 | }, {
|
26076 | key: 'getNestedField',
|
26077 | value: function getNestedField(name, getter) {
|
26078 | var fullNames = this.getValidFieldsFullName(name);
|
26079 | if (fullNames.length === 0 ||
|
26080 | fullNames.length === 1 && fullNames[0] === name
|
26081 | ) {
|
26082 | return getter(name);
|
26083 | }
|
26084 | var isArrayValue = fullNames[0][name.length] === '[';
|
26085 | var suffixNameStartIndex = isArrayValue ? name.length : name.length + 1;
|
26086 | return fullNames.reduce(function (acc, fullName) {
|
26087 | return (0, _set2['default'])(acc, fullName.slice(suffixNameStartIndex), getter(fullName));
|
26088 | }, isArrayValue ? [] : {});
|
26089 | }
|
26090 | }, {
|
26091 | key: 'isValidNestedFieldName',
|
26092 |
|
26093 |
|
26094 |
|
26095 |
|
26096 | value: function isValidNestedFieldName(name) {
|
26097 | var names = this.getAllFieldsName();
|
26098 | return names.every(function (n) {
|
26099 | return !partOf(n, name) && !partOf(name, n);
|
26100 | });
|
26101 | }
|
26102 | }, {
|
26103 | key: 'clearField',
|
26104 | value: function clearField(name) {
|
26105 | delete this.fields[name];
|
26106 | delete this.fieldsMeta[name];
|
26107 | }
|
26108 | }]);
|
26109 | return FieldsStore;
|
26110 | }();
|
26111 |
|
26112 | var _initialiseProps = function _initialiseProps() {
|
26113 | var _this6 = this;
|
26114 |
|
26115 | this.setFieldsInitialValue = function (initialValues) {
|
26116 | var flattenedInitialValues = _this6.flattenRegisteredFields(initialValues);
|
26117 | var fieldsMeta = _this6.fieldsMeta;
|
26118 | Object.keys(flattenedInitialValues).forEach(function (name) {
|
26119 | if (fieldsMeta[name]) {
|
26120 | _this6.setFieldMeta(name, (0, _extends3['default'])({}, _this6.getFieldMeta(name), {
|
26121 | initialValue: flattenedInitialValues[name]
|
26122 | }));
|
26123 | }
|
26124 | });
|
26125 | };
|
26126 |
|
26127 | this.getAllValues = function () {
|
26128 | var fieldsMeta = _this6.fieldsMeta,
|
26129 | fields = _this6.fields;
|
26130 |
|
26131 | return Object.keys(fieldsMeta).reduce(function (acc, name) {
|
26132 | return (0, _set2['default'])(acc, name, _this6.getValueFromFields(name, fields));
|
26133 | }, {});
|
26134 | };
|
26135 |
|
26136 | this.getFieldsValue = function (names) {
|
26137 | return _this6.getNestedFields(names, _this6.getFieldValue);
|
26138 | };
|
26139 |
|
26140 | this.getFieldValue = function (name) {
|
26141 | var fields = _this6.fields;
|
26142 |
|
26143 | return _this6.getNestedField(name, function (fullName) {
|
26144 | return _this6.getValueFromFields(fullName, fields);
|
26145 | });
|
26146 | };
|
26147 |
|
26148 | this.getFieldsError = function (names) {
|
26149 | return _this6.getNestedFields(names, _this6.getFieldError);
|
26150 | };
|
26151 |
|
26152 | this.getFieldError = function (name) {
|
26153 | return _this6.getNestedField(name, function (fullName) {
|
26154 | return (0, _utils.getErrorStrs)(_this6.getFieldMember(fullName, 'errors'));
|
26155 | });
|
26156 | };
|
26157 |
|
26158 | this.isFieldValidating = function (name) {
|
26159 | return _this6.getFieldMember(name, 'validating');
|
26160 | };
|
26161 |
|
26162 | this.isFieldsValidating = function (ns) {
|
26163 | var names = ns || _this6.getValidFieldsName();
|
26164 | return names.some(function (n) {
|
26165 | return _this6.isFieldValidating(n);
|
26166 | });
|
26167 | };
|
26168 |
|
26169 | this.isFieldTouched = function (name) {
|
26170 | return _this6.getFieldMember(name, 'touched');
|
26171 | };
|
26172 |
|
26173 | this.isFieldsTouched = function (ns) {
|
26174 | var names = ns || _this6.getValidFieldsName();
|
26175 | return names.some(function (n) {
|
26176 | return _this6.isFieldTouched(n);
|
26177 | });
|
26178 | };
|
26179 | };
|
26180 |
|
26181 | function createFieldsStore(fields) {
|
26182 | return new FieldsStore(fields);
|
26183 | }
|
26184 | module.exports = exports['default'];
|
26185 |
|
26186 | }),
|
26187 |
|
26188 | (function(module, exports) {
|
26189 |
|
26190 | "use strict";
|
26191 |
|
26192 | exports.__esModule = true;
|
26193 |
|
26194 | exports.default = function (instance, Constructor) {
|
26195 | if (!(instance instanceof Constructor)) {
|
26196 | throw new TypeError("Cannot call a class as a function");
|
26197 | }
|
26198 | };
|
26199 |
|
26200 | }),
|
26201 |
|
26202 | (function(module, exports, __webpack_require__) {
|
26203 |
|
26204 | "use strict";
|
26205 |
|
26206 | exports.__esModule = true;
|
26207 |
|
26208 | var _defineProperty = __webpack_require__(174);
|
26209 |
|
26210 | var _defineProperty2 = _interopRequireDefault(_defineProperty);
|
26211 |
|
26212 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
26213 |
|
26214 | exports.default = function () {
|
26215 | function defineProperties(target, props) {
|
26216 | for (var i = 0; i < props.length; i++) {
|
26217 | var descriptor = props[i];
|
26218 | descriptor.enumerable = descriptor.enumerable || false;
|
26219 | descriptor.configurable = true;
|
26220 | if ("value" in descriptor) descriptor.writable = true;
|
26221 | (0, _defineProperty2.default)(target, descriptor.key, descriptor);
|
26222 | }
|
26223 | }
|
26224 |
|
26225 | return function (Constructor, protoProps, staticProps) {
|
26226 | if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
26227 | if (staticProps) defineProperties(Constructor, staticProps);
|
26228 | return Constructor;
|
26229 | };
|
26230 | }();
|
26231 |
|
26232 | }),
|
26233 |
|
26234 | (function(module, exports, __webpack_require__) {
|
26235 |
|
26236 | "use strict";
|
26237 |
|
26238 | Object.defineProperty(exports, "__esModule", {
|
26239 | value: true
|
26240 | });
|
26241 |
|
26242 | var _extends2 = __webpack_require__(177);
|
26243 |
|
26244 | var _extends3 = _interopRequireDefault(_extends2);
|
26245 |
|
26246 | var _classCallCheck2 = __webpack_require__(326);
|
26247 |
|
26248 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
26249 |
|
26250 | exports.isFormField = isFormField;
|
26251 | exports["default"] = createFormField;
|
26252 |
|
26253 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
26254 |
|
26255 | var Field = function Field(fields) {
|
26256 | (0, _classCallCheck3["default"])(this, Field);
|
26257 |
|
26258 | (0, _extends3["default"])(this, fields);
|
26259 | };
|
26260 |
|
26261 | function isFormField(obj) {
|
26262 | return obj instanceof Field;
|
26263 | }
|
26264 |
|
26265 | function createFormField(field) {
|
26266 | if (isFormField(field)) {
|
26267 | return field;
|
26268 | }
|
26269 | return new Field(field);
|
26270 | }
|
26271 |
|
26272 | }),
|
26273 |
|
26274 | (function(module, exports, __webpack_require__) {
|
26275 |
|
26276 | 'use strict';
|
26277 |
|
26278 | Object.defineProperty(exports, "__esModule", {
|
26279 | value: true
|
26280 | });
|
26281 |
|
26282 | var _extends2 = __webpack_require__(177);
|
26283 |
|
26284 | var _extends3 = _interopRequireDefault(_extends2);
|
26285 |
|
26286 | exports.argumentContainer = argumentContainer;
|
26287 | exports.identity = identity;
|
26288 | exports.flattenArray = flattenArray;
|
26289 | exports.treeTraverse = treeTraverse;
|
26290 | exports.flattenFields = flattenFields;
|
26291 | exports.normalizeValidateRules = normalizeValidateRules;
|
26292 | exports.getValidateTriggers = getValidateTriggers;
|
26293 | exports.getValueFromEvent = getValueFromEvent;
|
26294 | exports.getErrorStrs = getErrorStrs;
|
26295 | exports.getParams = getParams;
|
26296 | exports.isEmptyObject = isEmptyObject;
|
26297 | exports.hasRules = hasRules;
|
26298 | exports.startsWith = startsWith;
|
26299 |
|
26300 | var _hoistNonReactStatics = __webpack_require__(330);
|
26301 |
|
26302 | var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
|
26303 |
|
26304 | var _warning = __webpack_require__(32);
|
26305 |
|
26306 | var _warning2 = _interopRequireDefault(_warning);
|
26307 |
|
26308 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
26309 |
|
26310 | function getDisplayName(WrappedComponent) {
|
26311 | return WrappedComponent.displayName || WrappedComponent.name || 'WrappedComponent';
|
26312 | }
|
26313 |
|
26314 | function argumentContainer(Container, WrappedComponent) {
|
26315 |
|
26316 | Container.displayName = 'Form(' + getDisplayName(WrappedComponent) + ')';
|
26317 | Container.WrappedComponent = WrappedComponent;
|
26318 | return (0, _hoistNonReactStatics2['default'])(Container, WrappedComponent);
|
26319 | }
|
26320 |
|
26321 | function identity(obj) {
|
26322 | return obj;
|
26323 | }
|
26324 |
|
26325 | function flattenArray(arr) {
|
26326 | return Array.prototype.concat.apply([], arr);
|
26327 | }
|
26328 |
|
26329 | function treeTraverse() {
|
26330 | var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
26331 | var tree = arguments[1];
|
26332 | var isLeafNode = arguments[2];
|
26333 | var errorMessage = arguments[3];
|
26334 | var callback = arguments[4];
|
26335 |
|
26336 | if (isLeafNode(path, tree)) {
|
26337 | callback(path, tree);
|
26338 | } else if (tree === undefined || tree === null) {
|
26339 |
|
26340 | } else if (Array.isArray(tree)) {
|
26341 | tree.forEach(function (subTree, index) {
|
26342 | return treeTraverse(path + '[' + index + ']', subTree, isLeafNode, errorMessage, callback);
|
26343 | });
|
26344 | } else {
|
26345 |
|
26346 | if (typeof tree !== 'object') {
|
26347 | (0, _warning2['default'])(false, errorMessage);
|
26348 | return;
|
26349 | }
|
26350 | Object.keys(tree).forEach(function (subTreeKey) {
|
26351 | var subTree = tree[subTreeKey];
|
26352 | treeTraverse('' + path + (path ? '.' : '') + subTreeKey, subTree, isLeafNode, errorMessage, callback);
|
26353 | });
|
26354 | }
|
26355 | }
|
26356 |
|
26357 | function flattenFields(maybeNestedFields, isLeafNode, errorMessage) {
|
26358 | var fields = {};
|
26359 | treeTraverse(undefined, maybeNestedFields, isLeafNode, errorMessage, function (path, node) {
|
26360 | fields[path] = node;
|
26361 | });
|
26362 | return fields;
|
26363 | }
|
26364 |
|
26365 | function normalizeValidateRules(validate, rules, validateTrigger) {
|
26366 | var validateRules = validate.map(function (item) {
|
26367 | var newItem = (0, _extends3['default'])({}, item, {
|
26368 | trigger: item.trigger || []
|
26369 | });
|
26370 | if (typeof newItem.trigger === 'string') {
|
26371 | newItem.trigger = [newItem.trigger];
|
26372 | }
|
26373 | return newItem;
|
26374 | });
|
26375 | if (rules) {
|
26376 | validateRules.push({
|
26377 | trigger: validateTrigger ? [].concat(validateTrigger) : [],
|
26378 | rules: rules
|
26379 | });
|
26380 | }
|
26381 | return validateRules;
|
26382 | }
|
26383 |
|
26384 | function getValidateTriggers(validateRules) {
|
26385 | return validateRules.filter(function (item) {
|
26386 | return !!item.rules && item.rules.length;
|
26387 | }).map(function (item) {
|
26388 | return item.trigger;
|
26389 | }).reduce(function (pre, curr) {
|
26390 | return pre.concat(curr);
|
26391 | }, []);
|
26392 | }
|
26393 |
|
26394 | function getValueFromEvent(e) {
|
26395 |
|
26396 | if (!e || !e.target) {
|
26397 | return e;
|
26398 | }
|
26399 | var target = e.target;
|
26400 |
|
26401 | return target.type === 'checkbox' ? target.checked : target.value;
|
26402 | }
|
26403 |
|
26404 | function getErrorStrs(errors) {
|
26405 | if (errors) {
|
26406 | return errors.map(function (e) {
|
26407 | if (e && e.message) {
|
26408 | return e.message;
|
26409 | }
|
26410 | return e;
|
26411 | });
|
26412 | }
|
26413 | return errors;
|
26414 | }
|
26415 |
|
26416 | function getParams(ns, opt, cb) {
|
26417 | var names = ns;
|
26418 | var options = opt;
|
26419 | var callback = cb;
|
26420 | if (cb === undefined) {
|
26421 | if (typeof names === 'function') {
|
26422 | callback = names;
|
26423 | options = {};
|
26424 | names = undefined;
|
26425 | } else if (Array.isArray(names)) {
|
26426 | if (typeof options === 'function') {
|
26427 | callback = options;
|
26428 | options = {};
|
26429 | } else {
|
26430 | options = options || {};
|
26431 | }
|
26432 | } else {
|
26433 | callback = options;
|
26434 | options = names || {};
|
26435 | names = undefined;
|
26436 | }
|
26437 | }
|
26438 | return {
|
26439 | names: names,
|
26440 | options: options,
|
26441 | callback: callback
|
26442 | };
|
26443 | }
|
26444 |
|
26445 | function isEmptyObject(obj) {
|
26446 | return Object.keys(obj).length === 0;
|
26447 | }
|
26448 |
|
26449 | function hasRules(validate) {
|
26450 | if (validate) {
|
26451 | return validate.some(function (item) {
|
26452 | return item.rules && item.rules.length;
|
26453 | });
|
26454 | }
|
26455 | return false;
|
26456 | }
|
26457 |
|
26458 | function startsWith(str, prefix) {
|
26459 | return str.lastIndexOf(prefix, 0) === 0;
|
26460 | }
|
26461 |
|
26462 | }),
|
26463 |
|
26464 | (function(module, exports, __webpack_require__) {
|
26465 |
|
26466 | 'use strict';
|
26467 |
|
26468 | |
26469 |
|
26470 |
|
26471 |
|
26472 | var ReactIs = __webpack_require__(331);
|
26473 | var REACT_STATICS = {
|
26474 | childContextTypes: true,
|
26475 | contextType: true,
|
26476 | contextTypes: true,
|
26477 | defaultProps: true,
|
26478 | displayName: true,
|
26479 | getDefaultProps: true,
|
26480 | getDerivedStateFromError: true,
|
26481 | getDerivedStateFromProps: true,
|
26482 | mixins: true,
|
26483 | propTypes: true,
|
26484 | type: true
|
26485 | };
|
26486 |
|
26487 | var KNOWN_STATICS = {
|
26488 | name: true,
|
26489 | length: true,
|
26490 | prototype: true,
|
26491 | caller: true,
|
26492 | callee: true,
|
26493 | arguments: true,
|
26494 | arity: true
|
26495 | };
|
26496 |
|
26497 | var FORWARD_REF_STATICS = {
|
26498 | '$$typeof': true,
|
26499 | render: true,
|
26500 | defaultProps: true,
|
26501 | displayName: true,
|
26502 | propTypes: true
|
26503 | };
|
26504 |
|
26505 | var MEMO_STATICS = {
|
26506 | '$$typeof': true,
|
26507 | compare: true,
|
26508 | defaultProps: true,
|
26509 | displayName: true,
|
26510 | propTypes: true,
|
26511 | type: true
|
26512 | };
|
26513 |
|
26514 | var TYPE_STATICS = {};
|
26515 | TYPE_STATICS[ReactIs.ForwardRef] = FORWARD_REF_STATICS;
|
26516 |
|
26517 | function getStatics(component) {
|
26518 | if (ReactIs.isMemo(component)) {
|
26519 | return MEMO_STATICS;
|
26520 | }
|
26521 | return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
|
26522 | }
|
26523 |
|
26524 | var defineProperty = Object.defineProperty;
|
26525 | var getOwnPropertyNames = Object.getOwnPropertyNames;
|
26526 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
26527 | var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
26528 | var getPrototypeOf = Object.getPrototypeOf;
|
26529 | var objectPrototype = Object.prototype;
|
26530 |
|
26531 | function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
26532 | if (typeof sourceComponent !== 'string') {
|
26533 |
|
26534 |
|
26535 | if (objectPrototype) {
|
26536 | var inheritedComponent = getPrototypeOf(sourceComponent);
|
26537 | if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
26538 | hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
26539 | }
|
26540 | }
|
26541 |
|
26542 | var keys = getOwnPropertyNames(sourceComponent);
|
26543 |
|
26544 | if (getOwnPropertySymbols) {
|
26545 | keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
26546 | }
|
26547 |
|
26548 | var targetStatics = getStatics(targetComponent);
|
26549 | var sourceStatics = getStatics(sourceComponent);
|
26550 |
|
26551 | for (var i = 0; i < keys.length; ++i) {
|
26552 | var key = keys[i];
|
26553 | if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
26554 | var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
26555 | try {
|
26556 |
|
26557 | defineProperty(targetComponent, key, descriptor);
|
26558 | } catch (e) {}
|
26559 | }
|
26560 | }
|
26561 |
|
26562 | return targetComponent;
|
26563 | }
|
26564 |
|
26565 | return targetComponent;
|
26566 | }
|
26567 |
|
26568 | module.exports = hoistNonReactStatics;
|
26569 |
|
26570 |
|
26571 | }),
|
26572 |
|
26573 | (function(module, exports, __webpack_require__) {
|
26574 |
|
26575 | (function(process) {'use strict';
|
26576 |
|
26577 | if (process.env.NODE_ENV === 'production') {
|
26578 | module.exports = __webpack_require__(332);
|
26579 | } else {
|
26580 | module.exports = __webpack_require__(333);
|
26581 | }
|
26582 |
|
26583 | }.call(exports, __webpack_require__(33)))
|
26584 |
|
26585 | }),
|
26586 |
|
26587 | (function(module, exports) {
|
26588 |
|
26589 | |
26590 |
|
26591 |
|
26592 |
|
26593 |
|
26594 |
|
26595 |
|
26596 |
|
26597 |
|
26598 | 'use strict';Object.defineProperty(exports,"__esModule",{value:!0});
|
26599 | 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"):
|
26600 | 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;
|
26601 | 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};
|
26602 | 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};
|
26603 | exports.isSuspense=function(a){return t(a)===p};
|
26604 |
|
26605 |
|
26606 | }),
|
26607 |
|
26608 | (function(module, exports, __webpack_require__) {
|
26609 |
|
26610 | (function(process) { |
26611 |
|
26612 |
|
26613 |
|
26614 |
|
26615 |
|
26616 |
|
26617 |
|
26618 |
|
26619 | 'use strict';
|
26620 |
|
26621 |
|
26622 |
|
26623 | if (process.env.NODE_ENV !== "production") {
|
26624 | (function() {
|
26625 | 'use strict';
|
26626 |
|
26627 | Object.defineProperty(exports, '__esModule', { value: true });
|
26628 |
|
26629 |
|
26630 |
|
26631 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
26632 |
|
26633 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
26634 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
26635 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
26636 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
26637 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
26638 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
26639 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
26640 | var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
26641 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
26642 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
26643 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
26644 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
26645 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
26646 |
|
26647 | function isValidElementType(type) {
|
26648 | return typeof type === 'string' || typeof type === 'function' ||
|
26649 |
|
26650 | 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);
|
26651 | }
|
26652 |
|
26653 | |
26654 |
|
26655 |
|
26656 |
|
26657 |
|
26658 |
|
26659 |
|
26660 |
|
26661 |
|
26662 |
|
26663 |
|
26664 |
|
26665 |
|
26666 |
|
26667 | var lowPriorityWarning = function () {};
|
26668 |
|
26669 | {
|
26670 | var printWarning = function (format) {
|
26671 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
26672 | args[_key - 1] = arguments[_key];
|
26673 | }
|
26674 |
|
26675 | var argIndex = 0;
|
26676 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
26677 | return args[argIndex++];
|
26678 | });
|
26679 | if (typeof console !== 'undefined') {
|
26680 | console.warn(message);
|
26681 | }
|
26682 | try {
|
26683 |
|
26684 |
|
26685 |
|
26686 | throw new Error(message);
|
26687 | } catch (x) {}
|
26688 | };
|
26689 |
|
26690 | lowPriorityWarning = function (condition, format) {
|
26691 | if (format === undefined) {
|
26692 | throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
26693 | }
|
26694 | if (!condition) {
|
26695 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
26696 | args[_key2 - 2] = arguments[_key2];
|
26697 | }
|
26698 |
|
26699 | printWarning.apply(undefined, [format].concat(args));
|
26700 | }
|
26701 | };
|
26702 | }
|
26703 |
|
26704 | var lowPriorityWarning$1 = lowPriorityWarning;
|
26705 |
|
26706 | function typeOf(object) {
|
26707 | if (typeof object === 'object' && object !== null) {
|
26708 | var $$typeof = object.$$typeof;
|
26709 | switch ($$typeof) {
|
26710 | case REACT_ELEMENT_TYPE:
|
26711 | var type = object.type;
|
26712 |
|
26713 | switch (type) {
|
26714 | case REACT_ASYNC_MODE_TYPE:
|
26715 | case REACT_CONCURRENT_MODE_TYPE:
|
26716 | case REACT_FRAGMENT_TYPE:
|
26717 | case REACT_PROFILER_TYPE:
|
26718 | case REACT_STRICT_MODE_TYPE:
|
26719 | case REACT_SUSPENSE_TYPE:
|
26720 | return type;
|
26721 | default:
|
26722 | var $$typeofType = type && type.$$typeof;
|
26723 |
|
26724 | switch ($$typeofType) {
|
26725 | case REACT_CONTEXT_TYPE:
|
26726 | case REACT_FORWARD_REF_TYPE:
|
26727 | case REACT_PROVIDER_TYPE:
|
26728 | return $$typeofType;
|
26729 | default:
|
26730 | return $$typeof;
|
26731 | }
|
26732 | }
|
26733 | case REACT_LAZY_TYPE:
|
26734 | case REACT_MEMO_TYPE:
|
26735 | case REACT_PORTAL_TYPE:
|
26736 | return $$typeof;
|
26737 | }
|
26738 | }
|
26739 |
|
26740 | return undefined;
|
26741 | }
|
26742 |
|
26743 |
|
26744 | var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
26745 | var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
26746 | var ContextConsumer = REACT_CONTEXT_TYPE;
|
26747 | var ContextProvider = REACT_PROVIDER_TYPE;
|
26748 | var Element = REACT_ELEMENT_TYPE;
|
26749 | var ForwardRef = REACT_FORWARD_REF_TYPE;
|
26750 | var Fragment = REACT_FRAGMENT_TYPE;
|
26751 | var Lazy = REACT_LAZY_TYPE;
|
26752 | var Memo = REACT_MEMO_TYPE;
|
26753 | var Portal = REACT_PORTAL_TYPE;
|
26754 | var Profiler = REACT_PROFILER_TYPE;
|
26755 | var StrictMode = REACT_STRICT_MODE_TYPE;
|
26756 | var Suspense = REACT_SUSPENSE_TYPE;
|
26757 |
|
26758 | var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
26759 |
|
26760 |
|
26761 | function isAsyncMode(object) {
|
26762 | {
|
26763 | if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
26764 | hasWarnedAboutDeprecatedIsAsyncMode = true;
|
26765 | 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.');
|
26766 | }
|
26767 | }
|
26768 | return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
26769 | }
|
26770 | function isConcurrentMode(object) {
|
26771 | return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
26772 | }
|
26773 | function isContextConsumer(object) {
|
26774 | return typeOf(object) === REACT_CONTEXT_TYPE;
|
26775 | }
|
26776 | function isContextProvider(object) {
|
26777 | return typeOf(object) === REACT_PROVIDER_TYPE;
|
26778 | }
|
26779 | function isElement(object) {
|
26780 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
26781 | }
|
26782 | function isForwardRef(object) {
|
26783 | return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
26784 | }
|
26785 | function isFragment(object) {
|
26786 | return typeOf(object) === REACT_FRAGMENT_TYPE;
|
26787 | }
|
26788 | function isLazy(object) {
|
26789 | return typeOf(object) === REACT_LAZY_TYPE;
|
26790 | }
|
26791 | function isMemo(object) {
|
26792 | return typeOf(object) === REACT_MEMO_TYPE;
|
26793 | }
|
26794 | function isPortal(object) {
|
26795 | return typeOf(object) === REACT_PORTAL_TYPE;
|
26796 | }
|
26797 | function isProfiler(object) {
|
26798 | return typeOf(object) === REACT_PROFILER_TYPE;
|
26799 | }
|
26800 | function isStrictMode(object) {
|
26801 | return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
26802 | }
|
26803 | function isSuspense(object) {
|
26804 | return typeOf(object) === REACT_SUSPENSE_TYPE;
|
26805 | }
|
26806 |
|
26807 | exports.typeOf = typeOf;
|
26808 | exports.AsyncMode = AsyncMode;
|
26809 | exports.ConcurrentMode = ConcurrentMode;
|
26810 | exports.ContextConsumer = ContextConsumer;
|
26811 | exports.ContextProvider = ContextProvider;
|
26812 | exports.Element = Element;
|
26813 | exports.ForwardRef = ForwardRef;
|
26814 | exports.Fragment = Fragment;
|
26815 | exports.Lazy = Lazy;
|
26816 | exports.Memo = Memo;
|
26817 | exports.Portal = Portal;
|
26818 | exports.Profiler = Profiler;
|
26819 | exports.StrictMode = StrictMode;
|
26820 | exports.Suspense = Suspense;
|
26821 | exports.isValidElementType = isValidElementType;
|
26822 | exports.isAsyncMode = isAsyncMode;
|
26823 | exports.isConcurrentMode = isConcurrentMode;
|
26824 | exports.isContextConsumer = isContextConsumer;
|
26825 | exports.isContextProvider = isContextProvider;
|
26826 | exports.isElement = isElement;
|
26827 | exports.isForwardRef = isForwardRef;
|
26828 | exports.isFragment = isFragment;
|
26829 | exports.isLazy = isLazy;
|
26830 | exports.isMemo = isMemo;
|
26831 | exports.isPortal = isPortal;
|
26832 | exports.isProfiler = isProfiler;
|
26833 | exports.isStrictMode = isStrictMode;
|
26834 | exports.isSuspense = isSuspense;
|
26835 | })();
|
26836 | }
|
26837 |
|
26838 | }.call(exports, __webpack_require__(33)))
|
26839 |
|
26840 | }),
|
26841 |
|
26842 | (function(module, exports, __webpack_require__) {
|
26843 |
|
26844 | 'use strict';
|
26845 |
|
26846 | Object.defineProperty(exports, "__esModule", {
|
26847 | value: true
|
26848 | });
|
26849 |
|
26850 | var _propTypes = __webpack_require__(6);
|
26851 |
|
26852 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
26853 |
|
26854 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
26855 |
|
26856 | var formShape = _propTypes2['default'].shape({
|
26857 | getFieldsValue: _propTypes2['default'].func,
|
26858 | getFieldValue: _propTypes2['default'].func,
|
26859 | getFieldInstance: _propTypes2['default'].func,
|
26860 | setFieldsValue: _propTypes2['default'].func,
|
26861 | setFields: _propTypes2['default'].func,
|
26862 | setFieldsInitialValue: _propTypes2['default'].func,
|
26863 | getFieldDecorator: _propTypes2['default'].func,
|
26864 | getFieldProps: _propTypes2['default'].func,
|
26865 | getFieldsError: _propTypes2['default'].func,
|
26866 | getFieldError: _propTypes2['default'].func,
|
26867 | isFieldValidating: _propTypes2['default'].func,
|
26868 | isFieldsValidating: _propTypes2['default'].func,
|
26869 | isFieldsTouched: _propTypes2['default'].func,
|
26870 | isFieldTouched: _propTypes2['default'].func,
|
26871 | isSubmitting: _propTypes2['default'].func,
|
26872 | submit: _propTypes2['default'].func,
|
26873 | validateFields: _propTypes2['default'].func,
|
26874 | resetFields: _propTypes2['default'].func
|
26875 | });
|
26876 |
|
26877 | exports['default'] = formShape;
|
26878 | module.exports = exports['default'];
|
26879 |
|
26880 | }),
|
26881 |
|
26882 | (function(module, exports, __webpack_require__) {
|
26883 |
|
26884 | 'use strict';
|
26885 |
|
26886 | Object.defineProperty(exports, "__esModule", {
|
26887 | value: true
|
26888 | });
|
26889 |
|
26890 | var _react = __webpack_require__(1);
|
26891 |
|
26892 | var _react2 = _interopRequireDefault(_react);
|
26893 |
|
26894 | var _reactDom = __webpack_require__(2);
|
26895 |
|
26896 | var _reactDom2 = _interopRequireDefault(_reactDom);
|
26897 |
|
26898 | var _propTypes = __webpack_require__(6);
|
26899 |
|
26900 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
26901 |
|
26902 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
26903 |
|
26904 | 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; }
|
26905 |
|
26906 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
26907 |
|
26908 | 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; }
|
26909 |
|
26910 | 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); }
|
26911 |
|
26912 | var propTypes = {
|
26913 | prefixCls: _propTypes2["default"].string
|
26914 | };
|
26915 | var defaultProps = {
|
26916 | prefixCls: 'u-form'
|
26917 | };
|
26918 |
|
26919 | var FormItem = function (_Component) {
|
26920 | _inherits(FormItem, _Component);
|
26921 |
|
26922 | function FormItem(props) {
|
26923 | _classCallCheck(this, FormItem);
|
26924 |
|
26925 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
26926 | }
|
26927 |
|
26928 | FormItem.prototype.render = function render() {
|
26929 | var _props = this.props,
|
26930 | children = _props.children,
|
26931 | _props$className = _props.className,
|
26932 | className = _props$className === undefined ? '' : _props$className,
|
26933 | prefixCls = _props.prefixCls,
|
26934 | style = _props.style;
|
26935 |
|
26936 | return _react2["default"].createElement(
|
26937 | 'div',
|
26938 | { className: prefixCls + '-item' + ' ' + className, style: style },
|
26939 | children
|
26940 | );
|
26941 | };
|
26942 |
|
26943 | return FormItem;
|
26944 | }(_react.Component);
|
26945 |
|
26946 | ;
|
26947 | FormItem.propTypes = propTypes;
|
26948 | FormItem.defaultProps = defaultProps;
|
26949 | exports["default"] = FormItem;
|
26950 | module.exports = exports['default'];
|
26951 |
|
26952 | }),
|
26953 |
|
26954 | (function(module, exports, __webpack_require__) {
|
26955 |
|
26956 | 'use strict';
|
26957 |
|
26958 | Object.defineProperty(exports, "__esModule", {
|
26959 | value: true
|
26960 | });
|
26961 |
|
26962 | var _react = __webpack_require__(1);
|
26963 |
|
26964 | var _react2 = _interopRequireDefault(_react);
|
26965 |
|
26966 | var _src = __webpack_require__(157);
|
26967 |
|
26968 | var _src2 = _interopRequireDefault(_src);
|
26969 |
|
26970 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
26971 |
|
26972 | 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; }
|
26973 |
|
26974 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
26975 |
|
26976 | 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; }
|
26977 |
|
26978 | 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); } |
26979 |
|
26980 |
|
26981 |
|
26982 |
|
26983 | var CheckboxGroup = _src2['default'].CheckboxGroup;
|
26984 |
|
26985 | var plainOptions = ['1', '2', '3', '4', '5'];
|
26986 | var defaultCheckedList = ['2', '3'];
|
26987 |
|
26988 | var Demo7 = function (_Component) {
|
26989 | _inherits(Demo7, _Component);
|
26990 |
|
26991 | function Demo7(props) {
|
26992 | _classCallCheck(this, Demo7);
|
26993 |
|
26994 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
26995 |
|
26996 | _this.onCheckAllChange = function (e) {
|
26997 | console.log(e);
|
26998 | _this.setState({
|
26999 | checkedList: e ? plainOptions : [],
|
27000 | indeterminate: false,
|
27001 | checkAll: e
|
27002 | });
|
27003 | };
|
27004 |
|
27005 | _this.state = {
|
27006 | checkedList: defaultCheckedList,
|
27007 | indeterminate: true,
|
27008 | checkAll: false
|
27009 | };
|
27010 | _this.onChange = _this.onChange.bind(_this);
|
27011 | return _this;
|
27012 | }
|
27013 |
|
27014 | Demo7.prototype.onChange = function onChange(checkedList) {
|
27015 | console.log(checkedList);
|
27016 | this.setState({
|
27017 | checkedList: checkedList,
|
27018 | indeterminate: !!checkedList.length && checkedList.length < plainOptions.length,
|
27019 | checkAll: checkedList.length === plainOptions.length
|
27020 | });
|
27021 | };
|
27022 |
|
27023 | Demo7.prototype.render = function render() {
|
27024 | return _react2['default'].createElement(
|
27025 | 'div',
|
27026 | { className: 'demo-checkbox' },
|
27027 | _react2['default'].createElement(
|
27028 | _src2['default'],
|
27029 | {
|
27030 | ref: 'test',
|
27031 | indeterminate: this.state.indeterminate,
|
27032 | onChange: this.onCheckAllChange,
|
27033 | checked: this.state.checkAll },
|
27034 | '\u5168\u9009'
|
27035 | ),
|
27036 | _react2['default'].createElement('br', null),
|
27037 | _react2['default'].createElement(
|
27038 | CheckboxGroup,
|
27039 | { value: this.state.checkedList, onChange: this.onChange },
|
27040 | _react2['default'].createElement(
|
27041 | _src2['default'],
|
27042 | { value: '1' },
|
27043 | '1'
|
27044 | ),
|
27045 | _react2['default'].createElement(
|
27046 | _src2['default'],
|
27047 | { value: '2' },
|
27048 | '2'
|
27049 | ),
|
27050 | _react2['default'].createElement(
|
27051 | _src2['default'],
|
27052 | { value: '3' },
|
27053 | '3'
|
27054 | ),
|
27055 | _react2['default'].createElement(
|
27056 | _src2['default'],
|
27057 | { value: '4' },
|
27058 | '4'
|
27059 | ),
|
27060 | _react2['default'].createElement(
|
27061 | _src2['default'],
|
27062 | { value: '5' },
|
27063 | '5'
|
27064 | )
|
27065 | )
|
27066 | );
|
27067 | };
|
27068 |
|
27069 | return Demo7;
|
27070 | }(_react.Component);
|
27071 |
|
27072 | exports['default'] = Demo7;
|
27073 | module.exports = exports['default'];
|
27074 |
|
27075 | }),
|
27076 |
|
27077 | (function(module, exports, __webpack_require__) {
|
27078 |
|
27079 | 'use strict';
|
27080 |
|
27081 | Object.defineProperty(exports, "__esModule", {
|
27082 | value: true
|
27083 | });
|
27084 |
|
27085 | var _react = __webpack_require__(1);
|
27086 |
|
27087 | var _react2 = _interopRequireDefault(_react);
|
27088 |
|
27089 | var _src = __webpack_require__(157);
|
27090 |
|
27091 | var _src2 = _interopRequireDefault(_src);
|
27092 |
|
27093 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
27094 |
|
27095 | 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; }
|
27096 |
|
27097 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
27098 |
|
27099 | 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; }
|
27100 |
|
27101 | 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); } |
27102 |
|
27103 |
|
27104 |
|
27105 |
|
27106 | var Demo7 = function (_Component) {
|
27107 | _inherits(Demo7, _Component);
|
27108 |
|
27109 | function Demo7(props) {
|
27110 | _classCallCheck(this, Demo7);
|
27111 |
|
27112 | var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
27113 |
|
27114 | _this.state = {
|
27115 | checkedFlag: false
|
27116 | };
|
27117 | _this.onChange = _this.onChange.bind(_this);
|
27118 | return _this;
|
27119 | }
|
27120 |
|
27121 | Demo7.prototype.onChange = function onChange(e) {
|
27122 | console.log(e);
|
27123 | this.setState({ checkedFlag: e });
|
27124 | };
|
27125 |
|
27126 | Demo7.prototype.render = function render() {
|
27127 | return _react2['default'].createElement(
|
27128 | 'div',
|
27129 | { className: 'demo-checkbox' },
|
27130 | _react2['default'].createElement(
|
27131 | _src2['default'],
|
27132 | {
|
27133 | disabled: true,
|
27134 | inverse: true,
|
27135 | checked: true },
|
27136 | '\u7981\u7528'
|
27137 | ),
|
27138 | _react2['default'].createElement(
|
27139 | _src2['default'],
|
27140 | {
|
27141 | inverse: true,
|
27142 | checked: this.state.checkedFlag,
|
27143 | onChange: this.onChange },
|
27144 | '\u5168\u9009'
|
27145 | ),
|
27146 | _react2['default'].createElement(
|
27147 | _src2['default'],
|
27148 | {
|
27149 | inverse: true,
|
27150 | indeterminate: true },
|
27151 | '\u534A\u9009'
|
27152 | )
|
27153 | );
|
27154 | };
|
27155 |
|
27156 | return Demo7;
|
27157 | }(_react.Component);
|
27158 |
|
27159 | exports['default'] = Demo7;
|
27160 | module.exports = exports['default'];
|
27161 |
|
27162 | })
|
27163 | ]);
|
27164 |
|
\ | No newline at end of file |