diff options
Diffstat (limited to 'examples/common.js')
-rw-r--r-- | examples/common.js | 33053 |
1 files changed, 0 insertions, 33053 deletions
diff --git a/examples/common.js b/examples/common.js deleted file mode 100644 index b019fc1..0000000 --- a/examples/common.js +++ /dev/null | |||
@@ -1,33053 +0,0 @@ | |||
1 | /******/ (function(modules) { // webpackBootstrap | ||
2 | /******/ // install a JSONP callback for chunk loading | ||
3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; | ||
4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { | ||
5 | /******/ // add "moreModules" to the modules object, | ||
6 | /******/ // then flag all "chunkIds" as loaded and fire callback | ||
7 | /******/ var moduleId, chunkId, i = 0, callbacks = []; | ||
8 | /******/ for(;i < chunkIds.length; i++) { | ||
9 | /******/ chunkId = chunkIds[i]; | ||
10 | /******/ if(installedChunks[chunkId]) | ||
11 | /******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); | ||
12 | /******/ installedChunks[chunkId] = 0; | ||
13 | /******/ } | ||
14 | /******/ for(moduleId in moreModules) { | ||
15 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { | ||
16 | /******/ var _m = moreModules[moduleId]; | ||
17 | /******/ | ||
18 | /******/ // Check if module is deduplicated | ||
19 | /******/ switch(typeof _m) { | ||
20 | /******/ case "object": | ||
21 | /******/ // Module can be created from a template | ||
22 | /******/ modules[moduleId] = (function(_m) { | ||
23 | /******/ var args = _m.slice(1), templateId = _m[0]; | ||
24 | /******/ return function (a,b,c) { | ||
25 | /******/ modules[templateId].apply(this, [a,b,c].concat(args)); | ||
26 | /******/ }; | ||
27 | /******/ }(_m)); | ||
28 | /******/ break; | ||
29 | /******/ case "function": | ||
30 | /******/ // Normal module | ||
31 | /******/ modules[moduleId] = _m; | ||
32 | /******/ break; | ||
33 | /******/ default: | ||
34 | /******/ // Module is a copy of another module | ||
35 | /******/ modules[moduleId] = modules[_m]; | ||
36 | /******/ break; | ||
37 | /******/ } | ||
38 | /******/ } | ||
39 | /******/ } | ||
40 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); | ||
41 | /******/ while(callbacks.length) | ||
42 | /******/ callbacks.shift().call(null, __webpack_require__); | ||
43 | /******/ if(moreModules[0]) { | ||
44 | /******/ installedModules[0] = 0; | ||
45 | /******/ return __webpack_require__(0); | ||
46 | /******/ } | ||
47 | /******/ }; | ||
48 | /******/ | ||
49 | /******/ // The module cache | ||
50 | /******/ var installedModules = {}; | ||
51 | /******/ | ||
52 | /******/ // object to store loaded and loading chunks | ||
53 | /******/ // "0" means "already loaded" | ||
54 | /******/ // Array means "loading", array contains callbacks | ||
55 | /******/ var installedChunks = { | ||
56 | /******/ 7:0 | ||
57 | /******/ }; | ||
58 | /******/ | ||
59 | /******/ // The require function | ||
60 | /******/ function __webpack_require__(moduleId) { | ||
61 | /******/ | ||
62 | /******/ // Check if module is in cache | ||
63 | /******/ if(installedModules[moduleId]) | ||
64 | /******/ return installedModules[moduleId].exports; | ||
65 | /******/ | ||
66 | /******/ // Create a new module (and put it into the cache) | ||
67 | /******/ var module = installedModules[moduleId] = { | ||
68 | /******/ exports: {}, | ||
69 | /******/ id: moduleId, | ||
70 | /******/ loaded: false | ||
71 | /******/ }; | ||
72 | /******/ | ||
73 | /******/ // Execute the module function | ||
74 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
75 | /******/ | ||
76 | /******/ // Flag the module as loaded | ||
77 | /******/ module.loaded = true; | ||
78 | /******/ | ||
79 | /******/ // Return the exports of the module | ||
80 | /******/ return module.exports; | ||
81 | /******/ } | ||
82 | /******/ | ||
83 | /******/ // This file contains only the entry chunk. | ||
84 | /******/ // The chunk loading function for additional chunks | ||
85 | /******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { | ||
86 | /******/ // "0" is the signal for "already loaded" | ||
87 | /******/ if(installedChunks[chunkId] === 0) | ||
88 | /******/ return callback.call(null, __webpack_require__); | ||
89 | /******/ | ||
90 | /******/ // an array means "currently loading". | ||
91 | /******/ if(installedChunks[chunkId] !== undefined) { | ||
92 | /******/ installedChunks[chunkId].push(callback); | ||
93 | /******/ } else { | ||
94 | /******/ // start chunk loading | ||
95 | /******/ installedChunks[chunkId] = [callback]; | ||
96 | /******/ var head = document.getElementsByTagName('head')[0]; | ||
97 | /******/ var script = document.createElement('script'); | ||
98 | /******/ script.type = 'text/javascript'; | ||
99 | /******/ script.charset = 'utf-8'; | ||
100 | /******/ script.async = true; | ||
101 | /******/ | ||
102 | /******/ script.src = __webpack_require__.p + "" + chunkId + "." + ({"0":"12hours","1":"disabled","2":"format","3":"hidden","4":"open","5":"pick-time","6":"value-and-defaultValue"}[chunkId]||chunkId) + ".js"; | ||
103 | /******/ head.appendChild(script); | ||
104 | /******/ } | ||
105 | /******/ }; | ||
106 | /******/ | ||
107 | /******/ // expose the modules object (__webpack_modules__) | ||
108 | /******/ __webpack_require__.m = modules; | ||
109 | /******/ | ||
110 | /******/ // expose the module cache | ||
111 | /******/ __webpack_require__.c = installedModules; | ||
112 | /******/ | ||
113 | /******/ // __webpack_public_path__ | ||
114 | /******/ __webpack_require__.p = ""; | ||
115 | /******/ }) | ||
116 | /************************************************************************/ | ||
117 | /******/ ((function(modules) { | ||
118 | // Check all modules for deduplicated modules | ||
119 | for(var i in modules) { | ||
120 | if(Object.prototype.hasOwnProperty.call(modules, i)) { | ||
121 | switch(typeof modules[i]) { | ||
122 | case "function": break; | ||
123 | case "object": | ||
124 | // Module can be created from a template | ||
125 | modules[i] = (function(_m) { | ||
126 | var args = _m.slice(1), fn = modules[_m[0]]; | ||
127 | return function (a,b,c) { | ||
128 | fn.apply(this, [a,b,c].concat(args)); | ||
129 | }; | ||
130 | }(modules[i])); | ||
131 | break; | ||
132 | default: | ||
133 | // Module is a copy of another module | ||
134 | modules[i] = modules[modules[i]]; | ||
135 | break; | ||
136 | } | ||
137 | } | ||
138 | } | ||
139 | return modules; | ||
140 | }([ | ||
141 | /* 0 */, | ||
142 | /* 1 */, | ||
143 | /* 2 */ | ||
144 | /***/ (function(module, exports) { | ||
145 | |||
146 | // removed by extract-text-webpack-plugin | ||
147 | |||
148 | /***/ }), | ||
149 | /* 3 */ | ||
150 | /***/ (function(module, exports, __webpack_require__) { | ||
151 | |||
152 | 'use strict'; | ||
153 | |||
154 | module.exports = __webpack_require__(4); | ||
155 | |||
156 | |||
157 | /***/ }), | ||
158 | /* 4 */ | ||
159 | /***/ (function(module, exports, __webpack_require__) { | ||
160 | |||
161 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
162 | * Copyright 2013-present, Facebook, Inc. | ||
163 | * All rights reserved. | ||
164 | * | ||
165 | * This source code is licensed under the BSD-style license found in the | ||
166 | * LICENSE file in the root directory of this source tree. An additional grant | ||
167 | * of patent rights can be found in the PATENTS file in the same directory. | ||
168 | * | ||
169 | */ | ||
170 | |||
171 | 'use strict'; | ||
172 | |||
173 | var _assign = __webpack_require__(6); | ||
174 | |||
175 | var ReactChildren = __webpack_require__(7); | ||
176 | var ReactComponent = __webpack_require__(20); | ||
177 | var ReactPureComponent = __webpack_require__(23); | ||
178 | var ReactClass = __webpack_require__(24); | ||
179 | var ReactDOMFactories = __webpack_require__(26); | ||
180 | var ReactElement = __webpack_require__(11); | ||
181 | var ReactPropTypes = __webpack_require__(31); | ||
182 | var ReactVersion = __webpack_require__(36); | ||
183 | |||
184 | var onlyChild = __webpack_require__(37); | ||
185 | var warning = __webpack_require__(13); | ||
186 | |||
187 | var createElement = ReactElement.createElement; | ||
188 | var createFactory = ReactElement.createFactory; | ||
189 | var cloneElement = ReactElement.cloneElement; | ||
190 | |||
191 | if (process.env.NODE_ENV !== 'production') { | ||
192 | var canDefineProperty = __webpack_require__(15); | ||
193 | var ReactElementValidator = __webpack_require__(27); | ||
194 | var didWarnPropTypesDeprecated = false; | ||
195 | createElement = ReactElementValidator.createElement; | ||
196 | createFactory = ReactElementValidator.createFactory; | ||
197 | cloneElement = ReactElementValidator.cloneElement; | ||
198 | } | ||
199 | |||
200 | var __spread = _assign; | ||
201 | |||
202 | if (process.env.NODE_ENV !== 'production') { | ||
203 | var warned = false; | ||
204 | __spread = function () { | ||
205 | process.env.NODE_ENV !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0; | ||
206 | warned = true; | ||
207 | return _assign.apply(null, arguments); | ||
208 | }; | ||
209 | } | ||
210 | |||
211 | var React = { | ||
212 | |||
213 | // Modern | ||
214 | |||
215 | Children: { | ||
216 | map: ReactChildren.map, | ||
217 | forEach: ReactChildren.forEach, | ||
218 | count: ReactChildren.count, | ||
219 | toArray: ReactChildren.toArray, | ||
220 | only: onlyChild | ||
221 | }, | ||
222 | |||
223 | Component: ReactComponent, | ||
224 | PureComponent: ReactPureComponent, | ||
225 | |||
226 | createElement: createElement, | ||
227 | cloneElement: cloneElement, | ||
228 | isValidElement: ReactElement.isValidElement, | ||
229 | |||
230 | // Classic | ||
231 | |||
232 | PropTypes: ReactPropTypes, | ||
233 | createClass: ReactClass.createClass, | ||
234 | createFactory: createFactory, | ||
235 | createMixin: function (mixin) { | ||
236 | // Currently a noop. Will be used to validate and trace mixins. | ||
237 | return mixin; | ||
238 | }, | ||
239 | |||
240 | // This looks DOM specific but these are actually isomorphic helpers | ||
241 | // since they are just generating DOM strings. | ||
242 | DOM: ReactDOMFactories, | ||
243 | |||
244 | version: ReactVersion, | ||
245 | |||
246 | // Deprecated hook for JSX spread, don't use this for anything. | ||
247 | __spread: __spread | ||
248 | }; | ||
249 | |||
250 | // TODO: Fix tests so that this deprecation warning doesn't cause failures. | ||
251 | if (process.env.NODE_ENV !== 'production') { | ||
252 | if (canDefineProperty) { | ||
253 | Object.defineProperty(React, 'PropTypes', { | ||
254 | get: function () { | ||
255 | process.env.NODE_ENV !== 'production' ? warning(didWarnPropTypesDeprecated, 'Accessing PropTypes via the main React package is deprecated. Use ' + 'the prop-types package from npm instead.') : void 0; | ||
256 | didWarnPropTypesDeprecated = true; | ||
257 | return ReactPropTypes; | ||
258 | } | ||
259 | }); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | module.exports = React; | ||
264 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
265 | |||
266 | /***/ }), | ||
267 | /* 5 */ | ||
268 | /***/ (function(module, exports) { | ||
269 | |||
270 | // shim for using process in browser | ||
271 | var process = module.exports = {}; | ||
272 | |||
273 | // cached from whatever global is present so that test runners that stub it | ||
274 | // don't break things. But we need to wrap it in a try catch in case it is | ||
275 | // wrapped in strict mode code which doesn't define any globals. It's inside a | ||
276 | // function because try/catches deoptimize in certain engines. | ||
277 | |||
278 | var cachedSetTimeout; | ||
279 | var cachedClearTimeout; | ||
280 | |||
281 | function defaultSetTimout() { | ||
282 | throw new Error('setTimeout has not been defined'); | ||
283 | } | ||
284 | function defaultClearTimeout () { | ||
285 | throw new Error('clearTimeout has not been defined'); | ||
286 | } | ||
287 | (function () { | ||
288 | try { | ||
289 | if (typeof setTimeout === 'function') { | ||
290 | cachedSetTimeout = setTimeout; | ||
291 | } else { | ||
292 | cachedSetTimeout = defaultSetTimout; | ||
293 | } | ||
294 | } catch (e) { | ||
295 | cachedSetTimeout = defaultSetTimout; | ||
296 | } | ||
297 | try { | ||
298 | if (typeof clearTimeout === 'function') { | ||
299 | cachedClearTimeout = clearTimeout; | ||
300 | } else { | ||
301 | cachedClearTimeout = defaultClearTimeout; | ||
302 | } | ||
303 | } catch (e) { | ||
304 | cachedClearTimeout = defaultClearTimeout; | ||
305 | } | ||
306 | } ()) | ||
307 | function runTimeout(fun) { | ||
308 | if (cachedSetTimeout === setTimeout) { | ||
309 | //normal enviroments in sane situations | ||
310 | return setTimeout(fun, 0); | ||
311 | } | ||
312 | // if setTimeout wasn't available but was latter defined | ||
313 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | ||
314 | cachedSetTimeout = setTimeout; | ||
315 | return setTimeout(fun, 0); | ||
316 | } | ||
317 | try { | ||
318 | // when when somebody has screwed with setTimeout but no I.E. maddness | ||
319 | return cachedSetTimeout(fun, 0); | ||
320 | } catch(e){ | ||
321 | try { | ||
322 | // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
323 | return cachedSetTimeout.call(null, fun, 0); | ||
324 | } catch(e){ | ||
325 | // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error | ||
326 | return cachedSetTimeout.call(this, fun, 0); | ||
327 | } | ||
328 | } | ||
329 | |||
330 | |||
331 | } | ||
332 | function runClearTimeout(marker) { | ||
333 | if (cachedClearTimeout === clearTimeout) { | ||
334 | //normal enviroments in sane situations | ||
335 | return clearTimeout(marker); | ||
336 | } | ||
337 | // if clearTimeout wasn't available but was latter defined | ||
338 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | ||
339 | cachedClearTimeout = clearTimeout; | ||
340 | return clearTimeout(marker); | ||
341 | } | ||
342 | try { | ||
343 | // when when somebody has screwed with setTimeout but no I.E. maddness | ||
344 | return cachedClearTimeout(marker); | ||
345 | } catch (e){ | ||
346 | try { | ||
347 | // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
348 | return cachedClearTimeout.call(null, marker); | ||
349 | } catch (e){ | ||
350 | // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. | ||
351 | // Some versions of I.E. have different rules for clearTimeout vs setTimeout | ||
352 | return cachedClearTimeout.call(this, marker); | ||
353 | } | ||
354 | } | ||
355 | |||
356 | |||
357 | |||
358 | } | ||
359 | var queue = []; | ||
360 | var draining = false; | ||
361 | var currentQueue; | ||
362 | var queueIndex = -1; | ||
363 | |||
364 | function cleanUpNextTick() { | ||
365 | if (!draining || !currentQueue) { | ||
366 | return; | ||
367 | } | ||
368 | draining = false; | ||
369 | if (currentQueue.length) { | ||
370 | queue = currentQueue.concat(queue); | ||
371 | } else { | ||
372 | queueIndex = -1; | ||
373 | } | ||
374 | if (queue.length) { | ||
375 | drainQueue(); | ||
376 | } | ||
377 | } | ||
378 | |||
379 | function drainQueue() { | ||
380 | if (draining) { | ||
381 | return; | ||
382 | } | ||
383 | var timeout = runTimeout(cleanUpNextTick); | ||
384 | draining = true; | ||
385 | |||
386 | var len = queue.length; | ||
387 | while(len) { | ||
388 | currentQueue = queue; | ||
389 | queue = []; | ||
390 | while (++queueIndex < len) { | ||
391 | if (currentQueue) { | ||
392 | currentQueue[queueIndex].run(); | ||
393 | } | ||
394 | } | ||
395 | queueIndex = -1; | ||
396 | len = queue.length; | ||
397 | } | ||
398 | currentQueue = null; | ||
399 | draining = false; | ||
400 | runClearTimeout(timeout); | ||
401 | } | ||
402 | |||
403 | process.nextTick = function (fun) { | ||
404 | var args = new Array(arguments.length - 1); | ||
405 | if (arguments.length > 1) { | ||
406 | for (var i = 1; i < arguments.length; i++) { | ||
407 | args[i - 1] = arguments[i]; | ||
408 | } | ||
409 | } | ||
410 | queue.push(new Item(fun, args)); | ||
411 | if (queue.length === 1 && !draining) { | ||
412 | runTimeout(drainQueue); | ||
413 | } | ||
414 | }; | ||
415 | |||
416 | // v8 likes predictible objects | ||
417 | function Item(fun, array) { | ||
418 | this.fun = fun; | ||
419 | this.array = array; | ||
420 | } | ||
421 | Item.prototype.run = function () { | ||
422 | this.fun.apply(null, this.array); | ||
423 | }; | ||
424 | process.title = 'browser'; | ||
425 | process.browser = true; | ||
426 | process.env = {}; | ||
427 | process.argv = []; | ||
428 | process.version = ''; // empty string to avoid regexp issues | ||
429 | process.versions = {}; | ||
430 | |||
431 | function noop() {} | ||
432 | |||
433 | process.on = noop; | ||
434 | process.addListener = noop; | ||
435 | process.once = noop; | ||
436 | process.off = noop; | ||
437 | process.removeListener = noop; | ||
438 | process.removeAllListeners = noop; | ||
439 | process.emit = noop; | ||
440 | |||
441 | process.binding = function (name) { | ||
442 | throw new Error('process.binding is not supported'); | ||
443 | }; | ||
444 | |||
445 | process.cwd = function () { return '/' }; | ||
446 | process.chdir = function (dir) { | ||
447 | throw new Error('process.chdir is not supported'); | ||
448 | }; | ||
449 | process.umask = function() { return 0; }; | ||
450 | |||
451 | |||
452 | /***/ }), | ||
453 | /* 6 */ | ||
454 | /***/ (function(module, exports) { | ||
455 | |||
456 | /* | ||
457 | object-assign | ||
458 | (c) Sindre Sorhus | ||
459 | @license MIT | ||
460 | */ | ||
461 | |||
462 | 'use strict'; | ||
463 | /* eslint-disable no-unused-vars */ | ||
464 | var getOwnPropertySymbols = Object.getOwnPropertySymbols; | ||
465 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
466 | var propIsEnumerable = Object.prototype.propertyIsEnumerable; | ||
467 | |||
468 | function toObject(val) { | ||
469 | if (val === null || val === undefined) { | ||
470 | throw new TypeError('Object.assign cannot be called with null or undefined'); | ||
471 | } | ||
472 | |||
473 | return Object(val); | ||
474 | } | ||
475 | |||
476 | function shouldUseNative() { | ||
477 | try { | ||
478 | if (!Object.assign) { | ||
479 | return false; | ||
480 | } | ||
481 | |||
482 | // Detect buggy property enumeration order in older V8 versions. | ||
483 | |||
484 | // https://bugs.chromium.org/p/v8/issues/detail?id=4118 | ||
485 | var test1 = new String('abc'); // eslint-disable-line no-new-wrappers | ||
486 | test1[5] = 'de'; | ||
487 | if (Object.getOwnPropertyNames(test1)[0] === '5') { | ||
488 | return false; | ||
489 | } | ||
490 | |||
491 | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 | ||
492 | var test2 = {}; | ||
493 | for (var i = 0; i < 10; i++) { | ||
494 | test2['_' + String.fromCharCode(i)] = i; | ||
495 | } | ||
496 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) { | ||
497 | return test2[n]; | ||
498 | }); | ||
499 | if (order2.join('') !== '0123456789') { | ||
500 | return false; | ||
501 | } | ||
502 | |||
503 | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 | ||
504 | var test3 = {}; | ||
505 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { | ||
506 | test3[letter] = letter; | ||
507 | }); | ||
508 | if (Object.keys(Object.assign({}, test3)).join('') !== | ||
509 | 'abcdefghijklmnopqrst') { | ||
510 | return false; | ||
511 | } | ||
512 | |||
513 | return true; | ||
514 | } catch (err) { | ||
515 | // We don't expect any of the above to throw, but better to be safe. | ||
516 | return false; | ||
517 | } | ||
518 | } | ||
519 | |||
520 | module.exports = shouldUseNative() ? Object.assign : function (target, source) { | ||
521 | var from; | ||
522 | var to = toObject(target); | ||
523 | var symbols; | ||
524 | |||
525 | for (var s = 1; s < arguments.length; s++) { | ||
526 | from = Object(arguments[s]); | ||
527 | |||
528 | for (var key in from) { | ||
529 | if (hasOwnProperty.call(from, key)) { | ||
530 | to[key] = from[key]; | ||
531 | } | ||
532 | } | ||
533 | |||
534 | if (getOwnPropertySymbols) { | ||
535 | symbols = getOwnPropertySymbols(from); | ||
536 | for (var i = 0; i < symbols.length; i++) { | ||
537 | if (propIsEnumerable.call(from, symbols[i])) { | ||
538 | to[symbols[i]] = from[symbols[i]]; | ||
539 | } | ||
540 | } | ||
541 | } | ||
542 | } | ||
543 | |||
544 | return to; | ||
545 | }; | ||
546 | |||
547 | |||
548 | /***/ }), | ||
549 | /* 7 */ | ||
550 | /***/ (function(module, exports, __webpack_require__) { | ||
551 | |||
552 | /** | ||
553 | * Copyright 2013-present, Facebook, Inc. | ||
554 | * All rights reserved. | ||
555 | * | ||
556 | * This source code is licensed under the BSD-style license found in the | ||
557 | * LICENSE file in the root directory of this source tree. An additional grant | ||
558 | * of patent rights can be found in the PATENTS file in the same directory. | ||
559 | * | ||
560 | */ | ||
561 | |||
562 | 'use strict'; | ||
563 | |||
564 | var PooledClass = __webpack_require__(8); | ||
565 | var ReactElement = __webpack_require__(11); | ||
566 | |||
567 | var emptyFunction = __webpack_require__(14); | ||
568 | var traverseAllChildren = __webpack_require__(17); | ||
569 | |||
570 | var twoArgumentPooler = PooledClass.twoArgumentPooler; | ||
571 | var fourArgumentPooler = PooledClass.fourArgumentPooler; | ||
572 | |||
573 | var userProvidedKeyEscapeRegex = /\/+/g; | ||
574 | function escapeUserProvidedKey(text) { | ||
575 | return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/'); | ||
576 | } | ||
577 | |||
578 | /** | ||
579 | * PooledClass representing the bookkeeping associated with performing a child | ||
580 | * traversal. Allows avoiding binding callbacks. | ||
581 | * | ||
582 | * @constructor ForEachBookKeeping | ||
583 | * @param {!function} forEachFunction Function to perform traversal with. | ||
584 | * @param {?*} forEachContext Context to perform context with. | ||
585 | */ | ||
586 | function ForEachBookKeeping(forEachFunction, forEachContext) { | ||
587 | this.func = forEachFunction; | ||
588 | this.context = forEachContext; | ||
589 | this.count = 0; | ||
590 | } | ||
591 | ForEachBookKeeping.prototype.destructor = function () { | ||
592 | this.func = null; | ||
593 | this.context = null; | ||
594 | this.count = 0; | ||
595 | }; | ||
596 | PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler); | ||
597 | |||
598 | function forEachSingleChild(bookKeeping, child, name) { | ||
599 | var func = bookKeeping.func, | ||
600 | context = bookKeeping.context; | ||
601 | |||
602 | func.call(context, child, bookKeeping.count++); | ||
603 | } | ||
604 | |||
605 | /** | ||
606 | * Iterates through children that are typically specified as `props.children`. | ||
607 | * | ||
608 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach | ||
609 | * | ||
610 | * The provided forEachFunc(child, index) will be called for each | ||
611 | * leaf child. | ||
612 | * | ||
613 | * @param {?*} children Children tree container. | ||
614 | * @param {function(*, int)} forEachFunc | ||
615 | * @param {*} forEachContext Context for forEachContext. | ||
616 | */ | ||
617 | function forEachChildren(children, forEachFunc, forEachContext) { | ||
618 | if (children == null) { | ||
619 | return children; | ||
620 | } | ||
621 | var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext); | ||
622 | traverseAllChildren(children, forEachSingleChild, traverseContext); | ||
623 | ForEachBookKeeping.release(traverseContext); | ||
624 | } | ||
625 | |||
626 | /** | ||
627 | * PooledClass representing the bookkeeping associated with performing a child | ||
628 | * mapping. Allows avoiding binding callbacks. | ||
629 | * | ||
630 | * @constructor MapBookKeeping | ||
631 | * @param {!*} mapResult Object containing the ordered map of results. | ||
632 | * @param {!function} mapFunction Function to perform mapping with. | ||
633 | * @param {?*} mapContext Context to perform mapping with. | ||
634 | */ | ||
635 | function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) { | ||
636 | this.result = mapResult; | ||
637 | this.keyPrefix = keyPrefix; | ||
638 | this.func = mapFunction; | ||
639 | this.context = mapContext; | ||
640 | this.count = 0; | ||
641 | } | ||
642 | MapBookKeeping.prototype.destructor = function () { | ||
643 | this.result = null; | ||
644 | this.keyPrefix = null; | ||
645 | this.func = null; | ||
646 | this.context = null; | ||
647 | this.count = 0; | ||
648 | }; | ||
649 | PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler); | ||
650 | |||
651 | function mapSingleChildIntoContext(bookKeeping, child, childKey) { | ||
652 | var result = bookKeeping.result, | ||
653 | keyPrefix = bookKeeping.keyPrefix, | ||
654 | func = bookKeeping.func, | ||
655 | context = bookKeeping.context; | ||
656 | |||
657 | |||
658 | var mappedChild = func.call(context, child, bookKeeping.count++); | ||
659 | if (Array.isArray(mappedChild)) { | ||
660 | mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument); | ||
661 | } else if (mappedChild != null) { | ||
662 | if (ReactElement.isValidElement(mappedChild)) { | ||
663 | mappedChild = ReactElement.cloneAndReplaceKey(mappedChild, | ||
664 | // Keep both the (mapped) and old keys if they differ, just as | ||
665 | // traverseAllChildren used to do for objects as children | ||
666 | keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey); | ||
667 | } | ||
668 | result.push(mappedChild); | ||
669 | } | ||
670 | } | ||
671 | |||
672 | function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { | ||
673 | var escapedPrefix = ''; | ||
674 | if (prefix != null) { | ||
675 | escapedPrefix = escapeUserProvidedKey(prefix) + '/'; | ||
676 | } | ||
677 | var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context); | ||
678 | traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); | ||
679 | MapBookKeeping.release(traverseContext); | ||
680 | } | ||
681 | |||
682 | /** | ||
683 | * Maps children that are typically specified as `props.children`. | ||
684 | * | ||
685 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map | ||
686 | * | ||
687 | * The provided mapFunction(child, key, index) will be called for each | ||
688 | * leaf child. | ||
689 | * | ||
690 | * @param {?*} children Children tree container. | ||
691 | * @param {function(*, int)} func The map function. | ||
692 | * @param {*} context Context for mapFunction. | ||
693 | * @return {object} Object containing the ordered map of results. | ||
694 | */ | ||
695 | function mapChildren(children, func, context) { | ||
696 | if (children == null) { | ||
697 | return children; | ||
698 | } | ||
699 | var result = []; | ||
700 | mapIntoWithKeyPrefixInternal(children, result, null, func, context); | ||
701 | return result; | ||
702 | } | ||
703 | |||
704 | function forEachSingleChildDummy(traverseContext, child, name) { | ||
705 | return null; | ||
706 | } | ||
707 | |||
708 | /** | ||
709 | * Count the number of children that are typically specified as | ||
710 | * `props.children`. | ||
711 | * | ||
712 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count | ||
713 | * | ||
714 | * @param {?*} children Children tree container. | ||
715 | * @return {number} The number of children. | ||
716 | */ | ||
717 | function countChildren(children, context) { | ||
718 | return traverseAllChildren(children, forEachSingleChildDummy, null); | ||
719 | } | ||
720 | |||
721 | /** | ||
722 | * Flatten a children object (typically specified as `props.children`) and | ||
723 | * return an array with appropriately re-keyed children. | ||
724 | * | ||
725 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray | ||
726 | */ | ||
727 | function toArray(children) { | ||
728 | var result = []; | ||
729 | mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); | ||
730 | return result; | ||
731 | } | ||
732 | |||
733 | var ReactChildren = { | ||
734 | forEach: forEachChildren, | ||
735 | map: mapChildren, | ||
736 | mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal, | ||
737 | count: countChildren, | ||
738 | toArray: toArray | ||
739 | }; | ||
740 | |||
741 | module.exports = ReactChildren; | ||
742 | |||
743 | /***/ }), | ||
744 | /* 8 */ | ||
745 | [323, 9], | ||
746 | /* 9 */ | ||
747 | /***/ (function(module, exports) { | ||
748 | |||
749 | /** | ||
750 | * Copyright (c) 2013-present, Facebook, Inc. | ||
751 | * All rights reserved. | ||
752 | * | ||
753 | * This source code is licensed under the BSD-style license found in the | ||
754 | * LICENSE file in the root directory of this source tree. An additional grant | ||
755 | * of patent rights can be found in the PATENTS file in the same directory. | ||
756 | * | ||
757 | * | ||
758 | */ | ||
759 | 'use strict'; | ||
760 | |||
761 | /** | ||
762 | * WARNING: DO NOT manually require this module. | ||
763 | * This is a replacement for `invariant(...)` used by the error code system | ||
764 | * and will _only_ be required by the corresponding babel pass. | ||
765 | * It always throws. | ||
766 | */ | ||
767 | |||
768 | function reactProdInvariant(code) { | ||
769 | var argCount = arguments.length - 1; | ||
770 | |||
771 | var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; | ||
772 | |||
773 | for (var argIdx = 0; argIdx < argCount; argIdx++) { | ||
774 | message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); | ||
775 | } | ||
776 | |||
777 | message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; | ||
778 | |||
779 | var error = new Error(message); | ||
780 | error.name = 'Invariant Violation'; | ||
781 | error.framesToPop = 1; // we don't care about reactProdInvariant's own frame | ||
782 | |||
783 | throw error; | ||
784 | } | ||
785 | |||
786 | module.exports = reactProdInvariant; | ||
787 | |||
788 | /***/ }), | ||
789 | /* 10 */ | ||
790 | /***/ (function(module, exports, __webpack_require__) { | ||
791 | |||
792 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
793 | * Copyright (c) 2013-present, Facebook, Inc. | ||
794 | * All rights reserved. | ||
795 | * | ||
796 | * This source code is licensed under the BSD-style license found in the | ||
797 | * LICENSE file in the root directory of this source tree. An additional grant | ||
798 | * of patent rights can be found in the PATENTS file in the same directory. | ||
799 | * | ||
800 | */ | ||
801 | |||
802 | 'use strict'; | ||
803 | |||
804 | /** | ||
805 | * Use invariant() to assert state which your program assumes to be true. | ||
806 | * | ||
807 | * Provide sprintf-style format (only %s is supported) and arguments | ||
808 | * to provide information about what broke and what you were | ||
809 | * expecting. | ||
810 | * | ||
811 | * The invariant message will be stripped in production, but the invariant | ||
812 | * will remain to ensure logic does not differ in production. | ||
813 | */ | ||
814 | |||
815 | var validateFormat = function validateFormat(format) {}; | ||
816 | |||
817 | if (process.env.NODE_ENV !== 'production') { | ||
818 | validateFormat = function validateFormat(format) { | ||
819 | if (format === undefined) { | ||
820 | throw new Error('invariant requires an error message argument'); | ||
821 | } | ||
822 | }; | ||
823 | } | ||
824 | |||
825 | function invariant(condition, format, a, b, c, d, e, f) { | ||
826 | validateFormat(format); | ||
827 | |||
828 | if (!condition) { | ||
829 | var error; | ||
830 | if (format === undefined) { | ||
831 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); | ||
832 | } else { | ||
833 | var args = [a, b, c, d, e, f]; | ||
834 | var argIndex = 0; | ||
835 | error = new Error(format.replace(/%s/g, function () { | ||
836 | return args[argIndex++]; | ||
837 | })); | ||
838 | error.name = 'Invariant Violation'; | ||
839 | } | ||
840 | |||
841 | error.framesToPop = 1; // we don't care about invariant's own frame | ||
842 | throw error; | ||
843 | } | ||
844 | } | ||
845 | |||
846 | module.exports = invariant; | ||
847 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
848 | |||
849 | /***/ }), | ||
850 | /* 11 */ | ||
851 | /***/ (function(module, exports, __webpack_require__) { | ||
852 | |||
853 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
854 | * Copyright 2014-present, Facebook, Inc. | ||
855 | * All rights reserved. | ||
856 | * | ||
857 | * This source code is licensed under the BSD-style license found in the | ||
858 | * LICENSE file in the root directory of this source tree. An additional grant | ||
859 | * of patent rights can be found in the PATENTS file in the same directory. | ||
860 | * | ||
861 | */ | ||
862 | |||
863 | 'use strict'; | ||
864 | |||
865 | var _assign = __webpack_require__(6); | ||
866 | |||
867 | var ReactCurrentOwner = __webpack_require__(12); | ||
868 | |||
869 | var warning = __webpack_require__(13); | ||
870 | var canDefineProperty = __webpack_require__(15); | ||
871 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
872 | |||
873 | var REACT_ELEMENT_TYPE = __webpack_require__(16); | ||
874 | |||
875 | var RESERVED_PROPS = { | ||
876 | key: true, | ||
877 | ref: true, | ||
878 | __self: true, | ||
879 | __source: true | ||
880 | }; | ||
881 | |||
882 | var specialPropKeyWarningShown, specialPropRefWarningShown; | ||
883 | |||
884 | function hasValidRef(config) { | ||
885 | if (process.env.NODE_ENV !== 'production') { | ||
886 | if (hasOwnProperty.call(config, 'ref')) { | ||
887 | var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; | ||
888 | if (getter && getter.isReactWarning) { | ||
889 | return false; | ||
890 | } | ||
891 | } | ||
892 | } | ||
893 | return config.ref !== undefined; | ||
894 | } | ||
895 | |||
896 | function hasValidKey(config) { | ||
897 | if (process.env.NODE_ENV !== 'production') { | ||
898 | if (hasOwnProperty.call(config, 'key')) { | ||
899 | var getter = Object.getOwnPropertyDescriptor(config, 'key').get; | ||
900 | if (getter && getter.isReactWarning) { | ||
901 | return false; | ||
902 | } | ||
903 | } | ||
904 | } | ||
905 | return config.key !== undefined; | ||
906 | } | ||
907 | |||
908 | function defineKeyPropWarningGetter(props, displayName) { | ||
909 | var warnAboutAccessingKey = function () { | ||
910 | if (!specialPropKeyWarningShown) { | ||
911 | specialPropKeyWarningShown = true; | ||
912 | process.env.NODE_ENV !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; | ||
913 | } | ||
914 | }; | ||
915 | warnAboutAccessingKey.isReactWarning = true; | ||
916 | Object.defineProperty(props, 'key', { | ||
917 | get: warnAboutAccessingKey, | ||
918 | configurable: true | ||
919 | }); | ||
920 | } | ||
921 | |||
922 | function defineRefPropWarningGetter(props, displayName) { | ||
923 | var warnAboutAccessingRef = function () { | ||
924 | if (!specialPropRefWarningShown) { | ||
925 | specialPropRefWarningShown = true; | ||
926 | process.env.NODE_ENV !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; | ||
927 | } | ||
928 | }; | ||
929 | warnAboutAccessingRef.isReactWarning = true; | ||
930 | Object.defineProperty(props, 'ref', { | ||
931 | get: warnAboutAccessingRef, | ||
932 | configurable: true | ||
933 | }); | ||
934 | } | ||
935 | |||
936 | /** | ||
937 | * Factory method to create a new React element. This no longer adheres to | ||
938 | * the class pattern, so do not use new to call it. Also, no instanceof check | ||
939 | * will work. Instead test $$typeof field against Symbol.for('react.element') to check | ||
940 | * if something is a React Element. | ||
941 | * | ||
942 | * @param {*} type | ||
943 | * @param {*} key | ||
944 | * @param {string|object} ref | ||
945 | * @param {*} self A *temporary* helper to detect places where `this` is | ||
946 | * different from the `owner` when React.createElement is called, so that we | ||
947 | * can warn. We want to get rid of owner and replace string `ref`s with arrow | ||
948 | * functions, and as long as `this` and owner are the same, there will be no | ||
949 | * change in behavior. | ||
950 | * @param {*} source An annotation object (added by a transpiler or otherwise) | ||
951 | * indicating filename, line number, and/or other information. | ||
952 | * @param {*} owner | ||
953 | * @param {*} props | ||
954 | * @internal | ||
955 | */ | ||
956 | var ReactElement = function (type, key, ref, self, source, owner, props) { | ||
957 | var element = { | ||
958 | // This tag allow us to uniquely identify this as a React Element | ||
959 | $$typeof: REACT_ELEMENT_TYPE, | ||
960 | |||
961 | // Built-in properties that belong on the element | ||
962 | type: type, | ||
963 | key: key, | ||
964 | ref: ref, | ||
965 | props: props, | ||
966 | |||
967 | // Record the component responsible for creating this element. | ||
968 | _owner: owner | ||
969 | }; | ||
970 | |||
971 | if (process.env.NODE_ENV !== 'production') { | ||
972 | // The validation flag is currently mutative. We put it on | ||
973 | // an external backing store so that we can freeze the whole object. | ||
974 | // This can be replaced with a WeakMap once they are implemented in | ||
975 | // commonly used development environments. | ||
976 | element._store = {}; | ||
977 | |||
978 | // To make comparing ReactElements easier for testing purposes, we make | ||
979 | // the validation flag non-enumerable (where possible, which should | ||
980 | // include every environment we run tests in), so the test framework | ||
981 | // ignores it. | ||
982 | if (canDefineProperty) { | ||
983 | Object.defineProperty(element._store, 'validated', { | ||
984 | configurable: false, | ||
985 | enumerable: false, | ||
986 | writable: true, | ||
987 | value: false | ||
988 | }); | ||
989 | // self and source are DEV only properties. | ||
990 | Object.defineProperty(element, '_self', { | ||
991 | configurable: false, | ||
992 | enumerable: false, | ||
993 | writable: false, | ||
994 | value: self | ||
995 | }); | ||
996 | // Two elements created in two different places should be considered | ||
997 | // equal for testing purposes and therefore we hide it from enumeration. | ||
998 | Object.defineProperty(element, '_source', { | ||
999 | configurable: false, | ||
1000 | enumerable: false, | ||
1001 | writable: false, | ||
1002 | value: source | ||
1003 | }); | ||
1004 | } else { | ||
1005 | element._store.validated = false; | ||
1006 | element._self = self; | ||
1007 | element._source = source; | ||
1008 | } | ||
1009 | if (Object.freeze) { | ||
1010 | Object.freeze(element.props); | ||
1011 | Object.freeze(element); | ||
1012 | } | ||
1013 | } | ||
1014 | |||
1015 | return element; | ||
1016 | }; | ||
1017 | |||
1018 | /** | ||
1019 | * Create and return a new ReactElement of the given type. | ||
1020 | * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement | ||
1021 | */ | ||
1022 | ReactElement.createElement = function (type, config, children) { | ||
1023 | var propName; | ||
1024 | |||
1025 | // Reserved names are extracted | ||
1026 | var props = {}; | ||
1027 | |||
1028 | var key = null; | ||
1029 | var ref = null; | ||
1030 | var self = null; | ||
1031 | var source = null; | ||
1032 | |||
1033 | if (config != null) { | ||
1034 | if (hasValidRef(config)) { | ||
1035 | ref = config.ref; | ||
1036 | } | ||
1037 | if (hasValidKey(config)) { | ||
1038 | key = '' + config.key; | ||
1039 | } | ||
1040 | |||
1041 | self = config.__self === undefined ? null : config.__self; | ||
1042 | source = config.__source === undefined ? null : config.__source; | ||
1043 | // Remaining properties are added to a new props object | ||
1044 | for (propName in config) { | ||
1045 | if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | ||
1046 | props[propName] = config[propName]; | ||
1047 | } | ||
1048 | } | ||
1049 | } | ||
1050 | |||
1051 | // Children can be more than one argument, and those are transferred onto | ||
1052 | // the newly allocated props object. | ||
1053 | var childrenLength = arguments.length - 2; | ||
1054 | if (childrenLength === 1) { | ||
1055 | props.children = children; | ||
1056 | } else if (childrenLength > 1) { | ||
1057 | var childArray = Array(childrenLength); | ||
1058 | for (var i = 0; i < childrenLength; i++) { | ||
1059 | childArray[i] = arguments[i + 2]; | ||
1060 | } | ||
1061 | if (process.env.NODE_ENV !== 'production') { | ||
1062 | if (Object.freeze) { | ||
1063 | Object.freeze(childArray); | ||
1064 | } | ||
1065 | } | ||
1066 | props.children = childArray; | ||
1067 | } | ||
1068 | |||
1069 | // Resolve default props | ||
1070 | if (type && type.defaultProps) { | ||
1071 | var defaultProps = type.defaultProps; | ||
1072 | for (propName in defaultProps) { | ||
1073 | if (props[propName] === undefined) { | ||
1074 | props[propName] = defaultProps[propName]; | ||
1075 | } | ||
1076 | } | ||
1077 | } | ||
1078 | if (process.env.NODE_ENV !== 'production') { | ||
1079 | if (key || ref) { | ||
1080 | if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { | ||
1081 | var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; | ||
1082 | if (key) { | ||
1083 | defineKeyPropWarningGetter(props, displayName); | ||
1084 | } | ||
1085 | if (ref) { | ||
1086 | defineRefPropWarningGetter(props, displayName); | ||
1087 | } | ||
1088 | } | ||
1089 | } | ||
1090 | } | ||
1091 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); | ||
1092 | }; | ||
1093 | |||
1094 | /** | ||
1095 | * Return a function that produces ReactElements of a given type. | ||
1096 | * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory | ||
1097 | */ | ||
1098 | ReactElement.createFactory = function (type) { | ||
1099 | var factory = ReactElement.createElement.bind(null, type); | ||
1100 | // Expose the type on the factory and the prototype so that it can be | ||
1101 | // easily accessed on elements. E.g. `<Foo />.type === Foo`. | ||
1102 | // This should not be named `constructor` since this may not be the function | ||
1103 | // that created the element, and it may not even be a constructor. | ||
1104 | // Legacy hook TODO: Warn if this is accessed | ||
1105 | factory.type = type; | ||
1106 | return factory; | ||
1107 | }; | ||
1108 | |||
1109 | ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { | ||
1110 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); | ||
1111 | |||
1112 | return newElement; | ||
1113 | }; | ||
1114 | |||
1115 | /** | ||
1116 | * Clone and return a new ReactElement using element as the starting point. | ||
1117 | * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement | ||
1118 | */ | ||
1119 | ReactElement.cloneElement = function (element, config, children) { | ||
1120 | var propName; | ||
1121 | |||
1122 | // Original props are copied | ||
1123 | var props = _assign({}, element.props); | ||
1124 | |||
1125 | // Reserved names are extracted | ||
1126 | var key = element.key; | ||
1127 | var ref = element.ref; | ||
1128 | // Self is preserved since the owner is preserved. | ||
1129 | var self = element._self; | ||
1130 | // Source is preserved since cloneElement is unlikely to be targeted by a | ||
1131 | // transpiler, and the original source is probably a better indicator of the | ||
1132 | // true owner. | ||
1133 | var source = element._source; | ||
1134 | |||
1135 | // Owner will be preserved, unless ref is overridden | ||
1136 | var owner = element._owner; | ||
1137 | |||
1138 | if (config != null) { | ||
1139 | if (hasValidRef(config)) { | ||
1140 | // Silently steal the ref from the parent. | ||
1141 | ref = config.ref; | ||
1142 | owner = ReactCurrentOwner.current; | ||
1143 | } | ||
1144 | if (hasValidKey(config)) { | ||
1145 | key = '' + config.key; | ||
1146 | } | ||
1147 | |||
1148 | // Remaining properties override existing props | ||
1149 | var defaultProps; | ||
1150 | if (element.type && element.type.defaultProps) { | ||
1151 | defaultProps = element.type.defaultProps; | ||
1152 | } | ||
1153 | for (propName in config) { | ||
1154 | if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | ||
1155 | if (config[propName] === undefined && defaultProps !== undefined) { | ||
1156 | // Resolve default props | ||
1157 | props[propName] = defaultProps[propName]; | ||
1158 | } else { | ||
1159 | props[propName] = config[propName]; | ||
1160 | } | ||
1161 | } | ||
1162 | } | ||
1163 | } | ||
1164 | |||
1165 | // Children can be more than one argument, and those are transferred onto | ||
1166 | // the newly allocated props object. | ||
1167 | var childrenLength = arguments.length - 2; | ||
1168 | if (childrenLength === 1) { | ||
1169 | props.children = children; | ||
1170 | } else if (childrenLength > 1) { | ||
1171 | var childArray = Array(childrenLength); | ||
1172 | for (var i = 0; i < childrenLength; i++) { | ||
1173 | childArray[i] = arguments[i + 2]; | ||
1174 | } | ||
1175 | props.children = childArray; | ||
1176 | } | ||
1177 | |||
1178 | return ReactElement(element.type, key, ref, self, source, owner, props); | ||
1179 | }; | ||
1180 | |||
1181 | /** | ||
1182 | * Verifies the object is a ReactElement. | ||
1183 | * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement | ||
1184 | * @param {?object} object | ||
1185 | * @return {boolean} True if `object` is a valid component. | ||
1186 | * @final | ||
1187 | */ | ||
1188 | ReactElement.isValidElement = function (object) { | ||
1189 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | ||
1190 | }; | ||
1191 | |||
1192 | module.exports = ReactElement; | ||
1193 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1194 | |||
1195 | /***/ }), | ||
1196 | /* 12 */ | ||
1197 | /***/ (function(module, exports) { | ||
1198 | |||
1199 | /** | ||
1200 | * Copyright 2013-present, Facebook, Inc. | ||
1201 | * All rights reserved. | ||
1202 | * | ||
1203 | * This source code is licensed under the BSD-style license found in the | ||
1204 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1205 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1206 | * | ||
1207 | * | ||
1208 | */ | ||
1209 | |||
1210 | 'use strict'; | ||
1211 | |||
1212 | /** | ||
1213 | * Keeps track of the current owner. | ||
1214 | * | ||
1215 | * The current owner is the component who should own any components that are | ||
1216 | * currently being constructed. | ||
1217 | */ | ||
1218 | var ReactCurrentOwner = { | ||
1219 | |||
1220 | /** | ||
1221 | * @internal | ||
1222 | * @type {ReactComponent} | ||
1223 | */ | ||
1224 | current: null | ||
1225 | |||
1226 | }; | ||
1227 | |||
1228 | module.exports = ReactCurrentOwner; | ||
1229 | |||
1230 | /***/ }), | ||
1231 | /* 13 */ | ||
1232 | /***/ (function(module, exports, __webpack_require__) { | ||
1233 | |||
1234 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1235 | * Copyright 2014-2015, Facebook, Inc. | ||
1236 | * All rights reserved. | ||
1237 | * | ||
1238 | * This source code is licensed under the BSD-style license found in the | ||
1239 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1240 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1241 | * | ||
1242 | */ | ||
1243 | |||
1244 | 'use strict'; | ||
1245 | |||
1246 | var emptyFunction = __webpack_require__(14); | ||
1247 | |||
1248 | /** | ||
1249 | * Similar to invariant but only logs a warning if the condition is not met. | ||
1250 | * This can be used to log issues in development environments in critical | ||
1251 | * paths. Removing the logging code for production environments will keep the | ||
1252 | * same logic and follow the same code paths. | ||
1253 | */ | ||
1254 | |||
1255 | var warning = emptyFunction; | ||
1256 | |||
1257 | if (process.env.NODE_ENV !== 'production') { | ||
1258 | (function () { | ||
1259 | var printWarning = function printWarning(format) { | ||
1260 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
1261 | args[_key - 1] = arguments[_key]; | ||
1262 | } | ||
1263 | |||
1264 | var argIndex = 0; | ||
1265 | var message = 'Warning: ' + format.replace(/%s/g, function () { | ||
1266 | return args[argIndex++]; | ||
1267 | }); | ||
1268 | if (typeof console !== 'undefined') { | ||
1269 | console.error(message); | ||
1270 | } | ||
1271 | try { | ||
1272 | // --- Welcome to debugging React --- | ||
1273 | // This error was thrown as a convenience so that you can use this stack | ||
1274 | // to find the callsite that caused this warning to fire. | ||
1275 | throw new Error(message); | ||
1276 | } catch (x) {} | ||
1277 | }; | ||
1278 | |||
1279 | warning = function warning(condition, format) { | ||
1280 | if (format === undefined) { | ||
1281 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); | ||
1282 | } | ||
1283 | |||
1284 | if (format.indexOf('Failed Composite propType: ') === 0) { | ||
1285 | return; // Ignore CompositeComponent proptype check. | ||
1286 | } | ||
1287 | |||
1288 | if (!condition) { | ||
1289 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
1290 | args[_key2 - 2] = arguments[_key2]; | ||
1291 | } | ||
1292 | |||
1293 | printWarning.apply(undefined, [format].concat(args)); | ||
1294 | } | ||
1295 | }; | ||
1296 | })(); | ||
1297 | } | ||
1298 | |||
1299 | module.exports = warning; | ||
1300 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1301 | |||
1302 | /***/ }), | ||
1303 | /* 14 */ | ||
1304 | /***/ (function(module, exports) { | ||
1305 | |||
1306 | "use strict"; | ||
1307 | |||
1308 | /** | ||
1309 | * Copyright (c) 2013-present, Facebook, Inc. | ||
1310 | * All rights reserved. | ||
1311 | * | ||
1312 | * This source code is licensed under the BSD-style license found in the | ||
1313 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1314 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1315 | * | ||
1316 | * | ||
1317 | */ | ||
1318 | |||
1319 | function makeEmptyFunction(arg) { | ||
1320 | return function () { | ||
1321 | return arg; | ||
1322 | }; | ||
1323 | } | ||
1324 | |||
1325 | /** | ||
1326 | * This function accepts and discards inputs; it has no side effects. This is | ||
1327 | * primarily useful idiomatically for overridable function endpoints which | ||
1328 | * always need to be callable, since JS lacks a null-call idiom ala Cocoa. | ||
1329 | */ | ||
1330 | var emptyFunction = function emptyFunction() {}; | ||
1331 | |||
1332 | emptyFunction.thatReturns = makeEmptyFunction; | ||
1333 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false); | ||
1334 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true); | ||
1335 | emptyFunction.thatReturnsNull = makeEmptyFunction(null); | ||
1336 | emptyFunction.thatReturnsThis = function () { | ||
1337 | return this; | ||
1338 | }; | ||
1339 | emptyFunction.thatReturnsArgument = function (arg) { | ||
1340 | return arg; | ||
1341 | }; | ||
1342 | |||
1343 | module.exports = emptyFunction; | ||
1344 | |||
1345 | /***/ }), | ||
1346 | /* 15 */ | ||
1347 | /***/ (function(module, exports, __webpack_require__) { | ||
1348 | |||
1349 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1350 | * Copyright 2013-present, Facebook, Inc. | ||
1351 | * All rights reserved. | ||
1352 | * | ||
1353 | * This source code is licensed under the BSD-style license found in the | ||
1354 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1355 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1356 | * | ||
1357 | * | ||
1358 | */ | ||
1359 | |||
1360 | 'use strict'; | ||
1361 | |||
1362 | var canDefineProperty = false; | ||
1363 | if (process.env.NODE_ENV !== 'production') { | ||
1364 | try { | ||
1365 | // $FlowFixMe https://github.com/facebook/flow/issues/285 | ||
1366 | Object.defineProperty({}, 'x', { get: function () {} }); | ||
1367 | canDefineProperty = true; | ||
1368 | } catch (x) { | ||
1369 | // IE will fail on defineProperty | ||
1370 | } | ||
1371 | } | ||
1372 | |||
1373 | module.exports = canDefineProperty; | ||
1374 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1375 | |||
1376 | /***/ }), | ||
1377 | /* 16 */ | ||
1378 | /***/ (function(module, exports) { | ||
1379 | |||
1380 | /** | ||
1381 | * Copyright 2014-present, Facebook, Inc. | ||
1382 | * All rights reserved. | ||
1383 | * | ||
1384 | * This source code is licensed under the BSD-style license found in the | ||
1385 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1386 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1387 | * | ||
1388 | * | ||
1389 | */ | ||
1390 | |||
1391 | 'use strict'; | ||
1392 | |||
1393 | // The Symbol used to tag the ReactElement type. If there is no native Symbol | ||
1394 | // nor polyfill, then a plain number is used for performance. | ||
1395 | |||
1396 | var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; | ||
1397 | |||
1398 | module.exports = REACT_ELEMENT_TYPE; | ||
1399 | |||
1400 | /***/ }), | ||
1401 | /* 17 */ | ||
1402 | /***/ (function(module, exports, __webpack_require__) { | ||
1403 | |||
1404 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1405 | * Copyright 2013-present, Facebook, Inc. | ||
1406 | * All rights reserved. | ||
1407 | * | ||
1408 | * This source code is licensed under the BSD-style license found in the | ||
1409 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1410 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1411 | * | ||
1412 | */ | ||
1413 | |||
1414 | 'use strict'; | ||
1415 | |||
1416 | var _prodInvariant = __webpack_require__(9); | ||
1417 | |||
1418 | var ReactCurrentOwner = __webpack_require__(12); | ||
1419 | var REACT_ELEMENT_TYPE = __webpack_require__(16); | ||
1420 | |||
1421 | var getIteratorFn = __webpack_require__(18); | ||
1422 | var invariant = __webpack_require__(10); | ||
1423 | var KeyEscapeUtils = __webpack_require__(19); | ||
1424 | var warning = __webpack_require__(13); | ||
1425 | |||
1426 | var SEPARATOR = '.'; | ||
1427 | var SUBSEPARATOR = ':'; | ||
1428 | |||
1429 | /** | ||
1430 | * This is inlined from ReactElement since this file is shared between | ||
1431 | * isomorphic and renderers. We could extract this to a | ||
1432 | * | ||
1433 | */ | ||
1434 | |||
1435 | /** | ||
1436 | * TODO: Test that a single child and an array with one item have the same key | ||
1437 | * pattern. | ||
1438 | */ | ||
1439 | |||
1440 | var didWarnAboutMaps = false; | ||
1441 | |||
1442 | /** | ||
1443 | * Generate a key string that identifies a component within a set. | ||
1444 | * | ||
1445 | * @param {*} component A component that could contain a manual key. | ||
1446 | * @param {number} index Index that is used if a manual key is not provided. | ||
1447 | * @return {string} | ||
1448 | */ | ||
1449 | function getComponentKey(component, index) { | ||
1450 | // Do some typechecking here since we call this blindly. We want to ensure | ||
1451 | // that we don't block potential future ES APIs. | ||
1452 | if (component && typeof component === 'object' && component.key != null) { | ||
1453 | // Explicit key | ||
1454 | return KeyEscapeUtils.escape(component.key); | ||
1455 | } | ||
1456 | // Implicit key determined by the index in the set | ||
1457 | return index.toString(36); | ||
1458 | } | ||
1459 | |||
1460 | /** | ||
1461 | * @param {?*} children Children tree container. | ||
1462 | * @param {!string} nameSoFar Name of the key path so far. | ||
1463 | * @param {!function} callback Callback to invoke with each child found. | ||
1464 | * @param {?*} traverseContext Used to pass information throughout the traversal | ||
1465 | * process. | ||
1466 | * @return {!number} The number of children in this subtree. | ||
1467 | */ | ||
1468 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { | ||
1469 | var type = typeof children; | ||
1470 | |||
1471 | if (type === 'undefined' || type === 'boolean') { | ||
1472 | // All of the above are perceived as null. | ||
1473 | children = null; | ||
1474 | } | ||
1475 | |||
1476 | if (children === null || type === 'string' || type === 'number' || | ||
1477 | // The following is inlined from ReactElement. This means we can optimize | ||
1478 | // some checks. React Fiber also inlines this logic for similar purposes. | ||
1479 | type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { | ||
1480 | callback(traverseContext, children, | ||
1481 | // If it's the only child, treat the name as if it was wrapped in an array | ||
1482 | // so that it's consistent if the number of children grows. | ||
1483 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); | ||
1484 | return 1; | ||
1485 | } | ||
1486 | |||
1487 | var child; | ||
1488 | var nextName; | ||
1489 | var subtreeCount = 0; // Count of children found in the current subtree. | ||
1490 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; | ||
1491 | |||
1492 | if (Array.isArray(children)) { | ||
1493 | for (var i = 0; i < children.length; i++) { | ||
1494 | child = children[i]; | ||
1495 | nextName = nextNamePrefix + getComponentKey(child, i); | ||
1496 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
1497 | } | ||
1498 | } else { | ||
1499 | var iteratorFn = getIteratorFn(children); | ||
1500 | if (iteratorFn) { | ||
1501 | var iterator = iteratorFn.call(children); | ||
1502 | var step; | ||
1503 | if (iteratorFn !== children.entries) { | ||
1504 | var ii = 0; | ||
1505 | while (!(step = iterator.next()).done) { | ||
1506 | child = step.value; | ||
1507 | nextName = nextNamePrefix + getComponentKey(child, ii++); | ||
1508 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
1509 | } | ||
1510 | } else { | ||
1511 | if (process.env.NODE_ENV !== 'production') { | ||
1512 | var mapsAsChildrenAddendum = ''; | ||
1513 | if (ReactCurrentOwner.current) { | ||
1514 | var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); | ||
1515 | if (mapsAsChildrenOwnerName) { | ||
1516 | mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; | ||
1517 | } | ||
1518 | } | ||
1519 | process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0; | ||
1520 | didWarnAboutMaps = true; | ||
1521 | } | ||
1522 | // Iterator will provide entry [k,v] tuples rather than values. | ||
1523 | while (!(step = iterator.next()).done) { | ||
1524 | var entry = step.value; | ||
1525 | if (entry) { | ||
1526 | child = entry[1]; | ||
1527 | nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); | ||
1528 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
1529 | } | ||
1530 | } | ||
1531 | } | ||
1532 | } else if (type === 'object') { | ||
1533 | var addendum = ''; | ||
1534 | if (process.env.NODE_ENV !== 'production') { | ||
1535 | addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.'; | ||
1536 | if (children._isReactElement) { | ||
1537 | addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.'; | ||
1538 | } | ||
1539 | if (ReactCurrentOwner.current) { | ||
1540 | var name = ReactCurrentOwner.current.getName(); | ||
1541 | if (name) { | ||
1542 | addendum += ' Check the render method of `' + name + '`.'; | ||
1543 | } | ||
1544 | } | ||
1545 | } | ||
1546 | var childrenString = String(children); | ||
1547 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0; | ||
1548 | } | ||
1549 | } | ||
1550 | |||
1551 | return subtreeCount; | ||
1552 | } | ||
1553 | |||
1554 | /** | ||
1555 | * Traverses children that are typically specified as `props.children`, but | ||
1556 | * might also be specified through attributes: | ||
1557 | * | ||
1558 | * - `traverseAllChildren(this.props.children, ...)` | ||
1559 | * - `traverseAllChildren(this.props.leftPanelChildren, ...)` | ||
1560 | * | ||
1561 | * The `traverseContext` is an optional argument that is passed through the | ||
1562 | * entire traversal. It can be used to store accumulations or anything else that | ||
1563 | * the callback might find relevant. | ||
1564 | * | ||
1565 | * @param {?*} children Children tree object. | ||
1566 | * @param {!function} callback To invoke upon traversing each child. | ||
1567 | * @param {?*} traverseContext Context for traversal. | ||
1568 | * @return {!number} The number of children in this subtree. | ||
1569 | */ | ||
1570 | function traverseAllChildren(children, callback, traverseContext) { | ||
1571 | if (children == null) { | ||
1572 | return 0; | ||
1573 | } | ||
1574 | |||
1575 | return traverseAllChildrenImpl(children, '', callback, traverseContext); | ||
1576 | } | ||
1577 | |||
1578 | module.exports = traverseAllChildren; | ||
1579 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1580 | |||
1581 | /***/ }), | ||
1582 | /* 18 */ | ||
1583 | /***/ (function(module, exports) { | ||
1584 | |||
1585 | /** | ||
1586 | * Copyright 2013-present, Facebook, Inc. | ||
1587 | * All rights reserved. | ||
1588 | * | ||
1589 | * This source code is licensed under the BSD-style license found in the | ||
1590 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1591 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1592 | * | ||
1593 | * | ||
1594 | */ | ||
1595 | |||
1596 | 'use strict'; | ||
1597 | |||
1598 | /* global Symbol */ | ||
1599 | |||
1600 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | ||
1601 | var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | ||
1602 | |||
1603 | /** | ||
1604 | * Returns the iterator method function contained on the iterable object. | ||
1605 | * | ||
1606 | * Be sure to invoke the function with the iterable as context: | ||
1607 | * | ||
1608 | * var iteratorFn = getIteratorFn(myIterable); | ||
1609 | * if (iteratorFn) { | ||
1610 | * var iterator = iteratorFn.call(myIterable); | ||
1611 | * ... | ||
1612 | * } | ||
1613 | * | ||
1614 | * @param {?object} maybeIterable | ||
1615 | * @return {?function} | ||
1616 | */ | ||
1617 | function getIteratorFn(maybeIterable) { | ||
1618 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | ||
1619 | if (typeof iteratorFn === 'function') { | ||
1620 | return iteratorFn; | ||
1621 | } | ||
1622 | } | ||
1623 | |||
1624 | module.exports = getIteratorFn; | ||
1625 | |||
1626 | /***/ }), | ||
1627 | /* 19 */ | ||
1628 | /***/ (function(module, exports) { | ||
1629 | |||
1630 | /** | ||
1631 | * Copyright 2013-present, Facebook, Inc. | ||
1632 | * All rights reserved. | ||
1633 | * | ||
1634 | * This source code is licensed under the BSD-style license found in the | ||
1635 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1636 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1637 | * | ||
1638 | * | ||
1639 | */ | ||
1640 | |||
1641 | 'use strict'; | ||
1642 | |||
1643 | /** | ||
1644 | * Escape and wrap key so it is safe to use as a reactid | ||
1645 | * | ||
1646 | * @param {string} key to be escaped. | ||
1647 | * @return {string} the escaped key. | ||
1648 | */ | ||
1649 | |||
1650 | function escape(key) { | ||
1651 | var escapeRegex = /[=:]/g; | ||
1652 | var escaperLookup = { | ||
1653 | '=': '=0', | ||
1654 | ':': '=2' | ||
1655 | }; | ||
1656 | var escapedString = ('' + key).replace(escapeRegex, function (match) { | ||
1657 | return escaperLookup[match]; | ||
1658 | }); | ||
1659 | |||
1660 | return '$' + escapedString; | ||
1661 | } | ||
1662 | |||
1663 | /** | ||
1664 | * Unescape and unwrap key for human-readable display | ||
1665 | * | ||
1666 | * @param {string} key to unescape. | ||
1667 | * @return {string} the unescaped key. | ||
1668 | */ | ||
1669 | function unescape(key) { | ||
1670 | var unescapeRegex = /(=0|=2)/g; | ||
1671 | var unescaperLookup = { | ||
1672 | '=0': '=', | ||
1673 | '=2': ':' | ||
1674 | }; | ||
1675 | var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1); | ||
1676 | |||
1677 | return ('' + keySubstring).replace(unescapeRegex, function (match) { | ||
1678 | return unescaperLookup[match]; | ||
1679 | }); | ||
1680 | } | ||
1681 | |||
1682 | var KeyEscapeUtils = { | ||
1683 | escape: escape, | ||
1684 | unescape: unescape | ||
1685 | }; | ||
1686 | |||
1687 | module.exports = KeyEscapeUtils; | ||
1688 | |||
1689 | /***/ }), | ||
1690 | /* 20 */ | ||
1691 | /***/ (function(module, exports, __webpack_require__) { | ||
1692 | |||
1693 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1694 | * Copyright 2013-present, Facebook, Inc. | ||
1695 | * All rights reserved. | ||
1696 | * | ||
1697 | * This source code is licensed under the BSD-style license found in the | ||
1698 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1699 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1700 | * | ||
1701 | */ | ||
1702 | |||
1703 | 'use strict'; | ||
1704 | |||
1705 | var _prodInvariant = __webpack_require__(9); | ||
1706 | |||
1707 | var ReactNoopUpdateQueue = __webpack_require__(21); | ||
1708 | |||
1709 | var canDefineProperty = __webpack_require__(15); | ||
1710 | var emptyObject = __webpack_require__(22); | ||
1711 | var invariant = __webpack_require__(10); | ||
1712 | var warning = __webpack_require__(13); | ||
1713 | |||
1714 | /** | ||
1715 | * Base class helpers for the updating state of a component. | ||
1716 | */ | ||
1717 | function ReactComponent(props, context, updater) { | ||
1718 | this.props = props; | ||
1719 | this.context = context; | ||
1720 | this.refs = emptyObject; | ||
1721 | // We initialize the default updater but the real one gets injected by the | ||
1722 | // renderer. | ||
1723 | this.updater = updater || ReactNoopUpdateQueue; | ||
1724 | } | ||
1725 | |||
1726 | ReactComponent.prototype.isReactComponent = {}; | ||
1727 | |||
1728 | /** | ||
1729 | * Sets a subset of the state. Always use this to mutate | ||
1730 | * state. You should treat `this.state` as immutable. | ||
1731 | * | ||
1732 | * There is no guarantee that `this.state` will be immediately updated, so | ||
1733 | * accessing `this.state` after calling this method may return the old value. | ||
1734 | * | ||
1735 | * There is no guarantee that calls to `setState` will run synchronously, | ||
1736 | * as they may eventually be batched together. You can provide an optional | ||
1737 | * callback that will be executed when the call to setState is actually | ||
1738 | * completed. | ||
1739 | * | ||
1740 | * When a function is provided to setState, it will be called at some point in | ||
1741 | * the future (not synchronously). It will be called with the up to date | ||
1742 | * component arguments (state, props, context). These values can be different | ||
1743 | * from this.* because your function may be called after receiveProps but before | ||
1744 | * shouldComponentUpdate, and this new state, props, and context will not yet be | ||
1745 | * assigned to this. | ||
1746 | * | ||
1747 | * @param {object|function} partialState Next partial state or function to | ||
1748 | * produce next partial state to be merged with current state. | ||
1749 | * @param {?function} callback Called after state is updated. | ||
1750 | * @final | ||
1751 | * @protected | ||
1752 | */ | ||
1753 | ReactComponent.prototype.setState = function (partialState, callback) { | ||
1754 | !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0; | ||
1755 | this.updater.enqueueSetState(this, partialState); | ||
1756 | if (callback) { | ||
1757 | this.updater.enqueueCallback(this, callback, 'setState'); | ||
1758 | } | ||
1759 | }; | ||
1760 | |||
1761 | /** | ||
1762 | * Forces an update. This should only be invoked when it is known with | ||
1763 | * certainty that we are **not** in a DOM transaction. | ||
1764 | * | ||
1765 | * You may want to call this when you know that some deeper aspect of the | ||
1766 | * component's state has changed but `setState` was not called. | ||
1767 | * | ||
1768 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
1769 | * `componentWillUpdate` and `componentDidUpdate`. | ||
1770 | * | ||
1771 | * @param {?function} callback Called after update is complete. | ||
1772 | * @final | ||
1773 | * @protected | ||
1774 | */ | ||
1775 | ReactComponent.prototype.forceUpdate = function (callback) { | ||
1776 | this.updater.enqueueForceUpdate(this); | ||
1777 | if (callback) { | ||
1778 | this.updater.enqueueCallback(this, callback, 'forceUpdate'); | ||
1779 | } | ||
1780 | }; | ||
1781 | |||
1782 | /** | ||
1783 | * Deprecated APIs. These APIs used to exist on classic React classes but since | ||
1784 | * we would like to deprecate them, we're not going to move them over to this | ||
1785 | * modern base class. Instead, we define a getter that warns if it's accessed. | ||
1786 | */ | ||
1787 | if (process.env.NODE_ENV !== 'production') { | ||
1788 | var deprecatedAPIs = { | ||
1789 | isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], | ||
1790 | replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] | ||
1791 | }; | ||
1792 | var defineDeprecationWarning = function (methodName, info) { | ||
1793 | if (canDefineProperty) { | ||
1794 | Object.defineProperty(ReactComponent.prototype, methodName, { | ||
1795 | get: function () { | ||
1796 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0; | ||
1797 | return undefined; | ||
1798 | } | ||
1799 | }); | ||
1800 | } | ||
1801 | }; | ||
1802 | for (var fnName in deprecatedAPIs) { | ||
1803 | if (deprecatedAPIs.hasOwnProperty(fnName)) { | ||
1804 | defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); | ||
1805 | } | ||
1806 | } | ||
1807 | } | ||
1808 | |||
1809 | module.exports = ReactComponent; | ||
1810 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1811 | |||
1812 | /***/ }), | ||
1813 | /* 21 */ | ||
1814 | /***/ (function(module, exports, __webpack_require__) { | ||
1815 | |||
1816 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1817 | * Copyright 2015-present, Facebook, Inc. | ||
1818 | * All rights reserved. | ||
1819 | * | ||
1820 | * This source code is licensed under the BSD-style license found in the | ||
1821 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1822 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1823 | * | ||
1824 | */ | ||
1825 | |||
1826 | 'use strict'; | ||
1827 | |||
1828 | var warning = __webpack_require__(13); | ||
1829 | |||
1830 | function warnNoop(publicInstance, callerName) { | ||
1831 | if (process.env.NODE_ENV !== 'production') { | ||
1832 | var constructor = publicInstance.constructor; | ||
1833 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0; | ||
1834 | } | ||
1835 | } | ||
1836 | |||
1837 | /** | ||
1838 | * This is the abstract API for an update queue. | ||
1839 | */ | ||
1840 | var ReactNoopUpdateQueue = { | ||
1841 | |||
1842 | /** | ||
1843 | * Checks whether or not this composite component is mounted. | ||
1844 | * @param {ReactClass} publicInstance The instance we want to test. | ||
1845 | * @return {boolean} True if mounted, false otherwise. | ||
1846 | * @protected | ||
1847 | * @final | ||
1848 | */ | ||
1849 | isMounted: function (publicInstance) { | ||
1850 | return false; | ||
1851 | }, | ||
1852 | |||
1853 | /** | ||
1854 | * Enqueue a callback that will be executed after all the pending updates | ||
1855 | * have processed. | ||
1856 | * | ||
1857 | * @param {ReactClass} publicInstance The instance to use as `this` context. | ||
1858 | * @param {?function} callback Called after state is updated. | ||
1859 | * @internal | ||
1860 | */ | ||
1861 | enqueueCallback: function (publicInstance, callback) {}, | ||
1862 | |||
1863 | /** | ||
1864 | * Forces an update. This should only be invoked when it is known with | ||
1865 | * certainty that we are **not** in a DOM transaction. | ||
1866 | * | ||
1867 | * You may want to call this when you know that some deeper aspect of the | ||
1868 | * component's state has changed but `setState` was not called. | ||
1869 | * | ||
1870 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
1871 | * `componentWillUpdate` and `componentDidUpdate`. | ||
1872 | * | ||
1873 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
1874 | * @internal | ||
1875 | */ | ||
1876 | enqueueForceUpdate: function (publicInstance) { | ||
1877 | warnNoop(publicInstance, 'forceUpdate'); | ||
1878 | }, | ||
1879 | |||
1880 | /** | ||
1881 | * Replaces all of the state. Always use this or `setState` to mutate state. | ||
1882 | * You should treat `this.state` as immutable. | ||
1883 | * | ||
1884 | * There is no guarantee that `this.state` will be immediately updated, so | ||
1885 | * accessing `this.state` after calling this method may return the old value. | ||
1886 | * | ||
1887 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
1888 | * @param {object} completeState Next state. | ||
1889 | * @internal | ||
1890 | */ | ||
1891 | enqueueReplaceState: function (publicInstance, completeState) { | ||
1892 | warnNoop(publicInstance, 'replaceState'); | ||
1893 | }, | ||
1894 | |||
1895 | /** | ||
1896 | * Sets a subset of the state. This only exists because _pendingState is | ||
1897 | * internal. This provides a merging strategy that is not available to deep | ||
1898 | * properties which is confusing. TODO: Expose pendingState or don't use it | ||
1899 | * during the merge. | ||
1900 | * | ||
1901 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
1902 | * @param {object} partialState Next partial state to be merged with state. | ||
1903 | * @internal | ||
1904 | */ | ||
1905 | enqueueSetState: function (publicInstance, partialState) { | ||
1906 | warnNoop(publicInstance, 'setState'); | ||
1907 | } | ||
1908 | }; | ||
1909 | |||
1910 | module.exports = ReactNoopUpdateQueue; | ||
1911 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1912 | |||
1913 | /***/ }), | ||
1914 | /* 22 */ | ||
1915 | /***/ (function(module, exports, __webpack_require__) { | ||
1916 | |||
1917 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1918 | * Copyright (c) 2013-present, Facebook, Inc. | ||
1919 | * All rights reserved. | ||
1920 | * | ||
1921 | * This source code is licensed under the BSD-style license found in the | ||
1922 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1923 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1924 | * | ||
1925 | */ | ||
1926 | |||
1927 | 'use strict'; | ||
1928 | |||
1929 | var emptyObject = {}; | ||
1930 | |||
1931 | if (process.env.NODE_ENV !== 'production') { | ||
1932 | Object.freeze(emptyObject); | ||
1933 | } | ||
1934 | |||
1935 | module.exports = emptyObject; | ||
1936 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1937 | |||
1938 | /***/ }), | ||
1939 | /* 23 */ | ||
1940 | /***/ (function(module, exports, __webpack_require__) { | ||
1941 | |||
1942 | /** | ||
1943 | * Copyright 2013-present, Facebook, Inc. | ||
1944 | * All rights reserved. | ||
1945 | * | ||
1946 | * This source code is licensed under the BSD-style license found in the | ||
1947 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1948 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1949 | * | ||
1950 | */ | ||
1951 | |||
1952 | 'use strict'; | ||
1953 | |||
1954 | var _assign = __webpack_require__(6); | ||
1955 | |||
1956 | var ReactComponent = __webpack_require__(20); | ||
1957 | var ReactNoopUpdateQueue = __webpack_require__(21); | ||
1958 | |||
1959 | var emptyObject = __webpack_require__(22); | ||
1960 | |||
1961 | /** | ||
1962 | * Base class helpers for the updating state of a component. | ||
1963 | */ | ||
1964 | function ReactPureComponent(props, context, updater) { | ||
1965 | // Duplicated from ReactComponent. | ||
1966 | this.props = props; | ||
1967 | this.context = context; | ||
1968 | this.refs = emptyObject; | ||
1969 | // We initialize the default updater but the real one gets injected by the | ||
1970 | // renderer. | ||
1971 | this.updater = updater || ReactNoopUpdateQueue; | ||
1972 | } | ||
1973 | |||
1974 | function ComponentDummy() {} | ||
1975 | ComponentDummy.prototype = ReactComponent.prototype; | ||
1976 | ReactPureComponent.prototype = new ComponentDummy(); | ||
1977 | ReactPureComponent.prototype.constructor = ReactPureComponent; | ||
1978 | // Avoid an extra prototype jump for these methods. | ||
1979 | _assign(ReactPureComponent.prototype, ReactComponent.prototype); | ||
1980 | ReactPureComponent.prototype.isPureReactComponent = true; | ||
1981 | |||
1982 | module.exports = ReactPureComponent; | ||
1983 | |||
1984 | /***/ }), | ||
1985 | /* 24 */ | ||
1986 | /***/ (function(module, exports, __webpack_require__) { | ||
1987 | |||
1988 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1989 | * Copyright 2013-present, Facebook, Inc. | ||
1990 | * All rights reserved. | ||
1991 | * | ||
1992 | * This source code is licensed under the BSD-style license found in the | ||
1993 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1994 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1995 | * | ||
1996 | */ | ||
1997 | |||
1998 | 'use strict'; | ||
1999 | |||
2000 | var _prodInvariant = __webpack_require__(9), | ||
2001 | _assign = __webpack_require__(6); | ||
2002 | |||
2003 | var ReactComponent = __webpack_require__(20); | ||
2004 | var ReactElement = __webpack_require__(11); | ||
2005 | var ReactPropTypeLocationNames = __webpack_require__(25); | ||
2006 | var ReactNoopUpdateQueue = __webpack_require__(21); | ||
2007 | |||
2008 | var emptyObject = __webpack_require__(22); | ||
2009 | var invariant = __webpack_require__(10); | ||
2010 | var warning = __webpack_require__(13); | ||
2011 | |||
2012 | var MIXINS_KEY = 'mixins'; | ||
2013 | |||
2014 | // Helper function to allow the creation of anonymous functions which do not | ||
2015 | // have .name set to the name of the variable being assigned to. | ||
2016 | function identity(fn) { | ||
2017 | return fn; | ||
2018 | } | ||
2019 | |||
2020 | /** | ||
2021 | * Policies that describe methods in `ReactClassInterface`. | ||
2022 | */ | ||
2023 | |||
2024 | |||
2025 | var injectedMixins = []; | ||
2026 | |||
2027 | /** | ||
2028 | * Composite components are higher-level components that compose other composite | ||
2029 | * or host components. | ||
2030 | * | ||
2031 | * To create a new type of `ReactClass`, pass a specification of | ||
2032 | * your new class to `React.createClass`. The only requirement of your class | ||
2033 | * specification is that you implement a `render` method. | ||
2034 | * | ||
2035 | * var MyComponent = React.createClass({ | ||
2036 | * render: function() { | ||
2037 | * return <div>Hello World</div>; | ||
2038 | * } | ||
2039 | * }); | ||
2040 | * | ||
2041 | * The class specification supports a specific protocol of methods that have | ||
2042 | * special meaning (e.g. `render`). See `ReactClassInterface` for | ||
2043 | * more the comprehensive protocol. Any other properties and methods in the | ||
2044 | * class specification will be available on the prototype. | ||
2045 | * | ||
2046 | * @interface ReactClassInterface | ||
2047 | * @internal | ||
2048 | */ | ||
2049 | var ReactClassInterface = { | ||
2050 | |||
2051 | /** | ||
2052 | * An array of Mixin objects to include when defining your component. | ||
2053 | * | ||
2054 | * @type {array} | ||
2055 | * @optional | ||
2056 | */ | ||
2057 | mixins: 'DEFINE_MANY', | ||
2058 | |||
2059 | /** | ||
2060 | * An object containing properties and methods that should be defined on | ||
2061 | * the component's constructor instead of its prototype (static methods). | ||
2062 | * | ||
2063 | * @type {object} | ||
2064 | * @optional | ||
2065 | */ | ||
2066 | statics: 'DEFINE_MANY', | ||
2067 | |||
2068 | /** | ||
2069 | * Definition of prop types for this component. | ||
2070 | * | ||
2071 | * @type {object} | ||
2072 | * @optional | ||
2073 | */ | ||
2074 | propTypes: 'DEFINE_MANY', | ||
2075 | |||
2076 | /** | ||
2077 | * Definition of context types for this component. | ||
2078 | * | ||
2079 | * @type {object} | ||
2080 | * @optional | ||
2081 | */ | ||
2082 | contextTypes: 'DEFINE_MANY', | ||
2083 | |||
2084 | /** | ||
2085 | * Definition of context types this component sets for its children. | ||
2086 | * | ||
2087 | * @type {object} | ||
2088 | * @optional | ||
2089 | */ | ||
2090 | childContextTypes: 'DEFINE_MANY', | ||
2091 | |||
2092 | // ==== Definition methods ==== | ||
2093 | |||
2094 | /** | ||
2095 | * Invoked when the component is mounted. Values in the mapping will be set on | ||
2096 | * `this.props` if that prop is not specified (i.e. using an `in` check). | ||
2097 | * | ||
2098 | * This method is invoked before `getInitialState` and therefore cannot rely | ||
2099 | * on `this.state` or use `this.setState`. | ||
2100 | * | ||
2101 | * @return {object} | ||
2102 | * @optional | ||
2103 | */ | ||
2104 | getDefaultProps: 'DEFINE_MANY_MERGED', | ||
2105 | |||
2106 | /** | ||
2107 | * Invoked once before the component is mounted. The return value will be used | ||
2108 | * as the initial value of `this.state`. | ||
2109 | * | ||
2110 | * getInitialState: function() { | ||
2111 | * return { | ||
2112 | * isOn: false, | ||
2113 | * fooBaz: new BazFoo() | ||
2114 | * } | ||
2115 | * } | ||
2116 | * | ||
2117 | * @return {object} | ||
2118 | * @optional | ||
2119 | */ | ||
2120 | getInitialState: 'DEFINE_MANY_MERGED', | ||
2121 | |||
2122 | /** | ||
2123 | * @return {object} | ||
2124 | * @optional | ||
2125 | */ | ||
2126 | getChildContext: 'DEFINE_MANY_MERGED', | ||
2127 | |||
2128 | /** | ||
2129 | * Uses props from `this.props` and state from `this.state` to render the | ||
2130 | * structure of the component. | ||
2131 | * | ||
2132 | * No guarantees are made about when or how often this method is invoked, so | ||
2133 | * it must not have side effects. | ||
2134 | * | ||
2135 | * render: function() { | ||
2136 | * var name = this.props.name; | ||
2137 | * return <div>Hello, {name}!</div>; | ||
2138 | * } | ||
2139 | * | ||
2140 | * @return {ReactComponent} | ||
2141 | * @required | ||
2142 | */ | ||
2143 | render: 'DEFINE_ONCE', | ||
2144 | |||
2145 | // ==== Delegate methods ==== | ||
2146 | |||
2147 | /** | ||
2148 | * Invoked when the component is initially created and about to be mounted. | ||
2149 | * This may have side effects, but any external subscriptions or data created | ||
2150 | * by this method must be cleaned up in `componentWillUnmount`. | ||
2151 | * | ||
2152 | * @optional | ||
2153 | */ | ||
2154 | componentWillMount: 'DEFINE_MANY', | ||
2155 | |||
2156 | /** | ||
2157 | * Invoked when the component has been mounted and has a DOM representation. | ||
2158 | * However, there is no guarantee that the DOM node is in the document. | ||
2159 | * | ||
2160 | * Use this as an opportunity to operate on the DOM when the component has | ||
2161 | * been mounted (initialized and rendered) for the first time. | ||
2162 | * | ||
2163 | * @param {DOMElement} rootNode DOM element representing the component. | ||
2164 | * @optional | ||
2165 | */ | ||
2166 | componentDidMount: 'DEFINE_MANY', | ||
2167 | |||
2168 | /** | ||
2169 | * Invoked before the component receives new props. | ||
2170 | * | ||
2171 | * Use this as an opportunity to react to a prop transition by updating the | ||
2172 | * state using `this.setState`. Current props are accessed via `this.props`. | ||
2173 | * | ||
2174 | * componentWillReceiveProps: function(nextProps, nextContext) { | ||
2175 | * this.setState({ | ||
2176 | * likesIncreasing: nextProps.likeCount > this.props.likeCount | ||
2177 | * }); | ||
2178 | * } | ||
2179 | * | ||
2180 | * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop | ||
2181 | * transition may cause a state change, but the opposite is not true. If you | ||
2182 | * need it, you are probably looking for `componentWillUpdate`. | ||
2183 | * | ||
2184 | * @param {object} nextProps | ||
2185 | * @optional | ||
2186 | */ | ||
2187 | componentWillReceiveProps: 'DEFINE_MANY', | ||
2188 | |||
2189 | /** | ||
2190 | * Invoked while deciding if the component should be updated as a result of | ||
2191 | * receiving new props, state and/or context. | ||
2192 | * | ||
2193 | * Use this as an opportunity to `return false` when you're certain that the | ||
2194 | * transition to the new props/state/context will not require a component | ||
2195 | * update. | ||
2196 | * | ||
2197 | * shouldComponentUpdate: function(nextProps, nextState, nextContext) { | ||
2198 | * return !equal(nextProps, this.props) || | ||
2199 | * !equal(nextState, this.state) || | ||
2200 | * !equal(nextContext, this.context); | ||
2201 | * } | ||
2202 | * | ||
2203 | * @param {object} nextProps | ||
2204 | * @param {?object} nextState | ||
2205 | * @param {?object} nextContext | ||
2206 | * @return {boolean} True if the component should update. | ||
2207 | * @optional | ||
2208 | */ | ||
2209 | shouldComponentUpdate: 'DEFINE_ONCE', | ||
2210 | |||
2211 | /** | ||
2212 | * Invoked when the component is about to update due to a transition from | ||
2213 | * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` | ||
2214 | * and `nextContext`. | ||
2215 | * | ||
2216 | * Use this as an opportunity to perform preparation before an update occurs. | ||
2217 | * | ||
2218 | * NOTE: You **cannot** use `this.setState()` in this method. | ||
2219 | * | ||
2220 | * @param {object} nextProps | ||
2221 | * @param {?object} nextState | ||
2222 | * @param {?object} nextContext | ||
2223 | * @param {ReactReconcileTransaction} transaction | ||
2224 | * @optional | ||
2225 | */ | ||
2226 | componentWillUpdate: 'DEFINE_MANY', | ||
2227 | |||
2228 | /** | ||
2229 | * Invoked when the component's DOM representation has been updated. | ||
2230 | * | ||
2231 | * Use this as an opportunity to operate on the DOM when the component has | ||
2232 | * been updated. | ||
2233 | * | ||
2234 | * @param {object} prevProps | ||
2235 | * @param {?object} prevState | ||
2236 | * @param {?object} prevContext | ||
2237 | * @param {DOMElement} rootNode DOM element representing the component. | ||
2238 | * @optional | ||
2239 | */ | ||
2240 | componentDidUpdate: 'DEFINE_MANY', | ||
2241 | |||
2242 | /** | ||
2243 | * Invoked when the component is about to be removed from its parent and have | ||
2244 | * its DOM representation destroyed. | ||
2245 | * | ||
2246 | * Use this as an opportunity to deallocate any external resources. | ||
2247 | * | ||
2248 | * NOTE: There is no `componentDidUnmount` since your component will have been | ||
2249 | * destroyed by that point. | ||
2250 | * | ||
2251 | * @optional | ||
2252 | */ | ||
2253 | componentWillUnmount: 'DEFINE_MANY', | ||
2254 | |||
2255 | // ==== Advanced methods ==== | ||
2256 | |||
2257 | /** | ||
2258 | * Updates the component's currently mounted DOM representation. | ||
2259 | * | ||
2260 | * By default, this implements React's rendering and reconciliation algorithm. | ||
2261 | * Sophisticated clients may wish to override this. | ||
2262 | * | ||
2263 | * @param {ReactReconcileTransaction} transaction | ||
2264 | * @internal | ||
2265 | * @overridable | ||
2266 | */ | ||
2267 | updateComponent: 'OVERRIDE_BASE' | ||
2268 | |||
2269 | }; | ||
2270 | |||
2271 | /** | ||
2272 | * Mapping from class specification keys to special processing functions. | ||
2273 | * | ||
2274 | * Although these are declared like instance properties in the specification | ||
2275 | * when defining classes using `React.createClass`, they are actually static | ||
2276 | * and are accessible on the constructor instead of the prototype. Despite | ||
2277 | * being static, they must be defined outside of the "statics" key under | ||
2278 | * which all other static methods are defined. | ||
2279 | */ | ||
2280 | var RESERVED_SPEC_KEYS = { | ||
2281 | displayName: function (Constructor, displayName) { | ||
2282 | Constructor.displayName = displayName; | ||
2283 | }, | ||
2284 | mixins: function (Constructor, mixins) { | ||
2285 | if (mixins) { | ||
2286 | for (var i = 0; i < mixins.length; i++) { | ||
2287 | mixSpecIntoComponent(Constructor, mixins[i]); | ||
2288 | } | ||
2289 | } | ||
2290 | }, | ||
2291 | childContextTypes: function (Constructor, childContextTypes) { | ||
2292 | if (process.env.NODE_ENV !== 'production') { | ||
2293 | validateTypeDef(Constructor, childContextTypes, 'childContext'); | ||
2294 | } | ||
2295 | Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes); | ||
2296 | }, | ||
2297 | contextTypes: function (Constructor, contextTypes) { | ||
2298 | if (process.env.NODE_ENV !== 'production') { | ||
2299 | validateTypeDef(Constructor, contextTypes, 'context'); | ||
2300 | } | ||
2301 | Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes); | ||
2302 | }, | ||
2303 | /** | ||
2304 | * Special case getDefaultProps which should move into statics but requires | ||
2305 | * automatic merging. | ||
2306 | */ | ||
2307 | getDefaultProps: function (Constructor, getDefaultProps) { | ||
2308 | if (Constructor.getDefaultProps) { | ||
2309 | Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); | ||
2310 | } else { | ||
2311 | Constructor.getDefaultProps = getDefaultProps; | ||
2312 | } | ||
2313 | }, | ||
2314 | propTypes: function (Constructor, propTypes) { | ||
2315 | if (process.env.NODE_ENV !== 'production') { | ||
2316 | validateTypeDef(Constructor, propTypes, 'prop'); | ||
2317 | } | ||
2318 | Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); | ||
2319 | }, | ||
2320 | statics: function (Constructor, statics) { | ||
2321 | mixStaticSpecIntoComponent(Constructor, statics); | ||
2322 | }, | ||
2323 | autobind: function () {} }; | ||
2324 | |||
2325 | function validateTypeDef(Constructor, typeDef, location) { | ||
2326 | for (var propName in typeDef) { | ||
2327 | if (typeDef.hasOwnProperty(propName)) { | ||
2328 | // use a warning instead of an invariant so components | ||
2329 | // don't show up in prod but only in __DEV__ | ||
2330 | process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0; | ||
2331 | } | ||
2332 | } | ||
2333 | } | ||
2334 | |||
2335 | function validateMethodOverride(isAlreadyDefined, name) { | ||
2336 | var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; | ||
2337 | |||
2338 | // Disallow overriding of base class methods unless explicitly allowed. | ||
2339 | if (ReactClassMixin.hasOwnProperty(name)) { | ||
2340 | !(specPolicy === 'OVERRIDE_BASE') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.', name) : _prodInvariant('73', name) : void 0; | ||
2341 | } | ||
2342 | |||
2343 | // Disallow defining methods more than once unless explicitly allowed. | ||
2344 | if (isAlreadyDefined) { | ||
2345 | !(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('74', name) : void 0; | ||
2346 | } | ||
2347 | } | ||
2348 | |||
2349 | /** | ||
2350 | * Mixin helper which handles policy validation and reserved | ||
2351 | * specification keys when building React classes. | ||
2352 | */ | ||
2353 | function mixSpecIntoComponent(Constructor, spec) { | ||
2354 | if (!spec) { | ||
2355 | if (process.env.NODE_ENV !== 'production') { | ||
2356 | var typeofSpec = typeof spec; | ||
2357 | var isMixinValid = typeofSpec === 'object' && spec !== null; | ||
2358 | |||
2359 | process.env.NODE_ENV !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0; | ||
2360 | } | ||
2361 | |||
2362 | return; | ||
2363 | } | ||
2364 | |||
2365 | !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0; | ||
2366 | !!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0; | ||
2367 | |||
2368 | var proto = Constructor.prototype; | ||
2369 | var autoBindPairs = proto.__reactAutoBindPairs; | ||
2370 | |||
2371 | // By handling mixins before any other properties, we ensure the same | ||
2372 | // chaining order is applied to methods with DEFINE_MANY policy, whether | ||
2373 | // mixins are listed before or after these methods in the spec. | ||
2374 | if (spec.hasOwnProperty(MIXINS_KEY)) { | ||
2375 | RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); | ||
2376 | } | ||
2377 | |||
2378 | for (var name in spec) { | ||
2379 | if (!spec.hasOwnProperty(name)) { | ||
2380 | continue; | ||
2381 | } | ||
2382 | |||
2383 | if (name === MIXINS_KEY) { | ||
2384 | // We have already handled mixins in a special case above. | ||
2385 | continue; | ||
2386 | } | ||
2387 | |||
2388 | var property = spec[name]; | ||
2389 | var isAlreadyDefined = proto.hasOwnProperty(name); | ||
2390 | validateMethodOverride(isAlreadyDefined, name); | ||
2391 | |||
2392 | if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { | ||
2393 | RESERVED_SPEC_KEYS[name](Constructor, property); | ||
2394 | } else { | ||
2395 | // Setup methods on prototype: | ||
2396 | // The following member methods should not be automatically bound: | ||
2397 | // 1. Expected ReactClass methods (in the "interface"). | ||
2398 | // 2. Overridden methods (that were mixed in). | ||
2399 | var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); | ||
2400 | var isFunction = typeof property === 'function'; | ||
2401 | var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; | ||
2402 | |||
2403 | if (shouldAutoBind) { | ||
2404 | autoBindPairs.push(name, property); | ||
2405 | proto[name] = property; | ||
2406 | } else { | ||
2407 | if (isAlreadyDefined) { | ||
2408 | var specPolicy = ReactClassInterface[name]; | ||
2409 | |||
2410 | // These cases should already be caught by validateMethodOverride. | ||
2411 | !(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0; | ||
2412 | |||
2413 | // For methods which are defined more than once, call the existing | ||
2414 | // methods before calling the new property, merging if appropriate. | ||
2415 | if (specPolicy === 'DEFINE_MANY_MERGED') { | ||
2416 | proto[name] = createMergedResultFunction(proto[name], property); | ||
2417 | } else if (specPolicy === 'DEFINE_MANY') { | ||
2418 | proto[name] = createChainedFunction(proto[name], property); | ||
2419 | } | ||
2420 | } else { | ||
2421 | proto[name] = property; | ||
2422 | if (process.env.NODE_ENV !== 'production') { | ||
2423 | // Add verbose displayName to the function, which helps when looking | ||
2424 | // at profiling tools. | ||
2425 | if (typeof property === 'function' && spec.displayName) { | ||
2426 | proto[name].displayName = spec.displayName + '_' + name; | ||
2427 | } | ||
2428 | } | ||
2429 | } | ||
2430 | } | ||
2431 | } | ||
2432 | } | ||
2433 | } | ||
2434 | |||
2435 | function mixStaticSpecIntoComponent(Constructor, statics) { | ||
2436 | if (!statics) { | ||
2437 | return; | ||
2438 | } | ||
2439 | for (var name in statics) { | ||
2440 | var property = statics[name]; | ||
2441 | if (!statics.hasOwnProperty(name)) { | ||
2442 | continue; | ||
2443 | } | ||
2444 | |||
2445 | var isReserved = name in RESERVED_SPEC_KEYS; | ||
2446 | !!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.', name) : _prodInvariant('78', name) : void 0; | ||
2447 | |||
2448 | var isInherited = name in Constructor; | ||
2449 | !!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('79', name) : void 0; | ||
2450 | Constructor[name] = property; | ||
2451 | } | ||
2452 | } | ||
2453 | |||
2454 | /** | ||
2455 | * Merge two objects, but throw if both contain the same key. | ||
2456 | * | ||
2457 | * @param {object} one The first object, which is mutated. | ||
2458 | * @param {object} two The second object | ||
2459 | * @return {object} one after it has been mutated to contain everything in two. | ||
2460 | */ | ||
2461 | function mergeIntoWithNoDuplicateKeys(one, two) { | ||
2462 | !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0; | ||
2463 | |||
2464 | for (var key in two) { | ||
2465 | if (two.hasOwnProperty(key)) { | ||
2466 | !(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.', key) : _prodInvariant('81', key) : void 0; | ||
2467 | one[key] = two[key]; | ||
2468 | } | ||
2469 | } | ||
2470 | return one; | ||
2471 | } | ||
2472 | |||
2473 | /** | ||
2474 | * Creates a function that invokes two functions and merges their return values. | ||
2475 | * | ||
2476 | * @param {function} one Function to invoke first. | ||
2477 | * @param {function} two Function to invoke second. | ||
2478 | * @return {function} Function that invokes the two argument functions. | ||
2479 | * @private | ||
2480 | */ | ||
2481 | function createMergedResultFunction(one, two) { | ||
2482 | return function mergedResult() { | ||
2483 | var a = one.apply(this, arguments); | ||
2484 | var b = two.apply(this, arguments); | ||
2485 | if (a == null) { | ||
2486 | return b; | ||
2487 | } else if (b == null) { | ||
2488 | return a; | ||
2489 | } | ||
2490 | var c = {}; | ||
2491 | mergeIntoWithNoDuplicateKeys(c, a); | ||
2492 | mergeIntoWithNoDuplicateKeys(c, b); | ||
2493 | return c; | ||
2494 | }; | ||
2495 | } | ||
2496 | |||
2497 | /** | ||
2498 | * Creates a function that invokes two functions and ignores their return vales. | ||
2499 | * | ||
2500 | * @param {function} one Function to invoke first. | ||
2501 | * @param {function} two Function to invoke second. | ||
2502 | * @return {function} Function that invokes the two argument functions. | ||
2503 | * @private | ||
2504 | */ | ||
2505 | function createChainedFunction(one, two) { | ||
2506 | return function chainedFunction() { | ||
2507 | one.apply(this, arguments); | ||
2508 | two.apply(this, arguments); | ||
2509 | }; | ||
2510 | } | ||
2511 | |||
2512 | /** | ||
2513 | * Binds a method to the component. | ||
2514 | * | ||
2515 | * @param {object} component Component whose method is going to be bound. | ||
2516 | * @param {function} method Method to be bound. | ||
2517 | * @return {function} The bound method. | ||
2518 | */ | ||
2519 | function bindAutoBindMethod(component, method) { | ||
2520 | var boundMethod = method.bind(component); | ||
2521 | if (process.env.NODE_ENV !== 'production') { | ||
2522 | boundMethod.__reactBoundContext = component; | ||
2523 | boundMethod.__reactBoundMethod = method; | ||
2524 | boundMethod.__reactBoundArguments = null; | ||
2525 | var componentName = component.constructor.displayName; | ||
2526 | var _bind = boundMethod.bind; | ||
2527 | boundMethod.bind = function (newThis) { | ||
2528 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
2529 | args[_key - 1] = arguments[_key]; | ||
2530 | } | ||
2531 | |||
2532 | // User is trying to bind() an autobound method; we effectively will | ||
2533 | // ignore the value of "this" that the user is trying to use, so | ||
2534 | // let's warn. | ||
2535 | if (newThis !== component && newThis !== null) { | ||
2536 | process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0; | ||
2537 | } else if (!args.length) { | ||
2538 | process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0; | ||
2539 | return boundMethod; | ||
2540 | } | ||
2541 | var reboundMethod = _bind.apply(boundMethod, arguments); | ||
2542 | reboundMethod.__reactBoundContext = component; | ||
2543 | reboundMethod.__reactBoundMethod = method; | ||
2544 | reboundMethod.__reactBoundArguments = args; | ||
2545 | return reboundMethod; | ||
2546 | }; | ||
2547 | } | ||
2548 | return boundMethod; | ||
2549 | } | ||
2550 | |||
2551 | /** | ||
2552 | * Binds all auto-bound methods in a component. | ||
2553 | * | ||
2554 | * @param {object} component Component whose method is going to be bound. | ||
2555 | */ | ||
2556 | function bindAutoBindMethods(component) { | ||
2557 | var pairs = component.__reactAutoBindPairs; | ||
2558 | for (var i = 0; i < pairs.length; i += 2) { | ||
2559 | var autoBindKey = pairs[i]; | ||
2560 | var method = pairs[i + 1]; | ||
2561 | component[autoBindKey] = bindAutoBindMethod(component, method); | ||
2562 | } | ||
2563 | } | ||
2564 | |||
2565 | /** | ||
2566 | * Add more to the ReactClass base class. These are all legacy features and | ||
2567 | * therefore not already part of the modern ReactComponent. | ||
2568 | */ | ||
2569 | var ReactClassMixin = { | ||
2570 | |||
2571 | /** | ||
2572 | * TODO: This will be deprecated because state should always keep a consistent | ||
2573 | * type signature and the only use case for this, is to avoid that. | ||
2574 | */ | ||
2575 | replaceState: function (newState, callback) { | ||
2576 | this.updater.enqueueReplaceState(this, newState); | ||
2577 | if (callback) { | ||
2578 | this.updater.enqueueCallback(this, callback, 'replaceState'); | ||
2579 | } | ||
2580 | }, | ||
2581 | |||
2582 | /** | ||
2583 | * Checks whether or not this composite component is mounted. | ||
2584 | * @return {boolean} True if mounted, false otherwise. | ||
2585 | * @protected | ||
2586 | * @final | ||
2587 | */ | ||
2588 | isMounted: function () { | ||
2589 | return this.updater.isMounted(this); | ||
2590 | } | ||
2591 | }; | ||
2592 | |||
2593 | var ReactClassComponent = function () {}; | ||
2594 | _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); | ||
2595 | |||
2596 | var didWarnDeprecated = false; | ||
2597 | |||
2598 | /** | ||
2599 | * Module for creating composite components. | ||
2600 | * | ||
2601 | * @class ReactClass | ||
2602 | */ | ||
2603 | var ReactClass = { | ||
2604 | |||
2605 | /** | ||
2606 | * Creates a composite component class given a class specification. | ||
2607 | * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass | ||
2608 | * | ||
2609 | * @param {object} spec Class specification (which must define `render`). | ||
2610 | * @return {function} Component constructor function. | ||
2611 | * @public | ||
2612 | */ | ||
2613 | createClass: function (spec) { | ||
2614 | if (process.env.NODE_ENV !== 'production') { | ||
2615 | process.env.NODE_ENV !== 'production' ? warning(didWarnDeprecated, '%s: React.createClass is deprecated and will be removed in version 16. ' + 'Use plain JavaScript classes instead. If you\'re not yet ready to ' + 'migrate, create-react-class is available on npm as a ' + 'drop-in replacement.', spec && spec.displayName || 'A Component') : void 0; | ||
2616 | didWarnDeprecated = true; | ||
2617 | } | ||
2618 | |||
2619 | // To keep our warnings more understandable, we'll use a little hack here to | ||
2620 | // ensure that Constructor.name !== 'Constructor'. This makes sure we don't | ||
2621 | // unnecessarily identify a class without displayName as 'Constructor'. | ||
2622 | var Constructor = identity(function (props, context, updater) { | ||
2623 | // This constructor gets overridden by mocks. The argument is used | ||
2624 | // by mocks to assert on what gets mounted. | ||
2625 | |||
2626 | if (process.env.NODE_ENV !== 'production') { | ||
2627 | process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; | ||
2628 | } | ||
2629 | |||
2630 | // Wire up auto-binding | ||
2631 | if (this.__reactAutoBindPairs.length) { | ||
2632 | bindAutoBindMethods(this); | ||
2633 | } | ||
2634 | |||
2635 | this.props = props; | ||
2636 | this.context = context; | ||
2637 | this.refs = emptyObject; | ||
2638 | this.updater = updater || ReactNoopUpdateQueue; | ||
2639 | |||
2640 | this.state = null; | ||
2641 | |||
2642 | // ReactClasses doesn't have constructors. Instead, they use the | ||
2643 | // getInitialState and componentWillMount methods for initialization. | ||
2644 | |||
2645 | var initialState = this.getInitialState ? this.getInitialState() : null; | ||
2646 | if (process.env.NODE_ENV !== 'production') { | ||
2647 | // We allow auto-mocks to proceed as if they're returning null. | ||
2648 | if (initialState === undefined && this.getInitialState._isMockFunction) { | ||
2649 | // This is probably bad practice. Consider warning here and | ||
2650 | // deprecating this convenience. | ||
2651 | initialState = null; | ||
2652 | } | ||
2653 | } | ||
2654 | !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0; | ||
2655 | |||
2656 | this.state = initialState; | ||
2657 | }); | ||
2658 | Constructor.prototype = new ReactClassComponent(); | ||
2659 | Constructor.prototype.constructor = Constructor; | ||
2660 | Constructor.prototype.__reactAutoBindPairs = []; | ||
2661 | |||
2662 | injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); | ||
2663 | |||
2664 | mixSpecIntoComponent(Constructor, spec); | ||
2665 | |||
2666 | // Initialize the defaultProps property after all mixins have been merged. | ||
2667 | if (Constructor.getDefaultProps) { | ||
2668 | Constructor.defaultProps = Constructor.getDefaultProps(); | ||
2669 | } | ||
2670 | |||
2671 | if (process.env.NODE_ENV !== 'production') { | ||
2672 | // This is a tag to indicate that the use of these method names is ok, | ||
2673 | // since it's used with createClass. If it's not, then it's likely a | ||
2674 | // mistake so we'll warn you to use the static property, property | ||
2675 | // initializer or constructor respectively. | ||
2676 | if (Constructor.getDefaultProps) { | ||
2677 | Constructor.getDefaultProps.isReactClassApproved = {}; | ||
2678 | } | ||
2679 | if (Constructor.prototype.getInitialState) { | ||
2680 | Constructor.prototype.getInitialState.isReactClassApproved = {}; | ||
2681 | } | ||
2682 | } | ||
2683 | |||
2684 | !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0; | ||
2685 | |||
2686 | if (process.env.NODE_ENV !== 'production') { | ||
2687 | process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0; | ||
2688 | process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0; | ||
2689 | } | ||
2690 | |||
2691 | // Reduce time spent doing lookups by setting these on the prototype. | ||
2692 | for (var methodName in ReactClassInterface) { | ||
2693 | if (!Constructor.prototype[methodName]) { | ||
2694 | Constructor.prototype[methodName] = null; | ||
2695 | } | ||
2696 | } | ||
2697 | |||
2698 | return Constructor; | ||
2699 | }, | ||
2700 | |||
2701 | injection: { | ||
2702 | injectMixin: function (mixin) { | ||
2703 | injectedMixins.push(mixin); | ||
2704 | } | ||
2705 | } | ||
2706 | |||
2707 | }; | ||
2708 | |||
2709 | module.exports = ReactClass; | ||
2710 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
2711 | |||
2712 | /***/ }), | ||
2713 | /* 25 */ | ||
2714 | /***/ (function(module, exports, __webpack_require__) { | ||
2715 | |||
2716 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
2717 | * Copyright 2013-present, Facebook, Inc. | ||
2718 | * All rights reserved. | ||
2719 | * | ||
2720 | * This source code is licensed under the BSD-style license found in the | ||
2721 | * LICENSE file in the root directory of this source tree. An additional grant | ||
2722 | * of patent rights can be found in the PATENTS file in the same directory. | ||
2723 | * | ||
2724 | * | ||
2725 | */ | ||
2726 | |||
2727 | 'use strict'; | ||
2728 | |||
2729 | var ReactPropTypeLocationNames = {}; | ||
2730 | |||
2731 | if (process.env.NODE_ENV !== 'production') { | ||
2732 | ReactPropTypeLocationNames = { | ||
2733 | prop: 'prop', | ||
2734 | context: 'context', | ||
2735 | childContext: 'child context' | ||
2736 | }; | ||
2737 | } | ||
2738 | |||
2739 | module.exports = ReactPropTypeLocationNames; | ||
2740 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
2741 | |||
2742 | /***/ }), | ||
2743 | /* 26 */ | ||
2744 | /***/ (function(module, exports, __webpack_require__) { | ||
2745 | |||
2746 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
2747 | * Copyright 2013-present, Facebook, Inc. | ||
2748 | * All rights reserved. | ||
2749 | * | ||
2750 | * This source code is licensed under the BSD-style license found in the | ||
2751 | * LICENSE file in the root directory of this source tree. An additional grant | ||
2752 | * of patent rights can be found in the PATENTS file in the same directory. | ||
2753 | * | ||
2754 | */ | ||
2755 | |||
2756 | 'use strict'; | ||
2757 | |||
2758 | var ReactElement = __webpack_require__(11); | ||
2759 | |||
2760 | /** | ||
2761 | * Create a factory that creates HTML tag elements. | ||
2762 | * | ||
2763 | * @private | ||
2764 | */ | ||
2765 | var createDOMFactory = ReactElement.createFactory; | ||
2766 | if (process.env.NODE_ENV !== 'production') { | ||
2767 | var ReactElementValidator = __webpack_require__(27); | ||
2768 | createDOMFactory = ReactElementValidator.createFactory; | ||
2769 | } | ||
2770 | |||
2771 | /** | ||
2772 | * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. | ||
2773 | * This is also accessible via `React.DOM`. | ||
2774 | * | ||
2775 | * @public | ||
2776 | */ | ||
2777 | var ReactDOMFactories = { | ||
2778 | a: createDOMFactory('a'), | ||
2779 | abbr: createDOMFactory('abbr'), | ||
2780 | address: createDOMFactory('address'), | ||
2781 | area: createDOMFactory('area'), | ||
2782 | article: createDOMFactory('article'), | ||
2783 | aside: createDOMFactory('aside'), | ||
2784 | audio: createDOMFactory('audio'), | ||
2785 | b: createDOMFactory('b'), | ||
2786 | base: createDOMFactory('base'), | ||
2787 | bdi: createDOMFactory('bdi'), | ||
2788 | bdo: createDOMFactory('bdo'), | ||
2789 | big: createDOMFactory('big'), | ||
2790 | blockquote: createDOMFactory('blockquote'), | ||
2791 | body: createDOMFactory('body'), | ||
2792 | br: createDOMFactory('br'), | ||
2793 | button: createDOMFactory('button'), | ||
2794 | canvas: createDOMFactory('canvas'), | ||
2795 | caption: createDOMFactory('caption'), | ||
2796 | cite: createDOMFactory('cite'), | ||
2797 | code: createDOMFactory('code'), | ||
2798 | col: createDOMFactory('col'), | ||
2799 | colgroup: createDOMFactory('colgroup'), | ||
2800 | data: createDOMFactory('data'), | ||
2801 | datalist: createDOMFactory('datalist'), | ||
2802 | dd: createDOMFactory('dd'), | ||
2803 | del: createDOMFactory('del'), | ||
2804 | details: createDOMFactory('details'), | ||
2805 | dfn: createDOMFactory('dfn'), | ||
2806 | dialog: createDOMFactory('dialog'), | ||
2807 | div: createDOMFactory('div'), | ||
2808 | dl: createDOMFactory('dl'), | ||
2809 | dt: createDOMFactory('dt'), | ||
2810 | em: createDOMFactory('em'), | ||
2811 | embed: createDOMFactory('embed'), | ||
2812 | fieldset: createDOMFactory('fieldset'), | ||
2813 | figcaption: createDOMFactory('figcaption'), | ||
2814 | figure: createDOMFactory('figure'), | ||
2815 | footer: createDOMFactory('footer'), | ||
2816 | form: createDOMFactory('form'), | ||
2817 | h1: createDOMFactory('h1'), | ||
2818 | h2: createDOMFactory('h2'), | ||
2819 | h3: createDOMFactory('h3'), | ||
2820 | h4: createDOMFactory('h4'), | ||
2821 | h5: createDOMFactory('h5'), | ||
2822 | h6: createDOMFactory('h6'), | ||
2823 | head: createDOMFactory('head'), | ||
2824 | header: createDOMFactory('header'), | ||
2825 | hgroup: createDOMFactory('hgroup'), | ||
2826 | hr: createDOMFactory('hr'), | ||
2827 | html: createDOMFactory('html'), | ||
2828 | i: createDOMFactory('i'), | ||
2829 | iframe: createDOMFactory('iframe'), | ||
2830 | img: createDOMFactory('img'), | ||
2831 | input: createDOMFactory('input'), | ||
2832 | ins: createDOMFactory('ins'), | ||
2833 | kbd: createDOMFactory('kbd'), | ||
2834 | keygen: createDOMFactory('keygen'), | ||
2835 | label: createDOMFactory('label'), | ||
2836 | legend: createDOMFactory('legend'), | ||
2837 | li: createDOMFactory('li'), | ||
2838 | link: createDOMFactory('link'), | ||
2839 | main: createDOMFactory('main'), | ||
2840 | map: createDOMFactory('map'), | ||
2841 | mark: createDOMFactory('mark'), | ||
2842 | menu: createDOMFactory('menu'), | ||
2843 | menuitem: createDOMFactory('menuitem'), | ||
2844 | meta: createDOMFactory('meta'), | ||
2845 | meter: createDOMFactory('meter'), | ||
2846 | nav: createDOMFactory('nav'), | ||
2847 | noscript: createDOMFactory('noscript'), | ||
2848 | object: createDOMFactory('object'), | ||
2849 | ol: createDOMFactory('ol'), | ||
2850 | optgroup: createDOMFactory('optgroup'), | ||
2851 | option: createDOMFactory('option'), | ||
2852 | output: createDOMFactory('output'), | ||
2853 | p: createDOMFactory('p'), | ||
2854 | param: createDOMFactory('param'), | ||
2855 | picture: createDOMFactory('picture'), | ||
2856 | pre: createDOMFactory('pre'), | ||
2857 | progress: createDOMFactory('progress'), | ||
2858 | q: createDOMFactory('q'), | ||
2859 | rp: createDOMFactory('rp'), | ||
2860 | rt: createDOMFactory('rt'), | ||
2861 | ruby: createDOMFactory('ruby'), | ||
2862 | s: createDOMFactory('s'), | ||
2863 | samp: createDOMFactory('samp'), | ||
2864 | script: createDOMFactory('script'), | ||
2865 | section: createDOMFactory('section'), | ||
2866 | select: createDOMFactory('select'), | ||
2867 | small: createDOMFactory('small'), | ||
2868 | source: createDOMFactory('source'), | ||
2869 | span: createDOMFactory('span'), | ||
2870 | strong: createDOMFactory('strong'), | ||
2871 | style: createDOMFactory('style'), | ||
2872 | sub: createDOMFactory('sub'), | ||
2873 | summary: createDOMFactory('summary'), | ||
2874 | sup: createDOMFactory('sup'), | ||
2875 | table: createDOMFactory('table'), | ||
2876 | tbody: createDOMFactory('tbody'), | ||
2877 | td: createDOMFactory('td'), | ||
2878 | textarea: createDOMFactory('textarea'), | ||
2879 | tfoot: createDOMFactory('tfoot'), | ||
2880 | th: createDOMFactory('th'), | ||
2881 | thead: createDOMFactory('thead'), | ||
2882 | time: createDOMFactory('time'), | ||
2883 | title: createDOMFactory('title'), | ||
2884 | tr: createDOMFactory('tr'), | ||
2885 | track: createDOMFactory('track'), | ||
2886 | u: createDOMFactory('u'), | ||
2887 | ul: createDOMFactory('ul'), | ||
2888 | 'var': createDOMFactory('var'), | ||
2889 | video: createDOMFactory('video'), | ||
2890 | wbr: createDOMFactory('wbr'), | ||
2891 | |||
2892 | // SVG | ||
2893 | circle: createDOMFactory('circle'), | ||
2894 | clipPath: createDOMFactory('clipPath'), | ||
2895 | defs: createDOMFactory('defs'), | ||
2896 | ellipse: createDOMFactory('ellipse'), | ||
2897 | g: createDOMFactory('g'), | ||
2898 | image: createDOMFactory('image'), | ||
2899 | line: createDOMFactory('line'), | ||
2900 | linearGradient: createDOMFactory('linearGradient'), | ||
2901 | mask: createDOMFactory('mask'), | ||
2902 | path: createDOMFactory('path'), | ||
2903 | pattern: createDOMFactory('pattern'), | ||
2904 | polygon: createDOMFactory('polygon'), | ||
2905 | polyline: createDOMFactory('polyline'), | ||
2906 | radialGradient: createDOMFactory('radialGradient'), | ||
2907 | rect: createDOMFactory('rect'), | ||
2908 | stop: createDOMFactory('stop'), | ||
2909 | svg: createDOMFactory('svg'), | ||
2910 | text: createDOMFactory('text'), | ||
2911 | tspan: createDOMFactory('tspan') | ||
2912 | }; | ||
2913 | |||
2914 | module.exports = ReactDOMFactories; | ||
2915 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
2916 | |||
2917 | /***/ }), | ||
2918 | /* 27 */ | ||
2919 | /***/ (function(module, exports, __webpack_require__) { | ||
2920 | |||
2921 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
2922 | * Copyright 2014-present, Facebook, Inc. | ||
2923 | * All rights reserved. | ||
2924 | * | ||
2925 | * This source code is licensed under the BSD-style license found in the | ||
2926 | * LICENSE file in the root directory of this source tree. An additional grant | ||
2927 | * of patent rights can be found in the PATENTS file in the same directory. | ||
2928 | * | ||
2929 | */ | ||
2930 | |||
2931 | /** | ||
2932 | * ReactElementValidator provides a wrapper around a element factory | ||
2933 | * which validates the props passed to the element. This is intended to be | ||
2934 | * used only in DEV and could be replaced by a static type checker for languages | ||
2935 | * that support it. | ||
2936 | */ | ||
2937 | |||
2938 | 'use strict'; | ||
2939 | |||
2940 | var ReactCurrentOwner = __webpack_require__(12); | ||
2941 | var ReactComponentTreeHook = __webpack_require__(28); | ||
2942 | var ReactElement = __webpack_require__(11); | ||
2943 | |||
2944 | var checkReactTypeSpec = __webpack_require__(29); | ||
2945 | |||
2946 | var canDefineProperty = __webpack_require__(15); | ||
2947 | var getIteratorFn = __webpack_require__(18); | ||
2948 | var warning = __webpack_require__(13); | ||
2949 | |||
2950 | function getDeclarationErrorAddendum() { | ||
2951 | if (ReactCurrentOwner.current) { | ||
2952 | var name = ReactCurrentOwner.current.getName(); | ||
2953 | if (name) { | ||
2954 | return ' Check the render method of `' + name + '`.'; | ||
2955 | } | ||
2956 | } | ||
2957 | return ''; | ||
2958 | } | ||
2959 | |||
2960 | function getSourceInfoErrorAddendum(elementProps) { | ||
2961 | if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) { | ||
2962 | var source = elementProps.__source; | ||
2963 | var fileName = source.fileName.replace(/^.*[\\\/]/, ''); | ||
2964 | var lineNumber = source.lineNumber; | ||
2965 | return ' Check your code at ' + fileName + ':' + lineNumber + '.'; | ||
2966 | } | ||
2967 | return ''; | ||
2968 | } | ||
2969 | |||
2970 | /** | ||
2971 | * Warn if there's no key explicitly set on dynamic arrays of children or | ||
2972 | * object keys are not valid. This allows us to keep track of children between | ||
2973 | * updates. | ||
2974 | */ | ||
2975 | var ownerHasKeyUseWarning = {}; | ||
2976 | |||
2977 | function getCurrentComponentErrorInfo(parentType) { | ||
2978 | var info = getDeclarationErrorAddendum(); | ||
2979 | |||
2980 | if (!info) { | ||
2981 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; | ||
2982 | if (parentName) { | ||
2983 | info = ' Check the top-level render call using <' + parentName + '>.'; | ||
2984 | } | ||
2985 | } | ||
2986 | return info; | ||
2987 | } | ||
2988 | |||
2989 | /** | ||
2990 | * Warn if the element doesn't have an explicit key assigned to it. | ||
2991 | * This element is in an array. The array could grow and shrink or be | ||
2992 | * reordered. All children that haven't already been validated are required to | ||
2993 | * have a "key" property assigned to it. Error statuses are cached so a warning | ||
2994 | * will only be shown once. | ||
2995 | * | ||
2996 | * @internal | ||
2997 | * @param {ReactElement} element Element that requires a key. | ||
2998 | * @param {*} parentType element's parent's type. | ||
2999 | */ | ||
3000 | function validateExplicitKey(element, parentType) { | ||
3001 | if (!element._store || element._store.validated || element.key != null) { | ||
3002 | return; | ||
3003 | } | ||
3004 | element._store.validated = true; | ||
3005 | |||
3006 | var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {}); | ||
3007 | |||
3008 | var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); | ||
3009 | if (memoizer[currentComponentErrorInfo]) { | ||
3010 | return; | ||
3011 | } | ||
3012 | memoizer[currentComponentErrorInfo] = true; | ||
3013 | |||
3014 | // Usually the current owner is the offender, but if it accepts children as a | ||
3015 | // property, it may be the creator of the child that's responsible for | ||
3016 | // assigning it a key. | ||
3017 | var childOwner = ''; | ||
3018 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) { | ||
3019 | // Give the component that originally created this child. | ||
3020 | childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; | ||
3021 | } | ||
3022 | |||
3023 | process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0; | ||
3024 | } | ||
3025 | |||
3026 | /** | ||
3027 | * Ensure that every element either is passed in a static location, in an | ||
3028 | * array with an explicit keys property defined, or in an object literal | ||
3029 | * with valid key property. | ||
3030 | * | ||
3031 | * @internal | ||
3032 | * @param {ReactNode} node Statically passed child of any type. | ||
3033 | * @param {*} parentType node's parent's type. | ||
3034 | */ | ||
3035 | function validateChildKeys(node, parentType) { | ||
3036 | if (typeof node !== 'object') { | ||
3037 | return; | ||
3038 | } | ||
3039 | if (Array.isArray(node)) { | ||
3040 | for (var i = 0; i < node.length; i++) { | ||
3041 | var child = node[i]; | ||
3042 | if (ReactElement.isValidElement(child)) { | ||
3043 | validateExplicitKey(child, parentType); | ||
3044 | } | ||
3045 | } | ||
3046 | } else if (ReactElement.isValidElement(node)) { | ||
3047 | // This element was passed in a valid location. | ||
3048 | if (node._store) { | ||
3049 | node._store.validated = true; | ||
3050 | } | ||
3051 | } else if (node) { | ||
3052 | var iteratorFn = getIteratorFn(node); | ||
3053 | // Entry iterators provide implicit keys. | ||
3054 | if (iteratorFn) { | ||
3055 | if (iteratorFn !== node.entries) { | ||
3056 | var iterator = iteratorFn.call(node); | ||
3057 | var step; | ||
3058 | while (!(step = iterator.next()).done) { | ||
3059 | if (ReactElement.isValidElement(step.value)) { | ||
3060 | validateExplicitKey(step.value, parentType); | ||
3061 | } | ||
3062 | } | ||
3063 | } | ||
3064 | } | ||
3065 | } | ||
3066 | } | ||
3067 | |||
3068 | /** | ||
3069 | * Given an element, validate that its props follow the propTypes definition, | ||
3070 | * provided by the type. | ||
3071 | * | ||
3072 | * @param {ReactElement} element | ||
3073 | */ | ||
3074 | function validatePropTypes(element) { | ||
3075 | var componentClass = element.type; | ||
3076 | if (typeof componentClass !== 'function') { | ||
3077 | return; | ||
3078 | } | ||
3079 | var name = componentClass.displayName || componentClass.name; | ||
3080 | if (componentClass.propTypes) { | ||
3081 | checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null); | ||
3082 | } | ||
3083 | if (typeof componentClass.getDefaultProps === 'function') { | ||
3084 | process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0; | ||
3085 | } | ||
3086 | } | ||
3087 | |||
3088 | var ReactElementValidator = { | ||
3089 | |||
3090 | createElement: function (type, props, children) { | ||
3091 | var validType = typeof type === 'string' || typeof type === 'function'; | ||
3092 | // We warn in this case but don't throw. We expect the element creation to | ||
3093 | // succeed and there will likely be errors in render. | ||
3094 | if (!validType) { | ||
3095 | if (typeof type !== 'function' && typeof type !== 'string') { | ||
3096 | var info = ''; | ||
3097 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { | ||
3098 | info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.'; | ||
3099 | } | ||
3100 | |||
3101 | var sourceInfo = getSourceInfoErrorAddendum(props); | ||
3102 | if (sourceInfo) { | ||
3103 | info += sourceInfo; | ||
3104 | } else { | ||
3105 | info += getDeclarationErrorAddendum(); | ||
3106 | } | ||
3107 | |||
3108 | info += ReactComponentTreeHook.getCurrentStackAddendum(); | ||
3109 | |||
3110 | process.env.NODE_ENV !== 'production' ? warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info) : void 0; | ||
3111 | } | ||
3112 | } | ||
3113 | |||
3114 | var element = ReactElement.createElement.apply(this, arguments); | ||
3115 | |||
3116 | // The result can be nullish if a mock or a custom function is used. | ||
3117 | // TODO: Drop this when these are no longer allowed as the type argument. | ||
3118 | if (element == null) { | ||
3119 | return element; | ||
3120 | } | ||
3121 | |||
3122 | // Skip key warning if the type isn't valid since our key validation logic | ||
3123 | // doesn't expect a non-string/function type and can throw confusing errors. | ||
3124 | // We don't want exception behavior to differ between dev and prod. | ||
3125 | // (Rendering will throw with a helpful message and as soon as the type is | ||
3126 | // fixed, the key warnings will appear.) | ||
3127 | if (validType) { | ||
3128 | for (var i = 2; i < arguments.length; i++) { | ||
3129 | validateChildKeys(arguments[i], type); | ||
3130 | } | ||
3131 | } | ||
3132 | |||
3133 | validatePropTypes(element); | ||
3134 | |||
3135 | return element; | ||
3136 | }, | ||
3137 | |||
3138 | createFactory: function (type) { | ||
3139 | var validatedFactory = ReactElementValidator.createElement.bind(null, type); | ||
3140 | // Legacy hook TODO: Warn if this is accessed | ||
3141 | validatedFactory.type = type; | ||
3142 | |||
3143 | if (process.env.NODE_ENV !== 'production') { | ||
3144 | if (canDefineProperty) { | ||
3145 | Object.defineProperty(validatedFactory, 'type', { | ||
3146 | enumerable: false, | ||
3147 | get: function () { | ||
3148 | process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0; | ||
3149 | Object.defineProperty(this, 'type', { | ||
3150 | value: type | ||
3151 | }); | ||
3152 | return type; | ||
3153 | } | ||
3154 | }); | ||
3155 | } | ||
3156 | } | ||
3157 | |||
3158 | return validatedFactory; | ||
3159 | }, | ||
3160 | |||
3161 | cloneElement: function (element, props, children) { | ||
3162 | var newElement = ReactElement.cloneElement.apply(this, arguments); | ||
3163 | for (var i = 2; i < arguments.length; i++) { | ||
3164 | validateChildKeys(arguments[i], newElement.type); | ||
3165 | } | ||
3166 | validatePropTypes(newElement); | ||
3167 | return newElement; | ||
3168 | } | ||
3169 | |||
3170 | }; | ||
3171 | |||
3172 | module.exports = ReactElementValidator; | ||
3173 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
3174 | |||
3175 | /***/ }), | ||
3176 | /* 28 */ | ||
3177 | /***/ (function(module, exports, __webpack_require__) { | ||
3178 | |||
3179 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
3180 | * Copyright 2016-present, Facebook, Inc. | ||
3181 | * All rights reserved. | ||
3182 | * | ||
3183 | * This source code is licensed under the BSD-style license found in the | ||
3184 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3185 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3186 | * | ||
3187 | * | ||
3188 | */ | ||
3189 | |||
3190 | 'use strict'; | ||
3191 | |||
3192 | var _prodInvariant = __webpack_require__(9); | ||
3193 | |||
3194 | var ReactCurrentOwner = __webpack_require__(12); | ||
3195 | |||
3196 | var invariant = __webpack_require__(10); | ||
3197 | var warning = __webpack_require__(13); | ||
3198 | |||
3199 | function isNative(fn) { | ||
3200 | // Based on isNative() from Lodash | ||
3201 | var funcToString = Function.prototype.toString; | ||
3202 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
3203 | var reIsNative = RegExp('^' + funcToString | ||
3204 | // Take an example native function source for comparison | ||
3205 | .call(hasOwnProperty) | ||
3206 | // Strip regex characters so we can use it for regex | ||
3207 | .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') | ||
3208 | // Remove hasOwnProperty from the template to make it generic | ||
3209 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); | ||
3210 | try { | ||
3211 | var source = funcToString.call(fn); | ||
3212 | return reIsNative.test(source); | ||
3213 | } catch (err) { | ||
3214 | return false; | ||
3215 | } | ||
3216 | } | ||
3217 | |||
3218 | var canUseCollections = | ||
3219 | // Array.from | ||
3220 | typeof Array.from === 'function' && | ||
3221 | // Map | ||
3222 | typeof Map === 'function' && isNative(Map) && | ||
3223 | // Map.prototype.keys | ||
3224 | Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) && | ||
3225 | // Set | ||
3226 | typeof Set === 'function' && isNative(Set) && | ||
3227 | // Set.prototype.keys | ||
3228 | Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys); | ||
3229 | |||
3230 | var setItem; | ||
3231 | var getItem; | ||
3232 | var removeItem; | ||
3233 | var getItemIDs; | ||
3234 | var addRoot; | ||
3235 | var removeRoot; | ||
3236 | var getRootIDs; | ||
3237 | |||
3238 | if (canUseCollections) { | ||
3239 | var itemMap = new Map(); | ||
3240 | var rootIDSet = new Set(); | ||
3241 | |||
3242 | setItem = function (id, item) { | ||
3243 | itemMap.set(id, item); | ||
3244 | }; | ||
3245 | getItem = function (id) { | ||
3246 | return itemMap.get(id); | ||
3247 | }; | ||
3248 | removeItem = function (id) { | ||
3249 | itemMap['delete'](id); | ||
3250 | }; | ||
3251 | getItemIDs = function () { | ||
3252 | return Array.from(itemMap.keys()); | ||
3253 | }; | ||
3254 | |||
3255 | addRoot = function (id) { | ||
3256 | rootIDSet.add(id); | ||
3257 | }; | ||
3258 | removeRoot = function (id) { | ||
3259 | rootIDSet['delete'](id); | ||
3260 | }; | ||
3261 | getRootIDs = function () { | ||
3262 | return Array.from(rootIDSet.keys()); | ||
3263 | }; | ||
3264 | } else { | ||
3265 | var itemByKey = {}; | ||
3266 | var rootByKey = {}; | ||
3267 | |||
3268 | // Use non-numeric keys to prevent V8 performance issues: | ||
3269 | // https://github.com/facebook/react/pull/7232 | ||
3270 | var getKeyFromID = function (id) { | ||
3271 | return '.' + id; | ||
3272 | }; | ||
3273 | var getIDFromKey = function (key) { | ||
3274 | return parseInt(key.substr(1), 10); | ||
3275 | }; | ||
3276 | |||
3277 | setItem = function (id, item) { | ||
3278 | var key = getKeyFromID(id); | ||
3279 | itemByKey[key] = item; | ||
3280 | }; | ||
3281 | getItem = function (id) { | ||
3282 | var key = getKeyFromID(id); | ||
3283 | return itemByKey[key]; | ||
3284 | }; | ||
3285 | removeItem = function (id) { | ||
3286 | var key = getKeyFromID(id); | ||
3287 | delete itemByKey[key]; | ||
3288 | }; | ||
3289 | getItemIDs = function () { | ||
3290 | return Object.keys(itemByKey).map(getIDFromKey); | ||
3291 | }; | ||
3292 | |||
3293 | addRoot = function (id) { | ||
3294 | var key = getKeyFromID(id); | ||
3295 | rootByKey[key] = true; | ||
3296 | }; | ||
3297 | removeRoot = function (id) { | ||
3298 | var key = getKeyFromID(id); | ||
3299 | delete rootByKey[key]; | ||
3300 | }; | ||
3301 | getRootIDs = function () { | ||
3302 | return Object.keys(rootByKey).map(getIDFromKey); | ||
3303 | }; | ||
3304 | } | ||
3305 | |||
3306 | var unmountedIDs = []; | ||
3307 | |||
3308 | function purgeDeep(id) { | ||
3309 | var item = getItem(id); | ||
3310 | if (item) { | ||
3311 | var childIDs = item.childIDs; | ||
3312 | |||
3313 | removeItem(id); | ||
3314 | childIDs.forEach(purgeDeep); | ||
3315 | } | ||
3316 | } | ||
3317 | |||
3318 | function describeComponentFrame(name, source, ownerName) { | ||
3319 | return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); | ||
3320 | } | ||
3321 | |||
3322 | function getDisplayName(element) { | ||
3323 | if (element == null) { | ||
3324 | return '#empty'; | ||
3325 | } else if (typeof element === 'string' || typeof element === 'number') { | ||
3326 | return '#text'; | ||
3327 | } else if (typeof element.type === 'string') { | ||
3328 | return element.type; | ||
3329 | } else { | ||
3330 | return element.type.displayName || element.type.name || 'Unknown'; | ||
3331 | } | ||
3332 | } | ||
3333 | |||
3334 | function describeID(id) { | ||
3335 | var name = ReactComponentTreeHook.getDisplayName(id); | ||
3336 | var element = ReactComponentTreeHook.getElement(id); | ||
3337 | var ownerID = ReactComponentTreeHook.getOwnerID(id); | ||
3338 | var ownerName; | ||
3339 | if (ownerID) { | ||
3340 | ownerName = ReactComponentTreeHook.getDisplayName(ownerID); | ||
3341 | } | ||
3342 | process.env.NODE_ENV !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0; | ||
3343 | return describeComponentFrame(name, element && element._source, ownerName); | ||
3344 | } | ||
3345 | |||
3346 | var ReactComponentTreeHook = { | ||
3347 | onSetChildren: function (id, nextChildIDs) { | ||
3348 | var item = getItem(id); | ||
3349 | !item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; | ||
3350 | item.childIDs = nextChildIDs; | ||
3351 | |||
3352 | for (var i = 0; i < nextChildIDs.length; i++) { | ||
3353 | var nextChildID = nextChildIDs[i]; | ||
3354 | var nextChild = getItem(nextChildID); | ||
3355 | !nextChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0; | ||
3356 | !(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0; | ||
3357 | !nextChild.isMounted ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0; | ||
3358 | if (nextChild.parentID == null) { | ||
3359 | nextChild.parentID = id; | ||
3360 | // TODO: This shouldn't be necessary but mounting a new root during in | ||
3361 | // componentWillMount currently causes not-yet-mounted components to | ||
3362 | // be purged from our tree data so their parent id is missing. | ||
3363 | } | ||
3364 | !(nextChild.parentID === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0; | ||
3365 | } | ||
3366 | }, | ||
3367 | onBeforeMountComponent: function (id, element, parentID) { | ||
3368 | var item = { | ||
3369 | element: element, | ||
3370 | parentID: parentID, | ||
3371 | text: null, | ||
3372 | childIDs: [], | ||
3373 | isMounted: false, | ||
3374 | updateCount: 0 | ||
3375 | }; | ||
3376 | setItem(id, item); | ||
3377 | }, | ||
3378 | onBeforeUpdateComponent: function (id, element) { | ||
3379 | var item = getItem(id); | ||
3380 | if (!item || !item.isMounted) { | ||
3381 | // We may end up here as a result of setState() in componentWillUnmount(). | ||
3382 | // In this case, ignore the element. | ||
3383 | return; | ||
3384 | } | ||
3385 | item.element = element; | ||
3386 | }, | ||
3387 | onMountComponent: function (id) { | ||
3388 | var item = getItem(id); | ||
3389 | !item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; | ||
3390 | item.isMounted = true; | ||
3391 | var isRoot = item.parentID === 0; | ||
3392 | if (isRoot) { | ||
3393 | addRoot(id); | ||
3394 | } | ||
3395 | }, | ||
3396 | onUpdateComponent: function (id) { | ||
3397 | var item = getItem(id); | ||
3398 | if (!item || !item.isMounted) { | ||
3399 | // We may end up here as a result of setState() in componentWillUnmount(). | ||
3400 | // In this case, ignore the element. | ||
3401 | return; | ||
3402 | } | ||
3403 | item.updateCount++; | ||
3404 | }, | ||
3405 | onUnmountComponent: function (id) { | ||
3406 | var item = getItem(id); | ||
3407 | if (item) { | ||
3408 | // We need to check if it exists. | ||
3409 | // `item` might not exist if it is inside an error boundary, and a sibling | ||
3410 | // error boundary child threw while mounting. Then this instance never | ||
3411 | // got a chance to mount, but it still gets an unmounting event during | ||
3412 | // the error boundary cleanup. | ||
3413 | item.isMounted = false; | ||
3414 | var isRoot = item.parentID === 0; | ||
3415 | if (isRoot) { | ||
3416 | removeRoot(id); | ||
3417 | } | ||
3418 | } | ||
3419 | unmountedIDs.push(id); | ||
3420 | }, | ||
3421 | purgeUnmountedComponents: function () { | ||
3422 | if (ReactComponentTreeHook._preventPurging) { | ||
3423 | // Should only be used for testing. | ||
3424 | return; | ||
3425 | } | ||
3426 | |||
3427 | for (var i = 0; i < unmountedIDs.length; i++) { | ||
3428 | var id = unmountedIDs[i]; | ||
3429 | purgeDeep(id); | ||
3430 | } | ||
3431 | unmountedIDs.length = 0; | ||
3432 | }, | ||
3433 | isMounted: function (id) { | ||
3434 | var item = getItem(id); | ||
3435 | return item ? item.isMounted : false; | ||
3436 | }, | ||
3437 | getCurrentStackAddendum: function (topElement) { | ||
3438 | var info = ''; | ||
3439 | if (topElement) { | ||
3440 | var name = getDisplayName(topElement); | ||
3441 | var owner = topElement._owner; | ||
3442 | info += describeComponentFrame(name, topElement._source, owner && owner.getName()); | ||
3443 | } | ||
3444 | |||
3445 | var currentOwner = ReactCurrentOwner.current; | ||
3446 | var id = currentOwner && currentOwner._debugID; | ||
3447 | |||
3448 | info += ReactComponentTreeHook.getStackAddendumByID(id); | ||
3449 | return info; | ||
3450 | }, | ||
3451 | getStackAddendumByID: function (id) { | ||
3452 | var info = ''; | ||
3453 | while (id) { | ||
3454 | info += describeID(id); | ||
3455 | id = ReactComponentTreeHook.getParentID(id); | ||
3456 | } | ||
3457 | return info; | ||
3458 | }, | ||
3459 | getChildIDs: function (id) { | ||
3460 | var item = getItem(id); | ||
3461 | return item ? item.childIDs : []; | ||
3462 | }, | ||
3463 | getDisplayName: function (id) { | ||
3464 | var element = ReactComponentTreeHook.getElement(id); | ||
3465 | if (!element) { | ||
3466 | return null; | ||
3467 | } | ||
3468 | return getDisplayName(element); | ||
3469 | }, | ||
3470 | getElement: function (id) { | ||
3471 | var item = getItem(id); | ||
3472 | return item ? item.element : null; | ||
3473 | }, | ||
3474 | getOwnerID: function (id) { | ||
3475 | var element = ReactComponentTreeHook.getElement(id); | ||
3476 | if (!element || !element._owner) { | ||
3477 | return null; | ||
3478 | } | ||
3479 | return element._owner._debugID; | ||
3480 | }, | ||
3481 | getParentID: function (id) { | ||
3482 | var item = getItem(id); | ||
3483 | return item ? item.parentID : null; | ||
3484 | }, | ||
3485 | getSource: function (id) { | ||
3486 | var item = getItem(id); | ||
3487 | var element = item ? item.element : null; | ||
3488 | var source = element != null ? element._source : null; | ||
3489 | return source; | ||
3490 | }, | ||
3491 | getText: function (id) { | ||
3492 | var element = ReactComponentTreeHook.getElement(id); | ||
3493 | if (typeof element === 'string') { | ||
3494 | return element; | ||
3495 | } else if (typeof element === 'number') { | ||
3496 | return '' + element; | ||
3497 | } else { | ||
3498 | return null; | ||
3499 | } | ||
3500 | }, | ||
3501 | getUpdateCount: function (id) { | ||
3502 | var item = getItem(id); | ||
3503 | return item ? item.updateCount : 0; | ||
3504 | }, | ||
3505 | |||
3506 | |||
3507 | getRootIDs: getRootIDs, | ||
3508 | getRegisteredIDs: getItemIDs | ||
3509 | }; | ||
3510 | |||
3511 | module.exports = ReactComponentTreeHook; | ||
3512 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
3513 | |||
3514 | /***/ }), | ||
3515 | /* 29 */ | ||
3516 | /***/ (function(module, exports, __webpack_require__) { | ||
3517 | |||
3518 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
3519 | * Copyright 2013-present, Facebook, Inc. | ||
3520 | * All rights reserved. | ||
3521 | * | ||
3522 | * This source code is licensed under the BSD-style license found in the | ||
3523 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3524 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3525 | * | ||
3526 | */ | ||
3527 | |||
3528 | 'use strict'; | ||
3529 | |||
3530 | var _prodInvariant = __webpack_require__(9); | ||
3531 | |||
3532 | var ReactPropTypeLocationNames = __webpack_require__(25); | ||
3533 | var ReactPropTypesSecret = __webpack_require__(30); | ||
3534 | |||
3535 | var invariant = __webpack_require__(10); | ||
3536 | var warning = __webpack_require__(13); | ||
3537 | |||
3538 | var ReactComponentTreeHook; | ||
3539 | |||
3540 | if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { | ||
3541 | // Temporary hack. | ||
3542 | // Inline requires don't work well with Jest: | ||
3543 | // https://github.com/facebook/react/issues/7240 | ||
3544 | // Remove the inline requires when we don't need them anymore: | ||
3545 | // https://github.com/facebook/react/pull/7178 | ||
3546 | ReactComponentTreeHook = __webpack_require__(28); | ||
3547 | } | ||
3548 | |||
3549 | var loggedTypeFailures = {}; | ||
3550 | |||
3551 | /** | ||
3552 | * Assert that the values match with the type specs. | ||
3553 | * Error messages are memorized and will only be shown once. | ||
3554 | * | ||
3555 | * @param {object} typeSpecs Map of name to a ReactPropType | ||
3556 | * @param {object} values Runtime values that need to be type-checked | ||
3557 | * @param {string} location e.g. "prop", "context", "child context" | ||
3558 | * @param {string} componentName Name of the component for error messages. | ||
3559 | * @param {?object} element The React element that is being type-checked | ||
3560 | * @param {?number} debugID The React component instance that is being type-checked | ||
3561 | * @private | ||
3562 | */ | ||
3563 | function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) { | ||
3564 | for (var typeSpecName in typeSpecs) { | ||
3565 | if (typeSpecs.hasOwnProperty(typeSpecName)) { | ||
3566 | var error; | ||
3567 | // Prop type validation may throw. In case they do, we don't want to | ||
3568 | // fail the render phase where it didn't fail before. So we log it. | ||
3569 | // After these have been cleaned up, we'll let them throw. | ||
3570 | try { | ||
3571 | // This is intentionally an invariant that gets caught. It's the same | ||
3572 | // behavior as without this statement except with a better message. | ||
3573 | !(typeof typeSpecs[typeSpecName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0; | ||
3574 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); | ||
3575 | } catch (ex) { | ||
3576 | error = ex; | ||
3577 | } | ||
3578 | process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName, typeof error) : void 0; | ||
3579 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
3580 | // Only monitor this failure once because there tends to be a lot of the | ||
3581 | // same error. | ||
3582 | loggedTypeFailures[error.message] = true; | ||
3583 | |||
3584 | var componentStackInfo = ''; | ||
3585 | |||
3586 | if (process.env.NODE_ENV !== 'production') { | ||
3587 | if (!ReactComponentTreeHook) { | ||
3588 | ReactComponentTreeHook = __webpack_require__(28); | ||
3589 | } | ||
3590 | if (debugID !== null) { | ||
3591 | componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID); | ||
3592 | } else if (element !== null) { | ||
3593 | componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element); | ||
3594 | } | ||
3595 | } | ||
3596 | |||
3597 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0; | ||
3598 | } | ||
3599 | } | ||
3600 | } | ||
3601 | } | ||
3602 | |||
3603 | module.exports = checkReactTypeSpec; | ||
3604 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
3605 | |||
3606 | /***/ }), | ||
3607 | /* 30 */ | ||
3608 | /***/ (function(module, exports) { | ||
3609 | |||
3610 | /** | ||
3611 | * Copyright 2013-present, Facebook, Inc. | ||
3612 | * All rights reserved. | ||
3613 | * | ||
3614 | * This source code is licensed under the BSD-style license found in the | ||
3615 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3616 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3617 | * | ||
3618 | * | ||
3619 | */ | ||
3620 | |||
3621 | 'use strict'; | ||
3622 | |||
3623 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | ||
3624 | |||
3625 | module.exports = ReactPropTypesSecret; | ||
3626 | |||
3627 | /***/ }), | ||
3628 | /* 31 */ | ||
3629 | /***/ (function(module, exports, __webpack_require__) { | ||
3630 | |||
3631 | /** | ||
3632 | * Copyright 2013-present, Facebook, Inc. | ||
3633 | * All rights reserved. | ||
3634 | * | ||
3635 | * This source code is licensed under the BSD-style license found in the | ||
3636 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3637 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3638 | * | ||
3639 | */ | ||
3640 | |||
3641 | 'use strict'; | ||
3642 | |||
3643 | var _require = __webpack_require__(11), | ||
3644 | isValidElement = _require.isValidElement; | ||
3645 | |||
3646 | var factory = __webpack_require__(32); | ||
3647 | |||
3648 | module.exports = factory(isValidElement); | ||
3649 | |||
3650 | /***/ }), | ||
3651 | /* 32 */ | ||
3652 | /***/ (function(module, exports, __webpack_require__) { | ||
3653 | |||
3654 | /** | ||
3655 | * Copyright 2013-present, Facebook, Inc. | ||
3656 | * All rights reserved. | ||
3657 | * | ||
3658 | * This source code is licensed under the BSD-style license found in the | ||
3659 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3660 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3661 | */ | ||
3662 | |||
3663 | 'use strict'; | ||
3664 | |||
3665 | // React 15.5 references this module, and assumes PropTypes are still callable in production. | ||
3666 | // Therefore we re-export development-only version with all the PropTypes checks here. | ||
3667 | // However if one is migrating to the `prop-types` npm library, they will go through the | ||
3668 | // `index.js` entry point, and it will branch depending on the environment. | ||
3669 | var factory = __webpack_require__(33); | ||
3670 | module.exports = function(isValidElement) { | ||
3671 | // It is still allowed in 15.5. | ||
3672 | var throwOnDirectAccess = false; | ||
3673 | return factory(isValidElement, throwOnDirectAccess); | ||
3674 | }; | ||
3675 | |||
3676 | |||
3677 | /***/ }), | ||
3678 | /* 33 */ | ||
3679 | /***/ (function(module, exports, __webpack_require__) { | ||
3680 | |||
3681 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
3682 | * Copyright 2013-present, Facebook, Inc. | ||
3683 | * All rights reserved. | ||
3684 | * | ||
3685 | * This source code is licensed under the BSD-style license found in the | ||
3686 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3687 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3688 | */ | ||
3689 | |||
3690 | 'use strict'; | ||
3691 | |||
3692 | var emptyFunction = __webpack_require__(14); | ||
3693 | var invariant = __webpack_require__(10); | ||
3694 | var warning = __webpack_require__(13); | ||
3695 | |||
3696 | var ReactPropTypesSecret = __webpack_require__(34); | ||
3697 | var checkPropTypes = __webpack_require__(35); | ||
3698 | |||
3699 | module.exports = function(isValidElement, throwOnDirectAccess) { | ||
3700 | /* global Symbol */ | ||
3701 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | ||
3702 | var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | ||
3703 | |||
3704 | /** | ||
3705 | * Returns the iterator method function contained on the iterable object. | ||
3706 | * | ||
3707 | * Be sure to invoke the function with the iterable as context: | ||
3708 | * | ||
3709 | * var iteratorFn = getIteratorFn(myIterable); | ||
3710 | * if (iteratorFn) { | ||
3711 | * var iterator = iteratorFn.call(myIterable); | ||
3712 | * ... | ||
3713 | * } | ||
3714 | * | ||
3715 | * @param {?object} maybeIterable | ||
3716 | * @return {?function} | ||
3717 | */ | ||
3718 | function getIteratorFn(maybeIterable) { | ||
3719 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | ||
3720 | if (typeof iteratorFn === 'function') { | ||
3721 | return iteratorFn; | ||
3722 | } | ||
3723 | } | ||
3724 | |||
3725 | /** | ||
3726 | * Collection of methods that allow declaration and validation of props that are | ||
3727 | * supplied to React components. Example usage: | ||
3728 | * | ||
3729 | * var Props = require('ReactPropTypes'); | ||
3730 | * var MyArticle = React.createClass({ | ||
3731 | * propTypes: { | ||
3732 | * // An optional string prop named "description". | ||
3733 | * description: Props.string, | ||
3734 | * | ||
3735 | * // A required enum prop named "category". | ||
3736 | * category: Props.oneOf(['News','Photos']).isRequired, | ||
3737 | * | ||
3738 | * // A prop named "dialog" that requires an instance of Dialog. | ||
3739 | * dialog: Props.instanceOf(Dialog).isRequired | ||
3740 | * }, | ||
3741 | * render: function() { ... } | ||
3742 | * }); | ||
3743 | * | ||
3744 | * A more formal specification of how these methods are used: | ||
3745 | * | ||
3746 | * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) | ||
3747 | * decl := ReactPropTypes.{type}(.isRequired)? | ||
3748 | * | ||
3749 | * Each and every declaration produces a function with the same signature. This | ||
3750 | * allows the creation of custom validation functions. For example: | ||
3751 | * | ||
3752 | * var MyLink = React.createClass({ | ||
3753 | * propTypes: { | ||
3754 | * // An optional string or URI prop named "href". | ||
3755 | * href: function(props, propName, componentName) { | ||
3756 | * var propValue = props[propName]; | ||
3757 | * if (propValue != null && typeof propValue !== 'string' && | ||
3758 | * !(propValue instanceof URI)) { | ||
3759 | * return new Error( | ||
3760 | * 'Expected a string or an URI for ' + propName + ' in ' + | ||
3761 | * componentName | ||
3762 | * ); | ||
3763 | * } | ||
3764 | * } | ||
3765 | * }, | ||
3766 | * render: function() {...} | ||
3767 | * }); | ||
3768 | * | ||
3769 | * @internal | ||
3770 | */ | ||
3771 | |||
3772 | var ANONYMOUS = '<<anonymous>>'; | ||
3773 | |||
3774 | // Important! | ||
3775 | // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. | ||
3776 | var ReactPropTypes = { | ||
3777 | array: createPrimitiveTypeChecker('array'), | ||
3778 | bool: createPrimitiveTypeChecker('boolean'), | ||
3779 | func: createPrimitiveTypeChecker('function'), | ||
3780 | number: createPrimitiveTypeChecker('number'), | ||
3781 | object: createPrimitiveTypeChecker('object'), | ||
3782 | string: createPrimitiveTypeChecker('string'), | ||
3783 | symbol: createPrimitiveTypeChecker('symbol'), | ||
3784 | |||
3785 | any: createAnyTypeChecker(), | ||
3786 | arrayOf: createArrayOfTypeChecker, | ||
3787 | element: createElementTypeChecker(), | ||
3788 | instanceOf: createInstanceTypeChecker, | ||
3789 | node: createNodeChecker(), | ||
3790 | objectOf: createObjectOfTypeChecker, | ||
3791 | oneOf: createEnumTypeChecker, | ||
3792 | oneOfType: createUnionTypeChecker, | ||
3793 | shape: createShapeTypeChecker | ||
3794 | }; | ||
3795 | |||
3796 | /** | ||
3797 | * inlined Object.is polyfill to avoid requiring consumers ship their own | ||
3798 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | ||
3799 | */ | ||
3800 | /*eslint-disable no-self-compare*/ | ||
3801 | function is(x, y) { | ||
3802 | // SameValue algorithm | ||
3803 | if (x === y) { | ||
3804 | // Steps 1-5, 7-10 | ||
3805 | // Steps 6.b-6.e: +0 != -0 | ||
3806 | return x !== 0 || 1 / x === 1 / y; | ||
3807 | } else { | ||
3808 | // Step 6.a: NaN == NaN | ||
3809 | return x !== x && y !== y; | ||
3810 | } | ||
3811 | } | ||
3812 | /*eslint-enable no-self-compare*/ | ||
3813 | |||
3814 | /** | ||
3815 | * We use an Error-like object for backward compatibility as people may call | ||
3816 | * PropTypes directly and inspect their output. However, we don't use real | ||
3817 | * Errors anymore. We don't inspect their stack anyway, and creating them | ||
3818 | * is prohibitively expensive if they are created too often, such as what | ||
3819 | * happens in oneOfType() for any type before the one that matched. | ||
3820 | */ | ||
3821 | function PropTypeError(message) { | ||
3822 | this.message = message; | ||
3823 | this.stack = ''; | ||
3824 | } | ||
3825 | // Make `instanceof Error` still work for returned errors. | ||
3826 | PropTypeError.prototype = Error.prototype; | ||
3827 | |||
3828 | function createChainableTypeChecker(validate) { | ||
3829 | if (process.env.NODE_ENV !== 'production') { | ||
3830 | var manualPropTypeCallCache = {}; | ||
3831 | var manualPropTypeWarningCount = 0; | ||
3832 | } | ||
3833 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { | ||
3834 | componentName = componentName || ANONYMOUS; | ||
3835 | propFullName = propFullName || propName; | ||
3836 | |||
3837 | if (secret !== ReactPropTypesSecret) { | ||
3838 | if (throwOnDirectAccess) { | ||
3839 | // New behavior only for users of `prop-types` package | ||
3840 | invariant( | ||
3841 | false, | ||
3842 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | ||
3843 | 'Use `PropTypes.checkPropTypes()` to call them. ' + | ||
3844 | 'Read more at http://fb.me/use-check-prop-types' | ||
3845 | ); | ||
3846 | } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { | ||
3847 | // Old behavior for people using React.PropTypes | ||
3848 | var cacheKey = componentName + ':' + propName; | ||
3849 | if ( | ||
3850 | !manualPropTypeCallCache[cacheKey] && | ||
3851 | // Avoid spamming the console because they are often not actionable except for lib authors | ||
3852 | manualPropTypeWarningCount < 3 | ||
3853 | ) { | ||
3854 | warning( | ||
3855 | false, | ||
3856 | 'You are manually calling a React.PropTypes validation ' + | ||
3857 | 'function for the `%s` prop on `%s`. This is deprecated ' + | ||
3858 | 'and will throw in the standalone `prop-types` package. ' + | ||
3859 | 'You may be seeing this warning due to a third-party PropTypes ' + | ||
3860 | 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', | ||
3861 | propFullName, | ||
3862 | componentName | ||
3863 | ); | ||
3864 | manualPropTypeCallCache[cacheKey] = true; | ||
3865 | manualPropTypeWarningCount++; | ||
3866 | } | ||
3867 | } | ||
3868 | } | ||
3869 | if (props[propName] == null) { | ||
3870 | if (isRequired) { | ||
3871 | if (props[propName] === null) { | ||
3872 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); | ||
3873 | } | ||
3874 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); | ||
3875 | } | ||
3876 | return null; | ||
3877 | } else { | ||
3878 | return validate(props, propName, componentName, location, propFullName); | ||
3879 | } | ||
3880 | } | ||
3881 | |||
3882 | var chainedCheckType = checkType.bind(null, false); | ||
3883 | chainedCheckType.isRequired = checkType.bind(null, true); | ||
3884 | |||
3885 | return chainedCheckType; | ||
3886 | } | ||
3887 | |||
3888 | function createPrimitiveTypeChecker(expectedType) { | ||
3889 | function validate(props, propName, componentName, location, propFullName, secret) { | ||
3890 | var propValue = props[propName]; | ||
3891 | var propType = getPropType(propValue); | ||
3892 | if (propType !== expectedType) { | ||
3893 | // `propValue` being instance of, say, date/regexp, pass the 'object' | ||
3894 | // check, but we can offer a more precise error message here rather than | ||
3895 | // 'of type `object`'. | ||
3896 | var preciseType = getPreciseType(propValue); | ||
3897 | |||
3898 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); | ||
3899 | } | ||
3900 | return null; | ||
3901 | } | ||
3902 | return createChainableTypeChecker(validate); | ||
3903 | } | ||
3904 | |||
3905 | function createAnyTypeChecker() { | ||
3906 | return createChainableTypeChecker(emptyFunction.thatReturnsNull); | ||
3907 | } | ||
3908 | |||
3909 | function createArrayOfTypeChecker(typeChecker) { | ||
3910 | function validate(props, propName, componentName, location, propFullName) { | ||
3911 | if (typeof typeChecker !== 'function') { | ||
3912 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); | ||
3913 | } | ||
3914 | var propValue = props[propName]; | ||
3915 | if (!Array.isArray(propValue)) { | ||
3916 | var propType = getPropType(propValue); | ||
3917 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); | ||
3918 | } | ||
3919 | for (var i = 0; i < propValue.length; i++) { | ||
3920 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); | ||
3921 | if (error instanceof Error) { | ||
3922 | return error; | ||
3923 | } | ||
3924 | } | ||
3925 | return null; | ||
3926 | } | ||
3927 | return createChainableTypeChecker(validate); | ||
3928 | } | ||
3929 | |||
3930 | function createElementTypeChecker() { | ||
3931 | function validate(props, propName, componentName, location, propFullName) { | ||
3932 | var propValue = props[propName]; | ||
3933 | if (!isValidElement(propValue)) { | ||
3934 | var propType = getPropType(propValue); | ||
3935 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); | ||
3936 | } | ||
3937 | return null; | ||
3938 | } | ||
3939 | return createChainableTypeChecker(validate); | ||
3940 | } | ||
3941 | |||
3942 | function createInstanceTypeChecker(expectedClass) { | ||
3943 | function validate(props, propName, componentName, location, propFullName) { | ||
3944 | if (!(props[propName] instanceof expectedClass)) { | ||
3945 | var expectedClassName = expectedClass.name || ANONYMOUS; | ||
3946 | var actualClassName = getClassName(props[propName]); | ||
3947 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); | ||
3948 | } | ||
3949 | return null; | ||
3950 | } | ||
3951 | return createChainableTypeChecker(validate); | ||
3952 | } | ||
3953 | |||
3954 | function createEnumTypeChecker(expectedValues) { | ||
3955 | if (!Array.isArray(expectedValues)) { | ||
3956 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; | ||
3957 | return emptyFunction.thatReturnsNull; | ||
3958 | } | ||
3959 | |||
3960 | function validate(props, propName, componentName, location, propFullName) { | ||
3961 | var propValue = props[propName]; | ||
3962 | for (var i = 0; i < expectedValues.length; i++) { | ||
3963 | if (is(propValue, expectedValues[i])) { | ||
3964 | return null; | ||
3965 | } | ||
3966 | } | ||
3967 | |||
3968 | var valuesString = JSON.stringify(expectedValues); | ||
3969 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); | ||
3970 | } | ||
3971 | return createChainableTypeChecker(validate); | ||
3972 | } | ||
3973 | |||
3974 | function createObjectOfTypeChecker(typeChecker) { | ||
3975 | function validate(props, propName, componentName, location, propFullName) { | ||
3976 | if (typeof typeChecker !== 'function') { | ||
3977 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); | ||
3978 | } | ||
3979 | var propValue = props[propName]; | ||
3980 | var propType = getPropType(propValue); | ||
3981 | if (propType !== 'object') { | ||
3982 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); | ||
3983 | } | ||
3984 | for (var key in propValue) { | ||
3985 | if (propValue.hasOwnProperty(key)) { | ||
3986 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); | ||
3987 | if (error instanceof Error) { | ||
3988 | return error; | ||
3989 | } | ||
3990 | } | ||
3991 | } | ||
3992 | return null; | ||
3993 | } | ||
3994 | return createChainableTypeChecker(validate); | ||
3995 | } | ||
3996 | |||
3997 | function createUnionTypeChecker(arrayOfTypeCheckers) { | ||
3998 | if (!Array.isArray(arrayOfTypeCheckers)) { | ||
3999 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; | ||
4000 | return emptyFunction.thatReturnsNull; | ||
4001 | } | ||
4002 | |||
4003 | function validate(props, propName, componentName, location, propFullName) { | ||
4004 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
4005 | var checker = arrayOfTypeCheckers[i]; | ||
4006 | if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { | ||
4007 | return null; | ||
4008 | } | ||
4009 | } | ||
4010 | |||
4011 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); | ||
4012 | } | ||
4013 | return createChainableTypeChecker(validate); | ||
4014 | } | ||
4015 | |||
4016 | function createNodeChecker() { | ||
4017 | function validate(props, propName, componentName, location, propFullName) { | ||
4018 | if (!isNode(props[propName])) { | ||
4019 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); | ||
4020 | } | ||
4021 | return null; | ||
4022 | } | ||
4023 | return createChainableTypeChecker(validate); | ||
4024 | } | ||
4025 | |||
4026 | function createShapeTypeChecker(shapeTypes) { | ||
4027 | function validate(props, propName, componentName, location, propFullName) { | ||
4028 | var propValue = props[propName]; | ||
4029 | var propType = getPropType(propValue); | ||
4030 | if (propType !== 'object') { | ||
4031 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); | ||
4032 | } | ||
4033 | for (var key in shapeTypes) { | ||
4034 | var checker = shapeTypes[key]; | ||
4035 | if (!checker) { | ||
4036 | continue; | ||
4037 | } | ||
4038 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); | ||
4039 | if (error) { | ||
4040 | return error; | ||
4041 | } | ||
4042 | } | ||
4043 | return null; | ||
4044 | } | ||
4045 | return createChainableTypeChecker(validate); | ||
4046 | } | ||
4047 | |||
4048 | function isNode(propValue) { | ||
4049 | switch (typeof propValue) { | ||
4050 | case 'number': | ||
4051 | case 'string': | ||
4052 | case 'undefined': | ||
4053 | return true; | ||
4054 | case 'boolean': | ||
4055 | return !propValue; | ||
4056 | case 'object': | ||
4057 | if (Array.isArray(propValue)) { | ||
4058 | return propValue.every(isNode); | ||
4059 | } | ||
4060 | if (propValue === null || isValidElement(propValue)) { | ||
4061 | return true; | ||
4062 | } | ||
4063 | |||
4064 | var iteratorFn = getIteratorFn(propValue); | ||
4065 | if (iteratorFn) { | ||
4066 | var iterator = iteratorFn.call(propValue); | ||
4067 | var step; | ||
4068 | if (iteratorFn !== propValue.entries) { | ||
4069 | while (!(step = iterator.next()).done) { | ||
4070 | if (!isNode(step.value)) { | ||
4071 | return false; | ||
4072 | } | ||
4073 | } | ||
4074 | } else { | ||
4075 | // Iterator will provide entry [k,v] tuples rather than values. | ||
4076 | while (!(step = iterator.next()).done) { | ||
4077 | var entry = step.value; | ||
4078 | if (entry) { | ||
4079 | if (!isNode(entry[1])) { | ||
4080 | return false; | ||
4081 | } | ||
4082 | } | ||
4083 | } | ||
4084 | } | ||
4085 | } else { | ||
4086 | return false; | ||
4087 | } | ||
4088 | |||
4089 | return true; | ||
4090 | default: | ||
4091 | return false; | ||
4092 | } | ||
4093 | } | ||
4094 | |||
4095 | function isSymbol(propType, propValue) { | ||
4096 | // Native Symbol. | ||
4097 | if (propType === 'symbol') { | ||
4098 | return true; | ||
4099 | } | ||
4100 | |||
4101 | // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' | ||
4102 | if (propValue['@@toStringTag'] === 'Symbol') { | ||
4103 | return true; | ||
4104 | } | ||
4105 | |||
4106 | // Fallback for non-spec compliant Symbols which are polyfilled. | ||
4107 | if (typeof Symbol === 'function' && propValue instanceof Symbol) { | ||
4108 | return true; | ||
4109 | } | ||
4110 | |||
4111 | return false; | ||
4112 | } | ||
4113 | |||
4114 | // Equivalent of `typeof` but with special handling for array and regexp. | ||
4115 | function getPropType(propValue) { | ||
4116 | var propType = typeof propValue; | ||
4117 | if (Array.isArray(propValue)) { | ||
4118 | return 'array'; | ||
4119 | } | ||
4120 | if (propValue instanceof RegExp) { | ||
4121 | // Old webkits (at least until Android 4.0) return 'function' rather than | ||
4122 | // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ | ||
4123 | // passes PropTypes.object. | ||
4124 | return 'object'; | ||
4125 | } | ||
4126 | if (isSymbol(propType, propValue)) { | ||
4127 | return 'symbol'; | ||
4128 | } | ||
4129 | return propType; | ||
4130 | } | ||
4131 | |||
4132 | // This handles more types than `getPropType`. Only used for error messages. | ||
4133 | // See `createPrimitiveTypeChecker`. | ||
4134 | function getPreciseType(propValue) { | ||
4135 | var propType = getPropType(propValue); | ||
4136 | if (propType === 'object') { | ||
4137 | if (propValue instanceof Date) { | ||
4138 | return 'date'; | ||
4139 | } else if (propValue instanceof RegExp) { | ||
4140 | return 'regexp'; | ||
4141 | } | ||
4142 | } | ||
4143 | return propType; | ||
4144 | } | ||
4145 | |||
4146 | // Returns class name of the object, if any. | ||
4147 | function getClassName(propValue) { | ||
4148 | if (!propValue.constructor || !propValue.constructor.name) { | ||
4149 | return ANONYMOUS; | ||
4150 | } | ||
4151 | return propValue.constructor.name; | ||
4152 | } | ||
4153 | |||
4154 | ReactPropTypes.checkPropTypes = checkPropTypes; | ||
4155 | ReactPropTypes.PropTypes = ReactPropTypes; | ||
4156 | |||
4157 | return ReactPropTypes; | ||
4158 | }; | ||
4159 | |||
4160 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
4161 | |||
4162 | /***/ }), | ||
4163 | /* 34 */ | ||
4164 | /***/ (function(module, exports) { | ||
4165 | |||
4166 | /** | ||
4167 | * Copyright 2013-present, Facebook, Inc. | ||
4168 | * All rights reserved. | ||
4169 | * | ||
4170 | * This source code is licensed under the BSD-style license found in the | ||
4171 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4172 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4173 | */ | ||
4174 | |||
4175 | 'use strict'; | ||
4176 | |||
4177 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | ||
4178 | |||
4179 | module.exports = ReactPropTypesSecret; | ||
4180 | |||
4181 | |||
4182 | /***/ }), | ||
4183 | /* 35 */ | ||
4184 | /***/ (function(module, exports, __webpack_require__) { | ||
4185 | |||
4186 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
4187 | * Copyright 2013-present, Facebook, Inc. | ||
4188 | * All rights reserved. | ||
4189 | * | ||
4190 | * This source code is licensed under the BSD-style license found in the | ||
4191 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4192 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4193 | */ | ||
4194 | |||
4195 | 'use strict'; | ||
4196 | |||
4197 | if (process.env.NODE_ENV !== 'production') { | ||
4198 | var invariant = __webpack_require__(10); | ||
4199 | var warning = __webpack_require__(13); | ||
4200 | var ReactPropTypesSecret = __webpack_require__(34); | ||
4201 | var loggedTypeFailures = {}; | ||
4202 | } | ||
4203 | |||
4204 | /** | ||
4205 | * Assert that the values match with the type specs. | ||
4206 | * Error messages are memorized and will only be shown once. | ||
4207 | * | ||
4208 | * @param {object} typeSpecs Map of name to a ReactPropType | ||
4209 | * @param {object} values Runtime values that need to be type-checked | ||
4210 | * @param {string} location e.g. "prop", "context", "child context" | ||
4211 | * @param {string} componentName Name of the component for error messages. | ||
4212 | * @param {?Function} getStack Returns the component stack. | ||
4213 | * @private | ||
4214 | */ | ||
4215 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) { | ||
4216 | if (process.env.NODE_ENV !== 'production') { | ||
4217 | for (var typeSpecName in typeSpecs) { | ||
4218 | if (typeSpecs.hasOwnProperty(typeSpecName)) { | ||
4219 | var error; | ||
4220 | // Prop type validation may throw. In case they do, we don't want to | ||
4221 | // fail the render phase where it didn't fail before. So we log it. | ||
4222 | // After these have been cleaned up, we'll let them throw. | ||
4223 | try { | ||
4224 | // This is intentionally an invariant that gets caught. It's the same | ||
4225 | // behavior as without this statement except with a better message. | ||
4226 | invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName); | ||
4227 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); | ||
4228 | } catch (ex) { | ||
4229 | error = ex; | ||
4230 | } | ||
4231 | warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); | ||
4232 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
4233 | // Only monitor this failure once because there tends to be a lot of the | ||
4234 | // same error. | ||
4235 | loggedTypeFailures[error.message] = true; | ||
4236 | |||
4237 | var stack = getStack ? getStack() : ''; | ||
4238 | |||
4239 | warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); | ||
4240 | } | ||
4241 | } | ||
4242 | } | ||
4243 | } | ||
4244 | } | ||
4245 | |||
4246 | module.exports = checkPropTypes; | ||
4247 | |||
4248 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
4249 | |||
4250 | /***/ }), | ||
4251 | /* 36 */ | ||
4252 | /***/ (function(module, exports) { | ||
4253 | |||
4254 | /** | ||
4255 | * Copyright 2013-present, Facebook, Inc. | ||
4256 | * All rights reserved. | ||
4257 | * | ||
4258 | * This source code is licensed under the BSD-style license found in the | ||
4259 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4260 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4261 | * | ||
4262 | */ | ||
4263 | |||
4264 | 'use strict'; | ||
4265 | |||
4266 | module.exports = '15.5.4'; | ||
4267 | |||
4268 | /***/ }), | ||
4269 | /* 37 */ | ||
4270 | /***/ (function(module, exports, __webpack_require__) { | ||
4271 | |||
4272 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
4273 | * Copyright 2013-present, Facebook, Inc. | ||
4274 | * All rights reserved. | ||
4275 | * | ||
4276 | * This source code is licensed under the BSD-style license found in the | ||
4277 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4278 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4279 | * | ||
4280 | */ | ||
4281 | 'use strict'; | ||
4282 | |||
4283 | var _prodInvariant = __webpack_require__(9); | ||
4284 | |||
4285 | var ReactElement = __webpack_require__(11); | ||
4286 | |||
4287 | var invariant = __webpack_require__(10); | ||
4288 | |||
4289 | /** | ||
4290 | * Returns the first child in a collection of children and verifies that there | ||
4291 | * is only one child in the collection. | ||
4292 | * | ||
4293 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only | ||
4294 | * | ||
4295 | * The current implementation of this function assumes that a single child gets | ||
4296 | * passed without a wrapper, but the purpose of this helper function is to | ||
4297 | * abstract away the particular structure of children. | ||
4298 | * | ||
4299 | * @param {?object} children Child collection structure. | ||
4300 | * @return {ReactElement} The first and only `ReactElement` contained in the | ||
4301 | * structure. | ||
4302 | */ | ||
4303 | function onlyChild(children) { | ||
4304 | !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0; | ||
4305 | return children; | ||
4306 | } | ||
4307 | |||
4308 | module.exports = onlyChild; | ||
4309 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
4310 | |||
4311 | /***/ }), | ||
4312 | /* 38 */ | ||
4313 | /***/ (function(module, exports, __webpack_require__) { | ||
4314 | |||
4315 | 'use strict'; | ||
4316 | |||
4317 | module.exports = __webpack_require__(39); | ||
4318 | |||
4319 | |||
4320 | /***/ }), | ||
4321 | /* 39 */ | ||
4322 | /***/ (function(module, exports, __webpack_require__) { | ||
4323 | |||
4324 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
4325 | * Copyright 2013-present, Facebook, Inc. | ||
4326 | * All rights reserved. | ||
4327 | * | ||
4328 | * This source code is licensed under the BSD-style license found in the | ||
4329 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4330 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4331 | * | ||
4332 | */ | ||
4333 | |||
4334 | /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ | ||
4335 | |||
4336 | 'use strict'; | ||
4337 | |||
4338 | var ReactDOMComponentTree = __webpack_require__(40); | ||
4339 | var ReactDefaultInjection = __webpack_require__(44); | ||
4340 | var ReactMount = __webpack_require__(172); | ||
4341 | var ReactReconciler = __webpack_require__(65); | ||
4342 | var ReactUpdates = __webpack_require__(62); | ||
4343 | var ReactVersion = __webpack_require__(177); | ||
4344 | |||
4345 | var findDOMNode = __webpack_require__(178); | ||
4346 | var getHostComponentFromComposite = __webpack_require__(179); | ||
4347 | var renderSubtreeIntoContainer = __webpack_require__(180); | ||
4348 | var warning = __webpack_require__(13); | ||
4349 | |||
4350 | ReactDefaultInjection.inject(); | ||
4351 | |||
4352 | var ReactDOM = { | ||
4353 | findDOMNode: findDOMNode, | ||
4354 | render: ReactMount.render, | ||
4355 | unmountComponentAtNode: ReactMount.unmountComponentAtNode, | ||
4356 | version: ReactVersion, | ||
4357 | |||
4358 | /* eslint-disable camelcase */ | ||
4359 | unstable_batchedUpdates: ReactUpdates.batchedUpdates, | ||
4360 | unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer | ||
4361 | }; | ||
4362 | |||
4363 | // Inject the runtime into a devtools global hook regardless of browser. | ||
4364 | // Allows for debugging when the hook is injected on the page. | ||
4365 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { | ||
4366 | __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ | ||
4367 | ComponentTree: { | ||
4368 | getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode, | ||
4369 | getNodeFromInstance: function (inst) { | ||
4370 | // inst is an internal instance (but could be a composite) | ||
4371 | if (inst._renderedComponent) { | ||
4372 | inst = getHostComponentFromComposite(inst); | ||
4373 | } | ||
4374 | if (inst) { | ||
4375 | return ReactDOMComponentTree.getNodeFromInstance(inst); | ||
4376 | } else { | ||
4377 | return null; | ||
4378 | } | ||
4379 | } | ||
4380 | }, | ||
4381 | Mount: ReactMount, | ||
4382 | Reconciler: ReactReconciler | ||
4383 | }); | ||
4384 | } | ||
4385 | |||
4386 | if (process.env.NODE_ENV !== 'production') { | ||
4387 | var ExecutionEnvironment = __webpack_require__(54); | ||
4388 | if (ExecutionEnvironment.canUseDOM && window.top === window.self) { | ||
4389 | |||
4390 | // First check if devtools is not installed | ||
4391 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { | ||
4392 | // If we're in Chrome or Firefox, provide a download link if not installed. | ||
4393 | if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { | ||
4394 | // Firefox does not have the issue with devtools loaded over file:// | ||
4395 | var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1; | ||
4396 | console.debug('Download the React DevTools ' + (showFileUrlMessage ? 'and use an HTTP server (instead of a file: URL) ' : '') + 'for a better development experience: ' + 'https://fb.me/react-devtools'); | ||
4397 | } | ||
4398 | } | ||
4399 | |||
4400 | var testFunc = function testFn() {}; | ||
4401 | process.env.NODE_ENV !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, 'It looks like you\'re using a minified copy of the development build ' + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0; | ||
4402 | |||
4403 | // If we're in IE8, check to see if we are in compatibility mode and provide | ||
4404 | // information on preventing compatibility mode | ||
4405 | var ieCompatibilityMode = document.documentMode && document.documentMode < 8; | ||
4406 | |||
4407 | process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : void 0; | ||
4408 | |||
4409 | var expectedFeatures = [ | ||
4410 | // shims | ||
4411 | Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.trim]; | ||
4412 | |||
4413 | for (var i = 0; i < expectedFeatures.length; i++) { | ||
4414 | if (!expectedFeatures[i]) { | ||
4415 | process.env.NODE_ENV !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0; | ||
4416 | break; | ||
4417 | } | ||
4418 | } | ||
4419 | } | ||
4420 | } | ||
4421 | |||
4422 | if (process.env.NODE_ENV !== 'production') { | ||
4423 | var ReactInstrumentation = __webpack_require__(68); | ||
4424 | var ReactDOMUnknownPropertyHook = __webpack_require__(181); | ||
4425 | var ReactDOMNullInputValuePropHook = __webpack_require__(182); | ||
4426 | var ReactDOMInvalidARIAHook = __webpack_require__(183); | ||
4427 | |||
4428 | ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook); | ||
4429 | ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook); | ||
4430 | ReactInstrumentation.debugTool.addHook(ReactDOMInvalidARIAHook); | ||
4431 | } | ||
4432 | |||
4433 | module.exports = ReactDOM; | ||
4434 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
4435 | |||
4436 | /***/ }), | ||
4437 | /* 40 */ | ||
4438 | /***/ (function(module, exports, __webpack_require__) { | ||
4439 | |||
4440 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
4441 | * Copyright 2013-present, Facebook, Inc. | ||
4442 | * All rights reserved. | ||
4443 | * | ||
4444 | * This source code is licensed under the BSD-style license found in the | ||
4445 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4446 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4447 | * | ||
4448 | */ | ||
4449 | |||
4450 | 'use strict'; | ||
4451 | |||
4452 | var _prodInvariant = __webpack_require__(41); | ||
4453 | |||
4454 | var DOMProperty = __webpack_require__(42); | ||
4455 | var ReactDOMComponentFlags = __webpack_require__(43); | ||
4456 | |||
4457 | var invariant = __webpack_require__(10); | ||
4458 | |||
4459 | var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; | ||
4460 | var Flags = ReactDOMComponentFlags; | ||
4461 | |||
4462 | var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2); | ||
4463 | |||
4464 | /** | ||
4465 | * Check if a given node should be cached. | ||
4466 | */ | ||
4467 | function shouldPrecacheNode(node, nodeID) { | ||
4468 | return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' '; | ||
4469 | } | ||
4470 | |||
4471 | /** | ||
4472 | * Drill down (through composites and empty components) until we get a host or | ||
4473 | * host text component. | ||
4474 | * | ||
4475 | * This is pretty polymorphic but unavoidable with the current structure we have | ||
4476 | * for `_renderedChildren`. | ||
4477 | */ | ||
4478 | function getRenderedHostOrTextFromComponent(component) { | ||
4479 | var rendered; | ||
4480 | while (rendered = component._renderedComponent) { | ||
4481 | component = rendered; | ||
4482 | } | ||
4483 | return component; | ||
4484 | } | ||
4485 | |||
4486 | /** | ||
4487 | * Populate `_hostNode` on the rendered host/text component with the given | ||
4488 | * DOM node. The passed `inst` can be a composite. | ||
4489 | */ | ||
4490 | function precacheNode(inst, node) { | ||
4491 | var hostInst = getRenderedHostOrTextFromComponent(inst); | ||
4492 | hostInst._hostNode = node; | ||
4493 | node[internalInstanceKey] = hostInst; | ||
4494 | } | ||
4495 | |||
4496 | function uncacheNode(inst) { | ||
4497 | var node = inst._hostNode; | ||
4498 | if (node) { | ||
4499 | delete node[internalInstanceKey]; | ||
4500 | inst._hostNode = null; | ||
4501 | } | ||
4502 | } | ||
4503 | |||
4504 | /** | ||
4505 | * Populate `_hostNode` on each child of `inst`, assuming that the children | ||
4506 | * match up with the DOM (element) children of `node`. | ||
4507 | * | ||
4508 | * We cache entire levels at once to avoid an n^2 problem where we access the | ||
4509 | * children of a node sequentially and have to walk from the start to our target | ||
4510 | * node every time. | ||
4511 | * | ||
4512 | * Since we update `_renderedChildren` and the actual DOM at (slightly) | ||
4513 | * different times, we could race here and see a newer `_renderedChildren` than | ||
4514 | * the DOM nodes we see. To avoid this, ReactMultiChild calls | ||
4515 | * `prepareToManageChildren` before we change `_renderedChildren`, at which | ||
4516 | * time the container's child nodes are always cached (until it unmounts). | ||
4517 | */ | ||
4518 | function precacheChildNodes(inst, node) { | ||
4519 | if (inst._flags & Flags.hasCachedChildNodes) { | ||
4520 | return; | ||
4521 | } | ||
4522 | var children = inst._renderedChildren; | ||
4523 | var childNode = node.firstChild; | ||
4524 | outer: for (var name in children) { | ||
4525 | if (!children.hasOwnProperty(name)) { | ||
4526 | continue; | ||
4527 | } | ||
4528 | var childInst = children[name]; | ||
4529 | var childID = getRenderedHostOrTextFromComponent(childInst)._domID; | ||
4530 | if (childID === 0) { | ||
4531 | // We're currently unmounting this child in ReactMultiChild; skip it. | ||
4532 | continue; | ||
4533 | } | ||
4534 | // We assume the child nodes are in the same order as the child instances. | ||
4535 | for (; childNode !== null; childNode = childNode.nextSibling) { | ||
4536 | if (shouldPrecacheNode(childNode, childID)) { | ||
4537 | precacheNode(childInst, childNode); | ||
4538 | continue outer; | ||
4539 | } | ||
4540 | } | ||
4541 | // We reached the end of the DOM children without finding an ID match. | ||
4542 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0; | ||
4543 | } | ||
4544 | inst._flags |= Flags.hasCachedChildNodes; | ||
4545 | } | ||
4546 | |||
4547 | /** | ||
4548 | * Given a DOM node, return the closest ReactDOMComponent or | ||
4549 | * ReactDOMTextComponent instance ancestor. | ||
4550 | */ | ||
4551 | function getClosestInstanceFromNode(node) { | ||
4552 | if (node[internalInstanceKey]) { | ||
4553 | return node[internalInstanceKey]; | ||
4554 | } | ||
4555 | |||
4556 | // Walk up the tree until we find an ancestor whose instance we have cached. | ||
4557 | var parents = []; | ||
4558 | while (!node[internalInstanceKey]) { | ||
4559 | parents.push(node); | ||
4560 | if (node.parentNode) { | ||
4561 | node = node.parentNode; | ||
4562 | } else { | ||
4563 | // Top of the tree. This node must not be part of a React tree (or is | ||
4564 | // unmounted, potentially). | ||
4565 | return null; | ||
4566 | } | ||
4567 | } | ||
4568 | |||
4569 | var closest; | ||
4570 | var inst; | ||
4571 | for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) { | ||
4572 | closest = inst; | ||
4573 | if (parents.length) { | ||
4574 | precacheChildNodes(inst, node); | ||
4575 | } | ||
4576 | } | ||
4577 | |||
4578 | return closest; | ||
4579 | } | ||
4580 | |||
4581 | /** | ||
4582 | * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent | ||
4583 | * instance, or null if the node was not rendered by this React. | ||
4584 | */ | ||
4585 | function getInstanceFromNode(node) { | ||
4586 | var inst = getClosestInstanceFromNode(node); | ||
4587 | if (inst != null && inst._hostNode === node) { | ||
4588 | return inst; | ||
4589 | } else { | ||
4590 | return null; | ||
4591 | } | ||
4592 | } | ||
4593 | |||
4594 | /** | ||
4595 | * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding | ||
4596 | * DOM node. | ||
4597 | */ | ||
4598 | function getNodeFromInstance(inst) { | ||
4599 | // Without this first invariant, passing a non-DOM-component triggers the next | ||
4600 | // invariant for a missing parent, which is super confusing. | ||
4601 | !(inst._hostNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; | ||
4602 | |||
4603 | if (inst._hostNode) { | ||
4604 | return inst._hostNode; | ||
4605 | } | ||
4606 | |||
4607 | // Walk up the tree until we find an ancestor whose DOM node we have cached. | ||
4608 | var parents = []; | ||
4609 | while (!inst._hostNode) { | ||
4610 | parents.push(inst); | ||
4611 | !inst._hostParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0; | ||
4612 | inst = inst._hostParent; | ||
4613 | } | ||
4614 | |||
4615 | // Now parents contains each ancestor that does *not* have a cached native | ||
4616 | // node, and `inst` is the deepest ancestor that does. | ||
4617 | for (; parents.length; inst = parents.pop()) { | ||
4618 | precacheChildNodes(inst, inst._hostNode); | ||
4619 | } | ||
4620 | |||
4621 | return inst._hostNode; | ||
4622 | } | ||
4623 | |||
4624 | var ReactDOMComponentTree = { | ||
4625 | getClosestInstanceFromNode: getClosestInstanceFromNode, | ||
4626 | getInstanceFromNode: getInstanceFromNode, | ||
4627 | getNodeFromInstance: getNodeFromInstance, | ||
4628 | precacheChildNodes: precacheChildNodes, | ||
4629 | precacheNode: precacheNode, | ||
4630 | uncacheNode: uncacheNode | ||
4631 | }; | ||
4632 | |||
4633 | module.exports = ReactDOMComponentTree; | ||
4634 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
4635 | |||
4636 | /***/ }), | ||
4637 | /* 41 */ | ||
4638 | 9, | ||
4639 | /* 42 */ | ||
4640 | /***/ (function(module, exports, __webpack_require__) { | ||
4641 | |||
4642 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
4643 | * Copyright 2013-present, Facebook, Inc. | ||
4644 | * All rights reserved. | ||
4645 | * | ||
4646 | * This source code is licensed under the BSD-style license found in the | ||
4647 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4648 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4649 | * | ||
4650 | */ | ||
4651 | |||
4652 | 'use strict'; | ||
4653 | |||
4654 | var _prodInvariant = __webpack_require__(41); | ||
4655 | |||
4656 | var invariant = __webpack_require__(10); | ||
4657 | |||
4658 | function checkMask(value, bitmask) { | ||
4659 | return (value & bitmask) === bitmask; | ||
4660 | } | ||
4661 | |||
4662 | var DOMPropertyInjection = { | ||
4663 | /** | ||
4664 | * Mapping from normalized, camelcased property names to a configuration that | ||
4665 | * specifies how the associated DOM property should be accessed or rendered. | ||
4666 | */ | ||
4667 | MUST_USE_PROPERTY: 0x1, | ||
4668 | HAS_BOOLEAN_VALUE: 0x4, | ||
4669 | HAS_NUMERIC_VALUE: 0x8, | ||
4670 | HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8, | ||
4671 | HAS_OVERLOADED_BOOLEAN_VALUE: 0x20, | ||
4672 | |||
4673 | /** | ||
4674 | * Inject some specialized knowledge about the DOM. This takes a config object | ||
4675 | * with the following properties: | ||
4676 | * | ||
4677 | * isCustomAttribute: function that given an attribute name will return true | ||
4678 | * if it can be inserted into the DOM verbatim. Useful for data-* or aria-* | ||
4679 | * attributes where it's impossible to enumerate all of the possible | ||
4680 | * attribute names, | ||
4681 | * | ||
4682 | * Properties: object mapping DOM property name to one of the | ||
4683 | * DOMPropertyInjection constants or null. If your attribute isn't in here, | ||
4684 | * it won't get written to the DOM. | ||
4685 | * | ||
4686 | * DOMAttributeNames: object mapping React attribute name to the DOM | ||
4687 | * attribute name. Attribute names not specified use the **lowercase** | ||
4688 | * normalized name. | ||
4689 | * | ||
4690 | * DOMAttributeNamespaces: object mapping React attribute name to the DOM | ||
4691 | * attribute namespace URL. (Attribute names not specified use no namespace.) | ||
4692 | * | ||
4693 | * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. | ||
4694 | * Property names not specified use the normalized name. | ||
4695 | * | ||
4696 | * DOMMutationMethods: Properties that require special mutation methods. If | ||
4697 | * `value` is undefined, the mutation method should unset the property. | ||
4698 | * | ||
4699 | * @param {object} domPropertyConfig the config as described above. | ||
4700 | */ | ||
4701 | injectDOMPropertyConfig: function (domPropertyConfig) { | ||
4702 | var Injection = DOMPropertyInjection; | ||
4703 | var Properties = domPropertyConfig.Properties || {}; | ||
4704 | var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {}; | ||
4705 | var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; | ||
4706 | var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; | ||
4707 | var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; | ||
4708 | |||
4709 | if (domPropertyConfig.isCustomAttribute) { | ||
4710 | DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute); | ||
4711 | } | ||
4712 | |||
4713 | for (var propName in Properties) { | ||
4714 | !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property \'%s\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : _prodInvariant('48', propName) : void 0; | ||
4715 | |||
4716 | var lowerCased = propName.toLowerCase(); | ||
4717 | var propConfig = Properties[propName]; | ||
4718 | |||
4719 | var propertyInfo = { | ||
4720 | attributeName: lowerCased, | ||
4721 | attributeNamespace: null, | ||
4722 | propertyName: propName, | ||
4723 | mutationMethod: null, | ||
4724 | |||
4725 | mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), | ||
4726 | hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), | ||
4727 | hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), | ||
4728 | hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE), | ||
4729 | hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE) | ||
4730 | }; | ||
4731 | !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0; | ||
4732 | |||
4733 | if (process.env.NODE_ENV !== 'production') { | ||
4734 | DOMProperty.getPossibleStandardName[lowerCased] = propName; | ||
4735 | } | ||
4736 | |||
4737 | if (DOMAttributeNames.hasOwnProperty(propName)) { | ||
4738 | var attributeName = DOMAttributeNames[propName]; | ||
4739 | propertyInfo.attributeName = attributeName; | ||
4740 | if (process.env.NODE_ENV !== 'production') { | ||
4741 | DOMProperty.getPossibleStandardName[attributeName] = propName; | ||
4742 | } | ||
4743 | } | ||
4744 | |||
4745 | if (DOMAttributeNamespaces.hasOwnProperty(propName)) { | ||
4746 | propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; | ||
4747 | } | ||
4748 | |||
4749 | if (DOMPropertyNames.hasOwnProperty(propName)) { | ||
4750 | propertyInfo.propertyName = DOMPropertyNames[propName]; | ||
4751 | } | ||
4752 | |||
4753 | if (DOMMutationMethods.hasOwnProperty(propName)) { | ||
4754 | propertyInfo.mutationMethod = DOMMutationMethods[propName]; | ||
4755 | } | ||
4756 | |||
4757 | DOMProperty.properties[propName] = propertyInfo; | ||
4758 | } | ||
4759 | } | ||
4760 | }; | ||
4761 | |||
4762 | /* eslint-disable max-len */ | ||
4763 | var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD'; | ||
4764 | /* eslint-enable max-len */ | ||
4765 | |||
4766 | /** | ||
4767 | * DOMProperty exports lookup objects that can be used like functions: | ||
4768 | * | ||
4769 | * > DOMProperty.isValid['id'] | ||
4770 | * true | ||
4771 | * > DOMProperty.isValid['foobar'] | ||
4772 | * undefined | ||
4773 | * | ||
4774 | * Although this may be confusing, it performs better in general. | ||
4775 | * | ||
4776 | * @see http://jsperf.com/key-exists | ||
4777 | * @see http://jsperf.com/key-missing | ||
4778 | */ | ||
4779 | var DOMProperty = { | ||
4780 | |||
4781 | ID_ATTRIBUTE_NAME: 'data-reactid', | ||
4782 | ROOT_ATTRIBUTE_NAME: 'data-reactroot', | ||
4783 | |||
4784 | ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR, | ||
4785 | ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040', | ||
4786 | |||
4787 | /** | ||
4788 | * Map from property "standard name" to an object with info about how to set | ||
4789 | * the property in the DOM. Each object contains: | ||
4790 | * | ||
4791 | * attributeName: | ||
4792 | * Used when rendering markup or with `*Attribute()`. | ||
4793 | * attributeNamespace | ||
4794 | * propertyName: | ||
4795 | * Used on DOM node instances. (This includes properties that mutate due to | ||
4796 | * external factors.) | ||
4797 | * mutationMethod: | ||
4798 | * If non-null, used instead of the property or `setAttribute()` after | ||
4799 | * initial render. | ||
4800 | * mustUseProperty: | ||
4801 | * Whether the property must be accessed and mutated as an object property. | ||
4802 | * hasBooleanValue: | ||
4803 | * Whether the property should be removed when set to a falsey value. | ||
4804 | * hasNumericValue: | ||
4805 | * Whether the property must be numeric or parse as a numeric and should be | ||
4806 | * removed when set to a falsey value. | ||
4807 | * hasPositiveNumericValue: | ||
4808 | * Whether the property must be positive numeric or parse as a positive | ||
4809 | * numeric and should be removed when set to a falsey value. | ||
4810 | * hasOverloadedBooleanValue: | ||
4811 | * Whether the property can be used as a flag as well as with a value. | ||
4812 | * Removed when strictly equal to false; present without a value when | ||
4813 | * strictly equal to true; present with a value otherwise. | ||
4814 | */ | ||
4815 | properties: {}, | ||
4816 | |||
4817 | /** | ||
4818 | * Mapping from lowercase property names to the properly cased version, used | ||
4819 | * to warn in the case of missing properties. Available only in __DEV__. | ||
4820 | * | ||
4821 | * autofocus is predefined, because adding it to the property whitelist | ||
4822 | * causes unintended side effects. | ||
4823 | * | ||
4824 | * @type {Object} | ||
4825 | */ | ||
4826 | getPossibleStandardName: process.env.NODE_ENV !== 'production' ? { autofocus: 'autoFocus' } : null, | ||
4827 | |||
4828 | /** | ||
4829 | * All of the isCustomAttribute() functions that have been injected. | ||
4830 | */ | ||
4831 | _isCustomAttributeFunctions: [], | ||
4832 | |||
4833 | /** | ||
4834 | * Checks whether a property name is a custom attribute. | ||
4835 | * @method | ||
4836 | */ | ||
4837 | isCustomAttribute: function (attributeName) { | ||
4838 | for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) { | ||
4839 | var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i]; | ||
4840 | if (isCustomAttributeFn(attributeName)) { | ||
4841 | return true; | ||
4842 | } | ||
4843 | } | ||
4844 | return false; | ||
4845 | }, | ||
4846 | |||
4847 | injection: DOMPropertyInjection | ||
4848 | }; | ||
4849 | |||
4850 | module.exports = DOMProperty; | ||
4851 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
4852 | |||
4853 | /***/ }), | ||
4854 | /* 43 */ | ||
4855 | /***/ (function(module, exports) { | ||
4856 | |||
4857 | /** | ||
4858 | * Copyright 2015-present, Facebook, Inc. | ||
4859 | * All rights reserved. | ||
4860 | * | ||
4861 | * This source code is licensed under the BSD-style license found in the | ||
4862 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4863 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4864 | * | ||
4865 | */ | ||
4866 | |||
4867 | 'use strict'; | ||
4868 | |||
4869 | var ReactDOMComponentFlags = { | ||
4870 | hasCachedChildNodes: 1 << 0 | ||
4871 | }; | ||
4872 | |||
4873 | module.exports = ReactDOMComponentFlags; | ||
4874 | |||
4875 | /***/ }), | ||
4876 | /* 44 */ | ||
4877 | /***/ (function(module, exports, __webpack_require__) { | ||
4878 | |||
4879 | /** | ||
4880 | * Copyright 2013-present, Facebook, Inc. | ||
4881 | * All rights reserved. | ||
4882 | * | ||
4883 | * This source code is licensed under the BSD-style license found in the | ||
4884 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4885 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4886 | * | ||
4887 | */ | ||
4888 | |||
4889 | 'use strict'; | ||
4890 | |||
4891 | var ARIADOMPropertyConfig = __webpack_require__(45); | ||
4892 | var BeforeInputEventPlugin = __webpack_require__(46); | ||
4893 | var ChangeEventPlugin = __webpack_require__(61); | ||
4894 | var DefaultEventPluginOrder = __webpack_require__(78); | ||
4895 | var EnterLeaveEventPlugin = __webpack_require__(79); | ||
4896 | var HTMLDOMPropertyConfig = __webpack_require__(84); | ||
4897 | var ReactComponentBrowserEnvironment = __webpack_require__(85); | ||
4898 | var ReactDOMComponent = __webpack_require__(98); | ||
4899 | var ReactDOMComponentTree = __webpack_require__(40); | ||
4900 | var ReactDOMEmptyComponent = __webpack_require__(143); | ||
4901 | var ReactDOMTreeTraversal = __webpack_require__(144); | ||
4902 | var ReactDOMTextComponent = __webpack_require__(145); | ||
4903 | var ReactDefaultBatchingStrategy = __webpack_require__(146); | ||
4904 | var ReactEventListener = __webpack_require__(147); | ||
4905 | var ReactInjection = __webpack_require__(150); | ||
4906 | var ReactReconcileTransaction = __webpack_require__(151); | ||
4907 | var SVGDOMPropertyConfig = __webpack_require__(159); | ||
4908 | var SelectEventPlugin = __webpack_require__(160); | ||
4909 | var SimpleEventPlugin = __webpack_require__(161); | ||
4910 | |||
4911 | var alreadyInjected = false; | ||
4912 | |||
4913 | function inject() { | ||
4914 | if (alreadyInjected) { | ||
4915 | // TODO: This is currently true because these injections are shared between | ||
4916 | // the client and the server package. They should be built independently | ||
4917 | // and not share any injection state. Then this problem will be solved. | ||
4918 | return; | ||
4919 | } | ||
4920 | alreadyInjected = true; | ||
4921 | |||
4922 | ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener); | ||
4923 | |||
4924 | /** | ||
4925 | * Inject modules for resolving DOM hierarchy and plugin ordering. | ||
4926 | */ | ||
4927 | ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder); | ||
4928 | ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree); | ||
4929 | ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal); | ||
4930 | |||
4931 | /** | ||
4932 | * Some important event plugins included by default (without having to require | ||
4933 | * them). | ||
4934 | */ | ||
4935 | ReactInjection.EventPluginHub.injectEventPluginsByName({ | ||
4936 | SimpleEventPlugin: SimpleEventPlugin, | ||
4937 | EnterLeaveEventPlugin: EnterLeaveEventPlugin, | ||
4938 | ChangeEventPlugin: ChangeEventPlugin, | ||
4939 | SelectEventPlugin: SelectEventPlugin, | ||
4940 | BeforeInputEventPlugin: BeforeInputEventPlugin | ||
4941 | }); | ||
4942 | |||
4943 | ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent); | ||
4944 | |||
4945 | ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent); | ||
4946 | |||
4947 | ReactInjection.DOMProperty.injectDOMPropertyConfig(ARIADOMPropertyConfig); | ||
4948 | ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig); | ||
4949 | ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig); | ||
4950 | |||
4951 | ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) { | ||
4952 | return new ReactDOMEmptyComponent(instantiate); | ||
4953 | }); | ||
4954 | |||
4955 | ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction); | ||
4956 | ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy); | ||
4957 | |||
4958 | ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment); | ||
4959 | } | ||
4960 | |||
4961 | module.exports = { | ||
4962 | inject: inject | ||
4963 | }; | ||
4964 | |||
4965 | /***/ }), | ||
4966 | /* 45 */ | ||
4967 | /***/ (function(module, exports) { | ||
4968 | |||
4969 | /** | ||
4970 | * Copyright 2013-present, Facebook, Inc. | ||
4971 | * All rights reserved. | ||
4972 | * | ||
4973 | * This source code is licensed under the BSD-style license found in the | ||
4974 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4975 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4976 | * | ||
4977 | */ | ||
4978 | |||
4979 | 'use strict'; | ||
4980 | |||
4981 | var ARIADOMPropertyConfig = { | ||
4982 | Properties: { | ||
4983 | // Global States and Properties | ||
4984 | 'aria-current': 0, // state | ||
4985 | 'aria-details': 0, | ||
4986 | 'aria-disabled': 0, // state | ||
4987 | 'aria-hidden': 0, // state | ||
4988 | 'aria-invalid': 0, // state | ||
4989 | 'aria-keyshortcuts': 0, | ||
4990 | 'aria-label': 0, | ||
4991 | 'aria-roledescription': 0, | ||
4992 | // Widget Attributes | ||
4993 | 'aria-autocomplete': 0, | ||
4994 | 'aria-checked': 0, | ||
4995 | 'aria-expanded': 0, | ||
4996 | 'aria-haspopup': 0, | ||
4997 | 'aria-level': 0, | ||
4998 | 'aria-modal': 0, | ||
4999 | 'aria-multiline': 0, | ||
5000 | 'aria-multiselectable': 0, | ||
5001 | 'aria-orientation': 0, | ||
5002 | 'aria-placeholder': 0, | ||
5003 | 'aria-pressed': 0, | ||
5004 | 'aria-readonly': 0, | ||
5005 | 'aria-required': 0, | ||
5006 | 'aria-selected': 0, | ||
5007 | 'aria-sort': 0, | ||
5008 | 'aria-valuemax': 0, | ||
5009 | 'aria-valuemin': 0, | ||
5010 | 'aria-valuenow': 0, | ||
5011 | 'aria-valuetext': 0, | ||
5012 | // Live Region Attributes | ||
5013 | 'aria-atomic': 0, | ||
5014 | 'aria-busy': 0, | ||
5015 | 'aria-live': 0, | ||
5016 | 'aria-relevant': 0, | ||
5017 | // Drag-and-Drop Attributes | ||
5018 | 'aria-dropeffect': 0, | ||
5019 | 'aria-grabbed': 0, | ||
5020 | // Relationship Attributes | ||
5021 | 'aria-activedescendant': 0, | ||
5022 | 'aria-colcount': 0, | ||
5023 | 'aria-colindex': 0, | ||
5024 | 'aria-colspan': 0, | ||
5025 | 'aria-controls': 0, | ||
5026 | 'aria-describedby': 0, | ||
5027 | 'aria-errormessage': 0, | ||
5028 | 'aria-flowto': 0, | ||
5029 | 'aria-labelledby': 0, | ||
5030 | 'aria-owns': 0, | ||
5031 | 'aria-posinset': 0, | ||
5032 | 'aria-rowcount': 0, | ||
5033 | 'aria-rowindex': 0, | ||
5034 | 'aria-rowspan': 0, | ||
5035 | 'aria-setsize': 0 | ||
5036 | }, | ||
5037 | DOMAttributeNames: {}, | ||
5038 | DOMPropertyNames: {} | ||
5039 | }; | ||
5040 | |||
5041 | module.exports = ARIADOMPropertyConfig; | ||
5042 | |||
5043 | /***/ }), | ||
5044 | /* 46 */ | ||
5045 | /***/ (function(module, exports, __webpack_require__) { | ||
5046 | |||
5047 | /** | ||
5048 | * Copyright 2013-present Facebook, Inc. | ||
5049 | * All rights reserved. | ||
5050 | * | ||
5051 | * This source code is licensed under the BSD-style license found in the | ||
5052 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5053 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5054 | * | ||
5055 | */ | ||
5056 | |||
5057 | 'use strict'; | ||
5058 | |||
5059 | var EventPropagators = __webpack_require__(47); | ||
5060 | var ExecutionEnvironment = __webpack_require__(54); | ||
5061 | var FallbackCompositionState = __webpack_require__(55); | ||
5062 | var SyntheticCompositionEvent = __webpack_require__(58); | ||
5063 | var SyntheticInputEvent = __webpack_require__(60); | ||
5064 | |||
5065 | var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space | ||
5066 | var START_KEYCODE = 229; | ||
5067 | |||
5068 | var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; | ||
5069 | |||
5070 | var documentMode = null; | ||
5071 | if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { | ||
5072 | documentMode = document.documentMode; | ||
5073 | } | ||
5074 | |||
5075 | // Webkit offers a very useful `textInput` event that can be used to | ||
5076 | // directly represent `beforeInput`. The IE `textinput` event is not as | ||
5077 | // useful, so we don't use it. | ||
5078 | var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto(); | ||
5079 | |||
5080 | // In IE9+, we have access to composition events, but the data supplied | ||
5081 | // by the native compositionend event may be incorrect. Japanese ideographic | ||
5082 | // spaces, for instance (\u3000) are not recorded correctly. | ||
5083 | var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); | ||
5084 | |||
5085 | /** | ||
5086 | * Opera <= 12 includes TextEvent in window, but does not fire | ||
5087 | * text input events. Rely on keypress instead. | ||
5088 | */ | ||
5089 | function isPresto() { | ||
5090 | var opera = window.opera; | ||
5091 | return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; | ||
5092 | } | ||
5093 | |||
5094 | var SPACEBAR_CODE = 32; | ||
5095 | var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); | ||
5096 | |||
5097 | // Events and their corresponding property names. | ||
5098 | var eventTypes = { | ||
5099 | beforeInput: { | ||
5100 | phasedRegistrationNames: { | ||
5101 | bubbled: 'onBeforeInput', | ||
5102 | captured: 'onBeforeInputCapture' | ||
5103 | }, | ||
5104 | dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste'] | ||
5105 | }, | ||
5106 | compositionEnd: { | ||
5107 | phasedRegistrationNames: { | ||
5108 | bubbled: 'onCompositionEnd', | ||
5109 | captured: 'onCompositionEndCapture' | ||
5110 | }, | ||
5111 | dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] | ||
5112 | }, | ||
5113 | compositionStart: { | ||
5114 | phasedRegistrationNames: { | ||
5115 | bubbled: 'onCompositionStart', | ||
5116 | captured: 'onCompositionStartCapture' | ||
5117 | }, | ||
5118 | dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] | ||
5119 | }, | ||
5120 | compositionUpdate: { | ||
5121 | phasedRegistrationNames: { | ||
5122 | bubbled: 'onCompositionUpdate', | ||
5123 | captured: 'onCompositionUpdateCapture' | ||
5124 | }, | ||
5125 | dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] | ||
5126 | } | ||
5127 | }; | ||
5128 | |||
5129 | // Track whether we've ever handled a keypress on the space key. | ||
5130 | var hasSpaceKeypress = false; | ||
5131 | |||
5132 | /** | ||
5133 | * Return whether a native keypress event is assumed to be a command. | ||
5134 | * This is required because Firefox fires `keypress` events for key commands | ||
5135 | * (cut, copy, select-all, etc.) even though no character is inserted. | ||
5136 | */ | ||
5137 | function isKeypressCommand(nativeEvent) { | ||
5138 | return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && | ||
5139 | // ctrlKey && altKey is equivalent to AltGr, and is not a command. | ||
5140 | !(nativeEvent.ctrlKey && nativeEvent.altKey); | ||
5141 | } | ||
5142 | |||
5143 | /** | ||
5144 | * Translate native top level events into event types. | ||
5145 | * | ||
5146 | * @param {string} topLevelType | ||
5147 | * @return {object} | ||
5148 | */ | ||
5149 | function getCompositionEventType(topLevelType) { | ||
5150 | switch (topLevelType) { | ||
5151 | case 'topCompositionStart': | ||
5152 | return eventTypes.compositionStart; | ||
5153 | case 'topCompositionEnd': | ||
5154 | return eventTypes.compositionEnd; | ||
5155 | case 'topCompositionUpdate': | ||
5156 | return eventTypes.compositionUpdate; | ||
5157 | } | ||
5158 | } | ||
5159 | |||
5160 | /** | ||
5161 | * Does our fallback best-guess model think this event signifies that | ||
5162 | * composition has begun? | ||
5163 | * | ||
5164 | * @param {string} topLevelType | ||
5165 | * @param {object} nativeEvent | ||
5166 | * @return {boolean} | ||
5167 | */ | ||
5168 | function isFallbackCompositionStart(topLevelType, nativeEvent) { | ||
5169 | return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE; | ||
5170 | } | ||
5171 | |||
5172 | /** | ||
5173 | * Does our fallback mode think that this event is the end of composition? | ||
5174 | * | ||
5175 | * @param {string} topLevelType | ||
5176 | * @param {object} nativeEvent | ||
5177 | * @return {boolean} | ||
5178 | */ | ||
5179 | function isFallbackCompositionEnd(topLevelType, nativeEvent) { | ||
5180 | switch (topLevelType) { | ||
5181 | case 'topKeyUp': | ||
5182 | // Command keys insert or clear IME input. | ||
5183 | return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; | ||
5184 | case 'topKeyDown': | ||
5185 | // Expect IME keyCode on each keydown. If we get any other | ||
5186 | // code we must have exited earlier. | ||
5187 | return nativeEvent.keyCode !== START_KEYCODE; | ||
5188 | case 'topKeyPress': | ||
5189 | case 'topMouseDown': | ||
5190 | case 'topBlur': | ||
5191 | // Events are not possible without cancelling IME. | ||
5192 | return true; | ||
5193 | default: | ||
5194 | return false; | ||
5195 | } | ||
5196 | } | ||
5197 | |||
5198 | /** | ||
5199 | * Google Input Tools provides composition data via a CustomEvent, | ||
5200 | * with the `data` property populated in the `detail` object. If this | ||
5201 | * is available on the event object, use it. If not, this is a plain | ||
5202 | * composition event and we have nothing special to extract. | ||
5203 | * | ||
5204 | * @param {object} nativeEvent | ||
5205 | * @return {?string} | ||
5206 | */ | ||
5207 | function getDataFromCustomEvent(nativeEvent) { | ||
5208 | var detail = nativeEvent.detail; | ||
5209 | if (typeof detail === 'object' && 'data' in detail) { | ||
5210 | return detail.data; | ||
5211 | } | ||
5212 | return null; | ||
5213 | } | ||
5214 | |||
5215 | // Track the current IME composition fallback object, if any. | ||
5216 | var currentComposition = null; | ||
5217 | |||
5218 | /** | ||
5219 | * @return {?object} A SyntheticCompositionEvent. | ||
5220 | */ | ||
5221 | function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
5222 | var eventType; | ||
5223 | var fallbackData; | ||
5224 | |||
5225 | if (canUseCompositionEvent) { | ||
5226 | eventType = getCompositionEventType(topLevelType); | ||
5227 | } else if (!currentComposition) { | ||
5228 | if (isFallbackCompositionStart(topLevelType, nativeEvent)) { | ||
5229 | eventType = eventTypes.compositionStart; | ||
5230 | } | ||
5231 | } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { | ||
5232 | eventType = eventTypes.compositionEnd; | ||
5233 | } | ||
5234 | |||
5235 | if (!eventType) { | ||
5236 | return null; | ||
5237 | } | ||
5238 | |||
5239 | if (useFallbackCompositionData) { | ||
5240 | // The current composition is stored statically and must not be | ||
5241 | // overwritten while composition continues. | ||
5242 | if (!currentComposition && eventType === eventTypes.compositionStart) { | ||
5243 | currentComposition = FallbackCompositionState.getPooled(nativeEventTarget); | ||
5244 | } else if (eventType === eventTypes.compositionEnd) { | ||
5245 | if (currentComposition) { | ||
5246 | fallbackData = currentComposition.getData(); | ||
5247 | } | ||
5248 | } | ||
5249 | } | ||
5250 | |||
5251 | var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); | ||
5252 | |||
5253 | if (fallbackData) { | ||
5254 | // Inject data generated from fallback path into the synthetic event. | ||
5255 | // This matches the property of native CompositionEventInterface. | ||
5256 | event.data = fallbackData; | ||
5257 | } else { | ||
5258 | var customData = getDataFromCustomEvent(nativeEvent); | ||
5259 | if (customData !== null) { | ||
5260 | event.data = customData; | ||
5261 | } | ||
5262 | } | ||
5263 | |||
5264 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
5265 | return event; | ||
5266 | } | ||
5267 | |||
5268 | /** | ||
5269 | * @param {string} topLevelType Record from `EventConstants`. | ||
5270 | * @param {object} nativeEvent Native browser event. | ||
5271 | * @return {?string} The string corresponding to this `beforeInput` event. | ||
5272 | */ | ||
5273 | function getNativeBeforeInputChars(topLevelType, nativeEvent) { | ||
5274 | switch (topLevelType) { | ||
5275 | case 'topCompositionEnd': | ||
5276 | return getDataFromCustomEvent(nativeEvent); | ||
5277 | case 'topKeyPress': | ||
5278 | /** | ||
5279 | * If native `textInput` events are available, our goal is to make | ||
5280 | * use of them. However, there is a special case: the spacebar key. | ||
5281 | * In Webkit, preventing default on a spacebar `textInput` event | ||
5282 | * cancels character insertion, but it *also* causes the browser | ||
5283 | * to fall back to its default spacebar behavior of scrolling the | ||
5284 | * page. | ||
5285 | * | ||
5286 | * Tracking at: | ||
5287 | * https://code.google.com/p/chromium/issues/detail?id=355103 | ||
5288 | * | ||
5289 | * To avoid this issue, use the keypress event as if no `textInput` | ||
5290 | * event is available. | ||
5291 | */ | ||
5292 | var which = nativeEvent.which; | ||
5293 | if (which !== SPACEBAR_CODE) { | ||
5294 | return null; | ||
5295 | } | ||
5296 | |||
5297 | hasSpaceKeypress = true; | ||
5298 | return SPACEBAR_CHAR; | ||
5299 | |||
5300 | case 'topTextInput': | ||
5301 | // Record the characters to be added to the DOM. | ||
5302 | var chars = nativeEvent.data; | ||
5303 | |||
5304 | // If it's a spacebar character, assume that we have already handled | ||
5305 | // it at the keypress level and bail immediately. Android Chrome | ||
5306 | // doesn't give us keycodes, so we need to blacklist it. | ||
5307 | if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { | ||
5308 | return null; | ||
5309 | } | ||
5310 | |||
5311 | return chars; | ||
5312 | |||
5313 | default: | ||
5314 | // For other native event types, do nothing. | ||
5315 | return null; | ||
5316 | } | ||
5317 | } | ||
5318 | |||
5319 | /** | ||
5320 | * For browsers that do not provide the `textInput` event, extract the | ||
5321 | * appropriate string to use for SyntheticInputEvent. | ||
5322 | * | ||
5323 | * @param {string} topLevelType Record from `EventConstants`. | ||
5324 | * @param {object} nativeEvent Native browser event. | ||
5325 | * @return {?string} The fallback string for this `beforeInput` event. | ||
5326 | */ | ||
5327 | function getFallbackBeforeInputChars(topLevelType, nativeEvent) { | ||
5328 | // If we are currently composing (IME) and using a fallback to do so, | ||
5329 | // try to extract the composed characters from the fallback object. | ||
5330 | // If composition event is available, we extract a string only at | ||
5331 | // compositionevent, otherwise extract it at fallback events. | ||
5332 | if (currentComposition) { | ||
5333 | if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) { | ||
5334 | var chars = currentComposition.getData(); | ||
5335 | FallbackCompositionState.release(currentComposition); | ||
5336 | currentComposition = null; | ||
5337 | return chars; | ||
5338 | } | ||
5339 | return null; | ||
5340 | } | ||
5341 | |||
5342 | switch (topLevelType) { | ||
5343 | case 'topPaste': | ||
5344 | // If a paste event occurs after a keypress, throw out the input | ||
5345 | // chars. Paste events should not lead to BeforeInput events. | ||
5346 | return null; | ||
5347 | case 'topKeyPress': | ||
5348 | /** | ||
5349 | * As of v27, Firefox may fire keypress events even when no character | ||
5350 | * will be inserted. A few possibilities: | ||
5351 | * | ||
5352 | * - `which` is `0`. Arrow keys, Esc key, etc. | ||
5353 | * | ||
5354 | * - `which` is the pressed key code, but no char is available. | ||
5355 | * Ex: 'AltGr + d` in Polish. There is no modified character for | ||
5356 | * this key combination and no character is inserted into the | ||
5357 | * document, but FF fires the keypress for char code `100` anyway. | ||
5358 | * No `input` event will occur. | ||
5359 | * | ||
5360 | * - `which` is the pressed key code, but a command combination is | ||
5361 | * being used. Ex: `Cmd+C`. No character is inserted, and no | ||
5362 | * `input` event will occur. | ||
5363 | */ | ||
5364 | if (nativeEvent.which && !isKeypressCommand(nativeEvent)) { | ||
5365 | return String.fromCharCode(nativeEvent.which); | ||
5366 | } | ||
5367 | return null; | ||
5368 | case 'topCompositionEnd': | ||
5369 | return useFallbackCompositionData ? null : nativeEvent.data; | ||
5370 | default: | ||
5371 | return null; | ||
5372 | } | ||
5373 | } | ||
5374 | |||
5375 | /** | ||
5376 | * Extract a SyntheticInputEvent for `beforeInput`, based on either native | ||
5377 | * `textInput` or fallback behavior. | ||
5378 | * | ||
5379 | * @return {?object} A SyntheticInputEvent. | ||
5380 | */ | ||
5381 | function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
5382 | var chars; | ||
5383 | |||
5384 | if (canUseTextInputEvent) { | ||
5385 | chars = getNativeBeforeInputChars(topLevelType, nativeEvent); | ||
5386 | } else { | ||
5387 | chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); | ||
5388 | } | ||
5389 | |||
5390 | // If no characters are being inserted, no BeforeInput event should | ||
5391 | // be fired. | ||
5392 | if (!chars) { | ||
5393 | return null; | ||
5394 | } | ||
5395 | |||
5396 | var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget); | ||
5397 | |||
5398 | event.data = chars; | ||
5399 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
5400 | return event; | ||
5401 | } | ||
5402 | |||
5403 | /** | ||
5404 | * Create an `onBeforeInput` event to match | ||
5405 | * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. | ||
5406 | * | ||
5407 | * This event plugin is based on the native `textInput` event | ||
5408 | * available in Chrome, Safari, Opera, and IE. This event fires after | ||
5409 | * `onKeyPress` and `onCompositionEnd`, but before `onInput`. | ||
5410 | * | ||
5411 | * `beforeInput` is spec'd but not implemented in any browsers, and | ||
5412 | * the `input` event does not provide any useful information about what has | ||
5413 | * actually been added, contrary to the spec. Thus, `textInput` is the best | ||
5414 | * available event to identify the characters that have actually been inserted | ||
5415 | * into the target node. | ||
5416 | * | ||
5417 | * This plugin is also responsible for emitting `composition` events, thus | ||
5418 | * allowing us to share composition fallback code for both `beforeInput` and | ||
5419 | * `composition` event types. | ||
5420 | */ | ||
5421 | var BeforeInputEventPlugin = { | ||
5422 | |||
5423 | eventTypes: eventTypes, | ||
5424 | |||
5425 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
5426 | return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)]; | ||
5427 | } | ||
5428 | }; | ||
5429 | |||
5430 | module.exports = BeforeInputEventPlugin; | ||
5431 | |||
5432 | /***/ }), | ||
5433 | /* 47 */ | ||
5434 | /***/ (function(module, exports, __webpack_require__) { | ||
5435 | |||
5436 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
5437 | * Copyright 2013-present, Facebook, Inc. | ||
5438 | * All rights reserved. | ||
5439 | * | ||
5440 | * This source code is licensed under the BSD-style license found in the | ||
5441 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5442 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5443 | * | ||
5444 | */ | ||
5445 | |||
5446 | 'use strict'; | ||
5447 | |||
5448 | var EventPluginHub = __webpack_require__(48); | ||
5449 | var EventPluginUtils = __webpack_require__(50); | ||
5450 | |||
5451 | var accumulateInto = __webpack_require__(52); | ||
5452 | var forEachAccumulated = __webpack_require__(53); | ||
5453 | var warning = __webpack_require__(13); | ||
5454 | |||
5455 | var getListener = EventPluginHub.getListener; | ||
5456 | |||
5457 | /** | ||
5458 | * Some event types have a notion of different registration names for different | ||
5459 | * "phases" of propagation. This finds listeners by a given phase. | ||
5460 | */ | ||
5461 | function listenerAtPhase(inst, event, propagationPhase) { | ||
5462 | var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; | ||
5463 | return getListener(inst, registrationName); | ||
5464 | } | ||
5465 | |||
5466 | /** | ||
5467 | * Tags a `SyntheticEvent` with dispatched listeners. Creating this function | ||
5468 | * here, allows us to not have to bind or create functions for each event. | ||
5469 | * Mutating the event's members allows us to not have to create a wrapping | ||
5470 | * "dispatch" object that pairs the event with the listener. | ||
5471 | */ | ||
5472 | function accumulateDirectionalDispatches(inst, phase, event) { | ||
5473 | if (process.env.NODE_ENV !== 'production') { | ||
5474 | process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0; | ||
5475 | } | ||
5476 | var listener = listenerAtPhase(inst, event, phase); | ||
5477 | if (listener) { | ||
5478 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | ||
5479 | event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); | ||
5480 | } | ||
5481 | } | ||
5482 | |||
5483 | /** | ||
5484 | * Collect dispatches (must be entirely collected before dispatching - see unit | ||
5485 | * tests). Lazily allocate the array to conserve memory. We must loop through | ||
5486 | * each event and perform the traversal for each one. We cannot perform a | ||
5487 | * single traversal for the entire collection of events because each event may | ||
5488 | * have a different target. | ||
5489 | */ | ||
5490 | function accumulateTwoPhaseDispatchesSingle(event) { | ||
5491 | if (event && event.dispatchConfig.phasedRegistrationNames) { | ||
5492 | EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); | ||
5493 | } | ||
5494 | } | ||
5495 | |||
5496 | /** | ||
5497 | * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. | ||
5498 | */ | ||
5499 | function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { | ||
5500 | if (event && event.dispatchConfig.phasedRegistrationNames) { | ||
5501 | var targetInst = event._targetInst; | ||
5502 | var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null; | ||
5503 | EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); | ||
5504 | } | ||
5505 | } | ||
5506 | |||
5507 | /** | ||
5508 | * Accumulates without regard to direction, does not look for phased | ||
5509 | * registration names. Same as `accumulateDirectDispatchesSingle` but without | ||
5510 | * requiring that the `dispatchMarker` be the same as the dispatched ID. | ||
5511 | */ | ||
5512 | function accumulateDispatches(inst, ignoredDirection, event) { | ||
5513 | if (event && event.dispatchConfig.registrationName) { | ||
5514 | var registrationName = event.dispatchConfig.registrationName; | ||
5515 | var listener = getListener(inst, registrationName); | ||
5516 | if (listener) { | ||
5517 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | ||
5518 | event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); | ||
5519 | } | ||
5520 | } | ||
5521 | } | ||
5522 | |||
5523 | /** | ||
5524 | * Accumulates dispatches on an `SyntheticEvent`, but only for the | ||
5525 | * `dispatchMarker`. | ||
5526 | * @param {SyntheticEvent} event | ||
5527 | */ | ||
5528 | function accumulateDirectDispatchesSingle(event) { | ||
5529 | if (event && event.dispatchConfig.registrationName) { | ||
5530 | accumulateDispatches(event._targetInst, null, event); | ||
5531 | } | ||
5532 | } | ||
5533 | |||
5534 | function accumulateTwoPhaseDispatches(events) { | ||
5535 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); | ||
5536 | } | ||
5537 | |||
5538 | function accumulateTwoPhaseDispatchesSkipTarget(events) { | ||
5539 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); | ||
5540 | } | ||
5541 | |||
5542 | function accumulateEnterLeaveDispatches(leave, enter, from, to) { | ||
5543 | EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter); | ||
5544 | } | ||
5545 | |||
5546 | function accumulateDirectDispatches(events) { | ||
5547 | forEachAccumulated(events, accumulateDirectDispatchesSingle); | ||
5548 | } | ||
5549 | |||
5550 | /** | ||
5551 | * A small set of propagation patterns, each of which will accept a small amount | ||
5552 | * of information, and generate a set of "dispatch ready event objects" - which | ||
5553 | * are sets of events that have already been annotated with a set of dispatched | ||
5554 | * listener functions/ids. The API is designed this way to discourage these | ||
5555 | * propagation strategies from actually executing the dispatches, since we | ||
5556 | * always want to collect the entire set of dispatches before executing event a | ||
5557 | * single one. | ||
5558 | * | ||
5559 | * @constructor EventPropagators | ||
5560 | */ | ||
5561 | var EventPropagators = { | ||
5562 | accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, | ||
5563 | accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, | ||
5564 | accumulateDirectDispatches: accumulateDirectDispatches, | ||
5565 | accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches | ||
5566 | }; | ||
5567 | |||
5568 | module.exports = EventPropagators; | ||
5569 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
5570 | |||
5571 | /***/ }), | ||
5572 | /* 48 */ | ||
5573 | /***/ (function(module, exports, __webpack_require__) { | ||
5574 | |||
5575 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
5576 | * Copyright 2013-present, Facebook, Inc. | ||
5577 | * All rights reserved. | ||
5578 | * | ||
5579 | * This source code is licensed under the BSD-style license found in the | ||
5580 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5581 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5582 | * | ||
5583 | */ | ||
5584 | |||
5585 | 'use strict'; | ||
5586 | |||
5587 | var _prodInvariant = __webpack_require__(41); | ||
5588 | |||
5589 | var EventPluginRegistry = __webpack_require__(49); | ||
5590 | var EventPluginUtils = __webpack_require__(50); | ||
5591 | var ReactErrorUtils = __webpack_require__(51); | ||
5592 | |||
5593 | var accumulateInto = __webpack_require__(52); | ||
5594 | var forEachAccumulated = __webpack_require__(53); | ||
5595 | var invariant = __webpack_require__(10); | ||
5596 | |||
5597 | /** | ||
5598 | * Internal store for event listeners | ||
5599 | */ | ||
5600 | var listenerBank = {}; | ||
5601 | |||
5602 | /** | ||
5603 | * Internal queue of events that have accumulated their dispatches and are | ||
5604 | * waiting to have their dispatches executed. | ||
5605 | */ | ||
5606 | var eventQueue = null; | ||
5607 | |||
5608 | /** | ||
5609 | * Dispatches an event and releases it back into the pool, unless persistent. | ||
5610 | * | ||
5611 | * @param {?object} event Synthetic event to be dispatched. | ||
5612 | * @param {boolean} simulated If the event is simulated (changes exn behavior) | ||
5613 | * @private | ||
5614 | */ | ||
5615 | var executeDispatchesAndRelease = function (event, simulated) { | ||
5616 | if (event) { | ||
5617 | EventPluginUtils.executeDispatchesInOrder(event, simulated); | ||
5618 | |||
5619 | if (!event.isPersistent()) { | ||
5620 | event.constructor.release(event); | ||
5621 | } | ||
5622 | } | ||
5623 | }; | ||
5624 | var executeDispatchesAndReleaseSimulated = function (e) { | ||
5625 | return executeDispatchesAndRelease(e, true); | ||
5626 | }; | ||
5627 | var executeDispatchesAndReleaseTopLevel = function (e) { | ||
5628 | return executeDispatchesAndRelease(e, false); | ||
5629 | }; | ||
5630 | |||
5631 | var getDictionaryKey = function (inst) { | ||
5632 | // Prevents V8 performance issue: | ||
5633 | // https://github.com/facebook/react/pull/7232 | ||
5634 | return '.' + inst._rootNodeID; | ||
5635 | }; | ||
5636 | |||
5637 | function isInteractive(tag) { | ||
5638 | return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; | ||
5639 | } | ||
5640 | |||
5641 | function shouldPreventMouseEvent(name, type, props) { | ||
5642 | switch (name) { | ||
5643 | case 'onClick': | ||
5644 | case 'onClickCapture': | ||
5645 | case 'onDoubleClick': | ||
5646 | case 'onDoubleClickCapture': | ||
5647 | case 'onMouseDown': | ||
5648 | case 'onMouseDownCapture': | ||
5649 | case 'onMouseMove': | ||
5650 | case 'onMouseMoveCapture': | ||
5651 | case 'onMouseUp': | ||
5652 | case 'onMouseUpCapture': | ||
5653 | return !!(props.disabled && isInteractive(type)); | ||
5654 | default: | ||
5655 | return false; | ||
5656 | } | ||
5657 | } | ||
5658 | |||
5659 | /** | ||
5660 | * This is a unified interface for event plugins to be installed and configured. | ||
5661 | * | ||
5662 | * Event plugins can implement the following properties: | ||
5663 | * | ||
5664 | * `extractEvents` {function(string, DOMEventTarget, string, object): *} | ||
5665 | * Required. When a top-level event is fired, this method is expected to | ||
5666 | * extract synthetic events that will in turn be queued and dispatched. | ||
5667 | * | ||
5668 | * `eventTypes` {object} | ||
5669 | * Optional, plugins that fire events must publish a mapping of registration | ||
5670 | * names that are used to register listeners. Values of this mapping must | ||
5671 | * be objects that contain `registrationName` or `phasedRegistrationNames`. | ||
5672 | * | ||
5673 | * `executeDispatch` {function(object, function, string)} | ||
5674 | * Optional, allows plugins to override how an event gets dispatched. By | ||
5675 | * default, the listener is simply invoked. | ||
5676 | * | ||
5677 | * Each plugin that is injected into `EventsPluginHub` is immediately operable. | ||
5678 | * | ||
5679 | * @public | ||
5680 | */ | ||
5681 | var EventPluginHub = { | ||
5682 | |||
5683 | /** | ||
5684 | * Methods for injecting dependencies. | ||
5685 | */ | ||
5686 | injection: { | ||
5687 | |||
5688 | /** | ||
5689 | * @param {array} InjectedEventPluginOrder | ||
5690 | * @public | ||
5691 | */ | ||
5692 | injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder, | ||
5693 | |||
5694 | /** | ||
5695 | * @param {object} injectedNamesToPlugins Map from names to plugin modules. | ||
5696 | */ | ||
5697 | injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName | ||
5698 | |||
5699 | }, | ||
5700 | |||
5701 | /** | ||
5702 | * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent. | ||
5703 | * | ||
5704 | * @param {object} inst The instance, which is the source of events. | ||
5705 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
5706 | * @param {function} listener The callback to store. | ||
5707 | */ | ||
5708 | putListener: function (inst, registrationName, listener) { | ||
5709 | !(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : _prodInvariant('94', registrationName, typeof listener) : void 0; | ||
5710 | |||
5711 | var key = getDictionaryKey(inst); | ||
5712 | var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); | ||
5713 | bankForRegistrationName[key] = listener; | ||
5714 | |||
5715 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | ||
5716 | if (PluginModule && PluginModule.didPutListener) { | ||
5717 | PluginModule.didPutListener(inst, registrationName, listener); | ||
5718 | } | ||
5719 | }, | ||
5720 | |||
5721 | /** | ||
5722 | * @param {object} inst The instance, which is the source of events. | ||
5723 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
5724 | * @return {?function} The stored callback. | ||
5725 | */ | ||
5726 | getListener: function (inst, registrationName) { | ||
5727 | // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not | ||
5728 | // live here; needs to be moved to a better place soon | ||
5729 | var bankForRegistrationName = listenerBank[registrationName]; | ||
5730 | if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) { | ||
5731 | return null; | ||
5732 | } | ||
5733 | var key = getDictionaryKey(inst); | ||
5734 | return bankForRegistrationName && bankForRegistrationName[key]; | ||
5735 | }, | ||
5736 | |||
5737 | /** | ||
5738 | * Deletes a listener from the registration bank. | ||
5739 | * | ||
5740 | * @param {object} inst The instance, which is the source of events. | ||
5741 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
5742 | */ | ||
5743 | deleteListener: function (inst, registrationName) { | ||
5744 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | ||
5745 | if (PluginModule && PluginModule.willDeleteListener) { | ||
5746 | PluginModule.willDeleteListener(inst, registrationName); | ||
5747 | } | ||
5748 | |||
5749 | var bankForRegistrationName = listenerBank[registrationName]; | ||
5750 | // TODO: This should never be null -- when is it? | ||
5751 | if (bankForRegistrationName) { | ||
5752 | var key = getDictionaryKey(inst); | ||
5753 | delete bankForRegistrationName[key]; | ||
5754 | } | ||
5755 | }, | ||
5756 | |||
5757 | /** | ||
5758 | * Deletes all listeners for the DOM element with the supplied ID. | ||
5759 | * | ||
5760 | * @param {object} inst The instance, which is the source of events. | ||
5761 | */ | ||
5762 | deleteAllListeners: function (inst) { | ||
5763 | var key = getDictionaryKey(inst); | ||
5764 | for (var registrationName in listenerBank) { | ||
5765 | if (!listenerBank.hasOwnProperty(registrationName)) { | ||
5766 | continue; | ||
5767 | } | ||
5768 | |||
5769 | if (!listenerBank[registrationName][key]) { | ||
5770 | continue; | ||
5771 | } | ||
5772 | |||
5773 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | ||
5774 | if (PluginModule && PluginModule.willDeleteListener) { | ||
5775 | PluginModule.willDeleteListener(inst, registrationName); | ||
5776 | } | ||
5777 | |||
5778 | delete listenerBank[registrationName][key]; | ||
5779 | } | ||
5780 | }, | ||
5781 | |||
5782 | /** | ||
5783 | * Allows registered plugins an opportunity to extract events from top-level | ||
5784 | * native browser events. | ||
5785 | * | ||
5786 | * @return {*} An accumulation of synthetic events. | ||
5787 | * @internal | ||
5788 | */ | ||
5789 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
5790 | var events; | ||
5791 | var plugins = EventPluginRegistry.plugins; | ||
5792 | for (var i = 0; i < plugins.length; i++) { | ||
5793 | // Not every plugin in the ordering may be loaded at runtime. | ||
5794 | var possiblePlugin = plugins[i]; | ||
5795 | if (possiblePlugin) { | ||
5796 | var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); | ||
5797 | if (extractedEvents) { | ||
5798 | events = accumulateInto(events, extractedEvents); | ||
5799 | } | ||
5800 | } | ||
5801 | } | ||
5802 | return events; | ||
5803 | }, | ||
5804 | |||
5805 | /** | ||
5806 | * Enqueues a synthetic event that should be dispatched when | ||
5807 | * `processEventQueue` is invoked. | ||
5808 | * | ||
5809 | * @param {*} events An accumulation of synthetic events. | ||
5810 | * @internal | ||
5811 | */ | ||
5812 | enqueueEvents: function (events) { | ||
5813 | if (events) { | ||
5814 | eventQueue = accumulateInto(eventQueue, events); | ||
5815 | } | ||
5816 | }, | ||
5817 | |||
5818 | /** | ||
5819 | * Dispatches all synthetic events on the event queue. | ||
5820 | * | ||
5821 | * @internal | ||
5822 | */ | ||
5823 | processEventQueue: function (simulated) { | ||
5824 | // Set `eventQueue` to null before processing it so that we can tell if more | ||
5825 | // events get enqueued while processing. | ||
5826 | var processingEventQueue = eventQueue; | ||
5827 | eventQueue = null; | ||
5828 | if (simulated) { | ||
5829 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated); | ||
5830 | } else { | ||
5831 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); | ||
5832 | } | ||
5833 | !!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : _prodInvariant('95') : void 0; | ||
5834 | // This would be a good time to rethrow if any of the event handlers threw. | ||
5835 | ReactErrorUtils.rethrowCaughtError(); | ||
5836 | }, | ||
5837 | |||
5838 | /** | ||
5839 | * These are needed for tests only. Do not use! | ||
5840 | */ | ||
5841 | __purge: function () { | ||
5842 | listenerBank = {}; | ||
5843 | }, | ||
5844 | |||
5845 | __getListenerBank: function () { | ||
5846 | return listenerBank; | ||
5847 | } | ||
5848 | |||
5849 | }; | ||
5850 | |||
5851 | module.exports = EventPluginHub; | ||
5852 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
5853 | |||
5854 | /***/ }), | ||
5855 | /* 49 */ | ||
5856 | /***/ (function(module, exports, __webpack_require__) { | ||
5857 | |||
5858 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
5859 | * Copyright 2013-present, Facebook, Inc. | ||
5860 | * All rights reserved. | ||
5861 | * | ||
5862 | * This source code is licensed under the BSD-style license found in the | ||
5863 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5864 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5865 | * | ||
5866 | * | ||
5867 | */ | ||
5868 | |||
5869 | 'use strict'; | ||
5870 | |||
5871 | var _prodInvariant = __webpack_require__(41); | ||
5872 | |||
5873 | var invariant = __webpack_require__(10); | ||
5874 | |||
5875 | /** | ||
5876 | * Injectable ordering of event plugins. | ||
5877 | */ | ||
5878 | var eventPluginOrder = null; | ||
5879 | |||
5880 | /** | ||
5881 | * Injectable mapping from names to event plugin modules. | ||
5882 | */ | ||
5883 | var namesToPlugins = {}; | ||
5884 | |||
5885 | /** | ||
5886 | * Recomputes the plugin list using the injected plugins and plugin ordering. | ||
5887 | * | ||
5888 | * @private | ||
5889 | */ | ||
5890 | function recomputePluginOrdering() { | ||
5891 | if (!eventPluginOrder) { | ||
5892 | // Wait until an `eventPluginOrder` is injected. | ||
5893 | return; | ||
5894 | } | ||
5895 | for (var pluginName in namesToPlugins) { | ||
5896 | var pluginModule = namesToPlugins[pluginName]; | ||
5897 | var pluginIndex = eventPluginOrder.indexOf(pluginName); | ||
5898 | !(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : _prodInvariant('96', pluginName) : void 0; | ||
5899 | if (EventPluginRegistry.plugins[pluginIndex]) { | ||
5900 | continue; | ||
5901 | } | ||
5902 | !pluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0; | ||
5903 | EventPluginRegistry.plugins[pluginIndex] = pluginModule; | ||
5904 | var publishedEvents = pluginModule.eventTypes; | ||
5905 | for (var eventName in publishedEvents) { | ||
5906 | !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : _prodInvariant('98', eventName, pluginName) : void 0; | ||
5907 | } | ||
5908 | } | ||
5909 | } | ||
5910 | |||
5911 | /** | ||
5912 | * Publishes an event so that it can be dispatched by the supplied plugin. | ||
5913 | * | ||
5914 | * @param {object} dispatchConfig Dispatch configuration for the event. | ||
5915 | * @param {object} PluginModule Plugin publishing the event. | ||
5916 | * @return {boolean} True if the event was successfully published. | ||
5917 | * @private | ||
5918 | */ | ||
5919 | function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { | ||
5920 | !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0; | ||
5921 | EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; | ||
5922 | |||
5923 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; | ||
5924 | if (phasedRegistrationNames) { | ||
5925 | for (var phaseName in phasedRegistrationNames) { | ||
5926 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) { | ||
5927 | var phasedRegistrationName = phasedRegistrationNames[phaseName]; | ||
5928 | publishRegistrationName(phasedRegistrationName, pluginModule, eventName); | ||
5929 | } | ||
5930 | } | ||
5931 | return true; | ||
5932 | } else if (dispatchConfig.registrationName) { | ||
5933 | publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); | ||
5934 | return true; | ||
5935 | } | ||
5936 | return false; | ||
5937 | } | ||
5938 | |||
5939 | /** | ||
5940 | * Publishes a registration name that is used to identify dispatched events and | ||
5941 | * can be used with `EventPluginHub.putListener` to register listeners. | ||
5942 | * | ||
5943 | * @param {string} registrationName Registration name to add. | ||
5944 | * @param {object} PluginModule Plugin publishing the event. | ||
5945 | * @private | ||
5946 | */ | ||
5947 | function publishRegistrationName(registrationName, pluginModule, eventName) { | ||
5948 | !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0; | ||
5949 | EventPluginRegistry.registrationNameModules[registrationName] = pluginModule; | ||
5950 | EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; | ||
5951 | |||
5952 | if (process.env.NODE_ENV !== 'production') { | ||
5953 | var lowerCasedName = registrationName.toLowerCase(); | ||
5954 | EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName; | ||
5955 | |||
5956 | if (registrationName === 'onDoubleClick') { | ||
5957 | EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName; | ||
5958 | } | ||
5959 | } | ||
5960 | } | ||
5961 | |||
5962 | /** | ||
5963 | * Registers plugins so that they can extract and dispatch events. | ||
5964 | * | ||
5965 | * @see {EventPluginHub} | ||
5966 | */ | ||
5967 | var EventPluginRegistry = { | ||
5968 | |||
5969 | /** | ||
5970 | * Ordered list of injected plugins. | ||
5971 | */ | ||
5972 | plugins: [], | ||
5973 | |||
5974 | /** | ||
5975 | * Mapping from event name to dispatch config | ||
5976 | */ | ||
5977 | eventNameDispatchConfigs: {}, | ||
5978 | |||
5979 | /** | ||
5980 | * Mapping from registration name to plugin module | ||
5981 | */ | ||
5982 | registrationNameModules: {}, | ||
5983 | |||
5984 | /** | ||
5985 | * Mapping from registration name to event name | ||
5986 | */ | ||
5987 | registrationNameDependencies: {}, | ||
5988 | |||
5989 | /** | ||
5990 | * Mapping from lowercase registration names to the properly cased version, | ||
5991 | * used to warn in the case of missing event handlers. Available | ||
5992 | * only in __DEV__. | ||
5993 | * @type {Object} | ||
5994 | */ | ||
5995 | possibleRegistrationNames: process.env.NODE_ENV !== 'production' ? {} : null, | ||
5996 | // Trust the developer to only use possibleRegistrationNames in __DEV__ | ||
5997 | |||
5998 | /** | ||
5999 | * Injects an ordering of plugins (by plugin name). This allows the ordering | ||
6000 | * to be decoupled from injection of the actual plugins so that ordering is | ||
6001 | * always deterministic regardless of packaging, on-the-fly injection, etc. | ||
6002 | * | ||
6003 | * @param {array} InjectedEventPluginOrder | ||
6004 | * @internal | ||
6005 | * @see {EventPluginHub.injection.injectEventPluginOrder} | ||
6006 | */ | ||
6007 | injectEventPluginOrder: function (injectedEventPluginOrder) { | ||
6008 | !!eventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : _prodInvariant('101') : void 0; | ||
6009 | // Clone the ordering so it cannot be dynamically mutated. | ||
6010 | eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); | ||
6011 | recomputePluginOrdering(); | ||
6012 | }, | ||
6013 | |||
6014 | /** | ||
6015 | * Injects plugins to be used by `EventPluginHub`. The plugin names must be | ||
6016 | * in the ordering injected by `injectEventPluginOrder`. | ||
6017 | * | ||
6018 | * Plugins can be injected as part of page initialization or on-the-fly. | ||
6019 | * | ||
6020 | * @param {object} injectedNamesToPlugins Map from names to plugin modules. | ||
6021 | * @internal | ||
6022 | * @see {EventPluginHub.injection.injectEventPluginsByName} | ||
6023 | */ | ||
6024 | injectEventPluginsByName: function (injectedNamesToPlugins) { | ||
6025 | var isOrderingDirty = false; | ||
6026 | for (var pluginName in injectedNamesToPlugins) { | ||
6027 | if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { | ||
6028 | continue; | ||
6029 | } | ||
6030 | var pluginModule = injectedNamesToPlugins[pluginName]; | ||
6031 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { | ||
6032 | !!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0; | ||
6033 | namesToPlugins[pluginName] = pluginModule; | ||
6034 | isOrderingDirty = true; | ||
6035 | } | ||
6036 | } | ||
6037 | if (isOrderingDirty) { | ||
6038 | recomputePluginOrdering(); | ||
6039 | } | ||
6040 | }, | ||
6041 | |||
6042 | /** | ||
6043 | * Looks up the plugin for the supplied event. | ||
6044 | * | ||
6045 | * @param {object} event A synthetic event. | ||
6046 | * @return {?object} The plugin that created the supplied event. | ||
6047 | * @internal | ||
6048 | */ | ||
6049 | getPluginModuleForEvent: function (event) { | ||
6050 | var dispatchConfig = event.dispatchConfig; | ||
6051 | if (dispatchConfig.registrationName) { | ||
6052 | return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null; | ||
6053 | } | ||
6054 | if (dispatchConfig.phasedRegistrationNames !== undefined) { | ||
6055 | // pulling phasedRegistrationNames out of dispatchConfig helps Flow see | ||
6056 | // that it is not undefined. | ||
6057 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; | ||
6058 | |||
6059 | for (var phase in phasedRegistrationNames) { | ||
6060 | if (!phasedRegistrationNames.hasOwnProperty(phase)) { | ||
6061 | continue; | ||
6062 | } | ||
6063 | var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]]; | ||
6064 | if (pluginModule) { | ||
6065 | return pluginModule; | ||
6066 | } | ||
6067 | } | ||
6068 | } | ||
6069 | return null; | ||
6070 | }, | ||
6071 | |||
6072 | /** | ||
6073 | * Exposed for unit testing. | ||
6074 | * @private | ||
6075 | */ | ||
6076 | _resetEventPlugins: function () { | ||
6077 | eventPluginOrder = null; | ||
6078 | for (var pluginName in namesToPlugins) { | ||
6079 | if (namesToPlugins.hasOwnProperty(pluginName)) { | ||
6080 | delete namesToPlugins[pluginName]; | ||
6081 | } | ||
6082 | } | ||
6083 | EventPluginRegistry.plugins.length = 0; | ||
6084 | |||
6085 | var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs; | ||
6086 | for (var eventName in eventNameDispatchConfigs) { | ||
6087 | if (eventNameDispatchConfigs.hasOwnProperty(eventName)) { | ||
6088 | delete eventNameDispatchConfigs[eventName]; | ||
6089 | } | ||
6090 | } | ||
6091 | |||
6092 | var registrationNameModules = EventPluginRegistry.registrationNameModules; | ||
6093 | for (var registrationName in registrationNameModules) { | ||
6094 | if (registrationNameModules.hasOwnProperty(registrationName)) { | ||
6095 | delete registrationNameModules[registrationName]; | ||
6096 | } | ||
6097 | } | ||
6098 | |||
6099 | if (process.env.NODE_ENV !== 'production') { | ||
6100 | var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames; | ||
6101 | for (var lowerCasedName in possibleRegistrationNames) { | ||
6102 | if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) { | ||
6103 | delete possibleRegistrationNames[lowerCasedName]; | ||
6104 | } | ||
6105 | } | ||
6106 | } | ||
6107 | } | ||
6108 | |||
6109 | }; | ||
6110 | |||
6111 | module.exports = EventPluginRegistry; | ||
6112 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
6113 | |||
6114 | /***/ }), | ||
6115 | /* 50 */ | ||
6116 | /***/ (function(module, exports, __webpack_require__) { | ||
6117 | |||
6118 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6119 | * Copyright 2013-present, Facebook, Inc. | ||
6120 | * All rights reserved. | ||
6121 | * | ||
6122 | * This source code is licensed under the BSD-style license found in the | ||
6123 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6124 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6125 | * | ||
6126 | */ | ||
6127 | |||
6128 | 'use strict'; | ||
6129 | |||
6130 | var _prodInvariant = __webpack_require__(41); | ||
6131 | |||
6132 | var ReactErrorUtils = __webpack_require__(51); | ||
6133 | |||
6134 | var invariant = __webpack_require__(10); | ||
6135 | var warning = __webpack_require__(13); | ||
6136 | |||
6137 | /** | ||
6138 | * Injected dependencies: | ||
6139 | */ | ||
6140 | |||
6141 | /** | ||
6142 | * - `ComponentTree`: [required] Module that can convert between React instances | ||
6143 | * and actual node references. | ||
6144 | */ | ||
6145 | var ComponentTree; | ||
6146 | var TreeTraversal; | ||
6147 | var injection = { | ||
6148 | injectComponentTree: function (Injected) { | ||
6149 | ComponentTree = Injected; | ||
6150 | if (process.env.NODE_ENV !== 'production') { | ||
6151 | process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0; | ||
6152 | } | ||
6153 | }, | ||
6154 | injectTreeTraversal: function (Injected) { | ||
6155 | TreeTraversal = Injected; | ||
6156 | if (process.env.NODE_ENV !== 'production') { | ||
6157 | process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0; | ||
6158 | } | ||
6159 | } | ||
6160 | }; | ||
6161 | |||
6162 | function isEndish(topLevelType) { | ||
6163 | return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel'; | ||
6164 | } | ||
6165 | |||
6166 | function isMoveish(topLevelType) { | ||
6167 | return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove'; | ||
6168 | } | ||
6169 | function isStartish(topLevelType) { | ||
6170 | return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart'; | ||
6171 | } | ||
6172 | |||
6173 | var validateEventDispatches; | ||
6174 | if (process.env.NODE_ENV !== 'production') { | ||
6175 | validateEventDispatches = function (event) { | ||
6176 | var dispatchListeners = event._dispatchListeners; | ||
6177 | var dispatchInstances = event._dispatchInstances; | ||
6178 | |||
6179 | var listenersIsArr = Array.isArray(dispatchListeners); | ||
6180 | var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; | ||
6181 | |||
6182 | var instancesIsArr = Array.isArray(dispatchInstances); | ||
6183 | var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; | ||
6184 | |||
6185 | process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0; | ||
6186 | }; | ||
6187 | } | ||
6188 | |||
6189 | /** | ||
6190 | * Dispatch the event to the listener. | ||
6191 | * @param {SyntheticEvent} event SyntheticEvent to handle | ||
6192 | * @param {boolean} simulated If the event is simulated (changes exn behavior) | ||
6193 | * @param {function} listener Application-level callback | ||
6194 | * @param {*} inst Internal component instance | ||
6195 | */ | ||
6196 | function executeDispatch(event, simulated, listener, inst) { | ||
6197 | var type = event.type || 'unknown-event'; | ||
6198 | event.currentTarget = EventPluginUtils.getNodeFromInstance(inst); | ||
6199 | if (simulated) { | ||
6200 | ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event); | ||
6201 | } else { | ||
6202 | ReactErrorUtils.invokeGuardedCallback(type, listener, event); | ||
6203 | } | ||
6204 | event.currentTarget = null; | ||
6205 | } | ||
6206 | |||
6207 | /** | ||
6208 | * Standard/simple iteration through an event's collected dispatches. | ||
6209 | */ | ||
6210 | function executeDispatchesInOrder(event, simulated) { | ||
6211 | var dispatchListeners = event._dispatchListeners; | ||
6212 | var dispatchInstances = event._dispatchInstances; | ||
6213 | if (process.env.NODE_ENV !== 'production') { | ||
6214 | validateEventDispatches(event); | ||
6215 | } | ||
6216 | if (Array.isArray(dispatchListeners)) { | ||
6217 | for (var i = 0; i < dispatchListeners.length; i++) { | ||
6218 | if (event.isPropagationStopped()) { | ||
6219 | break; | ||
6220 | } | ||
6221 | // Listeners and Instances are two parallel arrays that are always in sync. | ||
6222 | executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]); | ||
6223 | } | ||
6224 | } else if (dispatchListeners) { | ||
6225 | executeDispatch(event, simulated, dispatchListeners, dispatchInstances); | ||
6226 | } | ||
6227 | event._dispatchListeners = null; | ||
6228 | event._dispatchInstances = null; | ||
6229 | } | ||
6230 | |||
6231 | /** | ||
6232 | * Standard/simple iteration through an event's collected dispatches, but stops | ||
6233 | * at the first dispatch execution returning true, and returns that id. | ||
6234 | * | ||
6235 | * @return {?string} id of the first dispatch execution who's listener returns | ||
6236 | * true, or null if no listener returned true. | ||
6237 | */ | ||
6238 | function executeDispatchesInOrderStopAtTrueImpl(event) { | ||
6239 | var dispatchListeners = event._dispatchListeners; | ||
6240 | var dispatchInstances = event._dispatchInstances; | ||
6241 | if (process.env.NODE_ENV !== 'production') { | ||
6242 | validateEventDispatches(event); | ||
6243 | } | ||
6244 | if (Array.isArray(dispatchListeners)) { | ||
6245 | for (var i = 0; i < dispatchListeners.length; i++) { | ||
6246 | if (event.isPropagationStopped()) { | ||
6247 | break; | ||
6248 | } | ||
6249 | // Listeners and Instances are two parallel arrays that are always in sync. | ||
6250 | if (dispatchListeners[i](event, dispatchInstances[i])) { | ||
6251 | return dispatchInstances[i]; | ||
6252 | } | ||
6253 | } | ||
6254 | } else if (dispatchListeners) { | ||
6255 | if (dispatchListeners(event, dispatchInstances)) { | ||
6256 | return dispatchInstances; | ||
6257 | } | ||
6258 | } | ||
6259 | return null; | ||
6260 | } | ||
6261 | |||
6262 | /** | ||
6263 | * @see executeDispatchesInOrderStopAtTrueImpl | ||
6264 | */ | ||
6265 | function executeDispatchesInOrderStopAtTrue(event) { | ||
6266 | var ret = executeDispatchesInOrderStopAtTrueImpl(event); | ||
6267 | event._dispatchInstances = null; | ||
6268 | event._dispatchListeners = null; | ||
6269 | return ret; | ||
6270 | } | ||
6271 | |||
6272 | /** | ||
6273 | * Execution of a "direct" dispatch - there must be at most one dispatch | ||
6274 | * accumulated on the event or it is considered an error. It doesn't really make | ||
6275 | * sense for an event with multiple dispatches (bubbled) to keep track of the | ||
6276 | * return values at each dispatch execution, but it does tend to make sense when | ||
6277 | * dealing with "direct" dispatches. | ||
6278 | * | ||
6279 | * @return {*} The return value of executing the single dispatch. | ||
6280 | */ | ||
6281 | function executeDirectDispatch(event) { | ||
6282 | if (process.env.NODE_ENV !== 'production') { | ||
6283 | validateEventDispatches(event); | ||
6284 | } | ||
6285 | var dispatchListener = event._dispatchListeners; | ||
6286 | var dispatchInstance = event._dispatchInstances; | ||
6287 | !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0; | ||
6288 | event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null; | ||
6289 | var res = dispatchListener ? dispatchListener(event) : null; | ||
6290 | event.currentTarget = null; | ||
6291 | event._dispatchListeners = null; | ||
6292 | event._dispatchInstances = null; | ||
6293 | return res; | ||
6294 | } | ||
6295 | |||
6296 | /** | ||
6297 | * @param {SyntheticEvent} event | ||
6298 | * @return {boolean} True iff number of dispatches accumulated is greater than 0. | ||
6299 | */ | ||
6300 | function hasDispatches(event) { | ||
6301 | return !!event._dispatchListeners; | ||
6302 | } | ||
6303 | |||
6304 | /** | ||
6305 | * General utilities that are useful in creating custom Event Plugins. | ||
6306 | */ | ||
6307 | var EventPluginUtils = { | ||
6308 | isEndish: isEndish, | ||
6309 | isMoveish: isMoveish, | ||
6310 | isStartish: isStartish, | ||
6311 | |||
6312 | executeDirectDispatch: executeDirectDispatch, | ||
6313 | executeDispatchesInOrder: executeDispatchesInOrder, | ||
6314 | executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, | ||
6315 | hasDispatches: hasDispatches, | ||
6316 | |||
6317 | getInstanceFromNode: function (node) { | ||
6318 | return ComponentTree.getInstanceFromNode(node); | ||
6319 | }, | ||
6320 | getNodeFromInstance: function (node) { | ||
6321 | return ComponentTree.getNodeFromInstance(node); | ||
6322 | }, | ||
6323 | isAncestor: function (a, b) { | ||
6324 | return TreeTraversal.isAncestor(a, b); | ||
6325 | }, | ||
6326 | getLowestCommonAncestor: function (a, b) { | ||
6327 | return TreeTraversal.getLowestCommonAncestor(a, b); | ||
6328 | }, | ||
6329 | getParentInstance: function (inst) { | ||
6330 | return TreeTraversal.getParentInstance(inst); | ||
6331 | }, | ||
6332 | traverseTwoPhase: function (target, fn, arg) { | ||
6333 | return TreeTraversal.traverseTwoPhase(target, fn, arg); | ||
6334 | }, | ||
6335 | traverseEnterLeave: function (from, to, fn, argFrom, argTo) { | ||
6336 | return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo); | ||
6337 | }, | ||
6338 | |||
6339 | injection: injection | ||
6340 | }; | ||
6341 | |||
6342 | module.exports = EventPluginUtils; | ||
6343 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
6344 | |||
6345 | /***/ }), | ||
6346 | /* 51 */ | ||
6347 | /***/ (function(module, exports, __webpack_require__) { | ||
6348 | |||
6349 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6350 | * Copyright 2013-present, Facebook, Inc. | ||
6351 | * All rights reserved. | ||
6352 | * | ||
6353 | * This source code is licensed under the BSD-style license found in the | ||
6354 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6355 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6356 | * | ||
6357 | * | ||
6358 | */ | ||
6359 | |||
6360 | 'use strict'; | ||
6361 | |||
6362 | var caughtError = null; | ||
6363 | |||
6364 | /** | ||
6365 | * Call a function while guarding against errors that happens within it. | ||
6366 | * | ||
6367 | * @param {String} name of the guard to use for logging or debugging | ||
6368 | * @param {Function} func The function to invoke | ||
6369 | * @param {*} a First argument | ||
6370 | * @param {*} b Second argument | ||
6371 | */ | ||
6372 | function invokeGuardedCallback(name, func, a) { | ||
6373 | try { | ||
6374 | func(a); | ||
6375 | } catch (x) { | ||
6376 | if (caughtError === null) { | ||
6377 | caughtError = x; | ||
6378 | } | ||
6379 | } | ||
6380 | } | ||
6381 | |||
6382 | var ReactErrorUtils = { | ||
6383 | invokeGuardedCallback: invokeGuardedCallback, | ||
6384 | |||
6385 | /** | ||
6386 | * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event | ||
6387 | * handler are sure to be rethrown by rethrowCaughtError. | ||
6388 | */ | ||
6389 | invokeGuardedCallbackWithCatch: invokeGuardedCallback, | ||
6390 | |||
6391 | /** | ||
6392 | * During execution of guarded functions we will capture the first error which | ||
6393 | * we will rethrow to be handled by the top level error handler. | ||
6394 | */ | ||
6395 | rethrowCaughtError: function () { | ||
6396 | if (caughtError) { | ||
6397 | var error = caughtError; | ||
6398 | caughtError = null; | ||
6399 | throw error; | ||
6400 | } | ||
6401 | } | ||
6402 | }; | ||
6403 | |||
6404 | if (process.env.NODE_ENV !== 'production') { | ||
6405 | /** | ||
6406 | * To help development we can get better devtools integration by simulating a | ||
6407 | * real browser event. | ||
6408 | */ | ||
6409 | if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { | ||
6410 | var fakeNode = document.createElement('react'); | ||
6411 | ReactErrorUtils.invokeGuardedCallback = function (name, func, a) { | ||
6412 | var boundFunc = func.bind(null, a); | ||
6413 | var evtType = 'react-' + name; | ||
6414 | fakeNode.addEventListener(evtType, boundFunc, false); | ||
6415 | var evt = document.createEvent('Event'); | ||
6416 | evt.initEvent(evtType, false, false); | ||
6417 | fakeNode.dispatchEvent(evt); | ||
6418 | fakeNode.removeEventListener(evtType, boundFunc, false); | ||
6419 | }; | ||
6420 | } | ||
6421 | } | ||
6422 | |||
6423 | module.exports = ReactErrorUtils; | ||
6424 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
6425 | |||
6426 | /***/ }), | ||
6427 | /* 52 */ | ||
6428 | /***/ (function(module, exports, __webpack_require__) { | ||
6429 | |||
6430 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6431 | * Copyright 2014-present, Facebook, Inc. | ||
6432 | * All rights reserved. | ||
6433 | * | ||
6434 | * This source code is licensed under the BSD-style license found in the | ||
6435 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6436 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6437 | * | ||
6438 | * | ||
6439 | */ | ||
6440 | |||
6441 | 'use strict'; | ||
6442 | |||
6443 | var _prodInvariant = __webpack_require__(41); | ||
6444 | |||
6445 | var invariant = __webpack_require__(10); | ||
6446 | |||
6447 | /** | ||
6448 | * Accumulates items that must not be null or undefined into the first one. This | ||
6449 | * is used to conserve memory by avoiding array allocations, and thus sacrifices | ||
6450 | * API cleanness. Since `current` can be null before being passed in and not | ||
6451 | * null after this function, make sure to assign it back to `current`: | ||
6452 | * | ||
6453 | * `a = accumulateInto(a, b);` | ||
6454 | * | ||
6455 | * This API should be sparingly used. Try `accumulate` for something cleaner. | ||
6456 | * | ||
6457 | * @return {*|array<*>} An accumulation of items. | ||
6458 | */ | ||
6459 | |||
6460 | function accumulateInto(current, next) { | ||
6461 | !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0; | ||
6462 | |||
6463 | if (current == null) { | ||
6464 | return next; | ||
6465 | } | ||
6466 | |||
6467 | // Both are not empty. Warning: Never call x.concat(y) when you are not | ||
6468 | // certain that x is an Array (x could be a string with concat method). | ||
6469 | if (Array.isArray(current)) { | ||
6470 | if (Array.isArray(next)) { | ||
6471 | current.push.apply(current, next); | ||
6472 | return current; | ||
6473 | } | ||
6474 | current.push(next); | ||
6475 | return current; | ||
6476 | } | ||
6477 | |||
6478 | if (Array.isArray(next)) { | ||
6479 | // A bit too dangerous to mutate `next`. | ||
6480 | return [current].concat(next); | ||
6481 | } | ||
6482 | |||
6483 | return [current, next]; | ||
6484 | } | ||
6485 | |||
6486 | module.exports = accumulateInto; | ||
6487 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
6488 | |||
6489 | /***/ }), | ||
6490 | /* 53 */ | ||
6491 | /***/ (function(module, exports) { | ||
6492 | |||
6493 | /** | ||
6494 | * Copyright 2013-present, Facebook, Inc. | ||
6495 | * All rights reserved. | ||
6496 | * | ||
6497 | * This source code is licensed under the BSD-style license found in the | ||
6498 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6499 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6500 | * | ||
6501 | * | ||
6502 | */ | ||
6503 | |||
6504 | 'use strict'; | ||
6505 | |||
6506 | /** | ||
6507 | * @param {array} arr an "accumulation" of items which is either an Array or | ||
6508 | * a single item. Useful when paired with the `accumulate` module. This is a | ||
6509 | * simple utility that allows us to reason about a collection of items, but | ||
6510 | * handling the case when there is exactly one item (and we do not need to | ||
6511 | * allocate an array). | ||
6512 | */ | ||
6513 | |||
6514 | function forEachAccumulated(arr, cb, scope) { | ||
6515 | if (Array.isArray(arr)) { | ||
6516 | arr.forEach(cb, scope); | ||
6517 | } else if (arr) { | ||
6518 | cb.call(scope, arr); | ||
6519 | } | ||
6520 | } | ||
6521 | |||
6522 | module.exports = forEachAccumulated; | ||
6523 | |||
6524 | /***/ }), | ||
6525 | /* 54 */ | ||
6526 | /***/ (function(module, exports) { | ||
6527 | |||
6528 | /** | ||
6529 | * Copyright (c) 2013-present, Facebook, Inc. | ||
6530 | * All rights reserved. | ||
6531 | * | ||
6532 | * This source code is licensed under the BSD-style license found in the | ||
6533 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6534 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6535 | * | ||
6536 | */ | ||
6537 | |||
6538 | 'use strict'; | ||
6539 | |||
6540 | var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); | ||
6541 | |||
6542 | /** | ||
6543 | * Simple, lightweight module assisting with the detection and context of | ||
6544 | * Worker. Helps avoid circular dependencies and allows code to reason about | ||
6545 | * whether or not they are in a Worker, even if they never include the main | ||
6546 | * `ReactWorker` dependency. | ||
6547 | */ | ||
6548 | var ExecutionEnvironment = { | ||
6549 | |||
6550 | canUseDOM: canUseDOM, | ||
6551 | |||
6552 | canUseWorkers: typeof Worker !== 'undefined', | ||
6553 | |||
6554 | canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), | ||
6555 | |||
6556 | canUseViewport: canUseDOM && !!window.screen, | ||
6557 | |||
6558 | isInWorker: !canUseDOM // For now, this is true - might change in the future. | ||
6559 | |||
6560 | }; | ||
6561 | |||
6562 | module.exports = ExecutionEnvironment; | ||
6563 | |||
6564 | /***/ }), | ||
6565 | /* 55 */ | ||
6566 | /***/ (function(module, exports, __webpack_require__) { | ||
6567 | |||
6568 | /** | ||
6569 | * Copyright 2013-present, Facebook, Inc. | ||
6570 | * All rights reserved. | ||
6571 | * | ||
6572 | * This source code is licensed under the BSD-style license found in the | ||
6573 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6574 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6575 | * | ||
6576 | */ | ||
6577 | |||
6578 | 'use strict'; | ||
6579 | |||
6580 | var _assign = __webpack_require__(6); | ||
6581 | |||
6582 | var PooledClass = __webpack_require__(56); | ||
6583 | |||
6584 | var getTextContentAccessor = __webpack_require__(57); | ||
6585 | |||
6586 | /** | ||
6587 | * This helper class stores information about text content of a target node, | ||
6588 | * allowing comparison of content before and after a given event. | ||
6589 | * | ||
6590 | * Identify the node where selection currently begins, then observe | ||
6591 | * both its text content and its current position in the DOM. Since the | ||
6592 | * browser may natively replace the target node during composition, we can | ||
6593 | * use its position to find its replacement. | ||
6594 | * | ||
6595 | * @param {DOMEventTarget} root | ||
6596 | */ | ||
6597 | function FallbackCompositionState(root) { | ||
6598 | this._root = root; | ||
6599 | this._startText = this.getText(); | ||
6600 | this._fallbackText = null; | ||
6601 | } | ||
6602 | |||
6603 | _assign(FallbackCompositionState.prototype, { | ||
6604 | destructor: function () { | ||
6605 | this._root = null; | ||
6606 | this._startText = null; | ||
6607 | this._fallbackText = null; | ||
6608 | }, | ||
6609 | |||
6610 | /** | ||
6611 | * Get current text of input. | ||
6612 | * | ||
6613 | * @return {string} | ||
6614 | */ | ||
6615 | getText: function () { | ||
6616 | if ('value' in this._root) { | ||
6617 | return this._root.value; | ||
6618 | } | ||
6619 | return this._root[getTextContentAccessor()]; | ||
6620 | }, | ||
6621 | |||
6622 | /** | ||
6623 | * Determine the differing substring between the initially stored | ||
6624 | * text content and the current content. | ||
6625 | * | ||
6626 | * @return {string} | ||
6627 | */ | ||
6628 | getData: function () { | ||
6629 | if (this._fallbackText) { | ||
6630 | return this._fallbackText; | ||
6631 | } | ||
6632 | |||
6633 | var start; | ||
6634 | var startValue = this._startText; | ||
6635 | var startLength = startValue.length; | ||
6636 | var end; | ||
6637 | var endValue = this.getText(); | ||
6638 | var endLength = endValue.length; | ||
6639 | |||
6640 | for (start = 0; start < startLength; start++) { | ||
6641 | if (startValue[start] !== endValue[start]) { | ||
6642 | break; | ||
6643 | } | ||
6644 | } | ||
6645 | |||
6646 | var minEnd = startLength - start; | ||
6647 | for (end = 1; end <= minEnd; end++) { | ||
6648 | if (startValue[startLength - end] !== endValue[endLength - end]) { | ||
6649 | break; | ||
6650 | } | ||
6651 | } | ||
6652 | |||
6653 | var sliceTail = end > 1 ? 1 - end : undefined; | ||
6654 | this._fallbackText = endValue.slice(start, sliceTail); | ||
6655 | return this._fallbackText; | ||
6656 | } | ||
6657 | }); | ||
6658 | |||
6659 | PooledClass.addPoolingTo(FallbackCompositionState); | ||
6660 | |||
6661 | module.exports = FallbackCompositionState; | ||
6662 | |||
6663 | /***/ }), | ||
6664 | /* 56 */ | ||
6665 | [323, 41], | ||
6666 | /* 57 */ | ||
6667 | /***/ (function(module, exports, __webpack_require__) { | ||
6668 | |||
6669 | /** | ||
6670 | * Copyright 2013-present, Facebook, Inc. | ||
6671 | * All rights reserved. | ||
6672 | * | ||
6673 | * This source code is licensed under the BSD-style license found in the | ||
6674 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6675 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6676 | * | ||
6677 | */ | ||
6678 | |||
6679 | 'use strict'; | ||
6680 | |||
6681 | var ExecutionEnvironment = __webpack_require__(54); | ||
6682 | |||
6683 | var contentKey = null; | ||
6684 | |||
6685 | /** | ||
6686 | * Gets the key used to access text content on a DOM node. | ||
6687 | * | ||
6688 | * @return {?string} Key used to access text content. | ||
6689 | * @internal | ||
6690 | */ | ||
6691 | function getTextContentAccessor() { | ||
6692 | if (!contentKey && ExecutionEnvironment.canUseDOM) { | ||
6693 | // Prefer textContent to innerText because many browsers support both but | ||
6694 | // SVG <text> elements don't support innerText even when <div> does. | ||
6695 | contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; | ||
6696 | } | ||
6697 | return contentKey; | ||
6698 | } | ||
6699 | |||
6700 | module.exports = getTextContentAccessor; | ||
6701 | |||
6702 | /***/ }), | ||
6703 | /* 58 */ | ||
6704 | /***/ (function(module, exports, __webpack_require__) { | ||
6705 | |||
6706 | /** | ||
6707 | * Copyright 2013-present, Facebook, Inc. | ||
6708 | * All rights reserved. | ||
6709 | * | ||
6710 | * This source code is licensed under the BSD-style license found in the | ||
6711 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6712 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6713 | * | ||
6714 | */ | ||
6715 | |||
6716 | 'use strict'; | ||
6717 | |||
6718 | var SyntheticEvent = __webpack_require__(59); | ||
6719 | |||
6720 | /** | ||
6721 | * @interface Event | ||
6722 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents | ||
6723 | */ | ||
6724 | var CompositionEventInterface = { | ||
6725 | data: null | ||
6726 | }; | ||
6727 | |||
6728 | /** | ||
6729 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
6730 | * @param {string} dispatchMarker Marker identifying the event target. | ||
6731 | * @param {object} nativeEvent Native browser event. | ||
6732 | * @extends {SyntheticUIEvent} | ||
6733 | */ | ||
6734 | function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
6735 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
6736 | } | ||
6737 | |||
6738 | SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface); | ||
6739 | |||
6740 | module.exports = SyntheticCompositionEvent; | ||
6741 | |||
6742 | /***/ }), | ||
6743 | /* 59 */ | ||
6744 | /***/ (function(module, exports, __webpack_require__) { | ||
6745 | |||
6746 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6747 | * Copyright 2013-present, Facebook, Inc. | ||
6748 | * All rights reserved. | ||
6749 | * | ||
6750 | * This source code is licensed under the BSD-style license found in the | ||
6751 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6752 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6753 | * | ||
6754 | */ | ||
6755 | |||
6756 | 'use strict'; | ||
6757 | |||
6758 | var _assign = __webpack_require__(6); | ||
6759 | |||
6760 | var PooledClass = __webpack_require__(56); | ||
6761 | |||
6762 | var emptyFunction = __webpack_require__(14); | ||
6763 | var warning = __webpack_require__(13); | ||
6764 | |||
6765 | var didWarnForAddedNewProperty = false; | ||
6766 | var isProxySupported = typeof Proxy === 'function'; | ||
6767 | |||
6768 | var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances']; | ||
6769 | |||
6770 | /** | ||
6771 | * @interface Event | ||
6772 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
6773 | */ | ||
6774 | var EventInterface = { | ||
6775 | type: null, | ||
6776 | target: null, | ||
6777 | // currentTarget is set when dispatching; no use in copying it here | ||
6778 | currentTarget: emptyFunction.thatReturnsNull, | ||
6779 | eventPhase: null, | ||
6780 | bubbles: null, | ||
6781 | cancelable: null, | ||
6782 | timeStamp: function (event) { | ||
6783 | return event.timeStamp || Date.now(); | ||
6784 | }, | ||
6785 | defaultPrevented: null, | ||
6786 | isTrusted: null | ||
6787 | }; | ||
6788 | |||
6789 | /** | ||
6790 | * Synthetic events are dispatched by event plugins, typically in response to a | ||
6791 | * top-level event delegation handler. | ||
6792 | * | ||
6793 | * These systems should generally use pooling to reduce the frequency of garbage | ||
6794 | * collection. The system should check `isPersistent` to determine whether the | ||
6795 | * event should be released into the pool after being dispatched. Users that | ||
6796 | * need a persisted event should invoke `persist`. | ||
6797 | * | ||
6798 | * Synthetic events (and subclasses) implement the DOM Level 3 Events API by | ||
6799 | * normalizing browser quirks. Subclasses do not necessarily have to implement a | ||
6800 | * DOM interface; custom application-specific events can also subclass this. | ||
6801 | * | ||
6802 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
6803 | * @param {*} targetInst Marker identifying the event target. | ||
6804 | * @param {object} nativeEvent Native browser event. | ||
6805 | * @param {DOMEventTarget} nativeEventTarget Target node. | ||
6806 | */ | ||
6807 | function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { | ||
6808 | if (process.env.NODE_ENV !== 'production') { | ||
6809 | // these have a getter/setter for warnings | ||
6810 | delete this.nativeEvent; | ||
6811 | delete this.preventDefault; | ||
6812 | delete this.stopPropagation; | ||
6813 | } | ||
6814 | |||
6815 | this.dispatchConfig = dispatchConfig; | ||
6816 | this._targetInst = targetInst; | ||
6817 | this.nativeEvent = nativeEvent; | ||
6818 | |||
6819 | var Interface = this.constructor.Interface; | ||
6820 | for (var propName in Interface) { | ||
6821 | if (!Interface.hasOwnProperty(propName)) { | ||
6822 | continue; | ||
6823 | } | ||
6824 | if (process.env.NODE_ENV !== 'production') { | ||
6825 | delete this[propName]; // this has a getter/setter for warnings | ||
6826 | } | ||
6827 | var normalize = Interface[propName]; | ||
6828 | if (normalize) { | ||
6829 | this[propName] = normalize(nativeEvent); | ||
6830 | } else { | ||
6831 | if (propName === 'target') { | ||
6832 | this.target = nativeEventTarget; | ||
6833 | } else { | ||
6834 | this[propName] = nativeEvent[propName]; | ||
6835 | } | ||
6836 | } | ||
6837 | } | ||
6838 | |||
6839 | var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; | ||
6840 | if (defaultPrevented) { | ||
6841 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | ||
6842 | } else { | ||
6843 | this.isDefaultPrevented = emptyFunction.thatReturnsFalse; | ||
6844 | } | ||
6845 | this.isPropagationStopped = emptyFunction.thatReturnsFalse; | ||
6846 | return this; | ||
6847 | } | ||
6848 | |||
6849 | _assign(SyntheticEvent.prototype, { | ||
6850 | |||
6851 | preventDefault: function () { | ||
6852 | this.defaultPrevented = true; | ||
6853 | var event = this.nativeEvent; | ||
6854 | if (!event) { | ||
6855 | return; | ||
6856 | } | ||
6857 | |||
6858 | if (event.preventDefault) { | ||
6859 | event.preventDefault(); | ||
6860 | } else if (typeof event.returnValue !== 'unknown') { | ||
6861 | // eslint-disable-line valid-typeof | ||
6862 | event.returnValue = false; | ||
6863 | } | ||
6864 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | ||
6865 | }, | ||
6866 | |||
6867 | stopPropagation: function () { | ||
6868 | var event = this.nativeEvent; | ||
6869 | if (!event) { | ||
6870 | return; | ||
6871 | } | ||
6872 | |||
6873 | if (event.stopPropagation) { | ||
6874 | event.stopPropagation(); | ||
6875 | } else if (typeof event.cancelBubble !== 'unknown') { | ||
6876 | // eslint-disable-line valid-typeof | ||
6877 | // The ChangeEventPlugin registers a "propertychange" event for | ||
6878 | // IE. This event does not support bubbling or cancelling, and | ||
6879 | // any references to cancelBubble throw "Member not found". A | ||
6880 | // typeof check of "unknown" circumvents this issue (and is also | ||
6881 | // IE specific). | ||
6882 | event.cancelBubble = true; | ||
6883 | } | ||
6884 | |||
6885 | this.isPropagationStopped = emptyFunction.thatReturnsTrue; | ||
6886 | }, | ||
6887 | |||
6888 | /** | ||
6889 | * We release all dispatched `SyntheticEvent`s after each event loop, adding | ||
6890 | * them back into the pool. This allows a way to hold onto a reference that | ||
6891 | * won't be added back into the pool. | ||
6892 | */ | ||
6893 | persist: function () { | ||
6894 | this.isPersistent = emptyFunction.thatReturnsTrue; | ||
6895 | }, | ||
6896 | |||
6897 | /** | ||
6898 | * Checks if this event should be released back into the pool. | ||
6899 | * | ||
6900 | * @return {boolean} True if this should not be released, false otherwise. | ||
6901 | */ | ||
6902 | isPersistent: emptyFunction.thatReturnsFalse, | ||
6903 | |||
6904 | /** | ||
6905 | * `PooledClass` looks for `destructor` on each instance it releases. | ||
6906 | */ | ||
6907 | destructor: function () { | ||
6908 | var Interface = this.constructor.Interface; | ||
6909 | for (var propName in Interface) { | ||
6910 | if (process.env.NODE_ENV !== 'production') { | ||
6911 | Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); | ||
6912 | } else { | ||
6913 | this[propName] = null; | ||
6914 | } | ||
6915 | } | ||
6916 | for (var i = 0; i < shouldBeReleasedProperties.length; i++) { | ||
6917 | this[shouldBeReleasedProperties[i]] = null; | ||
6918 | } | ||
6919 | if (process.env.NODE_ENV !== 'production') { | ||
6920 | Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); | ||
6921 | Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction)); | ||
6922 | Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction)); | ||
6923 | } | ||
6924 | } | ||
6925 | |||
6926 | }); | ||
6927 | |||
6928 | SyntheticEvent.Interface = EventInterface; | ||
6929 | |||
6930 | if (process.env.NODE_ENV !== 'production') { | ||
6931 | if (isProxySupported) { | ||
6932 | /*eslint-disable no-func-assign */ | ||
6933 | SyntheticEvent = new Proxy(SyntheticEvent, { | ||
6934 | construct: function (target, args) { | ||
6935 | return this.apply(target, Object.create(target.prototype), args); | ||
6936 | }, | ||
6937 | apply: function (constructor, that, args) { | ||
6938 | return new Proxy(constructor.apply(that, args), { | ||
6939 | set: function (target, prop, value) { | ||
6940 | if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) { | ||
6941 | process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re adding a new property in the synthetic event object. ' + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0; | ||
6942 | didWarnForAddedNewProperty = true; | ||
6943 | } | ||
6944 | target[prop] = value; | ||
6945 | return true; | ||
6946 | } | ||
6947 | }); | ||
6948 | } | ||
6949 | }); | ||
6950 | /*eslint-enable no-func-assign */ | ||
6951 | } | ||
6952 | } | ||
6953 | /** | ||
6954 | * Helper to reduce boilerplate when creating subclasses. | ||
6955 | * | ||
6956 | * @param {function} Class | ||
6957 | * @param {?object} Interface | ||
6958 | */ | ||
6959 | SyntheticEvent.augmentClass = function (Class, Interface) { | ||
6960 | var Super = this; | ||
6961 | |||
6962 | var E = function () {}; | ||
6963 | E.prototype = Super.prototype; | ||
6964 | var prototype = new E(); | ||
6965 | |||
6966 | _assign(prototype, Class.prototype); | ||
6967 | Class.prototype = prototype; | ||
6968 | Class.prototype.constructor = Class; | ||
6969 | |||
6970 | Class.Interface = _assign({}, Super.Interface, Interface); | ||
6971 | Class.augmentClass = Super.augmentClass; | ||
6972 | |||
6973 | PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); | ||
6974 | }; | ||
6975 | |||
6976 | PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler); | ||
6977 | |||
6978 | module.exports = SyntheticEvent; | ||
6979 | |||
6980 | /** | ||
6981 | * Helper to nullify syntheticEvent instance properties when destructing | ||
6982 | * | ||
6983 | * @param {object} SyntheticEvent | ||
6984 | * @param {String} propName | ||
6985 | * @return {object} defineProperty object | ||
6986 | */ | ||
6987 | function getPooledWarningPropertyDefinition(propName, getVal) { | ||
6988 | var isFunction = typeof getVal === 'function'; | ||
6989 | return { | ||
6990 | configurable: true, | ||
6991 | set: set, | ||
6992 | get: get | ||
6993 | }; | ||
6994 | |||
6995 | function set(val) { | ||
6996 | var action = isFunction ? 'setting the method' : 'setting the property'; | ||
6997 | warn(action, 'This is effectively a no-op'); | ||
6998 | return val; | ||
6999 | } | ||
7000 | |||
7001 | function get() { | ||
7002 | var action = isFunction ? 'accessing the method' : 'accessing the property'; | ||
7003 | var result = isFunction ? 'This is a no-op function' : 'This is set to null'; | ||
7004 | warn(action, result); | ||
7005 | return getVal; | ||
7006 | } | ||
7007 | |||
7008 | function warn(action, result) { | ||
7009 | var warningCondition = false; | ||
7010 | process.env.NODE_ENV !== 'production' ? warning(warningCondition, 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0; | ||
7011 | } | ||
7012 | } | ||
7013 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
7014 | |||
7015 | /***/ }), | ||
7016 | /* 60 */ | ||
7017 | /***/ (function(module, exports, __webpack_require__) { | ||
7018 | |||
7019 | /** | ||
7020 | * Copyright 2013-present, Facebook, Inc. | ||
7021 | * All rights reserved. | ||
7022 | * | ||
7023 | * This source code is licensed under the BSD-style license found in the | ||
7024 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7025 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7026 | * | ||
7027 | */ | ||
7028 | |||
7029 | 'use strict'; | ||
7030 | |||
7031 | var SyntheticEvent = __webpack_require__(59); | ||
7032 | |||
7033 | /** | ||
7034 | * @interface Event | ||
7035 | * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 | ||
7036 | * /#events-inputevents | ||
7037 | */ | ||
7038 | var InputEventInterface = { | ||
7039 | data: null | ||
7040 | }; | ||
7041 | |||
7042 | /** | ||
7043 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
7044 | * @param {string} dispatchMarker Marker identifying the event target. | ||
7045 | * @param {object} nativeEvent Native browser event. | ||
7046 | * @extends {SyntheticUIEvent} | ||
7047 | */ | ||
7048 | function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
7049 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
7050 | } | ||
7051 | |||
7052 | SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface); | ||
7053 | |||
7054 | module.exports = SyntheticInputEvent; | ||
7055 | |||
7056 | /***/ }), | ||
7057 | /* 61 */ | ||
7058 | /***/ (function(module, exports, __webpack_require__) { | ||
7059 | |||
7060 | /** | ||
7061 | * Copyright 2013-present, Facebook, Inc. | ||
7062 | * All rights reserved. | ||
7063 | * | ||
7064 | * This source code is licensed under the BSD-style license found in the | ||
7065 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7066 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7067 | * | ||
7068 | */ | ||
7069 | |||
7070 | 'use strict'; | ||
7071 | |||
7072 | var EventPluginHub = __webpack_require__(48); | ||
7073 | var EventPropagators = __webpack_require__(47); | ||
7074 | var ExecutionEnvironment = __webpack_require__(54); | ||
7075 | var ReactDOMComponentTree = __webpack_require__(40); | ||
7076 | var ReactUpdates = __webpack_require__(62); | ||
7077 | var SyntheticEvent = __webpack_require__(59); | ||
7078 | |||
7079 | var getEventTarget = __webpack_require__(75); | ||
7080 | var isEventSupported = __webpack_require__(76); | ||
7081 | var isTextInputElement = __webpack_require__(77); | ||
7082 | |||
7083 | var eventTypes = { | ||
7084 | change: { | ||
7085 | phasedRegistrationNames: { | ||
7086 | bubbled: 'onChange', | ||
7087 | captured: 'onChangeCapture' | ||
7088 | }, | ||
7089 | dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange'] | ||
7090 | } | ||
7091 | }; | ||
7092 | |||
7093 | /** | ||
7094 | * For IE shims | ||
7095 | */ | ||
7096 | var activeElement = null; | ||
7097 | var activeElementInst = null; | ||
7098 | var activeElementValue = null; | ||
7099 | var activeElementValueProp = null; | ||
7100 | |||
7101 | /** | ||
7102 | * SECTION: handle `change` event | ||
7103 | */ | ||
7104 | function shouldUseChangeEvent(elem) { | ||
7105 | var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); | ||
7106 | return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; | ||
7107 | } | ||
7108 | |||
7109 | var doesChangeEventBubble = false; | ||
7110 | if (ExecutionEnvironment.canUseDOM) { | ||
7111 | // See `handleChange` comment below | ||
7112 | doesChangeEventBubble = isEventSupported('change') && (!document.documentMode || document.documentMode > 8); | ||
7113 | } | ||
7114 | |||
7115 | function manualDispatchChangeEvent(nativeEvent) { | ||
7116 | var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent)); | ||
7117 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
7118 | |||
7119 | // If change and propertychange bubbled, we'd just bind to it like all the | ||
7120 | // other events and have it go through ReactBrowserEventEmitter. Since it | ||
7121 | // doesn't, we manually listen for the events and so we have to enqueue and | ||
7122 | // process the abstract event manually. | ||
7123 | // | ||
7124 | // Batching is necessary here in order to ensure that all event handlers run | ||
7125 | // before the next rerender (including event handlers attached to ancestor | ||
7126 | // elements instead of directly on the input). Without this, controlled | ||
7127 | // components don't work properly in conjunction with event bubbling because | ||
7128 | // the component is rerendered and the value reverted before all the event | ||
7129 | // handlers can run. See https://github.com/facebook/react/issues/708. | ||
7130 | ReactUpdates.batchedUpdates(runEventInBatch, event); | ||
7131 | } | ||
7132 | |||
7133 | function runEventInBatch(event) { | ||
7134 | EventPluginHub.enqueueEvents(event); | ||
7135 | EventPluginHub.processEventQueue(false); | ||
7136 | } | ||
7137 | |||
7138 | function startWatchingForChangeEventIE8(target, targetInst) { | ||
7139 | activeElement = target; | ||
7140 | activeElementInst = targetInst; | ||
7141 | activeElement.attachEvent('onchange', manualDispatchChangeEvent); | ||
7142 | } | ||
7143 | |||
7144 | function stopWatchingForChangeEventIE8() { | ||
7145 | if (!activeElement) { | ||
7146 | return; | ||
7147 | } | ||
7148 | activeElement.detachEvent('onchange', manualDispatchChangeEvent); | ||
7149 | activeElement = null; | ||
7150 | activeElementInst = null; | ||
7151 | } | ||
7152 | |||
7153 | function getTargetInstForChangeEvent(topLevelType, targetInst) { | ||
7154 | if (topLevelType === 'topChange') { | ||
7155 | return targetInst; | ||
7156 | } | ||
7157 | } | ||
7158 | function handleEventsForChangeEventIE8(topLevelType, target, targetInst) { | ||
7159 | if (topLevelType === 'topFocus') { | ||
7160 | // stopWatching() should be a noop here but we call it just in case we | ||
7161 | // missed a blur event somehow. | ||
7162 | stopWatchingForChangeEventIE8(); | ||
7163 | startWatchingForChangeEventIE8(target, targetInst); | ||
7164 | } else if (topLevelType === 'topBlur') { | ||
7165 | stopWatchingForChangeEventIE8(); | ||
7166 | } | ||
7167 | } | ||
7168 | |||
7169 | /** | ||
7170 | * SECTION: handle `input` event | ||
7171 | */ | ||
7172 | var isInputEventSupported = false; | ||
7173 | if (ExecutionEnvironment.canUseDOM) { | ||
7174 | // IE9 claims to support the input event but fails to trigger it when | ||
7175 | // deleting text, so we ignore its input events. | ||
7176 | // IE10+ fire input events to often, such when a placeholder | ||
7177 | // changes or when an input with a placeholder is focused. | ||
7178 | isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 11); | ||
7179 | } | ||
7180 | |||
7181 | /** | ||
7182 | * (For IE <=11) Replacement getter/setter for the `value` property that gets | ||
7183 | * set on the active element. | ||
7184 | */ | ||
7185 | var newValueProp = { | ||
7186 | get: function () { | ||
7187 | return activeElementValueProp.get.call(this); | ||
7188 | }, | ||
7189 | set: function (val) { | ||
7190 | // Cast to a string so we can do equality checks. | ||
7191 | activeElementValue = '' + val; | ||
7192 | activeElementValueProp.set.call(this, val); | ||
7193 | } | ||
7194 | }; | ||
7195 | |||
7196 | /** | ||
7197 | * (For IE <=11) Starts tracking propertychange events on the passed-in element | ||
7198 | * and override the value property so that we can distinguish user events from | ||
7199 | * value changes in JS. | ||
7200 | */ | ||
7201 | function startWatchingForValueChange(target, targetInst) { | ||
7202 | activeElement = target; | ||
7203 | activeElementInst = targetInst; | ||
7204 | activeElementValue = target.value; | ||
7205 | activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value'); | ||
7206 | |||
7207 | // Not guarded in a canDefineProperty check: IE8 supports defineProperty only | ||
7208 | // on DOM elements | ||
7209 | Object.defineProperty(activeElement, 'value', newValueProp); | ||
7210 | if (activeElement.attachEvent) { | ||
7211 | activeElement.attachEvent('onpropertychange', handlePropertyChange); | ||
7212 | } else { | ||
7213 | activeElement.addEventListener('propertychange', handlePropertyChange, false); | ||
7214 | } | ||
7215 | } | ||
7216 | |||
7217 | /** | ||
7218 | * (For IE <=11) Removes the event listeners from the currently-tracked element, | ||
7219 | * if any exists. | ||
7220 | */ | ||
7221 | function stopWatchingForValueChange() { | ||
7222 | if (!activeElement) { | ||
7223 | return; | ||
7224 | } | ||
7225 | |||
7226 | // delete restores the original property definition | ||
7227 | delete activeElement.value; | ||
7228 | |||
7229 | if (activeElement.detachEvent) { | ||
7230 | activeElement.detachEvent('onpropertychange', handlePropertyChange); | ||
7231 | } else { | ||
7232 | activeElement.removeEventListener('propertychange', handlePropertyChange, false); | ||
7233 | } | ||
7234 | |||
7235 | activeElement = null; | ||
7236 | activeElementInst = null; | ||
7237 | activeElementValue = null; | ||
7238 | activeElementValueProp = null; | ||
7239 | } | ||
7240 | |||
7241 | /** | ||
7242 | * (For IE <=11) Handles a propertychange event, sending a `change` event if | ||
7243 | * the value of the active element has changed. | ||
7244 | */ | ||
7245 | function handlePropertyChange(nativeEvent) { | ||
7246 | if (nativeEvent.propertyName !== 'value') { | ||
7247 | return; | ||
7248 | } | ||
7249 | var value = nativeEvent.srcElement.value; | ||
7250 | if (value === activeElementValue) { | ||
7251 | return; | ||
7252 | } | ||
7253 | activeElementValue = value; | ||
7254 | |||
7255 | manualDispatchChangeEvent(nativeEvent); | ||
7256 | } | ||
7257 | |||
7258 | /** | ||
7259 | * If a `change` event should be fired, returns the target's ID. | ||
7260 | */ | ||
7261 | function getTargetInstForInputEvent(topLevelType, targetInst) { | ||
7262 | if (topLevelType === 'topInput') { | ||
7263 | // In modern browsers (i.e., not IE8 or IE9), the input event is exactly | ||
7264 | // what we want so fall through here and trigger an abstract event | ||
7265 | return targetInst; | ||
7266 | } | ||
7267 | } | ||
7268 | |||
7269 | function handleEventsForInputEventIE(topLevelType, target, targetInst) { | ||
7270 | if (topLevelType === 'topFocus') { | ||
7271 | // In IE8, we can capture almost all .value changes by adding a | ||
7272 | // propertychange handler and looking for events with propertyName | ||
7273 | // equal to 'value' | ||
7274 | // In IE9-11, propertychange fires for most input events but is buggy and | ||
7275 | // doesn't fire when text is deleted, but conveniently, selectionchange | ||
7276 | // appears to fire in all of the remaining cases so we catch those and | ||
7277 | // forward the event if the value has changed | ||
7278 | // In either case, we don't want to call the event handler if the value | ||
7279 | // is changed from JS so we redefine a setter for `.value` that updates | ||
7280 | // our activeElementValue variable, allowing us to ignore those changes | ||
7281 | // | ||
7282 | // stopWatching() should be a noop here but we call it just in case we | ||
7283 | // missed a blur event somehow. | ||
7284 | stopWatchingForValueChange(); | ||
7285 | startWatchingForValueChange(target, targetInst); | ||
7286 | } else if (topLevelType === 'topBlur') { | ||
7287 | stopWatchingForValueChange(); | ||
7288 | } | ||
7289 | } | ||
7290 | |||
7291 | // For IE8 and IE9. | ||
7292 | function getTargetInstForInputEventIE(topLevelType, targetInst) { | ||
7293 | if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') { | ||
7294 | // On the selectionchange event, the target is just document which isn't | ||
7295 | // helpful for us so just check activeElement instead. | ||
7296 | // | ||
7297 | // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire | ||
7298 | // propertychange on the first input event after setting `value` from a | ||
7299 | // script and fires only keydown, keypress, keyup. Catching keyup usually | ||
7300 | // gets it and catching keydown lets us fire an event for the first | ||
7301 | // keystroke if user does a key repeat (it'll be a little delayed: right | ||
7302 | // before the second keystroke). Other input methods (e.g., paste) seem to | ||
7303 | // fire selectionchange normally. | ||
7304 | if (activeElement && activeElement.value !== activeElementValue) { | ||
7305 | activeElementValue = activeElement.value; | ||
7306 | return activeElementInst; | ||
7307 | } | ||
7308 | } | ||
7309 | } | ||
7310 | |||
7311 | /** | ||
7312 | * SECTION: handle `click` event | ||
7313 | */ | ||
7314 | function shouldUseClickEvent(elem) { | ||
7315 | // Use the `click` event to detect changes to checkbox and radio inputs. | ||
7316 | // This approach works across all browsers, whereas `change` does not fire | ||
7317 | // until `blur` in IE8. | ||
7318 | return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); | ||
7319 | } | ||
7320 | |||
7321 | function getTargetInstForClickEvent(topLevelType, targetInst) { | ||
7322 | if (topLevelType === 'topClick') { | ||
7323 | return targetInst; | ||
7324 | } | ||
7325 | } | ||
7326 | |||
7327 | function handleControlledInputBlur(inst, node) { | ||
7328 | // TODO: In IE, inst is occasionally null. Why? | ||
7329 | if (inst == null) { | ||
7330 | return; | ||
7331 | } | ||
7332 | |||
7333 | // Fiber and ReactDOM keep wrapper state in separate places | ||
7334 | var state = inst._wrapperState || node._wrapperState; | ||
7335 | |||
7336 | if (!state || !state.controlled || node.type !== 'number') { | ||
7337 | return; | ||
7338 | } | ||
7339 | |||
7340 | // If controlled, assign the value attribute to the current value on blur | ||
7341 | var value = '' + node.value; | ||
7342 | if (node.getAttribute('value') !== value) { | ||
7343 | node.setAttribute('value', value); | ||
7344 | } | ||
7345 | } | ||
7346 | |||
7347 | /** | ||
7348 | * This plugin creates an `onChange` event that normalizes change events | ||
7349 | * across form elements. This event fires at a time when it's possible to | ||
7350 | * change the element's value without seeing a flicker. | ||
7351 | * | ||
7352 | * Supported elements are: | ||
7353 | * - input (see `isTextInputElement`) | ||
7354 | * - textarea | ||
7355 | * - select | ||
7356 | */ | ||
7357 | var ChangeEventPlugin = { | ||
7358 | |||
7359 | eventTypes: eventTypes, | ||
7360 | |||
7361 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
7362 | var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window; | ||
7363 | |||
7364 | var getTargetInstFunc, handleEventFunc; | ||
7365 | if (shouldUseChangeEvent(targetNode)) { | ||
7366 | if (doesChangeEventBubble) { | ||
7367 | getTargetInstFunc = getTargetInstForChangeEvent; | ||
7368 | } else { | ||
7369 | handleEventFunc = handleEventsForChangeEventIE8; | ||
7370 | } | ||
7371 | } else if (isTextInputElement(targetNode)) { | ||
7372 | if (isInputEventSupported) { | ||
7373 | getTargetInstFunc = getTargetInstForInputEvent; | ||
7374 | } else { | ||
7375 | getTargetInstFunc = getTargetInstForInputEventIE; | ||
7376 | handleEventFunc = handleEventsForInputEventIE; | ||
7377 | } | ||
7378 | } else if (shouldUseClickEvent(targetNode)) { | ||
7379 | getTargetInstFunc = getTargetInstForClickEvent; | ||
7380 | } | ||
7381 | |||
7382 | if (getTargetInstFunc) { | ||
7383 | var inst = getTargetInstFunc(topLevelType, targetInst); | ||
7384 | if (inst) { | ||
7385 | var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget); | ||
7386 | event.type = 'change'; | ||
7387 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
7388 | return event; | ||
7389 | } | ||
7390 | } | ||
7391 | |||
7392 | if (handleEventFunc) { | ||
7393 | handleEventFunc(topLevelType, targetNode, targetInst); | ||
7394 | } | ||
7395 | |||
7396 | // When blurring, set the value attribute for number inputs | ||
7397 | if (topLevelType === 'topBlur') { | ||
7398 | handleControlledInputBlur(targetInst, targetNode); | ||
7399 | } | ||
7400 | } | ||
7401 | |||
7402 | }; | ||
7403 | |||
7404 | module.exports = ChangeEventPlugin; | ||
7405 | |||
7406 | /***/ }), | ||
7407 | /* 62 */ | ||
7408 | /***/ (function(module, exports, __webpack_require__) { | ||
7409 | |||
7410 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
7411 | * Copyright 2013-present, Facebook, Inc. | ||
7412 | * All rights reserved. | ||
7413 | * | ||
7414 | * This source code is licensed under the BSD-style license found in the | ||
7415 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7416 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7417 | * | ||
7418 | */ | ||
7419 | |||
7420 | 'use strict'; | ||
7421 | |||
7422 | var _prodInvariant = __webpack_require__(41), | ||
7423 | _assign = __webpack_require__(6); | ||
7424 | |||
7425 | var CallbackQueue = __webpack_require__(63); | ||
7426 | var PooledClass = __webpack_require__(56); | ||
7427 | var ReactFeatureFlags = __webpack_require__(64); | ||
7428 | var ReactReconciler = __webpack_require__(65); | ||
7429 | var Transaction = __webpack_require__(74); | ||
7430 | |||
7431 | var invariant = __webpack_require__(10); | ||
7432 | |||
7433 | var dirtyComponents = []; | ||
7434 | var updateBatchNumber = 0; | ||
7435 | var asapCallbackQueue = CallbackQueue.getPooled(); | ||
7436 | var asapEnqueued = false; | ||
7437 | |||
7438 | var batchingStrategy = null; | ||
7439 | |||
7440 | function ensureInjected() { | ||
7441 | !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0; | ||
7442 | } | ||
7443 | |||
7444 | var NESTED_UPDATES = { | ||
7445 | initialize: function () { | ||
7446 | this.dirtyComponentsLength = dirtyComponents.length; | ||
7447 | }, | ||
7448 | close: function () { | ||
7449 | if (this.dirtyComponentsLength !== dirtyComponents.length) { | ||
7450 | // Additional updates were enqueued by componentDidUpdate handlers or | ||
7451 | // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run | ||
7452 | // these new updates so that if A's componentDidUpdate calls setState on | ||
7453 | // B, B will update before the callback A's updater provided when calling | ||
7454 | // setState. | ||
7455 | dirtyComponents.splice(0, this.dirtyComponentsLength); | ||
7456 | flushBatchedUpdates(); | ||
7457 | } else { | ||
7458 | dirtyComponents.length = 0; | ||
7459 | } | ||
7460 | } | ||
7461 | }; | ||
7462 | |||
7463 | var UPDATE_QUEUEING = { | ||
7464 | initialize: function () { | ||
7465 | this.callbackQueue.reset(); | ||
7466 | }, | ||
7467 | close: function () { | ||
7468 | this.callbackQueue.notifyAll(); | ||
7469 | } | ||
7470 | }; | ||
7471 | |||
7472 | var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; | ||
7473 | |||
7474 | function ReactUpdatesFlushTransaction() { | ||
7475 | this.reinitializeTransaction(); | ||
7476 | this.dirtyComponentsLength = null; | ||
7477 | this.callbackQueue = CallbackQueue.getPooled(); | ||
7478 | this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( | ||
7479 | /* useCreateElement */true); | ||
7480 | } | ||
7481 | |||
7482 | _assign(ReactUpdatesFlushTransaction.prototype, Transaction, { | ||
7483 | getTransactionWrappers: function () { | ||
7484 | return TRANSACTION_WRAPPERS; | ||
7485 | }, | ||
7486 | |||
7487 | destructor: function () { | ||
7488 | this.dirtyComponentsLength = null; | ||
7489 | CallbackQueue.release(this.callbackQueue); | ||
7490 | this.callbackQueue = null; | ||
7491 | ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); | ||
7492 | this.reconcileTransaction = null; | ||
7493 | }, | ||
7494 | |||
7495 | perform: function (method, scope, a) { | ||
7496 | // Essentially calls `this.reconcileTransaction.perform(method, scope, a)` | ||
7497 | // with this transaction's wrappers around it. | ||
7498 | return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); | ||
7499 | } | ||
7500 | }); | ||
7501 | |||
7502 | PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); | ||
7503 | |||
7504 | function batchedUpdates(callback, a, b, c, d, e) { | ||
7505 | ensureInjected(); | ||
7506 | return batchingStrategy.batchedUpdates(callback, a, b, c, d, e); | ||
7507 | } | ||
7508 | |||
7509 | /** | ||
7510 | * Array comparator for ReactComponents by mount ordering. | ||
7511 | * | ||
7512 | * @param {ReactComponent} c1 first component you're comparing | ||
7513 | * @param {ReactComponent} c2 second component you're comparing | ||
7514 | * @return {number} Return value usable by Array.prototype.sort(). | ||
7515 | */ | ||
7516 | function mountOrderComparator(c1, c2) { | ||
7517 | return c1._mountOrder - c2._mountOrder; | ||
7518 | } | ||
7519 | |||
7520 | function runBatchedUpdates(transaction) { | ||
7521 | var len = transaction.dirtyComponentsLength; | ||
7522 | !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0; | ||
7523 | |||
7524 | // Since reconciling a component higher in the owner hierarchy usually (not | ||
7525 | // always -- see shouldComponentUpdate()) will reconcile children, reconcile | ||
7526 | // them before their children by sorting the array. | ||
7527 | dirtyComponents.sort(mountOrderComparator); | ||
7528 | |||
7529 | // Any updates enqueued while reconciling must be performed after this entire | ||
7530 | // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and | ||
7531 | // C, B could update twice in a single batch if C's render enqueues an update | ||
7532 | // to B (since B would have already updated, we should skip it, and the only | ||
7533 | // way we can know to do so is by checking the batch counter). | ||
7534 | updateBatchNumber++; | ||
7535 | |||
7536 | for (var i = 0; i < len; i++) { | ||
7537 | // If a component is unmounted before pending changes apply, it will still | ||
7538 | // be here, but we assume that it has cleared its _pendingCallbacks and | ||
7539 | // that performUpdateIfNecessary is a noop. | ||
7540 | var component = dirtyComponents[i]; | ||
7541 | |||
7542 | // If performUpdateIfNecessary happens to enqueue any new updates, we | ||
7543 | // shouldn't execute the callbacks until the next render happens, so | ||
7544 | // stash the callbacks first | ||
7545 | var callbacks = component._pendingCallbacks; | ||
7546 | component._pendingCallbacks = null; | ||
7547 | |||
7548 | var markerName; | ||
7549 | if (ReactFeatureFlags.logTopLevelRenders) { | ||
7550 | var namedComponent = component; | ||
7551 | // Duck type TopLevelWrapper. This is probably always true. | ||
7552 | if (component._currentElement.type.isReactTopLevelWrapper) { | ||
7553 | namedComponent = component._renderedComponent; | ||
7554 | } | ||
7555 | markerName = 'React update: ' + namedComponent.getName(); | ||
7556 | console.time(markerName); | ||
7557 | } | ||
7558 | |||
7559 | ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber); | ||
7560 | |||
7561 | if (markerName) { | ||
7562 | console.timeEnd(markerName); | ||
7563 | } | ||
7564 | |||
7565 | if (callbacks) { | ||
7566 | for (var j = 0; j < callbacks.length; j++) { | ||
7567 | transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance()); | ||
7568 | } | ||
7569 | } | ||
7570 | } | ||
7571 | } | ||
7572 | |||
7573 | var flushBatchedUpdates = function () { | ||
7574 | // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents | ||
7575 | // array and perform any updates enqueued by mount-ready handlers (i.e., | ||
7576 | // componentDidUpdate) but we need to check here too in order to catch | ||
7577 | // updates enqueued by setState callbacks and asap calls. | ||
7578 | while (dirtyComponents.length || asapEnqueued) { | ||
7579 | if (dirtyComponents.length) { | ||
7580 | var transaction = ReactUpdatesFlushTransaction.getPooled(); | ||
7581 | transaction.perform(runBatchedUpdates, null, transaction); | ||
7582 | ReactUpdatesFlushTransaction.release(transaction); | ||
7583 | } | ||
7584 | |||
7585 | if (asapEnqueued) { | ||
7586 | asapEnqueued = false; | ||
7587 | var queue = asapCallbackQueue; | ||
7588 | asapCallbackQueue = CallbackQueue.getPooled(); | ||
7589 | queue.notifyAll(); | ||
7590 | CallbackQueue.release(queue); | ||
7591 | } | ||
7592 | } | ||
7593 | }; | ||
7594 | |||
7595 | /** | ||
7596 | * Mark a component as needing a rerender, adding an optional callback to a | ||
7597 | * list of functions which will be executed once the rerender occurs. | ||
7598 | */ | ||
7599 | function enqueueUpdate(component) { | ||
7600 | ensureInjected(); | ||
7601 | |||
7602 | // Various parts of our code (such as ReactCompositeComponent's | ||
7603 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
7604 | // verify that that's the case. (This is called by each top-level update | ||
7605 | // function, like setState, forceUpdate, etc.; creation and | ||
7606 | // destruction of top-level components is guarded in ReactMount.) | ||
7607 | |||
7608 | if (!batchingStrategy.isBatchingUpdates) { | ||
7609 | batchingStrategy.batchedUpdates(enqueueUpdate, component); | ||
7610 | return; | ||
7611 | } | ||
7612 | |||
7613 | dirtyComponents.push(component); | ||
7614 | if (component._updateBatchNumber == null) { | ||
7615 | component._updateBatchNumber = updateBatchNumber + 1; | ||
7616 | } | ||
7617 | } | ||
7618 | |||
7619 | /** | ||
7620 | * Enqueue a callback to be run at the end of the current batching cycle. Throws | ||
7621 | * if no updates are currently being performed. | ||
7622 | */ | ||
7623 | function asap(callback, context) { | ||
7624 | !batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context whereupdates are not being batched.') : _prodInvariant('125') : void 0; | ||
7625 | asapCallbackQueue.enqueue(callback, context); | ||
7626 | asapEnqueued = true; | ||
7627 | } | ||
7628 | |||
7629 | var ReactUpdatesInjection = { | ||
7630 | injectReconcileTransaction: function (ReconcileTransaction) { | ||
7631 | !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0; | ||
7632 | ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; | ||
7633 | }, | ||
7634 | |||
7635 | injectBatchingStrategy: function (_batchingStrategy) { | ||
7636 | !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0; | ||
7637 | !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0; | ||
7638 | !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0; | ||
7639 | batchingStrategy = _batchingStrategy; | ||
7640 | } | ||
7641 | }; | ||
7642 | |||
7643 | var ReactUpdates = { | ||
7644 | /** | ||
7645 | * React references `ReactReconcileTransaction` using this property in order | ||
7646 | * to allow dependency injection. | ||
7647 | * | ||
7648 | * @internal | ||
7649 | */ | ||
7650 | ReactReconcileTransaction: null, | ||
7651 | |||
7652 | batchedUpdates: batchedUpdates, | ||
7653 | enqueueUpdate: enqueueUpdate, | ||
7654 | flushBatchedUpdates: flushBatchedUpdates, | ||
7655 | injection: ReactUpdatesInjection, | ||
7656 | asap: asap | ||
7657 | }; | ||
7658 | |||
7659 | module.exports = ReactUpdates; | ||
7660 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
7661 | |||
7662 | /***/ }), | ||
7663 | /* 63 */ | ||
7664 | /***/ (function(module, exports, __webpack_require__) { | ||
7665 | |||
7666 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
7667 | * Copyright 2013-present, Facebook, Inc. | ||
7668 | * All rights reserved. | ||
7669 | * | ||
7670 | * This source code is licensed under the BSD-style license found in the | ||
7671 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7672 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7673 | * | ||
7674 | * | ||
7675 | */ | ||
7676 | |||
7677 | 'use strict'; | ||
7678 | |||
7679 | var _prodInvariant = __webpack_require__(41); | ||
7680 | |||
7681 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
7682 | |||
7683 | var PooledClass = __webpack_require__(56); | ||
7684 | |||
7685 | var invariant = __webpack_require__(10); | ||
7686 | |||
7687 | /** | ||
7688 | * A specialized pseudo-event module to help keep track of components waiting to | ||
7689 | * be notified when their DOM representations are available for use. | ||
7690 | * | ||
7691 | * This implements `PooledClass`, so you should never need to instantiate this. | ||
7692 | * Instead, use `CallbackQueue.getPooled()`. | ||
7693 | * | ||
7694 | * @class ReactMountReady | ||
7695 | * @implements PooledClass | ||
7696 | * @internal | ||
7697 | */ | ||
7698 | |||
7699 | var CallbackQueue = function () { | ||
7700 | function CallbackQueue(arg) { | ||
7701 | _classCallCheck(this, CallbackQueue); | ||
7702 | |||
7703 | this._callbacks = null; | ||
7704 | this._contexts = null; | ||
7705 | this._arg = arg; | ||
7706 | } | ||
7707 | |||
7708 | /** | ||
7709 | * Enqueues a callback to be invoked when `notifyAll` is invoked. | ||
7710 | * | ||
7711 | * @param {function} callback Invoked when `notifyAll` is invoked. | ||
7712 | * @param {?object} context Context to call `callback` with. | ||
7713 | * @internal | ||
7714 | */ | ||
7715 | |||
7716 | |||
7717 | CallbackQueue.prototype.enqueue = function enqueue(callback, context) { | ||
7718 | this._callbacks = this._callbacks || []; | ||
7719 | this._callbacks.push(callback); | ||
7720 | this._contexts = this._contexts || []; | ||
7721 | this._contexts.push(context); | ||
7722 | }; | ||
7723 | |||
7724 | /** | ||
7725 | * Invokes all enqueued callbacks and clears the queue. This is invoked after | ||
7726 | * the DOM representation of a component has been created or updated. | ||
7727 | * | ||
7728 | * @internal | ||
7729 | */ | ||
7730 | |||
7731 | |||
7732 | CallbackQueue.prototype.notifyAll = function notifyAll() { | ||
7733 | var callbacks = this._callbacks; | ||
7734 | var contexts = this._contexts; | ||
7735 | var arg = this._arg; | ||
7736 | if (callbacks && contexts) { | ||
7737 | !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0; | ||
7738 | this._callbacks = null; | ||
7739 | this._contexts = null; | ||
7740 | for (var i = 0; i < callbacks.length; i++) { | ||
7741 | callbacks[i].call(contexts[i], arg); | ||
7742 | } | ||
7743 | callbacks.length = 0; | ||
7744 | contexts.length = 0; | ||
7745 | } | ||
7746 | }; | ||
7747 | |||
7748 | CallbackQueue.prototype.checkpoint = function checkpoint() { | ||
7749 | return this._callbacks ? this._callbacks.length : 0; | ||
7750 | }; | ||
7751 | |||
7752 | CallbackQueue.prototype.rollback = function rollback(len) { | ||
7753 | if (this._callbacks && this._contexts) { | ||
7754 | this._callbacks.length = len; | ||
7755 | this._contexts.length = len; | ||
7756 | } | ||
7757 | }; | ||
7758 | |||
7759 | /** | ||
7760 | * Resets the internal queue. | ||
7761 | * | ||
7762 | * @internal | ||
7763 | */ | ||
7764 | |||
7765 | |||
7766 | CallbackQueue.prototype.reset = function reset() { | ||
7767 | this._callbacks = null; | ||
7768 | this._contexts = null; | ||
7769 | }; | ||
7770 | |||
7771 | /** | ||
7772 | * `PooledClass` looks for this. | ||
7773 | */ | ||
7774 | |||
7775 | |||
7776 | CallbackQueue.prototype.destructor = function destructor() { | ||
7777 | this.reset(); | ||
7778 | }; | ||
7779 | |||
7780 | return CallbackQueue; | ||
7781 | }(); | ||
7782 | |||
7783 | module.exports = PooledClass.addPoolingTo(CallbackQueue); | ||
7784 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
7785 | |||
7786 | /***/ }), | ||
7787 | /* 64 */ | ||
7788 | /***/ (function(module, exports) { | ||
7789 | |||
7790 | /** | ||
7791 | * Copyright 2013-present, Facebook, Inc. | ||
7792 | * All rights reserved. | ||
7793 | * | ||
7794 | * This source code is licensed under the BSD-style license found in the | ||
7795 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7796 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7797 | * | ||
7798 | * | ||
7799 | */ | ||
7800 | |||
7801 | 'use strict'; | ||
7802 | |||
7803 | var ReactFeatureFlags = { | ||
7804 | // When true, call console.time() before and .timeEnd() after each top-level | ||
7805 | // render (both initial renders and updates). Useful when looking at prod-mode | ||
7806 | // timeline profiles in Chrome, for example. | ||
7807 | logTopLevelRenders: false | ||
7808 | }; | ||
7809 | |||
7810 | module.exports = ReactFeatureFlags; | ||
7811 | |||
7812 | /***/ }), | ||
7813 | /* 65 */ | ||
7814 | /***/ (function(module, exports, __webpack_require__) { | ||
7815 | |||
7816 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
7817 | * Copyright 2013-present, Facebook, Inc. | ||
7818 | * All rights reserved. | ||
7819 | * | ||
7820 | * This source code is licensed under the BSD-style license found in the | ||
7821 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7822 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7823 | * | ||
7824 | */ | ||
7825 | |||
7826 | 'use strict'; | ||
7827 | |||
7828 | var ReactRef = __webpack_require__(66); | ||
7829 | var ReactInstrumentation = __webpack_require__(68); | ||
7830 | |||
7831 | var warning = __webpack_require__(13); | ||
7832 | |||
7833 | /** | ||
7834 | * Helper to call ReactRef.attachRefs with this composite component, split out | ||
7835 | * to avoid allocations in the transaction mount-ready queue. | ||
7836 | */ | ||
7837 | function attachRefs() { | ||
7838 | ReactRef.attachRefs(this, this._currentElement); | ||
7839 | } | ||
7840 | |||
7841 | var ReactReconciler = { | ||
7842 | |||
7843 | /** | ||
7844 | * Initializes the component, renders markup, and registers event listeners. | ||
7845 | * | ||
7846 | * @param {ReactComponent} internalInstance | ||
7847 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
7848 | * @param {?object} the containing host component instance | ||
7849 | * @param {?object} info about the host container | ||
7850 | * @return {?string} Rendered markup to be inserted into the DOM. | ||
7851 | * @final | ||
7852 | * @internal | ||
7853 | */ | ||
7854 | mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots | ||
7855 | ) { | ||
7856 | if (process.env.NODE_ENV !== 'production') { | ||
7857 | if (internalInstance._debugID !== 0) { | ||
7858 | ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID); | ||
7859 | } | ||
7860 | } | ||
7861 | var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID); | ||
7862 | if (internalInstance._currentElement && internalInstance._currentElement.ref != null) { | ||
7863 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance); | ||
7864 | } | ||
7865 | if (process.env.NODE_ENV !== 'production') { | ||
7866 | if (internalInstance._debugID !== 0) { | ||
7867 | ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID); | ||
7868 | } | ||
7869 | } | ||
7870 | return markup; | ||
7871 | }, | ||
7872 | |||
7873 | /** | ||
7874 | * Returns a value that can be passed to | ||
7875 | * ReactComponentEnvironment.replaceNodeWithMarkup. | ||
7876 | */ | ||
7877 | getHostNode: function (internalInstance) { | ||
7878 | return internalInstance.getHostNode(); | ||
7879 | }, | ||
7880 | |||
7881 | /** | ||
7882 | * Releases any resources allocated by `mountComponent`. | ||
7883 | * | ||
7884 | * @final | ||
7885 | * @internal | ||
7886 | */ | ||
7887 | unmountComponent: function (internalInstance, safely) { | ||
7888 | if (process.env.NODE_ENV !== 'production') { | ||
7889 | if (internalInstance._debugID !== 0) { | ||
7890 | ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID); | ||
7891 | } | ||
7892 | } | ||
7893 | ReactRef.detachRefs(internalInstance, internalInstance._currentElement); | ||
7894 | internalInstance.unmountComponent(safely); | ||
7895 | if (process.env.NODE_ENV !== 'production') { | ||
7896 | if (internalInstance._debugID !== 0) { | ||
7897 | ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID); | ||
7898 | } | ||
7899 | } | ||
7900 | }, | ||
7901 | |||
7902 | /** | ||
7903 | * Update a component using a new element. | ||
7904 | * | ||
7905 | * @param {ReactComponent} internalInstance | ||
7906 | * @param {ReactElement} nextElement | ||
7907 | * @param {ReactReconcileTransaction} transaction | ||
7908 | * @param {object} context | ||
7909 | * @internal | ||
7910 | */ | ||
7911 | receiveComponent: function (internalInstance, nextElement, transaction, context) { | ||
7912 | var prevElement = internalInstance._currentElement; | ||
7913 | |||
7914 | if (nextElement === prevElement && context === internalInstance._context) { | ||
7915 | // Since elements are immutable after the owner is rendered, | ||
7916 | // we can do a cheap identity compare here to determine if this is a | ||
7917 | // superfluous reconcile. It's possible for state to be mutable but such | ||
7918 | // change should trigger an update of the owner which would recreate | ||
7919 | // the element. We explicitly check for the existence of an owner since | ||
7920 | // it's possible for an element created outside a composite to be | ||
7921 | // deeply mutated and reused. | ||
7922 | |||
7923 | // TODO: Bailing out early is just a perf optimization right? | ||
7924 | // TODO: Removing the return statement should affect correctness? | ||
7925 | return; | ||
7926 | } | ||
7927 | |||
7928 | if (process.env.NODE_ENV !== 'production') { | ||
7929 | if (internalInstance._debugID !== 0) { | ||
7930 | ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement); | ||
7931 | } | ||
7932 | } | ||
7933 | |||
7934 | var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement); | ||
7935 | |||
7936 | if (refsChanged) { | ||
7937 | ReactRef.detachRefs(internalInstance, prevElement); | ||
7938 | } | ||
7939 | |||
7940 | internalInstance.receiveComponent(nextElement, transaction, context); | ||
7941 | |||
7942 | if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) { | ||
7943 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance); | ||
7944 | } | ||
7945 | |||
7946 | if (process.env.NODE_ENV !== 'production') { | ||
7947 | if (internalInstance._debugID !== 0) { | ||
7948 | ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); | ||
7949 | } | ||
7950 | } | ||
7951 | }, | ||
7952 | |||
7953 | /** | ||
7954 | * Flush any dirty changes in a component. | ||
7955 | * | ||
7956 | * @param {ReactComponent} internalInstance | ||
7957 | * @param {ReactReconcileTransaction} transaction | ||
7958 | * @internal | ||
7959 | */ | ||
7960 | performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) { | ||
7961 | if (internalInstance._updateBatchNumber !== updateBatchNumber) { | ||
7962 | // The component's enqueued batch number should always be the current | ||
7963 | // batch or the following one. | ||
7964 | process.env.NODE_ENV !== 'production' ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0; | ||
7965 | return; | ||
7966 | } | ||
7967 | if (process.env.NODE_ENV !== 'production') { | ||
7968 | if (internalInstance._debugID !== 0) { | ||
7969 | ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement); | ||
7970 | } | ||
7971 | } | ||
7972 | internalInstance.performUpdateIfNecessary(transaction); | ||
7973 | if (process.env.NODE_ENV !== 'production') { | ||
7974 | if (internalInstance._debugID !== 0) { | ||
7975 | ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); | ||
7976 | } | ||
7977 | } | ||
7978 | } | ||
7979 | |||
7980 | }; | ||
7981 | |||
7982 | module.exports = ReactReconciler; | ||
7983 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
7984 | |||
7985 | /***/ }), | ||
7986 | /* 66 */ | ||
7987 | /***/ (function(module, exports, __webpack_require__) { | ||
7988 | |||
7989 | /** | ||
7990 | * Copyright 2013-present, Facebook, Inc. | ||
7991 | * All rights reserved. | ||
7992 | * | ||
7993 | * This source code is licensed under the BSD-style license found in the | ||
7994 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7995 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7996 | * | ||
7997 | * | ||
7998 | */ | ||
7999 | |||
8000 | 'use strict'; | ||
8001 | |||
8002 | var ReactOwner = __webpack_require__(67); | ||
8003 | |||
8004 | var ReactRef = {}; | ||
8005 | |||
8006 | function attachRef(ref, component, owner) { | ||
8007 | if (typeof ref === 'function') { | ||
8008 | ref(component.getPublicInstance()); | ||
8009 | } else { | ||
8010 | // Legacy ref | ||
8011 | ReactOwner.addComponentAsRefTo(component, ref, owner); | ||
8012 | } | ||
8013 | } | ||
8014 | |||
8015 | function detachRef(ref, component, owner) { | ||
8016 | if (typeof ref === 'function') { | ||
8017 | ref(null); | ||
8018 | } else { | ||
8019 | // Legacy ref | ||
8020 | ReactOwner.removeComponentAsRefFrom(component, ref, owner); | ||
8021 | } | ||
8022 | } | ||
8023 | |||
8024 | ReactRef.attachRefs = function (instance, element) { | ||
8025 | if (element === null || typeof element !== 'object') { | ||
8026 | return; | ||
8027 | } | ||
8028 | var ref = element.ref; | ||
8029 | if (ref != null) { | ||
8030 | attachRef(ref, instance, element._owner); | ||
8031 | } | ||
8032 | }; | ||
8033 | |||
8034 | ReactRef.shouldUpdateRefs = function (prevElement, nextElement) { | ||
8035 | // If either the owner or a `ref` has changed, make sure the newest owner | ||
8036 | // has stored a reference to `this`, and the previous owner (if different) | ||
8037 | // has forgotten the reference to `this`. We use the element instead | ||
8038 | // of the public this.props because the post processing cannot determine | ||
8039 | // a ref. The ref conceptually lives on the element. | ||
8040 | |||
8041 | // TODO: Should this even be possible? The owner cannot change because | ||
8042 | // it's forbidden by shouldUpdateReactComponent. The ref can change | ||
8043 | // if you swap the keys of but not the refs. Reconsider where this check | ||
8044 | // is made. It probably belongs where the key checking and | ||
8045 | // instantiateReactComponent is done. | ||
8046 | |||
8047 | var prevRef = null; | ||
8048 | var prevOwner = null; | ||
8049 | if (prevElement !== null && typeof prevElement === 'object') { | ||
8050 | prevRef = prevElement.ref; | ||
8051 | prevOwner = prevElement._owner; | ||
8052 | } | ||
8053 | |||
8054 | var nextRef = null; | ||
8055 | var nextOwner = null; | ||
8056 | if (nextElement !== null && typeof nextElement === 'object') { | ||
8057 | nextRef = nextElement.ref; | ||
8058 | nextOwner = nextElement._owner; | ||
8059 | } | ||
8060 | |||
8061 | return prevRef !== nextRef || | ||
8062 | // If owner changes but we have an unchanged function ref, don't update refs | ||
8063 | typeof nextRef === 'string' && nextOwner !== prevOwner; | ||
8064 | }; | ||
8065 | |||
8066 | ReactRef.detachRefs = function (instance, element) { | ||
8067 | if (element === null || typeof element !== 'object') { | ||
8068 | return; | ||
8069 | } | ||
8070 | var ref = element.ref; | ||
8071 | if (ref != null) { | ||
8072 | detachRef(ref, instance, element._owner); | ||
8073 | } | ||
8074 | }; | ||
8075 | |||
8076 | module.exports = ReactRef; | ||
8077 | |||
8078 | /***/ }), | ||
8079 | /* 67 */ | ||
8080 | /***/ (function(module, exports, __webpack_require__) { | ||
8081 | |||
8082 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
8083 | * Copyright 2013-present, Facebook, Inc. | ||
8084 | * All rights reserved. | ||
8085 | * | ||
8086 | * This source code is licensed under the BSD-style license found in the | ||
8087 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8088 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8089 | * | ||
8090 | * | ||
8091 | */ | ||
8092 | |||
8093 | 'use strict'; | ||
8094 | |||
8095 | var _prodInvariant = __webpack_require__(41); | ||
8096 | |||
8097 | var invariant = __webpack_require__(10); | ||
8098 | |||
8099 | /** | ||
8100 | * @param {?object} object | ||
8101 | * @return {boolean} True if `object` is a valid owner. | ||
8102 | * @final | ||
8103 | */ | ||
8104 | function isValidOwner(object) { | ||
8105 | return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function'); | ||
8106 | } | ||
8107 | |||
8108 | /** | ||
8109 | * ReactOwners are capable of storing references to owned components. | ||
8110 | * | ||
8111 | * All components are capable of //being// referenced by owner components, but | ||
8112 | * only ReactOwner components are capable of //referencing// owned components. | ||
8113 | * The named reference is known as a "ref". | ||
8114 | * | ||
8115 | * Refs are available when mounted and updated during reconciliation. | ||
8116 | * | ||
8117 | * var MyComponent = React.createClass({ | ||
8118 | * render: function() { | ||
8119 | * return ( | ||
8120 | * <div onClick={this.handleClick}> | ||
8121 | * <CustomComponent ref="custom" /> | ||
8122 | * </div> | ||
8123 | * ); | ||
8124 | * }, | ||
8125 | * handleClick: function() { | ||
8126 | * this.refs.custom.handleClick(); | ||
8127 | * }, | ||
8128 | * componentDidMount: function() { | ||
8129 | * this.refs.custom.initialize(); | ||
8130 | * } | ||
8131 | * }); | ||
8132 | * | ||
8133 | * Refs should rarely be used. When refs are used, they should only be done to | ||
8134 | * control data that is not handled by React's data flow. | ||
8135 | * | ||
8136 | * @class ReactOwner | ||
8137 | */ | ||
8138 | var ReactOwner = { | ||
8139 | /** | ||
8140 | * Adds a component by ref to an owner component. | ||
8141 | * | ||
8142 | * @param {ReactComponent} component Component to reference. | ||
8143 | * @param {string} ref Name by which to refer to the component. | ||
8144 | * @param {ReactOwner} owner Component on which to record the ref. | ||
8145 | * @final | ||
8146 | * @internal | ||
8147 | */ | ||
8148 | addComponentAsRefTo: function (component, ref, owner) { | ||
8149 | !isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('119') : void 0; | ||
8150 | owner.attachRef(ref, component); | ||
8151 | }, | ||
8152 | |||
8153 | /** | ||
8154 | * Removes a component by ref from an owner component. | ||
8155 | * | ||
8156 | * @param {ReactComponent} component Component to dereference. | ||
8157 | * @param {string} ref Name of the ref to remove. | ||
8158 | * @param {ReactOwner} owner Component on which the ref is recorded. | ||
8159 | * @final | ||
8160 | * @internal | ||
8161 | */ | ||
8162 | removeComponentAsRefFrom: function (component, ref, owner) { | ||
8163 | !isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('120') : void 0; | ||
8164 | var ownerPublicInstance = owner.getPublicInstance(); | ||
8165 | // Check that `component`'s owner is still alive and that `component` is still the current ref | ||
8166 | // because we do not want to detach the ref if another component stole it. | ||
8167 | if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) { | ||
8168 | owner.detachRef(ref); | ||
8169 | } | ||
8170 | } | ||
8171 | |||
8172 | }; | ||
8173 | |||
8174 | module.exports = ReactOwner; | ||
8175 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
8176 | |||
8177 | /***/ }), | ||
8178 | /* 68 */ | ||
8179 | /***/ (function(module, exports, __webpack_require__) { | ||
8180 | |||
8181 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
8182 | * Copyright 2016-present, Facebook, Inc. | ||
8183 | * All rights reserved. | ||
8184 | * | ||
8185 | * This source code is licensed under the BSD-style license found in the | ||
8186 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8187 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8188 | * | ||
8189 | * | ||
8190 | */ | ||
8191 | |||
8192 | 'use strict'; | ||
8193 | |||
8194 | // Trust the developer to only use ReactInstrumentation with a __DEV__ check | ||
8195 | |||
8196 | var debugTool = null; | ||
8197 | |||
8198 | if (process.env.NODE_ENV !== 'production') { | ||
8199 | var ReactDebugTool = __webpack_require__(69); | ||
8200 | debugTool = ReactDebugTool; | ||
8201 | } | ||
8202 | |||
8203 | module.exports = { debugTool: debugTool }; | ||
8204 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
8205 | |||
8206 | /***/ }), | ||
8207 | /* 69 */ | ||
8208 | /***/ (function(module, exports, __webpack_require__) { | ||
8209 | |||
8210 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
8211 | * Copyright 2016-present, Facebook, Inc. | ||
8212 | * All rights reserved. | ||
8213 | * | ||
8214 | * This source code is licensed under the BSD-style license found in the | ||
8215 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8216 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8217 | * | ||
8218 | * | ||
8219 | */ | ||
8220 | |||
8221 | 'use strict'; | ||
8222 | |||
8223 | var ReactInvalidSetStateWarningHook = __webpack_require__(70); | ||
8224 | var ReactHostOperationHistoryHook = __webpack_require__(71); | ||
8225 | var ReactComponentTreeHook = __webpack_require__(28); | ||
8226 | var ExecutionEnvironment = __webpack_require__(54); | ||
8227 | |||
8228 | var performanceNow = __webpack_require__(72); | ||
8229 | var warning = __webpack_require__(13); | ||
8230 | |||
8231 | var hooks = []; | ||
8232 | var didHookThrowForEvent = {}; | ||
8233 | |||
8234 | function callHook(event, fn, context, arg1, arg2, arg3, arg4, arg5) { | ||
8235 | try { | ||
8236 | fn.call(context, arg1, arg2, arg3, arg4, arg5); | ||
8237 | } catch (e) { | ||
8238 | process.env.NODE_ENV !== 'production' ? warning(didHookThrowForEvent[event], 'Exception thrown by hook while handling %s: %s', event, e + '\n' + e.stack) : void 0; | ||
8239 | didHookThrowForEvent[event] = true; | ||
8240 | } | ||
8241 | } | ||
8242 | |||
8243 | function emitEvent(event, arg1, arg2, arg3, arg4, arg5) { | ||
8244 | for (var i = 0; i < hooks.length; i++) { | ||
8245 | var hook = hooks[i]; | ||
8246 | var fn = hook[event]; | ||
8247 | if (fn) { | ||
8248 | callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5); | ||
8249 | } | ||
8250 | } | ||
8251 | } | ||
8252 | |||
8253 | var isProfiling = false; | ||
8254 | var flushHistory = []; | ||
8255 | var lifeCycleTimerStack = []; | ||
8256 | var currentFlushNesting = 0; | ||
8257 | var currentFlushMeasurements = []; | ||
8258 | var currentFlushStartTime = 0; | ||
8259 | var currentTimerDebugID = null; | ||
8260 | var currentTimerStartTime = 0; | ||
8261 | var currentTimerNestedFlushDuration = 0; | ||
8262 | var currentTimerType = null; | ||
8263 | |||
8264 | var lifeCycleTimerHasWarned = false; | ||
8265 | |||
8266 | function clearHistory() { | ||
8267 | ReactComponentTreeHook.purgeUnmountedComponents(); | ||
8268 | ReactHostOperationHistoryHook.clearHistory(); | ||
8269 | } | ||
8270 | |||
8271 | function getTreeSnapshot(registeredIDs) { | ||
8272 | return registeredIDs.reduce(function (tree, id) { | ||
8273 | var ownerID = ReactComponentTreeHook.getOwnerID(id); | ||
8274 | var parentID = ReactComponentTreeHook.getParentID(id); | ||
8275 | tree[id] = { | ||
8276 | displayName: ReactComponentTreeHook.getDisplayName(id), | ||
8277 | text: ReactComponentTreeHook.getText(id), | ||
8278 | updateCount: ReactComponentTreeHook.getUpdateCount(id), | ||
8279 | childIDs: ReactComponentTreeHook.getChildIDs(id), | ||
8280 | // Text nodes don't have owners but this is close enough. | ||
8281 | ownerID: ownerID || parentID && ReactComponentTreeHook.getOwnerID(parentID) || 0, | ||
8282 | parentID: parentID | ||
8283 | }; | ||
8284 | return tree; | ||
8285 | }, {}); | ||
8286 | } | ||
8287 | |||
8288 | function resetMeasurements() { | ||
8289 | var previousStartTime = currentFlushStartTime; | ||
8290 | var previousMeasurements = currentFlushMeasurements; | ||
8291 | var previousOperations = ReactHostOperationHistoryHook.getHistory(); | ||
8292 | |||
8293 | if (currentFlushNesting === 0) { | ||
8294 | currentFlushStartTime = 0; | ||
8295 | currentFlushMeasurements = []; | ||
8296 | clearHistory(); | ||
8297 | return; | ||
8298 | } | ||
8299 | |||
8300 | if (previousMeasurements.length || previousOperations.length) { | ||
8301 | var registeredIDs = ReactComponentTreeHook.getRegisteredIDs(); | ||
8302 | flushHistory.push({ | ||
8303 | duration: performanceNow() - previousStartTime, | ||
8304 | measurements: previousMeasurements || [], | ||
8305 | operations: previousOperations || [], | ||
8306 | treeSnapshot: getTreeSnapshot(registeredIDs) | ||
8307 | }); | ||
8308 | } | ||
8309 | |||
8310 | clearHistory(); | ||
8311 | currentFlushStartTime = performanceNow(); | ||
8312 | currentFlushMeasurements = []; | ||
8313 | } | ||
8314 | |||
8315 | function checkDebugID(debugID) { | ||
8316 | var allowRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
8317 | |||
8318 | if (allowRoot && debugID === 0) { | ||
8319 | return; | ||
8320 | } | ||
8321 | if (!debugID) { | ||
8322 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDebugTool: debugID may not be empty.') : void 0; | ||
8323 | } | ||
8324 | } | ||
8325 | |||
8326 | function beginLifeCycleTimer(debugID, timerType) { | ||
8327 | if (currentFlushNesting === 0) { | ||
8328 | return; | ||
8329 | } | ||
8330 | if (currentTimerType && !lifeCycleTimerHasWarned) { | ||
8331 | process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'Did not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0; | ||
8332 | lifeCycleTimerHasWarned = true; | ||
8333 | } | ||
8334 | currentTimerStartTime = performanceNow(); | ||
8335 | currentTimerNestedFlushDuration = 0; | ||
8336 | currentTimerDebugID = debugID; | ||
8337 | currentTimerType = timerType; | ||
8338 | } | ||
8339 | |||
8340 | function endLifeCycleTimer(debugID, timerType) { | ||
8341 | if (currentFlushNesting === 0) { | ||
8342 | return; | ||
8343 | } | ||
8344 | if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) { | ||
8345 | process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0; | ||
8346 | lifeCycleTimerHasWarned = true; | ||
8347 | } | ||
8348 | if (isProfiling) { | ||
8349 | currentFlushMeasurements.push({ | ||
8350 | timerType: timerType, | ||
8351 | instanceID: debugID, | ||
8352 | duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration | ||
8353 | }); | ||
8354 | } | ||
8355 | currentTimerStartTime = 0; | ||
8356 | currentTimerNestedFlushDuration = 0; | ||
8357 | currentTimerDebugID = null; | ||
8358 | currentTimerType = null; | ||
8359 | } | ||
8360 | |||
8361 | function pauseCurrentLifeCycleTimer() { | ||
8362 | var currentTimer = { | ||
8363 | startTime: currentTimerStartTime, | ||
8364 | nestedFlushStartTime: performanceNow(), | ||
8365 | debugID: currentTimerDebugID, | ||
8366 | timerType: currentTimerType | ||
8367 | }; | ||
8368 | lifeCycleTimerStack.push(currentTimer); | ||
8369 | currentTimerStartTime = 0; | ||
8370 | currentTimerNestedFlushDuration = 0; | ||
8371 | currentTimerDebugID = null; | ||
8372 | currentTimerType = null; | ||
8373 | } | ||
8374 | |||
8375 | function resumeCurrentLifeCycleTimer() { | ||
8376 | var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(), | ||
8377 | startTime = _lifeCycleTimerStack$.startTime, | ||
8378 | nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime, | ||
8379 | debugID = _lifeCycleTimerStack$.debugID, | ||
8380 | timerType = _lifeCycleTimerStack$.timerType; | ||
8381 | |||
8382 | var nestedFlushDuration = performanceNow() - nestedFlushStartTime; | ||
8383 | currentTimerStartTime = startTime; | ||
8384 | currentTimerNestedFlushDuration += nestedFlushDuration; | ||
8385 | currentTimerDebugID = debugID; | ||
8386 | currentTimerType = timerType; | ||
8387 | } | ||
8388 | |||
8389 | var lastMarkTimeStamp = 0; | ||
8390 | var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function'; | ||
8391 | |||
8392 | function shouldMark(debugID) { | ||
8393 | if (!isProfiling || !canUsePerformanceMeasure) { | ||
8394 | return false; | ||
8395 | } | ||
8396 | var element = ReactComponentTreeHook.getElement(debugID); | ||
8397 | if (element == null || typeof element !== 'object') { | ||
8398 | return false; | ||
8399 | } | ||
8400 | var isHostElement = typeof element.type === 'string'; | ||
8401 | if (isHostElement) { | ||
8402 | return false; | ||
8403 | } | ||
8404 | return true; | ||
8405 | } | ||
8406 | |||
8407 | function markBegin(debugID, markType) { | ||
8408 | if (!shouldMark(debugID)) { | ||
8409 | return; | ||
8410 | } | ||
8411 | |||
8412 | var markName = debugID + '::' + markType; | ||
8413 | lastMarkTimeStamp = performanceNow(); | ||
8414 | performance.mark(markName); | ||
8415 | } | ||
8416 | |||
8417 | function markEnd(debugID, markType) { | ||
8418 | if (!shouldMark(debugID)) { | ||
8419 | return; | ||
8420 | } | ||
8421 | |||
8422 | var markName = debugID + '::' + markType; | ||
8423 | var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown'; | ||
8424 | |||
8425 | // Chrome has an issue of dropping markers recorded too fast: | ||
8426 | // https://bugs.chromium.org/p/chromium/issues/detail?id=640652 | ||
8427 | // To work around this, we will not report very small measurements. | ||
8428 | // I determined the magic number by tweaking it back and forth. | ||
8429 | // 0.05ms was enough to prevent the issue, but I set it to 0.1ms to be safe. | ||
8430 | // When the bug is fixed, we can `measure()` unconditionally if we want to. | ||
8431 | var timeStamp = performanceNow(); | ||
8432 | if (timeStamp - lastMarkTimeStamp > 0.1) { | ||
8433 | var measurementName = displayName + ' [' + markType + ']'; | ||
8434 | performance.measure(measurementName, markName); | ||
8435 | } | ||
8436 | |||
8437 | performance.clearMarks(markName); | ||
8438 | performance.clearMeasures(measurementName); | ||
8439 | } | ||
8440 | |||
8441 | var ReactDebugTool = { | ||
8442 | addHook: function (hook) { | ||
8443 | hooks.push(hook); | ||
8444 | }, | ||
8445 | removeHook: function (hook) { | ||
8446 | for (var i = 0; i < hooks.length; i++) { | ||
8447 | if (hooks[i] === hook) { | ||
8448 | hooks.splice(i, 1); | ||
8449 | i--; | ||
8450 | } | ||
8451 | } | ||
8452 | }, | ||
8453 | isProfiling: function () { | ||
8454 | return isProfiling; | ||
8455 | }, | ||
8456 | beginProfiling: function () { | ||
8457 | if (isProfiling) { | ||
8458 | return; | ||
8459 | } | ||
8460 | |||
8461 | isProfiling = true; | ||
8462 | flushHistory.length = 0; | ||
8463 | resetMeasurements(); | ||
8464 | ReactDebugTool.addHook(ReactHostOperationHistoryHook); | ||
8465 | }, | ||
8466 | endProfiling: function () { | ||
8467 | if (!isProfiling) { | ||
8468 | return; | ||
8469 | } | ||
8470 | |||
8471 | isProfiling = false; | ||
8472 | resetMeasurements(); | ||
8473 | ReactDebugTool.removeHook(ReactHostOperationHistoryHook); | ||
8474 | }, | ||
8475 | getFlushHistory: function () { | ||
8476 | return flushHistory; | ||
8477 | }, | ||
8478 | onBeginFlush: function () { | ||
8479 | currentFlushNesting++; | ||
8480 | resetMeasurements(); | ||
8481 | pauseCurrentLifeCycleTimer(); | ||
8482 | emitEvent('onBeginFlush'); | ||
8483 | }, | ||
8484 | onEndFlush: function () { | ||
8485 | resetMeasurements(); | ||
8486 | currentFlushNesting--; | ||
8487 | resumeCurrentLifeCycleTimer(); | ||
8488 | emitEvent('onEndFlush'); | ||
8489 | }, | ||
8490 | onBeginLifeCycleTimer: function (debugID, timerType) { | ||
8491 | checkDebugID(debugID); | ||
8492 | emitEvent('onBeginLifeCycleTimer', debugID, timerType); | ||
8493 | markBegin(debugID, timerType); | ||
8494 | beginLifeCycleTimer(debugID, timerType); | ||
8495 | }, | ||
8496 | onEndLifeCycleTimer: function (debugID, timerType) { | ||
8497 | checkDebugID(debugID); | ||
8498 | endLifeCycleTimer(debugID, timerType); | ||
8499 | markEnd(debugID, timerType); | ||
8500 | emitEvent('onEndLifeCycleTimer', debugID, timerType); | ||
8501 | }, | ||
8502 | onBeginProcessingChildContext: function () { | ||
8503 | emitEvent('onBeginProcessingChildContext'); | ||
8504 | }, | ||
8505 | onEndProcessingChildContext: function () { | ||
8506 | emitEvent('onEndProcessingChildContext'); | ||
8507 | }, | ||
8508 | onHostOperation: function (operation) { | ||
8509 | checkDebugID(operation.instanceID); | ||
8510 | emitEvent('onHostOperation', operation); | ||
8511 | }, | ||
8512 | onSetState: function () { | ||
8513 | emitEvent('onSetState'); | ||
8514 | }, | ||
8515 | onSetChildren: function (debugID, childDebugIDs) { | ||
8516 | checkDebugID(debugID); | ||
8517 | childDebugIDs.forEach(checkDebugID); | ||
8518 | emitEvent('onSetChildren', debugID, childDebugIDs); | ||
8519 | }, | ||
8520 | onBeforeMountComponent: function (debugID, element, parentDebugID) { | ||
8521 | checkDebugID(debugID); | ||
8522 | checkDebugID(parentDebugID, true); | ||
8523 | emitEvent('onBeforeMountComponent', debugID, element, parentDebugID); | ||
8524 | markBegin(debugID, 'mount'); | ||
8525 | }, | ||
8526 | onMountComponent: function (debugID) { | ||
8527 | checkDebugID(debugID); | ||
8528 | markEnd(debugID, 'mount'); | ||
8529 | emitEvent('onMountComponent', debugID); | ||
8530 | }, | ||
8531 | onBeforeUpdateComponent: function (debugID, element) { | ||
8532 | checkDebugID(debugID); | ||
8533 | emitEvent('onBeforeUpdateComponent', debugID, element); | ||
8534 | markBegin(debugID, 'update'); | ||
8535 | }, | ||
8536 | onUpdateComponent: function (debugID) { | ||
8537 | checkDebugID(debugID); | ||
8538 | markEnd(debugID, 'update'); | ||
8539 | emitEvent('onUpdateComponent', debugID); | ||
8540 | }, | ||
8541 | onBeforeUnmountComponent: function (debugID) { | ||
8542 | checkDebugID(debugID); | ||
8543 | emitEvent('onBeforeUnmountComponent', debugID); | ||
8544 | markBegin(debugID, 'unmount'); | ||
8545 | }, | ||
8546 | onUnmountComponent: function (debugID) { | ||
8547 | checkDebugID(debugID); | ||
8548 | markEnd(debugID, 'unmount'); | ||
8549 | emitEvent('onUnmountComponent', debugID); | ||
8550 | }, | ||
8551 | onTestEvent: function () { | ||
8552 | emitEvent('onTestEvent'); | ||
8553 | } | ||
8554 | }; | ||
8555 | |||
8556 | // TODO remove these when RN/www gets updated | ||
8557 | ReactDebugTool.addDevtool = ReactDebugTool.addHook; | ||
8558 | ReactDebugTool.removeDevtool = ReactDebugTool.removeHook; | ||
8559 | |||
8560 | ReactDebugTool.addHook(ReactInvalidSetStateWarningHook); | ||
8561 | ReactDebugTool.addHook(ReactComponentTreeHook); | ||
8562 | var url = ExecutionEnvironment.canUseDOM && window.location.href || ''; | ||
8563 | if (/[?&]react_perf\b/.test(url)) { | ||
8564 | ReactDebugTool.beginProfiling(); | ||
8565 | } | ||
8566 | |||
8567 | module.exports = ReactDebugTool; | ||
8568 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
8569 | |||
8570 | /***/ }), | ||
8571 | /* 70 */ | ||
8572 | /***/ (function(module, exports, __webpack_require__) { | ||
8573 | |||
8574 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
8575 | * Copyright 2016-present, Facebook, Inc. | ||
8576 | * All rights reserved. | ||
8577 | * | ||
8578 | * This source code is licensed under the BSD-style license found in the | ||
8579 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8580 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8581 | * | ||
8582 | * | ||
8583 | */ | ||
8584 | |||
8585 | 'use strict'; | ||
8586 | |||
8587 | var warning = __webpack_require__(13); | ||
8588 | |||
8589 | if (process.env.NODE_ENV !== 'production') { | ||
8590 | var processingChildContext = false; | ||
8591 | |||
8592 | var warnInvalidSetState = function () { | ||
8593 | process.env.NODE_ENV !== 'production' ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0; | ||
8594 | }; | ||
8595 | } | ||
8596 | |||
8597 | var ReactInvalidSetStateWarningHook = { | ||
8598 | onBeginProcessingChildContext: function () { | ||
8599 | processingChildContext = true; | ||
8600 | }, | ||
8601 | onEndProcessingChildContext: function () { | ||
8602 | processingChildContext = false; | ||
8603 | }, | ||
8604 | onSetState: function () { | ||
8605 | warnInvalidSetState(); | ||
8606 | } | ||
8607 | }; | ||
8608 | |||
8609 | module.exports = ReactInvalidSetStateWarningHook; | ||
8610 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
8611 | |||
8612 | /***/ }), | ||
8613 | /* 71 */ | ||
8614 | /***/ (function(module, exports) { | ||
8615 | |||
8616 | /** | ||
8617 | * Copyright 2016-present, Facebook, Inc. | ||
8618 | * All rights reserved. | ||
8619 | * | ||
8620 | * This source code is licensed under the BSD-style license found in the | ||
8621 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8622 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8623 | * | ||
8624 | * | ||
8625 | */ | ||
8626 | |||
8627 | 'use strict'; | ||
8628 | |||
8629 | var history = []; | ||
8630 | |||
8631 | var ReactHostOperationHistoryHook = { | ||
8632 | onHostOperation: function (operation) { | ||
8633 | history.push(operation); | ||
8634 | }, | ||
8635 | clearHistory: function () { | ||
8636 | if (ReactHostOperationHistoryHook._preventClearing) { | ||
8637 | // Should only be used for tests. | ||
8638 | return; | ||
8639 | } | ||
8640 | |||
8641 | history = []; | ||
8642 | }, | ||
8643 | getHistory: function () { | ||
8644 | return history; | ||
8645 | } | ||
8646 | }; | ||
8647 | |||
8648 | module.exports = ReactHostOperationHistoryHook; | ||
8649 | |||
8650 | /***/ }), | ||
8651 | /* 72 */ | ||
8652 | /***/ (function(module, exports, __webpack_require__) { | ||
8653 | |||
8654 | 'use strict'; | ||
8655 | |||
8656 | /** | ||
8657 | * Copyright (c) 2013-present, Facebook, Inc. | ||
8658 | * All rights reserved. | ||
8659 | * | ||
8660 | * This source code is licensed under the BSD-style license found in the | ||
8661 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8662 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8663 | * | ||
8664 | * @typechecks | ||
8665 | */ | ||
8666 | |||
8667 | var performance = __webpack_require__(73); | ||
8668 | |||
8669 | var performanceNow; | ||
8670 | |||
8671 | /** | ||
8672 | * Detect if we can use `window.performance.now()` and gracefully fallback to | ||
8673 | * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now | ||
8674 | * because of Facebook's testing infrastructure. | ||
8675 | */ | ||
8676 | if (performance.now) { | ||
8677 | performanceNow = function performanceNow() { | ||
8678 | return performance.now(); | ||
8679 | }; | ||
8680 | } else { | ||
8681 | performanceNow = function performanceNow() { | ||
8682 | return Date.now(); | ||
8683 | }; | ||
8684 | } | ||
8685 | |||
8686 | module.exports = performanceNow; | ||
8687 | |||
8688 | /***/ }), | ||
8689 | /* 73 */ | ||
8690 | /***/ (function(module, exports, __webpack_require__) { | ||
8691 | |||
8692 | /** | ||
8693 | * Copyright (c) 2013-present, Facebook, Inc. | ||
8694 | * All rights reserved. | ||
8695 | * | ||
8696 | * This source code is licensed under the BSD-style license found in the | ||
8697 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8698 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8699 | * | ||
8700 | * @typechecks | ||
8701 | */ | ||
8702 | |||
8703 | 'use strict'; | ||
8704 | |||
8705 | var ExecutionEnvironment = __webpack_require__(54); | ||
8706 | |||
8707 | var performance; | ||
8708 | |||
8709 | if (ExecutionEnvironment.canUseDOM) { | ||
8710 | performance = window.performance || window.msPerformance || window.webkitPerformance; | ||
8711 | } | ||
8712 | |||
8713 | module.exports = performance || {}; | ||
8714 | |||
8715 | /***/ }), | ||
8716 | /* 74 */ | ||
8717 | /***/ (function(module, exports, __webpack_require__) { | ||
8718 | |||
8719 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
8720 | * Copyright 2013-present, Facebook, Inc. | ||
8721 | * All rights reserved. | ||
8722 | * | ||
8723 | * This source code is licensed under the BSD-style license found in the | ||
8724 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8725 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8726 | * | ||
8727 | * | ||
8728 | */ | ||
8729 | |||
8730 | 'use strict'; | ||
8731 | |||
8732 | var _prodInvariant = __webpack_require__(41); | ||
8733 | |||
8734 | var invariant = __webpack_require__(10); | ||
8735 | |||
8736 | var OBSERVED_ERROR = {}; | ||
8737 | |||
8738 | /** | ||
8739 | * `Transaction` creates a black box that is able to wrap any method such that | ||
8740 | * certain invariants are maintained before and after the method is invoked | ||
8741 | * (Even if an exception is thrown while invoking the wrapped method). Whoever | ||
8742 | * instantiates a transaction can provide enforcers of the invariants at | ||
8743 | * creation time. The `Transaction` class itself will supply one additional | ||
8744 | * automatic invariant for you - the invariant that any transaction instance | ||
8745 | * should not be run while it is already being run. You would typically create a | ||
8746 | * single instance of a `Transaction` for reuse multiple times, that potentially | ||
8747 | * is used to wrap several different methods. Wrappers are extremely simple - | ||
8748 | * they only require implementing two methods. | ||
8749 | * | ||
8750 | * <pre> | ||
8751 | * wrappers (injected at creation time) | ||
8752 | * + + | ||
8753 | * | | | ||
8754 | * +-----------------|--------|--------------+ | ||
8755 | * | v | | | ||
8756 | * | +---------------+ | | | ||
8757 | * | +--| wrapper1 |---|----+ | | ||
8758 | * | | +---------------+ v | | | ||
8759 | * | | +-------------+ | | | ||
8760 | * | | +----| wrapper2 |--------+ | | ||
8761 | * | | | +-------------+ | | | | ||
8762 | * | | | | | | | ||
8763 | * | v v v v | wrapper | ||
8764 | * | +---+ +---+ +---------+ +---+ +---+ | invariants | ||
8765 | * perform(anyMethod) | | | | | | | | | | | | maintained | ||
8766 | * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|--------> | ||
8767 | * | | | | | | | | | | | | | ||
8768 | * | | | | | | | | | | | | | ||
8769 | * | | | | | | | | | | | | | ||
8770 | * | +---+ +---+ +---------+ +---+ +---+ | | ||
8771 | * | initialize close | | ||
8772 | * +-----------------------------------------+ | ||
8773 | * </pre> | ||
8774 | * | ||
8775 | * Use cases: | ||
8776 | * - Preserving the input selection ranges before/after reconciliation. | ||
8777 | * Restoring selection even in the event of an unexpected error. | ||
8778 | * - Deactivating events while rearranging the DOM, preventing blurs/focuses, | ||
8779 | * while guaranteeing that afterwards, the event system is reactivated. | ||
8780 | * - Flushing a queue of collected DOM mutations to the main UI thread after a | ||
8781 | * reconciliation takes place in a worker thread. | ||
8782 | * - Invoking any collected `componentDidUpdate` callbacks after rendering new | ||
8783 | * content. | ||
8784 | * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue | ||
8785 | * to preserve the `scrollTop` (an automatic scroll aware DOM). | ||
8786 | * - (Future use case): Layout calculations before and after DOM updates. | ||
8787 | * | ||
8788 | * Transactional plugin API: | ||
8789 | * - A module that has an `initialize` method that returns any precomputation. | ||
8790 | * - and a `close` method that accepts the precomputation. `close` is invoked | ||
8791 | * when the wrapped process is completed, or has failed. | ||
8792 | * | ||
8793 | * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules | ||
8794 | * that implement `initialize` and `close`. | ||
8795 | * @return {Transaction} Single transaction for reuse in thread. | ||
8796 | * | ||
8797 | * @class Transaction | ||
8798 | */ | ||
8799 | var TransactionImpl = { | ||
8800 | /** | ||
8801 | * Sets up this instance so that it is prepared for collecting metrics. Does | ||
8802 | * so such that this setup method may be used on an instance that is already | ||
8803 | * initialized, in a way that does not consume additional memory upon reuse. | ||
8804 | * That can be useful if you decide to make your subclass of this mixin a | ||
8805 | * "PooledClass". | ||
8806 | */ | ||
8807 | reinitializeTransaction: function () { | ||
8808 | this.transactionWrappers = this.getTransactionWrappers(); | ||
8809 | if (this.wrapperInitData) { | ||
8810 | this.wrapperInitData.length = 0; | ||
8811 | } else { | ||
8812 | this.wrapperInitData = []; | ||
8813 | } | ||
8814 | this._isInTransaction = false; | ||
8815 | }, | ||
8816 | |||
8817 | _isInTransaction: false, | ||
8818 | |||
8819 | /** | ||
8820 | * @abstract | ||
8821 | * @return {Array<TransactionWrapper>} Array of transaction wrappers. | ||
8822 | */ | ||
8823 | getTransactionWrappers: null, | ||
8824 | |||
8825 | isInTransaction: function () { | ||
8826 | return !!this._isInTransaction; | ||
8827 | }, | ||
8828 | |||
8829 | /** | ||
8830 | * Executes the function within a safety window. Use this for the top level | ||
8831 | * methods that result in large amounts of computation/mutations that would | ||
8832 | * need to be safety checked. The optional arguments helps prevent the need | ||
8833 | * to bind in many cases. | ||
8834 | * | ||
8835 | * @param {function} method Member of scope to call. | ||
8836 | * @param {Object} scope Scope to invoke from. | ||
8837 | * @param {Object?=} a Argument to pass to the method. | ||
8838 | * @param {Object?=} b Argument to pass to the method. | ||
8839 | * @param {Object?=} c Argument to pass to the method. | ||
8840 | * @param {Object?=} d Argument to pass to the method. | ||
8841 | * @param {Object?=} e Argument to pass to the method. | ||
8842 | * @param {Object?=} f Argument to pass to the method. | ||
8843 | * | ||
8844 | * @return {*} Return value from `method`. | ||
8845 | */ | ||
8846 | perform: function (method, scope, a, b, c, d, e, f) { | ||
8847 | !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0; | ||
8848 | var errorThrown; | ||
8849 | var ret; | ||
8850 | try { | ||
8851 | this._isInTransaction = true; | ||
8852 | // Catching errors makes debugging more difficult, so we start with | ||
8853 | // errorThrown set to true before setting it to false after calling | ||
8854 | // close -- if it's still set to true in the finally block, it means | ||
8855 | // one of these calls threw. | ||
8856 | errorThrown = true; | ||
8857 | this.initializeAll(0); | ||
8858 | ret = method.call(scope, a, b, c, d, e, f); | ||
8859 | errorThrown = false; | ||
8860 | } finally { | ||
8861 | try { | ||
8862 | if (errorThrown) { | ||
8863 | // If `method` throws, prefer to show that stack trace over any thrown | ||
8864 | // by invoking `closeAll`. | ||
8865 | try { | ||
8866 | this.closeAll(0); | ||
8867 | } catch (err) {} | ||
8868 | } else { | ||
8869 | // Since `method` didn't throw, we don't want to silence the exception | ||
8870 | // here. | ||
8871 | this.closeAll(0); | ||
8872 | } | ||
8873 | } finally { | ||
8874 | this._isInTransaction = false; | ||
8875 | } | ||
8876 | } | ||
8877 | return ret; | ||
8878 | }, | ||
8879 | |||
8880 | initializeAll: function (startIndex) { | ||
8881 | var transactionWrappers = this.transactionWrappers; | ||
8882 | for (var i = startIndex; i < transactionWrappers.length; i++) { | ||
8883 | var wrapper = transactionWrappers[i]; | ||
8884 | try { | ||
8885 | // Catching errors makes debugging more difficult, so we start with the | ||
8886 | // OBSERVED_ERROR state before overwriting it with the real return value | ||
8887 | // of initialize -- if it's still set to OBSERVED_ERROR in the finally | ||
8888 | // block, it means wrapper.initialize threw. | ||
8889 | this.wrapperInitData[i] = OBSERVED_ERROR; | ||
8890 | this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null; | ||
8891 | } finally { | ||
8892 | if (this.wrapperInitData[i] === OBSERVED_ERROR) { | ||
8893 | // The initializer for wrapper i threw an error; initialize the | ||
8894 | // remaining wrappers but silence any exceptions from them to ensure | ||
8895 | // that the first error is the one to bubble up. | ||
8896 | try { | ||
8897 | this.initializeAll(i + 1); | ||
8898 | } catch (err) {} | ||
8899 | } | ||
8900 | } | ||
8901 | } | ||
8902 | }, | ||
8903 | |||
8904 | /** | ||
8905 | * Invokes each of `this.transactionWrappers.close[i]` functions, passing into | ||
8906 | * them the respective return values of `this.transactionWrappers.init[i]` | ||
8907 | * (`close`rs that correspond to initializers that failed will not be | ||
8908 | * invoked). | ||
8909 | */ | ||
8910 | closeAll: function (startIndex) { | ||
8911 | !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0; | ||
8912 | var transactionWrappers = this.transactionWrappers; | ||
8913 | for (var i = startIndex; i < transactionWrappers.length; i++) { | ||
8914 | var wrapper = transactionWrappers[i]; | ||
8915 | var initData = this.wrapperInitData[i]; | ||
8916 | var errorThrown; | ||
8917 | try { | ||
8918 | // Catching errors makes debugging more difficult, so we start with | ||
8919 | // errorThrown set to true before setting it to false after calling | ||
8920 | // close -- if it's still set to true in the finally block, it means | ||
8921 | // wrapper.close threw. | ||
8922 | errorThrown = true; | ||
8923 | if (initData !== OBSERVED_ERROR && wrapper.close) { | ||
8924 | wrapper.close.call(this, initData); | ||
8925 | } | ||
8926 | errorThrown = false; | ||
8927 | } finally { | ||
8928 | if (errorThrown) { | ||
8929 | // The closer for wrapper i threw an error; close the remaining | ||
8930 | // wrappers but silence any exceptions from them to ensure that the | ||
8931 | // first error is the one to bubble up. | ||
8932 | try { | ||
8933 | this.closeAll(i + 1); | ||
8934 | } catch (e) {} | ||
8935 | } | ||
8936 | } | ||
8937 | } | ||
8938 | this.wrapperInitData.length = 0; | ||
8939 | } | ||
8940 | }; | ||
8941 | |||
8942 | module.exports = TransactionImpl; | ||
8943 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
8944 | |||
8945 | /***/ }), | ||
8946 | /* 75 */ | ||
8947 | /***/ (function(module, exports) { | ||
8948 | |||
8949 | /** | ||
8950 | * Copyright 2013-present, Facebook, Inc. | ||
8951 | * All rights reserved. | ||
8952 | * | ||
8953 | * This source code is licensed under the BSD-style license found in the | ||
8954 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8955 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8956 | * | ||
8957 | */ | ||
8958 | |||
8959 | 'use strict'; | ||
8960 | |||
8961 | /** | ||
8962 | * Gets the target node from a native browser event by accounting for | ||
8963 | * inconsistencies in browser DOM APIs. | ||
8964 | * | ||
8965 | * @param {object} nativeEvent Native browser event. | ||
8966 | * @return {DOMEventTarget} Target node. | ||
8967 | */ | ||
8968 | |||
8969 | function getEventTarget(nativeEvent) { | ||
8970 | var target = nativeEvent.target || nativeEvent.srcElement || window; | ||
8971 | |||
8972 | // Normalize SVG <use> element events #4963 | ||
8973 | if (target.correspondingUseElement) { | ||
8974 | target = target.correspondingUseElement; | ||
8975 | } | ||
8976 | |||
8977 | // Safari may fire events on text nodes (Node.TEXT_NODE is 3). | ||
8978 | // @see http://www.quirksmode.org/js/events_properties.html | ||
8979 | return target.nodeType === 3 ? target.parentNode : target; | ||
8980 | } | ||
8981 | |||
8982 | module.exports = getEventTarget; | ||
8983 | |||
8984 | /***/ }), | ||
8985 | /* 76 */ | ||
8986 | /***/ (function(module, exports, __webpack_require__) { | ||
8987 | |||
8988 | /** | ||
8989 | * Copyright 2013-present, Facebook, Inc. | ||
8990 | * All rights reserved. | ||
8991 | * | ||
8992 | * This source code is licensed under the BSD-style license found in the | ||
8993 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8994 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8995 | * | ||
8996 | */ | ||
8997 | |||
8998 | 'use strict'; | ||
8999 | |||
9000 | var ExecutionEnvironment = __webpack_require__(54); | ||
9001 | |||
9002 | var useHasFeature; | ||
9003 | if (ExecutionEnvironment.canUseDOM) { | ||
9004 | useHasFeature = document.implementation && document.implementation.hasFeature && | ||
9005 | // always returns true in newer browsers as per the standard. | ||
9006 | // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature | ||
9007 | document.implementation.hasFeature('', '') !== true; | ||
9008 | } | ||
9009 | |||
9010 | /** | ||
9011 | * Checks if an event is supported in the current execution environment. | ||
9012 | * | ||
9013 | * NOTE: This will not work correctly for non-generic events such as `change`, | ||
9014 | * `reset`, `load`, `error`, and `select`. | ||
9015 | * | ||
9016 | * Borrows from Modernizr. | ||
9017 | * | ||
9018 | * @param {string} eventNameSuffix Event name, e.g. "click". | ||
9019 | * @param {?boolean} capture Check if the capture phase is supported. | ||
9020 | * @return {boolean} True if the event is supported. | ||
9021 | * @internal | ||
9022 | * @license Modernizr 3.0.0pre (Custom Build) | MIT | ||
9023 | */ | ||
9024 | function isEventSupported(eventNameSuffix, capture) { | ||
9025 | if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { | ||
9026 | return false; | ||
9027 | } | ||
9028 | |||
9029 | var eventName = 'on' + eventNameSuffix; | ||
9030 | var isSupported = eventName in document; | ||
9031 | |||
9032 | if (!isSupported) { | ||
9033 | var element = document.createElement('div'); | ||
9034 | element.setAttribute(eventName, 'return;'); | ||
9035 | isSupported = typeof element[eventName] === 'function'; | ||
9036 | } | ||
9037 | |||
9038 | if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { | ||
9039 | // This is the only way to test support for the `wheel` event in IE9+. | ||
9040 | isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); | ||
9041 | } | ||
9042 | |||
9043 | return isSupported; | ||
9044 | } | ||
9045 | |||
9046 | module.exports = isEventSupported; | ||
9047 | |||
9048 | /***/ }), | ||
9049 | /* 77 */ | ||
9050 | /***/ (function(module, exports) { | ||
9051 | |||
9052 | /** | ||
9053 | * Copyright 2013-present, Facebook, Inc. | ||
9054 | * All rights reserved. | ||
9055 | * | ||
9056 | * This source code is licensed under the BSD-style license found in the | ||
9057 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9058 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9059 | * | ||
9060 | * | ||
9061 | */ | ||
9062 | |||
9063 | 'use strict'; | ||
9064 | |||
9065 | /** | ||
9066 | * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary | ||
9067 | */ | ||
9068 | |||
9069 | var supportedInputTypes = { | ||
9070 | 'color': true, | ||
9071 | 'date': true, | ||
9072 | 'datetime': true, | ||
9073 | 'datetime-local': true, | ||
9074 | 'email': true, | ||
9075 | 'month': true, | ||
9076 | 'number': true, | ||
9077 | 'password': true, | ||
9078 | 'range': true, | ||
9079 | 'search': true, | ||
9080 | 'tel': true, | ||
9081 | 'text': true, | ||
9082 | 'time': true, | ||
9083 | 'url': true, | ||
9084 | 'week': true | ||
9085 | }; | ||
9086 | |||
9087 | function isTextInputElement(elem) { | ||
9088 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); | ||
9089 | |||
9090 | if (nodeName === 'input') { | ||
9091 | return !!supportedInputTypes[elem.type]; | ||
9092 | } | ||
9093 | |||
9094 | if (nodeName === 'textarea') { | ||
9095 | return true; | ||
9096 | } | ||
9097 | |||
9098 | return false; | ||
9099 | } | ||
9100 | |||
9101 | module.exports = isTextInputElement; | ||
9102 | |||
9103 | /***/ }), | ||
9104 | /* 78 */ | ||
9105 | /***/ (function(module, exports) { | ||
9106 | |||
9107 | /** | ||
9108 | * Copyright 2013-present, Facebook, Inc. | ||
9109 | * All rights reserved. | ||
9110 | * | ||
9111 | * This source code is licensed under the BSD-style license found in the | ||
9112 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9113 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9114 | * | ||
9115 | */ | ||
9116 | |||
9117 | 'use strict'; | ||
9118 | |||
9119 | /** | ||
9120 | * Module that is injectable into `EventPluginHub`, that specifies a | ||
9121 | * deterministic ordering of `EventPlugin`s. A convenient way to reason about | ||
9122 | * plugins, without having to package every one of them. This is better than | ||
9123 | * having plugins be ordered in the same order that they are injected because | ||
9124 | * that ordering would be influenced by the packaging order. | ||
9125 | * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that | ||
9126 | * preventing default on events is convenient in `SimpleEventPlugin` handlers. | ||
9127 | */ | ||
9128 | |||
9129 | var DefaultEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin']; | ||
9130 | |||
9131 | module.exports = DefaultEventPluginOrder; | ||
9132 | |||
9133 | /***/ }), | ||
9134 | /* 79 */ | ||
9135 | /***/ (function(module, exports, __webpack_require__) { | ||
9136 | |||
9137 | /** | ||
9138 | * Copyright 2013-present, Facebook, Inc. | ||
9139 | * All rights reserved. | ||
9140 | * | ||
9141 | * This source code is licensed under the BSD-style license found in the | ||
9142 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9143 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9144 | * | ||
9145 | */ | ||
9146 | |||
9147 | 'use strict'; | ||
9148 | |||
9149 | var EventPropagators = __webpack_require__(47); | ||
9150 | var ReactDOMComponentTree = __webpack_require__(40); | ||
9151 | var SyntheticMouseEvent = __webpack_require__(80); | ||
9152 | |||
9153 | var eventTypes = { | ||
9154 | mouseEnter: { | ||
9155 | registrationName: 'onMouseEnter', | ||
9156 | dependencies: ['topMouseOut', 'topMouseOver'] | ||
9157 | }, | ||
9158 | mouseLeave: { | ||
9159 | registrationName: 'onMouseLeave', | ||
9160 | dependencies: ['topMouseOut', 'topMouseOver'] | ||
9161 | } | ||
9162 | }; | ||
9163 | |||
9164 | var EnterLeaveEventPlugin = { | ||
9165 | |||
9166 | eventTypes: eventTypes, | ||
9167 | |||
9168 | /** | ||
9169 | * For almost every interaction we care about, there will be both a top-level | ||
9170 | * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that | ||
9171 | * we do not extract duplicate events. However, moving the mouse into the | ||
9172 | * browser from outside will not fire a `mouseout` event. In this case, we use | ||
9173 | * the `mouseover` top-level event. | ||
9174 | */ | ||
9175 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
9176 | if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { | ||
9177 | return null; | ||
9178 | } | ||
9179 | if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') { | ||
9180 | // Must not be a mouse in or mouse out - ignoring. | ||
9181 | return null; | ||
9182 | } | ||
9183 | |||
9184 | var win; | ||
9185 | if (nativeEventTarget.window === nativeEventTarget) { | ||
9186 | // `nativeEventTarget` is probably a window object. | ||
9187 | win = nativeEventTarget; | ||
9188 | } else { | ||
9189 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. | ||
9190 | var doc = nativeEventTarget.ownerDocument; | ||
9191 | if (doc) { | ||
9192 | win = doc.defaultView || doc.parentWindow; | ||
9193 | } else { | ||
9194 | win = window; | ||
9195 | } | ||
9196 | } | ||
9197 | |||
9198 | var from; | ||
9199 | var to; | ||
9200 | if (topLevelType === 'topMouseOut') { | ||
9201 | from = targetInst; | ||
9202 | var related = nativeEvent.relatedTarget || nativeEvent.toElement; | ||
9203 | to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null; | ||
9204 | } else { | ||
9205 | // Moving to a node from outside the window. | ||
9206 | from = null; | ||
9207 | to = targetInst; | ||
9208 | } | ||
9209 | |||
9210 | if (from === to) { | ||
9211 | // Nothing pertains to our managed components. | ||
9212 | return null; | ||
9213 | } | ||
9214 | |||
9215 | var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from); | ||
9216 | var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to); | ||
9217 | |||
9218 | var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget); | ||
9219 | leave.type = 'mouseleave'; | ||
9220 | leave.target = fromNode; | ||
9221 | leave.relatedTarget = toNode; | ||
9222 | |||
9223 | var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget); | ||
9224 | enter.type = 'mouseenter'; | ||
9225 | enter.target = toNode; | ||
9226 | enter.relatedTarget = fromNode; | ||
9227 | |||
9228 | EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to); | ||
9229 | |||
9230 | return [leave, enter]; | ||
9231 | } | ||
9232 | |||
9233 | }; | ||
9234 | |||
9235 | module.exports = EnterLeaveEventPlugin; | ||
9236 | |||
9237 | /***/ }), | ||
9238 | /* 80 */ | ||
9239 | /***/ (function(module, exports, __webpack_require__) { | ||
9240 | |||
9241 | /** | ||
9242 | * Copyright 2013-present, Facebook, Inc. | ||
9243 | * All rights reserved. | ||
9244 | * | ||
9245 | * This source code is licensed under the BSD-style license found in the | ||
9246 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9247 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9248 | * | ||
9249 | */ | ||
9250 | |||
9251 | 'use strict'; | ||
9252 | |||
9253 | var SyntheticUIEvent = __webpack_require__(81); | ||
9254 | var ViewportMetrics = __webpack_require__(82); | ||
9255 | |||
9256 | var getEventModifierState = __webpack_require__(83); | ||
9257 | |||
9258 | /** | ||
9259 | * @interface MouseEvent | ||
9260 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
9261 | */ | ||
9262 | var MouseEventInterface = { | ||
9263 | screenX: null, | ||
9264 | screenY: null, | ||
9265 | clientX: null, | ||
9266 | clientY: null, | ||
9267 | ctrlKey: null, | ||
9268 | shiftKey: null, | ||
9269 | altKey: null, | ||
9270 | metaKey: null, | ||
9271 | getModifierState: getEventModifierState, | ||
9272 | button: function (event) { | ||
9273 | // Webkit, Firefox, IE9+ | ||
9274 | // which: 1 2 3 | ||
9275 | // button: 0 1 2 (standard) | ||
9276 | var button = event.button; | ||
9277 | if ('which' in event) { | ||
9278 | return button; | ||
9279 | } | ||
9280 | // IE<9 | ||
9281 | // which: undefined | ||
9282 | // button: 0 0 0 | ||
9283 | // button: 1 4 2 (onmouseup) | ||
9284 | return button === 2 ? 2 : button === 4 ? 1 : 0; | ||
9285 | }, | ||
9286 | buttons: null, | ||
9287 | relatedTarget: function (event) { | ||
9288 | return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); | ||
9289 | }, | ||
9290 | // "Proprietary" Interface. | ||
9291 | pageX: function (event) { | ||
9292 | return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft; | ||
9293 | }, | ||
9294 | pageY: function (event) { | ||
9295 | return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; | ||
9296 | } | ||
9297 | }; | ||
9298 | |||
9299 | /** | ||
9300 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
9301 | * @param {string} dispatchMarker Marker identifying the event target. | ||
9302 | * @param {object} nativeEvent Native browser event. | ||
9303 | * @extends {SyntheticUIEvent} | ||
9304 | */ | ||
9305 | function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
9306 | return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
9307 | } | ||
9308 | |||
9309 | SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); | ||
9310 | |||
9311 | module.exports = SyntheticMouseEvent; | ||
9312 | |||
9313 | /***/ }), | ||
9314 | /* 81 */ | ||
9315 | /***/ (function(module, exports, __webpack_require__) { | ||
9316 | |||
9317 | /** | ||
9318 | * Copyright 2013-present, Facebook, Inc. | ||
9319 | * All rights reserved. | ||
9320 | * | ||
9321 | * This source code is licensed under the BSD-style license found in the | ||
9322 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9323 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9324 | * | ||
9325 | */ | ||
9326 | |||
9327 | 'use strict'; | ||
9328 | |||
9329 | var SyntheticEvent = __webpack_require__(59); | ||
9330 | |||
9331 | var getEventTarget = __webpack_require__(75); | ||
9332 | |||
9333 | /** | ||
9334 | * @interface UIEvent | ||
9335 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
9336 | */ | ||
9337 | var UIEventInterface = { | ||
9338 | view: function (event) { | ||
9339 | if (event.view) { | ||
9340 | return event.view; | ||
9341 | } | ||
9342 | |||
9343 | var target = getEventTarget(event); | ||
9344 | if (target.window === target) { | ||
9345 | // target is a window object | ||
9346 | return target; | ||
9347 | } | ||
9348 | |||
9349 | var doc = target.ownerDocument; | ||
9350 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. | ||
9351 | if (doc) { | ||
9352 | return doc.defaultView || doc.parentWindow; | ||
9353 | } else { | ||
9354 | return window; | ||
9355 | } | ||
9356 | }, | ||
9357 | detail: function (event) { | ||
9358 | return event.detail || 0; | ||
9359 | } | ||
9360 | }; | ||
9361 | |||
9362 | /** | ||
9363 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
9364 | * @param {string} dispatchMarker Marker identifying the event target. | ||
9365 | * @param {object} nativeEvent Native browser event. | ||
9366 | * @extends {SyntheticEvent} | ||
9367 | */ | ||
9368 | function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
9369 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
9370 | } | ||
9371 | |||
9372 | SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); | ||
9373 | |||
9374 | module.exports = SyntheticUIEvent; | ||
9375 | |||
9376 | /***/ }), | ||
9377 | /* 82 */ | ||
9378 | /***/ (function(module, exports) { | ||
9379 | |||
9380 | /** | ||
9381 | * Copyright 2013-present, Facebook, Inc. | ||
9382 | * All rights reserved. | ||
9383 | * | ||
9384 | * This source code is licensed under the BSD-style license found in the | ||
9385 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9386 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9387 | * | ||
9388 | */ | ||
9389 | |||
9390 | 'use strict'; | ||
9391 | |||
9392 | var ViewportMetrics = { | ||
9393 | |||
9394 | currentScrollLeft: 0, | ||
9395 | |||
9396 | currentScrollTop: 0, | ||
9397 | |||
9398 | refreshScrollValues: function (scrollPosition) { | ||
9399 | ViewportMetrics.currentScrollLeft = scrollPosition.x; | ||
9400 | ViewportMetrics.currentScrollTop = scrollPosition.y; | ||
9401 | } | ||
9402 | |||
9403 | }; | ||
9404 | |||
9405 | module.exports = ViewportMetrics; | ||
9406 | |||
9407 | /***/ }), | ||
9408 | /* 83 */ | ||
9409 | /***/ (function(module, exports) { | ||
9410 | |||
9411 | /** | ||
9412 | * Copyright 2013-present, Facebook, Inc. | ||
9413 | * All rights reserved. | ||
9414 | * | ||
9415 | * This source code is licensed under the BSD-style license found in the | ||
9416 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9417 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9418 | * | ||
9419 | */ | ||
9420 | |||
9421 | 'use strict'; | ||
9422 | |||
9423 | /** | ||
9424 | * Translation from modifier key to the associated property in the event. | ||
9425 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers | ||
9426 | */ | ||
9427 | |||
9428 | var modifierKeyToProp = { | ||
9429 | 'Alt': 'altKey', | ||
9430 | 'Control': 'ctrlKey', | ||
9431 | 'Meta': 'metaKey', | ||
9432 | 'Shift': 'shiftKey' | ||
9433 | }; | ||
9434 | |||
9435 | // IE8 does not implement getModifierState so we simply map it to the only | ||
9436 | // modifier keys exposed by the event itself, does not support Lock-keys. | ||
9437 | // Currently, all major browsers except Chrome seems to support Lock-keys. | ||
9438 | function modifierStateGetter(keyArg) { | ||
9439 | var syntheticEvent = this; | ||
9440 | var nativeEvent = syntheticEvent.nativeEvent; | ||
9441 | if (nativeEvent.getModifierState) { | ||
9442 | return nativeEvent.getModifierState(keyArg); | ||
9443 | } | ||
9444 | var keyProp = modifierKeyToProp[keyArg]; | ||
9445 | return keyProp ? !!nativeEvent[keyProp] : false; | ||
9446 | } | ||
9447 | |||
9448 | function getEventModifierState(nativeEvent) { | ||
9449 | return modifierStateGetter; | ||
9450 | } | ||
9451 | |||
9452 | module.exports = getEventModifierState; | ||
9453 | |||
9454 | /***/ }), | ||
9455 | /* 84 */ | ||
9456 | /***/ (function(module, exports, __webpack_require__) { | ||
9457 | |||
9458 | /** | ||
9459 | * Copyright 2013-present, Facebook, Inc. | ||
9460 | * All rights reserved. | ||
9461 | * | ||
9462 | * This source code is licensed under the BSD-style license found in the | ||
9463 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9464 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9465 | * | ||
9466 | */ | ||
9467 | |||
9468 | 'use strict'; | ||
9469 | |||
9470 | var DOMProperty = __webpack_require__(42); | ||
9471 | |||
9472 | var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; | ||
9473 | var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; | ||
9474 | var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE; | ||
9475 | var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE; | ||
9476 | var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE; | ||
9477 | |||
9478 | var HTMLDOMPropertyConfig = { | ||
9479 | isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')), | ||
9480 | Properties: { | ||
9481 | /** | ||
9482 | * Standard Properties | ||
9483 | */ | ||
9484 | accept: 0, | ||
9485 | acceptCharset: 0, | ||
9486 | accessKey: 0, | ||
9487 | action: 0, | ||
9488 | allowFullScreen: HAS_BOOLEAN_VALUE, | ||
9489 | allowTransparency: 0, | ||
9490 | alt: 0, | ||
9491 | // specifies target context for links with `preload` type | ||
9492 | as: 0, | ||
9493 | async: HAS_BOOLEAN_VALUE, | ||
9494 | autoComplete: 0, | ||
9495 | // autoFocus is polyfilled/normalized by AutoFocusUtils | ||
9496 | // autoFocus: HAS_BOOLEAN_VALUE, | ||
9497 | autoPlay: HAS_BOOLEAN_VALUE, | ||
9498 | capture: HAS_BOOLEAN_VALUE, | ||
9499 | cellPadding: 0, | ||
9500 | cellSpacing: 0, | ||
9501 | charSet: 0, | ||
9502 | challenge: 0, | ||
9503 | checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
9504 | cite: 0, | ||
9505 | classID: 0, | ||
9506 | className: 0, | ||
9507 | cols: HAS_POSITIVE_NUMERIC_VALUE, | ||
9508 | colSpan: 0, | ||
9509 | content: 0, | ||
9510 | contentEditable: 0, | ||
9511 | contextMenu: 0, | ||
9512 | controls: HAS_BOOLEAN_VALUE, | ||
9513 | coords: 0, | ||
9514 | crossOrigin: 0, | ||
9515 | data: 0, // For `<object />` acts as `src`. | ||
9516 | dateTime: 0, | ||
9517 | 'default': HAS_BOOLEAN_VALUE, | ||
9518 | defer: HAS_BOOLEAN_VALUE, | ||
9519 | dir: 0, | ||
9520 | disabled: HAS_BOOLEAN_VALUE, | ||
9521 | download: HAS_OVERLOADED_BOOLEAN_VALUE, | ||
9522 | draggable: 0, | ||
9523 | encType: 0, | ||
9524 | form: 0, | ||
9525 | formAction: 0, | ||
9526 | formEncType: 0, | ||
9527 | formMethod: 0, | ||
9528 | formNoValidate: HAS_BOOLEAN_VALUE, | ||
9529 | formTarget: 0, | ||
9530 | frameBorder: 0, | ||
9531 | headers: 0, | ||
9532 | height: 0, | ||
9533 | hidden: HAS_BOOLEAN_VALUE, | ||
9534 | high: 0, | ||
9535 | href: 0, | ||
9536 | hrefLang: 0, | ||
9537 | htmlFor: 0, | ||
9538 | httpEquiv: 0, | ||
9539 | icon: 0, | ||
9540 | id: 0, | ||
9541 | inputMode: 0, | ||
9542 | integrity: 0, | ||
9543 | is: 0, | ||
9544 | keyParams: 0, | ||
9545 | keyType: 0, | ||
9546 | kind: 0, | ||
9547 | label: 0, | ||
9548 | lang: 0, | ||
9549 | list: 0, | ||
9550 | loop: HAS_BOOLEAN_VALUE, | ||
9551 | low: 0, | ||
9552 | manifest: 0, | ||
9553 | marginHeight: 0, | ||
9554 | marginWidth: 0, | ||
9555 | max: 0, | ||
9556 | maxLength: 0, | ||
9557 | media: 0, | ||
9558 | mediaGroup: 0, | ||
9559 | method: 0, | ||
9560 | min: 0, | ||
9561 | minLength: 0, | ||
9562 | // Caution; `option.selected` is not updated if `select.multiple` is | ||
9563 | // disabled with `removeAttribute`. | ||
9564 | multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
9565 | muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
9566 | name: 0, | ||
9567 | nonce: 0, | ||
9568 | noValidate: HAS_BOOLEAN_VALUE, | ||
9569 | open: HAS_BOOLEAN_VALUE, | ||
9570 | optimum: 0, | ||
9571 | pattern: 0, | ||
9572 | placeholder: 0, | ||
9573 | playsInline: HAS_BOOLEAN_VALUE, | ||
9574 | poster: 0, | ||
9575 | preload: 0, | ||
9576 | profile: 0, | ||
9577 | radioGroup: 0, | ||
9578 | readOnly: HAS_BOOLEAN_VALUE, | ||
9579 | referrerPolicy: 0, | ||
9580 | rel: 0, | ||
9581 | required: HAS_BOOLEAN_VALUE, | ||
9582 | reversed: HAS_BOOLEAN_VALUE, | ||
9583 | role: 0, | ||
9584 | rows: HAS_POSITIVE_NUMERIC_VALUE, | ||
9585 | rowSpan: HAS_NUMERIC_VALUE, | ||
9586 | sandbox: 0, | ||
9587 | scope: 0, | ||
9588 | scoped: HAS_BOOLEAN_VALUE, | ||
9589 | scrolling: 0, | ||
9590 | seamless: HAS_BOOLEAN_VALUE, | ||
9591 | selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
9592 | shape: 0, | ||
9593 | size: HAS_POSITIVE_NUMERIC_VALUE, | ||
9594 | sizes: 0, | ||
9595 | span: HAS_POSITIVE_NUMERIC_VALUE, | ||
9596 | spellCheck: 0, | ||
9597 | src: 0, | ||
9598 | srcDoc: 0, | ||
9599 | srcLang: 0, | ||
9600 | srcSet: 0, | ||
9601 | start: HAS_NUMERIC_VALUE, | ||
9602 | step: 0, | ||
9603 | style: 0, | ||
9604 | summary: 0, | ||
9605 | tabIndex: 0, | ||
9606 | target: 0, | ||
9607 | title: 0, | ||
9608 | // Setting .type throws on non-<input> tags | ||
9609 | type: 0, | ||
9610 | useMap: 0, | ||
9611 | value: 0, | ||
9612 | width: 0, | ||
9613 | wmode: 0, | ||
9614 | wrap: 0, | ||
9615 | |||
9616 | /** | ||
9617 | * RDFa Properties | ||
9618 | */ | ||
9619 | about: 0, | ||
9620 | datatype: 0, | ||
9621 | inlist: 0, | ||
9622 | prefix: 0, | ||
9623 | // property is also supported for OpenGraph in meta tags. | ||
9624 | property: 0, | ||
9625 | resource: 0, | ||
9626 | 'typeof': 0, | ||
9627 | vocab: 0, | ||
9628 | |||
9629 | /** | ||
9630 | * Non-standard Properties | ||
9631 | */ | ||
9632 | // autoCapitalize and autoCorrect are supported in Mobile Safari for | ||
9633 | // keyboard hints. | ||
9634 | autoCapitalize: 0, | ||
9635 | autoCorrect: 0, | ||
9636 | // autoSave allows WebKit/Blink to persist values of input fields on page reloads | ||
9637 | autoSave: 0, | ||
9638 | // color is for Safari mask-icon link | ||
9639 | color: 0, | ||
9640 | // itemProp, itemScope, itemType are for | ||
9641 | // Microdata support. See http://schema.org/docs/gs.html | ||
9642 | itemProp: 0, | ||
9643 | itemScope: HAS_BOOLEAN_VALUE, | ||
9644 | itemType: 0, | ||
9645 | // itemID and itemRef are for Microdata support as well but | ||
9646 | // only specified in the WHATWG spec document. See | ||
9647 | // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api | ||
9648 | itemID: 0, | ||
9649 | itemRef: 0, | ||
9650 | // results show looking glass icon and recent searches on input | ||
9651 | // search fields in WebKit/Blink | ||
9652 | results: 0, | ||
9653 | // IE-only attribute that specifies security restrictions on an iframe | ||
9654 | // as an alternative to the sandbox attribute on IE<10 | ||
9655 | security: 0, | ||
9656 | // IE-only attribute that controls focus behavior | ||
9657 | unselectable: 0 | ||
9658 | }, | ||
9659 | DOMAttributeNames: { | ||
9660 | acceptCharset: 'accept-charset', | ||
9661 | className: 'class', | ||
9662 | htmlFor: 'for', | ||
9663 | httpEquiv: 'http-equiv' | ||
9664 | }, | ||
9665 | DOMPropertyNames: {}, | ||
9666 | DOMMutationMethods: { | ||
9667 | value: function (node, value) { | ||
9668 | if (value == null) { | ||
9669 | return node.removeAttribute('value'); | ||
9670 | } | ||
9671 | |||
9672 | // Number inputs get special treatment due to some edge cases in | ||
9673 | // Chrome. Let everything else assign the value attribute as normal. | ||
9674 | // https://github.com/facebook/react/issues/7253#issuecomment-236074326 | ||
9675 | if (node.type !== 'number' || node.hasAttribute('value') === false) { | ||
9676 | node.setAttribute('value', '' + value); | ||
9677 | } else if (node.validity && !node.validity.badInput && node.ownerDocument.activeElement !== node) { | ||
9678 | // Don't assign an attribute if validation reports bad | ||
9679 | // input. Chrome will clear the value. Additionally, don't | ||
9680 | // operate on inputs that have focus, otherwise Chrome might | ||
9681 | // strip off trailing decimal places and cause the user's | ||
9682 | // cursor position to jump to the beginning of the input. | ||
9683 | // | ||
9684 | // In ReactDOMInput, we have an onBlur event that will trigger | ||
9685 | // this function again when focus is lost. | ||
9686 | node.setAttribute('value', '' + value); | ||
9687 | } | ||
9688 | } | ||
9689 | } | ||
9690 | }; | ||
9691 | |||
9692 | module.exports = HTMLDOMPropertyConfig; | ||
9693 | |||
9694 | /***/ }), | ||
9695 | /* 85 */ | ||
9696 | /***/ (function(module, exports, __webpack_require__) { | ||
9697 | |||
9698 | /** | ||
9699 | * Copyright 2013-present, Facebook, Inc. | ||
9700 | * All rights reserved. | ||
9701 | * | ||
9702 | * This source code is licensed under the BSD-style license found in the | ||
9703 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9704 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9705 | * | ||
9706 | */ | ||
9707 | |||
9708 | 'use strict'; | ||
9709 | |||
9710 | var DOMChildrenOperations = __webpack_require__(86); | ||
9711 | var ReactDOMIDOperations = __webpack_require__(97); | ||
9712 | |||
9713 | /** | ||
9714 | * Abstracts away all functionality of the reconciler that requires knowledge of | ||
9715 | * the browser context. TODO: These callers should be refactored to avoid the | ||
9716 | * need for this injection. | ||
9717 | */ | ||
9718 | var ReactComponentBrowserEnvironment = { | ||
9719 | |||
9720 | processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates, | ||
9721 | |||
9722 | replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup | ||
9723 | |||
9724 | }; | ||
9725 | |||
9726 | module.exports = ReactComponentBrowserEnvironment; | ||
9727 | |||
9728 | /***/ }), | ||
9729 | /* 86 */ | ||
9730 | /***/ (function(module, exports, __webpack_require__) { | ||
9731 | |||
9732 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
9733 | * Copyright 2013-present, Facebook, Inc. | ||
9734 | * All rights reserved. | ||
9735 | * | ||
9736 | * This source code is licensed under the BSD-style license found in the | ||
9737 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9738 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9739 | * | ||
9740 | */ | ||
9741 | |||
9742 | 'use strict'; | ||
9743 | |||
9744 | var DOMLazyTree = __webpack_require__(87); | ||
9745 | var Danger = __webpack_require__(93); | ||
9746 | var ReactDOMComponentTree = __webpack_require__(40); | ||
9747 | var ReactInstrumentation = __webpack_require__(68); | ||
9748 | |||
9749 | var createMicrosoftUnsafeLocalFunction = __webpack_require__(90); | ||
9750 | var setInnerHTML = __webpack_require__(89); | ||
9751 | var setTextContent = __webpack_require__(91); | ||
9752 | |||
9753 | function getNodeAfter(parentNode, node) { | ||
9754 | // Special case for text components, which return [open, close] comments | ||
9755 | // from getHostNode. | ||
9756 | if (Array.isArray(node)) { | ||
9757 | node = node[1]; | ||
9758 | } | ||
9759 | return node ? node.nextSibling : parentNode.firstChild; | ||
9760 | } | ||
9761 | |||
9762 | /** | ||
9763 | * Inserts `childNode` as a child of `parentNode` at the `index`. | ||
9764 | * | ||
9765 | * @param {DOMElement} parentNode Parent node in which to insert. | ||
9766 | * @param {DOMElement} childNode Child node to insert. | ||
9767 | * @param {number} index Index at which to insert the child. | ||
9768 | * @internal | ||
9769 | */ | ||
9770 | var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) { | ||
9771 | // We rely exclusively on `insertBefore(node, null)` instead of also using | ||
9772 | // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so | ||
9773 | // we are careful to use `null`.) | ||
9774 | parentNode.insertBefore(childNode, referenceNode); | ||
9775 | }); | ||
9776 | |||
9777 | function insertLazyTreeChildAt(parentNode, childTree, referenceNode) { | ||
9778 | DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode); | ||
9779 | } | ||
9780 | |||
9781 | function moveChild(parentNode, childNode, referenceNode) { | ||
9782 | if (Array.isArray(childNode)) { | ||
9783 | moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode); | ||
9784 | } else { | ||
9785 | insertChildAt(parentNode, childNode, referenceNode); | ||
9786 | } | ||
9787 | } | ||
9788 | |||
9789 | function removeChild(parentNode, childNode) { | ||
9790 | if (Array.isArray(childNode)) { | ||
9791 | var closingComment = childNode[1]; | ||
9792 | childNode = childNode[0]; | ||
9793 | removeDelimitedText(parentNode, childNode, closingComment); | ||
9794 | parentNode.removeChild(closingComment); | ||
9795 | } | ||
9796 | parentNode.removeChild(childNode); | ||
9797 | } | ||
9798 | |||
9799 | function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) { | ||
9800 | var node = openingComment; | ||
9801 | while (true) { | ||
9802 | var nextNode = node.nextSibling; | ||
9803 | insertChildAt(parentNode, node, referenceNode); | ||
9804 | if (node === closingComment) { | ||
9805 | break; | ||
9806 | } | ||
9807 | node = nextNode; | ||
9808 | } | ||
9809 | } | ||
9810 | |||
9811 | function removeDelimitedText(parentNode, startNode, closingComment) { | ||
9812 | while (true) { | ||
9813 | var node = startNode.nextSibling; | ||
9814 | if (node === closingComment) { | ||
9815 | // The closing comment is removed by ReactMultiChild. | ||
9816 | break; | ||
9817 | } else { | ||
9818 | parentNode.removeChild(node); | ||
9819 | } | ||
9820 | } | ||
9821 | } | ||
9822 | |||
9823 | function replaceDelimitedText(openingComment, closingComment, stringText) { | ||
9824 | var parentNode = openingComment.parentNode; | ||
9825 | var nodeAfterComment = openingComment.nextSibling; | ||
9826 | if (nodeAfterComment === closingComment) { | ||
9827 | // There are no text nodes between the opening and closing comments; insert | ||
9828 | // a new one if stringText isn't empty. | ||
9829 | if (stringText) { | ||
9830 | insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment); | ||
9831 | } | ||
9832 | } else { | ||
9833 | if (stringText) { | ||
9834 | // Set the text content of the first node after the opening comment, and | ||
9835 | // remove all following nodes up until the closing comment. | ||
9836 | setTextContent(nodeAfterComment, stringText); | ||
9837 | removeDelimitedText(parentNode, nodeAfterComment, closingComment); | ||
9838 | } else { | ||
9839 | removeDelimitedText(parentNode, openingComment, closingComment); | ||
9840 | } | ||
9841 | } | ||
9842 | |||
9843 | if (process.env.NODE_ENV !== 'production') { | ||
9844 | ReactInstrumentation.debugTool.onHostOperation({ | ||
9845 | instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID, | ||
9846 | type: 'replace text', | ||
9847 | payload: stringText | ||
9848 | }); | ||
9849 | } | ||
9850 | } | ||
9851 | |||
9852 | var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup; | ||
9853 | if (process.env.NODE_ENV !== 'production') { | ||
9854 | dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) { | ||
9855 | Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup); | ||
9856 | if (prevInstance._debugID !== 0) { | ||
9857 | ReactInstrumentation.debugTool.onHostOperation({ | ||
9858 | instanceID: prevInstance._debugID, | ||
9859 | type: 'replace with', | ||
9860 | payload: markup.toString() | ||
9861 | }); | ||
9862 | } else { | ||
9863 | var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node); | ||
9864 | if (nextInstance._debugID !== 0) { | ||
9865 | ReactInstrumentation.debugTool.onHostOperation({ | ||
9866 | instanceID: nextInstance._debugID, | ||
9867 | type: 'mount', | ||
9868 | payload: markup.toString() | ||
9869 | }); | ||
9870 | } | ||
9871 | } | ||
9872 | }; | ||
9873 | } | ||
9874 | |||
9875 | /** | ||
9876 | * Operations for updating with DOM children. | ||
9877 | */ | ||
9878 | var DOMChildrenOperations = { | ||
9879 | |||
9880 | dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup, | ||
9881 | |||
9882 | replaceDelimitedText: replaceDelimitedText, | ||
9883 | |||
9884 | /** | ||
9885 | * Updates a component's children by processing a series of updates. The | ||
9886 | * update configurations are each expected to have a `parentNode` property. | ||
9887 | * | ||
9888 | * @param {array<object>} updates List of update configurations. | ||
9889 | * @internal | ||
9890 | */ | ||
9891 | processUpdates: function (parentNode, updates) { | ||
9892 | if (process.env.NODE_ENV !== 'production') { | ||
9893 | var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID; | ||
9894 | } | ||
9895 | |||
9896 | for (var k = 0; k < updates.length; k++) { | ||
9897 | var update = updates[k]; | ||
9898 | switch (update.type) { | ||
9899 | case 'INSERT_MARKUP': | ||
9900 | insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode)); | ||
9901 | if (process.env.NODE_ENV !== 'production') { | ||
9902 | ReactInstrumentation.debugTool.onHostOperation({ | ||
9903 | instanceID: parentNodeDebugID, | ||
9904 | type: 'insert child', | ||
9905 | payload: { toIndex: update.toIndex, content: update.content.toString() } | ||
9906 | }); | ||
9907 | } | ||
9908 | break; | ||
9909 | case 'MOVE_EXISTING': | ||
9910 | moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode)); | ||
9911 | if (process.env.NODE_ENV !== 'production') { | ||
9912 | ReactInstrumentation.debugTool.onHostOperation({ | ||
9913 | instanceID: parentNodeDebugID, | ||
9914 | type: 'move child', | ||
9915 | payload: { fromIndex: update.fromIndex, toIndex: update.toIndex } | ||
9916 | }); | ||
9917 | } | ||
9918 | break; | ||
9919 | case 'SET_MARKUP': | ||
9920 | setInnerHTML(parentNode, update.content); | ||
9921 | if (process.env.NODE_ENV !== 'production') { | ||
9922 | ReactInstrumentation.debugTool.onHostOperation({ | ||
9923 | instanceID: parentNodeDebugID, | ||
9924 | type: 'replace children', | ||
9925 | payload: update.content.toString() | ||
9926 | }); | ||
9927 | } | ||
9928 | break; | ||
9929 | case 'TEXT_CONTENT': | ||
9930 | setTextContent(parentNode, update.content); | ||
9931 | if (process.env.NODE_ENV !== 'production') { | ||
9932 | ReactInstrumentation.debugTool.onHostOperation({ | ||
9933 | instanceID: parentNodeDebugID, | ||
9934 | type: 'replace text', | ||
9935 | payload: update.content.toString() | ||
9936 | }); | ||
9937 | } | ||
9938 | break; | ||
9939 | case 'REMOVE_NODE': | ||
9940 | removeChild(parentNode, update.fromNode); | ||
9941 | if (process.env.NODE_ENV !== 'production') { | ||
9942 | ReactInstrumentation.debugTool.onHostOperation({ | ||
9943 | instanceID: parentNodeDebugID, | ||
9944 | type: 'remove child', | ||
9945 | payload: { fromIndex: update.fromIndex } | ||
9946 | }); | ||
9947 | } | ||
9948 | break; | ||
9949 | } | ||
9950 | } | ||
9951 | } | ||
9952 | |||
9953 | }; | ||
9954 | |||
9955 | module.exports = DOMChildrenOperations; | ||
9956 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
9957 | |||
9958 | /***/ }), | ||
9959 | /* 87 */ | ||
9960 | /***/ (function(module, exports, __webpack_require__) { | ||
9961 | |||
9962 | /** | ||
9963 | * Copyright 2015-present, Facebook, Inc. | ||
9964 | * All rights reserved. | ||
9965 | * | ||
9966 | * This source code is licensed under the BSD-style license found in the | ||
9967 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9968 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9969 | * | ||
9970 | */ | ||
9971 | |||
9972 | 'use strict'; | ||
9973 | |||
9974 | var DOMNamespaces = __webpack_require__(88); | ||
9975 | var setInnerHTML = __webpack_require__(89); | ||
9976 | |||
9977 | var createMicrosoftUnsafeLocalFunction = __webpack_require__(90); | ||
9978 | var setTextContent = __webpack_require__(91); | ||
9979 | |||
9980 | var ELEMENT_NODE_TYPE = 1; | ||
9981 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11; | ||
9982 | |||
9983 | /** | ||
9984 | * In IE (8-11) and Edge, appending nodes with no children is dramatically | ||
9985 | * faster than appending a full subtree, so we essentially queue up the | ||
9986 | * .appendChild calls here and apply them so each node is added to its parent | ||
9987 | * before any children are added. | ||
9988 | * | ||
9989 | * In other browsers, doing so is slower or neutral compared to the other order | ||
9990 | * (in Firefox, twice as slow) so we only do this inversion in IE. | ||
9991 | * | ||
9992 | * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode. | ||
9993 | */ | ||
9994 | var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent); | ||
9995 | |||
9996 | function insertTreeChildren(tree) { | ||
9997 | if (!enableLazy) { | ||
9998 | return; | ||
9999 | } | ||
10000 | var node = tree.node; | ||
10001 | var children = tree.children; | ||
10002 | if (children.length) { | ||
10003 | for (var i = 0; i < children.length; i++) { | ||
10004 | insertTreeBefore(node, children[i], null); | ||
10005 | } | ||
10006 | } else if (tree.html != null) { | ||
10007 | setInnerHTML(node, tree.html); | ||
10008 | } else if (tree.text != null) { | ||
10009 | setTextContent(node, tree.text); | ||
10010 | } | ||
10011 | } | ||
10012 | |||
10013 | var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) { | ||
10014 | // DocumentFragments aren't actually part of the DOM after insertion so | ||
10015 | // appending children won't update the DOM. We need to ensure the fragment | ||
10016 | // is properly populated first, breaking out of our lazy approach for just | ||
10017 | // this level. Also, some <object> plugins (like Flash Player) will read | ||
10018 | // <param> nodes immediately upon insertion into the DOM, so <object> | ||
10019 | // must also be populated prior to insertion into the DOM. | ||
10020 | if (tree.node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE || tree.node.nodeType === ELEMENT_NODE_TYPE && tree.node.nodeName.toLowerCase() === 'object' && (tree.node.namespaceURI == null || tree.node.namespaceURI === DOMNamespaces.html)) { | ||
10021 | insertTreeChildren(tree); | ||
10022 | parentNode.insertBefore(tree.node, referenceNode); | ||
10023 | } else { | ||
10024 | parentNode.insertBefore(tree.node, referenceNode); | ||
10025 | insertTreeChildren(tree); | ||
10026 | } | ||
10027 | }); | ||
10028 | |||
10029 | function replaceChildWithTree(oldNode, newTree) { | ||
10030 | oldNode.parentNode.replaceChild(newTree.node, oldNode); | ||
10031 | insertTreeChildren(newTree); | ||
10032 | } | ||
10033 | |||
10034 | function queueChild(parentTree, childTree) { | ||
10035 | if (enableLazy) { | ||
10036 | parentTree.children.push(childTree); | ||
10037 | } else { | ||
10038 | parentTree.node.appendChild(childTree.node); | ||
10039 | } | ||
10040 | } | ||
10041 | |||
10042 | function queueHTML(tree, html) { | ||
10043 | if (enableLazy) { | ||
10044 | tree.html = html; | ||
10045 | } else { | ||
10046 | setInnerHTML(tree.node, html); | ||
10047 | } | ||
10048 | } | ||
10049 | |||
10050 | function queueText(tree, text) { | ||
10051 | if (enableLazy) { | ||
10052 | tree.text = text; | ||
10053 | } else { | ||
10054 | setTextContent(tree.node, text); | ||
10055 | } | ||
10056 | } | ||
10057 | |||
10058 | function toString() { | ||
10059 | return this.node.nodeName; | ||
10060 | } | ||
10061 | |||
10062 | function DOMLazyTree(node) { | ||
10063 | return { | ||
10064 | node: node, | ||
10065 | children: [], | ||
10066 | html: null, | ||
10067 | text: null, | ||
10068 | toString: toString | ||
10069 | }; | ||
10070 | } | ||
10071 | |||
10072 | DOMLazyTree.insertTreeBefore = insertTreeBefore; | ||
10073 | DOMLazyTree.replaceChildWithTree = replaceChildWithTree; | ||
10074 | DOMLazyTree.queueChild = queueChild; | ||
10075 | DOMLazyTree.queueHTML = queueHTML; | ||
10076 | DOMLazyTree.queueText = queueText; | ||
10077 | |||
10078 | module.exports = DOMLazyTree; | ||
10079 | |||
10080 | /***/ }), | ||
10081 | /* 88 */ | ||
10082 | /***/ (function(module, exports) { | ||
10083 | |||
10084 | /** | ||
10085 | * Copyright 2013-present, Facebook, Inc. | ||
10086 | * All rights reserved. | ||
10087 | * | ||
10088 | * This source code is licensed under the BSD-style license found in the | ||
10089 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10090 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10091 | * | ||
10092 | */ | ||
10093 | |||
10094 | 'use strict'; | ||
10095 | |||
10096 | var DOMNamespaces = { | ||
10097 | html: 'http://www.w3.org/1999/xhtml', | ||
10098 | mathml: 'http://www.w3.org/1998/Math/MathML', | ||
10099 | svg: 'http://www.w3.org/2000/svg' | ||
10100 | }; | ||
10101 | |||
10102 | module.exports = DOMNamespaces; | ||
10103 | |||
10104 | /***/ }), | ||
10105 | /* 89 */ | ||
10106 | /***/ (function(module, exports, __webpack_require__) { | ||
10107 | |||
10108 | /** | ||
10109 | * Copyright 2013-present, Facebook, Inc. | ||
10110 | * All rights reserved. | ||
10111 | * | ||
10112 | * This source code is licensed under the BSD-style license found in the | ||
10113 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10114 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10115 | * | ||
10116 | */ | ||
10117 | |||
10118 | 'use strict'; | ||
10119 | |||
10120 | var ExecutionEnvironment = __webpack_require__(54); | ||
10121 | var DOMNamespaces = __webpack_require__(88); | ||
10122 | |||
10123 | var WHITESPACE_TEST = /^[ \r\n\t\f]/; | ||
10124 | var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; | ||
10125 | |||
10126 | var createMicrosoftUnsafeLocalFunction = __webpack_require__(90); | ||
10127 | |||
10128 | // SVG temp container for IE lacking innerHTML | ||
10129 | var reusableSVGContainer; | ||
10130 | |||
10131 | /** | ||
10132 | * Set the innerHTML property of a node, ensuring that whitespace is preserved | ||
10133 | * even in IE8. | ||
10134 | * | ||
10135 | * @param {DOMElement} node | ||
10136 | * @param {string} html | ||
10137 | * @internal | ||
10138 | */ | ||
10139 | var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) { | ||
10140 | // IE does not have innerHTML for SVG nodes, so instead we inject the | ||
10141 | // new markup in a temp node and then move the child nodes across into | ||
10142 | // the target node | ||
10143 | if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) { | ||
10144 | reusableSVGContainer = reusableSVGContainer || document.createElement('div'); | ||
10145 | reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>'; | ||
10146 | var svgNode = reusableSVGContainer.firstChild; | ||
10147 | while (svgNode.firstChild) { | ||
10148 | node.appendChild(svgNode.firstChild); | ||
10149 | } | ||
10150 | } else { | ||
10151 | node.innerHTML = html; | ||
10152 | } | ||
10153 | }); | ||
10154 | |||
10155 | if (ExecutionEnvironment.canUseDOM) { | ||
10156 | // IE8: When updating a just created node with innerHTML only leading | ||
10157 | // whitespace is removed. When updating an existing node with innerHTML | ||
10158 | // whitespace in root TextNodes is also collapsed. | ||
10159 | // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html | ||
10160 | |||
10161 | // Feature detection; only IE8 is known to behave improperly like this. | ||
10162 | var testElement = document.createElement('div'); | ||
10163 | testElement.innerHTML = ' '; | ||
10164 | if (testElement.innerHTML === '') { | ||
10165 | setInnerHTML = function (node, html) { | ||
10166 | // Magic theory: IE8 supposedly differentiates between added and updated | ||
10167 | // nodes when processing innerHTML, innerHTML on updated nodes suffers | ||
10168 | // from worse whitespace behavior. Re-adding a node like this triggers | ||
10169 | // the initial and more favorable whitespace behavior. | ||
10170 | // TODO: What to do on a detached node? | ||
10171 | if (node.parentNode) { | ||
10172 | node.parentNode.replaceChild(node, node); | ||
10173 | } | ||
10174 | |||
10175 | // We also implement a workaround for non-visible tags disappearing into | ||
10176 | // thin air on IE8, this only happens if there is no visible text | ||
10177 | // in-front of the non-visible tags. Piggyback on the whitespace fix | ||
10178 | // and simply check if any non-visible tags appear in the source. | ||
10179 | if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) { | ||
10180 | // Recover leading whitespace by temporarily prepending any character. | ||
10181 | // \uFEFF has the potential advantage of being zero-width/invisible. | ||
10182 | // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode | ||
10183 | // in hopes that this is preserved even if "\uFEFF" is transformed to | ||
10184 | // the actual Unicode character (by Babel, for example). | ||
10185 | // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216 | ||
10186 | node.innerHTML = String.fromCharCode(0xFEFF) + html; | ||
10187 | |||
10188 | // deleteData leaves an empty `TextNode` which offsets the index of all | ||
10189 | // children. Definitely want to avoid this. | ||
10190 | var textNode = node.firstChild; | ||
10191 | if (textNode.data.length === 1) { | ||
10192 | node.removeChild(textNode); | ||
10193 | } else { | ||
10194 | textNode.deleteData(0, 1); | ||
10195 | } | ||
10196 | } else { | ||
10197 | node.innerHTML = html; | ||
10198 | } | ||
10199 | }; | ||
10200 | } | ||
10201 | testElement = null; | ||
10202 | } | ||
10203 | |||
10204 | module.exports = setInnerHTML; | ||
10205 | |||
10206 | /***/ }), | ||
10207 | /* 90 */ | ||
10208 | /***/ (function(module, exports) { | ||
10209 | |||
10210 | /** | ||
10211 | * Copyright 2013-present, Facebook, Inc. | ||
10212 | * All rights reserved. | ||
10213 | * | ||
10214 | * This source code is licensed under the BSD-style license found in the | ||
10215 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10216 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10217 | * | ||
10218 | */ | ||
10219 | |||
10220 | /* globals MSApp */ | ||
10221 | |||
10222 | 'use strict'; | ||
10223 | |||
10224 | /** | ||
10225 | * Create a function which has 'unsafe' privileges (required by windows8 apps) | ||
10226 | */ | ||
10227 | |||
10228 | var createMicrosoftUnsafeLocalFunction = function (func) { | ||
10229 | if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { | ||
10230 | return function (arg0, arg1, arg2, arg3) { | ||
10231 | MSApp.execUnsafeLocalFunction(function () { | ||
10232 | return func(arg0, arg1, arg2, arg3); | ||
10233 | }); | ||
10234 | }; | ||
10235 | } else { | ||
10236 | return func; | ||
10237 | } | ||
10238 | }; | ||
10239 | |||
10240 | module.exports = createMicrosoftUnsafeLocalFunction; | ||
10241 | |||
10242 | /***/ }), | ||
10243 | /* 91 */ | ||
10244 | /***/ (function(module, exports, __webpack_require__) { | ||
10245 | |||
10246 | /** | ||
10247 | * Copyright 2013-present, Facebook, Inc. | ||
10248 | * All rights reserved. | ||
10249 | * | ||
10250 | * This source code is licensed under the BSD-style license found in the | ||
10251 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10252 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10253 | * | ||
10254 | */ | ||
10255 | |||
10256 | 'use strict'; | ||
10257 | |||
10258 | var ExecutionEnvironment = __webpack_require__(54); | ||
10259 | var escapeTextContentForBrowser = __webpack_require__(92); | ||
10260 | var setInnerHTML = __webpack_require__(89); | ||
10261 | |||
10262 | /** | ||
10263 | * Set the textContent property of a node, ensuring that whitespace is preserved | ||
10264 | * even in IE8. innerText is a poor substitute for textContent and, among many | ||
10265 | * issues, inserts <br> instead of the literal newline chars. innerHTML behaves | ||
10266 | * as it should. | ||
10267 | * | ||
10268 | * @param {DOMElement} node | ||
10269 | * @param {string} text | ||
10270 | * @internal | ||
10271 | */ | ||
10272 | var setTextContent = function (node, text) { | ||
10273 | if (text) { | ||
10274 | var firstChild = node.firstChild; | ||
10275 | |||
10276 | if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) { | ||
10277 | firstChild.nodeValue = text; | ||
10278 | return; | ||
10279 | } | ||
10280 | } | ||
10281 | node.textContent = text; | ||
10282 | }; | ||
10283 | |||
10284 | if (ExecutionEnvironment.canUseDOM) { | ||
10285 | if (!('textContent' in document.documentElement)) { | ||
10286 | setTextContent = function (node, text) { | ||
10287 | if (node.nodeType === 3) { | ||
10288 | node.nodeValue = text; | ||
10289 | return; | ||
10290 | } | ||
10291 | setInnerHTML(node, escapeTextContentForBrowser(text)); | ||
10292 | }; | ||
10293 | } | ||
10294 | } | ||
10295 | |||
10296 | module.exports = setTextContent; | ||
10297 | |||
10298 | /***/ }), | ||
10299 | /* 92 */ | ||
10300 | /***/ (function(module, exports) { | ||
10301 | |||
10302 | /** | ||
10303 | * Copyright 2016-present, Facebook, Inc. | ||
10304 | * All rights reserved. | ||
10305 | * | ||
10306 | * This source code is licensed under the BSD-style license found in the | ||
10307 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10308 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10309 | * | ||
10310 | * Based on the escape-html library, which is used under the MIT License below: | ||
10311 | * | ||
10312 | * Copyright (c) 2012-2013 TJ Holowaychuk | ||
10313 | * Copyright (c) 2015 Andreas Lubbe | ||
10314 | * Copyright (c) 2015 Tiancheng "Timothy" Gu | ||
10315 | * | ||
10316 | * Permission is hereby granted, free of charge, to any person obtaining | ||
10317 | * a copy of this software and associated documentation files (the | ||
10318 | * 'Software'), to deal in the Software without restriction, including | ||
10319 | * without limitation the rights to use, copy, modify, merge, publish, | ||
10320 | * distribute, sublicense, and/or sell copies of the Software, and to | ||
10321 | * permit persons to whom the Software is furnished to do so, subject to | ||
10322 | * the following conditions: | ||
10323 | * | ||
10324 | * The above copyright notice and this permission notice shall be | ||
10325 | * included in all copies or substantial portions of the Software. | ||
10326 | * | ||
10327 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||
10328 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
10329 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
10330 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
10331 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
10332 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
10333 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
10334 | * | ||
10335 | */ | ||
10336 | |||
10337 | 'use strict'; | ||
10338 | |||
10339 | // code copied and modified from escape-html | ||
10340 | /** | ||
10341 | * Module variables. | ||
10342 | * @private | ||
10343 | */ | ||
10344 | |||
10345 | var matchHtmlRegExp = /["'&<>]/; | ||
10346 | |||
10347 | /** | ||
10348 | * Escape special characters in the given string of html. | ||
10349 | * | ||
10350 | * @param {string} string The string to escape for inserting into HTML | ||
10351 | * @return {string} | ||
10352 | * @public | ||
10353 | */ | ||
10354 | |||
10355 | function escapeHtml(string) { | ||
10356 | var str = '' + string; | ||
10357 | var match = matchHtmlRegExp.exec(str); | ||
10358 | |||
10359 | if (!match) { | ||
10360 | return str; | ||
10361 | } | ||
10362 | |||
10363 | var escape; | ||
10364 | var html = ''; | ||
10365 | var index = 0; | ||
10366 | var lastIndex = 0; | ||
10367 | |||
10368 | for (index = match.index; index < str.length; index++) { | ||
10369 | switch (str.charCodeAt(index)) { | ||
10370 | case 34: | ||
10371 | // " | ||
10372 | escape = '"'; | ||
10373 | break; | ||
10374 | case 38: | ||
10375 | // & | ||
10376 | escape = '&'; | ||
10377 | break; | ||
10378 | case 39: | ||
10379 | // ' | ||
10380 | escape = '''; // modified from escape-html; used to be ''' | ||
10381 | break; | ||
10382 | case 60: | ||
10383 | // < | ||
10384 | escape = '<'; | ||
10385 | break; | ||
10386 | case 62: | ||
10387 | // > | ||
10388 | escape = '>'; | ||
10389 | break; | ||
10390 | default: | ||
10391 | continue; | ||
10392 | } | ||
10393 | |||
10394 | if (lastIndex !== index) { | ||
10395 | html += str.substring(lastIndex, index); | ||
10396 | } | ||
10397 | |||
10398 | lastIndex = index + 1; | ||
10399 | html += escape; | ||
10400 | } | ||
10401 | |||
10402 | return lastIndex !== index ? html + str.substring(lastIndex, index) : html; | ||
10403 | } | ||
10404 | // end code copied and modified from escape-html | ||
10405 | |||
10406 | |||
10407 | /** | ||
10408 | * Escapes text to prevent scripting attacks. | ||
10409 | * | ||
10410 | * @param {*} text Text value to escape. | ||
10411 | * @return {string} An escaped string. | ||
10412 | */ | ||
10413 | function escapeTextContentForBrowser(text) { | ||
10414 | if (typeof text === 'boolean' || typeof text === 'number') { | ||
10415 | // this shortcircuit helps perf for types that we know will never have | ||
10416 | // special characters, especially given that this function is used often | ||
10417 | // for numeric dom ids. | ||
10418 | return '' + text; | ||
10419 | } | ||
10420 | return escapeHtml(text); | ||
10421 | } | ||
10422 | |||
10423 | module.exports = escapeTextContentForBrowser; | ||
10424 | |||
10425 | /***/ }), | ||
10426 | /* 93 */ | ||
10427 | /***/ (function(module, exports, __webpack_require__) { | ||
10428 | |||
10429 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
10430 | * Copyright 2013-present, Facebook, Inc. | ||
10431 | * All rights reserved. | ||
10432 | * | ||
10433 | * This source code is licensed under the BSD-style license found in the | ||
10434 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10435 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10436 | * | ||
10437 | */ | ||
10438 | |||
10439 | 'use strict'; | ||
10440 | |||
10441 | var _prodInvariant = __webpack_require__(41); | ||
10442 | |||
10443 | var DOMLazyTree = __webpack_require__(87); | ||
10444 | var ExecutionEnvironment = __webpack_require__(54); | ||
10445 | |||
10446 | var createNodesFromMarkup = __webpack_require__(94); | ||
10447 | var emptyFunction = __webpack_require__(14); | ||
10448 | var invariant = __webpack_require__(10); | ||
10449 | |||
10450 | var Danger = { | ||
10451 | |||
10452 | /** | ||
10453 | * Replaces a node with a string of markup at its current position within its | ||
10454 | * parent. The markup must render into a single root node. | ||
10455 | * | ||
10456 | * @param {DOMElement} oldChild Child node to replace. | ||
10457 | * @param {string} markup Markup to render in place of the child node. | ||
10458 | * @internal | ||
10459 | */ | ||
10460 | dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) { | ||
10461 | !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('56') : void 0; | ||
10462 | !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0; | ||
10463 | !(oldChild.nodeName !== 'HTML') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the <html> node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString().') : _prodInvariant('58') : void 0; | ||
10464 | |||
10465 | if (typeof markup === 'string') { | ||
10466 | var newChild = createNodesFromMarkup(markup, emptyFunction)[0]; | ||
10467 | oldChild.parentNode.replaceChild(newChild, oldChild); | ||
10468 | } else { | ||
10469 | DOMLazyTree.replaceChildWithTree(oldChild, markup); | ||
10470 | } | ||
10471 | } | ||
10472 | |||
10473 | }; | ||
10474 | |||
10475 | module.exports = Danger; | ||
10476 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
10477 | |||
10478 | /***/ }), | ||
10479 | /* 94 */ | ||
10480 | /***/ (function(module, exports, __webpack_require__) { | ||
10481 | |||
10482 | /* WEBPACK VAR INJECTION */(function(process) {'use strict'; | ||
10483 | |||
10484 | /** | ||
10485 | * Copyright (c) 2013-present, Facebook, Inc. | ||
10486 | * All rights reserved. | ||
10487 | * | ||
10488 | * This source code is licensed under the BSD-style license found in the | ||
10489 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10490 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10491 | * | ||
10492 | * @typechecks | ||
10493 | */ | ||
10494 | |||
10495 | /*eslint-disable fb-www/unsafe-html*/ | ||
10496 | |||
10497 | var ExecutionEnvironment = __webpack_require__(54); | ||
10498 | |||
10499 | var createArrayFromMixed = __webpack_require__(95); | ||
10500 | var getMarkupWrap = __webpack_require__(96); | ||
10501 | var invariant = __webpack_require__(10); | ||
10502 | |||
10503 | /** | ||
10504 | * Dummy container used to render all markup. | ||
10505 | */ | ||
10506 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; | ||
10507 | |||
10508 | /** | ||
10509 | * Pattern used by `getNodeName`. | ||
10510 | */ | ||
10511 | var nodeNamePattern = /^\s*<(\w+)/; | ||
10512 | |||
10513 | /** | ||
10514 | * Extracts the `nodeName` of the first element in a string of markup. | ||
10515 | * | ||
10516 | * @param {string} markup String of markup. | ||
10517 | * @return {?string} Node name of the supplied markup. | ||
10518 | */ | ||
10519 | function getNodeName(markup) { | ||
10520 | var nodeNameMatch = markup.match(nodeNamePattern); | ||
10521 | return nodeNameMatch && nodeNameMatch[1].toLowerCase(); | ||
10522 | } | ||
10523 | |||
10524 | /** | ||
10525 | * Creates an array containing the nodes rendered from the supplied markup. The | ||
10526 | * optionally supplied `handleScript` function will be invoked once for each | ||
10527 | * <script> element that is rendered. If no `handleScript` function is supplied, | ||
10528 | * an exception is thrown if any <script> elements are rendered. | ||
10529 | * | ||
10530 | * @param {string} markup A string of valid HTML markup. | ||
10531 | * @param {?function} handleScript Invoked once for each rendered <script>. | ||
10532 | * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes. | ||
10533 | */ | ||
10534 | function createNodesFromMarkup(markup, handleScript) { | ||
10535 | var node = dummyNode; | ||
10536 | !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0; | ||
10537 | var nodeName = getNodeName(markup); | ||
10538 | |||
10539 | var wrap = nodeName && getMarkupWrap(nodeName); | ||
10540 | if (wrap) { | ||
10541 | node.innerHTML = wrap[1] + markup + wrap[2]; | ||
10542 | |||
10543 | var wrapDepth = wrap[0]; | ||
10544 | while (wrapDepth--) { | ||
10545 | node = node.lastChild; | ||
10546 | } | ||
10547 | } else { | ||
10548 | node.innerHTML = markup; | ||
10549 | } | ||
10550 | |||
10551 | var scripts = node.getElementsByTagName('script'); | ||
10552 | if (scripts.length) { | ||
10553 | !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0; | ||
10554 | createArrayFromMixed(scripts).forEach(handleScript); | ||
10555 | } | ||
10556 | |||
10557 | var nodes = Array.from(node.childNodes); | ||
10558 | while (node.lastChild) { | ||
10559 | node.removeChild(node.lastChild); | ||
10560 | } | ||
10561 | return nodes; | ||
10562 | } | ||
10563 | |||
10564 | module.exports = createNodesFromMarkup; | ||
10565 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
10566 | |||
10567 | /***/ }), | ||
10568 | /* 95 */ | ||
10569 | /***/ (function(module, exports, __webpack_require__) { | ||
10570 | |||
10571 | /* WEBPACK VAR INJECTION */(function(process) {'use strict'; | ||
10572 | |||
10573 | /** | ||
10574 | * Copyright (c) 2013-present, Facebook, Inc. | ||
10575 | * All rights reserved. | ||
10576 | * | ||
10577 | * This source code is licensed under the BSD-style license found in the | ||
10578 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10579 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10580 | * | ||
10581 | * @typechecks | ||
10582 | */ | ||
10583 | |||
10584 | var invariant = __webpack_require__(10); | ||
10585 | |||
10586 | /** | ||
10587 | * Convert array-like objects to arrays. | ||
10588 | * | ||
10589 | * This API assumes the caller knows the contents of the data type. For less | ||
10590 | * well defined inputs use createArrayFromMixed. | ||
10591 | * | ||
10592 | * @param {object|function|filelist} obj | ||
10593 | * @return {array} | ||
10594 | */ | ||
10595 | function toArray(obj) { | ||
10596 | var length = obj.length; | ||
10597 | |||
10598 | // Some browsers builtin objects can report typeof 'function' (e.g. NodeList | ||
10599 | // in old versions of Safari). | ||
10600 | !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0; | ||
10601 | |||
10602 | !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0; | ||
10603 | |||
10604 | !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0; | ||
10605 | |||
10606 | !(typeof obj.callee !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0; | ||
10607 | |||
10608 | // Old IE doesn't give collections access to hasOwnProperty. Assume inputs | ||
10609 | // without method will throw during the slice call and skip straight to the | ||
10610 | // fallback. | ||
10611 | if (obj.hasOwnProperty) { | ||
10612 | try { | ||
10613 | return Array.prototype.slice.call(obj); | ||
10614 | } catch (e) { | ||
10615 | // IE < 9 does not support Array#slice on collections objects | ||
10616 | } | ||
10617 | } | ||
10618 | |||
10619 | // Fall back to copying key by key. This assumes all keys have a value, | ||
10620 | // so will not preserve sparsely populated inputs. | ||
10621 | var ret = Array(length); | ||
10622 | for (var ii = 0; ii < length; ii++) { | ||
10623 | ret[ii] = obj[ii]; | ||
10624 | } | ||
10625 | return ret; | ||
10626 | } | ||
10627 | |||
10628 | /** | ||
10629 | * Perform a heuristic test to determine if an object is "array-like". | ||
10630 | * | ||
10631 | * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" | ||
10632 | * Joshu replied: "Mu." | ||
10633 | * | ||
10634 | * This function determines if its argument has "array nature": it returns | ||
10635 | * true if the argument is an actual array, an `arguments' object, or an | ||
10636 | * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). | ||
10637 | * | ||
10638 | * It will return false for other array-like objects like Filelist. | ||
10639 | * | ||
10640 | * @param {*} obj | ||
10641 | * @return {boolean} | ||
10642 | */ | ||
10643 | function hasArrayNature(obj) { | ||
10644 | return ( | ||
10645 | // not null/false | ||
10646 | !!obj && ( | ||
10647 | // arrays are objects, NodeLists are functions in Safari | ||
10648 | typeof obj == 'object' || typeof obj == 'function') && | ||
10649 | // quacks like an array | ||
10650 | 'length' in obj && | ||
10651 | // not window | ||
10652 | !('setInterval' in obj) && | ||
10653 | // no DOM node should be considered an array-like | ||
10654 | // a 'select' element has 'length' and 'item' properties on IE8 | ||
10655 | typeof obj.nodeType != 'number' && ( | ||
10656 | // a real array | ||
10657 | Array.isArray(obj) || | ||
10658 | // arguments | ||
10659 | 'callee' in obj || | ||
10660 | // HTMLCollection/NodeList | ||
10661 | 'item' in obj) | ||
10662 | ); | ||
10663 | } | ||
10664 | |||
10665 | /** | ||
10666 | * Ensure that the argument is an array by wrapping it in an array if it is not. | ||
10667 | * Creates a copy of the argument if it is already an array. | ||
10668 | * | ||
10669 | * This is mostly useful idiomatically: | ||
10670 | * | ||
10671 | * var createArrayFromMixed = require('createArrayFromMixed'); | ||
10672 | * | ||
10673 | * function takesOneOrMoreThings(things) { | ||
10674 | * things = createArrayFromMixed(things); | ||
10675 | * ... | ||
10676 | * } | ||
10677 | * | ||
10678 | * This allows you to treat `things' as an array, but accept scalars in the API. | ||
10679 | * | ||
10680 | * If you need to convert an array-like object, like `arguments`, into an array | ||
10681 | * use toArray instead. | ||
10682 | * | ||
10683 | * @param {*} obj | ||
10684 | * @return {array} | ||
10685 | */ | ||
10686 | function createArrayFromMixed(obj) { | ||
10687 | if (!hasArrayNature(obj)) { | ||
10688 | return [obj]; | ||
10689 | } else if (Array.isArray(obj)) { | ||
10690 | return obj.slice(); | ||
10691 | } else { | ||
10692 | return toArray(obj); | ||
10693 | } | ||
10694 | } | ||
10695 | |||
10696 | module.exports = createArrayFromMixed; | ||
10697 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
10698 | |||
10699 | /***/ }), | ||
10700 | /* 96 */ | ||
10701 | /***/ (function(module, exports, __webpack_require__) { | ||
10702 | |||
10703 | /* WEBPACK VAR INJECTION */(function(process) {'use strict'; | ||
10704 | |||
10705 | /** | ||
10706 | * Copyright (c) 2013-present, Facebook, Inc. | ||
10707 | * All rights reserved. | ||
10708 | * | ||
10709 | * This source code is licensed under the BSD-style license found in the | ||
10710 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10711 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10712 | * | ||
10713 | */ | ||
10714 | |||
10715 | /*eslint-disable fb-www/unsafe-html */ | ||
10716 | |||
10717 | var ExecutionEnvironment = __webpack_require__(54); | ||
10718 | |||
10719 | var invariant = __webpack_require__(10); | ||
10720 | |||
10721 | /** | ||
10722 | * Dummy container used to detect which wraps are necessary. | ||
10723 | */ | ||
10724 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; | ||
10725 | |||
10726 | /** | ||
10727 | * Some browsers cannot use `innerHTML` to render certain elements standalone, | ||
10728 | * so we wrap them, render the wrapped nodes, then extract the desired node. | ||
10729 | * | ||
10730 | * In IE8, certain elements cannot render alone, so wrap all elements ('*'). | ||
10731 | */ | ||
10732 | |||
10733 | var shouldWrap = {}; | ||
10734 | |||
10735 | var selectWrap = [1, '<select multiple="true">', '</select>']; | ||
10736 | var tableWrap = [1, '<table>', '</table>']; | ||
10737 | var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>']; | ||
10738 | |||
10739 | var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>']; | ||
10740 | |||
10741 | var markupWrap = { | ||
10742 | '*': [1, '?<div>', '</div>'], | ||
10743 | |||
10744 | 'area': [1, '<map>', '</map>'], | ||
10745 | 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'], | ||
10746 | 'legend': [1, '<fieldset>', '</fieldset>'], | ||
10747 | 'param': [1, '<object>', '</object>'], | ||
10748 | 'tr': [2, '<table><tbody>', '</tbody></table>'], | ||
10749 | |||
10750 | 'optgroup': selectWrap, | ||
10751 | 'option': selectWrap, | ||
10752 | |||
10753 | 'caption': tableWrap, | ||
10754 | 'colgroup': tableWrap, | ||
10755 | 'tbody': tableWrap, | ||
10756 | 'tfoot': tableWrap, | ||
10757 | 'thead': tableWrap, | ||
10758 | |||
10759 | 'td': trWrap, | ||
10760 | 'th': trWrap | ||
10761 | }; | ||
10762 | |||
10763 | // Initialize the SVG elements since we know they'll always need to be wrapped | ||
10764 | // consistently. If they are created inside a <div> they will be initialized in | ||
10765 | // the wrong namespace (and will not display). | ||
10766 | var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan']; | ||
10767 | svgElements.forEach(function (nodeName) { | ||
10768 | markupWrap[nodeName] = svgWrap; | ||
10769 | shouldWrap[nodeName] = true; | ||
10770 | }); | ||
10771 | |||
10772 | /** | ||
10773 | * Gets the markup wrap configuration for the supplied `nodeName`. | ||
10774 | * | ||
10775 | * NOTE: This lazily detects which wraps are necessary for the current browser. | ||
10776 | * | ||
10777 | * @param {string} nodeName Lowercase `nodeName`. | ||
10778 | * @return {?array} Markup wrap configuration, if applicable. | ||
10779 | */ | ||
10780 | function getMarkupWrap(nodeName) { | ||
10781 | !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0; | ||
10782 | if (!markupWrap.hasOwnProperty(nodeName)) { | ||
10783 | nodeName = '*'; | ||
10784 | } | ||
10785 | if (!shouldWrap.hasOwnProperty(nodeName)) { | ||
10786 | if (nodeName === '*') { | ||
10787 | dummyNode.innerHTML = '<link />'; | ||
10788 | } else { | ||
10789 | dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>'; | ||
10790 | } | ||
10791 | shouldWrap[nodeName] = !dummyNode.firstChild; | ||
10792 | } | ||
10793 | return shouldWrap[nodeName] ? markupWrap[nodeName] : null; | ||
10794 | } | ||
10795 | |||
10796 | module.exports = getMarkupWrap; | ||
10797 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
10798 | |||
10799 | /***/ }), | ||
10800 | /* 97 */ | ||
10801 | /***/ (function(module, exports, __webpack_require__) { | ||
10802 | |||
10803 | /** | ||
10804 | * Copyright 2013-present, Facebook, Inc. | ||
10805 | * All rights reserved. | ||
10806 | * | ||
10807 | * This source code is licensed under the BSD-style license found in the | ||
10808 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10809 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10810 | * | ||
10811 | */ | ||
10812 | |||
10813 | 'use strict'; | ||
10814 | |||
10815 | var DOMChildrenOperations = __webpack_require__(86); | ||
10816 | var ReactDOMComponentTree = __webpack_require__(40); | ||
10817 | |||
10818 | /** | ||
10819 | * Operations used to process updates to DOM nodes. | ||
10820 | */ | ||
10821 | var ReactDOMIDOperations = { | ||
10822 | |||
10823 | /** | ||
10824 | * Updates a component's children by processing a series of updates. | ||
10825 | * | ||
10826 | * @param {array<object>} updates List of update configurations. | ||
10827 | * @internal | ||
10828 | */ | ||
10829 | dangerouslyProcessChildrenUpdates: function (parentInst, updates) { | ||
10830 | var node = ReactDOMComponentTree.getNodeFromInstance(parentInst); | ||
10831 | DOMChildrenOperations.processUpdates(node, updates); | ||
10832 | } | ||
10833 | }; | ||
10834 | |||
10835 | module.exports = ReactDOMIDOperations; | ||
10836 | |||
10837 | /***/ }), | ||
10838 | /* 98 */ | ||
10839 | /***/ (function(module, exports, __webpack_require__) { | ||
10840 | |||
10841 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
10842 | * Copyright 2013-present, Facebook, Inc. | ||
10843 | * All rights reserved. | ||
10844 | * | ||
10845 | * This source code is licensed under the BSD-style license found in the | ||
10846 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10847 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10848 | * | ||
10849 | */ | ||
10850 | |||
10851 | /* global hasOwnProperty:true */ | ||
10852 | |||
10853 | 'use strict'; | ||
10854 | |||
10855 | var _prodInvariant = __webpack_require__(41), | ||
10856 | _assign = __webpack_require__(6); | ||
10857 | |||
10858 | var AutoFocusUtils = __webpack_require__(99); | ||
10859 | var CSSPropertyOperations = __webpack_require__(101); | ||
10860 | var DOMLazyTree = __webpack_require__(87); | ||
10861 | var DOMNamespaces = __webpack_require__(88); | ||
10862 | var DOMProperty = __webpack_require__(42); | ||
10863 | var DOMPropertyOperations = __webpack_require__(109); | ||
10864 | var EventPluginHub = __webpack_require__(48); | ||
10865 | var EventPluginRegistry = __webpack_require__(49); | ||
10866 | var ReactBrowserEventEmitter = __webpack_require__(111); | ||
10867 | var ReactDOMComponentFlags = __webpack_require__(43); | ||
10868 | var ReactDOMComponentTree = __webpack_require__(40); | ||
10869 | var ReactDOMInput = __webpack_require__(114); | ||
10870 | var ReactDOMOption = __webpack_require__(117); | ||
10871 | var ReactDOMSelect = __webpack_require__(118); | ||
10872 | var ReactDOMTextarea = __webpack_require__(119); | ||
10873 | var ReactInstrumentation = __webpack_require__(68); | ||
10874 | var ReactMultiChild = __webpack_require__(120); | ||
10875 | var ReactServerRenderingTransaction = __webpack_require__(139); | ||
10876 | |||
10877 | var emptyFunction = __webpack_require__(14); | ||
10878 | var escapeTextContentForBrowser = __webpack_require__(92); | ||
10879 | var invariant = __webpack_require__(10); | ||
10880 | var isEventSupported = __webpack_require__(76); | ||
10881 | var shallowEqual = __webpack_require__(129); | ||
10882 | var validateDOMNesting = __webpack_require__(142); | ||
10883 | var warning = __webpack_require__(13); | ||
10884 | |||
10885 | var Flags = ReactDOMComponentFlags; | ||
10886 | var deleteListener = EventPluginHub.deleteListener; | ||
10887 | var getNode = ReactDOMComponentTree.getNodeFromInstance; | ||
10888 | var listenTo = ReactBrowserEventEmitter.listenTo; | ||
10889 | var registrationNameModules = EventPluginRegistry.registrationNameModules; | ||
10890 | |||
10891 | // For quickly matching children type, to test if can be treated as content. | ||
10892 | var CONTENT_TYPES = { 'string': true, 'number': true }; | ||
10893 | |||
10894 | var STYLE = 'style'; | ||
10895 | var HTML = '__html'; | ||
10896 | var RESERVED_PROPS = { | ||
10897 | children: null, | ||
10898 | dangerouslySetInnerHTML: null, | ||
10899 | suppressContentEditableWarning: null | ||
10900 | }; | ||
10901 | |||
10902 | // Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE). | ||
10903 | var DOC_FRAGMENT_TYPE = 11; | ||
10904 | |||
10905 | function getDeclarationErrorAddendum(internalInstance) { | ||
10906 | if (internalInstance) { | ||
10907 | var owner = internalInstance._currentElement._owner || null; | ||
10908 | if (owner) { | ||
10909 | var name = owner.getName(); | ||
10910 | if (name) { | ||
10911 | return ' This DOM node was rendered by `' + name + '`.'; | ||
10912 | } | ||
10913 | } | ||
10914 | } | ||
10915 | return ''; | ||
10916 | } | ||
10917 | |||
10918 | function friendlyStringify(obj) { | ||
10919 | if (typeof obj === 'object') { | ||
10920 | if (Array.isArray(obj)) { | ||
10921 | return '[' + obj.map(friendlyStringify).join(', ') + ']'; | ||
10922 | } else { | ||
10923 | var pairs = []; | ||
10924 | for (var key in obj) { | ||
10925 | if (Object.prototype.hasOwnProperty.call(obj, key)) { | ||
10926 | var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key); | ||
10927 | pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key])); | ||
10928 | } | ||
10929 | } | ||
10930 | return '{' + pairs.join(', ') + '}'; | ||
10931 | } | ||
10932 | } else if (typeof obj === 'string') { | ||
10933 | return JSON.stringify(obj); | ||
10934 | } else if (typeof obj === 'function') { | ||
10935 | return '[function object]'; | ||
10936 | } | ||
10937 | // Differs from JSON.stringify in that undefined because undefined and that | ||
10938 | // inf and nan don't become null | ||
10939 | return String(obj); | ||
10940 | } | ||
10941 | |||
10942 | var styleMutationWarning = {}; | ||
10943 | |||
10944 | function checkAndWarnForMutatedStyle(style1, style2, component) { | ||
10945 | if (style1 == null || style2 == null) { | ||
10946 | return; | ||
10947 | } | ||
10948 | if (shallowEqual(style1, style2)) { | ||
10949 | return; | ||
10950 | } | ||
10951 | |||
10952 | var componentName = component._tag; | ||
10953 | var owner = component._currentElement._owner; | ||
10954 | var ownerName; | ||
10955 | if (owner) { | ||
10956 | ownerName = owner.getName(); | ||
10957 | } | ||
10958 | |||
10959 | var hash = ownerName + '|' + componentName; | ||
10960 | |||
10961 | if (styleMutationWarning.hasOwnProperty(hash)) { | ||
10962 | return; | ||
10963 | } | ||
10964 | |||
10965 | styleMutationWarning[hash] = true; | ||
10966 | |||
10967 | process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : void 0; | ||
10968 | } | ||
10969 | |||
10970 | /** | ||
10971 | * @param {object} component | ||
10972 | * @param {?object} props | ||
10973 | */ | ||
10974 | function assertValidProps(component, props) { | ||
10975 | if (!props) { | ||
10976 | return; | ||
10977 | } | ||
10978 | // Note the use of `==` which checks for null or undefined. | ||
10979 | if (voidElementTags[component._tag]) { | ||
10980 | !(props.children == null && props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : _prodInvariant('137', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : void 0; | ||
10981 | } | ||
10982 | if (props.dangerouslySetInnerHTML != null) { | ||
10983 | !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : _prodInvariant('60') : void 0; | ||
10984 | !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : _prodInvariant('61') : void 0; | ||
10985 | } | ||
10986 | if (process.env.NODE_ENV !== 'production') { | ||
10987 | process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : void 0; | ||
10988 | process.env.NODE_ENV !== 'production' ? warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0; | ||
10989 | process.env.NODE_ENV !== 'production' ? warning(props.onFocusIn == null && props.onFocusOut == null, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.') : void 0; | ||
10990 | } | ||
10991 | !(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getDeclarationErrorAddendum(component)) : _prodInvariant('62', getDeclarationErrorAddendum(component)) : void 0; | ||
10992 | } | ||
10993 | |||
10994 | function enqueuePutListener(inst, registrationName, listener, transaction) { | ||
10995 | if (transaction instanceof ReactServerRenderingTransaction) { | ||
10996 | return; | ||
10997 | } | ||
10998 | if (process.env.NODE_ENV !== 'production') { | ||
10999 | // IE8 has no API for event capturing and the `onScroll` event doesn't | ||
11000 | // bubble. | ||
11001 | process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0; | ||
11002 | } | ||
11003 | var containerInfo = inst._hostContainerInfo; | ||
11004 | var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE; | ||
11005 | var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument; | ||
11006 | listenTo(registrationName, doc); | ||
11007 | transaction.getReactMountReady().enqueue(putListener, { | ||
11008 | inst: inst, | ||
11009 | registrationName: registrationName, | ||
11010 | listener: listener | ||
11011 | }); | ||
11012 | } | ||
11013 | |||
11014 | function putListener() { | ||
11015 | var listenerToPut = this; | ||
11016 | EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener); | ||
11017 | } | ||
11018 | |||
11019 | function inputPostMount() { | ||
11020 | var inst = this; | ||
11021 | ReactDOMInput.postMountWrapper(inst); | ||
11022 | } | ||
11023 | |||
11024 | function textareaPostMount() { | ||
11025 | var inst = this; | ||
11026 | ReactDOMTextarea.postMountWrapper(inst); | ||
11027 | } | ||
11028 | |||
11029 | function optionPostMount() { | ||
11030 | var inst = this; | ||
11031 | ReactDOMOption.postMountWrapper(inst); | ||
11032 | } | ||
11033 | |||
11034 | var setAndValidateContentChildDev = emptyFunction; | ||
11035 | if (process.env.NODE_ENV !== 'production') { | ||
11036 | setAndValidateContentChildDev = function (content) { | ||
11037 | var hasExistingContent = this._contentDebugID != null; | ||
11038 | var debugID = this._debugID; | ||
11039 | // This ID represents the inlined child that has no backing instance: | ||
11040 | var contentDebugID = -debugID; | ||
11041 | |||
11042 | if (content == null) { | ||
11043 | if (hasExistingContent) { | ||
11044 | ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID); | ||
11045 | } | ||
11046 | this._contentDebugID = null; | ||
11047 | return; | ||
11048 | } | ||
11049 | |||
11050 | validateDOMNesting(null, String(content), this, this._ancestorInfo); | ||
11051 | this._contentDebugID = contentDebugID; | ||
11052 | if (hasExistingContent) { | ||
11053 | ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content); | ||
11054 | ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID); | ||
11055 | } else { | ||
11056 | ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID); | ||
11057 | ReactInstrumentation.debugTool.onMountComponent(contentDebugID); | ||
11058 | ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]); | ||
11059 | } | ||
11060 | }; | ||
11061 | } | ||
11062 | |||
11063 | // There are so many media events, it makes sense to just | ||
11064 | // maintain a list rather than create a `trapBubbledEvent` for each | ||
11065 | var mediaEvents = { | ||
11066 | topAbort: 'abort', | ||
11067 | topCanPlay: 'canplay', | ||
11068 | topCanPlayThrough: 'canplaythrough', | ||
11069 | topDurationChange: 'durationchange', | ||
11070 | topEmptied: 'emptied', | ||
11071 | topEncrypted: 'encrypted', | ||
11072 | topEnded: 'ended', | ||
11073 | topError: 'error', | ||
11074 | topLoadedData: 'loadeddata', | ||
11075 | topLoadedMetadata: 'loadedmetadata', | ||
11076 | topLoadStart: 'loadstart', | ||
11077 | topPause: 'pause', | ||
11078 | topPlay: 'play', | ||
11079 | topPlaying: 'playing', | ||
11080 | topProgress: 'progress', | ||
11081 | topRateChange: 'ratechange', | ||
11082 | topSeeked: 'seeked', | ||
11083 | topSeeking: 'seeking', | ||
11084 | topStalled: 'stalled', | ||
11085 | topSuspend: 'suspend', | ||
11086 | topTimeUpdate: 'timeupdate', | ||
11087 | topVolumeChange: 'volumechange', | ||
11088 | topWaiting: 'waiting' | ||
11089 | }; | ||
11090 | |||
11091 | function trapBubbledEventsLocal() { | ||
11092 | var inst = this; | ||
11093 | // If a component renders to null or if another component fatals and causes | ||
11094 | // the state of the tree to be corrupted, `node` here can be null. | ||
11095 | !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : _prodInvariant('63') : void 0; | ||
11096 | var node = getNode(inst); | ||
11097 | !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : _prodInvariant('64') : void 0; | ||
11098 | |||
11099 | switch (inst._tag) { | ||
11100 | case 'iframe': | ||
11101 | case 'object': | ||
11102 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)]; | ||
11103 | break; | ||
11104 | case 'video': | ||
11105 | case 'audio': | ||
11106 | |||
11107 | inst._wrapperState.listeners = []; | ||
11108 | // Create listener for each media event | ||
11109 | for (var event in mediaEvents) { | ||
11110 | if (mediaEvents.hasOwnProperty(event)) { | ||
11111 | inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(event, mediaEvents[event], node)); | ||
11112 | } | ||
11113 | } | ||
11114 | break; | ||
11115 | case 'source': | ||
11116 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node)]; | ||
11117 | break; | ||
11118 | case 'img': | ||
11119 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node), ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)]; | ||
11120 | break; | ||
11121 | case 'form': | ||
11122 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topReset', 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent('topSubmit', 'submit', node)]; | ||
11123 | break; | ||
11124 | case 'input': | ||
11125 | case 'select': | ||
11126 | case 'textarea': | ||
11127 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topInvalid', 'invalid', node)]; | ||
11128 | break; | ||
11129 | } | ||
11130 | } | ||
11131 | |||
11132 | function postUpdateSelectWrapper() { | ||
11133 | ReactDOMSelect.postUpdateWrapper(this); | ||
11134 | } | ||
11135 | |||
11136 | // For HTML, certain tags should omit their close tag. We keep a whitelist for | ||
11137 | // those special-case tags. | ||
11138 | |||
11139 | var omittedCloseTags = { | ||
11140 | 'area': true, | ||
11141 | 'base': true, | ||
11142 | 'br': true, | ||
11143 | 'col': true, | ||
11144 | 'embed': true, | ||
11145 | 'hr': true, | ||
11146 | 'img': true, | ||
11147 | 'input': true, | ||
11148 | 'keygen': true, | ||
11149 | 'link': true, | ||
11150 | 'meta': true, | ||
11151 | 'param': true, | ||
11152 | 'source': true, | ||
11153 | 'track': true, | ||
11154 | 'wbr': true | ||
11155 | }; | ||
11156 | |||
11157 | var newlineEatingTags = { | ||
11158 | 'listing': true, | ||
11159 | 'pre': true, | ||
11160 | 'textarea': true | ||
11161 | }; | ||
11162 | |||
11163 | // For HTML, certain tags cannot have children. This has the same purpose as | ||
11164 | // `omittedCloseTags` except that `menuitem` should still have its closing tag. | ||
11165 | |||
11166 | var voidElementTags = _assign({ | ||
11167 | 'menuitem': true | ||
11168 | }, omittedCloseTags); | ||
11169 | |||
11170 | // We accept any tag to be rendered but since this gets injected into arbitrary | ||
11171 | // HTML, we want to make sure that it's a safe tag. | ||
11172 | // http://www.w3.org/TR/REC-xml/#NT-Name | ||
11173 | |||
11174 | var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset | ||
11175 | var validatedTagCache = {}; | ||
11176 | var hasOwnProperty = {}.hasOwnProperty; | ||
11177 | |||
11178 | function validateDangerousTag(tag) { | ||
11179 | if (!hasOwnProperty.call(validatedTagCache, tag)) { | ||
11180 | !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : _prodInvariant('65', tag) : void 0; | ||
11181 | validatedTagCache[tag] = true; | ||
11182 | } | ||
11183 | } | ||
11184 | |||
11185 | function isCustomComponent(tagName, props) { | ||
11186 | return tagName.indexOf('-') >= 0 || props.is != null; | ||
11187 | } | ||
11188 | |||
11189 | var globalIdCounter = 1; | ||
11190 | |||
11191 | /** | ||
11192 | * Creates a new React class that is idempotent and capable of containing other | ||
11193 | * React components. It accepts event listeners and DOM properties that are | ||
11194 | * valid according to `DOMProperty`. | ||
11195 | * | ||
11196 | * - Event listeners: `onClick`, `onMouseDown`, etc. | ||
11197 | * - DOM properties: `className`, `name`, `title`, etc. | ||
11198 | * | ||
11199 | * The `style` property functions differently from the DOM API. It accepts an | ||
11200 | * object mapping of style properties to values. | ||
11201 | * | ||
11202 | * @constructor ReactDOMComponent | ||
11203 | * @extends ReactMultiChild | ||
11204 | */ | ||
11205 | function ReactDOMComponent(element) { | ||
11206 | var tag = element.type; | ||
11207 | validateDangerousTag(tag); | ||
11208 | this._currentElement = element; | ||
11209 | this._tag = tag.toLowerCase(); | ||
11210 | this._namespaceURI = null; | ||
11211 | this._renderedChildren = null; | ||
11212 | this._previousStyle = null; | ||
11213 | this._previousStyleCopy = null; | ||
11214 | this._hostNode = null; | ||
11215 | this._hostParent = null; | ||
11216 | this._rootNodeID = 0; | ||
11217 | this._domID = 0; | ||
11218 | this._hostContainerInfo = null; | ||
11219 | this._wrapperState = null; | ||
11220 | this._topLevelWrapper = null; | ||
11221 | this._flags = 0; | ||
11222 | if (process.env.NODE_ENV !== 'production') { | ||
11223 | this._ancestorInfo = null; | ||
11224 | setAndValidateContentChildDev.call(this, null); | ||
11225 | } | ||
11226 | } | ||
11227 | |||
11228 | ReactDOMComponent.displayName = 'ReactDOMComponent'; | ||
11229 | |||
11230 | ReactDOMComponent.Mixin = { | ||
11231 | |||
11232 | /** | ||
11233 | * Generates root tag markup then recurses. This method has side effects and | ||
11234 | * is not idempotent. | ||
11235 | * | ||
11236 | * @internal | ||
11237 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
11238 | * @param {?ReactDOMComponent} the parent component instance | ||
11239 | * @param {?object} info about the host container | ||
11240 | * @param {object} context | ||
11241 | * @return {string} The computed markup. | ||
11242 | */ | ||
11243 | mountComponent: function (transaction, hostParent, hostContainerInfo, context) { | ||
11244 | this._rootNodeID = globalIdCounter++; | ||
11245 | this._domID = hostContainerInfo._idCounter++; | ||
11246 | this._hostParent = hostParent; | ||
11247 | this._hostContainerInfo = hostContainerInfo; | ||
11248 | |||
11249 | var props = this._currentElement.props; | ||
11250 | |||
11251 | switch (this._tag) { | ||
11252 | case 'audio': | ||
11253 | case 'form': | ||
11254 | case 'iframe': | ||
11255 | case 'img': | ||
11256 | case 'link': | ||
11257 | case 'object': | ||
11258 | case 'source': | ||
11259 | case 'video': | ||
11260 | this._wrapperState = { | ||
11261 | listeners: null | ||
11262 | }; | ||
11263 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); | ||
11264 | break; | ||
11265 | case 'input': | ||
11266 | ReactDOMInput.mountWrapper(this, props, hostParent); | ||
11267 | props = ReactDOMInput.getHostProps(this, props); | ||
11268 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); | ||
11269 | break; | ||
11270 | case 'option': | ||
11271 | ReactDOMOption.mountWrapper(this, props, hostParent); | ||
11272 | props = ReactDOMOption.getHostProps(this, props); | ||
11273 | break; | ||
11274 | case 'select': | ||
11275 | ReactDOMSelect.mountWrapper(this, props, hostParent); | ||
11276 | props = ReactDOMSelect.getHostProps(this, props); | ||
11277 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); | ||
11278 | break; | ||
11279 | case 'textarea': | ||
11280 | ReactDOMTextarea.mountWrapper(this, props, hostParent); | ||
11281 | props = ReactDOMTextarea.getHostProps(this, props); | ||
11282 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); | ||
11283 | break; | ||
11284 | } | ||
11285 | |||
11286 | assertValidProps(this, props); | ||
11287 | |||
11288 | // We create tags in the namespace of their parent container, except HTML | ||
11289 | // tags get no namespace. | ||
11290 | var namespaceURI; | ||
11291 | var parentTag; | ||
11292 | if (hostParent != null) { | ||
11293 | namespaceURI = hostParent._namespaceURI; | ||
11294 | parentTag = hostParent._tag; | ||
11295 | } else if (hostContainerInfo._tag) { | ||
11296 | namespaceURI = hostContainerInfo._namespaceURI; | ||
11297 | parentTag = hostContainerInfo._tag; | ||
11298 | } | ||
11299 | if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') { | ||
11300 | namespaceURI = DOMNamespaces.html; | ||
11301 | } | ||
11302 | if (namespaceURI === DOMNamespaces.html) { | ||
11303 | if (this._tag === 'svg') { | ||
11304 | namespaceURI = DOMNamespaces.svg; | ||
11305 | } else if (this._tag === 'math') { | ||
11306 | namespaceURI = DOMNamespaces.mathml; | ||
11307 | } | ||
11308 | } | ||
11309 | this._namespaceURI = namespaceURI; | ||
11310 | |||
11311 | if (process.env.NODE_ENV !== 'production') { | ||
11312 | var parentInfo; | ||
11313 | if (hostParent != null) { | ||
11314 | parentInfo = hostParent._ancestorInfo; | ||
11315 | } else if (hostContainerInfo._tag) { | ||
11316 | parentInfo = hostContainerInfo._ancestorInfo; | ||
11317 | } | ||
11318 | if (parentInfo) { | ||
11319 | // parentInfo should always be present except for the top-level | ||
11320 | // component when server rendering | ||
11321 | validateDOMNesting(this._tag, null, this, parentInfo); | ||
11322 | } | ||
11323 | this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this); | ||
11324 | } | ||
11325 | |||
11326 | var mountImage; | ||
11327 | if (transaction.useCreateElement) { | ||
11328 | var ownerDocument = hostContainerInfo._ownerDocument; | ||
11329 | var el; | ||
11330 | if (namespaceURI === DOMNamespaces.html) { | ||
11331 | if (this._tag === 'script') { | ||
11332 | // Create the script via .innerHTML so its "parser-inserted" flag is | ||
11333 | // set to true and it does not execute | ||
11334 | var div = ownerDocument.createElement('div'); | ||
11335 | var type = this._currentElement.type; | ||
11336 | div.innerHTML = '<' + type + '></' + type + '>'; | ||
11337 | el = div.removeChild(div.firstChild); | ||
11338 | } else if (props.is) { | ||
11339 | el = ownerDocument.createElement(this._currentElement.type, props.is); | ||
11340 | } else { | ||
11341 | // Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug. | ||
11342 | // See discussion in https://github.com/facebook/react/pull/6896 | ||
11343 | // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240 | ||
11344 | el = ownerDocument.createElement(this._currentElement.type); | ||
11345 | } | ||
11346 | } else { | ||
11347 | el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type); | ||
11348 | } | ||
11349 | ReactDOMComponentTree.precacheNode(this, el); | ||
11350 | this._flags |= Flags.hasCachedChildNodes; | ||
11351 | if (!this._hostParent) { | ||
11352 | DOMPropertyOperations.setAttributeForRoot(el); | ||
11353 | } | ||
11354 | this._updateDOMProperties(null, props, transaction); | ||
11355 | var lazyTree = DOMLazyTree(el); | ||
11356 | this._createInitialChildren(transaction, props, context, lazyTree); | ||
11357 | mountImage = lazyTree; | ||
11358 | } else { | ||
11359 | var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props); | ||
11360 | var tagContent = this._createContentMarkup(transaction, props, context); | ||
11361 | if (!tagContent && omittedCloseTags[this._tag]) { | ||
11362 | mountImage = tagOpen + '/>'; | ||
11363 | } else { | ||
11364 | mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>'; | ||
11365 | } | ||
11366 | } | ||
11367 | |||
11368 | switch (this._tag) { | ||
11369 | case 'input': | ||
11370 | transaction.getReactMountReady().enqueue(inputPostMount, this); | ||
11371 | if (props.autoFocus) { | ||
11372 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); | ||
11373 | } | ||
11374 | break; | ||
11375 | case 'textarea': | ||
11376 | transaction.getReactMountReady().enqueue(textareaPostMount, this); | ||
11377 | if (props.autoFocus) { | ||
11378 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); | ||
11379 | } | ||
11380 | break; | ||
11381 | case 'select': | ||
11382 | if (props.autoFocus) { | ||
11383 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); | ||
11384 | } | ||
11385 | break; | ||
11386 | case 'button': | ||
11387 | if (props.autoFocus) { | ||
11388 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); | ||
11389 | } | ||
11390 | break; | ||
11391 | case 'option': | ||
11392 | transaction.getReactMountReady().enqueue(optionPostMount, this); | ||
11393 | break; | ||
11394 | } | ||
11395 | |||
11396 | return mountImage; | ||
11397 | }, | ||
11398 | |||
11399 | /** | ||
11400 | * Creates markup for the open tag and all attributes. | ||
11401 | * | ||
11402 | * This method has side effects because events get registered. | ||
11403 | * | ||
11404 | * Iterating over object properties is faster than iterating over arrays. | ||
11405 | * @see http://jsperf.com/obj-vs-arr-iteration | ||
11406 | * | ||
11407 | * @private | ||
11408 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
11409 | * @param {object} props | ||
11410 | * @return {string} Markup of opening tag. | ||
11411 | */ | ||
11412 | _createOpenTagMarkupAndPutListeners: function (transaction, props) { | ||
11413 | var ret = '<' + this._currentElement.type; | ||
11414 | |||
11415 | for (var propKey in props) { | ||
11416 | if (!props.hasOwnProperty(propKey)) { | ||
11417 | continue; | ||
11418 | } | ||
11419 | var propValue = props[propKey]; | ||
11420 | if (propValue == null) { | ||
11421 | continue; | ||
11422 | } | ||
11423 | if (registrationNameModules.hasOwnProperty(propKey)) { | ||
11424 | if (propValue) { | ||
11425 | enqueuePutListener(this, propKey, propValue, transaction); | ||
11426 | } | ||
11427 | } else { | ||
11428 | if (propKey === STYLE) { | ||
11429 | if (propValue) { | ||
11430 | if (process.env.NODE_ENV !== 'production') { | ||
11431 | // See `_updateDOMProperties`. style block | ||
11432 | this._previousStyle = propValue; | ||
11433 | } | ||
11434 | propValue = this._previousStyleCopy = _assign({}, props.style); | ||
11435 | } | ||
11436 | propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this); | ||
11437 | } | ||
11438 | var markup = null; | ||
11439 | if (this._tag != null && isCustomComponent(this._tag, props)) { | ||
11440 | if (!RESERVED_PROPS.hasOwnProperty(propKey)) { | ||
11441 | markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue); | ||
11442 | } | ||
11443 | } else { | ||
11444 | markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue); | ||
11445 | } | ||
11446 | if (markup) { | ||
11447 | ret += ' ' + markup; | ||
11448 | } | ||
11449 | } | ||
11450 | } | ||
11451 | |||
11452 | // For static pages, no need to put React ID and checksum. Saves lots of | ||
11453 | // bytes. | ||
11454 | if (transaction.renderToStaticMarkup) { | ||
11455 | return ret; | ||
11456 | } | ||
11457 | |||
11458 | if (!this._hostParent) { | ||
11459 | ret += ' ' + DOMPropertyOperations.createMarkupForRoot(); | ||
11460 | } | ||
11461 | ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID); | ||
11462 | return ret; | ||
11463 | }, | ||
11464 | |||
11465 | /** | ||
11466 | * Creates markup for the content between the tags. | ||
11467 | * | ||
11468 | * @private | ||
11469 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
11470 | * @param {object} props | ||
11471 | * @param {object} context | ||
11472 | * @return {string} Content markup. | ||
11473 | */ | ||
11474 | _createContentMarkup: function (transaction, props, context) { | ||
11475 | var ret = ''; | ||
11476 | |||
11477 | // Intentional use of != to avoid catching zero/false. | ||
11478 | var innerHTML = props.dangerouslySetInnerHTML; | ||
11479 | if (innerHTML != null) { | ||
11480 | if (innerHTML.__html != null) { | ||
11481 | ret = innerHTML.__html; | ||
11482 | } | ||
11483 | } else { | ||
11484 | var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; | ||
11485 | var childrenToUse = contentToUse != null ? null : props.children; | ||
11486 | if (contentToUse != null) { | ||
11487 | // TODO: Validate that text is allowed as a child of this node | ||
11488 | ret = escapeTextContentForBrowser(contentToUse); | ||
11489 | if (process.env.NODE_ENV !== 'production') { | ||
11490 | setAndValidateContentChildDev.call(this, contentToUse); | ||
11491 | } | ||
11492 | } else if (childrenToUse != null) { | ||
11493 | var mountImages = this.mountChildren(childrenToUse, transaction, context); | ||
11494 | ret = mountImages.join(''); | ||
11495 | } | ||
11496 | } | ||
11497 | if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') { | ||
11498 | // text/html ignores the first character in these tags if it's a newline | ||
11499 | // Prefer to break application/xml over text/html (for now) by adding | ||
11500 | // a newline specifically to get eaten by the parser. (Alternately for | ||
11501 | // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first | ||
11502 | // \r is normalized out by HTMLTextAreaElement#value.) | ||
11503 | // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre> | ||
11504 | // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions> | ||
11505 | // See: <http://www.w3.org/TR/html5/syntax.html#newlines> | ||
11506 | // See: Parsing of "textarea" "listing" and "pre" elements | ||
11507 | // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody> | ||
11508 | return '\n' + ret; | ||
11509 | } else { | ||
11510 | return ret; | ||
11511 | } | ||
11512 | }, | ||
11513 | |||
11514 | _createInitialChildren: function (transaction, props, context, lazyTree) { | ||
11515 | // Intentional use of != to avoid catching zero/false. | ||
11516 | var innerHTML = props.dangerouslySetInnerHTML; | ||
11517 | if (innerHTML != null) { | ||
11518 | if (innerHTML.__html != null) { | ||
11519 | DOMLazyTree.queueHTML(lazyTree, innerHTML.__html); | ||
11520 | } | ||
11521 | } else { | ||
11522 | var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; | ||
11523 | var childrenToUse = contentToUse != null ? null : props.children; | ||
11524 | // TODO: Validate that text is allowed as a child of this node | ||
11525 | if (contentToUse != null) { | ||
11526 | // Avoid setting textContent when the text is empty. In IE11 setting | ||
11527 | // textContent on a text area will cause the placeholder to not | ||
11528 | // show within the textarea until it has been focused and blurred again. | ||
11529 | // https://github.com/facebook/react/issues/6731#issuecomment-254874553 | ||
11530 | if (contentToUse !== '') { | ||
11531 | if (process.env.NODE_ENV !== 'production') { | ||
11532 | setAndValidateContentChildDev.call(this, contentToUse); | ||
11533 | } | ||
11534 | DOMLazyTree.queueText(lazyTree, contentToUse); | ||
11535 | } | ||
11536 | } else if (childrenToUse != null) { | ||
11537 | var mountImages = this.mountChildren(childrenToUse, transaction, context); | ||
11538 | for (var i = 0; i < mountImages.length; i++) { | ||
11539 | DOMLazyTree.queueChild(lazyTree, mountImages[i]); | ||
11540 | } | ||
11541 | } | ||
11542 | } | ||
11543 | }, | ||
11544 | |||
11545 | /** | ||
11546 | * Receives a next element and updates the component. | ||
11547 | * | ||
11548 | * @internal | ||
11549 | * @param {ReactElement} nextElement | ||
11550 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
11551 | * @param {object} context | ||
11552 | */ | ||
11553 | receiveComponent: function (nextElement, transaction, context) { | ||
11554 | var prevElement = this._currentElement; | ||
11555 | this._currentElement = nextElement; | ||
11556 | this.updateComponent(transaction, prevElement, nextElement, context); | ||
11557 | }, | ||
11558 | |||
11559 | /** | ||
11560 | * Updates a DOM component after it has already been allocated and | ||
11561 | * attached to the DOM. Reconciles the root DOM node, then recurses. | ||
11562 | * | ||
11563 | * @param {ReactReconcileTransaction} transaction | ||
11564 | * @param {ReactElement} prevElement | ||
11565 | * @param {ReactElement} nextElement | ||
11566 | * @internal | ||
11567 | * @overridable | ||
11568 | */ | ||
11569 | updateComponent: function (transaction, prevElement, nextElement, context) { | ||
11570 | var lastProps = prevElement.props; | ||
11571 | var nextProps = this._currentElement.props; | ||
11572 | |||
11573 | switch (this._tag) { | ||
11574 | case 'input': | ||
11575 | lastProps = ReactDOMInput.getHostProps(this, lastProps); | ||
11576 | nextProps = ReactDOMInput.getHostProps(this, nextProps); | ||
11577 | break; | ||
11578 | case 'option': | ||
11579 | lastProps = ReactDOMOption.getHostProps(this, lastProps); | ||
11580 | nextProps = ReactDOMOption.getHostProps(this, nextProps); | ||
11581 | break; | ||
11582 | case 'select': | ||
11583 | lastProps = ReactDOMSelect.getHostProps(this, lastProps); | ||
11584 | nextProps = ReactDOMSelect.getHostProps(this, nextProps); | ||
11585 | break; | ||
11586 | case 'textarea': | ||
11587 | lastProps = ReactDOMTextarea.getHostProps(this, lastProps); | ||
11588 | nextProps = ReactDOMTextarea.getHostProps(this, nextProps); | ||
11589 | break; | ||
11590 | } | ||
11591 | |||
11592 | assertValidProps(this, nextProps); | ||
11593 | this._updateDOMProperties(lastProps, nextProps, transaction); | ||
11594 | this._updateDOMChildren(lastProps, nextProps, transaction, context); | ||
11595 | |||
11596 | switch (this._tag) { | ||
11597 | case 'input': | ||
11598 | // Update the wrapper around inputs *after* updating props. This has to | ||
11599 | // happen after `_updateDOMProperties`. Otherwise HTML5 input validations | ||
11600 | // raise warnings and prevent the new value from being assigned. | ||
11601 | ReactDOMInput.updateWrapper(this); | ||
11602 | break; | ||
11603 | case 'textarea': | ||
11604 | ReactDOMTextarea.updateWrapper(this); | ||
11605 | break; | ||
11606 | case 'select': | ||
11607 | // <select> value update needs to occur after <option> children | ||
11608 | // reconciliation | ||
11609 | transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this); | ||
11610 | break; | ||
11611 | } | ||
11612 | }, | ||
11613 | |||
11614 | /** | ||
11615 | * Reconciles the properties by detecting differences in property values and | ||
11616 | * updating the DOM as necessary. This function is probably the single most | ||
11617 | * critical path for performance optimization. | ||
11618 | * | ||
11619 | * TODO: Benchmark whether checking for changed values in memory actually | ||
11620 | * improves performance (especially statically positioned elements). | ||
11621 | * TODO: Benchmark the effects of putting this at the top since 99% of props | ||
11622 | * do not change for a given reconciliation. | ||
11623 | * TODO: Benchmark areas that can be improved with caching. | ||
11624 | * | ||
11625 | * @private | ||
11626 | * @param {object} lastProps | ||
11627 | * @param {object} nextProps | ||
11628 | * @param {?DOMElement} node | ||
11629 | */ | ||
11630 | _updateDOMProperties: function (lastProps, nextProps, transaction) { | ||
11631 | var propKey; | ||
11632 | var styleName; | ||
11633 | var styleUpdates; | ||
11634 | for (propKey in lastProps) { | ||
11635 | if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) { | ||
11636 | continue; | ||
11637 | } | ||
11638 | if (propKey === STYLE) { | ||
11639 | var lastStyle = this._previousStyleCopy; | ||
11640 | for (styleName in lastStyle) { | ||
11641 | if (lastStyle.hasOwnProperty(styleName)) { | ||
11642 | styleUpdates = styleUpdates || {}; | ||
11643 | styleUpdates[styleName] = ''; | ||
11644 | } | ||
11645 | } | ||
11646 | this._previousStyleCopy = null; | ||
11647 | } else if (registrationNameModules.hasOwnProperty(propKey)) { | ||
11648 | if (lastProps[propKey]) { | ||
11649 | // Only call deleteListener if there was a listener previously or | ||
11650 | // else willDeleteListener gets called when there wasn't actually a | ||
11651 | // listener (e.g., onClick={null}) | ||
11652 | deleteListener(this, propKey); | ||
11653 | } | ||
11654 | } else if (isCustomComponent(this._tag, lastProps)) { | ||
11655 | if (!RESERVED_PROPS.hasOwnProperty(propKey)) { | ||
11656 | DOMPropertyOperations.deleteValueForAttribute(getNode(this), propKey); | ||
11657 | } | ||
11658 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { | ||
11659 | DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey); | ||
11660 | } | ||
11661 | } | ||
11662 | for (propKey in nextProps) { | ||
11663 | var nextProp = nextProps[propKey]; | ||
11664 | var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined; | ||
11665 | if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) { | ||
11666 | continue; | ||
11667 | } | ||
11668 | if (propKey === STYLE) { | ||
11669 | if (nextProp) { | ||
11670 | if (process.env.NODE_ENV !== 'production') { | ||
11671 | checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this); | ||
11672 | this._previousStyle = nextProp; | ||
11673 | } | ||
11674 | nextProp = this._previousStyleCopy = _assign({}, nextProp); | ||
11675 | } else { | ||
11676 | this._previousStyleCopy = null; | ||
11677 | } | ||
11678 | if (lastProp) { | ||
11679 | // Unset styles on `lastProp` but not on `nextProp`. | ||
11680 | for (styleName in lastProp) { | ||
11681 | if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) { | ||
11682 | styleUpdates = styleUpdates || {}; | ||
11683 | styleUpdates[styleName] = ''; | ||
11684 | } | ||
11685 | } | ||
11686 | // Update styles that changed since `lastProp`. | ||
11687 | for (styleName in nextProp) { | ||
11688 | if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { | ||
11689 | styleUpdates = styleUpdates || {}; | ||
11690 | styleUpdates[styleName] = nextProp[styleName]; | ||
11691 | } | ||
11692 | } | ||
11693 | } else { | ||
11694 | // Relies on `updateStylesByID` not mutating `styleUpdates`. | ||
11695 | styleUpdates = nextProp; | ||
11696 | } | ||
11697 | } else if (registrationNameModules.hasOwnProperty(propKey)) { | ||
11698 | if (nextProp) { | ||
11699 | enqueuePutListener(this, propKey, nextProp, transaction); | ||
11700 | } else if (lastProp) { | ||
11701 | deleteListener(this, propKey); | ||
11702 | } | ||
11703 | } else if (isCustomComponent(this._tag, nextProps)) { | ||
11704 | if (!RESERVED_PROPS.hasOwnProperty(propKey)) { | ||
11705 | DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp); | ||
11706 | } | ||
11707 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { | ||
11708 | var node = getNode(this); | ||
11709 | // If we're updating to null or undefined, we should remove the property | ||
11710 | // from the DOM node instead of inadvertently setting to a string. This | ||
11711 | // brings us in line with the same behavior we have on initial render. | ||
11712 | if (nextProp != null) { | ||
11713 | DOMPropertyOperations.setValueForProperty(node, propKey, nextProp); | ||
11714 | } else { | ||
11715 | DOMPropertyOperations.deleteValueForProperty(node, propKey); | ||
11716 | } | ||
11717 | } | ||
11718 | } | ||
11719 | if (styleUpdates) { | ||
11720 | CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this); | ||
11721 | } | ||
11722 | }, | ||
11723 | |||
11724 | /** | ||
11725 | * Reconciles the children with the various properties that affect the | ||
11726 | * children content. | ||
11727 | * | ||
11728 | * @param {object} lastProps | ||
11729 | * @param {object} nextProps | ||
11730 | * @param {ReactReconcileTransaction} transaction | ||
11731 | * @param {object} context | ||
11732 | */ | ||
11733 | _updateDOMChildren: function (lastProps, nextProps, transaction, context) { | ||
11734 | var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null; | ||
11735 | var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null; | ||
11736 | |||
11737 | var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html; | ||
11738 | var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html; | ||
11739 | |||
11740 | // Note the use of `!=` which checks for null or undefined. | ||
11741 | var lastChildren = lastContent != null ? null : lastProps.children; | ||
11742 | var nextChildren = nextContent != null ? null : nextProps.children; | ||
11743 | |||
11744 | // If we're switching from children to content/html or vice versa, remove | ||
11745 | // the old content | ||
11746 | var lastHasContentOrHtml = lastContent != null || lastHtml != null; | ||
11747 | var nextHasContentOrHtml = nextContent != null || nextHtml != null; | ||
11748 | if (lastChildren != null && nextChildren == null) { | ||
11749 | this.updateChildren(null, transaction, context); | ||
11750 | } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { | ||
11751 | this.updateTextContent(''); | ||
11752 | if (process.env.NODE_ENV !== 'production') { | ||
11753 | ReactInstrumentation.debugTool.onSetChildren(this._debugID, []); | ||
11754 | } | ||
11755 | } | ||
11756 | |||
11757 | if (nextContent != null) { | ||
11758 | if (lastContent !== nextContent) { | ||
11759 | this.updateTextContent('' + nextContent); | ||
11760 | if (process.env.NODE_ENV !== 'production') { | ||
11761 | setAndValidateContentChildDev.call(this, nextContent); | ||
11762 | } | ||
11763 | } | ||
11764 | } else if (nextHtml != null) { | ||
11765 | if (lastHtml !== nextHtml) { | ||
11766 | this.updateMarkup('' + nextHtml); | ||
11767 | } | ||
11768 | if (process.env.NODE_ENV !== 'production') { | ||
11769 | ReactInstrumentation.debugTool.onSetChildren(this._debugID, []); | ||
11770 | } | ||
11771 | } else if (nextChildren != null) { | ||
11772 | if (process.env.NODE_ENV !== 'production') { | ||
11773 | setAndValidateContentChildDev.call(this, null); | ||
11774 | } | ||
11775 | |||
11776 | this.updateChildren(nextChildren, transaction, context); | ||
11777 | } | ||
11778 | }, | ||
11779 | |||
11780 | getHostNode: function () { | ||
11781 | return getNode(this); | ||
11782 | }, | ||
11783 | |||
11784 | /** | ||
11785 | * Destroys all event registrations for this instance. Does not remove from | ||
11786 | * the DOM. That must be done by the parent. | ||
11787 | * | ||
11788 | * @internal | ||
11789 | */ | ||
11790 | unmountComponent: function (safely) { | ||
11791 | switch (this._tag) { | ||
11792 | case 'audio': | ||
11793 | case 'form': | ||
11794 | case 'iframe': | ||
11795 | case 'img': | ||
11796 | case 'link': | ||
11797 | case 'object': | ||
11798 | case 'source': | ||
11799 | case 'video': | ||
11800 | var listeners = this._wrapperState.listeners; | ||
11801 | if (listeners) { | ||
11802 | for (var i = 0; i < listeners.length; i++) { | ||
11803 | listeners[i].remove(); | ||
11804 | } | ||
11805 | } | ||
11806 | break; | ||
11807 | case 'html': | ||
11808 | case 'head': | ||
11809 | case 'body': | ||
11810 | /** | ||
11811 | * Components like <html> <head> and <body> can't be removed or added | ||
11812 | * easily in a cross-browser way, however it's valuable to be able to | ||
11813 | * take advantage of React's reconciliation for styling and <title> | ||
11814 | * management. So we just document it and throw in dangerous cases. | ||
11815 | */ | ||
11816 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is impossible to unmount some top-level components (eg <html>, <head>, and <body>) reliably and efficiently. To fix this, have a single top-level component that never unmounts render these elements.', this._tag) : _prodInvariant('66', this._tag) : void 0; | ||
11817 | break; | ||
11818 | } | ||
11819 | |||
11820 | this.unmountChildren(safely); | ||
11821 | ReactDOMComponentTree.uncacheNode(this); | ||
11822 | EventPluginHub.deleteAllListeners(this); | ||
11823 | this._rootNodeID = 0; | ||
11824 | this._domID = 0; | ||
11825 | this._wrapperState = null; | ||
11826 | |||
11827 | if (process.env.NODE_ENV !== 'production') { | ||
11828 | setAndValidateContentChildDev.call(this, null); | ||
11829 | } | ||
11830 | }, | ||
11831 | |||
11832 | getPublicInstance: function () { | ||
11833 | return getNode(this); | ||
11834 | } | ||
11835 | |||
11836 | }; | ||
11837 | |||
11838 | _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin); | ||
11839 | |||
11840 | module.exports = ReactDOMComponent; | ||
11841 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
11842 | |||
11843 | /***/ }), | ||
11844 | /* 99 */ | ||
11845 | /***/ (function(module, exports, __webpack_require__) { | ||
11846 | |||
11847 | /** | ||
11848 | * Copyright 2013-present, Facebook, Inc. | ||
11849 | * All rights reserved. | ||
11850 | * | ||
11851 | * This source code is licensed under the BSD-style license found in the | ||
11852 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11853 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11854 | * | ||
11855 | */ | ||
11856 | |||
11857 | 'use strict'; | ||
11858 | |||
11859 | var ReactDOMComponentTree = __webpack_require__(40); | ||
11860 | |||
11861 | var focusNode = __webpack_require__(100); | ||
11862 | |||
11863 | var AutoFocusUtils = { | ||
11864 | focusDOMComponent: function () { | ||
11865 | focusNode(ReactDOMComponentTree.getNodeFromInstance(this)); | ||
11866 | } | ||
11867 | }; | ||
11868 | |||
11869 | module.exports = AutoFocusUtils; | ||
11870 | |||
11871 | /***/ }), | ||
11872 | /* 100 */ | ||
11873 | /***/ (function(module, exports) { | ||
11874 | |||
11875 | /** | ||
11876 | * Copyright (c) 2013-present, Facebook, Inc. | ||
11877 | * All rights reserved. | ||
11878 | * | ||
11879 | * This source code is licensed under the BSD-style license found in the | ||
11880 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11881 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11882 | * | ||
11883 | */ | ||
11884 | |||
11885 | 'use strict'; | ||
11886 | |||
11887 | /** | ||
11888 | * @param {DOMElement} node input/textarea to focus | ||
11889 | */ | ||
11890 | |||
11891 | function focusNode(node) { | ||
11892 | // IE8 can throw "Can't move focus to the control because it is invisible, | ||
11893 | // not enabled, or of a type that does not accept the focus." for all kinds of | ||
11894 | // reasons that are too expensive and fragile to test. | ||
11895 | try { | ||
11896 | node.focus(); | ||
11897 | } catch (e) {} | ||
11898 | } | ||
11899 | |||
11900 | module.exports = focusNode; | ||
11901 | |||
11902 | /***/ }), | ||
11903 | /* 101 */ | ||
11904 | /***/ (function(module, exports, __webpack_require__) { | ||
11905 | |||
11906 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
11907 | * Copyright 2013-present, Facebook, Inc. | ||
11908 | * All rights reserved. | ||
11909 | * | ||
11910 | * This source code is licensed under the BSD-style license found in the | ||
11911 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11912 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11913 | * | ||
11914 | */ | ||
11915 | |||
11916 | 'use strict'; | ||
11917 | |||
11918 | var CSSProperty = __webpack_require__(102); | ||
11919 | var ExecutionEnvironment = __webpack_require__(54); | ||
11920 | var ReactInstrumentation = __webpack_require__(68); | ||
11921 | |||
11922 | var camelizeStyleName = __webpack_require__(103); | ||
11923 | var dangerousStyleValue = __webpack_require__(105); | ||
11924 | var hyphenateStyleName = __webpack_require__(106); | ||
11925 | var memoizeStringOnly = __webpack_require__(108); | ||
11926 | var warning = __webpack_require__(13); | ||
11927 | |||
11928 | var processStyleName = memoizeStringOnly(function (styleName) { | ||
11929 | return hyphenateStyleName(styleName); | ||
11930 | }); | ||
11931 | |||
11932 | var hasShorthandPropertyBug = false; | ||
11933 | var styleFloatAccessor = 'cssFloat'; | ||
11934 | if (ExecutionEnvironment.canUseDOM) { | ||
11935 | var tempStyle = document.createElement('div').style; | ||
11936 | try { | ||
11937 | // IE8 throws "Invalid argument." if resetting shorthand style properties. | ||
11938 | tempStyle.font = ''; | ||
11939 | } catch (e) { | ||
11940 | hasShorthandPropertyBug = true; | ||
11941 | } | ||
11942 | // IE8 only supports accessing cssFloat (standard) as styleFloat | ||
11943 | if (document.documentElement.style.cssFloat === undefined) { | ||
11944 | styleFloatAccessor = 'styleFloat'; | ||
11945 | } | ||
11946 | } | ||
11947 | |||
11948 | if (process.env.NODE_ENV !== 'production') { | ||
11949 | // 'msTransform' is correct, but the other prefixes should be capitalized | ||
11950 | var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/; | ||
11951 | |||
11952 | // style values shouldn't contain a semicolon | ||
11953 | var badStyleValueWithSemicolonPattern = /;\s*$/; | ||
11954 | |||
11955 | var warnedStyleNames = {}; | ||
11956 | var warnedStyleValues = {}; | ||
11957 | var warnedForNaNValue = false; | ||
11958 | |||
11959 | var warnHyphenatedStyleName = function (name, owner) { | ||
11960 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { | ||
11961 | return; | ||
11962 | } | ||
11963 | |||
11964 | warnedStyleNames[name] = true; | ||
11965 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0; | ||
11966 | }; | ||
11967 | |||
11968 | var warnBadVendoredStyleName = function (name, owner) { | ||
11969 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { | ||
11970 | return; | ||
11971 | } | ||
11972 | |||
11973 | warnedStyleNames[name] = true; | ||
11974 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0; | ||
11975 | }; | ||
11976 | |||
11977 | var warnStyleValueWithSemicolon = function (name, value, owner) { | ||
11978 | if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { | ||
11979 | return; | ||
11980 | } | ||
11981 | |||
11982 | warnedStyleValues[value] = true; | ||
11983 | process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0; | ||
11984 | }; | ||
11985 | |||
11986 | var warnStyleValueIsNaN = function (name, value, owner) { | ||
11987 | if (warnedForNaNValue) { | ||
11988 | return; | ||
11989 | } | ||
11990 | |||
11991 | warnedForNaNValue = true; | ||
11992 | process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0; | ||
11993 | }; | ||
11994 | |||
11995 | var checkRenderMessage = function (owner) { | ||
11996 | if (owner) { | ||
11997 | var name = owner.getName(); | ||
11998 | if (name) { | ||
11999 | return ' Check the render method of `' + name + '`.'; | ||
12000 | } | ||
12001 | } | ||
12002 | return ''; | ||
12003 | }; | ||
12004 | |||
12005 | /** | ||
12006 | * @param {string} name | ||
12007 | * @param {*} value | ||
12008 | * @param {ReactDOMComponent} component | ||
12009 | */ | ||
12010 | var warnValidStyle = function (name, value, component) { | ||
12011 | var owner; | ||
12012 | if (component) { | ||
12013 | owner = component._currentElement._owner; | ||
12014 | } | ||
12015 | if (name.indexOf('-') > -1) { | ||
12016 | warnHyphenatedStyleName(name, owner); | ||
12017 | } else if (badVendoredStyleNamePattern.test(name)) { | ||
12018 | warnBadVendoredStyleName(name, owner); | ||
12019 | } else if (badStyleValueWithSemicolonPattern.test(value)) { | ||
12020 | warnStyleValueWithSemicolon(name, value, owner); | ||
12021 | } | ||
12022 | |||
12023 | if (typeof value === 'number' && isNaN(value)) { | ||
12024 | warnStyleValueIsNaN(name, value, owner); | ||
12025 | } | ||
12026 | }; | ||
12027 | } | ||
12028 | |||
12029 | /** | ||
12030 | * Operations for dealing with CSS properties. | ||
12031 | */ | ||
12032 | var CSSPropertyOperations = { | ||
12033 | |||
12034 | /** | ||
12035 | * Serializes a mapping of style properties for use as inline styles: | ||
12036 | * | ||
12037 | * > createMarkupForStyles({width: '200px', height: 0}) | ||
12038 | * "width:200px;height:0;" | ||
12039 | * | ||
12040 | * Undefined values are ignored so that declarative programming is easier. | ||
12041 | * The result should be HTML-escaped before insertion into the DOM. | ||
12042 | * | ||
12043 | * @param {object} styles | ||
12044 | * @param {ReactDOMComponent} component | ||
12045 | * @return {?string} | ||
12046 | */ | ||
12047 | createMarkupForStyles: function (styles, component) { | ||
12048 | var serialized = ''; | ||
12049 | for (var styleName in styles) { | ||
12050 | if (!styles.hasOwnProperty(styleName)) { | ||
12051 | continue; | ||
12052 | } | ||
12053 | var styleValue = styles[styleName]; | ||
12054 | if (process.env.NODE_ENV !== 'production') { | ||
12055 | warnValidStyle(styleName, styleValue, component); | ||
12056 | } | ||
12057 | if (styleValue != null) { | ||
12058 | serialized += processStyleName(styleName) + ':'; | ||
12059 | serialized += dangerousStyleValue(styleName, styleValue, component) + ';'; | ||
12060 | } | ||
12061 | } | ||
12062 | return serialized || null; | ||
12063 | }, | ||
12064 | |||
12065 | /** | ||
12066 | * Sets the value for multiple styles on a node. If a value is specified as | ||
12067 | * '' (empty string), the corresponding style property will be unset. | ||
12068 | * | ||
12069 | * @param {DOMElement} node | ||
12070 | * @param {object} styles | ||
12071 | * @param {ReactDOMComponent} component | ||
12072 | */ | ||
12073 | setValueForStyles: function (node, styles, component) { | ||
12074 | if (process.env.NODE_ENV !== 'production') { | ||
12075 | ReactInstrumentation.debugTool.onHostOperation({ | ||
12076 | instanceID: component._debugID, | ||
12077 | type: 'update styles', | ||
12078 | payload: styles | ||
12079 | }); | ||
12080 | } | ||
12081 | |||
12082 | var style = node.style; | ||
12083 | for (var styleName in styles) { | ||
12084 | if (!styles.hasOwnProperty(styleName)) { | ||
12085 | continue; | ||
12086 | } | ||
12087 | if (process.env.NODE_ENV !== 'production') { | ||
12088 | warnValidStyle(styleName, styles[styleName], component); | ||
12089 | } | ||
12090 | var styleValue = dangerousStyleValue(styleName, styles[styleName], component); | ||
12091 | if (styleName === 'float' || styleName === 'cssFloat') { | ||
12092 | styleName = styleFloatAccessor; | ||
12093 | } | ||
12094 | if (styleValue) { | ||
12095 | style[styleName] = styleValue; | ||
12096 | } else { | ||
12097 | var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName]; | ||
12098 | if (expansion) { | ||
12099 | // Shorthand property that IE8 won't like unsetting, so unset each | ||
12100 | // component to placate it | ||
12101 | for (var individualStyleName in expansion) { | ||
12102 | style[individualStyleName] = ''; | ||
12103 | } | ||
12104 | } else { | ||
12105 | style[styleName] = ''; | ||
12106 | } | ||
12107 | } | ||
12108 | } | ||
12109 | } | ||
12110 | |||
12111 | }; | ||
12112 | |||
12113 | module.exports = CSSPropertyOperations; | ||
12114 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
12115 | |||
12116 | /***/ }), | ||
12117 | /* 102 */ | ||
12118 | /***/ (function(module, exports) { | ||
12119 | |||
12120 | /** | ||
12121 | * Copyright 2013-present, Facebook, Inc. | ||
12122 | * All rights reserved. | ||
12123 | * | ||
12124 | * This source code is licensed under the BSD-style license found in the | ||
12125 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12126 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12127 | * | ||
12128 | */ | ||
12129 | |||
12130 | 'use strict'; | ||
12131 | |||
12132 | /** | ||
12133 | * CSS properties which accept numbers but are not in units of "px". | ||
12134 | */ | ||
12135 | |||
12136 | var isUnitlessNumber = { | ||
12137 | animationIterationCount: true, | ||
12138 | borderImageOutset: true, | ||
12139 | borderImageSlice: true, | ||
12140 | borderImageWidth: true, | ||
12141 | boxFlex: true, | ||
12142 | boxFlexGroup: true, | ||
12143 | boxOrdinalGroup: true, | ||
12144 | columnCount: true, | ||
12145 | flex: true, | ||
12146 | flexGrow: true, | ||
12147 | flexPositive: true, | ||
12148 | flexShrink: true, | ||
12149 | flexNegative: true, | ||
12150 | flexOrder: true, | ||
12151 | gridRow: true, | ||
12152 | gridColumn: true, | ||
12153 | fontWeight: true, | ||
12154 | lineClamp: true, | ||
12155 | lineHeight: true, | ||
12156 | opacity: true, | ||
12157 | order: true, | ||
12158 | orphans: true, | ||
12159 | tabSize: true, | ||
12160 | widows: true, | ||
12161 | zIndex: true, | ||
12162 | zoom: true, | ||
12163 | |||
12164 | // SVG-related properties | ||
12165 | fillOpacity: true, | ||
12166 | floodOpacity: true, | ||
12167 | stopOpacity: true, | ||
12168 | strokeDasharray: true, | ||
12169 | strokeDashoffset: true, | ||
12170 | strokeMiterlimit: true, | ||
12171 | strokeOpacity: true, | ||
12172 | strokeWidth: true | ||
12173 | }; | ||
12174 | |||
12175 | /** | ||
12176 | * @param {string} prefix vendor-specific prefix, eg: Webkit | ||
12177 | * @param {string} key style name, eg: transitionDuration | ||
12178 | * @return {string} style name prefixed with `prefix`, properly camelCased, eg: | ||
12179 | * WebkitTransitionDuration | ||
12180 | */ | ||
12181 | function prefixKey(prefix, key) { | ||
12182 | return prefix + key.charAt(0).toUpperCase() + key.substring(1); | ||
12183 | } | ||
12184 | |||
12185 | /** | ||
12186 | * Support style names that may come passed in prefixed by adding permutations | ||
12187 | * of vendor prefixes. | ||
12188 | */ | ||
12189 | var prefixes = ['Webkit', 'ms', 'Moz', 'O']; | ||
12190 | |||
12191 | // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an | ||
12192 | // infinite loop, because it iterates over the newly added props too. | ||
12193 | Object.keys(isUnitlessNumber).forEach(function (prop) { | ||
12194 | prefixes.forEach(function (prefix) { | ||
12195 | isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; | ||
12196 | }); | ||
12197 | }); | ||
12198 | |||
12199 | /** | ||
12200 | * Most style properties can be unset by doing .style[prop] = '' but IE8 | ||
12201 | * doesn't like doing that with shorthand properties so for the properties that | ||
12202 | * IE8 breaks on, which are listed here, we instead unset each of the | ||
12203 | * individual properties. See http://bugs.jquery.com/ticket/12385. | ||
12204 | * The 4-value 'clock' properties like margin, padding, border-width seem to | ||
12205 | * behave without any problems. Curiously, list-style works too without any | ||
12206 | * special prodding. | ||
12207 | */ | ||
12208 | var shorthandPropertyExpansions = { | ||
12209 | background: { | ||
12210 | backgroundAttachment: true, | ||
12211 | backgroundColor: true, | ||
12212 | backgroundImage: true, | ||
12213 | backgroundPositionX: true, | ||
12214 | backgroundPositionY: true, | ||
12215 | backgroundRepeat: true | ||
12216 | }, | ||
12217 | backgroundPosition: { | ||
12218 | backgroundPositionX: true, | ||
12219 | backgroundPositionY: true | ||
12220 | }, | ||
12221 | border: { | ||
12222 | borderWidth: true, | ||
12223 | borderStyle: true, | ||
12224 | borderColor: true | ||
12225 | }, | ||
12226 | borderBottom: { | ||
12227 | borderBottomWidth: true, | ||
12228 | borderBottomStyle: true, | ||
12229 | borderBottomColor: true | ||
12230 | }, | ||
12231 | borderLeft: { | ||
12232 | borderLeftWidth: true, | ||
12233 | borderLeftStyle: true, | ||
12234 | borderLeftColor: true | ||
12235 | }, | ||
12236 | borderRight: { | ||
12237 | borderRightWidth: true, | ||
12238 | borderRightStyle: true, | ||
12239 | borderRightColor: true | ||
12240 | }, | ||
12241 | borderTop: { | ||
12242 | borderTopWidth: true, | ||
12243 | borderTopStyle: true, | ||
12244 | borderTopColor: true | ||
12245 | }, | ||
12246 | font: { | ||
12247 | fontStyle: true, | ||
12248 | fontVariant: true, | ||
12249 | fontWeight: true, | ||
12250 | fontSize: true, | ||
12251 | lineHeight: true, | ||
12252 | fontFamily: true | ||
12253 | }, | ||
12254 | outline: { | ||
12255 | outlineWidth: true, | ||
12256 | outlineStyle: true, | ||
12257 | outlineColor: true | ||
12258 | } | ||
12259 | }; | ||
12260 | |||
12261 | var CSSProperty = { | ||
12262 | isUnitlessNumber: isUnitlessNumber, | ||
12263 | shorthandPropertyExpansions: shorthandPropertyExpansions | ||
12264 | }; | ||
12265 | |||
12266 | module.exports = CSSProperty; | ||
12267 | |||
12268 | /***/ }), | ||
12269 | /* 103 */ | ||
12270 | /***/ (function(module, exports, __webpack_require__) { | ||
12271 | |||
12272 | /** | ||
12273 | * Copyright (c) 2013-present, Facebook, Inc. | ||
12274 | * All rights reserved. | ||
12275 | * | ||
12276 | * This source code is licensed under the BSD-style license found in the | ||
12277 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12278 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12279 | * | ||
12280 | * @typechecks | ||
12281 | */ | ||
12282 | |||
12283 | 'use strict'; | ||
12284 | |||
12285 | var camelize = __webpack_require__(104); | ||
12286 | |||
12287 | var msPattern = /^-ms-/; | ||
12288 | |||
12289 | /** | ||
12290 | * Camelcases a hyphenated CSS property name, for example: | ||
12291 | * | ||
12292 | * > camelizeStyleName('background-color') | ||
12293 | * < "backgroundColor" | ||
12294 | * > camelizeStyleName('-moz-transition') | ||
12295 | * < "MozTransition" | ||
12296 | * > camelizeStyleName('-ms-transition') | ||
12297 | * < "msTransition" | ||
12298 | * | ||
12299 | * As Andi Smith suggests | ||
12300 | * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix | ||
12301 | * is converted to lowercase `ms`. | ||
12302 | * | ||
12303 | * @param {string} string | ||
12304 | * @return {string} | ||
12305 | */ | ||
12306 | function camelizeStyleName(string) { | ||
12307 | return camelize(string.replace(msPattern, 'ms-')); | ||
12308 | } | ||
12309 | |||
12310 | module.exports = camelizeStyleName; | ||
12311 | |||
12312 | /***/ }), | ||
12313 | /* 104 */ | ||
12314 | /***/ (function(module, exports) { | ||
12315 | |||
12316 | "use strict"; | ||
12317 | |||
12318 | /** | ||
12319 | * Copyright (c) 2013-present, Facebook, Inc. | ||
12320 | * All rights reserved. | ||
12321 | * | ||
12322 | * This source code is licensed under the BSD-style license found in the | ||
12323 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12324 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12325 | * | ||
12326 | * @typechecks | ||
12327 | */ | ||
12328 | |||
12329 | var _hyphenPattern = /-(.)/g; | ||
12330 | |||
12331 | /** | ||
12332 | * Camelcases a hyphenated string, for example: | ||
12333 | * | ||
12334 | * > camelize('background-color') | ||
12335 | * < "backgroundColor" | ||
12336 | * | ||
12337 | * @param {string} string | ||
12338 | * @return {string} | ||
12339 | */ | ||
12340 | function camelize(string) { | ||
12341 | return string.replace(_hyphenPattern, function (_, character) { | ||
12342 | return character.toUpperCase(); | ||
12343 | }); | ||
12344 | } | ||
12345 | |||
12346 | module.exports = camelize; | ||
12347 | |||
12348 | /***/ }), | ||
12349 | /* 105 */ | ||
12350 | /***/ (function(module, exports, __webpack_require__) { | ||
12351 | |||
12352 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
12353 | * Copyright 2013-present, Facebook, Inc. | ||
12354 | * All rights reserved. | ||
12355 | * | ||
12356 | * This source code is licensed under the BSD-style license found in the | ||
12357 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12358 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12359 | * | ||
12360 | */ | ||
12361 | |||
12362 | 'use strict'; | ||
12363 | |||
12364 | var CSSProperty = __webpack_require__(102); | ||
12365 | var warning = __webpack_require__(13); | ||
12366 | |||
12367 | var isUnitlessNumber = CSSProperty.isUnitlessNumber; | ||
12368 | var styleWarnings = {}; | ||
12369 | |||
12370 | /** | ||
12371 | * Convert a value into the proper css writable value. The style name `name` | ||
12372 | * should be logical (no hyphens), as specified | ||
12373 | * in `CSSProperty.isUnitlessNumber`. | ||
12374 | * | ||
12375 | * @param {string} name CSS property name such as `topMargin`. | ||
12376 | * @param {*} value CSS property value such as `10px`. | ||
12377 | * @param {ReactDOMComponent} component | ||
12378 | * @return {string} Normalized style value with dimensions applied. | ||
12379 | */ | ||
12380 | function dangerousStyleValue(name, value, component) { | ||
12381 | // Note that we've removed escapeTextForBrowser() calls here since the | ||
12382 | // whole string will be escaped when the attribute is injected into | ||
12383 | // the markup. If you provide unsafe user data here they can inject | ||
12384 | // arbitrary CSS which may be problematic (I couldn't repro this): | ||
12385 | // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet | ||
12386 | // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/ | ||
12387 | // This is not an XSS hole but instead a potential CSS injection issue | ||
12388 | // which has lead to a greater discussion about how we're going to | ||
12389 | // trust URLs moving forward. See #2115901 | ||
12390 | |||
12391 | var isEmpty = value == null || typeof value === 'boolean' || value === ''; | ||
12392 | if (isEmpty) { | ||
12393 | return ''; | ||
12394 | } | ||
12395 | |||
12396 | var isNonNumeric = isNaN(value); | ||
12397 | if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) { | ||
12398 | return '' + value; // cast to string | ||
12399 | } | ||
12400 | |||
12401 | if (typeof value === 'string') { | ||
12402 | if (process.env.NODE_ENV !== 'production') { | ||
12403 | // Allow '0' to pass through without warning. 0 is already special and | ||
12404 | // doesn't require units, so we don't need to warn about it. | ||
12405 | if (component && value !== '0') { | ||
12406 | var owner = component._currentElement._owner; | ||
12407 | var ownerName = owner ? owner.getName() : null; | ||
12408 | if (ownerName && !styleWarnings[ownerName]) { | ||
12409 | styleWarnings[ownerName] = {}; | ||
12410 | } | ||
12411 | var warned = false; | ||
12412 | if (ownerName) { | ||
12413 | var warnings = styleWarnings[ownerName]; | ||
12414 | warned = warnings[name]; | ||
12415 | if (!warned) { | ||
12416 | warnings[name] = true; | ||
12417 | } | ||
12418 | } | ||
12419 | if (!warned) { | ||
12420 | process.env.NODE_ENV !== 'production' ? warning(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0; | ||
12421 | } | ||
12422 | } | ||
12423 | } | ||
12424 | value = value.trim(); | ||
12425 | } | ||
12426 | return value + 'px'; | ||
12427 | } | ||
12428 | |||
12429 | module.exports = dangerousStyleValue; | ||
12430 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
12431 | |||
12432 | /***/ }), | ||
12433 | /* 106 */ | ||
12434 | /***/ (function(module, exports, __webpack_require__) { | ||
12435 | |||
12436 | /** | ||
12437 | * Copyright (c) 2013-present, Facebook, Inc. | ||
12438 | * All rights reserved. | ||
12439 | * | ||
12440 | * This source code is licensed under the BSD-style license found in the | ||
12441 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12442 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12443 | * | ||
12444 | * @typechecks | ||
12445 | */ | ||
12446 | |||
12447 | 'use strict'; | ||
12448 | |||
12449 | var hyphenate = __webpack_require__(107); | ||
12450 | |||
12451 | var msPattern = /^ms-/; | ||
12452 | |||
12453 | /** | ||
12454 | * Hyphenates a camelcased CSS property name, for example: | ||
12455 | * | ||
12456 | * > hyphenateStyleName('backgroundColor') | ||
12457 | * < "background-color" | ||
12458 | * > hyphenateStyleName('MozTransition') | ||
12459 | * < "-moz-transition" | ||
12460 | * > hyphenateStyleName('msTransition') | ||
12461 | * < "-ms-transition" | ||
12462 | * | ||
12463 | * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix | ||
12464 | * is converted to `-ms-`. | ||
12465 | * | ||
12466 | * @param {string} string | ||
12467 | * @return {string} | ||
12468 | */ | ||
12469 | function hyphenateStyleName(string) { | ||
12470 | return hyphenate(string).replace(msPattern, '-ms-'); | ||
12471 | } | ||
12472 | |||
12473 | module.exports = hyphenateStyleName; | ||
12474 | |||
12475 | /***/ }), | ||
12476 | /* 107 */ | ||
12477 | /***/ (function(module, exports) { | ||
12478 | |||
12479 | 'use strict'; | ||
12480 | |||
12481 | /** | ||
12482 | * Copyright (c) 2013-present, Facebook, Inc. | ||
12483 | * All rights reserved. | ||
12484 | * | ||
12485 | * This source code is licensed under the BSD-style license found in the | ||
12486 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12487 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12488 | * | ||
12489 | * @typechecks | ||
12490 | */ | ||
12491 | |||
12492 | var _uppercasePattern = /([A-Z])/g; | ||
12493 | |||
12494 | /** | ||
12495 | * Hyphenates a camelcased string, for example: | ||
12496 | * | ||
12497 | * > hyphenate('backgroundColor') | ||
12498 | * < "background-color" | ||
12499 | * | ||
12500 | * For CSS style names, use `hyphenateStyleName` instead which works properly | ||
12501 | * with all vendor prefixes, including `ms`. | ||
12502 | * | ||
12503 | * @param {string} string | ||
12504 | * @return {string} | ||
12505 | */ | ||
12506 | function hyphenate(string) { | ||
12507 | return string.replace(_uppercasePattern, '-$1').toLowerCase(); | ||
12508 | } | ||
12509 | |||
12510 | module.exports = hyphenate; | ||
12511 | |||
12512 | /***/ }), | ||
12513 | /* 108 */ | ||
12514 | /***/ (function(module, exports) { | ||
12515 | |||
12516 | /** | ||
12517 | * Copyright (c) 2013-present, Facebook, Inc. | ||
12518 | * All rights reserved. | ||
12519 | * | ||
12520 | * This source code is licensed under the BSD-style license found in the | ||
12521 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12522 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12523 | * | ||
12524 | * | ||
12525 | * @typechecks static-only | ||
12526 | */ | ||
12527 | |||
12528 | 'use strict'; | ||
12529 | |||
12530 | /** | ||
12531 | * Memoizes the return value of a function that accepts one string argument. | ||
12532 | */ | ||
12533 | |||
12534 | function memoizeStringOnly(callback) { | ||
12535 | var cache = {}; | ||
12536 | return function (string) { | ||
12537 | if (!cache.hasOwnProperty(string)) { | ||
12538 | cache[string] = callback.call(this, string); | ||
12539 | } | ||
12540 | return cache[string]; | ||
12541 | }; | ||
12542 | } | ||
12543 | |||
12544 | module.exports = memoizeStringOnly; | ||
12545 | |||
12546 | /***/ }), | ||
12547 | /* 109 */ | ||
12548 | /***/ (function(module, exports, __webpack_require__) { | ||
12549 | |||
12550 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
12551 | * Copyright 2013-present, Facebook, Inc. | ||
12552 | * All rights reserved. | ||
12553 | * | ||
12554 | * This source code is licensed under the BSD-style license found in the | ||
12555 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12556 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12557 | * | ||
12558 | */ | ||
12559 | |||
12560 | 'use strict'; | ||
12561 | |||
12562 | var DOMProperty = __webpack_require__(42); | ||
12563 | var ReactDOMComponentTree = __webpack_require__(40); | ||
12564 | var ReactInstrumentation = __webpack_require__(68); | ||
12565 | |||
12566 | var quoteAttributeValueForBrowser = __webpack_require__(110); | ||
12567 | var warning = __webpack_require__(13); | ||
12568 | |||
12569 | var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); | ||
12570 | var illegalAttributeNameCache = {}; | ||
12571 | var validatedAttributeNameCache = {}; | ||
12572 | |||
12573 | function isAttributeNameSafe(attributeName) { | ||
12574 | if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { | ||
12575 | return true; | ||
12576 | } | ||
12577 | if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { | ||
12578 | return false; | ||
12579 | } | ||
12580 | if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { | ||
12581 | validatedAttributeNameCache[attributeName] = true; | ||
12582 | return true; | ||
12583 | } | ||
12584 | illegalAttributeNameCache[attributeName] = true; | ||
12585 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0; | ||
12586 | return false; | ||
12587 | } | ||
12588 | |||
12589 | function shouldIgnoreValue(propertyInfo, value) { | ||
12590 | return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false; | ||
12591 | } | ||
12592 | |||
12593 | /** | ||
12594 | * Operations for dealing with DOM properties. | ||
12595 | */ | ||
12596 | var DOMPropertyOperations = { | ||
12597 | |||
12598 | /** | ||
12599 | * Creates markup for the ID property. | ||
12600 | * | ||
12601 | * @param {string} id Unescaped ID. | ||
12602 | * @return {string} Markup string. | ||
12603 | */ | ||
12604 | createMarkupForID: function (id) { | ||
12605 | return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id); | ||
12606 | }, | ||
12607 | |||
12608 | setAttributeForID: function (node, id) { | ||
12609 | node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id); | ||
12610 | }, | ||
12611 | |||
12612 | createMarkupForRoot: function () { | ||
12613 | return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""'; | ||
12614 | }, | ||
12615 | |||
12616 | setAttributeForRoot: function (node) { | ||
12617 | node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, ''); | ||
12618 | }, | ||
12619 | |||
12620 | /** | ||
12621 | * Creates markup for a property. | ||
12622 | * | ||
12623 | * @param {string} name | ||
12624 | * @param {*} value | ||
12625 | * @return {?string} Markup string, or null if the property was invalid. | ||
12626 | */ | ||
12627 | createMarkupForProperty: function (name, value) { | ||
12628 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
12629 | if (propertyInfo) { | ||
12630 | if (shouldIgnoreValue(propertyInfo, value)) { | ||
12631 | return ''; | ||
12632 | } | ||
12633 | var attributeName = propertyInfo.attributeName; | ||
12634 | if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | ||
12635 | return attributeName + '=""'; | ||
12636 | } | ||
12637 | return attributeName + '=' + quoteAttributeValueForBrowser(value); | ||
12638 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
12639 | if (value == null) { | ||
12640 | return ''; | ||
12641 | } | ||
12642 | return name + '=' + quoteAttributeValueForBrowser(value); | ||
12643 | } | ||
12644 | return null; | ||
12645 | }, | ||
12646 | |||
12647 | /** | ||
12648 | * Creates markup for a custom property. | ||
12649 | * | ||
12650 | * @param {string} name | ||
12651 | * @param {*} value | ||
12652 | * @return {string} Markup string, or empty string if the property was invalid. | ||
12653 | */ | ||
12654 | createMarkupForCustomAttribute: function (name, value) { | ||
12655 | if (!isAttributeNameSafe(name) || value == null) { | ||
12656 | return ''; | ||
12657 | } | ||
12658 | return name + '=' + quoteAttributeValueForBrowser(value); | ||
12659 | }, | ||
12660 | |||
12661 | /** | ||
12662 | * Sets the value for a property on a node. | ||
12663 | * | ||
12664 | * @param {DOMElement} node | ||
12665 | * @param {string} name | ||
12666 | * @param {*} value | ||
12667 | */ | ||
12668 | setValueForProperty: function (node, name, value) { | ||
12669 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
12670 | if (propertyInfo) { | ||
12671 | var mutationMethod = propertyInfo.mutationMethod; | ||
12672 | if (mutationMethod) { | ||
12673 | mutationMethod(node, value); | ||
12674 | } else if (shouldIgnoreValue(propertyInfo, value)) { | ||
12675 | this.deleteValueForProperty(node, name); | ||
12676 | return; | ||
12677 | } else if (propertyInfo.mustUseProperty) { | ||
12678 | // Contrary to `setAttribute`, object properties are properly | ||
12679 | // `toString`ed by IE8/9. | ||
12680 | node[propertyInfo.propertyName] = value; | ||
12681 | } else { | ||
12682 | var attributeName = propertyInfo.attributeName; | ||
12683 | var namespace = propertyInfo.attributeNamespace; | ||
12684 | // `setAttribute` with objects becomes only `[object]` in IE8/9, | ||
12685 | // ('' + value) makes it output the correct toString()-value. | ||
12686 | if (namespace) { | ||
12687 | node.setAttributeNS(namespace, attributeName, '' + value); | ||
12688 | } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | ||
12689 | node.setAttribute(attributeName, ''); | ||
12690 | } else { | ||
12691 | node.setAttribute(attributeName, '' + value); | ||
12692 | } | ||
12693 | } | ||
12694 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
12695 | DOMPropertyOperations.setValueForAttribute(node, name, value); | ||
12696 | return; | ||
12697 | } | ||
12698 | |||
12699 | if (process.env.NODE_ENV !== 'production') { | ||
12700 | var payload = {}; | ||
12701 | payload[name] = value; | ||
12702 | ReactInstrumentation.debugTool.onHostOperation({ | ||
12703 | instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | ||
12704 | type: 'update attribute', | ||
12705 | payload: payload | ||
12706 | }); | ||
12707 | } | ||
12708 | }, | ||
12709 | |||
12710 | setValueForAttribute: function (node, name, value) { | ||
12711 | if (!isAttributeNameSafe(name)) { | ||
12712 | return; | ||
12713 | } | ||
12714 | if (value == null) { | ||
12715 | node.removeAttribute(name); | ||
12716 | } else { | ||
12717 | node.setAttribute(name, '' + value); | ||
12718 | } | ||
12719 | |||
12720 | if (process.env.NODE_ENV !== 'production') { | ||
12721 | var payload = {}; | ||
12722 | payload[name] = value; | ||
12723 | ReactInstrumentation.debugTool.onHostOperation({ | ||
12724 | instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | ||
12725 | type: 'update attribute', | ||
12726 | payload: payload | ||
12727 | }); | ||
12728 | } | ||
12729 | }, | ||
12730 | |||
12731 | /** | ||
12732 | * Deletes an attributes from a node. | ||
12733 | * | ||
12734 | * @param {DOMElement} node | ||
12735 | * @param {string} name | ||
12736 | */ | ||
12737 | deleteValueForAttribute: function (node, name) { | ||
12738 | node.removeAttribute(name); | ||
12739 | if (process.env.NODE_ENV !== 'production') { | ||
12740 | ReactInstrumentation.debugTool.onHostOperation({ | ||
12741 | instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | ||
12742 | type: 'remove attribute', | ||
12743 | payload: name | ||
12744 | }); | ||
12745 | } | ||
12746 | }, | ||
12747 | |||
12748 | /** | ||
12749 | * Deletes the value for a property on a node. | ||
12750 | * | ||
12751 | * @param {DOMElement} node | ||
12752 | * @param {string} name | ||
12753 | */ | ||
12754 | deleteValueForProperty: function (node, name) { | ||
12755 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
12756 | if (propertyInfo) { | ||
12757 | var mutationMethod = propertyInfo.mutationMethod; | ||
12758 | if (mutationMethod) { | ||
12759 | mutationMethod(node, undefined); | ||
12760 | } else if (propertyInfo.mustUseProperty) { | ||
12761 | var propName = propertyInfo.propertyName; | ||
12762 | if (propertyInfo.hasBooleanValue) { | ||
12763 | node[propName] = false; | ||
12764 | } else { | ||
12765 | node[propName] = ''; | ||
12766 | } | ||
12767 | } else { | ||
12768 | node.removeAttribute(propertyInfo.attributeName); | ||
12769 | } | ||
12770 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
12771 | node.removeAttribute(name); | ||
12772 | } | ||
12773 | |||
12774 | if (process.env.NODE_ENV !== 'production') { | ||
12775 | ReactInstrumentation.debugTool.onHostOperation({ | ||
12776 | instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | ||
12777 | type: 'remove attribute', | ||
12778 | payload: name | ||
12779 | }); | ||
12780 | } | ||
12781 | } | ||
12782 | |||
12783 | }; | ||
12784 | |||
12785 | module.exports = DOMPropertyOperations; | ||
12786 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
12787 | |||
12788 | /***/ }), | ||
12789 | /* 110 */ | ||
12790 | /***/ (function(module, exports, __webpack_require__) { | ||
12791 | |||
12792 | /** | ||
12793 | * Copyright 2013-present, Facebook, Inc. | ||
12794 | * All rights reserved. | ||
12795 | * | ||
12796 | * This source code is licensed under the BSD-style license found in the | ||
12797 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12798 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12799 | * | ||
12800 | */ | ||
12801 | |||
12802 | 'use strict'; | ||
12803 | |||
12804 | var escapeTextContentForBrowser = __webpack_require__(92); | ||
12805 | |||
12806 | /** | ||
12807 | * Escapes attribute value to prevent scripting attacks. | ||
12808 | * | ||
12809 | * @param {*} value Value to escape. | ||
12810 | * @return {string} An escaped string. | ||
12811 | */ | ||
12812 | function quoteAttributeValueForBrowser(value) { | ||
12813 | return '"' + escapeTextContentForBrowser(value) + '"'; | ||
12814 | } | ||
12815 | |||
12816 | module.exports = quoteAttributeValueForBrowser; | ||
12817 | |||
12818 | /***/ }), | ||
12819 | /* 111 */ | ||
12820 | /***/ (function(module, exports, __webpack_require__) { | ||
12821 | |||
12822 | /** | ||
12823 | * Copyright 2013-present, Facebook, Inc. | ||
12824 | * All rights reserved. | ||
12825 | * | ||
12826 | * This source code is licensed under the BSD-style license found in the | ||
12827 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12828 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12829 | * | ||
12830 | */ | ||
12831 | |||
12832 | 'use strict'; | ||
12833 | |||
12834 | var _assign = __webpack_require__(6); | ||
12835 | |||
12836 | var EventPluginRegistry = __webpack_require__(49); | ||
12837 | var ReactEventEmitterMixin = __webpack_require__(112); | ||
12838 | var ViewportMetrics = __webpack_require__(82); | ||
12839 | |||
12840 | var getVendorPrefixedEventName = __webpack_require__(113); | ||
12841 | var isEventSupported = __webpack_require__(76); | ||
12842 | |||
12843 | /** | ||
12844 | * Summary of `ReactBrowserEventEmitter` event handling: | ||
12845 | * | ||
12846 | * - Top-level delegation is used to trap most native browser events. This | ||
12847 | * may only occur in the main thread and is the responsibility of | ||
12848 | * ReactEventListener, which is injected and can therefore support pluggable | ||
12849 | * event sources. This is the only work that occurs in the main thread. | ||
12850 | * | ||
12851 | * - We normalize and de-duplicate events to account for browser quirks. This | ||
12852 | * may be done in the worker thread. | ||
12853 | * | ||
12854 | * - Forward these native events (with the associated top-level type used to | ||
12855 | * trap it) to `EventPluginHub`, which in turn will ask plugins if they want | ||
12856 | * to extract any synthetic events. | ||
12857 | * | ||
12858 | * - The `EventPluginHub` will then process each event by annotating them with | ||
12859 | * "dispatches", a sequence of listeners and IDs that care about that event. | ||
12860 | * | ||
12861 | * - The `EventPluginHub` then dispatches the events. | ||
12862 | * | ||
12863 | * Overview of React and the event system: | ||
12864 | * | ||
12865 | * +------------+ . | ||
12866 | * | DOM | . | ||
12867 | * +------------+ . | ||
12868 | * | . | ||
12869 | * v . | ||
12870 | * +------------+ . | ||
12871 | * | ReactEvent | . | ||
12872 | * | Listener | . | ||
12873 | * +------------+ . +-----------+ | ||
12874 | * | . +--------+|SimpleEvent| | ||
12875 | * | . | |Plugin | | ||
12876 | * +-----|------+ . v +-----------+ | ||
12877 | * | | | . +--------------+ +------------+ | ||
12878 | * | +-----------.--->|EventPluginHub| | Event | | ||
12879 | * | | . | | +-----------+ | Propagators| | ||
12880 | * | ReactEvent | . | | |TapEvent | |------------| | ||
12881 | * | Emitter | . | |<---+|Plugin | |other plugin| | ||
12882 | * | | . | | +-----------+ | utilities | | ||
12883 | * | +-----------.--->| | +------------+ | ||
12884 | * | | | . +--------------+ | ||
12885 | * +-----|------+ . ^ +-----------+ | ||
12886 | * | . | |Enter/Leave| | ||
12887 | * + . +-------+|Plugin | | ||
12888 | * +-------------+ . +-----------+ | ||
12889 | * | application | . | ||
12890 | * |-------------| . | ||
12891 | * | | . | ||
12892 | * | | . | ||
12893 | * +-------------+ . | ||
12894 | * . | ||
12895 | * React Core . General Purpose Event Plugin System | ||
12896 | */ | ||
12897 | |||
12898 | var hasEventPageXY; | ||
12899 | var alreadyListeningTo = {}; | ||
12900 | var isMonitoringScrollValue = false; | ||
12901 | var reactTopListenersCounter = 0; | ||
12902 | |||
12903 | // For events like 'submit' which don't consistently bubble (which we trap at a | ||
12904 | // lower node than `document`), binding at `document` would cause duplicate | ||
12905 | // events so we don't include them here | ||
12906 | var topEventMapping = { | ||
12907 | topAbort: 'abort', | ||
12908 | topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend', | ||
12909 | topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration', | ||
12910 | topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart', | ||
12911 | topBlur: 'blur', | ||
12912 | topCanPlay: 'canplay', | ||
12913 | topCanPlayThrough: 'canplaythrough', | ||
12914 | topChange: 'change', | ||
12915 | topClick: 'click', | ||
12916 | topCompositionEnd: 'compositionend', | ||
12917 | topCompositionStart: 'compositionstart', | ||
12918 | topCompositionUpdate: 'compositionupdate', | ||
12919 | topContextMenu: 'contextmenu', | ||
12920 | topCopy: 'copy', | ||
12921 | topCut: 'cut', | ||
12922 | topDoubleClick: 'dblclick', | ||
12923 | topDrag: 'drag', | ||
12924 | topDragEnd: 'dragend', | ||
12925 | topDragEnter: 'dragenter', | ||
12926 | topDragExit: 'dragexit', | ||
12927 | topDragLeave: 'dragleave', | ||
12928 | topDragOver: 'dragover', | ||
12929 | topDragStart: 'dragstart', | ||
12930 | topDrop: 'drop', | ||
12931 | topDurationChange: 'durationchange', | ||
12932 | topEmptied: 'emptied', | ||
12933 | topEncrypted: 'encrypted', | ||
12934 | topEnded: 'ended', | ||
12935 | topError: 'error', | ||
12936 | topFocus: 'focus', | ||
12937 | topInput: 'input', | ||
12938 | topKeyDown: 'keydown', | ||
12939 | topKeyPress: 'keypress', | ||
12940 | topKeyUp: 'keyup', | ||
12941 | topLoadedData: 'loadeddata', | ||
12942 | topLoadedMetadata: 'loadedmetadata', | ||
12943 | topLoadStart: 'loadstart', | ||
12944 | topMouseDown: 'mousedown', | ||
12945 | topMouseMove: 'mousemove', | ||
12946 | topMouseOut: 'mouseout', | ||
12947 | topMouseOver: 'mouseover', | ||
12948 | topMouseUp: 'mouseup', | ||
12949 | topPaste: 'paste', | ||
12950 | topPause: 'pause', | ||
12951 | topPlay: 'play', | ||
12952 | topPlaying: 'playing', | ||
12953 | topProgress: 'progress', | ||
12954 | topRateChange: 'ratechange', | ||
12955 | topScroll: 'scroll', | ||
12956 | topSeeked: 'seeked', | ||
12957 | topSeeking: 'seeking', | ||
12958 | topSelectionChange: 'selectionchange', | ||
12959 | topStalled: 'stalled', | ||
12960 | topSuspend: 'suspend', | ||
12961 | topTextInput: 'textInput', | ||
12962 | topTimeUpdate: 'timeupdate', | ||
12963 | topTouchCancel: 'touchcancel', | ||
12964 | topTouchEnd: 'touchend', | ||
12965 | topTouchMove: 'touchmove', | ||
12966 | topTouchStart: 'touchstart', | ||
12967 | topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend', | ||
12968 | topVolumeChange: 'volumechange', | ||
12969 | topWaiting: 'waiting', | ||
12970 | topWheel: 'wheel' | ||
12971 | }; | ||
12972 | |||
12973 | /** | ||
12974 | * To ensure no conflicts with other potential React instances on the page | ||
12975 | */ | ||
12976 | var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2); | ||
12977 | |||
12978 | function getListeningForDocument(mountAt) { | ||
12979 | // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` | ||
12980 | // directly. | ||
12981 | if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { | ||
12982 | mountAt[topListenersIDKey] = reactTopListenersCounter++; | ||
12983 | alreadyListeningTo[mountAt[topListenersIDKey]] = {}; | ||
12984 | } | ||
12985 | return alreadyListeningTo[mountAt[topListenersIDKey]]; | ||
12986 | } | ||
12987 | |||
12988 | /** | ||
12989 | * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For | ||
12990 | * example: | ||
12991 | * | ||
12992 | * EventPluginHub.putListener('myID', 'onClick', myFunction); | ||
12993 | * | ||
12994 | * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. | ||
12995 | * | ||
12996 | * @internal | ||
12997 | */ | ||
12998 | var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, { | ||
12999 | |||
13000 | /** | ||
13001 | * Injectable event backend | ||
13002 | */ | ||
13003 | ReactEventListener: null, | ||
13004 | |||
13005 | injection: { | ||
13006 | /** | ||
13007 | * @param {object} ReactEventListener | ||
13008 | */ | ||
13009 | injectReactEventListener: function (ReactEventListener) { | ||
13010 | ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel); | ||
13011 | ReactBrowserEventEmitter.ReactEventListener = ReactEventListener; | ||
13012 | } | ||
13013 | }, | ||
13014 | |||
13015 | /** | ||
13016 | * Sets whether or not any created callbacks should be enabled. | ||
13017 | * | ||
13018 | * @param {boolean} enabled True if callbacks should be enabled. | ||
13019 | */ | ||
13020 | setEnabled: function (enabled) { | ||
13021 | if (ReactBrowserEventEmitter.ReactEventListener) { | ||
13022 | ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled); | ||
13023 | } | ||
13024 | }, | ||
13025 | |||
13026 | /** | ||
13027 | * @return {boolean} True if callbacks are enabled. | ||
13028 | */ | ||
13029 | isEnabled: function () { | ||
13030 | return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled()); | ||
13031 | }, | ||
13032 | |||
13033 | /** | ||
13034 | * We listen for bubbled touch events on the document object. | ||
13035 | * | ||
13036 | * Firefox v8.01 (and possibly others) exhibited strange behavior when | ||
13037 | * mounting `onmousemove` events at some node that was not the document | ||
13038 | * element. The symptoms were that if your mouse is not moving over something | ||
13039 | * contained within that mount point (for example on the background) the | ||
13040 | * top-level listeners for `onmousemove` won't be called. However, if you | ||
13041 | * register the `mousemove` on the document object, then it will of course | ||
13042 | * catch all `mousemove`s. This along with iOS quirks, justifies restricting | ||
13043 | * top-level listeners to the document object only, at least for these | ||
13044 | * movement types of events and possibly all events. | ||
13045 | * | ||
13046 | * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html | ||
13047 | * | ||
13048 | * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but | ||
13049 | * they bubble to document. | ||
13050 | * | ||
13051 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
13052 | * @param {object} contentDocumentHandle Document which owns the container | ||
13053 | */ | ||
13054 | listenTo: function (registrationName, contentDocumentHandle) { | ||
13055 | var mountAt = contentDocumentHandle; | ||
13056 | var isListening = getListeningForDocument(mountAt); | ||
13057 | var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName]; | ||
13058 | |||
13059 | for (var i = 0; i < dependencies.length; i++) { | ||
13060 | var dependency = dependencies[i]; | ||
13061 | if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { | ||
13062 | if (dependency === 'topWheel') { | ||
13063 | if (isEventSupported('wheel')) { | ||
13064 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt); | ||
13065 | } else if (isEventSupported('mousewheel')) { | ||
13066 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt); | ||
13067 | } else { | ||
13068 | // Firefox needs to capture a different mouse scroll event. | ||
13069 | // @see http://www.quirksmode.org/dom/events/tests/scroll.html | ||
13070 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt); | ||
13071 | } | ||
13072 | } else if (dependency === 'topScroll') { | ||
13073 | |||
13074 | if (isEventSupported('scroll', true)) { | ||
13075 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt); | ||
13076 | } else { | ||
13077 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE); | ||
13078 | } | ||
13079 | } else if (dependency === 'topFocus' || dependency === 'topBlur') { | ||
13080 | |||
13081 | if (isEventSupported('focus', true)) { | ||
13082 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt); | ||
13083 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt); | ||
13084 | } else if (isEventSupported('focusin')) { | ||
13085 | // IE has `focusin` and `focusout` events which bubble. | ||
13086 | // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html | ||
13087 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt); | ||
13088 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt); | ||
13089 | } | ||
13090 | |||
13091 | // to make sure blur and focus event listeners are only attached once | ||
13092 | isListening.topBlur = true; | ||
13093 | isListening.topFocus = true; | ||
13094 | } else if (topEventMapping.hasOwnProperty(dependency)) { | ||
13095 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt); | ||
13096 | } | ||
13097 | |||
13098 | isListening[dependency] = true; | ||
13099 | } | ||
13100 | } | ||
13101 | }, | ||
13102 | |||
13103 | trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { | ||
13104 | return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle); | ||
13105 | }, | ||
13106 | |||
13107 | trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { | ||
13108 | return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle); | ||
13109 | }, | ||
13110 | |||
13111 | /** | ||
13112 | * Protect against document.createEvent() returning null | ||
13113 | * Some popup blocker extensions appear to do this: | ||
13114 | * https://github.com/facebook/react/issues/6887 | ||
13115 | */ | ||
13116 | supportsEventPageXY: function () { | ||
13117 | if (!document.createEvent) { | ||
13118 | return false; | ||
13119 | } | ||
13120 | var ev = document.createEvent('MouseEvent'); | ||
13121 | return ev != null && 'pageX' in ev; | ||
13122 | }, | ||
13123 | |||
13124 | /** | ||
13125 | * Listens to window scroll and resize events. We cache scroll values so that | ||
13126 | * application code can access them without triggering reflows. | ||
13127 | * | ||
13128 | * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when | ||
13129 | * pageX/pageY isn't supported (legacy browsers). | ||
13130 | * | ||
13131 | * NOTE: Scroll events do not bubble. | ||
13132 | * | ||
13133 | * @see http://www.quirksmode.org/dom/events/scroll.html | ||
13134 | */ | ||
13135 | ensureScrollValueMonitoring: function () { | ||
13136 | if (hasEventPageXY === undefined) { | ||
13137 | hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY(); | ||
13138 | } | ||
13139 | if (!hasEventPageXY && !isMonitoringScrollValue) { | ||
13140 | var refresh = ViewportMetrics.refreshScrollValues; | ||
13141 | ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh); | ||
13142 | isMonitoringScrollValue = true; | ||
13143 | } | ||
13144 | } | ||
13145 | |||
13146 | }); | ||
13147 | |||
13148 | module.exports = ReactBrowserEventEmitter; | ||
13149 | |||
13150 | /***/ }), | ||
13151 | /* 112 */ | ||
13152 | /***/ (function(module, exports, __webpack_require__) { | ||
13153 | |||
13154 | /** | ||
13155 | * Copyright 2013-present, Facebook, Inc. | ||
13156 | * All rights reserved. | ||
13157 | * | ||
13158 | * This source code is licensed under the BSD-style license found in the | ||
13159 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13160 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13161 | * | ||
13162 | */ | ||
13163 | |||
13164 | 'use strict'; | ||
13165 | |||
13166 | var EventPluginHub = __webpack_require__(48); | ||
13167 | |||
13168 | function runEventQueueInBatch(events) { | ||
13169 | EventPluginHub.enqueueEvents(events); | ||
13170 | EventPluginHub.processEventQueue(false); | ||
13171 | } | ||
13172 | |||
13173 | var ReactEventEmitterMixin = { | ||
13174 | |||
13175 | /** | ||
13176 | * Streams a fired top-level event to `EventPluginHub` where plugins have the | ||
13177 | * opportunity to create `ReactEvent`s to be dispatched. | ||
13178 | */ | ||
13179 | handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
13180 | var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); | ||
13181 | runEventQueueInBatch(events); | ||
13182 | } | ||
13183 | }; | ||
13184 | |||
13185 | module.exports = ReactEventEmitterMixin; | ||
13186 | |||
13187 | /***/ }), | ||
13188 | /* 113 */ | ||
13189 | /***/ (function(module, exports, __webpack_require__) { | ||
13190 | |||
13191 | /** | ||
13192 | * Copyright 2013-present, Facebook, Inc. | ||
13193 | * All rights reserved. | ||
13194 | * | ||
13195 | * This source code is licensed under the BSD-style license found in the | ||
13196 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13197 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13198 | * | ||
13199 | */ | ||
13200 | |||
13201 | 'use strict'; | ||
13202 | |||
13203 | var ExecutionEnvironment = __webpack_require__(54); | ||
13204 | |||
13205 | /** | ||
13206 | * Generate a mapping of standard vendor prefixes using the defined style property and event name. | ||
13207 | * | ||
13208 | * @param {string} styleProp | ||
13209 | * @param {string} eventName | ||
13210 | * @returns {object} | ||
13211 | */ | ||
13212 | function makePrefixMap(styleProp, eventName) { | ||
13213 | var prefixes = {}; | ||
13214 | |||
13215 | prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); | ||
13216 | prefixes['Webkit' + styleProp] = 'webkit' + eventName; | ||
13217 | prefixes['Moz' + styleProp] = 'moz' + eventName; | ||
13218 | prefixes['ms' + styleProp] = 'MS' + eventName; | ||
13219 | prefixes['O' + styleProp] = 'o' + eventName.toLowerCase(); | ||
13220 | |||
13221 | return prefixes; | ||
13222 | } | ||
13223 | |||
13224 | /** | ||
13225 | * A list of event names to a configurable list of vendor prefixes. | ||
13226 | */ | ||
13227 | var vendorPrefixes = { | ||
13228 | animationend: makePrefixMap('Animation', 'AnimationEnd'), | ||
13229 | animationiteration: makePrefixMap('Animation', 'AnimationIteration'), | ||
13230 | animationstart: makePrefixMap('Animation', 'AnimationStart'), | ||
13231 | transitionend: makePrefixMap('Transition', 'TransitionEnd') | ||
13232 | }; | ||
13233 | |||
13234 | /** | ||
13235 | * Event names that have already been detected and prefixed (if applicable). | ||
13236 | */ | ||
13237 | var prefixedEventNames = {}; | ||
13238 | |||
13239 | /** | ||
13240 | * Element to check for prefixes on. | ||
13241 | */ | ||
13242 | var style = {}; | ||
13243 | |||
13244 | /** | ||
13245 | * Bootstrap if a DOM exists. | ||
13246 | */ | ||
13247 | if (ExecutionEnvironment.canUseDOM) { | ||
13248 | style = document.createElement('div').style; | ||
13249 | |||
13250 | // On some platforms, in particular some releases of Android 4.x, | ||
13251 | // the un-prefixed "animation" and "transition" properties are defined on the | ||
13252 | // style object but the events that fire will still be prefixed, so we need | ||
13253 | // to check if the un-prefixed events are usable, and if not remove them from the map. | ||
13254 | if (!('AnimationEvent' in window)) { | ||
13255 | delete vendorPrefixes.animationend.animation; | ||
13256 | delete vendorPrefixes.animationiteration.animation; | ||
13257 | delete vendorPrefixes.animationstart.animation; | ||
13258 | } | ||
13259 | |||
13260 | // Same as above | ||
13261 | if (!('TransitionEvent' in window)) { | ||
13262 | delete vendorPrefixes.transitionend.transition; | ||
13263 | } | ||
13264 | } | ||
13265 | |||
13266 | /** | ||
13267 | * Attempts to determine the correct vendor prefixed event name. | ||
13268 | * | ||
13269 | * @param {string} eventName | ||
13270 | * @returns {string} | ||
13271 | */ | ||
13272 | function getVendorPrefixedEventName(eventName) { | ||
13273 | if (prefixedEventNames[eventName]) { | ||
13274 | return prefixedEventNames[eventName]; | ||
13275 | } else if (!vendorPrefixes[eventName]) { | ||
13276 | return eventName; | ||
13277 | } | ||
13278 | |||
13279 | var prefixMap = vendorPrefixes[eventName]; | ||
13280 | |||
13281 | for (var styleProp in prefixMap) { | ||
13282 | if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { | ||
13283 | return prefixedEventNames[eventName] = prefixMap[styleProp]; | ||
13284 | } | ||
13285 | } | ||
13286 | |||
13287 | return ''; | ||
13288 | } | ||
13289 | |||
13290 | module.exports = getVendorPrefixedEventName; | ||
13291 | |||
13292 | /***/ }), | ||
13293 | /* 114 */ | ||
13294 | /***/ (function(module, exports, __webpack_require__) { | ||
13295 | |||
13296 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13297 | * Copyright 2013-present, Facebook, Inc. | ||
13298 | * All rights reserved. | ||
13299 | * | ||
13300 | * This source code is licensed under the BSD-style license found in the | ||
13301 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13302 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13303 | * | ||
13304 | */ | ||
13305 | |||
13306 | 'use strict'; | ||
13307 | |||
13308 | var _prodInvariant = __webpack_require__(41), | ||
13309 | _assign = __webpack_require__(6); | ||
13310 | |||
13311 | var DOMPropertyOperations = __webpack_require__(109); | ||
13312 | var LinkedValueUtils = __webpack_require__(115); | ||
13313 | var ReactDOMComponentTree = __webpack_require__(40); | ||
13314 | var ReactUpdates = __webpack_require__(62); | ||
13315 | |||
13316 | var invariant = __webpack_require__(10); | ||
13317 | var warning = __webpack_require__(13); | ||
13318 | |||
13319 | var didWarnValueLink = false; | ||
13320 | var didWarnCheckedLink = false; | ||
13321 | var didWarnValueDefaultValue = false; | ||
13322 | var didWarnCheckedDefaultChecked = false; | ||
13323 | var didWarnControlledToUncontrolled = false; | ||
13324 | var didWarnUncontrolledToControlled = false; | ||
13325 | |||
13326 | function forceUpdateIfMounted() { | ||
13327 | if (this._rootNodeID) { | ||
13328 | // DOM component is still mounted; update | ||
13329 | ReactDOMInput.updateWrapper(this); | ||
13330 | } | ||
13331 | } | ||
13332 | |||
13333 | function isControlled(props) { | ||
13334 | var usesChecked = props.type === 'checkbox' || props.type === 'radio'; | ||
13335 | return usesChecked ? props.checked != null : props.value != null; | ||
13336 | } | ||
13337 | |||
13338 | /** | ||
13339 | * Implements an <input> host component that allows setting these optional | ||
13340 | * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. | ||
13341 | * | ||
13342 | * If `checked` or `value` are not supplied (or null/undefined), user actions | ||
13343 | * that affect the checked state or value will trigger updates to the element. | ||
13344 | * | ||
13345 | * If they are supplied (and not null/undefined), the rendered element will not | ||
13346 | * trigger updates to the element. Instead, the props must change in order for | ||
13347 | * the rendered element to be updated. | ||
13348 | * | ||
13349 | * The rendered element will be initialized as unchecked (or `defaultChecked`) | ||
13350 | * with an empty value (or `defaultValue`). | ||
13351 | * | ||
13352 | * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html | ||
13353 | */ | ||
13354 | var ReactDOMInput = { | ||
13355 | getHostProps: function (inst, props) { | ||
13356 | var value = LinkedValueUtils.getValue(props); | ||
13357 | var checked = LinkedValueUtils.getChecked(props); | ||
13358 | |||
13359 | var hostProps = _assign({ | ||
13360 | // Make sure we set .type before any other properties (setting .value | ||
13361 | // before .type means .value is lost in IE11 and below) | ||
13362 | type: undefined, | ||
13363 | // Make sure we set .step before .value (setting .value before .step | ||
13364 | // means .value is rounded on mount, based upon step precision) | ||
13365 | step: undefined, | ||
13366 | // Make sure we set .min & .max before .value (to ensure proper order | ||
13367 | // in corner cases such as min or max deriving from value, e.g. Issue #7170) | ||
13368 | min: undefined, | ||
13369 | max: undefined | ||
13370 | }, props, { | ||
13371 | defaultChecked: undefined, | ||
13372 | defaultValue: undefined, | ||
13373 | value: value != null ? value : inst._wrapperState.initialValue, | ||
13374 | checked: checked != null ? checked : inst._wrapperState.initialChecked, | ||
13375 | onChange: inst._wrapperState.onChange | ||
13376 | }); | ||
13377 | |||
13378 | return hostProps; | ||
13379 | }, | ||
13380 | |||
13381 | mountWrapper: function (inst, props) { | ||
13382 | if (process.env.NODE_ENV !== 'production') { | ||
13383 | LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner); | ||
13384 | |||
13385 | var owner = inst._currentElement._owner; | ||
13386 | |||
13387 | if (props.valueLink !== undefined && !didWarnValueLink) { | ||
13388 | process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0; | ||
13389 | didWarnValueLink = true; | ||
13390 | } | ||
13391 | if (props.checkedLink !== undefined && !didWarnCheckedLink) { | ||
13392 | process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0; | ||
13393 | didWarnCheckedLink = true; | ||
13394 | } | ||
13395 | if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { | ||
13396 | process.env.NODE_ENV !== 'production' ? warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0; | ||
13397 | didWarnCheckedDefaultChecked = true; | ||
13398 | } | ||
13399 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { | ||
13400 | process.env.NODE_ENV !== 'production' ? warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0; | ||
13401 | didWarnValueDefaultValue = true; | ||
13402 | } | ||
13403 | } | ||
13404 | |||
13405 | var defaultValue = props.defaultValue; | ||
13406 | inst._wrapperState = { | ||
13407 | initialChecked: props.checked != null ? props.checked : props.defaultChecked, | ||
13408 | initialValue: props.value != null ? props.value : defaultValue, | ||
13409 | listeners: null, | ||
13410 | onChange: _handleChange.bind(inst), | ||
13411 | controlled: isControlled(props) | ||
13412 | }; | ||
13413 | }, | ||
13414 | |||
13415 | updateWrapper: function (inst) { | ||
13416 | var props = inst._currentElement.props; | ||
13417 | |||
13418 | if (process.env.NODE_ENV !== 'production') { | ||
13419 | var controlled = isControlled(props); | ||
13420 | var owner = inst._currentElement._owner; | ||
13421 | |||
13422 | if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) { | ||
13423 | process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0; | ||
13424 | didWarnUncontrolledToControlled = true; | ||
13425 | } | ||
13426 | if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) { | ||
13427 | process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0; | ||
13428 | didWarnControlledToUncontrolled = true; | ||
13429 | } | ||
13430 | } | ||
13431 | |||
13432 | // TODO: Shouldn't this be getChecked(props)? | ||
13433 | var checked = props.checked; | ||
13434 | if (checked != null) { | ||
13435 | DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false); | ||
13436 | } | ||
13437 | |||
13438 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
13439 | var value = LinkedValueUtils.getValue(props); | ||
13440 | if (value != null) { | ||
13441 | if (value === 0 && node.value === '') { | ||
13442 | node.value = '0'; | ||
13443 | // Note: IE9 reports a number inputs as 'text', so check props instead. | ||
13444 | } else if (props.type === 'number') { | ||
13445 | // Simulate `input.valueAsNumber`. IE9 does not support it | ||
13446 | var valueAsNumber = parseFloat(node.value, 10) || 0; | ||
13447 | |||
13448 | // eslint-disable-next-line | ||
13449 | if (value != valueAsNumber) { | ||
13450 | // Cast `value` to a string to ensure the value is set correctly. While | ||
13451 | // browsers typically do this as necessary, jsdom doesn't. | ||
13452 | node.value = '' + value; | ||
13453 | } | ||
13454 | // eslint-disable-next-line | ||
13455 | } else if (value != node.value) { | ||
13456 | // Cast `value` to a string to ensure the value is set correctly. While | ||
13457 | // browsers typically do this as necessary, jsdom doesn't. | ||
13458 | node.value = '' + value; | ||
13459 | } | ||
13460 | } else { | ||
13461 | if (props.value == null && props.defaultValue != null) { | ||
13462 | // In Chrome, assigning defaultValue to certain input types triggers input validation. | ||
13463 | // For number inputs, the display value loses trailing decimal points. For email inputs, | ||
13464 | // Chrome raises "The specified value <x> is not a valid email address". | ||
13465 | // | ||
13466 | // Here we check to see if the defaultValue has actually changed, avoiding these problems | ||
13467 | // when the user is inputting text | ||
13468 | // | ||
13469 | // https://github.com/facebook/react/issues/7253 | ||
13470 | if (node.defaultValue !== '' + props.defaultValue) { | ||
13471 | node.defaultValue = '' + props.defaultValue; | ||
13472 | } | ||
13473 | } | ||
13474 | if (props.checked == null && props.defaultChecked != null) { | ||
13475 | node.defaultChecked = !!props.defaultChecked; | ||
13476 | } | ||
13477 | } | ||
13478 | }, | ||
13479 | |||
13480 | postMountWrapper: function (inst) { | ||
13481 | var props = inst._currentElement.props; | ||
13482 | |||
13483 | // This is in postMount because we need access to the DOM node, which is not | ||
13484 | // available until after the component has mounted. | ||
13485 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
13486 | |||
13487 | // Detach value from defaultValue. We won't do anything if we're working on | ||
13488 | // submit or reset inputs as those values & defaultValues are linked. They | ||
13489 | // are not resetable nodes so this operation doesn't matter and actually | ||
13490 | // removes browser-default values (eg "Submit Query") when no value is | ||
13491 | // provided. | ||
13492 | |||
13493 | switch (props.type) { | ||
13494 | case 'submit': | ||
13495 | case 'reset': | ||
13496 | break; | ||
13497 | case 'color': | ||
13498 | case 'date': | ||
13499 | case 'datetime': | ||
13500 | case 'datetime-local': | ||
13501 | case 'month': | ||
13502 | case 'time': | ||
13503 | case 'week': | ||
13504 | // This fixes the no-show issue on iOS Safari and Android Chrome: | ||
13505 | // https://github.com/facebook/react/issues/7233 | ||
13506 | node.value = ''; | ||
13507 | node.value = node.defaultValue; | ||
13508 | break; | ||
13509 | default: | ||
13510 | node.value = node.value; | ||
13511 | break; | ||
13512 | } | ||
13513 | |||
13514 | // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug | ||
13515 | // this is needed to work around a chrome bug where setting defaultChecked | ||
13516 | // will sometimes influence the value of checked (even after detachment). | ||
13517 | // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 | ||
13518 | // We need to temporarily unset name to avoid disrupting radio button groups. | ||
13519 | var name = node.name; | ||
13520 | if (name !== '') { | ||
13521 | node.name = ''; | ||
13522 | } | ||
13523 | node.defaultChecked = !node.defaultChecked; | ||
13524 | node.defaultChecked = !node.defaultChecked; | ||
13525 | if (name !== '') { | ||
13526 | node.name = name; | ||
13527 | } | ||
13528 | } | ||
13529 | }; | ||
13530 | |||
13531 | function _handleChange(event) { | ||
13532 | var props = this._currentElement.props; | ||
13533 | |||
13534 | var returnValue = LinkedValueUtils.executeOnChange(props, event); | ||
13535 | |||
13536 | // Here we use asap to wait until all updates have propagated, which | ||
13537 | // is important when using controlled components within layers: | ||
13538 | // https://github.com/facebook/react/issues/1698 | ||
13539 | ReactUpdates.asap(forceUpdateIfMounted, this); | ||
13540 | |||
13541 | var name = props.name; | ||
13542 | if (props.type === 'radio' && name != null) { | ||
13543 | var rootNode = ReactDOMComponentTree.getNodeFromInstance(this); | ||
13544 | var queryRoot = rootNode; | ||
13545 | |||
13546 | while (queryRoot.parentNode) { | ||
13547 | queryRoot = queryRoot.parentNode; | ||
13548 | } | ||
13549 | |||
13550 | // If `rootNode.form` was non-null, then we could try `form.elements`, | ||
13551 | // but that sometimes behaves strangely in IE8. We could also try using | ||
13552 | // `form.getElementsByName`, but that will only return direct children | ||
13553 | // and won't include inputs that use the HTML5 `form=` attribute. Since | ||
13554 | // the input might not even be in a form, let's just use the global | ||
13555 | // `querySelectorAll` to ensure we don't miss anything. | ||
13556 | var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); | ||
13557 | |||
13558 | for (var i = 0; i < group.length; i++) { | ||
13559 | var otherNode = group[i]; | ||
13560 | if (otherNode === rootNode || otherNode.form !== rootNode.form) { | ||
13561 | continue; | ||
13562 | } | ||
13563 | // This will throw if radio buttons rendered by different copies of React | ||
13564 | // and the same name are rendered into the same form (same as #1939). | ||
13565 | // That's probably okay; we don't support it just as we don't support | ||
13566 | // mixing React radio buttons with non-React ones. | ||
13567 | var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode); | ||
13568 | !otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : _prodInvariant('90') : void 0; | ||
13569 | // If this is a controlled radio button group, forcing the input that | ||
13570 | // was previously checked to update will cause it to be come re-checked | ||
13571 | // as appropriate. | ||
13572 | ReactUpdates.asap(forceUpdateIfMounted, otherInstance); | ||
13573 | } | ||
13574 | } | ||
13575 | |||
13576 | return returnValue; | ||
13577 | } | ||
13578 | |||
13579 | module.exports = ReactDOMInput; | ||
13580 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
13581 | |||
13582 | /***/ }), | ||
13583 | /* 115 */ | ||
13584 | /***/ (function(module, exports, __webpack_require__) { | ||
13585 | |||
13586 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13587 | * Copyright 2013-present, Facebook, Inc. | ||
13588 | * All rights reserved. | ||
13589 | * | ||
13590 | * This source code is licensed under the BSD-style license found in the | ||
13591 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13592 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13593 | * | ||
13594 | */ | ||
13595 | |||
13596 | 'use strict'; | ||
13597 | |||
13598 | var _prodInvariant = __webpack_require__(41); | ||
13599 | |||
13600 | var ReactPropTypesSecret = __webpack_require__(116); | ||
13601 | var propTypesFactory = __webpack_require__(32); | ||
13602 | |||
13603 | var React = __webpack_require__(4); | ||
13604 | var PropTypes = propTypesFactory(React.isValidElement); | ||
13605 | |||
13606 | var invariant = __webpack_require__(10); | ||
13607 | var warning = __webpack_require__(13); | ||
13608 | |||
13609 | var hasReadOnlyValue = { | ||
13610 | 'button': true, | ||
13611 | 'checkbox': true, | ||
13612 | 'image': true, | ||
13613 | 'hidden': true, | ||
13614 | 'radio': true, | ||
13615 | 'reset': true, | ||
13616 | 'submit': true | ||
13617 | }; | ||
13618 | |||
13619 | function _assertSingleLink(inputProps) { | ||
13620 | !(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use checkedLink, you probably don\'t want to use valueLink and vice versa.') : _prodInvariant('87') : void 0; | ||
13621 | } | ||
13622 | function _assertValueLink(inputProps) { | ||
13623 | _assertSingleLink(inputProps); | ||
13624 | !(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don\'t want to use valueLink.') : _prodInvariant('88') : void 0; | ||
13625 | } | ||
13626 | |||
13627 | function _assertCheckedLink(inputProps) { | ||
13628 | _assertSingleLink(inputProps); | ||
13629 | !(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. If you want to use checked or onChange, you probably don\'t want to use checkedLink') : _prodInvariant('89') : void 0; | ||
13630 | } | ||
13631 | |||
13632 | var propTypes = { | ||
13633 | value: function (props, propName, componentName) { | ||
13634 | if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) { | ||
13635 | return null; | ||
13636 | } | ||
13637 | return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); | ||
13638 | }, | ||
13639 | checked: function (props, propName, componentName) { | ||
13640 | if (!props[propName] || props.onChange || props.readOnly || props.disabled) { | ||
13641 | return null; | ||
13642 | } | ||
13643 | return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); | ||
13644 | }, | ||
13645 | onChange: PropTypes.func | ||
13646 | }; | ||
13647 | |||
13648 | var loggedTypeFailures = {}; | ||
13649 | function getDeclarationErrorAddendum(owner) { | ||
13650 | if (owner) { | ||
13651 | var name = owner.getName(); | ||
13652 | if (name) { | ||
13653 | return ' Check the render method of `' + name + '`.'; | ||
13654 | } | ||
13655 | } | ||
13656 | return ''; | ||
13657 | } | ||
13658 | |||
13659 | /** | ||
13660 | * Provide a linked `value` attribute for controlled forms. You should not use | ||
13661 | * this outside of the ReactDOM controlled form components. | ||
13662 | */ | ||
13663 | var LinkedValueUtils = { | ||
13664 | checkPropTypes: function (tagName, props, owner) { | ||
13665 | for (var propName in propTypes) { | ||
13666 | if (propTypes.hasOwnProperty(propName)) { | ||
13667 | var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret); | ||
13668 | } | ||
13669 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
13670 | // Only monitor this failure once because there tends to be a lot of the | ||
13671 | // same error. | ||
13672 | loggedTypeFailures[error.message] = true; | ||
13673 | |||
13674 | var addendum = getDeclarationErrorAddendum(owner); | ||
13675 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0; | ||
13676 | } | ||
13677 | } | ||
13678 | }, | ||
13679 | |||
13680 | /** | ||
13681 | * @param {object} inputProps Props for form component | ||
13682 | * @return {*} current value of the input either from value prop or link. | ||
13683 | */ | ||
13684 | getValue: function (inputProps) { | ||
13685 | if (inputProps.valueLink) { | ||
13686 | _assertValueLink(inputProps); | ||
13687 | return inputProps.valueLink.value; | ||
13688 | } | ||
13689 | return inputProps.value; | ||
13690 | }, | ||
13691 | |||
13692 | /** | ||
13693 | * @param {object} inputProps Props for form component | ||
13694 | * @return {*} current checked status of the input either from checked prop | ||
13695 | * or link. | ||
13696 | */ | ||
13697 | getChecked: function (inputProps) { | ||
13698 | if (inputProps.checkedLink) { | ||
13699 | _assertCheckedLink(inputProps); | ||
13700 | return inputProps.checkedLink.value; | ||
13701 | } | ||
13702 | return inputProps.checked; | ||
13703 | }, | ||
13704 | |||
13705 | /** | ||
13706 | * @param {object} inputProps Props for form component | ||
13707 | * @param {SyntheticEvent} event change event to handle | ||
13708 | */ | ||
13709 | executeOnChange: function (inputProps, event) { | ||
13710 | if (inputProps.valueLink) { | ||
13711 | _assertValueLink(inputProps); | ||
13712 | return inputProps.valueLink.requestChange(event.target.value); | ||
13713 | } else if (inputProps.checkedLink) { | ||
13714 | _assertCheckedLink(inputProps); | ||
13715 | return inputProps.checkedLink.requestChange(event.target.checked); | ||
13716 | } else if (inputProps.onChange) { | ||
13717 | return inputProps.onChange.call(undefined, event); | ||
13718 | } | ||
13719 | } | ||
13720 | }; | ||
13721 | |||
13722 | module.exports = LinkedValueUtils; | ||
13723 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
13724 | |||
13725 | /***/ }), | ||
13726 | /* 116 */ | ||
13727 | 30, | ||
13728 | /* 117 */ | ||
13729 | /***/ (function(module, exports, __webpack_require__) { | ||
13730 | |||
13731 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13732 | * Copyright 2013-present, Facebook, Inc. | ||
13733 | * All rights reserved. | ||
13734 | * | ||
13735 | * This source code is licensed under the BSD-style license found in the | ||
13736 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13737 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13738 | * | ||
13739 | */ | ||
13740 | |||
13741 | 'use strict'; | ||
13742 | |||
13743 | var _assign = __webpack_require__(6); | ||
13744 | |||
13745 | var React = __webpack_require__(4); | ||
13746 | var ReactDOMComponentTree = __webpack_require__(40); | ||
13747 | var ReactDOMSelect = __webpack_require__(118); | ||
13748 | |||
13749 | var warning = __webpack_require__(13); | ||
13750 | var didWarnInvalidOptionChildren = false; | ||
13751 | |||
13752 | function flattenChildren(children) { | ||
13753 | var content = ''; | ||
13754 | |||
13755 | // Flatten children and warn if they aren't strings or numbers; | ||
13756 | // invalid types are ignored. | ||
13757 | React.Children.forEach(children, function (child) { | ||
13758 | if (child == null) { | ||
13759 | return; | ||
13760 | } | ||
13761 | if (typeof child === 'string' || typeof child === 'number') { | ||
13762 | content += child; | ||
13763 | } else if (!didWarnInvalidOptionChildren) { | ||
13764 | didWarnInvalidOptionChildren = true; | ||
13765 | process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0; | ||
13766 | } | ||
13767 | }); | ||
13768 | |||
13769 | return content; | ||
13770 | } | ||
13771 | |||
13772 | /** | ||
13773 | * Implements an <option> host component that warns when `selected` is set. | ||
13774 | */ | ||
13775 | var ReactDOMOption = { | ||
13776 | mountWrapper: function (inst, props, hostParent) { | ||
13777 | // TODO (yungsters): Remove support for `selected` in <option>. | ||
13778 | if (process.env.NODE_ENV !== 'production') { | ||
13779 | process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : void 0; | ||
13780 | } | ||
13781 | |||
13782 | // Look up whether this option is 'selected' | ||
13783 | var selectValue = null; | ||
13784 | if (hostParent != null) { | ||
13785 | var selectParent = hostParent; | ||
13786 | |||
13787 | if (selectParent._tag === 'optgroup') { | ||
13788 | selectParent = selectParent._hostParent; | ||
13789 | } | ||
13790 | |||
13791 | if (selectParent != null && selectParent._tag === 'select') { | ||
13792 | selectValue = ReactDOMSelect.getSelectValueContext(selectParent); | ||
13793 | } | ||
13794 | } | ||
13795 | |||
13796 | // If the value is null (e.g., no specified value or after initial mount) | ||
13797 | // or missing (e.g., for <datalist>), we don't change props.selected | ||
13798 | var selected = null; | ||
13799 | if (selectValue != null) { | ||
13800 | var value; | ||
13801 | if (props.value != null) { | ||
13802 | value = props.value + ''; | ||
13803 | } else { | ||
13804 | value = flattenChildren(props.children); | ||
13805 | } | ||
13806 | selected = false; | ||
13807 | if (Array.isArray(selectValue)) { | ||
13808 | // multiple | ||
13809 | for (var i = 0; i < selectValue.length; i++) { | ||
13810 | if ('' + selectValue[i] === value) { | ||
13811 | selected = true; | ||
13812 | break; | ||
13813 | } | ||
13814 | } | ||
13815 | } else { | ||
13816 | selected = '' + selectValue === value; | ||
13817 | } | ||
13818 | } | ||
13819 | |||
13820 | inst._wrapperState = { selected: selected }; | ||
13821 | }, | ||
13822 | |||
13823 | postMountWrapper: function (inst) { | ||
13824 | // value="" should make a value attribute (#6219) | ||
13825 | var props = inst._currentElement.props; | ||
13826 | if (props.value != null) { | ||
13827 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
13828 | node.setAttribute('value', props.value); | ||
13829 | } | ||
13830 | }, | ||
13831 | |||
13832 | getHostProps: function (inst, props) { | ||
13833 | var hostProps = _assign({ selected: undefined, children: undefined }, props); | ||
13834 | |||
13835 | // Read state only from initial mount because <select> updates value | ||
13836 | // manually; we need the initial state only for server rendering | ||
13837 | if (inst._wrapperState.selected != null) { | ||
13838 | hostProps.selected = inst._wrapperState.selected; | ||
13839 | } | ||
13840 | |||
13841 | var content = flattenChildren(props.children); | ||
13842 | |||
13843 | if (content) { | ||
13844 | hostProps.children = content; | ||
13845 | } | ||
13846 | |||
13847 | return hostProps; | ||
13848 | } | ||
13849 | |||
13850 | }; | ||
13851 | |||
13852 | module.exports = ReactDOMOption; | ||
13853 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
13854 | |||
13855 | /***/ }), | ||
13856 | /* 118 */ | ||
13857 | /***/ (function(module, exports, __webpack_require__) { | ||
13858 | |||
13859 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13860 | * Copyright 2013-present, Facebook, Inc. | ||
13861 | * All rights reserved. | ||
13862 | * | ||
13863 | * This source code is licensed under the BSD-style license found in the | ||
13864 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13865 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13866 | * | ||
13867 | */ | ||
13868 | |||
13869 | 'use strict'; | ||
13870 | |||
13871 | var _assign = __webpack_require__(6); | ||
13872 | |||
13873 | var LinkedValueUtils = __webpack_require__(115); | ||
13874 | var ReactDOMComponentTree = __webpack_require__(40); | ||
13875 | var ReactUpdates = __webpack_require__(62); | ||
13876 | |||
13877 | var warning = __webpack_require__(13); | ||
13878 | |||
13879 | var didWarnValueLink = false; | ||
13880 | var didWarnValueDefaultValue = false; | ||
13881 | |||
13882 | function updateOptionsIfPendingUpdateAndMounted() { | ||
13883 | if (this._rootNodeID && this._wrapperState.pendingUpdate) { | ||
13884 | this._wrapperState.pendingUpdate = false; | ||
13885 | |||
13886 | var props = this._currentElement.props; | ||
13887 | var value = LinkedValueUtils.getValue(props); | ||
13888 | |||
13889 | if (value != null) { | ||
13890 | updateOptions(this, Boolean(props.multiple), value); | ||
13891 | } | ||
13892 | } | ||
13893 | } | ||
13894 | |||
13895 | function getDeclarationErrorAddendum(owner) { | ||
13896 | if (owner) { | ||
13897 | var name = owner.getName(); | ||
13898 | if (name) { | ||
13899 | return ' Check the render method of `' + name + '`.'; | ||
13900 | } | ||
13901 | } | ||
13902 | return ''; | ||
13903 | } | ||
13904 | |||
13905 | var valuePropNames = ['value', 'defaultValue']; | ||
13906 | |||
13907 | /** | ||
13908 | * Validation function for `value` and `defaultValue`. | ||
13909 | * @private | ||
13910 | */ | ||
13911 | function checkSelectPropTypes(inst, props) { | ||
13912 | var owner = inst._currentElement._owner; | ||
13913 | LinkedValueUtils.checkPropTypes('select', props, owner); | ||
13914 | |||
13915 | if (props.valueLink !== undefined && !didWarnValueLink) { | ||
13916 | process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0; | ||
13917 | didWarnValueLink = true; | ||
13918 | } | ||
13919 | |||
13920 | for (var i = 0; i < valuePropNames.length; i++) { | ||
13921 | var propName = valuePropNames[i]; | ||
13922 | if (props[propName] == null) { | ||
13923 | continue; | ||
13924 | } | ||
13925 | var isArray = Array.isArray(props[propName]); | ||
13926 | if (props.multiple && !isArray) { | ||
13927 | process.env.NODE_ENV !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; | ||
13928 | } else if (!props.multiple && isArray) { | ||
13929 | process.env.NODE_ENV !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; | ||
13930 | } | ||
13931 | } | ||
13932 | } | ||
13933 | |||
13934 | /** | ||
13935 | * @param {ReactDOMComponent} inst | ||
13936 | * @param {boolean} multiple | ||
13937 | * @param {*} propValue A stringable (with `multiple`, a list of stringables). | ||
13938 | * @private | ||
13939 | */ | ||
13940 | function updateOptions(inst, multiple, propValue) { | ||
13941 | var selectedValue, i; | ||
13942 | var options = ReactDOMComponentTree.getNodeFromInstance(inst).options; | ||
13943 | |||
13944 | if (multiple) { | ||
13945 | selectedValue = {}; | ||
13946 | for (i = 0; i < propValue.length; i++) { | ||
13947 | selectedValue['' + propValue[i]] = true; | ||
13948 | } | ||
13949 | for (i = 0; i < options.length; i++) { | ||
13950 | var selected = selectedValue.hasOwnProperty(options[i].value); | ||
13951 | if (options[i].selected !== selected) { | ||
13952 | options[i].selected = selected; | ||
13953 | } | ||
13954 | } | ||
13955 | } else { | ||
13956 | // Do not set `select.value` as exact behavior isn't consistent across all | ||
13957 | // browsers for all cases. | ||
13958 | selectedValue = '' + propValue; | ||
13959 | for (i = 0; i < options.length; i++) { | ||
13960 | if (options[i].value === selectedValue) { | ||
13961 | options[i].selected = true; | ||
13962 | return; | ||
13963 | } | ||
13964 | } | ||
13965 | if (options.length) { | ||
13966 | options[0].selected = true; | ||
13967 | } | ||
13968 | } | ||
13969 | } | ||
13970 | |||
13971 | /** | ||
13972 | * Implements a <select> host component that allows optionally setting the | ||
13973 | * props `value` and `defaultValue`. If `multiple` is false, the prop must be a | ||
13974 | * stringable. If `multiple` is true, the prop must be an array of stringables. | ||
13975 | * | ||
13976 | * If `value` is not supplied (or null/undefined), user actions that change the | ||
13977 | * selected option will trigger updates to the rendered options. | ||
13978 | * | ||
13979 | * If it is supplied (and not null/undefined), the rendered options will not | ||
13980 | * update in response to user actions. Instead, the `value` prop must change in | ||
13981 | * order for the rendered options to update. | ||
13982 | * | ||
13983 | * If `defaultValue` is provided, any options with the supplied values will be | ||
13984 | * selected. | ||
13985 | */ | ||
13986 | var ReactDOMSelect = { | ||
13987 | getHostProps: function (inst, props) { | ||
13988 | return _assign({}, props, { | ||
13989 | onChange: inst._wrapperState.onChange, | ||
13990 | value: undefined | ||
13991 | }); | ||
13992 | }, | ||
13993 | |||
13994 | mountWrapper: function (inst, props) { | ||
13995 | if (process.env.NODE_ENV !== 'production') { | ||
13996 | checkSelectPropTypes(inst, props); | ||
13997 | } | ||
13998 | |||
13999 | var value = LinkedValueUtils.getValue(props); | ||
14000 | inst._wrapperState = { | ||
14001 | pendingUpdate: false, | ||
14002 | initialValue: value != null ? value : props.defaultValue, | ||
14003 | listeners: null, | ||
14004 | onChange: _handleChange.bind(inst), | ||
14005 | wasMultiple: Boolean(props.multiple) | ||
14006 | }; | ||
14007 | |||
14008 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { | ||
14009 | process.env.NODE_ENV !== 'production' ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0; | ||
14010 | didWarnValueDefaultValue = true; | ||
14011 | } | ||
14012 | }, | ||
14013 | |||
14014 | getSelectValueContext: function (inst) { | ||
14015 | // ReactDOMOption looks at this initial value so the initial generated | ||
14016 | // markup has correct `selected` attributes | ||
14017 | return inst._wrapperState.initialValue; | ||
14018 | }, | ||
14019 | |||
14020 | postUpdateWrapper: function (inst) { | ||
14021 | var props = inst._currentElement.props; | ||
14022 | |||
14023 | // After the initial mount, we control selected-ness manually so don't pass | ||
14024 | // this value down | ||
14025 | inst._wrapperState.initialValue = undefined; | ||
14026 | |||
14027 | var wasMultiple = inst._wrapperState.wasMultiple; | ||
14028 | inst._wrapperState.wasMultiple = Boolean(props.multiple); | ||
14029 | |||
14030 | var value = LinkedValueUtils.getValue(props); | ||
14031 | if (value != null) { | ||
14032 | inst._wrapperState.pendingUpdate = false; | ||
14033 | updateOptions(inst, Boolean(props.multiple), value); | ||
14034 | } else if (wasMultiple !== Boolean(props.multiple)) { | ||
14035 | // For simplicity, reapply `defaultValue` if `multiple` is toggled. | ||
14036 | if (props.defaultValue != null) { | ||
14037 | updateOptions(inst, Boolean(props.multiple), props.defaultValue); | ||
14038 | } else { | ||
14039 | // Revert the select back to its default unselected state. | ||
14040 | updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : ''); | ||
14041 | } | ||
14042 | } | ||
14043 | } | ||
14044 | }; | ||
14045 | |||
14046 | function _handleChange(event) { | ||
14047 | var props = this._currentElement.props; | ||
14048 | var returnValue = LinkedValueUtils.executeOnChange(props, event); | ||
14049 | |||
14050 | if (this._rootNodeID) { | ||
14051 | this._wrapperState.pendingUpdate = true; | ||
14052 | } | ||
14053 | ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); | ||
14054 | return returnValue; | ||
14055 | } | ||
14056 | |||
14057 | module.exports = ReactDOMSelect; | ||
14058 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
14059 | |||
14060 | /***/ }), | ||
14061 | /* 119 */ | ||
14062 | /***/ (function(module, exports, __webpack_require__) { | ||
14063 | |||
14064 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
14065 | * Copyright 2013-present, Facebook, Inc. | ||
14066 | * All rights reserved. | ||
14067 | * | ||
14068 | * This source code is licensed under the BSD-style license found in the | ||
14069 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14070 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14071 | * | ||
14072 | */ | ||
14073 | |||
14074 | 'use strict'; | ||
14075 | |||
14076 | var _prodInvariant = __webpack_require__(41), | ||
14077 | _assign = __webpack_require__(6); | ||
14078 | |||
14079 | var LinkedValueUtils = __webpack_require__(115); | ||
14080 | var ReactDOMComponentTree = __webpack_require__(40); | ||
14081 | var ReactUpdates = __webpack_require__(62); | ||
14082 | |||
14083 | var invariant = __webpack_require__(10); | ||
14084 | var warning = __webpack_require__(13); | ||
14085 | |||
14086 | var didWarnValueLink = false; | ||
14087 | var didWarnValDefaultVal = false; | ||
14088 | |||
14089 | function forceUpdateIfMounted() { | ||
14090 | if (this._rootNodeID) { | ||
14091 | // DOM component is still mounted; update | ||
14092 | ReactDOMTextarea.updateWrapper(this); | ||
14093 | } | ||
14094 | } | ||
14095 | |||
14096 | /** | ||
14097 | * Implements a <textarea> host component that allows setting `value`, and | ||
14098 | * `defaultValue`. This differs from the traditional DOM API because value is | ||
14099 | * usually set as PCDATA children. | ||
14100 | * | ||
14101 | * If `value` is not supplied (or null/undefined), user actions that affect the | ||
14102 | * value will trigger updates to the element. | ||
14103 | * | ||
14104 | * If `value` is supplied (and not null/undefined), the rendered element will | ||
14105 | * not trigger updates to the element. Instead, the `value` prop must change in | ||
14106 | * order for the rendered element to be updated. | ||
14107 | * | ||
14108 | * The rendered element will be initialized with an empty value, the prop | ||
14109 | * `defaultValue` if specified, or the children content (deprecated). | ||
14110 | */ | ||
14111 | var ReactDOMTextarea = { | ||
14112 | getHostProps: function (inst, props) { | ||
14113 | !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0; | ||
14114 | |||
14115 | // Always set children to the same thing. In IE9, the selection range will | ||
14116 | // get reset if `textContent` is mutated. We could add a check in setTextContent | ||
14117 | // to only set the value if/when the value differs from the node value (which would | ||
14118 | // completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution. | ||
14119 | // The value can be a boolean or object so that's why it's forced to be a string. | ||
14120 | var hostProps = _assign({}, props, { | ||
14121 | value: undefined, | ||
14122 | defaultValue: undefined, | ||
14123 | children: '' + inst._wrapperState.initialValue, | ||
14124 | onChange: inst._wrapperState.onChange | ||
14125 | }); | ||
14126 | |||
14127 | return hostProps; | ||
14128 | }, | ||
14129 | |||
14130 | mountWrapper: function (inst, props) { | ||
14131 | if (process.env.NODE_ENV !== 'production') { | ||
14132 | LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner); | ||
14133 | if (props.valueLink !== undefined && !didWarnValueLink) { | ||
14134 | process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0; | ||
14135 | didWarnValueLink = true; | ||
14136 | } | ||
14137 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) { | ||
14138 | process.env.NODE_ENV !== 'production' ? warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0; | ||
14139 | didWarnValDefaultVal = true; | ||
14140 | } | ||
14141 | } | ||
14142 | |||
14143 | var value = LinkedValueUtils.getValue(props); | ||
14144 | var initialValue = value; | ||
14145 | |||
14146 | // Only bother fetching default value if we're going to use it | ||
14147 | if (value == null) { | ||
14148 | var defaultValue = props.defaultValue; | ||
14149 | // TODO (yungsters): Remove support for children content in <textarea>. | ||
14150 | var children = props.children; | ||
14151 | if (children != null) { | ||
14152 | if (process.env.NODE_ENV !== 'production') { | ||
14153 | process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0; | ||
14154 | } | ||
14155 | !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0; | ||
14156 | if (Array.isArray(children)) { | ||
14157 | !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0; | ||
14158 | children = children[0]; | ||
14159 | } | ||
14160 | |||
14161 | defaultValue = '' + children; | ||
14162 | } | ||
14163 | if (defaultValue == null) { | ||
14164 | defaultValue = ''; | ||
14165 | } | ||
14166 | initialValue = defaultValue; | ||
14167 | } | ||
14168 | |||
14169 | inst._wrapperState = { | ||
14170 | initialValue: '' + initialValue, | ||
14171 | listeners: null, | ||
14172 | onChange: _handleChange.bind(inst) | ||
14173 | }; | ||
14174 | }, | ||
14175 | |||
14176 | updateWrapper: function (inst) { | ||
14177 | var props = inst._currentElement.props; | ||
14178 | |||
14179 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
14180 | var value = LinkedValueUtils.getValue(props); | ||
14181 | if (value != null) { | ||
14182 | // Cast `value` to a string to ensure the value is set correctly. While | ||
14183 | // browsers typically do this as necessary, jsdom doesn't. | ||
14184 | var newValue = '' + value; | ||
14185 | |||
14186 | // To avoid side effects (such as losing text selection), only set value if changed | ||
14187 | if (newValue !== node.value) { | ||
14188 | node.value = newValue; | ||
14189 | } | ||
14190 | if (props.defaultValue == null) { | ||
14191 | node.defaultValue = newValue; | ||
14192 | } | ||
14193 | } | ||
14194 | if (props.defaultValue != null) { | ||
14195 | node.defaultValue = props.defaultValue; | ||
14196 | } | ||
14197 | }, | ||
14198 | |||
14199 | postMountWrapper: function (inst) { | ||
14200 | // This is in postMount because we need access to the DOM node, which is not | ||
14201 | // available until after the component has mounted. | ||
14202 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
14203 | var textContent = node.textContent; | ||
14204 | |||
14205 | // Only set node.value if textContent is equal to the expected | ||
14206 | // initial value. In IE10/IE11 there is a bug where the placeholder attribute | ||
14207 | // will populate textContent as well. | ||
14208 | // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/ | ||
14209 | if (textContent === inst._wrapperState.initialValue) { | ||
14210 | node.value = textContent; | ||
14211 | } | ||
14212 | } | ||
14213 | }; | ||
14214 | |||
14215 | function _handleChange(event) { | ||
14216 | var props = this._currentElement.props; | ||
14217 | var returnValue = LinkedValueUtils.executeOnChange(props, event); | ||
14218 | ReactUpdates.asap(forceUpdateIfMounted, this); | ||
14219 | return returnValue; | ||
14220 | } | ||
14221 | |||
14222 | module.exports = ReactDOMTextarea; | ||
14223 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
14224 | |||
14225 | /***/ }), | ||
14226 | /* 120 */ | ||
14227 | /***/ (function(module, exports, __webpack_require__) { | ||
14228 | |||
14229 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
14230 | * Copyright 2013-present, Facebook, Inc. | ||
14231 | * All rights reserved. | ||
14232 | * | ||
14233 | * This source code is licensed under the BSD-style license found in the | ||
14234 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14235 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14236 | * | ||
14237 | */ | ||
14238 | |||
14239 | 'use strict'; | ||
14240 | |||
14241 | var _prodInvariant = __webpack_require__(41); | ||
14242 | |||
14243 | var ReactComponentEnvironment = __webpack_require__(121); | ||
14244 | var ReactInstanceMap = __webpack_require__(122); | ||
14245 | var ReactInstrumentation = __webpack_require__(68); | ||
14246 | |||
14247 | var ReactCurrentOwner = __webpack_require__(12); | ||
14248 | var ReactReconciler = __webpack_require__(65); | ||
14249 | var ReactChildReconciler = __webpack_require__(123); | ||
14250 | |||
14251 | var emptyFunction = __webpack_require__(14); | ||
14252 | var flattenChildren = __webpack_require__(138); | ||
14253 | var invariant = __webpack_require__(10); | ||
14254 | |||
14255 | /** | ||
14256 | * Make an update for markup to be rendered and inserted at a supplied index. | ||
14257 | * | ||
14258 | * @param {string} markup Markup that renders into an element. | ||
14259 | * @param {number} toIndex Destination index. | ||
14260 | * @private | ||
14261 | */ | ||
14262 | function makeInsertMarkup(markup, afterNode, toIndex) { | ||
14263 | // NOTE: Null values reduce hidden classes. | ||
14264 | return { | ||
14265 | type: 'INSERT_MARKUP', | ||
14266 | content: markup, | ||
14267 | fromIndex: null, | ||
14268 | fromNode: null, | ||
14269 | toIndex: toIndex, | ||
14270 | afterNode: afterNode | ||
14271 | }; | ||
14272 | } | ||
14273 | |||
14274 | /** | ||
14275 | * Make an update for moving an existing element to another index. | ||
14276 | * | ||
14277 | * @param {number} fromIndex Source index of the existing element. | ||
14278 | * @param {number} toIndex Destination index of the element. | ||
14279 | * @private | ||
14280 | */ | ||
14281 | function makeMove(child, afterNode, toIndex) { | ||
14282 | // NOTE: Null values reduce hidden classes. | ||
14283 | return { | ||
14284 | type: 'MOVE_EXISTING', | ||
14285 | content: null, | ||
14286 | fromIndex: child._mountIndex, | ||
14287 | fromNode: ReactReconciler.getHostNode(child), | ||
14288 | toIndex: toIndex, | ||
14289 | afterNode: afterNode | ||
14290 | }; | ||
14291 | } | ||
14292 | |||
14293 | /** | ||
14294 | * Make an update for removing an element at an index. | ||
14295 | * | ||
14296 | * @param {number} fromIndex Index of the element to remove. | ||
14297 | * @private | ||
14298 | */ | ||
14299 | function makeRemove(child, node) { | ||
14300 | // NOTE: Null values reduce hidden classes. | ||
14301 | return { | ||
14302 | type: 'REMOVE_NODE', | ||
14303 | content: null, | ||
14304 | fromIndex: child._mountIndex, | ||
14305 | fromNode: node, | ||
14306 | toIndex: null, | ||
14307 | afterNode: null | ||
14308 | }; | ||
14309 | } | ||
14310 | |||
14311 | /** | ||
14312 | * Make an update for setting the markup of a node. | ||
14313 | * | ||
14314 | * @param {string} markup Markup that renders into an element. | ||
14315 | * @private | ||
14316 | */ | ||
14317 | function makeSetMarkup(markup) { | ||
14318 | // NOTE: Null values reduce hidden classes. | ||
14319 | return { | ||
14320 | type: 'SET_MARKUP', | ||
14321 | content: markup, | ||
14322 | fromIndex: null, | ||
14323 | fromNode: null, | ||
14324 | toIndex: null, | ||
14325 | afterNode: null | ||
14326 | }; | ||
14327 | } | ||
14328 | |||
14329 | /** | ||
14330 | * Make an update for setting the text content. | ||
14331 | * | ||
14332 | * @param {string} textContent Text content to set. | ||
14333 | * @private | ||
14334 | */ | ||
14335 | function makeTextContent(textContent) { | ||
14336 | // NOTE: Null values reduce hidden classes. | ||
14337 | return { | ||
14338 | type: 'TEXT_CONTENT', | ||
14339 | content: textContent, | ||
14340 | fromIndex: null, | ||
14341 | fromNode: null, | ||
14342 | toIndex: null, | ||
14343 | afterNode: null | ||
14344 | }; | ||
14345 | } | ||
14346 | |||
14347 | /** | ||
14348 | * Push an update, if any, onto the queue. Creates a new queue if none is | ||
14349 | * passed and always returns the queue. Mutative. | ||
14350 | */ | ||
14351 | function enqueue(queue, update) { | ||
14352 | if (update) { | ||
14353 | queue = queue || []; | ||
14354 | queue.push(update); | ||
14355 | } | ||
14356 | return queue; | ||
14357 | } | ||
14358 | |||
14359 | /** | ||
14360 | * Processes any enqueued updates. | ||
14361 | * | ||
14362 | * @private | ||
14363 | */ | ||
14364 | function processQueue(inst, updateQueue) { | ||
14365 | ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue); | ||
14366 | } | ||
14367 | |||
14368 | var setChildrenForInstrumentation = emptyFunction; | ||
14369 | if (process.env.NODE_ENV !== 'production') { | ||
14370 | var getDebugID = function (inst) { | ||
14371 | if (!inst._debugID) { | ||
14372 | // Check for ART-like instances. TODO: This is silly/gross. | ||
14373 | var internal; | ||
14374 | if (internal = ReactInstanceMap.get(inst)) { | ||
14375 | inst = internal; | ||
14376 | } | ||
14377 | } | ||
14378 | return inst._debugID; | ||
14379 | }; | ||
14380 | setChildrenForInstrumentation = function (children) { | ||
14381 | var debugID = getDebugID(this); | ||
14382 | // TODO: React Native empty components are also multichild. | ||
14383 | // This means they still get into this method but don't have _debugID. | ||
14384 | if (debugID !== 0) { | ||
14385 | ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) { | ||
14386 | return children[key]._debugID; | ||
14387 | }) : []); | ||
14388 | } | ||
14389 | }; | ||
14390 | } | ||
14391 | |||
14392 | /** | ||
14393 | * ReactMultiChild are capable of reconciling multiple children. | ||
14394 | * | ||
14395 | * @class ReactMultiChild | ||
14396 | * @internal | ||
14397 | */ | ||
14398 | var ReactMultiChild = { | ||
14399 | |||
14400 | /** | ||
14401 | * Provides common functionality for components that must reconcile multiple | ||
14402 | * children. This is used by `ReactDOMComponent` to mount, update, and | ||
14403 | * unmount child components. | ||
14404 | * | ||
14405 | * @lends {ReactMultiChild.prototype} | ||
14406 | */ | ||
14407 | Mixin: { | ||
14408 | |||
14409 | _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) { | ||
14410 | if (process.env.NODE_ENV !== 'production') { | ||
14411 | var selfDebugID = getDebugID(this); | ||
14412 | if (this._currentElement) { | ||
14413 | try { | ||
14414 | ReactCurrentOwner.current = this._currentElement._owner; | ||
14415 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID); | ||
14416 | } finally { | ||
14417 | ReactCurrentOwner.current = null; | ||
14418 | } | ||
14419 | } | ||
14420 | } | ||
14421 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context); | ||
14422 | }, | ||
14423 | |||
14424 | _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) { | ||
14425 | var nextChildren; | ||
14426 | var selfDebugID = 0; | ||
14427 | if (process.env.NODE_ENV !== 'production') { | ||
14428 | selfDebugID = getDebugID(this); | ||
14429 | if (this._currentElement) { | ||
14430 | try { | ||
14431 | ReactCurrentOwner.current = this._currentElement._owner; | ||
14432 | nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID); | ||
14433 | } finally { | ||
14434 | ReactCurrentOwner.current = null; | ||
14435 | } | ||
14436 | ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID); | ||
14437 | return nextChildren; | ||
14438 | } | ||
14439 | } | ||
14440 | nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID); | ||
14441 | ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID); | ||
14442 | return nextChildren; | ||
14443 | }, | ||
14444 | |||
14445 | /** | ||
14446 | * Generates a "mount image" for each of the supplied children. In the case | ||
14447 | * of `ReactDOMComponent`, a mount image is a string of markup. | ||
14448 | * | ||
14449 | * @param {?object} nestedChildren Nested child maps. | ||
14450 | * @return {array} An array of mounted representations. | ||
14451 | * @internal | ||
14452 | */ | ||
14453 | mountChildren: function (nestedChildren, transaction, context) { | ||
14454 | var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context); | ||
14455 | this._renderedChildren = children; | ||
14456 | |||
14457 | var mountImages = []; | ||
14458 | var index = 0; | ||
14459 | for (var name in children) { | ||
14460 | if (children.hasOwnProperty(name)) { | ||
14461 | var child = children[name]; | ||
14462 | var selfDebugID = 0; | ||
14463 | if (process.env.NODE_ENV !== 'production') { | ||
14464 | selfDebugID = getDebugID(this); | ||
14465 | } | ||
14466 | var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID); | ||
14467 | child._mountIndex = index++; | ||
14468 | mountImages.push(mountImage); | ||
14469 | } | ||
14470 | } | ||
14471 | |||
14472 | if (process.env.NODE_ENV !== 'production') { | ||
14473 | setChildrenForInstrumentation.call(this, children); | ||
14474 | } | ||
14475 | |||
14476 | return mountImages; | ||
14477 | }, | ||
14478 | |||
14479 | /** | ||
14480 | * Replaces any rendered children with a text content string. | ||
14481 | * | ||
14482 | * @param {string} nextContent String of content. | ||
14483 | * @internal | ||
14484 | */ | ||
14485 | updateTextContent: function (nextContent) { | ||
14486 | var prevChildren = this._renderedChildren; | ||
14487 | // Remove any rendered children. | ||
14488 | ReactChildReconciler.unmountChildren(prevChildren, false); | ||
14489 | for (var name in prevChildren) { | ||
14490 | if (prevChildren.hasOwnProperty(name)) { | ||
14491 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0; | ||
14492 | } | ||
14493 | } | ||
14494 | // Set new text content. | ||
14495 | var updates = [makeTextContent(nextContent)]; | ||
14496 | processQueue(this, updates); | ||
14497 | }, | ||
14498 | |||
14499 | /** | ||
14500 | * Replaces any rendered children with a markup string. | ||
14501 | * | ||
14502 | * @param {string} nextMarkup String of markup. | ||
14503 | * @internal | ||
14504 | */ | ||
14505 | updateMarkup: function (nextMarkup) { | ||
14506 | var prevChildren = this._renderedChildren; | ||
14507 | // Remove any rendered children. | ||
14508 | ReactChildReconciler.unmountChildren(prevChildren, false); | ||
14509 | for (var name in prevChildren) { | ||
14510 | if (prevChildren.hasOwnProperty(name)) { | ||
14511 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0; | ||
14512 | } | ||
14513 | } | ||
14514 | var updates = [makeSetMarkup(nextMarkup)]; | ||
14515 | processQueue(this, updates); | ||
14516 | }, | ||
14517 | |||
14518 | /** | ||
14519 | * Updates the rendered children with new children. | ||
14520 | * | ||
14521 | * @param {?object} nextNestedChildrenElements Nested child element maps. | ||
14522 | * @param {ReactReconcileTransaction} transaction | ||
14523 | * @internal | ||
14524 | */ | ||
14525 | updateChildren: function (nextNestedChildrenElements, transaction, context) { | ||
14526 | // Hook used by React ART | ||
14527 | this._updateChildren(nextNestedChildrenElements, transaction, context); | ||
14528 | }, | ||
14529 | |||
14530 | /** | ||
14531 | * @param {?object} nextNestedChildrenElements Nested child element maps. | ||
14532 | * @param {ReactReconcileTransaction} transaction | ||
14533 | * @final | ||
14534 | * @protected | ||
14535 | */ | ||
14536 | _updateChildren: function (nextNestedChildrenElements, transaction, context) { | ||
14537 | var prevChildren = this._renderedChildren; | ||
14538 | var removedNodes = {}; | ||
14539 | var mountImages = []; | ||
14540 | var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context); | ||
14541 | if (!nextChildren && !prevChildren) { | ||
14542 | return; | ||
14543 | } | ||
14544 | var updates = null; | ||
14545 | var name; | ||
14546 | // `nextIndex` will increment for each child in `nextChildren`, but | ||
14547 | // `lastIndex` will be the last index visited in `prevChildren`. | ||
14548 | var nextIndex = 0; | ||
14549 | var lastIndex = 0; | ||
14550 | // `nextMountIndex` will increment for each newly mounted child. | ||
14551 | var nextMountIndex = 0; | ||
14552 | var lastPlacedNode = null; | ||
14553 | for (name in nextChildren) { | ||
14554 | if (!nextChildren.hasOwnProperty(name)) { | ||
14555 | continue; | ||
14556 | } | ||
14557 | var prevChild = prevChildren && prevChildren[name]; | ||
14558 | var nextChild = nextChildren[name]; | ||
14559 | if (prevChild === nextChild) { | ||
14560 | updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex)); | ||
14561 | lastIndex = Math.max(prevChild._mountIndex, lastIndex); | ||
14562 | prevChild._mountIndex = nextIndex; | ||
14563 | } else { | ||
14564 | if (prevChild) { | ||
14565 | // Update `lastIndex` before `_mountIndex` gets unset by unmounting. | ||
14566 | lastIndex = Math.max(prevChild._mountIndex, lastIndex); | ||
14567 | // The `removedNodes` loop below will actually remove the child. | ||
14568 | } | ||
14569 | // The child must be instantiated before it's mounted. | ||
14570 | updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context)); | ||
14571 | nextMountIndex++; | ||
14572 | } | ||
14573 | nextIndex++; | ||
14574 | lastPlacedNode = ReactReconciler.getHostNode(nextChild); | ||
14575 | } | ||
14576 | // Remove children that are no longer present. | ||
14577 | for (name in removedNodes) { | ||
14578 | if (removedNodes.hasOwnProperty(name)) { | ||
14579 | updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name])); | ||
14580 | } | ||
14581 | } | ||
14582 | if (updates) { | ||
14583 | processQueue(this, updates); | ||
14584 | } | ||
14585 | this._renderedChildren = nextChildren; | ||
14586 | |||
14587 | if (process.env.NODE_ENV !== 'production') { | ||
14588 | setChildrenForInstrumentation.call(this, nextChildren); | ||
14589 | } | ||
14590 | }, | ||
14591 | |||
14592 | /** | ||
14593 | * Unmounts all rendered children. This should be used to clean up children | ||
14594 | * when this component is unmounted. It does not actually perform any | ||
14595 | * backend operations. | ||
14596 | * | ||
14597 | * @internal | ||
14598 | */ | ||
14599 | unmountChildren: function (safely) { | ||
14600 | var renderedChildren = this._renderedChildren; | ||
14601 | ReactChildReconciler.unmountChildren(renderedChildren, safely); | ||
14602 | this._renderedChildren = null; | ||
14603 | }, | ||
14604 | |||
14605 | /** | ||
14606 | * Moves a child component to the supplied index. | ||
14607 | * | ||
14608 | * @param {ReactComponent} child Component to move. | ||
14609 | * @param {number} toIndex Destination index of the element. | ||
14610 | * @param {number} lastIndex Last index visited of the siblings of `child`. | ||
14611 | * @protected | ||
14612 | */ | ||
14613 | moveChild: function (child, afterNode, toIndex, lastIndex) { | ||
14614 | // If the index of `child` is less than `lastIndex`, then it needs to | ||
14615 | // be moved. Otherwise, we do not need to move it because a child will be | ||
14616 | // inserted or moved before `child`. | ||
14617 | if (child._mountIndex < lastIndex) { | ||
14618 | return makeMove(child, afterNode, toIndex); | ||
14619 | } | ||
14620 | }, | ||
14621 | |||
14622 | /** | ||
14623 | * Creates a child component. | ||
14624 | * | ||
14625 | * @param {ReactComponent} child Component to create. | ||
14626 | * @param {string} mountImage Markup to insert. | ||
14627 | * @protected | ||
14628 | */ | ||
14629 | createChild: function (child, afterNode, mountImage) { | ||
14630 | return makeInsertMarkup(mountImage, afterNode, child._mountIndex); | ||
14631 | }, | ||
14632 | |||
14633 | /** | ||
14634 | * Removes a child component. | ||
14635 | * | ||
14636 | * @param {ReactComponent} child Child to remove. | ||
14637 | * @protected | ||
14638 | */ | ||
14639 | removeChild: function (child, node) { | ||
14640 | return makeRemove(child, node); | ||
14641 | }, | ||
14642 | |||
14643 | /** | ||
14644 | * Mounts a child with the supplied name. | ||
14645 | * | ||
14646 | * NOTE: This is part of `updateChildren` and is here for readability. | ||
14647 | * | ||
14648 | * @param {ReactComponent} child Component to mount. | ||
14649 | * @param {string} name Name of the child. | ||
14650 | * @param {number} index Index at which to insert the child. | ||
14651 | * @param {ReactReconcileTransaction} transaction | ||
14652 | * @private | ||
14653 | */ | ||
14654 | _mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) { | ||
14655 | child._mountIndex = index; | ||
14656 | return this.createChild(child, afterNode, mountImage); | ||
14657 | }, | ||
14658 | |||
14659 | /** | ||
14660 | * Unmounts a rendered child. | ||
14661 | * | ||
14662 | * NOTE: This is part of `updateChildren` and is here for readability. | ||
14663 | * | ||
14664 | * @param {ReactComponent} child Component to unmount. | ||
14665 | * @private | ||
14666 | */ | ||
14667 | _unmountChild: function (child, node) { | ||
14668 | var update = this.removeChild(child, node); | ||
14669 | child._mountIndex = null; | ||
14670 | return update; | ||
14671 | } | ||
14672 | |||
14673 | } | ||
14674 | |||
14675 | }; | ||
14676 | |||
14677 | module.exports = ReactMultiChild; | ||
14678 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
14679 | |||
14680 | /***/ }), | ||
14681 | /* 121 */ | ||
14682 | /***/ (function(module, exports, __webpack_require__) { | ||
14683 | |||
14684 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
14685 | * Copyright 2014-present, Facebook, Inc. | ||
14686 | * All rights reserved. | ||
14687 | * | ||
14688 | * This source code is licensed under the BSD-style license found in the | ||
14689 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14690 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14691 | * | ||
14692 | * | ||
14693 | */ | ||
14694 | |||
14695 | 'use strict'; | ||
14696 | |||
14697 | var _prodInvariant = __webpack_require__(41); | ||
14698 | |||
14699 | var invariant = __webpack_require__(10); | ||
14700 | |||
14701 | var injected = false; | ||
14702 | |||
14703 | var ReactComponentEnvironment = { | ||
14704 | |||
14705 | /** | ||
14706 | * Optionally injectable hook for swapping out mount images in the middle of | ||
14707 | * the tree. | ||
14708 | */ | ||
14709 | replaceNodeWithMarkup: null, | ||
14710 | |||
14711 | /** | ||
14712 | * Optionally injectable hook for processing a queue of child updates. Will | ||
14713 | * later move into MultiChildComponents. | ||
14714 | */ | ||
14715 | processChildrenUpdates: null, | ||
14716 | |||
14717 | injection: { | ||
14718 | injectEnvironment: function (environment) { | ||
14719 | !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0; | ||
14720 | ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup; | ||
14721 | ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates; | ||
14722 | injected = true; | ||
14723 | } | ||
14724 | } | ||
14725 | |||
14726 | }; | ||
14727 | |||
14728 | module.exports = ReactComponentEnvironment; | ||
14729 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
14730 | |||
14731 | /***/ }), | ||
14732 | /* 122 */ | ||
14733 | /***/ (function(module, exports) { | ||
14734 | |||
14735 | /** | ||
14736 | * Copyright 2013-present, Facebook, Inc. | ||
14737 | * All rights reserved. | ||
14738 | * | ||
14739 | * This source code is licensed under the BSD-style license found in the | ||
14740 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14741 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14742 | * | ||
14743 | */ | ||
14744 | |||
14745 | 'use strict'; | ||
14746 | |||
14747 | /** | ||
14748 | * `ReactInstanceMap` maintains a mapping from a public facing stateful | ||
14749 | * instance (key) and the internal representation (value). This allows public | ||
14750 | * methods to accept the user facing instance as an argument and map them back | ||
14751 | * to internal methods. | ||
14752 | */ | ||
14753 | |||
14754 | // TODO: Replace this with ES6: var ReactInstanceMap = new Map(); | ||
14755 | |||
14756 | var ReactInstanceMap = { | ||
14757 | |||
14758 | /** | ||
14759 | * This API should be called `delete` but we'd have to make sure to always | ||
14760 | * transform these to strings for IE support. When this transform is fully | ||
14761 | * supported we can rename it. | ||
14762 | */ | ||
14763 | remove: function (key) { | ||
14764 | key._reactInternalInstance = undefined; | ||
14765 | }, | ||
14766 | |||
14767 | get: function (key) { | ||
14768 | return key._reactInternalInstance; | ||
14769 | }, | ||
14770 | |||
14771 | has: function (key) { | ||
14772 | return key._reactInternalInstance !== undefined; | ||
14773 | }, | ||
14774 | |||
14775 | set: function (key, value) { | ||
14776 | key._reactInternalInstance = value; | ||
14777 | } | ||
14778 | |||
14779 | }; | ||
14780 | |||
14781 | module.exports = ReactInstanceMap; | ||
14782 | |||
14783 | /***/ }), | ||
14784 | /* 123 */ | ||
14785 | /***/ (function(module, exports, __webpack_require__) { | ||
14786 | |||
14787 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
14788 | * Copyright 2014-present, Facebook, Inc. | ||
14789 | * All rights reserved. | ||
14790 | * | ||
14791 | * This source code is licensed under the BSD-style license found in the | ||
14792 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14793 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14794 | * | ||
14795 | */ | ||
14796 | |||
14797 | 'use strict'; | ||
14798 | |||
14799 | var ReactReconciler = __webpack_require__(65); | ||
14800 | |||
14801 | var instantiateReactComponent = __webpack_require__(124); | ||
14802 | var KeyEscapeUtils = __webpack_require__(134); | ||
14803 | var shouldUpdateReactComponent = __webpack_require__(130); | ||
14804 | var traverseAllChildren = __webpack_require__(135); | ||
14805 | var warning = __webpack_require__(13); | ||
14806 | |||
14807 | var ReactComponentTreeHook; | ||
14808 | |||
14809 | if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { | ||
14810 | // Temporary hack. | ||
14811 | // Inline requires don't work well with Jest: | ||
14812 | // https://github.com/facebook/react/issues/7240 | ||
14813 | // Remove the inline requires when we don't need them anymore: | ||
14814 | // https://github.com/facebook/react/pull/7178 | ||
14815 | ReactComponentTreeHook = __webpack_require__(28); | ||
14816 | } | ||
14817 | |||
14818 | function instantiateChild(childInstances, child, name, selfDebugID) { | ||
14819 | // We found a component instance. | ||
14820 | var keyUnique = childInstances[name] === undefined; | ||
14821 | if (process.env.NODE_ENV !== 'production') { | ||
14822 | if (!ReactComponentTreeHook) { | ||
14823 | ReactComponentTreeHook = __webpack_require__(28); | ||
14824 | } | ||
14825 | if (!keyUnique) { | ||
14826 | process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0; | ||
14827 | } | ||
14828 | } | ||
14829 | if (child != null && keyUnique) { | ||
14830 | childInstances[name] = instantiateReactComponent(child, true); | ||
14831 | } | ||
14832 | } | ||
14833 | |||
14834 | /** | ||
14835 | * ReactChildReconciler provides helpers for initializing or updating a set of | ||
14836 | * children. Its output is suitable for passing it onto ReactMultiChild which | ||
14837 | * does diffed reordering and insertion. | ||
14838 | */ | ||
14839 | var ReactChildReconciler = { | ||
14840 | /** | ||
14841 | * Generates a "mount image" for each of the supplied children. In the case | ||
14842 | * of `ReactDOMComponent`, a mount image is a string of markup. | ||
14843 | * | ||
14844 | * @param {?object} nestedChildNodes Nested child maps. | ||
14845 | * @return {?object} A set of child instances. | ||
14846 | * @internal | ||
14847 | */ | ||
14848 | instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // 0 in production and for roots | ||
14849 | ) { | ||
14850 | if (nestedChildNodes == null) { | ||
14851 | return null; | ||
14852 | } | ||
14853 | var childInstances = {}; | ||
14854 | |||
14855 | if (process.env.NODE_ENV !== 'production') { | ||
14856 | traverseAllChildren(nestedChildNodes, function (childInsts, child, name) { | ||
14857 | return instantiateChild(childInsts, child, name, selfDebugID); | ||
14858 | }, childInstances); | ||
14859 | } else { | ||
14860 | traverseAllChildren(nestedChildNodes, instantiateChild, childInstances); | ||
14861 | } | ||
14862 | return childInstances; | ||
14863 | }, | ||
14864 | |||
14865 | /** | ||
14866 | * Updates the rendered children and returns a new set of children. | ||
14867 | * | ||
14868 | * @param {?object} prevChildren Previously initialized set of children. | ||
14869 | * @param {?object} nextChildren Flat child element maps. | ||
14870 | * @param {ReactReconcileTransaction} transaction | ||
14871 | * @param {object} context | ||
14872 | * @return {?object} A new set of child instances. | ||
14873 | * @internal | ||
14874 | */ | ||
14875 | updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID // 0 in production and for roots | ||
14876 | ) { | ||
14877 | // We currently don't have a way to track moves here but if we use iterators | ||
14878 | // instead of for..in we can zip the iterators and check if an item has | ||
14879 | // moved. | ||
14880 | // TODO: If nothing has changed, return the prevChildren object so that we | ||
14881 | // can quickly bailout if nothing has changed. | ||
14882 | if (!nextChildren && !prevChildren) { | ||
14883 | return; | ||
14884 | } | ||
14885 | var name; | ||
14886 | var prevChild; | ||
14887 | for (name in nextChildren) { | ||
14888 | if (!nextChildren.hasOwnProperty(name)) { | ||
14889 | continue; | ||
14890 | } | ||
14891 | prevChild = prevChildren && prevChildren[name]; | ||
14892 | var prevElement = prevChild && prevChild._currentElement; | ||
14893 | var nextElement = nextChildren[name]; | ||
14894 | if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) { | ||
14895 | ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context); | ||
14896 | nextChildren[name] = prevChild; | ||
14897 | } else { | ||
14898 | if (prevChild) { | ||
14899 | removedNodes[name] = ReactReconciler.getHostNode(prevChild); | ||
14900 | ReactReconciler.unmountComponent(prevChild, false); | ||
14901 | } | ||
14902 | // The child must be instantiated before it's mounted. | ||
14903 | var nextChildInstance = instantiateReactComponent(nextElement, true); | ||
14904 | nextChildren[name] = nextChildInstance; | ||
14905 | // Creating mount image now ensures refs are resolved in right order | ||
14906 | // (see https://github.com/facebook/react/pull/7101 for explanation). | ||
14907 | var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID); | ||
14908 | mountImages.push(nextChildMountImage); | ||
14909 | } | ||
14910 | } | ||
14911 | // Unmount children that are no longer present. | ||
14912 | for (name in prevChildren) { | ||
14913 | if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { | ||
14914 | prevChild = prevChildren[name]; | ||
14915 | removedNodes[name] = ReactReconciler.getHostNode(prevChild); | ||
14916 | ReactReconciler.unmountComponent(prevChild, false); | ||
14917 | } | ||
14918 | } | ||
14919 | }, | ||
14920 | |||
14921 | /** | ||
14922 | * Unmounts all rendered children. This should be used to clean up children | ||
14923 | * when this component is unmounted. | ||
14924 | * | ||
14925 | * @param {?object} renderedChildren Previously initialized set of children. | ||
14926 | * @internal | ||
14927 | */ | ||
14928 | unmountChildren: function (renderedChildren, safely) { | ||
14929 | for (var name in renderedChildren) { | ||
14930 | if (renderedChildren.hasOwnProperty(name)) { | ||
14931 | var renderedChild = renderedChildren[name]; | ||
14932 | ReactReconciler.unmountComponent(renderedChild, safely); | ||
14933 | } | ||
14934 | } | ||
14935 | } | ||
14936 | |||
14937 | }; | ||
14938 | |||
14939 | module.exports = ReactChildReconciler; | ||
14940 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
14941 | |||
14942 | /***/ }), | ||
14943 | /* 124 */ | ||
14944 | /***/ (function(module, exports, __webpack_require__) { | ||
14945 | |||
14946 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
14947 | * Copyright 2013-present, Facebook, Inc. | ||
14948 | * All rights reserved. | ||
14949 | * | ||
14950 | * This source code is licensed under the BSD-style license found in the | ||
14951 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14952 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14953 | * | ||
14954 | */ | ||
14955 | |||
14956 | 'use strict'; | ||
14957 | |||
14958 | var _prodInvariant = __webpack_require__(41), | ||
14959 | _assign = __webpack_require__(6); | ||
14960 | |||
14961 | var ReactCompositeComponent = __webpack_require__(125); | ||
14962 | var ReactEmptyComponent = __webpack_require__(131); | ||
14963 | var ReactHostComponent = __webpack_require__(132); | ||
14964 | |||
14965 | var getNextDebugID = __webpack_require__(133); | ||
14966 | var invariant = __webpack_require__(10); | ||
14967 | var warning = __webpack_require__(13); | ||
14968 | |||
14969 | // To avoid a cyclic dependency, we create the final class in this module | ||
14970 | var ReactCompositeComponentWrapper = function (element) { | ||
14971 | this.construct(element); | ||
14972 | }; | ||
14973 | |||
14974 | function getDeclarationErrorAddendum(owner) { | ||
14975 | if (owner) { | ||
14976 | var name = owner.getName(); | ||
14977 | if (name) { | ||
14978 | return ' Check the render method of `' + name + '`.'; | ||
14979 | } | ||
14980 | } | ||
14981 | return ''; | ||
14982 | } | ||
14983 | |||
14984 | /** | ||
14985 | * Check if the type reference is a known internal type. I.e. not a user | ||
14986 | * provided composite type. | ||
14987 | * | ||
14988 | * @param {function} type | ||
14989 | * @return {boolean} Returns true if this is a valid internal type. | ||
14990 | */ | ||
14991 | function isInternalComponentType(type) { | ||
14992 | return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function'; | ||
14993 | } | ||
14994 | |||
14995 | /** | ||
14996 | * Given a ReactNode, create an instance that will actually be mounted. | ||
14997 | * | ||
14998 | * @param {ReactNode} node | ||
14999 | * @param {boolean} shouldHaveDebugID | ||
15000 | * @return {object} A new instance of the element's constructor. | ||
15001 | * @protected | ||
15002 | */ | ||
15003 | function instantiateReactComponent(node, shouldHaveDebugID) { | ||
15004 | var instance; | ||
15005 | |||
15006 | if (node === null || node === false) { | ||
15007 | instance = ReactEmptyComponent.create(instantiateReactComponent); | ||
15008 | } else if (typeof node === 'object') { | ||
15009 | var element = node; | ||
15010 | var type = element.type; | ||
15011 | if (typeof type !== 'function' && typeof type !== 'string') { | ||
15012 | var info = ''; | ||
15013 | if (process.env.NODE_ENV !== 'production') { | ||
15014 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { | ||
15015 | info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.'; | ||
15016 | } | ||
15017 | } | ||
15018 | info += getDeclarationErrorAddendum(element._owner); | ||
15019 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info) : _prodInvariant('130', type == null ? type : typeof type, info) : void 0; | ||
15020 | } | ||
15021 | |||
15022 | // Special case string values | ||
15023 | if (typeof element.type === 'string') { | ||
15024 | instance = ReactHostComponent.createInternalComponent(element); | ||
15025 | } else if (isInternalComponentType(element.type)) { | ||
15026 | // This is temporarily available for custom components that are not string | ||
15027 | // representations. I.e. ART. Once those are updated to use the string | ||
15028 | // representation, we can drop this code path. | ||
15029 | instance = new element.type(element); | ||
15030 | |||
15031 | // We renamed this. Allow the old name for compat. :( | ||
15032 | if (!instance.getHostNode) { | ||
15033 | instance.getHostNode = instance.getNativeNode; | ||
15034 | } | ||
15035 | } else { | ||
15036 | instance = new ReactCompositeComponentWrapper(element); | ||
15037 | } | ||
15038 | } else if (typeof node === 'string' || typeof node === 'number') { | ||
15039 | instance = ReactHostComponent.createInstanceForText(node); | ||
15040 | } else { | ||
15041 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0; | ||
15042 | } | ||
15043 | |||
15044 | if (process.env.NODE_ENV !== 'production') { | ||
15045 | process.env.NODE_ENV !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getHostNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0; | ||
15046 | } | ||
15047 | |||
15048 | // These two fields are used by the DOM and ART diffing algorithms | ||
15049 | // respectively. Instead of using expandos on components, we should be | ||
15050 | // storing the state needed by the diffing algorithms elsewhere. | ||
15051 | instance._mountIndex = 0; | ||
15052 | instance._mountImage = null; | ||
15053 | |||
15054 | if (process.env.NODE_ENV !== 'production') { | ||
15055 | instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0; | ||
15056 | } | ||
15057 | |||
15058 | // Internal instances should fully constructed at this point, so they should | ||
15059 | // not get any new fields added to them at this point. | ||
15060 | if (process.env.NODE_ENV !== 'production') { | ||
15061 | if (Object.preventExtensions) { | ||
15062 | Object.preventExtensions(instance); | ||
15063 | } | ||
15064 | } | ||
15065 | |||
15066 | return instance; | ||
15067 | } | ||
15068 | |||
15069 | _assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, { | ||
15070 | _instantiateReactComponent: instantiateReactComponent | ||
15071 | }); | ||
15072 | |||
15073 | module.exports = instantiateReactComponent; | ||
15074 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
15075 | |||
15076 | /***/ }), | ||
15077 | /* 125 */ | ||
15078 | /***/ (function(module, exports, __webpack_require__) { | ||
15079 | |||
15080 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
15081 | * Copyright 2013-present, Facebook, Inc. | ||
15082 | * All rights reserved. | ||
15083 | * | ||
15084 | * This source code is licensed under the BSD-style license found in the | ||
15085 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15086 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15087 | * | ||
15088 | */ | ||
15089 | |||
15090 | 'use strict'; | ||
15091 | |||
15092 | var _prodInvariant = __webpack_require__(41), | ||
15093 | _assign = __webpack_require__(6); | ||
15094 | |||
15095 | var React = __webpack_require__(4); | ||
15096 | var ReactComponentEnvironment = __webpack_require__(121); | ||
15097 | var ReactCurrentOwner = __webpack_require__(12); | ||
15098 | var ReactErrorUtils = __webpack_require__(51); | ||
15099 | var ReactInstanceMap = __webpack_require__(122); | ||
15100 | var ReactInstrumentation = __webpack_require__(68); | ||
15101 | var ReactNodeTypes = __webpack_require__(126); | ||
15102 | var ReactReconciler = __webpack_require__(65); | ||
15103 | |||
15104 | if (process.env.NODE_ENV !== 'production') { | ||
15105 | var checkReactTypeSpec = __webpack_require__(127); | ||
15106 | } | ||
15107 | |||
15108 | var emptyObject = __webpack_require__(22); | ||
15109 | var invariant = __webpack_require__(10); | ||
15110 | var shallowEqual = __webpack_require__(129); | ||
15111 | var shouldUpdateReactComponent = __webpack_require__(130); | ||
15112 | var warning = __webpack_require__(13); | ||
15113 | |||
15114 | var CompositeTypes = { | ||
15115 | ImpureClass: 0, | ||
15116 | PureClass: 1, | ||
15117 | StatelessFunctional: 2 | ||
15118 | }; | ||
15119 | |||
15120 | function StatelessComponent(Component) {} | ||
15121 | StatelessComponent.prototype.render = function () { | ||
15122 | var Component = ReactInstanceMap.get(this)._currentElement.type; | ||
15123 | var element = Component(this.props, this.context, this.updater); | ||
15124 | warnIfInvalidElement(Component, element); | ||
15125 | return element; | ||
15126 | }; | ||
15127 | |||
15128 | function warnIfInvalidElement(Component, element) { | ||
15129 | if (process.env.NODE_ENV !== 'production') { | ||
15130 | process.env.NODE_ENV !== 'production' ? warning(element === null || element === false || React.isValidElement(element), '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : void 0; | ||
15131 | process.env.NODE_ENV !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0; | ||
15132 | } | ||
15133 | } | ||
15134 | |||
15135 | function shouldConstruct(Component) { | ||
15136 | return !!(Component.prototype && Component.prototype.isReactComponent); | ||
15137 | } | ||
15138 | |||
15139 | function isPureComponent(Component) { | ||
15140 | return !!(Component.prototype && Component.prototype.isPureReactComponent); | ||
15141 | } | ||
15142 | |||
15143 | // Separated into a function to contain deoptimizations caused by try/finally. | ||
15144 | function measureLifeCyclePerf(fn, debugID, timerType) { | ||
15145 | if (debugID === 0) { | ||
15146 | // Top-level wrappers (see ReactMount) and empty components (see | ||
15147 | // ReactDOMEmptyComponent) are invisible to hooks and devtools. | ||
15148 | // Both are implementation details that should go away in the future. | ||
15149 | return fn(); | ||
15150 | } | ||
15151 | |||
15152 | ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType); | ||
15153 | try { | ||
15154 | return fn(); | ||
15155 | } finally { | ||
15156 | ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType); | ||
15157 | } | ||
15158 | } | ||
15159 | |||
15160 | /** | ||
15161 | * ------------------ The Life-Cycle of a Composite Component ------------------ | ||
15162 | * | ||
15163 | * - constructor: Initialization of state. The instance is now retained. | ||
15164 | * - componentWillMount | ||
15165 | * - render | ||
15166 | * - [children's constructors] | ||
15167 | * - [children's componentWillMount and render] | ||
15168 | * - [children's componentDidMount] | ||
15169 | * - componentDidMount | ||
15170 | * | ||
15171 | * Update Phases: | ||
15172 | * - componentWillReceiveProps (only called if parent updated) | ||
15173 | * - shouldComponentUpdate | ||
15174 | * - componentWillUpdate | ||
15175 | * - render | ||
15176 | * - [children's constructors or receive props phases] | ||
15177 | * - componentDidUpdate | ||
15178 | * | ||
15179 | * - componentWillUnmount | ||
15180 | * - [children's componentWillUnmount] | ||
15181 | * - [children destroyed] | ||
15182 | * - (destroyed): The instance is now blank, released by React and ready for GC. | ||
15183 | * | ||
15184 | * ----------------------------------------------------------------------------- | ||
15185 | */ | ||
15186 | |||
15187 | /** | ||
15188 | * An incrementing ID assigned to each component when it is mounted. This is | ||
15189 | * used to enforce the order in which `ReactUpdates` updates dirty components. | ||
15190 | * | ||
15191 | * @private | ||
15192 | */ | ||
15193 | var nextMountID = 1; | ||
15194 | |||
15195 | /** | ||
15196 | * @lends {ReactCompositeComponent.prototype} | ||
15197 | */ | ||
15198 | var ReactCompositeComponent = { | ||
15199 | |||
15200 | /** | ||
15201 | * Base constructor for all composite component. | ||
15202 | * | ||
15203 | * @param {ReactElement} element | ||
15204 | * @final | ||
15205 | * @internal | ||
15206 | */ | ||
15207 | construct: function (element) { | ||
15208 | this._currentElement = element; | ||
15209 | this._rootNodeID = 0; | ||
15210 | this._compositeType = null; | ||
15211 | this._instance = null; | ||
15212 | this._hostParent = null; | ||
15213 | this._hostContainerInfo = null; | ||
15214 | |||
15215 | // See ReactUpdateQueue | ||
15216 | this._updateBatchNumber = null; | ||
15217 | this._pendingElement = null; | ||
15218 | this._pendingStateQueue = null; | ||
15219 | this._pendingReplaceState = false; | ||
15220 | this._pendingForceUpdate = false; | ||
15221 | |||
15222 | this._renderedNodeType = null; | ||
15223 | this._renderedComponent = null; | ||
15224 | this._context = null; | ||
15225 | this._mountOrder = 0; | ||
15226 | this._topLevelWrapper = null; | ||
15227 | |||
15228 | // See ReactUpdates and ReactUpdateQueue. | ||
15229 | this._pendingCallbacks = null; | ||
15230 | |||
15231 | // ComponentWillUnmount shall only be called once | ||
15232 | this._calledComponentWillUnmount = false; | ||
15233 | |||
15234 | if (process.env.NODE_ENV !== 'production') { | ||
15235 | this._warnedAboutRefsInRender = false; | ||
15236 | } | ||
15237 | }, | ||
15238 | |||
15239 | /** | ||
15240 | * Initializes the component, renders markup, and registers event listeners. | ||
15241 | * | ||
15242 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
15243 | * @param {?object} hostParent | ||
15244 | * @param {?object} hostContainerInfo | ||
15245 | * @param {?object} context | ||
15246 | * @return {?string} Rendered markup to be inserted into the DOM. | ||
15247 | * @final | ||
15248 | * @internal | ||
15249 | */ | ||
15250 | mountComponent: function (transaction, hostParent, hostContainerInfo, context) { | ||
15251 | var _this = this; | ||
15252 | |||
15253 | this._context = context; | ||
15254 | this._mountOrder = nextMountID++; | ||
15255 | this._hostParent = hostParent; | ||
15256 | this._hostContainerInfo = hostContainerInfo; | ||
15257 | |||
15258 | var publicProps = this._currentElement.props; | ||
15259 | var publicContext = this._processContext(context); | ||
15260 | |||
15261 | var Component = this._currentElement.type; | ||
15262 | |||
15263 | var updateQueue = transaction.getUpdateQueue(); | ||
15264 | |||
15265 | // Initialize the public class | ||
15266 | var doConstruct = shouldConstruct(Component); | ||
15267 | var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue); | ||
15268 | var renderedElement; | ||
15269 | |||
15270 | // Support functional components | ||
15271 | if (!doConstruct && (inst == null || inst.render == null)) { | ||
15272 | renderedElement = inst; | ||
15273 | warnIfInvalidElement(Component, renderedElement); | ||
15274 | !(inst === null || inst === false || React.isValidElement(inst)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : _prodInvariant('105', Component.displayName || Component.name || 'Component') : void 0; | ||
15275 | inst = new StatelessComponent(Component); | ||
15276 | this._compositeType = CompositeTypes.StatelessFunctional; | ||
15277 | } else { | ||
15278 | if (isPureComponent(Component)) { | ||
15279 | this._compositeType = CompositeTypes.PureClass; | ||
15280 | } else { | ||
15281 | this._compositeType = CompositeTypes.ImpureClass; | ||
15282 | } | ||
15283 | } | ||
15284 | |||
15285 | if (process.env.NODE_ENV !== 'production') { | ||
15286 | // This will throw later in _renderValidatedComponent, but add an early | ||
15287 | // warning now to help debugging | ||
15288 | if (inst.render == null) { | ||
15289 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', Component.displayName || Component.name || 'Component') : void 0; | ||
15290 | } | ||
15291 | |||
15292 | var propsMutated = inst.props !== publicProps; | ||
15293 | var componentName = Component.displayName || Component.name || 'Component'; | ||
15294 | |||
15295 | process.env.NODE_ENV !== 'production' ? warning(inst.props === undefined || !propsMutated, '%s(...): When calling super() in `%s`, make sure to pass ' + 'up the same props that your component\'s constructor was passed.', componentName, componentName) : void 0; | ||
15296 | } | ||
15297 | |||
15298 | // These should be set up in the constructor, but as a convenience for | ||
15299 | // simpler class abstractions, we set them up after the fact. | ||
15300 | inst.props = publicProps; | ||
15301 | inst.context = publicContext; | ||
15302 | inst.refs = emptyObject; | ||
15303 | inst.updater = updateQueue; | ||
15304 | |||
15305 | this._instance = inst; | ||
15306 | |||
15307 | // Store a reference from the instance back to the internal representation | ||
15308 | ReactInstanceMap.set(inst, this); | ||
15309 | |||
15310 | if (process.env.NODE_ENV !== 'production') { | ||
15311 | // Since plain JS classes are defined without any special initialization | ||
15312 | // logic, we can not catch common errors early. Therefore, we have to | ||
15313 | // catch them here, at initialization time, instead. | ||
15314 | process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved || inst.state, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0; | ||
15315 | process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : void 0; | ||
15316 | process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : void 0; | ||
15317 | process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : void 0; | ||
15318 | process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : void 0; | ||
15319 | process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : void 0; | ||
15320 | process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : void 0; | ||
15321 | } | ||
15322 | |||
15323 | var initialState = inst.state; | ||
15324 | if (initialState === undefined) { | ||
15325 | inst.state = initialState = null; | ||
15326 | } | ||
15327 | !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : _prodInvariant('106', this.getName() || 'ReactCompositeComponent') : void 0; | ||
15328 | |||
15329 | this._pendingStateQueue = null; | ||
15330 | this._pendingReplaceState = false; | ||
15331 | this._pendingForceUpdate = false; | ||
15332 | |||
15333 | var markup; | ||
15334 | if (inst.unstable_handleError) { | ||
15335 | markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context); | ||
15336 | } else { | ||
15337 | markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); | ||
15338 | } | ||
15339 | |||
15340 | if (inst.componentDidMount) { | ||
15341 | if (process.env.NODE_ENV !== 'production') { | ||
15342 | transaction.getReactMountReady().enqueue(function () { | ||
15343 | measureLifeCyclePerf(function () { | ||
15344 | return inst.componentDidMount(); | ||
15345 | }, _this._debugID, 'componentDidMount'); | ||
15346 | }); | ||
15347 | } else { | ||
15348 | transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); | ||
15349 | } | ||
15350 | } | ||
15351 | |||
15352 | return markup; | ||
15353 | }, | ||
15354 | |||
15355 | _constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) { | ||
15356 | if (process.env.NODE_ENV !== 'production') { | ||
15357 | ReactCurrentOwner.current = this; | ||
15358 | try { | ||
15359 | return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue); | ||
15360 | } finally { | ||
15361 | ReactCurrentOwner.current = null; | ||
15362 | } | ||
15363 | } else { | ||
15364 | return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue); | ||
15365 | } | ||
15366 | }, | ||
15367 | |||
15368 | _constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) { | ||
15369 | var Component = this._currentElement.type; | ||
15370 | |||
15371 | if (doConstruct) { | ||
15372 | if (process.env.NODE_ENV !== 'production') { | ||
15373 | return measureLifeCyclePerf(function () { | ||
15374 | return new Component(publicProps, publicContext, updateQueue); | ||
15375 | }, this._debugID, 'ctor'); | ||
15376 | } else { | ||
15377 | return new Component(publicProps, publicContext, updateQueue); | ||
15378 | } | ||
15379 | } | ||
15380 | |||
15381 | // This can still be an instance in case of factory components | ||
15382 | // but we'll count this as time spent rendering as the more common case. | ||
15383 | if (process.env.NODE_ENV !== 'production') { | ||
15384 | return measureLifeCyclePerf(function () { | ||
15385 | return Component(publicProps, publicContext, updateQueue); | ||
15386 | }, this._debugID, 'render'); | ||
15387 | } else { | ||
15388 | return Component(publicProps, publicContext, updateQueue); | ||
15389 | } | ||
15390 | }, | ||
15391 | |||
15392 | performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) { | ||
15393 | var markup; | ||
15394 | var checkpoint = transaction.checkpoint(); | ||
15395 | try { | ||
15396 | markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); | ||
15397 | } catch (e) { | ||
15398 | // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint | ||
15399 | transaction.rollback(checkpoint); | ||
15400 | this._instance.unstable_handleError(e); | ||
15401 | if (this._pendingStateQueue) { | ||
15402 | this._instance.state = this._processPendingState(this._instance.props, this._instance.context); | ||
15403 | } | ||
15404 | checkpoint = transaction.checkpoint(); | ||
15405 | |||
15406 | this._renderedComponent.unmountComponent(true); | ||
15407 | transaction.rollback(checkpoint); | ||
15408 | |||
15409 | // Try again - we've informed the component about the error, so they can render an error message this time. | ||
15410 | // If this throws again, the error will bubble up (and can be caught by a higher error boundary). | ||
15411 | markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); | ||
15412 | } | ||
15413 | return markup; | ||
15414 | }, | ||
15415 | |||
15416 | performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) { | ||
15417 | var inst = this._instance; | ||
15418 | |||
15419 | var debugID = 0; | ||
15420 | if (process.env.NODE_ENV !== 'production') { | ||
15421 | debugID = this._debugID; | ||
15422 | } | ||
15423 | |||
15424 | if (inst.componentWillMount) { | ||
15425 | if (process.env.NODE_ENV !== 'production') { | ||
15426 | measureLifeCyclePerf(function () { | ||
15427 | return inst.componentWillMount(); | ||
15428 | }, debugID, 'componentWillMount'); | ||
15429 | } else { | ||
15430 | inst.componentWillMount(); | ||
15431 | } | ||
15432 | // When mounting, calls to `setState` by `componentWillMount` will set | ||
15433 | // `this._pendingStateQueue` without triggering a re-render. | ||
15434 | if (this._pendingStateQueue) { | ||
15435 | inst.state = this._processPendingState(inst.props, inst.context); | ||
15436 | } | ||
15437 | } | ||
15438 | |||
15439 | // If not a stateless component, we now render | ||
15440 | if (renderedElement === undefined) { | ||
15441 | renderedElement = this._renderValidatedComponent(); | ||
15442 | } | ||
15443 | |||
15444 | var nodeType = ReactNodeTypes.getType(renderedElement); | ||
15445 | this._renderedNodeType = nodeType; | ||
15446 | var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */ | ||
15447 | ); | ||
15448 | this._renderedComponent = child; | ||
15449 | |||
15450 | var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID); | ||
15451 | |||
15452 | if (process.env.NODE_ENV !== 'production') { | ||
15453 | if (debugID !== 0) { | ||
15454 | var childDebugIDs = child._debugID !== 0 ? [child._debugID] : []; | ||
15455 | ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs); | ||
15456 | } | ||
15457 | } | ||
15458 | |||
15459 | return markup; | ||
15460 | }, | ||
15461 | |||
15462 | getHostNode: function () { | ||
15463 | return ReactReconciler.getHostNode(this._renderedComponent); | ||
15464 | }, | ||
15465 | |||
15466 | /** | ||
15467 | * Releases any resources allocated by `mountComponent`. | ||
15468 | * | ||
15469 | * @final | ||
15470 | * @internal | ||
15471 | */ | ||
15472 | unmountComponent: function (safely) { | ||
15473 | if (!this._renderedComponent) { | ||
15474 | return; | ||
15475 | } | ||
15476 | |||
15477 | var inst = this._instance; | ||
15478 | |||
15479 | if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) { | ||
15480 | inst._calledComponentWillUnmount = true; | ||
15481 | |||
15482 | if (safely) { | ||
15483 | var name = this.getName() + '.componentWillUnmount()'; | ||
15484 | ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst)); | ||
15485 | } else { | ||
15486 | if (process.env.NODE_ENV !== 'production') { | ||
15487 | measureLifeCyclePerf(function () { | ||
15488 | return inst.componentWillUnmount(); | ||
15489 | }, this._debugID, 'componentWillUnmount'); | ||
15490 | } else { | ||
15491 | inst.componentWillUnmount(); | ||
15492 | } | ||
15493 | } | ||
15494 | } | ||
15495 | |||
15496 | if (this._renderedComponent) { | ||
15497 | ReactReconciler.unmountComponent(this._renderedComponent, safely); | ||
15498 | this._renderedNodeType = null; | ||
15499 | this._renderedComponent = null; | ||
15500 | this._instance = null; | ||
15501 | } | ||
15502 | |||
15503 | // Reset pending fields | ||
15504 | // Even if this component is scheduled for another update in ReactUpdates, | ||
15505 | // it would still be ignored because these fields are reset. | ||
15506 | this._pendingStateQueue = null; | ||
15507 | this._pendingReplaceState = false; | ||
15508 | this._pendingForceUpdate = false; | ||
15509 | this._pendingCallbacks = null; | ||
15510 | this._pendingElement = null; | ||
15511 | |||
15512 | // These fields do not really need to be reset since this object is no | ||
15513 | // longer accessible. | ||
15514 | this._context = null; | ||
15515 | this._rootNodeID = 0; | ||
15516 | this._topLevelWrapper = null; | ||
15517 | |||
15518 | // Delete the reference from the instance to this internal representation | ||
15519 | // which allow the internals to be properly cleaned up even if the user | ||
15520 | // leaks a reference to the public instance. | ||
15521 | ReactInstanceMap.remove(inst); | ||
15522 | |||
15523 | // Some existing components rely on inst.props even after they've been | ||
15524 | // destroyed (in event handlers). | ||
15525 | // TODO: inst.props = null; | ||
15526 | // TODO: inst.state = null; | ||
15527 | // TODO: inst.context = null; | ||
15528 | }, | ||
15529 | |||
15530 | /** | ||
15531 | * Filters the context object to only contain keys specified in | ||
15532 | * `contextTypes` | ||
15533 | * | ||
15534 | * @param {object} context | ||
15535 | * @return {?object} | ||
15536 | * @private | ||
15537 | */ | ||
15538 | _maskContext: function (context) { | ||
15539 | var Component = this._currentElement.type; | ||
15540 | var contextTypes = Component.contextTypes; | ||
15541 | if (!contextTypes) { | ||
15542 | return emptyObject; | ||
15543 | } | ||
15544 | var maskedContext = {}; | ||
15545 | for (var contextName in contextTypes) { | ||
15546 | maskedContext[contextName] = context[contextName]; | ||
15547 | } | ||
15548 | return maskedContext; | ||
15549 | }, | ||
15550 | |||
15551 | /** | ||
15552 | * Filters the context object to only contain keys specified in | ||
15553 | * `contextTypes`, and asserts that they are valid. | ||
15554 | * | ||
15555 | * @param {object} context | ||
15556 | * @return {?object} | ||
15557 | * @private | ||
15558 | */ | ||
15559 | _processContext: function (context) { | ||
15560 | var maskedContext = this._maskContext(context); | ||
15561 | if (process.env.NODE_ENV !== 'production') { | ||
15562 | var Component = this._currentElement.type; | ||
15563 | if (Component.contextTypes) { | ||
15564 | this._checkContextTypes(Component.contextTypes, maskedContext, 'context'); | ||
15565 | } | ||
15566 | } | ||
15567 | return maskedContext; | ||
15568 | }, | ||
15569 | |||
15570 | /** | ||
15571 | * @param {object} currentContext | ||
15572 | * @return {object} | ||
15573 | * @private | ||
15574 | */ | ||
15575 | _processChildContext: function (currentContext) { | ||
15576 | var Component = this._currentElement.type; | ||
15577 | var inst = this._instance; | ||
15578 | var childContext; | ||
15579 | |||
15580 | if (inst.getChildContext) { | ||
15581 | if (process.env.NODE_ENV !== 'production') { | ||
15582 | ReactInstrumentation.debugTool.onBeginProcessingChildContext(); | ||
15583 | try { | ||
15584 | childContext = inst.getChildContext(); | ||
15585 | } finally { | ||
15586 | ReactInstrumentation.debugTool.onEndProcessingChildContext(); | ||
15587 | } | ||
15588 | } else { | ||
15589 | childContext = inst.getChildContext(); | ||
15590 | } | ||
15591 | } | ||
15592 | |||
15593 | if (childContext) { | ||
15594 | !(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().', this.getName() || 'ReactCompositeComponent') : _prodInvariant('107', this.getName() || 'ReactCompositeComponent') : void 0; | ||
15595 | if (process.env.NODE_ENV !== 'production') { | ||
15596 | this._checkContextTypes(Component.childContextTypes, childContext, 'child context'); | ||
15597 | } | ||
15598 | for (var name in childContext) { | ||
15599 | !(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : _prodInvariant('108', this.getName() || 'ReactCompositeComponent', name) : void 0; | ||
15600 | } | ||
15601 | return _assign({}, currentContext, childContext); | ||
15602 | } | ||
15603 | return currentContext; | ||
15604 | }, | ||
15605 | |||
15606 | /** | ||
15607 | * Assert that the context types are valid | ||
15608 | * | ||
15609 | * @param {object} typeSpecs Map of context field to a ReactPropType | ||
15610 | * @param {object} values Runtime values that need to be type-checked | ||
15611 | * @param {string} location e.g. "prop", "context", "child context" | ||
15612 | * @private | ||
15613 | */ | ||
15614 | _checkContextTypes: function (typeSpecs, values, location) { | ||
15615 | if (process.env.NODE_ENV !== 'production') { | ||
15616 | checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID); | ||
15617 | } | ||
15618 | }, | ||
15619 | |||
15620 | receiveComponent: function (nextElement, transaction, nextContext) { | ||
15621 | var prevElement = this._currentElement; | ||
15622 | var prevContext = this._context; | ||
15623 | |||
15624 | this._pendingElement = null; | ||
15625 | |||
15626 | this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext); | ||
15627 | }, | ||
15628 | |||
15629 | /** | ||
15630 | * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate` | ||
15631 | * is set, update the component. | ||
15632 | * | ||
15633 | * @param {ReactReconcileTransaction} transaction | ||
15634 | * @internal | ||
15635 | */ | ||
15636 | performUpdateIfNecessary: function (transaction) { | ||
15637 | if (this._pendingElement != null) { | ||
15638 | ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context); | ||
15639 | } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) { | ||
15640 | this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context); | ||
15641 | } else { | ||
15642 | this._updateBatchNumber = null; | ||
15643 | } | ||
15644 | }, | ||
15645 | |||
15646 | /** | ||
15647 | * Perform an update to a mounted component. The componentWillReceiveProps and | ||
15648 | * shouldComponentUpdate methods are called, then (assuming the update isn't | ||
15649 | * skipped) the remaining update lifecycle methods are called and the DOM | ||
15650 | * representation is updated. | ||
15651 | * | ||
15652 | * By default, this implements React's rendering and reconciliation algorithm. | ||
15653 | * Sophisticated clients may wish to override this. | ||
15654 | * | ||
15655 | * @param {ReactReconcileTransaction} transaction | ||
15656 | * @param {ReactElement} prevParentElement | ||
15657 | * @param {ReactElement} nextParentElement | ||
15658 | * @internal | ||
15659 | * @overridable | ||
15660 | */ | ||
15661 | updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) { | ||
15662 | var inst = this._instance; | ||
15663 | !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Attempted to update component `%s` that has already been unmounted (or failed to mount).', this.getName() || 'ReactCompositeComponent') : _prodInvariant('136', this.getName() || 'ReactCompositeComponent') : void 0; | ||
15664 | |||
15665 | var willReceive = false; | ||
15666 | var nextContext; | ||
15667 | |||
15668 | // Determine if the context has changed or not | ||
15669 | if (this._context === nextUnmaskedContext) { | ||
15670 | nextContext = inst.context; | ||
15671 | } else { | ||
15672 | nextContext = this._processContext(nextUnmaskedContext); | ||
15673 | willReceive = true; | ||
15674 | } | ||
15675 | |||
15676 | var prevProps = prevParentElement.props; | ||
15677 | var nextProps = nextParentElement.props; | ||
15678 | |||
15679 | // Not a simple state update but a props update | ||
15680 | if (prevParentElement !== nextParentElement) { | ||
15681 | willReceive = true; | ||
15682 | } | ||
15683 | |||
15684 | // An update here will schedule an update but immediately set | ||
15685 | // _pendingStateQueue which will ensure that any state updates gets | ||
15686 | // immediately reconciled instead of waiting for the next batch. | ||
15687 | if (willReceive && inst.componentWillReceiveProps) { | ||
15688 | if (process.env.NODE_ENV !== 'production') { | ||
15689 | measureLifeCyclePerf(function () { | ||
15690 | return inst.componentWillReceiveProps(nextProps, nextContext); | ||
15691 | }, this._debugID, 'componentWillReceiveProps'); | ||
15692 | } else { | ||
15693 | inst.componentWillReceiveProps(nextProps, nextContext); | ||
15694 | } | ||
15695 | } | ||
15696 | |||
15697 | var nextState = this._processPendingState(nextProps, nextContext); | ||
15698 | var shouldUpdate = true; | ||
15699 | |||
15700 | if (!this._pendingForceUpdate) { | ||
15701 | if (inst.shouldComponentUpdate) { | ||
15702 | if (process.env.NODE_ENV !== 'production') { | ||
15703 | shouldUpdate = measureLifeCyclePerf(function () { | ||
15704 | return inst.shouldComponentUpdate(nextProps, nextState, nextContext); | ||
15705 | }, this._debugID, 'shouldComponentUpdate'); | ||
15706 | } else { | ||
15707 | shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext); | ||
15708 | } | ||
15709 | } else { | ||
15710 | if (this._compositeType === CompositeTypes.PureClass) { | ||
15711 | shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState); | ||
15712 | } | ||
15713 | } | ||
15714 | } | ||
15715 | |||
15716 | if (process.env.NODE_ENV !== 'production') { | ||
15717 | process.env.NODE_ENV !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0; | ||
15718 | } | ||
15719 | |||
15720 | this._updateBatchNumber = null; | ||
15721 | if (shouldUpdate) { | ||
15722 | this._pendingForceUpdate = false; | ||
15723 | // Will set `this.props`, `this.state` and `this.context`. | ||
15724 | this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext); | ||
15725 | } else { | ||
15726 | // If it's determined that a component should not update, we still want | ||
15727 | // to set props and state but we shortcut the rest of the update. | ||
15728 | this._currentElement = nextParentElement; | ||
15729 | this._context = nextUnmaskedContext; | ||
15730 | inst.props = nextProps; | ||
15731 | inst.state = nextState; | ||
15732 | inst.context = nextContext; | ||
15733 | } | ||
15734 | }, | ||
15735 | |||
15736 | _processPendingState: function (props, context) { | ||
15737 | var inst = this._instance; | ||
15738 | var queue = this._pendingStateQueue; | ||
15739 | var replace = this._pendingReplaceState; | ||
15740 | this._pendingReplaceState = false; | ||
15741 | this._pendingStateQueue = null; | ||
15742 | |||
15743 | if (!queue) { | ||
15744 | return inst.state; | ||
15745 | } | ||
15746 | |||
15747 | if (replace && queue.length === 1) { | ||
15748 | return queue[0]; | ||
15749 | } | ||
15750 | |||
15751 | var nextState = _assign({}, replace ? queue[0] : inst.state); | ||
15752 | for (var i = replace ? 1 : 0; i < queue.length; i++) { | ||
15753 | var partial = queue[i]; | ||
15754 | _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial); | ||
15755 | } | ||
15756 | |||
15757 | return nextState; | ||
15758 | }, | ||
15759 | |||
15760 | /** | ||
15761 | * Merges new props and state, notifies delegate methods of update and | ||
15762 | * performs update. | ||
15763 | * | ||
15764 | * @param {ReactElement} nextElement Next element | ||
15765 | * @param {object} nextProps Next public object to set as properties. | ||
15766 | * @param {?object} nextState Next object to set as state. | ||
15767 | * @param {?object} nextContext Next public object to set as context. | ||
15768 | * @param {ReactReconcileTransaction} transaction | ||
15769 | * @param {?object} unmaskedContext | ||
15770 | * @private | ||
15771 | */ | ||
15772 | _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) { | ||
15773 | var _this2 = this; | ||
15774 | |||
15775 | var inst = this._instance; | ||
15776 | |||
15777 | var hasComponentDidUpdate = Boolean(inst.componentDidUpdate); | ||
15778 | var prevProps; | ||
15779 | var prevState; | ||
15780 | var prevContext; | ||
15781 | if (hasComponentDidUpdate) { | ||
15782 | prevProps = inst.props; | ||
15783 | prevState = inst.state; | ||
15784 | prevContext = inst.context; | ||
15785 | } | ||
15786 | |||
15787 | if (inst.componentWillUpdate) { | ||
15788 | if (process.env.NODE_ENV !== 'production') { | ||
15789 | measureLifeCyclePerf(function () { | ||
15790 | return inst.componentWillUpdate(nextProps, nextState, nextContext); | ||
15791 | }, this._debugID, 'componentWillUpdate'); | ||
15792 | } else { | ||
15793 | inst.componentWillUpdate(nextProps, nextState, nextContext); | ||
15794 | } | ||
15795 | } | ||
15796 | |||
15797 | this._currentElement = nextElement; | ||
15798 | this._context = unmaskedContext; | ||
15799 | inst.props = nextProps; | ||
15800 | inst.state = nextState; | ||
15801 | inst.context = nextContext; | ||
15802 | |||
15803 | this._updateRenderedComponent(transaction, unmaskedContext); | ||
15804 | |||
15805 | if (hasComponentDidUpdate) { | ||
15806 | if (process.env.NODE_ENV !== 'production') { | ||
15807 | transaction.getReactMountReady().enqueue(function () { | ||
15808 | measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), _this2._debugID, 'componentDidUpdate'); | ||
15809 | }); | ||
15810 | } else { | ||
15811 | transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst); | ||
15812 | } | ||
15813 | } | ||
15814 | }, | ||
15815 | |||
15816 | /** | ||
15817 | * Call the component's `render` method and update the DOM accordingly. | ||
15818 | * | ||
15819 | * @param {ReactReconcileTransaction} transaction | ||
15820 | * @internal | ||
15821 | */ | ||
15822 | _updateRenderedComponent: function (transaction, context) { | ||
15823 | var prevComponentInstance = this._renderedComponent; | ||
15824 | var prevRenderedElement = prevComponentInstance._currentElement; | ||
15825 | var nextRenderedElement = this._renderValidatedComponent(); | ||
15826 | |||
15827 | var debugID = 0; | ||
15828 | if (process.env.NODE_ENV !== 'production') { | ||
15829 | debugID = this._debugID; | ||
15830 | } | ||
15831 | |||
15832 | if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { | ||
15833 | ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context)); | ||
15834 | } else { | ||
15835 | var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance); | ||
15836 | ReactReconciler.unmountComponent(prevComponentInstance, false); | ||
15837 | |||
15838 | var nodeType = ReactNodeTypes.getType(nextRenderedElement); | ||
15839 | this._renderedNodeType = nodeType; | ||
15840 | var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */ | ||
15841 | ); | ||
15842 | this._renderedComponent = child; | ||
15843 | |||
15844 | var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID); | ||
15845 | |||
15846 | if (process.env.NODE_ENV !== 'production') { | ||
15847 | if (debugID !== 0) { | ||
15848 | var childDebugIDs = child._debugID !== 0 ? [child._debugID] : []; | ||
15849 | ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs); | ||
15850 | } | ||
15851 | } | ||
15852 | |||
15853 | this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance); | ||
15854 | } | ||
15855 | }, | ||
15856 | |||
15857 | /** | ||
15858 | * Overridden in shallow rendering. | ||
15859 | * | ||
15860 | * @protected | ||
15861 | */ | ||
15862 | _replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) { | ||
15863 | ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance); | ||
15864 | }, | ||
15865 | |||
15866 | /** | ||
15867 | * @protected | ||
15868 | */ | ||
15869 | _renderValidatedComponentWithoutOwnerOrContext: function () { | ||
15870 | var inst = this._instance; | ||
15871 | var renderedElement; | ||
15872 | |||
15873 | if (process.env.NODE_ENV !== 'production') { | ||
15874 | renderedElement = measureLifeCyclePerf(function () { | ||
15875 | return inst.render(); | ||
15876 | }, this._debugID, 'render'); | ||
15877 | } else { | ||
15878 | renderedElement = inst.render(); | ||
15879 | } | ||
15880 | |||
15881 | if (process.env.NODE_ENV !== 'production') { | ||
15882 | // We allow auto-mocks to proceed as if they're returning null. | ||
15883 | if (renderedElement === undefined && inst.render._isMockFunction) { | ||
15884 | // This is probably bad practice. Consider warning here and | ||
15885 | // deprecating this convenience. | ||
15886 | renderedElement = null; | ||
15887 | } | ||
15888 | } | ||
15889 | |||
15890 | return renderedElement; | ||
15891 | }, | ||
15892 | |||
15893 | /** | ||
15894 | * @private | ||
15895 | */ | ||
15896 | _renderValidatedComponent: function () { | ||
15897 | var renderedElement; | ||
15898 | if (process.env.NODE_ENV !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) { | ||
15899 | ReactCurrentOwner.current = this; | ||
15900 | try { | ||
15901 | renderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); | ||
15902 | } finally { | ||
15903 | ReactCurrentOwner.current = null; | ||
15904 | } | ||
15905 | } else { | ||
15906 | renderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); | ||
15907 | } | ||
15908 | !( | ||
15909 | // TODO: An `isValidNode` function would probably be more appropriate | ||
15910 | renderedElement === null || renderedElement === false || React.isValidElement(renderedElement)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : _prodInvariant('109', this.getName() || 'ReactCompositeComponent') : void 0; | ||
15911 | |||
15912 | return renderedElement; | ||
15913 | }, | ||
15914 | |||
15915 | /** | ||
15916 | * Lazily allocates the refs object and stores `component` as `ref`. | ||
15917 | * | ||
15918 | * @param {string} ref Reference name. | ||
15919 | * @param {component} component Component to store as `ref`. | ||
15920 | * @final | ||
15921 | * @private | ||
15922 | */ | ||
15923 | attachRef: function (ref, component) { | ||
15924 | var inst = this.getPublicInstance(); | ||
15925 | !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0; | ||
15926 | var publicComponentInstance = component.getPublicInstance(); | ||
15927 | if (process.env.NODE_ENV !== 'production') { | ||
15928 | var componentName = component && component.getName ? component.getName() : 'a component'; | ||
15929 | process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null || component._compositeType !== CompositeTypes.StatelessFunctional, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : void 0; | ||
15930 | } | ||
15931 | var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs; | ||
15932 | refs[ref] = publicComponentInstance; | ||
15933 | }, | ||
15934 | |||
15935 | /** | ||
15936 | * Detaches a reference name. | ||
15937 | * | ||
15938 | * @param {string} ref Name to dereference. | ||
15939 | * @final | ||
15940 | * @private | ||
15941 | */ | ||
15942 | detachRef: function (ref) { | ||
15943 | var refs = this.getPublicInstance().refs; | ||
15944 | delete refs[ref]; | ||
15945 | }, | ||
15946 | |||
15947 | /** | ||
15948 | * Get a text description of the component that can be used to identify it | ||
15949 | * in error messages. | ||
15950 | * @return {string} The name or null. | ||
15951 | * @internal | ||
15952 | */ | ||
15953 | getName: function () { | ||
15954 | var type = this._currentElement.type; | ||
15955 | var constructor = this._instance && this._instance.constructor; | ||
15956 | return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null; | ||
15957 | }, | ||
15958 | |||
15959 | /** | ||
15960 | * Get the publicly accessible representation of this component - i.e. what | ||
15961 | * is exposed by refs and returned by render. Can be null for stateless | ||
15962 | * components. | ||
15963 | * | ||
15964 | * @return {ReactComponent} the public component instance. | ||
15965 | * @internal | ||
15966 | */ | ||
15967 | getPublicInstance: function () { | ||
15968 | var inst = this._instance; | ||
15969 | if (this._compositeType === CompositeTypes.StatelessFunctional) { | ||
15970 | return null; | ||
15971 | } | ||
15972 | return inst; | ||
15973 | }, | ||
15974 | |||
15975 | // Stub | ||
15976 | _instantiateReactComponent: null | ||
15977 | |||
15978 | }; | ||
15979 | |||
15980 | module.exports = ReactCompositeComponent; | ||
15981 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
15982 | |||
15983 | /***/ }), | ||
15984 | /* 126 */ | ||
15985 | /***/ (function(module, exports, __webpack_require__) { | ||
15986 | |||
15987 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
15988 | * Copyright 2013-present, Facebook, Inc. | ||
15989 | * All rights reserved. | ||
15990 | * | ||
15991 | * This source code is licensed under the BSD-style license found in the | ||
15992 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15993 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15994 | * | ||
15995 | * | ||
15996 | */ | ||
15997 | |||
15998 | 'use strict'; | ||
15999 | |||
16000 | var _prodInvariant = __webpack_require__(41); | ||
16001 | |||
16002 | var React = __webpack_require__(4); | ||
16003 | |||
16004 | var invariant = __webpack_require__(10); | ||
16005 | |||
16006 | var ReactNodeTypes = { | ||
16007 | HOST: 0, | ||
16008 | COMPOSITE: 1, | ||
16009 | EMPTY: 2, | ||
16010 | |||
16011 | getType: function (node) { | ||
16012 | if (node === null || node === false) { | ||
16013 | return ReactNodeTypes.EMPTY; | ||
16014 | } else if (React.isValidElement(node)) { | ||
16015 | if (typeof node.type === 'function') { | ||
16016 | return ReactNodeTypes.COMPOSITE; | ||
16017 | } else { | ||
16018 | return ReactNodeTypes.HOST; | ||
16019 | } | ||
16020 | } | ||
16021 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0; | ||
16022 | } | ||
16023 | }; | ||
16024 | |||
16025 | module.exports = ReactNodeTypes; | ||
16026 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16027 | |||
16028 | /***/ }), | ||
16029 | /* 127 */ | ||
16030 | /***/ (function(module, exports, __webpack_require__) { | ||
16031 | |||
16032 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16033 | * Copyright 2013-present, Facebook, Inc. | ||
16034 | * All rights reserved. | ||
16035 | * | ||
16036 | * This source code is licensed under the BSD-style license found in the | ||
16037 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16038 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16039 | * | ||
16040 | */ | ||
16041 | |||
16042 | 'use strict'; | ||
16043 | |||
16044 | var _prodInvariant = __webpack_require__(41); | ||
16045 | |||
16046 | var ReactPropTypeLocationNames = __webpack_require__(128); | ||
16047 | var ReactPropTypesSecret = __webpack_require__(116); | ||
16048 | |||
16049 | var invariant = __webpack_require__(10); | ||
16050 | var warning = __webpack_require__(13); | ||
16051 | |||
16052 | var ReactComponentTreeHook; | ||
16053 | |||
16054 | if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { | ||
16055 | // Temporary hack. | ||
16056 | // Inline requires don't work well with Jest: | ||
16057 | // https://github.com/facebook/react/issues/7240 | ||
16058 | // Remove the inline requires when we don't need them anymore: | ||
16059 | // https://github.com/facebook/react/pull/7178 | ||
16060 | ReactComponentTreeHook = __webpack_require__(28); | ||
16061 | } | ||
16062 | |||
16063 | var loggedTypeFailures = {}; | ||
16064 | |||
16065 | /** | ||
16066 | * Assert that the values match with the type specs. | ||
16067 | * Error messages are memorized and will only be shown once. | ||
16068 | * | ||
16069 | * @param {object} typeSpecs Map of name to a ReactPropType | ||
16070 | * @param {object} values Runtime values that need to be type-checked | ||
16071 | * @param {string} location e.g. "prop", "context", "child context" | ||
16072 | * @param {string} componentName Name of the component for error messages. | ||
16073 | * @param {?object} element The React element that is being type-checked | ||
16074 | * @param {?number} debugID The React component instance that is being type-checked | ||
16075 | * @private | ||
16076 | */ | ||
16077 | function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) { | ||
16078 | for (var typeSpecName in typeSpecs) { | ||
16079 | if (typeSpecs.hasOwnProperty(typeSpecName)) { | ||
16080 | var error; | ||
16081 | // Prop type validation may throw. In case they do, we don't want to | ||
16082 | // fail the render phase where it didn't fail before. So we log it. | ||
16083 | // After these have been cleaned up, we'll let them throw. | ||
16084 | try { | ||
16085 | // This is intentionally an invariant that gets caught. It's the same | ||
16086 | // behavior as without this statement except with a better message. | ||
16087 | !(typeof typeSpecs[typeSpecName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0; | ||
16088 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); | ||
16089 | } catch (ex) { | ||
16090 | error = ex; | ||
16091 | } | ||
16092 | process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName, typeof error) : void 0; | ||
16093 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
16094 | // Only monitor this failure once because there tends to be a lot of the | ||
16095 | // same error. | ||
16096 | loggedTypeFailures[error.message] = true; | ||
16097 | |||
16098 | var componentStackInfo = ''; | ||
16099 | |||
16100 | if (process.env.NODE_ENV !== 'production') { | ||
16101 | if (!ReactComponentTreeHook) { | ||
16102 | ReactComponentTreeHook = __webpack_require__(28); | ||
16103 | } | ||
16104 | if (debugID !== null) { | ||
16105 | componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID); | ||
16106 | } else if (element !== null) { | ||
16107 | componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element); | ||
16108 | } | ||
16109 | } | ||
16110 | |||
16111 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0; | ||
16112 | } | ||
16113 | } | ||
16114 | } | ||
16115 | } | ||
16116 | |||
16117 | module.exports = checkReactTypeSpec; | ||
16118 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16119 | |||
16120 | /***/ }), | ||
16121 | /* 128 */ | ||
16122 | 25, | ||
16123 | /* 129 */ | ||
16124 | /***/ (function(module, exports) { | ||
16125 | |||
16126 | /** | ||
16127 | * Copyright (c) 2013-present, Facebook, Inc. | ||
16128 | * All rights reserved. | ||
16129 | * | ||
16130 | * This source code is licensed under the BSD-style license found in the | ||
16131 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16132 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16133 | * | ||
16134 | * @typechecks | ||
16135 | * | ||
16136 | */ | ||
16137 | |||
16138 | /*eslint-disable no-self-compare */ | ||
16139 | |||
16140 | 'use strict'; | ||
16141 | |||
16142 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
16143 | |||
16144 | /** | ||
16145 | * inlined Object.is polyfill to avoid requiring consumers ship their own | ||
16146 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | ||
16147 | */ | ||
16148 | function is(x, y) { | ||
16149 | // SameValue algorithm | ||
16150 | if (x === y) { | ||
16151 | // Steps 1-5, 7-10 | ||
16152 | // Steps 6.b-6.e: +0 != -0 | ||
16153 | // Added the nonzero y check to make Flow happy, but it is redundant | ||
16154 | return x !== 0 || y !== 0 || 1 / x === 1 / y; | ||
16155 | } else { | ||
16156 | // Step 6.a: NaN == NaN | ||
16157 | return x !== x && y !== y; | ||
16158 | } | ||
16159 | } | ||
16160 | |||
16161 | /** | ||
16162 | * Performs equality by iterating through keys on an object and returning false | ||
16163 | * when any key has values which are not strictly equal between the arguments. | ||
16164 | * Returns true when the values of all keys are strictly equal. | ||
16165 | */ | ||
16166 | function shallowEqual(objA, objB) { | ||
16167 | if (is(objA, objB)) { | ||
16168 | return true; | ||
16169 | } | ||
16170 | |||
16171 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { | ||
16172 | return false; | ||
16173 | } | ||
16174 | |||
16175 | var keysA = Object.keys(objA); | ||
16176 | var keysB = Object.keys(objB); | ||
16177 | |||
16178 | if (keysA.length !== keysB.length) { | ||
16179 | return false; | ||
16180 | } | ||
16181 | |||
16182 | // Test for A's keys different from B. | ||
16183 | for (var i = 0; i < keysA.length; i++) { | ||
16184 | if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { | ||
16185 | return false; | ||
16186 | } | ||
16187 | } | ||
16188 | |||
16189 | return true; | ||
16190 | } | ||
16191 | |||
16192 | module.exports = shallowEqual; | ||
16193 | |||
16194 | /***/ }), | ||
16195 | /* 130 */ | ||
16196 | /***/ (function(module, exports) { | ||
16197 | |||
16198 | /** | ||
16199 | * Copyright 2013-present, Facebook, Inc. | ||
16200 | * All rights reserved. | ||
16201 | * | ||
16202 | * This source code is licensed under the BSD-style license found in the | ||
16203 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16204 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16205 | * | ||
16206 | */ | ||
16207 | |||
16208 | 'use strict'; | ||
16209 | |||
16210 | /** | ||
16211 | * Given a `prevElement` and `nextElement`, determines if the existing | ||
16212 | * instance should be updated as opposed to being destroyed or replaced by a new | ||
16213 | * instance. Both arguments are elements. This ensures that this logic can | ||
16214 | * operate on stateless trees without any backing instance. | ||
16215 | * | ||
16216 | * @param {?object} prevElement | ||
16217 | * @param {?object} nextElement | ||
16218 | * @return {boolean} True if the existing instance should be updated. | ||
16219 | * @protected | ||
16220 | */ | ||
16221 | |||
16222 | function shouldUpdateReactComponent(prevElement, nextElement) { | ||
16223 | var prevEmpty = prevElement === null || prevElement === false; | ||
16224 | var nextEmpty = nextElement === null || nextElement === false; | ||
16225 | if (prevEmpty || nextEmpty) { | ||
16226 | return prevEmpty === nextEmpty; | ||
16227 | } | ||
16228 | |||
16229 | var prevType = typeof prevElement; | ||
16230 | var nextType = typeof nextElement; | ||
16231 | if (prevType === 'string' || prevType === 'number') { | ||
16232 | return nextType === 'string' || nextType === 'number'; | ||
16233 | } else { | ||
16234 | return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key; | ||
16235 | } | ||
16236 | } | ||
16237 | |||
16238 | module.exports = shouldUpdateReactComponent; | ||
16239 | |||
16240 | /***/ }), | ||
16241 | /* 131 */ | ||
16242 | /***/ (function(module, exports) { | ||
16243 | |||
16244 | /** | ||
16245 | * Copyright 2014-present, Facebook, Inc. | ||
16246 | * All rights reserved. | ||
16247 | * | ||
16248 | * This source code is licensed under the BSD-style license found in the | ||
16249 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16250 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16251 | * | ||
16252 | */ | ||
16253 | |||
16254 | 'use strict'; | ||
16255 | |||
16256 | var emptyComponentFactory; | ||
16257 | |||
16258 | var ReactEmptyComponentInjection = { | ||
16259 | injectEmptyComponentFactory: function (factory) { | ||
16260 | emptyComponentFactory = factory; | ||
16261 | } | ||
16262 | }; | ||
16263 | |||
16264 | var ReactEmptyComponent = { | ||
16265 | create: function (instantiate) { | ||
16266 | return emptyComponentFactory(instantiate); | ||
16267 | } | ||
16268 | }; | ||
16269 | |||
16270 | ReactEmptyComponent.injection = ReactEmptyComponentInjection; | ||
16271 | |||
16272 | module.exports = ReactEmptyComponent; | ||
16273 | |||
16274 | /***/ }), | ||
16275 | /* 132 */ | ||
16276 | /***/ (function(module, exports, __webpack_require__) { | ||
16277 | |||
16278 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16279 | * Copyright 2014-present, Facebook, Inc. | ||
16280 | * All rights reserved. | ||
16281 | * | ||
16282 | * This source code is licensed under the BSD-style license found in the | ||
16283 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16284 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16285 | * | ||
16286 | */ | ||
16287 | |||
16288 | 'use strict'; | ||
16289 | |||
16290 | var _prodInvariant = __webpack_require__(41); | ||
16291 | |||
16292 | var invariant = __webpack_require__(10); | ||
16293 | |||
16294 | var genericComponentClass = null; | ||
16295 | var textComponentClass = null; | ||
16296 | |||
16297 | var ReactHostComponentInjection = { | ||
16298 | // This accepts a class that receives the tag string. This is a catch all | ||
16299 | // that can render any kind of tag. | ||
16300 | injectGenericComponentClass: function (componentClass) { | ||
16301 | genericComponentClass = componentClass; | ||
16302 | }, | ||
16303 | // This accepts a text component class that takes the text string to be | ||
16304 | // rendered as props. | ||
16305 | injectTextComponentClass: function (componentClass) { | ||
16306 | textComponentClass = componentClass; | ||
16307 | } | ||
16308 | }; | ||
16309 | |||
16310 | /** | ||
16311 | * Get a host internal component class for a specific tag. | ||
16312 | * | ||
16313 | * @param {ReactElement} element The element to create. | ||
16314 | * @return {function} The internal class constructor function. | ||
16315 | */ | ||
16316 | function createInternalComponent(element) { | ||
16317 | !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0; | ||
16318 | return new genericComponentClass(element); | ||
16319 | } | ||
16320 | |||
16321 | /** | ||
16322 | * @param {ReactText} text | ||
16323 | * @return {ReactComponent} | ||
16324 | */ | ||
16325 | function createInstanceForText(text) { | ||
16326 | return new textComponentClass(text); | ||
16327 | } | ||
16328 | |||
16329 | /** | ||
16330 | * @param {ReactComponent} component | ||
16331 | * @return {boolean} | ||
16332 | */ | ||
16333 | function isTextComponent(component) { | ||
16334 | return component instanceof textComponentClass; | ||
16335 | } | ||
16336 | |||
16337 | var ReactHostComponent = { | ||
16338 | createInternalComponent: createInternalComponent, | ||
16339 | createInstanceForText: createInstanceForText, | ||
16340 | isTextComponent: isTextComponent, | ||
16341 | injection: ReactHostComponentInjection | ||
16342 | }; | ||
16343 | |||
16344 | module.exports = ReactHostComponent; | ||
16345 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16346 | |||
16347 | /***/ }), | ||
16348 | /* 133 */ | ||
16349 | /***/ (function(module, exports) { | ||
16350 | |||
16351 | /** | ||
16352 | * Copyright 2013-present, Facebook, Inc. | ||
16353 | * All rights reserved. | ||
16354 | * | ||
16355 | * This source code is licensed under the BSD-style license found in the | ||
16356 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16357 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16358 | * | ||
16359 | * | ||
16360 | */ | ||
16361 | |||
16362 | 'use strict'; | ||
16363 | |||
16364 | var nextDebugID = 1; | ||
16365 | |||
16366 | function getNextDebugID() { | ||
16367 | return nextDebugID++; | ||
16368 | } | ||
16369 | |||
16370 | module.exports = getNextDebugID; | ||
16371 | |||
16372 | /***/ }), | ||
16373 | /* 134 */ | ||
16374 | 19, | ||
16375 | /* 135 */ | ||
16376 | /***/ (function(module, exports, __webpack_require__) { | ||
16377 | |||
16378 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16379 | * Copyright 2013-present, Facebook, Inc. | ||
16380 | * All rights reserved. | ||
16381 | * | ||
16382 | * This source code is licensed under the BSD-style license found in the | ||
16383 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16384 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16385 | * | ||
16386 | */ | ||
16387 | |||
16388 | 'use strict'; | ||
16389 | |||
16390 | var _prodInvariant = __webpack_require__(41); | ||
16391 | |||
16392 | var ReactCurrentOwner = __webpack_require__(12); | ||
16393 | var REACT_ELEMENT_TYPE = __webpack_require__(136); | ||
16394 | |||
16395 | var getIteratorFn = __webpack_require__(137); | ||
16396 | var invariant = __webpack_require__(10); | ||
16397 | var KeyEscapeUtils = __webpack_require__(134); | ||
16398 | var warning = __webpack_require__(13); | ||
16399 | |||
16400 | var SEPARATOR = '.'; | ||
16401 | var SUBSEPARATOR = ':'; | ||
16402 | |||
16403 | /** | ||
16404 | * This is inlined from ReactElement since this file is shared between | ||
16405 | * isomorphic and renderers. We could extract this to a | ||
16406 | * | ||
16407 | */ | ||
16408 | |||
16409 | /** | ||
16410 | * TODO: Test that a single child and an array with one item have the same key | ||
16411 | * pattern. | ||
16412 | */ | ||
16413 | |||
16414 | var didWarnAboutMaps = false; | ||
16415 | |||
16416 | /** | ||
16417 | * Generate a key string that identifies a component within a set. | ||
16418 | * | ||
16419 | * @param {*} component A component that could contain a manual key. | ||
16420 | * @param {number} index Index that is used if a manual key is not provided. | ||
16421 | * @return {string} | ||
16422 | */ | ||
16423 | function getComponentKey(component, index) { | ||
16424 | // Do some typechecking here since we call this blindly. We want to ensure | ||
16425 | // that we don't block potential future ES APIs. | ||
16426 | if (component && typeof component === 'object' && component.key != null) { | ||
16427 | // Explicit key | ||
16428 | return KeyEscapeUtils.escape(component.key); | ||
16429 | } | ||
16430 | // Implicit key determined by the index in the set | ||
16431 | return index.toString(36); | ||
16432 | } | ||
16433 | |||
16434 | /** | ||
16435 | * @param {?*} children Children tree container. | ||
16436 | * @param {!string} nameSoFar Name of the key path so far. | ||
16437 | * @param {!function} callback Callback to invoke with each child found. | ||
16438 | * @param {?*} traverseContext Used to pass information throughout the traversal | ||
16439 | * process. | ||
16440 | * @return {!number} The number of children in this subtree. | ||
16441 | */ | ||
16442 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { | ||
16443 | var type = typeof children; | ||
16444 | |||
16445 | if (type === 'undefined' || type === 'boolean') { | ||
16446 | // All of the above are perceived as null. | ||
16447 | children = null; | ||
16448 | } | ||
16449 | |||
16450 | if (children === null || type === 'string' || type === 'number' || | ||
16451 | // The following is inlined from ReactElement. This means we can optimize | ||
16452 | // some checks. React Fiber also inlines this logic for similar purposes. | ||
16453 | type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { | ||
16454 | callback(traverseContext, children, | ||
16455 | // If it's the only child, treat the name as if it was wrapped in an array | ||
16456 | // so that it's consistent if the number of children grows. | ||
16457 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); | ||
16458 | return 1; | ||
16459 | } | ||
16460 | |||
16461 | var child; | ||
16462 | var nextName; | ||
16463 | var subtreeCount = 0; // Count of children found in the current subtree. | ||
16464 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; | ||
16465 | |||
16466 | if (Array.isArray(children)) { | ||
16467 | for (var i = 0; i < children.length; i++) { | ||
16468 | child = children[i]; | ||
16469 | nextName = nextNamePrefix + getComponentKey(child, i); | ||
16470 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
16471 | } | ||
16472 | } else { | ||
16473 | var iteratorFn = getIteratorFn(children); | ||
16474 | if (iteratorFn) { | ||
16475 | var iterator = iteratorFn.call(children); | ||
16476 | var step; | ||
16477 | if (iteratorFn !== children.entries) { | ||
16478 | var ii = 0; | ||
16479 | while (!(step = iterator.next()).done) { | ||
16480 | child = step.value; | ||
16481 | nextName = nextNamePrefix + getComponentKey(child, ii++); | ||
16482 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
16483 | } | ||
16484 | } else { | ||
16485 | if (process.env.NODE_ENV !== 'production') { | ||
16486 | var mapsAsChildrenAddendum = ''; | ||
16487 | if (ReactCurrentOwner.current) { | ||
16488 | var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); | ||
16489 | if (mapsAsChildrenOwnerName) { | ||
16490 | mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; | ||
16491 | } | ||
16492 | } | ||
16493 | process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0; | ||
16494 | didWarnAboutMaps = true; | ||
16495 | } | ||
16496 | // Iterator will provide entry [k,v] tuples rather than values. | ||
16497 | while (!(step = iterator.next()).done) { | ||
16498 | var entry = step.value; | ||
16499 | if (entry) { | ||
16500 | child = entry[1]; | ||
16501 | nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); | ||
16502 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
16503 | } | ||
16504 | } | ||
16505 | } | ||
16506 | } else if (type === 'object') { | ||
16507 | var addendum = ''; | ||
16508 | if (process.env.NODE_ENV !== 'production') { | ||
16509 | addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.'; | ||
16510 | if (children._isReactElement) { | ||
16511 | addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.'; | ||
16512 | } | ||
16513 | if (ReactCurrentOwner.current) { | ||
16514 | var name = ReactCurrentOwner.current.getName(); | ||
16515 | if (name) { | ||
16516 | addendum += ' Check the render method of `' + name + '`.'; | ||
16517 | } | ||
16518 | } | ||
16519 | } | ||
16520 | var childrenString = String(children); | ||
16521 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0; | ||
16522 | } | ||
16523 | } | ||
16524 | |||
16525 | return subtreeCount; | ||
16526 | } | ||
16527 | |||
16528 | /** | ||
16529 | * Traverses children that are typically specified as `props.children`, but | ||
16530 | * might also be specified through attributes: | ||
16531 | * | ||
16532 | * - `traverseAllChildren(this.props.children, ...)` | ||
16533 | * - `traverseAllChildren(this.props.leftPanelChildren, ...)` | ||
16534 | * | ||
16535 | * The `traverseContext` is an optional argument that is passed through the | ||
16536 | * entire traversal. It can be used to store accumulations or anything else that | ||
16537 | * the callback might find relevant. | ||
16538 | * | ||
16539 | * @param {?*} children Children tree object. | ||
16540 | * @param {!function} callback To invoke upon traversing each child. | ||
16541 | * @param {?*} traverseContext Context for traversal. | ||
16542 | * @return {!number} The number of children in this subtree. | ||
16543 | */ | ||
16544 | function traverseAllChildren(children, callback, traverseContext) { | ||
16545 | if (children == null) { | ||
16546 | return 0; | ||
16547 | } | ||
16548 | |||
16549 | return traverseAllChildrenImpl(children, '', callback, traverseContext); | ||
16550 | } | ||
16551 | |||
16552 | module.exports = traverseAllChildren; | ||
16553 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16554 | |||
16555 | /***/ }), | ||
16556 | /* 136 */ | ||
16557 | 16, | ||
16558 | /* 137 */ | ||
16559 | 18, | ||
16560 | /* 138 */ | ||
16561 | /***/ (function(module, exports, __webpack_require__) { | ||
16562 | |||
16563 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16564 | * Copyright 2013-present, Facebook, Inc. | ||
16565 | * All rights reserved. | ||
16566 | * | ||
16567 | * This source code is licensed under the BSD-style license found in the | ||
16568 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16569 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16570 | * | ||
16571 | * | ||
16572 | */ | ||
16573 | |||
16574 | 'use strict'; | ||
16575 | |||
16576 | var KeyEscapeUtils = __webpack_require__(134); | ||
16577 | var traverseAllChildren = __webpack_require__(135); | ||
16578 | var warning = __webpack_require__(13); | ||
16579 | |||
16580 | var ReactComponentTreeHook; | ||
16581 | |||
16582 | if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { | ||
16583 | // Temporary hack. | ||
16584 | // Inline requires don't work well with Jest: | ||
16585 | // https://github.com/facebook/react/issues/7240 | ||
16586 | // Remove the inline requires when we don't need them anymore: | ||
16587 | // https://github.com/facebook/react/pull/7178 | ||
16588 | ReactComponentTreeHook = __webpack_require__(28); | ||
16589 | } | ||
16590 | |||
16591 | /** | ||
16592 | * @param {function} traverseContext Context passed through traversal. | ||
16593 | * @param {?ReactComponent} child React child component. | ||
16594 | * @param {!string} name String name of key path to child. | ||
16595 | * @param {number=} selfDebugID Optional debugID of the current internal instance. | ||
16596 | */ | ||
16597 | function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) { | ||
16598 | // We found a component instance. | ||
16599 | if (traverseContext && typeof traverseContext === 'object') { | ||
16600 | var result = traverseContext; | ||
16601 | var keyUnique = result[name] === undefined; | ||
16602 | if (process.env.NODE_ENV !== 'production') { | ||
16603 | if (!ReactComponentTreeHook) { | ||
16604 | ReactComponentTreeHook = __webpack_require__(28); | ||
16605 | } | ||
16606 | if (!keyUnique) { | ||
16607 | process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0; | ||
16608 | } | ||
16609 | } | ||
16610 | if (keyUnique && child != null) { | ||
16611 | result[name] = child; | ||
16612 | } | ||
16613 | } | ||
16614 | } | ||
16615 | |||
16616 | /** | ||
16617 | * Flattens children that are typically specified as `props.children`. Any null | ||
16618 | * children will not be included in the resulting object. | ||
16619 | * @return {!object} flattened children keyed by name. | ||
16620 | */ | ||
16621 | function flattenChildren(children, selfDebugID) { | ||
16622 | if (children == null) { | ||
16623 | return children; | ||
16624 | } | ||
16625 | var result = {}; | ||
16626 | |||
16627 | if (process.env.NODE_ENV !== 'production') { | ||
16628 | traverseAllChildren(children, function (traverseContext, child, name) { | ||
16629 | return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID); | ||
16630 | }, result); | ||
16631 | } else { | ||
16632 | traverseAllChildren(children, flattenSingleChildIntoContext, result); | ||
16633 | } | ||
16634 | return result; | ||
16635 | } | ||
16636 | |||
16637 | module.exports = flattenChildren; | ||
16638 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16639 | |||
16640 | /***/ }), | ||
16641 | /* 139 */ | ||
16642 | /***/ (function(module, exports, __webpack_require__) { | ||
16643 | |||
16644 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16645 | * Copyright 2014-present, Facebook, Inc. | ||
16646 | * All rights reserved. | ||
16647 | * | ||
16648 | * This source code is licensed under the BSD-style license found in the | ||
16649 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16650 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16651 | * | ||
16652 | */ | ||
16653 | |||
16654 | 'use strict'; | ||
16655 | |||
16656 | var _assign = __webpack_require__(6); | ||
16657 | |||
16658 | var PooledClass = __webpack_require__(56); | ||
16659 | var Transaction = __webpack_require__(74); | ||
16660 | var ReactInstrumentation = __webpack_require__(68); | ||
16661 | var ReactServerUpdateQueue = __webpack_require__(140); | ||
16662 | |||
16663 | /** | ||
16664 | * Executed within the scope of the `Transaction` instance. Consider these as | ||
16665 | * being member methods, but with an implied ordering while being isolated from | ||
16666 | * each other. | ||
16667 | */ | ||
16668 | var TRANSACTION_WRAPPERS = []; | ||
16669 | |||
16670 | if (process.env.NODE_ENV !== 'production') { | ||
16671 | TRANSACTION_WRAPPERS.push({ | ||
16672 | initialize: ReactInstrumentation.debugTool.onBeginFlush, | ||
16673 | close: ReactInstrumentation.debugTool.onEndFlush | ||
16674 | }); | ||
16675 | } | ||
16676 | |||
16677 | var noopCallbackQueue = { | ||
16678 | enqueue: function () {} | ||
16679 | }; | ||
16680 | |||
16681 | /** | ||
16682 | * @class ReactServerRenderingTransaction | ||
16683 | * @param {boolean} renderToStaticMarkup | ||
16684 | */ | ||
16685 | function ReactServerRenderingTransaction(renderToStaticMarkup) { | ||
16686 | this.reinitializeTransaction(); | ||
16687 | this.renderToStaticMarkup = renderToStaticMarkup; | ||
16688 | this.useCreateElement = false; | ||
16689 | this.updateQueue = new ReactServerUpdateQueue(this); | ||
16690 | } | ||
16691 | |||
16692 | var Mixin = { | ||
16693 | /** | ||
16694 | * @see Transaction | ||
16695 | * @abstract | ||
16696 | * @final | ||
16697 | * @return {array} Empty list of operation wrap procedures. | ||
16698 | */ | ||
16699 | getTransactionWrappers: function () { | ||
16700 | return TRANSACTION_WRAPPERS; | ||
16701 | }, | ||
16702 | |||
16703 | /** | ||
16704 | * @return {object} The queue to collect `onDOMReady` callbacks with. | ||
16705 | */ | ||
16706 | getReactMountReady: function () { | ||
16707 | return noopCallbackQueue; | ||
16708 | }, | ||
16709 | |||
16710 | /** | ||
16711 | * @return {object} The queue to collect React async events. | ||
16712 | */ | ||
16713 | getUpdateQueue: function () { | ||
16714 | return this.updateQueue; | ||
16715 | }, | ||
16716 | |||
16717 | /** | ||
16718 | * `PooledClass` looks for this, and will invoke this before allowing this | ||
16719 | * instance to be reused. | ||
16720 | */ | ||
16721 | destructor: function () {}, | ||
16722 | |||
16723 | checkpoint: function () {}, | ||
16724 | |||
16725 | rollback: function () {} | ||
16726 | }; | ||
16727 | |||
16728 | _assign(ReactServerRenderingTransaction.prototype, Transaction, Mixin); | ||
16729 | |||
16730 | PooledClass.addPoolingTo(ReactServerRenderingTransaction); | ||
16731 | |||
16732 | module.exports = ReactServerRenderingTransaction; | ||
16733 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16734 | |||
16735 | /***/ }), | ||
16736 | /* 140 */ | ||
16737 | /***/ (function(module, exports, __webpack_require__) { | ||
16738 | |||
16739 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16740 | * Copyright 2015-present, Facebook, Inc. | ||
16741 | * All rights reserved. | ||
16742 | * | ||
16743 | * This source code is licensed under the BSD-style license found in the | ||
16744 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16745 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16746 | * | ||
16747 | * | ||
16748 | */ | ||
16749 | |||
16750 | 'use strict'; | ||
16751 | |||
16752 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
16753 | |||
16754 | var ReactUpdateQueue = __webpack_require__(141); | ||
16755 | |||
16756 | var warning = __webpack_require__(13); | ||
16757 | |||
16758 | function warnNoop(publicInstance, callerName) { | ||
16759 | if (process.env.NODE_ENV !== 'production') { | ||
16760 | var constructor = publicInstance.constructor; | ||
16761 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0; | ||
16762 | } | ||
16763 | } | ||
16764 | |||
16765 | /** | ||
16766 | * This is the update queue used for server rendering. | ||
16767 | * It delegates to ReactUpdateQueue while server rendering is in progress and | ||
16768 | * switches to ReactNoopUpdateQueue after the transaction has completed. | ||
16769 | * @class ReactServerUpdateQueue | ||
16770 | * @param {Transaction} transaction | ||
16771 | */ | ||
16772 | |||
16773 | var ReactServerUpdateQueue = function () { | ||
16774 | function ReactServerUpdateQueue(transaction) { | ||
16775 | _classCallCheck(this, ReactServerUpdateQueue); | ||
16776 | |||
16777 | this.transaction = transaction; | ||
16778 | } | ||
16779 | |||
16780 | /** | ||
16781 | * Checks whether or not this composite component is mounted. | ||
16782 | * @param {ReactClass} publicInstance The instance we want to test. | ||
16783 | * @return {boolean} True if mounted, false otherwise. | ||
16784 | * @protected | ||
16785 | * @final | ||
16786 | */ | ||
16787 | |||
16788 | |||
16789 | ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) { | ||
16790 | return false; | ||
16791 | }; | ||
16792 | |||
16793 | /** | ||
16794 | * Enqueue a callback that will be executed after all the pending updates | ||
16795 | * have processed. | ||
16796 | * | ||
16797 | * @param {ReactClass} publicInstance The instance to use as `this` context. | ||
16798 | * @param {?function} callback Called after state is updated. | ||
16799 | * @internal | ||
16800 | */ | ||
16801 | |||
16802 | |||
16803 | ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) { | ||
16804 | if (this.transaction.isInTransaction()) { | ||
16805 | ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName); | ||
16806 | } | ||
16807 | }; | ||
16808 | |||
16809 | /** | ||
16810 | * Forces an update. This should only be invoked when it is known with | ||
16811 | * certainty that we are **not** in a DOM transaction. | ||
16812 | * | ||
16813 | * You may want to call this when you know that some deeper aspect of the | ||
16814 | * component's state has changed but `setState` was not called. | ||
16815 | * | ||
16816 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
16817 | * `componentWillUpdate` and `componentDidUpdate`. | ||
16818 | * | ||
16819 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
16820 | * @internal | ||
16821 | */ | ||
16822 | |||
16823 | |||
16824 | ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) { | ||
16825 | if (this.transaction.isInTransaction()) { | ||
16826 | ReactUpdateQueue.enqueueForceUpdate(publicInstance); | ||
16827 | } else { | ||
16828 | warnNoop(publicInstance, 'forceUpdate'); | ||
16829 | } | ||
16830 | }; | ||
16831 | |||
16832 | /** | ||
16833 | * Replaces all of the state. Always use this or `setState` to mutate state. | ||
16834 | * You should treat `this.state` as immutable. | ||
16835 | * | ||
16836 | * There is no guarantee that `this.state` will be immediately updated, so | ||
16837 | * accessing `this.state` after calling this method may return the old value. | ||
16838 | * | ||
16839 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
16840 | * @param {object|function} completeState Next state. | ||
16841 | * @internal | ||
16842 | */ | ||
16843 | |||
16844 | |||
16845 | ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) { | ||
16846 | if (this.transaction.isInTransaction()) { | ||
16847 | ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState); | ||
16848 | } else { | ||
16849 | warnNoop(publicInstance, 'replaceState'); | ||
16850 | } | ||
16851 | }; | ||
16852 | |||
16853 | /** | ||
16854 | * Sets a subset of the state. This only exists because _pendingState is | ||
16855 | * internal. This provides a merging strategy that is not available to deep | ||
16856 | * properties which is confusing. TODO: Expose pendingState or don't use it | ||
16857 | * during the merge. | ||
16858 | * | ||
16859 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
16860 | * @param {object|function} partialState Next partial state to be merged with state. | ||
16861 | * @internal | ||
16862 | */ | ||
16863 | |||
16864 | |||
16865 | ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) { | ||
16866 | if (this.transaction.isInTransaction()) { | ||
16867 | ReactUpdateQueue.enqueueSetState(publicInstance, partialState); | ||
16868 | } else { | ||
16869 | warnNoop(publicInstance, 'setState'); | ||
16870 | } | ||
16871 | }; | ||
16872 | |||
16873 | return ReactServerUpdateQueue; | ||
16874 | }(); | ||
16875 | |||
16876 | module.exports = ReactServerUpdateQueue; | ||
16877 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16878 | |||
16879 | /***/ }), | ||
16880 | /* 141 */ | ||
16881 | /***/ (function(module, exports, __webpack_require__) { | ||
16882 | |||
16883 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16884 | * Copyright 2015-present, Facebook, Inc. | ||
16885 | * All rights reserved. | ||
16886 | * | ||
16887 | * This source code is licensed under the BSD-style license found in the | ||
16888 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16889 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16890 | * | ||
16891 | */ | ||
16892 | |||
16893 | 'use strict'; | ||
16894 | |||
16895 | var _prodInvariant = __webpack_require__(41); | ||
16896 | |||
16897 | var ReactCurrentOwner = __webpack_require__(12); | ||
16898 | var ReactInstanceMap = __webpack_require__(122); | ||
16899 | var ReactInstrumentation = __webpack_require__(68); | ||
16900 | var ReactUpdates = __webpack_require__(62); | ||
16901 | |||
16902 | var invariant = __webpack_require__(10); | ||
16903 | var warning = __webpack_require__(13); | ||
16904 | |||
16905 | function enqueueUpdate(internalInstance) { | ||
16906 | ReactUpdates.enqueueUpdate(internalInstance); | ||
16907 | } | ||
16908 | |||
16909 | function formatUnexpectedArgument(arg) { | ||
16910 | var type = typeof arg; | ||
16911 | if (type !== 'object') { | ||
16912 | return type; | ||
16913 | } | ||
16914 | var displayName = arg.constructor && arg.constructor.name || type; | ||
16915 | var keys = Object.keys(arg); | ||
16916 | if (keys.length > 0 && keys.length < 20) { | ||
16917 | return displayName + ' (keys: ' + keys.join(', ') + ')'; | ||
16918 | } | ||
16919 | return displayName; | ||
16920 | } | ||
16921 | |||
16922 | function getInternalInstanceReadyForUpdate(publicInstance, callerName) { | ||
16923 | var internalInstance = ReactInstanceMap.get(publicInstance); | ||
16924 | if (!internalInstance) { | ||
16925 | if (process.env.NODE_ENV !== 'production') { | ||
16926 | var ctor = publicInstance.constructor; | ||
16927 | // Only warn when we have a callerName. Otherwise we should be silent. | ||
16928 | // We're probably calling from enqueueCallback. We don't want to warn | ||
16929 | // there because we already warned for the corresponding lifecycle method. | ||
16930 | process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0; | ||
16931 | } | ||
16932 | return null; | ||
16933 | } | ||
16934 | |||
16935 | if (process.env.NODE_ENV !== 'production') { | ||
16936 | process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + 'within `render` or another component\'s constructor). Render methods ' + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0; | ||
16937 | } | ||
16938 | |||
16939 | return internalInstance; | ||
16940 | } | ||
16941 | |||
16942 | /** | ||
16943 | * ReactUpdateQueue allows for state updates to be scheduled into a later | ||
16944 | * reconciliation step. | ||
16945 | */ | ||
16946 | var ReactUpdateQueue = { | ||
16947 | |||
16948 | /** | ||
16949 | * Checks whether or not this composite component is mounted. | ||
16950 | * @param {ReactClass} publicInstance The instance we want to test. | ||
16951 | * @return {boolean} True if mounted, false otherwise. | ||
16952 | * @protected | ||
16953 | * @final | ||
16954 | */ | ||
16955 | isMounted: function (publicInstance) { | ||
16956 | if (process.env.NODE_ENV !== 'production') { | ||
16957 | var owner = ReactCurrentOwner.current; | ||
16958 | if (owner !== null) { | ||
16959 | process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0; | ||
16960 | owner._warnedAboutRefsInRender = true; | ||
16961 | } | ||
16962 | } | ||
16963 | var internalInstance = ReactInstanceMap.get(publicInstance); | ||
16964 | if (internalInstance) { | ||
16965 | // During componentWillMount and render this will still be null but after | ||
16966 | // that will always render to something. At least for now. So we can use | ||
16967 | // this hack. | ||
16968 | return !!internalInstance._renderedComponent; | ||
16969 | } else { | ||
16970 | return false; | ||
16971 | } | ||
16972 | }, | ||
16973 | |||
16974 | /** | ||
16975 | * Enqueue a callback that will be executed after all the pending updates | ||
16976 | * have processed. | ||
16977 | * | ||
16978 | * @param {ReactClass} publicInstance The instance to use as `this` context. | ||
16979 | * @param {?function} callback Called after state is updated. | ||
16980 | * @param {string} callerName Name of the calling function in the public API. | ||
16981 | * @internal | ||
16982 | */ | ||
16983 | enqueueCallback: function (publicInstance, callback, callerName) { | ||
16984 | ReactUpdateQueue.validateCallback(callback, callerName); | ||
16985 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); | ||
16986 | |||
16987 | // Previously we would throw an error if we didn't have an internal | ||
16988 | // instance. Since we want to make it a no-op instead, we mirror the same | ||
16989 | // behavior we have in other enqueue* methods. | ||
16990 | // We also need to ignore callbacks in componentWillMount. See | ||
16991 | // enqueueUpdates. | ||
16992 | if (!internalInstance) { | ||
16993 | return null; | ||
16994 | } | ||
16995 | |||
16996 | if (internalInstance._pendingCallbacks) { | ||
16997 | internalInstance._pendingCallbacks.push(callback); | ||
16998 | } else { | ||
16999 | internalInstance._pendingCallbacks = [callback]; | ||
17000 | } | ||
17001 | // TODO: The callback here is ignored when setState is called from | ||
17002 | // componentWillMount. Either fix it or disallow doing so completely in | ||
17003 | // favor of getInitialState. Alternatively, we can disallow | ||
17004 | // componentWillMount during server-side rendering. | ||
17005 | enqueueUpdate(internalInstance); | ||
17006 | }, | ||
17007 | |||
17008 | enqueueCallbackInternal: function (internalInstance, callback) { | ||
17009 | if (internalInstance._pendingCallbacks) { | ||
17010 | internalInstance._pendingCallbacks.push(callback); | ||
17011 | } else { | ||
17012 | internalInstance._pendingCallbacks = [callback]; | ||
17013 | } | ||
17014 | enqueueUpdate(internalInstance); | ||
17015 | }, | ||
17016 | |||
17017 | /** | ||
17018 | * Forces an update. This should only be invoked when it is known with | ||
17019 | * certainty that we are **not** in a DOM transaction. | ||
17020 | * | ||
17021 | * You may want to call this when you know that some deeper aspect of the | ||
17022 | * component's state has changed but `setState` was not called. | ||
17023 | * | ||
17024 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
17025 | * `componentWillUpdate` and `componentDidUpdate`. | ||
17026 | * | ||
17027 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
17028 | * @internal | ||
17029 | */ | ||
17030 | enqueueForceUpdate: function (publicInstance) { | ||
17031 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate'); | ||
17032 | |||
17033 | if (!internalInstance) { | ||
17034 | return; | ||
17035 | } | ||
17036 | |||
17037 | internalInstance._pendingForceUpdate = true; | ||
17038 | |||
17039 | enqueueUpdate(internalInstance); | ||
17040 | }, | ||
17041 | |||
17042 | /** | ||
17043 | * Replaces all of the state. Always use this or `setState` to mutate state. | ||
17044 | * You should treat `this.state` as immutable. | ||
17045 | * | ||
17046 | * There is no guarantee that `this.state` will be immediately updated, so | ||
17047 | * accessing `this.state` after calling this method may return the old value. | ||
17048 | * | ||
17049 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
17050 | * @param {object} completeState Next state. | ||
17051 | * @internal | ||
17052 | */ | ||
17053 | enqueueReplaceState: function (publicInstance, completeState, callback) { | ||
17054 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState'); | ||
17055 | |||
17056 | if (!internalInstance) { | ||
17057 | return; | ||
17058 | } | ||
17059 | |||
17060 | internalInstance._pendingStateQueue = [completeState]; | ||
17061 | internalInstance._pendingReplaceState = true; | ||
17062 | |||
17063 | // Future-proof 15.5 | ||
17064 | if (callback !== undefined && callback !== null) { | ||
17065 | ReactUpdateQueue.validateCallback(callback, 'replaceState'); | ||
17066 | if (internalInstance._pendingCallbacks) { | ||
17067 | internalInstance._pendingCallbacks.push(callback); | ||
17068 | } else { | ||
17069 | internalInstance._pendingCallbacks = [callback]; | ||
17070 | } | ||
17071 | } | ||
17072 | |||
17073 | enqueueUpdate(internalInstance); | ||
17074 | }, | ||
17075 | |||
17076 | /** | ||
17077 | * Sets a subset of the state. This only exists because _pendingState is | ||
17078 | * internal. This provides a merging strategy that is not available to deep | ||
17079 | * properties which is confusing. TODO: Expose pendingState or don't use it | ||
17080 | * during the merge. | ||
17081 | * | ||
17082 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
17083 | * @param {object} partialState Next partial state to be merged with state. | ||
17084 | * @internal | ||
17085 | */ | ||
17086 | enqueueSetState: function (publicInstance, partialState) { | ||
17087 | if (process.env.NODE_ENV !== 'production') { | ||
17088 | ReactInstrumentation.debugTool.onSetState(); | ||
17089 | process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0; | ||
17090 | } | ||
17091 | |||
17092 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState'); | ||
17093 | |||
17094 | if (!internalInstance) { | ||
17095 | return; | ||
17096 | } | ||
17097 | |||
17098 | var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []); | ||
17099 | queue.push(partialState); | ||
17100 | |||
17101 | enqueueUpdate(internalInstance); | ||
17102 | }, | ||
17103 | |||
17104 | enqueueElementInternal: function (internalInstance, nextElement, nextContext) { | ||
17105 | internalInstance._pendingElement = nextElement; | ||
17106 | // TODO: introduce _pendingContext instead of setting it directly. | ||
17107 | internalInstance._context = nextContext; | ||
17108 | enqueueUpdate(internalInstance); | ||
17109 | }, | ||
17110 | |||
17111 | validateCallback: function (callback, callerName) { | ||
17112 | !(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0; | ||
17113 | } | ||
17114 | |||
17115 | }; | ||
17116 | |||
17117 | module.exports = ReactUpdateQueue; | ||
17118 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
17119 | |||
17120 | /***/ }), | ||
17121 | /* 142 */ | ||
17122 | /***/ (function(module, exports, __webpack_require__) { | ||
17123 | |||
17124 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
17125 | * Copyright 2015-present, Facebook, Inc. | ||
17126 | * All rights reserved. | ||
17127 | * | ||
17128 | * This source code is licensed under the BSD-style license found in the | ||
17129 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17130 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17131 | * | ||
17132 | */ | ||
17133 | |||
17134 | 'use strict'; | ||
17135 | |||
17136 | var _assign = __webpack_require__(6); | ||
17137 | |||
17138 | var emptyFunction = __webpack_require__(14); | ||
17139 | var warning = __webpack_require__(13); | ||
17140 | |||
17141 | var validateDOMNesting = emptyFunction; | ||
17142 | |||
17143 | if (process.env.NODE_ENV !== 'production') { | ||
17144 | // This validation code was written based on the HTML5 parsing spec: | ||
17145 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | ||
17146 | // | ||
17147 | // Note: this does not catch all invalid nesting, nor does it try to (as it's | ||
17148 | // not clear what practical benefit doing so provides); instead, we warn only | ||
17149 | // for cases where the parser will give a parse tree differing from what React | ||
17150 | // intended. For example, <b><div></div></b> is invalid but we don't warn | ||
17151 | // because it still parses correctly; we do warn for other cases like nested | ||
17152 | // <p> tags where the beginning of the second element implicitly closes the | ||
17153 | // first, causing a confusing mess. | ||
17154 | |||
17155 | // https://html.spec.whatwg.org/multipage/syntax.html#special | ||
17156 | var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp']; | ||
17157 | |||
17158 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | ||
17159 | var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', | ||
17160 | |||
17161 | // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point | ||
17162 | // TODO: Distinguish by namespace here -- for <title>, including it here | ||
17163 | // errs on the side of fewer warnings | ||
17164 | 'foreignObject', 'desc', 'title']; | ||
17165 | |||
17166 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope | ||
17167 | var buttonScopeTags = inScopeTags.concat(['button']); | ||
17168 | |||
17169 | // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags | ||
17170 | var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; | ||
17171 | |||
17172 | var emptyAncestorInfo = { | ||
17173 | current: null, | ||
17174 | |||
17175 | formTag: null, | ||
17176 | aTagInScope: null, | ||
17177 | buttonTagInScope: null, | ||
17178 | nobrTagInScope: null, | ||
17179 | pTagInButtonScope: null, | ||
17180 | |||
17181 | listItemTagAutoclosing: null, | ||
17182 | dlItemTagAutoclosing: null | ||
17183 | }; | ||
17184 | |||
17185 | var updatedAncestorInfo = function (oldInfo, tag, instance) { | ||
17186 | var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo); | ||
17187 | var info = { tag: tag, instance: instance }; | ||
17188 | |||
17189 | if (inScopeTags.indexOf(tag) !== -1) { | ||
17190 | ancestorInfo.aTagInScope = null; | ||
17191 | ancestorInfo.buttonTagInScope = null; | ||
17192 | ancestorInfo.nobrTagInScope = null; | ||
17193 | } | ||
17194 | if (buttonScopeTags.indexOf(tag) !== -1) { | ||
17195 | ancestorInfo.pTagInButtonScope = null; | ||
17196 | } | ||
17197 | |||
17198 | // See rules for 'li', 'dd', 'dt' start tags in | ||
17199 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody | ||
17200 | if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { | ||
17201 | ancestorInfo.listItemTagAutoclosing = null; | ||
17202 | ancestorInfo.dlItemTagAutoclosing = null; | ||
17203 | } | ||
17204 | |||
17205 | ancestorInfo.current = info; | ||
17206 | |||
17207 | if (tag === 'form') { | ||
17208 | ancestorInfo.formTag = info; | ||
17209 | } | ||
17210 | if (tag === 'a') { | ||
17211 | ancestorInfo.aTagInScope = info; | ||
17212 | } | ||
17213 | if (tag === 'button') { | ||
17214 | ancestorInfo.buttonTagInScope = info; | ||
17215 | } | ||
17216 | if (tag === 'nobr') { | ||
17217 | ancestorInfo.nobrTagInScope = info; | ||
17218 | } | ||
17219 | if (tag === 'p') { | ||
17220 | ancestorInfo.pTagInButtonScope = info; | ||
17221 | } | ||
17222 | if (tag === 'li') { | ||
17223 | ancestorInfo.listItemTagAutoclosing = info; | ||
17224 | } | ||
17225 | if (tag === 'dd' || tag === 'dt') { | ||
17226 | ancestorInfo.dlItemTagAutoclosing = info; | ||
17227 | } | ||
17228 | |||
17229 | return ancestorInfo; | ||
17230 | }; | ||
17231 | |||
17232 | /** | ||
17233 | * Returns whether | ||
17234 | */ | ||
17235 | var isTagValidWithParent = function (tag, parentTag) { | ||
17236 | // First, let's check if we're in an unusual parsing mode... | ||
17237 | switch (parentTag) { | ||
17238 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect | ||
17239 | case 'select': | ||
17240 | return tag === 'option' || tag === 'optgroup' || tag === '#text'; | ||
17241 | case 'optgroup': | ||
17242 | return tag === 'option' || tag === '#text'; | ||
17243 | // Strictly speaking, seeing an <option> doesn't mean we're in a <select> | ||
17244 | // but | ||
17245 | case 'option': | ||
17246 | return tag === '#text'; | ||
17247 | |||
17248 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd | ||
17249 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption | ||
17250 | // No special behavior since these rules fall back to "in body" mode for | ||
17251 | // all except special table nodes which cause bad parsing behavior anyway. | ||
17252 | |||
17253 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr | ||
17254 | case 'tr': | ||
17255 | return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
17256 | |||
17257 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody | ||
17258 | case 'tbody': | ||
17259 | case 'thead': | ||
17260 | case 'tfoot': | ||
17261 | return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
17262 | |||
17263 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup | ||
17264 | case 'colgroup': | ||
17265 | return tag === 'col' || tag === 'template'; | ||
17266 | |||
17267 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable | ||
17268 | case 'table': | ||
17269 | return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
17270 | |||
17271 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead | ||
17272 | case 'head': | ||
17273 | return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
17274 | |||
17275 | // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element | ||
17276 | case 'html': | ||
17277 | return tag === 'head' || tag === 'body'; | ||
17278 | case '#document': | ||
17279 | return tag === 'html'; | ||
17280 | } | ||
17281 | |||
17282 | // Probably in the "in body" parsing mode, so we outlaw only tag combos | ||
17283 | // where the parsing rules cause implicit opens or closes to be added. | ||
17284 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody | ||
17285 | switch (tag) { | ||
17286 | case 'h1': | ||
17287 | case 'h2': | ||
17288 | case 'h3': | ||
17289 | case 'h4': | ||
17290 | case 'h5': | ||
17291 | case 'h6': | ||
17292 | return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; | ||
17293 | |||
17294 | case 'rp': | ||
17295 | case 'rt': | ||
17296 | return impliedEndTags.indexOf(parentTag) === -1; | ||
17297 | |||
17298 | case 'body': | ||
17299 | case 'caption': | ||
17300 | case 'col': | ||
17301 | case 'colgroup': | ||
17302 | case 'frame': | ||
17303 | case 'head': | ||
17304 | case 'html': | ||
17305 | case 'tbody': | ||
17306 | case 'td': | ||
17307 | case 'tfoot': | ||
17308 | case 'th': | ||
17309 | case 'thead': | ||
17310 | case 'tr': | ||
17311 | // These tags are only valid with a few parents that have special child | ||
17312 | // parsing rules -- if we're down here, then none of those matched and | ||
17313 | // so we allow it only if we don't know what the parent is, as all other | ||
17314 | // cases are invalid. | ||
17315 | return parentTag == null; | ||
17316 | } | ||
17317 | |||
17318 | return true; | ||
17319 | }; | ||
17320 | |||
17321 | /** | ||
17322 | * Returns whether | ||
17323 | */ | ||
17324 | var findInvalidAncestorForTag = function (tag, ancestorInfo) { | ||
17325 | switch (tag) { | ||
17326 | case 'address': | ||
17327 | case 'article': | ||
17328 | case 'aside': | ||
17329 | case 'blockquote': | ||
17330 | case 'center': | ||
17331 | case 'details': | ||
17332 | case 'dialog': | ||
17333 | case 'dir': | ||
17334 | case 'div': | ||
17335 | case 'dl': | ||
17336 | case 'fieldset': | ||
17337 | case 'figcaption': | ||
17338 | case 'figure': | ||
17339 | case 'footer': | ||
17340 | case 'header': | ||
17341 | case 'hgroup': | ||
17342 | case 'main': | ||
17343 | case 'menu': | ||
17344 | case 'nav': | ||
17345 | case 'ol': | ||
17346 | case 'p': | ||
17347 | case 'section': | ||
17348 | case 'summary': | ||
17349 | case 'ul': | ||
17350 | case 'pre': | ||
17351 | case 'listing': | ||
17352 | case 'table': | ||
17353 | case 'hr': | ||
17354 | case 'xmp': | ||
17355 | case 'h1': | ||
17356 | case 'h2': | ||
17357 | case 'h3': | ||
17358 | case 'h4': | ||
17359 | case 'h5': | ||
17360 | case 'h6': | ||
17361 | return ancestorInfo.pTagInButtonScope; | ||
17362 | |||
17363 | case 'form': | ||
17364 | return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; | ||
17365 | |||
17366 | case 'li': | ||
17367 | return ancestorInfo.listItemTagAutoclosing; | ||
17368 | |||
17369 | case 'dd': | ||
17370 | case 'dt': | ||
17371 | return ancestorInfo.dlItemTagAutoclosing; | ||
17372 | |||
17373 | case 'button': | ||
17374 | return ancestorInfo.buttonTagInScope; | ||
17375 | |||
17376 | case 'a': | ||
17377 | // Spec says something about storing a list of markers, but it sounds | ||
17378 | // equivalent to this check. | ||
17379 | return ancestorInfo.aTagInScope; | ||
17380 | |||
17381 | case 'nobr': | ||
17382 | return ancestorInfo.nobrTagInScope; | ||
17383 | } | ||
17384 | |||
17385 | return null; | ||
17386 | }; | ||
17387 | |||
17388 | /** | ||
17389 | * Given a ReactCompositeComponent instance, return a list of its recursive | ||
17390 | * owners, starting at the root and ending with the instance itself. | ||
17391 | */ | ||
17392 | var findOwnerStack = function (instance) { | ||
17393 | if (!instance) { | ||
17394 | return []; | ||
17395 | } | ||
17396 | |||
17397 | var stack = []; | ||
17398 | do { | ||
17399 | stack.push(instance); | ||
17400 | } while (instance = instance._currentElement._owner); | ||
17401 | stack.reverse(); | ||
17402 | return stack; | ||
17403 | }; | ||
17404 | |||
17405 | var didWarn = {}; | ||
17406 | |||
17407 | validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) { | ||
17408 | ancestorInfo = ancestorInfo || emptyAncestorInfo; | ||
17409 | var parentInfo = ancestorInfo.current; | ||
17410 | var parentTag = parentInfo && parentInfo.tag; | ||
17411 | |||
17412 | if (childText != null) { | ||
17413 | process.env.NODE_ENV !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0; | ||
17414 | childTag = '#text'; | ||
17415 | } | ||
17416 | |||
17417 | var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; | ||
17418 | var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); | ||
17419 | var problematic = invalidParent || invalidAncestor; | ||
17420 | |||
17421 | if (problematic) { | ||
17422 | var ancestorTag = problematic.tag; | ||
17423 | var ancestorInstance = problematic.instance; | ||
17424 | |||
17425 | var childOwner = childInstance && childInstance._currentElement._owner; | ||
17426 | var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner; | ||
17427 | |||
17428 | var childOwners = findOwnerStack(childOwner); | ||
17429 | var ancestorOwners = findOwnerStack(ancestorOwner); | ||
17430 | |||
17431 | var minStackLen = Math.min(childOwners.length, ancestorOwners.length); | ||
17432 | var i; | ||
17433 | |||
17434 | var deepestCommon = -1; | ||
17435 | for (i = 0; i < minStackLen; i++) { | ||
17436 | if (childOwners[i] === ancestorOwners[i]) { | ||
17437 | deepestCommon = i; | ||
17438 | } else { | ||
17439 | break; | ||
17440 | } | ||
17441 | } | ||
17442 | |||
17443 | var UNKNOWN = '(unknown)'; | ||
17444 | var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) { | ||
17445 | return inst.getName() || UNKNOWN; | ||
17446 | }); | ||
17447 | var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) { | ||
17448 | return inst.getName() || UNKNOWN; | ||
17449 | }); | ||
17450 | var ownerInfo = [].concat( | ||
17451 | // If the parent and child instances have a common owner ancestor, start | ||
17452 | // with that -- otherwise we just start with the parent's owners. | ||
17453 | deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag, | ||
17454 | // If we're warning about an invalid (non-parent) ancestry, add '...' | ||
17455 | invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > '); | ||
17456 | |||
17457 | var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo; | ||
17458 | if (didWarn[warnKey]) { | ||
17459 | return; | ||
17460 | } | ||
17461 | didWarn[warnKey] = true; | ||
17462 | |||
17463 | var tagDisplayName = childTag; | ||
17464 | var whitespaceInfo = ''; | ||
17465 | if (childTag === '#text') { | ||
17466 | if (/\S/.test(childText)) { | ||
17467 | tagDisplayName = 'Text nodes'; | ||
17468 | } else { | ||
17469 | tagDisplayName = 'Whitespace text nodes'; | ||
17470 | whitespaceInfo = ' Make sure you don\'t have any extra whitespace between tags on ' + 'each line of your source code.'; | ||
17471 | } | ||
17472 | } else { | ||
17473 | tagDisplayName = '<' + childTag + '>'; | ||
17474 | } | ||
17475 | |||
17476 | if (invalidParent) { | ||
17477 | var info = ''; | ||
17478 | if (ancestorTag === 'table' && childTag === 'tr') { | ||
17479 | info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.'; | ||
17480 | } | ||
17481 | process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s ' + 'See %s.%s', tagDisplayName, ancestorTag, whitespaceInfo, ownerInfo, info) : void 0; | ||
17482 | } else { | ||
17483 | process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0; | ||
17484 | } | ||
17485 | } | ||
17486 | }; | ||
17487 | |||
17488 | validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo; | ||
17489 | |||
17490 | // For testing | ||
17491 | validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) { | ||
17492 | ancestorInfo = ancestorInfo || emptyAncestorInfo; | ||
17493 | var parentInfo = ancestorInfo.current; | ||
17494 | var parentTag = parentInfo && parentInfo.tag; | ||
17495 | return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo); | ||
17496 | }; | ||
17497 | } | ||
17498 | |||
17499 | module.exports = validateDOMNesting; | ||
17500 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
17501 | |||
17502 | /***/ }), | ||
17503 | /* 143 */ | ||
17504 | /***/ (function(module, exports, __webpack_require__) { | ||
17505 | |||
17506 | /** | ||
17507 | * Copyright 2014-present, Facebook, Inc. | ||
17508 | * All rights reserved. | ||
17509 | * | ||
17510 | * This source code is licensed under the BSD-style license found in the | ||
17511 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17512 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17513 | * | ||
17514 | */ | ||
17515 | |||
17516 | 'use strict'; | ||
17517 | |||
17518 | var _assign = __webpack_require__(6); | ||
17519 | |||
17520 | var DOMLazyTree = __webpack_require__(87); | ||
17521 | var ReactDOMComponentTree = __webpack_require__(40); | ||
17522 | |||
17523 | var ReactDOMEmptyComponent = function (instantiate) { | ||
17524 | // ReactCompositeComponent uses this: | ||
17525 | this._currentElement = null; | ||
17526 | // ReactDOMComponentTree uses these: | ||
17527 | this._hostNode = null; | ||
17528 | this._hostParent = null; | ||
17529 | this._hostContainerInfo = null; | ||
17530 | this._domID = 0; | ||
17531 | }; | ||
17532 | _assign(ReactDOMEmptyComponent.prototype, { | ||
17533 | mountComponent: function (transaction, hostParent, hostContainerInfo, context) { | ||
17534 | var domID = hostContainerInfo._idCounter++; | ||
17535 | this._domID = domID; | ||
17536 | this._hostParent = hostParent; | ||
17537 | this._hostContainerInfo = hostContainerInfo; | ||
17538 | |||
17539 | var nodeValue = ' react-empty: ' + this._domID + ' '; | ||
17540 | if (transaction.useCreateElement) { | ||
17541 | var ownerDocument = hostContainerInfo._ownerDocument; | ||
17542 | var node = ownerDocument.createComment(nodeValue); | ||
17543 | ReactDOMComponentTree.precacheNode(this, node); | ||
17544 | return DOMLazyTree(node); | ||
17545 | } else { | ||
17546 | if (transaction.renderToStaticMarkup) { | ||
17547 | // Normally we'd insert a comment node, but since this is a situation | ||
17548 | // where React won't take over (static pages), we can simply return | ||
17549 | // nothing. | ||
17550 | return ''; | ||
17551 | } | ||
17552 | return '<!--' + nodeValue + '-->'; | ||
17553 | } | ||
17554 | }, | ||
17555 | receiveComponent: function () {}, | ||
17556 | getHostNode: function () { | ||
17557 | return ReactDOMComponentTree.getNodeFromInstance(this); | ||
17558 | }, | ||
17559 | unmountComponent: function () { | ||
17560 | ReactDOMComponentTree.uncacheNode(this); | ||
17561 | } | ||
17562 | }); | ||
17563 | |||
17564 | module.exports = ReactDOMEmptyComponent; | ||
17565 | |||
17566 | /***/ }), | ||
17567 | /* 144 */ | ||
17568 | /***/ (function(module, exports, __webpack_require__) { | ||
17569 | |||
17570 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
17571 | * Copyright 2015-present, Facebook, Inc. | ||
17572 | * All rights reserved. | ||
17573 | * | ||
17574 | * This source code is licensed under the BSD-style license found in the | ||
17575 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17576 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17577 | * | ||
17578 | */ | ||
17579 | |||
17580 | 'use strict'; | ||
17581 | |||
17582 | var _prodInvariant = __webpack_require__(41); | ||
17583 | |||
17584 | var invariant = __webpack_require__(10); | ||
17585 | |||
17586 | /** | ||
17587 | * Return the lowest common ancestor of A and B, or null if they are in | ||
17588 | * different trees. | ||
17589 | */ | ||
17590 | function getLowestCommonAncestor(instA, instB) { | ||
17591 | !('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; | ||
17592 | !('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; | ||
17593 | |||
17594 | var depthA = 0; | ||
17595 | for (var tempA = instA; tempA; tempA = tempA._hostParent) { | ||
17596 | depthA++; | ||
17597 | } | ||
17598 | var depthB = 0; | ||
17599 | for (var tempB = instB; tempB; tempB = tempB._hostParent) { | ||
17600 | depthB++; | ||
17601 | } | ||
17602 | |||
17603 | // If A is deeper, crawl up. | ||
17604 | while (depthA - depthB > 0) { | ||
17605 | instA = instA._hostParent; | ||
17606 | depthA--; | ||
17607 | } | ||
17608 | |||
17609 | // If B is deeper, crawl up. | ||
17610 | while (depthB - depthA > 0) { | ||
17611 | instB = instB._hostParent; | ||
17612 | depthB--; | ||
17613 | } | ||
17614 | |||
17615 | // Walk in lockstep until we find a match. | ||
17616 | var depth = depthA; | ||
17617 | while (depth--) { | ||
17618 | if (instA === instB) { | ||
17619 | return instA; | ||
17620 | } | ||
17621 | instA = instA._hostParent; | ||
17622 | instB = instB._hostParent; | ||
17623 | } | ||
17624 | return null; | ||
17625 | } | ||
17626 | |||
17627 | /** | ||
17628 | * Return if A is an ancestor of B. | ||
17629 | */ | ||
17630 | function isAncestor(instA, instB) { | ||
17631 | !('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0; | ||
17632 | !('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0; | ||
17633 | |||
17634 | while (instB) { | ||
17635 | if (instB === instA) { | ||
17636 | return true; | ||
17637 | } | ||
17638 | instB = instB._hostParent; | ||
17639 | } | ||
17640 | return false; | ||
17641 | } | ||
17642 | |||
17643 | /** | ||
17644 | * Return the parent instance of the passed-in instance. | ||
17645 | */ | ||
17646 | function getParentInstance(inst) { | ||
17647 | !('_hostNode' in inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0; | ||
17648 | |||
17649 | return inst._hostParent; | ||
17650 | } | ||
17651 | |||
17652 | /** | ||
17653 | * Simulates the traversal of a two-phase, capture/bubble event dispatch. | ||
17654 | */ | ||
17655 | function traverseTwoPhase(inst, fn, arg) { | ||
17656 | var path = []; | ||
17657 | while (inst) { | ||
17658 | path.push(inst); | ||
17659 | inst = inst._hostParent; | ||
17660 | } | ||
17661 | var i; | ||
17662 | for (i = path.length; i-- > 0;) { | ||
17663 | fn(path[i], 'captured', arg); | ||
17664 | } | ||
17665 | for (i = 0; i < path.length; i++) { | ||
17666 | fn(path[i], 'bubbled', arg); | ||
17667 | } | ||
17668 | } | ||
17669 | |||
17670 | /** | ||
17671 | * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that | ||
17672 | * should would receive a `mouseEnter` or `mouseLeave` event. | ||
17673 | * | ||
17674 | * Does not invoke the callback on the nearest common ancestor because nothing | ||
17675 | * "entered" or "left" that element. | ||
17676 | */ | ||
17677 | function traverseEnterLeave(from, to, fn, argFrom, argTo) { | ||
17678 | var common = from && to ? getLowestCommonAncestor(from, to) : null; | ||
17679 | var pathFrom = []; | ||
17680 | while (from && from !== common) { | ||
17681 | pathFrom.push(from); | ||
17682 | from = from._hostParent; | ||
17683 | } | ||
17684 | var pathTo = []; | ||
17685 | while (to && to !== common) { | ||
17686 | pathTo.push(to); | ||
17687 | to = to._hostParent; | ||
17688 | } | ||
17689 | var i; | ||
17690 | for (i = 0; i < pathFrom.length; i++) { | ||
17691 | fn(pathFrom[i], 'bubbled', argFrom); | ||
17692 | } | ||
17693 | for (i = pathTo.length; i-- > 0;) { | ||
17694 | fn(pathTo[i], 'captured', argTo); | ||
17695 | } | ||
17696 | } | ||
17697 | |||
17698 | module.exports = { | ||
17699 | isAncestor: isAncestor, | ||
17700 | getLowestCommonAncestor: getLowestCommonAncestor, | ||
17701 | getParentInstance: getParentInstance, | ||
17702 | traverseTwoPhase: traverseTwoPhase, | ||
17703 | traverseEnterLeave: traverseEnterLeave | ||
17704 | }; | ||
17705 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
17706 | |||
17707 | /***/ }), | ||
17708 | /* 145 */ | ||
17709 | /***/ (function(module, exports, __webpack_require__) { | ||
17710 | |||
17711 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
17712 | * Copyright 2013-present, Facebook, Inc. | ||
17713 | * All rights reserved. | ||
17714 | * | ||
17715 | * This source code is licensed under the BSD-style license found in the | ||
17716 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17717 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17718 | * | ||
17719 | */ | ||
17720 | |||
17721 | 'use strict'; | ||
17722 | |||
17723 | var _prodInvariant = __webpack_require__(41), | ||
17724 | _assign = __webpack_require__(6); | ||
17725 | |||
17726 | var DOMChildrenOperations = __webpack_require__(86); | ||
17727 | var DOMLazyTree = __webpack_require__(87); | ||
17728 | var ReactDOMComponentTree = __webpack_require__(40); | ||
17729 | |||
17730 | var escapeTextContentForBrowser = __webpack_require__(92); | ||
17731 | var invariant = __webpack_require__(10); | ||
17732 | var validateDOMNesting = __webpack_require__(142); | ||
17733 | |||
17734 | /** | ||
17735 | * Text nodes violate a couple assumptions that React makes about components: | ||
17736 | * | ||
17737 | * - When mounting text into the DOM, adjacent text nodes are merged. | ||
17738 | * - Text nodes cannot be assigned a React root ID. | ||
17739 | * | ||
17740 | * This component is used to wrap strings between comment nodes so that they | ||
17741 | * can undergo the same reconciliation that is applied to elements. | ||
17742 | * | ||
17743 | * TODO: Investigate representing React components in the DOM with text nodes. | ||
17744 | * | ||
17745 | * @class ReactDOMTextComponent | ||
17746 | * @extends ReactComponent | ||
17747 | * @internal | ||
17748 | */ | ||
17749 | var ReactDOMTextComponent = function (text) { | ||
17750 | // TODO: This is really a ReactText (ReactNode), not a ReactElement | ||
17751 | this._currentElement = text; | ||
17752 | this._stringText = '' + text; | ||
17753 | // ReactDOMComponentTree uses these: | ||
17754 | this._hostNode = null; | ||
17755 | this._hostParent = null; | ||
17756 | |||
17757 | // Properties | ||
17758 | this._domID = 0; | ||
17759 | this._mountIndex = 0; | ||
17760 | this._closingComment = null; | ||
17761 | this._commentNodes = null; | ||
17762 | }; | ||
17763 | |||
17764 | _assign(ReactDOMTextComponent.prototype, { | ||
17765 | |||
17766 | /** | ||
17767 | * Creates the markup for this text node. This node is not intended to have | ||
17768 | * any features besides containing text content. | ||
17769 | * | ||
17770 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
17771 | * @return {string} Markup for this text node. | ||
17772 | * @internal | ||
17773 | */ | ||
17774 | mountComponent: function (transaction, hostParent, hostContainerInfo, context) { | ||
17775 | if (process.env.NODE_ENV !== 'production') { | ||
17776 | var parentInfo; | ||
17777 | if (hostParent != null) { | ||
17778 | parentInfo = hostParent._ancestorInfo; | ||
17779 | } else if (hostContainerInfo != null) { | ||
17780 | parentInfo = hostContainerInfo._ancestorInfo; | ||
17781 | } | ||
17782 | if (parentInfo) { | ||
17783 | // parentInfo should always be present except for the top-level | ||
17784 | // component when server rendering | ||
17785 | validateDOMNesting(null, this._stringText, this, parentInfo); | ||
17786 | } | ||
17787 | } | ||
17788 | |||
17789 | var domID = hostContainerInfo._idCounter++; | ||
17790 | var openingValue = ' react-text: ' + domID + ' '; | ||
17791 | var closingValue = ' /react-text '; | ||
17792 | this._domID = domID; | ||
17793 | this._hostParent = hostParent; | ||
17794 | if (transaction.useCreateElement) { | ||
17795 | var ownerDocument = hostContainerInfo._ownerDocument; | ||
17796 | var openingComment = ownerDocument.createComment(openingValue); | ||
17797 | var closingComment = ownerDocument.createComment(closingValue); | ||
17798 | var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment()); | ||
17799 | DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment)); | ||
17800 | if (this._stringText) { | ||
17801 | DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText))); | ||
17802 | } | ||
17803 | DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment)); | ||
17804 | ReactDOMComponentTree.precacheNode(this, openingComment); | ||
17805 | this._closingComment = closingComment; | ||
17806 | return lazyTree; | ||
17807 | } else { | ||
17808 | var escapedText = escapeTextContentForBrowser(this._stringText); | ||
17809 | |||
17810 | if (transaction.renderToStaticMarkup) { | ||
17811 | // Normally we'd wrap this between comment nodes for the reasons stated | ||
17812 | // above, but since this is a situation where React won't take over | ||
17813 | // (static pages), we can simply return the text as it is. | ||
17814 | return escapedText; | ||
17815 | } | ||
17816 | |||
17817 | return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->'; | ||
17818 | } | ||
17819 | }, | ||
17820 | |||
17821 | /** | ||
17822 | * Updates this component by updating the text content. | ||
17823 | * | ||
17824 | * @param {ReactText} nextText The next text content | ||
17825 | * @param {ReactReconcileTransaction} transaction | ||
17826 | * @internal | ||
17827 | */ | ||
17828 | receiveComponent: function (nextText, transaction) { | ||
17829 | if (nextText !== this._currentElement) { | ||
17830 | this._currentElement = nextText; | ||
17831 | var nextStringText = '' + nextText; | ||
17832 | if (nextStringText !== this._stringText) { | ||
17833 | // TODO: Save this as pending props and use performUpdateIfNecessary | ||
17834 | // and/or updateComponent to do the actual update for consistency with | ||
17835 | // other component types? | ||
17836 | this._stringText = nextStringText; | ||
17837 | var commentNodes = this.getHostNode(); | ||
17838 | DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText); | ||
17839 | } | ||
17840 | } | ||
17841 | }, | ||
17842 | |||
17843 | getHostNode: function () { | ||
17844 | var hostNode = this._commentNodes; | ||
17845 | if (hostNode) { | ||
17846 | return hostNode; | ||
17847 | } | ||
17848 | if (!this._closingComment) { | ||
17849 | var openingComment = ReactDOMComponentTree.getNodeFromInstance(this); | ||
17850 | var node = openingComment.nextSibling; | ||
17851 | while (true) { | ||
17852 | !(node != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0; | ||
17853 | if (node.nodeType === 8 && node.nodeValue === ' /react-text ') { | ||
17854 | this._closingComment = node; | ||
17855 | break; | ||
17856 | } | ||
17857 | node = node.nextSibling; | ||
17858 | } | ||
17859 | } | ||
17860 | hostNode = [this._hostNode, this._closingComment]; | ||
17861 | this._commentNodes = hostNode; | ||
17862 | return hostNode; | ||
17863 | }, | ||
17864 | |||
17865 | unmountComponent: function () { | ||
17866 | this._closingComment = null; | ||
17867 | this._commentNodes = null; | ||
17868 | ReactDOMComponentTree.uncacheNode(this); | ||
17869 | } | ||
17870 | |||
17871 | }); | ||
17872 | |||
17873 | module.exports = ReactDOMTextComponent; | ||
17874 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
17875 | |||
17876 | /***/ }), | ||
17877 | /* 146 */ | ||
17878 | /***/ (function(module, exports, __webpack_require__) { | ||
17879 | |||
17880 | /** | ||
17881 | * Copyright 2013-present, Facebook, Inc. | ||
17882 | * All rights reserved. | ||
17883 | * | ||
17884 | * This source code is licensed under the BSD-style license found in the | ||
17885 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17886 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17887 | * | ||
17888 | */ | ||
17889 | |||
17890 | 'use strict'; | ||
17891 | |||
17892 | var _assign = __webpack_require__(6); | ||
17893 | |||
17894 | var ReactUpdates = __webpack_require__(62); | ||
17895 | var Transaction = __webpack_require__(74); | ||
17896 | |||
17897 | var emptyFunction = __webpack_require__(14); | ||
17898 | |||
17899 | var RESET_BATCHED_UPDATES = { | ||
17900 | initialize: emptyFunction, | ||
17901 | close: function () { | ||
17902 | ReactDefaultBatchingStrategy.isBatchingUpdates = false; | ||
17903 | } | ||
17904 | }; | ||
17905 | |||
17906 | var FLUSH_BATCHED_UPDATES = { | ||
17907 | initialize: emptyFunction, | ||
17908 | close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates) | ||
17909 | }; | ||
17910 | |||
17911 | var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES]; | ||
17912 | |||
17913 | function ReactDefaultBatchingStrategyTransaction() { | ||
17914 | this.reinitializeTransaction(); | ||
17915 | } | ||
17916 | |||
17917 | _assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, { | ||
17918 | getTransactionWrappers: function () { | ||
17919 | return TRANSACTION_WRAPPERS; | ||
17920 | } | ||
17921 | }); | ||
17922 | |||
17923 | var transaction = new ReactDefaultBatchingStrategyTransaction(); | ||
17924 | |||
17925 | var ReactDefaultBatchingStrategy = { | ||
17926 | isBatchingUpdates: false, | ||
17927 | |||
17928 | /** | ||
17929 | * Call the provided function in a context within which calls to `setState` | ||
17930 | * and friends are batched such that components aren't updated unnecessarily. | ||
17931 | */ | ||
17932 | batchedUpdates: function (callback, a, b, c, d, e) { | ||
17933 | var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates; | ||
17934 | |||
17935 | ReactDefaultBatchingStrategy.isBatchingUpdates = true; | ||
17936 | |||
17937 | // The code is written this way to avoid extra allocations | ||
17938 | if (alreadyBatchingUpdates) { | ||
17939 | return callback(a, b, c, d, e); | ||
17940 | } else { | ||
17941 | return transaction.perform(callback, null, a, b, c, d, e); | ||
17942 | } | ||
17943 | } | ||
17944 | }; | ||
17945 | |||
17946 | module.exports = ReactDefaultBatchingStrategy; | ||
17947 | |||
17948 | /***/ }), | ||
17949 | /* 147 */ | ||
17950 | /***/ (function(module, exports, __webpack_require__) { | ||
17951 | |||
17952 | /** | ||
17953 | * Copyright 2013-present, Facebook, Inc. | ||
17954 | * All rights reserved. | ||
17955 | * | ||
17956 | * This source code is licensed under the BSD-style license found in the | ||
17957 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17958 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17959 | * | ||
17960 | */ | ||
17961 | |||
17962 | 'use strict'; | ||
17963 | |||
17964 | var _assign = __webpack_require__(6); | ||
17965 | |||
17966 | var EventListener = __webpack_require__(148); | ||
17967 | var ExecutionEnvironment = __webpack_require__(54); | ||
17968 | var PooledClass = __webpack_require__(56); | ||
17969 | var ReactDOMComponentTree = __webpack_require__(40); | ||
17970 | var ReactUpdates = __webpack_require__(62); | ||
17971 | |||
17972 | var getEventTarget = __webpack_require__(75); | ||
17973 | var getUnboundedScrollPosition = __webpack_require__(149); | ||
17974 | |||
17975 | /** | ||
17976 | * Find the deepest React component completely containing the root of the | ||
17977 | * passed-in instance (for use when entire React trees are nested within each | ||
17978 | * other). If React trees are not nested, returns null. | ||
17979 | */ | ||
17980 | function findParent(inst) { | ||
17981 | // TODO: It may be a good idea to cache this to prevent unnecessary DOM | ||
17982 | // traversal, but caching is difficult to do correctly without using a | ||
17983 | // mutation observer to listen for all DOM changes. | ||
17984 | while (inst._hostParent) { | ||
17985 | inst = inst._hostParent; | ||
17986 | } | ||
17987 | var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
17988 | var container = rootNode.parentNode; | ||
17989 | return ReactDOMComponentTree.getClosestInstanceFromNode(container); | ||
17990 | } | ||
17991 | |||
17992 | // Used to store ancestor hierarchy in top level callback | ||
17993 | function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) { | ||
17994 | this.topLevelType = topLevelType; | ||
17995 | this.nativeEvent = nativeEvent; | ||
17996 | this.ancestors = []; | ||
17997 | } | ||
17998 | _assign(TopLevelCallbackBookKeeping.prototype, { | ||
17999 | destructor: function () { | ||
18000 | this.topLevelType = null; | ||
18001 | this.nativeEvent = null; | ||
18002 | this.ancestors.length = 0; | ||
18003 | } | ||
18004 | }); | ||
18005 | PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler); | ||
18006 | |||
18007 | function handleTopLevelImpl(bookKeeping) { | ||
18008 | var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent); | ||
18009 | var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget); | ||
18010 | |||
18011 | // Loop through the hierarchy, in case there's any nested components. | ||
18012 | // It's important that we build the array of ancestors before calling any | ||
18013 | // event handlers, because event handlers can modify the DOM, leading to | ||
18014 | // inconsistencies with ReactMount's node cache. See #1105. | ||
18015 | var ancestor = targetInst; | ||
18016 | do { | ||
18017 | bookKeeping.ancestors.push(ancestor); | ||
18018 | ancestor = ancestor && findParent(ancestor); | ||
18019 | } while (ancestor); | ||
18020 | |||
18021 | for (var i = 0; i < bookKeeping.ancestors.length; i++) { | ||
18022 | targetInst = bookKeeping.ancestors[i]; | ||
18023 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); | ||
18024 | } | ||
18025 | } | ||
18026 | |||
18027 | function scrollValueMonitor(cb) { | ||
18028 | var scrollPosition = getUnboundedScrollPosition(window); | ||
18029 | cb(scrollPosition); | ||
18030 | } | ||
18031 | |||
18032 | var ReactEventListener = { | ||
18033 | _enabled: true, | ||
18034 | _handleTopLevel: null, | ||
18035 | |||
18036 | WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null, | ||
18037 | |||
18038 | setHandleTopLevel: function (handleTopLevel) { | ||
18039 | ReactEventListener._handleTopLevel = handleTopLevel; | ||
18040 | }, | ||
18041 | |||
18042 | setEnabled: function (enabled) { | ||
18043 | ReactEventListener._enabled = !!enabled; | ||
18044 | }, | ||
18045 | |||
18046 | isEnabled: function () { | ||
18047 | return ReactEventListener._enabled; | ||
18048 | }, | ||
18049 | |||
18050 | /** | ||
18051 | * Traps top-level events by using event bubbling. | ||
18052 | * | ||
18053 | * @param {string} topLevelType Record from `EventConstants`. | ||
18054 | * @param {string} handlerBaseName Event name (e.g. "click"). | ||
18055 | * @param {object} element Element on which to attach listener. | ||
18056 | * @return {?object} An object with a remove function which will forcefully | ||
18057 | * remove the listener. | ||
18058 | * @internal | ||
18059 | */ | ||
18060 | trapBubbledEvent: function (topLevelType, handlerBaseName, element) { | ||
18061 | if (!element) { | ||
18062 | return null; | ||
18063 | } | ||
18064 | return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); | ||
18065 | }, | ||
18066 | |||
18067 | /** | ||
18068 | * Traps a top-level event by using event capturing. | ||
18069 | * | ||
18070 | * @param {string} topLevelType Record from `EventConstants`. | ||
18071 | * @param {string} handlerBaseName Event name (e.g. "click"). | ||
18072 | * @param {object} element Element on which to attach listener. | ||
18073 | * @return {?object} An object with a remove function which will forcefully | ||
18074 | * remove the listener. | ||
18075 | * @internal | ||
18076 | */ | ||
18077 | trapCapturedEvent: function (topLevelType, handlerBaseName, element) { | ||
18078 | if (!element) { | ||
18079 | return null; | ||
18080 | } | ||
18081 | return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); | ||
18082 | }, | ||
18083 | |||
18084 | monitorScrollValue: function (refresh) { | ||
18085 | var callback = scrollValueMonitor.bind(null, refresh); | ||
18086 | EventListener.listen(window, 'scroll', callback); | ||
18087 | }, | ||
18088 | |||
18089 | dispatchEvent: function (topLevelType, nativeEvent) { | ||
18090 | if (!ReactEventListener._enabled) { | ||
18091 | return; | ||
18092 | } | ||
18093 | |||
18094 | var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent); | ||
18095 | try { | ||
18096 | // Event queue being processed in the same cycle allows | ||
18097 | // `preventDefault`. | ||
18098 | ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping); | ||
18099 | } finally { | ||
18100 | TopLevelCallbackBookKeeping.release(bookKeeping); | ||
18101 | } | ||
18102 | } | ||
18103 | }; | ||
18104 | |||
18105 | module.exports = ReactEventListener; | ||
18106 | |||
18107 | /***/ }), | ||
18108 | /* 148 */ | ||
18109 | /***/ (function(module, exports, __webpack_require__) { | ||
18110 | |||
18111 | /* WEBPACK VAR INJECTION */(function(process) {'use strict'; | ||
18112 | |||
18113 | /** | ||
18114 | * Copyright (c) 2013-present, Facebook, Inc. | ||
18115 | * | ||
18116 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
18117 | * you may not use this file except in compliance with the License. | ||
18118 | * You may obtain a copy of the License at | ||
18119 | * | ||
18120 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
18121 | * | ||
18122 | * Unless required by applicable law or agreed to in writing, software | ||
18123 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
18124 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
18125 | * See the License for the specific language governing permissions and | ||
18126 | * limitations under the License. | ||
18127 | * | ||
18128 | * @typechecks | ||
18129 | */ | ||
18130 | |||
18131 | var emptyFunction = __webpack_require__(14); | ||
18132 | |||
18133 | /** | ||
18134 | * Upstream version of event listener. Does not take into account specific | ||
18135 | * nature of platform. | ||
18136 | */ | ||
18137 | var EventListener = { | ||
18138 | /** | ||
18139 | * Listen to DOM events during the bubble phase. | ||
18140 | * | ||
18141 | * @param {DOMEventTarget} target DOM element to register listener on. | ||
18142 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. | ||
18143 | * @param {function} callback Callback function. | ||
18144 | * @return {object} Object with a `remove` method. | ||
18145 | */ | ||
18146 | listen: function listen(target, eventType, callback) { | ||
18147 | if (target.addEventListener) { | ||
18148 | target.addEventListener(eventType, callback, false); | ||
18149 | return { | ||
18150 | remove: function remove() { | ||
18151 | target.removeEventListener(eventType, callback, false); | ||
18152 | } | ||
18153 | }; | ||
18154 | } else if (target.attachEvent) { | ||
18155 | target.attachEvent('on' + eventType, callback); | ||
18156 | return { | ||
18157 | remove: function remove() { | ||
18158 | target.detachEvent('on' + eventType, callback); | ||
18159 | } | ||
18160 | }; | ||
18161 | } | ||
18162 | }, | ||
18163 | |||
18164 | /** | ||
18165 | * Listen to DOM events during the capture phase. | ||
18166 | * | ||
18167 | * @param {DOMEventTarget} target DOM element to register listener on. | ||
18168 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. | ||
18169 | * @param {function} callback Callback function. | ||
18170 | * @return {object} Object with a `remove` method. | ||
18171 | */ | ||
18172 | capture: function capture(target, eventType, callback) { | ||
18173 | if (target.addEventListener) { | ||
18174 | target.addEventListener(eventType, callback, true); | ||
18175 | return { | ||
18176 | remove: function remove() { | ||
18177 | target.removeEventListener(eventType, callback, true); | ||
18178 | } | ||
18179 | }; | ||
18180 | } else { | ||
18181 | if (process.env.NODE_ENV !== 'production') { | ||
18182 | console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.'); | ||
18183 | } | ||
18184 | return { | ||
18185 | remove: emptyFunction | ||
18186 | }; | ||
18187 | } | ||
18188 | }, | ||
18189 | |||
18190 | registerDefault: function registerDefault() {} | ||
18191 | }; | ||
18192 | |||
18193 | module.exports = EventListener; | ||
18194 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
18195 | |||
18196 | /***/ }), | ||
18197 | /* 149 */ | ||
18198 | /***/ (function(module, exports) { | ||
18199 | |||
18200 | /** | ||
18201 | * Copyright (c) 2013-present, Facebook, Inc. | ||
18202 | * All rights reserved. | ||
18203 | * | ||
18204 | * This source code is licensed under the BSD-style license found in the | ||
18205 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18206 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18207 | * | ||
18208 | * @typechecks | ||
18209 | */ | ||
18210 | |||
18211 | 'use strict'; | ||
18212 | |||
18213 | /** | ||
18214 | * Gets the scroll position of the supplied element or window. | ||
18215 | * | ||
18216 | * The return values are unbounded, unlike `getScrollPosition`. This means they | ||
18217 | * may be negative or exceed the element boundaries (which is possible using | ||
18218 | * inertial scrolling). | ||
18219 | * | ||
18220 | * @param {DOMWindow|DOMElement} scrollable | ||
18221 | * @return {object} Map with `x` and `y` keys. | ||
18222 | */ | ||
18223 | |||
18224 | function getUnboundedScrollPosition(scrollable) { | ||
18225 | if (scrollable.Window && scrollable instanceof scrollable.Window) { | ||
18226 | return { | ||
18227 | x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft, | ||
18228 | y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop | ||
18229 | }; | ||
18230 | } | ||
18231 | return { | ||
18232 | x: scrollable.scrollLeft, | ||
18233 | y: scrollable.scrollTop | ||
18234 | }; | ||
18235 | } | ||
18236 | |||
18237 | module.exports = getUnboundedScrollPosition; | ||
18238 | |||
18239 | /***/ }), | ||
18240 | /* 150 */ | ||
18241 | /***/ (function(module, exports, __webpack_require__) { | ||
18242 | |||
18243 | /** | ||
18244 | * Copyright 2013-present, Facebook, Inc. | ||
18245 | * All rights reserved. | ||
18246 | * | ||
18247 | * This source code is licensed under the BSD-style license found in the | ||
18248 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18249 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18250 | * | ||
18251 | */ | ||
18252 | |||
18253 | 'use strict'; | ||
18254 | |||
18255 | var DOMProperty = __webpack_require__(42); | ||
18256 | var EventPluginHub = __webpack_require__(48); | ||
18257 | var EventPluginUtils = __webpack_require__(50); | ||
18258 | var ReactComponentEnvironment = __webpack_require__(121); | ||
18259 | var ReactEmptyComponent = __webpack_require__(131); | ||
18260 | var ReactBrowserEventEmitter = __webpack_require__(111); | ||
18261 | var ReactHostComponent = __webpack_require__(132); | ||
18262 | var ReactUpdates = __webpack_require__(62); | ||
18263 | |||
18264 | var ReactInjection = { | ||
18265 | Component: ReactComponentEnvironment.injection, | ||
18266 | DOMProperty: DOMProperty.injection, | ||
18267 | EmptyComponent: ReactEmptyComponent.injection, | ||
18268 | EventPluginHub: EventPluginHub.injection, | ||
18269 | EventPluginUtils: EventPluginUtils.injection, | ||
18270 | EventEmitter: ReactBrowserEventEmitter.injection, | ||
18271 | HostComponent: ReactHostComponent.injection, | ||
18272 | Updates: ReactUpdates.injection | ||
18273 | }; | ||
18274 | |||
18275 | module.exports = ReactInjection; | ||
18276 | |||
18277 | /***/ }), | ||
18278 | /* 151 */ | ||
18279 | /***/ (function(module, exports, __webpack_require__) { | ||
18280 | |||
18281 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
18282 | * Copyright 2013-present, Facebook, Inc. | ||
18283 | * All rights reserved. | ||
18284 | * | ||
18285 | * This source code is licensed under the BSD-style license found in the | ||
18286 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18287 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18288 | * | ||
18289 | */ | ||
18290 | |||
18291 | 'use strict'; | ||
18292 | |||
18293 | var _assign = __webpack_require__(6); | ||
18294 | |||
18295 | var CallbackQueue = __webpack_require__(63); | ||
18296 | var PooledClass = __webpack_require__(56); | ||
18297 | var ReactBrowserEventEmitter = __webpack_require__(111); | ||
18298 | var ReactInputSelection = __webpack_require__(152); | ||
18299 | var ReactInstrumentation = __webpack_require__(68); | ||
18300 | var Transaction = __webpack_require__(74); | ||
18301 | var ReactUpdateQueue = __webpack_require__(141); | ||
18302 | |||
18303 | /** | ||
18304 | * Ensures that, when possible, the selection range (currently selected text | ||
18305 | * input) is not disturbed by performing the transaction. | ||
18306 | */ | ||
18307 | var SELECTION_RESTORATION = { | ||
18308 | /** | ||
18309 | * @return {Selection} Selection information. | ||
18310 | */ | ||
18311 | initialize: ReactInputSelection.getSelectionInformation, | ||
18312 | /** | ||
18313 | * @param {Selection} sel Selection information returned from `initialize`. | ||
18314 | */ | ||
18315 | close: ReactInputSelection.restoreSelection | ||
18316 | }; | ||
18317 | |||
18318 | /** | ||
18319 | * Suppresses events (blur/focus) that could be inadvertently dispatched due to | ||
18320 | * high level DOM manipulations (like temporarily removing a text input from the | ||
18321 | * DOM). | ||
18322 | */ | ||
18323 | var EVENT_SUPPRESSION = { | ||
18324 | /** | ||
18325 | * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before | ||
18326 | * the reconciliation. | ||
18327 | */ | ||
18328 | initialize: function () { | ||
18329 | var currentlyEnabled = ReactBrowserEventEmitter.isEnabled(); | ||
18330 | ReactBrowserEventEmitter.setEnabled(false); | ||
18331 | return currentlyEnabled; | ||
18332 | }, | ||
18333 | |||
18334 | /** | ||
18335 | * @param {boolean} previouslyEnabled Enabled status of | ||
18336 | * `ReactBrowserEventEmitter` before the reconciliation occurred. `close` | ||
18337 | * restores the previous value. | ||
18338 | */ | ||
18339 | close: function (previouslyEnabled) { | ||
18340 | ReactBrowserEventEmitter.setEnabled(previouslyEnabled); | ||
18341 | } | ||
18342 | }; | ||
18343 | |||
18344 | /** | ||
18345 | * Provides a queue for collecting `componentDidMount` and | ||
18346 | * `componentDidUpdate` callbacks during the transaction. | ||
18347 | */ | ||
18348 | var ON_DOM_READY_QUEUEING = { | ||
18349 | /** | ||
18350 | * Initializes the internal `onDOMReady` queue. | ||
18351 | */ | ||
18352 | initialize: function () { | ||
18353 | this.reactMountReady.reset(); | ||
18354 | }, | ||
18355 | |||
18356 | /** | ||
18357 | * After DOM is flushed, invoke all registered `onDOMReady` callbacks. | ||
18358 | */ | ||
18359 | close: function () { | ||
18360 | this.reactMountReady.notifyAll(); | ||
18361 | } | ||
18362 | }; | ||
18363 | |||
18364 | /** | ||
18365 | * Executed within the scope of the `Transaction` instance. Consider these as | ||
18366 | * being member methods, but with an implied ordering while being isolated from | ||
18367 | * each other. | ||
18368 | */ | ||
18369 | var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING]; | ||
18370 | |||
18371 | if (process.env.NODE_ENV !== 'production') { | ||
18372 | TRANSACTION_WRAPPERS.push({ | ||
18373 | initialize: ReactInstrumentation.debugTool.onBeginFlush, | ||
18374 | close: ReactInstrumentation.debugTool.onEndFlush | ||
18375 | }); | ||
18376 | } | ||
18377 | |||
18378 | /** | ||
18379 | * Currently: | ||
18380 | * - The order that these are listed in the transaction is critical: | ||
18381 | * - Suppresses events. | ||
18382 | * - Restores selection range. | ||
18383 | * | ||
18384 | * Future: | ||
18385 | * - Restore document/overflow scroll positions that were unintentionally | ||
18386 | * modified via DOM insertions above the top viewport boundary. | ||
18387 | * - Implement/integrate with customized constraint based layout system and keep | ||
18388 | * track of which dimensions must be remeasured. | ||
18389 | * | ||
18390 | * @class ReactReconcileTransaction | ||
18391 | */ | ||
18392 | function ReactReconcileTransaction(useCreateElement) { | ||
18393 | this.reinitializeTransaction(); | ||
18394 | // Only server-side rendering really needs this option (see | ||
18395 | // `ReactServerRendering`), but server-side uses | ||
18396 | // `ReactServerRenderingTransaction` instead. This option is here so that it's | ||
18397 | // accessible and defaults to false when `ReactDOMComponent` and | ||
18398 | // `ReactDOMTextComponent` checks it in `mountComponent`.` | ||
18399 | this.renderToStaticMarkup = false; | ||
18400 | this.reactMountReady = CallbackQueue.getPooled(null); | ||
18401 | this.useCreateElement = useCreateElement; | ||
18402 | } | ||
18403 | |||
18404 | var Mixin = { | ||
18405 | /** | ||
18406 | * @see Transaction | ||
18407 | * @abstract | ||
18408 | * @final | ||
18409 | * @return {array<object>} List of operation wrap procedures. | ||
18410 | * TODO: convert to array<TransactionWrapper> | ||
18411 | */ | ||
18412 | getTransactionWrappers: function () { | ||
18413 | return TRANSACTION_WRAPPERS; | ||
18414 | }, | ||
18415 | |||
18416 | /** | ||
18417 | * @return {object} The queue to collect `onDOMReady` callbacks with. | ||
18418 | */ | ||
18419 | getReactMountReady: function () { | ||
18420 | return this.reactMountReady; | ||
18421 | }, | ||
18422 | |||
18423 | /** | ||
18424 | * @return {object} The queue to collect React async events. | ||
18425 | */ | ||
18426 | getUpdateQueue: function () { | ||
18427 | return ReactUpdateQueue; | ||
18428 | }, | ||
18429 | |||
18430 | /** | ||
18431 | * Save current transaction state -- if the return value from this method is | ||
18432 | * passed to `rollback`, the transaction will be reset to that state. | ||
18433 | */ | ||
18434 | checkpoint: function () { | ||
18435 | // reactMountReady is the our only stateful wrapper | ||
18436 | return this.reactMountReady.checkpoint(); | ||
18437 | }, | ||
18438 | |||
18439 | rollback: function (checkpoint) { | ||
18440 | this.reactMountReady.rollback(checkpoint); | ||
18441 | }, | ||
18442 | |||
18443 | /** | ||
18444 | * `PooledClass` looks for this, and will invoke this before allowing this | ||
18445 | * instance to be reused. | ||
18446 | */ | ||
18447 | destructor: function () { | ||
18448 | CallbackQueue.release(this.reactMountReady); | ||
18449 | this.reactMountReady = null; | ||
18450 | } | ||
18451 | }; | ||
18452 | |||
18453 | _assign(ReactReconcileTransaction.prototype, Transaction, Mixin); | ||
18454 | |||
18455 | PooledClass.addPoolingTo(ReactReconcileTransaction); | ||
18456 | |||
18457 | module.exports = ReactReconcileTransaction; | ||
18458 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
18459 | |||
18460 | /***/ }), | ||
18461 | /* 152 */ | ||
18462 | /***/ (function(module, exports, __webpack_require__) { | ||
18463 | |||
18464 | /** | ||
18465 | * Copyright 2013-present, Facebook, Inc. | ||
18466 | * All rights reserved. | ||
18467 | * | ||
18468 | * This source code is licensed under the BSD-style license found in the | ||
18469 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18470 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18471 | * | ||
18472 | */ | ||
18473 | |||
18474 | 'use strict'; | ||
18475 | |||
18476 | var ReactDOMSelection = __webpack_require__(153); | ||
18477 | |||
18478 | var containsNode = __webpack_require__(155); | ||
18479 | var focusNode = __webpack_require__(100); | ||
18480 | var getActiveElement = __webpack_require__(158); | ||
18481 | |||
18482 | function isInDocument(node) { | ||
18483 | return containsNode(document.documentElement, node); | ||
18484 | } | ||
18485 | |||
18486 | /** | ||
18487 | * @ReactInputSelection: React input selection module. Based on Selection.js, | ||
18488 | * but modified to be suitable for react and has a couple of bug fixes (doesn't | ||
18489 | * assume buttons have range selections allowed). | ||
18490 | * Input selection module for React. | ||
18491 | */ | ||
18492 | var ReactInputSelection = { | ||
18493 | |||
18494 | hasSelectionCapabilities: function (elem) { | ||
18495 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); | ||
18496 | return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true'); | ||
18497 | }, | ||
18498 | |||
18499 | getSelectionInformation: function () { | ||
18500 | var focusedElem = getActiveElement(); | ||
18501 | return { | ||
18502 | focusedElem: focusedElem, | ||
18503 | selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null | ||
18504 | }; | ||
18505 | }, | ||
18506 | |||
18507 | /** | ||
18508 | * @restoreSelection: If any selection information was potentially lost, | ||
18509 | * restore it. This is useful when performing operations that could remove dom | ||
18510 | * nodes and place them back in, resulting in focus being lost. | ||
18511 | */ | ||
18512 | restoreSelection: function (priorSelectionInformation) { | ||
18513 | var curFocusedElem = getActiveElement(); | ||
18514 | var priorFocusedElem = priorSelectionInformation.focusedElem; | ||
18515 | var priorSelectionRange = priorSelectionInformation.selectionRange; | ||
18516 | if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { | ||
18517 | if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) { | ||
18518 | ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange); | ||
18519 | } | ||
18520 | focusNode(priorFocusedElem); | ||
18521 | } | ||
18522 | }, | ||
18523 | |||
18524 | /** | ||
18525 | * @getSelection: Gets the selection bounds of a focused textarea, input or | ||
18526 | * contentEditable node. | ||
18527 | * -@input: Look up selection bounds of this input | ||
18528 | * -@return {start: selectionStart, end: selectionEnd} | ||
18529 | */ | ||
18530 | getSelection: function (input) { | ||
18531 | var selection; | ||
18532 | |||
18533 | if ('selectionStart' in input) { | ||
18534 | // Modern browser with input or textarea. | ||
18535 | selection = { | ||
18536 | start: input.selectionStart, | ||
18537 | end: input.selectionEnd | ||
18538 | }; | ||
18539 | } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { | ||
18540 | // IE8 input. | ||
18541 | var range = document.selection.createRange(); | ||
18542 | // There can only be one selection per document in IE, so it must | ||
18543 | // be in our element. | ||
18544 | if (range.parentElement() === input) { | ||
18545 | selection = { | ||
18546 | start: -range.moveStart('character', -input.value.length), | ||
18547 | end: -range.moveEnd('character', -input.value.length) | ||
18548 | }; | ||
18549 | } | ||
18550 | } else { | ||
18551 | // Content editable or old IE textarea. | ||
18552 | selection = ReactDOMSelection.getOffsets(input); | ||
18553 | } | ||
18554 | |||
18555 | return selection || { start: 0, end: 0 }; | ||
18556 | }, | ||
18557 | |||
18558 | /** | ||
18559 | * @setSelection: Sets the selection bounds of a textarea or input and focuses | ||
18560 | * the input. | ||
18561 | * -@input Set selection bounds of this input or textarea | ||
18562 | * -@offsets Object of same form that is returned from get* | ||
18563 | */ | ||
18564 | setSelection: function (input, offsets) { | ||
18565 | var start = offsets.start; | ||
18566 | var end = offsets.end; | ||
18567 | if (end === undefined) { | ||
18568 | end = start; | ||
18569 | } | ||
18570 | |||
18571 | if ('selectionStart' in input) { | ||
18572 | input.selectionStart = start; | ||
18573 | input.selectionEnd = Math.min(end, input.value.length); | ||
18574 | } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { | ||
18575 | var range = input.createTextRange(); | ||
18576 | range.collapse(true); | ||
18577 | range.moveStart('character', start); | ||
18578 | range.moveEnd('character', end - start); | ||
18579 | range.select(); | ||
18580 | } else { | ||
18581 | ReactDOMSelection.setOffsets(input, offsets); | ||
18582 | } | ||
18583 | } | ||
18584 | }; | ||
18585 | |||
18586 | module.exports = ReactInputSelection; | ||
18587 | |||
18588 | /***/ }), | ||
18589 | /* 153 */ | ||
18590 | /***/ (function(module, exports, __webpack_require__) { | ||
18591 | |||
18592 | /** | ||
18593 | * Copyright 2013-present, Facebook, Inc. | ||
18594 | * All rights reserved. | ||
18595 | * | ||
18596 | * This source code is licensed under the BSD-style license found in the | ||
18597 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18598 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18599 | * | ||
18600 | */ | ||
18601 | |||
18602 | 'use strict'; | ||
18603 | |||
18604 | var ExecutionEnvironment = __webpack_require__(54); | ||
18605 | |||
18606 | var getNodeForCharacterOffset = __webpack_require__(154); | ||
18607 | var getTextContentAccessor = __webpack_require__(57); | ||
18608 | |||
18609 | /** | ||
18610 | * While `isCollapsed` is available on the Selection object and `collapsed` | ||
18611 | * is available on the Range object, IE11 sometimes gets them wrong. | ||
18612 | * If the anchor/focus nodes and offsets are the same, the range is collapsed. | ||
18613 | */ | ||
18614 | function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) { | ||
18615 | return anchorNode === focusNode && anchorOffset === focusOffset; | ||
18616 | } | ||
18617 | |||
18618 | /** | ||
18619 | * Get the appropriate anchor and focus node/offset pairs for IE. | ||
18620 | * | ||
18621 | * The catch here is that IE's selection API doesn't provide information | ||
18622 | * about whether the selection is forward or backward, so we have to | ||
18623 | * behave as though it's always forward. | ||
18624 | * | ||
18625 | * IE text differs from modern selection in that it behaves as though | ||
18626 | * block elements end with a new line. This means character offsets will | ||
18627 | * differ between the two APIs. | ||
18628 | * | ||
18629 | * @param {DOMElement} node | ||
18630 | * @return {object} | ||
18631 | */ | ||
18632 | function getIEOffsets(node) { | ||
18633 | var selection = document.selection; | ||
18634 | var selectedRange = selection.createRange(); | ||
18635 | var selectedLength = selectedRange.text.length; | ||
18636 | |||
18637 | // Duplicate selection so we can move range without breaking user selection. | ||
18638 | var fromStart = selectedRange.duplicate(); | ||
18639 | fromStart.moveToElementText(node); | ||
18640 | fromStart.setEndPoint('EndToStart', selectedRange); | ||
18641 | |||
18642 | var startOffset = fromStart.text.length; | ||
18643 | var endOffset = startOffset + selectedLength; | ||
18644 | |||
18645 | return { | ||
18646 | start: startOffset, | ||
18647 | end: endOffset | ||
18648 | }; | ||
18649 | } | ||
18650 | |||
18651 | /** | ||
18652 | * @param {DOMElement} node | ||
18653 | * @return {?object} | ||
18654 | */ | ||
18655 | function getModernOffsets(node) { | ||
18656 | var selection = window.getSelection && window.getSelection(); | ||
18657 | |||
18658 | if (!selection || selection.rangeCount === 0) { | ||
18659 | return null; | ||
18660 | } | ||
18661 | |||
18662 | var anchorNode = selection.anchorNode; | ||
18663 | var anchorOffset = selection.anchorOffset; | ||
18664 | var focusNode = selection.focusNode; | ||
18665 | var focusOffset = selection.focusOffset; | ||
18666 | |||
18667 | var currentRange = selection.getRangeAt(0); | ||
18668 | |||
18669 | // In Firefox, range.startContainer and range.endContainer can be "anonymous | ||
18670 | // divs", e.g. the up/down buttons on an <input type="number">. Anonymous | ||
18671 | // divs do not seem to expose properties, triggering a "Permission denied | ||
18672 | // error" if any of its properties are accessed. The only seemingly possible | ||
18673 | // way to avoid erroring is to access a property that typically works for | ||
18674 | // non-anonymous divs and catch any error that may otherwise arise. See | ||
18675 | // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 | ||
18676 | try { | ||
18677 | /* eslint-disable no-unused-expressions */ | ||
18678 | currentRange.startContainer.nodeType; | ||
18679 | currentRange.endContainer.nodeType; | ||
18680 | /* eslint-enable no-unused-expressions */ | ||
18681 | } catch (e) { | ||
18682 | return null; | ||
18683 | } | ||
18684 | |||
18685 | // If the node and offset values are the same, the selection is collapsed. | ||
18686 | // `Selection.isCollapsed` is available natively, but IE sometimes gets | ||
18687 | // this value wrong. | ||
18688 | var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset); | ||
18689 | |||
18690 | var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length; | ||
18691 | |||
18692 | var tempRange = currentRange.cloneRange(); | ||
18693 | tempRange.selectNodeContents(node); | ||
18694 | tempRange.setEnd(currentRange.startContainer, currentRange.startOffset); | ||
18695 | |||
18696 | var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset); | ||
18697 | |||
18698 | var start = isTempRangeCollapsed ? 0 : tempRange.toString().length; | ||
18699 | var end = start + rangeLength; | ||
18700 | |||
18701 | // Detect whether the selection is backward. | ||
18702 | var detectionRange = document.createRange(); | ||
18703 | detectionRange.setStart(anchorNode, anchorOffset); | ||
18704 | detectionRange.setEnd(focusNode, focusOffset); | ||
18705 | var isBackward = detectionRange.collapsed; | ||
18706 | |||
18707 | return { | ||
18708 | start: isBackward ? end : start, | ||
18709 | end: isBackward ? start : end | ||
18710 | }; | ||
18711 | } | ||
18712 | |||
18713 | /** | ||
18714 | * @param {DOMElement|DOMTextNode} node | ||
18715 | * @param {object} offsets | ||
18716 | */ | ||
18717 | function setIEOffsets(node, offsets) { | ||
18718 | var range = document.selection.createRange().duplicate(); | ||
18719 | var start, end; | ||
18720 | |||
18721 | if (offsets.end === undefined) { | ||
18722 | start = offsets.start; | ||
18723 | end = start; | ||
18724 | } else if (offsets.start > offsets.end) { | ||
18725 | start = offsets.end; | ||
18726 | end = offsets.start; | ||
18727 | } else { | ||
18728 | start = offsets.start; | ||
18729 | end = offsets.end; | ||
18730 | } | ||
18731 | |||
18732 | range.moveToElementText(node); | ||
18733 | range.moveStart('character', start); | ||
18734 | range.setEndPoint('EndToStart', range); | ||
18735 | range.moveEnd('character', end - start); | ||
18736 | range.select(); | ||
18737 | } | ||
18738 | |||
18739 | /** | ||
18740 | * In modern non-IE browsers, we can support both forward and backward | ||
18741 | * selections. | ||
18742 | * | ||
18743 | * Note: IE10+ supports the Selection object, but it does not support | ||
18744 | * the `extend` method, which means that even in modern IE, it's not possible | ||
18745 | * to programmatically create a backward selection. Thus, for all IE | ||
18746 | * versions, we use the old IE API to create our selections. | ||
18747 | * | ||
18748 | * @param {DOMElement|DOMTextNode} node | ||
18749 | * @param {object} offsets | ||
18750 | */ | ||
18751 | function setModernOffsets(node, offsets) { | ||
18752 | if (!window.getSelection) { | ||
18753 | return; | ||
18754 | } | ||
18755 | |||
18756 | var selection = window.getSelection(); | ||
18757 | var length = node[getTextContentAccessor()].length; | ||
18758 | var start = Math.min(offsets.start, length); | ||
18759 | var end = offsets.end === undefined ? start : Math.min(offsets.end, length); | ||
18760 | |||
18761 | // IE 11 uses modern selection, but doesn't support the extend method. | ||
18762 | // Flip backward selections, so we can set with a single range. | ||
18763 | if (!selection.extend && start > end) { | ||
18764 | var temp = end; | ||
18765 | end = start; | ||
18766 | start = temp; | ||
18767 | } | ||
18768 | |||
18769 | var startMarker = getNodeForCharacterOffset(node, start); | ||
18770 | var endMarker = getNodeForCharacterOffset(node, end); | ||
18771 | |||
18772 | if (startMarker && endMarker) { | ||
18773 | var range = document.createRange(); | ||
18774 | range.setStart(startMarker.node, startMarker.offset); | ||
18775 | selection.removeAllRanges(); | ||
18776 | |||
18777 | if (start > end) { | ||
18778 | selection.addRange(range); | ||
18779 | selection.extend(endMarker.node, endMarker.offset); | ||
18780 | } else { | ||
18781 | range.setEnd(endMarker.node, endMarker.offset); | ||
18782 | selection.addRange(range); | ||
18783 | } | ||
18784 | } | ||
18785 | } | ||
18786 | |||
18787 | var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window); | ||
18788 | |||
18789 | var ReactDOMSelection = { | ||
18790 | /** | ||
18791 | * @param {DOMElement} node | ||
18792 | */ | ||
18793 | getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets, | ||
18794 | |||
18795 | /** | ||
18796 | * @param {DOMElement|DOMTextNode} node | ||
18797 | * @param {object} offsets | ||
18798 | */ | ||
18799 | setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets | ||
18800 | }; | ||
18801 | |||
18802 | module.exports = ReactDOMSelection; | ||
18803 | |||
18804 | /***/ }), | ||
18805 | /* 154 */ | ||
18806 | /***/ (function(module, exports) { | ||
18807 | |||
18808 | /** | ||
18809 | * Copyright 2013-present, Facebook, Inc. | ||
18810 | * All rights reserved. | ||
18811 | * | ||
18812 | * This source code is licensed under the BSD-style license found in the | ||
18813 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18814 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18815 | * | ||
18816 | */ | ||
18817 | |||
18818 | 'use strict'; | ||
18819 | |||
18820 | /** | ||
18821 | * Given any node return the first leaf node without children. | ||
18822 | * | ||
18823 | * @param {DOMElement|DOMTextNode} node | ||
18824 | * @return {DOMElement|DOMTextNode} | ||
18825 | */ | ||
18826 | |||
18827 | function getLeafNode(node) { | ||
18828 | while (node && node.firstChild) { | ||
18829 | node = node.firstChild; | ||
18830 | } | ||
18831 | return node; | ||
18832 | } | ||
18833 | |||
18834 | /** | ||
18835 | * Get the next sibling within a container. This will walk up the | ||
18836 | * DOM if a node's siblings have been exhausted. | ||
18837 | * | ||
18838 | * @param {DOMElement|DOMTextNode} node | ||
18839 | * @return {?DOMElement|DOMTextNode} | ||
18840 | */ | ||
18841 | function getSiblingNode(node) { | ||
18842 | while (node) { | ||
18843 | if (node.nextSibling) { | ||
18844 | return node.nextSibling; | ||
18845 | } | ||
18846 | node = node.parentNode; | ||
18847 | } | ||
18848 | } | ||
18849 | |||
18850 | /** | ||
18851 | * Get object describing the nodes which contain characters at offset. | ||
18852 | * | ||
18853 | * @param {DOMElement|DOMTextNode} root | ||
18854 | * @param {number} offset | ||
18855 | * @return {?object} | ||
18856 | */ | ||
18857 | function getNodeForCharacterOffset(root, offset) { | ||
18858 | var node = getLeafNode(root); | ||
18859 | var nodeStart = 0; | ||
18860 | var nodeEnd = 0; | ||
18861 | |||
18862 | while (node) { | ||
18863 | if (node.nodeType === 3) { | ||
18864 | nodeEnd = nodeStart + node.textContent.length; | ||
18865 | |||
18866 | if (nodeStart <= offset && nodeEnd >= offset) { | ||
18867 | return { | ||
18868 | node: node, | ||
18869 | offset: offset - nodeStart | ||
18870 | }; | ||
18871 | } | ||
18872 | |||
18873 | nodeStart = nodeEnd; | ||
18874 | } | ||
18875 | |||
18876 | node = getLeafNode(getSiblingNode(node)); | ||
18877 | } | ||
18878 | } | ||
18879 | |||
18880 | module.exports = getNodeForCharacterOffset; | ||
18881 | |||
18882 | /***/ }), | ||
18883 | /* 155 */ | ||
18884 | /***/ (function(module, exports, __webpack_require__) { | ||
18885 | |||
18886 | 'use strict'; | ||
18887 | |||
18888 | /** | ||
18889 | * Copyright (c) 2013-present, Facebook, Inc. | ||
18890 | * All rights reserved. | ||
18891 | * | ||
18892 | * This source code is licensed under the BSD-style license found in the | ||
18893 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18894 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18895 | * | ||
18896 | * | ||
18897 | */ | ||
18898 | |||
18899 | var isTextNode = __webpack_require__(156); | ||
18900 | |||
18901 | /*eslint-disable no-bitwise */ | ||
18902 | |||
18903 | /** | ||
18904 | * Checks if a given DOM node contains or is another DOM node. | ||
18905 | */ | ||
18906 | function containsNode(outerNode, innerNode) { | ||
18907 | if (!outerNode || !innerNode) { | ||
18908 | return false; | ||
18909 | } else if (outerNode === innerNode) { | ||
18910 | return true; | ||
18911 | } else if (isTextNode(outerNode)) { | ||
18912 | return false; | ||
18913 | } else if (isTextNode(innerNode)) { | ||
18914 | return containsNode(outerNode, innerNode.parentNode); | ||
18915 | } else if ('contains' in outerNode) { | ||
18916 | return outerNode.contains(innerNode); | ||
18917 | } else if (outerNode.compareDocumentPosition) { | ||
18918 | return !!(outerNode.compareDocumentPosition(innerNode) & 16); | ||
18919 | } else { | ||
18920 | return false; | ||
18921 | } | ||
18922 | } | ||
18923 | |||
18924 | module.exports = containsNode; | ||
18925 | |||
18926 | /***/ }), | ||
18927 | /* 156 */ | ||
18928 | /***/ (function(module, exports, __webpack_require__) { | ||
18929 | |||
18930 | 'use strict'; | ||
18931 | |||
18932 | /** | ||
18933 | * Copyright (c) 2013-present, Facebook, Inc. | ||
18934 | * All rights reserved. | ||
18935 | * | ||
18936 | * This source code is licensed under the BSD-style license found in the | ||
18937 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18938 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18939 | * | ||
18940 | * @typechecks | ||
18941 | */ | ||
18942 | |||
18943 | var isNode = __webpack_require__(157); | ||
18944 | |||
18945 | /** | ||
18946 | * @param {*} object The object to check. | ||
18947 | * @return {boolean} Whether or not the object is a DOM text node. | ||
18948 | */ | ||
18949 | function isTextNode(object) { | ||
18950 | return isNode(object) && object.nodeType == 3; | ||
18951 | } | ||
18952 | |||
18953 | module.exports = isTextNode; | ||
18954 | |||
18955 | /***/ }), | ||
18956 | /* 157 */ | ||
18957 | /***/ (function(module, exports) { | ||
18958 | |||
18959 | 'use strict'; | ||
18960 | |||
18961 | /** | ||
18962 | * Copyright (c) 2013-present, Facebook, Inc. | ||
18963 | * All rights reserved. | ||
18964 | * | ||
18965 | * This source code is licensed under the BSD-style license found in the | ||
18966 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18967 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18968 | * | ||
18969 | * @typechecks | ||
18970 | */ | ||
18971 | |||
18972 | /** | ||
18973 | * @param {*} object The object to check. | ||
18974 | * @return {boolean} Whether or not the object is a DOM node. | ||
18975 | */ | ||
18976 | function isNode(object) { | ||
18977 | var doc = object ? object.ownerDocument || object : document; | ||
18978 | var defaultView = doc.defaultView || window; | ||
18979 | return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); | ||
18980 | } | ||
18981 | |||
18982 | module.exports = isNode; | ||
18983 | |||
18984 | /***/ }), | ||
18985 | /* 158 */ | ||
18986 | /***/ (function(module, exports) { | ||
18987 | |||
18988 | 'use strict'; | ||
18989 | |||
18990 | /** | ||
18991 | * Copyright (c) 2013-present, Facebook, Inc. | ||
18992 | * All rights reserved. | ||
18993 | * | ||
18994 | * This source code is licensed under the BSD-style license found in the | ||
18995 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18996 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18997 | * | ||
18998 | * @typechecks | ||
18999 | */ | ||
19000 | |||
19001 | /* eslint-disable fb-www/typeof-undefined */ | ||
19002 | |||
19003 | /** | ||
19004 | * Same as document.activeElement but wraps in a try-catch block. In IE it is | ||
19005 | * not safe to call document.activeElement if there is nothing focused. | ||
19006 | * | ||
19007 | * The activeElement will be null only if the document or document body is not | ||
19008 | * yet defined. | ||
19009 | * | ||
19010 | * @param {?DOMDocument} doc Defaults to current document. | ||
19011 | * @return {?DOMElement} | ||
19012 | */ | ||
19013 | function getActiveElement(doc) /*?DOMElement*/{ | ||
19014 | doc = doc || (typeof document !== 'undefined' ? document : undefined); | ||
19015 | if (typeof doc === 'undefined') { | ||
19016 | return null; | ||
19017 | } | ||
19018 | try { | ||
19019 | return doc.activeElement || doc.body; | ||
19020 | } catch (e) { | ||
19021 | return doc.body; | ||
19022 | } | ||
19023 | } | ||
19024 | |||
19025 | module.exports = getActiveElement; | ||
19026 | |||
19027 | /***/ }), | ||
19028 | /* 159 */ | ||
19029 | /***/ (function(module, exports) { | ||
19030 | |||
19031 | /** | ||
19032 | * Copyright 2013-present, Facebook, Inc. | ||
19033 | * All rights reserved. | ||
19034 | * | ||
19035 | * This source code is licensed under the BSD-style license found in the | ||
19036 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19037 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19038 | * | ||
19039 | */ | ||
19040 | |||
19041 | 'use strict'; | ||
19042 | |||
19043 | var NS = { | ||
19044 | xlink: 'http://www.w3.org/1999/xlink', | ||
19045 | xml: 'http://www.w3.org/XML/1998/namespace' | ||
19046 | }; | ||
19047 | |||
19048 | // We use attributes for everything SVG so let's avoid some duplication and run | ||
19049 | // code instead. | ||
19050 | // The following are all specified in the HTML config already so we exclude here. | ||
19051 | // - class (as className) | ||
19052 | // - color | ||
19053 | // - height | ||
19054 | // - id | ||
19055 | // - lang | ||
19056 | // - max | ||
19057 | // - media | ||
19058 | // - method | ||
19059 | // - min | ||
19060 | // - name | ||
19061 | // - style | ||
19062 | // - target | ||
19063 | // - type | ||
19064 | // - width | ||
19065 | var ATTRS = { | ||
19066 | accentHeight: 'accent-height', | ||
19067 | accumulate: 0, | ||
19068 | additive: 0, | ||
19069 | alignmentBaseline: 'alignment-baseline', | ||
19070 | allowReorder: 'allowReorder', | ||
19071 | alphabetic: 0, | ||
19072 | amplitude: 0, | ||
19073 | arabicForm: 'arabic-form', | ||
19074 | ascent: 0, | ||
19075 | attributeName: 'attributeName', | ||
19076 | attributeType: 'attributeType', | ||
19077 | autoReverse: 'autoReverse', | ||
19078 | azimuth: 0, | ||
19079 | baseFrequency: 'baseFrequency', | ||
19080 | baseProfile: 'baseProfile', | ||
19081 | baselineShift: 'baseline-shift', | ||
19082 | bbox: 0, | ||
19083 | begin: 0, | ||
19084 | bias: 0, | ||
19085 | by: 0, | ||
19086 | calcMode: 'calcMode', | ||
19087 | capHeight: 'cap-height', | ||
19088 | clip: 0, | ||
19089 | clipPath: 'clip-path', | ||
19090 | clipRule: 'clip-rule', | ||
19091 | clipPathUnits: 'clipPathUnits', | ||
19092 | colorInterpolation: 'color-interpolation', | ||
19093 | colorInterpolationFilters: 'color-interpolation-filters', | ||
19094 | colorProfile: 'color-profile', | ||
19095 | colorRendering: 'color-rendering', | ||
19096 | contentScriptType: 'contentScriptType', | ||
19097 | contentStyleType: 'contentStyleType', | ||
19098 | cursor: 0, | ||
19099 | cx: 0, | ||
19100 | cy: 0, | ||
19101 | d: 0, | ||
19102 | decelerate: 0, | ||
19103 | descent: 0, | ||
19104 | diffuseConstant: 'diffuseConstant', | ||
19105 | direction: 0, | ||
19106 | display: 0, | ||
19107 | divisor: 0, | ||
19108 | dominantBaseline: 'dominant-baseline', | ||
19109 | dur: 0, | ||
19110 | dx: 0, | ||
19111 | dy: 0, | ||
19112 | edgeMode: 'edgeMode', | ||
19113 | elevation: 0, | ||
19114 | enableBackground: 'enable-background', | ||
19115 | end: 0, | ||
19116 | exponent: 0, | ||
19117 | externalResourcesRequired: 'externalResourcesRequired', | ||
19118 | fill: 0, | ||
19119 | fillOpacity: 'fill-opacity', | ||
19120 | fillRule: 'fill-rule', | ||
19121 | filter: 0, | ||
19122 | filterRes: 'filterRes', | ||
19123 | filterUnits: 'filterUnits', | ||
19124 | floodColor: 'flood-color', | ||
19125 | floodOpacity: 'flood-opacity', | ||
19126 | focusable: 0, | ||
19127 | fontFamily: 'font-family', | ||
19128 | fontSize: 'font-size', | ||
19129 | fontSizeAdjust: 'font-size-adjust', | ||
19130 | fontStretch: 'font-stretch', | ||
19131 | fontStyle: 'font-style', | ||
19132 | fontVariant: 'font-variant', | ||
19133 | fontWeight: 'font-weight', | ||
19134 | format: 0, | ||
19135 | from: 0, | ||
19136 | fx: 0, | ||
19137 | fy: 0, | ||
19138 | g1: 0, | ||
19139 | g2: 0, | ||
19140 | glyphName: 'glyph-name', | ||
19141 | glyphOrientationHorizontal: 'glyph-orientation-horizontal', | ||
19142 | glyphOrientationVertical: 'glyph-orientation-vertical', | ||
19143 | glyphRef: 'glyphRef', | ||
19144 | gradientTransform: 'gradientTransform', | ||
19145 | gradientUnits: 'gradientUnits', | ||
19146 | hanging: 0, | ||
19147 | horizAdvX: 'horiz-adv-x', | ||
19148 | horizOriginX: 'horiz-origin-x', | ||
19149 | ideographic: 0, | ||
19150 | imageRendering: 'image-rendering', | ||
19151 | 'in': 0, | ||
19152 | in2: 0, | ||
19153 | intercept: 0, | ||
19154 | k: 0, | ||
19155 | k1: 0, | ||
19156 | k2: 0, | ||
19157 | k3: 0, | ||
19158 | k4: 0, | ||
19159 | kernelMatrix: 'kernelMatrix', | ||
19160 | kernelUnitLength: 'kernelUnitLength', | ||
19161 | kerning: 0, | ||
19162 | keyPoints: 'keyPoints', | ||
19163 | keySplines: 'keySplines', | ||
19164 | keyTimes: 'keyTimes', | ||
19165 | lengthAdjust: 'lengthAdjust', | ||
19166 | letterSpacing: 'letter-spacing', | ||
19167 | lightingColor: 'lighting-color', | ||
19168 | limitingConeAngle: 'limitingConeAngle', | ||
19169 | local: 0, | ||
19170 | markerEnd: 'marker-end', | ||
19171 | markerMid: 'marker-mid', | ||
19172 | markerStart: 'marker-start', | ||
19173 | markerHeight: 'markerHeight', | ||
19174 | markerUnits: 'markerUnits', | ||
19175 | markerWidth: 'markerWidth', | ||
19176 | mask: 0, | ||
19177 | maskContentUnits: 'maskContentUnits', | ||
19178 | maskUnits: 'maskUnits', | ||
19179 | mathematical: 0, | ||
19180 | mode: 0, | ||
19181 | numOctaves: 'numOctaves', | ||
19182 | offset: 0, | ||
19183 | opacity: 0, | ||
19184 | operator: 0, | ||
19185 | order: 0, | ||
19186 | orient: 0, | ||
19187 | orientation: 0, | ||
19188 | origin: 0, | ||
19189 | overflow: 0, | ||
19190 | overlinePosition: 'overline-position', | ||
19191 | overlineThickness: 'overline-thickness', | ||
19192 | paintOrder: 'paint-order', | ||
19193 | panose1: 'panose-1', | ||
19194 | pathLength: 'pathLength', | ||
19195 | patternContentUnits: 'patternContentUnits', | ||
19196 | patternTransform: 'patternTransform', | ||
19197 | patternUnits: 'patternUnits', | ||
19198 | pointerEvents: 'pointer-events', | ||
19199 | points: 0, | ||
19200 | pointsAtX: 'pointsAtX', | ||
19201 | pointsAtY: 'pointsAtY', | ||
19202 | pointsAtZ: 'pointsAtZ', | ||
19203 | preserveAlpha: 'preserveAlpha', | ||
19204 | preserveAspectRatio: 'preserveAspectRatio', | ||
19205 | primitiveUnits: 'primitiveUnits', | ||
19206 | r: 0, | ||
19207 | radius: 0, | ||
19208 | refX: 'refX', | ||
19209 | refY: 'refY', | ||
19210 | renderingIntent: 'rendering-intent', | ||
19211 | repeatCount: 'repeatCount', | ||
19212 | repeatDur: 'repeatDur', | ||
19213 | requiredExtensions: 'requiredExtensions', | ||
19214 | requiredFeatures: 'requiredFeatures', | ||
19215 | restart: 0, | ||
19216 | result: 0, | ||
19217 | rotate: 0, | ||
19218 | rx: 0, | ||
19219 | ry: 0, | ||
19220 | scale: 0, | ||
19221 | seed: 0, | ||
19222 | shapeRendering: 'shape-rendering', | ||
19223 | slope: 0, | ||
19224 | spacing: 0, | ||
19225 | specularConstant: 'specularConstant', | ||
19226 | specularExponent: 'specularExponent', | ||
19227 | speed: 0, | ||
19228 | spreadMethod: 'spreadMethod', | ||
19229 | startOffset: 'startOffset', | ||
19230 | stdDeviation: 'stdDeviation', | ||
19231 | stemh: 0, | ||
19232 | stemv: 0, | ||
19233 | stitchTiles: 'stitchTiles', | ||
19234 | stopColor: 'stop-color', | ||
19235 | stopOpacity: 'stop-opacity', | ||
19236 | strikethroughPosition: 'strikethrough-position', | ||
19237 | strikethroughThickness: 'strikethrough-thickness', | ||
19238 | string: 0, | ||
19239 | stroke: 0, | ||
19240 | strokeDasharray: 'stroke-dasharray', | ||
19241 | strokeDashoffset: 'stroke-dashoffset', | ||
19242 | strokeLinecap: 'stroke-linecap', | ||
19243 | strokeLinejoin: 'stroke-linejoin', | ||
19244 | strokeMiterlimit: 'stroke-miterlimit', | ||
19245 | strokeOpacity: 'stroke-opacity', | ||
19246 | strokeWidth: 'stroke-width', | ||
19247 | surfaceScale: 'surfaceScale', | ||
19248 | systemLanguage: 'systemLanguage', | ||
19249 | tableValues: 'tableValues', | ||
19250 | targetX: 'targetX', | ||
19251 | targetY: 'targetY', | ||
19252 | textAnchor: 'text-anchor', | ||
19253 | textDecoration: 'text-decoration', | ||
19254 | textRendering: 'text-rendering', | ||
19255 | textLength: 'textLength', | ||
19256 | to: 0, | ||
19257 | transform: 0, | ||
19258 | u1: 0, | ||
19259 | u2: 0, | ||
19260 | underlinePosition: 'underline-position', | ||
19261 | underlineThickness: 'underline-thickness', | ||
19262 | unicode: 0, | ||
19263 | unicodeBidi: 'unicode-bidi', | ||
19264 | unicodeRange: 'unicode-range', | ||
19265 | unitsPerEm: 'units-per-em', | ||
19266 | vAlphabetic: 'v-alphabetic', | ||
19267 | vHanging: 'v-hanging', | ||
19268 | vIdeographic: 'v-ideographic', | ||
19269 | vMathematical: 'v-mathematical', | ||
19270 | values: 0, | ||
19271 | vectorEffect: 'vector-effect', | ||
19272 | version: 0, | ||
19273 | vertAdvY: 'vert-adv-y', | ||
19274 | vertOriginX: 'vert-origin-x', | ||
19275 | vertOriginY: 'vert-origin-y', | ||
19276 | viewBox: 'viewBox', | ||
19277 | viewTarget: 'viewTarget', | ||
19278 | visibility: 0, | ||
19279 | widths: 0, | ||
19280 | wordSpacing: 'word-spacing', | ||
19281 | writingMode: 'writing-mode', | ||
19282 | x: 0, | ||
19283 | xHeight: 'x-height', | ||
19284 | x1: 0, | ||
19285 | x2: 0, | ||
19286 | xChannelSelector: 'xChannelSelector', | ||
19287 | xlinkActuate: 'xlink:actuate', | ||
19288 | xlinkArcrole: 'xlink:arcrole', | ||
19289 | xlinkHref: 'xlink:href', | ||
19290 | xlinkRole: 'xlink:role', | ||
19291 | xlinkShow: 'xlink:show', | ||
19292 | xlinkTitle: 'xlink:title', | ||
19293 | xlinkType: 'xlink:type', | ||
19294 | xmlBase: 'xml:base', | ||
19295 | xmlns: 0, | ||
19296 | xmlnsXlink: 'xmlns:xlink', | ||
19297 | xmlLang: 'xml:lang', | ||
19298 | xmlSpace: 'xml:space', | ||
19299 | y: 0, | ||
19300 | y1: 0, | ||
19301 | y2: 0, | ||
19302 | yChannelSelector: 'yChannelSelector', | ||
19303 | z: 0, | ||
19304 | zoomAndPan: 'zoomAndPan' | ||
19305 | }; | ||
19306 | |||
19307 | var SVGDOMPropertyConfig = { | ||
19308 | Properties: {}, | ||
19309 | DOMAttributeNamespaces: { | ||
19310 | xlinkActuate: NS.xlink, | ||
19311 | xlinkArcrole: NS.xlink, | ||
19312 | xlinkHref: NS.xlink, | ||
19313 | xlinkRole: NS.xlink, | ||
19314 | xlinkShow: NS.xlink, | ||
19315 | xlinkTitle: NS.xlink, | ||
19316 | xlinkType: NS.xlink, | ||
19317 | xmlBase: NS.xml, | ||
19318 | xmlLang: NS.xml, | ||
19319 | xmlSpace: NS.xml | ||
19320 | }, | ||
19321 | DOMAttributeNames: {} | ||
19322 | }; | ||
19323 | |||
19324 | Object.keys(ATTRS).forEach(function (key) { | ||
19325 | SVGDOMPropertyConfig.Properties[key] = 0; | ||
19326 | if (ATTRS[key]) { | ||
19327 | SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key]; | ||
19328 | } | ||
19329 | }); | ||
19330 | |||
19331 | module.exports = SVGDOMPropertyConfig; | ||
19332 | |||
19333 | /***/ }), | ||
19334 | /* 160 */ | ||
19335 | /***/ (function(module, exports, __webpack_require__) { | ||
19336 | |||
19337 | /** | ||
19338 | * Copyright 2013-present, Facebook, Inc. | ||
19339 | * All rights reserved. | ||
19340 | * | ||
19341 | * This source code is licensed under the BSD-style license found in the | ||
19342 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19343 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19344 | * | ||
19345 | */ | ||
19346 | |||
19347 | 'use strict'; | ||
19348 | |||
19349 | var EventPropagators = __webpack_require__(47); | ||
19350 | var ExecutionEnvironment = __webpack_require__(54); | ||
19351 | var ReactDOMComponentTree = __webpack_require__(40); | ||
19352 | var ReactInputSelection = __webpack_require__(152); | ||
19353 | var SyntheticEvent = __webpack_require__(59); | ||
19354 | |||
19355 | var getActiveElement = __webpack_require__(158); | ||
19356 | var isTextInputElement = __webpack_require__(77); | ||
19357 | var shallowEqual = __webpack_require__(129); | ||
19358 | |||
19359 | var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11; | ||
19360 | |||
19361 | var eventTypes = { | ||
19362 | select: { | ||
19363 | phasedRegistrationNames: { | ||
19364 | bubbled: 'onSelect', | ||
19365 | captured: 'onSelectCapture' | ||
19366 | }, | ||
19367 | dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange'] | ||
19368 | } | ||
19369 | }; | ||
19370 | |||
19371 | var activeElement = null; | ||
19372 | var activeElementInst = null; | ||
19373 | var lastSelection = null; | ||
19374 | var mouseDown = false; | ||
19375 | |||
19376 | // Track whether a listener exists for this plugin. If none exist, we do | ||
19377 | // not extract events. See #3639. | ||
19378 | var hasListener = false; | ||
19379 | |||
19380 | /** | ||
19381 | * Get an object which is a unique representation of the current selection. | ||
19382 | * | ||
19383 | * The return value will not be consistent across nodes or browsers, but | ||
19384 | * two identical selections on the same node will return identical objects. | ||
19385 | * | ||
19386 | * @param {DOMElement} node | ||
19387 | * @return {object} | ||
19388 | */ | ||
19389 | function getSelection(node) { | ||
19390 | if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) { | ||
19391 | return { | ||
19392 | start: node.selectionStart, | ||
19393 | end: node.selectionEnd | ||
19394 | }; | ||
19395 | } else if (window.getSelection) { | ||
19396 | var selection = window.getSelection(); | ||
19397 | return { | ||
19398 | anchorNode: selection.anchorNode, | ||
19399 | anchorOffset: selection.anchorOffset, | ||
19400 | focusNode: selection.focusNode, | ||
19401 | focusOffset: selection.focusOffset | ||
19402 | }; | ||
19403 | } else if (document.selection) { | ||
19404 | var range = document.selection.createRange(); | ||
19405 | return { | ||
19406 | parentElement: range.parentElement(), | ||
19407 | text: range.text, | ||
19408 | top: range.boundingTop, | ||
19409 | left: range.boundingLeft | ||
19410 | }; | ||
19411 | } | ||
19412 | } | ||
19413 | |||
19414 | /** | ||
19415 | * Poll selection to see whether it's changed. | ||
19416 | * | ||
19417 | * @param {object} nativeEvent | ||
19418 | * @return {?SyntheticEvent} | ||
19419 | */ | ||
19420 | function constructSelectEvent(nativeEvent, nativeEventTarget) { | ||
19421 | // Ensure we have the right element, and that the user is not dragging a | ||
19422 | // selection (this matches native `select` event behavior). In HTML5, select | ||
19423 | // fires only on input and textarea thus if there's no focused element we | ||
19424 | // won't dispatch. | ||
19425 | if (mouseDown || activeElement == null || activeElement !== getActiveElement()) { | ||
19426 | return null; | ||
19427 | } | ||
19428 | |||
19429 | // Only fire when selection has actually changed. | ||
19430 | var currentSelection = getSelection(activeElement); | ||
19431 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { | ||
19432 | lastSelection = currentSelection; | ||
19433 | |||
19434 | var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget); | ||
19435 | |||
19436 | syntheticEvent.type = 'select'; | ||
19437 | syntheticEvent.target = activeElement; | ||
19438 | |||
19439 | EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent); | ||
19440 | |||
19441 | return syntheticEvent; | ||
19442 | } | ||
19443 | |||
19444 | return null; | ||
19445 | } | ||
19446 | |||
19447 | /** | ||
19448 | * This plugin creates an `onSelect` event that normalizes select events | ||
19449 | * across form elements. | ||
19450 | * | ||
19451 | * Supported elements are: | ||
19452 | * - input (see `isTextInputElement`) | ||
19453 | * - textarea | ||
19454 | * - contentEditable | ||
19455 | * | ||
19456 | * This differs from native browser implementations in the following ways: | ||
19457 | * - Fires on contentEditable fields as well as inputs. | ||
19458 | * - Fires for collapsed selection. | ||
19459 | * - Fires after user input. | ||
19460 | */ | ||
19461 | var SelectEventPlugin = { | ||
19462 | |||
19463 | eventTypes: eventTypes, | ||
19464 | |||
19465 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
19466 | if (!hasListener) { | ||
19467 | return null; | ||
19468 | } | ||
19469 | |||
19470 | var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window; | ||
19471 | |||
19472 | switch (topLevelType) { | ||
19473 | // Track the input node that has focus. | ||
19474 | case 'topFocus': | ||
19475 | if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { | ||
19476 | activeElement = targetNode; | ||
19477 | activeElementInst = targetInst; | ||
19478 | lastSelection = null; | ||
19479 | } | ||
19480 | break; | ||
19481 | case 'topBlur': | ||
19482 | activeElement = null; | ||
19483 | activeElementInst = null; | ||
19484 | lastSelection = null; | ||
19485 | break; | ||
19486 | |||
19487 | // Don't fire the event while the user is dragging. This matches the | ||
19488 | // semantics of the native select event. | ||
19489 | case 'topMouseDown': | ||
19490 | mouseDown = true; | ||
19491 | break; | ||
19492 | case 'topContextMenu': | ||
19493 | case 'topMouseUp': | ||
19494 | mouseDown = false; | ||
19495 | return constructSelectEvent(nativeEvent, nativeEventTarget); | ||
19496 | |||
19497 | // Chrome and IE fire non-standard event when selection is changed (and | ||
19498 | // sometimes when it hasn't). IE's event fires out of order with respect | ||
19499 | // to key and input events on deletion, so we discard it. | ||
19500 | // | ||
19501 | // Firefox doesn't support selectionchange, so check selection status | ||
19502 | // after each key entry. The selection changes after keydown and before | ||
19503 | // keyup, but we check on keydown as well in the case of holding down a | ||
19504 | // key, when multiple keydown events are fired but only one keyup is. | ||
19505 | // This is also our approach for IE handling, for the reason above. | ||
19506 | case 'topSelectionChange': | ||
19507 | if (skipSelectionChangeEvent) { | ||
19508 | break; | ||
19509 | } | ||
19510 | // falls through | ||
19511 | case 'topKeyDown': | ||
19512 | case 'topKeyUp': | ||
19513 | return constructSelectEvent(nativeEvent, nativeEventTarget); | ||
19514 | } | ||
19515 | |||
19516 | return null; | ||
19517 | }, | ||
19518 | |||
19519 | didPutListener: function (inst, registrationName, listener) { | ||
19520 | if (registrationName === 'onSelect') { | ||
19521 | hasListener = true; | ||
19522 | } | ||
19523 | } | ||
19524 | }; | ||
19525 | |||
19526 | module.exports = SelectEventPlugin; | ||
19527 | |||
19528 | /***/ }), | ||
19529 | /* 161 */ | ||
19530 | /***/ (function(module, exports, __webpack_require__) { | ||
19531 | |||
19532 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
19533 | * Copyright 2013-present, Facebook, Inc. | ||
19534 | * All rights reserved. | ||
19535 | * | ||
19536 | * This source code is licensed under the BSD-style license found in the | ||
19537 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19538 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19539 | * | ||
19540 | * | ||
19541 | */ | ||
19542 | |||
19543 | 'use strict'; | ||
19544 | |||
19545 | var _prodInvariant = __webpack_require__(41); | ||
19546 | |||
19547 | var EventListener = __webpack_require__(148); | ||
19548 | var EventPropagators = __webpack_require__(47); | ||
19549 | var ReactDOMComponentTree = __webpack_require__(40); | ||
19550 | var SyntheticAnimationEvent = __webpack_require__(162); | ||
19551 | var SyntheticClipboardEvent = __webpack_require__(163); | ||
19552 | var SyntheticEvent = __webpack_require__(59); | ||
19553 | var SyntheticFocusEvent = __webpack_require__(164); | ||
19554 | var SyntheticKeyboardEvent = __webpack_require__(165); | ||
19555 | var SyntheticMouseEvent = __webpack_require__(80); | ||
19556 | var SyntheticDragEvent = __webpack_require__(168); | ||
19557 | var SyntheticTouchEvent = __webpack_require__(169); | ||
19558 | var SyntheticTransitionEvent = __webpack_require__(170); | ||
19559 | var SyntheticUIEvent = __webpack_require__(81); | ||
19560 | var SyntheticWheelEvent = __webpack_require__(171); | ||
19561 | |||
19562 | var emptyFunction = __webpack_require__(14); | ||
19563 | var getEventCharCode = __webpack_require__(166); | ||
19564 | var invariant = __webpack_require__(10); | ||
19565 | |||
19566 | /** | ||
19567 | * Turns | ||
19568 | * ['abort', ...] | ||
19569 | * into | ||
19570 | * eventTypes = { | ||
19571 | * 'abort': { | ||
19572 | * phasedRegistrationNames: { | ||
19573 | * bubbled: 'onAbort', | ||
19574 | * captured: 'onAbortCapture', | ||
19575 | * }, | ||
19576 | * dependencies: ['topAbort'], | ||
19577 | * }, | ||
19578 | * ... | ||
19579 | * }; | ||
19580 | * topLevelEventsToDispatchConfig = { | ||
19581 | * 'topAbort': { sameConfig } | ||
19582 | * }; | ||
19583 | */ | ||
19584 | var eventTypes = {}; | ||
19585 | var topLevelEventsToDispatchConfig = {}; | ||
19586 | ['abort', 'animationEnd', 'animationIteration', 'animationStart', 'blur', 'canPlay', 'canPlayThrough', 'click', 'contextMenu', 'copy', 'cut', 'doubleClick', 'drag', 'dragEnd', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'dragStart', 'drop', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'mouseDown', 'mouseMove', 'mouseOut', 'mouseOver', 'mouseUp', 'paste', 'pause', 'play', 'playing', 'progress', 'rateChange', 'reset', 'scroll', 'seeked', 'seeking', 'stalled', 'submit', 'suspend', 'timeUpdate', 'touchCancel', 'touchEnd', 'touchMove', 'touchStart', 'transitionEnd', 'volumeChange', 'waiting', 'wheel'].forEach(function (event) { | ||
19587 | var capitalizedEvent = event[0].toUpperCase() + event.slice(1); | ||
19588 | var onEvent = 'on' + capitalizedEvent; | ||
19589 | var topEvent = 'top' + capitalizedEvent; | ||
19590 | |||
19591 | var type = { | ||
19592 | phasedRegistrationNames: { | ||
19593 | bubbled: onEvent, | ||
19594 | captured: onEvent + 'Capture' | ||
19595 | }, | ||
19596 | dependencies: [topEvent] | ||
19597 | }; | ||
19598 | eventTypes[event] = type; | ||
19599 | topLevelEventsToDispatchConfig[topEvent] = type; | ||
19600 | }); | ||
19601 | |||
19602 | var onClickListeners = {}; | ||
19603 | |||
19604 | function getDictionaryKey(inst) { | ||
19605 | // Prevents V8 performance issue: | ||
19606 | // https://github.com/facebook/react/pull/7232 | ||
19607 | return '.' + inst._rootNodeID; | ||
19608 | } | ||
19609 | |||
19610 | function isInteractive(tag) { | ||
19611 | return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; | ||
19612 | } | ||
19613 | |||
19614 | var SimpleEventPlugin = { | ||
19615 | |||
19616 | eventTypes: eventTypes, | ||
19617 | |||
19618 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
19619 | var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; | ||
19620 | if (!dispatchConfig) { | ||
19621 | return null; | ||
19622 | } | ||
19623 | var EventConstructor; | ||
19624 | switch (topLevelType) { | ||
19625 | case 'topAbort': | ||
19626 | case 'topCanPlay': | ||
19627 | case 'topCanPlayThrough': | ||
19628 | case 'topDurationChange': | ||
19629 | case 'topEmptied': | ||
19630 | case 'topEncrypted': | ||
19631 | case 'topEnded': | ||
19632 | case 'topError': | ||
19633 | case 'topInput': | ||
19634 | case 'topInvalid': | ||
19635 | case 'topLoad': | ||
19636 | case 'topLoadedData': | ||
19637 | case 'topLoadedMetadata': | ||
19638 | case 'topLoadStart': | ||
19639 | case 'topPause': | ||
19640 | case 'topPlay': | ||
19641 | case 'topPlaying': | ||
19642 | case 'topProgress': | ||
19643 | case 'topRateChange': | ||
19644 | case 'topReset': | ||
19645 | case 'topSeeked': | ||
19646 | case 'topSeeking': | ||
19647 | case 'topStalled': | ||
19648 | case 'topSubmit': | ||
19649 | case 'topSuspend': | ||
19650 | case 'topTimeUpdate': | ||
19651 | case 'topVolumeChange': | ||
19652 | case 'topWaiting': | ||
19653 | // HTML Events | ||
19654 | // @see http://www.w3.org/TR/html5/index.html#events-0 | ||
19655 | EventConstructor = SyntheticEvent; | ||
19656 | break; | ||
19657 | case 'topKeyPress': | ||
19658 | // Firefox creates a keypress event for function keys too. This removes | ||
19659 | // the unwanted keypress events. Enter is however both printable and | ||
19660 | // non-printable. One would expect Tab to be as well (but it isn't). | ||
19661 | if (getEventCharCode(nativeEvent) === 0) { | ||
19662 | return null; | ||
19663 | } | ||
19664 | /* falls through */ | ||
19665 | case 'topKeyDown': | ||
19666 | case 'topKeyUp': | ||
19667 | EventConstructor = SyntheticKeyboardEvent; | ||
19668 | break; | ||
19669 | case 'topBlur': | ||
19670 | case 'topFocus': | ||
19671 | EventConstructor = SyntheticFocusEvent; | ||
19672 | break; | ||
19673 | case 'topClick': | ||
19674 | // Firefox creates a click event on right mouse clicks. This removes the | ||
19675 | // unwanted click events. | ||
19676 | if (nativeEvent.button === 2) { | ||
19677 | return null; | ||
19678 | } | ||
19679 | /* falls through */ | ||
19680 | case 'topDoubleClick': | ||
19681 | case 'topMouseDown': | ||
19682 | case 'topMouseMove': | ||
19683 | case 'topMouseUp': | ||
19684 | // TODO: Disabled elements should not respond to mouse events | ||
19685 | /* falls through */ | ||
19686 | case 'topMouseOut': | ||
19687 | case 'topMouseOver': | ||
19688 | case 'topContextMenu': | ||
19689 | EventConstructor = SyntheticMouseEvent; | ||
19690 | break; | ||
19691 | case 'topDrag': | ||
19692 | case 'topDragEnd': | ||
19693 | case 'topDragEnter': | ||
19694 | case 'topDragExit': | ||
19695 | case 'topDragLeave': | ||
19696 | case 'topDragOver': | ||
19697 | case 'topDragStart': | ||
19698 | case 'topDrop': | ||
19699 | EventConstructor = SyntheticDragEvent; | ||
19700 | break; | ||
19701 | case 'topTouchCancel': | ||
19702 | case 'topTouchEnd': | ||
19703 | case 'topTouchMove': | ||
19704 | case 'topTouchStart': | ||
19705 | EventConstructor = SyntheticTouchEvent; | ||
19706 | break; | ||
19707 | case 'topAnimationEnd': | ||
19708 | case 'topAnimationIteration': | ||
19709 | case 'topAnimationStart': | ||
19710 | EventConstructor = SyntheticAnimationEvent; | ||
19711 | break; | ||
19712 | case 'topTransitionEnd': | ||
19713 | EventConstructor = SyntheticTransitionEvent; | ||
19714 | break; | ||
19715 | case 'topScroll': | ||
19716 | EventConstructor = SyntheticUIEvent; | ||
19717 | break; | ||
19718 | case 'topWheel': | ||
19719 | EventConstructor = SyntheticWheelEvent; | ||
19720 | break; | ||
19721 | case 'topCopy': | ||
19722 | case 'topCut': | ||
19723 | case 'topPaste': | ||
19724 | EventConstructor = SyntheticClipboardEvent; | ||
19725 | break; | ||
19726 | } | ||
19727 | !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0; | ||
19728 | var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget); | ||
19729 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
19730 | return event; | ||
19731 | }, | ||
19732 | |||
19733 | didPutListener: function (inst, registrationName, listener) { | ||
19734 | // Mobile Safari does not fire properly bubble click events on | ||
19735 | // non-interactive elements, which means delegated click listeners do not | ||
19736 | // fire. The workaround for this bug involves attaching an empty click | ||
19737 | // listener on the target node. | ||
19738 | // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html | ||
19739 | if (registrationName === 'onClick' && !isInteractive(inst._tag)) { | ||
19740 | var key = getDictionaryKey(inst); | ||
19741 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
19742 | if (!onClickListeners[key]) { | ||
19743 | onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction); | ||
19744 | } | ||
19745 | } | ||
19746 | }, | ||
19747 | |||
19748 | willDeleteListener: function (inst, registrationName) { | ||
19749 | if (registrationName === 'onClick' && !isInteractive(inst._tag)) { | ||
19750 | var key = getDictionaryKey(inst); | ||
19751 | onClickListeners[key].remove(); | ||
19752 | delete onClickListeners[key]; | ||
19753 | } | ||
19754 | } | ||
19755 | |||
19756 | }; | ||
19757 | |||
19758 | module.exports = SimpleEventPlugin; | ||
19759 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
19760 | |||
19761 | /***/ }), | ||
19762 | /* 162 */ | ||
19763 | /***/ (function(module, exports, __webpack_require__) { | ||
19764 | |||
19765 | /** | ||
19766 | * Copyright 2013-present, Facebook, Inc. | ||
19767 | * All rights reserved. | ||
19768 | * | ||
19769 | * This source code is licensed under the BSD-style license found in the | ||
19770 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19771 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19772 | * | ||
19773 | */ | ||
19774 | |||
19775 | 'use strict'; | ||
19776 | |||
19777 | var SyntheticEvent = __webpack_require__(59); | ||
19778 | |||
19779 | /** | ||
19780 | * @interface Event | ||
19781 | * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface | ||
19782 | * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent | ||
19783 | */ | ||
19784 | var AnimationEventInterface = { | ||
19785 | animationName: null, | ||
19786 | elapsedTime: null, | ||
19787 | pseudoElement: null | ||
19788 | }; | ||
19789 | |||
19790 | /** | ||
19791 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
19792 | * @param {string} dispatchMarker Marker identifying the event target. | ||
19793 | * @param {object} nativeEvent Native browser event. | ||
19794 | * @extends {SyntheticEvent} | ||
19795 | */ | ||
19796 | function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
19797 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
19798 | } | ||
19799 | |||
19800 | SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface); | ||
19801 | |||
19802 | module.exports = SyntheticAnimationEvent; | ||
19803 | |||
19804 | /***/ }), | ||
19805 | /* 163 */ | ||
19806 | /***/ (function(module, exports, __webpack_require__) { | ||
19807 | |||
19808 | /** | ||
19809 | * Copyright 2013-present, Facebook, Inc. | ||
19810 | * All rights reserved. | ||
19811 | * | ||
19812 | * This source code is licensed under the BSD-style license found in the | ||
19813 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19814 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19815 | * | ||
19816 | */ | ||
19817 | |||
19818 | 'use strict'; | ||
19819 | |||
19820 | var SyntheticEvent = __webpack_require__(59); | ||
19821 | |||
19822 | /** | ||
19823 | * @interface Event | ||
19824 | * @see http://www.w3.org/TR/clipboard-apis/ | ||
19825 | */ | ||
19826 | var ClipboardEventInterface = { | ||
19827 | clipboardData: function (event) { | ||
19828 | return 'clipboardData' in event ? event.clipboardData : window.clipboardData; | ||
19829 | } | ||
19830 | }; | ||
19831 | |||
19832 | /** | ||
19833 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
19834 | * @param {string} dispatchMarker Marker identifying the event target. | ||
19835 | * @param {object} nativeEvent Native browser event. | ||
19836 | * @extends {SyntheticUIEvent} | ||
19837 | */ | ||
19838 | function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
19839 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
19840 | } | ||
19841 | |||
19842 | SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); | ||
19843 | |||
19844 | module.exports = SyntheticClipboardEvent; | ||
19845 | |||
19846 | /***/ }), | ||
19847 | /* 164 */ | ||
19848 | /***/ (function(module, exports, __webpack_require__) { | ||
19849 | |||
19850 | /** | ||
19851 | * Copyright 2013-present, Facebook, Inc. | ||
19852 | * All rights reserved. | ||
19853 | * | ||
19854 | * This source code is licensed under the BSD-style license found in the | ||
19855 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19856 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19857 | * | ||
19858 | */ | ||
19859 | |||
19860 | 'use strict'; | ||
19861 | |||
19862 | var SyntheticUIEvent = __webpack_require__(81); | ||
19863 | |||
19864 | /** | ||
19865 | * @interface FocusEvent | ||
19866 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
19867 | */ | ||
19868 | var FocusEventInterface = { | ||
19869 | relatedTarget: null | ||
19870 | }; | ||
19871 | |||
19872 | /** | ||
19873 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
19874 | * @param {string} dispatchMarker Marker identifying the event target. | ||
19875 | * @param {object} nativeEvent Native browser event. | ||
19876 | * @extends {SyntheticUIEvent} | ||
19877 | */ | ||
19878 | function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
19879 | return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
19880 | } | ||
19881 | |||
19882 | SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); | ||
19883 | |||
19884 | module.exports = SyntheticFocusEvent; | ||
19885 | |||
19886 | /***/ }), | ||
19887 | /* 165 */ | ||
19888 | /***/ (function(module, exports, __webpack_require__) { | ||
19889 | |||
19890 | /** | ||
19891 | * Copyright 2013-present, Facebook, Inc. | ||
19892 | * All rights reserved. | ||
19893 | * | ||
19894 | * This source code is licensed under the BSD-style license found in the | ||
19895 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19896 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19897 | * | ||
19898 | */ | ||
19899 | |||
19900 | 'use strict'; | ||
19901 | |||
19902 | var SyntheticUIEvent = __webpack_require__(81); | ||
19903 | |||
19904 | var getEventCharCode = __webpack_require__(166); | ||
19905 | var getEventKey = __webpack_require__(167); | ||
19906 | var getEventModifierState = __webpack_require__(83); | ||
19907 | |||
19908 | /** | ||
19909 | * @interface KeyboardEvent | ||
19910 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
19911 | */ | ||
19912 | var KeyboardEventInterface = { | ||
19913 | key: getEventKey, | ||
19914 | location: null, | ||
19915 | ctrlKey: null, | ||
19916 | shiftKey: null, | ||
19917 | altKey: null, | ||
19918 | metaKey: null, | ||
19919 | repeat: null, | ||
19920 | locale: null, | ||
19921 | getModifierState: getEventModifierState, | ||
19922 | // Legacy Interface | ||
19923 | charCode: function (event) { | ||
19924 | // `charCode` is the result of a KeyPress event and represents the value of | ||
19925 | // the actual printable character. | ||
19926 | |||
19927 | // KeyPress is deprecated, but its replacement is not yet final and not | ||
19928 | // implemented in any major browser. Only KeyPress has charCode. | ||
19929 | if (event.type === 'keypress') { | ||
19930 | return getEventCharCode(event); | ||
19931 | } | ||
19932 | return 0; | ||
19933 | }, | ||
19934 | keyCode: function (event) { | ||
19935 | // `keyCode` is the result of a KeyDown/Up event and represents the value of | ||
19936 | // physical keyboard key. | ||
19937 | |||
19938 | // The actual meaning of the value depends on the users' keyboard layout | ||
19939 | // which cannot be detected. Assuming that it is a US keyboard layout | ||
19940 | // provides a surprisingly accurate mapping for US and European users. | ||
19941 | // Due to this, it is left to the user to implement at this time. | ||
19942 | if (event.type === 'keydown' || event.type === 'keyup') { | ||
19943 | return event.keyCode; | ||
19944 | } | ||
19945 | return 0; | ||
19946 | }, | ||
19947 | which: function (event) { | ||
19948 | // `which` is an alias for either `keyCode` or `charCode` depending on the | ||
19949 | // type of the event. | ||
19950 | if (event.type === 'keypress') { | ||
19951 | return getEventCharCode(event); | ||
19952 | } | ||
19953 | if (event.type === 'keydown' || event.type === 'keyup') { | ||
19954 | return event.keyCode; | ||
19955 | } | ||
19956 | return 0; | ||
19957 | } | ||
19958 | }; | ||
19959 | |||
19960 | /** | ||
19961 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
19962 | * @param {string} dispatchMarker Marker identifying the event target. | ||
19963 | * @param {object} nativeEvent Native browser event. | ||
19964 | * @extends {SyntheticUIEvent} | ||
19965 | */ | ||
19966 | function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
19967 | return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
19968 | } | ||
19969 | |||
19970 | SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); | ||
19971 | |||
19972 | module.exports = SyntheticKeyboardEvent; | ||
19973 | |||
19974 | /***/ }), | ||
19975 | /* 166 */ | ||
19976 | /***/ (function(module, exports) { | ||
19977 | |||
19978 | /** | ||
19979 | * Copyright 2013-present, Facebook, Inc. | ||
19980 | * All rights reserved. | ||
19981 | * | ||
19982 | * This source code is licensed under the BSD-style license found in the | ||
19983 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19984 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19985 | * | ||
19986 | */ | ||
19987 | |||
19988 | 'use strict'; | ||
19989 | |||
19990 | /** | ||
19991 | * `charCode` represents the actual "character code" and is safe to use with | ||
19992 | * `String.fromCharCode`. As such, only keys that correspond to printable | ||
19993 | * characters produce a valid `charCode`, the only exception to this is Enter. | ||
19994 | * The Tab-key is considered non-printable and does not have a `charCode`, | ||
19995 | * presumably because it does not produce a tab-character in browsers. | ||
19996 | * | ||
19997 | * @param {object} nativeEvent Native browser event. | ||
19998 | * @return {number} Normalized `charCode` property. | ||
19999 | */ | ||
20000 | |||
20001 | function getEventCharCode(nativeEvent) { | ||
20002 | var charCode; | ||
20003 | var keyCode = nativeEvent.keyCode; | ||
20004 | |||
20005 | if ('charCode' in nativeEvent) { | ||
20006 | charCode = nativeEvent.charCode; | ||
20007 | |||
20008 | // FF does not set `charCode` for the Enter-key, check against `keyCode`. | ||
20009 | if (charCode === 0 && keyCode === 13) { | ||
20010 | charCode = 13; | ||
20011 | } | ||
20012 | } else { | ||
20013 | // IE8 does not implement `charCode`, but `keyCode` has the correct value. | ||
20014 | charCode = keyCode; | ||
20015 | } | ||
20016 | |||
20017 | // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. | ||
20018 | // Must not discard the (non-)printable Enter-key. | ||
20019 | if (charCode >= 32 || charCode === 13) { | ||
20020 | return charCode; | ||
20021 | } | ||
20022 | |||
20023 | return 0; | ||
20024 | } | ||
20025 | |||
20026 | module.exports = getEventCharCode; | ||
20027 | |||
20028 | /***/ }), | ||
20029 | /* 167 */ | ||
20030 | /***/ (function(module, exports, __webpack_require__) { | ||
20031 | |||
20032 | /** | ||
20033 | * Copyright 2013-present, Facebook, Inc. | ||
20034 | * All rights reserved. | ||
20035 | * | ||
20036 | * This source code is licensed under the BSD-style license found in the | ||
20037 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20038 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20039 | * | ||
20040 | */ | ||
20041 | |||
20042 | 'use strict'; | ||
20043 | |||
20044 | var getEventCharCode = __webpack_require__(166); | ||
20045 | |||
20046 | /** | ||
20047 | * Normalization of deprecated HTML5 `key` values | ||
20048 | * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names | ||
20049 | */ | ||
20050 | var normalizeKey = { | ||
20051 | 'Esc': 'Escape', | ||
20052 | 'Spacebar': ' ', | ||
20053 | 'Left': 'ArrowLeft', | ||
20054 | 'Up': 'ArrowUp', | ||
20055 | 'Right': 'ArrowRight', | ||
20056 | 'Down': 'ArrowDown', | ||
20057 | 'Del': 'Delete', | ||
20058 | 'Win': 'OS', | ||
20059 | 'Menu': 'ContextMenu', | ||
20060 | 'Apps': 'ContextMenu', | ||
20061 | 'Scroll': 'ScrollLock', | ||
20062 | 'MozPrintableKey': 'Unidentified' | ||
20063 | }; | ||
20064 | |||
20065 | /** | ||
20066 | * Translation from legacy `keyCode` to HTML5 `key` | ||
20067 | * Only special keys supported, all others depend on keyboard layout or browser | ||
20068 | * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names | ||
20069 | */ | ||
20070 | var translateToKey = { | ||
20071 | 8: 'Backspace', | ||
20072 | 9: 'Tab', | ||
20073 | 12: 'Clear', | ||
20074 | 13: 'Enter', | ||
20075 | 16: 'Shift', | ||
20076 | 17: 'Control', | ||
20077 | 18: 'Alt', | ||
20078 | 19: 'Pause', | ||
20079 | 20: 'CapsLock', | ||
20080 | 27: 'Escape', | ||
20081 | 32: ' ', | ||
20082 | 33: 'PageUp', | ||
20083 | 34: 'PageDown', | ||
20084 | 35: 'End', | ||
20085 | 36: 'Home', | ||
20086 | 37: 'ArrowLeft', | ||
20087 | 38: 'ArrowUp', | ||
20088 | 39: 'ArrowRight', | ||
20089 | 40: 'ArrowDown', | ||
20090 | 45: 'Insert', | ||
20091 | 46: 'Delete', | ||
20092 | 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6', | ||
20093 | 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12', | ||
20094 | 144: 'NumLock', | ||
20095 | 145: 'ScrollLock', | ||
20096 | 224: 'Meta' | ||
20097 | }; | ||
20098 | |||
20099 | /** | ||
20100 | * @param {object} nativeEvent Native browser event. | ||
20101 | * @return {string} Normalized `key` property. | ||
20102 | */ | ||
20103 | function getEventKey(nativeEvent) { | ||
20104 | if (nativeEvent.key) { | ||
20105 | // Normalize inconsistent values reported by browsers due to | ||
20106 | // implementations of a working draft specification. | ||
20107 | |||
20108 | // FireFox implements `key` but returns `MozPrintableKey` for all | ||
20109 | // printable characters (normalized to `Unidentified`), ignore it. | ||
20110 | var key = normalizeKey[nativeEvent.key] || nativeEvent.key; | ||
20111 | if (key !== 'Unidentified') { | ||
20112 | return key; | ||
20113 | } | ||
20114 | } | ||
20115 | |||
20116 | // Browser does not implement `key`, polyfill as much of it as we can. | ||
20117 | if (nativeEvent.type === 'keypress') { | ||
20118 | var charCode = getEventCharCode(nativeEvent); | ||
20119 | |||
20120 | // The enter-key is technically both printable and non-printable and can | ||
20121 | // thus be captured by `keypress`, no other non-printable key should. | ||
20122 | return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); | ||
20123 | } | ||
20124 | if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { | ||
20125 | // While user keyboard layout determines the actual meaning of each | ||
20126 | // `keyCode` value, almost all function keys have a universal value. | ||
20127 | return translateToKey[nativeEvent.keyCode] || 'Unidentified'; | ||
20128 | } | ||
20129 | return ''; | ||
20130 | } | ||
20131 | |||
20132 | module.exports = getEventKey; | ||
20133 | |||
20134 | /***/ }), | ||
20135 | /* 168 */ | ||
20136 | /***/ (function(module, exports, __webpack_require__) { | ||
20137 | |||
20138 | /** | ||
20139 | * Copyright 2013-present, Facebook, Inc. | ||
20140 | * All rights reserved. | ||
20141 | * | ||
20142 | * This source code is licensed under the BSD-style license found in the | ||
20143 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20144 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20145 | * | ||
20146 | */ | ||
20147 | |||
20148 | 'use strict'; | ||
20149 | |||
20150 | var SyntheticMouseEvent = __webpack_require__(80); | ||
20151 | |||
20152 | /** | ||
20153 | * @interface DragEvent | ||
20154 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
20155 | */ | ||
20156 | var DragEventInterface = { | ||
20157 | dataTransfer: null | ||
20158 | }; | ||
20159 | |||
20160 | /** | ||
20161 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
20162 | * @param {string} dispatchMarker Marker identifying the event target. | ||
20163 | * @param {object} nativeEvent Native browser event. | ||
20164 | * @extends {SyntheticUIEvent} | ||
20165 | */ | ||
20166 | function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
20167 | return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
20168 | } | ||
20169 | |||
20170 | SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); | ||
20171 | |||
20172 | module.exports = SyntheticDragEvent; | ||
20173 | |||
20174 | /***/ }), | ||
20175 | /* 169 */ | ||
20176 | /***/ (function(module, exports, __webpack_require__) { | ||
20177 | |||
20178 | /** | ||
20179 | * Copyright 2013-present, Facebook, Inc. | ||
20180 | * All rights reserved. | ||
20181 | * | ||
20182 | * This source code is licensed under the BSD-style license found in the | ||
20183 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20184 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20185 | * | ||
20186 | */ | ||
20187 | |||
20188 | 'use strict'; | ||
20189 | |||
20190 | var SyntheticUIEvent = __webpack_require__(81); | ||
20191 | |||
20192 | var getEventModifierState = __webpack_require__(83); | ||
20193 | |||
20194 | /** | ||
20195 | * @interface TouchEvent | ||
20196 | * @see http://www.w3.org/TR/touch-events/ | ||
20197 | */ | ||
20198 | var TouchEventInterface = { | ||
20199 | touches: null, | ||
20200 | targetTouches: null, | ||
20201 | changedTouches: null, | ||
20202 | altKey: null, | ||
20203 | metaKey: null, | ||
20204 | ctrlKey: null, | ||
20205 | shiftKey: null, | ||
20206 | getModifierState: getEventModifierState | ||
20207 | }; | ||
20208 | |||
20209 | /** | ||
20210 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
20211 | * @param {string} dispatchMarker Marker identifying the event target. | ||
20212 | * @param {object} nativeEvent Native browser event. | ||
20213 | * @extends {SyntheticUIEvent} | ||
20214 | */ | ||
20215 | function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
20216 | return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
20217 | } | ||
20218 | |||
20219 | SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); | ||
20220 | |||
20221 | module.exports = SyntheticTouchEvent; | ||
20222 | |||
20223 | /***/ }), | ||
20224 | /* 170 */ | ||
20225 | /***/ (function(module, exports, __webpack_require__) { | ||
20226 | |||
20227 | /** | ||
20228 | * Copyright 2013-present, Facebook, Inc. | ||
20229 | * All rights reserved. | ||
20230 | * | ||
20231 | * This source code is licensed under the BSD-style license found in the | ||
20232 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20233 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20234 | * | ||
20235 | */ | ||
20236 | |||
20237 | 'use strict'; | ||
20238 | |||
20239 | var SyntheticEvent = __webpack_require__(59); | ||
20240 | |||
20241 | /** | ||
20242 | * @interface Event | ||
20243 | * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- | ||
20244 | * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent | ||
20245 | */ | ||
20246 | var TransitionEventInterface = { | ||
20247 | propertyName: null, | ||
20248 | elapsedTime: null, | ||
20249 | pseudoElement: null | ||
20250 | }; | ||
20251 | |||
20252 | /** | ||
20253 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
20254 | * @param {string} dispatchMarker Marker identifying the event target. | ||
20255 | * @param {object} nativeEvent Native browser event. | ||
20256 | * @extends {SyntheticEvent} | ||
20257 | */ | ||
20258 | function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
20259 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
20260 | } | ||
20261 | |||
20262 | SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface); | ||
20263 | |||
20264 | module.exports = SyntheticTransitionEvent; | ||
20265 | |||
20266 | /***/ }), | ||
20267 | /* 171 */ | ||
20268 | /***/ (function(module, exports, __webpack_require__) { | ||
20269 | |||
20270 | /** | ||
20271 | * Copyright 2013-present, Facebook, Inc. | ||
20272 | * All rights reserved. | ||
20273 | * | ||
20274 | * This source code is licensed under the BSD-style license found in the | ||
20275 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20276 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20277 | * | ||
20278 | */ | ||
20279 | |||
20280 | 'use strict'; | ||
20281 | |||
20282 | var SyntheticMouseEvent = __webpack_require__(80); | ||
20283 | |||
20284 | /** | ||
20285 | * @interface WheelEvent | ||
20286 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
20287 | */ | ||
20288 | var WheelEventInterface = { | ||
20289 | deltaX: function (event) { | ||
20290 | return 'deltaX' in event ? event.deltaX : | ||
20291 | // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). | ||
20292 | 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; | ||
20293 | }, | ||
20294 | deltaY: function (event) { | ||
20295 | return 'deltaY' in event ? event.deltaY : | ||
20296 | // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). | ||
20297 | 'wheelDeltaY' in event ? -event.wheelDeltaY : | ||
20298 | // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). | ||
20299 | 'wheelDelta' in event ? -event.wheelDelta : 0; | ||
20300 | }, | ||
20301 | deltaZ: null, | ||
20302 | |||
20303 | // Browsers without "deltaMode" is reporting in raw wheel delta where one | ||
20304 | // notch on the scroll is always +/- 120, roughly equivalent to pixels. | ||
20305 | // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or | ||
20306 | // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. | ||
20307 | deltaMode: null | ||
20308 | }; | ||
20309 | |||
20310 | /** | ||
20311 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
20312 | * @param {string} dispatchMarker Marker identifying the event target. | ||
20313 | * @param {object} nativeEvent Native browser event. | ||
20314 | * @extends {SyntheticMouseEvent} | ||
20315 | */ | ||
20316 | function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
20317 | return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
20318 | } | ||
20319 | |||
20320 | SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); | ||
20321 | |||
20322 | module.exports = SyntheticWheelEvent; | ||
20323 | |||
20324 | /***/ }), | ||
20325 | /* 172 */ | ||
20326 | /***/ (function(module, exports, __webpack_require__) { | ||
20327 | |||
20328 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
20329 | * Copyright 2013-present, Facebook, Inc. | ||
20330 | * All rights reserved. | ||
20331 | * | ||
20332 | * This source code is licensed under the BSD-style license found in the | ||
20333 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20334 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20335 | * | ||
20336 | */ | ||
20337 | |||
20338 | 'use strict'; | ||
20339 | |||
20340 | var _prodInvariant = __webpack_require__(41); | ||
20341 | |||
20342 | var DOMLazyTree = __webpack_require__(87); | ||
20343 | var DOMProperty = __webpack_require__(42); | ||
20344 | var React = __webpack_require__(4); | ||
20345 | var ReactBrowserEventEmitter = __webpack_require__(111); | ||
20346 | var ReactCurrentOwner = __webpack_require__(12); | ||
20347 | var ReactDOMComponentTree = __webpack_require__(40); | ||
20348 | var ReactDOMContainerInfo = __webpack_require__(173); | ||
20349 | var ReactDOMFeatureFlags = __webpack_require__(174); | ||
20350 | var ReactFeatureFlags = __webpack_require__(64); | ||
20351 | var ReactInstanceMap = __webpack_require__(122); | ||
20352 | var ReactInstrumentation = __webpack_require__(68); | ||
20353 | var ReactMarkupChecksum = __webpack_require__(175); | ||
20354 | var ReactReconciler = __webpack_require__(65); | ||
20355 | var ReactUpdateQueue = __webpack_require__(141); | ||
20356 | var ReactUpdates = __webpack_require__(62); | ||
20357 | |||
20358 | var emptyObject = __webpack_require__(22); | ||
20359 | var instantiateReactComponent = __webpack_require__(124); | ||
20360 | var invariant = __webpack_require__(10); | ||
20361 | var setInnerHTML = __webpack_require__(89); | ||
20362 | var shouldUpdateReactComponent = __webpack_require__(130); | ||
20363 | var warning = __webpack_require__(13); | ||
20364 | |||
20365 | var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; | ||
20366 | var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME; | ||
20367 | |||
20368 | var ELEMENT_NODE_TYPE = 1; | ||
20369 | var DOC_NODE_TYPE = 9; | ||
20370 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11; | ||
20371 | |||
20372 | var instancesByReactRootID = {}; | ||
20373 | |||
20374 | /** | ||
20375 | * Finds the index of the first character | ||
20376 | * that's not common between the two given strings. | ||
20377 | * | ||
20378 | * @return {number} the index of the character where the strings diverge | ||
20379 | */ | ||
20380 | function firstDifferenceIndex(string1, string2) { | ||
20381 | var minLen = Math.min(string1.length, string2.length); | ||
20382 | for (var i = 0; i < minLen; i++) { | ||
20383 | if (string1.charAt(i) !== string2.charAt(i)) { | ||
20384 | return i; | ||
20385 | } | ||
20386 | } | ||
20387 | return string1.length === string2.length ? -1 : minLen; | ||
20388 | } | ||
20389 | |||
20390 | /** | ||
20391 | * @param {DOMElement|DOMDocument} container DOM element that may contain | ||
20392 | * a React component | ||
20393 | * @return {?*} DOM element that may have the reactRoot ID, or null. | ||
20394 | */ | ||
20395 | function getReactRootElementInContainer(container) { | ||
20396 | if (!container) { | ||
20397 | return null; | ||
20398 | } | ||
20399 | |||
20400 | if (container.nodeType === DOC_NODE_TYPE) { | ||
20401 | return container.documentElement; | ||
20402 | } else { | ||
20403 | return container.firstChild; | ||
20404 | } | ||
20405 | } | ||
20406 | |||
20407 | function internalGetID(node) { | ||
20408 | // If node is something like a window, document, or text node, none of | ||
20409 | // which support attributes or a .getAttribute method, gracefully return | ||
20410 | // the empty string, as if the attribute were missing. | ||
20411 | return node.getAttribute && node.getAttribute(ATTR_NAME) || ''; | ||
20412 | } | ||
20413 | |||
20414 | /** | ||
20415 | * Mounts this component and inserts it into the DOM. | ||
20416 | * | ||
20417 | * @param {ReactComponent} componentInstance The instance to mount. | ||
20418 | * @param {DOMElement} container DOM element to mount into. | ||
20419 | * @param {ReactReconcileTransaction} transaction | ||
20420 | * @param {boolean} shouldReuseMarkup If true, do not insert markup | ||
20421 | */ | ||
20422 | function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) { | ||
20423 | var markerName; | ||
20424 | if (ReactFeatureFlags.logTopLevelRenders) { | ||
20425 | var wrappedElement = wrapperInstance._currentElement.props.child; | ||
20426 | var type = wrappedElement.type; | ||
20427 | markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name); | ||
20428 | console.time(markerName); | ||
20429 | } | ||
20430 | |||
20431 | var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */ | ||
20432 | ); | ||
20433 | |||
20434 | if (markerName) { | ||
20435 | console.timeEnd(markerName); | ||
20436 | } | ||
20437 | |||
20438 | wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance; | ||
20439 | ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction); | ||
20440 | } | ||
20441 | |||
20442 | /** | ||
20443 | * Batched mount. | ||
20444 | * | ||
20445 | * @param {ReactComponent} componentInstance The instance to mount. | ||
20446 | * @param {DOMElement} container DOM element to mount into. | ||
20447 | * @param {boolean} shouldReuseMarkup If true, do not insert markup | ||
20448 | */ | ||
20449 | function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) { | ||
20450 | var transaction = ReactUpdates.ReactReconcileTransaction.getPooled( | ||
20451 | /* useCreateElement */ | ||
20452 | !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement); | ||
20453 | transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context); | ||
20454 | ReactUpdates.ReactReconcileTransaction.release(transaction); | ||
20455 | } | ||
20456 | |||
20457 | /** | ||
20458 | * Unmounts a component and removes it from the DOM. | ||
20459 | * | ||
20460 | * @param {ReactComponent} instance React component instance. | ||
20461 | * @param {DOMElement} container DOM element to unmount from. | ||
20462 | * @final | ||
20463 | * @internal | ||
20464 | * @see {ReactMount.unmountComponentAtNode} | ||
20465 | */ | ||
20466 | function unmountComponentFromNode(instance, container, safely) { | ||
20467 | if (process.env.NODE_ENV !== 'production') { | ||
20468 | ReactInstrumentation.debugTool.onBeginFlush(); | ||
20469 | } | ||
20470 | ReactReconciler.unmountComponent(instance, safely); | ||
20471 | if (process.env.NODE_ENV !== 'production') { | ||
20472 | ReactInstrumentation.debugTool.onEndFlush(); | ||
20473 | } | ||
20474 | |||
20475 | if (container.nodeType === DOC_NODE_TYPE) { | ||
20476 | container = container.documentElement; | ||
20477 | } | ||
20478 | |||
20479 | // http://jsperf.com/emptying-a-node | ||
20480 | while (container.lastChild) { | ||
20481 | container.removeChild(container.lastChild); | ||
20482 | } | ||
20483 | } | ||
20484 | |||
20485 | /** | ||
20486 | * True if the supplied DOM node has a direct React-rendered child that is | ||
20487 | * not a React root element. Useful for warning in `render`, | ||
20488 | * `unmountComponentAtNode`, etc. | ||
20489 | * | ||
20490 | * @param {?DOMElement} node The candidate DOM node. | ||
20491 | * @return {boolean} True if the DOM element contains a direct child that was | ||
20492 | * rendered by React but is not a root element. | ||
20493 | * @internal | ||
20494 | */ | ||
20495 | function hasNonRootReactChild(container) { | ||
20496 | var rootEl = getReactRootElementInContainer(container); | ||
20497 | if (rootEl) { | ||
20498 | var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl); | ||
20499 | return !!(inst && inst._hostParent); | ||
20500 | } | ||
20501 | } | ||
20502 | |||
20503 | /** | ||
20504 | * True if the supplied DOM node is a React DOM element and | ||
20505 | * it has been rendered by another copy of React. | ||
20506 | * | ||
20507 | * @param {?DOMElement} node The candidate DOM node. | ||
20508 | * @return {boolean} True if the DOM has been rendered by another copy of React | ||
20509 | * @internal | ||
20510 | */ | ||
20511 | function nodeIsRenderedByOtherInstance(container) { | ||
20512 | var rootEl = getReactRootElementInContainer(container); | ||
20513 | return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl)); | ||
20514 | } | ||
20515 | |||
20516 | /** | ||
20517 | * True if the supplied DOM node is a valid node element. | ||
20518 | * | ||
20519 | * @param {?DOMElement} node The candidate DOM node. | ||
20520 | * @return {boolean} True if the DOM is a valid DOM node. | ||
20521 | * @internal | ||
20522 | */ | ||
20523 | function isValidContainer(node) { | ||
20524 | return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)); | ||
20525 | } | ||
20526 | |||
20527 | /** | ||
20528 | * True if the supplied DOM node is a valid React node element. | ||
20529 | * | ||
20530 | * @param {?DOMElement} node The candidate DOM node. | ||
20531 | * @return {boolean} True if the DOM is a valid React DOM node. | ||
20532 | * @internal | ||
20533 | */ | ||
20534 | function isReactNode(node) { | ||
20535 | return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME)); | ||
20536 | } | ||
20537 | |||
20538 | function getHostRootInstanceInContainer(container) { | ||
20539 | var rootEl = getReactRootElementInContainer(container); | ||
20540 | var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl); | ||
20541 | return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null; | ||
20542 | } | ||
20543 | |||
20544 | function getTopLevelWrapperInContainer(container) { | ||
20545 | var root = getHostRootInstanceInContainer(container); | ||
20546 | return root ? root._hostContainerInfo._topLevelWrapper : null; | ||
20547 | } | ||
20548 | |||
20549 | /** | ||
20550 | * Temporary (?) hack so that we can store all top-level pending updates on | ||
20551 | * composites instead of having to worry about different types of components | ||
20552 | * here. | ||
20553 | */ | ||
20554 | var topLevelRootCounter = 1; | ||
20555 | var TopLevelWrapper = function () { | ||
20556 | this.rootID = topLevelRootCounter++; | ||
20557 | }; | ||
20558 | TopLevelWrapper.prototype.isReactComponent = {}; | ||
20559 | if (process.env.NODE_ENV !== 'production') { | ||
20560 | TopLevelWrapper.displayName = 'TopLevelWrapper'; | ||
20561 | } | ||
20562 | TopLevelWrapper.prototype.render = function () { | ||
20563 | return this.props.child; | ||
20564 | }; | ||
20565 | TopLevelWrapper.isReactTopLevelWrapper = true; | ||
20566 | |||
20567 | /** | ||
20568 | * Mounting is the process of initializing a React component by creating its | ||
20569 | * representative DOM elements and inserting them into a supplied `container`. | ||
20570 | * Any prior content inside `container` is destroyed in the process. | ||
20571 | * | ||
20572 | * ReactMount.render( | ||
20573 | * component, | ||
20574 | * document.getElementById('container') | ||
20575 | * ); | ||
20576 | * | ||
20577 | * <div id="container"> <-- Supplied `container`. | ||
20578 | * <div data-reactid=".3"> <-- Rendered reactRoot of React | ||
20579 | * // ... component. | ||
20580 | * </div> | ||
20581 | * </div> | ||
20582 | * | ||
20583 | * Inside of `container`, the first element rendered is the "reactRoot". | ||
20584 | */ | ||
20585 | var ReactMount = { | ||
20586 | |||
20587 | TopLevelWrapper: TopLevelWrapper, | ||
20588 | |||
20589 | /** | ||
20590 | * Used by devtools. The keys are not important. | ||
20591 | */ | ||
20592 | _instancesByReactRootID: instancesByReactRootID, | ||
20593 | |||
20594 | /** | ||
20595 | * This is a hook provided to support rendering React components while | ||
20596 | * ensuring that the apparent scroll position of its `container` does not | ||
20597 | * change. | ||
20598 | * | ||
20599 | * @param {DOMElement} container The `container` being rendered into. | ||
20600 | * @param {function} renderCallback This must be called once to do the render. | ||
20601 | */ | ||
20602 | scrollMonitor: function (container, renderCallback) { | ||
20603 | renderCallback(); | ||
20604 | }, | ||
20605 | |||
20606 | /** | ||
20607 | * Take a component that's already mounted into the DOM and replace its props | ||
20608 | * @param {ReactComponent} prevComponent component instance already in the DOM | ||
20609 | * @param {ReactElement} nextElement component instance to render | ||
20610 | * @param {DOMElement} container container to render into | ||
20611 | * @param {?function} callback function triggered on completion | ||
20612 | */ | ||
20613 | _updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) { | ||
20614 | ReactMount.scrollMonitor(container, function () { | ||
20615 | ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext); | ||
20616 | if (callback) { | ||
20617 | ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback); | ||
20618 | } | ||
20619 | }); | ||
20620 | |||
20621 | return prevComponent; | ||
20622 | }, | ||
20623 | |||
20624 | /** | ||
20625 | * Render a new component into the DOM. Hooked by hooks! | ||
20626 | * | ||
20627 | * @param {ReactElement} nextElement element to render | ||
20628 | * @param {DOMElement} container container to render into | ||
20629 | * @param {boolean} shouldReuseMarkup if we should skip the markup insertion | ||
20630 | * @return {ReactComponent} nextComponent | ||
20631 | */ | ||
20632 | _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) { | ||
20633 | // Various parts of our code (such as ReactCompositeComponent's | ||
20634 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
20635 | // verify that that's the case. | ||
20636 | process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0; | ||
20637 | |||
20638 | !isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0; | ||
20639 | |||
20640 | ReactBrowserEventEmitter.ensureScrollValueMonitoring(); | ||
20641 | var componentInstance = instantiateReactComponent(nextElement, false); | ||
20642 | |||
20643 | // The initial render is synchronous but any updates that happen during | ||
20644 | // rendering, in componentWillMount or componentDidMount, will be batched | ||
20645 | // according to the current batching strategy. | ||
20646 | |||
20647 | ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context); | ||
20648 | |||
20649 | var wrapperID = componentInstance._instance.rootID; | ||
20650 | instancesByReactRootID[wrapperID] = componentInstance; | ||
20651 | |||
20652 | return componentInstance; | ||
20653 | }, | ||
20654 | |||
20655 | /** | ||
20656 | * Renders a React component into the DOM in the supplied `container`. | ||
20657 | * | ||
20658 | * If the React component was previously rendered into `container`, this will | ||
20659 | * perform an update on it and only mutate the DOM as necessary to reflect the | ||
20660 | * latest React component. | ||
20661 | * | ||
20662 | * @param {ReactComponent} parentComponent The conceptual parent of this render tree. | ||
20663 | * @param {ReactElement} nextElement Component element to render. | ||
20664 | * @param {DOMElement} container DOM element to render into. | ||
20665 | * @param {?function} callback function triggered on completion | ||
20666 | * @return {ReactComponent} Component instance rendered in `container`. | ||
20667 | */ | ||
20668 | renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { | ||
20669 | !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0; | ||
20670 | return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback); | ||
20671 | }, | ||
20672 | |||
20673 | _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { | ||
20674 | ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render'); | ||
20675 | !React.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : | ||
20676 | // Check if it quacks like an element | ||
20677 | nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0; | ||
20678 | |||
20679 | process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0; | ||
20680 | |||
20681 | var nextWrappedElement = React.createElement(TopLevelWrapper, { child: nextElement }); | ||
20682 | |||
20683 | var nextContext; | ||
20684 | if (parentComponent) { | ||
20685 | var parentInst = ReactInstanceMap.get(parentComponent); | ||
20686 | nextContext = parentInst._processChildContext(parentInst._context); | ||
20687 | } else { | ||
20688 | nextContext = emptyObject; | ||
20689 | } | ||
20690 | |||
20691 | var prevComponent = getTopLevelWrapperInContainer(container); | ||
20692 | |||
20693 | if (prevComponent) { | ||
20694 | var prevWrappedElement = prevComponent._currentElement; | ||
20695 | var prevElement = prevWrappedElement.props.child; | ||
20696 | if (shouldUpdateReactComponent(prevElement, nextElement)) { | ||
20697 | var publicInst = prevComponent._renderedComponent.getPublicInstance(); | ||
20698 | var updatedCallback = callback && function () { | ||
20699 | callback.call(publicInst); | ||
20700 | }; | ||
20701 | ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback); | ||
20702 | return publicInst; | ||
20703 | } else { | ||
20704 | ReactMount.unmountComponentAtNode(container); | ||
20705 | } | ||
20706 | } | ||
20707 | |||
20708 | var reactRootElement = getReactRootElementInContainer(container); | ||
20709 | var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement); | ||
20710 | var containerHasNonRootReactChild = hasNonRootReactChild(container); | ||
20711 | |||
20712 | if (process.env.NODE_ENV !== 'production') { | ||
20713 | process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0; | ||
20714 | |||
20715 | if (!containerHasReactMarkup || reactRootElement.nextSibling) { | ||
20716 | var rootElementSibling = reactRootElement; | ||
20717 | while (rootElementSibling) { | ||
20718 | if (internalGetID(rootElementSibling)) { | ||
20719 | process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : void 0; | ||
20720 | break; | ||
20721 | } | ||
20722 | rootElementSibling = rootElementSibling.nextSibling; | ||
20723 | } | ||
20724 | } | ||
20725 | } | ||
20726 | |||
20727 | var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild; | ||
20728 | var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance(); | ||
20729 | if (callback) { | ||
20730 | callback.call(component); | ||
20731 | } | ||
20732 | return component; | ||
20733 | }, | ||
20734 | |||
20735 | /** | ||
20736 | * Renders a React component into the DOM in the supplied `container`. | ||
20737 | * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render | ||
20738 | * | ||
20739 | * If the React component was previously rendered into `container`, this will | ||
20740 | * perform an update on it and only mutate the DOM as necessary to reflect the | ||
20741 | * latest React component. | ||
20742 | * | ||
20743 | * @param {ReactElement} nextElement Component element to render. | ||
20744 | * @param {DOMElement} container DOM element to render into. | ||
20745 | * @param {?function} callback function triggered on completion | ||
20746 | * @return {ReactComponent} Component instance rendered in `container`. | ||
20747 | */ | ||
20748 | render: function (nextElement, container, callback) { | ||
20749 | return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback); | ||
20750 | }, | ||
20751 | |||
20752 | /** | ||
20753 | * Unmounts and destroys the React component rendered in the `container`. | ||
20754 | * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode | ||
20755 | * | ||
20756 | * @param {DOMElement} container DOM element containing a React component. | ||
20757 | * @return {boolean} True if a component was found in and unmounted from | ||
20758 | * `container` | ||
20759 | */ | ||
20760 | unmountComponentAtNode: function (container) { | ||
20761 | // Various parts of our code (such as ReactCompositeComponent's | ||
20762 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
20763 | // verify that that's the case. (Strictly speaking, unmounting won't cause a | ||
20764 | // render but we still don't expect to be in a render call here.) | ||
20765 | process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0; | ||
20766 | |||
20767 | !isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0; | ||
20768 | |||
20769 | if (process.env.NODE_ENV !== 'production') { | ||
20770 | process.env.NODE_ENV !== 'production' ? warning(!nodeIsRenderedByOtherInstance(container), 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by another copy of React.') : void 0; | ||
20771 | } | ||
20772 | |||
20773 | var prevComponent = getTopLevelWrapperInContainer(container); | ||
20774 | if (!prevComponent) { | ||
20775 | // Check if the node being unmounted was rendered by React, but isn't a | ||
20776 | // root node. | ||
20777 | var containerHasNonRootReactChild = hasNonRootReactChild(container); | ||
20778 | |||
20779 | // Check if the container itself is a React root node. | ||
20780 | var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME); | ||
20781 | |||
20782 | if (process.env.NODE_ENV !== 'production') { | ||
20783 | process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0; | ||
20784 | } | ||
20785 | |||
20786 | return false; | ||
20787 | } | ||
20788 | delete instancesByReactRootID[prevComponent._instance.rootID]; | ||
20789 | ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false); | ||
20790 | return true; | ||
20791 | }, | ||
20792 | |||
20793 | _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) { | ||
20794 | !isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0; | ||
20795 | |||
20796 | if (shouldReuseMarkup) { | ||
20797 | var rootElement = getReactRootElementInContainer(container); | ||
20798 | if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) { | ||
20799 | ReactDOMComponentTree.precacheNode(instance, rootElement); | ||
20800 | return; | ||
20801 | } else { | ||
20802 | var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
20803 | rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
20804 | |||
20805 | var rootMarkup = rootElement.outerHTML; | ||
20806 | rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum); | ||
20807 | |||
20808 | var normalizedMarkup = markup; | ||
20809 | if (process.env.NODE_ENV !== 'production') { | ||
20810 | // because rootMarkup is retrieved from the DOM, various normalizations | ||
20811 | // will have occurred which will not be present in `markup`. Here, | ||
20812 | // insert markup into a <div> or <iframe> depending on the container | ||
20813 | // type to perform the same normalizations before comparing. | ||
20814 | var normalizer; | ||
20815 | if (container.nodeType === ELEMENT_NODE_TYPE) { | ||
20816 | normalizer = document.createElement('div'); | ||
20817 | normalizer.innerHTML = markup; | ||
20818 | normalizedMarkup = normalizer.innerHTML; | ||
20819 | } else { | ||
20820 | normalizer = document.createElement('iframe'); | ||
20821 | document.body.appendChild(normalizer); | ||
20822 | normalizer.contentDocument.write(markup); | ||
20823 | normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML; | ||
20824 | document.body.removeChild(normalizer); | ||
20825 | } | ||
20826 | } | ||
20827 | |||
20828 | var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup); | ||
20829 | var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20); | ||
20830 | |||
20831 | !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s', difference) : _prodInvariant('42', difference) : void 0; | ||
20832 | |||
20833 | if (process.env.NODE_ENV !== 'production') { | ||
20834 | process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : void 0; | ||
20835 | } | ||
20836 | } | ||
20837 | } | ||
20838 | |||
20839 | !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but you didn\'t use server rendering. We can\'t do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('43') : void 0; | ||
20840 | |||
20841 | if (transaction.useCreateElement) { | ||
20842 | while (container.lastChild) { | ||
20843 | container.removeChild(container.lastChild); | ||
20844 | } | ||
20845 | DOMLazyTree.insertTreeBefore(container, markup, null); | ||
20846 | } else { | ||
20847 | setInnerHTML(container, markup); | ||
20848 | ReactDOMComponentTree.precacheNode(instance, container.firstChild); | ||
20849 | } | ||
20850 | |||
20851 | if (process.env.NODE_ENV !== 'production') { | ||
20852 | var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild); | ||
20853 | if (hostNode._debugID !== 0) { | ||
20854 | ReactInstrumentation.debugTool.onHostOperation({ | ||
20855 | instanceID: hostNode._debugID, | ||
20856 | type: 'mount', | ||
20857 | payload: markup.toString() | ||
20858 | }); | ||
20859 | } | ||
20860 | } | ||
20861 | } | ||
20862 | }; | ||
20863 | |||
20864 | module.exports = ReactMount; | ||
20865 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
20866 | |||
20867 | /***/ }), | ||
20868 | /* 173 */ | ||
20869 | /***/ (function(module, exports, __webpack_require__) { | ||
20870 | |||
20871 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
20872 | * Copyright 2013-present, Facebook, Inc. | ||
20873 | * All rights reserved. | ||
20874 | * | ||
20875 | * This source code is licensed under the BSD-style license found in the | ||
20876 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20877 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20878 | * | ||
20879 | */ | ||
20880 | |||
20881 | 'use strict'; | ||
20882 | |||
20883 | var validateDOMNesting = __webpack_require__(142); | ||
20884 | |||
20885 | var DOC_NODE_TYPE = 9; | ||
20886 | |||
20887 | function ReactDOMContainerInfo(topLevelWrapper, node) { | ||
20888 | var info = { | ||
20889 | _topLevelWrapper: topLevelWrapper, | ||
20890 | _idCounter: 1, | ||
20891 | _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null, | ||
20892 | _node: node, | ||
20893 | _tag: node ? node.nodeName.toLowerCase() : null, | ||
20894 | _namespaceURI: node ? node.namespaceURI : null | ||
20895 | }; | ||
20896 | if (process.env.NODE_ENV !== 'production') { | ||
20897 | info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null; | ||
20898 | } | ||
20899 | return info; | ||
20900 | } | ||
20901 | |||
20902 | module.exports = ReactDOMContainerInfo; | ||
20903 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
20904 | |||
20905 | /***/ }), | ||
20906 | /* 174 */ | ||
20907 | /***/ (function(module, exports) { | ||
20908 | |||
20909 | /** | ||
20910 | * Copyright 2013-present, Facebook, Inc. | ||
20911 | * All rights reserved. | ||
20912 | * | ||
20913 | * This source code is licensed under the BSD-style license found in the | ||
20914 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20915 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20916 | * | ||
20917 | */ | ||
20918 | |||
20919 | 'use strict'; | ||
20920 | |||
20921 | var ReactDOMFeatureFlags = { | ||
20922 | useCreateElement: true, | ||
20923 | useFiber: false | ||
20924 | }; | ||
20925 | |||
20926 | module.exports = ReactDOMFeatureFlags; | ||
20927 | |||
20928 | /***/ }), | ||
20929 | /* 175 */ | ||
20930 | /***/ (function(module, exports, __webpack_require__) { | ||
20931 | |||
20932 | /** | ||
20933 | * Copyright 2013-present, Facebook, Inc. | ||
20934 | * All rights reserved. | ||
20935 | * | ||
20936 | * This source code is licensed under the BSD-style license found in the | ||
20937 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20938 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20939 | * | ||
20940 | */ | ||
20941 | |||
20942 | 'use strict'; | ||
20943 | |||
20944 | var adler32 = __webpack_require__(176); | ||
20945 | |||
20946 | var TAG_END = /\/?>/; | ||
20947 | var COMMENT_START = /^<\!\-\-/; | ||
20948 | |||
20949 | var ReactMarkupChecksum = { | ||
20950 | CHECKSUM_ATTR_NAME: 'data-react-checksum', | ||
20951 | |||
20952 | /** | ||
20953 | * @param {string} markup Markup string | ||
20954 | * @return {string} Markup string with checksum attribute attached | ||
20955 | */ | ||
20956 | addChecksumToMarkup: function (markup) { | ||
20957 | var checksum = adler32(markup); | ||
20958 | |||
20959 | // Add checksum (handle both parent tags, comments and self-closing tags) | ||
20960 | if (COMMENT_START.test(markup)) { | ||
20961 | return markup; | ||
20962 | } else { | ||
20963 | return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&'); | ||
20964 | } | ||
20965 | }, | ||
20966 | |||
20967 | /** | ||
20968 | * @param {string} markup to use | ||
20969 | * @param {DOMElement} element root React element | ||
20970 | * @returns {boolean} whether or not the markup is the same | ||
20971 | */ | ||
20972 | canReuseMarkup: function (markup, element) { | ||
20973 | var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
20974 | existingChecksum = existingChecksum && parseInt(existingChecksum, 10); | ||
20975 | var markupChecksum = adler32(markup); | ||
20976 | return markupChecksum === existingChecksum; | ||
20977 | } | ||
20978 | }; | ||
20979 | |||
20980 | module.exports = ReactMarkupChecksum; | ||
20981 | |||
20982 | /***/ }), | ||
20983 | /* 176 */ | ||
20984 | /***/ (function(module, exports) { | ||
20985 | |||
20986 | /** | ||
20987 | * Copyright 2013-present, Facebook, Inc. | ||
20988 | * All rights reserved. | ||
20989 | * | ||
20990 | * This source code is licensed under the BSD-style license found in the | ||
20991 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20992 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20993 | * | ||
20994 | * | ||
20995 | */ | ||
20996 | |||
20997 | 'use strict'; | ||
20998 | |||
20999 | var MOD = 65521; | ||
21000 | |||
21001 | // adler32 is not cryptographically strong, and is only used to sanity check that | ||
21002 | // markup generated on the server matches the markup generated on the client. | ||
21003 | // This implementation (a modified version of the SheetJS version) has been optimized | ||
21004 | // for our use case, at the expense of conforming to the adler32 specification | ||
21005 | // for non-ascii inputs. | ||
21006 | function adler32(data) { | ||
21007 | var a = 1; | ||
21008 | var b = 0; | ||
21009 | var i = 0; | ||
21010 | var l = data.length; | ||
21011 | var m = l & ~0x3; | ||
21012 | while (i < m) { | ||
21013 | var n = Math.min(i + 4096, m); | ||
21014 | for (; i < n; i += 4) { | ||
21015 | b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3)); | ||
21016 | } | ||
21017 | a %= MOD; | ||
21018 | b %= MOD; | ||
21019 | } | ||
21020 | for (; i < l; i++) { | ||
21021 | b += a += data.charCodeAt(i); | ||
21022 | } | ||
21023 | a %= MOD; | ||
21024 | b %= MOD; | ||
21025 | return a | b << 16; | ||
21026 | } | ||
21027 | |||
21028 | module.exports = adler32; | ||
21029 | |||
21030 | /***/ }), | ||
21031 | /* 177 */ | ||
21032 | 36, | ||
21033 | /* 178 */ | ||
21034 | /***/ (function(module, exports, __webpack_require__) { | ||
21035 | |||
21036 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
21037 | * Copyright 2013-present, Facebook, Inc. | ||
21038 | * All rights reserved. | ||
21039 | * | ||
21040 | * This source code is licensed under the BSD-style license found in the | ||
21041 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21042 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21043 | * | ||
21044 | */ | ||
21045 | |||
21046 | 'use strict'; | ||
21047 | |||
21048 | var _prodInvariant = __webpack_require__(41); | ||
21049 | |||
21050 | var ReactCurrentOwner = __webpack_require__(12); | ||
21051 | var ReactDOMComponentTree = __webpack_require__(40); | ||
21052 | var ReactInstanceMap = __webpack_require__(122); | ||
21053 | |||
21054 | var getHostComponentFromComposite = __webpack_require__(179); | ||
21055 | var invariant = __webpack_require__(10); | ||
21056 | var warning = __webpack_require__(13); | ||
21057 | |||
21058 | /** | ||
21059 | * Returns the DOM node rendered by this element. | ||
21060 | * | ||
21061 | * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode | ||
21062 | * | ||
21063 | * @param {ReactComponent|DOMElement} componentOrElement | ||
21064 | * @return {?DOMElement} The root node of this element. | ||
21065 | */ | ||
21066 | function findDOMNode(componentOrElement) { | ||
21067 | if (process.env.NODE_ENV !== 'production') { | ||
21068 | var owner = ReactCurrentOwner.current; | ||
21069 | if (owner !== null) { | ||
21070 | process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0; | ||
21071 | owner._warnedAboutRefsInRender = true; | ||
21072 | } | ||
21073 | } | ||
21074 | if (componentOrElement == null) { | ||
21075 | return null; | ||
21076 | } | ||
21077 | if (componentOrElement.nodeType === 1) { | ||
21078 | return componentOrElement; | ||
21079 | } | ||
21080 | |||
21081 | var inst = ReactInstanceMap.get(componentOrElement); | ||
21082 | if (inst) { | ||
21083 | inst = getHostComponentFromComposite(inst); | ||
21084 | return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null; | ||
21085 | } | ||
21086 | |||
21087 | if (typeof componentOrElement.render === 'function') { | ||
21088 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0; | ||
21089 | } else { | ||
21090 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0; | ||
21091 | } | ||
21092 | } | ||
21093 | |||
21094 | module.exports = findDOMNode; | ||
21095 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
21096 | |||
21097 | /***/ }), | ||
21098 | /* 179 */ | ||
21099 | /***/ (function(module, exports, __webpack_require__) { | ||
21100 | |||
21101 | /** | ||
21102 | * Copyright 2013-present, Facebook, Inc. | ||
21103 | * All rights reserved. | ||
21104 | * | ||
21105 | * This source code is licensed under the BSD-style license found in the | ||
21106 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21107 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21108 | * | ||
21109 | */ | ||
21110 | |||
21111 | 'use strict'; | ||
21112 | |||
21113 | var ReactNodeTypes = __webpack_require__(126); | ||
21114 | |||
21115 | function getHostComponentFromComposite(inst) { | ||
21116 | var type; | ||
21117 | |||
21118 | while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) { | ||
21119 | inst = inst._renderedComponent; | ||
21120 | } | ||
21121 | |||
21122 | if (type === ReactNodeTypes.HOST) { | ||
21123 | return inst._renderedComponent; | ||
21124 | } else if (type === ReactNodeTypes.EMPTY) { | ||
21125 | return null; | ||
21126 | } | ||
21127 | } | ||
21128 | |||
21129 | module.exports = getHostComponentFromComposite; | ||
21130 | |||
21131 | /***/ }), | ||
21132 | /* 180 */ | ||
21133 | /***/ (function(module, exports, __webpack_require__) { | ||
21134 | |||
21135 | /** | ||
21136 | * Copyright 2013-present, Facebook, Inc. | ||
21137 | * All rights reserved. | ||
21138 | * | ||
21139 | * This source code is licensed under the BSD-style license found in the | ||
21140 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21141 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21142 | * | ||
21143 | */ | ||
21144 | |||
21145 | 'use strict'; | ||
21146 | |||
21147 | var ReactMount = __webpack_require__(172); | ||
21148 | |||
21149 | module.exports = ReactMount.renderSubtreeIntoContainer; | ||
21150 | |||
21151 | /***/ }), | ||
21152 | /* 181 */ | ||
21153 | /***/ (function(module, exports, __webpack_require__) { | ||
21154 | |||
21155 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
21156 | * Copyright 2013-present, Facebook, Inc. | ||
21157 | * All rights reserved. | ||
21158 | * | ||
21159 | * This source code is licensed under the BSD-style license found in the | ||
21160 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21161 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21162 | * | ||
21163 | */ | ||
21164 | |||
21165 | 'use strict'; | ||
21166 | |||
21167 | var DOMProperty = __webpack_require__(42); | ||
21168 | var EventPluginRegistry = __webpack_require__(49); | ||
21169 | var ReactComponentTreeHook = __webpack_require__(28); | ||
21170 | |||
21171 | var warning = __webpack_require__(13); | ||
21172 | |||
21173 | if (process.env.NODE_ENV !== 'production') { | ||
21174 | var reactProps = { | ||
21175 | children: true, | ||
21176 | dangerouslySetInnerHTML: true, | ||
21177 | key: true, | ||
21178 | ref: true, | ||
21179 | |||
21180 | autoFocus: true, | ||
21181 | defaultValue: true, | ||
21182 | valueLink: true, | ||
21183 | defaultChecked: true, | ||
21184 | checkedLink: true, | ||
21185 | innerHTML: true, | ||
21186 | suppressContentEditableWarning: true, | ||
21187 | onFocusIn: true, | ||
21188 | onFocusOut: true | ||
21189 | }; | ||
21190 | var warnedProperties = {}; | ||
21191 | |||
21192 | var validateProperty = function (tagName, name, debugID) { | ||
21193 | if (DOMProperty.properties.hasOwnProperty(name) || DOMProperty.isCustomAttribute(name)) { | ||
21194 | return true; | ||
21195 | } | ||
21196 | if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { | ||
21197 | return true; | ||
21198 | } | ||
21199 | if (EventPluginRegistry.registrationNameModules.hasOwnProperty(name)) { | ||
21200 | return true; | ||
21201 | } | ||
21202 | warnedProperties[name] = true; | ||
21203 | var lowerCasedName = name.toLowerCase(); | ||
21204 | |||
21205 | // data-* attributes should be lowercase; suggest the lowercase version | ||
21206 | var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null; | ||
21207 | |||
21208 | var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry.possibleRegistrationNames[lowerCasedName] : null; | ||
21209 | |||
21210 | if (standardName != null) { | ||
21211 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown DOM property %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; | ||
21212 | return true; | ||
21213 | } else if (registrationName != null) { | ||
21214 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown event handler property %s. Did you mean `%s`?%s', name, registrationName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; | ||
21215 | return true; | ||
21216 | } else { | ||
21217 | // We were unable to guess which prop the user intended. | ||
21218 | // It is likely that the user was just blindly spreading/forwarding props | ||
21219 | // Components should be careful to only render valid props/attributes. | ||
21220 | // Warning will be invoked in warnUnknownProperties to allow grouping. | ||
21221 | return false; | ||
21222 | } | ||
21223 | }; | ||
21224 | } | ||
21225 | |||
21226 | var warnUnknownProperties = function (debugID, element) { | ||
21227 | var unknownProps = []; | ||
21228 | for (var key in element.props) { | ||
21229 | var isValid = validateProperty(element.type, key, debugID); | ||
21230 | if (!isValid) { | ||
21231 | unknownProps.push(key); | ||
21232 | } | ||
21233 | } | ||
21234 | |||
21235 | var unknownPropString = unknownProps.map(function (prop) { | ||
21236 | return '`' + prop + '`'; | ||
21237 | }).join(', '); | ||
21238 | |||
21239 | if (unknownProps.length === 1) { | ||
21240 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown prop %s on <%s> tag. Remove this prop from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; | ||
21241 | } else if (unknownProps.length > 1) { | ||
21242 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown props %s on <%s> tag. Remove these props from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; | ||
21243 | } | ||
21244 | }; | ||
21245 | |||
21246 | function handleElement(debugID, element) { | ||
21247 | if (element == null || typeof element.type !== 'string') { | ||
21248 | return; | ||
21249 | } | ||
21250 | if (element.type.indexOf('-') >= 0 || element.props.is) { | ||
21251 | return; | ||
21252 | } | ||
21253 | warnUnknownProperties(debugID, element); | ||
21254 | } | ||
21255 | |||
21256 | var ReactDOMUnknownPropertyHook = { | ||
21257 | onBeforeMountComponent: function (debugID, element) { | ||
21258 | handleElement(debugID, element); | ||
21259 | }, | ||
21260 | onBeforeUpdateComponent: function (debugID, element) { | ||
21261 | handleElement(debugID, element); | ||
21262 | } | ||
21263 | }; | ||
21264 | |||
21265 | module.exports = ReactDOMUnknownPropertyHook; | ||
21266 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
21267 | |||
21268 | /***/ }), | ||
21269 | /* 182 */ | ||
21270 | /***/ (function(module, exports, __webpack_require__) { | ||
21271 | |||
21272 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
21273 | * Copyright 2013-present, Facebook, Inc. | ||
21274 | * All rights reserved. | ||
21275 | * | ||
21276 | * This source code is licensed under the BSD-style license found in the | ||
21277 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21278 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21279 | * | ||
21280 | */ | ||
21281 | |||
21282 | 'use strict'; | ||
21283 | |||
21284 | var ReactComponentTreeHook = __webpack_require__(28); | ||
21285 | |||
21286 | var warning = __webpack_require__(13); | ||
21287 | |||
21288 | var didWarnValueNull = false; | ||
21289 | |||
21290 | function handleElement(debugID, element) { | ||
21291 | if (element == null) { | ||
21292 | return; | ||
21293 | } | ||
21294 | if (element.type !== 'input' && element.type !== 'textarea' && element.type !== 'select') { | ||
21295 | return; | ||
21296 | } | ||
21297 | if (element.props != null && element.props.value === null && !didWarnValueNull) { | ||
21298 | process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; | ||
21299 | |||
21300 | didWarnValueNull = true; | ||
21301 | } | ||
21302 | } | ||
21303 | |||
21304 | var ReactDOMNullInputValuePropHook = { | ||
21305 | onBeforeMountComponent: function (debugID, element) { | ||
21306 | handleElement(debugID, element); | ||
21307 | }, | ||
21308 | onBeforeUpdateComponent: function (debugID, element) { | ||
21309 | handleElement(debugID, element); | ||
21310 | } | ||
21311 | }; | ||
21312 | |||
21313 | module.exports = ReactDOMNullInputValuePropHook; | ||
21314 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
21315 | |||
21316 | /***/ }), | ||
21317 | /* 183 */ | ||
21318 | /***/ (function(module, exports, __webpack_require__) { | ||
21319 | |||
21320 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
21321 | * Copyright 2013-present, Facebook, Inc. | ||
21322 | * All rights reserved. | ||
21323 | * | ||
21324 | * This source code is licensed under the BSD-style license found in the | ||
21325 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21326 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21327 | * | ||
21328 | */ | ||
21329 | |||
21330 | 'use strict'; | ||
21331 | |||
21332 | var DOMProperty = __webpack_require__(42); | ||
21333 | var ReactComponentTreeHook = __webpack_require__(28); | ||
21334 | |||
21335 | var warning = __webpack_require__(13); | ||
21336 | |||
21337 | var warnedProperties = {}; | ||
21338 | var rARIA = new RegExp('^(aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); | ||
21339 | |||
21340 | function validateProperty(tagName, name, debugID) { | ||
21341 | if (warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { | ||
21342 | return true; | ||
21343 | } | ||
21344 | |||
21345 | if (rARIA.test(name)) { | ||
21346 | var lowerCasedName = name.toLowerCase(); | ||
21347 | var standardName = DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null; | ||
21348 | |||
21349 | // If this is an aria-* attribute, but is not listed in the known DOM | ||
21350 | // DOM properties, then it is an invalid aria-* attribute. | ||
21351 | if (standardName == null) { | ||
21352 | warnedProperties[name] = true; | ||
21353 | return false; | ||
21354 | } | ||
21355 | // aria-* attributes should be lowercase; suggest the lowercase version. | ||
21356 | if (name !== standardName) { | ||
21357 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown ARIA attribute %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; | ||
21358 | warnedProperties[name] = true; | ||
21359 | return true; | ||
21360 | } | ||
21361 | } | ||
21362 | |||
21363 | return true; | ||
21364 | } | ||
21365 | |||
21366 | function warnInvalidARIAProps(debugID, element) { | ||
21367 | var invalidProps = []; | ||
21368 | |||
21369 | for (var key in element.props) { | ||
21370 | var isValid = validateProperty(element.type, key, debugID); | ||
21371 | if (!isValid) { | ||
21372 | invalidProps.push(key); | ||
21373 | } | ||
21374 | } | ||
21375 | |||
21376 | var unknownPropString = invalidProps.map(function (prop) { | ||
21377 | return '`' + prop + '`'; | ||
21378 | }).join(', '); | ||
21379 | |||
21380 | if (invalidProps.length === 1) { | ||
21381 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; | ||
21382 | } else if (invalidProps.length > 1) { | ||
21383 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; | ||
21384 | } | ||
21385 | } | ||
21386 | |||
21387 | function handleElement(debugID, element) { | ||
21388 | if (element == null || typeof element.type !== 'string') { | ||
21389 | return; | ||
21390 | } | ||
21391 | if (element.type.indexOf('-') >= 0 || element.props.is) { | ||
21392 | return; | ||
21393 | } | ||
21394 | |||
21395 | warnInvalidARIAProps(debugID, element); | ||
21396 | } | ||
21397 | |||
21398 | var ReactDOMInvalidARIAHook = { | ||
21399 | onBeforeMountComponent: function (debugID, element) { | ||
21400 | if (process.env.NODE_ENV !== 'production') { | ||
21401 | handleElement(debugID, element); | ||
21402 | } | ||
21403 | }, | ||
21404 | onBeforeUpdateComponent: function (debugID, element) { | ||
21405 | if (process.env.NODE_ENV !== 'production') { | ||
21406 | handleElement(debugID, element); | ||
21407 | } | ||
21408 | } | ||
21409 | }; | ||
21410 | |||
21411 | module.exports = ReactDOMInvalidARIAHook; | ||
21412 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
21413 | |||
21414 | /***/ }), | ||
21415 | /* 184 */ | ||
21416 | /***/ (function(module, exports) { | ||
21417 | |||
21418 | //! moment.js | ||
21419 | //! version : 2.18.1 | ||
21420 | //! authors : Tim Wood, Iskren Chernev, Moment.js contributors | ||
21421 | //! license : MIT | ||
21422 | //! momentjs.com | ||
21423 | |||
21424 | ;(function (global, factory) { | ||
21425 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
21426 | typeof define === 'function' && define.amd ? define(factory) : | ||
21427 | global.moment = factory() | ||
21428 | }(this, (function () { 'use strict'; | ||
21429 | |||
21430 | var hookCallback; | ||
21431 | |||
21432 | function hooks () { | ||
21433 | return hookCallback.apply(null, arguments); | ||
21434 | } | ||
21435 | |||
21436 | // This is done to register the method called with moment() | ||
21437 | // without creating circular dependencies. | ||
21438 | function setHookCallback (callback) { | ||
21439 | hookCallback = callback; | ||
21440 | } | ||
21441 | |||
21442 | function isArray(input) { | ||
21443 | return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; | ||
21444 | } | ||
21445 | |||
21446 | function isObject(input) { | ||
21447 | // IE8 will treat undefined and null as object if it wasn't for | ||
21448 | // input != null | ||
21449 | return input != null && Object.prototype.toString.call(input) === '[object Object]'; | ||
21450 | } | ||
21451 | |||
21452 | function isObjectEmpty(obj) { | ||
21453 | var k; | ||
21454 | for (k in obj) { | ||
21455 | // even if its not own property I'd still call it non-empty | ||
21456 | return false; | ||
21457 | } | ||
21458 | return true; | ||
21459 | } | ||
21460 | |||
21461 | function isUndefined(input) { | ||
21462 | return input === void 0; | ||
21463 | } | ||
21464 | |||
21465 | function isNumber(input) { | ||
21466 | return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; | ||
21467 | } | ||
21468 | |||
21469 | function isDate(input) { | ||
21470 | return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; | ||
21471 | } | ||
21472 | |||
21473 | function map(arr, fn) { | ||
21474 | var res = [], i; | ||
21475 | for (i = 0; i < arr.length; ++i) { | ||
21476 | res.push(fn(arr[i], i)); | ||
21477 | } | ||
21478 | return res; | ||
21479 | } | ||
21480 | |||
21481 | function hasOwnProp(a, b) { | ||
21482 | return Object.prototype.hasOwnProperty.call(a, b); | ||
21483 | } | ||
21484 | |||
21485 | function extend(a, b) { | ||
21486 | for (var i in b) { | ||
21487 | if (hasOwnProp(b, i)) { | ||
21488 | a[i] = b[i]; | ||
21489 | } | ||
21490 | } | ||
21491 | |||
21492 | if (hasOwnProp(b, 'toString')) { | ||
21493 | a.toString = b.toString; | ||
21494 | } | ||
21495 | |||
21496 | if (hasOwnProp(b, 'valueOf')) { | ||
21497 | a.valueOf = b.valueOf; | ||
21498 | } | ||
21499 | |||
21500 | return a; | ||
21501 | } | ||
21502 | |||
21503 | function createUTC (input, format, locale, strict) { | ||
21504 | return createLocalOrUTC(input, format, locale, strict, true).utc(); | ||
21505 | } | ||
21506 | |||
21507 | function defaultParsingFlags() { | ||
21508 | // We need to deep clone this object. | ||
21509 | return { | ||
21510 | empty : false, | ||
21511 | unusedTokens : [], | ||
21512 | unusedInput : [], | ||
21513 | overflow : -2, | ||
21514 | charsLeftOver : 0, | ||
21515 | nullInput : false, | ||
21516 | invalidMonth : null, | ||
21517 | invalidFormat : false, | ||
21518 | userInvalidated : false, | ||
21519 | iso : false, | ||
21520 | parsedDateParts : [], | ||
21521 | meridiem : null, | ||
21522 | rfc2822 : false, | ||
21523 | weekdayMismatch : false | ||
21524 | }; | ||
21525 | } | ||
21526 | |||
21527 | function getParsingFlags(m) { | ||
21528 | if (m._pf == null) { | ||
21529 | m._pf = defaultParsingFlags(); | ||
21530 | } | ||
21531 | return m._pf; | ||
21532 | } | ||
21533 | |||
21534 | var some; | ||
21535 | if (Array.prototype.some) { | ||
21536 | some = Array.prototype.some; | ||
21537 | } else { | ||
21538 | some = function (fun) { | ||
21539 | var t = Object(this); | ||
21540 | var len = t.length >>> 0; | ||
21541 | |||
21542 | for (var i = 0; i < len; i++) { | ||
21543 | if (i in t && fun.call(this, t[i], i, t)) { | ||
21544 | return true; | ||
21545 | } | ||
21546 | } | ||
21547 | |||
21548 | return false; | ||
21549 | }; | ||
21550 | } | ||
21551 | |||
21552 | var some$1 = some; | ||
21553 | |||
21554 | function isValid(m) { | ||
21555 | if (m._isValid == null) { | ||
21556 | var flags = getParsingFlags(m); | ||
21557 | var parsedParts = some$1.call(flags.parsedDateParts, function (i) { | ||
21558 | return i != null; | ||
21559 | }); | ||
21560 | var isNowValid = !isNaN(m._d.getTime()) && | ||
21561 | flags.overflow < 0 && | ||
21562 | !flags.empty && | ||
21563 | !flags.invalidMonth && | ||
21564 | !flags.invalidWeekday && | ||
21565 | !flags.nullInput && | ||
21566 | !flags.invalidFormat && | ||
21567 | !flags.userInvalidated && | ||
21568 | (!flags.meridiem || (flags.meridiem && parsedParts)); | ||
21569 | |||
21570 | if (m._strict) { | ||
21571 | isNowValid = isNowValid && | ||
21572 | flags.charsLeftOver === 0 && | ||
21573 | flags.unusedTokens.length === 0 && | ||
21574 | flags.bigHour === undefined; | ||
21575 | } | ||
21576 | |||
21577 | if (Object.isFrozen == null || !Object.isFrozen(m)) { | ||
21578 | m._isValid = isNowValid; | ||
21579 | } | ||
21580 | else { | ||
21581 | return isNowValid; | ||
21582 | } | ||
21583 | } | ||
21584 | return m._isValid; | ||
21585 | } | ||
21586 | |||
21587 | function createInvalid (flags) { | ||
21588 | var m = createUTC(NaN); | ||
21589 | if (flags != null) { | ||
21590 | extend(getParsingFlags(m), flags); | ||
21591 | } | ||
21592 | else { | ||
21593 | getParsingFlags(m).userInvalidated = true; | ||
21594 | } | ||
21595 | |||
21596 | return m; | ||
21597 | } | ||
21598 | |||
21599 | // Plugins that add properties should also add the key here (null value), | ||
21600 | // so we can properly clone ourselves. | ||
21601 | var momentProperties = hooks.momentProperties = []; | ||
21602 | |||
21603 | function copyConfig(to, from) { | ||
21604 | var i, prop, val; | ||
21605 | |||
21606 | if (!isUndefined(from._isAMomentObject)) { | ||
21607 | to._isAMomentObject = from._isAMomentObject; | ||
21608 | } | ||
21609 | if (!isUndefined(from._i)) { | ||
21610 | to._i = from._i; | ||
21611 | } | ||
21612 | if (!isUndefined(from._f)) { | ||
21613 | to._f = from._f; | ||
21614 | } | ||
21615 | if (!isUndefined(from._l)) { | ||
21616 | to._l = from._l; | ||
21617 | } | ||
21618 | if (!isUndefined(from._strict)) { | ||
21619 | to._strict = from._strict; | ||
21620 | } | ||
21621 | if (!isUndefined(from._tzm)) { | ||
21622 | to._tzm = from._tzm; | ||
21623 | } | ||
21624 | if (!isUndefined(from._isUTC)) { | ||
21625 | to._isUTC = from._isUTC; | ||
21626 | } | ||
21627 | if (!isUndefined(from._offset)) { | ||
21628 | to._offset = from._offset; | ||
21629 | } | ||
21630 | if (!isUndefined(from._pf)) { | ||
21631 | to._pf = getParsingFlags(from); | ||
21632 | } | ||
21633 | if (!isUndefined(from._locale)) { | ||
21634 | to._locale = from._locale; | ||
21635 | } | ||
21636 | |||
21637 | if (momentProperties.length > 0) { | ||
21638 | for (i = 0; i < momentProperties.length; i++) { | ||
21639 | prop = momentProperties[i]; | ||
21640 | val = from[prop]; | ||
21641 | if (!isUndefined(val)) { | ||
21642 | to[prop] = val; | ||
21643 | } | ||
21644 | } | ||
21645 | } | ||
21646 | |||
21647 | return to; | ||
21648 | } | ||
21649 | |||
21650 | var updateInProgress = false; | ||
21651 | |||
21652 | // Moment prototype object | ||
21653 | function Moment(config) { | ||
21654 | copyConfig(this, config); | ||
21655 | this._d = new Date(config._d != null ? config._d.getTime() : NaN); | ||
21656 | if (!this.isValid()) { | ||
21657 | this._d = new Date(NaN); | ||
21658 | } | ||
21659 | // Prevent infinite loop in case updateOffset creates new moment | ||
21660 | // objects. | ||
21661 | if (updateInProgress === false) { | ||
21662 | updateInProgress = true; | ||
21663 | hooks.updateOffset(this); | ||
21664 | updateInProgress = false; | ||
21665 | } | ||
21666 | } | ||
21667 | |||
21668 | function isMoment (obj) { | ||
21669 | return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); | ||
21670 | } | ||
21671 | |||
21672 | function absFloor (number) { | ||
21673 | if (number < 0) { | ||
21674 | // -0 -> 0 | ||
21675 | return Math.ceil(number) || 0; | ||
21676 | } else { | ||
21677 | return Math.floor(number); | ||
21678 | } | ||
21679 | } | ||
21680 | |||
21681 | function toInt(argumentForCoercion) { | ||
21682 | var coercedNumber = +argumentForCoercion, | ||
21683 | value = 0; | ||
21684 | |||
21685 | if (coercedNumber !== 0 && isFinite(coercedNumber)) { | ||
21686 | value = absFloor(coercedNumber); | ||
21687 | } | ||
21688 | |||
21689 | return value; | ||
21690 | } | ||
21691 | |||
21692 | // compare two arrays, return the number of differences | ||
21693 | function compareArrays(array1, array2, dontConvert) { | ||
21694 | var len = Math.min(array1.length, array2.length), | ||
21695 | lengthDiff = Math.abs(array1.length - array2.length), | ||
21696 | diffs = 0, | ||
21697 | i; | ||
21698 | for (i = 0; i < len; i++) { | ||
21699 | if ((dontConvert && array1[i] !== array2[i]) || | ||
21700 | (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { | ||
21701 | diffs++; | ||
21702 | } | ||
21703 | } | ||
21704 | return diffs + lengthDiff; | ||
21705 | } | ||
21706 | |||
21707 | function warn(msg) { | ||
21708 | if (hooks.suppressDeprecationWarnings === false && | ||
21709 | (typeof console !== 'undefined') && console.warn) { | ||
21710 | console.warn('Deprecation warning: ' + msg); | ||
21711 | } | ||
21712 | } | ||
21713 | |||
21714 | function deprecate(msg, fn) { | ||
21715 | var firstTime = true; | ||
21716 | |||
21717 | return extend(function () { | ||
21718 | if (hooks.deprecationHandler != null) { | ||
21719 | hooks.deprecationHandler(null, msg); | ||
21720 | } | ||
21721 | if (firstTime) { | ||
21722 | var args = []; | ||
21723 | var arg; | ||
21724 | for (var i = 0; i < arguments.length; i++) { | ||
21725 | arg = ''; | ||
21726 | if (typeof arguments[i] === 'object') { | ||
21727 | arg += '\n[' + i + '] '; | ||
21728 | for (var key in arguments[0]) { | ||
21729 | arg += key + ': ' + arguments[0][key] + ', '; | ||
21730 | } | ||
21731 | arg = arg.slice(0, -2); // Remove trailing comma and space | ||
21732 | } else { | ||
21733 | arg = arguments[i]; | ||
21734 | } | ||
21735 | args.push(arg); | ||
21736 | } | ||
21737 | warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); | ||
21738 | firstTime = false; | ||
21739 | } | ||
21740 | return fn.apply(this, arguments); | ||
21741 | }, fn); | ||
21742 | } | ||
21743 | |||
21744 | var deprecations = {}; | ||
21745 | |||
21746 | function deprecateSimple(name, msg) { | ||
21747 | if (hooks.deprecationHandler != null) { | ||
21748 | hooks.deprecationHandler(name, msg); | ||
21749 | } | ||
21750 | if (!deprecations[name]) { | ||
21751 | warn(msg); | ||
21752 | deprecations[name] = true; | ||
21753 | } | ||
21754 | } | ||
21755 | |||
21756 | hooks.suppressDeprecationWarnings = false; | ||
21757 | hooks.deprecationHandler = null; | ||
21758 | |||
21759 | function isFunction(input) { | ||
21760 | return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; | ||
21761 | } | ||
21762 | |||
21763 | function set (config) { | ||
21764 | var prop, i; | ||
21765 | for (i in config) { | ||
21766 | prop = config[i]; | ||
21767 | if (isFunction(prop)) { | ||
21768 | this[i] = prop; | ||
21769 | } else { | ||
21770 | this['_' + i] = prop; | ||
21771 | } | ||
21772 | } | ||
21773 | this._config = config; | ||
21774 | // Lenient ordinal parsing accepts just a number in addition to | ||
21775 | // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. | ||
21776 | // TODO: Remove "ordinalParse" fallback in next major release. | ||
21777 | this._dayOfMonthOrdinalParseLenient = new RegExp( | ||
21778 | (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + | ||
21779 | '|' + (/\d{1,2}/).source); | ||
21780 | } | ||
21781 | |||
21782 | function mergeConfigs(parentConfig, childConfig) { | ||
21783 | var res = extend({}, parentConfig), prop; | ||
21784 | for (prop in childConfig) { | ||
21785 | if (hasOwnProp(childConfig, prop)) { | ||
21786 | if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { | ||
21787 | res[prop] = {}; | ||
21788 | extend(res[prop], parentConfig[prop]); | ||
21789 | extend(res[prop], childConfig[prop]); | ||
21790 | } else if (childConfig[prop] != null) { | ||
21791 | res[prop] = childConfig[prop]; | ||
21792 | } else { | ||
21793 | delete res[prop]; | ||
21794 | } | ||
21795 | } | ||
21796 | } | ||
21797 | for (prop in parentConfig) { | ||
21798 | if (hasOwnProp(parentConfig, prop) && | ||
21799 | !hasOwnProp(childConfig, prop) && | ||
21800 | isObject(parentConfig[prop])) { | ||
21801 | // make sure changes to properties don't modify parent config | ||
21802 | res[prop] = extend({}, res[prop]); | ||
21803 | } | ||
21804 | } | ||
21805 | return res; | ||
21806 | } | ||
21807 | |||
21808 | function Locale(config) { | ||
21809 | if (config != null) { | ||
21810 | this.set(config); | ||
21811 | } | ||
21812 | } | ||
21813 | |||
21814 | var keys; | ||
21815 | |||
21816 | if (Object.keys) { | ||
21817 | keys = Object.keys; | ||
21818 | } else { | ||
21819 | keys = function (obj) { | ||
21820 | var i, res = []; | ||
21821 | for (i in obj) { | ||
21822 | if (hasOwnProp(obj, i)) { | ||
21823 | res.push(i); | ||
21824 | } | ||
21825 | } | ||
21826 | return res; | ||
21827 | }; | ||
21828 | } | ||
21829 | |||
21830 | var keys$1 = keys; | ||
21831 | |||
21832 | var defaultCalendar = { | ||
21833 | sameDay : '[Today at] LT', | ||
21834 | nextDay : '[Tomorrow at] LT', | ||
21835 | nextWeek : 'dddd [at] LT', | ||
21836 | lastDay : '[Yesterday at] LT', | ||
21837 | lastWeek : '[Last] dddd [at] LT', | ||
21838 | sameElse : 'L' | ||
21839 | }; | ||
21840 | |||
21841 | function calendar (key, mom, now) { | ||
21842 | var output = this._calendar[key] || this._calendar['sameElse']; | ||
21843 | return isFunction(output) ? output.call(mom, now) : output; | ||
21844 | } | ||
21845 | |||
21846 | var defaultLongDateFormat = { | ||
21847 | LTS : 'h:mm:ss A', | ||
21848 | LT : 'h:mm A', | ||
21849 | L : 'MM/DD/YYYY', | ||
21850 | LL : 'MMMM D, YYYY', | ||
21851 | LLL : 'MMMM D, YYYY h:mm A', | ||
21852 | LLLL : 'dddd, MMMM D, YYYY h:mm A' | ||
21853 | }; | ||
21854 | |||
21855 | function longDateFormat (key) { | ||
21856 | var format = this._longDateFormat[key], | ||
21857 | formatUpper = this._longDateFormat[key.toUpperCase()]; | ||
21858 | |||
21859 | if (format || !formatUpper) { | ||
21860 | return format; | ||
21861 | } | ||
21862 | |||
21863 | this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { | ||
21864 | return val.slice(1); | ||
21865 | }); | ||
21866 | |||
21867 | return this._longDateFormat[key]; | ||
21868 | } | ||
21869 | |||
21870 | var defaultInvalidDate = 'Invalid date'; | ||
21871 | |||
21872 | function invalidDate () { | ||
21873 | return this._invalidDate; | ||
21874 | } | ||
21875 | |||
21876 | var defaultOrdinal = '%d'; | ||
21877 | var defaultDayOfMonthOrdinalParse = /\d{1,2}/; | ||
21878 | |||
21879 | function ordinal (number) { | ||
21880 | return this._ordinal.replace('%d', number); | ||
21881 | } | ||
21882 | |||
21883 | var defaultRelativeTime = { | ||
21884 | future : 'in %s', | ||
21885 | past : '%s ago', | ||
21886 | s : 'a few seconds', | ||
21887 | ss : '%d seconds', | ||
21888 | m : 'a minute', | ||
21889 | mm : '%d minutes', | ||
21890 | h : 'an hour', | ||
21891 | hh : '%d hours', | ||
21892 | d : 'a day', | ||
21893 | dd : '%d days', | ||
21894 | M : 'a month', | ||
21895 | MM : '%d months', | ||
21896 | y : 'a year', | ||
21897 | yy : '%d years' | ||
21898 | }; | ||
21899 | |||
21900 | function relativeTime (number, withoutSuffix, string, isFuture) { | ||
21901 | var output = this._relativeTime[string]; | ||
21902 | return (isFunction(output)) ? | ||
21903 | output(number, withoutSuffix, string, isFuture) : | ||
21904 | output.replace(/%d/i, number); | ||
21905 | } | ||
21906 | |||
21907 | function pastFuture (diff, output) { | ||
21908 | var format = this._relativeTime[diff > 0 ? 'future' : 'past']; | ||
21909 | return isFunction(format) ? format(output) : format.replace(/%s/i, output); | ||
21910 | } | ||
21911 | |||
21912 | var aliases = {}; | ||
21913 | |||
21914 | function addUnitAlias (unit, shorthand) { | ||
21915 | var lowerCase = unit.toLowerCase(); | ||
21916 | aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; | ||
21917 | } | ||
21918 | |||
21919 | function normalizeUnits(units) { | ||
21920 | return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; | ||
21921 | } | ||
21922 | |||
21923 | function normalizeObjectUnits(inputObject) { | ||
21924 | var normalizedInput = {}, | ||
21925 | normalizedProp, | ||
21926 | prop; | ||
21927 | |||
21928 | for (prop in inputObject) { | ||
21929 | if (hasOwnProp(inputObject, prop)) { | ||
21930 | normalizedProp = normalizeUnits(prop); | ||
21931 | if (normalizedProp) { | ||
21932 | normalizedInput[normalizedProp] = inputObject[prop]; | ||
21933 | } | ||
21934 | } | ||
21935 | } | ||
21936 | |||
21937 | return normalizedInput; | ||
21938 | } | ||
21939 | |||
21940 | var priorities = {}; | ||
21941 | |||
21942 | function addUnitPriority(unit, priority) { | ||
21943 | priorities[unit] = priority; | ||
21944 | } | ||
21945 | |||
21946 | function getPrioritizedUnits(unitsObj) { | ||
21947 | var units = []; | ||
21948 | for (var u in unitsObj) { | ||
21949 | units.push({unit: u, priority: priorities[u]}); | ||
21950 | } | ||
21951 | units.sort(function (a, b) { | ||
21952 | return a.priority - b.priority; | ||
21953 | }); | ||
21954 | return units; | ||
21955 | } | ||
21956 | |||
21957 | function makeGetSet (unit, keepTime) { | ||
21958 | return function (value) { | ||
21959 | if (value != null) { | ||
21960 | set$1(this, unit, value); | ||
21961 | hooks.updateOffset(this, keepTime); | ||
21962 | return this; | ||
21963 | } else { | ||
21964 | return get(this, unit); | ||
21965 | } | ||
21966 | }; | ||
21967 | } | ||
21968 | |||
21969 | function get (mom, unit) { | ||
21970 | return mom.isValid() ? | ||
21971 | mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; | ||
21972 | } | ||
21973 | |||
21974 | function set$1 (mom, unit, value) { | ||
21975 | if (mom.isValid()) { | ||
21976 | mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); | ||
21977 | } | ||
21978 | } | ||
21979 | |||
21980 | // MOMENTS | ||
21981 | |||
21982 | function stringGet (units) { | ||
21983 | units = normalizeUnits(units); | ||
21984 | if (isFunction(this[units])) { | ||
21985 | return this[units](); | ||
21986 | } | ||
21987 | return this; | ||
21988 | } | ||
21989 | |||
21990 | |||
21991 | function stringSet (units, value) { | ||
21992 | if (typeof units === 'object') { | ||
21993 | units = normalizeObjectUnits(units); | ||
21994 | var prioritized = getPrioritizedUnits(units); | ||
21995 | for (var i = 0; i < prioritized.length; i++) { | ||
21996 | this[prioritized[i].unit](units[prioritized[i].unit]); | ||
21997 | } | ||
21998 | } else { | ||
21999 | units = normalizeUnits(units); | ||
22000 | if (isFunction(this[units])) { | ||
22001 | return this[units](value); | ||
22002 | } | ||
22003 | } | ||
22004 | return this; | ||
22005 | } | ||
22006 | |||
22007 | function zeroFill(number, targetLength, forceSign) { | ||
22008 | var absNumber = '' + Math.abs(number), | ||
22009 | zerosToFill = targetLength - absNumber.length, | ||
22010 | sign = number >= 0; | ||
22011 | return (sign ? (forceSign ? '+' : '') : '-') + | ||
22012 | Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; | ||
22013 | } | ||
22014 | |||
22015 | var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; | ||
22016 | |||
22017 | var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; | ||
22018 | |||
22019 | var formatFunctions = {}; | ||
22020 | |||
22021 | var formatTokenFunctions = {}; | ||
22022 | |||
22023 | // token: 'M' | ||
22024 | // padded: ['MM', 2] | ||
22025 | // ordinal: 'Mo' | ||
22026 | // callback: function () { this.month() + 1 } | ||
22027 | function addFormatToken (token, padded, ordinal, callback) { | ||
22028 | var func = callback; | ||
22029 | if (typeof callback === 'string') { | ||
22030 | func = function () { | ||
22031 | return this[callback](); | ||
22032 | }; | ||
22033 | } | ||
22034 | if (token) { | ||
22035 | formatTokenFunctions[token] = func; | ||
22036 | } | ||
22037 | if (padded) { | ||
22038 | formatTokenFunctions[padded[0]] = function () { | ||
22039 | return zeroFill(func.apply(this, arguments), padded[1], padded[2]); | ||
22040 | }; | ||
22041 | } | ||
22042 | if (ordinal) { | ||
22043 | formatTokenFunctions[ordinal] = function () { | ||
22044 | return this.localeData().ordinal(func.apply(this, arguments), token); | ||
22045 | }; | ||
22046 | } | ||
22047 | } | ||
22048 | |||
22049 | function removeFormattingTokens(input) { | ||
22050 | if (input.match(/\[[\s\S]/)) { | ||
22051 | return input.replace(/^\[|\]$/g, ''); | ||
22052 | } | ||
22053 | return input.replace(/\\/g, ''); | ||
22054 | } | ||
22055 | |||
22056 | function makeFormatFunction(format) { | ||
22057 | var array = format.match(formattingTokens), i, length; | ||
22058 | |||
22059 | for (i = 0, length = array.length; i < length; i++) { | ||
22060 | if (formatTokenFunctions[array[i]]) { | ||
22061 | array[i] = formatTokenFunctions[array[i]]; | ||
22062 | } else { | ||
22063 | array[i] = removeFormattingTokens(array[i]); | ||
22064 | } | ||
22065 | } | ||
22066 | |||
22067 | return function (mom) { | ||
22068 | var output = '', i; | ||
22069 | for (i = 0; i < length; i++) { | ||
22070 | output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; | ||
22071 | } | ||
22072 | return output; | ||
22073 | }; | ||
22074 | } | ||
22075 | |||
22076 | // format date using native date object | ||
22077 | function formatMoment(m, format) { | ||
22078 | if (!m.isValid()) { | ||
22079 | return m.localeData().invalidDate(); | ||
22080 | } | ||
22081 | |||
22082 | format = expandFormat(format, m.localeData()); | ||
22083 | formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); | ||
22084 | |||
22085 | return formatFunctions[format](m); | ||
22086 | } | ||
22087 | |||
22088 | function expandFormat(format, locale) { | ||
22089 | var i = 5; | ||
22090 | |||
22091 | function replaceLongDateFormatTokens(input) { | ||
22092 | return locale.longDateFormat(input) || input; | ||
22093 | } | ||
22094 | |||
22095 | localFormattingTokens.lastIndex = 0; | ||
22096 | while (i >= 0 && localFormattingTokens.test(format)) { | ||
22097 | format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); | ||
22098 | localFormattingTokens.lastIndex = 0; | ||
22099 | i -= 1; | ||
22100 | } | ||
22101 | |||
22102 | return format; | ||
22103 | } | ||
22104 | |||
22105 | var match1 = /\d/; // 0 - 9 | ||
22106 | var match2 = /\d\d/; // 00 - 99 | ||
22107 | var match3 = /\d{3}/; // 000 - 999 | ||
22108 | var match4 = /\d{4}/; // 0000 - 9999 | ||
22109 | var match6 = /[+-]?\d{6}/; // -999999 - 999999 | ||
22110 | var match1to2 = /\d\d?/; // 0 - 99 | ||
22111 | var match3to4 = /\d\d\d\d?/; // 999 - 9999 | ||
22112 | var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 | ||
22113 | var match1to3 = /\d{1,3}/; // 0 - 999 | ||
22114 | var match1to4 = /\d{1,4}/; // 0 - 9999 | ||
22115 | var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 | ||
22116 | |||
22117 | var matchUnsigned = /\d+/; // 0 - inf | ||
22118 | var matchSigned = /[+-]?\d+/; // -inf - inf | ||
22119 | |||
22120 | var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z | ||
22121 | var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z | ||
22122 | |||
22123 | var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 | ||
22124 | |||
22125 | // any word (or two) characters or numbers including two/three word month in arabic. | ||
22126 | // includes scottish gaelic two word and hyphenated months | ||
22127 | var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; | ||
22128 | |||
22129 | |||
22130 | var regexes = {}; | ||
22131 | |||
22132 | function addRegexToken (token, regex, strictRegex) { | ||
22133 | regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { | ||
22134 | return (isStrict && strictRegex) ? strictRegex : regex; | ||
22135 | }; | ||
22136 | } | ||
22137 | |||
22138 | function getParseRegexForToken (token, config) { | ||
22139 | if (!hasOwnProp(regexes, token)) { | ||
22140 | return new RegExp(unescapeFormat(token)); | ||
22141 | } | ||
22142 | |||
22143 | return regexes[token](config._strict, config._locale); | ||
22144 | } | ||
22145 | |||
22146 | // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript | ||
22147 | function unescapeFormat(s) { | ||
22148 | return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { | ||
22149 | return p1 || p2 || p3 || p4; | ||
22150 | })); | ||
22151 | } | ||
22152 | |||
22153 | function regexEscape(s) { | ||
22154 | return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); | ||
22155 | } | ||
22156 | |||
22157 | var tokens = {}; | ||
22158 | |||
22159 | function addParseToken (token, callback) { | ||
22160 | var i, func = callback; | ||
22161 | if (typeof token === 'string') { | ||
22162 | token = [token]; | ||
22163 | } | ||
22164 | if (isNumber(callback)) { | ||
22165 | func = function (input, array) { | ||
22166 | array[callback] = toInt(input); | ||
22167 | }; | ||
22168 | } | ||
22169 | for (i = 0; i < token.length; i++) { | ||
22170 | tokens[token[i]] = func; | ||
22171 | } | ||
22172 | } | ||
22173 | |||
22174 | function addWeekParseToken (token, callback) { | ||
22175 | addParseToken(token, function (input, array, config, token) { | ||
22176 | config._w = config._w || {}; | ||
22177 | callback(input, config._w, config, token); | ||
22178 | }); | ||
22179 | } | ||
22180 | |||
22181 | function addTimeToArrayFromToken(token, input, config) { | ||
22182 | if (input != null && hasOwnProp(tokens, token)) { | ||
22183 | tokens[token](input, config._a, config, token); | ||
22184 | } | ||
22185 | } | ||
22186 | |||
22187 | var YEAR = 0; | ||
22188 | var MONTH = 1; | ||
22189 | var DATE = 2; | ||
22190 | var HOUR = 3; | ||
22191 | var MINUTE = 4; | ||
22192 | var SECOND = 5; | ||
22193 | var MILLISECOND = 6; | ||
22194 | var WEEK = 7; | ||
22195 | var WEEKDAY = 8; | ||
22196 | |||
22197 | var indexOf; | ||
22198 | |||
22199 | if (Array.prototype.indexOf) { | ||
22200 | indexOf = Array.prototype.indexOf; | ||
22201 | } else { | ||
22202 | indexOf = function (o) { | ||
22203 | // I know | ||
22204 | var i; | ||
22205 | for (i = 0; i < this.length; ++i) { | ||
22206 | if (this[i] === o) { | ||
22207 | return i; | ||
22208 | } | ||
22209 | } | ||
22210 | return -1; | ||
22211 | }; | ||
22212 | } | ||
22213 | |||
22214 | var indexOf$1 = indexOf; | ||
22215 | |||
22216 | function daysInMonth(year, month) { | ||
22217 | return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); | ||
22218 | } | ||
22219 | |||
22220 | // FORMATTING | ||
22221 | |||
22222 | addFormatToken('M', ['MM', 2], 'Mo', function () { | ||
22223 | return this.month() + 1; | ||
22224 | }); | ||
22225 | |||
22226 | addFormatToken('MMM', 0, 0, function (format) { | ||
22227 | return this.localeData().monthsShort(this, format); | ||
22228 | }); | ||
22229 | |||
22230 | addFormatToken('MMMM', 0, 0, function (format) { | ||
22231 | return this.localeData().months(this, format); | ||
22232 | }); | ||
22233 | |||
22234 | // ALIASES | ||
22235 | |||
22236 | addUnitAlias('month', 'M'); | ||
22237 | |||
22238 | // PRIORITY | ||
22239 | |||
22240 | addUnitPriority('month', 8); | ||
22241 | |||
22242 | // PARSING | ||
22243 | |||
22244 | addRegexToken('M', match1to2); | ||
22245 | addRegexToken('MM', match1to2, match2); | ||
22246 | addRegexToken('MMM', function (isStrict, locale) { | ||
22247 | return locale.monthsShortRegex(isStrict); | ||
22248 | }); | ||
22249 | addRegexToken('MMMM', function (isStrict, locale) { | ||
22250 | return locale.monthsRegex(isStrict); | ||
22251 | }); | ||
22252 | |||
22253 | addParseToken(['M', 'MM'], function (input, array) { | ||
22254 | array[MONTH] = toInt(input) - 1; | ||
22255 | }); | ||
22256 | |||
22257 | addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { | ||
22258 | var month = config._locale.monthsParse(input, token, config._strict); | ||
22259 | // if we didn't find a month name, mark the date as invalid. | ||
22260 | if (month != null) { | ||
22261 | array[MONTH] = month; | ||
22262 | } else { | ||
22263 | getParsingFlags(config).invalidMonth = input; | ||
22264 | } | ||
22265 | }); | ||
22266 | |||
22267 | // LOCALES | ||
22268 | |||
22269 | var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/; | ||
22270 | var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); | ||
22271 | function localeMonths (m, format) { | ||
22272 | if (!m) { | ||
22273 | return isArray(this._months) ? this._months : | ||
22274 | this._months['standalone']; | ||
22275 | } | ||
22276 | return isArray(this._months) ? this._months[m.month()] : | ||
22277 | this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; | ||
22278 | } | ||
22279 | |||
22280 | var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); | ||
22281 | function localeMonthsShort (m, format) { | ||
22282 | if (!m) { | ||
22283 | return isArray(this._monthsShort) ? this._monthsShort : | ||
22284 | this._monthsShort['standalone']; | ||
22285 | } | ||
22286 | return isArray(this._monthsShort) ? this._monthsShort[m.month()] : | ||
22287 | this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; | ||
22288 | } | ||
22289 | |||
22290 | function handleStrictParse(monthName, format, strict) { | ||
22291 | var i, ii, mom, llc = monthName.toLocaleLowerCase(); | ||
22292 | if (!this._monthsParse) { | ||
22293 | // this is not used | ||
22294 | this._monthsParse = []; | ||
22295 | this._longMonthsParse = []; | ||
22296 | this._shortMonthsParse = []; | ||
22297 | for (i = 0; i < 12; ++i) { | ||
22298 | mom = createUTC([2000, i]); | ||
22299 | this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); | ||
22300 | this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); | ||
22301 | } | ||
22302 | } | ||
22303 | |||
22304 | if (strict) { | ||
22305 | if (format === 'MMM') { | ||
22306 | ii = indexOf$1.call(this._shortMonthsParse, llc); | ||
22307 | return ii !== -1 ? ii : null; | ||
22308 | } else { | ||
22309 | ii = indexOf$1.call(this._longMonthsParse, llc); | ||
22310 | return ii !== -1 ? ii : null; | ||
22311 | } | ||
22312 | } else { | ||
22313 | if (format === 'MMM') { | ||
22314 | ii = indexOf$1.call(this._shortMonthsParse, llc); | ||
22315 | if (ii !== -1) { | ||
22316 | return ii; | ||
22317 | } | ||
22318 | ii = indexOf$1.call(this._longMonthsParse, llc); | ||
22319 | return ii !== -1 ? ii : null; | ||
22320 | } else { | ||
22321 | ii = indexOf$1.call(this._longMonthsParse, llc); | ||
22322 | if (ii !== -1) { | ||
22323 | return ii; | ||
22324 | } | ||
22325 | ii = indexOf$1.call(this._shortMonthsParse, llc); | ||
22326 | return ii !== -1 ? ii : null; | ||
22327 | } | ||
22328 | } | ||
22329 | } | ||
22330 | |||
22331 | function localeMonthsParse (monthName, format, strict) { | ||
22332 | var i, mom, regex; | ||
22333 | |||
22334 | if (this._monthsParseExact) { | ||
22335 | return handleStrictParse.call(this, monthName, format, strict); | ||
22336 | } | ||
22337 | |||
22338 | if (!this._monthsParse) { | ||
22339 | this._monthsParse = []; | ||
22340 | this._longMonthsParse = []; | ||
22341 | this._shortMonthsParse = []; | ||
22342 | } | ||
22343 | |||
22344 | // TODO: add sorting | ||
22345 | // Sorting makes sure if one month (or abbr) is a prefix of another | ||
22346 | // see sorting in computeMonthsParse | ||
22347 | for (i = 0; i < 12; i++) { | ||
22348 | // make the regex if we don't have it already | ||
22349 | mom = createUTC([2000, i]); | ||
22350 | if (strict && !this._longMonthsParse[i]) { | ||
22351 | this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); | ||
22352 | this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); | ||
22353 | } | ||
22354 | if (!strict && !this._monthsParse[i]) { | ||
22355 | regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); | ||
22356 | this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); | ||
22357 | } | ||
22358 | // test the regex | ||
22359 | if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { | ||
22360 | return i; | ||
22361 | } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { | ||
22362 | return i; | ||
22363 | } else if (!strict && this._monthsParse[i].test(monthName)) { | ||
22364 | return i; | ||
22365 | } | ||
22366 | } | ||
22367 | } | ||
22368 | |||
22369 | // MOMENTS | ||
22370 | |||
22371 | function setMonth (mom, value) { | ||
22372 | var dayOfMonth; | ||
22373 | |||
22374 | if (!mom.isValid()) { | ||
22375 | // No op | ||
22376 | return mom; | ||
22377 | } | ||
22378 | |||
22379 | if (typeof value === 'string') { | ||
22380 | if (/^\d+$/.test(value)) { | ||
22381 | value = toInt(value); | ||
22382 | } else { | ||
22383 | value = mom.localeData().monthsParse(value); | ||
22384 | // TODO: Another silent failure? | ||
22385 | if (!isNumber(value)) { | ||
22386 | return mom; | ||
22387 | } | ||
22388 | } | ||
22389 | } | ||
22390 | |||
22391 | dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); | ||
22392 | mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); | ||
22393 | return mom; | ||
22394 | } | ||
22395 | |||
22396 | function getSetMonth (value) { | ||
22397 | if (value != null) { | ||
22398 | setMonth(this, value); | ||
22399 | hooks.updateOffset(this, true); | ||
22400 | return this; | ||
22401 | } else { | ||
22402 | return get(this, 'Month'); | ||
22403 | } | ||
22404 | } | ||
22405 | |||
22406 | function getDaysInMonth () { | ||
22407 | return daysInMonth(this.year(), this.month()); | ||
22408 | } | ||
22409 | |||
22410 | var defaultMonthsShortRegex = matchWord; | ||
22411 | function monthsShortRegex (isStrict) { | ||
22412 | if (this._monthsParseExact) { | ||
22413 | if (!hasOwnProp(this, '_monthsRegex')) { | ||
22414 | computeMonthsParse.call(this); | ||
22415 | } | ||
22416 | if (isStrict) { | ||
22417 | return this._monthsShortStrictRegex; | ||
22418 | } else { | ||
22419 | return this._monthsShortRegex; | ||
22420 | } | ||
22421 | } else { | ||
22422 | if (!hasOwnProp(this, '_monthsShortRegex')) { | ||
22423 | this._monthsShortRegex = defaultMonthsShortRegex; | ||
22424 | } | ||
22425 | return this._monthsShortStrictRegex && isStrict ? | ||
22426 | this._monthsShortStrictRegex : this._monthsShortRegex; | ||
22427 | } | ||
22428 | } | ||
22429 | |||
22430 | var defaultMonthsRegex = matchWord; | ||
22431 | function monthsRegex (isStrict) { | ||
22432 | if (this._monthsParseExact) { | ||
22433 | if (!hasOwnProp(this, '_monthsRegex')) { | ||
22434 | computeMonthsParse.call(this); | ||
22435 | } | ||
22436 | if (isStrict) { | ||
22437 | return this._monthsStrictRegex; | ||
22438 | } else { | ||
22439 | return this._monthsRegex; | ||
22440 | } | ||
22441 | } else { | ||
22442 | if (!hasOwnProp(this, '_monthsRegex')) { | ||
22443 | this._monthsRegex = defaultMonthsRegex; | ||
22444 | } | ||
22445 | return this._monthsStrictRegex && isStrict ? | ||
22446 | this._monthsStrictRegex : this._monthsRegex; | ||
22447 | } | ||
22448 | } | ||
22449 | |||
22450 | function computeMonthsParse () { | ||
22451 | function cmpLenRev(a, b) { | ||
22452 | return b.length - a.length; | ||
22453 | } | ||
22454 | |||
22455 | var shortPieces = [], longPieces = [], mixedPieces = [], | ||
22456 | i, mom; | ||
22457 | for (i = 0; i < 12; i++) { | ||
22458 | // make the regex if we don't have it already | ||
22459 | mom = createUTC([2000, i]); | ||
22460 | shortPieces.push(this.monthsShort(mom, '')); | ||
22461 | longPieces.push(this.months(mom, '')); | ||
22462 | mixedPieces.push(this.months(mom, '')); | ||
22463 | mixedPieces.push(this.monthsShort(mom, '')); | ||
22464 | } | ||
22465 | // Sorting makes sure if one month (or abbr) is a prefix of another it | ||
22466 | // will match the longer piece. | ||
22467 | shortPieces.sort(cmpLenRev); | ||
22468 | longPieces.sort(cmpLenRev); | ||
22469 | mixedPieces.sort(cmpLenRev); | ||
22470 | for (i = 0; i < 12; i++) { | ||
22471 | shortPieces[i] = regexEscape(shortPieces[i]); | ||
22472 | longPieces[i] = regexEscape(longPieces[i]); | ||
22473 | } | ||
22474 | for (i = 0; i < 24; i++) { | ||
22475 | mixedPieces[i] = regexEscape(mixedPieces[i]); | ||
22476 | } | ||
22477 | |||
22478 | this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); | ||
22479 | this._monthsShortRegex = this._monthsRegex; | ||
22480 | this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); | ||
22481 | this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); | ||
22482 | } | ||
22483 | |||
22484 | // FORMATTING | ||
22485 | |||
22486 | addFormatToken('Y', 0, 0, function () { | ||
22487 | var y = this.year(); | ||
22488 | return y <= 9999 ? '' + y : '+' + y; | ||
22489 | }); | ||
22490 | |||
22491 | addFormatToken(0, ['YY', 2], 0, function () { | ||
22492 | return this.year() % 100; | ||
22493 | }); | ||
22494 | |||
22495 | addFormatToken(0, ['YYYY', 4], 0, 'year'); | ||
22496 | addFormatToken(0, ['YYYYY', 5], 0, 'year'); | ||
22497 | addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); | ||
22498 | |||
22499 | // ALIASES | ||
22500 | |||
22501 | addUnitAlias('year', 'y'); | ||
22502 | |||
22503 | // PRIORITIES | ||
22504 | |||
22505 | addUnitPriority('year', 1); | ||
22506 | |||
22507 | // PARSING | ||
22508 | |||
22509 | addRegexToken('Y', matchSigned); | ||
22510 | addRegexToken('YY', match1to2, match2); | ||
22511 | addRegexToken('YYYY', match1to4, match4); | ||
22512 | addRegexToken('YYYYY', match1to6, match6); | ||
22513 | addRegexToken('YYYYYY', match1to6, match6); | ||
22514 | |||
22515 | addParseToken(['YYYYY', 'YYYYYY'], YEAR); | ||
22516 | addParseToken('YYYY', function (input, array) { | ||
22517 | array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); | ||
22518 | }); | ||
22519 | addParseToken('YY', function (input, array) { | ||
22520 | array[YEAR] = hooks.parseTwoDigitYear(input); | ||
22521 | }); | ||
22522 | addParseToken('Y', function (input, array) { | ||
22523 | array[YEAR] = parseInt(input, 10); | ||
22524 | }); | ||
22525 | |||
22526 | // HELPERS | ||
22527 | |||
22528 | function daysInYear(year) { | ||
22529 | return isLeapYear(year) ? 366 : 365; | ||
22530 | } | ||
22531 | |||
22532 | function isLeapYear(year) { | ||
22533 | return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; | ||
22534 | } | ||
22535 | |||
22536 | // HOOKS | ||
22537 | |||
22538 | hooks.parseTwoDigitYear = function (input) { | ||
22539 | return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); | ||
22540 | }; | ||
22541 | |||
22542 | // MOMENTS | ||
22543 | |||
22544 | var getSetYear = makeGetSet('FullYear', true); | ||
22545 | |||
22546 | function getIsLeapYear () { | ||
22547 | return isLeapYear(this.year()); | ||
22548 | } | ||
22549 | |||
22550 | function createDate (y, m, d, h, M, s, ms) { | ||
22551 | // can't just apply() to create a date: | ||
22552 | // https://stackoverflow.com/q/181348 | ||
22553 | var date = new Date(y, m, d, h, M, s, ms); | ||
22554 | |||
22555 | // the date constructor remaps years 0-99 to 1900-1999 | ||
22556 | if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { | ||
22557 | date.setFullYear(y); | ||
22558 | } | ||
22559 | return date; | ||
22560 | } | ||
22561 | |||
22562 | function createUTCDate (y) { | ||
22563 | var date = new Date(Date.UTC.apply(null, arguments)); | ||
22564 | |||
22565 | // the Date.UTC function remaps years 0-99 to 1900-1999 | ||
22566 | if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { | ||
22567 | date.setUTCFullYear(y); | ||
22568 | } | ||
22569 | return date; | ||
22570 | } | ||
22571 | |||
22572 | // start-of-first-week - start-of-year | ||
22573 | function firstWeekOffset(year, dow, doy) { | ||
22574 | var // first-week day -- which january is always in the first week (4 for iso, 1 for other) | ||
22575 | fwd = 7 + dow - doy, | ||
22576 | // first-week day local weekday -- which local weekday is fwd | ||
22577 | fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; | ||
22578 | |||
22579 | return -fwdlw + fwd - 1; | ||
22580 | } | ||
22581 | |||
22582 | // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday | ||
22583 | function dayOfYearFromWeeks(year, week, weekday, dow, doy) { | ||
22584 | var localWeekday = (7 + weekday - dow) % 7, | ||
22585 | weekOffset = firstWeekOffset(year, dow, doy), | ||
22586 | dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, | ||
22587 | resYear, resDayOfYear; | ||
22588 | |||
22589 | if (dayOfYear <= 0) { | ||
22590 | resYear = year - 1; | ||
22591 | resDayOfYear = daysInYear(resYear) + dayOfYear; | ||
22592 | } else if (dayOfYear > daysInYear(year)) { | ||
22593 | resYear = year + 1; | ||
22594 | resDayOfYear = dayOfYear - daysInYear(year); | ||
22595 | } else { | ||
22596 | resYear = year; | ||
22597 | resDayOfYear = dayOfYear; | ||
22598 | } | ||
22599 | |||
22600 | return { | ||
22601 | year: resYear, | ||
22602 | dayOfYear: resDayOfYear | ||
22603 | }; | ||
22604 | } | ||
22605 | |||
22606 | function weekOfYear(mom, dow, doy) { | ||
22607 | var weekOffset = firstWeekOffset(mom.year(), dow, doy), | ||
22608 | week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, | ||
22609 | resWeek, resYear; | ||
22610 | |||
22611 | if (week < 1) { | ||
22612 | resYear = mom.year() - 1; | ||
22613 | resWeek = week + weeksInYear(resYear, dow, doy); | ||
22614 | } else if (week > weeksInYear(mom.year(), dow, doy)) { | ||
22615 | resWeek = week - weeksInYear(mom.year(), dow, doy); | ||
22616 | resYear = mom.year() + 1; | ||
22617 | } else { | ||
22618 | resYear = mom.year(); | ||
22619 | resWeek = week; | ||
22620 | } | ||
22621 | |||
22622 | return { | ||
22623 | week: resWeek, | ||
22624 | year: resYear | ||
22625 | }; | ||
22626 | } | ||
22627 | |||
22628 | function weeksInYear(year, dow, doy) { | ||
22629 | var weekOffset = firstWeekOffset(year, dow, doy), | ||
22630 | weekOffsetNext = firstWeekOffset(year + 1, dow, doy); | ||
22631 | return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; | ||
22632 | } | ||
22633 | |||
22634 | // FORMATTING | ||
22635 | |||
22636 | addFormatToken('w', ['ww', 2], 'wo', 'week'); | ||
22637 | addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); | ||
22638 | |||
22639 | // ALIASES | ||
22640 | |||
22641 | addUnitAlias('week', 'w'); | ||
22642 | addUnitAlias('isoWeek', 'W'); | ||
22643 | |||
22644 | // PRIORITIES | ||
22645 | |||
22646 | addUnitPriority('week', 5); | ||
22647 | addUnitPriority('isoWeek', 5); | ||
22648 | |||
22649 | // PARSING | ||
22650 | |||
22651 | addRegexToken('w', match1to2); | ||
22652 | addRegexToken('ww', match1to2, match2); | ||
22653 | addRegexToken('W', match1to2); | ||
22654 | addRegexToken('WW', match1to2, match2); | ||
22655 | |||
22656 | addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { | ||
22657 | week[token.substr(0, 1)] = toInt(input); | ||
22658 | }); | ||
22659 | |||
22660 | // HELPERS | ||
22661 | |||
22662 | // LOCALES | ||
22663 | |||
22664 | function localeWeek (mom) { | ||
22665 | return weekOfYear(mom, this._week.dow, this._week.doy).week; | ||
22666 | } | ||
22667 | |||
22668 | var defaultLocaleWeek = { | ||
22669 | dow : 0, // Sunday is the first day of the week. | ||
22670 | doy : 6 // The week that contains Jan 1st is the first week of the year. | ||
22671 | }; | ||
22672 | |||
22673 | function localeFirstDayOfWeek () { | ||
22674 | return this._week.dow; | ||
22675 | } | ||
22676 | |||
22677 | function localeFirstDayOfYear () { | ||
22678 | return this._week.doy; | ||
22679 | } | ||
22680 | |||
22681 | // MOMENTS | ||
22682 | |||
22683 | function getSetWeek (input) { | ||
22684 | var week = this.localeData().week(this); | ||
22685 | return input == null ? week : this.add((input - week) * 7, 'd'); | ||
22686 | } | ||
22687 | |||
22688 | function getSetISOWeek (input) { | ||
22689 | var week = weekOfYear(this, 1, 4).week; | ||
22690 | return input == null ? week : this.add((input - week) * 7, 'd'); | ||
22691 | } | ||
22692 | |||
22693 | // FORMATTING | ||
22694 | |||
22695 | addFormatToken('d', 0, 'do', 'day'); | ||
22696 | |||
22697 | addFormatToken('dd', 0, 0, function (format) { | ||
22698 | return this.localeData().weekdaysMin(this, format); | ||
22699 | }); | ||
22700 | |||
22701 | addFormatToken('ddd', 0, 0, function (format) { | ||
22702 | return this.localeData().weekdaysShort(this, format); | ||
22703 | }); | ||
22704 | |||
22705 | addFormatToken('dddd', 0, 0, function (format) { | ||
22706 | return this.localeData().weekdays(this, format); | ||
22707 | }); | ||
22708 | |||
22709 | addFormatToken('e', 0, 0, 'weekday'); | ||
22710 | addFormatToken('E', 0, 0, 'isoWeekday'); | ||
22711 | |||
22712 | // ALIASES | ||
22713 | |||
22714 | addUnitAlias('day', 'd'); | ||
22715 | addUnitAlias('weekday', 'e'); | ||
22716 | addUnitAlias('isoWeekday', 'E'); | ||
22717 | |||
22718 | // PRIORITY | ||
22719 | addUnitPriority('day', 11); | ||
22720 | addUnitPriority('weekday', 11); | ||
22721 | addUnitPriority('isoWeekday', 11); | ||
22722 | |||
22723 | // PARSING | ||
22724 | |||
22725 | addRegexToken('d', match1to2); | ||
22726 | addRegexToken('e', match1to2); | ||
22727 | addRegexToken('E', match1to2); | ||
22728 | addRegexToken('dd', function (isStrict, locale) { | ||
22729 | return locale.weekdaysMinRegex(isStrict); | ||
22730 | }); | ||
22731 | addRegexToken('ddd', function (isStrict, locale) { | ||
22732 | return locale.weekdaysShortRegex(isStrict); | ||
22733 | }); | ||
22734 | addRegexToken('dddd', function (isStrict, locale) { | ||
22735 | return locale.weekdaysRegex(isStrict); | ||
22736 | }); | ||
22737 | |||
22738 | addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { | ||
22739 | var weekday = config._locale.weekdaysParse(input, token, config._strict); | ||
22740 | // if we didn't get a weekday name, mark the date as invalid | ||
22741 | if (weekday != null) { | ||
22742 | week.d = weekday; | ||
22743 | } else { | ||
22744 | getParsingFlags(config).invalidWeekday = input; | ||
22745 | } | ||
22746 | }); | ||
22747 | |||
22748 | addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { | ||
22749 | week[token] = toInt(input); | ||
22750 | }); | ||
22751 | |||
22752 | // HELPERS | ||
22753 | |||
22754 | function parseWeekday(input, locale) { | ||
22755 | if (typeof input !== 'string') { | ||
22756 | return input; | ||
22757 | } | ||
22758 | |||
22759 | if (!isNaN(input)) { | ||
22760 | return parseInt(input, 10); | ||
22761 | } | ||
22762 | |||
22763 | input = locale.weekdaysParse(input); | ||
22764 | if (typeof input === 'number') { | ||
22765 | return input; | ||
22766 | } | ||
22767 | |||
22768 | return null; | ||
22769 | } | ||
22770 | |||
22771 | function parseIsoWeekday(input, locale) { | ||
22772 | if (typeof input === 'string') { | ||
22773 | return locale.weekdaysParse(input) % 7 || 7; | ||
22774 | } | ||
22775 | return isNaN(input) ? null : input; | ||
22776 | } | ||
22777 | |||
22778 | // LOCALES | ||
22779 | |||
22780 | var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); | ||
22781 | function localeWeekdays (m, format) { | ||
22782 | if (!m) { | ||
22783 | return isArray(this._weekdays) ? this._weekdays : | ||
22784 | this._weekdays['standalone']; | ||
22785 | } | ||
22786 | return isArray(this._weekdays) ? this._weekdays[m.day()] : | ||
22787 | this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; | ||
22788 | } | ||
22789 | |||
22790 | var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); | ||
22791 | function localeWeekdaysShort (m) { | ||
22792 | return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; | ||
22793 | } | ||
22794 | |||
22795 | var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); | ||
22796 | function localeWeekdaysMin (m) { | ||
22797 | return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; | ||
22798 | } | ||
22799 | |||
22800 | function handleStrictParse$1(weekdayName, format, strict) { | ||
22801 | var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); | ||
22802 | if (!this._weekdaysParse) { | ||
22803 | this._weekdaysParse = []; | ||
22804 | this._shortWeekdaysParse = []; | ||
22805 | this._minWeekdaysParse = []; | ||
22806 | |||
22807 | for (i = 0; i < 7; ++i) { | ||
22808 | mom = createUTC([2000, 1]).day(i); | ||
22809 | this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); | ||
22810 | this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); | ||
22811 | this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); | ||
22812 | } | ||
22813 | } | ||
22814 | |||
22815 | if (strict) { | ||
22816 | if (format === 'dddd') { | ||
22817 | ii = indexOf$1.call(this._weekdaysParse, llc); | ||
22818 | return ii !== -1 ? ii : null; | ||
22819 | } else if (format === 'ddd') { | ||
22820 | ii = indexOf$1.call(this._shortWeekdaysParse, llc); | ||
22821 | return ii !== -1 ? ii : null; | ||
22822 | } else { | ||
22823 | ii = indexOf$1.call(this._minWeekdaysParse, llc); | ||
22824 | return ii !== -1 ? ii : null; | ||
22825 | } | ||
22826 | } else { | ||
22827 | if (format === 'dddd') { | ||
22828 | ii = indexOf$1.call(this._weekdaysParse, llc); | ||
22829 | if (ii !== -1) { | ||
22830 | return ii; | ||
22831 | } | ||
22832 | ii = indexOf$1.call(this._shortWeekdaysParse, llc); | ||
22833 | if (ii !== -1) { | ||
22834 | return ii; | ||
22835 | } | ||
22836 | ii = indexOf$1.call(this._minWeekdaysParse, llc); | ||
22837 | return ii !== -1 ? ii : null; | ||
22838 | } else if (format === 'ddd') { | ||
22839 | ii = indexOf$1.call(this._shortWeekdaysParse, llc); | ||
22840 | if (ii !== -1) { | ||
22841 | return ii; | ||
22842 | } | ||
22843 | ii = indexOf$1.call(this._weekdaysParse, llc); | ||
22844 | if (ii !== -1) { | ||
22845 | return ii; | ||
22846 | } | ||
22847 | ii = indexOf$1.call(this._minWeekdaysParse, llc); | ||
22848 | return ii !== -1 ? ii : null; | ||
22849 | } else { | ||
22850 | ii = indexOf$1.call(this._minWeekdaysParse, llc); | ||
22851 | if (ii !== -1) { | ||
22852 | return ii; | ||
22853 | } | ||
22854 | ii = indexOf$1.call(this._weekdaysParse, llc); | ||
22855 | if (ii !== -1) { | ||
22856 | return ii; | ||
22857 | } | ||
22858 | ii = indexOf$1.call(this._shortWeekdaysParse, llc); | ||
22859 | return ii !== -1 ? ii : null; | ||
22860 | } | ||
22861 | } | ||
22862 | } | ||
22863 | |||
22864 | function localeWeekdaysParse (weekdayName, format, strict) { | ||
22865 | var i, mom, regex; | ||
22866 | |||
22867 | if (this._weekdaysParseExact) { | ||
22868 | return handleStrictParse$1.call(this, weekdayName, format, strict); | ||
22869 | } | ||
22870 | |||
22871 | if (!this._weekdaysParse) { | ||
22872 | this._weekdaysParse = []; | ||
22873 | this._minWeekdaysParse = []; | ||
22874 | this._shortWeekdaysParse = []; | ||
22875 | this._fullWeekdaysParse = []; | ||
22876 | } | ||
22877 | |||
22878 | for (i = 0; i < 7; i++) { | ||
22879 | // make the regex if we don't have it already | ||
22880 | |||
22881 | mom = createUTC([2000, 1]).day(i); | ||
22882 | if (strict && !this._fullWeekdaysParse[i]) { | ||
22883 | this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); | ||
22884 | this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); | ||
22885 | this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); | ||
22886 | } | ||
22887 | if (!this._weekdaysParse[i]) { | ||
22888 | regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); | ||
22889 | this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); | ||
22890 | } | ||
22891 | // test the regex | ||
22892 | if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { | ||
22893 | return i; | ||
22894 | } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { | ||
22895 | return i; | ||
22896 | } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { | ||
22897 | return i; | ||
22898 | } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { | ||
22899 | return i; | ||
22900 | } | ||
22901 | } | ||
22902 | } | ||
22903 | |||
22904 | // MOMENTS | ||
22905 | |||
22906 | function getSetDayOfWeek (input) { | ||
22907 | if (!this.isValid()) { | ||
22908 | return input != null ? this : NaN; | ||
22909 | } | ||
22910 | var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); | ||
22911 | if (input != null) { | ||
22912 | input = parseWeekday(input, this.localeData()); | ||
22913 | return this.add(input - day, 'd'); | ||
22914 | } else { | ||
22915 | return day; | ||
22916 | } | ||
22917 | } | ||
22918 | |||
22919 | function getSetLocaleDayOfWeek (input) { | ||
22920 | if (!this.isValid()) { | ||
22921 | return input != null ? this : NaN; | ||
22922 | } | ||
22923 | var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; | ||
22924 | return input == null ? weekday : this.add(input - weekday, 'd'); | ||
22925 | } | ||
22926 | |||
22927 | function getSetISODayOfWeek (input) { | ||
22928 | if (!this.isValid()) { | ||
22929 | return input != null ? this : NaN; | ||
22930 | } | ||
22931 | |||
22932 | // behaves the same as moment#day except | ||
22933 | // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) | ||
22934 | // as a setter, sunday should belong to the previous week. | ||
22935 | |||
22936 | if (input != null) { | ||
22937 | var weekday = parseIsoWeekday(input, this.localeData()); | ||
22938 | return this.day(this.day() % 7 ? weekday : weekday - 7); | ||
22939 | } else { | ||
22940 | return this.day() || 7; | ||
22941 | } | ||
22942 | } | ||
22943 | |||
22944 | var defaultWeekdaysRegex = matchWord; | ||
22945 | function weekdaysRegex (isStrict) { | ||
22946 | if (this._weekdaysParseExact) { | ||
22947 | if (!hasOwnProp(this, '_weekdaysRegex')) { | ||
22948 | computeWeekdaysParse.call(this); | ||
22949 | } | ||
22950 | if (isStrict) { | ||
22951 | return this._weekdaysStrictRegex; | ||
22952 | } else { | ||
22953 | return this._weekdaysRegex; | ||
22954 | } | ||
22955 | } else { | ||
22956 | if (!hasOwnProp(this, '_weekdaysRegex')) { | ||
22957 | this._weekdaysRegex = defaultWeekdaysRegex; | ||
22958 | } | ||
22959 | return this._weekdaysStrictRegex && isStrict ? | ||
22960 | this._weekdaysStrictRegex : this._weekdaysRegex; | ||
22961 | } | ||
22962 | } | ||
22963 | |||
22964 | var defaultWeekdaysShortRegex = matchWord; | ||
22965 | function weekdaysShortRegex (isStrict) { | ||
22966 | if (this._weekdaysParseExact) { | ||
22967 | if (!hasOwnProp(this, '_weekdaysRegex')) { | ||
22968 | computeWeekdaysParse.call(this); | ||
22969 | } | ||
22970 | if (isStrict) { | ||
22971 | return this._weekdaysShortStrictRegex; | ||
22972 | } else { | ||
22973 | return this._weekdaysShortRegex; | ||
22974 | } | ||
22975 | } else { | ||
22976 | if (!hasOwnProp(this, '_weekdaysShortRegex')) { | ||
22977 | this._weekdaysShortRegex = defaultWeekdaysShortRegex; | ||
22978 | } | ||
22979 | return this._weekdaysShortStrictRegex && isStrict ? | ||
22980 | this._weekdaysShortStrictRegex : this._weekdaysShortRegex; | ||
22981 | } | ||
22982 | } | ||
22983 | |||
22984 | var defaultWeekdaysMinRegex = matchWord; | ||
22985 | function weekdaysMinRegex (isStrict) { | ||
22986 | if (this._weekdaysParseExact) { | ||
22987 | if (!hasOwnProp(this, '_weekdaysRegex')) { | ||
22988 | computeWeekdaysParse.call(this); | ||
22989 | } | ||
22990 | if (isStrict) { | ||
22991 | return this._weekdaysMinStrictRegex; | ||
22992 | } else { | ||
22993 | return this._weekdaysMinRegex; | ||
22994 | } | ||
22995 | } else { | ||
22996 | if (!hasOwnProp(this, '_weekdaysMinRegex')) { | ||
22997 | this._weekdaysMinRegex = defaultWeekdaysMinRegex; | ||
22998 | } | ||
22999 | return this._weekdaysMinStrictRegex && isStrict ? | ||
23000 | this._weekdaysMinStrictRegex : this._weekdaysMinRegex; | ||
23001 | } | ||
23002 | } | ||
23003 | |||
23004 | |||
23005 | function computeWeekdaysParse () { | ||
23006 | function cmpLenRev(a, b) { | ||
23007 | return b.length - a.length; | ||
23008 | } | ||
23009 | |||
23010 | var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], | ||
23011 | i, mom, minp, shortp, longp; | ||
23012 | for (i = 0; i < 7; i++) { | ||
23013 | // make the regex if we don't have it already | ||
23014 | mom = createUTC([2000, 1]).day(i); | ||
23015 | minp = this.weekdaysMin(mom, ''); | ||
23016 | shortp = this.weekdaysShort(mom, ''); | ||
23017 | longp = this.weekdays(mom, ''); | ||
23018 | minPieces.push(minp); | ||
23019 | shortPieces.push(shortp); | ||
23020 | longPieces.push(longp); | ||
23021 | mixedPieces.push(minp); | ||
23022 | mixedPieces.push(shortp); | ||
23023 | mixedPieces.push(longp); | ||
23024 | } | ||
23025 | // Sorting makes sure if one weekday (or abbr) is a prefix of another it | ||
23026 | // will match the longer piece. | ||
23027 | minPieces.sort(cmpLenRev); | ||
23028 | shortPieces.sort(cmpLenRev); | ||
23029 | longPieces.sort(cmpLenRev); | ||
23030 | mixedPieces.sort(cmpLenRev); | ||
23031 | for (i = 0; i < 7; i++) { | ||
23032 | shortPieces[i] = regexEscape(shortPieces[i]); | ||
23033 | longPieces[i] = regexEscape(longPieces[i]); | ||
23034 | mixedPieces[i] = regexEscape(mixedPieces[i]); | ||
23035 | } | ||
23036 | |||
23037 | this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); | ||
23038 | this._weekdaysShortRegex = this._weekdaysRegex; | ||
23039 | this._weekdaysMinRegex = this._weekdaysRegex; | ||
23040 | |||
23041 | this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); | ||
23042 | this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); | ||
23043 | this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); | ||
23044 | } | ||
23045 | |||
23046 | // FORMATTING | ||
23047 | |||
23048 | function hFormat() { | ||
23049 | return this.hours() % 12 || 12; | ||
23050 | } | ||
23051 | |||
23052 | function kFormat() { | ||
23053 | return this.hours() || 24; | ||
23054 | } | ||
23055 | |||
23056 | addFormatToken('H', ['HH', 2], 0, 'hour'); | ||
23057 | addFormatToken('h', ['hh', 2], 0, hFormat); | ||
23058 | addFormatToken('k', ['kk', 2], 0, kFormat); | ||
23059 | |||
23060 | addFormatToken('hmm', 0, 0, function () { | ||
23061 | return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); | ||
23062 | }); | ||
23063 | |||
23064 | addFormatToken('hmmss', 0, 0, function () { | ||
23065 | return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + | ||
23066 | zeroFill(this.seconds(), 2); | ||
23067 | }); | ||
23068 | |||
23069 | addFormatToken('Hmm', 0, 0, function () { | ||
23070 | return '' + this.hours() + zeroFill(this.minutes(), 2); | ||
23071 | }); | ||
23072 | |||
23073 | addFormatToken('Hmmss', 0, 0, function () { | ||
23074 | return '' + this.hours() + zeroFill(this.minutes(), 2) + | ||
23075 | zeroFill(this.seconds(), 2); | ||
23076 | }); | ||
23077 | |||
23078 | function meridiem (token, lowercase) { | ||
23079 | addFormatToken(token, 0, 0, function () { | ||
23080 | return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); | ||
23081 | }); | ||
23082 | } | ||
23083 | |||
23084 | meridiem('a', true); | ||
23085 | meridiem('A', false); | ||
23086 | |||
23087 | // ALIASES | ||
23088 | |||
23089 | addUnitAlias('hour', 'h'); | ||
23090 | |||
23091 | // PRIORITY | ||
23092 | addUnitPriority('hour', 13); | ||
23093 | |||
23094 | // PARSING | ||
23095 | |||
23096 | function matchMeridiem (isStrict, locale) { | ||
23097 | return locale._meridiemParse; | ||
23098 | } | ||
23099 | |||
23100 | addRegexToken('a', matchMeridiem); | ||
23101 | addRegexToken('A', matchMeridiem); | ||
23102 | addRegexToken('H', match1to2); | ||
23103 | addRegexToken('h', match1to2); | ||
23104 | addRegexToken('k', match1to2); | ||
23105 | addRegexToken('HH', match1to2, match2); | ||
23106 | addRegexToken('hh', match1to2, match2); | ||
23107 | addRegexToken('kk', match1to2, match2); | ||
23108 | |||
23109 | addRegexToken('hmm', match3to4); | ||
23110 | addRegexToken('hmmss', match5to6); | ||
23111 | addRegexToken('Hmm', match3to4); | ||
23112 | addRegexToken('Hmmss', match5to6); | ||
23113 | |||
23114 | addParseToken(['H', 'HH'], HOUR); | ||
23115 | addParseToken(['k', 'kk'], function (input, array, config) { | ||
23116 | var kInput = toInt(input); | ||
23117 | array[HOUR] = kInput === 24 ? 0 : kInput; | ||
23118 | }); | ||
23119 | addParseToken(['a', 'A'], function (input, array, config) { | ||
23120 | config._isPm = config._locale.isPM(input); | ||
23121 | config._meridiem = input; | ||
23122 | }); | ||
23123 | addParseToken(['h', 'hh'], function (input, array, config) { | ||
23124 | array[HOUR] = toInt(input); | ||
23125 | getParsingFlags(config).bigHour = true; | ||
23126 | }); | ||
23127 | addParseToken('hmm', function (input, array, config) { | ||
23128 | var pos = input.length - 2; | ||
23129 | array[HOUR] = toInt(input.substr(0, pos)); | ||
23130 | array[MINUTE] = toInt(input.substr(pos)); | ||
23131 | getParsingFlags(config).bigHour = true; | ||
23132 | }); | ||
23133 | addParseToken('hmmss', function (input, array, config) { | ||
23134 | var pos1 = input.length - 4; | ||
23135 | var pos2 = input.length - 2; | ||
23136 | array[HOUR] = toInt(input.substr(0, pos1)); | ||
23137 | array[MINUTE] = toInt(input.substr(pos1, 2)); | ||
23138 | array[SECOND] = toInt(input.substr(pos2)); | ||
23139 | getParsingFlags(config).bigHour = true; | ||
23140 | }); | ||
23141 | addParseToken('Hmm', function (input, array, config) { | ||
23142 | var pos = input.length - 2; | ||
23143 | array[HOUR] = toInt(input.substr(0, pos)); | ||
23144 | array[MINUTE] = toInt(input.substr(pos)); | ||
23145 | }); | ||
23146 | addParseToken('Hmmss', function (input, array, config) { | ||
23147 | var pos1 = input.length - 4; | ||
23148 | var pos2 = input.length - 2; | ||
23149 | array[HOUR] = toInt(input.substr(0, pos1)); | ||
23150 | array[MINUTE] = toInt(input.substr(pos1, 2)); | ||
23151 | array[SECOND] = toInt(input.substr(pos2)); | ||
23152 | }); | ||
23153 | |||
23154 | // LOCALES | ||
23155 | |||
23156 | function localeIsPM (input) { | ||
23157 | // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays | ||
23158 | // Using charAt should be more compatible. | ||
23159 | return ((input + '').toLowerCase().charAt(0) === 'p'); | ||
23160 | } | ||
23161 | |||
23162 | var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; | ||
23163 | function localeMeridiem (hours, minutes, isLower) { | ||
23164 | if (hours > 11) { | ||
23165 | return isLower ? 'pm' : 'PM'; | ||
23166 | } else { | ||
23167 | return isLower ? 'am' : 'AM'; | ||
23168 | } | ||
23169 | } | ||
23170 | |||
23171 | |||
23172 | // MOMENTS | ||
23173 | |||
23174 | // Setting the hour should keep the time, because the user explicitly | ||
23175 | // specified which hour he wants. So trying to maintain the same hour (in | ||
23176 | // a new timezone) makes sense. Adding/subtracting hours does not follow | ||
23177 | // this rule. | ||
23178 | var getSetHour = makeGetSet('Hours', true); | ||
23179 | |||
23180 | // months | ||
23181 | // week | ||
23182 | // weekdays | ||
23183 | // meridiem | ||
23184 | var baseConfig = { | ||
23185 | calendar: defaultCalendar, | ||
23186 | longDateFormat: defaultLongDateFormat, | ||
23187 | invalidDate: defaultInvalidDate, | ||
23188 | ordinal: defaultOrdinal, | ||
23189 | dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, | ||
23190 | relativeTime: defaultRelativeTime, | ||
23191 | |||
23192 | months: defaultLocaleMonths, | ||
23193 | monthsShort: defaultLocaleMonthsShort, | ||
23194 | |||
23195 | week: defaultLocaleWeek, | ||
23196 | |||
23197 | weekdays: defaultLocaleWeekdays, | ||
23198 | weekdaysMin: defaultLocaleWeekdaysMin, | ||
23199 | weekdaysShort: defaultLocaleWeekdaysShort, | ||
23200 | |||
23201 | meridiemParse: defaultLocaleMeridiemParse | ||
23202 | }; | ||
23203 | |||
23204 | // internal storage for locale config files | ||
23205 | var locales = {}; | ||
23206 | var localeFamilies = {}; | ||
23207 | var globalLocale; | ||
23208 | |||
23209 | function normalizeLocale(key) { | ||
23210 | return key ? key.toLowerCase().replace('_', '-') : key; | ||
23211 | } | ||
23212 | |||
23213 | // pick the locale from the array | ||
23214 | // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each | ||
23215 | // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root | ||
23216 | function chooseLocale(names) { | ||
23217 | var i = 0, j, next, locale, split; | ||
23218 | |||
23219 | while (i < names.length) { | ||
23220 | split = normalizeLocale(names[i]).split('-'); | ||
23221 | j = split.length; | ||
23222 | next = normalizeLocale(names[i + 1]); | ||
23223 | next = next ? next.split('-') : null; | ||
23224 | while (j > 0) { | ||
23225 | locale = loadLocale(split.slice(0, j).join('-')); | ||
23226 | if (locale) { | ||
23227 | return locale; | ||
23228 | } | ||
23229 | if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { | ||
23230 | //the next array item is better than a shallower substring of this one | ||
23231 | break; | ||
23232 | } | ||
23233 | j--; | ||
23234 | } | ||
23235 | i++; | ||
23236 | } | ||
23237 | return null; | ||
23238 | } | ||
23239 | |||
23240 | function loadLocale(name) { | ||
23241 | var oldLocale = null; | ||
23242 | // TODO: Find a better way to register and load all the locales in Node | ||
23243 | if (!locales[name] && (typeof module !== 'undefined') && | ||
23244 | module && module.exports) { | ||
23245 | try { | ||
23246 | oldLocale = globalLocale._abbr; | ||
23247 | require('./locale/' + name); | ||
23248 | // because defineLocale currently also sets the global locale, we | ||
23249 | // want to undo that for lazy loaded locales | ||
23250 | getSetGlobalLocale(oldLocale); | ||
23251 | } catch (e) { } | ||
23252 | } | ||
23253 | return locales[name]; | ||
23254 | } | ||
23255 | |||
23256 | // This function will load locale and then set the global locale. If | ||
23257 | // no arguments are passed in, it will simply return the current global | ||
23258 | // locale key. | ||
23259 | function getSetGlobalLocale (key, values) { | ||
23260 | var data; | ||
23261 | if (key) { | ||
23262 | if (isUndefined(values)) { | ||
23263 | data = getLocale(key); | ||
23264 | } | ||
23265 | else { | ||
23266 | data = defineLocale(key, values); | ||
23267 | } | ||
23268 | |||
23269 | if (data) { | ||
23270 | // moment.duration._locale = moment._locale = data; | ||
23271 | globalLocale = data; | ||
23272 | } | ||
23273 | } | ||
23274 | |||
23275 | return globalLocale._abbr; | ||
23276 | } | ||
23277 | |||
23278 | function defineLocale (name, config) { | ||
23279 | if (config !== null) { | ||
23280 | var parentConfig = baseConfig; | ||
23281 | config.abbr = name; | ||
23282 | if (locales[name] != null) { | ||
23283 | deprecateSimple('defineLocaleOverride', | ||
23284 | 'use moment.updateLocale(localeName, config) to change ' + | ||
23285 | 'an existing locale. moment.defineLocale(localeName, ' + | ||
23286 | 'config) should only be used for creating a new locale ' + | ||
23287 | 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); | ||
23288 | parentConfig = locales[name]._config; | ||
23289 | } else if (config.parentLocale != null) { | ||
23290 | if (locales[config.parentLocale] != null) { | ||
23291 | parentConfig = locales[config.parentLocale]._config; | ||
23292 | } else { | ||
23293 | if (!localeFamilies[config.parentLocale]) { | ||
23294 | localeFamilies[config.parentLocale] = []; | ||
23295 | } | ||
23296 | localeFamilies[config.parentLocale].push({ | ||
23297 | name: name, | ||
23298 | config: config | ||
23299 | }); | ||
23300 | return null; | ||
23301 | } | ||
23302 | } | ||
23303 | locales[name] = new Locale(mergeConfigs(parentConfig, config)); | ||
23304 | |||
23305 | if (localeFamilies[name]) { | ||
23306 | localeFamilies[name].forEach(function (x) { | ||
23307 | defineLocale(x.name, x.config); | ||
23308 | }); | ||
23309 | } | ||
23310 | |||
23311 | // backwards compat for now: also set the locale | ||
23312 | // make sure we set the locale AFTER all child locales have been | ||
23313 | // created, so we won't end up with the child locale set. | ||
23314 | getSetGlobalLocale(name); | ||
23315 | |||
23316 | |||
23317 | return locales[name]; | ||
23318 | } else { | ||
23319 | // useful for testing | ||
23320 | delete locales[name]; | ||
23321 | return null; | ||
23322 | } | ||
23323 | } | ||
23324 | |||
23325 | function updateLocale(name, config) { | ||
23326 | if (config != null) { | ||
23327 | var locale, parentConfig = baseConfig; | ||
23328 | // MERGE | ||
23329 | if (locales[name] != null) { | ||
23330 | parentConfig = locales[name]._config; | ||
23331 | } | ||
23332 | config = mergeConfigs(parentConfig, config); | ||
23333 | locale = new Locale(config); | ||
23334 | locale.parentLocale = locales[name]; | ||
23335 | locales[name] = locale; | ||
23336 | |||
23337 | // backwards compat for now: also set the locale | ||
23338 | getSetGlobalLocale(name); | ||
23339 | } else { | ||
23340 | // pass null for config to unupdate, useful for tests | ||
23341 | if (locales[name] != null) { | ||
23342 | if (locales[name].parentLocale != null) { | ||
23343 | locales[name] = locales[name].parentLocale; | ||
23344 | } else if (locales[name] != null) { | ||
23345 | delete locales[name]; | ||
23346 | } | ||
23347 | } | ||
23348 | } | ||
23349 | return locales[name]; | ||
23350 | } | ||
23351 | |||
23352 | // returns locale data | ||
23353 | function getLocale (key) { | ||
23354 | var locale; | ||
23355 | |||
23356 | if (key && key._locale && key._locale._abbr) { | ||
23357 | key = key._locale._abbr; | ||
23358 | } | ||
23359 | |||
23360 | if (!key) { | ||
23361 | return globalLocale; | ||
23362 | } | ||
23363 | |||
23364 | if (!isArray(key)) { | ||
23365 | //short-circuit everything else | ||
23366 | locale = loadLocale(key); | ||
23367 | if (locale) { | ||
23368 | return locale; | ||
23369 | } | ||
23370 | key = [key]; | ||
23371 | } | ||
23372 | |||
23373 | return chooseLocale(key); | ||
23374 | } | ||
23375 | |||
23376 | function listLocales() { | ||
23377 | return keys$1(locales); | ||
23378 | } | ||
23379 | |||
23380 | function checkOverflow (m) { | ||
23381 | var overflow; | ||
23382 | var a = m._a; | ||
23383 | |||
23384 | if (a && getParsingFlags(m).overflow === -2) { | ||
23385 | overflow = | ||
23386 | a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : | ||
23387 | a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : | ||
23388 | a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : | ||
23389 | a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : | ||
23390 | a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : | ||
23391 | a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : | ||
23392 | -1; | ||
23393 | |||
23394 | if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { | ||
23395 | overflow = DATE; | ||
23396 | } | ||
23397 | if (getParsingFlags(m)._overflowWeeks && overflow === -1) { | ||
23398 | overflow = WEEK; | ||
23399 | } | ||
23400 | if (getParsingFlags(m)._overflowWeekday && overflow === -1) { | ||
23401 | overflow = WEEKDAY; | ||
23402 | } | ||
23403 | |||
23404 | getParsingFlags(m).overflow = overflow; | ||
23405 | } | ||
23406 | |||
23407 | return m; | ||
23408 | } | ||
23409 | |||
23410 | // iso 8601 regex | ||
23411 | // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) | ||
23412 | var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; | ||
23413 | var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; | ||
23414 | |||
23415 | var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; | ||
23416 | |||
23417 | var isoDates = [ | ||
23418 | ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], | ||
23419 | ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], | ||
23420 | ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], | ||
23421 | ['GGGG-[W]WW', /\d{4}-W\d\d/, false], | ||
23422 | ['YYYY-DDD', /\d{4}-\d{3}/], | ||
23423 | ['YYYY-MM', /\d{4}-\d\d/, false], | ||
23424 | ['YYYYYYMMDD', /[+-]\d{10}/], | ||
23425 | ['YYYYMMDD', /\d{8}/], | ||
23426 | // YYYYMM is NOT allowed by the standard | ||
23427 | ['GGGG[W]WWE', /\d{4}W\d{3}/], | ||
23428 | ['GGGG[W]WW', /\d{4}W\d{2}/, false], | ||
23429 | ['YYYYDDD', /\d{7}/] | ||
23430 | ]; | ||
23431 | |||
23432 | // iso time formats and regexes | ||
23433 | var isoTimes = [ | ||
23434 | ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], | ||
23435 | ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], | ||
23436 | ['HH:mm:ss', /\d\d:\d\d:\d\d/], | ||
23437 | ['HH:mm', /\d\d:\d\d/], | ||
23438 | ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], | ||
23439 | ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], | ||
23440 | ['HHmmss', /\d\d\d\d\d\d/], | ||
23441 | ['HHmm', /\d\d\d\d/], | ||
23442 | ['HH', /\d\d/] | ||
23443 | ]; | ||
23444 | |||
23445 | var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; | ||
23446 | |||
23447 | // date from iso format | ||
23448 | function configFromISO(config) { | ||
23449 | var i, l, | ||
23450 | string = config._i, | ||
23451 | match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), | ||
23452 | allowTime, dateFormat, timeFormat, tzFormat; | ||
23453 | |||
23454 | if (match) { | ||
23455 | getParsingFlags(config).iso = true; | ||
23456 | |||
23457 | for (i = 0, l = isoDates.length; i < l; i++) { | ||
23458 | if (isoDates[i][1].exec(match[1])) { | ||
23459 | dateFormat = isoDates[i][0]; | ||
23460 | allowTime = isoDates[i][2] !== false; | ||
23461 | break; | ||
23462 | } | ||
23463 | } | ||
23464 | if (dateFormat == null) { | ||
23465 | config._isValid = false; | ||
23466 | return; | ||
23467 | } | ||
23468 | if (match[3]) { | ||
23469 | for (i = 0, l = isoTimes.length; i < l; i++) { | ||
23470 | if (isoTimes[i][1].exec(match[3])) { | ||
23471 | // match[2] should be 'T' or space | ||
23472 | timeFormat = (match[2] || ' ') + isoTimes[i][0]; | ||
23473 | break; | ||
23474 | } | ||
23475 | } | ||
23476 | if (timeFormat == null) { | ||
23477 | config._isValid = false; | ||
23478 | return; | ||
23479 | } | ||
23480 | } | ||
23481 | if (!allowTime && timeFormat != null) { | ||
23482 | config._isValid = false; | ||
23483 | return; | ||
23484 | } | ||
23485 | if (match[4]) { | ||
23486 | if (tzRegex.exec(match[4])) { | ||
23487 | tzFormat = 'Z'; | ||
23488 | } else { | ||
23489 | config._isValid = false; | ||
23490 | return; | ||
23491 | } | ||
23492 | } | ||
23493 | config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); | ||
23494 | configFromStringAndFormat(config); | ||
23495 | } else { | ||
23496 | config._isValid = false; | ||
23497 | } | ||
23498 | } | ||
23499 | |||
23500 | // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 | ||
23501 | var basicRfcRegex = /^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/; | ||
23502 | |||
23503 | // date and time from ref 2822 format | ||
23504 | function configFromRFC2822(config) { | ||
23505 | var string, match, dayFormat, | ||
23506 | dateFormat, timeFormat, tzFormat; | ||
23507 | var timezones = { | ||
23508 | ' GMT': ' +0000', | ||
23509 | ' EDT': ' -0400', | ||
23510 | ' EST': ' -0500', | ||
23511 | ' CDT': ' -0500', | ||
23512 | ' CST': ' -0600', | ||
23513 | ' MDT': ' -0600', | ||
23514 | ' MST': ' -0700', | ||
23515 | ' PDT': ' -0700', | ||
23516 | ' PST': ' -0800' | ||
23517 | }; | ||
23518 | var military = 'YXWVUTSRQPONZABCDEFGHIKLM'; | ||
23519 | var timezone, timezoneIndex; | ||
23520 | |||
23521 | string = config._i | ||
23522 | .replace(/\([^\)]*\)|[\n\t]/g, ' ') // Remove comments and folding whitespace | ||
23523 | .replace(/(\s\s+)/g, ' ') // Replace multiple-spaces with a single space | ||
23524 | .replace(/^\s|\s$/g, ''); // Remove leading and trailing spaces | ||
23525 | match = basicRfcRegex.exec(string); | ||
23526 | |||
23527 | if (match) { | ||
23528 | dayFormat = match[1] ? 'ddd' + ((match[1].length === 5) ? ', ' : ' ') : ''; | ||
23529 | dateFormat = 'D MMM ' + ((match[2].length > 10) ? 'YYYY ' : 'YY '); | ||
23530 | timeFormat = 'HH:mm' + (match[4] ? ':ss' : ''); | ||
23531 | |||
23532 | // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. | ||
23533 | if (match[1]) { // day of week given | ||
23534 | var momentDate = new Date(match[2]); | ||
23535 | var momentDay = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][momentDate.getDay()]; | ||
23536 | |||
23537 | if (match[1].substr(0,3) !== momentDay) { | ||
23538 | getParsingFlags(config).weekdayMismatch = true; | ||
23539 | config._isValid = false; | ||
23540 | return; | ||
23541 | } | ||
23542 | } | ||
23543 | |||
23544 | switch (match[5].length) { | ||
23545 | case 2: // military | ||
23546 | if (timezoneIndex === 0) { | ||
23547 | timezone = ' +0000'; | ||
23548 | } else { | ||
23549 | timezoneIndex = military.indexOf(match[5][1].toUpperCase()) - 12; | ||
23550 | timezone = ((timezoneIndex < 0) ? ' -' : ' +') + | ||
23551 | (('' + timezoneIndex).replace(/^-?/, '0')).match(/..$/)[0] + '00'; | ||
23552 | } | ||
23553 | break; | ||
23554 | case 4: // Zone | ||
23555 | timezone = timezones[match[5]]; | ||
23556 | break; | ||
23557 | default: // UT or +/-9999 | ||
23558 | timezone = timezones[' GMT']; | ||
23559 | } | ||
23560 | match[5] = timezone; | ||
23561 | config._i = match.splice(1).join(''); | ||
23562 | tzFormat = ' ZZ'; | ||
23563 | config._f = dayFormat + dateFormat + timeFormat + tzFormat; | ||
23564 | configFromStringAndFormat(config); | ||
23565 | getParsingFlags(config).rfc2822 = true; | ||
23566 | } else { | ||
23567 | config._isValid = false; | ||
23568 | } | ||
23569 | } | ||
23570 | |||
23571 | // date from iso format or fallback | ||
23572 | function configFromString(config) { | ||
23573 | var matched = aspNetJsonRegex.exec(config._i); | ||
23574 | |||
23575 | if (matched !== null) { | ||
23576 | config._d = new Date(+matched[1]); | ||
23577 | return; | ||
23578 | } | ||
23579 | |||
23580 | configFromISO(config); | ||
23581 | if (config._isValid === false) { | ||
23582 | delete config._isValid; | ||
23583 | } else { | ||
23584 | return; | ||
23585 | } | ||
23586 | |||
23587 | configFromRFC2822(config); | ||
23588 | if (config._isValid === false) { | ||
23589 | delete config._isValid; | ||
23590 | } else { | ||
23591 | return; | ||
23592 | } | ||
23593 | |||
23594 | // Final attempt, use Input Fallback | ||
23595 | hooks.createFromInputFallback(config); | ||
23596 | } | ||
23597 | |||
23598 | hooks.createFromInputFallback = deprecate( | ||
23599 | 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + | ||
23600 | 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + | ||
23601 | 'discouraged and will be removed in an upcoming major release. Please refer to ' + | ||
23602 | 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', | ||
23603 | function (config) { | ||
23604 | config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); | ||
23605 | } | ||
23606 | ); | ||
23607 | |||
23608 | // Pick the first defined of two or three arguments. | ||
23609 | function defaults(a, b, c) { | ||
23610 | if (a != null) { | ||
23611 | return a; | ||
23612 | } | ||
23613 | if (b != null) { | ||
23614 | return b; | ||
23615 | } | ||
23616 | return c; | ||
23617 | } | ||
23618 | |||
23619 | function currentDateArray(config) { | ||
23620 | // hooks is actually the exported moment object | ||
23621 | var nowValue = new Date(hooks.now()); | ||
23622 | if (config._useUTC) { | ||
23623 | return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; | ||
23624 | } | ||
23625 | return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; | ||
23626 | } | ||
23627 | |||
23628 | // convert an array to a date. | ||
23629 | // the array should mirror the parameters below | ||
23630 | // note: all values past the year are optional and will default to the lowest possible value. | ||
23631 | // [year, month, day , hour, minute, second, millisecond] | ||
23632 | function configFromArray (config) { | ||
23633 | var i, date, input = [], currentDate, yearToUse; | ||
23634 | |||
23635 | if (config._d) { | ||
23636 | return; | ||
23637 | } | ||
23638 | |||
23639 | currentDate = currentDateArray(config); | ||
23640 | |||
23641 | //compute day of the year from weeks and weekdays | ||
23642 | if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { | ||
23643 | dayOfYearFromWeekInfo(config); | ||
23644 | } | ||
23645 | |||
23646 | //if the day of the year is set, figure out what it is | ||
23647 | if (config._dayOfYear != null) { | ||
23648 | yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); | ||
23649 | |||
23650 | if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { | ||
23651 | getParsingFlags(config)._overflowDayOfYear = true; | ||
23652 | } | ||
23653 | |||
23654 | date = createUTCDate(yearToUse, 0, config._dayOfYear); | ||
23655 | config._a[MONTH] = date.getUTCMonth(); | ||
23656 | config._a[DATE] = date.getUTCDate(); | ||
23657 | } | ||
23658 | |||
23659 | // Default to current date. | ||
23660 | // * if no year, month, day of month are given, default to today | ||
23661 | // * if day of month is given, default month and year | ||
23662 | // * if month is given, default only year | ||
23663 | // * if year is given, don't default anything | ||
23664 | for (i = 0; i < 3 && config._a[i] == null; ++i) { | ||
23665 | config._a[i] = input[i] = currentDate[i]; | ||
23666 | } | ||
23667 | |||
23668 | // Zero out whatever was not defaulted, including time | ||
23669 | for (; i < 7; i++) { | ||
23670 | config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; | ||
23671 | } | ||
23672 | |||
23673 | // Check for 24:00:00.000 | ||
23674 | if (config._a[HOUR] === 24 && | ||
23675 | config._a[MINUTE] === 0 && | ||
23676 | config._a[SECOND] === 0 && | ||
23677 | config._a[MILLISECOND] === 0) { | ||
23678 | config._nextDay = true; | ||
23679 | config._a[HOUR] = 0; | ||
23680 | } | ||
23681 | |||
23682 | config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); | ||
23683 | // Apply timezone offset from input. The actual utcOffset can be changed | ||
23684 | // with parseZone. | ||
23685 | if (config._tzm != null) { | ||
23686 | config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); | ||
23687 | } | ||
23688 | |||
23689 | if (config._nextDay) { | ||
23690 | config._a[HOUR] = 24; | ||
23691 | } | ||
23692 | } | ||
23693 | |||
23694 | function dayOfYearFromWeekInfo(config) { | ||
23695 | var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; | ||
23696 | |||
23697 | w = config._w; | ||
23698 | if (w.GG != null || w.W != null || w.E != null) { | ||
23699 | dow = 1; | ||
23700 | doy = 4; | ||
23701 | |||
23702 | // TODO: We need to take the current isoWeekYear, but that depends on | ||
23703 | // how we interpret now (local, utc, fixed offset). So create | ||
23704 | // a now version of current config (take local/utc/offset flags, and | ||
23705 | // create now). | ||
23706 | weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); | ||
23707 | week = defaults(w.W, 1); | ||
23708 | weekday = defaults(w.E, 1); | ||
23709 | if (weekday < 1 || weekday > 7) { | ||
23710 | weekdayOverflow = true; | ||
23711 | } | ||
23712 | } else { | ||
23713 | dow = config._locale._week.dow; | ||
23714 | doy = config._locale._week.doy; | ||
23715 | |||
23716 | var curWeek = weekOfYear(createLocal(), dow, doy); | ||
23717 | |||
23718 | weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); | ||
23719 | |||
23720 | // Default to current week. | ||
23721 | week = defaults(w.w, curWeek.week); | ||
23722 | |||
23723 | if (w.d != null) { | ||
23724 | // weekday -- low day numbers are considered next week | ||
23725 | weekday = w.d; | ||
23726 | if (weekday < 0 || weekday > 6) { | ||
23727 | weekdayOverflow = true; | ||
23728 | } | ||
23729 | } else if (w.e != null) { | ||
23730 | // local weekday -- counting starts from begining of week | ||
23731 | weekday = w.e + dow; | ||
23732 | if (w.e < 0 || w.e > 6) { | ||
23733 | weekdayOverflow = true; | ||
23734 | } | ||
23735 | } else { | ||
23736 | // default to begining of week | ||
23737 | weekday = dow; | ||
23738 | } | ||
23739 | } | ||
23740 | if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { | ||
23741 | getParsingFlags(config)._overflowWeeks = true; | ||
23742 | } else if (weekdayOverflow != null) { | ||
23743 | getParsingFlags(config)._overflowWeekday = true; | ||
23744 | } else { | ||
23745 | temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); | ||
23746 | config._a[YEAR] = temp.year; | ||
23747 | config._dayOfYear = temp.dayOfYear; | ||
23748 | } | ||
23749 | } | ||
23750 | |||
23751 | // constant that refers to the ISO standard | ||
23752 | hooks.ISO_8601 = function () {}; | ||
23753 | |||
23754 | // constant that refers to the RFC 2822 form | ||
23755 | hooks.RFC_2822 = function () {}; | ||
23756 | |||
23757 | // date from string and format string | ||
23758 | function configFromStringAndFormat(config) { | ||
23759 | // TODO: Move this to another part of the creation flow to prevent circular deps | ||
23760 | if (config._f === hooks.ISO_8601) { | ||
23761 | configFromISO(config); | ||
23762 | return; | ||
23763 | } | ||
23764 | if (config._f === hooks.RFC_2822) { | ||
23765 | configFromRFC2822(config); | ||
23766 | return; | ||
23767 | } | ||
23768 | config._a = []; | ||
23769 | getParsingFlags(config).empty = true; | ||
23770 | |||
23771 | // This array is used to make a Date, either with `new Date` or `Date.UTC` | ||
23772 | var string = '' + config._i, | ||
23773 | i, parsedInput, tokens, token, skipped, | ||
23774 | stringLength = string.length, | ||
23775 | totalParsedInputLength = 0; | ||
23776 | |||
23777 | tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; | ||
23778 | |||
23779 | for (i = 0; i < tokens.length; i++) { | ||
23780 | token = tokens[i]; | ||
23781 | parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; | ||
23782 | // console.log('token', token, 'parsedInput', parsedInput, | ||
23783 | // 'regex', getParseRegexForToken(token, config)); | ||
23784 | if (parsedInput) { | ||
23785 | skipped = string.substr(0, string.indexOf(parsedInput)); | ||
23786 | if (skipped.length > 0) { | ||
23787 | getParsingFlags(config).unusedInput.push(skipped); | ||
23788 | } | ||
23789 | string = string.slice(string.indexOf(parsedInput) + parsedInput.length); | ||
23790 | totalParsedInputLength += parsedInput.length; | ||
23791 | } | ||
23792 | // don't parse if it's not a known token | ||
23793 | if (formatTokenFunctions[token]) { | ||
23794 | if (parsedInput) { | ||
23795 | getParsingFlags(config).empty = false; | ||
23796 | } | ||
23797 | else { | ||
23798 | getParsingFlags(config).unusedTokens.push(token); | ||
23799 | } | ||
23800 | addTimeToArrayFromToken(token, parsedInput, config); | ||
23801 | } | ||
23802 | else if (config._strict && !parsedInput) { | ||
23803 | getParsingFlags(config).unusedTokens.push(token); | ||
23804 | } | ||
23805 | } | ||
23806 | |||
23807 | // add remaining unparsed input length to the string | ||
23808 | getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; | ||
23809 | if (string.length > 0) { | ||
23810 | getParsingFlags(config).unusedInput.push(string); | ||
23811 | } | ||
23812 | |||
23813 | // clear _12h flag if hour is <= 12 | ||
23814 | if (config._a[HOUR] <= 12 && | ||
23815 | getParsingFlags(config).bigHour === true && | ||
23816 | config._a[HOUR] > 0) { | ||
23817 | getParsingFlags(config).bigHour = undefined; | ||
23818 | } | ||
23819 | |||
23820 | getParsingFlags(config).parsedDateParts = config._a.slice(0); | ||
23821 | getParsingFlags(config).meridiem = config._meridiem; | ||
23822 | // handle meridiem | ||
23823 | config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); | ||
23824 | |||
23825 | configFromArray(config); | ||
23826 | checkOverflow(config); | ||
23827 | } | ||
23828 | |||
23829 | |||
23830 | function meridiemFixWrap (locale, hour, meridiem) { | ||
23831 | var isPm; | ||
23832 | |||
23833 | if (meridiem == null) { | ||
23834 | // nothing to do | ||
23835 | return hour; | ||
23836 | } | ||
23837 | if (locale.meridiemHour != null) { | ||
23838 | return locale.meridiemHour(hour, meridiem); | ||
23839 | } else if (locale.isPM != null) { | ||
23840 | // Fallback | ||
23841 | isPm = locale.isPM(meridiem); | ||
23842 | if (isPm && hour < 12) { | ||
23843 | hour += 12; | ||
23844 | } | ||
23845 | if (!isPm && hour === 12) { | ||
23846 | hour = 0; | ||
23847 | } | ||
23848 | return hour; | ||
23849 | } else { | ||
23850 | // this is not supposed to happen | ||
23851 | return hour; | ||
23852 | } | ||
23853 | } | ||
23854 | |||
23855 | // date from string and array of format strings | ||
23856 | function configFromStringAndArray(config) { | ||
23857 | var tempConfig, | ||
23858 | bestMoment, | ||
23859 | |||
23860 | scoreToBeat, | ||
23861 | i, | ||
23862 | currentScore; | ||
23863 | |||
23864 | if (config._f.length === 0) { | ||
23865 | getParsingFlags(config).invalidFormat = true; | ||
23866 | config._d = new Date(NaN); | ||
23867 | return; | ||
23868 | } | ||
23869 | |||
23870 | for (i = 0; i < config._f.length; i++) { | ||
23871 | currentScore = 0; | ||
23872 | tempConfig = copyConfig({}, config); | ||
23873 | if (config._useUTC != null) { | ||
23874 | tempConfig._useUTC = config._useUTC; | ||
23875 | } | ||
23876 | tempConfig._f = config._f[i]; | ||
23877 | configFromStringAndFormat(tempConfig); | ||
23878 | |||
23879 | if (!isValid(tempConfig)) { | ||
23880 | continue; | ||
23881 | } | ||
23882 | |||
23883 | // if there is any input that was not parsed add a penalty for that format | ||
23884 | currentScore += getParsingFlags(tempConfig).charsLeftOver; | ||
23885 | |||
23886 | //or tokens | ||
23887 | currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; | ||
23888 | |||
23889 | getParsingFlags(tempConfig).score = currentScore; | ||
23890 | |||
23891 | if (scoreToBeat == null || currentScore < scoreToBeat) { | ||
23892 | scoreToBeat = currentScore; | ||
23893 | bestMoment = tempConfig; | ||
23894 | } | ||
23895 | } | ||
23896 | |||
23897 | extend(config, bestMoment || tempConfig); | ||
23898 | } | ||
23899 | |||
23900 | function configFromObject(config) { | ||
23901 | if (config._d) { | ||
23902 | return; | ||
23903 | } | ||
23904 | |||
23905 | var i = normalizeObjectUnits(config._i); | ||
23906 | config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { | ||
23907 | return obj && parseInt(obj, 10); | ||
23908 | }); | ||
23909 | |||
23910 | configFromArray(config); | ||
23911 | } | ||
23912 | |||
23913 | function createFromConfig (config) { | ||
23914 | var res = new Moment(checkOverflow(prepareConfig(config))); | ||
23915 | if (res._nextDay) { | ||
23916 | // Adding is smart enough around DST | ||
23917 | res.add(1, 'd'); | ||
23918 | res._nextDay = undefined; | ||
23919 | } | ||
23920 | |||
23921 | return res; | ||
23922 | } | ||
23923 | |||
23924 | function prepareConfig (config) { | ||
23925 | var input = config._i, | ||
23926 | format = config._f; | ||
23927 | |||
23928 | config._locale = config._locale || getLocale(config._l); | ||
23929 | |||
23930 | if (input === null || (format === undefined && input === '')) { | ||
23931 | return createInvalid({nullInput: true}); | ||
23932 | } | ||
23933 | |||
23934 | if (typeof input === 'string') { | ||
23935 | config._i = input = config._locale.preparse(input); | ||
23936 | } | ||
23937 | |||
23938 | if (isMoment(input)) { | ||
23939 | return new Moment(checkOverflow(input)); | ||
23940 | } else if (isDate(input)) { | ||
23941 | config._d = input; | ||
23942 | } else if (isArray(format)) { | ||
23943 | configFromStringAndArray(config); | ||
23944 | } else if (format) { | ||
23945 | configFromStringAndFormat(config); | ||
23946 | } else { | ||
23947 | configFromInput(config); | ||
23948 | } | ||
23949 | |||
23950 | if (!isValid(config)) { | ||
23951 | config._d = null; | ||
23952 | } | ||
23953 | |||
23954 | return config; | ||
23955 | } | ||
23956 | |||
23957 | function configFromInput(config) { | ||
23958 | var input = config._i; | ||
23959 | if (isUndefined(input)) { | ||
23960 | config._d = new Date(hooks.now()); | ||
23961 | } else if (isDate(input)) { | ||
23962 | config._d = new Date(input.valueOf()); | ||
23963 | } else if (typeof input === 'string') { | ||
23964 | configFromString(config); | ||
23965 | } else if (isArray(input)) { | ||
23966 | config._a = map(input.slice(0), function (obj) { | ||
23967 | return parseInt(obj, 10); | ||
23968 | }); | ||
23969 | configFromArray(config); | ||
23970 | } else if (isObject(input)) { | ||
23971 | configFromObject(config); | ||
23972 | } else if (isNumber(input)) { | ||
23973 | // from milliseconds | ||
23974 | config._d = new Date(input); | ||
23975 | } else { | ||
23976 | hooks.createFromInputFallback(config); | ||
23977 | } | ||
23978 | } | ||
23979 | |||
23980 | function createLocalOrUTC (input, format, locale, strict, isUTC) { | ||
23981 | var c = {}; | ||
23982 | |||
23983 | if (locale === true || locale === false) { | ||
23984 | strict = locale; | ||
23985 | locale = undefined; | ||
23986 | } | ||
23987 | |||
23988 | if ((isObject(input) && isObjectEmpty(input)) || | ||
23989 | (isArray(input) && input.length === 0)) { | ||
23990 | input = undefined; | ||
23991 | } | ||
23992 | // object construction must be done this way. | ||
23993 | // https://github.com/moment/moment/issues/1423 | ||
23994 | c._isAMomentObject = true; | ||
23995 | c._useUTC = c._isUTC = isUTC; | ||
23996 | c._l = locale; | ||
23997 | c._i = input; | ||
23998 | c._f = format; | ||
23999 | c._strict = strict; | ||
24000 | |||
24001 | return createFromConfig(c); | ||
24002 | } | ||
24003 | |||
24004 | function createLocal (input, format, locale, strict) { | ||
24005 | return createLocalOrUTC(input, format, locale, strict, false); | ||
24006 | } | ||
24007 | |||
24008 | var prototypeMin = deprecate( | ||
24009 | 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', | ||
24010 | function () { | ||
24011 | var other = createLocal.apply(null, arguments); | ||
24012 | if (this.isValid() && other.isValid()) { | ||
24013 | return other < this ? this : other; | ||
24014 | } else { | ||
24015 | return createInvalid(); | ||
24016 | } | ||
24017 | } | ||
24018 | ); | ||
24019 | |||
24020 | var prototypeMax = deprecate( | ||
24021 | 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', | ||
24022 | function () { | ||
24023 | var other = createLocal.apply(null, arguments); | ||
24024 | if (this.isValid() && other.isValid()) { | ||
24025 | return other > this ? this : other; | ||
24026 | } else { | ||
24027 | return createInvalid(); | ||
24028 | } | ||
24029 | } | ||
24030 | ); | ||
24031 | |||
24032 | // Pick a moment m from moments so that m[fn](other) is true for all | ||
24033 | // other. This relies on the function fn to be transitive. | ||
24034 | // | ||
24035 | // moments should either be an array of moment objects or an array, whose | ||
24036 | // first element is an array of moment objects. | ||
24037 | function pickBy(fn, moments) { | ||
24038 | var res, i; | ||
24039 | if (moments.length === 1 && isArray(moments[0])) { | ||
24040 | moments = moments[0]; | ||
24041 | } | ||
24042 | if (!moments.length) { | ||
24043 | return createLocal(); | ||
24044 | } | ||
24045 | res = moments[0]; | ||
24046 | for (i = 1; i < moments.length; ++i) { | ||
24047 | if (!moments[i].isValid() || moments[i][fn](res)) { | ||
24048 | res = moments[i]; | ||
24049 | } | ||
24050 | } | ||
24051 | return res; | ||
24052 | } | ||
24053 | |||
24054 | // TODO: Use [].sort instead? | ||
24055 | function min () { | ||
24056 | var args = [].slice.call(arguments, 0); | ||
24057 | |||
24058 | return pickBy('isBefore', args); | ||
24059 | } | ||
24060 | |||
24061 | function max () { | ||
24062 | var args = [].slice.call(arguments, 0); | ||
24063 | |||
24064 | return pickBy('isAfter', args); | ||
24065 | } | ||
24066 | |||
24067 | var now = function () { | ||
24068 | return Date.now ? Date.now() : +(new Date()); | ||
24069 | }; | ||
24070 | |||
24071 | var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; | ||
24072 | |||
24073 | function isDurationValid(m) { | ||
24074 | for (var key in m) { | ||
24075 | if (!(ordering.indexOf(key) !== -1 && (m[key] == null || !isNaN(m[key])))) { | ||
24076 | return false; | ||
24077 | } | ||
24078 | } | ||
24079 | |||
24080 | var unitHasDecimal = false; | ||
24081 | for (var i = 0; i < ordering.length; ++i) { | ||
24082 | if (m[ordering[i]]) { | ||
24083 | if (unitHasDecimal) { | ||
24084 | return false; // only allow non-integers for smallest unit | ||
24085 | } | ||
24086 | if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { | ||
24087 | unitHasDecimal = true; | ||
24088 | } | ||
24089 | } | ||
24090 | } | ||
24091 | |||
24092 | return true; | ||
24093 | } | ||
24094 | |||
24095 | function isValid$1() { | ||
24096 | return this._isValid; | ||
24097 | } | ||
24098 | |||
24099 | function createInvalid$1() { | ||
24100 | return createDuration(NaN); | ||
24101 | } | ||
24102 | |||
24103 | function Duration (duration) { | ||
24104 | var normalizedInput = normalizeObjectUnits(duration), | ||
24105 | years = normalizedInput.year || 0, | ||
24106 | quarters = normalizedInput.quarter || 0, | ||
24107 | months = normalizedInput.month || 0, | ||
24108 | weeks = normalizedInput.week || 0, | ||
24109 | days = normalizedInput.day || 0, | ||
24110 | hours = normalizedInput.hour || 0, | ||
24111 | minutes = normalizedInput.minute || 0, | ||
24112 | seconds = normalizedInput.second || 0, | ||
24113 | milliseconds = normalizedInput.millisecond || 0; | ||
24114 | |||
24115 | this._isValid = isDurationValid(normalizedInput); | ||
24116 | |||
24117 | // representation for dateAddRemove | ||
24118 | this._milliseconds = +milliseconds + | ||
24119 | seconds * 1e3 + // 1000 | ||
24120 | minutes * 6e4 + // 1000 * 60 | ||
24121 | hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 | ||
24122 | // Because of dateAddRemove treats 24 hours as different from a | ||
24123 | // day when working around DST, we need to store them separately | ||
24124 | this._days = +days + | ||
24125 | weeks * 7; | ||
24126 | // It is impossible translate months into days without knowing | ||
24127 | // which months you are are talking about, so we have to store | ||
24128 | // it separately. | ||
24129 | this._months = +months + | ||
24130 | quarters * 3 + | ||
24131 | years * 12; | ||
24132 | |||
24133 | this._data = {}; | ||
24134 | |||
24135 | this._locale = getLocale(); | ||
24136 | |||
24137 | this._bubble(); | ||
24138 | } | ||
24139 | |||
24140 | function isDuration (obj) { | ||
24141 | return obj instanceof Duration; | ||
24142 | } | ||
24143 | |||
24144 | function absRound (number) { | ||
24145 | if (number < 0) { | ||
24146 | return Math.round(-1 * number) * -1; | ||
24147 | } else { | ||
24148 | return Math.round(number); | ||
24149 | } | ||
24150 | } | ||
24151 | |||
24152 | // FORMATTING | ||
24153 | |||
24154 | function offset (token, separator) { | ||
24155 | addFormatToken(token, 0, 0, function () { | ||
24156 | var offset = this.utcOffset(); | ||
24157 | var sign = '+'; | ||
24158 | if (offset < 0) { | ||
24159 | offset = -offset; | ||
24160 | sign = '-'; | ||
24161 | } | ||
24162 | return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); | ||
24163 | }); | ||
24164 | } | ||
24165 | |||
24166 | offset('Z', ':'); | ||
24167 | offset('ZZ', ''); | ||
24168 | |||
24169 | // PARSING | ||
24170 | |||
24171 | addRegexToken('Z', matchShortOffset); | ||
24172 | addRegexToken('ZZ', matchShortOffset); | ||
24173 | addParseToken(['Z', 'ZZ'], function (input, array, config) { | ||
24174 | config._useUTC = true; | ||
24175 | config._tzm = offsetFromString(matchShortOffset, input); | ||
24176 | }); | ||
24177 | |||
24178 | // HELPERS | ||
24179 | |||
24180 | // timezone chunker | ||
24181 | // '+10:00' > ['10', '00'] | ||
24182 | // '-1530' > ['-15', '30'] | ||
24183 | var chunkOffset = /([\+\-]|\d\d)/gi; | ||
24184 | |||
24185 | function offsetFromString(matcher, string) { | ||
24186 | var matches = (string || '').match(matcher); | ||
24187 | |||
24188 | if (matches === null) { | ||
24189 | return null; | ||
24190 | } | ||
24191 | |||
24192 | var chunk = matches[matches.length - 1] || []; | ||
24193 | var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; | ||
24194 | var minutes = +(parts[1] * 60) + toInt(parts[2]); | ||
24195 | |||
24196 | return minutes === 0 ? | ||
24197 | 0 : | ||
24198 | parts[0] === '+' ? minutes : -minutes; | ||
24199 | } | ||
24200 | |||
24201 | // Return a moment from input, that is local/utc/zone equivalent to model. | ||
24202 | function cloneWithOffset(input, model) { | ||
24203 | var res, diff; | ||
24204 | if (model._isUTC) { | ||
24205 | res = model.clone(); | ||
24206 | diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); | ||
24207 | // Use low-level api, because this fn is low-level api. | ||
24208 | res._d.setTime(res._d.valueOf() + diff); | ||
24209 | hooks.updateOffset(res, false); | ||
24210 | return res; | ||
24211 | } else { | ||
24212 | return createLocal(input).local(); | ||
24213 | } | ||
24214 | } | ||
24215 | |||
24216 | function getDateOffset (m) { | ||
24217 | // On Firefox.24 Date#getTimezoneOffset returns a floating point. | ||
24218 | // https://github.com/moment/moment/pull/1871 | ||
24219 | return -Math.round(m._d.getTimezoneOffset() / 15) * 15; | ||
24220 | } | ||
24221 | |||
24222 | // HOOKS | ||
24223 | |||
24224 | // This function will be called whenever a moment is mutated. | ||
24225 | // It is intended to keep the offset in sync with the timezone. | ||
24226 | hooks.updateOffset = function () {}; | ||
24227 | |||
24228 | // MOMENTS | ||
24229 | |||
24230 | // keepLocalTime = true means only change the timezone, without | ||
24231 | // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> | ||
24232 | // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset | ||
24233 | // +0200, so we adjust the time as needed, to be valid. | ||
24234 | // | ||
24235 | // Keeping the time actually adds/subtracts (one hour) | ||
24236 | // from the actual represented time. That is why we call updateOffset | ||
24237 | // a second time. In case it wants us to change the offset again | ||
24238 | // _changeInProgress == true case, then we have to adjust, because | ||
24239 | // there is no such time in the given timezone. | ||
24240 | function getSetOffset (input, keepLocalTime, keepMinutes) { | ||
24241 | var offset = this._offset || 0, | ||
24242 | localAdjust; | ||
24243 | if (!this.isValid()) { | ||
24244 | return input != null ? this : NaN; | ||
24245 | } | ||
24246 | if (input != null) { | ||
24247 | if (typeof input === 'string') { | ||
24248 | input = offsetFromString(matchShortOffset, input); | ||
24249 | if (input === null) { | ||
24250 | return this; | ||
24251 | } | ||
24252 | } else if (Math.abs(input) < 16 && !keepMinutes) { | ||
24253 | input = input * 60; | ||
24254 | } | ||
24255 | if (!this._isUTC && keepLocalTime) { | ||
24256 | localAdjust = getDateOffset(this); | ||
24257 | } | ||
24258 | this._offset = input; | ||
24259 | this._isUTC = true; | ||
24260 | if (localAdjust != null) { | ||
24261 | this.add(localAdjust, 'm'); | ||
24262 | } | ||
24263 | if (offset !== input) { | ||
24264 | if (!keepLocalTime || this._changeInProgress) { | ||
24265 | addSubtract(this, createDuration(input - offset, 'm'), 1, false); | ||
24266 | } else if (!this._changeInProgress) { | ||
24267 | this._changeInProgress = true; | ||
24268 | hooks.updateOffset(this, true); | ||
24269 | this._changeInProgress = null; | ||
24270 | } | ||
24271 | } | ||
24272 | return this; | ||
24273 | } else { | ||
24274 | return this._isUTC ? offset : getDateOffset(this); | ||
24275 | } | ||
24276 | } | ||
24277 | |||
24278 | function getSetZone (input, keepLocalTime) { | ||
24279 | if (input != null) { | ||
24280 | if (typeof input !== 'string') { | ||
24281 | input = -input; | ||
24282 | } | ||
24283 | |||
24284 | this.utcOffset(input, keepLocalTime); | ||
24285 | |||
24286 | return this; | ||
24287 | } else { | ||
24288 | return -this.utcOffset(); | ||
24289 | } | ||
24290 | } | ||
24291 | |||
24292 | function setOffsetToUTC (keepLocalTime) { | ||
24293 | return this.utcOffset(0, keepLocalTime); | ||
24294 | } | ||
24295 | |||
24296 | function setOffsetToLocal (keepLocalTime) { | ||
24297 | if (this._isUTC) { | ||
24298 | this.utcOffset(0, keepLocalTime); | ||
24299 | this._isUTC = false; | ||
24300 | |||
24301 | if (keepLocalTime) { | ||
24302 | this.subtract(getDateOffset(this), 'm'); | ||
24303 | } | ||
24304 | } | ||
24305 | return this; | ||
24306 | } | ||
24307 | |||
24308 | function setOffsetToParsedOffset () { | ||
24309 | if (this._tzm != null) { | ||
24310 | this.utcOffset(this._tzm, false, true); | ||
24311 | } else if (typeof this._i === 'string') { | ||
24312 | var tZone = offsetFromString(matchOffset, this._i); | ||
24313 | if (tZone != null) { | ||
24314 | this.utcOffset(tZone); | ||
24315 | } | ||
24316 | else { | ||
24317 | this.utcOffset(0, true); | ||
24318 | } | ||
24319 | } | ||
24320 | return this; | ||
24321 | } | ||
24322 | |||
24323 | function hasAlignedHourOffset (input) { | ||
24324 | if (!this.isValid()) { | ||
24325 | return false; | ||
24326 | } | ||
24327 | input = input ? createLocal(input).utcOffset() : 0; | ||
24328 | |||
24329 | return (this.utcOffset() - input) % 60 === 0; | ||
24330 | } | ||
24331 | |||
24332 | function isDaylightSavingTime () { | ||
24333 | return ( | ||
24334 | this.utcOffset() > this.clone().month(0).utcOffset() || | ||
24335 | this.utcOffset() > this.clone().month(5).utcOffset() | ||
24336 | ); | ||
24337 | } | ||
24338 | |||
24339 | function isDaylightSavingTimeShifted () { | ||
24340 | if (!isUndefined(this._isDSTShifted)) { | ||
24341 | return this._isDSTShifted; | ||
24342 | } | ||
24343 | |||
24344 | var c = {}; | ||
24345 | |||
24346 | copyConfig(c, this); | ||
24347 | c = prepareConfig(c); | ||
24348 | |||
24349 | if (c._a) { | ||
24350 | var other = c._isUTC ? createUTC(c._a) : createLocal(c._a); | ||
24351 | this._isDSTShifted = this.isValid() && | ||
24352 | compareArrays(c._a, other.toArray()) > 0; | ||
24353 | } else { | ||
24354 | this._isDSTShifted = false; | ||
24355 | } | ||
24356 | |||
24357 | return this._isDSTShifted; | ||
24358 | } | ||
24359 | |||
24360 | function isLocal () { | ||
24361 | return this.isValid() ? !this._isUTC : false; | ||
24362 | } | ||
24363 | |||
24364 | function isUtcOffset () { | ||
24365 | return this.isValid() ? this._isUTC : false; | ||
24366 | } | ||
24367 | |||
24368 | function isUtc () { | ||
24369 | return this.isValid() ? this._isUTC && this._offset === 0 : false; | ||
24370 | } | ||
24371 | |||
24372 | // ASP.NET json date format regex | ||
24373 | var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; | ||
24374 | |||
24375 | // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html | ||
24376 | // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere | ||
24377 | // and further modified to allow for strings containing both week and day | ||
24378 | var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/; | ||
24379 | |||
24380 | function createDuration (input, key) { | ||
24381 | var duration = input, | ||
24382 | // matching against regexp is expensive, do it on demand | ||
24383 | match = null, | ||
24384 | sign, | ||
24385 | ret, | ||
24386 | diffRes; | ||
24387 | |||
24388 | if (isDuration(input)) { | ||
24389 | duration = { | ||
24390 | ms : input._milliseconds, | ||
24391 | d : input._days, | ||
24392 | M : input._months | ||
24393 | }; | ||
24394 | } else if (isNumber(input)) { | ||
24395 | duration = {}; | ||
24396 | if (key) { | ||
24397 | duration[key] = input; | ||
24398 | } else { | ||
24399 | duration.milliseconds = input; | ||
24400 | } | ||
24401 | } else if (!!(match = aspNetRegex.exec(input))) { | ||
24402 | sign = (match[1] === '-') ? -1 : 1; | ||
24403 | duration = { | ||
24404 | y : 0, | ||
24405 | d : toInt(match[DATE]) * sign, | ||
24406 | h : toInt(match[HOUR]) * sign, | ||
24407 | m : toInt(match[MINUTE]) * sign, | ||
24408 | s : toInt(match[SECOND]) * sign, | ||
24409 | ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match | ||
24410 | }; | ||
24411 | } else if (!!(match = isoRegex.exec(input))) { | ||
24412 | sign = (match[1] === '-') ? -1 : 1; | ||
24413 | duration = { | ||
24414 | y : parseIso(match[2], sign), | ||
24415 | M : parseIso(match[3], sign), | ||
24416 | w : parseIso(match[4], sign), | ||
24417 | d : parseIso(match[5], sign), | ||
24418 | h : parseIso(match[6], sign), | ||
24419 | m : parseIso(match[7], sign), | ||
24420 | s : parseIso(match[8], sign) | ||
24421 | }; | ||
24422 | } else if (duration == null) {// checks for null or undefined | ||
24423 | duration = {}; | ||
24424 | } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { | ||
24425 | diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); | ||
24426 | |||
24427 | duration = {}; | ||
24428 | duration.ms = diffRes.milliseconds; | ||
24429 | duration.M = diffRes.months; | ||
24430 | } | ||
24431 | |||
24432 | ret = new Duration(duration); | ||
24433 | |||
24434 | if (isDuration(input) && hasOwnProp(input, '_locale')) { | ||
24435 | ret._locale = input._locale; | ||
24436 | } | ||
24437 | |||
24438 | return ret; | ||
24439 | } | ||
24440 | |||
24441 | createDuration.fn = Duration.prototype; | ||
24442 | createDuration.invalid = createInvalid$1; | ||
24443 | |||
24444 | function parseIso (inp, sign) { | ||
24445 | // We'd normally use ~~inp for this, but unfortunately it also | ||
24446 | // converts floats to ints. | ||
24447 | // inp may be undefined, so careful calling replace on it. | ||
24448 | var res = inp && parseFloat(inp.replace(',', '.')); | ||
24449 | // apply sign while we're at it | ||
24450 | return (isNaN(res) ? 0 : res) * sign; | ||
24451 | } | ||
24452 | |||
24453 | function positiveMomentsDifference(base, other) { | ||
24454 | var res = {milliseconds: 0, months: 0}; | ||
24455 | |||
24456 | res.months = other.month() - base.month() + | ||
24457 | (other.year() - base.year()) * 12; | ||
24458 | if (base.clone().add(res.months, 'M').isAfter(other)) { | ||
24459 | --res.months; | ||
24460 | } | ||
24461 | |||
24462 | res.milliseconds = +other - +(base.clone().add(res.months, 'M')); | ||
24463 | |||
24464 | return res; | ||
24465 | } | ||
24466 | |||
24467 | function momentsDifference(base, other) { | ||
24468 | var res; | ||
24469 | if (!(base.isValid() && other.isValid())) { | ||
24470 | return {milliseconds: 0, months: 0}; | ||
24471 | } | ||
24472 | |||
24473 | other = cloneWithOffset(other, base); | ||
24474 | if (base.isBefore(other)) { | ||
24475 | res = positiveMomentsDifference(base, other); | ||
24476 | } else { | ||
24477 | res = positiveMomentsDifference(other, base); | ||
24478 | res.milliseconds = -res.milliseconds; | ||
24479 | res.months = -res.months; | ||
24480 | } | ||
24481 | |||
24482 | return res; | ||
24483 | } | ||
24484 | |||
24485 | // TODO: remove 'name' arg after deprecation is removed | ||
24486 | function createAdder(direction, name) { | ||
24487 | return function (val, period) { | ||
24488 | var dur, tmp; | ||
24489 | //invert the arguments, but complain about it | ||
24490 | if (period !== null && !isNaN(+period)) { | ||
24491 | deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + | ||
24492 | 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); | ||
24493 | tmp = val; val = period; period = tmp; | ||
24494 | } | ||
24495 | |||
24496 | val = typeof val === 'string' ? +val : val; | ||
24497 | dur = createDuration(val, period); | ||
24498 | addSubtract(this, dur, direction); | ||
24499 | return this; | ||
24500 | }; | ||
24501 | } | ||
24502 | |||
24503 | function addSubtract (mom, duration, isAdding, updateOffset) { | ||
24504 | var milliseconds = duration._milliseconds, | ||
24505 | days = absRound(duration._days), | ||
24506 | months = absRound(duration._months); | ||
24507 | |||
24508 | if (!mom.isValid()) { | ||
24509 | // No op | ||
24510 | return; | ||
24511 | } | ||
24512 | |||
24513 | updateOffset = updateOffset == null ? true : updateOffset; | ||
24514 | |||
24515 | if (milliseconds) { | ||
24516 | mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); | ||
24517 | } | ||
24518 | if (days) { | ||
24519 | set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); | ||
24520 | } | ||
24521 | if (months) { | ||
24522 | setMonth(mom, get(mom, 'Month') + months * isAdding); | ||
24523 | } | ||
24524 | if (updateOffset) { | ||
24525 | hooks.updateOffset(mom, days || months); | ||
24526 | } | ||
24527 | } | ||
24528 | |||
24529 | var add = createAdder(1, 'add'); | ||
24530 | var subtract = createAdder(-1, 'subtract'); | ||
24531 | |||
24532 | function getCalendarFormat(myMoment, now) { | ||
24533 | var diff = myMoment.diff(now, 'days', true); | ||
24534 | return diff < -6 ? 'sameElse' : | ||
24535 | diff < -1 ? 'lastWeek' : | ||
24536 | diff < 0 ? 'lastDay' : | ||
24537 | diff < 1 ? 'sameDay' : | ||
24538 | diff < 2 ? 'nextDay' : | ||
24539 | diff < 7 ? 'nextWeek' : 'sameElse'; | ||
24540 | } | ||
24541 | |||
24542 | function calendar$1 (time, formats) { | ||
24543 | // We want to compare the start of today, vs this. | ||
24544 | // Getting start-of-today depends on whether we're local/utc/offset or not. | ||
24545 | var now = time || createLocal(), | ||
24546 | sod = cloneWithOffset(now, this).startOf('day'), | ||
24547 | format = hooks.calendarFormat(this, sod) || 'sameElse'; | ||
24548 | |||
24549 | var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); | ||
24550 | |||
24551 | return this.format(output || this.localeData().calendar(format, this, createLocal(now))); | ||
24552 | } | ||
24553 | |||
24554 | function clone () { | ||
24555 | return new Moment(this); | ||
24556 | } | ||
24557 | |||
24558 | function isAfter (input, units) { | ||
24559 | var localInput = isMoment(input) ? input : createLocal(input); | ||
24560 | if (!(this.isValid() && localInput.isValid())) { | ||
24561 | return false; | ||
24562 | } | ||
24563 | units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); | ||
24564 | if (units === 'millisecond') { | ||
24565 | return this.valueOf() > localInput.valueOf(); | ||
24566 | } else { | ||
24567 | return localInput.valueOf() < this.clone().startOf(units).valueOf(); | ||
24568 | } | ||
24569 | } | ||
24570 | |||
24571 | function isBefore (input, units) { | ||
24572 | var localInput = isMoment(input) ? input : createLocal(input); | ||
24573 | if (!(this.isValid() && localInput.isValid())) { | ||
24574 | return false; | ||
24575 | } | ||
24576 | units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); | ||
24577 | if (units === 'millisecond') { | ||
24578 | return this.valueOf() < localInput.valueOf(); | ||
24579 | } else { | ||
24580 | return this.clone().endOf(units).valueOf() < localInput.valueOf(); | ||
24581 | } | ||
24582 | } | ||
24583 | |||
24584 | function isBetween (from, to, units, inclusivity) { | ||
24585 | inclusivity = inclusivity || '()'; | ||
24586 | return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && | ||
24587 | (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); | ||
24588 | } | ||
24589 | |||
24590 | function isSame (input, units) { | ||
24591 | var localInput = isMoment(input) ? input : createLocal(input), | ||
24592 | inputMs; | ||
24593 | if (!(this.isValid() && localInput.isValid())) { | ||
24594 | return false; | ||
24595 | } | ||
24596 | units = normalizeUnits(units || 'millisecond'); | ||
24597 | if (units === 'millisecond') { | ||
24598 | return this.valueOf() === localInput.valueOf(); | ||
24599 | } else { | ||
24600 | inputMs = localInput.valueOf(); | ||
24601 | return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); | ||
24602 | } | ||
24603 | } | ||
24604 | |||
24605 | function isSameOrAfter (input, units) { | ||
24606 | return this.isSame(input, units) || this.isAfter(input,units); | ||
24607 | } | ||
24608 | |||
24609 | function isSameOrBefore (input, units) { | ||
24610 | return this.isSame(input, units) || this.isBefore(input,units); | ||
24611 | } | ||
24612 | |||
24613 | function diff (input, units, asFloat) { | ||
24614 | var that, | ||
24615 | zoneDelta, | ||
24616 | delta, output; | ||
24617 | |||
24618 | if (!this.isValid()) { | ||
24619 | return NaN; | ||
24620 | } | ||
24621 | |||
24622 | that = cloneWithOffset(input, this); | ||
24623 | |||
24624 | if (!that.isValid()) { | ||
24625 | return NaN; | ||
24626 | } | ||
24627 | |||
24628 | zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; | ||
24629 | |||
24630 | units = normalizeUnits(units); | ||
24631 | |||
24632 | if (units === 'year' || units === 'month' || units === 'quarter') { | ||
24633 | output = monthDiff(this, that); | ||
24634 | if (units === 'quarter') { | ||
24635 | output = output / 3; | ||
24636 | } else if (units === 'year') { | ||
24637 | output = output / 12; | ||
24638 | } | ||
24639 | } else { | ||
24640 | delta = this - that; | ||
24641 | output = units === 'second' ? delta / 1e3 : // 1000 | ||
24642 | units === 'minute' ? delta / 6e4 : // 1000 * 60 | ||
24643 | units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 | ||
24644 | units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst | ||
24645 | units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst | ||
24646 | delta; | ||
24647 | } | ||
24648 | return asFloat ? output : absFloor(output); | ||
24649 | } | ||
24650 | |||
24651 | function monthDiff (a, b) { | ||
24652 | // difference in months | ||
24653 | var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), | ||
24654 | // b is in (anchor - 1 month, anchor + 1 month) | ||
24655 | anchor = a.clone().add(wholeMonthDiff, 'months'), | ||
24656 | anchor2, adjust; | ||
24657 | |||
24658 | if (b - anchor < 0) { | ||
24659 | anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); | ||
24660 | // linear across the month | ||
24661 | adjust = (b - anchor) / (anchor - anchor2); | ||
24662 | } else { | ||
24663 | anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); | ||
24664 | // linear across the month | ||
24665 | adjust = (b - anchor) / (anchor2 - anchor); | ||
24666 | } | ||
24667 | |||
24668 | //check for negative zero, return zero if negative zero | ||
24669 | return -(wholeMonthDiff + adjust) || 0; | ||
24670 | } | ||
24671 | |||
24672 | hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; | ||
24673 | hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; | ||
24674 | |||
24675 | function toString () { | ||
24676 | return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); | ||
24677 | } | ||
24678 | |||
24679 | function toISOString() { | ||
24680 | if (!this.isValid()) { | ||
24681 | return null; | ||
24682 | } | ||
24683 | var m = this.clone().utc(); | ||
24684 | if (m.year() < 0 || m.year() > 9999) { | ||
24685 | return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); | ||
24686 | } | ||
24687 | if (isFunction(Date.prototype.toISOString)) { | ||
24688 | // native implementation is ~50x faster, use it when we can | ||
24689 | return this.toDate().toISOString(); | ||
24690 | } | ||
24691 | return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); | ||
24692 | } | ||
24693 | |||
24694 | /** | ||
24695 | * Return a human readable representation of a moment that can | ||
24696 | * also be evaluated to get a new moment which is the same | ||
24697 | * | ||
24698 | * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | ||
24699 | */ | ||
24700 | function inspect () { | ||
24701 | if (!this.isValid()) { | ||
24702 | return 'moment.invalid(/* ' + this._i + ' */)'; | ||
24703 | } | ||
24704 | var func = 'moment'; | ||
24705 | var zone = ''; | ||
24706 | if (!this.isLocal()) { | ||
24707 | func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; | ||
24708 | zone = 'Z'; | ||
24709 | } | ||
24710 | var prefix = '[' + func + '("]'; | ||
24711 | var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY'; | ||
24712 | var datetime = '-MM-DD[T]HH:mm:ss.SSS'; | ||
24713 | var suffix = zone + '[")]'; | ||
24714 | |||
24715 | return this.format(prefix + year + datetime + suffix); | ||
24716 | } | ||
24717 | |||
24718 | function format (inputString) { | ||
24719 | if (!inputString) { | ||
24720 | inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; | ||
24721 | } | ||
24722 | var output = formatMoment(this, inputString); | ||
24723 | return this.localeData().postformat(output); | ||
24724 | } | ||
24725 | |||
24726 | function from (time, withoutSuffix) { | ||
24727 | if (this.isValid() && | ||
24728 | ((isMoment(time) && time.isValid()) || | ||
24729 | createLocal(time).isValid())) { | ||
24730 | return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); | ||
24731 | } else { | ||
24732 | return this.localeData().invalidDate(); | ||
24733 | } | ||
24734 | } | ||
24735 | |||
24736 | function fromNow (withoutSuffix) { | ||
24737 | return this.from(createLocal(), withoutSuffix); | ||
24738 | } | ||
24739 | |||
24740 | function to (time, withoutSuffix) { | ||
24741 | if (this.isValid() && | ||
24742 | ((isMoment(time) && time.isValid()) || | ||
24743 | createLocal(time).isValid())) { | ||
24744 | return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); | ||
24745 | } else { | ||
24746 | return this.localeData().invalidDate(); | ||
24747 | } | ||
24748 | } | ||
24749 | |||
24750 | function toNow (withoutSuffix) { | ||
24751 | return this.to(createLocal(), withoutSuffix); | ||
24752 | } | ||
24753 | |||
24754 | // If passed a locale key, it will set the locale for this | ||
24755 | // instance. Otherwise, it will return the locale configuration | ||
24756 | // variables for this instance. | ||
24757 | function locale (key) { | ||
24758 | var newLocaleData; | ||
24759 | |||
24760 | if (key === undefined) { | ||
24761 | return this._locale._abbr; | ||
24762 | } else { | ||
24763 | newLocaleData = getLocale(key); | ||
24764 | if (newLocaleData != null) { | ||
24765 | this._locale = newLocaleData; | ||
24766 | } | ||
24767 | return this; | ||
24768 | } | ||
24769 | } | ||
24770 | |||
24771 | var lang = deprecate( | ||
24772 | 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', | ||
24773 | function (key) { | ||
24774 | if (key === undefined) { | ||
24775 | return this.localeData(); | ||
24776 | } else { | ||
24777 | return this.locale(key); | ||
24778 | } | ||
24779 | } | ||
24780 | ); | ||
24781 | |||
24782 | function localeData () { | ||
24783 | return this._locale; | ||
24784 | } | ||
24785 | |||
24786 | function startOf (units) { | ||
24787 | units = normalizeUnits(units); | ||
24788 | // the following switch intentionally omits break keywords | ||
24789 | // to utilize falling through the cases. | ||
24790 | switch (units) { | ||
24791 | case 'year': | ||
24792 | this.month(0); | ||
24793 | /* falls through */ | ||
24794 | case 'quarter': | ||
24795 | case 'month': | ||
24796 | this.date(1); | ||
24797 | /* falls through */ | ||
24798 | case 'week': | ||
24799 | case 'isoWeek': | ||
24800 | case 'day': | ||
24801 | case 'date': | ||
24802 | this.hours(0); | ||
24803 | /* falls through */ | ||
24804 | case 'hour': | ||
24805 | this.minutes(0); | ||
24806 | /* falls through */ | ||
24807 | case 'minute': | ||
24808 | this.seconds(0); | ||
24809 | /* falls through */ | ||
24810 | case 'second': | ||
24811 | this.milliseconds(0); | ||
24812 | } | ||
24813 | |||
24814 | // weeks are a special case | ||
24815 | if (units === 'week') { | ||
24816 | this.weekday(0); | ||
24817 | } | ||
24818 | if (units === 'isoWeek') { | ||
24819 | this.isoWeekday(1); | ||
24820 | } | ||
24821 | |||
24822 | // quarters are also special | ||
24823 | if (units === 'quarter') { | ||
24824 | this.month(Math.floor(this.month() / 3) * 3); | ||
24825 | } | ||
24826 | |||
24827 | return this; | ||
24828 | } | ||
24829 | |||
24830 | function endOf (units) { | ||
24831 | units = normalizeUnits(units); | ||
24832 | if (units === undefined || units === 'millisecond') { | ||
24833 | return this; | ||
24834 | } | ||
24835 | |||
24836 | // 'date' is an alias for 'day', so it should be considered as such. | ||
24837 | if (units === 'date') { | ||
24838 | units = 'day'; | ||
24839 | } | ||
24840 | |||
24841 | return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); | ||
24842 | } | ||
24843 | |||
24844 | function valueOf () { | ||
24845 | return this._d.valueOf() - ((this._offset || 0) * 60000); | ||
24846 | } | ||
24847 | |||
24848 | function unix () { | ||
24849 | return Math.floor(this.valueOf() / 1000); | ||
24850 | } | ||
24851 | |||
24852 | function toDate () { | ||
24853 | return new Date(this.valueOf()); | ||
24854 | } | ||
24855 | |||
24856 | function toArray () { | ||
24857 | var m = this; | ||
24858 | return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; | ||
24859 | } | ||
24860 | |||
24861 | function toObject () { | ||
24862 | var m = this; | ||
24863 | return { | ||
24864 | years: m.year(), | ||
24865 | months: m.month(), | ||
24866 | date: m.date(), | ||
24867 | hours: m.hours(), | ||
24868 | minutes: m.minutes(), | ||
24869 | seconds: m.seconds(), | ||
24870 | milliseconds: m.milliseconds() | ||
24871 | }; | ||
24872 | } | ||
24873 | |||
24874 | function toJSON () { | ||
24875 | // new Date(NaN).toJSON() === null | ||
24876 | return this.isValid() ? this.toISOString() : null; | ||
24877 | } | ||
24878 | |||
24879 | function isValid$2 () { | ||
24880 | return isValid(this); | ||
24881 | } | ||
24882 | |||
24883 | function parsingFlags () { | ||
24884 | return extend({}, getParsingFlags(this)); | ||
24885 | } | ||
24886 | |||
24887 | function invalidAt () { | ||
24888 | return getParsingFlags(this).overflow; | ||
24889 | } | ||
24890 | |||
24891 | function creationData() { | ||
24892 | return { | ||
24893 | input: this._i, | ||
24894 | format: this._f, | ||
24895 | locale: this._locale, | ||
24896 | isUTC: this._isUTC, | ||
24897 | strict: this._strict | ||
24898 | }; | ||
24899 | } | ||
24900 | |||
24901 | // FORMATTING | ||
24902 | |||
24903 | addFormatToken(0, ['gg', 2], 0, function () { | ||
24904 | return this.weekYear() % 100; | ||
24905 | }); | ||
24906 | |||
24907 | addFormatToken(0, ['GG', 2], 0, function () { | ||
24908 | return this.isoWeekYear() % 100; | ||
24909 | }); | ||
24910 | |||
24911 | function addWeekYearFormatToken (token, getter) { | ||
24912 | addFormatToken(0, [token, token.length], 0, getter); | ||
24913 | } | ||
24914 | |||
24915 | addWeekYearFormatToken('gggg', 'weekYear'); | ||
24916 | addWeekYearFormatToken('ggggg', 'weekYear'); | ||
24917 | addWeekYearFormatToken('GGGG', 'isoWeekYear'); | ||
24918 | addWeekYearFormatToken('GGGGG', 'isoWeekYear'); | ||
24919 | |||
24920 | // ALIASES | ||
24921 | |||
24922 | addUnitAlias('weekYear', 'gg'); | ||
24923 | addUnitAlias('isoWeekYear', 'GG'); | ||
24924 | |||
24925 | // PRIORITY | ||
24926 | |||
24927 | addUnitPriority('weekYear', 1); | ||
24928 | addUnitPriority('isoWeekYear', 1); | ||
24929 | |||
24930 | |||
24931 | // PARSING | ||
24932 | |||
24933 | addRegexToken('G', matchSigned); | ||
24934 | addRegexToken('g', matchSigned); | ||
24935 | addRegexToken('GG', match1to2, match2); | ||
24936 | addRegexToken('gg', match1to2, match2); | ||
24937 | addRegexToken('GGGG', match1to4, match4); | ||
24938 | addRegexToken('gggg', match1to4, match4); | ||
24939 | addRegexToken('GGGGG', match1to6, match6); | ||
24940 | addRegexToken('ggggg', match1to6, match6); | ||
24941 | |||
24942 | addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { | ||
24943 | week[token.substr(0, 2)] = toInt(input); | ||
24944 | }); | ||
24945 | |||
24946 | addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { | ||
24947 | week[token] = hooks.parseTwoDigitYear(input); | ||
24948 | }); | ||
24949 | |||
24950 | // MOMENTS | ||
24951 | |||
24952 | function getSetWeekYear (input) { | ||
24953 | return getSetWeekYearHelper.call(this, | ||
24954 | input, | ||
24955 | this.week(), | ||
24956 | this.weekday(), | ||
24957 | this.localeData()._week.dow, | ||
24958 | this.localeData()._week.doy); | ||
24959 | } | ||
24960 | |||
24961 | function getSetISOWeekYear (input) { | ||
24962 | return getSetWeekYearHelper.call(this, | ||
24963 | input, this.isoWeek(), this.isoWeekday(), 1, 4); | ||
24964 | } | ||
24965 | |||
24966 | function getISOWeeksInYear () { | ||
24967 | return weeksInYear(this.year(), 1, 4); | ||
24968 | } | ||
24969 | |||
24970 | function getWeeksInYear () { | ||
24971 | var weekInfo = this.localeData()._week; | ||
24972 | return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); | ||
24973 | } | ||
24974 | |||
24975 | function getSetWeekYearHelper(input, week, weekday, dow, doy) { | ||
24976 | var weeksTarget; | ||
24977 | if (input == null) { | ||
24978 | return weekOfYear(this, dow, doy).year; | ||
24979 | } else { | ||
24980 | weeksTarget = weeksInYear(input, dow, doy); | ||
24981 | if (week > weeksTarget) { | ||
24982 | week = weeksTarget; | ||
24983 | } | ||
24984 | return setWeekAll.call(this, input, week, weekday, dow, doy); | ||
24985 | } | ||
24986 | } | ||
24987 | |||
24988 | function setWeekAll(weekYear, week, weekday, dow, doy) { | ||
24989 | var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), | ||
24990 | date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); | ||
24991 | |||
24992 | this.year(date.getUTCFullYear()); | ||
24993 | this.month(date.getUTCMonth()); | ||
24994 | this.date(date.getUTCDate()); | ||
24995 | return this; | ||
24996 | } | ||
24997 | |||
24998 | // FORMATTING | ||
24999 | |||
25000 | addFormatToken('Q', 0, 'Qo', 'quarter'); | ||
25001 | |||
25002 | // ALIASES | ||
25003 | |||
25004 | addUnitAlias('quarter', 'Q'); | ||
25005 | |||
25006 | // PRIORITY | ||
25007 | |||
25008 | addUnitPriority('quarter', 7); | ||
25009 | |||
25010 | // PARSING | ||
25011 | |||
25012 | addRegexToken('Q', match1); | ||
25013 | addParseToken('Q', function (input, array) { | ||
25014 | array[MONTH] = (toInt(input) - 1) * 3; | ||
25015 | }); | ||
25016 | |||
25017 | // MOMENTS | ||
25018 | |||
25019 | function getSetQuarter (input) { | ||
25020 | return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); | ||
25021 | } | ||
25022 | |||
25023 | // FORMATTING | ||
25024 | |||
25025 | addFormatToken('D', ['DD', 2], 'Do', 'date'); | ||
25026 | |||
25027 | // ALIASES | ||
25028 | |||
25029 | addUnitAlias('date', 'D'); | ||
25030 | |||
25031 | // PRIOROITY | ||
25032 | addUnitPriority('date', 9); | ||
25033 | |||
25034 | // PARSING | ||
25035 | |||
25036 | addRegexToken('D', match1to2); | ||
25037 | addRegexToken('DD', match1to2, match2); | ||
25038 | addRegexToken('Do', function (isStrict, locale) { | ||
25039 | // TODO: Remove "ordinalParse" fallback in next major release. | ||
25040 | return isStrict ? | ||
25041 | (locale._dayOfMonthOrdinalParse || locale._ordinalParse) : | ||
25042 | locale._dayOfMonthOrdinalParseLenient; | ||
25043 | }); | ||
25044 | |||
25045 | addParseToken(['D', 'DD'], DATE); | ||
25046 | addParseToken('Do', function (input, array) { | ||
25047 | array[DATE] = toInt(input.match(match1to2)[0], 10); | ||
25048 | }); | ||
25049 | |||
25050 | // MOMENTS | ||
25051 | |||
25052 | var getSetDayOfMonth = makeGetSet('Date', true); | ||
25053 | |||
25054 | // FORMATTING | ||
25055 | |||
25056 | addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); | ||
25057 | |||
25058 | // ALIASES | ||
25059 | |||
25060 | addUnitAlias('dayOfYear', 'DDD'); | ||
25061 | |||
25062 | // PRIORITY | ||
25063 | addUnitPriority('dayOfYear', 4); | ||
25064 | |||
25065 | // PARSING | ||
25066 | |||
25067 | addRegexToken('DDD', match1to3); | ||
25068 | addRegexToken('DDDD', match3); | ||
25069 | addParseToken(['DDD', 'DDDD'], function (input, array, config) { | ||
25070 | config._dayOfYear = toInt(input); | ||
25071 | }); | ||
25072 | |||
25073 | // HELPERS | ||
25074 | |||
25075 | // MOMENTS | ||
25076 | |||
25077 | function getSetDayOfYear (input) { | ||
25078 | var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; | ||
25079 | return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); | ||
25080 | } | ||
25081 | |||
25082 | // FORMATTING | ||
25083 | |||
25084 | addFormatToken('m', ['mm', 2], 0, 'minute'); | ||
25085 | |||
25086 | // ALIASES | ||
25087 | |||
25088 | addUnitAlias('minute', 'm'); | ||
25089 | |||
25090 | // PRIORITY | ||
25091 | |||
25092 | addUnitPriority('minute', 14); | ||
25093 | |||
25094 | // PARSING | ||
25095 | |||
25096 | addRegexToken('m', match1to2); | ||
25097 | addRegexToken('mm', match1to2, match2); | ||
25098 | addParseToken(['m', 'mm'], MINUTE); | ||
25099 | |||
25100 | // MOMENTS | ||
25101 | |||
25102 | var getSetMinute = makeGetSet('Minutes', false); | ||
25103 | |||
25104 | // FORMATTING | ||
25105 | |||
25106 | addFormatToken('s', ['ss', 2], 0, 'second'); | ||
25107 | |||
25108 | // ALIASES | ||
25109 | |||
25110 | addUnitAlias('second', 's'); | ||
25111 | |||
25112 | // PRIORITY | ||
25113 | |||
25114 | addUnitPriority('second', 15); | ||
25115 | |||
25116 | // PARSING | ||
25117 | |||
25118 | addRegexToken('s', match1to2); | ||
25119 | addRegexToken('ss', match1to2, match2); | ||
25120 | addParseToken(['s', 'ss'], SECOND); | ||
25121 | |||
25122 | // MOMENTS | ||
25123 | |||
25124 | var getSetSecond = makeGetSet('Seconds', false); | ||
25125 | |||
25126 | // FORMATTING | ||
25127 | |||
25128 | addFormatToken('S', 0, 0, function () { | ||
25129 | return ~~(this.millisecond() / 100); | ||
25130 | }); | ||
25131 | |||
25132 | addFormatToken(0, ['SS', 2], 0, function () { | ||
25133 | return ~~(this.millisecond() / 10); | ||
25134 | }); | ||
25135 | |||
25136 | addFormatToken(0, ['SSS', 3], 0, 'millisecond'); | ||
25137 | addFormatToken(0, ['SSSS', 4], 0, function () { | ||
25138 | return this.millisecond() * 10; | ||
25139 | }); | ||
25140 | addFormatToken(0, ['SSSSS', 5], 0, function () { | ||
25141 | return this.millisecond() * 100; | ||
25142 | }); | ||
25143 | addFormatToken(0, ['SSSSSS', 6], 0, function () { | ||
25144 | return this.millisecond() * 1000; | ||
25145 | }); | ||
25146 | addFormatToken(0, ['SSSSSSS', 7], 0, function () { | ||
25147 | return this.millisecond() * 10000; | ||
25148 | }); | ||
25149 | addFormatToken(0, ['SSSSSSSS', 8], 0, function () { | ||
25150 | return this.millisecond() * 100000; | ||
25151 | }); | ||
25152 | addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { | ||
25153 | return this.millisecond() * 1000000; | ||
25154 | }); | ||
25155 | |||
25156 | |||
25157 | // ALIASES | ||
25158 | |||
25159 | addUnitAlias('millisecond', 'ms'); | ||
25160 | |||
25161 | // PRIORITY | ||
25162 | |||
25163 | addUnitPriority('millisecond', 16); | ||
25164 | |||
25165 | // PARSING | ||
25166 | |||
25167 | addRegexToken('S', match1to3, match1); | ||
25168 | addRegexToken('SS', match1to3, match2); | ||
25169 | addRegexToken('SSS', match1to3, match3); | ||
25170 | |||
25171 | var token; | ||
25172 | for (token = 'SSSS'; token.length <= 9; token += 'S') { | ||
25173 | addRegexToken(token, matchUnsigned); | ||
25174 | } | ||
25175 | |||
25176 | function parseMs(input, array) { | ||
25177 | array[MILLISECOND] = toInt(('0.' + input) * 1000); | ||
25178 | } | ||
25179 | |||
25180 | for (token = 'S'; token.length <= 9; token += 'S') { | ||
25181 | addParseToken(token, parseMs); | ||
25182 | } | ||
25183 | // MOMENTS | ||
25184 | |||
25185 | var getSetMillisecond = makeGetSet('Milliseconds', false); | ||
25186 | |||
25187 | // FORMATTING | ||
25188 | |||
25189 | addFormatToken('z', 0, 0, 'zoneAbbr'); | ||
25190 | addFormatToken('zz', 0, 0, 'zoneName'); | ||
25191 | |||
25192 | // MOMENTS | ||
25193 | |||
25194 | function getZoneAbbr () { | ||
25195 | return this._isUTC ? 'UTC' : ''; | ||
25196 | } | ||
25197 | |||
25198 | function getZoneName () { | ||
25199 | return this._isUTC ? 'Coordinated Universal Time' : ''; | ||
25200 | } | ||
25201 | |||
25202 | var proto = Moment.prototype; | ||
25203 | |||
25204 | proto.add = add; | ||
25205 | proto.calendar = calendar$1; | ||
25206 | proto.clone = clone; | ||
25207 | proto.diff = diff; | ||
25208 | proto.endOf = endOf; | ||
25209 | proto.format = format; | ||
25210 | proto.from = from; | ||
25211 | proto.fromNow = fromNow; | ||
25212 | proto.to = to; | ||
25213 | proto.toNow = toNow; | ||
25214 | proto.get = stringGet; | ||
25215 | proto.invalidAt = invalidAt; | ||
25216 | proto.isAfter = isAfter; | ||
25217 | proto.isBefore = isBefore; | ||
25218 | proto.isBetween = isBetween; | ||
25219 | proto.isSame = isSame; | ||
25220 | proto.isSameOrAfter = isSameOrAfter; | ||
25221 | proto.isSameOrBefore = isSameOrBefore; | ||
25222 | proto.isValid = isValid$2; | ||
25223 | proto.lang = lang; | ||
25224 | proto.locale = locale; | ||
25225 | proto.localeData = localeData; | ||
25226 | proto.max = prototypeMax; | ||
25227 | proto.min = prototypeMin; | ||
25228 | proto.parsingFlags = parsingFlags; | ||
25229 | proto.set = stringSet; | ||
25230 | proto.startOf = startOf; | ||
25231 | proto.subtract = subtract; | ||
25232 | proto.toArray = toArray; | ||
25233 | proto.toObject = toObject; | ||
25234 | proto.toDate = toDate; | ||
25235 | proto.toISOString = toISOString; | ||
25236 | proto.inspect = inspect; | ||
25237 | proto.toJSON = toJSON; | ||
25238 | proto.toString = toString; | ||
25239 | proto.unix = unix; | ||
25240 | proto.valueOf = valueOf; | ||
25241 | proto.creationData = creationData; | ||
25242 | |||
25243 | // Year | ||
25244 | proto.year = getSetYear; | ||
25245 | proto.isLeapYear = getIsLeapYear; | ||
25246 | |||
25247 | // Week Year | ||
25248 | proto.weekYear = getSetWeekYear; | ||
25249 | proto.isoWeekYear = getSetISOWeekYear; | ||
25250 | |||
25251 | // Quarter | ||
25252 | proto.quarter = proto.quarters = getSetQuarter; | ||
25253 | |||
25254 | // Month | ||
25255 | proto.month = getSetMonth; | ||
25256 | proto.daysInMonth = getDaysInMonth; | ||
25257 | |||
25258 | // Week | ||
25259 | proto.week = proto.weeks = getSetWeek; | ||
25260 | proto.isoWeek = proto.isoWeeks = getSetISOWeek; | ||
25261 | proto.weeksInYear = getWeeksInYear; | ||
25262 | proto.isoWeeksInYear = getISOWeeksInYear; | ||
25263 | |||
25264 | // Day | ||
25265 | proto.date = getSetDayOfMonth; | ||
25266 | proto.day = proto.days = getSetDayOfWeek; | ||
25267 | proto.weekday = getSetLocaleDayOfWeek; | ||
25268 | proto.isoWeekday = getSetISODayOfWeek; | ||
25269 | proto.dayOfYear = getSetDayOfYear; | ||
25270 | |||
25271 | // Hour | ||
25272 | proto.hour = proto.hours = getSetHour; | ||
25273 | |||
25274 | // Minute | ||
25275 | proto.minute = proto.minutes = getSetMinute; | ||
25276 | |||
25277 | // Second | ||
25278 | proto.second = proto.seconds = getSetSecond; | ||
25279 | |||
25280 | // Millisecond | ||
25281 | proto.millisecond = proto.milliseconds = getSetMillisecond; | ||
25282 | |||
25283 | // Offset | ||
25284 | proto.utcOffset = getSetOffset; | ||
25285 | proto.utc = setOffsetToUTC; | ||
25286 | proto.local = setOffsetToLocal; | ||
25287 | proto.parseZone = setOffsetToParsedOffset; | ||
25288 | proto.hasAlignedHourOffset = hasAlignedHourOffset; | ||
25289 | proto.isDST = isDaylightSavingTime; | ||
25290 | proto.isLocal = isLocal; | ||
25291 | proto.isUtcOffset = isUtcOffset; | ||
25292 | proto.isUtc = isUtc; | ||
25293 | proto.isUTC = isUtc; | ||
25294 | |||
25295 | // Timezone | ||
25296 | proto.zoneAbbr = getZoneAbbr; | ||
25297 | proto.zoneName = getZoneName; | ||
25298 | |||
25299 | // Deprecations | ||
25300 | proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); | ||
25301 | proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); | ||
25302 | proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); | ||
25303 | proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); | ||
25304 | proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); | ||
25305 | |||
25306 | function createUnix (input) { | ||
25307 | return createLocal(input * 1000); | ||
25308 | } | ||
25309 | |||
25310 | function createInZone () { | ||
25311 | return createLocal.apply(null, arguments).parseZone(); | ||
25312 | } | ||
25313 | |||
25314 | function preParsePostFormat (string) { | ||
25315 | return string; | ||
25316 | } | ||
25317 | |||
25318 | var proto$1 = Locale.prototype; | ||
25319 | |||
25320 | proto$1.calendar = calendar; | ||
25321 | proto$1.longDateFormat = longDateFormat; | ||
25322 | proto$1.invalidDate = invalidDate; | ||
25323 | proto$1.ordinal = ordinal; | ||
25324 | proto$1.preparse = preParsePostFormat; | ||
25325 | proto$1.postformat = preParsePostFormat; | ||
25326 | proto$1.relativeTime = relativeTime; | ||
25327 | proto$1.pastFuture = pastFuture; | ||
25328 | proto$1.set = set; | ||
25329 | |||
25330 | // Month | ||
25331 | proto$1.months = localeMonths; | ||
25332 | proto$1.monthsShort = localeMonthsShort; | ||
25333 | proto$1.monthsParse = localeMonthsParse; | ||
25334 | proto$1.monthsRegex = monthsRegex; | ||
25335 | proto$1.monthsShortRegex = monthsShortRegex; | ||
25336 | |||
25337 | // Week | ||
25338 | proto$1.week = localeWeek; | ||
25339 | proto$1.firstDayOfYear = localeFirstDayOfYear; | ||
25340 | proto$1.firstDayOfWeek = localeFirstDayOfWeek; | ||
25341 | |||
25342 | // Day of Week | ||
25343 | proto$1.weekdays = localeWeekdays; | ||
25344 | proto$1.weekdaysMin = localeWeekdaysMin; | ||
25345 | proto$1.weekdaysShort = localeWeekdaysShort; | ||
25346 | proto$1.weekdaysParse = localeWeekdaysParse; | ||
25347 | |||
25348 | proto$1.weekdaysRegex = weekdaysRegex; | ||
25349 | proto$1.weekdaysShortRegex = weekdaysShortRegex; | ||
25350 | proto$1.weekdaysMinRegex = weekdaysMinRegex; | ||
25351 | |||
25352 | // Hours | ||
25353 | proto$1.isPM = localeIsPM; | ||
25354 | proto$1.meridiem = localeMeridiem; | ||
25355 | |||
25356 | function get$1 (format, index, field, setter) { | ||
25357 | var locale = getLocale(); | ||
25358 | var utc = createUTC().set(setter, index); | ||
25359 | return locale[field](utc, format); | ||
25360 | } | ||
25361 | |||
25362 | function listMonthsImpl (format, index, field) { | ||
25363 | if (isNumber(format)) { | ||
25364 | index = format; | ||
25365 | format = undefined; | ||
25366 | } | ||
25367 | |||
25368 | format = format || ''; | ||
25369 | |||
25370 | if (index != null) { | ||
25371 | return get$1(format, index, field, 'month'); | ||
25372 | } | ||
25373 | |||
25374 | var i; | ||
25375 | var out = []; | ||
25376 | for (i = 0; i < 12; i++) { | ||
25377 | out[i] = get$1(format, i, field, 'month'); | ||
25378 | } | ||
25379 | return out; | ||
25380 | } | ||
25381 | |||
25382 | // () | ||
25383 | // (5) | ||
25384 | // (fmt, 5) | ||
25385 | // (fmt) | ||
25386 | // (true) | ||
25387 | // (true, 5) | ||
25388 | // (true, fmt, 5) | ||
25389 | // (true, fmt) | ||
25390 | function listWeekdaysImpl (localeSorted, format, index, field) { | ||
25391 | if (typeof localeSorted === 'boolean') { | ||
25392 | if (isNumber(format)) { | ||
25393 | index = format; | ||
25394 | format = undefined; | ||
25395 | } | ||
25396 | |||
25397 | format = format || ''; | ||
25398 | } else { | ||
25399 | format = localeSorted; | ||
25400 | index = format; | ||
25401 | localeSorted = false; | ||
25402 | |||
25403 | if (isNumber(format)) { | ||
25404 | index = format; | ||
25405 | format = undefined; | ||
25406 | } | ||
25407 | |||
25408 | format = format || ''; | ||
25409 | } | ||
25410 | |||
25411 | var locale = getLocale(), | ||
25412 | shift = localeSorted ? locale._week.dow : 0; | ||
25413 | |||
25414 | if (index != null) { | ||
25415 | return get$1(format, (index + shift) % 7, field, 'day'); | ||
25416 | } | ||
25417 | |||
25418 | var i; | ||
25419 | var out = []; | ||
25420 | for (i = 0; i < 7; i++) { | ||
25421 | out[i] = get$1(format, (i + shift) % 7, field, 'day'); | ||
25422 | } | ||
25423 | return out; | ||
25424 | } | ||
25425 | |||
25426 | function listMonths (format, index) { | ||
25427 | return listMonthsImpl(format, index, 'months'); | ||
25428 | } | ||
25429 | |||
25430 | function listMonthsShort (format, index) { | ||
25431 | return listMonthsImpl(format, index, 'monthsShort'); | ||
25432 | } | ||
25433 | |||
25434 | function listWeekdays (localeSorted, format, index) { | ||
25435 | return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); | ||
25436 | } | ||
25437 | |||
25438 | function listWeekdaysShort (localeSorted, format, index) { | ||
25439 | return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); | ||
25440 | } | ||
25441 | |||
25442 | function listWeekdaysMin (localeSorted, format, index) { | ||
25443 | return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); | ||
25444 | } | ||
25445 | |||
25446 | getSetGlobalLocale('en', { | ||
25447 | dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, | ||
25448 | ordinal : function (number) { | ||
25449 | var b = number % 10, | ||
25450 | output = (toInt(number % 100 / 10) === 1) ? 'th' : | ||
25451 | (b === 1) ? 'st' : | ||
25452 | (b === 2) ? 'nd' : | ||
25453 | (b === 3) ? 'rd' : 'th'; | ||
25454 | return number + output; | ||
25455 | } | ||
25456 | }); | ||
25457 | |||
25458 | // Side effect imports | ||
25459 | hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale); | ||
25460 | hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale); | ||
25461 | |||
25462 | var mathAbs = Math.abs; | ||
25463 | |||
25464 | function abs () { | ||
25465 | var data = this._data; | ||
25466 | |||
25467 | this._milliseconds = mathAbs(this._milliseconds); | ||
25468 | this._days = mathAbs(this._days); | ||
25469 | this._months = mathAbs(this._months); | ||
25470 | |||
25471 | data.milliseconds = mathAbs(data.milliseconds); | ||
25472 | data.seconds = mathAbs(data.seconds); | ||
25473 | data.minutes = mathAbs(data.minutes); | ||
25474 | data.hours = mathAbs(data.hours); | ||
25475 | data.months = mathAbs(data.months); | ||
25476 | data.years = mathAbs(data.years); | ||
25477 | |||
25478 | return this; | ||
25479 | } | ||
25480 | |||
25481 | function addSubtract$1 (duration, input, value, direction) { | ||
25482 | var other = createDuration(input, value); | ||
25483 | |||
25484 | duration._milliseconds += direction * other._milliseconds; | ||
25485 | duration._days += direction * other._days; | ||
25486 | duration._months += direction * other._months; | ||
25487 | |||
25488 | return duration._bubble(); | ||
25489 | } | ||
25490 | |||
25491 | // supports only 2.0-style add(1, 's') or add(duration) | ||
25492 | function add$1 (input, value) { | ||
25493 | return addSubtract$1(this, input, value, 1); | ||
25494 | } | ||
25495 | |||
25496 | // supports only 2.0-style subtract(1, 's') or subtract(duration) | ||
25497 | function subtract$1 (input, value) { | ||
25498 | return addSubtract$1(this, input, value, -1); | ||
25499 | } | ||
25500 | |||
25501 | function absCeil (number) { | ||
25502 | if (number < 0) { | ||
25503 | return Math.floor(number); | ||
25504 | } else { | ||
25505 | return Math.ceil(number); | ||
25506 | } | ||
25507 | } | ||
25508 | |||
25509 | function bubble () { | ||
25510 | var milliseconds = this._milliseconds; | ||
25511 | var days = this._days; | ||
25512 | var months = this._months; | ||
25513 | var data = this._data; | ||
25514 | var seconds, minutes, hours, years, monthsFromDays; | ||
25515 | |||
25516 | // if we have a mix of positive and negative values, bubble down first | ||
25517 | // check: https://github.com/moment/moment/issues/2166 | ||
25518 | if (!((milliseconds >= 0 && days >= 0 && months >= 0) || | ||
25519 | (milliseconds <= 0 && days <= 0 && months <= 0))) { | ||
25520 | milliseconds += absCeil(monthsToDays(months) + days) * 864e5; | ||
25521 | days = 0; | ||
25522 | months = 0; | ||
25523 | } | ||
25524 | |||
25525 | // The following code bubbles up values, see the tests for | ||
25526 | // examples of what that means. | ||
25527 | data.milliseconds = milliseconds % 1000; | ||
25528 | |||
25529 | seconds = absFloor(milliseconds / 1000); | ||
25530 | data.seconds = seconds % 60; | ||
25531 | |||
25532 | minutes = absFloor(seconds / 60); | ||
25533 | data.minutes = minutes % 60; | ||
25534 | |||
25535 | hours = absFloor(minutes / 60); | ||
25536 | data.hours = hours % 24; | ||
25537 | |||
25538 | days += absFloor(hours / 24); | ||
25539 | |||
25540 | // convert days to months | ||
25541 | monthsFromDays = absFloor(daysToMonths(days)); | ||
25542 | months += monthsFromDays; | ||
25543 | days -= absCeil(monthsToDays(monthsFromDays)); | ||
25544 | |||
25545 | // 12 months -> 1 year | ||
25546 | years = absFloor(months / 12); | ||
25547 | months %= 12; | ||
25548 | |||
25549 | data.days = days; | ||
25550 | data.months = months; | ||
25551 | data.years = years; | ||
25552 | |||
25553 | return this; | ||
25554 | } | ||
25555 | |||
25556 | function daysToMonths (days) { | ||
25557 | // 400 years have 146097 days (taking into account leap year rules) | ||
25558 | // 400 years have 12 months === 4800 | ||
25559 | return days * 4800 / 146097; | ||
25560 | } | ||
25561 | |||
25562 | function monthsToDays (months) { | ||
25563 | // the reverse of daysToMonths | ||
25564 | return months * 146097 / 4800; | ||
25565 | } | ||
25566 | |||
25567 | function as (units) { | ||
25568 | if (!this.isValid()) { | ||
25569 | return NaN; | ||
25570 | } | ||
25571 | var days; | ||
25572 | var months; | ||
25573 | var milliseconds = this._milliseconds; | ||
25574 | |||
25575 | units = normalizeUnits(units); | ||
25576 | |||
25577 | if (units === 'month' || units === 'year') { | ||
25578 | days = this._days + milliseconds / 864e5; | ||
25579 | months = this._months + daysToMonths(days); | ||
25580 | return units === 'month' ? months : months / 12; | ||
25581 | } else { | ||
25582 | // handle milliseconds separately because of floating point math errors (issue #1867) | ||
25583 | days = this._days + Math.round(monthsToDays(this._months)); | ||
25584 | switch (units) { | ||
25585 | case 'week' : return days / 7 + milliseconds / 6048e5; | ||
25586 | case 'day' : return days + milliseconds / 864e5; | ||
25587 | case 'hour' : return days * 24 + milliseconds / 36e5; | ||
25588 | case 'minute' : return days * 1440 + milliseconds / 6e4; | ||
25589 | case 'second' : return days * 86400 + milliseconds / 1000; | ||
25590 | // Math.floor prevents floating point math errors here | ||
25591 | case 'millisecond': return Math.floor(days * 864e5) + milliseconds; | ||
25592 | default: throw new Error('Unknown unit ' + units); | ||
25593 | } | ||
25594 | } | ||
25595 | } | ||
25596 | |||
25597 | // TODO: Use this.as('ms')? | ||
25598 | function valueOf$1 () { | ||
25599 | if (!this.isValid()) { | ||
25600 | return NaN; | ||
25601 | } | ||
25602 | return ( | ||
25603 | this._milliseconds + | ||
25604 | this._days * 864e5 + | ||
25605 | (this._months % 12) * 2592e6 + | ||
25606 | toInt(this._months / 12) * 31536e6 | ||
25607 | ); | ||
25608 | } | ||
25609 | |||
25610 | function makeAs (alias) { | ||
25611 | return function () { | ||
25612 | return this.as(alias); | ||
25613 | }; | ||
25614 | } | ||
25615 | |||
25616 | var asMilliseconds = makeAs('ms'); | ||
25617 | var asSeconds = makeAs('s'); | ||
25618 | var asMinutes = makeAs('m'); | ||
25619 | var asHours = makeAs('h'); | ||
25620 | var asDays = makeAs('d'); | ||
25621 | var asWeeks = makeAs('w'); | ||
25622 | var asMonths = makeAs('M'); | ||
25623 | var asYears = makeAs('y'); | ||
25624 | |||
25625 | function get$2 (units) { | ||
25626 | units = normalizeUnits(units); | ||
25627 | return this.isValid() ? this[units + 's']() : NaN; | ||
25628 | } | ||
25629 | |||
25630 | function makeGetter(name) { | ||
25631 | return function () { | ||
25632 | return this.isValid() ? this._data[name] : NaN; | ||
25633 | }; | ||
25634 | } | ||
25635 | |||
25636 | var milliseconds = makeGetter('milliseconds'); | ||
25637 | var seconds = makeGetter('seconds'); | ||
25638 | var minutes = makeGetter('minutes'); | ||
25639 | var hours = makeGetter('hours'); | ||
25640 | var days = makeGetter('days'); | ||
25641 | var months = makeGetter('months'); | ||
25642 | var years = makeGetter('years'); | ||
25643 | |||
25644 | function weeks () { | ||
25645 | return absFloor(this.days() / 7); | ||
25646 | } | ||
25647 | |||
25648 | var round = Math.round; | ||
25649 | var thresholds = { | ||
25650 | ss: 44, // a few seconds to seconds | ||
25651 | s : 45, // seconds to minute | ||
25652 | m : 45, // minutes to hour | ||
25653 | h : 22, // hours to day | ||
25654 | d : 26, // days to month | ||
25655 | M : 11 // months to year | ||
25656 | }; | ||
25657 | |||
25658 | // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize | ||
25659 | function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { | ||
25660 | return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); | ||
25661 | } | ||
25662 | |||
25663 | function relativeTime$1 (posNegDuration, withoutSuffix, locale) { | ||
25664 | var duration = createDuration(posNegDuration).abs(); | ||
25665 | var seconds = round(duration.as('s')); | ||
25666 | var minutes = round(duration.as('m')); | ||
25667 | var hours = round(duration.as('h')); | ||
25668 | var days = round(duration.as('d')); | ||
25669 | var months = round(duration.as('M')); | ||
25670 | var years = round(duration.as('y')); | ||
25671 | |||
25672 | var a = seconds <= thresholds.ss && ['s', seconds] || | ||
25673 | seconds < thresholds.s && ['ss', seconds] || | ||
25674 | minutes <= 1 && ['m'] || | ||
25675 | minutes < thresholds.m && ['mm', minutes] || | ||
25676 | hours <= 1 && ['h'] || | ||
25677 | hours < thresholds.h && ['hh', hours] || | ||
25678 | days <= 1 && ['d'] || | ||
25679 | days < thresholds.d && ['dd', days] || | ||
25680 | months <= 1 && ['M'] || | ||
25681 | months < thresholds.M && ['MM', months] || | ||
25682 | years <= 1 && ['y'] || ['yy', years]; | ||
25683 | |||
25684 | a[2] = withoutSuffix; | ||
25685 | a[3] = +posNegDuration > 0; | ||
25686 | a[4] = locale; | ||
25687 | return substituteTimeAgo.apply(null, a); | ||
25688 | } | ||
25689 | |||
25690 | // This function allows you to set the rounding function for relative time strings | ||
25691 | function getSetRelativeTimeRounding (roundingFunction) { | ||
25692 | if (roundingFunction === undefined) { | ||
25693 | return round; | ||
25694 | } | ||
25695 | if (typeof(roundingFunction) === 'function') { | ||
25696 | round = roundingFunction; | ||
25697 | return true; | ||
25698 | } | ||
25699 | return false; | ||
25700 | } | ||
25701 | |||
25702 | // This function allows you to set a threshold for relative time strings | ||
25703 | function getSetRelativeTimeThreshold (threshold, limit) { | ||
25704 | if (thresholds[threshold] === undefined) { | ||
25705 | return false; | ||
25706 | } | ||
25707 | if (limit === undefined) { | ||
25708 | return thresholds[threshold]; | ||
25709 | } | ||
25710 | thresholds[threshold] = limit; | ||
25711 | if (threshold === 's') { | ||
25712 | thresholds.ss = limit - 1; | ||
25713 | } | ||
25714 | return true; | ||
25715 | } | ||
25716 | |||
25717 | function humanize (withSuffix) { | ||
25718 | if (!this.isValid()) { | ||
25719 | return this.localeData().invalidDate(); | ||
25720 | } | ||
25721 | |||
25722 | var locale = this.localeData(); | ||
25723 | var output = relativeTime$1(this, !withSuffix, locale); | ||
25724 | |||
25725 | if (withSuffix) { | ||
25726 | output = locale.pastFuture(+this, output); | ||
25727 | } | ||
25728 | |||
25729 | return locale.postformat(output); | ||
25730 | } | ||
25731 | |||
25732 | var abs$1 = Math.abs; | ||
25733 | |||
25734 | function toISOString$1() { | ||
25735 | // for ISO strings we do not use the normal bubbling rules: | ||
25736 | // * milliseconds bubble up until they become hours | ||
25737 | // * days do not bubble at all | ||
25738 | // * months bubble up until they become years | ||
25739 | // This is because there is no context-free conversion between hours and days | ||
25740 | // (think of clock changes) | ||
25741 | // and also not between days and months (28-31 days per month) | ||
25742 | if (!this.isValid()) { | ||
25743 | return this.localeData().invalidDate(); | ||
25744 | } | ||
25745 | |||
25746 | var seconds = abs$1(this._milliseconds) / 1000; | ||
25747 | var days = abs$1(this._days); | ||
25748 | var months = abs$1(this._months); | ||
25749 | var minutes, hours, years; | ||
25750 | |||
25751 | // 3600 seconds -> 60 minutes -> 1 hour | ||
25752 | minutes = absFloor(seconds / 60); | ||
25753 | hours = absFloor(minutes / 60); | ||
25754 | seconds %= 60; | ||
25755 | minutes %= 60; | ||
25756 | |||
25757 | // 12 months -> 1 year | ||
25758 | years = absFloor(months / 12); | ||
25759 | months %= 12; | ||
25760 | |||
25761 | |||
25762 | // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js | ||
25763 | var Y = years; | ||
25764 | var M = months; | ||
25765 | var D = days; | ||
25766 | var h = hours; | ||
25767 | var m = minutes; | ||
25768 | var s = seconds; | ||
25769 | var total = this.asSeconds(); | ||
25770 | |||
25771 | if (!total) { | ||
25772 | // this is the same as C#'s (Noda) and python (isodate)... | ||
25773 | // but not other JS (goog.date) | ||
25774 | return 'P0D'; | ||
25775 | } | ||
25776 | |||
25777 | return (total < 0 ? '-' : '') + | ||
25778 | 'P' + | ||
25779 | (Y ? Y + 'Y' : '') + | ||
25780 | (M ? M + 'M' : '') + | ||
25781 | (D ? D + 'D' : '') + | ||
25782 | ((h || m || s) ? 'T' : '') + | ||
25783 | (h ? h + 'H' : '') + | ||
25784 | (m ? m + 'M' : '') + | ||
25785 | (s ? s + 'S' : ''); | ||
25786 | } | ||
25787 | |||
25788 | var proto$2 = Duration.prototype; | ||
25789 | |||
25790 | proto$2.isValid = isValid$1; | ||
25791 | proto$2.abs = abs; | ||
25792 | proto$2.add = add$1; | ||
25793 | proto$2.subtract = subtract$1; | ||
25794 | proto$2.as = as; | ||
25795 | proto$2.asMilliseconds = asMilliseconds; | ||
25796 | proto$2.asSeconds = asSeconds; | ||
25797 | proto$2.asMinutes = asMinutes; | ||
25798 | proto$2.asHours = asHours; | ||
25799 | proto$2.asDays = asDays; | ||
25800 | proto$2.asWeeks = asWeeks; | ||
25801 | proto$2.asMonths = asMonths; | ||
25802 | proto$2.asYears = asYears; | ||
25803 | proto$2.valueOf = valueOf$1; | ||
25804 | proto$2._bubble = bubble; | ||
25805 | proto$2.get = get$2; | ||
25806 | proto$2.milliseconds = milliseconds; | ||
25807 | proto$2.seconds = seconds; | ||
25808 | proto$2.minutes = minutes; | ||
25809 | proto$2.hours = hours; | ||
25810 | proto$2.days = days; | ||
25811 | proto$2.weeks = weeks; | ||
25812 | proto$2.months = months; | ||
25813 | proto$2.years = years; | ||
25814 | proto$2.humanize = humanize; | ||
25815 | proto$2.toISOString = toISOString$1; | ||
25816 | proto$2.toString = toISOString$1; | ||
25817 | proto$2.toJSON = toISOString$1; | ||
25818 | proto$2.locale = locale; | ||
25819 | proto$2.localeData = localeData; | ||
25820 | |||
25821 | // Deprecations | ||
25822 | proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1); | ||
25823 | proto$2.lang = lang; | ||
25824 | |||
25825 | // Side effect imports | ||
25826 | |||
25827 | // FORMATTING | ||
25828 | |||
25829 | addFormatToken('X', 0, 0, 'unix'); | ||
25830 | addFormatToken('x', 0, 0, 'valueOf'); | ||
25831 | |||
25832 | // PARSING | ||
25833 | |||
25834 | addRegexToken('x', matchSigned); | ||
25835 | addRegexToken('X', matchTimestamp); | ||
25836 | addParseToken('X', function (input, array, config) { | ||
25837 | config._d = new Date(parseFloat(input, 10) * 1000); | ||
25838 | }); | ||
25839 | addParseToken('x', function (input, array, config) { | ||
25840 | config._d = new Date(toInt(input)); | ||
25841 | }); | ||
25842 | |||
25843 | // Side effect imports | ||
25844 | |||
25845 | |||
25846 | hooks.version = '2.18.1'; | ||
25847 | |||
25848 | setHookCallback(createLocal); | ||
25849 | |||
25850 | hooks.fn = proto; | ||
25851 | hooks.min = min; | ||
25852 | hooks.max = max; | ||
25853 | hooks.now = now; | ||
25854 | hooks.utc = createUTC; | ||
25855 | hooks.unix = createUnix; | ||
25856 | hooks.months = listMonths; | ||
25857 | hooks.isDate = isDate; | ||
25858 | hooks.locale = getSetGlobalLocale; | ||
25859 | hooks.invalid = createInvalid; | ||
25860 | hooks.duration = createDuration; | ||
25861 | hooks.isMoment = isMoment; | ||
25862 | hooks.weekdays = listWeekdays; | ||
25863 | hooks.parseZone = createInZone; | ||
25864 | hooks.localeData = getLocale; | ||
25865 | hooks.isDuration = isDuration; | ||
25866 | hooks.monthsShort = listMonthsShort; | ||
25867 | hooks.weekdaysMin = listWeekdaysMin; | ||
25868 | hooks.defineLocale = defineLocale; | ||
25869 | hooks.updateLocale = updateLocale; | ||
25870 | hooks.locales = listLocales; | ||
25871 | hooks.weekdaysShort = listWeekdaysShort; | ||
25872 | hooks.normalizeUnits = normalizeUnits; | ||
25873 | hooks.relativeTimeRounding = getSetRelativeTimeRounding; | ||
25874 | hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; | ||
25875 | hooks.calendarFormat = getCalendarFormat; | ||
25876 | hooks.prototype = proto; | ||
25877 | |||
25878 | return hooks; | ||
25879 | |||
25880 | }))); | ||
25881 | |||
25882 | |||
25883 | /***/ }), | ||
25884 | /* 185 */ | ||
25885 | /***/ (function(module, exports, __webpack_require__) { | ||
25886 | |||
25887 | 'use strict'; | ||
25888 | |||
25889 | Object.defineProperty(exports, "__esModule", { | ||
25890 | value: true | ||
25891 | }); | ||
25892 | |||
25893 | var _src = __webpack_require__(186); | ||
25894 | |||
25895 | var _src2 = _interopRequireDefault(_src); | ||
25896 | |||
25897 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
25898 | |||
25899 | exports.default = _src2.default; | ||
25900 | module.exports = exports['default']; | ||
25901 | |||
25902 | /***/ }), | ||
25903 | /* 186 */ | ||
25904 | /***/ (function(module, exports, __webpack_require__) { | ||
25905 | |||
25906 | 'use strict'; | ||
25907 | |||
25908 | Object.defineProperty(exports, "__esModule", { | ||
25909 | value: true | ||
25910 | }); | ||
25911 | |||
25912 | var _TimePicker = __webpack_require__(187); | ||
25913 | |||
25914 | var _TimePicker2 = _interopRequireDefault(_TimePicker); | ||
25915 | |||
25916 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
25917 | |||
25918 | exports.default = _TimePicker2.default; | ||
25919 | module.exports = exports['default']; | ||
25920 | |||
25921 | /***/ }), | ||
25922 | /* 187 */ | ||
25923 | /***/ (function(module, exports, __webpack_require__) { | ||
25924 | |||
25925 | 'use strict'; | ||
25926 | |||
25927 | Object.defineProperty(exports, "__esModule", { | ||
25928 | value: true | ||
25929 | }); | ||
25930 | |||
25931 | var _classCallCheck2 = __webpack_require__(188); | ||
25932 | |||
25933 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
25934 | |||
25935 | var _possibleConstructorReturn2 = __webpack_require__(189); | ||
25936 | |||
25937 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
25938 | |||
25939 | var _inherits2 = __webpack_require__(258); | ||
25940 | |||
25941 | var _inherits3 = _interopRequireDefault(_inherits2); | ||
25942 | |||
25943 | var _react = __webpack_require__(3); | ||
25944 | |||
25945 | var _react2 = _interopRequireDefault(_react); | ||
25946 | |||
25947 | var _propTypes = __webpack_require__(266); | ||
25948 | |||
25949 | var _propTypes2 = _interopRequireDefault(_propTypes); | ||
25950 | |||
25951 | var _rcTrigger = __webpack_require__(268); | ||
25952 | |||
25953 | var _rcTrigger2 = _interopRequireDefault(_rcTrigger); | ||
25954 | |||
25955 | var _Panel = __webpack_require__(307); | ||
25956 | |||
25957 | var _Panel2 = _interopRequireDefault(_Panel); | ||
25958 | |||
25959 | var _placements = __webpack_require__(316); | ||
25960 | |||
25961 | var _placements2 = _interopRequireDefault(_placements); | ||
25962 | |||
25963 | var _moment = __webpack_require__(184); | ||
25964 | |||
25965 | var _moment2 = _interopRequireDefault(_moment); | ||
25966 | |||
25967 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
25968 | |||
25969 | function noop() {} | ||
25970 | |||
25971 | function refFn(field, component) { | ||
25972 | this[field] = component; | ||
25973 | } | ||
25974 | |||
25975 | var Picker = function (_Component) { | ||
25976 | (0, _inherits3.default)(Picker, _Component); | ||
25977 | |||
25978 | function Picker(props) { | ||
25979 | (0, _classCallCheck3.default)(this, Picker); | ||
25980 | |||
25981 | var _this = (0, _possibleConstructorReturn3.default)(this, _Component.call(this, props)); | ||
25982 | |||
25983 | _initialiseProps.call(_this); | ||
25984 | |||
25985 | _this.saveInputRef = refFn.bind(_this, 'picker'); | ||
25986 | _this.savePanelRef = refFn.bind(_this, 'panelInstance'); | ||
25987 | var defaultOpen = props.defaultOpen, | ||
25988 | defaultValue = props.defaultValue, | ||
25989 | _props$open = props.open, | ||
25990 | open = _props$open === undefined ? defaultOpen : _props$open, | ||
25991 | _props$value = props.value, | ||
25992 | value = _props$value === undefined ? defaultValue : _props$value; | ||
25993 | |||
25994 | _this.state = { | ||
25995 | open: open, | ||
25996 | value: value | ||
25997 | }; | ||
25998 | return _this; | ||
25999 | } | ||
26000 | |||
26001 | Picker.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
26002 | var value = nextProps.value, | ||
26003 | open = nextProps.open; | ||
26004 | |||
26005 | if ('value' in nextProps) { | ||
26006 | this.setState({ | ||
26007 | value: value | ||
26008 | }); | ||
26009 | } | ||
26010 | if (open !== undefined) { | ||
26011 | this.setState({ open: open }); | ||
26012 | } | ||
26013 | }; | ||
26014 | |||
26015 | Picker.prototype.setValue = function setValue(value) { | ||
26016 | if (!('value' in this.props)) { | ||
26017 | this.setState({ | ||
26018 | value: value | ||
26019 | }); | ||
26020 | } | ||
26021 | this.props.onChange(value); | ||
26022 | }; | ||
26023 | |||
26024 | Picker.prototype.getFormat = function getFormat() { | ||
26025 | var _props = this.props, | ||
26026 | format = _props.format, | ||
26027 | showHour = _props.showHour, | ||
26028 | showMinute = _props.showMinute, | ||
26029 | showSecond = _props.showSecond, | ||
26030 | use12Hours = _props.use12Hours; | ||
26031 | |||
26032 | if (format) { | ||
26033 | return format; | ||
26034 | } | ||
26035 | |||
26036 | if (use12Hours) { | ||
26037 | var fmtString = [showHour ? 'h' : '', showMinute ? 'mm' : '', showSecond ? 'ss' : ''].filter(function (item) { | ||
26038 | return !!item; | ||
26039 | }).join(':'); | ||
26040 | |||
26041 | return fmtString.concat(' a'); | ||
26042 | } | ||
26043 | |||
26044 | return [showHour ? 'HH' : '', showMinute ? 'mm' : '', showSecond ? 'ss' : ''].filter(function (item) { | ||
26045 | return !!item; | ||
26046 | }).join(':'); | ||
26047 | }; | ||
26048 | |||
26049 | Picker.prototype.getPanelElement = function getPanelElement() { | ||
26050 | var _props2 = this.props, | ||
26051 | prefixCls = _props2.prefixCls, | ||
26052 | placeholder = _props2.placeholder, | ||
26053 | disabledHours = _props2.disabledHours, | ||
26054 | disabledMinutes = _props2.disabledMinutes, | ||
26055 | disabledSeconds = _props2.disabledSeconds, | ||
26056 | hideDisabledOptions = _props2.hideDisabledOptions, | ||
26057 | allowEmpty = _props2.allowEmpty, | ||
26058 | showHour = _props2.showHour, | ||
26059 | showMinute = _props2.showMinute, | ||
26060 | showSecond = _props2.showSecond, | ||
26061 | defaultOpenValue = _props2.defaultOpenValue, | ||
26062 | clearText = _props2.clearText, | ||
26063 | addon = _props2.addon, | ||
26064 | use12Hours = _props2.use12Hours; | ||
26065 | |||
26066 | return _react2.default.createElement(_Panel2.default, { | ||
26067 | clearText: clearText, | ||
26068 | prefixCls: prefixCls + '-panel', | ||
26069 | ref: this.savePanelRef, | ||
26070 | value: this.state.value, | ||
26071 | onChange: this.onPanelChange, | ||
26072 | onClear: this.onPanelClear, | ||
26073 | defaultOpenValue: defaultOpenValue, | ||
26074 | showHour: showHour, | ||
26075 | showMinute: showMinute, | ||
26076 | showSecond: showSecond, | ||
26077 | onEsc: this.onEsc, | ||
26078 | allowEmpty: allowEmpty, | ||
26079 | format: this.getFormat(), | ||
26080 | placeholder: placeholder, | ||
26081 | disabledHours: disabledHours, | ||
26082 | disabledMinutes: disabledMinutes, | ||
26083 | disabledSeconds: disabledSeconds, | ||
26084 | hideDisabledOptions: hideDisabledOptions, | ||
26085 | use12Hours: use12Hours, | ||
26086 | addon: addon | ||
26087 | }); | ||
26088 | }; | ||
26089 | |||
26090 | Picker.prototype.getPopupClassName = function getPopupClassName() { | ||
26091 | var _props3 = this.props, | ||
26092 | showHour = _props3.showHour, | ||
26093 | showMinute = _props3.showMinute, | ||
26094 | showSecond = _props3.showSecond, | ||
26095 | use12Hours = _props3.use12Hours, | ||
26096 | prefixCls = _props3.prefixCls; | ||
26097 | |||
26098 | var popupClassName = this.props.popupClassName; | ||
26099 | // Keep it for old compatibility | ||
26100 | if ((!showHour || !showMinute || !showSecond) && !use12Hours) { | ||
26101 | popupClassName += ' ' + prefixCls + '-panel-narrow'; | ||
26102 | } | ||
26103 | var selectColumnCount = 0; | ||
26104 | if (showHour) { | ||
26105 | selectColumnCount += 1; | ||
26106 | } | ||
26107 | if (showMinute) { | ||
26108 | selectColumnCount += 1; | ||
26109 | } | ||
26110 | if (showSecond) { | ||
26111 | selectColumnCount += 1; | ||
26112 | } | ||
26113 | if (use12Hours) { | ||
26114 | selectColumnCount += 1; | ||
26115 | } | ||
26116 | popupClassName += ' ' + prefixCls + '-panel-column-' + selectColumnCount; | ||
26117 | return popupClassName; | ||
26118 | }; | ||
26119 | |||
26120 | Picker.prototype.setOpen = function setOpen(open) { | ||
26121 | var _props4 = this.props, | ||
26122 | onOpen = _props4.onOpen, | ||
26123 | onClose = _props4.onClose; | ||
26124 | |||
26125 | if (this.state.open !== open) { | ||
26126 | if (!('open' in this.props)) { | ||
26127 | this.setState({ open: open }); | ||
26128 | } | ||
26129 | if (open) { | ||
26130 | onOpen({ open: open }); | ||
26131 | } else { | ||
26132 | onClose({ open: open }); | ||
26133 | } | ||
26134 | } | ||
26135 | }; | ||
26136 | |||
26137 | Picker.prototype.focus = function focus() { | ||
26138 | this.picker.focus(); | ||
26139 | }; | ||
26140 | |||
26141 | Picker.prototype.render = function render() { | ||
26142 | var _props5 = this.props, | ||
26143 | prefixCls = _props5.prefixCls, | ||
26144 | placeholder = _props5.placeholder, | ||
26145 | placement = _props5.placement, | ||
26146 | align = _props5.align, | ||
26147 | disabled = _props5.disabled, | ||
26148 | transitionName = _props5.transitionName, | ||
26149 | style = _props5.style, | ||
26150 | className = _props5.className, | ||
26151 | getPopupContainer = _props5.getPopupContainer, | ||
26152 | name = _props5.name, | ||
26153 | autoComplete = _props5.autoComplete; | ||
26154 | var _state = this.state, | ||
26155 | open = _state.open, | ||
26156 | value = _state.value; | ||
26157 | |||
26158 | var popupClassName = this.getPopupClassName(); | ||
26159 | return _react2.default.createElement( | ||
26160 | _rcTrigger2.default, | ||
26161 | { | ||
26162 | prefixCls: prefixCls + '-panel', | ||
26163 | popupClassName: popupClassName, | ||
26164 | popup: this.getPanelElement(), | ||
26165 | popupAlign: align, | ||
26166 | builtinPlacements: _placements2.default, | ||
26167 | popupPlacement: placement, | ||
26168 | action: disabled ? [] : ['click'], | ||
26169 | destroyPopupOnHide: true, | ||
26170 | getPopupContainer: getPopupContainer, | ||
26171 | popupTransitionName: transitionName, | ||
26172 | popupVisible: open, | ||
26173 | onPopupVisibleChange: this.onVisibleChange | ||
26174 | }, | ||
26175 | _react2.default.createElement( | ||
26176 | 'span', | ||
26177 | { className: prefixCls + ' ' + className, style: style }, | ||
26178 | _react2.default.createElement('input', { | ||
26179 | className: prefixCls + '-input', | ||
26180 | ref: this.saveInputRef, | ||
26181 | type: 'text', | ||
26182 | placeholder: placeholder, | ||
26183 | name: name, | ||
26184 | readOnly: true, | ||
26185 | onKeyDown: this.onKeyDown, | ||
26186 | disabled: disabled, value: value && value.format(this.getFormat()) || '', | ||
26187 | autoComplete: autoComplete | ||
26188 | }), | ||
26189 | _react2.default.createElement('span', { className: prefixCls + '-icon' }) | ||
26190 | ) | ||
26191 | ); | ||
26192 | }; | ||
26193 | |||
26194 | return Picker; | ||
26195 | }(_react.Component); | ||
26196 | |||
26197 | Picker.propTypes = { | ||
26198 | prefixCls: _propTypes2.default.string, | ||
26199 | clearText: _propTypes2.default.string, | ||
26200 | value: _propTypes2.default.object, | ||
26201 | defaultOpenValue: _propTypes2.default.object, | ||
26202 | disabled: _propTypes2.default.bool, | ||
26203 | allowEmpty: _propTypes2.default.bool, | ||
26204 | defaultValue: _propTypes2.default.object, | ||
26205 | open: _propTypes2.default.bool, | ||
26206 | defaultOpen: _propTypes2.default.bool, | ||
26207 | align: _propTypes2.default.object, | ||
26208 | placement: _propTypes2.default.any, | ||
26209 | transitionName: _propTypes2.default.string, | ||
26210 | getPopupContainer: _propTypes2.default.func, | ||
26211 | placeholder: _propTypes2.default.string, | ||
26212 | format: _propTypes2.default.string, | ||
26213 | showHour: _propTypes2.default.bool, | ||
26214 | showMinute: _propTypes2.default.bool, | ||
26215 | showSecond: _propTypes2.default.bool, | ||
26216 | style: _propTypes2.default.object, | ||
26217 | className: _propTypes2.default.string, | ||
26218 | popupClassName: _propTypes2.default.string, | ||
26219 | disabledHours: _propTypes2.default.func, | ||
26220 | disabledMinutes: _propTypes2.default.func, | ||
26221 | disabledSeconds: _propTypes2.default.func, | ||
26222 | hideDisabledOptions: _propTypes2.default.bool, | ||
26223 | onChange: _propTypes2.default.func, | ||
26224 | onOpen: _propTypes2.default.func, | ||
26225 | onClose: _propTypes2.default.func, | ||
26226 | addon: _propTypes2.default.func, | ||
26227 | name: _propTypes2.default.string, | ||
26228 | autoComplete: _propTypes2.default.string, | ||
26229 | use12Hours: _propTypes2.default.bool | ||
26230 | }; | ||
26231 | Picker.defaultProps = { | ||
26232 | clearText: 'clear', | ||
26233 | prefixCls: 'rc-time-picker', | ||
26234 | defaultOpen: false, | ||
26235 | style: {}, | ||
26236 | className: '', | ||
26237 | popupClassName: '', | ||
26238 | align: {}, | ||
26239 | defaultOpenValue: (0, _moment2.default)(), | ||
26240 | allowEmpty: true, | ||
26241 | showHour: true, | ||
26242 | showMinute: true, | ||
26243 | showSecond: true, | ||
26244 | disabledHours: noop, | ||
26245 | disabledMinutes: noop, | ||
26246 | disabledSeconds: noop, | ||
26247 | hideDisabledOptions: false, | ||
26248 | placement: 'bottomLeft', | ||
26249 | onChange: noop, | ||
26250 | onOpen: noop, | ||
26251 | onClose: noop, | ||
26252 | addon: noop, | ||
26253 | use12Hours: false | ||
26254 | }; | ||
26255 | |||
26256 | var _initialiseProps = function _initialiseProps() { | ||
26257 | var _this2 = this; | ||
26258 | |||
26259 | this.onPanelChange = function (value) { | ||
26260 | _this2.setValue(value); | ||
26261 | }; | ||
26262 | |||
26263 | this.onPanelClear = function () { | ||
26264 | _this2.setValue(null); | ||
26265 | _this2.setOpen(false); | ||
26266 | }; | ||
26267 | |||
26268 | this.onVisibleChange = function (open) { | ||
26269 | _this2.setOpen(open); | ||
26270 | }; | ||
26271 | |||
26272 | this.onEsc = function () { | ||
26273 | _this2.setOpen(false); | ||
26274 | _this2.focus(); | ||
26275 | }; | ||
26276 | |||
26277 | this.onKeyDown = function (e) { | ||
26278 | if (e.keyCode === 40) { | ||
26279 | _this2.setOpen(true); | ||
26280 | } | ||
26281 | }; | ||
26282 | }; | ||
26283 | |||
26284 | exports.default = Picker; | ||
26285 | module.exports = exports['default']; | ||
26286 | |||
26287 | /***/ }), | ||
26288 | /* 188 */ | ||
26289 | /***/ (function(module, exports) { | ||
26290 | |||
26291 | "use strict"; | ||
26292 | |||
26293 | exports.__esModule = true; | ||
26294 | |||
26295 | exports.default = function (instance, Constructor) { | ||
26296 | if (!(instance instanceof Constructor)) { | ||
26297 | throw new TypeError("Cannot call a class as a function"); | ||
26298 | } | ||
26299 | }; | ||
26300 | |||
26301 | /***/ }), | ||
26302 | /* 189 */ | ||
26303 | /***/ (function(module, exports, __webpack_require__) { | ||
26304 | |||
26305 | "use strict"; | ||
26306 | |||
26307 | exports.__esModule = true; | ||
26308 | |||
26309 | var _typeof2 = __webpack_require__(190); | ||
26310 | |||
26311 | var _typeof3 = _interopRequireDefault(_typeof2); | ||
26312 | |||
26313 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
26314 | |||
26315 | exports.default = function (self, call) { | ||
26316 | if (!self) { | ||
26317 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
26318 | } | ||
26319 | |||
26320 | return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self; | ||
26321 | }; | ||
26322 | |||
26323 | /***/ }), | ||
26324 | /* 190 */ | ||
26325 | /***/ (function(module, exports, __webpack_require__) { | ||
26326 | |||
26327 | "use strict"; | ||
26328 | |||
26329 | exports.__esModule = true; | ||
26330 | |||
26331 | var _iterator = __webpack_require__(191); | ||
26332 | |||
26333 | var _iterator2 = _interopRequireDefault(_iterator); | ||
26334 | |||
26335 | var _symbol = __webpack_require__(242); | ||
26336 | |||
26337 | var _symbol2 = _interopRequireDefault(_symbol); | ||
26338 | |||
26339 | 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; }; | ||
26340 | |||
26341 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
26342 | |||
26343 | exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) { | ||
26344 | return typeof obj === "undefined" ? "undefined" : _typeof(obj); | ||
26345 | } : function (obj) { | ||
26346 | return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj); | ||
26347 | }; | ||
26348 | |||
26349 | /***/ }), | ||
26350 | /* 191 */ | ||
26351 | /***/ (function(module, exports, __webpack_require__) { | ||
26352 | |||
26353 | module.exports = { "default": __webpack_require__(192), __esModule: true }; | ||
26354 | |||
26355 | /***/ }), | ||
26356 | /* 192 */ | ||
26357 | /***/ (function(module, exports, __webpack_require__) { | ||
26358 | |||
26359 | __webpack_require__(193); | ||
26360 | __webpack_require__(237); | ||
26361 | module.exports = __webpack_require__(241).f('iterator'); | ||
26362 | |||
26363 | /***/ }), | ||
26364 | /* 193 */ | ||
26365 | /***/ (function(module, exports, __webpack_require__) { | ||
26366 | |||
26367 | 'use strict'; | ||
26368 | var $at = __webpack_require__(194)(true); | ||
26369 | |||
26370 | // 21.1.3.27 String.prototype[@@iterator]() | ||
26371 | __webpack_require__(197)(String, 'String', function(iterated){ | ||
26372 | this._t = String(iterated); // target | ||
26373 | this._i = 0; // next index | ||
26374 | // 21.1.5.2.1 %StringIteratorPrototype%.next() | ||
26375 | }, function(){ | ||
26376 | var O = this._t | ||
26377 | , index = this._i | ||
26378 | , point; | ||
26379 | if(index >= O.length)return {value: undefined, done: true}; | ||
26380 | point = $at(O, index); | ||
26381 | this._i += point.length; | ||
26382 | return {value: point, done: false}; | ||
26383 | }); | ||
26384 | |||
26385 | /***/ }), | ||
26386 | /* 194 */ | ||
26387 | /***/ (function(module, exports, __webpack_require__) { | ||
26388 | |||
26389 | var toInteger = __webpack_require__(195) | ||
26390 | , defined = __webpack_require__(196); | ||
26391 | // true -> String#at | ||
26392 | // false -> String#codePointAt | ||
26393 | module.exports = function(TO_STRING){ | ||
26394 | return function(that, pos){ | ||
26395 | var s = String(defined(that)) | ||
26396 | , i = toInteger(pos) | ||
26397 | , l = s.length | ||
26398 | , a, b; | ||
26399 | if(i < 0 || i >= l)return TO_STRING ? '' : undefined; | ||
26400 | a = s.charCodeAt(i); | ||
26401 | return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff | ||
26402 | ? TO_STRING ? s.charAt(i) : a | ||
26403 | : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; | ||
26404 | }; | ||
26405 | }; | ||
26406 | |||
26407 | /***/ }), | ||
26408 | /* 195 */ | ||
26409 | /***/ (function(module, exports) { | ||
26410 | |||
26411 | // 7.1.4 ToInteger | ||
26412 | var ceil = Math.ceil | ||
26413 | , floor = Math.floor; | ||
26414 | module.exports = function(it){ | ||
26415 | return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); | ||
26416 | }; | ||
26417 | |||
26418 | /***/ }), | ||
26419 | /* 196 */ | ||
26420 | /***/ (function(module, exports) { | ||
26421 | |||
26422 | // 7.2.1 RequireObjectCoercible(argument) | ||
26423 | module.exports = function(it){ | ||
26424 | if(it == undefined)throw TypeError("Can't call method on " + it); | ||
26425 | return it; | ||
26426 | }; | ||
26427 | |||
26428 | /***/ }), | ||
26429 | /* 197 */ | ||
26430 | /***/ (function(module, exports, __webpack_require__) { | ||
26431 | |||
26432 | 'use strict'; | ||
26433 | var LIBRARY = __webpack_require__(198) | ||
26434 | , $export = __webpack_require__(199) | ||
26435 | , redefine = __webpack_require__(214) | ||
26436 | , hide = __webpack_require__(204) | ||
26437 | , has = __webpack_require__(215) | ||
26438 | , Iterators = __webpack_require__(216) | ||
26439 | , $iterCreate = __webpack_require__(217) | ||
26440 | , setToStringTag = __webpack_require__(233) | ||
26441 | , getPrototypeOf = __webpack_require__(235) | ||
26442 | , ITERATOR = __webpack_require__(234)('iterator') | ||
26443 | , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` | ||
26444 | , FF_ITERATOR = '@@iterator' | ||
26445 | , KEYS = 'keys' | ||
26446 | , VALUES = 'values'; | ||
26447 | |||
26448 | var returnThis = function(){ return this; }; | ||
26449 | |||
26450 | module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ | ||
26451 | $iterCreate(Constructor, NAME, next); | ||
26452 | var getMethod = function(kind){ | ||
26453 | if(!BUGGY && kind in proto)return proto[kind]; | ||
26454 | switch(kind){ | ||
26455 | case KEYS: return function keys(){ return new Constructor(this, kind); }; | ||
26456 | case VALUES: return function values(){ return new Constructor(this, kind); }; | ||
26457 | } return function entries(){ return new Constructor(this, kind); }; | ||
26458 | }; | ||
26459 | var TAG = NAME + ' Iterator' | ||
26460 | , DEF_VALUES = DEFAULT == VALUES | ||
26461 | , VALUES_BUG = false | ||
26462 | , proto = Base.prototype | ||
26463 | , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] | ||
26464 | , $default = $native || getMethod(DEFAULT) | ||
26465 | , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined | ||
26466 | , $anyNative = NAME == 'Array' ? proto.entries || $native : $native | ||
26467 | , methods, key, IteratorPrototype; | ||
26468 | // Fix native | ||
26469 | if($anyNative){ | ||
26470 | IteratorPrototype = getPrototypeOf($anyNative.call(new Base)); | ||
26471 | if(IteratorPrototype !== Object.prototype){ | ||
26472 | // Set @@toStringTag to native iterators | ||
26473 | setToStringTag(IteratorPrototype, TAG, true); | ||
26474 | // fix for some old engines | ||
26475 | if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); | ||
26476 | } | ||
26477 | } | ||
26478 | // fix Array#{values, @@iterator}.name in V8 / FF | ||
26479 | if(DEF_VALUES && $native && $native.name !== VALUES){ | ||
26480 | VALUES_BUG = true; | ||
26481 | $default = function values(){ return $native.call(this); }; | ||
26482 | } | ||
26483 | // Define iterator | ||
26484 | if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ | ||
26485 | hide(proto, ITERATOR, $default); | ||
26486 | } | ||
26487 | // Plug for library | ||
26488 | Iterators[NAME] = $default; | ||
26489 | Iterators[TAG] = returnThis; | ||
26490 | if(DEFAULT){ | ||
26491 | methods = { | ||
26492 | values: DEF_VALUES ? $default : getMethod(VALUES), | ||
26493 | keys: IS_SET ? $default : getMethod(KEYS), | ||
26494 | entries: $entries | ||
26495 | }; | ||
26496 | if(FORCED)for(key in methods){ | ||
26497 | if(!(key in proto))redefine(proto, key, methods[key]); | ||
26498 | } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); | ||
26499 | } | ||
26500 | return methods; | ||
26501 | }; | ||
26502 | |||
26503 | /***/ }), | ||
26504 | /* 198 */ | ||
26505 | /***/ (function(module, exports) { | ||
26506 | |||
26507 | module.exports = true; | ||
26508 | |||
26509 | /***/ }), | ||
26510 | /* 199 */ | ||
26511 | /***/ (function(module, exports, __webpack_require__) { | ||
26512 | |||
26513 | var global = __webpack_require__(200) | ||
26514 | , core = __webpack_require__(201) | ||
26515 | , ctx = __webpack_require__(202) | ||
26516 | , hide = __webpack_require__(204) | ||
26517 | , PROTOTYPE = 'prototype'; | ||
26518 | |||
26519 | var $export = function(type, name, source){ | ||
26520 | var IS_FORCED = type & $export.F | ||
26521 | , IS_GLOBAL = type & $export.G | ||
26522 | , IS_STATIC = type & $export.S | ||
26523 | , IS_PROTO = type & $export.P | ||
26524 | , IS_BIND = type & $export.B | ||
26525 | , IS_WRAP = type & $export.W | ||
26526 | , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) | ||
26527 | , expProto = exports[PROTOTYPE] | ||
26528 | , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] | ||
26529 | , key, own, out; | ||
26530 | if(IS_GLOBAL)source = name; | ||
26531 | for(key in source){ | ||
26532 | // contains in native | ||
26533 | own = !IS_FORCED && target && target[key] !== undefined; | ||
26534 | if(own && key in exports)continue; | ||
26535 | // export native or passed | ||
26536 | out = own ? target[key] : source[key]; | ||
26537 | // prevent global pollution for namespaces | ||
26538 | exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] | ||
26539 | // bind timers to global for call from export context | ||
26540 | : IS_BIND && own ? ctx(out, global) | ||
26541 | // wrap global constructors for prevent change them in library | ||
26542 | : IS_WRAP && target[key] == out ? (function(C){ | ||
26543 | var F = function(a, b, c){ | ||
26544 | if(this instanceof C){ | ||
26545 | switch(arguments.length){ | ||
26546 | case 0: return new C; | ||
26547 | case 1: return new C(a); | ||
26548 | case 2: return new C(a, b); | ||
26549 | } return new C(a, b, c); | ||
26550 | } return C.apply(this, arguments); | ||
26551 | }; | ||
26552 | F[PROTOTYPE] = C[PROTOTYPE]; | ||
26553 | return F; | ||
26554 | // make static versions for prototype methods | ||
26555 | })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; | ||
26556 | // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% | ||
26557 | if(IS_PROTO){ | ||
26558 | (exports.virtual || (exports.virtual = {}))[key] = out; | ||
26559 | // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% | ||
26560 | if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out); | ||
26561 | } | ||
26562 | } | ||
26563 | }; | ||
26564 | // type bitmap | ||
26565 | $export.F = 1; // forced | ||
26566 | $export.G = 2; // global | ||
26567 | $export.S = 4; // static | ||
26568 | $export.P = 8; // proto | ||
26569 | $export.B = 16; // bind | ||
26570 | $export.W = 32; // wrap | ||
26571 | $export.U = 64; // safe | ||
26572 | $export.R = 128; // real proto method for `library` | ||
26573 | module.exports = $export; | ||
26574 | |||
26575 | /***/ }), | ||
26576 | /* 200 */ | ||
26577 | /***/ (function(module, exports) { | ||
26578 | |||
26579 | // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 | ||
26580 | var global = module.exports = typeof window != 'undefined' && window.Math == Math | ||
26581 | ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); | ||
26582 | if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef | ||
26583 | |||
26584 | /***/ }), | ||
26585 | /* 201 */ | ||
26586 | /***/ (function(module, exports) { | ||
26587 | |||
26588 | var core = module.exports = {version: '2.4.0'}; | ||
26589 | if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef | ||
26590 | |||
26591 | /***/ }), | ||
26592 | /* 202 */ | ||
26593 | /***/ (function(module, exports, __webpack_require__) { | ||
26594 | |||
26595 | // optional / simple context binding | ||
26596 | var aFunction = __webpack_require__(203); | ||
26597 | module.exports = function(fn, that, length){ | ||
26598 | aFunction(fn); | ||
26599 | if(that === undefined)return fn; | ||
26600 | switch(length){ | ||
26601 | case 1: return function(a){ | ||
26602 | return fn.call(that, a); | ||
26603 | }; | ||
26604 | case 2: return function(a, b){ | ||
26605 | return fn.call(that, a, b); | ||
26606 | }; | ||
26607 | case 3: return function(a, b, c){ | ||
26608 | return fn.call(that, a, b, c); | ||
26609 | }; | ||
26610 | } | ||
26611 | return function(/* ...args */){ | ||
26612 | return fn.apply(that, arguments); | ||
26613 | }; | ||
26614 | }; | ||
26615 | |||
26616 | /***/ }), | ||
26617 | /* 203 */ | ||
26618 | /***/ (function(module, exports) { | ||
26619 | |||
26620 | module.exports = function(it){ | ||
26621 | if(typeof it != 'function')throw TypeError(it + ' is not a function!'); | ||
26622 | return it; | ||
26623 | }; | ||
26624 | |||
26625 | /***/ }), | ||
26626 | /* 204 */ | ||
26627 | /***/ (function(module, exports, __webpack_require__) { | ||
26628 | |||
26629 | var dP = __webpack_require__(205) | ||
26630 | , createDesc = __webpack_require__(213); | ||
26631 | module.exports = __webpack_require__(209) ? function(object, key, value){ | ||
26632 | return dP.f(object, key, createDesc(1, value)); | ||
26633 | } : function(object, key, value){ | ||
26634 | object[key] = value; | ||
26635 | return object; | ||
26636 | }; | ||
26637 | |||
26638 | /***/ }), | ||
26639 | /* 205 */ | ||
26640 | /***/ (function(module, exports, __webpack_require__) { | ||
26641 | |||
26642 | var anObject = __webpack_require__(206) | ||
26643 | , IE8_DOM_DEFINE = __webpack_require__(208) | ||
26644 | , toPrimitive = __webpack_require__(212) | ||
26645 | , dP = Object.defineProperty; | ||
26646 | |||
26647 | exports.f = __webpack_require__(209) ? Object.defineProperty : function defineProperty(O, P, Attributes){ | ||
26648 | anObject(O); | ||
26649 | P = toPrimitive(P, true); | ||
26650 | anObject(Attributes); | ||
26651 | if(IE8_DOM_DEFINE)try { | ||
26652 | return dP(O, P, Attributes); | ||
26653 | } catch(e){ /* empty */ } | ||
26654 | if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); | ||
26655 | if('value' in Attributes)O[P] = Attributes.value; | ||
26656 | return O; | ||
26657 | }; | ||
26658 | |||
26659 | /***/ }), | ||
26660 | /* 206 */ | ||
26661 | /***/ (function(module, exports, __webpack_require__) { | ||
26662 | |||
26663 | var isObject = __webpack_require__(207); | ||
26664 | module.exports = function(it){ | ||
26665 | if(!isObject(it))throw TypeError(it + ' is not an object!'); | ||
26666 | return it; | ||
26667 | }; | ||
26668 | |||
26669 | /***/ }), | ||
26670 | /* 207 */ | ||
26671 | /***/ (function(module, exports) { | ||
26672 | |||
26673 | module.exports = function(it){ | ||
26674 | return typeof it === 'object' ? it !== null : typeof it === 'function'; | ||
26675 | }; | ||
26676 | |||
26677 | /***/ }), | ||
26678 | /* 208 */ | ||
26679 | /***/ (function(module, exports, __webpack_require__) { | ||
26680 | |||
26681 | module.exports = !__webpack_require__(209) && !__webpack_require__(210)(function(){ | ||
26682 | return Object.defineProperty(__webpack_require__(211)('div'), 'a', {get: function(){ return 7; }}).a != 7; | ||
26683 | }); | ||
26684 | |||
26685 | /***/ }), | ||
26686 | /* 209 */ | ||
26687 | /***/ (function(module, exports, __webpack_require__) { | ||
26688 | |||
26689 | // Thank's IE8 for his funny defineProperty | ||
26690 | module.exports = !__webpack_require__(210)(function(){ | ||
26691 | return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; | ||
26692 | }); | ||
26693 | |||
26694 | /***/ }), | ||
26695 | /* 210 */ | ||
26696 | /***/ (function(module, exports) { | ||
26697 | |||
26698 | module.exports = function(exec){ | ||
26699 | try { | ||
26700 | return !!exec(); | ||
26701 | } catch(e){ | ||
26702 | return true; | ||
26703 | } | ||
26704 | }; | ||
26705 | |||
26706 | /***/ }), | ||
26707 | /* 211 */ | ||
26708 | /***/ (function(module, exports, __webpack_require__) { | ||
26709 | |||
26710 | var isObject = __webpack_require__(207) | ||
26711 | , document = __webpack_require__(200).document | ||
26712 | // in old IE typeof document.createElement is 'object' | ||
26713 | , is = isObject(document) && isObject(document.createElement); | ||
26714 | module.exports = function(it){ | ||
26715 | return is ? document.createElement(it) : {}; | ||
26716 | }; | ||
26717 | |||
26718 | /***/ }), | ||
26719 | /* 212 */ | ||
26720 | /***/ (function(module, exports, __webpack_require__) { | ||
26721 | |||
26722 | // 7.1.1 ToPrimitive(input [, PreferredType]) | ||
26723 | var isObject = __webpack_require__(207); | ||
26724 | // instead of the ES6 spec version, we didn't implement @@toPrimitive case | ||
26725 | // and the second argument - flag - preferred type is a string | ||
26726 | module.exports = function(it, S){ | ||
26727 | if(!isObject(it))return it; | ||
26728 | var fn, val; | ||
26729 | if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; | ||
26730 | if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; | ||
26731 | if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; | ||
26732 | throw TypeError("Can't convert object to primitive value"); | ||
26733 | }; | ||
26734 | |||
26735 | /***/ }), | ||
26736 | /* 213 */ | ||
26737 | /***/ (function(module, exports) { | ||
26738 | |||
26739 | module.exports = function(bitmap, value){ | ||
26740 | return { | ||
26741 | enumerable : !(bitmap & 1), | ||
26742 | configurable: !(bitmap & 2), | ||
26743 | writable : !(bitmap & 4), | ||
26744 | value : value | ||
26745 | }; | ||
26746 | }; | ||
26747 | |||
26748 | /***/ }), | ||
26749 | /* 214 */ | ||
26750 | /***/ (function(module, exports, __webpack_require__) { | ||
26751 | |||
26752 | module.exports = __webpack_require__(204); | ||
26753 | |||
26754 | /***/ }), | ||
26755 | /* 215 */ | ||
26756 | /***/ (function(module, exports) { | ||
26757 | |||
26758 | var hasOwnProperty = {}.hasOwnProperty; | ||
26759 | module.exports = function(it, key){ | ||
26760 | return hasOwnProperty.call(it, key); | ||
26761 | }; | ||
26762 | |||
26763 | /***/ }), | ||
26764 | /* 216 */ | ||
26765 | /***/ (function(module, exports) { | ||
26766 | |||
26767 | module.exports = {}; | ||
26768 | |||
26769 | /***/ }), | ||
26770 | /* 217 */ | ||
26771 | /***/ (function(module, exports, __webpack_require__) { | ||
26772 | |||
26773 | 'use strict'; | ||
26774 | var create = __webpack_require__(218) | ||
26775 | , descriptor = __webpack_require__(213) | ||
26776 | , setToStringTag = __webpack_require__(233) | ||
26777 | , IteratorPrototype = {}; | ||
26778 | |||
26779 | // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() | ||
26780 | __webpack_require__(204)(IteratorPrototype, __webpack_require__(234)('iterator'), function(){ return this; }); | ||
26781 | |||
26782 | module.exports = function(Constructor, NAME, next){ | ||
26783 | Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); | ||
26784 | setToStringTag(Constructor, NAME + ' Iterator'); | ||
26785 | }; | ||
26786 | |||
26787 | /***/ }), | ||
26788 | /* 218 */ | ||
26789 | /***/ (function(module, exports, __webpack_require__) { | ||
26790 | |||
26791 | // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) | ||
26792 | var anObject = __webpack_require__(206) | ||
26793 | , dPs = __webpack_require__(219) | ||
26794 | , enumBugKeys = __webpack_require__(231) | ||
26795 | , IE_PROTO = __webpack_require__(228)('IE_PROTO') | ||
26796 | , Empty = function(){ /* empty */ } | ||
26797 | , PROTOTYPE = 'prototype'; | ||
26798 | |||
26799 | // Create object with fake `null` prototype: use iframe Object with cleared prototype | ||
26800 | var createDict = function(){ | ||
26801 | // Thrash, waste and sodomy: IE GC bug | ||
26802 | var iframe = __webpack_require__(211)('iframe') | ||
26803 | , i = enumBugKeys.length | ||
26804 | , lt = '<' | ||
26805 | , gt = '>' | ||
26806 | , iframeDocument; | ||
26807 | iframe.style.display = 'none'; | ||
26808 | __webpack_require__(232).appendChild(iframe); | ||
26809 | iframe.src = 'javascript:'; // eslint-disable-line no-script-url | ||
26810 | // createDict = iframe.contentWindow.Object; | ||
26811 | // html.removeChild(iframe); | ||
26812 | iframeDocument = iframe.contentWindow.document; | ||
26813 | iframeDocument.open(); | ||
26814 | iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); | ||
26815 | iframeDocument.close(); | ||
26816 | createDict = iframeDocument.F; | ||
26817 | while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]]; | ||
26818 | return createDict(); | ||
26819 | }; | ||
26820 | |||
26821 | module.exports = Object.create || function create(O, Properties){ | ||
26822 | var result; | ||
26823 | if(O !== null){ | ||
26824 | Empty[PROTOTYPE] = anObject(O); | ||
26825 | result = new Empty; | ||
26826 | Empty[PROTOTYPE] = null; | ||
26827 | // add "__proto__" for Object.getPrototypeOf polyfill | ||
26828 | result[IE_PROTO] = O; | ||
26829 | } else result = createDict(); | ||
26830 | return Properties === undefined ? result : dPs(result, Properties); | ||
26831 | }; | ||
26832 | |||
26833 | |||
26834 | /***/ }), | ||
26835 | /* 219 */ | ||
26836 | /***/ (function(module, exports, __webpack_require__) { | ||
26837 | |||
26838 | var dP = __webpack_require__(205) | ||
26839 | , anObject = __webpack_require__(206) | ||
26840 | , getKeys = __webpack_require__(220); | ||
26841 | |||
26842 | module.exports = __webpack_require__(209) ? Object.defineProperties : function defineProperties(O, Properties){ | ||
26843 | anObject(O); | ||
26844 | var keys = getKeys(Properties) | ||
26845 | , length = keys.length | ||
26846 | , i = 0 | ||
26847 | , P; | ||
26848 | while(length > i)dP.f(O, P = keys[i++], Properties[P]); | ||
26849 | return O; | ||
26850 | }; | ||
26851 | |||
26852 | /***/ }), | ||
26853 | /* 220 */ | ||
26854 | /***/ (function(module, exports, __webpack_require__) { | ||
26855 | |||
26856 | // 19.1.2.14 / 15.2.3.14 Object.keys(O) | ||
26857 | var $keys = __webpack_require__(221) | ||
26858 | , enumBugKeys = __webpack_require__(231); | ||
26859 | |||
26860 | module.exports = Object.keys || function keys(O){ | ||
26861 | return $keys(O, enumBugKeys); | ||
26862 | }; | ||
26863 | |||
26864 | /***/ }), | ||
26865 | /* 221 */ | ||
26866 | /***/ (function(module, exports, __webpack_require__) { | ||
26867 | |||
26868 | var has = __webpack_require__(215) | ||
26869 | , toIObject = __webpack_require__(222) | ||
26870 | , arrayIndexOf = __webpack_require__(225)(false) | ||
26871 | , IE_PROTO = __webpack_require__(228)('IE_PROTO'); | ||
26872 | |||
26873 | module.exports = function(object, names){ | ||
26874 | var O = toIObject(object) | ||
26875 | , i = 0 | ||
26876 | , result = [] | ||
26877 | , key; | ||
26878 | for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); | ||
26879 | // Don't enum bug & hidden keys | ||
26880 | while(names.length > i)if(has(O, key = names[i++])){ | ||
26881 | ~arrayIndexOf(result, key) || result.push(key); | ||
26882 | } | ||
26883 | return result; | ||
26884 | }; | ||
26885 | |||
26886 | /***/ }), | ||
26887 | /* 222 */ | ||
26888 | /***/ (function(module, exports, __webpack_require__) { | ||
26889 | |||
26890 | // to indexed object, toObject with fallback for non-array-like ES3 strings | ||
26891 | var IObject = __webpack_require__(223) | ||
26892 | , defined = __webpack_require__(196); | ||
26893 | module.exports = function(it){ | ||
26894 | return IObject(defined(it)); | ||
26895 | }; | ||
26896 | |||
26897 | /***/ }), | ||
26898 | /* 223 */ | ||
26899 | /***/ (function(module, exports, __webpack_require__) { | ||
26900 | |||
26901 | // fallback for non-array-like ES3 and non-enumerable old V8 strings | ||
26902 | var cof = __webpack_require__(224); | ||
26903 | module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ | ||
26904 | return cof(it) == 'String' ? it.split('') : Object(it); | ||
26905 | }; | ||
26906 | |||
26907 | /***/ }), | ||
26908 | /* 224 */ | ||
26909 | /***/ (function(module, exports) { | ||
26910 | |||
26911 | var toString = {}.toString; | ||
26912 | |||
26913 | module.exports = function(it){ | ||
26914 | return toString.call(it).slice(8, -1); | ||
26915 | }; | ||
26916 | |||
26917 | /***/ }), | ||
26918 | /* 225 */ | ||
26919 | /***/ (function(module, exports, __webpack_require__) { | ||
26920 | |||
26921 | // false -> Array#indexOf | ||
26922 | // true -> Array#includes | ||
26923 | var toIObject = __webpack_require__(222) | ||
26924 | , toLength = __webpack_require__(226) | ||
26925 | , toIndex = __webpack_require__(227); | ||
26926 | module.exports = function(IS_INCLUDES){ | ||
26927 | return function($this, el, fromIndex){ | ||
26928 | var O = toIObject($this) | ||
26929 | , length = toLength(O.length) | ||
26930 | , index = toIndex(fromIndex, length) | ||
26931 | , value; | ||
26932 | // Array#includes uses SameValueZero equality algorithm | ||
26933 | if(IS_INCLUDES && el != el)while(length > index){ | ||
26934 | value = O[index++]; | ||
26935 | if(value != value)return true; | ||
26936 | // Array#toIndex ignores holes, Array#includes - not | ||
26937 | } else for(;length > index; index++)if(IS_INCLUDES || index in O){ | ||
26938 | if(O[index] === el)return IS_INCLUDES || index || 0; | ||
26939 | } return !IS_INCLUDES && -1; | ||
26940 | }; | ||
26941 | }; | ||
26942 | |||
26943 | /***/ }), | ||
26944 | /* 226 */ | ||
26945 | /***/ (function(module, exports, __webpack_require__) { | ||
26946 | |||
26947 | // 7.1.15 ToLength | ||
26948 | var toInteger = __webpack_require__(195) | ||
26949 | , min = Math.min; | ||
26950 | module.exports = function(it){ | ||
26951 | return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 | ||
26952 | }; | ||
26953 | |||
26954 | /***/ }), | ||
26955 | /* 227 */ | ||
26956 | /***/ (function(module, exports, __webpack_require__) { | ||
26957 | |||
26958 | var toInteger = __webpack_require__(195) | ||
26959 | , max = Math.max | ||
26960 | , min = Math.min; | ||
26961 | module.exports = function(index, length){ | ||
26962 | index = toInteger(index); | ||
26963 | return index < 0 ? max(index + length, 0) : min(index, length); | ||
26964 | }; | ||
26965 | |||
26966 | /***/ }), | ||
26967 | /* 228 */ | ||
26968 | /***/ (function(module, exports, __webpack_require__) { | ||
26969 | |||
26970 | var shared = __webpack_require__(229)('keys') | ||
26971 | , uid = __webpack_require__(230); | ||
26972 | module.exports = function(key){ | ||
26973 | return shared[key] || (shared[key] = uid(key)); | ||
26974 | }; | ||
26975 | |||
26976 | /***/ }), | ||
26977 | /* 229 */ | ||
26978 | /***/ (function(module, exports, __webpack_require__) { | ||
26979 | |||
26980 | var global = __webpack_require__(200) | ||
26981 | , SHARED = '__core-js_shared__' | ||
26982 | , store = global[SHARED] || (global[SHARED] = {}); | ||
26983 | module.exports = function(key){ | ||
26984 | return store[key] || (store[key] = {}); | ||
26985 | }; | ||
26986 | |||
26987 | /***/ }), | ||
26988 | /* 230 */ | ||
26989 | /***/ (function(module, exports) { | ||
26990 | |||
26991 | var id = 0 | ||
26992 | , px = Math.random(); | ||
26993 | module.exports = function(key){ | ||
26994 | return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); | ||
26995 | }; | ||
26996 | |||
26997 | /***/ }), | ||
26998 | /* 231 */ | ||
26999 | /***/ (function(module, exports) { | ||
27000 | |||
27001 | // IE 8- don't enum bug keys | ||
27002 | module.exports = ( | ||
27003 | 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' | ||
27004 | ).split(','); | ||
27005 | |||
27006 | /***/ }), | ||
27007 | /* 232 */ | ||
27008 | /***/ (function(module, exports, __webpack_require__) { | ||
27009 | |||
27010 | module.exports = __webpack_require__(200).document && document.documentElement; | ||
27011 | |||
27012 | /***/ }), | ||
27013 | /* 233 */ | ||
27014 | /***/ (function(module, exports, __webpack_require__) { | ||
27015 | |||
27016 | var def = __webpack_require__(205).f | ||
27017 | , has = __webpack_require__(215) | ||
27018 | , TAG = __webpack_require__(234)('toStringTag'); | ||
27019 | |||
27020 | module.exports = function(it, tag, stat){ | ||
27021 | if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); | ||
27022 | }; | ||
27023 | |||
27024 | /***/ }), | ||
27025 | /* 234 */ | ||
27026 | /***/ (function(module, exports, __webpack_require__) { | ||
27027 | |||
27028 | var store = __webpack_require__(229)('wks') | ||
27029 | , uid = __webpack_require__(230) | ||
27030 | , Symbol = __webpack_require__(200).Symbol | ||
27031 | , USE_SYMBOL = typeof Symbol == 'function'; | ||
27032 | |||
27033 | var $exports = module.exports = function(name){ | ||
27034 | return store[name] || (store[name] = | ||
27035 | USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); | ||
27036 | }; | ||
27037 | |||
27038 | $exports.store = store; | ||
27039 | |||
27040 | /***/ }), | ||
27041 | /* 235 */ | ||
27042 | /***/ (function(module, exports, __webpack_require__) { | ||
27043 | |||
27044 | // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) | ||
27045 | var has = __webpack_require__(215) | ||
27046 | , toObject = __webpack_require__(236) | ||
27047 | , IE_PROTO = __webpack_require__(228)('IE_PROTO') | ||
27048 | , ObjectProto = Object.prototype; | ||
27049 | |||
27050 | module.exports = Object.getPrototypeOf || function(O){ | ||
27051 | O = toObject(O); | ||
27052 | if(has(O, IE_PROTO))return O[IE_PROTO]; | ||
27053 | if(typeof O.constructor == 'function' && O instanceof O.constructor){ | ||
27054 | return O.constructor.prototype; | ||
27055 | } return O instanceof Object ? ObjectProto : null; | ||
27056 | }; | ||
27057 | |||
27058 | /***/ }), | ||
27059 | /* 236 */ | ||
27060 | /***/ (function(module, exports, __webpack_require__) { | ||
27061 | |||
27062 | // 7.1.13 ToObject(argument) | ||
27063 | var defined = __webpack_require__(196); | ||
27064 | module.exports = function(it){ | ||
27065 | return Object(defined(it)); | ||
27066 | }; | ||
27067 | |||
27068 | /***/ }), | ||
27069 | /* 237 */ | ||
27070 | /***/ (function(module, exports, __webpack_require__) { | ||
27071 | |||
27072 | __webpack_require__(238); | ||
27073 | var global = __webpack_require__(200) | ||
27074 | , hide = __webpack_require__(204) | ||
27075 | , Iterators = __webpack_require__(216) | ||
27076 | , TO_STRING_TAG = __webpack_require__(234)('toStringTag'); | ||
27077 | |||
27078 | for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ | ||
27079 | var NAME = collections[i] | ||
27080 | , Collection = global[NAME] | ||
27081 | , proto = Collection && Collection.prototype; | ||
27082 | if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); | ||
27083 | Iterators[NAME] = Iterators.Array; | ||
27084 | } | ||
27085 | |||
27086 | /***/ }), | ||
27087 | /* 238 */ | ||
27088 | /***/ (function(module, exports, __webpack_require__) { | ||
27089 | |||
27090 | 'use strict'; | ||
27091 | var addToUnscopables = __webpack_require__(239) | ||
27092 | , step = __webpack_require__(240) | ||
27093 | , Iterators = __webpack_require__(216) | ||
27094 | , toIObject = __webpack_require__(222); | ||
27095 | |||
27096 | // 22.1.3.4 Array.prototype.entries() | ||
27097 | // 22.1.3.13 Array.prototype.keys() | ||
27098 | // 22.1.3.29 Array.prototype.values() | ||
27099 | // 22.1.3.30 Array.prototype[@@iterator]() | ||
27100 | module.exports = __webpack_require__(197)(Array, 'Array', function(iterated, kind){ | ||
27101 | this._t = toIObject(iterated); // target | ||
27102 | this._i = 0; // next index | ||
27103 | this._k = kind; // kind | ||
27104 | // 22.1.5.2.1 %ArrayIteratorPrototype%.next() | ||
27105 | }, function(){ | ||
27106 | var O = this._t | ||
27107 | , kind = this._k | ||
27108 | , index = this._i++; | ||
27109 | if(!O || index >= O.length){ | ||
27110 | this._t = undefined; | ||
27111 | return step(1); | ||
27112 | } | ||
27113 | if(kind == 'keys' )return step(0, index); | ||
27114 | if(kind == 'values')return step(0, O[index]); | ||
27115 | return step(0, [index, O[index]]); | ||
27116 | }, 'values'); | ||
27117 | |||
27118 | // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) | ||
27119 | Iterators.Arguments = Iterators.Array; | ||
27120 | |||
27121 | addToUnscopables('keys'); | ||
27122 | addToUnscopables('values'); | ||
27123 | addToUnscopables('entries'); | ||
27124 | |||
27125 | /***/ }), | ||
27126 | /* 239 */ | ||
27127 | /***/ (function(module, exports) { | ||
27128 | |||
27129 | module.exports = function(){ /* empty */ }; | ||
27130 | |||
27131 | /***/ }), | ||
27132 | /* 240 */ | ||
27133 | /***/ (function(module, exports) { | ||
27134 | |||
27135 | module.exports = function(done, value){ | ||
27136 | return {value: value, done: !!done}; | ||
27137 | }; | ||
27138 | |||
27139 | /***/ }), | ||
27140 | /* 241 */ | ||
27141 | /***/ (function(module, exports, __webpack_require__) { | ||
27142 | |||
27143 | exports.f = __webpack_require__(234); | ||
27144 | |||
27145 | /***/ }), | ||
27146 | /* 242 */ | ||
27147 | /***/ (function(module, exports, __webpack_require__) { | ||
27148 | |||
27149 | module.exports = { "default": __webpack_require__(243), __esModule: true }; | ||
27150 | |||
27151 | /***/ }), | ||
27152 | /* 243 */ | ||
27153 | /***/ (function(module, exports, __webpack_require__) { | ||
27154 | |||
27155 | __webpack_require__(244); | ||
27156 | __webpack_require__(255); | ||
27157 | __webpack_require__(256); | ||
27158 | __webpack_require__(257); | ||
27159 | module.exports = __webpack_require__(201).Symbol; | ||
27160 | |||
27161 | /***/ }), | ||
27162 | /* 244 */ | ||
27163 | /***/ (function(module, exports, __webpack_require__) { | ||
27164 | |||
27165 | 'use strict'; | ||
27166 | // ECMAScript 6 symbols shim | ||
27167 | var global = __webpack_require__(200) | ||
27168 | , has = __webpack_require__(215) | ||
27169 | , DESCRIPTORS = __webpack_require__(209) | ||
27170 | , $export = __webpack_require__(199) | ||
27171 | , redefine = __webpack_require__(214) | ||
27172 | , META = __webpack_require__(245).KEY | ||
27173 | , $fails = __webpack_require__(210) | ||
27174 | , shared = __webpack_require__(229) | ||
27175 | , setToStringTag = __webpack_require__(233) | ||
27176 | , uid = __webpack_require__(230) | ||
27177 | , wks = __webpack_require__(234) | ||
27178 | , wksExt = __webpack_require__(241) | ||
27179 | , wksDefine = __webpack_require__(246) | ||
27180 | , keyOf = __webpack_require__(247) | ||
27181 | , enumKeys = __webpack_require__(248) | ||
27182 | , isArray = __webpack_require__(251) | ||
27183 | , anObject = __webpack_require__(206) | ||
27184 | , toIObject = __webpack_require__(222) | ||
27185 | , toPrimitive = __webpack_require__(212) | ||
27186 | , createDesc = __webpack_require__(213) | ||
27187 | , _create = __webpack_require__(218) | ||
27188 | , gOPNExt = __webpack_require__(252) | ||
27189 | , $GOPD = __webpack_require__(254) | ||
27190 | , $DP = __webpack_require__(205) | ||
27191 | , $keys = __webpack_require__(220) | ||
27192 | , gOPD = $GOPD.f | ||
27193 | , dP = $DP.f | ||
27194 | , gOPN = gOPNExt.f | ||
27195 | , $Symbol = global.Symbol | ||
27196 | , $JSON = global.JSON | ||
27197 | , _stringify = $JSON && $JSON.stringify | ||
27198 | , PROTOTYPE = 'prototype' | ||
27199 | , HIDDEN = wks('_hidden') | ||
27200 | , TO_PRIMITIVE = wks('toPrimitive') | ||
27201 | , isEnum = {}.propertyIsEnumerable | ||
27202 | , SymbolRegistry = shared('symbol-registry') | ||
27203 | , AllSymbols = shared('symbols') | ||
27204 | , OPSymbols = shared('op-symbols') | ||
27205 | , ObjectProto = Object[PROTOTYPE] | ||
27206 | , USE_NATIVE = typeof $Symbol == 'function' | ||
27207 | , QObject = global.QObject; | ||
27208 | // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 | ||
27209 | var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; | ||
27210 | |||
27211 | // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 | ||
27212 | var setSymbolDesc = DESCRIPTORS && $fails(function(){ | ||
27213 | return _create(dP({}, 'a', { | ||
27214 | get: function(){ return dP(this, 'a', {value: 7}).a; } | ||
27215 | })).a != 7; | ||
27216 | }) ? function(it, key, D){ | ||
27217 | var protoDesc = gOPD(ObjectProto, key); | ||
27218 | if(protoDesc)delete ObjectProto[key]; | ||
27219 | dP(it, key, D); | ||
27220 | if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc); | ||
27221 | } : dP; | ||
27222 | |||
27223 | var wrap = function(tag){ | ||
27224 | var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); | ||
27225 | sym._k = tag; | ||
27226 | return sym; | ||
27227 | }; | ||
27228 | |||
27229 | var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){ | ||
27230 | return typeof it == 'symbol'; | ||
27231 | } : function(it){ | ||
27232 | return it instanceof $Symbol; | ||
27233 | }; | ||
27234 | |||
27235 | var $defineProperty = function defineProperty(it, key, D){ | ||
27236 | if(it === ObjectProto)$defineProperty(OPSymbols, key, D); | ||
27237 | anObject(it); | ||
27238 | key = toPrimitive(key, true); | ||
27239 | anObject(D); | ||
27240 | if(has(AllSymbols, key)){ | ||
27241 | if(!D.enumerable){ | ||
27242 | if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {})); | ||
27243 | it[HIDDEN][key] = true; | ||
27244 | } else { | ||
27245 | if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; | ||
27246 | D = _create(D, {enumerable: createDesc(0, false)}); | ||
27247 | } return setSymbolDesc(it, key, D); | ||
27248 | } return dP(it, key, D); | ||
27249 | }; | ||
27250 | var $defineProperties = function defineProperties(it, P){ | ||
27251 | anObject(it); | ||
27252 | var keys = enumKeys(P = toIObject(P)) | ||
27253 | , i = 0 | ||
27254 | , l = keys.length | ||
27255 | , key; | ||
27256 | while(l > i)$defineProperty(it, key = keys[i++], P[key]); | ||
27257 | return it; | ||
27258 | }; | ||
27259 | var $create = function create(it, P){ | ||
27260 | return P === undefined ? _create(it) : $defineProperties(_create(it), P); | ||
27261 | }; | ||
27262 | var $propertyIsEnumerable = function propertyIsEnumerable(key){ | ||
27263 | var E = isEnum.call(this, key = toPrimitive(key, true)); | ||
27264 | if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false; | ||
27265 | return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; | ||
27266 | }; | ||
27267 | var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ | ||
27268 | it = toIObject(it); | ||
27269 | key = toPrimitive(key, true); | ||
27270 | if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return; | ||
27271 | var D = gOPD(it, key); | ||
27272 | if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; | ||
27273 | return D; | ||
27274 | }; | ||
27275 | var $getOwnPropertyNames = function getOwnPropertyNames(it){ | ||
27276 | var names = gOPN(toIObject(it)) | ||
27277 | , result = [] | ||
27278 | , i = 0 | ||
27279 | , key; | ||
27280 | while(names.length > i){ | ||
27281 | if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key); | ||
27282 | } return result; | ||
27283 | }; | ||
27284 | var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ | ||
27285 | var IS_OP = it === ObjectProto | ||
27286 | , names = gOPN(IS_OP ? OPSymbols : toIObject(it)) | ||
27287 | , result = [] | ||
27288 | , i = 0 | ||
27289 | , key; | ||
27290 | while(names.length > i){ | ||
27291 | if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]); | ||
27292 | } return result; | ||
27293 | }; | ||
27294 | |||
27295 | // 19.4.1.1 Symbol([description]) | ||
27296 | if(!USE_NATIVE){ | ||
27297 | $Symbol = function Symbol(){ | ||
27298 | if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!'); | ||
27299 | var tag = uid(arguments.length > 0 ? arguments[0] : undefined); | ||
27300 | var $set = function(value){ | ||
27301 | if(this === ObjectProto)$set.call(OPSymbols, value); | ||
27302 | if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; | ||
27303 | setSymbolDesc(this, tag, createDesc(1, value)); | ||
27304 | }; | ||
27305 | if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set}); | ||
27306 | return wrap(tag); | ||
27307 | }; | ||
27308 | redefine($Symbol[PROTOTYPE], 'toString', function toString(){ | ||
27309 | return this._k; | ||
27310 | }); | ||
27311 | |||
27312 | $GOPD.f = $getOwnPropertyDescriptor; | ||
27313 | $DP.f = $defineProperty; | ||
27314 | __webpack_require__(253).f = gOPNExt.f = $getOwnPropertyNames; | ||
27315 | __webpack_require__(250).f = $propertyIsEnumerable; | ||
27316 | __webpack_require__(249).f = $getOwnPropertySymbols; | ||
27317 | |||
27318 | if(DESCRIPTORS && !__webpack_require__(198)){ | ||
27319 | redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); | ||
27320 | } | ||
27321 | |||
27322 | wksExt.f = function(name){ | ||
27323 | return wrap(wks(name)); | ||
27324 | } | ||
27325 | } | ||
27326 | |||
27327 | $export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol}); | ||
27328 | |||
27329 | for(var symbols = ( | ||
27330 | // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 | ||
27331 | 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' | ||
27332 | ).split(','), i = 0; symbols.length > i; )wks(symbols[i++]); | ||
27333 | |||
27334 | for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]); | ||
27335 | |||
27336 | $export($export.S + $export.F * !USE_NATIVE, 'Symbol', { | ||
27337 | // 19.4.2.1 Symbol.for(key) | ||
27338 | 'for': function(key){ | ||
27339 | return has(SymbolRegistry, key += '') | ||
27340 | ? SymbolRegistry[key] | ||
27341 | : SymbolRegistry[key] = $Symbol(key); | ||
27342 | }, | ||
27343 | // 19.4.2.5 Symbol.keyFor(sym) | ||
27344 | keyFor: function keyFor(key){ | ||
27345 | if(isSymbol(key))return keyOf(SymbolRegistry, key); | ||
27346 | throw TypeError(key + ' is not a symbol!'); | ||
27347 | }, | ||
27348 | useSetter: function(){ setter = true; }, | ||
27349 | useSimple: function(){ setter = false; } | ||
27350 | }); | ||
27351 | |||
27352 | $export($export.S + $export.F * !USE_NATIVE, 'Object', { | ||
27353 | // 19.1.2.2 Object.create(O [, Properties]) | ||
27354 | create: $create, | ||
27355 | // 19.1.2.4 Object.defineProperty(O, P, Attributes) | ||
27356 | defineProperty: $defineProperty, | ||
27357 | // 19.1.2.3 Object.defineProperties(O, Properties) | ||
27358 | defineProperties: $defineProperties, | ||
27359 | // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) | ||
27360 | getOwnPropertyDescriptor: $getOwnPropertyDescriptor, | ||
27361 | // 19.1.2.7 Object.getOwnPropertyNames(O) | ||
27362 | getOwnPropertyNames: $getOwnPropertyNames, | ||
27363 | // 19.1.2.8 Object.getOwnPropertySymbols(O) | ||
27364 | getOwnPropertySymbols: $getOwnPropertySymbols | ||
27365 | }); | ||
27366 | |||
27367 | // 24.3.2 JSON.stringify(value [, replacer [, space]]) | ||
27368 | $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){ | ||
27369 | var S = $Symbol(); | ||
27370 | // MS Edge converts symbol values to JSON as {} | ||
27371 | // WebKit converts symbol values to JSON as null | ||
27372 | // V8 throws on boxed symbols | ||
27373 | return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; | ||
27374 | })), 'JSON', { | ||
27375 | stringify: function stringify(it){ | ||
27376 | if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined | ||
27377 | var args = [it] | ||
27378 | , i = 1 | ||
27379 | , replacer, $replacer; | ||
27380 | while(arguments.length > i)args.push(arguments[i++]); | ||
27381 | replacer = args[1]; | ||
27382 | if(typeof replacer == 'function')$replacer = replacer; | ||
27383 | if($replacer || !isArray(replacer))replacer = function(key, value){ | ||
27384 | if($replacer)value = $replacer.call(this, key, value); | ||
27385 | if(!isSymbol(value))return value; | ||
27386 | }; | ||
27387 | args[1] = replacer; | ||
27388 | return _stringify.apply($JSON, args); | ||
27389 | } | ||
27390 | }); | ||
27391 | |||
27392 | // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) | ||
27393 | $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(204)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); | ||
27394 | // 19.4.3.5 Symbol.prototype[@@toStringTag] | ||
27395 | setToStringTag($Symbol, 'Symbol'); | ||
27396 | // 20.2.1.9 Math[@@toStringTag] | ||
27397 | setToStringTag(Math, 'Math', true); | ||
27398 | // 24.3.3 JSON[@@toStringTag] | ||
27399 | setToStringTag(global.JSON, 'JSON', true); | ||
27400 | |||
27401 | /***/ }), | ||
27402 | /* 245 */ | ||
27403 | /***/ (function(module, exports, __webpack_require__) { | ||
27404 | |||
27405 | var META = __webpack_require__(230)('meta') | ||
27406 | , isObject = __webpack_require__(207) | ||
27407 | , has = __webpack_require__(215) | ||
27408 | , setDesc = __webpack_require__(205).f | ||
27409 | , id = 0; | ||
27410 | var isExtensible = Object.isExtensible || function(){ | ||
27411 | return true; | ||
27412 | }; | ||
27413 | var FREEZE = !__webpack_require__(210)(function(){ | ||
27414 | return isExtensible(Object.preventExtensions({})); | ||
27415 | }); | ||
27416 | var setMeta = function(it){ | ||
27417 | setDesc(it, META, {value: { | ||
27418 | i: 'O' + ++id, // object ID | ||
27419 | w: {} // weak collections IDs | ||
27420 | }}); | ||
27421 | }; | ||
27422 | var fastKey = function(it, create){ | ||
27423 | // return primitive with prefix | ||
27424 | if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; | ||
27425 | if(!has(it, META)){ | ||
27426 | // can't set metadata to uncaught frozen object | ||
27427 | if(!isExtensible(it))return 'F'; | ||
27428 | // not necessary to add metadata | ||
27429 | if(!create)return 'E'; | ||
27430 | // add missing metadata | ||
27431 | setMeta(it); | ||
27432 | // return object ID | ||
27433 | } return it[META].i; | ||
27434 | }; | ||
27435 | var getWeak = function(it, create){ | ||
27436 | if(!has(it, META)){ | ||
27437 | // can't set metadata to uncaught frozen object | ||
27438 | if(!isExtensible(it))return true; | ||
27439 | // not necessary to add metadata | ||
27440 | if(!create)return false; | ||
27441 | // add missing metadata | ||
27442 | setMeta(it); | ||
27443 | // return hash weak collections IDs | ||
27444 | } return it[META].w; | ||
27445 | }; | ||
27446 | // add metadata on freeze-family methods calling | ||
27447 | var onFreeze = function(it){ | ||
27448 | if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it); | ||
27449 | return it; | ||
27450 | }; | ||
27451 | var meta = module.exports = { | ||
27452 | KEY: META, | ||
27453 | NEED: false, | ||
27454 | fastKey: fastKey, | ||
27455 | getWeak: getWeak, | ||
27456 | onFreeze: onFreeze | ||
27457 | }; | ||
27458 | |||
27459 | /***/ }), | ||
27460 | /* 246 */ | ||
27461 | /***/ (function(module, exports, __webpack_require__) { | ||
27462 | |||
27463 | var global = __webpack_require__(200) | ||
27464 | , core = __webpack_require__(201) | ||
27465 | , LIBRARY = __webpack_require__(198) | ||
27466 | , wksExt = __webpack_require__(241) | ||
27467 | , defineProperty = __webpack_require__(205).f; | ||
27468 | module.exports = function(name){ | ||
27469 | var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); | ||
27470 | if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)}); | ||
27471 | }; | ||
27472 | |||
27473 | /***/ }), | ||
27474 | /* 247 */ | ||
27475 | /***/ (function(module, exports, __webpack_require__) { | ||
27476 | |||
27477 | var getKeys = __webpack_require__(220) | ||
27478 | , toIObject = __webpack_require__(222); | ||
27479 | module.exports = function(object, el){ | ||
27480 | var O = toIObject(object) | ||
27481 | , keys = getKeys(O) | ||
27482 | , length = keys.length | ||
27483 | , index = 0 | ||
27484 | , key; | ||
27485 | while(length > index)if(O[key = keys[index++]] === el)return key; | ||
27486 | }; | ||
27487 | |||
27488 | /***/ }), | ||
27489 | /* 248 */ | ||
27490 | /***/ (function(module, exports, __webpack_require__) { | ||
27491 | |||
27492 | // all enumerable object keys, includes symbols | ||
27493 | var getKeys = __webpack_require__(220) | ||
27494 | , gOPS = __webpack_require__(249) | ||
27495 | , pIE = __webpack_require__(250); | ||
27496 | module.exports = function(it){ | ||
27497 | var result = getKeys(it) | ||
27498 | , getSymbols = gOPS.f; | ||
27499 | if(getSymbols){ | ||
27500 | var symbols = getSymbols(it) | ||
27501 | , isEnum = pIE.f | ||
27502 | , i = 0 | ||
27503 | , key; | ||
27504 | while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key); | ||
27505 | } return result; | ||
27506 | }; | ||
27507 | |||
27508 | /***/ }), | ||
27509 | /* 249 */ | ||
27510 | /***/ (function(module, exports) { | ||
27511 | |||
27512 | exports.f = Object.getOwnPropertySymbols; | ||
27513 | |||
27514 | /***/ }), | ||
27515 | /* 250 */ | ||
27516 | /***/ (function(module, exports) { | ||
27517 | |||
27518 | exports.f = {}.propertyIsEnumerable; | ||
27519 | |||
27520 | /***/ }), | ||
27521 | /* 251 */ | ||
27522 | /***/ (function(module, exports, __webpack_require__) { | ||
27523 | |||
27524 | // 7.2.2 IsArray(argument) | ||
27525 | var cof = __webpack_require__(224); | ||
27526 | module.exports = Array.isArray || function isArray(arg){ | ||
27527 | return cof(arg) == 'Array'; | ||
27528 | }; | ||
27529 | |||
27530 | /***/ }), | ||
27531 | /* 252 */ | ||
27532 | /***/ (function(module, exports, __webpack_require__) { | ||
27533 | |||
27534 | // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window | ||
27535 | var toIObject = __webpack_require__(222) | ||
27536 | , gOPN = __webpack_require__(253).f | ||
27537 | , toString = {}.toString; | ||
27538 | |||
27539 | var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames | ||
27540 | ? Object.getOwnPropertyNames(window) : []; | ||
27541 | |||
27542 | var getWindowNames = function(it){ | ||
27543 | try { | ||
27544 | return gOPN(it); | ||
27545 | } catch(e){ | ||
27546 | return windowNames.slice(); | ||
27547 | } | ||
27548 | }; | ||
27549 | |||
27550 | module.exports.f = function getOwnPropertyNames(it){ | ||
27551 | return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); | ||
27552 | }; | ||
27553 | |||
27554 | |||
27555 | /***/ }), | ||
27556 | /* 253 */ | ||
27557 | /***/ (function(module, exports, __webpack_require__) { | ||
27558 | |||
27559 | // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) | ||
27560 | var $keys = __webpack_require__(221) | ||
27561 | , hiddenKeys = __webpack_require__(231).concat('length', 'prototype'); | ||
27562 | |||
27563 | exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){ | ||
27564 | return $keys(O, hiddenKeys); | ||
27565 | }; | ||
27566 | |||
27567 | /***/ }), | ||
27568 | /* 254 */ | ||
27569 | /***/ (function(module, exports, __webpack_require__) { | ||
27570 | |||
27571 | var pIE = __webpack_require__(250) | ||
27572 | , createDesc = __webpack_require__(213) | ||
27573 | , toIObject = __webpack_require__(222) | ||
27574 | , toPrimitive = __webpack_require__(212) | ||
27575 | , has = __webpack_require__(215) | ||
27576 | , IE8_DOM_DEFINE = __webpack_require__(208) | ||
27577 | , gOPD = Object.getOwnPropertyDescriptor; | ||
27578 | |||
27579 | exports.f = __webpack_require__(209) ? gOPD : function getOwnPropertyDescriptor(O, P){ | ||
27580 | O = toIObject(O); | ||
27581 | P = toPrimitive(P, true); | ||
27582 | if(IE8_DOM_DEFINE)try { | ||
27583 | return gOPD(O, P); | ||
27584 | } catch(e){ /* empty */ } | ||
27585 | if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]); | ||
27586 | }; | ||
27587 | |||
27588 | /***/ }), | ||
27589 | /* 255 */ | ||
27590 | /***/ (function(module, exports) { | ||
27591 | |||
27592 | |||
27593 | |||
27594 | /***/ }), | ||
27595 | /* 256 */ | ||
27596 | /***/ (function(module, exports, __webpack_require__) { | ||
27597 | |||
27598 | __webpack_require__(246)('asyncIterator'); | ||
27599 | |||
27600 | /***/ }), | ||
27601 | /* 257 */ | ||
27602 | /***/ (function(module, exports, __webpack_require__) { | ||
27603 | |||
27604 | __webpack_require__(246)('observable'); | ||
27605 | |||
27606 | /***/ }), | ||
27607 | /* 258 */ | ||
27608 | /***/ (function(module, exports, __webpack_require__) { | ||
27609 | |||
27610 | "use strict"; | ||
27611 | |||
27612 | exports.__esModule = true; | ||
27613 | |||
27614 | var _setPrototypeOf = __webpack_require__(259); | ||
27615 | |||
27616 | var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); | ||
27617 | |||
27618 | var _create = __webpack_require__(263); | ||
27619 | |||
27620 | var _create2 = _interopRequireDefault(_create); | ||
27621 | |||
27622 | var _typeof2 = __webpack_require__(190); | ||
27623 | |||
27624 | var _typeof3 = _interopRequireDefault(_typeof2); | ||
27625 | |||
27626 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
27627 | |||
27628 | exports.default = function (subClass, superClass) { | ||
27629 | if (typeof superClass !== "function" && superClass !== null) { | ||
27630 | throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass))); | ||
27631 | } | ||
27632 | |||
27633 | subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, { | ||
27634 | constructor: { | ||
27635 | value: subClass, | ||
27636 | enumerable: false, | ||
27637 | writable: true, | ||
27638 | configurable: true | ||
27639 | } | ||
27640 | }); | ||
27641 | if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass; | ||
27642 | }; | ||
27643 | |||
27644 | /***/ }), | ||
27645 | /* 259 */ | ||
27646 | /***/ (function(module, exports, __webpack_require__) { | ||
27647 | |||
27648 | module.exports = { "default": __webpack_require__(260), __esModule: true }; | ||
27649 | |||
27650 | /***/ }), | ||
27651 | /* 260 */ | ||
27652 | /***/ (function(module, exports, __webpack_require__) { | ||
27653 | |||
27654 | __webpack_require__(261); | ||
27655 | module.exports = __webpack_require__(201).Object.setPrototypeOf; | ||
27656 | |||
27657 | /***/ }), | ||
27658 | /* 261 */ | ||
27659 | /***/ (function(module, exports, __webpack_require__) { | ||
27660 | |||
27661 | // 19.1.3.19 Object.setPrototypeOf(O, proto) | ||
27662 | var $export = __webpack_require__(199); | ||
27663 | $export($export.S, 'Object', {setPrototypeOf: __webpack_require__(262).set}); | ||
27664 | |||
27665 | /***/ }), | ||
27666 | /* 262 */ | ||
27667 | /***/ (function(module, exports, __webpack_require__) { | ||
27668 | |||
27669 | // Works with __proto__ only. Old v8 can't work with null proto objects. | ||
27670 | /* eslint-disable no-proto */ | ||
27671 | var isObject = __webpack_require__(207) | ||
27672 | , anObject = __webpack_require__(206); | ||
27673 | var check = function(O, proto){ | ||
27674 | anObject(O); | ||
27675 | if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!"); | ||
27676 | }; | ||
27677 | module.exports = { | ||
27678 | set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line | ||
27679 | function(test, buggy, set){ | ||
27680 | try { | ||
27681 | set = __webpack_require__(202)(Function.call, __webpack_require__(254).f(Object.prototype, '__proto__').set, 2); | ||
27682 | set(test, []); | ||
27683 | buggy = !(test instanceof Array); | ||
27684 | } catch(e){ buggy = true; } | ||
27685 | return function setPrototypeOf(O, proto){ | ||
27686 | check(O, proto); | ||
27687 | if(buggy)O.__proto__ = proto; | ||
27688 | else set(O, proto); | ||
27689 | return O; | ||
27690 | }; | ||
27691 | }({}, false) : undefined), | ||
27692 | check: check | ||
27693 | }; | ||
27694 | |||
27695 | /***/ }), | ||
27696 | /* 263 */ | ||
27697 | /***/ (function(module, exports, __webpack_require__) { | ||
27698 | |||
27699 | module.exports = { "default": __webpack_require__(264), __esModule: true }; | ||
27700 | |||
27701 | /***/ }), | ||
27702 | /* 264 */ | ||
27703 | /***/ (function(module, exports, __webpack_require__) { | ||
27704 | |||
27705 | __webpack_require__(265); | ||
27706 | var $Object = __webpack_require__(201).Object; | ||
27707 | module.exports = function create(P, D){ | ||
27708 | return $Object.create(P, D); | ||
27709 | }; | ||
27710 | |||
27711 | /***/ }), | ||
27712 | /* 265 */ | ||
27713 | /***/ (function(module, exports, __webpack_require__) { | ||
27714 | |||
27715 | var $export = __webpack_require__(199) | ||
27716 | // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) | ||
27717 | $export($export.S, 'Object', {create: __webpack_require__(218)}); | ||
27718 | |||
27719 | /***/ }), | ||
27720 | /* 266 */ | ||
27721 | /***/ (function(module, exports, __webpack_require__) { | ||
27722 | |||
27723 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
27724 | * Copyright 2013-present, Facebook, Inc. | ||
27725 | * All rights reserved. | ||
27726 | * | ||
27727 | * This source code is licensed under the BSD-style license found in the | ||
27728 | * LICENSE file in the root directory of this source tree. An additional grant | ||
27729 | * of patent rights can be found in the PATENTS file in the same directory. | ||
27730 | */ | ||
27731 | |||
27732 | if (process.env.NODE_ENV !== 'production') { | ||
27733 | var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && | ||
27734 | Symbol.for && | ||
27735 | Symbol.for('react.element')) || | ||
27736 | 0xeac7; | ||
27737 | |||
27738 | var isValidElement = function(object) { | ||
27739 | return typeof object === 'object' && | ||
27740 | object !== null && | ||
27741 | object.$$typeof === REACT_ELEMENT_TYPE; | ||
27742 | }; | ||
27743 | |||
27744 | // By explicitly using `prop-types` you are opting into new development behavior. | ||
27745 | // http://fb.me/prop-types-in-prod | ||
27746 | var throwOnDirectAccess = true; | ||
27747 | module.exports = __webpack_require__(33)(isValidElement, throwOnDirectAccess); | ||
27748 | } else { | ||
27749 | // By explicitly using `prop-types` you are opting into new production behavior. | ||
27750 | // http://fb.me/prop-types-in-prod | ||
27751 | module.exports = __webpack_require__(267)(); | ||
27752 | } | ||
27753 | |||
27754 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
27755 | |||
27756 | /***/ }), | ||
27757 | /* 267 */ | ||
27758 | /***/ (function(module, exports, __webpack_require__) { | ||
27759 | |||
27760 | /** | ||
27761 | * Copyright 2013-present, Facebook, Inc. | ||
27762 | * All rights reserved. | ||
27763 | * | ||
27764 | * This source code is licensed under the BSD-style license found in the | ||
27765 | * LICENSE file in the root directory of this source tree. An additional grant | ||
27766 | * of patent rights can be found in the PATENTS file in the same directory. | ||
27767 | */ | ||
27768 | |||
27769 | 'use strict'; | ||
27770 | |||
27771 | var emptyFunction = __webpack_require__(14); | ||
27772 | var invariant = __webpack_require__(10); | ||
27773 | |||
27774 | module.exports = function() { | ||
27775 | // Important! | ||
27776 | // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. | ||
27777 | function shim() { | ||
27778 | invariant( | ||
27779 | false, | ||
27780 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | ||
27781 | 'Use PropTypes.checkPropTypes() to call them. ' + | ||
27782 | 'Read more at http://fb.me/use-check-prop-types' | ||
27783 | ); | ||
27784 | }; | ||
27785 | shim.isRequired = shim; | ||
27786 | function getShim() { | ||
27787 | return shim; | ||
27788 | }; | ||
27789 | var ReactPropTypes = { | ||
27790 | array: shim, | ||
27791 | bool: shim, | ||
27792 | func: shim, | ||
27793 | number: shim, | ||
27794 | object: shim, | ||
27795 | string: shim, | ||
27796 | symbol: shim, | ||
27797 | |||
27798 | any: shim, | ||
27799 | arrayOf: getShim, | ||
27800 | element: shim, | ||
27801 | instanceOf: getShim, | ||
27802 | node: shim, | ||
27803 | objectOf: getShim, | ||
27804 | oneOf: getShim, | ||
27805 | oneOfType: getShim, | ||
27806 | shape: getShim | ||
27807 | }; | ||
27808 | |||
27809 | ReactPropTypes.checkPropTypes = emptyFunction; | ||
27810 | ReactPropTypes.PropTypes = ReactPropTypes; | ||
27811 | |||
27812 | return ReactPropTypes; | ||
27813 | }; | ||
27814 | |||
27815 | |||
27816 | /***/ }), | ||
27817 | /* 268 */ | ||
27818 | /***/ (function(module, exports, __webpack_require__) { | ||
27819 | |||
27820 | 'use strict'; | ||
27821 | |||
27822 | module.exports = __webpack_require__(269); | ||
27823 | |||
27824 | /***/ }), | ||
27825 | /* 269 */ | ||
27826 | /***/ (function(module, exports, __webpack_require__) { | ||
27827 | |||
27828 | 'use strict'; | ||
27829 | |||
27830 | Object.defineProperty(exports, "__esModule", { | ||
27831 | value: true | ||
27832 | }); | ||
27833 | |||
27834 | var _extends2 = __webpack_require__(270); | ||
27835 | |||
27836 | var _extends3 = _interopRequireDefault(_extends2); | ||
27837 | |||
27838 | var _react = __webpack_require__(3); | ||
27839 | |||
27840 | var _react2 = _interopRequireDefault(_react); | ||
27841 | |||
27842 | var _reactDom = __webpack_require__(38); | ||
27843 | |||
27844 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
27845 | |||
27846 | var _contains = __webpack_require__(275); | ||
27847 | |||
27848 | var _contains2 = _interopRequireDefault(_contains); | ||
27849 | |||
27850 | var _addEventListener = __webpack_require__(276); | ||
27851 | |||
27852 | var _addEventListener2 = _interopRequireDefault(_addEventListener); | ||
27853 | |||
27854 | var _Popup = __webpack_require__(280); | ||
27855 | |||
27856 | var _Popup2 = _interopRequireDefault(_Popup); | ||
27857 | |||
27858 | var _utils = __webpack_require__(305); | ||
27859 | |||
27860 | var _getContainerRenderMixin = __webpack_require__(306); | ||
27861 | |||
27862 | var _getContainerRenderMixin2 = _interopRequireDefault(_getContainerRenderMixin); | ||
27863 | |||
27864 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
27865 | |||
27866 | function noop() {} | ||
27867 | |||
27868 | function returnEmptyString() { | ||
27869 | return ''; | ||
27870 | } | ||
27871 | |||
27872 | function returnDocument() { | ||
27873 | return window.document; | ||
27874 | } | ||
27875 | |||
27876 | // use fastclick for mobile touch | ||
27877 | var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur']; | ||
27878 | |||
27879 | var Trigger = _react2["default"].createClass({ | ||
27880 | displayName: 'Trigger', | ||
27881 | |||
27882 | propTypes: { | ||
27883 | children: _react.PropTypes.any, | ||
27884 | action: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.arrayOf(_react.PropTypes.string)]), | ||
27885 | showAction: _react.PropTypes.any, | ||
27886 | hideAction: _react.PropTypes.any, | ||
27887 | getPopupClassNameFromAlign: _react.PropTypes.any, | ||
27888 | onPopupVisibleChange: _react.PropTypes.func, | ||
27889 | afterPopupVisibleChange: _react.PropTypes.func, | ||
27890 | popup: _react.PropTypes.oneOfType([_react.PropTypes.node, _react.PropTypes.func]).isRequired, | ||
27891 | popupStyle: _react.PropTypes.object, | ||
27892 | prefixCls: _react.PropTypes.string, | ||
27893 | popupClassName: _react.PropTypes.string, | ||
27894 | popupPlacement: _react.PropTypes.string, | ||
27895 | builtinPlacements: _react.PropTypes.object, | ||
27896 | popupTransitionName: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.object]), | ||
27897 | popupAnimation: _react.PropTypes.any, | ||
27898 | mouseEnterDelay: _react.PropTypes.number, | ||
27899 | mouseLeaveDelay: _react.PropTypes.number, | ||
27900 | zIndex: _react.PropTypes.number, | ||
27901 | focusDelay: _react.PropTypes.number, | ||
27902 | blurDelay: _react.PropTypes.number, | ||
27903 | getPopupContainer: _react.PropTypes.func, | ||
27904 | getDocument: _react.PropTypes.func, | ||
27905 | destroyPopupOnHide: _react.PropTypes.bool, | ||
27906 | mask: _react.PropTypes.bool, | ||
27907 | maskClosable: _react.PropTypes.bool, | ||
27908 | onPopupAlign: _react.PropTypes.func, | ||
27909 | popupAlign: _react.PropTypes.object, | ||
27910 | popupVisible: _react.PropTypes.bool, | ||
27911 | maskTransitionName: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.object]), | ||
27912 | maskAnimation: _react.PropTypes.string | ||
27913 | }, | ||
27914 | |||
27915 | mixins: [(0, _getContainerRenderMixin2["default"])({ | ||
27916 | autoMount: false, | ||
27917 | |||
27918 | isVisible: function isVisible(instance) { | ||
27919 | return instance.state.popupVisible; | ||
27920 | }, | ||
27921 | getContainer: function getContainer(instance) { | ||
27922 | var props = instance.props; | ||
27923 | |||
27924 | var popupContainer = document.createElement('div'); | ||
27925 | // Make sure default popup container will never cause scrollbar appearing | ||
27926 | // https://github.com/react-component/trigger/issues/41 | ||
27927 | popupContainer.style.position = 'absolute'; | ||
27928 | popupContainer.style.top = '0'; | ||
27929 | popupContainer.style.left = '0'; | ||
27930 | popupContainer.style.width = '100%'; | ||
27931 | var mountNode = props.getPopupContainer ? props.getPopupContainer((0, _reactDom.findDOMNode)(instance)) : props.getDocument().body; | ||
27932 | mountNode.appendChild(popupContainer); | ||
27933 | return popupContainer; | ||
27934 | } | ||
27935 | })], | ||
27936 | |||
27937 | getDefaultProps: function getDefaultProps() { | ||
27938 | return { | ||
27939 | prefixCls: 'rc-trigger-popup', | ||
27940 | getPopupClassNameFromAlign: returnEmptyString, | ||
27941 | getDocument: returnDocument, | ||
27942 | onPopupVisibleChange: noop, | ||
27943 | afterPopupVisibleChange: noop, | ||
27944 | onPopupAlign: noop, | ||
27945 | popupClassName: '', | ||
27946 | mouseEnterDelay: 0, | ||
27947 | mouseLeaveDelay: 0.1, | ||
27948 | focusDelay: 0, | ||
27949 | blurDelay: 0.15, | ||
27950 | popupStyle: {}, | ||
27951 | destroyPopupOnHide: false, | ||
27952 | popupAlign: {}, | ||
27953 | defaultPopupVisible: false, | ||
27954 | mask: false, | ||
27955 | maskClosable: true, | ||
27956 | action: [], | ||
27957 | showAction: [], | ||
27958 | hideAction: [] | ||
27959 | }; | ||
27960 | }, | ||
27961 | getInitialState: function getInitialState() { | ||
27962 | var props = this.props; | ||
27963 | var popupVisible = void 0; | ||
27964 | if ('popupVisible' in props) { | ||
27965 | popupVisible = !!props.popupVisible; | ||
27966 | } else { | ||
27967 | popupVisible = !!props.defaultPopupVisible; | ||
27968 | } | ||
27969 | return { | ||
27970 | popupVisible: popupVisible | ||
27971 | }; | ||
27972 | }, | ||
27973 | componentWillMount: function componentWillMount() { | ||
27974 | var _this = this; | ||
27975 | |||
27976 | ALL_HANDLERS.forEach(function (h) { | ||
27977 | _this['fire' + h] = function (e) { | ||
27978 | _this.fireEvents(h, e); | ||
27979 | }; | ||
27980 | }); | ||
27981 | }, | ||
27982 | componentDidMount: function componentDidMount() { | ||
27983 | this.componentDidUpdate({}, { | ||
27984 | popupVisible: this.state.popupVisible | ||
27985 | }); | ||
27986 | }, | ||
27987 | componentWillReceiveProps: function componentWillReceiveProps(_ref) { | ||
27988 | var popupVisible = _ref.popupVisible; | ||
27989 | |||
27990 | if (popupVisible !== undefined) { | ||
27991 | this.setState({ | ||
27992 | popupVisible: popupVisible | ||
27993 | }); | ||
27994 | } | ||
27995 | }, | ||
27996 | componentDidUpdate: function componentDidUpdate(_, prevState) { | ||
27997 | var props = this.props; | ||
27998 | var state = this.state; | ||
27999 | this.renderComponent(null, function () { | ||
28000 | if (prevState.popupVisible !== state.popupVisible) { | ||
28001 | props.afterPopupVisibleChange(state.popupVisible); | ||
28002 | } | ||
28003 | }); | ||
28004 | |||
28005 | if (state.popupVisible) { | ||
28006 | var currentDocument = void 0; | ||
28007 | if (!this.clickOutsideHandler && this.isClickToHide()) { | ||
28008 | currentDocument = props.getDocument(); | ||
28009 | this.clickOutsideHandler = (0, _addEventListener2["default"])(currentDocument, 'click', this.onDocumentClick); | ||
28010 | } | ||
28011 | return; | ||
28012 | } | ||
28013 | |||
28014 | this.clearOutsideHandler(); | ||
28015 | }, | ||
28016 | componentWillUnmount: function componentWillUnmount() { | ||
28017 | this.clearDelayTimer(); | ||
28018 | this.clearOutsideHandler(); | ||
28019 | }, | ||
28020 | onMouseEnter: function onMouseEnter(e) { | ||
28021 | this.fireEvents('onMouseEnter', e); | ||
28022 | this.delaySetPopupVisible(true, this.props.mouseEnterDelay); | ||
28023 | }, | ||
28024 | onMouseLeave: function onMouseLeave(e) { | ||
28025 | this.fireEvents('onMouseLeave', e); | ||
28026 | this.delaySetPopupVisible(false, this.props.mouseLeaveDelay); | ||
28027 | }, | ||
28028 | onPopupMouseEnter: function onPopupMouseEnter() { | ||
28029 | this.clearDelayTimer(); | ||
28030 | }, | ||
28031 | onPopupMouseLeave: function onPopupMouseLeave(e) { | ||
28032 | // https://github.com/react-component/trigger/pull/13 | ||
28033 | // react bug? | ||
28034 | if (e.relatedTarget && !e.relatedTarget.setTimeout && this._component && (0, _contains2["default"])(this._component.getPopupDomNode(), e.relatedTarget)) { | ||
28035 | return; | ||
28036 | } | ||
28037 | this.delaySetPopupVisible(false, this.props.mouseLeaveDelay); | ||
28038 | }, | ||
28039 | onFocus: function onFocus(e) { | ||
28040 | this.fireEvents('onFocus', e); | ||
28041 | // incase focusin and focusout | ||
28042 | this.clearDelayTimer(); | ||
28043 | if (this.isFocusToShow()) { | ||
28044 | this.focusTime = Date.now(); | ||
28045 | this.delaySetPopupVisible(true, this.props.focusDelay); | ||
28046 | } | ||
28047 | }, | ||
28048 | onMouseDown: function onMouseDown(e) { | ||
28049 | this.fireEvents('onMouseDown', e); | ||
28050 | this.preClickTime = Date.now(); | ||
28051 | }, | ||
28052 | onBlur: function onBlur(e) { | ||
28053 | this.fireEvents('onBlur', e); | ||
28054 | this.clearDelayTimer(); | ||
28055 | if (this.isBlurToHide()) { | ||
28056 | this.delaySetPopupVisible(false, this.props.blurDelay); | ||
28057 | } | ||
28058 | }, | ||
28059 | onClick: function onClick(event) { | ||
28060 | this.fireEvents('onClick', event); | ||
28061 | // focus will trigger click | ||
28062 | if (this.focusTime) { | ||
28063 | var preTime = void 0; | ||
28064 | if (this.preClickTime) { | ||
28065 | preTime = this.preClickTime; | ||
28066 | } | ||
28067 | if (Math.abs(preTime - this.focusTime) < 20) { | ||
28068 | return; | ||
28069 | } | ||
28070 | this.focusTime = 0; | ||
28071 | } | ||
28072 | this.preClickTime = 0; | ||
28073 | event.preventDefault(); | ||
28074 | var nextVisible = !this.state.popupVisible; | ||
28075 | if (this.isClickToHide() && !nextVisible || nextVisible && this.isClickToShow()) { | ||
28076 | this.setPopupVisible(!this.state.popupVisible); | ||
28077 | } | ||
28078 | }, | ||
28079 | onDocumentClick: function onDocumentClick(event) { | ||
28080 | if (this.props.mask && !this.props.maskClosable) { | ||
28081 | return; | ||
28082 | } | ||
28083 | var target = event.target; | ||
28084 | var root = (0, _reactDom.findDOMNode)(this); | ||
28085 | var popupNode = this.getPopupDomNode(); | ||
28086 | if (!(0, _contains2["default"])(root, target) && !(0, _contains2["default"])(popupNode, target)) { | ||
28087 | this.close(); | ||
28088 | } | ||
28089 | }, | ||
28090 | getPopupDomNode: function getPopupDomNode() { | ||
28091 | // for test | ||
28092 | if (this._component) { | ||
28093 | return this._component.isMounted() ? this._component.getPopupDomNode() : null; | ||
28094 | } | ||
28095 | return null; | ||
28096 | }, | ||
28097 | getRootDomNode: function getRootDomNode() { | ||
28098 | return _reactDom2["default"].findDOMNode(this); | ||
28099 | }, | ||
28100 | getPopupClassNameFromAlign: function getPopupClassNameFromAlign(align) { | ||
28101 | var className = []; | ||
28102 | var props = this.props; | ||
28103 | var popupPlacement = props.popupPlacement, | ||
28104 | builtinPlacements = props.builtinPlacements, | ||
28105 | prefixCls = props.prefixCls; | ||
28106 | |||
28107 | if (popupPlacement && builtinPlacements) { | ||
28108 | className.push((0, _utils.getPopupClassNameFromAlign)(builtinPlacements, prefixCls, align)); | ||
28109 | } | ||
28110 | if (props.getPopupClassNameFromAlign) { | ||
28111 | className.push(props.getPopupClassNameFromAlign(align)); | ||
28112 | } | ||
28113 | return className.join(' '); | ||
28114 | }, | ||
28115 | getPopupAlign: function getPopupAlign() { | ||
28116 | var props = this.props; | ||
28117 | var popupPlacement = props.popupPlacement, | ||
28118 | popupAlign = props.popupAlign, | ||
28119 | builtinPlacements = props.builtinPlacements; | ||
28120 | |||
28121 | if (popupPlacement && builtinPlacements) { | ||
28122 | return (0, _utils.getAlignFromPlacement)(builtinPlacements, popupPlacement, popupAlign); | ||
28123 | } | ||
28124 | return popupAlign; | ||
28125 | }, | ||
28126 | getComponent: function getComponent() { | ||
28127 | var props = this.props, | ||
28128 | state = this.state; | ||
28129 | |||
28130 | var mouseProps = {}; | ||
28131 | if (this.isMouseEnterToShow()) { | ||
28132 | mouseProps.onMouseEnter = this.onPopupMouseEnter; | ||
28133 | } | ||
28134 | if (this.isMouseLeaveToHide()) { | ||
28135 | mouseProps.onMouseLeave = this.onPopupMouseLeave; | ||
28136 | } | ||
28137 | return _react2["default"].createElement( | ||
28138 | _Popup2["default"], | ||
28139 | (0, _extends3["default"])({ | ||
28140 | prefixCls: props.prefixCls, | ||
28141 | destroyPopupOnHide: props.destroyPopupOnHide, | ||
28142 | visible: state.popupVisible, | ||
28143 | className: props.popupClassName, | ||
28144 | action: props.action, | ||
28145 | align: this.getPopupAlign(), | ||
28146 | onAlign: props.onPopupAlign, | ||
28147 | animation: props.popupAnimation, | ||
28148 | getClassNameFromAlign: this.getPopupClassNameFromAlign | ||
28149 | }, mouseProps, { | ||
28150 | getRootDomNode: this.getRootDomNode, | ||
28151 | style: props.popupStyle, | ||
28152 | mask: props.mask, | ||
28153 | zIndex: props.zIndex, | ||
28154 | transitionName: props.popupTransitionName, | ||
28155 | maskAnimation: props.maskAnimation, | ||
28156 | maskTransitionName: props.maskTransitionName | ||
28157 | }), | ||
28158 | typeof props.popup === 'function' ? props.popup() : props.popup | ||
28159 | ); | ||
28160 | }, | ||
28161 | setPopupVisible: function setPopupVisible(popupVisible) { | ||
28162 | this.clearDelayTimer(); | ||
28163 | if (this.state.popupVisible !== popupVisible) { | ||
28164 | if (!('popupVisible' in this.props)) { | ||
28165 | this.setState({ | ||
28166 | popupVisible: popupVisible | ||
28167 | }); | ||
28168 | } | ||
28169 | this.props.onPopupVisibleChange(popupVisible); | ||
28170 | } | ||
28171 | }, | ||
28172 | delaySetPopupVisible: function delaySetPopupVisible(visible, delayS) { | ||
28173 | var _this2 = this; | ||
28174 | |||
28175 | var delay = delayS * 1000; | ||
28176 | this.clearDelayTimer(); | ||
28177 | if (delay) { | ||
28178 | this.delayTimer = setTimeout(function () { | ||
28179 | _this2.setPopupVisible(visible); | ||
28180 | _this2.clearDelayTimer(); | ||
28181 | }, delay); | ||
28182 | } else { | ||
28183 | this.setPopupVisible(visible); | ||
28184 | } | ||
28185 | }, | ||
28186 | clearDelayTimer: function clearDelayTimer() { | ||
28187 | if (this.delayTimer) { | ||
28188 | clearTimeout(this.delayTimer); | ||
28189 | this.delayTimer = null; | ||
28190 | } | ||
28191 | }, | ||
28192 | clearOutsideHandler: function clearOutsideHandler() { | ||
28193 | if (this.clickOutsideHandler) { | ||
28194 | this.clickOutsideHandler.remove(); | ||
28195 | this.clickOutsideHandler = null; | ||
28196 | } | ||
28197 | }, | ||
28198 | createTwoChains: function createTwoChains(event) { | ||
28199 | var childPros = this.props.children.props; | ||
28200 | var props = this.props; | ||
28201 | if (childPros[event] && props[event]) { | ||
28202 | return this['fire' + event]; | ||
28203 | } | ||
28204 | return childPros[event] || props[event]; | ||
28205 | }, | ||
28206 | isClickToShow: function isClickToShow() { | ||
28207 | var _props = this.props, | ||
28208 | action = _props.action, | ||
28209 | showAction = _props.showAction; | ||
28210 | |||
28211 | return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1; | ||
28212 | }, | ||
28213 | isClickToHide: function isClickToHide() { | ||
28214 | var _props2 = this.props, | ||
28215 | action = _props2.action, | ||
28216 | hideAction = _props2.hideAction; | ||
28217 | |||
28218 | return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1; | ||
28219 | }, | ||
28220 | isMouseEnterToShow: function isMouseEnterToShow() { | ||
28221 | var _props3 = this.props, | ||
28222 | action = _props3.action, | ||
28223 | showAction = _props3.showAction; | ||
28224 | |||
28225 | return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1; | ||
28226 | }, | ||
28227 | isMouseLeaveToHide: function isMouseLeaveToHide() { | ||
28228 | var _props4 = this.props, | ||
28229 | action = _props4.action, | ||
28230 | hideAction = _props4.hideAction; | ||
28231 | |||
28232 | return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1; | ||
28233 | }, | ||
28234 | isFocusToShow: function isFocusToShow() { | ||
28235 | var _props5 = this.props, | ||
28236 | action = _props5.action, | ||
28237 | showAction = _props5.showAction; | ||
28238 | |||
28239 | return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1; | ||
28240 | }, | ||
28241 | isBlurToHide: function isBlurToHide() { | ||
28242 | var _props6 = this.props, | ||
28243 | action = _props6.action, | ||
28244 | hideAction = _props6.hideAction; | ||
28245 | |||
28246 | return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1; | ||
28247 | }, | ||
28248 | forcePopupAlign: function forcePopupAlign() { | ||
28249 | if (this.state.popupVisible && this.popupInstance && this.popupInstance.alignInstance) { | ||
28250 | this.popupInstance.alignInstance.forceAlign(); | ||
28251 | } | ||
28252 | }, | ||
28253 | fireEvents: function fireEvents(type, e) { | ||
28254 | var childCallback = this.props.children.props[type]; | ||
28255 | if (childCallback) { | ||
28256 | childCallback(e); | ||
28257 | } | ||
28258 | var callback = this.props[type]; | ||
28259 | if (callback) { | ||
28260 | callback(e); | ||
28261 | } | ||
28262 | }, | ||
28263 | close: function close() { | ||
28264 | this.setPopupVisible(false); | ||
28265 | }, | ||
28266 | render: function render() { | ||
28267 | var props = this.props; | ||
28268 | var children = props.children; | ||
28269 | var child = _react2["default"].Children.only(children); | ||
28270 | var newChildProps = {}; | ||
28271 | if (this.isClickToHide() || this.isClickToShow()) { | ||
28272 | newChildProps.onClick = this.onClick; | ||
28273 | newChildProps.onMouseDown = this.onMouseDown; | ||
28274 | } else { | ||
28275 | newChildProps.onClick = this.createTwoChains('onClick'); | ||
28276 | newChildProps.onMouseDown = this.createTwoChains('onMouseDown'); | ||
28277 | } | ||
28278 | if (this.isMouseEnterToShow()) { | ||
28279 | newChildProps.onMouseEnter = this.onMouseEnter; | ||
28280 | } else { | ||
28281 | newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter'); | ||
28282 | } | ||
28283 | if (this.isMouseLeaveToHide()) { | ||
28284 | newChildProps.onMouseLeave = this.onMouseLeave; | ||
28285 | } else { | ||
28286 | newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave'); | ||
28287 | } | ||
28288 | if (this.isFocusToShow() || this.isBlurToHide()) { | ||
28289 | newChildProps.onFocus = this.onFocus; | ||
28290 | newChildProps.onBlur = this.onBlur; | ||
28291 | } else { | ||
28292 | newChildProps.onFocus = this.createTwoChains('onFocus'); | ||
28293 | newChildProps.onBlur = this.createTwoChains('onBlur'); | ||
28294 | } | ||
28295 | |||
28296 | return _react2["default"].cloneElement(child, newChildProps); | ||
28297 | } | ||
28298 | }); | ||
28299 | |||
28300 | exports["default"] = Trigger; | ||
28301 | module.exports = exports['default']; | ||
28302 | |||
28303 | /***/ }), | ||
28304 | /* 270 */ | ||
28305 | /***/ (function(module, exports, __webpack_require__) { | ||
28306 | |||
28307 | "use strict"; | ||
28308 | |||
28309 | exports.__esModule = true; | ||
28310 | |||
28311 | var _assign = __webpack_require__(271); | ||
28312 | |||
28313 | var _assign2 = _interopRequireDefault(_assign); | ||
28314 | |||
28315 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
28316 | |||
28317 | exports.default = _assign2.default || function (target) { | ||
28318 | for (var i = 1; i < arguments.length; i++) { | ||
28319 | var source = arguments[i]; | ||
28320 | |||
28321 | for (var key in source) { | ||
28322 | if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
28323 | target[key] = source[key]; | ||
28324 | } | ||
28325 | } | ||
28326 | } | ||
28327 | |||
28328 | return target; | ||
28329 | }; | ||
28330 | |||
28331 | /***/ }), | ||
28332 | /* 271 */ | ||
28333 | /***/ (function(module, exports, __webpack_require__) { | ||
28334 | |||
28335 | module.exports = { "default": __webpack_require__(272), __esModule: true }; | ||
28336 | |||
28337 | /***/ }), | ||
28338 | /* 272 */ | ||
28339 | /***/ (function(module, exports, __webpack_require__) { | ||
28340 | |||
28341 | __webpack_require__(273); | ||
28342 | module.exports = __webpack_require__(201).Object.assign; | ||
28343 | |||
28344 | /***/ }), | ||
28345 | /* 273 */ | ||
28346 | /***/ (function(module, exports, __webpack_require__) { | ||
28347 | |||
28348 | // 19.1.3.1 Object.assign(target, source) | ||
28349 | var $export = __webpack_require__(199); | ||
28350 | |||
28351 | $export($export.S + $export.F, 'Object', {assign: __webpack_require__(274)}); | ||
28352 | |||
28353 | /***/ }), | ||
28354 | /* 274 */ | ||
28355 | /***/ (function(module, exports, __webpack_require__) { | ||
28356 | |||
28357 | 'use strict'; | ||
28358 | // 19.1.2.1 Object.assign(target, source, ...) | ||
28359 | var getKeys = __webpack_require__(220) | ||
28360 | , gOPS = __webpack_require__(249) | ||
28361 | , pIE = __webpack_require__(250) | ||
28362 | , toObject = __webpack_require__(236) | ||
28363 | , IObject = __webpack_require__(223) | ||
28364 | , $assign = Object.assign; | ||
28365 | |||
28366 | // should work with symbols and should have deterministic property order (V8 bug) | ||
28367 | module.exports = !$assign || __webpack_require__(210)(function(){ | ||
28368 | var A = {} | ||
28369 | , B = {} | ||
28370 | , S = Symbol() | ||
28371 | , K = 'abcdefghijklmnopqrst'; | ||
28372 | A[S] = 7; | ||
28373 | K.split('').forEach(function(k){ B[k] = k; }); | ||
28374 | return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; | ||
28375 | }) ? function assign(target, source){ // eslint-disable-line no-unused-vars | ||
28376 | var T = toObject(target) | ||
28377 | , aLen = arguments.length | ||
28378 | , index = 1 | ||
28379 | , getSymbols = gOPS.f | ||
28380 | , isEnum = pIE.f; | ||
28381 | while(aLen > index){ | ||
28382 | var S = IObject(arguments[index++]) | ||
28383 | , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) | ||
28384 | , length = keys.length | ||
28385 | , j = 0 | ||
28386 | , key; | ||
28387 | while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; | ||
28388 | } return T; | ||
28389 | } : $assign; | ||
28390 | |||
28391 | /***/ }), | ||
28392 | /* 275 */ | ||
28393 | /***/ (function(module, exports) { | ||
28394 | |||
28395 | "use strict"; | ||
28396 | |||
28397 | Object.defineProperty(exports, "__esModule", { | ||
28398 | value: true | ||
28399 | }); | ||
28400 | exports["default"] = contains; | ||
28401 | function contains(root, n) { | ||
28402 | var node = n; | ||
28403 | while (node) { | ||
28404 | if (node === root) { | ||
28405 | return true; | ||
28406 | } | ||
28407 | node = node.parentNode; | ||
28408 | } | ||
28409 | |||
28410 | return false; | ||
28411 | } | ||
28412 | module.exports = exports['default']; | ||
28413 | |||
28414 | /***/ }), | ||
28415 | /* 276 */ | ||
28416 | /***/ (function(module, exports, __webpack_require__) { | ||
28417 | |||
28418 | 'use strict'; | ||
28419 | |||
28420 | Object.defineProperty(exports, "__esModule", { | ||
28421 | value: true | ||
28422 | }); | ||
28423 | exports["default"] = addEventListenerWrap; | ||
28424 | |||
28425 | var _addDomEventListener = __webpack_require__(277); | ||
28426 | |||
28427 | var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener); | ||
28428 | |||
28429 | var _reactDom = __webpack_require__(38); | ||
28430 | |||
28431 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
28432 | |||
28433 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
28434 | |||
28435 | function addEventListenerWrap(target, eventType, cb) { | ||
28436 | /* eslint camelcase: 2 */ | ||
28437 | var callback = _reactDom2["default"].unstable_batchedUpdates ? function run(e) { | ||
28438 | _reactDom2["default"].unstable_batchedUpdates(cb, e); | ||
28439 | } : cb; | ||
28440 | return (0, _addDomEventListener2["default"])(target, eventType, callback); | ||
28441 | } | ||
28442 | module.exports = exports['default']; | ||
28443 | |||
28444 | /***/ }), | ||
28445 | /* 277 */ | ||
28446 | /***/ (function(module, exports, __webpack_require__) { | ||
28447 | |||
28448 | 'use strict'; | ||
28449 | |||
28450 | Object.defineProperty(exports, "__esModule", { | ||
28451 | value: true | ||
28452 | }); | ||
28453 | exports["default"] = addEventListener; | ||
28454 | |||
28455 | var _EventObject = __webpack_require__(278); | ||
28456 | |||
28457 | var _EventObject2 = _interopRequireDefault(_EventObject); | ||
28458 | |||
28459 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
28460 | |||
28461 | function addEventListener(target, eventType, callback) { | ||
28462 | function wrapCallback(e) { | ||
28463 | var ne = new _EventObject2["default"](e); | ||
28464 | callback.call(target, ne); | ||
28465 | } | ||
28466 | |||
28467 | if (target.addEventListener) { | ||
28468 | target.addEventListener(eventType, wrapCallback, false); | ||
28469 | return { | ||
28470 | remove: function remove() { | ||
28471 | target.removeEventListener(eventType, wrapCallback, false); | ||
28472 | } | ||
28473 | }; | ||
28474 | } else if (target.attachEvent) { | ||
28475 | target.attachEvent('on' + eventType, wrapCallback); | ||
28476 | return { | ||
28477 | remove: function remove() { | ||
28478 | target.detachEvent('on' + eventType, wrapCallback); | ||
28479 | } | ||
28480 | }; | ||
28481 | } | ||
28482 | } | ||
28483 | module.exports = exports['default']; | ||
28484 | |||
28485 | /***/ }), | ||
28486 | /* 278 */ | ||
28487 | /***/ (function(module, exports, __webpack_require__) { | ||
28488 | |||
28489 | 'use strict'; | ||
28490 | |||
28491 | Object.defineProperty(exports, "__esModule", { | ||
28492 | value: true | ||
28493 | }); | ||
28494 | |||
28495 | var _EventBaseObject = __webpack_require__(279); | ||
28496 | |||
28497 | var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject); | ||
28498 | |||
28499 | var _objectAssign = __webpack_require__(6); | ||
28500 | |||
28501 | var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
28502 | |||
28503 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
28504 | |||
28505 | /** | ||
28506 | * @ignore | ||
28507 | * event object for dom | ||
28508 | * @author yiminghe@gmail.com | ||
28509 | */ | ||
28510 | |||
28511 | var TRUE = true; | ||
28512 | var FALSE = false; | ||
28513 | var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type']; | ||
28514 | |||
28515 | function isNullOrUndefined(w) { | ||
28516 | return w === null || w === undefined; | ||
28517 | } | ||
28518 | |||
28519 | var eventNormalizers = [{ | ||
28520 | reg: /^key/, | ||
28521 | props: ['char', 'charCode', 'key', 'keyCode', 'which'], | ||
28522 | fix: function fix(event, nativeEvent) { | ||
28523 | if (isNullOrUndefined(event.which)) { | ||
28524 | event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode; | ||
28525 | } | ||
28526 | |||
28527 | // add metaKey to non-Mac browsers (use ctrl for PC 's and Meta for Macs) | ||
28528 | if (event.metaKey === undefined) { | ||
28529 | event.metaKey = event.ctrlKey; | ||
28530 | } | ||
28531 | } | ||
28532 | }, { | ||
28533 | reg: /^touch/, | ||
28534 | props: ['touches', 'changedTouches', 'targetTouches'] | ||
28535 | }, { | ||
28536 | reg: /^hashchange$/, | ||
28537 | props: ['newURL', 'oldURL'] | ||
28538 | }, { | ||
28539 | reg: /^gesturechange$/i, | ||
28540 | props: ['rotation', 'scale'] | ||
28541 | }, { | ||
28542 | reg: /^(mousewheel|DOMMouseScroll)$/, | ||
28543 | props: [], | ||
28544 | fix: function fix(event, nativeEvent) { | ||
28545 | var deltaX = void 0; | ||
28546 | var deltaY = void 0; | ||
28547 | var delta = void 0; | ||
28548 | var wheelDelta = nativeEvent.wheelDelta; | ||
28549 | var axis = nativeEvent.axis; | ||
28550 | var wheelDeltaY = nativeEvent.wheelDeltaY; | ||
28551 | var wheelDeltaX = nativeEvent.wheelDeltaX; | ||
28552 | var detail = nativeEvent.detail; | ||
28553 | |||
28554 | // ie/webkit | ||
28555 | if (wheelDelta) { | ||
28556 | delta = wheelDelta / 120; | ||
28557 | } | ||
28558 | |||
28559 | // gecko | ||
28560 | if (detail) { | ||
28561 | // press control e.detail == 1 else e.detail == 3 | ||
28562 | delta = 0 - (detail % 3 === 0 ? detail / 3 : detail); | ||
28563 | } | ||
28564 | |||
28565 | // Gecko | ||
28566 | if (axis !== undefined) { | ||
28567 | if (axis === event.HORIZONTAL_AXIS) { | ||
28568 | deltaY = 0; | ||
28569 | deltaX = 0 - delta; | ||
28570 | } else if (axis === event.VERTICAL_AXIS) { | ||
28571 | deltaX = 0; | ||
28572 | deltaY = delta; | ||
28573 | } | ||
28574 | } | ||
28575 | |||
28576 | // Webkit | ||
28577 | if (wheelDeltaY !== undefined) { | ||
28578 | deltaY = wheelDeltaY / 120; | ||
28579 | } | ||
28580 | if (wheelDeltaX !== undefined) { | ||
28581 | deltaX = -1 * wheelDeltaX / 120; | ||
28582 | } | ||
28583 | |||
28584 | // 默认 deltaY (ie) | ||
28585 | if (!deltaX && !deltaY) { | ||
28586 | deltaY = delta; | ||
28587 | } | ||
28588 | |||
28589 | if (deltaX !== undefined) { | ||
28590 | /** | ||
28591 | * deltaX of mousewheel event | ||
28592 | * @property deltaX | ||
28593 | * @member Event.DomEvent.Object | ||
28594 | */ | ||
28595 | event.deltaX = deltaX; | ||
28596 | } | ||
28597 | |||
28598 | if (deltaY !== undefined) { | ||
28599 | /** | ||
28600 | * deltaY of mousewheel event | ||
28601 | * @property deltaY | ||
28602 | * @member Event.DomEvent.Object | ||
28603 | */ | ||
28604 | event.deltaY = deltaY; | ||
28605 | } | ||
28606 | |||
28607 | if (delta !== undefined) { | ||
28608 | /** | ||
28609 | * delta of mousewheel event | ||
28610 | * @property delta | ||
28611 | * @member Event.DomEvent.Object | ||
28612 | */ | ||
28613 | event.delta = delta; | ||
28614 | } | ||
28615 | } | ||
28616 | }, { | ||
28617 | reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i, | ||
28618 | props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'], | ||
28619 | fix: function fix(event, nativeEvent) { | ||
28620 | var eventDoc = void 0; | ||
28621 | var doc = void 0; | ||
28622 | var body = void 0; | ||
28623 | var target = event.target; | ||
28624 | var button = nativeEvent.button; | ||
28625 | |||
28626 | // Calculate pageX/Y if missing and clientX/Y available | ||
28627 | if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) { | ||
28628 | eventDoc = target.ownerDocument || document; | ||
28629 | doc = eventDoc.documentElement; | ||
28630 | body = eventDoc.body; | ||
28631 | event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); | ||
28632 | event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); | ||
28633 | } | ||
28634 | |||
28635 | // which for click: 1 === left; 2 === middle; 3 === right | ||
28636 | // do not use button | ||
28637 | if (!event.which && button !== undefined) { | ||
28638 | if (button & 1) { | ||
28639 | event.which = 1; | ||
28640 | } else if (button & 2) { | ||
28641 | event.which = 3; | ||
28642 | } else if (button & 4) { | ||
28643 | event.which = 2; | ||
28644 | } else { | ||
28645 | event.which = 0; | ||
28646 | } | ||
28647 | } | ||
28648 | |||
28649 | // add relatedTarget, if necessary | ||
28650 | if (!event.relatedTarget && event.fromElement) { | ||
28651 | event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement; | ||
28652 | } | ||
28653 | |||
28654 | return event; | ||
28655 | } | ||
28656 | }]; | ||
28657 | |||
28658 | function retTrue() { | ||
28659 | return TRUE; | ||
28660 | } | ||
28661 | |||
28662 | function retFalse() { | ||
28663 | return FALSE; | ||
28664 | } | ||
28665 | |||
28666 | function DomEventObject(nativeEvent) { | ||
28667 | var type = nativeEvent.type; | ||
28668 | |||
28669 | var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean'; | ||
28670 | |||
28671 | _EventBaseObject2["default"].call(this); | ||
28672 | |||
28673 | this.nativeEvent = nativeEvent; | ||
28674 | |||
28675 | // in case dom event has been mark as default prevented by lower dom node | ||
28676 | var isDefaultPrevented = retFalse; | ||
28677 | if ('defaultPrevented' in nativeEvent) { | ||
28678 | isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse; | ||
28679 | } else if ('getPreventDefault' in nativeEvent) { | ||
28680 | // https://bugzilla.mozilla.org/show_bug.cgi?id=691151 | ||
28681 | isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse; | ||
28682 | } else if ('returnValue' in nativeEvent) { | ||
28683 | isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse; | ||
28684 | } | ||
28685 | |||
28686 | this.isDefaultPrevented = isDefaultPrevented; | ||
28687 | |||
28688 | var fixFns = []; | ||
28689 | var fixFn = void 0; | ||
28690 | var l = void 0; | ||
28691 | var prop = void 0; | ||
28692 | var props = commonProps.concat(); | ||
28693 | |||
28694 | eventNormalizers.forEach(function (normalizer) { | ||
28695 | if (type.match(normalizer.reg)) { | ||
28696 | props = props.concat(normalizer.props); | ||
28697 | if (normalizer.fix) { | ||
28698 | fixFns.push(normalizer.fix); | ||
28699 | } | ||
28700 | } | ||
28701 | }); | ||
28702 | |||
28703 | l = props.length; | ||
28704 | |||
28705 | // clone properties of the original event object | ||
28706 | while (l) { | ||
28707 | prop = props[--l]; | ||
28708 | this[prop] = nativeEvent[prop]; | ||
28709 | } | ||
28710 | |||
28711 | // fix target property, if necessary | ||
28712 | if (!this.target && isNative) { | ||
28713 | this.target = nativeEvent.srcElement || document; // srcElement might not be defined either | ||
28714 | } | ||
28715 | |||
28716 | // check if target is a text node (safari) | ||
28717 | if (this.target && this.target.nodeType === 3) { | ||
28718 | this.target = this.target.parentNode; | ||
28719 | } | ||
28720 | |||
28721 | l = fixFns.length; | ||
28722 | |||
28723 | while (l) { | ||
28724 | fixFn = fixFns[--l]; | ||
28725 | fixFn(this, nativeEvent); | ||
28726 | } | ||
28727 | |||
28728 | this.timeStamp = nativeEvent.timeStamp || Date.now(); | ||
28729 | } | ||
28730 | |||
28731 | var EventBaseObjectProto = _EventBaseObject2["default"].prototype; | ||
28732 | |||
28733 | (0, _objectAssign2["default"])(DomEventObject.prototype, EventBaseObjectProto, { | ||
28734 | constructor: DomEventObject, | ||
28735 | |||
28736 | preventDefault: function preventDefault() { | ||
28737 | var e = this.nativeEvent; | ||
28738 | |||
28739 | // if preventDefault exists run it on the original event | ||
28740 | if (e.preventDefault) { | ||
28741 | e.preventDefault(); | ||
28742 | } else { | ||
28743 | // otherwise set the returnValue property of the original event to FALSE (IE) | ||
28744 | e.returnValue = FALSE; | ||
28745 | } | ||
28746 | |||
28747 | EventBaseObjectProto.preventDefault.call(this); | ||
28748 | }, | ||
28749 | stopPropagation: function stopPropagation() { | ||
28750 | var e = this.nativeEvent; | ||
28751 | |||
28752 | // if stopPropagation exists run it on the original event | ||
28753 | if (e.stopPropagation) { | ||
28754 | e.stopPropagation(); | ||
28755 | } else { | ||
28756 | // otherwise set the cancelBubble property of the original event to TRUE (IE) | ||
28757 | e.cancelBubble = TRUE; | ||
28758 | } | ||
28759 | |||
28760 | EventBaseObjectProto.stopPropagation.call(this); | ||
28761 | } | ||
28762 | }); | ||
28763 | |||
28764 | exports["default"] = DomEventObject; | ||
28765 | module.exports = exports['default']; | ||
28766 | |||
28767 | /***/ }), | ||
28768 | /* 279 */ | ||
28769 | /***/ (function(module, exports) { | ||
28770 | |||
28771 | "use strict"; | ||
28772 | |||
28773 | Object.defineProperty(exports, "__esModule", { | ||
28774 | value: true | ||
28775 | }); | ||
28776 | /** | ||
28777 | * @ignore | ||
28778 | * base event object for custom and dom event. | ||
28779 | * @author yiminghe@gmail.com | ||
28780 | */ | ||
28781 | |||
28782 | function returnFalse() { | ||
28783 | return false; | ||
28784 | } | ||
28785 | |||
28786 | function returnTrue() { | ||
28787 | return true; | ||
28788 | } | ||
28789 | |||
28790 | function EventBaseObject() { | ||
28791 | this.timeStamp = Date.now(); | ||
28792 | this.target = undefined; | ||
28793 | this.currentTarget = undefined; | ||
28794 | } | ||
28795 | |||
28796 | EventBaseObject.prototype = { | ||
28797 | isEventObject: 1, | ||
28798 | |||
28799 | constructor: EventBaseObject, | ||
28800 | |||
28801 | isDefaultPrevented: returnFalse, | ||
28802 | |||
28803 | isPropagationStopped: returnFalse, | ||
28804 | |||
28805 | isImmediatePropagationStopped: returnFalse, | ||
28806 | |||
28807 | preventDefault: function preventDefault() { | ||
28808 | this.isDefaultPrevented = returnTrue; | ||
28809 | }, | ||
28810 | stopPropagation: function stopPropagation() { | ||
28811 | this.isPropagationStopped = returnTrue; | ||
28812 | }, | ||
28813 | stopImmediatePropagation: function stopImmediatePropagation() { | ||
28814 | this.isImmediatePropagationStopped = returnTrue; | ||
28815 | // fixed 1.2 | ||
28816 | // call stopPropagation implicitly | ||
28817 | this.stopPropagation(); | ||
28818 | }, | ||
28819 | halt: function halt(immediate) { | ||
28820 | if (immediate) { | ||
28821 | this.stopImmediatePropagation(); | ||
28822 | } else { | ||
28823 | this.stopPropagation(); | ||
28824 | } | ||
28825 | this.preventDefault(); | ||
28826 | } | ||
28827 | }; | ||
28828 | |||
28829 | exports["default"] = EventBaseObject; | ||
28830 | module.exports = exports['default']; | ||
28831 | |||
28832 | /***/ }), | ||
28833 | /* 280 */ | ||
28834 | /***/ (function(module, exports, __webpack_require__) { | ||
28835 | |||
28836 | 'use strict'; | ||
28837 | |||
28838 | Object.defineProperty(exports, "__esModule", { | ||
28839 | value: true | ||
28840 | }); | ||
28841 | |||
28842 | var _extends2 = __webpack_require__(270); | ||
28843 | |||
28844 | var _extends3 = _interopRequireDefault(_extends2); | ||
28845 | |||
28846 | var _react = __webpack_require__(3); | ||
28847 | |||
28848 | var _react2 = _interopRequireDefault(_react); | ||
28849 | |||
28850 | var _reactDom = __webpack_require__(38); | ||
28851 | |||
28852 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
28853 | |||
28854 | var _rcAlign = __webpack_require__(281); | ||
28855 | |||
28856 | var _rcAlign2 = _interopRequireDefault(_rcAlign); | ||
28857 | |||
28858 | var _rcAnimate = __webpack_require__(293); | ||
28859 | |||
28860 | var _rcAnimate2 = _interopRequireDefault(_rcAnimate); | ||
28861 | |||
28862 | var _PopupInner = __webpack_require__(302); | ||
28863 | |||
28864 | var _PopupInner2 = _interopRequireDefault(_PopupInner); | ||
28865 | |||
28866 | var _LazyRenderBox = __webpack_require__(303); | ||
28867 | |||
28868 | var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox); | ||
28869 | |||
28870 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
28871 | |||
28872 | var Popup = _react2["default"].createClass({ | ||
28873 | displayName: 'Popup', | ||
28874 | |||
28875 | propTypes: { | ||
28876 | visible: _react.PropTypes.bool, | ||
28877 | style: _react.PropTypes.object, | ||
28878 | getClassNameFromAlign: _react.PropTypes.func, | ||
28879 | onAlign: _react.PropTypes.func, | ||
28880 | getRootDomNode: _react.PropTypes.func, | ||
28881 | onMouseEnter: _react.PropTypes.func, | ||
28882 | align: _react.PropTypes.any, | ||
28883 | destroyPopupOnHide: _react.PropTypes.bool, | ||
28884 | className: _react.PropTypes.string, | ||
28885 | prefixCls: _react.PropTypes.string, | ||
28886 | onMouseLeave: _react.PropTypes.func | ||
28887 | }, | ||
28888 | |||
28889 | componentDidMount: function componentDidMount() { | ||
28890 | this.rootNode = this.getPopupDomNode(); | ||
28891 | }, | ||
28892 | onAlign: function onAlign(popupDomNode, align) { | ||
28893 | var props = this.props; | ||
28894 | var alignClassName = props.getClassNameFromAlign(props.align); | ||
28895 | var currentAlignClassName = props.getClassNameFromAlign(align); | ||
28896 | if (alignClassName !== currentAlignClassName) { | ||
28897 | this.currentAlignClassName = currentAlignClassName; | ||
28898 | popupDomNode.className = this.getClassName(currentAlignClassName); | ||
28899 | } | ||
28900 | props.onAlign(popupDomNode, align); | ||
28901 | }, | ||
28902 | getPopupDomNode: function getPopupDomNode() { | ||
28903 | return _reactDom2["default"].findDOMNode(this.refs.popup); | ||
28904 | }, | ||
28905 | getTarget: function getTarget() { | ||
28906 | return this.props.getRootDomNode(); | ||
28907 | }, | ||
28908 | getMaskTransitionName: function getMaskTransitionName() { | ||
28909 | var props = this.props; | ||
28910 | var transitionName = props.maskTransitionName; | ||
28911 | var animation = props.maskAnimation; | ||
28912 | if (!transitionName && animation) { | ||
28913 | transitionName = props.prefixCls + '-' + animation; | ||
28914 | } | ||
28915 | return transitionName; | ||
28916 | }, | ||
28917 | getTransitionName: function getTransitionName() { | ||
28918 | var props = this.props; | ||
28919 | var transitionName = props.transitionName; | ||
28920 | if (!transitionName && props.animation) { | ||
28921 | transitionName = props.prefixCls + '-' + props.animation; | ||
28922 | } | ||
28923 | return transitionName; | ||
28924 | }, | ||
28925 | getClassName: function getClassName(currentAlignClassName) { | ||
28926 | return this.props.prefixCls + ' ' + this.props.className + ' ' + currentAlignClassName; | ||
28927 | }, | ||
28928 | getPopupElement: function getPopupElement() { | ||
28929 | var props = this.props; | ||
28930 | var align = props.align, | ||
28931 | style = props.style, | ||
28932 | visible = props.visible, | ||
28933 | prefixCls = props.prefixCls, | ||
28934 | destroyPopupOnHide = props.destroyPopupOnHide; | ||
28935 | |||
28936 | var className = this.getClassName(this.currentAlignClassName || props.getClassNameFromAlign(align)); | ||
28937 | var hiddenClassName = prefixCls + '-hidden'; | ||
28938 | if (!visible) { | ||
28939 | this.currentAlignClassName = null; | ||
28940 | } | ||
28941 | var newStyle = (0, _extends3["default"])({}, style, this.getZIndexStyle()); | ||
28942 | var popupInnerProps = { | ||
28943 | className: className, | ||
28944 | prefixCls: prefixCls, | ||
28945 | ref: 'popup', | ||
28946 | onMouseEnter: props.onMouseEnter, | ||
28947 | onMouseLeave: props.onMouseLeave, | ||
28948 | style: newStyle | ||
28949 | }; | ||
28950 | if (destroyPopupOnHide) { | ||
28951 | return _react2["default"].createElement( | ||
28952 | _rcAnimate2["default"], | ||
28953 | { | ||
28954 | component: '', | ||
28955 | exclusive: true, | ||
28956 | transitionAppear: true, | ||
28957 | transitionName: this.getTransitionName() | ||
28958 | }, | ||
28959 | visible ? _react2["default"].createElement( | ||
28960 | _rcAlign2["default"], | ||
28961 | { | ||
28962 | target: this.getTarget, | ||
28963 | key: 'popup', | ||
28964 | ref: this.saveAlign, | ||
28965 | monitorWindowResize: true, | ||
28966 | align: align, | ||
28967 | onAlign: this.onAlign | ||
28968 | }, | ||
28969 | _react2["default"].createElement( | ||
28970 | _PopupInner2["default"], | ||
28971 | (0, _extends3["default"])({ | ||
28972 | visible: true | ||
28973 | }, popupInnerProps), | ||
28974 | props.children | ||
28975 | ) | ||
28976 | ) : null | ||
28977 | ); | ||
28978 | } | ||
28979 | return _react2["default"].createElement( | ||
28980 | _rcAnimate2["default"], | ||
28981 | { | ||
28982 | component: '', | ||
28983 | exclusive: true, | ||
28984 | transitionAppear: true, | ||
28985 | transitionName: this.getTransitionName(), | ||
28986 | showProp: 'xVisible' | ||
28987 | }, | ||
28988 | _react2["default"].createElement( | ||
28989 | _rcAlign2["default"], | ||
28990 | { | ||
28991 | target: this.getTarget, | ||
28992 | key: 'popup', | ||
28993 | ref: this.saveAlign, | ||
28994 | monitorWindowResize: true, | ||
28995 | xVisible: visible, | ||
28996 | childrenProps: { visible: 'xVisible' }, | ||
28997 | disabled: !visible, | ||
28998 | align: align, | ||
28999 | onAlign: this.onAlign | ||
29000 | }, | ||
29001 | _react2["default"].createElement( | ||
29002 | _PopupInner2["default"], | ||
29003 | (0, _extends3["default"])({ | ||
29004 | hiddenClassName: hiddenClassName | ||
29005 | }, popupInnerProps), | ||
29006 | props.children | ||
29007 | ) | ||
29008 | ) | ||
29009 | ); | ||
29010 | }, | ||
29011 | getZIndexStyle: function getZIndexStyle() { | ||
29012 | var style = {}; | ||
29013 | var props = this.props; | ||
29014 | if (props.zIndex !== undefined) { | ||
29015 | style.zIndex = props.zIndex; | ||
29016 | } | ||
29017 | return style; | ||
29018 | }, | ||
29019 | getMaskElement: function getMaskElement() { | ||
29020 | var props = this.props; | ||
29021 | var maskElement = void 0; | ||
29022 | if (props.mask) { | ||
29023 | var maskTransition = this.getMaskTransitionName(); | ||
29024 | maskElement = _react2["default"].createElement(_LazyRenderBox2["default"], { | ||
29025 | style: this.getZIndexStyle(), | ||
29026 | key: 'mask', | ||
29027 | className: props.prefixCls + '-mask', | ||
29028 | hiddenClassName: props.prefixCls + '-mask-hidden', | ||
29029 | visible: props.visible | ||
29030 | }); | ||
29031 | if (maskTransition) { | ||
29032 | maskElement = _react2["default"].createElement( | ||
29033 | _rcAnimate2["default"], | ||
29034 | { | ||
29035 | key: 'mask', | ||
29036 | showProp: 'visible', | ||
29037 | transitionAppear: true, | ||
29038 | component: '', | ||
29039 | transitionName: maskTransition | ||
29040 | }, | ||
29041 | maskElement | ||
29042 | ); | ||
29043 | } | ||
29044 | } | ||
29045 | return maskElement; | ||
29046 | }, | ||
29047 | saveAlign: function saveAlign(align) { | ||
29048 | this.alignInstance = align; | ||
29049 | }, | ||
29050 | render: function render() { | ||
29051 | return _react2["default"].createElement( | ||
29052 | 'div', | ||
29053 | null, | ||
29054 | this.getMaskElement(), | ||
29055 | this.getPopupElement() | ||
29056 | ); | ||
29057 | } | ||
29058 | }); | ||
29059 | |||
29060 | exports["default"] = Popup; | ||
29061 | module.exports = exports['default']; | ||
29062 | |||
29063 | /***/ }), | ||
29064 | /* 281 */ | ||
29065 | /***/ (function(module, exports, __webpack_require__) { | ||
29066 | |||
29067 | 'use strict'; | ||
29068 | |||
29069 | Object.defineProperty(exports, "__esModule", { | ||
29070 | value: true | ||
29071 | }); | ||
29072 | |||
29073 | var _Align = __webpack_require__(282); | ||
29074 | |||
29075 | var _Align2 = _interopRequireDefault(_Align); | ||
29076 | |||
29077 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
29078 | |||
29079 | exports["default"] = _Align2["default"]; // export this package's api | ||
29080 | |||
29081 | module.exports = exports['default']; | ||
29082 | |||
29083 | /***/ }), | ||
29084 | /* 282 */ | ||
29085 | /***/ (function(module, exports, __webpack_require__) { | ||
29086 | |||
29087 | 'use strict'; | ||
29088 | |||
29089 | Object.defineProperty(exports, "__esModule", { | ||
29090 | value: true | ||
29091 | }); | ||
29092 | |||
29093 | var _react = __webpack_require__(3); | ||
29094 | |||
29095 | var _react2 = _interopRequireDefault(_react); | ||
29096 | |||
29097 | var _reactDom = __webpack_require__(38); | ||
29098 | |||
29099 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
29100 | |||
29101 | var _domAlign = __webpack_require__(283); | ||
29102 | |||
29103 | var _domAlign2 = _interopRequireDefault(_domAlign); | ||
29104 | |||
29105 | var _addEventListener = __webpack_require__(276); | ||
29106 | |||
29107 | var _addEventListener2 = _interopRequireDefault(_addEventListener); | ||
29108 | |||
29109 | var _isWindow = __webpack_require__(292); | ||
29110 | |||
29111 | var _isWindow2 = _interopRequireDefault(_isWindow); | ||
29112 | |||
29113 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
29114 | |||
29115 | function buffer(fn, ms) { | ||
29116 | var timer = void 0; | ||
29117 | |||
29118 | function clear() { | ||
29119 | if (timer) { | ||
29120 | clearTimeout(timer); | ||
29121 | timer = null; | ||
29122 | } | ||
29123 | } | ||
29124 | |||
29125 | function bufferFn() { | ||
29126 | clear(); | ||
29127 | timer = setTimeout(fn, ms); | ||
29128 | } | ||
29129 | |||
29130 | bufferFn.clear = clear; | ||
29131 | |||
29132 | return bufferFn; | ||
29133 | } | ||
29134 | |||
29135 | var Align = _react2["default"].createClass({ | ||
29136 | displayName: 'Align', | ||
29137 | |||
29138 | propTypes: { | ||
29139 | childrenProps: _react.PropTypes.object, | ||
29140 | align: _react.PropTypes.object.isRequired, | ||
29141 | target: _react.PropTypes.func, | ||
29142 | onAlign: _react.PropTypes.func, | ||
29143 | monitorBufferTime: _react.PropTypes.number, | ||
29144 | monitorWindowResize: _react.PropTypes.bool, | ||
29145 | disabled: _react.PropTypes.bool, | ||
29146 | children: _react.PropTypes.any | ||
29147 | }, | ||
29148 | |||
29149 | getDefaultProps: function getDefaultProps() { | ||
29150 | return { | ||
29151 | target: function target() { | ||
29152 | return window; | ||
29153 | }, | ||
29154 | onAlign: function onAlign() {}, | ||
29155 | |||
29156 | monitorBufferTime: 50, | ||
29157 | monitorWindowResize: false, | ||
29158 | disabled: false | ||
29159 | }; | ||
29160 | }, | ||
29161 | componentDidMount: function componentDidMount() { | ||
29162 | var props = this.props; | ||
29163 | // if parent ref not attached .... use document.getElementById | ||
29164 | this.forceAlign(); | ||
29165 | if (!props.disabled && props.monitorWindowResize) { | ||
29166 | this.startMonitorWindowResize(); | ||
29167 | } | ||
29168 | }, | ||
29169 | componentDidUpdate: function componentDidUpdate(prevProps) { | ||
29170 | var reAlign = false; | ||
29171 | var props = this.props; | ||
29172 | |||
29173 | if (!props.disabled) { | ||
29174 | if (prevProps.disabled || prevProps.align !== props.align) { | ||
29175 | reAlign = true; | ||
29176 | } else { | ||
29177 | var lastTarget = prevProps.target(); | ||
29178 | var currentTarget = props.target(); | ||
29179 | if ((0, _isWindow2["default"])(lastTarget) && (0, _isWindow2["default"])(currentTarget)) { | ||
29180 | reAlign = false; | ||
29181 | } else if (lastTarget !== currentTarget) { | ||
29182 | reAlign = true; | ||
29183 | } | ||
29184 | } | ||
29185 | } | ||
29186 | |||
29187 | if (reAlign) { | ||
29188 | this.forceAlign(); | ||
29189 | } | ||
29190 | |||
29191 | if (props.monitorWindowResize && !props.disabled) { | ||
29192 | this.startMonitorWindowResize(); | ||
29193 | } else { | ||
29194 | this.stopMonitorWindowResize(); | ||
29195 | } | ||
29196 | }, | ||
29197 | componentWillUnmount: function componentWillUnmount() { | ||
29198 | this.stopMonitorWindowResize(); | ||
29199 | }, | ||
29200 | startMonitorWindowResize: function startMonitorWindowResize() { | ||
29201 | if (!this.resizeHandler) { | ||
29202 | this.bufferMonitor = buffer(this.forceAlign, this.props.monitorBufferTime); | ||
29203 | this.resizeHandler = (0, _addEventListener2["default"])(window, 'resize', this.bufferMonitor); | ||
29204 | } | ||
29205 | }, | ||
29206 | stopMonitorWindowResize: function stopMonitorWindowResize() { | ||
29207 | if (this.resizeHandler) { | ||
29208 | this.bufferMonitor.clear(); | ||
29209 | this.resizeHandler.remove(); | ||
29210 | this.resizeHandler = null; | ||
29211 | } | ||
29212 | }, | ||
29213 | forceAlign: function forceAlign() { | ||
29214 | var props = this.props; | ||
29215 | if (!props.disabled) { | ||
29216 | var source = _reactDom2["default"].findDOMNode(this); | ||
29217 | props.onAlign(source, (0, _domAlign2["default"])(source, props.target(), props.align)); | ||
29218 | } | ||
29219 | }, | ||
29220 | render: function render() { | ||
29221 | var _props = this.props, | ||
29222 | childrenProps = _props.childrenProps, | ||
29223 | children = _props.children; | ||
29224 | |||
29225 | var child = _react2["default"].Children.only(children); | ||
29226 | if (childrenProps) { | ||
29227 | var newProps = {}; | ||
29228 | for (var prop in childrenProps) { | ||
29229 | if (childrenProps.hasOwnProperty(prop)) { | ||
29230 | newProps[prop] = this.props[childrenProps[prop]]; | ||
29231 | } | ||
29232 | } | ||
29233 | return _react2["default"].cloneElement(child, newProps); | ||
29234 | } | ||
29235 | return child; | ||
29236 | } | ||
29237 | }); | ||
29238 | |||
29239 | exports["default"] = Align; | ||
29240 | module.exports = exports['default']; | ||
29241 | |||
29242 | /***/ }), | ||
29243 | /* 283 */ | ||
29244 | /***/ (function(module, exports, __webpack_require__) { | ||
29245 | |||
29246 | 'use strict'; | ||
29247 | |||
29248 | Object.defineProperty(exports, "__esModule", { | ||
29249 | value: true | ||
29250 | }); | ||
29251 | |||
29252 | var _utils = __webpack_require__(284); | ||
29253 | |||
29254 | var _utils2 = _interopRequireDefault(_utils); | ||
29255 | |||
29256 | var _getOffsetParent = __webpack_require__(286); | ||
29257 | |||
29258 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); | ||
29259 | |||
29260 | var _getVisibleRectForElement = __webpack_require__(287); | ||
29261 | |||
29262 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement); | ||
29263 | |||
29264 | var _adjustForViewport = __webpack_require__(288); | ||
29265 | |||
29266 | var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport); | ||
29267 | |||
29268 | var _getRegion = __webpack_require__(289); | ||
29269 | |||
29270 | var _getRegion2 = _interopRequireDefault(_getRegion); | ||
29271 | |||
29272 | var _getElFuturePos = __webpack_require__(290); | ||
29273 | |||
29274 | var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos); | ||
29275 | |||
29276 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
29277 | |||
29278 | // http://yiminghe.iteye.com/blog/1124720 | ||
29279 | |||
29280 | /** | ||
29281 | * align dom node flexibly | ||
29282 | * @author yiminghe@gmail.com | ||
29283 | */ | ||
29284 | |||
29285 | function isFailX(elFuturePos, elRegion, visibleRect) { | ||
29286 | return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right; | ||
29287 | } | ||
29288 | |||
29289 | function isFailY(elFuturePos, elRegion, visibleRect) { | ||
29290 | return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom; | ||
29291 | } | ||
29292 | |||
29293 | function isCompleteFailX(elFuturePos, elRegion, visibleRect) { | ||
29294 | return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left; | ||
29295 | } | ||
29296 | |||
29297 | function isCompleteFailY(elFuturePos, elRegion, visibleRect) { | ||
29298 | return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top; | ||
29299 | } | ||
29300 | |||
29301 | function flip(points, reg, map) { | ||
29302 | var ret = []; | ||
29303 | _utils2["default"].each(points, function (p) { | ||
29304 | ret.push(p.replace(reg, function (m) { | ||
29305 | return map[m]; | ||
29306 | })); | ||
29307 | }); | ||
29308 | return ret; | ||
29309 | } | ||
29310 | |||
29311 | function flipOffset(offset, index) { | ||
29312 | offset[index] = -offset[index]; | ||
29313 | return offset; | ||
29314 | } | ||
29315 | |||
29316 | function convertOffset(str, offsetLen) { | ||
29317 | var n = void 0; | ||
29318 | if (/%$/.test(str)) { | ||
29319 | n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen; | ||
29320 | } else { | ||
29321 | n = parseInt(str, 10); | ||
29322 | } | ||
29323 | return n || 0; | ||
29324 | } | ||
29325 | |||
29326 | function normalizeOffset(offset, el) { | ||
29327 | offset[0] = convertOffset(offset[0], el.width); | ||
29328 | offset[1] = convertOffset(offset[1], el.height); | ||
29329 | } | ||
29330 | |||
29331 | function domAlign(el, refNode, align) { | ||
29332 | var points = align.points; | ||
29333 | var offset = align.offset || [0, 0]; | ||
29334 | var targetOffset = align.targetOffset || [0, 0]; | ||
29335 | var overflow = align.overflow; | ||
29336 | var target = align.target || refNode; | ||
29337 | var source = align.source || el; | ||
29338 | offset = [].concat(offset); | ||
29339 | targetOffset = [].concat(targetOffset); | ||
29340 | overflow = overflow || {}; | ||
29341 | var newOverflowCfg = {}; | ||
29342 | |||
29343 | var fail = 0; | ||
29344 | // 当前节点可以被放置的显示区域 | ||
29345 | var visibleRect = (0, _getVisibleRectForElement2["default"])(source); | ||
29346 | // 当前节点所占的区域, left/top/width/height | ||
29347 | var elRegion = (0, _getRegion2["default"])(source); | ||
29348 | // 参照节点所占的区域, left/top/width/height | ||
29349 | var refNodeRegion = (0, _getRegion2["default"])(target); | ||
29350 | // 将 offset 转换成数值,支持百分比 | ||
29351 | normalizeOffset(offset, elRegion); | ||
29352 | normalizeOffset(targetOffset, refNodeRegion); | ||
29353 | // 当前节点将要被放置的位置 | ||
29354 | var elFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, points, offset, targetOffset); | ||
29355 | // 当前节点将要所处的区域 | ||
29356 | var newElRegion = _utils2["default"].merge(elRegion, elFuturePos); | ||
29357 | |||
29358 | // 如果可视区域不能完全放置当前节点时允许调整 | ||
29359 | if (visibleRect && (overflow.adjustX || overflow.adjustY)) { | ||
29360 | if (overflow.adjustX) { | ||
29361 | // 如果横向不能放下 | ||
29362 | if (isFailX(elFuturePos, elRegion, visibleRect)) { | ||
29363 | // 对齐位置反下 | ||
29364 | var newPoints = flip(points, /[lr]/ig, { | ||
29365 | l: 'r', | ||
29366 | r: 'l' | ||
29367 | }); | ||
29368 | // 偏移量也反下 | ||
29369 | var newOffset = flipOffset(offset, 0); | ||
29370 | var newTargetOffset = flipOffset(targetOffset, 0); | ||
29371 | var newElFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, newPoints, newOffset, newTargetOffset); | ||
29372 | if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) { | ||
29373 | fail = 1; | ||
29374 | points = newPoints; | ||
29375 | offset = newOffset; | ||
29376 | targetOffset = newTargetOffset; | ||
29377 | } | ||
29378 | } | ||
29379 | } | ||
29380 | |||
29381 | if (overflow.adjustY) { | ||
29382 | // 如果纵向不能放下 | ||
29383 | if (isFailY(elFuturePos, elRegion, visibleRect)) { | ||
29384 | // 对齐位置反下 | ||
29385 | var _newPoints = flip(points, /[tb]/ig, { | ||
29386 | t: 'b', | ||
29387 | b: 't' | ||
29388 | }); | ||
29389 | // 偏移量也反下 | ||
29390 | var _newOffset = flipOffset(offset, 1); | ||
29391 | var _newTargetOffset = flipOffset(targetOffset, 1); | ||
29392 | var _newElFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, _newPoints, _newOffset, _newTargetOffset); | ||
29393 | if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) { | ||
29394 | fail = 1; | ||
29395 | points = _newPoints; | ||
29396 | offset = _newOffset; | ||
29397 | targetOffset = _newTargetOffset; | ||
29398 | } | ||
29399 | } | ||
29400 | } | ||
29401 | |||
29402 | // 如果失败,重新计算当前节点将要被放置的位置 | ||
29403 | if (fail) { | ||
29404 | elFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, points, offset, targetOffset); | ||
29405 | _utils2["default"].mix(newElRegion, elFuturePos); | ||
29406 | } | ||
29407 | |||
29408 | // 检查反下后的位置是否可以放下了 | ||
29409 | // 如果仍然放不下只有指定了可以调整当前方向才调整 | ||
29410 | newOverflowCfg.adjustX = overflow.adjustX && isFailX(elFuturePos, elRegion, visibleRect); | ||
29411 | |||
29412 | newOverflowCfg.adjustY = overflow.adjustY && isFailY(elFuturePos, elRegion, visibleRect); | ||
29413 | |||
29414 | // 确实要调整,甚至可能会调整高度宽度 | ||
29415 | if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) { | ||
29416 | newElRegion = (0, _adjustForViewport2["default"])(elFuturePos, elRegion, visibleRect, newOverflowCfg); | ||
29417 | } | ||
29418 | } | ||
29419 | |||
29420 | // need judge to in case set fixed with in css on height auto element | ||
29421 | if (newElRegion.width !== elRegion.width) { | ||
29422 | _utils2["default"].css(source, 'width', _utils2["default"].width(source) + newElRegion.width - elRegion.width); | ||
29423 | } | ||
29424 | |||
29425 | if (newElRegion.height !== elRegion.height) { | ||
29426 | _utils2["default"].css(source, 'height', _utils2["default"].height(source) + newElRegion.height - elRegion.height); | ||
29427 | } | ||
29428 | |||
29429 | // https://github.com/kissyteam/kissy/issues/190 | ||
29430 | // 相对于屏幕位置没变,而 left/top 变了 | ||
29431 | // 例如 <div 'relative'><el absolute></div> | ||
29432 | _utils2["default"].offset(source, { | ||
29433 | left: newElRegion.left, | ||
29434 | top: newElRegion.top | ||
29435 | }, { | ||
29436 | useCssRight: align.useCssRight, | ||
29437 | useCssBottom: align.useCssBottom, | ||
29438 | useCssTransform: align.useCssTransform | ||
29439 | }); | ||
29440 | |||
29441 | return { | ||
29442 | points: points, | ||
29443 | offset: offset, | ||
29444 | targetOffset: targetOffset, | ||
29445 | overflow: newOverflowCfg | ||
29446 | }; | ||
29447 | } | ||
29448 | |||
29449 | domAlign.__getOffsetParent = _getOffsetParent2["default"]; | ||
29450 | |||
29451 | domAlign.__getVisibleRectForElement = _getVisibleRectForElement2["default"]; | ||
29452 | |||
29453 | exports["default"] = domAlign; | ||
29454 | /** | ||
29455 | * 2012-04-26 yiminghe@gmail.com | ||
29456 | * - 优化智能对齐算法 | ||
29457 | * - 慎用 resizeXX | ||
29458 | * | ||
29459 | * 2011-07-13 yiminghe@gmail.com note: | ||
29460 | * - 增加智能对齐,以及大小调整选项 | ||
29461 | **/ | ||
29462 | |||
29463 | module.exports = exports['default']; | ||
29464 | |||
29465 | /***/ }), | ||
29466 | /* 284 */ | ||
29467 | /***/ (function(module, exports, __webpack_require__) { | ||
29468 | |||
29469 | 'use strict'; | ||
29470 | |||
29471 | Object.defineProperty(exports, "__esModule", { | ||
29472 | value: true | ||
29473 | }); | ||
29474 | |||
29475 | 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; }; | ||
29476 | |||
29477 | var _propertyUtils = __webpack_require__(285); | ||
29478 | |||
29479 | var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; | ||
29480 | |||
29481 | var getComputedStyleX = void 0; | ||
29482 | |||
29483 | function force(x, y) { | ||
29484 | return x + y; | ||
29485 | } | ||
29486 | |||
29487 | function css(el, name, v) { | ||
29488 | var value = v; | ||
29489 | if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { | ||
29490 | for (var i in name) { | ||
29491 | if (name.hasOwnProperty(i)) { | ||
29492 | css(el, i, name[i]); | ||
29493 | } | ||
29494 | } | ||
29495 | return undefined; | ||
29496 | } | ||
29497 | if (typeof value !== 'undefined') { | ||
29498 | if (typeof value === 'number') { | ||
29499 | value = value + 'px'; | ||
29500 | } | ||
29501 | el.style[name] = value; | ||
29502 | return undefined; | ||
29503 | } | ||
29504 | return getComputedStyleX(el, name); | ||
29505 | } | ||
29506 | |||
29507 | function getClientPosition(elem) { | ||
29508 | var box = void 0; | ||
29509 | var x = void 0; | ||
29510 | var y = void 0; | ||
29511 | var doc = elem.ownerDocument; | ||
29512 | var body = doc.body; | ||
29513 | var docElem = doc && doc.documentElement; | ||
29514 | // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式 | ||
29515 | box = elem.getBoundingClientRect(); | ||
29516 | |||
29517 | // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop | ||
29518 | // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确 | ||
29519 | // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin | ||
29520 | |||
29521 | x = box.left; | ||
29522 | y = box.top; | ||
29523 | |||
29524 | // In IE, most of the time, 2 extra pixels are added to the top and left | ||
29525 | // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and | ||
29526 | // IE6 standards mode, this border can be overridden by setting the | ||
29527 | // document element's border to zero -- thus, we cannot rely on the | ||
29528 | // offset always being 2 pixels. | ||
29529 | |||
29530 | // In quirks mode, the offset can be determined by querying the body's | ||
29531 | // clientLeft/clientTop, but in standards mode, it is found by querying | ||
29532 | // the document element's clientLeft/clientTop. Since we already called | ||
29533 | // getClientBoundingRect we have already forced a reflow, so it is not | ||
29534 | // too expensive just to query them all. | ||
29535 | |||
29536 | // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的 | ||
29537 | // 窗口边框标准是设 documentElement ,quirks 时设置 body | ||
29538 | // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去 | ||
29539 | // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置 | ||
29540 | // 标准 ie 下 docElem.clientTop 就是 border-top | ||
29541 | // ie7 html 即窗口边框改变不了。永远为 2 | ||
29542 | // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0 | ||
29543 | |||
29544 | x -= docElem.clientLeft || body.clientLeft || 0; | ||
29545 | y -= docElem.clientTop || body.clientTop || 0; | ||
29546 | |||
29547 | return { | ||
29548 | left: x, | ||
29549 | top: y | ||
29550 | }; | ||
29551 | } | ||
29552 | |||
29553 | function getScroll(w, top) { | ||
29554 | var ret = w['page' + (top ? 'Y' : 'X') + 'Offset']; | ||
29555 | var method = 'scroll' + (top ? 'Top' : 'Left'); | ||
29556 | if (typeof ret !== 'number') { | ||
29557 | var d = w.document; | ||
29558 | // ie6,7,8 standard mode | ||
29559 | ret = d.documentElement[method]; | ||
29560 | if (typeof ret !== 'number') { | ||
29561 | // quirks mode | ||
29562 | ret = d.body[method]; | ||
29563 | } | ||
29564 | } | ||
29565 | return ret; | ||
29566 | } | ||
29567 | |||
29568 | function getScrollLeft(w) { | ||
29569 | return getScroll(w); | ||
29570 | } | ||
29571 | |||
29572 | function getScrollTop(w) { | ||
29573 | return getScroll(w, true); | ||
29574 | } | ||
29575 | |||
29576 | function getOffset(el) { | ||
29577 | var pos = getClientPosition(el); | ||
29578 | var doc = el.ownerDocument; | ||
29579 | var w = doc.defaultView || doc.parentWindow; | ||
29580 | pos.left += getScrollLeft(w); | ||
29581 | pos.top += getScrollTop(w); | ||
29582 | return pos; | ||
29583 | } | ||
29584 | function _getComputedStyle(elem, name, cs) { | ||
29585 | var computedStyle = cs; | ||
29586 | var val = ''; | ||
29587 | var d = elem.ownerDocument; | ||
29588 | computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null); | ||
29589 | |||
29590 | // https://github.com/kissyteam/kissy/issues/61 | ||
29591 | if (computedStyle) { | ||
29592 | val = computedStyle.getPropertyValue(name) || computedStyle[name]; | ||
29593 | } | ||
29594 | |||
29595 | return val; | ||
29596 | } | ||
29597 | |||
29598 | var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i'); | ||
29599 | var RE_POS = /^(top|right|bottom|left)$/; | ||
29600 | var CURRENT_STYLE = 'currentStyle'; | ||
29601 | var RUNTIME_STYLE = 'runtimeStyle'; | ||
29602 | var LEFT = 'left'; | ||
29603 | var PX = 'px'; | ||
29604 | |||
29605 | function _getComputedStyleIE(elem, name) { | ||
29606 | // currentStyle maybe null | ||
29607 | // http://msdn.microsoft.com/en-us/library/ms535231.aspx | ||
29608 | var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; | ||
29609 | |||
29610 | // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值 | ||
29611 | // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19 | ||
29612 | // 在 ie 下不对,需要直接用 offset 方式 | ||
29613 | // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了 | ||
29614 | |||
29615 | // From the awesome hack by Dean Edwards | ||
29616 | // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | ||
29617 | // If we're not dealing with a regular pixel number | ||
29618 | // but a number that has a weird ending, we need to convert it to pixels | ||
29619 | // exclude left right for relativity | ||
29620 | if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { | ||
29621 | // Remember the original values | ||
29622 | var style = elem.style; | ||
29623 | var left = style[LEFT]; | ||
29624 | var rsLeft = elem[RUNTIME_STYLE][LEFT]; | ||
29625 | |||
29626 | // prevent flashing of content | ||
29627 | elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; | ||
29628 | |||
29629 | // Put in the new values to get a computed value out | ||
29630 | style[LEFT] = name === 'fontSize' ? '1em' : ret || 0; | ||
29631 | ret = style.pixelLeft + PX; | ||
29632 | |||
29633 | // Revert the changed values | ||
29634 | style[LEFT] = left; | ||
29635 | |||
29636 | elem[RUNTIME_STYLE][LEFT] = rsLeft; | ||
29637 | } | ||
29638 | return ret === '' ? 'auto' : ret; | ||
29639 | } | ||
29640 | |||
29641 | if (typeof window !== 'undefined') { | ||
29642 | getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; | ||
29643 | } | ||
29644 | |||
29645 | function getOffsetDirection(dir, option) { | ||
29646 | if (dir === 'left') { | ||
29647 | return option.useCssRight ? 'right' : dir; | ||
29648 | } | ||
29649 | return option.useCssBottom ? 'bottom' : dir; | ||
29650 | } | ||
29651 | |||
29652 | function oppositeOffsetDirection(dir) { | ||
29653 | if (dir === 'left') { | ||
29654 | return 'right'; | ||
29655 | } else if (dir === 'right') { | ||
29656 | return 'left'; | ||
29657 | } else if (dir === 'top') { | ||
29658 | return 'bottom'; | ||
29659 | } else if (dir === 'bottom') { | ||
29660 | return 'top'; | ||
29661 | } | ||
29662 | } | ||
29663 | |||
29664 | // 设置 elem 相对 elem.ownerDocument 的坐标 | ||
29665 | function setLeftTop(elem, offset, option) { | ||
29666 | // set position first, in-case top/left are set even on static elem | ||
29667 | if (css(elem, 'position') === 'static') { | ||
29668 | elem.style.position = 'relative'; | ||
29669 | } | ||
29670 | var presetH = -999; | ||
29671 | var presetV = -999; | ||
29672 | var horizontalProperty = getOffsetDirection('left', option); | ||
29673 | var verticalProperty = getOffsetDirection('top', option); | ||
29674 | var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty); | ||
29675 | var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty); | ||
29676 | |||
29677 | if (horizontalProperty !== 'left') { | ||
29678 | presetH = 999; | ||
29679 | } | ||
29680 | |||
29681 | if (verticalProperty !== 'top') { | ||
29682 | presetV = 999; | ||
29683 | } | ||
29684 | var originalTransition = ''; | ||
29685 | var originalOffset = getOffset(elem); | ||
29686 | if ('left' in offset || 'top' in offset) { | ||
29687 | originalTransition = (0, _propertyUtils.getTransitionProperty)(elem) || ''; | ||
29688 | (0, _propertyUtils.setTransitionProperty)(elem, 'none'); | ||
29689 | } | ||
29690 | if ('left' in offset) { | ||
29691 | elem.style[oppositeHorizontalProperty] = ''; | ||
29692 | elem.style[horizontalProperty] = presetH + 'px'; | ||
29693 | } | ||
29694 | if ('top' in offset) { | ||
29695 | elem.style[oppositeVerticalProperty] = ''; | ||
29696 | elem.style[verticalProperty] = presetV + 'px'; | ||
29697 | } | ||
29698 | var old = getOffset(elem); | ||
29699 | var originalStyle = {}; | ||
29700 | for (var key in offset) { | ||
29701 | if (offset.hasOwnProperty(key)) { | ||
29702 | var dir = getOffsetDirection(key, option); | ||
29703 | var preset = key === 'left' ? presetH : presetV; | ||
29704 | var off = originalOffset[key] - old[key]; | ||
29705 | if (dir === key) { | ||
29706 | originalStyle[dir] = preset + off; | ||
29707 | } else { | ||
29708 | originalStyle[dir] = preset - off; | ||
29709 | } | ||
29710 | } | ||
29711 | } | ||
29712 | css(elem, originalStyle); | ||
29713 | // force relayout | ||
29714 | force(elem.offsetTop, elem.offsetLeft); | ||
29715 | if ('left' in offset || 'top' in offset) { | ||
29716 | (0, _propertyUtils.setTransitionProperty)(elem, originalTransition); | ||
29717 | } | ||
29718 | var ret = {}; | ||
29719 | for (var _key in offset) { | ||
29720 | if (offset.hasOwnProperty(_key)) { | ||
29721 | var _dir = getOffsetDirection(_key, option); | ||
29722 | var _off = offset[_key] - originalOffset[_key]; | ||
29723 | if (_key === _dir) { | ||
29724 | ret[_dir] = originalStyle[_dir] + _off; | ||
29725 | } else { | ||
29726 | ret[_dir] = originalStyle[_dir] - _off; | ||
29727 | } | ||
29728 | } | ||
29729 | } | ||
29730 | css(elem, ret); | ||
29731 | } | ||
29732 | |||
29733 | function setTransform(elem, offset) { | ||
29734 | var originalOffset = getOffset(elem); | ||
29735 | var originalXY = (0, _propertyUtils.getTransformXY)(elem); | ||
29736 | var resultXY = { x: originalXY.x, y: originalXY.y }; | ||
29737 | if ('left' in offset) { | ||
29738 | resultXY.x = originalXY.x + offset.left - originalOffset.left; | ||
29739 | } | ||
29740 | if ('top' in offset) { | ||
29741 | resultXY.y = originalXY.y + offset.top - originalOffset.top; | ||
29742 | } | ||
29743 | (0, _propertyUtils.setTransformXY)(elem, resultXY); | ||
29744 | } | ||
29745 | |||
29746 | function setOffset(elem, offset, option) { | ||
29747 | if (option.useCssRight || option.useCssBottom) { | ||
29748 | setLeftTop(elem, offset, option); | ||
29749 | } else if (option.useCssTransform && (0, _propertyUtils.getTransformName)() in document.body.style) { | ||
29750 | setTransform(elem, offset, option); | ||
29751 | } else { | ||
29752 | setLeftTop(elem, offset, option); | ||
29753 | } | ||
29754 | } | ||
29755 | |||
29756 | function each(arr, fn) { | ||
29757 | for (var i = 0; i < arr.length; i++) { | ||
29758 | fn(arr[i]); | ||
29759 | } | ||
29760 | } | ||
29761 | |||
29762 | function isBorderBoxFn(elem) { | ||
29763 | return getComputedStyleX(elem, 'boxSizing') === 'border-box'; | ||
29764 | } | ||
29765 | |||
29766 | var BOX_MODELS = ['margin', 'border', 'padding']; | ||
29767 | var CONTENT_INDEX = -1; | ||
29768 | var PADDING_INDEX = 2; | ||
29769 | var BORDER_INDEX = 1; | ||
29770 | var MARGIN_INDEX = 0; | ||
29771 | |||
29772 | function swap(elem, options, callback) { | ||
29773 | var old = {}; | ||
29774 | var style = elem.style; | ||
29775 | var name = void 0; | ||
29776 | |||
29777 | // Remember the old values, and insert the new ones | ||
29778 | for (name in options) { | ||
29779 | if (options.hasOwnProperty(name)) { | ||
29780 | old[name] = style[name]; | ||
29781 | style[name] = options[name]; | ||
29782 | } | ||
29783 | } | ||
29784 | |||
29785 | callback.call(elem); | ||
29786 | |||
29787 | // Revert the old values | ||
29788 | for (name in options) { | ||
29789 | if (options.hasOwnProperty(name)) { | ||
29790 | style[name] = old[name]; | ||
29791 | } | ||
29792 | } | ||
29793 | } | ||
29794 | |||
29795 | function getPBMWidth(elem, props, which) { | ||
29796 | var value = 0; | ||
29797 | var prop = void 0; | ||
29798 | var j = void 0; | ||
29799 | var i = void 0; | ||
29800 | for (j = 0; j < props.length; j++) { | ||
29801 | prop = props[j]; | ||
29802 | if (prop) { | ||
29803 | for (i = 0; i < which.length; i++) { | ||
29804 | var cssProp = void 0; | ||
29805 | if (prop === 'border') { | ||
29806 | cssProp = '' + prop + which[i] + 'Width'; | ||
29807 | } else { | ||
29808 | cssProp = prop + which[i]; | ||
29809 | } | ||
29810 | value += parseFloat(getComputedStyleX(elem, cssProp)) || 0; | ||
29811 | } | ||
29812 | } | ||
29813 | } | ||
29814 | return value; | ||
29815 | } | ||
29816 | |||
29817 | /** | ||
29818 | * A crude way of determining if an object is a window | ||
29819 | * @member util | ||
29820 | */ | ||
29821 | function isWindow(obj) { | ||
29822 | // must use == for ie8 | ||
29823 | /* eslint eqeqeq:0 */ | ||
29824 | return obj !== null && obj !== undefined && obj == obj.window; | ||
29825 | } | ||
29826 | |||
29827 | var domUtils = {}; | ||
29828 | |||
29829 | each(['Width', 'Height'], function (name) { | ||
29830 | domUtils['doc' + name] = function (refWin) { | ||
29831 | var d = refWin.document; | ||
29832 | return Math.max( | ||
29833 | // firefox chrome documentElement.scrollHeight< body.scrollHeight | ||
29834 | // ie standard mode : documentElement.scrollHeight> body.scrollHeight | ||
29835 | d.documentElement['scroll' + name], | ||
29836 | // quirks : documentElement.scrollHeight 最大等于可视窗口多一点? | ||
29837 | d.body['scroll' + name], domUtils['viewport' + name](d)); | ||
29838 | }; | ||
29839 | |||
29840 | domUtils['viewport' + name] = function (win) { | ||
29841 | // pc browser includes scrollbar in window.innerWidth | ||
29842 | var prop = 'client' + name; | ||
29843 | var doc = win.document; | ||
29844 | var body = doc.body; | ||
29845 | var documentElement = doc.documentElement; | ||
29846 | var documentElementProp = documentElement[prop]; | ||
29847 | // 标准模式取 documentElement | ||
29848 | // backcompat 取 body | ||
29849 | return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp; | ||
29850 | }; | ||
29851 | }); | ||
29852 | |||
29853 | /* | ||
29854 | 得到元素的大小信息 | ||
29855 | @param elem | ||
29856 | @param name | ||
29857 | @param {String} [extra] 'padding' : (css width) + padding | ||
29858 | 'border' : (css width) + padding + border | ||
29859 | 'margin' : (css width) + padding + border + margin | ||
29860 | */ | ||
29861 | function getWH(elem, name, ex) { | ||
29862 | var extra = ex; | ||
29863 | if (isWindow(elem)) { | ||
29864 | return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); | ||
29865 | } else if (elem.nodeType === 9) { | ||
29866 | return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem); | ||
29867 | } | ||
29868 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; | ||
29869 | var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight; | ||
29870 | var computedStyle = getComputedStyleX(elem); | ||
29871 | var isBorderBox = isBorderBoxFn(elem, computedStyle); | ||
29872 | var cssBoxValue = 0; | ||
29873 | if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) { | ||
29874 | borderBoxValue = undefined; | ||
29875 | // Fall back to computed then un computed css if necessary | ||
29876 | cssBoxValue = getComputedStyleX(elem, name); | ||
29877 | if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) { | ||
29878 | cssBoxValue = elem.style[name] || 0; | ||
29879 | } | ||
29880 | // Normalize '', auto, and prepare for extra | ||
29881 | cssBoxValue = parseFloat(cssBoxValue) || 0; | ||
29882 | } | ||
29883 | if (extra === undefined) { | ||
29884 | extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; | ||
29885 | } | ||
29886 | var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox; | ||
29887 | var val = borderBoxValue || cssBoxValue; | ||
29888 | if (extra === CONTENT_INDEX) { | ||
29889 | if (borderBoxValueOrIsBorderBox) { | ||
29890 | return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle); | ||
29891 | } | ||
29892 | return cssBoxValue; | ||
29893 | } else if (borderBoxValueOrIsBorderBox) { | ||
29894 | if (extra === BORDER_INDEX) { | ||
29895 | return val; | ||
29896 | } | ||
29897 | return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle)); | ||
29898 | } | ||
29899 | return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle); | ||
29900 | } | ||
29901 | |||
29902 | var cssShow = { | ||
29903 | position: 'absolute', | ||
29904 | visibility: 'hidden', | ||
29905 | display: 'block' | ||
29906 | }; | ||
29907 | |||
29908 | // fix #119 : https://github.com/kissyteam/kissy/issues/119 | ||
29909 | function getWHIgnoreDisplay() { | ||
29910 | for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) { | ||
29911 | args[_key2] = arguments[_key2]; | ||
29912 | } | ||
29913 | |||
29914 | var val = void 0; | ||
29915 | var elem = args[0]; | ||
29916 | // in case elem is window | ||
29917 | // elem.offsetWidth === undefined | ||
29918 | if (elem.offsetWidth !== 0) { | ||
29919 | val = getWH.apply(undefined, args); | ||
29920 | } else { | ||
29921 | swap(elem, cssShow, function () { | ||
29922 | val = getWH.apply(undefined, args); | ||
29923 | }); | ||
29924 | } | ||
29925 | return val; | ||
29926 | } | ||
29927 | |||
29928 | each(['width', 'height'], function (name) { | ||
29929 | var first = name.charAt(0).toUpperCase() + name.slice(1); | ||
29930 | domUtils['outer' + first] = function (el, includeMargin) { | ||
29931 | return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); | ||
29932 | }; | ||
29933 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; | ||
29934 | |||
29935 | domUtils[name] = function (elem, v) { | ||
29936 | var val = v; | ||
29937 | if (val !== undefined) { | ||
29938 | if (elem) { | ||
29939 | var computedStyle = getComputedStyleX(elem); | ||
29940 | var isBorderBox = isBorderBoxFn(elem); | ||
29941 | if (isBorderBox) { | ||
29942 | val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle); | ||
29943 | } | ||
29944 | return css(elem, name, val); | ||
29945 | } | ||
29946 | return undefined; | ||
29947 | } | ||
29948 | return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); | ||
29949 | }; | ||
29950 | }); | ||
29951 | |||
29952 | function mix(to, from) { | ||
29953 | for (var i in from) { | ||
29954 | if (from.hasOwnProperty(i)) { | ||
29955 | to[i] = from[i]; | ||
29956 | } | ||
29957 | } | ||
29958 | return to; | ||
29959 | } | ||
29960 | |||
29961 | var utils = { | ||
29962 | getWindow: function getWindow(node) { | ||
29963 | if (node && node.document && node.setTimeout) { | ||
29964 | return node; | ||
29965 | } | ||
29966 | var doc = node.ownerDocument || node; | ||
29967 | return doc.defaultView || doc.parentWindow; | ||
29968 | }, | ||
29969 | offset: function offset(el, value, option) { | ||
29970 | if (typeof value !== 'undefined') { | ||
29971 | setOffset(el, value, option || {}); | ||
29972 | } else { | ||
29973 | return getOffset(el); | ||
29974 | } | ||
29975 | }, | ||
29976 | |||
29977 | isWindow: isWindow, | ||
29978 | each: each, | ||
29979 | css: css, | ||
29980 | clone: function clone(obj) { | ||
29981 | var i = void 0; | ||
29982 | var ret = {}; | ||
29983 | for (i in obj) { | ||
29984 | if (obj.hasOwnProperty(i)) { | ||
29985 | ret[i] = obj[i]; | ||
29986 | } | ||
29987 | } | ||
29988 | var overflow = obj.overflow; | ||
29989 | if (overflow) { | ||
29990 | for (i in obj) { | ||
29991 | if (obj.hasOwnProperty(i)) { | ||
29992 | ret.overflow[i] = obj.overflow[i]; | ||
29993 | } | ||
29994 | } | ||
29995 | } | ||
29996 | return ret; | ||
29997 | }, | ||
29998 | |||
29999 | mix: mix, | ||
30000 | getWindowScrollLeft: function getWindowScrollLeft(w) { | ||
30001 | return getScrollLeft(w); | ||
30002 | }, | ||
30003 | getWindowScrollTop: function getWindowScrollTop(w) { | ||
30004 | return getScrollTop(w); | ||
30005 | }, | ||
30006 | merge: function merge() { | ||
30007 | var ret = {}; | ||
30008 | |||
30009 | for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) { | ||
30010 | args[_key3] = arguments[_key3]; | ||
30011 | } | ||
30012 | |||
30013 | for (var i = 0; i < args.length; i++) { | ||
30014 | utils.mix(ret, args[i]); | ||
30015 | } | ||
30016 | return ret; | ||
30017 | }, | ||
30018 | |||
30019 | viewportWidth: 0, | ||
30020 | viewportHeight: 0 | ||
30021 | }; | ||
30022 | |||
30023 | mix(utils, domUtils); | ||
30024 | |||
30025 | exports["default"] = utils; | ||
30026 | module.exports = exports['default']; | ||
30027 | |||
30028 | /***/ }), | ||
30029 | /* 285 */ | ||
30030 | /***/ (function(module, exports) { | ||
30031 | |||
30032 | 'use strict'; | ||
30033 | |||
30034 | Object.defineProperty(exports, "__esModule", { | ||
30035 | value: true | ||
30036 | }); | ||
30037 | exports.getTransformName = getTransformName; | ||
30038 | exports.setTransitionProperty = setTransitionProperty; | ||
30039 | exports.getTransitionProperty = getTransitionProperty; | ||
30040 | exports.getTransformXY = getTransformXY; | ||
30041 | exports.setTransformXY = setTransformXY; | ||
30042 | var vendorPrefix = void 0; | ||
30043 | |||
30044 | var jsCssMap = { | ||
30045 | Webkit: '-webkit-', | ||
30046 | Moz: '-moz-', | ||
30047 | // IE did it wrong again ... | ||
30048 | ms: '-ms-', | ||
30049 | O: '-o-' | ||
30050 | }; | ||
30051 | |||
30052 | function getVendorPrefix() { | ||
30053 | if (vendorPrefix !== undefined) { | ||
30054 | return vendorPrefix; | ||
30055 | } | ||
30056 | vendorPrefix = ''; | ||
30057 | var style = document.createElement('p').style; | ||
30058 | var testProp = 'Transform'; | ||
30059 | for (var key in jsCssMap) { | ||
30060 | if (key + testProp in style) { | ||
30061 | vendorPrefix = key; | ||
30062 | } | ||
30063 | } | ||
30064 | return vendorPrefix; | ||
30065 | } | ||
30066 | |||
30067 | function getTransitionName() { | ||
30068 | return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty'; | ||
30069 | } | ||
30070 | |||
30071 | function getTransformName() { | ||
30072 | return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform'; | ||
30073 | } | ||
30074 | |||
30075 | function setTransitionProperty(node, value) { | ||
30076 | var name = getTransitionName(); | ||
30077 | if (name) { | ||
30078 | node.style[name] = value; | ||
30079 | if (name !== 'transitionProperty') { | ||
30080 | node.style.transitionProperty = value; | ||
30081 | } | ||
30082 | } | ||
30083 | } | ||
30084 | |||
30085 | function setTransform(node, value) { | ||
30086 | var name = getTransformName(); | ||
30087 | if (name) { | ||
30088 | node.style[name] = value; | ||
30089 | if (name !== 'transform') { | ||
30090 | node.style.transform = value; | ||
30091 | } | ||
30092 | } | ||
30093 | } | ||
30094 | |||
30095 | function getTransitionProperty(node) { | ||
30096 | return node.style.transitionProperty || node.style[getTransitionName()]; | ||
30097 | } | ||
30098 | |||
30099 | function getTransformXY(node) { | ||
30100 | var style = window.getComputedStyle(node, null); | ||
30101 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName()); | ||
30102 | if (transform && transform !== 'none') { | ||
30103 | var matrix = transform.replace(/[^0-9\-.,]/g, '').split(','); | ||
30104 | return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) }; | ||
30105 | } | ||
30106 | return { | ||
30107 | x: 0, | ||
30108 | y: 0 | ||
30109 | }; | ||
30110 | } | ||
30111 | |||
30112 | var matrix2d = /matrix\((.*)\)/; | ||
30113 | var matrix3d = /matrix3d\((.*)\)/; | ||
30114 | |||
30115 | function setTransformXY(node, xy) { | ||
30116 | var style = window.getComputedStyle(node, null); | ||
30117 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName()); | ||
30118 | if (transform && transform !== 'none') { | ||
30119 | var arr = void 0; | ||
30120 | var match2d = transform.match(matrix2d); | ||
30121 | if (match2d) { | ||
30122 | match2d = match2d[1]; | ||
30123 | arr = match2d.split(',').map(function (item) { | ||
30124 | return parseFloat(item, 10); | ||
30125 | }); | ||
30126 | arr[4] = xy.x; | ||
30127 | arr[5] = xy.y; | ||
30128 | setTransform(node, 'matrix(' + arr.join(',') + ')'); | ||
30129 | } else { | ||
30130 | var match3d = transform.match(matrix3d)[1]; | ||
30131 | arr = match3d.split(',').map(function (item) { | ||
30132 | return parseFloat(item, 10); | ||
30133 | }); | ||
30134 | arr[12] = xy.x; | ||
30135 | arr[13] = xy.y; | ||
30136 | setTransform(node, 'matrix3d(' + arr.join(',') + ')'); | ||
30137 | } | ||
30138 | } else { | ||
30139 | setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)'); | ||
30140 | } | ||
30141 | } | ||
30142 | |||
30143 | /***/ }), | ||
30144 | /* 286 */ | ||
30145 | /***/ (function(module, exports, __webpack_require__) { | ||
30146 | |||
30147 | 'use strict'; | ||
30148 | |||
30149 | Object.defineProperty(exports, "__esModule", { | ||
30150 | value: true | ||
30151 | }); | ||
30152 | |||
30153 | var _utils = __webpack_require__(284); | ||
30154 | |||
30155 | var _utils2 = _interopRequireDefault(_utils); | ||
30156 | |||
30157 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
30158 | |||
30159 | /** | ||
30160 | * 得到会导致元素显示不全的祖先元素 | ||
30161 | */ | ||
30162 | |||
30163 | function getOffsetParent(element) { | ||
30164 | // ie 这个也不是完全可行 | ||
30165 | /* | ||
30166 | <div style="width: 50px;height: 100px;overflow: hidden"> | ||
30167 | <div style="width: 50px;height: 100px;position: relative;" id="d6"> | ||
30168 | 元素 6 高 100px 宽 50px<br/> | ||
30169 | </div> | ||
30170 | </div> | ||
30171 | */ | ||
30172 | // element.offsetParent does the right thing in ie7 and below. Return parent with layout! | ||
30173 | // In other browsers it only includes elements with position absolute, relative or | ||
30174 | // fixed, not elements with overflow set to auto or scroll. | ||
30175 | // if (UA.ie && ieMode < 8) { | ||
30176 | // return element.offsetParent; | ||
30177 | // } | ||
30178 | // 统一的 offsetParent 方法 | ||
30179 | var doc = element.ownerDocument; | ||
30180 | var body = doc.body; | ||
30181 | var parent = void 0; | ||
30182 | var positionStyle = _utils2["default"].css(element, 'position'); | ||
30183 | var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute'; | ||
30184 | |||
30185 | if (!skipStatic) { | ||
30186 | return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode; | ||
30187 | } | ||
30188 | |||
30189 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) { | ||
30190 | positionStyle = _utils2["default"].css(parent, 'position'); | ||
30191 | if (positionStyle !== 'static') { | ||
30192 | return parent; | ||
30193 | } | ||
30194 | } | ||
30195 | return null; | ||
30196 | } | ||
30197 | |||
30198 | exports["default"] = getOffsetParent; | ||
30199 | module.exports = exports['default']; | ||
30200 | |||
30201 | /***/ }), | ||
30202 | /* 287 */ | ||
30203 | /***/ (function(module, exports, __webpack_require__) { | ||
30204 | |||
30205 | 'use strict'; | ||
30206 | |||
30207 | Object.defineProperty(exports, "__esModule", { | ||
30208 | value: true | ||
30209 | }); | ||
30210 | |||
30211 | var _utils = __webpack_require__(284); | ||
30212 | |||
30213 | var _utils2 = _interopRequireDefault(_utils); | ||
30214 | |||
30215 | var _getOffsetParent = __webpack_require__(286); | ||
30216 | |||
30217 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); | ||
30218 | |||
30219 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
30220 | |||
30221 | /** | ||
30222 | * 获得元素的显示部分的区域 | ||
30223 | */ | ||
30224 | function getVisibleRectForElement(element) { | ||
30225 | var visibleRect = { | ||
30226 | left: 0, | ||
30227 | right: Infinity, | ||
30228 | top: 0, | ||
30229 | bottom: Infinity | ||
30230 | }; | ||
30231 | var el = (0, _getOffsetParent2["default"])(element); | ||
30232 | var scrollX = void 0; | ||
30233 | var scrollY = void 0; | ||
30234 | var winSize = void 0; | ||
30235 | var doc = element.ownerDocument; | ||
30236 | var win = doc.defaultView || doc.parentWindow; | ||
30237 | var body = doc.body; | ||
30238 | var documentElement = doc.documentElement; | ||
30239 | |||
30240 | // Determine the size of the visible rect by climbing the dom accounting for | ||
30241 | // all scrollable containers. | ||
30242 | while (el) { | ||
30243 | // clientWidth is zero for inline block elements in ie. | ||
30244 | if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) && | ||
30245 | // body may have overflow set on it, yet we still get the entire | ||
30246 | // viewport. In some browsers, el.offsetParent may be | ||
30247 | // document.documentElement, so check for that too. | ||
30248 | el !== body && el !== documentElement && _utils2["default"].css(el, 'overflow') !== 'visible') { | ||
30249 | var pos = _utils2["default"].offset(el); | ||
30250 | // add border | ||
30251 | pos.left += el.clientLeft; | ||
30252 | pos.top += el.clientTop; | ||
30253 | visibleRect.top = Math.max(visibleRect.top, pos.top); | ||
30254 | visibleRect.right = Math.min(visibleRect.right, | ||
30255 | // consider area without scrollBar | ||
30256 | pos.left + el.clientWidth); | ||
30257 | visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight); | ||
30258 | visibleRect.left = Math.max(visibleRect.left, pos.left); | ||
30259 | } else if (el === body || el === documentElement) { | ||
30260 | break; | ||
30261 | } | ||
30262 | el = (0, _getOffsetParent2["default"])(el); | ||
30263 | } | ||
30264 | |||
30265 | // Clip by window's viewport. | ||
30266 | scrollX = _utils2["default"].getWindowScrollLeft(win); | ||
30267 | scrollY = _utils2["default"].getWindowScrollTop(win); | ||
30268 | visibleRect.left = Math.max(visibleRect.left, scrollX); | ||
30269 | visibleRect.top = Math.max(visibleRect.top, scrollY); | ||
30270 | winSize = { | ||
30271 | width: _utils2["default"].viewportWidth(win), | ||
30272 | height: _utils2["default"].viewportHeight(win) | ||
30273 | }; | ||
30274 | visibleRect.right = Math.min(visibleRect.right, scrollX + winSize.width); | ||
30275 | visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + winSize.height); | ||
30276 | return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null; | ||
30277 | } | ||
30278 | |||
30279 | exports["default"] = getVisibleRectForElement; | ||
30280 | module.exports = exports['default']; | ||
30281 | |||
30282 | /***/ }), | ||
30283 | /* 288 */ | ||
30284 | /***/ (function(module, exports, __webpack_require__) { | ||
30285 | |||
30286 | 'use strict'; | ||
30287 | |||
30288 | Object.defineProperty(exports, "__esModule", { | ||
30289 | value: true | ||
30290 | }); | ||
30291 | |||
30292 | var _utils = __webpack_require__(284); | ||
30293 | |||
30294 | var _utils2 = _interopRequireDefault(_utils); | ||
30295 | |||
30296 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
30297 | |||
30298 | function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) { | ||
30299 | var pos = _utils2["default"].clone(elFuturePos); | ||
30300 | var size = { | ||
30301 | width: elRegion.width, | ||
30302 | height: elRegion.height | ||
30303 | }; | ||
30304 | |||
30305 | if (overflow.adjustX && pos.left < visibleRect.left) { | ||
30306 | pos.left = visibleRect.left; | ||
30307 | } | ||
30308 | |||
30309 | // Left edge inside and right edge outside viewport, try to resize it. | ||
30310 | if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) { | ||
30311 | size.width -= pos.left + size.width - visibleRect.right; | ||
30312 | } | ||
30313 | |||
30314 | // Right edge outside viewport, try to move it. | ||
30315 | if (overflow.adjustX && pos.left + size.width > visibleRect.right) { | ||
30316 | // 保证左边界和可视区域左边界对齐 | ||
30317 | pos.left = Math.max(visibleRect.right - size.width, visibleRect.left); | ||
30318 | } | ||
30319 | |||
30320 | // Top edge outside viewport, try to move it. | ||
30321 | if (overflow.adjustY && pos.top < visibleRect.top) { | ||
30322 | pos.top = visibleRect.top; | ||
30323 | } | ||
30324 | |||
30325 | // Top edge inside and bottom edge outside viewport, try to resize it. | ||
30326 | if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) { | ||
30327 | size.height -= pos.top + size.height - visibleRect.bottom; | ||
30328 | } | ||
30329 | |||
30330 | // Bottom edge outside viewport, try to move it. | ||
30331 | if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) { | ||
30332 | // 保证上边界和可视区域上边界对齐 | ||
30333 | pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top); | ||
30334 | } | ||
30335 | |||
30336 | return _utils2["default"].mix(pos, size); | ||
30337 | } | ||
30338 | |||
30339 | exports["default"] = adjustForViewport; | ||
30340 | module.exports = exports['default']; | ||
30341 | |||
30342 | /***/ }), | ||
30343 | /* 289 */ | ||
30344 | /***/ (function(module, exports, __webpack_require__) { | ||
30345 | |||
30346 | 'use strict'; | ||
30347 | |||
30348 | Object.defineProperty(exports, "__esModule", { | ||
30349 | value: true | ||
30350 | }); | ||
30351 | |||
30352 | var _utils = __webpack_require__(284); | ||
30353 | |||
30354 | var _utils2 = _interopRequireDefault(_utils); | ||
30355 | |||
30356 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
30357 | |||
30358 | function getRegion(node) { | ||
30359 | var offset = void 0; | ||
30360 | var w = void 0; | ||
30361 | var h = void 0; | ||
30362 | if (!_utils2["default"].isWindow(node) && node.nodeType !== 9) { | ||
30363 | offset = _utils2["default"].offset(node); | ||
30364 | w = _utils2["default"].outerWidth(node); | ||
30365 | h = _utils2["default"].outerHeight(node); | ||
30366 | } else { | ||
30367 | var win = _utils2["default"].getWindow(node); | ||
30368 | offset = { | ||
30369 | left: _utils2["default"].getWindowScrollLeft(win), | ||
30370 | top: _utils2["default"].getWindowScrollTop(win) | ||
30371 | }; | ||
30372 | w = _utils2["default"].viewportWidth(win); | ||
30373 | h = _utils2["default"].viewportHeight(win); | ||
30374 | } | ||
30375 | offset.width = w; | ||
30376 | offset.height = h; | ||
30377 | return offset; | ||
30378 | } | ||
30379 | |||
30380 | exports["default"] = getRegion; | ||
30381 | module.exports = exports['default']; | ||
30382 | |||
30383 | /***/ }), | ||
30384 | /* 290 */ | ||
30385 | /***/ (function(module, exports, __webpack_require__) { | ||
30386 | |||
30387 | 'use strict'; | ||
30388 | |||
30389 | Object.defineProperty(exports, "__esModule", { | ||
30390 | value: true | ||
30391 | }); | ||
30392 | |||
30393 | var _getAlignOffset = __webpack_require__(291); | ||
30394 | |||
30395 | var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset); | ||
30396 | |||
30397 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
30398 | |||
30399 | function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) { | ||
30400 | var xy = void 0; | ||
30401 | var diff = void 0; | ||
30402 | var p1 = void 0; | ||
30403 | var p2 = void 0; | ||
30404 | |||
30405 | xy = { | ||
30406 | left: elRegion.left, | ||
30407 | top: elRegion.top | ||
30408 | }; | ||
30409 | |||
30410 | p1 = (0, _getAlignOffset2["default"])(refNodeRegion, points[1]); | ||
30411 | p2 = (0, _getAlignOffset2["default"])(elRegion, points[0]); | ||
30412 | |||
30413 | diff = [p2.left - p1.left, p2.top - p1.top]; | ||
30414 | |||
30415 | return { | ||
30416 | left: xy.left - diff[0] + offset[0] - targetOffset[0], | ||
30417 | top: xy.top - diff[1] + offset[1] - targetOffset[1] | ||
30418 | }; | ||
30419 | } | ||
30420 | |||
30421 | exports["default"] = getElFuturePos; | ||
30422 | module.exports = exports['default']; | ||
30423 | |||
30424 | /***/ }), | ||
30425 | /* 291 */ | ||
30426 | /***/ (function(module, exports) { | ||
30427 | |||
30428 | 'use strict'; | ||
30429 | |||
30430 | Object.defineProperty(exports, "__esModule", { | ||
30431 | value: true | ||
30432 | }); | ||
30433 | /** | ||
30434 | * 获取 node 上的 align 对齐点 相对于页面的坐标 | ||
30435 | */ | ||
30436 | |||
30437 | function getAlignOffset(region, align) { | ||
30438 | var V = align.charAt(0); | ||
30439 | var H = align.charAt(1); | ||
30440 | var w = region.width; | ||
30441 | var h = region.height; | ||
30442 | var x = void 0; | ||
30443 | var y = void 0; | ||
30444 | |||
30445 | x = region.left; | ||
30446 | y = region.top; | ||
30447 | |||
30448 | if (V === 'c') { | ||
30449 | y += h / 2; | ||
30450 | } else if (V === 'b') { | ||
30451 | y += h; | ||
30452 | } | ||
30453 | |||
30454 | if (H === 'c') { | ||
30455 | x += w / 2; | ||
30456 | } else if (H === 'r') { | ||
30457 | x += w; | ||
30458 | } | ||
30459 | |||
30460 | return { | ||
30461 | left: x, | ||
30462 | top: y | ||
30463 | }; | ||
30464 | } | ||
30465 | |||
30466 | exports["default"] = getAlignOffset; | ||
30467 | module.exports = exports['default']; | ||
30468 | |||
30469 | /***/ }), | ||
30470 | /* 292 */ | ||
30471 | /***/ (function(module, exports) { | ||
30472 | |||
30473 | "use strict"; | ||
30474 | |||
30475 | Object.defineProperty(exports, "__esModule", { | ||
30476 | value: true | ||
30477 | }); | ||
30478 | exports["default"] = isWindow; | ||
30479 | function isWindow(obj) { | ||
30480 | /* eslint no-eq-null: 0 */ | ||
30481 | /* eslint eqeqeq: 0 */ | ||
30482 | return obj != null && obj == obj.window; | ||
30483 | } | ||
30484 | module.exports = exports['default']; | ||
30485 | |||
30486 | /***/ }), | ||
30487 | /* 293 */ | ||
30488 | /***/ (function(module, exports, __webpack_require__) { | ||
30489 | |||
30490 | 'use strict'; | ||
30491 | |||
30492 | // export this package's api | ||
30493 | module.exports = __webpack_require__(294); | ||
30494 | |||
30495 | /***/ }), | ||
30496 | /* 294 */ | ||
30497 | /***/ (function(module, exports, __webpack_require__) { | ||
30498 | |||
30499 | 'use strict'; | ||
30500 | |||
30501 | Object.defineProperty(exports, "__esModule", { | ||
30502 | value: true | ||
30503 | }); | ||
30504 | |||
30505 | 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; }; | ||
30506 | |||
30507 | var _react = __webpack_require__(3); | ||
30508 | |||
30509 | var _react2 = _interopRequireDefault(_react); | ||
30510 | |||
30511 | var _ChildrenUtils = __webpack_require__(295); | ||
30512 | |||
30513 | var _AnimateChild = __webpack_require__(296); | ||
30514 | |||
30515 | var _AnimateChild2 = _interopRequireDefault(_AnimateChild); | ||
30516 | |||
30517 | var _util = __webpack_require__(301); | ||
30518 | |||
30519 | var _util2 = _interopRequireDefault(_util); | ||
30520 | |||
30521 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
30522 | |||
30523 | 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; } | ||
30524 | |||
30525 | var defaultKey = 'rc_animate_' + Date.now(); | ||
30526 | |||
30527 | |||
30528 | function getChildrenFromProps(props) { | ||
30529 | var children = props.children; | ||
30530 | if (_react2["default"].isValidElement(children)) { | ||
30531 | if (!children.key) { | ||
30532 | return _react2["default"].cloneElement(children, { | ||
30533 | key: defaultKey | ||
30534 | }); | ||
30535 | } | ||
30536 | } | ||
30537 | return children; | ||
30538 | } | ||
30539 | |||
30540 | function noop() {} | ||
30541 | |||
30542 | var Animate = _react2["default"].createClass({ | ||
30543 | displayName: 'Animate', | ||
30544 | |||
30545 | propTypes: { | ||
30546 | component: _react2["default"].PropTypes.any, | ||
30547 | componentProps: _react2["default"].PropTypes.object, | ||
30548 | animation: _react2["default"].PropTypes.object, | ||
30549 | transitionName: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.string, _react2["default"].PropTypes.object]), | ||
30550 | transitionEnter: _react2["default"].PropTypes.bool, | ||
30551 | transitionAppear: _react2["default"].PropTypes.bool, | ||
30552 | exclusive: _react2["default"].PropTypes.bool, | ||
30553 | transitionLeave: _react2["default"].PropTypes.bool, | ||
30554 | onEnd: _react2["default"].PropTypes.func, | ||
30555 | onEnter: _react2["default"].PropTypes.func, | ||
30556 | onLeave: _react2["default"].PropTypes.func, | ||
30557 | onAppear: _react2["default"].PropTypes.func, | ||
30558 | showProp: _react2["default"].PropTypes.string | ||
30559 | }, | ||
30560 | |||
30561 | getDefaultProps: function getDefaultProps() { | ||
30562 | return { | ||
30563 | animation: {}, | ||
30564 | component: 'span', | ||
30565 | componentProps: {}, | ||
30566 | transitionEnter: true, | ||
30567 | transitionLeave: true, | ||
30568 | transitionAppear: false, | ||
30569 | onEnd: noop, | ||
30570 | onEnter: noop, | ||
30571 | onLeave: noop, | ||
30572 | onAppear: noop | ||
30573 | }; | ||
30574 | }, | ||
30575 | getInitialState: function getInitialState() { | ||
30576 | this.currentlyAnimatingKeys = {}; | ||
30577 | this.keysToEnter = []; | ||
30578 | this.keysToLeave = []; | ||
30579 | return { | ||
30580 | children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(this.props)) | ||
30581 | }; | ||
30582 | }, | ||
30583 | componentDidMount: function componentDidMount() { | ||
30584 | var _this = this; | ||
30585 | |||
30586 | var showProp = this.props.showProp; | ||
30587 | var children = this.state.children; | ||
30588 | if (showProp) { | ||
30589 | children = children.filter(function (child) { | ||
30590 | return !!child.props[showProp]; | ||
30591 | }); | ||
30592 | } | ||
30593 | children.forEach(function (child) { | ||
30594 | if (child) { | ||
30595 | _this.performAppear(child.key); | ||
30596 | } | ||
30597 | }); | ||
30598 | }, | ||
30599 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | ||
30600 | var _this2 = this; | ||
30601 | |||
30602 | this.nextProps = nextProps; | ||
30603 | var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps)); | ||
30604 | var props = this.props; | ||
30605 | // exclusive needs immediate response | ||
30606 | if (props.exclusive) { | ||
30607 | Object.keys(this.currentlyAnimatingKeys).forEach(function (key) { | ||
30608 | _this2.stop(key); | ||
30609 | }); | ||
30610 | } | ||
30611 | var showProp = props.showProp; | ||
30612 | var currentlyAnimatingKeys = this.currentlyAnimatingKeys; | ||
30613 | // last props children if exclusive | ||
30614 | var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children; | ||
30615 | // in case destroy in showProp mode | ||
30616 | var newChildren = []; | ||
30617 | if (showProp) { | ||
30618 | currentChildren.forEach(function (currentChild) { | ||
30619 | var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key); | ||
30620 | var newChild = void 0; | ||
30621 | if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) { | ||
30622 | newChild = _react2["default"].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true)); | ||
30623 | } else { | ||
30624 | newChild = nextChild; | ||
30625 | } | ||
30626 | if (newChild) { | ||
30627 | newChildren.push(newChild); | ||
30628 | } | ||
30629 | }); | ||
30630 | nextChildren.forEach(function (nextChild) { | ||
30631 | if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) { | ||
30632 | newChildren.push(nextChild); | ||
30633 | } | ||
30634 | }); | ||
30635 | } else { | ||
30636 | newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren); | ||
30637 | } | ||
30638 | |||
30639 | // need render to avoid update | ||
30640 | this.setState({ | ||
30641 | children: newChildren | ||
30642 | }); | ||
30643 | |||
30644 | nextChildren.forEach(function (child) { | ||
30645 | var key = child && child.key; | ||
30646 | if (child && currentlyAnimatingKeys[key]) { | ||
30647 | return; | ||
30648 | } | ||
30649 | var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); | ||
30650 | if (showProp) { | ||
30651 | var showInNext = child.props[showProp]; | ||
30652 | if (hasPrev) { | ||
30653 | var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); | ||
30654 | if (!showInNow && showInNext) { | ||
30655 | _this2.keysToEnter.push(key); | ||
30656 | } | ||
30657 | } else if (showInNext) { | ||
30658 | _this2.keysToEnter.push(key); | ||
30659 | } | ||
30660 | } else if (!hasPrev) { | ||
30661 | _this2.keysToEnter.push(key); | ||
30662 | } | ||
30663 | }); | ||
30664 | |||
30665 | currentChildren.forEach(function (child) { | ||
30666 | var key = child && child.key; | ||
30667 | if (child && currentlyAnimatingKeys[key]) { | ||
30668 | return; | ||
30669 | } | ||
30670 | var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key); | ||
30671 | if (showProp) { | ||
30672 | var showInNow = child.props[showProp]; | ||
30673 | if (hasNext) { | ||
30674 | var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp); | ||
30675 | if (!showInNext && showInNow) { | ||
30676 | _this2.keysToLeave.push(key); | ||
30677 | } | ||
30678 | } else if (showInNow) { | ||
30679 | _this2.keysToLeave.push(key); | ||
30680 | } | ||
30681 | } else if (!hasNext) { | ||
30682 | _this2.keysToLeave.push(key); | ||
30683 | } | ||
30684 | }); | ||
30685 | }, | ||
30686 | componentDidUpdate: function componentDidUpdate() { | ||
30687 | var keysToEnter = this.keysToEnter; | ||
30688 | this.keysToEnter = []; | ||
30689 | keysToEnter.forEach(this.performEnter); | ||
30690 | var keysToLeave = this.keysToLeave; | ||
30691 | this.keysToLeave = []; | ||
30692 | keysToLeave.forEach(this.performLeave); | ||
30693 | }, | ||
30694 | performEnter: function performEnter(key) { | ||
30695 | // may already remove by exclusive | ||
30696 | if (this.refs[key]) { | ||
30697 | this.currentlyAnimatingKeys[key] = true; | ||
30698 | this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter')); | ||
30699 | } | ||
30700 | }, | ||
30701 | performAppear: function performAppear(key) { | ||
30702 | if (this.refs[key]) { | ||
30703 | this.currentlyAnimatingKeys[key] = true; | ||
30704 | this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear')); | ||
30705 | } | ||
30706 | }, | ||
30707 | handleDoneAdding: function handleDoneAdding(key, type) { | ||
30708 | var props = this.props; | ||
30709 | delete this.currentlyAnimatingKeys[key]; | ||
30710 | // if update on exclusive mode, skip check | ||
30711 | if (props.exclusive && props !== this.nextProps) { | ||
30712 | return; | ||
30713 | } | ||
30714 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); | ||
30715 | if (!this.isValidChildByKey(currentChildren, key)) { | ||
30716 | // exclusive will not need this | ||
30717 | this.performLeave(key); | ||
30718 | } else { | ||
30719 | if (type === 'appear') { | ||
30720 | if (_util2["default"].allowAppearCallback(props)) { | ||
30721 | props.onAppear(key); | ||
30722 | props.onEnd(key, true); | ||
30723 | } | ||
30724 | } else { | ||
30725 | if (_util2["default"].allowEnterCallback(props)) { | ||
30726 | props.onEnter(key); | ||
30727 | props.onEnd(key, true); | ||
30728 | } | ||
30729 | } | ||
30730 | } | ||
30731 | }, | ||
30732 | performLeave: function performLeave(key) { | ||
30733 | // may already remove by exclusive | ||
30734 | if (this.refs[key]) { | ||
30735 | this.currentlyAnimatingKeys[key] = true; | ||
30736 | this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key)); | ||
30737 | } | ||
30738 | }, | ||
30739 | handleDoneLeaving: function handleDoneLeaving(key) { | ||
30740 | var props = this.props; | ||
30741 | delete this.currentlyAnimatingKeys[key]; | ||
30742 | // if update on exclusive mode, skip check | ||
30743 | if (props.exclusive && props !== this.nextProps) { | ||
30744 | return; | ||
30745 | } | ||
30746 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); | ||
30747 | // in case state change is too fast | ||
30748 | if (this.isValidChildByKey(currentChildren, key)) { | ||
30749 | this.performEnter(key); | ||
30750 | } else { | ||
30751 | var end = function end() { | ||
30752 | if (_util2["default"].allowLeaveCallback(props)) { | ||
30753 | props.onLeave(key); | ||
30754 | props.onEnd(key, false); | ||
30755 | } | ||
30756 | }; | ||
30757 | /* eslint react/no-is-mounted:0 */ | ||
30758 | if (this.isMounted() && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) { | ||
30759 | this.setState({ | ||
30760 | children: currentChildren | ||
30761 | }, end); | ||
30762 | } else { | ||
30763 | end(); | ||
30764 | } | ||
30765 | } | ||
30766 | }, | ||
30767 | isValidChildByKey: function isValidChildByKey(currentChildren, key) { | ||
30768 | var showProp = this.props.showProp; | ||
30769 | if (showProp) { | ||
30770 | return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); | ||
30771 | } | ||
30772 | return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); | ||
30773 | }, | ||
30774 | stop: function stop(key) { | ||
30775 | delete this.currentlyAnimatingKeys[key]; | ||
30776 | var component = this.refs[key]; | ||
30777 | if (component) { | ||
30778 | component.stop(); | ||
30779 | } | ||
30780 | }, | ||
30781 | render: function render() { | ||
30782 | var props = this.props; | ||
30783 | this.nextProps = props; | ||
30784 | var stateChildren = this.state.children; | ||
30785 | var children = null; | ||
30786 | if (stateChildren) { | ||
30787 | children = stateChildren.map(function (child) { | ||
30788 | if (child === null || child === undefined) { | ||
30789 | return child; | ||
30790 | } | ||
30791 | if (!child.key) { | ||
30792 | throw new Error('must set key for <rc-animate> children'); | ||
30793 | } | ||
30794 | return _react2["default"].createElement( | ||
30795 | _AnimateChild2["default"], | ||
30796 | { | ||
30797 | key: child.key, | ||
30798 | ref: child.key, | ||
30799 | animation: props.animation, | ||
30800 | transitionName: props.transitionName, | ||
30801 | transitionEnter: props.transitionEnter, | ||
30802 | transitionAppear: props.transitionAppear, | ||
30803 | transitionLeave: props.transitionLeave | ||
30804 | }, | ||
30805 | child | ||
30806 | ); | ||
30807 | }); | ||
30808 | } | ||
30809 | var Component = props.component; | ||
30810 | if (Component) { | ||
30811 | var passedProps = props; | ||
30812 | if (typeof Component === 'string') { | ||
30813 | passedProps = _extends({ | ||
30814 | className: props.className, | ||
30815 | style: props.style | ||
30816 | }, props.componentProps); | ||
30817 | } | ||
30818 | return _react2["default"].createElement( | ||
30819 | Component, | ||
30820 | passedProps, | ||
30821 | children | ||
30822 | ); | ||
30823 | } | ||
30824 | return children[0] || null; | ||
30825 | } | ||
30826 | }); | ||
30827 | |||
30828 | exports["default"] = Animate; | ||
30829 | module.exports = exports['default']; | ||
30830 | |||
30831 | /***/ }), | ||
30832 | /* 295 */ | ||
30833 | /***/ (function(module, exports, __webpack_require__) { | ||
30834 | |||
30835 | 'use strict'; | ||
30836 | |||
30837 | Object.defineProperty(exports, "__esModule", { | ||
30838 | value: true | ||
30839 | }); | ||
30840 | exports.toArrayChildren = toArrayChildren; | ||
30841 | exports.findChildInChildrenByKey = findChildInChildrenByKey; | ||
30842 | exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey; | ||
30843 | exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey; | ||
30844 | exports.isSameChildren = isSameChildren; | ||
30845 | exports.mergeChildren = mergeChildren; | ||
30846 | |||
30847 | var _react = __webpack_require__(3); | ||
30848 | |||
30849 | var _react2 = _interopRequireDefault(_react); | ||
30850 | |||
30851 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
30852 | |||
30853 | function toArrayChildren(children) { | ||
30854 | var ret = []; | ||
30855 | _react2["default"].Children.forEach(children, function (child) { | ||
30856 | ret.push(child); | ||
30857 | }); | ||
30858 | return ret; | ||
30859 | } | ||
30860 | |||
30861 | function findChildInChildrenByKey(children, key) { | ||
30862 | var ret = null; | ||
30863 | if (children) { | ||
30864 | children.forEach(function (child) { | ||
30865 | if (ret) { | ||
30866 | return; | ||
30867 | } | ||
30868 | if (child && child.key === key) { | ||
30869 | ret = child; | ||
30870 | } | ||
30871 | }); | ||
30872 | } | ||
30873 | return ret; | ||
30874 | } | ||
30875 | |||
30876 | function findShownChildInChildrenByKey(children, key, showProp) { | ||
30877 | var ret = null; | ||
30878 | if (children) { | ||
30879 | children.forEach(function (child) { | ||
30880 | if (child && child.key === key && child.props[showProp]) { | ||
30881 | if (ret) { | ||
30882 | throw new Error('two child with same key for <rc-animate> children'); | ||
30883 | } | ||
30884 | ret = child; | ||
30885 | } | ||
30886 | }); | ||
30887 | } | ||
30888 | return ret; | ||
30889 | } | ||
30890 | |||
30891 | function findHiddenChildInChildrenByKey(children, key, showProp) { | ||
30892 | var found = 0; | ||
30893 | if (children) { | ||
30894 | children.forEach(function (child) { | ||
30895 | if (found) { | ||
30896 | return; | ||
30897 | } | ||
30898 | found = child && child.key === key && !child.props[showProp]; | ||
30899 | }); | ||
30900 | } | ||
30901 | return found; | ||
30902 | } | ||
30903 | |||
30904 | function isSameChildren(c1, c2, showProp) { | ||
30905 | var same = c1.length === c2.length; | ||
30906 | if (same) { | ||
30907 | c1.forEach(function (child, index) { | ||
30908 | var child2 = c2[index]; | ||
30909 | if (child && child2) { | ||
30910 | if (child && !child2 || !child && child2) { | ||
30911 | same = false; | ||
30912 | } else if (child.key !== child2.key) { | ||
30913 | same = false; | ||
30914 | } else if (showProp && child.props[showProp] !== child2.props[showProp]) { | ||
30915 | same = false; | ||
30916 | } | ||
30917 | } | ||
30918 | }); | ||
30919 | } | ||
30920 | return same; | ||
30921 | } | ||
30922 | |||
30923 | function mergeChildren(prev, next) { | ||
30924 | var ret = []; | ||
30925 | |||
30926 | // For each key of `next`, the list of keys to insert before that key in | ||
30927 | // the combined list | ||
30928 | var nextChildrenPending = {}; | ||
30929 | var pendingChildren = []; | ||
30930 | prev.forEach(function (child) { | ||
30931 | if (child && findChildInChildrenByKey(next, child.key)) { | ||
30932 | if (pendingChildren.length) { | ||
30933 | nextChildrenPending[child.key] = pendingChildren; | ||
30934 | pendingChildren = []; | ||
30935 | } | ||
30936 | } else { | ||
30937 | pendingChildren.push(child); | ||
30938 | } | ||
30939 | }); | ||
30940 | |||
30941 | next.forEach(function (child) { | ||
30942 | if (child && nextChildrenPending.hasOwnProperty(child.key)) { | ||
30943 | ret = ret.concat(nextChildrenPending[child.key]); | ||
30944 | } | ||
30945 | ret.push(child); | ||
30946 | }); | ||
30947 | |||
30948 | ret = ret.concat(pendingChildren); | ||
30949 | |||
30950 | return ret; | ||
30951 | } | ||
30952 | |||
30953 | /***/ }), | ||
30954 | /* 296 */ | ||
30955 | /***/ (function(module, exports, __webpack_require__) { | ||
30956 | |||
30957 | 'use strict'; | ||
30958 | |||
30959 | Object.defineProperty(exports, "__esModule", { | ||
30960 | value: true | ||
30961 | }); | ||
30962 | |||
30963 | 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; }; | ||
30964 | |||
30965 | var _react = __webpack_require__(3); | ||
30966 | |||
30967 | var _react2 = _interopRequireDefault(_react); | ||
30968 | |||
30969 | var _reactDom = __webpack_require__(38); | ||
30970 | |||
30971 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
30972 | |||
30973 | var _cssAnimation = __webpack_require__(297); | ||
30974 | |||
30975 | var _cssAnimation2 = _interopRequireDefault(_cssAnimation); | ||
30976 | |||
30977 | var _util = __webpack_require__(301); | ||
30978 | |||
30979 | var _util2 = _interopRequireDefault(_util); | ||
30980 | |||
30981 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
30982 | |||
30983 | var transitionMap = { | ||
30984 | enter: 'transitionEnter', | ||
30985 | appear: 'transitionAppear', | ||
30986 | leave: 'transitionLeave' | ||
30987 | }; | ||
30988 | |||
30989 | var AnimateChild = _react2["default"].createClass({ | ||
30990 | displayName: 'AnimateChild', | ||
30991 | |||
30992 | propTypes: { | ||
30993 | children: _react2["default"].PropTypes.any | ||
30994 | }, | ||
30995 | |||
30996 | componentWillUnmount: function componentWillUnmount() { | ||
30997 | this.stop(); | ||
30998 | }, | ||
30999 | componentWillEnter: function componentWillEnter(done) { | ||
31000 | if (_util2["default"].isEnterSupported(this.props)) { | ||
31001 | this.transition('enter', done); | ||
31002 | } else { | ||
31003 | done(); | ||
31004 | } | ||
31005 | }, | ||
31006 | componentWillAppear: function componentWillAppear(done) { | ||
31007 | if (_util2["default"].isAppearSupported(this.props)) { | ||
31008 | this.transition('appear', done); | ||
31009 | } else { | ||
31010 | done(); | ||
31011 | } | ||
31012 | }, | ||
31013 | componentWillLeave: function componentWillLeave(done) { | ||
31014 | if (_util2["default"].isLeaveSupported(this.props)) { | ||
31015 | this.transition('leave', done); | ||
31016 | } else { | ||
31017 | // always sync, do not interupt with react component life cycle | ||
31018 | // update hidden -> animate hidden -> | ||
31019 | // didUpdate -> animate leave -> unmount (if animate is none) | ||
31020 | done(); | ||
31021 | } | ||
31022 | }, | ||
31023 | transition: function transition(animationType, finishCallback) { | ||
31024 | var _this = this; | ||
31025 | |||
31026 | var node = _reactDom2["default"].findDOMNode(this); | ||
31027 | var props = this.props; | ||
31028 | var transitionName = props.transitionName; | ||
31029 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object'; | ||
31030 | this.stop(); | ||
31031 | var end = function end() { | ||
31032 | _this.stopper = null; | ||
31033 | finishCallback(); | ||
31034 | }; | ||
31035 | if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) { | ||
31036 | var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType; | ||
31037 | var activeName = name + '-active'; | ||
31038 | if (nameIsObj && transitionName[animationType + 'Active']) { | ||
31039 | activeName = transitionName[animationType + 'Active']; | ||
31040 | } | ||
31041 | this.stopper = (0, _cssAnimation2["default"])(node, { | ||
31042 | name: name, | ||
31043 | active: activeName | ||
31044 | }, end); | ||
31045 | } else { | ||
31046 | this.stopper = props.animation[animationType](node, end); | ||
31047 | } | ||
31048 | }, | ||
31049 | stop: function stop() { | ||
31050 | var stopper = this.stopper; | ||
31051 | if (stopper) { | ||
31052 | this.stopper = null; | ||
31053 | stopper.stop(); | ||
31054 | } | ||
31055 | }, | ||
31056 | render: function render() { | ||
31057 | return this.props.children; | ||
31058 | } | ||
31059 | }); | ||
31060 | |||
31061 | exports["default"] = AnimateChild; | ||
31062 | module.exports = exports['default']; | ||
31063 | |||
31064 | /***/ }), | ||
31065 | /* 297 */ | ||
31066 | /***/ (function(module, exports, __webpack_require__) { | ||
31067 | |||
31068 | 'use strict'; | ||
31069 | |||
31070 | Object.defineProperty(exports, "__esModule", { | ||
31071 | value: true | ||
31072 | }); | ||
31073 | |||
31074 | 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; }; | ||
31075 | |||
31076 | var _Event = __webpack_require__(298); | ||
31077 | |||
31078 | var _Event2 = _interopRequireDefault(_Event); | ||
31079 | |||
31080 | var _componentClasses = __webpack_require__(299); | ||
31081 | |||
31082 | var _componentClasses2 = _interopRequireDefault(_componentClasses); | ||
31083 | |||
31084 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
31085 | |||
31086 | var isCssAnimationSupported = _Event2["default"].endEvents.length !== 0; | ||
31087 | |||
31088 | |||
31089 | var capitalPrefixes = ['Webkit', 'Moz', 'O', | ||
31090 | // ms is special .... ! | ||
31091 | 'ms']; | ||
31092 | var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', '']; | ||
31093 | |||
31094 | function getStyleProperty(node, name) { | ||
31095 | // old ff need null, https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle | ||
31096 | var style = window.getComputedStyle(node, null); | ||
31097 | var ret = ''; | ||
31098 | for (var i = 0; i < prefixes.length; i++) { | ||
31099 | ret = style.getPropertyValue(prefixes[i] + name); | ||
31100 | if (ret) { | ||
31101 | break; | ||
31102 | } | ||
31103 | } | ||
31104 | return ret; | ||
31105 | } | ||
31106 | |||
31107 | function fixBrowserByTimeout(node) { | ||
31108 | if (isCssAnimationSupported) { | ||
31109 | var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0; | ||
31110 | var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0; | ||
31111 | var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0; | ||
31112 | var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0; | ||
31113 | var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay); | ||
31114 | // sometimes, browser bug | ||
31115 | node.rcEndAnimTimeout = setTimeout(function () { | ||
31116 | node.rcEndAnimTimeout = null; | ||
31117 | if (node.rcEndListener) { | ||
31118 | node.rcEndListener(); | ||
31119 | } | ||
31120 | }, time * 1000 + 200); | ||
31121 | } | ||
31122 | } | ||
31123 | |||
31124 | function clearBrowserBugTimeout(node) { | ||
31125 | if (node.rcEndAnimTimeout) { | ||
31126 | clearTimeout(node.rcEndAnimTimeout); | ||
31127 | node.rcEndAnimTimeout = null; | ||
31128 | } | ||
31129 | } | ||
31130 | |||
31131 | var cssAnimation = function cssAnimation(node, transitionName, endCallback) { | ||
31132 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object'; | ||
31133 | var className = nameIsObj ? transitionName.name : transitionName; | ||
31134 | var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active'; | ||
31135 | var end = endCallback; | ||
31136 | var start = void 0; | ||
31137 | var active = void 0; | ||
31138 | var nodeClasses = (0, _componentClasses2["default"])(node); | ||
31139 | |||
31140 | if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') { | ||
31141 | end = endCallback.end; | ||
31142 | start = endCallback.start; | ||
31143 | active = endCallback.active; | ||
31144 | } | ||
31145 | |||
31146 | if (node.rcEndListener) { | ||
31147 | node.rcEndListener(); | ||
31148 | } | ||
31149 | |||
31150 | node.rcEndListener = function (e) { | ||
31151 | if (e && e.target !== node) { | ||
31152 | return; | ||
31153 | } | ||
31154 | |||
31155 | if (node.rcAnimTimeout) { | ||
31156 | clearTimeout(node.rcAnimTimeout); | ||
31157 | node.rcAnimTimeout = null; | ||
31158 | } | ||
31159 | |||
31160 | clearBrowserBugTimeout(node); | ||
31161 | |||
31162 | nodeClasses.remove(className); | ||
31163 | nodeClasses.remove(activeClassName); | ||
31164 | |||
31165 | _Event2["default"].removeEndEventListener(node, node.rcEndListener); | ||
31166 | node.rcEndListener = null; | ||
31167 | |||
31168 | // Usually this optional end is used for informing an owner of | ||
31169 | // a leave animation and telling it to remove the child. | ||
31170 | if (end) { | ||
31171 | end(); | ||
31172 | } | ||
31173 | }; | ||
31174 | |||
31175 | _Event2["default"].addEndEventListener(node, node.rcEndListener); | ||
31176 | |||
31177 | if (start) { | ||
31178 | start(); | ||
31179 | } | ||
31180 | nodeClasses.add(className); | ||
31181 | |||
31182 | node.rcAnimTimeout = setTimeout(function () { | ||
31183 | node.rcAnimTimeout = null; | ||
31184 | nodeClasses.add(activeClassName); | ||
31185 | if (active) { | ||
31186 | setTimeout(active, 0); | ||
31187 | } | ||
31188 | fixBrowserByTimeout(node); | ||
31189 | // 30ms for firefox | ||
31190 | }, 30); | ||
31191 | |||
31192 | return { | ||
31193 | stop: function stop() { | ||
31194 | if (node.rcEndListener) { | ||
31195 | node.rcEndListener(); | ||
31196 | } | ||
31197 | } | ||
31198 | }; | ||
31199 | }; | ||
31200 | |||
31201 | cssAnimation.style = function (node, style, callback) { | ||
31202 | if (node.rcEndListener) { | ||
31203 | node.rcEndListener(); | ||
31204 | } | ||
31205 | |||
31206 | node.rcEndListener = function (e) { | ||
31207 | if (e && e.target !== node) { | ||
31208 | return; | ||
31209 | } | ||
31210 | |||
31211 | if (node.rcAnimTimeout) { | ||
31212 | clearTimeout(node.rcAnimTimeout); | ||
31213 | node.rcAnimTimeout = null; | ||
31214 | } | ||
31215 | |||
31216 | clearBrowserBugTimeout(node); | ||
31217 | |||
31218 | _Event2["default"].removeEndEventListener(node, node.rcEndListener); | ||
31219 | node.rcEndListener = null; | ||
31220 | |||
31221 | // Usually this optional callback is used for informing an owner of | ||
31222 | // a leave animation and telling it to remove the child. | ||
31223 | if (callback) { | ||
31224 | callback(); | ||
31225 | } | ||
31226 | }; | ||
31227 | |||
31228 | _Event2["default"].addEndEventListener(node, node.rcEndListener); | ||
31229 | |||
31230 | node.rcAnimTimeout = setTimeout(function () { | ||
31231 | for (var s in style) { | ||
31232 | if (style.hasOwnProperty(s)) { | ||
31233 | node.style[s] = style[s]; | ||
31234 | } | ||
31235 | } | ||
31236 | node.rcAnimTimeout = null; | ||
31237 | fixBrowserByTimeout(node); | ||
31238 | }, 0); | ||
31239 | }; | ||
31240 | |||
31241 | cssAnimation.setTransition = function (node, p, value) { | ||
31242 | var property = p; | ||
31243 | var v = value; | ||
31244 | if (value === undefined) { | ||
31245 | v = property; | ||
31246 | property = ''; | ||
31247 | } | ||
31248 | property = property || ''; | ||
31249 | capitalPrefixes.forEach(function (prefix) { | ||
31250 | node.style[prefix + 'Transition' + property] = v; | ||
31251 | }); | ||
31252 | }; | ||
31253 | |||
31254 | cssAnimation.isCssAnimationSupported = isCssAnimationSupported; | ||
31255 | |||
31256 | exports["default"] = cssAnimation; | ||
31257 | module.exports = exports['default']; | ||
31258 | |||
31259 | /***/ }), | ||
31260 | /* 298 */ | ||
31261 | /***/ (function(module, exports) { | ||
31262 | |||
31263 | 'use strict'; | ||
31264 | |||
31265 | Object.defineProperty(exports, "__esModule", { | ||
31266 | value: true | ||
31267 | }); | ||
31268 | var EVENT_NAME_MAP = { | ||
31269 | transitionend: { | ||
31270 | transition: 'transitionend', | ||
31271 | WebkitTransition: 'webkitTransitionEnd', | ||
31272 | MozTransition: 'mozTransitionEnd', | ||
31273 | OTransition: 'oTransitionEnd', | ||
31274 | msTransition: 'MSTransitionEnd' | ||
31275 | }, | ||
31276 | |||
31277 | animationend: { | ||
31278 | animation: 'animationend', | ||
31279 | WebkitAnimation: 'webkitAnimationEnd', | ||
31280 | MozAnimation: 'mozAnimationEnd', | ||
31281 | OAnimation: 'oAnimationEnd', | ||
31282 | msAnimation: 'MSAnimationEnd' | ||
31283 | } | ||
31284 | }; | ||
31285 | |||
31286 | var endEvents = []; | ||
31287 | |||
31288 | function detectEvents() { | ||
31289 | var testEl = document.createElement('div'); | ||
31290 | var style = testEl.style; | ||
31291 | |||
31292 | if (!('AnimationEvent' in window)) { | ||
31293 | delete EVENT_NAME_MAP.animationend.animation; | ||
31294 | } | ||
31295 | |||
31296 | if (!('TransitionEvent' in window)) { | ||
31297 | delete EVENT_NAME_MAP.transitionend.transition; | ||
31298 | } | ||
31299 | |||
31300 | for (var baseEventName in EVENT_NAME_MAP) { | ||
31301 | if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) { | ||
31302 | var baseEvents = EVENT_NAME_MAP[baseEventName]; | ||
31303 | for (var styleName in baseEvents) { | ||
31304 | if (styleName in style) { | ||
31305 | endEvents.push(baseEvents[styleName]); | ||
31306 | break; | ||
31307 | } | ||
31308 | } | ||
31309 | } | ||
31310 | } | ||
31311 | } | ||
31312 | |||
31313 | if (typeof window !== 'undefined' && typeof document !== 'undefined') { | ||
31314 | detectEvents(); | ||
31315 | } | ||
31316 | |||
31317 | function addEventListener(node, eventName, eventListener) { | ||
31318 | node.addEventListener(eventName, eventListener, false); | ||
31319 | } | ||
31320 | |||
31321 | function removeEventListener(node, eventName, eventListener) { | ||
31322 | node.removeEventListener(eventName, eventListener, false); | ||
31323 | } | ||
31324 | |||
31325 | var TransitionEvents = { | ||
31326 | addEndEventListener: function addEndEventListener(node, eventListener) { | ||
31327 | if (endEvents.length === 0) { | ||
31328 | window.setTimeout(eventListener, 0); | ||
31329 | return; | ||
31330 | } | ||
31331 | endEvents.forEach(function (endEvent) { | ||
31332 | addEventListener(node, endEvent, eventListener); | ||
31333 | }); | ||
31334 | }, | ||
31335 | |||
31336 | |||
31337 | endEvents: endEvents, | ||
31338 | |||
31339 | removeEndEventListener: function removeEndEventListener(node, eventListener) { | ||
31340 | if (endEvents.length === 0) { | ||
31341 | return; | ||
31342 | } | ||
31343 | endEvents.forEach(function (endEvent) { | ||
31344 | removeEventListener(node, endEvent, eventListener); | ||
31345 | }); | ||
31346 | } | ||
31347 | }; | ||
31348 | |||
31349 | exports["default"] = TransitionEvents; | ||
31350 | module.exports = exports['default']; | ||
31351 | |||
31352 | /***/ }), | ||
31353 | /* 299 */ | ||
31354 | /***/ (function(module, exports, __webpack_require__) { | ||
31355 | |||
31356 | /** | ||
31357 | * Module dependencies. | ||
31358 | */ | ||
31359 | |||
31360 | try { | ||
31361 | var index = __webpack_require__(300); | ||
31362 | } catch (err) { | ||
31363 | var index = __webpack_require__(300); | ||
31364 | } | ||
31365 | |||
31366 | /** | ||
31367 | * Whitespace regexp. | ||
31368 | */ | ||
31369 | |||
31370 | var re = /\s+/; | ||
31371 | |||
31372 | /** | ||
31373 | * toString reference. | ||
31374 | */ | ||
31375 | |||
31376 | var toString = Object.prototype.toString; | ||
31377 | |||
31378 | /** | ||
31379 | * Wrap `el` in a `ClassList`. | ||
31380 | * | ||
31381 | * @param {Element} el | ||
31382 | * @return {ClassList} | ||
31383 | * @api public | ||
31384 | */ | ||
31385 | |||
31386 | module.exports = function(el){ | ||
31387 | return new ClassList(el); | ||
31388 | }; | ||
31389 | |||
31390 | /** | ||
31391 | * Initialize a new ClassList for `el`. | ||
31392 | * | ||
31393 | * @param {Element} el | ||
31394 | * @api private | ||
31395 | */ | ||
31396 | |||
31397 | function ClassList(el) { | ||
31398 | if (!el || !el.nodeType) { | ||
31399 | throw new Error('A DOM element reference is required'); | ||
31400 | } | ||
31401 | this.el = el; | ||
31402 | this.list = el.classList; | ||
31403 | } | ||
31404 | |||
31405 | /** | ||
31406 | * Add class `name` if not already present. | ||
31407 | * | ||
31408 | * @param {String} name | ||
31409 | * @return {ClassList} | ||
31410 | * @api public | ||
31411 | */ | ||
31412 | |||
31413 | ClassList.prototype.add = function(name){ | ||
31414 | // classList | ||
31415 | if (this.list) { | ||
31416 | this.list.add(name); | ||
31417 | return this; | ||
31418 | } | ||
31419 | |||
31420 | // fallback | ||
31421 | var arr = this.array(); | ||
31422 | var i = index(arr, name); | ||
31423 | if (!~i) arr.push(name); | ||
31424 | this.el.className = arr.join(' '); | ||
31425 | return this; | ||
31426 | }; | ||
31427 | |||
31428 | /** | ||
31429 | * Remove class `name` when present, or | ||
31430 | * pass a regular expression to remove | ||
31431 | * any which match. | ||
31432 | * | ||
31433 | * @param {String|RegExp} name | ||
31434 | * @return {ClassList} | ||
31435 | * @api public | ||
31436 | */ | ||
31437 | |||
31438 | ClassList.prototype.remove = function(name){ | ||
31439 | if ('[object RegExp]' == toString.call(name)) { | ||
31440 | return this.removeMatching(name); | ||
31441 | } | ||
31442 | |||
31443 | // classList | ||
31444 | if (this.list) { | ||
31445 | this.list.remove(name); | ||
31446 | return this; | ||
31447 | } | ||
31448 | |||
31449 | // fallback | ||
31450 | var arr = this.array(); | ||
31451 | var i = index(arr, name); | ||
31452 | if (~i) arr.splice(i, 1); | ||
31453 | this.el.className = arr.join(' '); | ||
31454 | return this; | ||
31455 | }; | ||
31456 | |||
31457 | /** | ||
31458 | * Remove all classes matching `re`. | ||
31459 | * | ||
31460 | * @param {RegExp} re | ||
31461 | * @return {ClassList} | ||
31462 | * @api private | ||
31463 | */ | ||
31464 | |||
31465 | ClassList.prototype.removeMatching = function(re){ | ||
31466 | var arr = this.array(); | ||
31467 | for (var i = 0; i < arr.length; i++) { | ||
31468 | if (re.test(arr[i])) { | ||
31469 | this.remove(arr[i]); | ||
31470 | } | ||
31471 | } | ||
31472 | return this; | ||
31473 | }; | ||
31474 | |||
31475 | /** | ||
31476 | * Toggle class `name`, can force state via `force`. | ||
31477 | * | ||
31478 | * For browsers that support classList, but do not support `force` yet, | ||
31479 | * the mistake will be detected and corrected. | ||
31480 | * | ||
31481 | * @param {String} name | ||
31482 | * @param {Boolean} force | ||
31483 | * @return {ClassList} | ||
31484 | * @api public | ||
31485 | */ | ||
31486 | |||
31487 | ClassList.prototype.toggle = function(name, force){ | ||
31488 | // classList | ||
31489 | if (this.list) { | ||
31490 | if ("undefined" !== typeof force) { | ||
31491 | if (force !== this.list.toggle(name, force)) { | ||
31492 | this.list.toggle(name); // toggle again to correct | ||
31493 | } | ||
31494 | } else { | ||
31495 | this.list.toggle(name); | ||
31496 | } | ||
31497 | return this; | ||
31498 | } | ||
31499 | |||
31500 | // fallback | ||
31501 | if ("undefined" !== typeof force) { | ||
31502 | if (!force) { | ||
31503 | this.remove(name); | ||
31504 | } else { | ||
31505 | this.add(name); | ||
31506 | } | ||
31507 | } else { | ||
31508 | if (this.has(name)) { | ||
31509 | this.remove(name); | ||
31510 | } else { | ||
31511 | this.add(name); | ||
31512 | } | ||
31513 | } | ||
31514 | |||
31515 | return this; | ||
31516 | }; | ||
31517 | |||
31518 | /** | ||
31519 | * Return an array of classes. | ||
31520 | * | ||
31521 | * @return {Array} | ||
31522 | * @api public | ||
31523 | */ | ||
31524 | |||
31525 | ClassList.prototype.array = function(){ | ||
31526 | var className = this.el.getAttribute('class') || ''; | ||
31527 | var str = className.replace(/^\s+|\s+$/g, ''); | ||
31528 | var arr = str.split(re); | ||
31529 | if ('' === arr[0]) arr.shift(); | ||
31530 | return arr; | ||
31531 | }; | ||
31532 | |||
31533 | /** | ||
31534 | * Check if class `name` is present. | ||
31535 | * | ||
31536 | * @param {String} name | ||
31537 | * @return {ClassList} | ||
31538 | * @api public | ||
31539 | */ | ||
31540 | |||
31541 | ClassList.prototype.has = | ||
31542 | ClassList.prototype.contains = function(name){ | ||
31543 | return this.list | ||
31544 | ? this.list.contains(name) | ||
31545 | : !! ~index(this.array(), name); | ||
31546 | }; | ||
31547 | |||
31548 | |||
31549 | /***/ }), | ||
31550 | /* 300 */ | ||
31551 | /***/ (function(module, exports) { | ||
31552 | |||
31553 | module.exports = function(arr, obj){ | ||
31554 | if (arr.indexOf) return arr.indexOf(obj); | ||
31555 | for (var i = 0; i < arr.length; ++i) { | ||
31556 | if (arr[i] === obj) return i; | ||
31557 | } | ||
31558 | return -1; | ||
31559 | }; | ||
31560 | |||
31561 | /***/ }), | ||
31562 | /* 301 */ | ||
31563 | /***/ (function(module, exports) { | ||
31564 | |||
31565 | "use strict"; | ||
31566 | |||
31567 | Object.defineProperty(exports, "__esModule", { | ||
31568 | value: true | ||
31569 | }); | ||
31570 | var util = { | ||
31571 | isAppearSupported: function isAppearSupported(props) { | ||
31572 | return props.transitionName && props.transitionAppear || props.animation.appear; | ||
31573 | }, | ||
31574 | isEnterSupported: function isEnterSupported(props) { | ||
31575 | return props.transitionName && props.transitionEnter || props.animation.enter; | ||
31576 | }, | ||
31577 | isLeaveSupported: function isLeaveSupported(props) { | ||
31578 | return props.transitionName && props.transitionLeave || props.animation.leave; | ||
31579 | }, | ||
31580 | allowAppearCallback: function allowAppearCallback(props) { | ||
31581 | return props.transitionAppear || props.animation.appear; | ||
31582 | }, | ||
31583 | allowEnterCallback: function allowEnterCallback(props) { | ||
31584 | return props.transitionEnter || props.animation.enter; | ||
31585 | }, | ||
31586 | allowLeaveCallback: function allowLeaveCallback(props) { | ||
31587 | return props.transitionLeave || props.animation.leave; | ||
31588 | } | ||
31589 | }; | ||
31590 | exports["default"] = util; | ||
31591 | module.exports = exports['default']; | ||
31592 | |||
31593 | /***/ }), | ||
31594 | /* 302 */ | ||
31595 | /***/ (function(module, exports, __webpack_require__) { | ||
31596 | |||
31597 | 'use strict'; | ||
31598 | |||
31599 | Object.defineProperty(exports, "__esModule", { | ||
31600 | value: true | ||
31601 | }); | ||
31602 | |||
31603 | var _react = __webpack_require__(3); | ||
31604 | |||
31605 | var _react2 = _interopRequireDefault(_react); | ||
31606 | |||
31607 | var _LazyRenderBox = __webpack_require__(303); | ||
31608 | |||
31609 | var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox); | ||
31610 | |||
31611 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
31612 | |||
31613 | var PopupInner = _react2["default"].createClass({ | ||
31614 | displayName: 'PopupInner', | ||
31615 | |||
31616 | propTypes: { | ||
31617 | hiddenClassName: _react.PropTypes.string, | ||
31618 | className: _react.PropTypes.string, | ||
31619 | prefixCls: _react.PropTypes.string, | ||
31620 | onMouseEnter: _react.PropTypes.func, | ||
31621 | onMouseLeave: _react.PropTypes.func, | ||
31622 | children: _react.PropTypes.any | ||
31623 | }, | ||
31624 | render: function render() { | ||
31625 | var props = this.props; | ||
31626 | var className = props.className; | ||
31627 | if (!props.visible) { | ||
31628 | className += ' ' + props.hiddenClassName; | ||
31629 | } | ||
31630 | return _react2["default"].createElement( | ||
31631 | 'div', | ||
31632 | { | ||
31633 | className: className, | ||
31634 | onMouseEnter: props.onMouseEnter, | ||
31635 | onMouseLeave: props.onMouseLeave, | ||
31636 | style: props.style | ||
31637 | }, | ||
31638 | _react2["default"].createElement( | ||
31639 | _LazyRenderBox2["default"], | ||
31640 | { className: props.prefixCls + '-content', visible: props.visible }, | ||
31641 | props.children | ||
31642 | ) | ||
31643 | ); | ||
31644 | } | ||
31645 | }); | ||
31646 | |||
31647 | exports["default"] = PopupInner; | ||
31648 | module.exports = exports['default']; | ||
31649 | |||
31650 | /***/ }), | ||
31651 | /* 303 */ | ||
31652 | /***/ (function(module, exports, __webpack_require__) { | ||
31653 | |||
31654 | 'use strict'; | ||
31655 | |||
31656 | Object.defineProperty(exports, "__esModule", { | ||
31657 | value: true | ||
31658 | }); | ||
31659 | |||
31660 | var _objectWithoutProperties2 = __webpack_require__(304); | ||
31661 | |||
31662 | var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); | ||
31663 | |||
31664 | var _react = __webpack_require__(3); | ||
31665 | |||
31666 | var _react2 = _interopRequireDefault(_react); | ||
31667 | |||
31668 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
31669 | |||
31670 | var LazyRenderBox = _react2["default"].createClass({ | ||
31671 | displayName: 'LazyRenderBox', | ||
31672 | |||
31673 | propTypes: { | ||
31674 | children: _react.PropTypes.any, | ||
31675 | className: _react.PropTypes.string, | ||
31676 | visible: _react.PropTypes.bool, | ||
31677 | hiddenClassName: _react.PropTypes.string | ||
31678 | }, | ||
31679 | shouldComponentUpdate: function shouldComponentUpdate(nextProps) { | ||
31680 | return nextProps.hiddenClassName || nextProps.visible; | ||
31681 | }, | ||
31682 | render: function render() { | ||
31683 | var _props = this.props, | ||
31684 | hiddenClassName = _props.hiddenClassName, | ||
31685 | visible = _props.visible, | ||
31686 | props = (0, _objectWithoutProperties3["default"])(_props, ['hiddenClassName', 'visible']); | ||
31687 | |||
31688 | |||
31689 | if (hiddenClassName || _react2["default"].Children.count(props.children) > 1) { | ||
31690 | if (!visible && hiddenClassName) { | ||
31691 | props.className += ' ' + hiddenClassName; | ||
31692 | } | ||
31693 | return _react2["default"].createElement('div', props); | ||
31694 | } | ||
31695 | |||
31696 | return _react2["default"].Children.only(props.children); | ||
31697 | } | ||
31698 | }); | ||
31699 | |||
31700 | exports["default"] = LazyRenderBox; | ||
31701 | module.exports = exports['default']; | ||
31702 | |||
31703 | /***/ }), | ||
31704 | /* 304 */ | ||
31705 | /***/ (function(module, exports) { | ||
31706 | |||
31707 | "use strict"; | ||
31708 | |||
31709 | exports.__esModule = true; | ||
31710 | |||
31711 | exports.default = function (obj, keys) { | ||
31712 | var target = {}; | ||
31713 | |||
31714 | for (var i in obj) { | ||
31715 | if (keys.indexOf(i) >= 0) continue; | ||
31716 | if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; | ||
31717 | target[i] = obj[i]; | ||
31718 | } | ||
31719 | |||
31720 | return target; | ||
31721 | }; | ||
31722 | |||
31723 | /***/ }), | ||
31724 | /* 305 */ | ||
31725 | /***/ (function(module, exports, __webpack_require__) { | ||
31726 | |||
31727 | 'use strict'; | ||
31728 | |||
31729 | Object.defineProperty(exports, "__esModule", { | ||
31730 | value: true | ||
31731 | }); | ||
31732 | |||
31733 | var _extends2 = __webpack_require__(270); | ||
31734 | |||
31735 | var _extends3 = _interopRequireDefault(_extends2); | ||
31736 | |||
31737 | exports.getAlignFromPlacement = getAlignFromPlacement; | ||
31738 | exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign; | ||
31739 | |||
31740 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
31741 | |||
31742 | function isPointsEq(a1, a2) { | ||
31743 | return a1[0] === a2[0] && a1[1] === a2[1]; | ||
31744 | } | ||
31745 | |||
31746 | function getAlignFromPlacement(builtinPlacements, placementStr, align) { | ||
31747 | var baseAlign = builtinPlacements[placementStr] || {}; | ||
31748 | return (0, _extends3["default"])({}, baseAlign, align); | ||
31749 | } | ||
31750 | |||
31751 | function getPopupClassNameFromAlign(builtinPlacements, prefixCls, align) { | ||
31752 | var points = align.points; | ||
31753 | for (var placement in builtinPlacements) { | ||
31754 | if (builtinPlacements.hasOwnProperty(placement)) { | ||
31755 | if (isPointsEq(builtinPlacements[placement].points, points)) { | ||
31756 | return prefixCls + '-placement-' + placement; | ||
31757 | } | ||
31758 | } | ||
31759 | } | ||
31760 | return ''; | ||
31761 | } | ||
31762 | |||
31763 | /***/ }), | ||
31764 | /* 306 */ | ||
31765 | /***/ (function(module, exports, __webpack_require__) { | ||
31766 | |||
31767 | 'use strict'; | ||
31768 | |||
31769 | Object.defineProperty(exports, "__esModule", { | ||
31770 | value: true | ||
31771 | }); | ||
31772 | |||
31773 | 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; }; | ||
31774 | |||
31775 | exports["default"] = getContainerRenderMixin; | ||
31776 | |||
31777 | var _reactDom = __webpack_require__(38); | ||
31778 | |||
31779 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
31780 | |||
31781 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
31782 | |||
31783 | function defaultGetContainer() { | ||
31784 | var container = document.createElement('div'); | ||
31785 | document.body.appendChild(container); | ||
31786 | return container; | ||
31787 | } | ||
31788 | |||
31789 | function getContainerRenderMixin(config) { | ||
31790 | var _config$autoMount = config.autoMount, | ||
31791 | autoMount = _config$autoMount === undefined ? true : _config$autoMount, | ||
31792 | _config$autoDestroy = config.autoDestroy, | ||
31793 | autoDestroy = _config$autoDestroy === undefined ? true : _config$autoDestroy, | ||
31794 | isVisible = config.isVisible, | ||
31795 | getComponent = config.getComponent, | ||
31796 | _config$getContainer = config.getContainer, | ||
31797 | getContainer = _config$getContainer === undefined ? defaultGetContainer : _config$getContainer; | ||
31798 | |||
31799 | |||
31800 | var mixin = void 0; | ||
31801 | |||
31802 | function _renderComponent(instance, componentArg, ready) { | ||
31803 | if (!isVisible || instance._component || isVisible(instance)) { | ||
31804 | if (!instance._container) { | ||
31805 | instance._container = getContainer(instance); | ||
31806 | } | ||
31807 | var component = void 0; | ||
31808 | if (instance.getComponent) { | ||
31809 | component = instance.getComponent(componentArg); | ||
31810 | } else { | ||
31811 | component = getComponent(instance, componentArg); | ||
31812 | } | ||
31813 | _reactDom2["default"].unstable_renderSubtreeIntoContainer(instance, component, instance._container, function callback() { | ||
31814 | instance._component = this; | ||
31815 | if (ready) { | ||
31816 | ready.call(this); | ||
31817 | } | ||
31818 | }); | ||
31819 | } | ||
31820 | } | ||
31821 | |||
31822 | if (autoMount) { | ||
31823 | mixin = _extends({}, mixin, { | ||
31824 | componentDidMount: function componentDidMount() { | ||
31825 | _renderComponent(this); | ||
31826 | }, | ||
31827 | componentDidUpdate: function componentDidUpdate() { | ||
31828 | _renderComponent(this); | ||
31829 | } | ||
31830 | }); | ||
31831 | } | ||
31832 | |||
31833 | if (!autoMount || !autoDestroy) { | ||
31834 | mixin = _extends({}, mixin, { | ||
31835 | renderComponent: function renderComponent(componentArg, ready) { | ||
31836 | _renderComponent(this, componentArg, ready); | ||
31837 | } | ||
31838 | }); | ||
31839 | } | ||
31840 | |||
31841 | function _removeContainer(instance) { | ||
31842 | if (instance._container) { | ||
31843 | var container = instance._container; | ||
31844 | _reactDom2["default"].unmountComponentAtNode(container); | ||
31845 | container.parentNode.removeChild(container); | ||
31846 | instance._container = null; | ||
31847 | } | ||
31848 | } | ||
31849 | |||
31850 | if (autoDestroy) { | ||
31851 | mixin = _extends({}, mixin, { | ||
31852 | componentWillUnmount: function componentWillUnmount() { | ||
31853 | _removeContainer(this); | ||
31854 | } | ||
31855 | }); | ||
31856 | } else { | ||
31857 | mixin = _extends({}, mixin, { | ||
31858 | removeContainer: function removeContainer() { | ||
31859 | _removeContainer(this); | ||
31860 | } | ||
31861 | }); | ||
31862 | } | ||
31863 | |||
31864 | return mixin; | ||
31865 | } | ||
31866 | module.exports = exports['default']; | ||
31867 | |||
31868 | /***/ }), | ||
31869 | /* 307 */ | ||
31870 | /***/ (function(module, exports, __webpack_require__) { | ||
31871 | |||
31872 | 'use strict'; | ||
31873 | |||
31874 | Object.defineProperty(exports, "__esModule", { | ||
31875 | value: true | ||
31876 | }); | ||
31877 | |||
31878 | var _defineProperty2 = __webpack_require__(308); | ||
31879 | |||
31880 | var _defineProperty3 = _interopRequireDefault(_defineProperty2); | ||
31881 | |||
31882 | var _classCallCheck2 = __webpack_require__(188); | ||
31883 | |||
31884 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
31885 | |||
31886 | var _possibleConstructorReturn2 = __webpack_require__(189); | ||
31887 | |||
31888 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
31889 | |||
31890 | var _inherits2 = __webpack_require__(258); | ||
31891 | |||
31892 | var _inherits3 = _interopRequireDefault(_inherits2); | ||
31893 | |||
31894 | var _react = __webpack_require__(3); | ||
31895 | |||
31896 | var _react2 = _interopRequireDefault(_react); | ||
31897 | |||
31898 | var _propTypes = __webpack_require__(266); | ||
31899 | |||
31900 | var _propTypes2 = _interopRequireDefault(_propTypes); | ||
31901 | |||
31902 | var _Header = __webpack_require__(312); | ||
31903 | |||
31904 | var _Header2 = _interopRequireDefault(_Header); | ||
31905 | |||
31906 | var _Combobox = __webpack_require__(313); | ||
31907 | |||
31908 | var _Combobox2 = _interopRequireDefault(_Combobox); | ||
31909 | |||
31910 | var _moment = __webpack_require__(184); | ||
31911 | |||
31912 | var _moment2 = _interopRequireDefault(_moment); | ||
31913 | |||
31914 | var _classnames = __webpack_require__(315); | ||
31915 | |||
31916 | var _classnames2 = _interopRequireDefault(_classnames); | ||
31917 | |||
31918 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
31919 | |||
31920 | function noop() {} | ||
31921 | |||
31922 | function generateOptions(length, disabledOptions, hideDisabledOptions) { | ||
31923 | var arr = []; | ||
31924 | for (var value = 0; value < length; value++) { | ||
31925 | if (!disabledOptions || disabledOptions.indexOf(value) < 0 || !hideDisabledOptions) { | ||
31926 | arr.push(value); | ||
31927 | } | ||
31928 | } | ||
31929 | return arr; | ||
31930 | } | ||
31931 | |||
31932 | var Panel = function (_Component) { | ||
31933 | (0, _inherits3.default)(Panel, _Component); | ||
31934 | |||
31935 | function Panel(props) { | ||
31936 | (0, _classCallCheck3.default)(this, Panel); | ||
31937 | |||
31938 | var _this = (0, _possibleConstructorReturn3.default)(this, _Component.call(this, props)); | ||
31939 | |||
31940 | _this.onChange = function (newValue) { | ||
31941 | _this.setState({ value: newValue }); | ||
31942 | _this.props.onChange(newValue); | ||
31943 | }; | ||
31944 | |||
31945 | _this.onCurrentSelectPanelChange = function (currentSelectPanel) { | ||
31946 | _this.setState({ currentSelectPanel: currentSelectPanel }); | ||
31947 | }; | ||
31948 | |||
31949 | _this.state = { | ||
31950 | value: props.value, | ||
31951 | selectionRange: [] | ||
31952 | }; | ||
31953 | return _this; | ||
31954 | } | ||
31955 | |||
31956 | Panel.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
31957 | var value = nextProps.value; | ||
31958 | if (value) { | ||
31959 | this.setState({ | ||
31960 | value: value | ||
31961 | }); | ||
31962 | } | ||
31963 | }; | ||
31964 | |||
31965 | // https://github.com/ant-design/ant-design/issues/5829 | ||
31966 | Panel.prototype.close = function close() { | ||
31967 | this.props.onEsc(); | ||
31968 | }; | ||
31969 | |||
31970 | Panel.prototype.render = function render() { | ||
31971 | var _classNames; | ||
31972 | |||
31973 | var _props = this.props, | ||
31974 | prefixCls = _props.prefixCls, | ||
31975 | className = _props.className, | ||
31976 | placeholder = _props.placeholder, | ||
31977 | disabledHours = _props.disabledHours, | ||
31978 | disabledMinutes = _props.disabledMinutes, | ||
31979 | disabledSeconds = _props.disabledSeconds, | ||
31980 | hideDisabledOptions = _props.hideDisabledOptions, | ||
31981 | allowEmpty = _props.allowEmpty, | ||
31982 | showHour = _props.showHour, | ||
31983 | showMinute = _props.showMinute, | ||
31984 | showSecond = _props.showSecond, | ||
31985 | format = _props.format, | ||
31986 | defaultOpenValue = _props.defaultOpenValue, | ||
31987 | clearText = _props.clearText, | ||
31988 | onEsc = _props.onEsc, | ||
31989 | addon = _props.addon, | ||
31990 | use12Hours = _props.use12Hours, | ||
31991 | onClear = _props.onClear; | ||
31992 | var _state = this.state, | ||
31993 | value = _state.value, | ||
31994 | currentSelectPanel = _state.currentSelectPanel; | ||
31995 | |||
31996 | var disabledHourOptions = disabledHours(); | ||
31997 | var disabledMinuteOptions = disabledMinutes(value ? value.hour() : null); | ||
31998 | var disabledSecondOptions = disabledSeconds(value ? value.hour() : null, value ? value.minute() : null); | ||
31999 | var hourOptions = generateOptions(24, disabledHourOptions, hideDisabledOptions); | ||
32000 | var minuteOptions = generateOptions(60, disabledMinuteOptions, hideDisabledOptions); | ||
32001 | var secondOptions = generateOptions(60, disabledSecondOptions, hideDisabledOptions); | ||
32002 | |||
32003 | return _react2.default.createElement( | ||
32004 | 'div', | ||
32005 | { className: (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-inner', true), (0, _defineProperty3.default)(_classNames, className, !!className), _classNames)) }, | ||
32006 | _react2.default.createElement(_Header2.default, { | ||
32007 | clearText: clearText, | ||
32008 | prefixCls: prefixCls, | ||
32009 | defaultOpenValue: defaultOpenValue, | ||
32010 | value: value, | ||
32011 | currentSelectPanel: currentSelectPanel, | ||
32012 | onEsc: onEsc, | ||
32013 | format: format, | ||
32014 | placeholder: placeholder, | ||
32015 | hourOptions: hourOptions, | ||
32016 | minuteOptions: minuteOptions, | ||
32017 | secondOptions: secondOptions, | ||
32018 | disabledHours: disabledHours, | ||
32019 | disabledMinutes: disabledMinutes, | ||
32020 | disabledSeconds: disabledSeconds, | ||
32021 | onChange: this.onChange, | ||
32022 | onClear: onClear, | ||
32023 | allowEmpty: allowEmpty | ||
32024 | }), | ||
32025 | _react2.default.createElement(_Combobox2.default, { | ||
32026 | prefixCls: prefixCls, | ||
32027 | value: value, | ||
32028 | defaultOpenValue: defaultOpenValue, | ||
32029 | format: format, | ||
32030 | onChange: this.onChange, | ||
32031 | showHour: showHour, | ||
32032 | showMinute: showMinute, | ||
32033 | showSecond: showSecond, | ||
32034 | hourOptions: hourOptions, | ||
32035 | minuteOptions: minuteOptions, | ||
32036 | secondOptions: secondOptions, | ||
32037 | disabledHours: disabledHours, | ||
32038 | disabledMinutes: disabledMinutes, | ||
32039 | disabledSeconds: disabledSeconds, | ||
32040 | onCurrentSelectPanelChange: this.onCurrentSelectPanelChange, | ||
32041 | use12Hours: use12Hours | ||
32042 | }), | ||
32043 | addon(this) | ||
32044 | ); | ||
32045 | }; | ||
32046 | |||
32047 | return Panel; | ||
32048 | }(_react.Component); | ||
32049 | |||
32050 | Panel.propTypes = { | ||
32051 | clearText: _propTypes2.default.string, | ||
32052 | prefixCls: _propTypes2.default.string, | ||
32053 | className: _propTypes2.default.string, | ||
32054 | defaultOpenValue: _propTypes2.default.object, | ||
32055 | value: _propTypes2.default.object, | ||
32056 | placeholder: _propTypes2.default.string, | ||
32057 | format: _propTypes2.default.string, | ||
32058 | disabledHours: _propTypes2.default.func, | ||
32059 | disabledMinutes: _propTypes2.default.func, | ||
32060 | disabledSeconds: _propTypes2.default.func, | ||
32061 | hideDisabledOptions: _propTypes2.default.bool, | ||
32062 | onChange: _propTypes2.default.func, | ||
32063 | onEsc: _propTypes2.default.func, | ||
32064 | allowEmpty: _propTypes2.default.bool, | ||
32065 | showHour: _propTypes2.default.bool, | ||
32066 | showMinute: _propTypes2.default.bool, | ||
32067 | showSecond: _propTypes2.default.bool, | ||
32068 | onClear: _propTypes2.default.func, | ||
32069 | use12Hours: _propTypes2.default.bool, | ||
32070 | addon: _propTypes2.default.func | ||
32071 | }; | ||
32072 | Panel.defaultProps = { | ||
32073 | prefixCls: 'rc-time-picker-panel', | ||
32074 | onChange: noop, | ||
32075 | onClear: noop, | ||
32076 | disabledHours: noop, | ||
32077 | disabledMinutes: noop, | ||
32078 | disabledSeconds: noop, | ||
32079 | defaultOpenValue: (0, _moment2.default)(), | ||
32080 | use12Hours: false, | ||
32081 | addon: noop | ||
32082 | }; | ||
32083 | exports.default = Panel; | ||
32084 | module.exports = exports['default']; | ||
32085 | |||
32086 | /***/ }), | ||
32087 | /* 308 */ | ||
32088 | /***/ (function(module, exports, __webpack_require__) { | ||
32089 | |||
32090 | "use strict"; | ||
32091 | |||
32092 | exports.__esModule = true; | ||
32093 | |||
32094 | var _defineProperty = __webpack_require__(309); | ||
32095 | |||
32096 | var _defineProperty2 = _interopRequireDefault(_defineProperty); | ||
32097 | |||
32098 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
32099 | |||
32100 | exports.default = function (obj, key, value) { | ||
32101 | if (key in obj) { | ||
32102 | (0, _defineProperty2.default)(obj, key, { | ||
32103 | value: value, | ||
32104 | enumerable: true, | ||
32105 | configurable: true, | ||
32106 | writable: true | ||
32107 | }); | ||
32108 | } else { | ||
32109 | obj[key] = value; | ||
32110 | } | ||
32111 | |||
32112 | return obj; | ||
32113 | }; | ||
32114 | |||
32115 | /***/ }), | ||
32116 | /* 309 */ | ||
32117 | /***/ (function(module, exports, __webpack_require__) { | ||
32118 | |||
32119 | module.exports = { "default": __webpack_require__(310), __esModule: true }; | ||
32120 | |||
32121 | /***/ }), | ||
32122 | /* 310 */ | ||
32123 | /***/ (function(module, exports, __webpack_require__) { | ||
32124 | |||
32125 | __webpack_require__(311); | ||
32126 | var $Object = __webpack_require__(201).Object; | ||
32127 | module.exports = function defineProperty(it, key, desc){ | ||
32128 | return $Object.defineProperty(it, key, desc); | ||
32129 | }; | ||
32130 | |||
32131 | /***/ }), | ||
32132 | /* 311 */ | ||
32133 | /***/ (function(module, exports, __webpack_require__) { | ||
32134 | |||
32135 | var $export = __webpack_require__(199); | ||
32136 | // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) | ||
32137 | $export($export.S + $export.F * !__webpack_require__(209), 'Object', {defineProperty: __webpack_require__(205).f}); | ||
32138 | |||
32139 | /***/ }), | ||
32140 | /* 312 */ | ||
32141 | /***/ (function(module, exports, __webpack_require__) { | ||
32142 | |||
32143 | 'use strict'; | ||
32144 | |||
32145 | Object.defineProperty(exports, "__esModule", { | ||
32146 | value: true | ||
32147 | }); | ||
32148 | |||
32149 | var _classCallCheck2 = __webpack_require__(188); | ||
32150 | |||
32151 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
32152 | |||
32153 | var _possibleConstructorReturn2 = __webpack_require__(189); | ||
32154 | |||
32155 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
32156 | |||
32157 | var _inherits2 = __webpack_require__(258); | ||
32158 | |||
32159 | var _inherits3 = _interopRequireDefault(_inherits2); | ||
32160 | |||
32161 | var _react = __webpack_require__(3); | ||
32162 | |||
32163 | var _react2 = _interopRequireDefault(_react); | ||
32164 | |||
32165 | var _propTypes = __webpack_require__(266); | ||
32166 | |||
32167 | var _propTypes2 = _interopRequireDefault(_propTypes); | ||
32168 | |||
32169 | var _moment = __webpack_require__(184); | ||
32170 | |||
32171 | var _moment2 = _interopRequireDefault(_moment); | ||
32172 | |||
32173 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
32174 | |||
32175 | var Header = function (_Component) { | ||
32176 | (0, _inherits3.default)(Header, _Component); | ||
32177 | |||
32178 | function Header(props) { | ||
32179 | (0, _classCallCheck3.default)(this, Header); | ||
32180 | |||
32181 | var _this = (0, _possibleConstructorReturn3.default)(this, _Component.call(this, props)); | ||
32182 | |||
32183 | _initialiseProps.call(_this); | ||
32184 | |||
32185 | var value = props.value, | ||
32186 | format = props.format; | ||
32187 | |||
32188 | _this.state = { | ||
32189 | str: value && value.format(format) || '', | ||
32190 | invalid: false | ||
32191 | }; | ||
32192 | return _this; | ||
32193 | } | ||
32194 | |||
32195 | Header.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
32196 | var value = nextProps.value, | ||
32197 | format = nextProps.format; | ||
32198 | |||
32199 | this.setState({ | ||
32200 | str: value && value.format(format) || '', | ||
32201 | invalid: false | ||
32202 | }); | ||
32203 | }; | ||
32204 | |||
32205 | Header.prototype.getClearButton = function getClearButton() { | ||
32206 | var _props = this.props, | ||
32207 | prefixCls = _props.prefixCls, | ||
32208 | allowEmpty = _props.allowEmpty; | ||
32209 | |||
32210 | if (!allowEmpty) { | ||
32211 | return null; | ||
32212 | } | ||
32213 | return _react2.default.createElement('a', { | ||
32214 | className: prefixCls + '-clear-btn', | ||
32215 | role: 'button', | ||
32216 | title: this.props.clearText, | ||
32217 | onMouseDown: this.onClear | ||
32218 | }); | ||
32219 | }; | ||
32220 | |||
32221 | Header.prototype.getProtoValue = function getProtoValue() { | ||
32222 | return this.props.value || this.props.defaultOpenValue; | ||
32223 | }; | ||
32224 | |||
32225 | Header.prototype.getInput = function getInput() { | ||
32226 | var _props2 = this.props, | ||
32227 | prefixCls = _props2.prefixCls, | ||
32228 | placeholder = _props2.placeholder; | ||
32229 | var _state = this.state, | ||
32230 | invalid = _state.invalid, | ||
32231 | str = _state.str; | ||
32232 | |||
32233 | var invalidClass = invalid ? prefixCls + '-input-invalid' : ''; | ||
32234 | return _react2.default.createElement('input', { | ||
32235 | className: prefixCls + '-input ' + invalidClass, | ||
32236 | ref: 'input', | ||
32237 | onKeyDown: this.onKeyDown, | ||
32238 | value: str, | ||
32239 | placeholder: placeholder, | ||
32240 | onChange: this.onInputChange | ||
32241 | }); | ||
32242 | }; | ||
32243 | |||
32244 | Header.prototype.render = function render() { | ||
32245 | var prefixCls = this.props.prefixCls; | ||
32246 | |||
32247 | return _react2.default.createElement( | ||
32248 | 'div', | ||
32249 | { className: prefixCls + '-input-wrap' }, | ||
32250 | this.getInput(), | ||
32251 | this.getClearButton() | ||
32252 | ); | ||
32253 | }; | ||
32254 | |||
32255 | return Header; | ||
32256 | }(_react.Component); | ||
32257 | |||
32258 | Header.propTypes = { | ||
32259 | format: _propTypes2.default.string, | ||
32260 | prefixCls: _propTypes2.default.string, | ||
32261 | disabledDate: _propTypes2.default.func, | ||
32262 | placeholder: _propTypes2.default.string, | ||
32263 | clearText: _propTypes2.default.string, | ||
32264 | value: _propTypes2.default.object, | ||
32265 | hourOptions: _propTypes2.default.array, | ||
32266 | minuteOptions: _propTypes2.default.array, | ||
32267 | secondOptions: _propTypes2.default.array, | ||
32268 | disabledHours: _propTypes2.default.func, | ||
32269 | disabledMinutes: _propTypes2.default.func, | ||
32270 | disabledSeconds: _propTypes2.default.func, | ||
32271 | onChange: _propTypes2.default.func, | ||
32272 | onClear: _propTypes2.default.func, | ||
32273 | onEsc: _propTypes2.default.func, | ||
32274 | allowEmpty: _propTypes2.default.bool, | ||
32275 | defaultOpenValue: _propTypes2.default.object, | ||
32276 | currentSelectPanel: _propTypes2.default.string | ||
32277 | }; | ||
32278 | |||
32279 | var _initialiseProps = function _initialiseProps() { | ||
32280 | var _this2 = this; | ||
32281 | |||
32282 | this.onInputChange = function (event) { | ||
32283 | var str = event.target.value; | ||
32284 | _this2.setState({ | ||
32285 | str: str | ||
32286 | }); | ||
32287 | var _props3 = _this2.props, | ||
32288 | format = _props3.format, | ||
32289 | hourOptions = _props3.hourOptions, | ||
32290 | minuteOptions = _props3.minuteOptions, | ||
32291 | secondOptions = _props3.secondOptions, | ||
32292 | disabledHours = _props3.disabledHours, | ||
32293 | disabledMinutes = _props3.disabledMinutes, | ||
32294 | disabledSeconds = _props3.disabledSeconds, | ||
32295 | onChange = _props3.onChange, | ||
32296 | allowEmpty = _props3.allowEmpty; | ||
32297 | |||
32298 | |||
32299 | if (str) { | ||
32300 | var originalValue = _this2.props.value; | ||
32301 | var value = _this2.getProtoValue().clone(); | ||
32302 | var parsed = (0, _moment2.default)(str, format, true); | ||
32303 | if (!parsed.isValid()) { | ||
32304 | _this2.setState({ | ||
32305 | invalid: true | ||
32306 | }); | ||
32307 | return; | ||
32308 | } | ||
32309 | value.hour(parsed.hour()).minute(parsed.minute()).second(parsed.second()); | ||
32310 | |||
32311 | // if time value not allowed, response warning. | ||
32312 | if (hourOptions.indexOf(value.hour()) < 0 || minuteOptions.indexOf(value.minute()) < 0 || secondOptions.indexOf(value.second()) < 0) { | ||
32313 | _this2.setState({ | ||
32314 | invalid: true | ||
32315 | }); | ||
32316 | return; | ||
32317 | } | ||
32318 | |||
32319 | // if time value is disabled, response warning. | ||
32320 | var disabledHourOptions = disabledHours(); | ||
32321 | var disabledMinuteOptions = disabledMinutes(value.hour()); | ||
32322 | var disabledSecondOptions = disabledSeconds(value.hour(), value.minute()); | ||
32323 | if (disabledHourOptions && disabledHourOptions.indexOf(value.hour()) >= 0 || disabledMinuteOptions && disabledMinuteOptions.indexOf(value.minute()) >= 0 || disabledSecondOptions && disabledSecondOptions.indexOf(value.second()) >= 0) { | ||
32324 | _this2.setState({ | ||
32325 | invalid: true | ||
32326 | }); | ||
32327 | return; | ||
32328 | } | ||
32329 | |||
32330 | if (originalValue) { | ||
32331 | if (originalValue.hour() !== value.hour() || originalValue.minute() !== value.minute() || originalValue.second() !== value.second()) { | ||
32332 | // keep other fields for rc-calendar | ||
32333 | var changedValue = originalValue.clone(); | ||
32334 | changedValue.hour(value.hour()); | ||
32335 | changedValue.minute(value.minute()); | ||
32336 | changedValue.second(value.second()); | ||
32337 | onChange(changedValue); | ||
32338 | } | ||
32339 | } else if (originalValue !== value) { | ||
32340 | onChange(value); | ||
32341 | } | ||
32342 | } else if (allowEmpty) { | ||
32343 | onChange(null); | ||
32344 | } else { | ||
32345 | _this2.setState({ | ||
32346 | invalid: true | ||
32347 | }); | ||
32348 | return; | ||
32349 | } | ||
32350 | |||
32351 | _this2.setState({ | ||
32352 | invalid: false | ||
32353 | }); | ||
32354 | }; | ||
32355 | |||
32356 | this.onKeyDown = function (e) { | ||
32357 | if (e.keyCode === 27) { | ||
32358 | _this2.props.onEsc(); | ||
32359 | } | ||
32360 | }; | ||
32361 | |||
32362 | this.onClear = function () { | ||
32363 | _this2.setState({ str: '' }); | ||
32364 | _this2.props.onClear(); | ||
32365 | }; | ||
32366 | }; | ||
32367 | |||
32368 | exports.default = Header; | ||
32369 | module.exports = exports['default']; | ||
32370 | |||
32371 | /***/ }), | ||
32372 | /* 313 */ | ||
32373 | /***/ (function(module, exports, __webpack_require__) { | ||
32374 | |||
32375 | 'use strict'; | ||
32376 | |||
32377 | Object.defineProperty(exports, "__esModule", { | ||
32378 | value: true | ||
32379 | }); | ||
32380 | |||
32381 | var _classCallCheck2 = __webpack_require__(188); | ||
32382 | |||
32383 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
32384 | |||
32385 | var _possibleConstructorReturn2 = __webpack_require__(189); | ||
32386 | |||
32387 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
32388 | |||
32389 | var _inherits2 = __webpack_require__(258); | ||
32390 | |||
32391 | var _inherits3 = _interopRequireDefault(_inherits2); | ||
32392 | |||
32393 | var _react = __webpack_require__(3); | ||
32394 | |||
32395 | var _react2 = _interopRequireDefault(_react); | ||
32396 | |||
32397 | var _propTypes = __webpack_require__(266); | ||
32398 | |||
32399 | var _propTypes2 = _interopRequireDefault(_propTypes); | ||
32400 | |||
32401 | var _Select = __webpack_require__(314); | ||
32402 | |||
32403 | var _Select2 = _interopRequireDefault(_Select); | ||
32404 | |||
32405 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
32406 | |||
32407 | var formatOption = function formatOption(option, disabledOptions) { | ||
32408 | var value = '' + option; | ||
32409 | if (option < 10) { | ||
32410 | value = '0' + option; | ||
32411 | } | ||
32412 | |||
32413 | var disabled = false; | ||
32414 | if (disabledOptions && disabledOptions.indexOf(option) >= 0) { | ||
32415 | disabled = true; | ||
32416 | } | ||
32417 | |||
32418 | return { | ||
32419 | value: value, | ||
32420 | disabled: disabled | ||
32421 | }; | ||
32422 | }; | ||
32423 | |||
32424 | var Combobox = function (_Component) { | ||
32425 | (0, _inherits3.default)(Combobox, _Component); | ||
32426 | |||
32427 | function Combobox() { | ||
32428 | var _temp, _this, _ret; | ||
32429 | |||
32430 | (0, _classCallCheck3.default)(this, Combobox); | ||
32431 | |||
32432 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
32433 | args[_key] = arguments[_key]; | ||
32434 | } | ||
32435 | |||
32436 | return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onItemChange = function (type, itemValue) { | ||
32437 | var _this$props = _this.props, | ||
32438 | onChange = _this$props.onChange, | ||
32439 | defaultOpenValue = _this$props.defaultOpenValue, | ||
32440 | use12Hours = _this$props.use12Hours; | ||
32441 | |||
32442 | var value = (_this.props.value || defaultOpenValue).clone(); | ||
32443 | |||
32444 | if (type === 'hour') { | ||
32445 | if (use12Hours) { | ||
32446 | if (_this.isAM()) { | ||
32447 | value.hour(+itemValue % 12); | ||
32448 | } else { | ||
32449 | value.hour(+itemValue % 12 + 12); | ||
32450 | } | ||
32451 | } else { | ||
32452 | value.hour(+itemValue); | ||
32453 | } | ||
32454 | } else if (type === 'minute') { | ||
32455 | value.minute(+itemValue); | ||
32456 | } else if (type === 'ampm') { | ||
32457 | var ampm = itemValue.toUpperCase(); | ||
32458 | if (use12Hours) { | ||
32459 | if (ampm === 'PM' && value.hour() < 12) { | ||
32460 | value.hour(value.hour() % 12 + 12); | ||
32461 | } | ||
32462 | |||
32463 | if (ampm === 'AM') { | ||
32464 | if (value.hour() >= 12) { | ||
32465 | value.hour(value.hour() - 12); | ||
32466 | } | ||
32467 | } | ||
32468 | } | ||
32469 | } else { | ||
32470 | value.second(+itemValue); | ||
32471 | } | ||
32472 | onChange(value); | ||
32473 | }, _this.onEnterSelectPanel = function (range) { | ||
32474 | _this.props.onCurrentSelectPanelChange(range); | ||
32475 | }, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret); | ||
32476 | } | ||
32477 | |||
32478 | Combobox.prototype.getHourSelect = function getHourSelect(hour) { | ||
32479 | var _props = this.props, | ||
32480 | prefixCls = _props.prefixCls, | ||
32481 | hourOptions = _props.hourOptions, | ||
32482 | disabledHours = _props.disabledHours, | ||
32483 | showHour = _props.showHour, | ||
32484 | use12Hours = _props.use12Hours; | ||
32485 | |||
32486 | if (!showHour) { | ||
32487 | return null; | ||
32488 | } | ||
32489 | var disabledOptions = disabledHours(); | ||
32490 | var hourOptionsAdj = void 0; | ||
32491 | var hourAdj = void 0; | ||
32492 | if (use12Hours) { | ||
32493 | hourOptionsAdj = [12].concat(hourOptions.filter(function (h) { | ||
32494 | return h < 12 && h > 0; | ||
32495 | })); | ||
32496 | hourAdj = hour % 12 || 12; | ||
32497 | } else { | ||
32498 | hourOptionsAdj = hourOptions; | ||
32499 | hourAdj = hour; | ||
32500 | } | ||
32501 | |||
32502 | return _react2.default.createElement(_Select2.default, { | ||
32503 | prefixCls: prefixCls, | ||
32504 | options: hourOptionsAdj.map(function (option) { | ||
32505 | return formatOption(option, disabledOptions); | ||
32506 | }), | ||
32507 | selectedIndex: hourOptionsAdj.indexOf(hourAdj), | ||
32508 | type: 'hour', | ||
32509 | onSelect: this.onItemChange, | ||
32510 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'hour') | ||
32511 | }); | ||
32512 | }; | ||
32513 | |||
32514 | Combobox.prototype.getMinuteSelect = function getMinuteSelect(minute) { | ||
32515 | var _props2 = this.props, | ||
32516 | prefixCls = _props2.prefixCls, | ||
32517 | minuteOptions = _props2.minuteOptions, | ||
32518 | disabledMinutes = _props2.disabledMinutes, | ||
32519 | defaultOpenValue = _props2.defaultOpenValue, | ||
32520 | showMinute = _props2.showMinute; | ||
32521 | |||
32522 | if (!showMinute) { | ||
32523 | return null; | ||
32524 | } | ||
32525 | var value = this.props.value || defaultOpenValue; | ||
32526 | var disabledOptions = disabledMinutes(value.hour()); | ||
32527 | |||
32528 | return _react2.default.createElement(_Select2.default, { | ||
32529 | prefixCls: prefixCls, | ||
32530 | options: minuteOptions.map(function (option) { | ||
32531 | return formatOption(option, disabledOptions); | ||
32532 | }), | ||
32533 | selectedIndex: minuteOptions.indexOf(minute), | ||
32534 | type: 'minute', | ||
32535 | onSelect: this.onItemChange, | ||
32536 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'minute') | ||
32537 | }); | ||
32538 | }; | ||
32539 | |||
32540 | Combobox.prototype.getSecondSelect = function getSecondSelect(second) { | ||
32541 | var _props3 = this.props, | ||
32542 | prefixCls = _props3.prefixCls, | ||
32543 | secondOptions = _props3.secondOptions, | ||
32544 | disabledSeconds = _props3.disabledSeconds, | ||
32545 | showSecond = _props3.showSecond, | ||
32546 | defaultOpenValue = _props3.defaultOpenValue; | ||
32547 | |||
32548 | if (!showSecond) { | ||
32549 | return null; | ||
32550 | } | ||
32551 | var value = this.props.value || defaultOpenValue; | ||
32552 | var disabledOptions = disabledSeconds(value.hour(), value.minute()); | ||
32553 | |||
32554 | return _react2.default.createElement(_Select2.default, { | ||
32555 | prefixCls: prefixCls, | ||
32556 | options: secondOptions.map(function (option) { | ||
32557 | return formatOption(option, disabledOptions); | ||
32558 | }), | ||
32559 | selectedIndex: secondOptions.indexOf(second), | ||
32560 | type: 'second', | ||
32561 | onSelect: this.onItemChange, | ||
32562 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'second') | ||
32563 | }); | ||
32564 | }; | ||
32565 | |||
32566 | Combobox.prototype.getAMPMSelect = function getAMPMSelect() { | ||
32567 | var _props4 = this.props, | ||
32568 | prefixCls = _props4.prefixCls, | ||
32569 | use12Hours = _props4.use12Hours, | ||
32570 | format = _props4.format; | ||
32571 | |||
32572 | if (!use12Hours) { | ||
32573 | return null; | ||
32574 | } | ||
32575 | |||
32576 | var AMPMOptions = ['am', 'pm'] // If format has A char, then we should uppercase AM/PM | ||
32577 | .map(function (c) { | ||
32578 | return format.match(/\sA/) ? c.toUpperCase() : c; | ||
32579 | }).map(function (c) { | ||
32580 | return { value: c }; | ||
32581 | }); | ||
32582 | |||
32583 | var selected = this.isAM() ? 0 : 1; | ||
32584 | |||
32585 | return _react2.default.createElement(_Select2.default, { | ||
32586 | prefixCls: prefixCls, | ||
32587 | options: AMPMOptions, | ||
32588 | selectedIndex: selected, | ||
32589 | type: 'ampm', | ||
32590 | onSelect: this.onItemChange, | ||
32591 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'ampm') | ||
32592 | }); | ||
32593 | }; | ||
32594 | |||
32595 | Combobox.prototype.isAM = function isAM() { | ||
32596 | var value = this.props.value || this.props.defaultOpenValue; | ||
32597 | return value.hour() >= 0 && value.hour() < 12; | ||
32598 | }; | ||
32599 | |||
32600 | Combobox.prototype.render = function render() { | ||
32601 | var _props5 = this.props, | ||
32602 | prefixCls = _props5.prefixCls, | ||
32603 | defaultOpenValue = _props5.defaultOpenValue; | ||
32604 | |||
32605 | var value = this.props.value || defaultOpenValue; | ||
32606 | return _react2.default.createElement( | ||
32607 | 'div', | ||
32608 | { className: prefixCls + '-combobox' }, | ||
32609 | this.getHourSelect(value.hour()), | ||
32610 | this.getMinuteSelect(value.minute()), | ||
32611 | this.getSecondSelect(value.second()), | ||
32612 | this.getAMPMSelect(value.hour()) | ||
32613 | ); | ||
32614 | }; | ||
32615 | |||
32616 | return Combobox; | ||
32617 | }(_react.Component); | ||
32618 | |||
32619 | Combobox.propTypes = { | ||
32620 | format: _propTypes2.default.string, | ||
32621 | defaultOpenValue: _propTypes2.default.object, | ||
32622 | prefixCls: _propTypes2.default.string, | ||
32623 | value: _propTypes2.default.object, | ||
32624 | onChange: _propTypes2.default.func, | ||
32625 | showHour: _propTypes2.default.bool, | ||
32626 | showMinute: _propTypes2.default.bool, | ||
32627 | showSecond: _propTypes2.default.bool, | ||
32628 | hourOptions: _propTypes2.default.array, | ||
32629 | minuteOptions: _propTypes2.default.array, | ||
32630 | secondOptions: _propTypes2.default.array, | ||
32631 | disabledHours: _propTypes2.default.func, | ||
32632 | disabledMinutes: _propTypes2.default.func, | ||
32633 | disabledSeconds: _propTypes2.default.func, | ||
32634 | onCurrentSelectPanelChange: _propTypes2.default.func, | ||
32635 | use12Hours: _propTypes2.default.bool | ||
32636 | }; | ||
32637 | exports.default = Combobox; | ||
32638 | module.exports = exports['default']; | ||
32639 | |||
32640 | /***/ }), | ||
32641 | /* 314 */ | ||
32642 | /***/ (function(module, exports, __webpack_require__) { | ||
32643 | |||
32644 | 'use strict'; | ||
32645 | |||
32646 | Object.defineProperty(exports, "__esModule", { | ||
32647 | value: true | ||
32648 | }); | ||
32649 | |||
32650 | var _defineProperty2 = __webpack_require__(308); | ||
32651 | |||
32652 | var _defineProperty3 = _interopRequireDefault(_defineProperty2); | ||
32653 | |||
32654 | var _classCallCheck2 = __webpack_require__(188); | ||
32655 | |||
32656 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
32657 | |||
32658 | var _possibleConstructorReturn2 = __webpack_require__(189); | ||
32659 | |||
32660 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
32661 | |||
32662 | var _inherits2 = __webpack_require__(258); | ||
32663 | |||
32664 | var _inherits3 = _interopRequireDefault(_inherits2); | ||
32665 | |||
32666 | var _react = __webpack_require__(3); | ||
32667 | |||
32668 | var _react2 = _interopRequireDefault(_react); | ||
32669 | |||
32670 | var _propTypes = __webpack_require__(266); | ||
32671 | |||
32672 | var _propTypes2 = _interopRequireDefault(_propTypes); | ||
32673 | |||
32674 | var _reactDom = __webpack_require__(38); | ||
32675 | |||
32676 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
32677 | |||
32678 | var _classnames3 = __webpack_require__(315); | ||
32679 | |||
32680 | var _classnames4 = _interopRequireDefault(_classnames3); | ||
32681 | |||
32682 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
32683 | |||
32684 | var scrollTo = function scrollTo(element, to, duration) { | ||
32685 | var requestAnimationFrame = window.requestAnimationFrame || function requestAnimationFrameTimeout() { | ||
32686 | return setTimeout(arguments[0], 10); | ||
32687 | }; | ||
32688 | // jump to target if duration zero | ||
32689 | if (duration <= 0) { | ||
32690 | element.scrollTop = to; | ||
32691 | return; | ||
32692 | } | ||
32693 | var difference = to - element.scrollTop; | ||
32694 | var perTick = difference / duration * 10; | ||
32695 | |||
32696 | requestAnimationFrame(function () { | ||
32697 | element.scrollTop = element.scrollTop + perTick; | ||
32698 | if (element.scrollTop === to) return; | ||
32699 | scrollTo(element, to, duration - 10); | ||
32700 | }); | ||
32701 | }; | ||
32702 | |||
32703 | var Select = function (_Component) { | ||
32704 | (0, _inherits3.default)(Select, _Component); | ||
32705 | |||
32706 | function Select() { | ||
32707 | var _temp, _this, _ret; | ||
32708 | |||
32709 | (0, _classCallCheck3.default)(this, Select); | ||
32710 | |||
32711 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
32712 | args[_key] = arguments[_key]; | ||
32713 | } | ||
32714 | |||
32715 | return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { | ||
32716 | active: false | ||
32717 | }, _this.onSelect = function (value) { | ||
32718 | var _this$props = _this.props, | ||
32719 | onSelect = _this$props.onSelect, | ||
32720 | type = _this$props.type; | ||
32721 | |||
32722 | onSelect(type, value); | ||
32723 | }, _this.handleMouseEnter = function (e) { | ||
32724 | _this.setState({ active: true }); | ||
32725 | _this.props.onMouseEnter(e); | ||
32726 | }, _this.handleMouseLeave = function () { | ||
32727 | _this.setState({ active: false }); | ||
32728 | }, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret); | ||
32729 | } | ||
32730 | |||
32731 | Select.prototype.componentDidMount = function componentDidMount() { | ||
32732 | // jump to selected option | ||
32733 | this.scrollToSelected(0); | ||
32734 | }; | ||
32735 | |||
32736 | Select.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
32737 | // smooth scroll to selected option | ||
32738 | if (prevProps.selectedIndex !== this.props.selectedIndex) { | ||
32739 | this.scrollToSelected(120); | ||
32740 | } | ||
32741 | }; | ||
32742 | |||
32743 | Select.prototype.getOptions = function getOptions() { | ||
32744 | var _this2 = this; | ||
32745 | |||
32746 | var _props = this.props, | ||
32747 | options = _props.options, | ||
32748 | selectedIndex = _props.selectedIndex, | ||
32749 | prefixCls = _props.prefixCls; | ||
32750 | |||
32751 | return options.map(function (item, index) { | ||
32752 | var _classnames; | ||
32753 | |||
32754 | var cls = (0, _classnames4.default)((_classnames = {}, (0, _defineProperty3.default)(_classnames, prefixCls + '-select-option-selected', selectedIndex === index), (0, _defineProperty3.default)(_classnames, prefixCls + '-select-option-disabled', item.disabled), _classnames)); | ||
32755 | var onclick = null; | ||
32756 | if (!item.disabled) { | ||
32757 | onclick = _this2.onSelect.bind(_this2, item.value); | ||
32758 | } | ||
32759 | return _react2.default.createElement( | ||
32760 | 'li', | ||
32761 | { | ||
32762 | className: cls, | ||
32763 | key: index, | ||
32764 | onClick: onclick, | ||
32765 | disabled: item.disabled | ||
32766 | }, | ||
32767 | item.value | ||
32768 | ); | ||
32769 | }); | ||
32770 | }; | ||
32771 | |||
32772 | Select.prototype.scrollToSelected = function scrollToSelected(duration) { | ||
32773 | // move to selected item | ||
32774 | var select = _reactDom2.default.findDOMNode(this); | ||
32775 | var list = _reactDom2.default.findDOMNode(this.refs.list); | ||
32776 | if (!list) { | ||
32777 | return; | ||
32778 | } | ||
32779 | var index = this.props.selectedIndex; | ||
32780 | if (index < 0) { | ||
32781 | index = 0; | ||
32782 | } | ||
32783 | var topOption = list.children[index]; | ||
32784 | var to = topOption.offsetTop; | ||
32785 | scrollTo(select, to, duration); | ||
32786 | }; | ||
32787 | |||
32788 | Select.prototype.render = function render() { | ||
32789 | var _classnames2; | ||
32790 | |||
32791 | if (this.props.options.length === 0) { | ||
32792 | return null; | ||
32793 | } | ||
32794 | |||
32795 | var prefixCls = this.props.prefixCls; | ||
32796 | |||
32797 | var cls = (0, _classnames4.default)((_classnames2 = {}, (0, _defineProperty3.default)(_classnames2, prefixCls + '-select', 1), (0, _defineProperty3.default)(_classnames2, prefixCls + '-select-active', this.state.active), _classnames2)); | ||
32798 | |||
32799 | return _react2.default.createElement( | ||
32800 | 'div', | ||
32801 | { | ||
32802 | className: cls, | ||
32803 | onMouseEnter: this.handleMouseEnter, | ||
32804 | onMouseLeave: this.handleMouseLeave | ||
32805 | }, | ||
32806 | _react2.default.createElement( | ||
32807 | 'ul', | ||
32808 | { ref: 'list' }, | ||
32809 | this.getOptions() | ||
32810 | ) | ||
32811 | ); | ||
32812 | }; | ||
32813 | |||
32814 | return Select; | ||
32815 | }(_react.Component); | ||
32816 | |||
32817 | Select.propTypes = { | ||
32818 | prefixCls: _propTypes2.default.string, | ||
32819 | options: _propTypes2.default.array, | ||
32820 | selectedIndex: _propTypes2.default.number, | ||
32821 | type: _propTypes2.default.string, | ||
32822 | onSelect: _propTypes2.default.func, | ||
32823 | onMouseEnter: _propTypes2.default.func | ||
32824 | }; | ||
32825 | exports.default = Select; | ||
32826 | module.exports = exports['default']; | ||
32827 | |||
32828 | /***/ }), | ||
32829 | /* 315 */ | ||
32830 | /***/ (function(module, exports, __webpack_require__) { | ||
32831 | |||
32832 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! | ||
32833 | Copyright (c) 2016 Jed Watson. | ||
32834 | Licensed under the MIT License (MIT), see | ||
32835 | http://jedwatson.github.io/classnames | ||
32836 | */ | ||
32837 | /* global define */ | ||
32838 | |||
32839 | (function () { | ||
32840 | 'use strict'; | ||
32841 | |||
32842 | var hasOwn = {}.hasOwnProperty; | ||
32843 | |||
32844 | function classNames () { | ||
32845 | var classes = []; | ||
32846 | |||
32847 | for (var i = 0; i < arguments.length; i++) { | ||
32848 | var arg = arguments[i]; | ||
32849 | if (!arg) continue; | ||
32850 | |||
32851 | var argType = typeof arg; | ||
32852 | |||
32853 | if (argType === 'string' || argType === 'number') { | ||
32854 | classes.push(arg); | ||
32855 | } else if (Array.isArray(arg)) { | ||
32856 | classes.push(classNames.apply(null, arg)); | ||
32857 | } else if (argType === 'object') { | ||
32858 | for (var key in arg) { | ||
32859 | if (hasOwn.call(arg, key) && arg[key]) { | ||
32860 | classes.push(key); | ||
32861 | } | ||
32862 | } | ||
32863 | } | ||
32864 | } | ||
32865 | |||
32866 | return classes.join(' '); | ||
32867 | } | ||
32868 | |||
32869 | if (typeof module !== 'undefined' && module.exports) { | ||
32870 | module.exports = classNames; | ||
32871 | } else if (true) { | ||
32872 | // register as 'classnames', consistent with npm package name | ||
32873 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { | ||
32874 | return classNames; | ||
32875 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
32876 | } else { | ||
32877 | window.classNames = classNames; | ||
32878 | } | ||
32879 | }()); | ||
32880 | |||
32881 | |||
32882 | /***/ }), | ||
32883 | /* 316 */ | ||
32884 | /***/ (function(module, exports) { | ||
32885 | |||
32886 | 'use strict'; | ||
32887 | |||
32888 | Object.defineProperty(exports, "__esModule", { | ||
32889 | value: true | ||
32890 | }); | ||
32891 | var autoAdjustOverflow = { | ||
32892 | adjustX: 1, | ||
32893 | adjustY: 1 | ||
32894 | }; | ||
32895 | |||
32896 | var targetOffset = [0, 0]; | ||
32897 | |||
32898 | var placements = { | ||
32899 | bottomLeft: { | ||
32900 | points: ['tl', 'tl'], | ||
32901 | overflow: autoAdjustOverflow, | ||
32902 | offset: [0, -3], | ||
32903 | targetOffset: targetOffset | ||
32904 | }, | ||
32905 | bottomRight: { | ||
32906 | points: ['tr', 'tr'], | ||
32907 | overflow: autoAdjustOverflow, | ||
32908 | offset: [0, -3], | ||
32909 | targetOffset: targetOffset | ||
32910 | }, | ||
32911 | topRight: { | ||
32912 | points: ['br', 'br'], | ||
32913 | overflow: autoAdjustOverflow, | ||
32914 | offset: [0, 3], | ||
32915 | targetOffset: targetOffset | ||
32916 | }, | ||
32917 | topLeft: { | ||
32918 | points: ['bl', 'bl'], | ||
32919 | overflow: autoAdjustOverflow, | ||
32920 | offset: [0, 3], | ||
32921 | targetOffset: targetOffset | ||
32922 | } | ||
32923 | }; | ||
32924 | |||
32925 | exports.default = placements; | ||
32926 | module.exports = exports['default']; | ||
32927 | |||
32928 | /***/ }), | ||
32929 | /* 317 */, | ||
32930 | /* 318 */, | ||
32931 | /* 319 */, | ||
32932 | /* 320 */, | ||
32933 | /* 321 */, | ||
32934 | /* 322 */, | ||
32935 | /* 323 */ | ||
32936 | /***/ (function(module, exports, __webpack_require__, __webpack_module_template_argument_0__) { | ||
32937 | |||
32938 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
32939 | * Copyright 2013-present, Facebook, Inc. | ||
32940 | * All rights reserved. | ||
32941 | * | ||
32942 | * This source code is licensed under the BSD-style license found in the | ||
32943 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32944 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32945 | * | ||
32946 | * | ||
32947 | */ | ||
32948 | |||
32949 | 'use strict'; | ||
32950 | |||
32951 | var _prodInvariant = __webpack_require__(__webpack_module_template_argument_0__); | ||
32952 | |||
32953 | var invariant = __webpack_require__(10); | ||
32954 | |||
32955 | /** | ||
32956 | * Static poolers. Several custom versions for each potential number of | ||
32957 | * arguments. A completely generic pooler is easy to implement, but would | ||
32958 | * require accessing the `arguments` object. In each of these, `this` refers to | ||
32959 | * the Class itself, not an instance. If any others are needed, simply add them | ||
32960 | * here, or in their own files. | ||
32961 | */ | ||
32962 | var oneArgumentPooler = function (copyFieldsFrom) { | ||
32963 | var Klass = this; | ||
32964 | if (Klass.instancePool.length) { | ||
32965 | var instance = Klass.instancePool.pop(); | ||
32966 | Klass.call(instance, copyFieldsFrom); | ||
32967 | return instance; | ||
32968 | } else { | ||
32969 | return new Klass(copyFieldsFrom); | ||
32970 | } | ||
32971 | }; | ||
32972 | |||
32973 | var twoArgumentPooler = function (a1, a2) { | ||
32974 | var Klass = this; | ||
32975 | if (Klass.instancePool.length) { | ||
32976 | var instance = Klass.instancePool.pop(); | ||
32977 | Klass.call(instance, a1, a2); | ||
32978 | return instance; | ||
32979 | } else { | ||
32980 | return new Klass(a1, a2); | ||
32981 | } | ||
32982 | }; | ||
32983 | |||
32984 | var threeArgumentPooler = function (a1, a2, a3) { | ||
32985 | var Klass = this; | ||
32986 | if (Klass.instancePool.length) { | ||
32987 | var instance = Klass.instancePool.pop(); | ||
32988 | Klass.call(instance, a1, a2, a3); | ||
32989 | return instance; | ||
32990 | } else { | ||
32991 | return new Klass(a1, a2, a3); | ||
32992 | } | ||
32993 | }; | ||
32994 | |||
32995 | var fourArgumentPooler = function (a1, a2, a3, a4) { | ||
32996 | var Klass = this; | ||
32997 | if (Klass.instancePool.length) { | ||
32998 | var instance = Klass.instancePool.pop(); | ||
32999 | Klass.call(instance, a1, a2, a3, a4); | ||
33000 | return instance; | ||
33001 | } else { | ||
33002 | return new Klass(a1, a2, a3, a4); | ||
33003 | } | ||
33004 | }; | ||
33005 | |||
33006 | var standardReleaser = function (instance) { | ||
33007 | var Klass = this; | ||
33008 | !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0; | ||
33009 | instance.destructor(); | ||
33010 | if (Klass.instancePool.length < Klass.poolSize) { | ||
33011 | Klass.instancePool.push(instance); | ||
33012 | } | ||
33013 | }; | ||
33014 | |||
33015 | var DEFAULT_POOL_SIZE = 10; | ||
33016 | var DEFAULT_POOLER = oneArgumentPooler; | ||
33017 | |||
33018 | /** | ||
33019 | * Augments `CopyConstructor` to be a poolable class, augmenting only the class | ||
33020 | * itself (statically) not adding any prototypical fields. Any CopyConstructor | ||
33021 | * you give this may have a `poolSize` property, and will look for a | ||
33022 | * prototypical `destructor` on instances. | ||
33023 | * | ||
33024 | * @param {Function} CopyConstructor Constructor that can be used to reset. | ||
33025 | * @param {Function} pooler Customizable pooler. | ||
33026 | */ | ||
33027 | var addPoolingTo = function (CopyConstructor, pooler) { | ||
33028 | // Casting as any so that flow ignores the actual implementation and trusts | ||
33029 | // it to match the type we declared | ||
33030 | var NewKlass = CopyConstructor; | ||
33031 | NewKlass.instancePool = []; | ||
33032 | NewKlass.getPooled = pooler || DEFAULT_POOLER; | ||
33033 | if (!NewKlass.poolSize) { | ||
33034 | NewKlass.poolSize = DEFAULT_POOL_SIZE; | ||
33035 | } | ||
33036 | NewKlass.release = standardReleaser; | ||
33037 | return NewKlass; | ||
33038 | }; | ||
33039 | |||
33040 | var PooledClass = { | ||
33041 | addPoolingTo: addPoolingTo, | ||
33042 | oneArgumentPooler: oneArgumentPooler, | ||
33043 | twoArgumentPooler: twoArgumentPooler, | ||
33044 | threeArgumentPooler: threeArgumentPooler, | ||
33045 | fourArgumentPooler: fourArgumentPooler | ||
33046 | }; | ||
33047 | |||
33048 | module.exports = PooledClass; | ||
33049 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
33050 | |||
33051 | /***/ }) | ||
33052 | /******/ ]))); | ||
33053 | //# sourceMappingURL=common.js.map \ No newline at end of file | ||