diff options
Diffstat (limited to 'common.js')
-rw-r--r-- | common.js | 34611 |
1 files changed, 34611 insertions, 0 deletions
diff --git a/common.js b/common.js new file mode 100644 index 0000000..c8b2f03 --- /dev/null +++ b/common.js | |||
@@ -0,0 +1,34611 @@ | |||
1 | /******/ (function(modules) { // webpackBootstrap | ||
2 | /******/ // install a JSONP callback for chunk loading | ||
3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; | ||
4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { | ||
5 | /******/ // add "moreModules" to the modules object, | ||
6 | /******/ // then flag all "chunkIds" as loaded and fire callback | ||
7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; | ||
8 | /******/ for(;i < chunkIds.length; i++) { | ||
9 | /******/ chunkId = chunkIds[i]; | ||
10 | /******/ if(installedChunks[chunkId]) { | ||
11 | /******/ resolves.push(installedChunks[chunkId][0]); | ||
12 | /******/ } | ||
13 | /******/ installedChunks[chunkId] = 0; | ||
14 | /******/ } | ||
15 | /******/ for(moduleId in moreModules) { | ||
16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { | ||
17 | /******/ modules[moduleId] = moreModules[moduleId]; | ||
18 | /******/ } | ||
19 | /******/ } | ||
20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); | ||
21 | /******/ while(resolves.length) { | ||
22 | /******/ resolves.shift()(); | ||
23 | /******/ } | ||
24 | /******/ if(executeModules) { | ||
25 | /******/ for(i=0; i < executeModules.length; i++) { | ||
26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); | ||
27 | /******/ } | ||
28 | /******/ } | ||
29 | /******/ return result; | ||
30 | /******/ }; | ||
31 | /******/ | ||
32 | /******/ // The module cache | ||
33 | /******/ var installedModules = {}; | ||
34 | /******/ | ||
35 | /******/ // objects to store loaded and loading chunks | ||
36 | /******/ var installedChunks = { | ||
37 | /******/ 7: 0 | ||
38 | /******/ }; | ||
39 | /******/ | ||
40 | /******/ // The require function | ||
41 | /******/ function __webpack_require__(moduleId) { | ||
42 | /******/ | ||
43 | /******/ // Check if module is in cache | ||
44 | /******/ if(installedModules[moduleId]) { | ||
45 | /******/ return installedModules[moduleId].exports; | ||
46 | /******/ } | ||
47 | /******/ // Create a new module (and put it into the cache) | ||
48 | /******/ var module = installedModules[moduleId] = { | ||
49 | /******/ i: moduleId, | ||
50 | /******/ l: false, | ||
51 | /******/ exports: {} | ||
52 | /******/ }; | ||
53 | /******/ | ||
54 | /******/ // Execute the module function | ||
55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
56 | /******/ | ||
57 | /******/ // Flag the module as loaded | ||
58 | /******/ module.l = true; | ||
59 | /******/ | ||
60 | /******/ // Return the exports of the module | ||
61 | /******/ return module.exports; | ||
62 | /******/ } | ||
63 | /******/ | ||
64 | /******/ // This file contains only the entry chunk. | ||
65 | /******/ // The chunk loading function for additional chunks | ||
66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { | ||
67 | /******/ var installedChunkData = installedChunks[chunkId]; | ||
68 | /******/ if(installedChunkData === 0) { | ||
69 | /******/ return new Promise(function(resolve) { resolve(); }); | ||
70 | /******/ } | ||
71 | /******/ | ||
72 | /******/ // a Promise means "currently loading". | ||
73 | /******/ if(installedChunkData) { | ||
74 | /******/ return installedChunkData[2]; | ||
75 | /******/ } | ||
76 | /******/ | ||
77 | /******/ // setup Promise in chunk cache | ||
78 | /******/ var promise = new Promise(function(resolve, reject) { | ||
79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; | ||
80 | /******/ }); | ||
81 | /******/ installedChunkData[2] = promise; | ||
82 | /******/ | ||
83 | /******/ // start chunk loading | ||
84 | /******/ var head = document.getElementsByTagName('head')[0]; | ||
85 | /******/ var script = document.createElement('script'); | ||
86 | /******/ script.type = 'text/javascript'; | ||
87 | /******/ script.charset = 'utf-8'; | ||
88 | /******/ script.async = true; | ||
89 | /******/ script.timeout = 120000; | ||
90 | /******/ | ||
91 | /******/ if (__webpack_require__.nc) { | ||
92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); | ||
93 | /******/ } | ||
94 | /******/ script.src = __webpack_require__.p + "" + chunkId + ".js"; | ||
95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); | ||
96 | /******/ script.onerror = script.onload = onScriptComplete; | ||
97 | /******/ function onScriptComplete() { | ||
98 | /******/ // avoid mem leaks in IE. | ||
99 | /******/ script.onerror = script.onload = null; | ||
100 | /******/ clearTimeout(timeout); | ||
101 | /******/ var chunk = installedChunks[chunkId]; | ||
102 | /******/ if(chunk !== 0) { | ||
103 | /******/ if(chunk) { | ||
104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); | ||
105 | /******/ } | ||
106 | /******/ installedChunks[chunkId] = undefined; | ||
107 | /******/ } | ||
108 | /******/ }; | ||
109 | /******/ head.appendChild(script); | ||
110 | /******/ | ||
111 | /******/ return promise; | ||
112 | /******/ }; | ||
113 | /******/ | ||
114 | /******/ // expose the modules object (__webpack_modules__) | ||
115 | /******/ __webpack_require__.m = modules; | ||
116 | /******/ | ||
117 | /******/ // expose the module cache | ||
118 | /******/ __webpack_require__.c = installedModules; | ||
119 | /******/ | ||
120 | /******/ // identity function for calling harmony imports with the correct context | ||
121 | /******/ __webpack_require__.i = function(value) { return value; }; | ||
122 | /******/ | ||
123 | /******/ // define getter function for harmony exports | ||
124 | /******/ __webpack_require__.d = function(exports, name, getter) { | ||
125 | /******/ if(!__webpack_require__.o(exports, name)) { | ||
126 | /******/ Object.defineProperty(exports, name, { | ||
127 | /******/ configurable: false, | ||
128 | /******/ enumerable: true, | ||
129 | /******/ get: getter | ||
130 | /******/ }); | ||
131 | /******/ } | ||
132 | /******/ }; | ||
133 | /******/ | ||
134 | /******/ // getDefaultExport function for compatibility with non-harmony modules | ||
135 | /******/ __webpack_require__.n = function(module) { | ||
136 | /******/ var getter = module && module.__esModule ? | ||
137 | /******/ function getDefault() { return module['default']; } : | ||
138 | /******/ function getModuleExports() { return module; }; | ||
139 | /******/ __webpack_require__.d(getter, 'a', getter); | ||
140 | /******/ return getter; | ||
141 | /******/ }; | ||
142 | /******/ | ||
143 | /******/ // Object.prototype.hasOwnProperty.call | ||
144 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
145 | /******/ | ||
146 | /******/ // __webpack_public_path__ | ||
147 | /******/ __webpack_require__.p = ""; | ||
148 | /******/ | ||
149 | /******/ // on error function for async loading | ||
150 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; | ||
151 | /******/ }) | ||
152 | /************************************************************************/ | ||
153 | /******/ ([ | ||
154 | /* 0 */ | ||
155 | /***/ (function(module, exports) { | ||
156 | |||
157 | // shim for using process in browser | ||
158 | var process = module.exports = {}; | ||
159 | |||
160 | // cached from whatever global is present so that test runners that stub it | ||
161 | // don't break things. But we need to wrap it in a try catch in case it is | ||
162 | // wrapped in strict mode code which doesn't define any globals. It's inside a | ||
163 | // function because try/catches deoptimize in certain engines. | ||
164 | |||
165 | var cachedSetTimeout; | ||
166 | var cachedClearTimeout; | ||
167 | |||
168 | function defaultSetTimout() { | ||
169 | throw new Error('setTimeout has not been defined'); | ||
170 | } | ||
171 | function defaultClearTimeout () { | ||
172 | throw new Error('clearTimeout has not been defined'); | ||
173 | } | ||
174 | (function () { | ||
175 | try { | ||
176 | if (typeof setTimeout === 'function') { | ||
177 | cachedSetTimeout = setTimeout; | ||
178 | } else { | ||
179 | cachedSetTimeout = defaultSetTimout; | ||
180 | } | ||
181 | } catch (e) { | ||
182 | cachedSetTimeout = defaultSetTimout; | ||
183 | } | ||
184 | try { | ||
185 | if (typeof clearTimeout === 'function') { | ||
186 | cachedClearTimeout = clearTimeout; | ||
187 | } else { | ||
188 | cachedClearTimeout = defaultClearTimeout; | ||
189 | } | ||
190 | } catch (e) { | ||
191 | cachedClearTimeout = defaultClearTimeout; | ||
192 | } | ||
193 | } ()) | ||
194 | function runTimeout(fun) { | ||
195 | if (cachedSetTimeout === setTimeout) { | ||
196 | //normal enviroments in sane situations | ||
197 | return setTimeout(fun, 0); | ||
198 | } | ||
199 | // if setTimeout wasn't available but was latter defined | ||
200 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | ||
201 | cachedSetTimeout = setTimeout; | ||
202 | return setTimeout(fun, 0); | ||
203 | } | ||
204 | try { | ||
205 | // when when somebody has screwed with setTimeout but no I.E. maddness | ||
206 | return cachedSetTimeout(fun, 0); | ||
207 | } catch(e){ | ||
208 | try { | ||
209 | // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
210 | return cachedSetTimeout.call(null, fun, 0); | ||
211 | } catch(e){ | ||
212 | // 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 | ||
213 | return cachedSetTimeout.call(this, fun, 0); | ||
214 | } | ||
215 | } | ||
216 | |||
217 | |||
218 | } | ||
219 | function runClearTimeout(marker) { | ||
220 | if (cachedClearTimeout === clearTimeout) { | ||
221 | //normal enviroments in sane situations | ||
222 | return clearTimeout(marker); | ||
223 | } | ||
224 | // if clearTimeout wasn't available but was latter defined | ||
225 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | ||
226 | cachedClearTimeout = clearTimeout; | ||
227 | return clearTimeout(marker); | ||
228 | } | ||
229 | try { | ||
230 | // when when somebody has screwed with setTimeout but no I.E. maddness | ||
231 | return cachedClearTimeout(marker); | ||
232 | } catch (e){ | ||
233 | try { | ||
234 | // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
235 | return cachedClearTimeout.call(null, marker); | ||
236 | } catch (e){ | ||
237 | // 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. | ||
238 | // Some versions of I.E. have different rules for clearTimeout vs setTimeout | ||
239 | return cachedClearTimeout.call(this, marker); | ||
240 | } | ||
241 | } | ||
242 | |||
243 | |||
244 | |||
245 | } | ||
246 | var queue = []; | ||
247 | var draining = false; | ||
248 | var currentQueue; | ||
249 | var queueIndex = -1; | ||
250 | |||
251 | function cleanUpNextTick() { | ||
252 | if (!draining || !currentQueue) { | ||
253 | return; | ||
254 | } | ||
255 | draining = false; | ||
256 | if (currentQueue.length) { | ||
257 | queue = currentQueue.concat(queue); | ||
258 | } else { | ||
259 | queueIndex = -1; | ||
260 | } | ||
261 | if (queue.length) { | ||
262 | drainQueue(); | ||
263 | } | ||
264 | } | ||
265 | |||
266 | function drainQueue() { | ||
267 | if (draining) { | ||
268 | return; | ||
269 | } | ||
270 | var timeout = runTimeout(cleanUpNextTick); | ||
271 | draining = true; | ||
272 | |||
273 | var len = queue.length; | ||
274 | while(len) { | ||
275 | currentQueue = queue; | ||
276 | queue = []; | ||
277 | while (++queueIndex < len) { | ||
278 | if (currentQueue) { | ||
279 | currentQueue[queueIndex].run(); | ||
280 | } | ||
281 | } | ||
282 | queueIndex = -1; | ||
283 | len = queue.length; | ||
284 | } | ||
285 | currentQueue = null; | ||
286 | draining = false; | ||
287 | runClearTimeout(timeout); | ||
288 | } | ||
289 | |||
290 | process.nextTick = function (fun) { | ||
291 | var args = new Array(arguments.length - 1); | ||
292 | if (arguments.length > 1) { | ||
293 | for (var i = 1; i < arguments.length; i++) { | ||
294 | args[i - 1] = arguments[i]; | ||
295 | } | ||
296 | } | ||
297 | queue.push(new Item(fun, args)); | ||
298 | if (queue.length === 1 && !draining) { | ||
299 | runTimeout(drainQueue); | ||
300 | } | ||
301 | }; | ||
302 | |||
303 | // v8 likes predictible objects | ||
304 | function Item(fun, array) { | ||
305 | this.fun = fun; | ||
306 | this.array = array; | ||
307 | } | ||
308 | Item.prototype.run = function () { | ||
309 | this.fun.apply(null, this.array); | ||
310 | }; | ||
311 | process.title = 'browser'; | ||
312 | process.browser = true; | ||
313 | process.env = {}; | ||
314 | process.argv = []; | ||
315 | process.version = ''; // empty string to avoid regexp issues | ||
316 | process.versions = {}; | ||
317 | |||
318 | function noop() {} | ||
319 | |||
320 | process.on = noop; | ||
321 | process.addListener = noop; | ||
322 | process.once = noop; | ||
323 | process.off = noop; | ||
324 | process.removeListener = noop; | ||
325 | process.removeAllListeners = noop; | ||
326 | process.emit = noop; | ||
327 | process.prependListener = noop; | ||
328 | process.prependOnceListener = noop; | ||
329 | |||
330 | process.listeners = function (name) { return [] } | ||
331 | |||
332 | process.binding = function (name) { | ||
333 | throw new Error('process.binding is not supported'); | ||
334 | }; | ||
335 | |||
336 | process.cwd = function () { return '/' }; | ||
337 | process.chdir = function (dir) { | ||
338 | throw new Error('process.chdir is not supported'); | ||
339 | }; | ||
340 | process.umask = function() { return 0; }; | ||
341 | |||
342 | |||
343 | /***/ }), | ||
344 | /* 1 */ | ||
345 | /***/ (function(module, exports, __webpack_require__) { | ||
346 | |||
347 | "use strict"; | ||
348 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
349 | * Copyright (c) 2013-present, Facebook, Inc. | ||
350 | * All rights reserved. | ||
351 | * | ||
352 | * This source code is licensed under the BSD-style license found in the | ||
353 | * LICENSE file in the root directory of this source tree. An additional grant | ||
354 | * of patent rights can be found in the PATENTS file in the same directory. | ||
355 | * | ||
356 | */ | ||
357 | |||
358 | |||
359 | |||
360 | /** | ||
361 | * Use invariant() to assert state which your program assumes to be true. | ||
362 | * | ||
363 | * Provide sprintf-style format (only %s is supported) and arguments | ||
364 | * to provide information about what broke and what you were | ||
365 | * expecting. | ||
366 | * | ||
367 | * The invariant message will be stripped in production, but the invariant | ||
368 | * will remain to ensure logic does not differ in production. | ||
369 | */ | ||
370 | |||
371 | var validateFormat = function validateFormat(format) {}; | ||
372 | |||
373 | if (process.env.NODE_ENV !== 'production') { | ||
374 | validateFormat = function validateFormat(format) { | ||
375 | if (format === undefined) { | ||
376 | throw new Error('invariant requires an error message argument'); | ||
377 | } | ||
378 | }; | ||
379 | } | ||
380 | |||
381 | function invariant(condition, format, a, b, c, d, e, f) { | ||
382 | validateFormat(format); | ||
383 | |||
384 | if (!condition) { | ||
385 | var error; | ||
386 | if (format === undefined) { | ||
387 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); | ||
388 | } else { | ||
389 | var args = [a, b, c, d, e, f]; | ||
390 | var argIndex = 0; | ||
391 | error = new Error(format.replace(/%s/g, function () { | ||
392 | return args[argIndex++]; | ||
393 | })); | ||
394 | error.name = 'Invariant Violation'; | ||
395 | } | ||
396 | |||
397 | error.framesToPop = 1; // we don't care about invariant's own frame | ||
398 | throw error; | ||
399 | } | ||
400 | } | ||
401 | |||
402 | module.exports = invariant; | ||
403 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
404 | |||
405 | /***/ }), | ||
406 | /* 2 */ | ||
407 | /***/ (function(module, exports, __webpack_require__) { | ||
408 | |||
409 | "use strict"; | ||
410 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
411 | * Copyright 2014-2015, Facebook, Inc. | ||
412 | * All rights reserved. | ||
413 | * | ||
414 | * This source code is licensed under the BSD-style license found in the | ||
415 | * LICENSE file in the root directory of this source tree. An additional grant | ||
416 | * of patent rights can be found in the PATENTS file in the same directory. | ||
417 | * | ||
418 | */ | ||
419 | |||
420 | |||
421 | |||
422 | var emptyFunction = __webpack_require__(10); | ||
423 | |||
424 | /** | ||
425 | * Similar to invariant but only logs a warning if the condition is not met. | ||
426 | * This can be used to log issues in development environments in critical | ||
427 | * paths. Removing the logging code for production environments will keep the | ||
428 | * same logic and follow the same code paths. | ||
429 | */ | ||
430 | |||
431 | var warning = emptyFunction; | ||
432 | |||
433 | if (process.env.NODE_ENV !== 'production') { | ||
434 | (function () { | ||
435 | var printWarning = function printWarning(format) { | ||
436 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
437 | args[_key - 1] = arguments[_key]; | ||
438 | } | ||
439 | |||
440 | var argIndex = 0; | ||
441 | var message = 'Warning: ' + format.replace(/%s/g, function () { | ||
442 | return args[argIndex++]; | ||
443 | }); | ||
444 | if (typeof console !== 'undefined') { | ||
445 | console.error(message); | ||
446 | } | ||
447 | try { | ||
448 | // --- Welcome to debugging React --- | ||
449 | // This error was thrown as a convenience so that you can use this stack | ||
450 | // to find the callsite that caused this warning to fire. | ||
451 | throw new Error(message); | ||
452 | } catch (x) {} | ||
453 | }; | ||
454 | |||
455 | warning = function warning(condition, format) { | ||
456 | if (format === undefined) { | ||
457 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); | ||
458 | } | ||
459 | |||
460 | if (format.indexOf('Failed Composite propType: ') === 0) { | ||
461 | return; // Ignore CompositeComponent proptype check. | ||
462 | } | ||
463 | |||
464 | if (!condition) { | ||
465 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
466 | args[_key2 - 2] = arguments[_key2]; | ||
467 | } | ||
468 | |||
469 | printWarning.apply(undefined, [format].concat(args)); | ||
470 | } | ||
471 | }; | ||
472 | })(); | ||
473 | } | ||
474 | |||
475 | module.exports = warning; | ||
476 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
477 | |||
478 | /***/ }), | ||
479 | /* 3 */ | ||
480 | /***/ (function(module, exports, __webpack_require__) { | ||
481 | |||
482 | "use strict"; | ||
483 | /** | ||
484 | * Copyright (c) 2013-present, Facebook, Inc. | ||
485 | * All rights reserved. | ||
486 | * | ||
487 | * This source code is licensed under the BSD-style license found in the | ||
488 | * LICENSE file in the root directory of this source tree. An additional grant | ||
489 | * of patent rights can be found in the PATENTS file in the same directory. | ||
490 | * | ||
491 | * | ||
492 | */ | ||
493 | |||
494 | |||
495 | /** | ||
496 | * WARNING: DO NOT manually require this module. | ||
497 | * This is a replacement for `invariant(...)` used by the error code system | ||
498 | * and will _only_ be required by the corresponding babel pass. | ||
499 | * It always throws. | ||
500 | */ | ||
501 | |||
502 | function reactProdInvariant(code) { | ||
503 | var argCount = arguments.length - 1; | ||
504 | |||
505 | var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; | ||
506 | |||
507 | for (var argIdx = 0; argIdx < argCount; argIdx++) { | ||
508 | message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); | ||
509 | } | ||
510 | |||
511 | message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; | ||
512 | |||
513 | var error = new Error(message); | ||
514 | error.name = 'Invariant Violation'; | ||
515 | error.framesToPop = 1; // we don't care about reactProdInvariant's own frame | ||
516 | |||
517 | throw error; | ||
518 | } | ||
519 | |||
520 | module.exports = reactProdInvariant; | ||
521 | |||
522 | /***/ }), | ||
523 | /* 4 */ | ||
524 | /***/ (function(module, exports, __webpack_require__) { | ||
525 | |||
526 | "use strict"; | ||
527 | /* | ||
528 | object-assign | ||
529 | (c) Sindre Sorhus | ||
530 | @license MIT | ||
531 | */ | ||
532 | |||
533 | |||
534 | /* eslint-disable no-unused-vars */ | ||
535 | var getOwnPropertySymbols = Object.getOwnPropertySymbols; | ||
536 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
537 | var propIsEnumerable = Object.prototype.propertyIsEnumerable; | ||
538 | |||
539 | function toObject(val) { | ||
540 | if (val === null || val === undefined) { | ||
541 | throw new TypeError('Object.assign cannot be called with null or undefined'); | ||
542 | } | ||
543 | |||
544 | return Object(val); | ||
545 | } | ||
546 | |||
547 | function shouldUseNative() { | ||
548 | try { | ||
549 | if (!Object.assign) { | ||
550 | return false; | ||
551 | } | ||
552 | |||
553 | // Detect buggy property enumeration order in older V8 versions. | ||
554 | |||
555 | // https://bugs.chromium.org/p/v8/issues/detail?id=4118 | ||
556 | var test1 = new String('abc'); // eslint-disable-line no-new-wrappers | ||
557 | test1[5] = 'de'; | ||
558 | if (Object.getOwnPropertyNames(test1)[0] === '5') { | ||
559 | return false; | ||
560 | } | ||
561 | |||
562 | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 | ||
563 | var test2 = {}; | ||
564 | for (var i = 0; i < 10; i++) { | ||
565 | test2['_' + String.fromCharCode(i)] = i; | ||
566 | } | ||
567 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) { | ||
568 | return test2[n]; | ||
569 | }); | ||
570 | if (order2.join('') !== '0123456789') { | ||
571 | return false; | ||
572 | } | ||
573 | |||
574 | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 | ||
575 | var test3 = {}; | ||
576 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { | ||
577 | test3[letter] = letter; | ||
578 | }); | ||
579 | if (Object.keys(Object.assign({}, test3)).join('') !== | ||
580 | 'abcdefghijklmnopqrst') { | ||
581 | return false; | ||
582 | } | ||
583 | |||
584 | return true; | ||
585 | } catch (err) { | ||
586 | // We don't expect any of the above to throw, but better to be safe. | ||
587 | return false; | ||
588 | } | ||
589 | } | ||
590 | |||
591 | module.exports = shouldUseNative() ? Object.assign : function (target, source) { | ||
592 | var from; | ||
593 | var to = toObject(target); | ||
594 | var symbols; | ||
595 | |||
596 | for (var s = 1; s < arguments.length; s++) { | ||
597 | from = Object(arguments[s]); | ||
598 | |||
599 | for (var key in from) { | ||
600 | if (hasOwnProperty.call(from, key)) { | ||
601 | to[key] = from[key]; | ||
602 | } | ||
603 | } | ||
604 | |||
605 | if (getOwnPropertySymbols) { | ||
606 | symbols = getOwnPropertySymbols(from); | ||
607 | for (var i = 0; i < symbols.length; i++) { | ||
608 | if (propIsEnumerable.call(from, symbols[i])) { | ||
609 | to[symbols[i]] = from[symbols[i]]; | ||
610 | } | ||
611 | } | ||
612 | } | ||
613 | } | ||
614 | |||
615 | return to; | ||
616 | }; | ||
617 | |||
618 | |||
619 | /***/ }), | ||
620 | /* 5 */ | ||
621 | /***/ (function(module, exports, __webpack_require__) { | ||
622 | |||
623 | "use strict"; | ||
624 | |||
625 | |||
626 | module.exports = __webpack_require__(39); | ||
627 | |||
628 | |||
629 | /***/ }), | ||
630 | /* 6 */ | ||
631 | /***/ (function(module, exports, __webpack_require__) { | ||
632 | |||
633 | "use strict"; | ||
634 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
635 | * Copyright 2013-present, Facebook, Inc. | ||
636 | * All rights reserved. | ||
637 | * | ||
638 | * This source code is licensed under the BSD-style license found in the | ||
639 | * LICENSE file in the root directory of this source tree. An additional grant | ||
640 | * of patent rights can be found in the PATENTS file in the same directory. | ||
641 | * | ||
642 | */ | ||
643 | |||
644 | |||
645 | |||
646 | var _prodInvariant = __webpack_require__(3); | ||
647 | |||
648 | var DOMProperty = __webpack_require__(21); | ||
649 | var ReactDOMComponentFlags = __webpack_require__(121); | ||
650 | |||
651 | var invariant = __webpack_require__(1); | ||
652 | |||
653 | var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; | ||
654 | var Flags = ReactDOMComponentFlags; | ||
655 | |||
656 | var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2); | ||
657 | |||
658 | /** | ||
659 | * Check if a given node should be cached. | ||
660 | */ | ||
661 | function shouldPrecacheNode(node, nodeID) { | ||
662 | 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 + ' '; | ||
663 | } | ||
664 | |||
665 | /** | ||
666 | * Drill down (through composites and empty components) until we get a host or | ||
667 | * host text component. | ||
668 | * | ||
669 | * This is pretty polymorphic but unavoidable with the current structure we have | ||
670 | * for `_renderedChildren`. | ||
671 | */ | ||
672 | function getRenderedHostOrTextFromComponent(component) { | ||
673 | var rendered; | ||
674 | while (rendered = component._renderedComponent) { | ||
675 | component = rendered; | ||
676 | } | ||
677 | return component; | ||
678 | } | ||
679 | |||
680 | /** | ||
681 | * Populate `_hostNode` on the rendered host/text component with the given | ||
682 | * DOM node. The passed `inst` can be a composite. | ||
683 | */ | ||
684 | function precacheNode(inst, node) { | ||
685 | var hostInst = getRenderedHostOrTextFromComponent(inst); | ||
686 | hostInst._hostNode = node; | ||
687 | node[internalInstanceKey] = hostInst; | ||
688 | } | ||
689 | |||
690 | function uncacheNode(inst) { | ||
691 | var node = inst._hostNode; | ||
692 | if (node) { | ||
693 | delete node[internalInstanceKey]; | ||
694 | inst._hostNode = null; | ||
695 | } | ||
696 | } | ||
697 | |||
698 | /** | ||
699 | * Populate `_hostNode` on each child of `inst`, assuming that the children | ||
700 | * match up with the DOM (element) children of `node`. | ||
701 | * | ||
702 | * We cache entire levels at once to avoid an n^2 problem where we access the | ||
703 | * children of a node sequentially and have to walk from the start to our target | ||
704 | * node every time. | ||
705 | * | ||
706 | * Since we update `_renderedChildren` and the actual DOM at (slightly) | ||
707 | * different times, we could race here and see a newer `_renderedChildren` than | ||
708 | * the DOM nodes we see. To avoid this, ReactMultiChild calls | ||
709 | * `prepareToManageChildren` before we change `_renderedChildren`, at which | ||
710 | * time the container's child nodes are always cached (until it unmounts). | ||
711 | */ | ||
712 | function precacheChildNodes(inst, node) { | ||
713 | if (inst._flags & Flags.hasCachedChildNodes) { | ||
714 | return; | ||
715 | } | ||
716 | var children = inst._renderedChildren; | ||
717 | var childNode = node.firstChild; | ||
718 | outer: for (var name in children) { | ||
719 | if (!children.hasOwnProperty(name)) { | ||
720 | continue; | ||
721 | } | ||
722 | var childInst = children[name]; | ||
723 | var childID = getRenderedHostOrTextFromComponent(childInst)._domID; | ||
724 | if (childID === 0) { | ||
725 | // We're currently unmounting this child in ReactMultiChild; skip it. | ||
726 | continue; | ||
727 | } | ||
728 | // We assume the child nodes are in the same order as the child instances. | ||
729 | for (; childNode !== null; childNode = childNode.nextSibling) { | ||
730 | if (shouldPrecacheNode(childNode, childID)) { | ||
731 | precacheNode(childInst, childNode); | ||
732 | continue outer; | ||
733 | } | ||
734 | } | ||
735 | // We reached the end of the DOM children without finding an ID match. | ||
736 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0; | ||
737 | } | ||
738 | inst._flags |= Flags.hasCachedChildNodes; | ||
739 | } | ||
740 | |||
741 | /** | ||
742 | * Given a DOM node, return the closest ReactDOMComponent or | ||
743 | * ReactDOMTextComponent instance ancestor. | ||
744 | */ | ||
745 | function getClosestInstanceFromNode(node) { | ||
746 | if (node[internalInstanceKey]) { | ||
747 | return node[internalInstanceKey]; | ||
748 | } | ||
749 | |||
750 | // Walk up the tree until we find an ancestor whose instance we have cached. | ||
751 | var parents = []; | ||
752 | while (!node[internalInstanceKey]) { | ||
753 | parents.push(node); | ||
754 | if (node.parentNode) { | ||
755 | node = node.parentNode; | ||
756 | } else { | ||
757 | // Top of the tree. This node must not be part of a React tree (or is | ||
758 | // unmounted, potentially). | ||
759 | return null; | ||
760 | } | ||
761 | } | ||
762 | |||
763 | var closest; | ||
764 | var inst; | ||
765 | for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) { | ||
766 | closest = inst; | ||
767 | if (parents.length) { | ||
768 | precacheChildNodes(inst, node); | ||
769 | } | ||
770 | } | ||
771 | |||
772 | return closest; | ||
773 | } | ||
774 | |||
775 | /** | ||
776 | * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent | ||
777 | * instance, or null if the node was not rendered by this React. | ||
778 | */ | ||
779 | function getInstanceFromNode(node) { | ||
780 | var inst = getClosestInstanceFromNode(node); | ||
781 | if (inst != null && inst._hostNode === node) { | ||
782 | return inst; | ||
783 | } else { | ||
784 | return null; | ||
785 | } | ||
786 | } | ||
787 | |||
788 | /** | ||
789 | * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding | ||
790 | * DOM node. | ||
791 | */ | ||
792 | function getNodeFromInstance(inst) { | ||
793 | // Without this first invariant, passing a non-DOM-component triggers the next | ||
794 | // invariant for a missing parent, which is super confusing. | ||
795 | !(inst._hostNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; | ||
796 | |||
797 | if (inst._hostNode) { | ||
798 | return inst._hostNode; | ||
799 | } | ||
800 | |||
801 | // Walk up the tree until we find an ancestor whose DOM node we have cached. | ||
802 | var parents = []; | ||
803 | while (!inst._hostNode) { | ||
804 | parents.push(inst); | ||
805 | !inst._hostParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0; | ||
806 | inst = inst._hostParent; | ||
807 | } | ||
808 | |||
809 | // Now parents contains each ancestor that does *not* have a cached native | ||
810 | // node, and `inst` is the deepest ancestor that does. | ||
811 | for (; parents.length; inst = parents.pop()) { | ||
812 | precacheChildNodes(inst, inst._hostNode); | ||
813 | } | ||
814 | |||
815 | return inst._hostNode; | ||
816 | } | ||
817 | |||
818 | var ReactDOMComponentTree = { | ||
819 | getClosestInstanceFromNode: getClosestInstanceFromNode, | ||
820 | getInstanceFromNode: getInstanceFromNode, | ||
821 | getNodeFromInstance: getNodeFromInstance, | ||
822 | precacheChildNodes: precacheChildNodes, | ||
823 | precacheNode: precacheNode, | ||
824 | uncacheNode: uncacheNode | ||
825 | }; | ||
826 | |||
827 | module.exports = ReactDOMComponentTree; | ||
828 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
829 | |||
830 | /***/ }), | ||
831 | /* 7 */ | ||
832 | /***/ (function(module, exports, __webpack_require__) { | ||
833 | |||
834 | "use strict"; | ||
835 | /** | ||
836 | * Copyright (c) 2013-present, Facebook, Inc. | ||
837 | * All rights reserved. | ||
838 | * | ||
839 | * This source code is licensed under the BSD-style license found in the | ||
840 | * LICENSE file in the root directory of this source tree. An additional grant | ||
841 | * of patent rights can be found in the PATENTS file in the same directory. | ||
842 | * | ||
843 | */ | ||
844 | |||
845 | |||
846 | |||
847 | var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); | ||
848 | |||
849 | /** | ||
850 | * Simple, lightweight module assisting with the detection and context of | ||
851 | * Worker. Helps avoid circular dependencies and allows code to reason about | ||
852 | * whether or not they are in a Worker, even if they never include the main | ||
853 | * `ReactWorker` dependency. | ||
854 | */ | ||
855 | var ExecutionEnvironment = { | ||
856 | |||
857 | canUseDOM: canUseDOM, | ||
858 | |||
859 | canUseWorkers: typeof Worker !== 'undefined', | ||
860 | |||
861 | canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), | ||
862 | |||
863 | canUseViewport: canUseDOM && !!window.screen, | ||
864 | |||
865 | isInWorker: !canUseDOM // For now, this is true - might change in the future. | ||
866 | |||
867 | }; | ||
868 | |||
869 | module.exports = ExecutionEnvironment; | ||
870 | |||
871 | /***/ }), | ||
872 | /* 8 */ | ||
873 | /***/ (function(module, exports, __webpack_require__) { | ||
874 | |||
875 | "use strict"; | ||
876 | |||
877 | |||
878 | module.exports = __webpack_require__(255); | ||
879 | |||
880 | |||
881 | /***/ }), | ||
882 | /* 9 */ | ||
883 | /***/ (function(module, exports, __webpack_require__) { | ||
884 | |||
885 | "use strict"; | ||
886 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
887 | * Copyright 2016-present, Facebook, Inc. | ||
888 | * All rights reserved. | ||
889 | * | ||
890 | * This source code is licensed under the BSD-style license found in the | ||
891 | * LICENSE file in the root directory of this source tree. An additional grant | ||
892 | * of patent rights can be found in the PATENTS file in the same directory. | ||
893 | * | ||
894 | * | ||
895 | */ | ||
896 | |||
897 | |||
898 | |||
899 | var _prodInvariant = __webpack_require__(32); | ||
900 | |||
901 | var ReactCurrentOwner = __webpack_require__(17); | ||
902 | |||
903 | var invariant = __webpack_require__(1); | ||
904 | var warning = __webpack_require__(2); | ||
905 | |||
906 | function isNative(fn) { | ||
907 | // Based on isNative() from Lodash | ||
908 | var funcToString = Function.prototype.toString; | ||
909 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
910 | var reIsNative = RegExp('^' + funcToString | ||
911 | // Take an example native function source for comparison | ||
912 | .call(hasOwnProperty) | ||
913 | // Strip regex characters so we can use it for regex | ||
914 | .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') | ||
915 | // Remove hasOwnProperty from the template to make it generic | ||
916 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); | ||
917 | try { | ||
918 | var source = funcToString.call(fn); | ||
919 | return reIsNative.test(source); | ||
920 | } catch (err) { | ||
921 | return false; | ||
922 | } | ||
923 | } | ||
924 | |||
925 | var canUseCollections = | ||
926 | // Array.from | ||
927 | typeof Array.from === 'function' && | ||
928 | // Map | ||
929 | typeof Map === 'function' && isNative(Map) && | ||
930 | // Map.prototype.keys | ||
931 | Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) && | ||
932 | // Set | ||
933 | typeof Set === 'function' && isNative(Set) && | ||
934 | // Set.prototype.keys | ||
935 | Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys); | ||
936 | |||
937 | var setItem; | ||
938 | var getItem; | ||
939 | var removeItem; | ||
940 | var getItemIDs; | ||
941 | var addRoot; | ||
942 | var removeRoot; | ||
943 | var getRootIDs; | ||
944 | |||
945 | if (canUseCollections) { | ||
946 | var itemMap = new Map(); | ||
947 | var rootIDSet = new Set(); | ||
948 | |||
949 | setItem = function (id, item) { | ||
950 | itemMap.set(id, item); | ||
951 | }; | ||
952 | getItem = function (id) { | ||
953 | return itemMap.get(id); | ||
954 | }; | ||
955 | removeItem = function (id) { | ||
956 | itemMap['delete'](id); | ||
957 | }; | ||
958 | getItemIDs = function () { | ||
959 | return Array.from(itemMap.keys()); | ||
960 | }; | ||
961 | |||
962 | addRoot = function (id) { | ||
963 | rootIDSet.add(id); | ||
964 | }; | ||
965 | removeRoot = function (id) { | ||
966 | rootIDSet['delete'](id); | ||
967 | }; | ||
968 | getRootIDs = function () { | ||
969 | return Array.from(rootIDSet.keys()); | ||
970 | }; | ||
971 | } else { | ||
972 | var itemByKey = {}; | ||
973 | var rootByKey = {}; | ||
974 | |||
975 | // Use non-numeric keys to prevent V8 performance issues: | ||
976 | // https://github.com/facebook/react/pull/7232 | ||
977 | var getKeyFromID = function (id) { | ||
978 | return '.' + id; | ||
979 | }; | ||
980 | var getIDFromKey = function (key) { | ||
981 | return parseInt(key.substr(1), 10); | ||
982 | }; | ||
983 | |||
984 | setItem = function (id, item) { | ||
985 | var key = getKeyFromID(id); | ||
986 | itemByKey[key] = item; | ||
987 | }; | ||
988 | getItem = function (id) { | ||
989 | var key = getKeyFromID(id); | ||
990 | return itemByKey[key]; | ||
991 | }; | ||
992 | removeItem = function (id) { | ||
993 | var key = getKeyFromID(id); | ||
994 | delete itemByKey[key]; | ||
995 | }; | ||
996 | getItemIDs = function () { | ||
997 | return Object.keys(itemByKey).map(getIDFromKey); | ||
998 | }; | ||
999 | |||
1000 | addRoot = function (id) { | ||
1001 | var key = getKeyFromID(id); | ||
1002 | rootByKey[key] = true; | ||
1003 | }; | ||
1004 | removeRoot = function (id) { | ||
1005 | var key = getKeyFromID(id); | ||
1006 | delete rootByKey[key]; | ||
1007 | }; | ||
1008 | getRootIDs = function () { | ||
1009 | return Object.keys(rootByKey).map(getIDFromKey); | ||
1010 | }; | ||
1011 | } | ||
1012 | |||
1013 | var unmountedIDs = []; | ||
1014 | |||
1015 | function purgeDeep(id) { | ||
1016 | var item = getItem(id); | ||
1017 | if (item) { | ||
1018 | var childIDs = item.childIDs; | ||
1019 | |||
1020 | removeItem(id); | ||
1021 | childIDs.forEach(purgeDeep); | ||
1022 | } | ||
1023 | } | ||
1024 | |||
1025 | function describeComponentFrame(name, source, ownerName) { | ||
1026 | return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); | ||
1027 | } | ||
1028 | |||
1029 | function getDisplayName(element) { | ||
1030 | if (element == null) { | ||
1031 | return '#empty'; | ||
1032 | } else if (typeof element === 'string' || typeof element === 'number') { | ||
1033 | return '#text'; | ||
1034 | } else if (typeof element.type === 'string') { | ||
1035 | return element.type; | ||
1036 | } else { | ||
1037 | return element.type.displayName || element.type.name || 'Unknown'; | ||
1038 | } | ||
1039 | } | ||
1040 | |||
1041 | function describeID(id) { | ||
1042 | var name = ReactComponentTreeHook.getDisplayName(id); | ||
1043 | var element = ReactComponentTreeHook.getElement(id); | ||
1044 | var ownerID = ReactComponentTreeHook.getOwnerID(id); | ||
1045 | var ownerName; | ||
1046 | if (ownerID) { | ||
1047 | ownerName = ReactComponentTreeHook.getDisplayName(ownerID); | ||
1048 | } | ||
1049 | process.env.NODE_ENV !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0; | ||
1050 | return describeComponentFrame(name, element && element._source, ownerName); | ||
1051 | } | ||
1052 | |||
1053 | var ReactComponentTreeHook = { | ||
1054 | onSetChildren: function (id, nextChildIDs) { | ||
1055 | var item = getItem(id); | ||
1056 | !item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; | ||
1057 | item.childIDs = nextChildIDs; | ||
1058 | |||
1059 | for (var i = 0; i < nextChildIDs.length; i++) { | ||
1060 | var nextChildID = nextChildIDs[i]; | ||
1061 | var nextChild = getItem(nextChildID); | ||
1062 | !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; | ||
1063 | !(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; | ||
1064 | !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; | ||
1065 | if (nextChild.parentID == null) { | ||
1066 | nextChild.parentID = id; | ||
1067 | // TODO: This shouldn't be necessary but mounting a new root during in | ||
1068 | // componentWillMount currently causes not-yet-mounted components to | ||
1069 | // be purged from our tree data so their parent id is missing. | ||
1070 | } | ||
1071 | !(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; | ||
1072 | } | ||
1073 | }, | ||
1074 | onBeforeMountComponent: function (id, element, parentID) { | ||
1075 | var item = { | ||
1076 | element: element, | ||
1077 | parentID: parentID, | ||
1078 | text: null, | ||
1079 | childIDs: [], | ||
1080 | isMounted: false, | ||
1081 | updateCount: 0 | ||
1082 | }; | ||
1083 | setItem(id, item); | ||
1084 | }, | ||
1085 | onBeforeUpdateComponent: function (id, element) { | ||
1086 | var item = getItem(id); | ||
1087 | if (!item || !item.isMounted) { | ||
1088 | // We may end up here as a result of setState() in componentWillUnmount(). | ||
1089 | // In this case, ignore the element. | ||
1090 | return; | ||
1091 | } | ||
1092 | item.element = element; | ||
1093 | }, | ||
1094 | onMountComponent: function (id) { | ||
1095 | var item = getItem(id); | ||
1096 | !item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; | ||
1097 | item.isMounted = true; | ||
1098 | var isRoot = item.parentID === 0; | ||
1099 | if (isRoot) { | ||
1100 | addRoot(id); | ||
1101 | } | ||
1102 | }, | ||
1103 | onUpdateComponent: function (id) { | ||
1104 | var item = getItem(id); | ||
1105 | if (!item || !item.isMounted) { | ||
1106 | // We may end up here as a result of setState() in componentWillUnmount(). | ||
1107 | // In this case, ignore the element. | ||
1108 | return; | ||
1109 | } | ||
1110 | item.updateCount++; | ||
1111 | }, | ||
1112 | onUnmountComponent: function (id) { | ||
1113 | var item = getItem(id); | ||
1114 | if (item) { | ||
1115 | // We need to check if it exists. | ||
1116 | // `item` might not exist if it is inside an error boundary, and a sibling | ||
1117 | // error boundary child threw while mounting. Then this instance never | ||
1118 | // got a chance to mount, but it still gets an unmounting event during | ||
1119 | // the error boundary cleanup. | ||
1120 | item.isMounted = false; | ||
1121 | var isRoot = item.parentID === 0; | ||
1122 | if (isRoot) { | ||
1123 | removeRoot(id); | ||
1124 | } | ||
1125 | } | ||
1126 | unmountedIDs.push(id); | ||
1127 | }, | ||
1128 | purgeUnmountedComponents: function () { | ||
1129 | if (ReactComponentTreeHook._preventPurging) { | ||
1130 | // Should only be used for testing. | ||
1131 | return; | ||
1132 | } | ||
1133 | |||
1134 | for (var i = 0; i < unmountedIDs.length; i++) { | ||
1135 | var id = unmountedIDs[i]; | ||
1136 | purgeDeep(id); | ||
1137 | } | ||
1138 | unmountedIDs.length = 0; | ||
1139 | }, | ||
1140 | isMounted: function (id) { | ||
1141 | var item = getItem(id); | ||
1142 | return item ? item.isMounted : false; | ||
1143 | }, | ||
1144 | getCurrentStackAddendum: function (topElement) { | ||
1145 | var info = ''; | ||
1146 | if (topElement) { | ||
1147 | var name = getDisplayName(topElement); | ||
1148 | var owner = topElement._owner; | ||
1149 | info += describeComponentFrame(name, topElement._source, owner && owner.getName()); | ||
1150 | } | ||
1151 | |||
1152 | var currentOwner = ReactCurrentOwner.current; | ||
1153 | var id = currentOwner && currentOwner._debugID; | ||
1154 | |||
1155 | info += ReactComponentTreeHook.getStackAddendumByID(id); | ||
1156 | return info; | ||
1157 | }, | ||
1158 | getStackAddendumByID: function (id) { | ||
1159 | var info = ''; | ||
1160 | while (id) { | ||
1161 | info += describeID(id); | ||
1162 | id = ReactComponentTreeHook.getParentID(id); | ||
1163 | } | ||
1164 | return info; | ||
1165 | }, | ||
1166 | getChildIDs: function (id) { | ||
1167 | var item = getItem(id); | ||
1168 | return item ? item.childIDs : []; | ||
1169 | }, | ||
1170 | getDisplayName: function (id) { | ||
1171 | var element = ReactComponentTreeHook.getElement(id); | ||
1172 | if (!element) { | ||
1173 | return null; | ||
1174 | } | ||
1175 | return getDisplayName(element); | ||
1176 | }, | ||
1177 | getElement: function (id) { | ||
1178 | var item = getItem(id); | ||
1179 | return item ? item.element : null; | ||
1180 | }, | ||
1181 | getOwnerID: function (id) { | ||
1182 | var element = ReactComponentTreeHook.getElement(id); | ||
1183 | if (!element || !element._owner) { | ||
1184 | return null; | ||
1185 | } | ||
1186 | return element._owner._debugID; | ||
1187 | }, | ||
1188 | getParentID: function (id) { | ||
1189 | var item = getItem(id); | ||
1190 | return item ? item.parentID : null; | ||
1191 | }, | ||
1192 | getSource: function (id) { | ||
1193 | var item = getItem(id); | ||
1194 | var element = item ? item.element : null; | ||
1195 | var source = element != null ? element._source : null; | ||
1196 | return source; | ||
1197 | }, | ||
1198 | getText: function (id) { | ||
1199 | var element = ReactComponentTreeHook.getElement(id); | ||
1200 | if (typeof element === 'string') { | ||
1201 | return element; | ||
1202 | } else if (typeof element === 'number') { | ||
1203 | return '' + element; | ||
1204 | } else { | ||
1205 | return null; | ||
1206 | } | ||
1207 | }, | ||
1208 | getUpdateCount: function (id) { | ||
1209 | var item = getItem(id); | ||
1210 | return item ? item.updateCount : 0; | ||
1211 | }, | ||
1212 | |||
1213 | |||
1214 | getRootIDs: getRootIDs, | ||
1215 | getRegisteredIDs: getItemIDs | ||
1216 | }; | ||
1217 | |||
1218 | module.exports = ReactComponentTreeHook; | ||
1219 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
1220 | |||
1221 | /***/ }), | ||
1222 | /* 10 */ | ||
1223 | /***/ (function(module, exports, __webpack_require__) { | ||
1224 | |||
1225 | "use strict"; | ||
1226 | |||
1227 | |||
1228 | /** | ||
1229 | * Copyright (c) 2013-present, Facebook, Inc. | ||
1230 | * All rights reserved. | ||
1231 | * | ||
1232 | * This source code is licensed under the BSD-style license found in the | ||
1233 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1234 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1235 | * | ||
1236 | * | ||
1237 | */ | ||
1238 | |||
1239 | function makeEmptyFunction(arg) { | ||
1240 | return function () { | ||
1241 | return arg; | ||
1242 | }; | ||
1243 | } | ||
1244 | |||
1245 | /** | ||
1246 | * This function accepts and discards inputs; it has no side effects. This is | ||
1247 | * primarily useful idiomatically for overridable function endpoints which | ||
1248 | * always need to be callable, since JS lacks a null-call idiom ala Cocoa. | ||
1249 | */ | ||
1250 | var emptyFunction = function emptyFunction() {}; | ||
1251 | |||
1252 | emptyFunction.thatReturns = makeEmptyFunction; | ||
1253 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false); | ||
1254 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true); | ||
1255 | emptyFunction.thatReturnsNull = makeEmptyFunction(null); | ||
1256 | emptyFunction.thatReturnsThis = function () { | ||
1257 | return this; | ||
1258 | }; | ||
1259 | emptyFunction.thatReturnsArgument = function (arg) { | ||
1260 | return arg; | ||
1261 | }; | ||
1262 | |||
1263 | module.exports = emptyFunction; | ||
1264 | |||
1265 | /***/ }), | ||
1266 | /* 11 */ | ||
1267 | /***/ (function(module, exports, __webpack_require__) { | ||
1268 | |||
1269 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1270 | * Copyright 2013-present, Facebook, Inc. | ||
1271 | * All rights reserved. | ||
1272 | * | ||
1273 | * This source code is licensed under the BSD-style license found in the | ||
1274 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1275 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1276 | */ | ||
1277 | |||
1278 | if (process.env.NODE_ENV !== 'production') { | ||
1279 | var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && | ||
1280 | Symbol.for && | ||
1281 | Symbol.for('react.element')) || | ||
1282 | 0xeac7; | ||
1283 | |||
1284 | var isValidElement = function(object) { | ||
1285 | return typeof object === 'object' && | ||
1286 | object !== null && | ||
1287 | object.$$typeof === REACT_ELEMENT_TYPE; | ||
1288 | }; | ||
1289 | |||
1290 | // By explicitly using `prop-types` you are opting into new development behavior. | ||
1291 | // http://fb.me/prop-types-in-prod | ||
1292 | var throwOnDirectAccess = true; | ||
1293 | module.exports = __webpack_require__(114)(isValidElement, throwOnDirectAccess); | ||
1294 | } else { | ||
1295 | // By explicitly using `prop-types` you are opting into new production behavior. | ||
1296 | // http://fb.me/prop-types-in-prod | ||
1297 | module.exports = __webpack_require__(227)(); | ||
1298 | } | ||
1299 | |||
1300 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
1301 | |||
1302 | /***/ }), | ||
1303 | /* 12 */ | ||
1304 | /***/ (function(module, exports, __webpack_require__) { | ||
1305 | |||
1306 | "use strict"; | ||
1307 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1308 | * Copyright 2016-present, Facebook, Inc. | ||
1309 | * All rights reserved. | ||
1310 | * | ||
1311 | * This source code is licensed under the BSD-style license found in the | ||
1312 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1313 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1314 | * | ||
1315 | * | ||
1316 | */ | ||
1317 | |||
1318 | |||
1319 | |||
1320 | // Trust the developer to only use ReactInstrumentation with a __DEV__ check | ||
1321 | |||
1322 | var debugTool = null; | ||
1323 | |||
1324 | if (process.env.NODE_ENV !== 'production') { | ||
1325 | var ReactDebugTool = __webpack_require__(270); | ||
1326 | debugTool = ReactDebugTool; | ||
1327 | } | ||
1328 | |||
1329 | module.exports = { debugTool: debugTool }; | ||
1330 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
1331 | |||
1332 | /***/ }), | ||
1333 | /* 13 */ | ||
1334 | /***/ (function(module, exports, __webpack_require__) { | ||
1335 | |||
1336 | "use strict"; | ||
1337 | |||
1338 | |||
1339 | exports.__esModule = true; | ||
1340 | |||
1341 | exports.default = function (instance, Constructor) { | ||
1342 | if (!(instance instanceof Constructor)) { | ||
1343 | throw new TypeError("Cannot call a class as a function"); | ||
1344 | } | ||
1345 | }; | ||
1346 | |||
1347 | /***/ }), | ||
1348 | /* 14 */ | ||
1349 | /***/ (function(module, exports, __webpack_require__) { | ||
1350 | |||
1351 | "use strict"; | ||
1352 | |||
1353 | |||
1354 | exports.__esModule = true; | ||
1355 | |||
1356 | var _setPrototypeOf = __webpack_require__(162); | ||
1357 | |||
1358 | var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); | ||
1359 | |||
1360 | var _create = __webpack_require__(161); | ||
1361 | |||
1362 | var _create2 = _interopRequireDefault(_create); | ||
1363 | |||
1364 | var _typeof2 = __webpack_require__(94); | ||
1365 | |||
1366 | var _typeof3 = _interopRequireDefault(_typeof2); | ||
1367 | |||
1368 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
1369 | |||
1370 | exports.default = function (subClass, superClass) { | ||
1371 | if (typeof superClass !== "function" && superClass !== null) { | ||
1372 | throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass))); | ||
1373 | } | ||
1374 | |||
1375 | subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, { | ||
1376 | constructor: { | ||
1377 | value: subClass, | ||
1378 | enumerable: false, | ||
1379 | writable: true, | ||
1380 | configurable: true | ||
1381 | } | ||
1382 | }); | ||
1383 | if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass; | ||
1384 | }; | ||
1385 | |||
1386 | /***/ }), | ||
1387 | /* 15 */ | ||
1388 | /***/ (function(module, exports, __webpack_require__) { | ||
1389 | |||
1390 | "use strict"; | ||
1391 | |||
1392 | |||
1393 | exports.__esModule = true; | ||
1394 | |||
1395 | var _typeof2 = __webpack_require__(94); | ||
1396 | |||
1397 | var _typeof3 = _interopRequireDefault(_typeof2); | ||
1398 | |||
1399 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
1400 | |||
1401 | exports.default = function (self, call) { | ||
1402 | if (!self) { | ||
1403 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
1404 | } | ||
1405 | |||
1406 | return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self; | ||
1407 | }; | ||
1408 | |||
1409 | /***/ }), | ||
1410 | /* 16 */ | ||
1411 | /***/ (function(module, exports, __webpack_require__) { | ||
1412 | |||
1413 | "use strict"; | ||
1414 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1415 | * Copyright 2013-present, Facebook, Inc. | ||
1416 | * All rights reserved. | ||
1417 | * | ||
1418 | * This source code is licensed under the BSD-style license found in the | ||
1419 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1420 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1421 | * | ||
1422 | */ | ||
1423 | |||
1424 | |||
1425 | |||
1426 | var _prodInvariant = __webpack_require__(3), | ||
1427 | _assign = __webpack_require__(4); | ||
1428 | |||
1429 | var CallbackQueue = __webpack_require__(119); | ||
1430 | var PooledClass = __webpack_require__(30); | ||
1431 | var ReactFeatureFlags = __webpack_require__(124); | ||
1432 | var ReactReconciler = __webpack_require__(38); | ||
1433 | var Transaction = __webpack_require__(56); | ||
1434 | |||
1435 | var invariant = __webpack_require__(1); | ||
1436 | |||
1437 | var dirtyComponents = []; | ||
1438 | var updateBatchNumber = 0; | ||
1439 | var asapCallbackQueue = CallbackQueue.getPooled(); | ||
1440 | var asapEnqueued = false; | ||
1441 | |||
1442 | var batchingStrategy = null; | ||
1443 | |||
1444 | function ensureInjected() { | ||
1445 | !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0; | ||
1446 | } | ||
1447 | |||
1448 | var NESTED_UPDATES = { | ||
1449 | initialize: function () { | ||
1450 | this.dirtyComponentsLength = dirtyComponents.length; | ||
1451 | }, | ||
1452 | close: function () { | ||
1453 | if (this.dirtyComponentsLength !== dirtyComponents.length) { | ||
1454 | // Additional updates were enqueued by componentDidUpdate handlers or | ||
1455 | // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run | ||
1456 | // these new updates so that if A's componentDidUpdate calls setState on | ||
1457 | // B, B will update before the callback A's updater provided when calling | ||
1458 | // setState. | ||
1459 | dirtyComponents.splice(0, this.dirtyComponentsLength); | ||
1460 | flushBatchedUpdates(); | ||
1461 | } else { | ||
1462 | dirtyComponents.length = 0; | ||
1463 | } | ||
1464 | } | ||
1465 | }; | ||
1466 | |||
1467 | var UPDATE_QUEUEING = { | ||
1468 | initialize: function () { | ||
1469 | this.callbackQueue.reset(); | ||
1470 | }, | ||
1471 | close: function () { | ||
1472 | this.callbackQueue.notifyAll(); | ||
1473 | } | ||
1474 | }; | ||
1475 | |||
1476 | var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; | ||
1477 | |||
1478 | function ReactUpdatesFlushTransaction() { | ||
1479 | this.reinitializeTransaction(); | ||
1480 | this.dirtyComponentsLength = null; | ||
1481 | this.callbackQueue = CallbackQueue.getPooled(); | ||
1482 | this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( | ||
1483 | /* useCreateElement */true); | ||
1484 | } | ||
1485 | |||
1486 | _assign(ReactUpdatesFlushTransaction.prototype, Transaction, { | ||
1487 | getTransactionWrappers: function () { | ||
1488 | return TRANSACTION_WRAPPERS; | ||
1489 | }, | ||
1490 | |||
1491 | destructor: function () { | ||
1492 | this.dirtyComponentsLength = null; | ||
1493 | CallbackQueue.release(this.callbackQueue); | ||
1494 | this.callbackQueue = null; | ||
1495 | ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); | ||
1496 | this.reconcileTransaction = null; | ||
1497 | }, | ||
1498 | |||
1499 | perform: function (method, scope, a) { | ||
1500 | // Essentially calls `this.reconcileTransaction.perform(method, scope, a)` | ||
1501 | // with this transaction's wrappers around it. | ||
1502 | return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); | ||
1503 | } | ||
1504 | }); | ||
1505 | |||
1506 | PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); | ||
1507 | |||
1508 | function batchedUpdates(callback, a, b, c, d, e) { | ||
1509 | ensureInjected(); | ||
1510 | return batchingStrategy.batchedUpdates(callback, a, b, c, d, e); | ||
1511 | } | ||
1512 | |||
1513 | /** | ||
1514 | * Array comparator for ReactComponents by mount ordering. | ||
1515 | * | ||
1516 | * @param {ReactComponent} c1 first component you're comparing | ||
1517 | * @param {ReactComponent} c2 second component you're comparing | ||
1518 | * @return {number} Return value usable by Array.prototype.sort(). | ||
1519 | */ | ||
1520 | function mountOrderComparator(c1, c2) { | ||
1521 | return c1._mountOrder - c2._mountOrder; | ||
1522 | } | ||
1523 | |||
1524 | function runBatchedUpdates(transaction) { | ||
1525 | var len = transaction.dirtyComponentsLength; | ||
1526 | !(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; | ||
1527 | |||
1528 | // Since reconciling a component higher in the owner hierarchy usually (not | ||
1529 | // always -- see shouldComponentUpdate()) will reconcile children, reconcile | ||
1530 | // them before their children by sorting the array. | ||
1531 | dirtyComponents.sort(mountOrderComparator); | ||
1532 | |||
1533 | // Any updates enqueued while reconciling must be performed after this entire | ||
1534 | // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and | ||
1535 | // C, B could update twice in a single batch if C's render enqueues an update | ||
1536 | // to B (since B would have already updated, we should skip it, and the only | ||
1537 | // way we can know to do so is by checking the batch counter). | ||
1538 | updateBatchNumber++; | ||
1539 | |||
1540 | for (var i = 0; i < len; i++) { | ||
1541 | // If a component is unmounted before pending changes apply, it will still | ||
1542 | // be here, but we assume that it has cleared its _pendingCallbacks and | ||
1543 | // that performUpdateIfNecessary is a noop. | ||
1544 | var component = dirtyComponents[i]; | ||
1545 | |||
1546 | // If performUpdateIfNecessary happens to enqueue any new updates, we | ||
1547 | // shouldn't execute the callbacks until the next render happens, so | ||
1548 | // stash the callbacks first | ||
1549 | var callbacks = component._pendingCallbacks; | ||
1550 | component._pendingCallbacks = null; | ||
1551 | |||
1552 | var markerName; | ||
1553 | if (ReactFeatureFlags.logTopLevelRenders) { | ||
1554 | var namedComponent = component; | ||
1555 | // Duck type TopLevelWrapper. This is probably always true. | ||
1556 | if (component._currentElement.type.isReactTopLevelWrapper) { | ||
1557 | namedComponent = component._renderedComponent; | ||
1558 | } | ||
1559 | markerName = 'React update: ' + namedComponent.getName(); | ||
1560 | console.time(markerName); | ||
1561 | } | ||
1562 | |||
1563 | ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber); | ||
1564 | |||
1565 | if (markerName) { | ||
1566 | console.timeEnd(markerName); | ||
1567 | } | ||
1568 | |||
1569 | if (callbacks) { | ||
1570 | for (var j = 0; j < callbacks.length; j++) { | ||
1571 | transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance()); | ||
1572 | } | ||
1573 | } | ||
1574 | } | ||
1575 | } | ||
1576 | |||
1577 | var flushBatchedUpdates = function () { | ||
1578 | // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents | ||
1579 | // array and perform any updates enqueued by mount-ready handlers (i.e., | ||
1580 | // componentDidUpdate) but we need to check here too in order to catch | ||
1581 | // updates enqueued by setState callbacks and asap calls. | ||
1582 | while (dirtyComponents.length || asapEnqueued) { | ||
1583 | if (dirtyComponents.length) { | ||
1584 | var transaction = ReactUpdatesFlushTransaction.getPooled(); | ||
1585 | transaction.perform(runBatchedUpdates, null, transaction); | ||
1586 | ReactUpdatesFlushTransaction.release(transaction); | ||
1587 | } | ||
1588 | |||
1589 | if (asapEnqueued) { | ||
1590 | asapEnqueued = false; | ||
1591 | var queue = asapCallbackQueue; | ||
1592 | asapCallbackQueue = CallbackQueue.getPooled(); | ||
1593 | queue.notifyAll(); | ||
1594 | CallbackQueue.release(queue); | ||
1595 | } | ||
1596 | } | ||
1597 | }; | ||
1598 | |||
1599 | /** | ||
1600 | * Mark a component as needing a rerender, adding an optional callback to a | ||
1601 | * list of functions which will be executed once the rerender occurs. | ||
1602 | */ | ||
1603 | function enqueueUpdate(component) { | ||
1604 | ensureInjected(); | ||
1605 | |||
1606 | // Various parts of our code (such as ReactCompositeComponent's | ||
1607 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
1608 | // verify that that's the case. (This is called by each top-level update | ||
1609 | // function, like setState, forceUpdate, etc.; creation and | ||
1610 | // destruction of top-level components is guarded in ReactMount.) | ||
1611 | |||
1612 | if (!batchingStrategy.isBatchingUpdates) { | ||
1613 | batchingStrategy.batchedUpdates(enqueueUpdate, component); | ||
1614 | return; | ||
1615 | } | ||
1616 | |||
1617 | dirtyComponents.push(component); | ||
1618 | if (component._updateBatchNumber == null) { | ||
1619 | component._updateBatchNumber = updateBatchNumber + 1; | ||
1620 | } | ||
1621 | } | ||
1622 | |||
1623 | /** | ||
1624 | * Enqueue a callback to be run at the end of the current batching cycle. Throws | ||
1625 | * if no updates are currently being performed. | ||
1626 | */ | ||
1627 | function asap(callback, context) { | ||
1628 | !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; | ||
1629 | asapCallbackQueue.enqueue(callback, context); | ||
1630 | asapEnqueued = true; | ||
1631 | } | ||
1632 | |||
1633 | var ReactUpdatesInjection = { | ||
1634 | injectReconcileTransaction: function (ReconcileTransaction) { | ||
1635 | !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0; | ||
1636 | ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; | ||
1637 | }, | ||
1638 | |||
1639 | injectBatchingStrategy: function (_batchingStrategy) { | ||
1640 | !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0; | ||
1641 | !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0; | ||
1642 | !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0; | ||
1643 | batchingStrategy = _batchingStrategy; | ||
1644 | } | ||
1645 | }; | ||
1646 | |||
1647 | var ReactUpdates = { | ||
1648 | /** | ||
1649 | * React references `ReactReconcileTransaction` using this property in order | ||
1650 | * to allow dependency injection. | ||
1651 | * | ||
1652 | * @internal | ||
1653 | */ | ||
1654 | ReactReconcileTransaction: null, | ||
1655 | |||
1656 | batchedUpdates: batchedUpdates, | ||
1657 | enqueueUpdate: enqueueUpdate, | ||
1658 | flushBatchedUpdates: flushBatchedUpdates, | ||
1659 | injection: ReactUpdatesInjection, | ||
1660 | asap: asap | ||
1661 | }; | ||
1662 | |||
1663 | module.exports = ReactUpdates; | ||
1664 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
1665 | |||
1666 | /***/ }), | ||
1667 | /* 17 */ | ||
1668 | /***/ (function(module, exports, __webpack_require__) { | ||
1669 | |||
1670 | "use strict"; | ||
1671 | /** | ||
1672 | * Copyright 2013-present, Facebook, Inc. | ||
1673 | * All rights reserved. | ||
1674 | * | ||
1675 | * This source code is licensed under the BSD-style license found in the | ||
1676 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1677 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1678 | * | ||
1679 | * | ||
1680 | */ | ||
1681 | |||
1682 | |||
1683 | |||
1684 | /** | ||
1685 | * Keeps track of the current owner. | ||
1686 | * | ||
1687 | * The current owner is the component who should own any components that are | ||
1688 | * currently being constructed. | ||
1689 | */ | ||
1690 | var ReactCurrentOwner = { | ||
1691 | |||
1692 | /** | ||
1693 | * @internal | ||
1694 | * @type {ReactComponent} | ||
1695 | */ | ||
1696 | current: null | ||
1697 | |||
1698 | }; | ||
1699 | |||
1700 | module.exports = ReactCurrentOwner; | ||
1701 | |||
1702 | /***/ }), | ||
1703 | /* 18 */ | ||
1704 | /***/ (function(module, exports) { | ||
1705 | |||
1706 | //! moment.js | ||
1707 | //! version : 2.18.1 | ||
1708 | //! authors : Tim Wood, Iskren Chernev, Moment.js contributors | ||
1709 | //! license : MIT | ||
1710 | //! momentjs.com | ||
1711 | |||
1712 | ;(function (global, factory) { | ||
1713 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
1714 | typeof define === 'function' && define.amd ? define(factory) : | ||
1715 | global.moment = factory() | ||
1716 | }(this, (function () { 'use strict'; | ||
1717 | |||
1718 | var hookCallback; | ||
1719 | |||
1720 | function hooks () { | ||
1721 | return hookCallback.apply(null, arguments); | ||
1722 | } | ||
1723 | |||
1724 | // This is done to register the method called with moment() | ||
1725 | // without creating circular dependencies. | ||
1726 | function setHookCallback (callback) { | ||
1727 | hookCallback = callback; | ||
1728 | } | ||
1729 | |||
1730 | function isArray(input) { | ||
1731 | return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; | ||
1732 | } | ||
1733 | |||
1734 | function isObject(input) { | ||
1735 | // IE8 will treat undefined and null as object if it wasn't for | ||
1736 | // input != null | ||
1737 | return input != null && Object.prototype.toString.call(input) === '[object Object]'; | ||
1738 | } | ||
1739 | |||
1740 | function isObjectEmpty(obj) { | ||
1741 | var k; | ||
1742 | for (k in obj) { | ||
1743 | // even if its not own property I'd still call it non-empty | ||
1744 | return false; | ||
1745 | } | ||
1746 | return true; | ||
1747 | } | ||
1748 | |||
1749 | function isUndefined(input) { | ||
1750 | return input === void 0; | ||
1751 | } | ||
1752 | |||
1753 | function isNumber(input) { | ||
1754 | return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; | ||
1755 | } | ||
1756 | |||
1757 | function isDate(input) { | ||
1758 | return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; | ||
1759 | } | ||
1760 | |||
1761 | function map(arr, fn) { | ||
1762 | var res = [], i; | ||
1763 | for (i = 0; i < arr.length; ++i) { | ||
1764 | res.push(fn(arr[i], i)); | ||
1765 | } | ||
1766 | return res; | ||
1767 | } | ||
1768 | |||
1769 | function hasOwnProp(a, b) { | ||
1770 | return Object.prototype.hasOwnProperty.call(a, b); | ||
1771 | } | ||
1772 | |||
1773 | function extend(a, b) { | ||
1774 | for (var i in b) { | ||
1775 | if (hasOwnProp(b, i)) { | ||
1776 | a[i] = b[i]; | ||
1777 | } | ||
1778 | } | ||
1779 | |||
1780 | if (hasOwnProp(b, 'toString')) { | ||
1781 | a.toString = b.toString; | ||
1782 | } | ||
1783 | |||
1784 | if (hasOwnProp(b, 'valueOf')) { | ||
1785 | a.valueOf = b.valueOf; | ||
1786 | } | ||
1787 | |||
1788 | return a; | ||
1789 | } | ||
1790 | |||
1791 | function createUTC (input, format, locale, strict) { | ||
1792 | return createLocalOrUTC(input, format, locale, strict, true).utc(); | ||
1793 | } | ||
1794 | |||
1795 | function defaultParsingFlags() { | ||
1796 | // We need to deep clone this object. | ||
1797 | return { | ||
1798 | empty : false, | ||
1799 | unusedTokens : [], | ||
1800 | unusedInput : [], | ||
1801 | overflow : -2, | ||
1802 | charsLeftOver : 0, | ||
1803 | nullInput : false, | ||
1804 | invalidMonth : null, | ||
1805 | invalidFormat : false, | ||
1806 | userInvalidated : false, | ||
1807 | iso : false, | ||
1808 | parsedDateParts : [], | ||
1809 | meridiem : null, | ||
1810 | rfc2822 : false, | ||
1811 | weekdayMismatch : false | ||
1812 | }; | ||
1813 | } | ||
1814 | |||
1815 | function getParsingFlags(m) { | ||
1816 | if (m._pf == null) { | ||
1817 | m._pf = defaultParsingFlags(); | ||
1818 | } | ||
1819 | return m._pf; | ||
1820 | } | ||
1821 | |||
1822 | var some; | ||
1823 | if (Array.prototype.some) { | ||
1824 | some = Array.prototype.some; | ||
1825 | } else { | ||
1826 | some = function (fun) { | ||
1827 | var t = Object(this); | ||
1828 | var len = t.length >>> 0; | ||
1829 | |||
1830 | for (var i = 0; i < len; i++) { | ||
1831 | if (i in t && fun.call(this, t[i], i, t)) { | ||
1832 | return true; | ||
1833 | } | ||
1834 | } | ||
1835 | |||
1836 | return false; | ||
1837 | }; | ||
1838 | } | ||
1839 | |||
1840 | var some$1 = some; | ||
1841 | |||
1842 | function isValid(m) { | ||
1843 | if (m._isValid == null) { | ||
1844 | var flags = getParsingFlags(m); | ||
1845 | var parsedParts = some$1.call(flags.parsedDateParts, function (i) { | ||
1846 | return i != null; | ||
1847 | }); | ||
1848 | var isNowValid = !isNaN(m._d.getTime()) && | ||
1849 | flags.overflow < 0 && | ||
1850 | !flags.empty && | ||
1851 | !flags.invalidMonth && | ||
1852 | !flags.invalidWeekday && | ||
1853 | !flags.nullInput && | ||
1854 | !flags.invalidFormat && | ||
1855 | !flags.userInvalidated && | ||
1856 | (!flags.meridiem || (flags.meridiem && parsedParts)); | ||
1857 | |||
1858 | if (m._strict) { | ||
1859 | isNowValid = isNowValid && | ||
1860 | flags.charsLeftOver === 0 && | ||
1861 | flags.unusedTokens.length === 0 && | ||
1862 | flags.bigHour === undefined; | ||
1863 | } | ||
1864 | |||
1865 | if (Object.isFrozen == null || !Object.isFrozen(m)) { | ||
1866 | m._isValid = isNowValid; | ||
1867 | } | ||
1868 | else { | ||
1869 | return isNowValid; | ||
1870 | } | ||
1871 | } | ||
1872 | return m._isValid; | ||
1873 | } | ||
1874 | |||
1875 | function createInvalid (flags) { | ||
1876 | var m = createUTC(NaN); | ||
1877 | if (flags != null) { | ||
1878 | extend(getParsingFlags(m), flags); | ||
1879 | } | ||
1880 | else { | ||
1881 | getParsingFlags(m).userInvalidated = true; | ||
1882 | } | ||
1883 | |||
1884 | return m; | ||
1885 | } | ||
1886 | |||
1887 | // Plugins that add properties should also add the key here (null value), | ||
1888 | // so we can properly clone ourselves. | ||
1889 | var momentProperties = hooks.momentProperties = []; | ||
1890 | |||
1891 | function copyConfig(to, from) { | ||
1892 | var i, prop, val; | ||
1893 | |||
1894 | if (!isUndefined(from._isAMomentObject)) { | ||
1895 | to._isAMomentObject = from._isAMomentObject; | ||
1896 | } | ||
1897 | if (!isUndefined(from._i)) { | ||
1898 | to._i = from._i; | ||
1899 | } | ||
1900 | if (!isUndefined(from._f)) { | ||
1901 | to._f = from._f; | ||
1902 | } | ||
1903 | if (!isUndefined(from._l)) { | ||
1904 | to._l = from._l; | ||
1905 | } | ||
1906 | if (!isUndefined(from._strict)) { | ||
1907 | to._strict = from._strict; | ||
1908 | } | ||
1909 | if (!isUndefined(from._tzm)) { | ||
1910 | to._tzm = from._tzm; | ||
1911 | } | ||
1912 | if (!isUndefined(from._isUTC)) { | ||
1913 | to._isUTC = from._isUTC; | ||
1914 | } | ||
1915 | if (!isUndefined(from._offset)) { | ||
1916 | to._offset = from._offset; | ||
1917 | } | ||
1918 | if (!isUndefined(from._pf)) { | ||
1919 | to._pf = getParsingFlags(from); | ||
1920 | } | ||
1921 | if (!isUndefined(from._locale)) { | ||
1922 | to._locale = from._locale; | ||
1923 | } | ||
1924 | |||
1925 | if (momentProperties.length > 0) { | ||
1926 | for (i = 0; i < momentProperties.length; i++) { | ||
1927 | prop = momentProperties[i]; | ||
1928 | val = from[prop]; | ||
1929 | if (!isUndefined(val)) { | ||
1930 | to[prop] = val; | ||
1931 | } | ||
1932 | } | ||
1933 | } | ||
1934 | |||
1935 | return to; | ||
1936 | } | ||
1937 | |||
1938 | var updateInProgress = false; | ||
1939 | |||
1940 | // Moment prototype object | ||
1941 | function Moment(config) { | ||
1942 | copyConfig(this, config); | ||
1943 | this._d = new Date(config._d != null ? config._d.getTime() : NaN); | ||
1944 | if (!this.isValid()) { | ||
1945 | this._d = new Date(NaN); | ||
1946 | } | ||
1947 | // Prevent infinite loop in case updateOffset creates new moment | ||
1948 | // objects. | ||
1949 | if (updateInProgress === false) { | ||
1950 | updateInProgress = true; | ||
1951 | hooks.updateOffset(this); | ||
1952 | updateInProgress = false; | ||
1953 | } | ||
1954 | } | ||
1955 | |||
1956 | function isMoment (obj) { | ||
1957 | return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); | ||
1958 | } | ||
1959 | |||
1960 | function absFloor (number) { | ||
1961 | if (number < 0) { | ||
1962 | // -0 -> 0 | ||
1963 | return Math.ceil(number) || 0; | ||
1964 | } else { | ||
1965 | return Math.floor(number); | ||
1966 | } | ||
1967 | } | ||
1968 | |||
1969 | function toInt(argumentForCoercion) { | ||
1970 | var coercedNumber = +argumentForCoercion, | ||
1971 | value = 0; | ||
1972 | |||
1973 | if (coercedNumber !== 0 && isFinite(coercedNumber)) { | ||
1974 | value = absFloor(coercedNumber); | ||
1975 | } | ||
1976 | |||
1977 | return value; | ||
1978 | } | ||
1979 | |||
1980 | // compare two arrays, return the number of differences | ||
1981 | function compareArrays(array1, array2, dontConvert) { | ||
1982 | var len = Math.min(array1.length, array2.length), | ||
1983 | lengthDiff = Math.abs(array1.length - array2.length), | ||
1984 | diffs = 0, | ||
1985 | i; | ||
1986 | for (i = 0; i < len; i++) { | ||
1987 | if ((dontConvert && array1[i] !== array2[i]) || | ||
1988 | (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { | ||
1989 | diffs++; | ||
1990 | } | ||
1991 | } | ||
1992 | return diffs + lengthDiff; | ||
1993 | } | ||
1994 | |||
1995 | function warn(msg) { | ||
1996 | if (hooks.suppressDeprecationWarnings === false && | ||
1997 | (typeof console !== 'undefined') && console.warn) { | ||
1998 | console.warn('Deprecation warning: ' + msg); | ||
1999 | } | ||
2000 | } | ||
2001 | |||
2002 | function deprecate(msg, fn) { | ||
2003 | var firstTime = true; | ||
2004 | |||
2005 | return extend(function () { | ||
2006 | if (hooks.deprecationHandler != null) { | ||
2007 | hooks.deprecationHandler(null, msg); | ||
2008 | } | ||
2009 | if (firstTime) { | ||
2010 | var args = []; | ||
2011 | var arg; | ||
2012 | for (var i = 0; i < arguments.length; i++) { | ||
2013 | arg = ''; | ||
2014 | if (typeof arguments[i] === 'object') { | ||
2015 | arg += '\n[' + i + '] '; | ||
2016 | for (var key in arguments[0]) { | ||
2017 | arg += key + ': ' + arguments[0][key] + ', '; | ||
2018 | } | ||
2019 | arg = arg.slice(0, -2); // Remove trailing comma and space | ||
2020 | } else { | ||
2021 | arg = arguments[i]; | ||
2022 | } | ||
2023 | args.push(arg); | ||
2024 | } | ||
2025 | warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); | ||
2026 | firstTime = false; | ||
2027 | } | ||
2028 | return fn.apply(this, arguments); | ||
2029 | }, fn); | ||
2030 | } | ||
2031 | |||
2032 | var deprecations = {}; | ||
2033 | |||
2034 | function deprecateSimple(name, msg) { | ||
2035 | if (hooks.deprecationHandler != null) { | ||
2036 | hooks.deprecationHandler(name, msg); | ||
2037 | } | ||
2038 | if (!deprecations[name]) { | ||
2039 | warn(msg); | ||
2040 | deprecations[name] = true; | ||
2041 | } | ||
2042 | } | ||
2043 | |||
2044 | hooks.suppressDeprecationWarnings = false; | ||
2045 | hooks.deprecationHandler = null; | ||
2046 | |||
2047 | function isFunction(input) { | ||
2048 | return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; | ||
2049 | } | ||
2050 | |||
2051 | function set (config) { | ||
2052 | var prop, i; | ||
2053 | for (i in config) { | ||
2054 | prop = config[i]; | ||
2055 | if (isFunction(prop)) { | ||
2056 | this[i] = prop; | ||
2057 | } else { | ||
2058 | this['_' + i] = prop; | ||
2059 | } | ||
2060 | } | ||
2061 | this._config = config; | ||
2062 | // Lenient ordinal parsing accepts just a number in addition to | ||
2063 | // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. | ||
2064 | // TODO: Remove "ordinalParse" fallback in next major release. | ||
2065 | this._dayOfMonthOrdinalParseLenient = new RegExp( | ||
2066 | (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + | ||
2067 | '|' + (/\d{1,2}/).source); | ||
2068 | } | ||
2069 | |||
2070 | function mergeConfigs(parentConfig, childConfig) { | ||
2071 | var res = extend({}, parentConfig), prop; | ||
2072 | for (prop in childConfig) { | ||
2073 | if (hasOwnProp(childConfig, prop)) { | ||
2074 | if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { | ||
2075 | res[prop] = {}; | ||
2076 | extend(res[prop], parentConfig[prop]); | ||
2077 | extend(res[prop], childConfig[prop]); | ||
2078 | } else if (childConfig[prop] != null) { | ||
2079 | res[prop] = childConfig[prop]; | ||
2080 | } else { | ||
2081 | delete res[prop]; | ||
2082 | } | ||
2083 | } | ||
2084 | } | ||
2085 | for (prop in parentConfig) { | ||
2086 | if (hasOwnProp(parentConfig, prop) && | ||
2087 | !hasOwnProp(childConfig, prop) && | ||
2088 | isObject(parentConfig[prop])) { | ||
2089 | // make sure changes to properties don't modify parent config | ||
2090 | res[prop] = extend({}, res[prop]); | ||
2091 | } | ||
2092 | } | ||
2093 | return res; | ||
2094 | } | ||
2095 | |||
2096 | function Locale(config) { | ||
2097 | if (config != null) { | ||
2098 | this.set(config); | ||
2099 | } | ||
2100 | } | ||
2101 | |||
2102 | var keys; | ||
2103 | |||
2104 | if (Object.keys) { | ||
2105 | keys = Object.keys; | ||
2106 | } else { | ||
2107 | keys = function (obj) { | ||
2108 | var i, res = []; | ||
2109 | for (i in obj) { | ||
2110 | if (hasOwnProp(obj, i)) { | ||
2111 | res.push(i); | ||
2112 | } | ||
2113 | } | ||
2114 | return res; | ||
2115 | }; | ||
2116 | } | ||
2117 | |||
2118 | var keys$1 = keys; | ||
2119 | |||
2120 | var defaultCalendar = { | ||
2121 | sameDay : '[Today at] LT', | ||
2122 | nextDay : '[Tomorrow at] LT', | ||
2123 | nextWeek : 'dddd [at] LT', | ||
2124 | lastDay : '[Yesterday at] LT', | ||
2125 | lastWeek : '[Last] dddd [at] LT', | ||
2126 | sameElse : 'L' | ||
2127 | }; | ||
2128 | |||
2129 | function calendar (key, mom, now) { | ||
2130 | var output = this._calendar[key] || this._calendar['sameElse']; | ||
2131 | return isFunction(output) ? output.call(mom, now) : output; | ||
2132 | } | ||
2133 | |||
2134 | var defaultLongDateFormat = { | ||
2135 | LTS : 'h:mm:ss A', | ||
2136 | LT : 'h:mm A', | ||
2137 | L : 'MM/DD/YYYY', | ||
2138 | LL : 'MMMM D, YYYY', | ||
2139 | LLL : 'MMMM D, YYYY h:mm A', | ||
2140 | LLLL : 'dddd, MMMM D, YYYY h:mm A' | ||
2141 | }; | ||
2142 | |||
2143 | function longDateFormat (key) { | ||
2144 | var format = this._longDateFormat[key], | ||
2145 | formatUpper = this._longDateFormat[key.toUpperCase()]; | ||
2146 | |||
2147 | if (format || !formatUpper) { | ||
2148 | return format; | ||
2149 | } | ||
2150 | |||
2151 | this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { | ||
2152 | return val.slice(1); | ||
2153 | }); | ||
2154 | |||
2155 | return this._longDateFormat[key]; | ||
2156 | } | ||
2157 | |||
2158 | var defaultInvalidDate = 'Invalid date'; | ||
2159 | |||
2160 | function invalidDate () { | ||
2161 | return this._invalidDate; | ||
2162 | } | ||
2163 | |||
2164 | var defaultOrdinal = '%d'; | ||
2165 | var defaultDayOfMonthOrdinalParse = /\d{1,2}/; | ||
2166 | |||
2167 | function ordinal (number) { | ||
2168 | return this._ordinal.replace('%d', number); | ||
2169 | } | ||
2170 | |||
2171 | var defaultRelativeTime = { | ||
2172 | future : 'in %s', | ||
2173 | past : '%s ago', | ||
2174 | s : 'a few seconds', | ||
2175 | ss : '%d seconds', | ||
2176 | m : 'a minute', | ||
2177 | mm : '%d minutes', | ||
2178 | h : 'an hour', | ||
2179 | hh : '%d hours', | ||
2180 | d : 'a day', | ||
2181 | dd : '%d days', | ||
2182 | M : 'a month', | ||
2183 | MM : '%d months', | ||
2184 | y : 'a year', | ||
2185 | yy : '%d years' | ||
2186 | }; | ||
2187 | |||
2188 | function relativeTime (number, withoutSuffix, string, isFuture) { | ||
2189 | var output = this._relativeTime[string]; | ||
2190 | return (isFunction(output)) ? | ||
2191 | output(number, withoutSuffix, string, isFuture) : | ||
2192 | output.replace(/%d/i, number); | ||
2193 | } | ||
2194 | |||
2195 | function pastFuture (diff, output) { | ||
2196 | var format = this._relativeTime[diff > 0 ? 'future' : 'past']; | ||
2197 | return isFunction(format) ? format(output) : format.replace(/%s/i, output); | ||
2198 | } | ||
2199 | |||
2200 | var aliases = {}; | ||
2201 | |||
2202 | function addUnitAlias (unit, shorthand) { | ||
2203 | var lowerCase = unit.toLowerCase(); | ||
2204 | aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; | ||
2205 | } | ||
2206 | |||
2207 | function normalizeUnits(units) { | ||
2208 | return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; | ||
2209 | } | ||
2210 | |||
2211 | function normalizeObjectUnits(inputObject) { | ||
2212 | var normalizedInput = {}, | ||
2213 | normalizedProp, | ||
2214 | prop; | ||
2215 | |||
2216 | for (prop in inputObject) { | ||
2217 | if (hasOwnProp(inputObject, prop)) { | ||
2218 | normalizedProp = normalizeUnits(prop); | ||
2219 | if (normalizedProp) { | ||
2220 | normalizedInput[normalizedProp] = inputObject[prop]; | ||
2221 | } | ||
2222 | } | ||
2223 | } | ||
2224 | |||
2225 | return normalizedInput; | ||
2226 | } | ||
2227 | |||
2228 | var priorities = {}; | ||
2229 | |||
2230 | function addUnitPriority(unit, priority) { | ||
2231 | priorities[unit] = priority; | ||
2232 | } | ||
2233 | |||
2234 | function getPrioritizedUnits(unitsObj) { | ||
2235 | var units = []; | ||
2236 | for (var u in unitsObj) { | ||
2237 | units.push({unit: u, priority: priorities[u]}); | ||
2238 | } | ||
2239 | units.sort(function (a, b) { | ||
2240 | return a.priority - b.priority; | ||
2241 | }); | ||
2242 | return units; | ||
2243 | } | ||
2244 | |||
2245 | function makeGetSet (unit, keepTime) { | ||
2246 | return function (value) { | ||
2247 | if (value != null) { | ||
2248 | set$1(this, unit, value); | ||
2249 | hooks.updateOffset(this, keepTime); | ||
2250 | return this; | ||
2251 | } else { | ||
2252 | return get(this, unit); | ||
2253 | } | ||
2254 | }; | ||
2255 | } | ||
2256 | |||
2257 | function get (mom, unit) { | ||
2258 | return mom.isValid() ? | ||
2259 | mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; | ||
2260 | } | ||
2261 | |||
2262 | function set$1 (mom, unit, value) { | ||
2263 | if (mom.isValid()) { | ||
2264 | mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); | ||
2265 | } | ||
2266 | } | ||
2267 | |||
2268 | // MOMENTS | ||
2269 | |||
2270 | function stringGet (units) { | ||
2271 | units = normalizeUnits(units); | ||
2272 | if (isFunction(this[units])) { | ||
2273 | return this[units](); | ||
2274 | } | ||
2275 | return this; | ||
2276 | } | ||
2277 | |||
2278 | |||
2279 | function stringSet (units, value) { | ||
2280 | if (typeof units === 'object') { | ||
2281 | units = normalizeObjectUnits(units); | ||
2282 | var prioritized = getPrioritizedUnits(units); | ||
2283 | for (var i = 0; i < prioritized.length; i++) { | ||
2284 | this[prioritized[i].unit](units[prioritized[i].unit]); | ||
2285 | } | ||
2286 | } else { | ||
2287 | units = normalizeUnits(units); | ||
2288 | if (isFunction(this[units])) { | ||
2289 | return this[units](value); | ||
2290 | } | ||
2291 | } | ||
2292 | return this; | ||
2293 | } | ||
2294 | |||
2295 | function zeroFill(number, targetLength, forceSign) { | ||
2296 | var absNumber = '' + Math.abs(number), | ||
2297 | zerosToFill = targetLength - absNumber.length, | ||
2298 | sign = number >= 0; | ||
2299 | return (sign ? (forceSign ? '+' : '') : '-') + | ||
2300 | Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; | ||
2301 | } | ||
2302 | |||
2303 | 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; | ||
2304 | |||
2305 | var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; | ||
2306 | |||
2307 | var formatFunctions = {}; | ||
2308 | |||
2309 | var formatTokenFunctions = {}; | ||
2310 | |||
2311 | // token: 'M' | ||
2312 | // padded: ['MM', 2] | ||
2313 | // ordinal: 'Mo' | ||
2314 | // callback: function () { this.month() + 1 } | ||
2315 | function addFormatToken (token, padded, ordinal, callback) { | ||
2316 | var func = callback; | ||
2317 | if (typeof callback === 'string') { | ||
2318 | func = function () { | ||
2319 | return this[callback](); | ||
2320 | }; | ||
2321 | } | ||
2322 | if (token) { | ||
2323 | formatTokenFunctions[token] = func; | ||
2324 | } | ||
2325 | if (padded) { | ||
2326 | formatTokenFunctions[padded[0]] = function () { | ||
2327 | return zeroFill(func.apply(this, arguments), padded[1], padded[2]); | ||
2328 | }; | ||
2329 | } | ||
2330 | if (ordinal) { | ||
2331 | formatTokenFunctions[ordinal] = function () { | ||
2332 | return this.localeData().ordinal(func.apply(this, arguments), token); | ||
2333 | }; | ||
2334 | } | ||
2335 | } | ||
2336 | |||
2337 | function removeFormattingTokens(input) { | ||
2338 | if (input.match(/\[[\s\S]/)) { | ||
2339 | return input.replace(/^\[|\]$/g, ''); | ||
2340 | } | ||
2341 | return input.replace(/\\/g, ''); | ||
2342 | } | ||
2343 | |||
2344 | function makeFormatFunction(format) { | ||
2345 | var array = format.match(formattingTokens), i, length; | ||
2346 | |||
2347 | for (i = 0, length = array.length; i < length; i++) { | ||
2348 | if (formatTokenFunctions[array[i]]) { | ||
2349 | array[i] = formatTokenFunctions[array[i]]; | ||
2350 | } else { | ||
2351 | array[i] = removeFormattingTokens(array[i]); | ||
2352 | } | ||
2353 | } | ||
2354 | |||
2355 | return function (mom) { | ||
2356 | var output = '', i; | ||
2357 | for (i = 0; i < length; i++) { | ||
2358 | output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; | ||
2359 | } | ||
2360 | return output; | ||
2361 | }; | ||
2362 | } | ||
2363 | |||
2364 | // format date using native date object | ||
2365 | function formatMoment(m, format) { | ||
2366 | if (!m.isValid()) { | ||
2367 | return m.localeData().invalidDate(); | ||
2368 | } | ||
2369 | |||
2370 | format = expandFormat(format, m.localeData()); | ||
2371 | formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); | ||
2372 | |||
2373 | return formatFunctions[format](m); | ||
2374 | } | ||
2375 | |||
2376 | function expandFormat(format, locale) { | ||
2377 | var i = 5; | ||
2378 | |||
2379 | function replaceLongDateFormatTokens(input) { | ||
2380 | return locale.longDateFormat(input) || input; | ||
2381 | } | ||
2382 | |||
2383 | localFormattingTokens.lastIndex = 0; | ||
2384 | while (i >= 0 && localFormattingTokens.test(format)) { | ||
2385 | format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); | ||
2386 | localFormattingTokens.lastIndex = 0; | ||
2387 | i -= 1; | ||
2388 | } | ||
2389 | |||
2390 | return format; | ||
2391 | } | ||
2392 | |||
2393 | var match1 = /\d/; // 0 - 9 | ||
2394 | var match2 = /\d\d/; // 00 - 99 | ||
2395 | var match3 = /\d{3}/; // 000 - 999 | ||
2396 | var match4 = /\d{4}/; // 0000 - 9999 | ||
2397 | var match6 = /[+-]?\d{6}/; // -999999 - 999999 | ||
2398 | var match1to2 = /\d\d?/; // 0 - 99 | ||
2399 | var match3to4 = /\d\d\d\d?/; // 999 - 9999 | ||
2400 | var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 | ||
2401 | var match1to3 = /\d{1,3}/; // 0 - 999 | ||
2402 | var match1to4 = /\d{1,4}/; // 0 - 9999 | ||
2403 | var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 | ||
2404 | |||
2405 | var matchUnsigned = /\d+/; // 0 - inf | ||
2406 | var matchSigned = /[+-]?\d+/; // -inf - inf | ||
2407 | |||
2408 | var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z | ||
2409 | var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z | ||
2410 | |||
2411 | var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 | ||
2412 | |||
2413 | // any word (or two) characters or numbers including two/three word month in arabic. | ||
2414 | // includes scottish gaelic two word and hyphenated months | ||
2415 | var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; | ||
2416 | |||
2417 | |||
2418 | var regexes = {}; | ||
2419 | |||
2420 | function addRegexToken (token, regex, strictRegex) { | ||
2421 | regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { | ||
2422 | return (isStrict && strictRegex) ? strictRegex : regex; | ||
2423 | }; | ||
2424 | } | ||
2425 | |||
2426 | function getParseRegexForToken (token, config) { | ||
2427 | if (!hasOwnProp(regexes, token)) { | ||
2428 | return new RegExp(unescapeFormat(token)); | ||
2429 | } | ||
2430 | |||
2431 | return regexes[token](config._strict, config._locale); | ||
2432 | } | ||
2433 | |||
2434 | // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript | ||
2435 | function unescapeFormat(s) { | ||
2436 | return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { | ||
2437 | return p1 || p2 || p3 || p4; | ||
2438 | })); | ||
2439 | } | ||
2440 | |||
2441 | function regexEscape(s) { | ||
2442 | return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); | ||
2443 | } | ||
2444 | |||
2445 | var tokens = {}; | ||
2446 | |||
2447 | function addParseToken (token, callback) { | ||
2448 | var i, func = callback; | ||
2449 | if (typeof token === 'string') { | ||
2450 | token = [token]; | ||
2451 | } | ||
2452 | if (isNumber(callback)) { | ||
2453 | func = function (input, array) { | ||
2454 | array[callback] = toInt(input); | ||
2455 | }; | ||
2456 | } | ||
2457 | for (i = 0; i < token.length; i++) { | ||
2458 | tokens[token[i]] = func; | ||
2459 | } | ||
2460 | } | ||
2461 | |||
2462 | function addWeekParseToken (token, callback) { | ||
2463 | addParseToken(token, function (input, array, config, token) { | ||
2464 | config._w = config._w || {}; | ||
2465 | callback(input, config._w, config, token); | ||
2466 | }); | ||
2467 | } | ||
2468 | |||
2469 | function addTimeToArrayFromToken(token, input, config) { | ||
2470 | if (input != null && hasOwnProp(tokens, token)) { | ||
2471 | tokens[token](input, config._a, config, token); | ||
2472 | } | ||
2473 | } | ||
2474 | |||
2475 | var YEAR = 0; | ||
2476 | var MONTH = 1; | ||
2477 | var DATE = 2; | ||
2478 | var HOUR = 3; | ||
2479 | var MINUTE = 4; | ||
2480 | var SECOND = 5; | ||
2481 | var MILLISECOND = 6; | ||
2482 | var WEEK = 7; | ||
2483 | var WEEKDAY = 8; | ||
2484 | |||
2485 | var indexOf; | ||
2486 | |||
2487 | if (Array.prototype.indexOf) { | ||
2488 | indexOf = Array.prototype.indexOf; | ||
2489 | } else { | ||
2490 | indexOf = function (o) { | ||
2491 | // I know | ||
2492 | var i; | ||
2493 | for (i = 0; i < this.length; ++i) { | ||
2494 | if (this[i] === o) { | ||
2495 | return i; | ||
2496 | } | ||
2497 | } | ||
2498 | return -1; | ||
2499 | }; | ||
2500 | } | ||
2501 | |||
2502 | var indexOf$1 = indexOf; | ||
2503 | |||
2504 | function daysInMonth(year, month) { | ||
2505 | return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); | ||
2506 | } | ||
2507 | |||
2508 | // FORMATTING | ||
2509 | |||
2510 | addFormatToken('M', ['MM', 2], 'Mo', function () { | ||
2511 | return this.month() + 1; | ||
2512 | }); | ||
2513 | |||
2514 | addFormatToken('MMM', 0, 0, function (format) { | ||
2515 | return this.localeData().monthsShort(this, format); | ||
2516 | }); | ||
2517 | |||
2518 | addFormatToken('MMMM', 0, 0, function (format) { | ||
2519 | return this.localeData().months(this, format); | ||
2520 | }); | ||
2521 | |||
2522 | // ALIASES | ||
2523 | |||
2524 | addUnitAlias('month', 'M'); | ||
2525 | |||
2526 | // PRIORITY | ||
2527 | |||
2528 | addUnitPriority('month', 8); | ||
2529 | |||
2530 | // PARSING | ||
2531 | |||
2532 | addRegexToken('M', match1to2); | ||
2533 | addRegexToken('MM', match1to2, match2); | ||
2534 | addRegexToken('MMM', function (isStrict, locale) { | ||
2535 | return locale.monthsShortRegex(isStrict); | ||
2536 | }); | ||
2537 | addRegexToken('MMMM', function (isStrict, locale) { | ||
2538 | return locale.monthsRegex(isStrict); | ||
2539 | }); | ||
2540 | |||
2541 | addParseToken(['M', 'MM'], function (input, array) { | ||
2542 | array[MONTH] = toInt(input) - 1; | ||
2543 | }); | ||
2544 | |||
2545 | addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { | ||
2546 | var month = config._locale.monthsParse(input, token, config._strict); | ||
2547 | // if we didn't find a month name, mark the date as invalid. | ||
2548 | if (month != null) { | ||
2549 | array[MONTH] = month; | ||
2550 | } else { | ||
2551 | getParsingFlags(config).invalidMonth = input; | ||
2552 | } | ||
2553 | }); | ||
2554 | |||
2555 | // LOCALES | ||
2556 | |||
2557 | var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/; | ||
2558 | var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); | ||
2559 | function localeMonths (m, format) { | ||
2560 | if (!m) { | ||
2561 | return isArray(this._months) ? this._months : | ||
2562 | this._months['standalone']; | ||
2563 | } | ||
2564 | return isArray(this._months) ? this._months[m.month()] : | ||
2565 | this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; | ||
2566 | } | ||
2567 | |||
2568 | var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); | ||
2569 | function localeMonthsShort (m, format) { | ||
2570 | if (!m) { | ||
2571 | return isArray(this._monthsShort) ? this._monthsShort : | ||
2572 | this._monthsShort['standalone']; | ||
2573 | } | ||
2574 | return isArray(this._monthsShort) ? this._monthsShort[m.month()] : | ||
2575 | this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; | ||
2576 | } | ||
2577 | |||
2578 | function handleStrictParse(monthName, format, strict) { | ||
2579 | var i, ii, mom, llc = monthName.toLocaleLowerCase(); | ||
2580 | if (!this._monthsParse) { | ||
2581 | // this is not used | ||
2582 | this._monthsParse = []; | ||
2583 | this._longMonthsParse = []; | ||
2584 | this._shortMonthsParse = []; | ||
2585 | for (i = 0; i < 12; ++i) { | ||
2586 | mom = createUTC([2000, i]); | ||
2587 | this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); | ||
2588 | this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); | ||
2589 | } | ||
2590 | } | ||
2591 | |||
2592 | if (strict) { | ||
2593 | if (format === 'MMM') { | ||
2594 | ii = indexOf$1.call(this._shortMonthsParse, llc); | ||
2595 | return ii !== -1 ? ii : null; | ||
2596 | } else { | ||
2597 | ii = indexOf$1.call(this._longMonthsParse, llc); | ||
2598 | return ii !== -1 ? ii : null; | ||
2599 | } | ||
2600 | } else { | ||
2601 | if (format === 'MMM') { | ||
2602 | ii = indexOf$1.call(this._shortMonthsParse, llc); | ||
2603 | if (ii !== -1) { | ||
2604 | return ii; | ||
2605 | } | ||
2606 | ii = indexOf$1.call(this._longMonthsParse, llc); | ||
2607 | return ii !== -1 ? ii : null; | ||
2608 | } else { | ||
2609 | ii = indexOf$1.call(this._longMonthsParse, llc); | ||
2610 | if (ii !== -1) { | ||
2611 | return ii; | ||
2612 | } | ||
2613 | ii = indexOf$1.call(this._shortMonthsParse, llc); | ||
2614 | return ii !== -1 ? ii : null; | ||
2615 | } | ||
2616 | } | ||
2617 | } | ||
2618 | |||
2619 | function localeMonthsParse (monthName, format, strict) { | ||
2620 | var i, mom, regex; | ||
2621 | |||
2622 | if (this._monthsParseExact) { | ||
2623 | return handleStrictParse.call(this, monthName, format, strict); | ||
2624 | } | ||
2625 | |||
2626 | if (!this._monthsParse) { | ||
2627 | this._monthsParse = []; | ||
2628 | this._longMonthsParse = []; | ||
2629 | this._shortMonthsParse = []; | ||
2630 | } | ||
2631 | |||
2632 | // TODO: add sorting | ||
2633 | // Sorting makes sure if one month (or abbr) is a prefix of another | ||
2634 | // see sorting in computeMonthsParse | ||
2635 | for (i = 0; i < 12; i++) { | ||
2636 | // make the regex if we don't have it already | ||
2637 | mom = createUTC([2000, i]); | ||
2638 | if (strict && !this._longMonthsParse[i]) { | ||
2639 | this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); | ||
2640 | this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); | ||
2641 | } | ||
2642 | if (!strict && !this._monthsParse[i]) { | ||
2643 | regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); | ||
2644 | this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); | ||
2645 | } | ||
2646 | // test the regex | ||
2647 | if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { | ||
2648 | return i; | ||
2649 | } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { | ||
2650 | return i; | ||
2651 | } else if (!strict && this._monthsParse[i].test(monthName)) { | ||
2652 | return i; | ||
2653 | } | ||
2654 | } | ||
2655 | } | ||
2656 | |||
2657 | // MOMENTS | ||
2658 | |||
2659 | function setMonth (mom, value) { | ||
2660 | var dayOfMonth; | ||
2661 | |||
2662 | if (!mom.isValid()) { | ||
2663 | // No op | ||
2664 | return mom; | ||
2665 | } | ||
2666 | |||
2667 | if (typeof value === 'string') { | ||
2668 | if (/^\d+$/.test(value)) { | ||
2669 | value = toInt(value); | ||
2670 | } else { | ||
2671 | value = mom.localeData().monthsParse(value); | ||
2672 | // TODO: Another silent failure? | ||
2673 | if (!isNumber(value)) { | ||
2674 | return mom; | ||
2675 | } | ||
2676 | } | ||
2677 | } | ||
2678 | |||
2679 | dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); | ||
2680 | mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); | ||
2681 | return mom; | ||
2682 | } | ||
2683 | |||
2684 | function getSetMonth (value) { | ||
2685 | if (value != null) { | ||
2686 | setMonth(this, value); | ||
2687 | hooks.updateOffset(this, true); | ||
2688 | return this; | ||
2689 | } else { | ||
2690 | return get(this, 'Month'); | ||
2691 | } | ||
2692 | } | ||
2693 | |||
2694 | function getDaysInMonth () { | ||
2695 | return daysInMonth(this.year(), this.month()); | ||
2696 | } | ||
2697 | |||
2698 | var defaultMonthsShortRegex = matchWord; | ||
2699 | function monthsShortRegex (isStrict) { | ||
2700 | if (this._monthsParseExact) { | ||
2701 | if (!hasOwnProp(this, '_monthsRegex')) { | ||
2702 | computeMonthsParse.call(this); | ||
2703 | } | ||
2704 | if (isStrict) { | ||
2705 | return this._monthsShortStrictRegex; | ||
2706 | } else { | ||
2707 | return this._monthsShortRegex; | ||
2708 | } | ||
2709 | } else { | ||
2710 | if (!hasOwnProp(this, '_monthsShortRegex')) { | ||
2711 | this._monthsShortRegex = defaultMonthsShortRegex; | ||
2712 | } | ||
2713 | return this._monthsShortStrictRegex && isStrict ? | ||
2714 | this._monthsShortStrictRegex : this._monthsShortRegex; | ||
2715 | } | ||
2716 | } | ||
2717 | |||
2718 | var defaultMonthsRegex = matchWord; | ||
2719 | function monthsRegex (isStrict) { | ||
2720 | if (this._monthsParseExact) { | ||
2721 | if (!hasOwnProp(this, '_monthsRegex')) { | ||
2722 | computeMonthsParse.call(this); | ||
2723 | } | ||
2724 | if (isStrict) { | ||
2725 | return this._monthsStrictRegex; | ||
2726 | } else { | ||
2727 | return this._monthsRegex; | ||
2728 | } | ||
2729 | } else { | ||
2730 | if (!hasOwnProp(this, '_monthsRegex')) { | ||
2731 | this._monthsRegex = defaultMonthsRegex; | ||
2732 | } | ||
2733 | return this._monthsStrictRegex && isStrict ? | ||
2734 | this._monthsStrictRegex : this._monthsRegex; | ||
2735 | } | ||
2736 | } | ||
2737 | |||
2738 | function computeMonthsParse () { | ||
2739 | function cmpLenRev(a, b) { | ||
2740 | return b.length - a.length; | ||
2741 | } | ||
2742 | |||
2743 | var shortPieces = [], longPieces = [], mixedPieces = [], | ||
2744 | i, mom; | ||
2745 | for (i = 0; i < 12; i++) { | ||
2746 | // make the regex if we don't have it already | ||
2747 | mom = createUTC([2000, i]); | ||
2748 | shortPieces.push(this.monthsShort(mom, '')); | ||
2749 | longPieces.push(this.months(mom, '')); | ||
2750 | mixedPieces.push(this.months(mom, '')); | ||
2751 | mixedPieces.push(this.monthsShort(mom, '')); | ||
2752 | } | ||
2753 | // Sorting makes sure if one month (or abbr) is a prefix of another it | ||
2754 | // will match the longer piece. | ||
2755 | shortPieces.sort(cmpLenRev); | ||
2756 | longPieces.sort(cmpLenRev); | ||
2757 | mixedPieces.sort(cmpLenRev); | ||
2758 | for (i = 0; i < 12; i++) { | ||
2759 | shortPieces[i] = regexEscape(shortPieces[i]); | ||
2760 | longPieces[i] = regexEscape(longPieces[i]); | ||
2761 | } | ||
2762 | for (i = 0; i < 24; i++) { | ||
2763 | mixedPieces[i] = regexEscape(mixedPieces[i]); | ||
2764 | } | ||
2765 | |||
2766 | this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); | ||
2767 | this._monthsShortRegex = this._monthsRegex; | ||
2768 | this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); | ||
2769 | this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); | ||
2770 | } | ||
2771 | |||
2772 | // FORMATTING | ||
2773 | |||
2774 | addFormatToken('Y', 0, 0, function () { | ||
2775 | var y = this.year(); | ||
2776 | return y <= 9999 ? '' + y : '+' + y; | ||
2777 | }); | ||
2778 | |||
2779 | addFormatToken(0, ['YY', 2], 0, function () { | ||
2780 | return this.year() % 100; | ||
2781 | }); | ||
2782 | |||
2783 | addFormatToken(0, ['YYYY', 4], 0, 'year'); | ||
2784 | addFormatToken(0, ['YYYYY', 5], 0, 'year'); | ||
2785 | addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); | ||
2786 | |||
2787 | // ALIASES | ||
2788 | |||
2789 | addUnitAlias('year', 'y'); | ||
2790 | |||
2791 | // PRIORITIES | ||
2792 | |||
2793 | addUnitPriority('year', 1); | ||
2794 | |||
2795 | // PARSING | ||
2796 | |||
2797 | addRegexToken('Y', matchSigned); | ||
2798 | addRegexToken('YY', match1to2, match2); | ||
2799 | addRegexToken('YYYY', match1to4, match4); | ||
2800 | addRegexToken('YYYYY', match1to6, match6); | ||
2801 | addRegexToken('YYYYYY', match1to6, match6); | ||
2802 | |||
2803 | addParseToken(['YYYYY', 'YYYYYY'], YEAR); | ||
2804 | addParseToken('YYYY', function (input, array) { | ||
2805 | array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); | ||
2806 | }); | ||
2807 | addParseToken('YY', function (input, array) { | ||
2808 | array[YEAR] = hooks.parseTwoDigitYear(input); | ||
2809 | }); | ||
2810 | addParseToken('Y', function (input, array) { | ||
2811 | array[YEAR] = parseInt(input, 10); | ||
2812 | }); | ||
2813 | |||
2814 | // HELPERS | ||
2815 | |||
2816 | function daysInYear(year) { | ||
2817 | return isLeapYear(year) ? 366 : 365; | ||
2818 | } | ||
2819 | |||
2820 | function isLeapYear(year) { | ||
2821 | return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; | ||
2822 | } | ||
2823 | |||
2824 | // HOOKS | ||
2825 | |||
2826 | hooks.parseTwoDigitYear = function (input) { | ||
2827 | return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); | ||
2828 | }; | ||
2829 | |||
2830 | // MOMENTS | ||
2831 | |||
2832 | var getSetYear = makeGetSet('FullYear', true); | ||
2833 | |||
2834 | function getIsLeapYear () { | ||
2835 | return isLeapYear(this.year()); | ||
2836 | } | ||
2837 | |||
2838 | function createDate (y, m, d, h, M, s, ms) { | ||
2839 | // can't just apply() to create a date: | ||
2840 | // https://stackoverflow.com/q/181348 | ||
2841 | var date = new Date(y, m, d, h, M, s, ms); | ||
2842 | |||
2843 | // the date constructor remaps years 0-99 to 1900-1999 | ||
2844 | if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { | ||
2845 | date.setFullYear(y); | ||
2846 | } | ||
2847 | return date; | ||
2848 | } | ||
2849 | |||
2850 | function createUTCDate (y) { | ||
2851 | var date = new Date(Date.UTC.apply(null, arguments)); | ||
2852 | |||
2853 | // the Date.UTC function remaps years 0-99 to 1900-1999 | ||
2854 | if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { | ||
2855 | date.setUTCFullYear(y); | ||
2856 | } | ||
2857 | return date; | ||
2858 | } | ||
2859 | |||
2860 | // start-of-first-week - start-of-year | ||
2861 | function firstWeekOffset(year, dow, doy) { | ||
2862 | var // first-week day -- which january is always in the first week (4 for iso, 1 for other) | ||
2863 | fwd = 7 + dow - doy, | ||
2864 | // first-week day local weekday -- which local weekday is fwd | ||
2865 | fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; | ||
2866 | |||
2867 | return -fwdlw + fwd - 1; | ||
2868 | } | ||
2869 | |||
2870 | // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday | ||
2871 | function dayOfYearFromWeeks(year, week, weekday, dow, doy) { | ||
2872 | var localWeekday = (7 + weekday - dow) % 7, | ||
2873 | weekOffset = firstWeekOffset(year, dow, doy), | ||
2874 | dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, | ||
2875 | resYear, resDayOfYear; | ||
2876 | |||
2877 | if (dayOfYear <= 0) { | ||
2878 | resYear = year - 1; | ||
2879 | resDayOfYear = daysInYear(resYear) + dayOfYear; | ||
2880 | } else if (dayOfYear > daysInYear(year)) { | ||
2881 | resYear = year + 1; | ||
2882 | resDayOfYear = dayOfYear - daysInYear(year); | ||
2883 | } else { | ||
2884 | resYear = year; | ||
2885 | resDayOfYear = dayOfYear; | ||
2886 | } | ||
2887 | |||
2888 | return { | ||
2889 | year: resYear, | ||
2890 | dayOfYear: resDayOfYear | ||
2891 | }; | ||
2892 | } | ||
2893 | |||
2894 | function weekOfYear(mom, dow, doy) { | ||
2895 | var weekOffset = firstWeekOffset(mom.year(), dow, doy), | ||
2896 | week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, | ||
2897 | resWeek, resYear; | ||
2898 | |||
2899 | if (week < 1) { | ||
2900 | resYear = mom.year() - 1; | ||
2901 | resWeek = week + weeksInYear(resYear, dow, doy); | ||
2902 | } else if (week > weeksInYear(mom.year(), dow, doy)) { | ||
2903 | resWeek = week - weeksInYear(mom.year(), dow, doy); | ||
2904 | resYear = mom.year() + 1; | ||
2905 | } else { | ||
2906 | resYear = mom.year(); | ||
2907 | resWeek = week; | ||
2908 | } | ||
2909 | |||
2910 | return { | ||
2911 | week: resWeek, | ||
2912 | year: resYear | ||
2913 | }; | ||
2914 | } | ||
2915 | |||
2916 | function weeksInYear(year, dow, doy) { | ||
2917 | var weekOffset = firstWeekOffset(year, dow, doy), | ||
2918 | weekOffsetNext = firstWeekOffset(year + 1, dow, doy); | ||
2919 | return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; | ||
2920 | } | ||
2921 | |||
2922 | // FORMATTING | ||
2923 | |||
2924 | addFormatToken('w', ['ww', 2], 'wo', 'week'); | ||
2925 | addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); | ||
2926 | |||
2927 | // ALIASES | ||
2928 | |||
2929 | addUnitAlias('week', 'w'); | ||
2930 | addUnitAlias('isoWeek', 'W'); | ||
2931 | |||
2932 | // PRIORITIES | ||
2933 | |||
2934 | addUnitPriority('week', 5); | ||
2935 | addUnitPriority('isoWeek', 5); | ||
2936 | |||
2937 | // PARSING | ||
2938 | |||
2939 | addRegexToken('w', match1to2); | ||
2940 | addRegexToken('ww', match1to2, match2); | ||
2941 | addRegexToken('W', match1to2); | ||
2942 | addRegexToken('WW', match1to2, match2); | ||
2943 | |||
2944 | addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { | ||
2945 | week[token.substr(0, 1)] = toInt(input); | ||
2946 | }); | ||
2947 | |||
2948 | // HELPERS | ||
2949 | |||
2950 | // LOCALES | ||
2951 | |||
2952 | function localeWeek (mom) { | ||
2953 | return weekOfYear(mom, this._week.dow, this._week.doy).week; | ||
2954 | } | ||
2955 | |||
2956 | var defaultLocaleWeek = { | ||
2957 | dow : 0, // Sunday is the first day of the week. | ||
2958 | doy : 6 // The week that contains Jan 1st is the first week of the year. | ||
2959 | }; | ||
2960 | |||
2961 | function localeFirstDayOfWeek () { | ||
2962 | return this._week.dow; | ||
2963 | } | ||
2964 | |||
2965 | function localeFirstDayOfYear () { | ||
2966 | return this._week.doy; | ||
2967 | } | ||
2968 | |||
2969 | // MOMENTS | ||
2970 | |||
2971 | function getSetWeek (input) { | ||
2972 | var week = this.localeData().week(this); | ||
2973 | return input == null ? week : this.add((input - week) * 7, 'd'); | ||
2974 | } | ||
2975 | |||
2976 | function getSetISOWeek (input) { | ||
2977 | var week = weekOfYear(this, 1, 4).week; | ||
2978 | return input == null ? week : this.add((input - week) * 7, 'd'); | ||
2979 | } | ||
2980 | |||
2981 | // FORMATTING | ||
2982 | |||
2983 | addFormatToken('d', 0, 'do', 'day'); | ||
2984 | |||
2985 | addFormatToken('dd', 0, 0, function (format) { | ||
2986 | return this.localeData().weekdaysMin(this, format); | ||
2987 | }); | ||
2988 | |||
2989 | addFormatToken('ddd', 0, 0, function (format) { | ||
2990 | return this.localeData().weekdaysShort(this, format); | ||
2991 | }); | ||
2992 | |||
2993 | addFormatToken('dddd', 0, 0, function (format) { | ||
2994 | return this.localeData().weekdays(this, format); | ||
2995 | }); | ||
2996 | |||
2997 | addFormatToken('e', 0, 0, 'weekday'); | ||
2998 | addFormatToken('E', 0, 0, 'isoWeekday'); | ||
2999 | |||
3000 | // ALIASES | ||
3001 | |||
3002 | addUnitAlias('day', 'd'); | ||
3003 | addUnitAlias('weekday', 'e'); | ||
3004 | addUnitAlias('isoWeekday', 'E'); | ||
3005 | |||
3006 | // PRIORITY | ||
3007 | addUnitPriority('day', 11); | ||
3008 | addUnitPriority('weekday', 11); | ||
3009 | addUnitPriority('isoWeekday', 11); | ||
3010 | |||
3011 | // PARSING | ||
3012 | |||
3013 | addRegexToken('d', match1to2); | ||
3014 | addRegexToken('e', match1to2); | ||
3015 | addRegexToken('E', match1to2); | ||
3016 | addRegexToken('dd', function (isStrict, locale) { | ||
3017 | return locale.weekdaysMinRegex(isStrict); | ||
3018 | }); | ||
3019 | addRegexToken('ddd', function (isStrict, locale) { | ||
3020 | return locale.weekdaysShortRegex(isStrict); | ||
3021 | }); | ||
3022 | addRegexToken('dddd', function (isStrict, locale) { | ||
3023 | return locale.weekdaysRegex(isStrict); | ||
3024 | }); | ||
3025 | |||
3026 | addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { | ||
3027 | var weekday = config._locale.weekdaysParse(input, token, config._strict); | ||
3028 | // if we didn't get a weekday name, mark the date as invalid | ||
3029 | if (weekday != null) { | ||
3030 | week.d = weekday; | ||
3031 | } else { | ||
3032 | getParsingFlags(config).invalidWeekday = input; | ||
3033 | } | ||
3034 | }); | ||
3035 | |||
3036 | addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { | ||
3037 | week[token] = toInt(input); | ||
3038 | }); | ||
3039 | |||
3040 | // HELPERS | ||
3041 | |||
3042 | function parseWeekday(input, locale) { | ||
3043 | if (typeof input !== 'string') { | ||
3044 | return input; | ||
3045 | } | ||
3046 | |||
3047 | if (!isNaN(input)) { | ||
3048 | return parseInt(input, 10); | ||
3049 | } | ||
3050 | |||
3051 | input = locale.weekdaysParse(input); | ||
3052 | if (typeof input === 'number') { | ||
3053 | return input; | ||
3054 | } | ||
3055 | |||
3056 | return null; | ||
3057 | } | ||
3058 | |||
3059 | function parseIsoWeekday(input, locale) { | ||
3060 | if (typeof input === 'string') { | ||
3061 | return locale.weekdaysParse(input) % 7 || 7; | ||
3062 | } | ||
3063 | return isNaN(input) ? null : input; | ||
3064 | } | ||
3065 | |||
3066 | // LOCALES | ||
3067 | |||
3068 | var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); | ||
3069 | function localeWeekdays (m, format) { | ||
3070 | if (!m) { | ||
3071 | return isArray(this._weekdays) ? this._weekdays : | ||
3072 | this._weekdays['standalone']; | ||
3073 | } | ||
3074 | return isArray(this._weekdays) ? this._weekdays[m.day()] : | ||
3075 | this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; | ||
3076 | } | ||
3077 | |||
3078 | var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); | ||
3079 | function localeWeekdaysShort (m) { | ||
3080 | return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; | ||
3081 | } | ||
3082 | |||
3083 | var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); | ||
3084 | function localeWeekdaysMin (m) { | ||
3085 | return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; | ||
3086 | } | ||
3087 | |||
3088 | function handleStrictParse$1(weekdayName, format, strict) { | ||
3089 | var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); | ||
3090 | if (!this._weekdaysParse) { | ||
3091 | this._weekdaysParse = []; | ||
3092 | this._shortWeekdaysParse = []; | ||
3093 | this._minWeekdaysParse = []; | ||
3094 | |||
3095 | for (i = 0; i < 7; ++i) { | ||
3096 | mom = createUTC([2000, 1]).day(i); | ||
3097 | this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); | ||
3098 | this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); | ||
3099 | this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); | ||
3100 | } | ||
3101 | } | ||
3102 | |||
3103 | if (strict) { | ||
3104 | if (format === 'dddd') { | ||
3105 | ii = indexOf$1.call(this._weekdaysParse, llc); | ||
3106 | return ii !== -1 ? ii : null; | ||
3107 | } else if (format === 'ddd') { | ||
3108 | ii = indexOf$1.call(this._shortWeekdaysParse, llc); | ||
3109 | return ii !== -1 ? ii : null; | ||
3110 | } else { | ||
3111 | ii = indexOf$1.call(this._minWeekdaysParse, llc); | ||
3112 | return ii !== -1 ? ii : null; | ||
3113 | } | ||
3114 | } else { | ||
3115 | if (format === 'dddd') { | ||
3116 | ii = indexOf$1.call(this._weekdaysParse, llc); | ||
3117 | if (ii !== -1) { | ||
3118 | return ii; | ||
3119 | } | ||
3120 | ii = indexOf$1.call(this._shortWeekdaysParse, llc); | ||
3121 | if (ii !== -1) { | ||
3122 | return ii; | ||
3123 | } | ||
3124 | ii = indexOf$1.call(this._minWeekdaysParse, llc); | ||
3125 | return ii !== -1 ? ii : null; | ||
3126 | } else if (format === 'ddd') { | ||
3127 | ii = indexOf$1.call(this._shortWeekdaysParse, llc); | ||
3128 | if (ii !== -1) { | ||
3129 | return ii; | ||
3130 | } | ||
3131 | ii = indexOf$1.call(this._weekdaysParse, llc); | ||
3132 | if (ii !== -1) { | ||
3133 | return ii; | ||
3134 | } | ||
3135 | ii = indexOf$1.call(this._minWeekdaysParse, llc); | ||
3136 | return ii !== -1 ? ii : null; | ||
3137 | } else { | ||
3138 | ii = indexOf$1.call(this._minWeekdaysParse, llc); | ||
3139 | if (ii !== -1) { | ||
3140 | return ii; | ||
3141 | } | ||
3142 | ii = indexOf$1.call(this._weekdaysParse, llc); | ||
3143 | if (ii !== -1) { | ||
3144 | return ii; | ||
3145 | } | ||
3146 | ii = indexOf$1.call(this._shortWeekdaysParse, llc); | ||
3147 | return ii !== -1 ? ii : null; | ||
3148 | } | ||
3149 | } | ||
3150 | } | ||
3151 | |||
3152 | function localeWeekdaysParse (weekdayName, format, strict) { | ||
3153 | var i, mom, regex; | ||
3154 | |||
3155 | if (this._weekdaysParseExact) { | ||
3156 | return handleStrictParse$1.call(this, weekdayName, format, strict); | ||
3157 | } | ||
3158 | |||
3159 | if (!this._weekdaysParse) { | ||
3160 | this._weekdaysParse = []; | ||
3161 | this._minWeekdaysParse = []; | ||
3162 | this._shortWeekdaysParse = []; | ||
3163 | this._fullWeekdaysParse = []; | ||
3164 | } | ||
3165 | |||
3166 | for (i = 0; i < 7; i++) { | ||
3167 | // make the regex if we don't have it already | ||
3168 | |||
3169 | mom = createUTC([2000, 1]).day(i); | ||
3170 | if (strict && !this._fullWeekdaysParse[i]) { | ||
3171 | this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); | ||
3172 | this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); | ||
3173 | this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); | ||
3174 | } | ||
3175 | if (!this._weekdaysParse[i]) { | ||
3176 | regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); | ||
3177 | this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); | ||
3178 | } | ||
3179 | // test the regex | ||
3180 | if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { | ||
3181 | return i; | ||
3182 | } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { | ||
3183 | return i; | ||
3184 | } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { | ||
3185 | return i; | ||
3186 | } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { | ||
3187 | return i; | ||
3188 | } | ||
3189 | } | ||
3190 | } | ||
3191 | |||
3192 | // MOMENTS | ||
3193 | |||
3194 | function getSetDayOfWeek (input) { | ||
3195 | if (!this.isValid()) { | ||
3196 | return input != null ? this : NaN; | ||
3197 | } | ||
3198 | var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); | ||
3199 | if (input != null) { | ||
3200 | input = parseWeekday(input, this.localeData()); | ||
3201 | return this.add(input - day, 'd'); | ||
3202 | } else { | ||
3203 | return day; | ||
3204 | } | ||
3205 | } | ||
3206 | |||
3207 | function getSetLocaleDayOfWeek (input) { | ||
3208 | if (!this.isValid()) { | ||
3209 | return input != null ? this : NaN; | ||
3210 | } | ||
3211 | var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; | ||
3212 | return input == null ? weekday : this.add(input - weekday, 'd'); | ||
3213 | } | ||
3214 | |||
3215 | function getSetISODayOfWeek (input) { | ||
3216 | if (!this.isValid()) { | ||
3217 | return input != null ? this : NaN; | ||
3218 | } | ||
3219 | |||
3220 | // behaves the same as moment#day except | ||
3221 | // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) | ||
3222 | // as a setter, sunday should belong to the previous week. | ||
3223 | |||
3224 | if (input != null) { | ||
3225 | var weekday = parseIsoWeekday(input, this.localeData()); | ||
3226 | return this.day(this.day() % 7 ? weekday : weekday - 7); | ||
3227 | } else { | ||
3228 | return this.day() || 7; | ||
3229 | } | ||
3230 | } | ||
3231 | |||
3232 | var defaultWeekdaysRegex = matchWord; | ||
3233 | function weekdaysRegex (isStrict) { | ||
3234 | if (this._weekdaysParseExact) { | ||
3235 | if (!hasOwnProp(this, '_weekdaysRegex')) { | ||
3236 | computeWeekdaysParse.call(this); | ||
3237 | } | ||
3238 | if (isStrict) { | ||
3239 | return this._weekdaysStrictRegex; | ||
3240 | } else { | ||
3241 | return this._weekdaysRegex; | ||
3242 | } | ||
3243 | } else { | ||
3244 | if (!hasOwnProp(this, '_weekdaysRegex')) { | ||
3245 | this._weekdaysRegex = defaultWeekdaysRegex; | ||
3246 | } | ||
3247 | return this._weekdaysStrictRegex && isStrict ? | ||
3248 | this._weekdaysStrictRegex : this._weekdaysRegex; | ||
3249 | } | ||
3250 | } | ||
3251 | |||
3252 | var defaultWeekdaysShortRegex = matchWord; | ||
3253 | function weekdaysShortRegex (isStrict) { | ||
3254 | if (this._weekdaysParseExact) { | ||
3255 | if (!hasOwnProp(this, '_weekdaysRegex')) { | ||
3256 | computeWeekdaysParse.call(this); | ||
3257 | } | ||
3258 | if (isStrict) { | ||
3259 | return this._weekdaysShortStrictRegex; | ||
3260 | } else { | ||
3261 | return this._weekdaysShortRegex; | ||
3262 | } | ||
3263 | } else { | ||
3264 | if (!hasOwnProp(this, '_weekdaysShortRegex')) { | ||
3265 | this._weekdaysShortRegex = defaultWeekdaysShortRegex; | ||
3266 | } | ||
3267 | return this._weekdaysShortStrictRegex && isStrict ? | ||
3268 | this._weekdaysShortStrictRegex : this._weekdaysShortRegex; | ||
3269 | } | ||
3270 | } | ||
3271 | |||
3272 | var defaultWeekdaysMinRegex = matchWord; | ||
3273 | function weekdaysMinRegex (isStrict) { | ||
3274 | if (this._weekdaysParseExact) { | ||
3275 | if (!hasOwnProp(this, '_weekdaysRegex')) { | ||
3276 | computeWeekdaysParse.call(this); | ||
3277 | } | ||
3278 | if (isStrict) { | ||
3279 | return this._weekdaysMinStrictRegex; | ||
3280 | } else { | ||
3281 | return this._weekdaysMinRegex; | ||
3282 | } | ||
3283 | } else { | ||
3284 | if (!hasOwnProp(this, '_weekdaysMinRegex')) { | ||
3285 | this._weekdaysMinRegex = defaultWeekdaysMinRegex; | ||
3286 | } | ||
3287 | return this._weekdaysMinStrictRegex && isStrict ? | ||
3288 | this._weekdaysMinStrictRegex : this._weekdaysMinRegex; | ||
3289 | } | ||
3290 | } | ||
3291 | |||
3292 | |||
3293 | function computeWeekdaysParse () { | ||
3294 | function cmpLenRev(a, b) { | ||
3295 | return b.length - a.length; | ||
3296 | } | ||
3297 | |||
3298 | var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], | ||
3299 | i, mom, minp, shortp, longp; | ||
3300 | for (i = 0; i < 7; i++) { | ||
3301 | // make the regex if we don't have it already | ||
3302 | mom = createUTC([2000, 1]).day(i); | ||
3303 | minp = this.weekdaysMin(mom, ''); | ||
3304 | shortp = this.weekdaysShort(mom, ''); | ||
3305 | longp = this.weekdays(mom, ''); | ||
3306 | minPieces.push(minp); | ||
3307 | shortPieces.push(shortp); | ||
3308 | longPieces.push(longp); | ||
3309 | mixedPieces.push(minp); | ||
3310 | mixedPieces.push(shortp); | ||
3311 | mixedPieces.push(longp); | ||
3312 | } | ||
3313 | // Sorting makes sure if one weekday (or abbr) is a prefix of another it | ||
3314 | // will match the longer piece. | ||
3315 | minPieces.sort(cmpLenRev); | ||
3316 | shortPieces.sort(cmpLenRev); | ||
3317 | longPieces.sort(cmpLenRev); | ||
3318 | mixedPieces.sort(cmpLenRev); | ||
3319 | for (i = 0; i < 7; i++) { | ||
3320 | shortPieces[i] = regexEscape(shortPieces[i]); | ||
3321 | longPieces[i] = regexEscape(longPieces[i]); | ||
3322 | mixedPieces[i] = regexEscape(mixedPieces[i]); | ||
3323 | } | ||
3324 | |||
3325 | this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); | ||
3326 | this._weekdaysShortRegex = this._weekdaysRegex; | ||
3327 | this._weekdaysMinRegex = this._weekdaysRegex; | ||
3328 | |||
3329 | this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); | ||
3330 | this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); | ||
3331 | this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); | ||
3332 | } | ||
3333 | |||
3334 | // FORMATTING | ||
3335 | |||
3336 | function hFormat() { | ||
3337 | return this.hours() % 12 || 12; | ||
3338 | } | ||
3339 | |||
3340 | function kFormat() { | ||
3341 | return this.hours() || 24; | ||
3342 | } | ||
3343 | |||
3344 | addFormatToken('H', ['HH', 2], 0, 'hour'); | ||
3345 | addFormatToken('h', ['hh', 2], 0, hFormat); | ||
3346 | addFormatToken('k', ['kk', 2], 0, kFormat); | ||
3347 | |||
3348 | addFormatToken('hmm', 0, 0, function () { | ||
3349 | return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); | ||
3350 | }); | ||
3351 | |||
3352 | addFormatToken('hmmss', 0, 0, function () { | ||
3353 | return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + | ||
3354 | zeroFill(this.seconds(), 2); | ||
3355 | }); | ||
3356 | |||
3357 | addFormatToken('Hmm', 0, 0, function () { | ||
3358 | return '' + this.hours() + zeroFill(this.minutes(), 2); | ||
3359 | }); | ||
3360 | |||
3361 | addFormatToken('Hmmss', 0, 0, function () { | ||
3362 | return '' + this.hours() + zeroFill(this.minutes(), 2) + | ||
3363 | zeroFill(this.seconds(), 2); | ||
3364 | }); | ||
3365 | |||
3366 | function meridiem (token, lowercase) { | ||
3367 | addFormatToken(token, 0, 0, function () { | ||
3368 | return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); | ||
3369 | }); | ||
3370 | } | ||
3371 | |||
3372 | meridiem('a', true); | ||
3373 | meridiem('A', false); | ||
3374 | |||
3375 | // ALIASES | ||
3376 | |||
3377 | addUnitAlias('hour', 'h'); | ||
3378 | |||
3379 | // PRIORITY | ||
3380 | addUnitPriority('hour', 13); | ||
3381 | |||
3382 | // PARSING | ||
3383 | |||
3384 | function matchMeridiem (isStrict, locale) { | ||
3385 | return locale._meridiemParse; | ||
3386 | } | ||
3387 | |||
3388 | addRegexToken('a', matchMeridiem); | ||
3389 | addRegexToken('A', matchMeridiem); | ||
3390 | addRegexToken('H', match1to2); | ||
3391 | addRegexToken('h', match1to2); | ||
3392 | addRegexToken('k', match1to2); | ||
3393 | addRegexToken('HH', match1to2, match2); | ||
3394 | addRegexToken('hh', match1to2, match2); | ||
3395 | addRegexToken('kk', match1to2, match2); | ||
3396 | |||
3397 | addRegexToken('hmm', match3to4); | ||
3398 | addRegexToken('hmmss', match5to6); | ||
3399 | addRegexToken('Hmm', match3to4); | ||
3400 | addRegexToken('Hmmss', match5to6); | ||
3401 | |||
3402 | addParseToken(['H', 'HH'], HOUR); | ||
3403 | addParseToken(['k', 'kk'], function (input, array, config) { | ||
3404 | var kInput = toInt(input); | ||
3405 | array[HOUR] = kInput === 24 ? 0 : kInput; | ||
3406 | }); | ||
3407 | addParseToken(['a', 'A'], function (input, array, config) { | ||
3408 | config._isPm = config._locale.isPM(input); | ||
3409 | config._meridiem = input; | ||
3410 | }); | ||
3411 | addParseToken(['h', 'hh'], function (input, array, config) { | ||
3412 | array[HOUR] = toInt(input); | ||
3413 | getParsingFlags(config).bigHour = true; | ||
3414 | }); | ||
3415 | addParseToken('hmm', function (input, array, config) { | ||
3416 | var pos = input.length - 2; | ||
3417 | array[HOUR] = toInt(input.substr(0, pos)); | ||
3418 | array[MINUTE] = toInt(input.substr(pos)); | ||
3419 | getParsingFlags(config).bigHour = true; | ||
3420 | }); | ||
3421 | addParseToken('hmmss', function (input, array, config) { | ||
3422 | var pos1 = input.length - 4; | ||
3423 | var pos2 = input.length - 2; | ||
3424 | array[HOUR] = toInt(input.substr(0, pos1)); | ||
3425 | array[MINUTE] = toInt(input.substr(pos1, 2)); | ||
3426 | array[SECOND] = toInt(input.substr(pos2)); | ||
3427 | getParsingFlags(config).bigHour = true; | ||
3428 | }); | ||
3429 | addParseToken('Hmm', function (input, array, config) { | ||
3430 | var pos = input.length - 2; | ||
3431 | array[HOUR] = toInt(input.substr(0, pos)); | ||
3432 | array[MINUTE] = toInt(input.substr(pos)); | ||
3433 | }); | ||
3434 | addParseToken('Hmmss', function (input, array, config) { | ||
3435 | var pos1 = input.length - 4; | ||
3436 | var pos2 = input.length - 2; | ||
3437 | array[HOUR] = toInt(input.substr(0, pos1)); | ||
3438 | array[MINUTE] = toInt(input.substr(pos1, 2)); | ||
3439 | array[SECOND] = toInt(input.substr(pos2)); | ||
3440 | }); | ||
3441 | |||
3442 | // LOCALES | ||
3443 | |||
3444 | function localeIsPM (input) { | ||
3445 | // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays | ||
3446 | // Using charAt should be more compatible. | ||
3447 | return ((input + '').toLowerCase().charAt(0) === 'p'); | ||
3448 | } | ||
3449 | |||
3450 | var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; | ||
3451 | function localeMeridiem (hours, minutes, isLower) { | ||
3452 | if (hours > 11) { | ||
3453 | return isLower ? 'pm' : 'PM'; | ||
3454 | } else { | ||
3455 | return isLower ? 'am' : 'AM'; | ||
3456 | } | ||
3457 | } | ||
3458 | |||
3459 | |||
3460 | // MOMENTS | ||
3461 | |||
3462 | // Setting the hour should keep the time, because the user explicitly | ||
3463 | // specified which hour he wants. So trying to maintain the same hour (in | ||
3464 | // a new timezone) makes sense. Adding/subtracting hours does not follow | ||
3465 | // this rule. | ||
3466 | var getSetHour = makeGetSet('Hours', true); | ||
3467 | |||
3468 | // months | ||
3469 | // week | ||
3470 | // weekdays | ||
3471 | // meridiem | ||
3472 | var baseConfig = { | ||
3473 | calendar: defaultCalendar, | ||
3474 | longDateFormat: defaultLongDateFormat, | ||
3475 | invalidDate: defaultInvalidDate, | ||
3476 | ordinal: defaultOrdinal, | ||
3477 | dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, | ||
3478 | relativeTime: defaultRelativeTime, | ||
3479 | |||
3480 | months: defaultLocaleMonths, | ||
3481 | monthsShort: defaultLocaleMonthsShort, | ||
3482 | |||
3483 | week: defaultLocaleWeek, | ||
3484 | |||
3485 | weekdays: defaultLocaleWeekdays, | ||
3486 | weekdaysMin: defaultLocaleWeekdaysMin, | ||
3487 | weekdaysShort: defaultLocaleWeekdaysShort, | ||
3488 | |||
3489 | meridiemParse: defaultLocaleMeridiemParse | ||
3490 | }; | ||
3491 | |||
3492 | // internal storage for locale config files | ||
3493 | var locales = {}; | ||
3494 | var localeFamilies = {}; | ||
3495 | var globalLocale; | ||
3496 | |||
3497 | function normalizeLocale(key) { | ||
3498 | return key ? key.toLowerCase().replace('_', '-') : key; | ||
3499 | } | ||
3500 | |||
3501 | // pick the locale from the array | ||
3502 | // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each | ||
3503 | // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root | ||
3504 | function chooseLocale(names) { | ||
3505 | var i = 0, j, next, locale, split; | ||
3506 | |||
3507 | while (i < names.length) { | ||
3508 | split = normalizeLocale(names[i]).split('-'); | ||
3509 | j = split.length; | ||
3510 | next = normalizeLocale(names[i + 1]); | ||
3511 | next = next ? next.split('-') : null; | ||
3512 | while (j > 0) { | ||
3513 | locale = loadLocale(split.slice(0, j).join('-')); | ||
3514 | if (locale) { | ||
3515 | return locale; | ||
3516 | } | ||
3517 | if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { | ||
3518 | //the next array item is better than a shallower substring of this one | ||
3519 | break; | ||
3520 | } | ||
3521 | j--; | ||
3522 | } | ||
3523 | i++; | ||
3524 | } | ||
3525 | return null; | ||
3526 | } | ||
3527 | |||
3528 | function loadLocale(name) { | ||
3529 | var oldLocale = null; | ||
3530 | // TODO: Find a better way to register and load all the locales in Node | ||
3531 | if (!locales[name] && (typeof module !== 'undefined') && | ||
3532 | module && module.exports) { | ||
3533 | try { | ||
3534 | oldLocale = globalLocale._abbr; | ||
3535 | require('./locale/' + name); | ||
3536 | // because defineLocale currently also sets the global locale, we | ||
3537 | // want to undo that for lazy loaded locales | ||
3538 | getSetGlobalLocale(oldLocale); | ||
3539 | } catch (e) { } | ||
3540 | } | ||
3541 | return locales[name]; | ||
3542 | } | ||
3543 | |||
3544 | // This function will load locale and then set the global locale. If | ||
3545 | // no arguments are passed in, it will simply return the current global | ||
3546 | // locale key. | ||
3547 | function getSetGlobalLocale (key, values) { | ||
3548 | var data; | ||
3549 | if (key) { | ||
3550 | if (isUndefined(values)) { | ||
3551 | data = getLocale(key); | ||
3552 | } | ||
3553 | else { | ||
3554 | data = defineLocale(key, values); | ||
3555 | } | ||
3556 | |||
3557 | if (data) { | ||
3558 | // moment.duration._locale = moment._locale = data; | ||
3559 | globalLocale = data; | ||
3560 | } | ||
3561 | } | ||
3562 | |||
3563 | return globalLocale._abbr; | ||
3564 | } | ||
3565 | |||
3566 | function defineLocale (name, config) { | ||
3567 | if (config !== null) { | ||
3568 | var parentConfig = baseConfig; | ||
3569 | config.abbr = name; | ||
3570 | if (locales[name] != null) { | ||
3571 | deprecateSimple('defineLocaleOverride', | ||
3572 | 'use moment.updateLocale(localeName, config) to change ' + | ||
3573 | 'an existing locale. moment.defineLocale(localeName, ' + | ||
3574 | 'config) should only be used for creating a new locale ' + | ||
3575 | 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); | ||
3576 | parentConfig = locales[name]._config; | ||
3577 | } else if (config.parentLocale != null) { | ||
3578 | if (locales[config.parentLocale] != null) { | ||
3579 | parentConfig = locales[config.parentLocale]._config; | ||
3580 | } else { | ||
3581 | if (!localeFamilies[config.parentLocale]) { | ||
3582 | localeFamilies[config.parentLocale] = []; | ||
3583 | } | ||
3584 | localeFamilies[config.parentLocale].push({ | ||
3585 | name: name, | ||
3586 | config: config | ||
3587 | }); | ||
3588 | return null; | ||
3589 | } | ||
3590 | } | ||
3591 | locales[name] = new Locale(mergeConfigs(parentConfig, config)); | ||
3592 | |||
3593 | if (localeFamilies[name]) { | ||
3594 | localeFamilies[name].forEach(function (x) { | ||
3595 | defineLocale(x.name, x.config); | ||
3596 | }); | ||
3597 | } | ||
3598 | |||
3599 | // backwards compat for now: also set the locale | ||
3600 | // make sure we set the locale AFTER all child locales have been | ||
3601 | // created, so we won't end up with the child locale set. | ||
3602 | getSetGlobalLocale(name); | ||
3603 | |||
3604 | |||
3605 | return locales[name]; | ||
3606 | } else { | ||
3607 | // useful for testing | ||
3608 | delete locales[name]; | ||
3609 | return null; | ||
3610 | } | ||
3611 | } | ||
3612 | |||
3613 | function updateLocale(name, config) { | ||
3614 | if (config != null) { | ||
3615 | var locale, parentConfig = baseConfig; | ||
3616 | // MERGE | ||
3617 | if (locales[name] != null) { | ||
3618 | parentConfig = locales[name]._config; | ||
3619 | } | ||
3620 | config = mergeConfigs(parentConfig, config); | ||
3621 | locale = new Locale(config); | ||
3622 | locale.parentLocale = locales[name]; | ||
3623 | locales[name] = locale; | ||
3624 | |||
3625 | // backwards compat for now: also set the locale | ||
3626 | getSetGlobalLocale(name); | ||
3627 | } else { | ||
3628 | // pass null for config to unupdate, useful for tests | ||
3629 | if (locales[name] != null) { | ||
3630 | if (locales[name].parentLocale != null) { | ||
3631 | locales[name] = locales[name].parentLocale; | ||
3632 | } else if (locales[name] != null) { | ||
3633 | delete locales[name]; | ||
3634 | } | ||
3635 | } | ||
3636 | } | ||
3637 | return locales[name]; | ||
3638 | } | ||
3639 | |||
3640 | // returns locale data | ||
3641 | function getLocale (key) { | ||
3642 | var locale; | ||
3643 | |||
3644 | if (key && key._locale && key._locale._abbr) { | ||
3645 | key = key._locale._abbr; | ||
3646 | } | ||
3647 | |||
3648 | if (!key) { | ||
3649 | return globalLocale; | ||
3650 | } | ||
3651 | |||
3652 | if (!isArray(key)) { | ||
3653 | //short-circuit everything else | ||
3654 | locale = loadLocale(key); | ||
3655 | if (locale) { | ||
3656 | return locale; | ||
3657 | } | ||
3658 | key = [key]; | ||
3659 | } | ||
3660 | |||
3661 | return chooseLocale(key); | ||
3662 | } | ||
3663 | |||
3664 | function listLocales() { | ||
3665 | return keys$1(locales); | ||
3666 | } | ||
3667 | |||
3668 | function checkOverflow (m) { | ||
3669 | var overflow; | ||
3670 | var a = m._a; | ||
3671 | |||
3672 | if (a && getParsingFlags(m).overflow === -2) { | ||
3673 | overflow = | ||
3674 | a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : | ||
3675 | a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : | ||
3676 | a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : | ||
3677 | a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : | ||
3678 | a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : | ||
3679 | a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : | ||
3680 | -1; | ||
3681 | |||
3682 | if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { | ||
3683 | overflow = DATE; | ||
3684 | } | ||
3685 | if (getParsingFlags(m)._overflowWeeks && overflow === -1) { | ||
3686 | overflow = WEEK; | ||
3687 | } | ||
3688 | if (getParsingFlags(m)._overflowWeekday && overflow === -1) { | ||
3689 | overflow = WEEKDAY; | ||
3690 | } | ||
3691 | |||
3692 | getParsingFlags(m).overflow = overflow; | ||
3693 | } | ||
3694 | |||
3695 | return m; | ||
3696 | } | ||
3697 | |||
3698 | // iso 8601 regex | ||
3699 | // 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) | ||
3700 | 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)?)?$/; | ||
3701 | 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)?)?$/; | ||
3702 | |||
3703 | var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; | ||
3704 | |||
3705 | var isoDates = [ | ||
3706 | ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], | ||
3707 | ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], | ||
3708 | ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], | ||
3709 | ['GGGG-[W]WW', /\d{4}-W\d\d/, false], | ||
3710 | ['YYYY-DDD', /\d{4}-\d{3}/], | ||
3711 | ['YYYY-MM', /\d{4}-\d\d/, false], | ||
3712 | ['YYYYYYMMDD', /[+-]\d{10}/], | ||
3713 | ['YYYYMMDD', /\d{8}/], | ||
3714 | // YYYYMM is NOT allowed by the standard | ||
3715 | ['GGGG[W]WWE', /\d{4}W\d{3}/], | ||
3716 | ['GGGG[W]WW', /\d{4}W\d{2}/, false], | ||
3717 | ['YYYYDDD', /\d{7}/] | ||
3718 | ]; | ||
3719 | |||
3720 | // iso time formats and regexes | ||
3721 | var isoTimes = [ | ||
3722 | ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], | ||
3723 | ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], | ||
3724 | ['HH:mm:ss', /\d\d:\d\d:\d\d/], | ||
3725 | ['HH:mm', /\d\d:\d\d/], | ||
3726 | ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], | ||
3727 | ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], | ||
3728 | ['HHmmss', /\d\d\d\d\d\d/], | ||
3729 | ['HHmm', /\d\d\d\d/], | ||
3730 | ['HH', /\d\d/] | ||
3731 | ]; | ||
3732 | |||
3733 | var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; | ||
3734 | |||
3735 | // date from iso format | ||
3736 | function configFromISO(config) { | ||
3737 | var i, l, | ||
3738 | string = config._i, | ||
3739 | match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), | ||
3740 | allowTime, dateFormat, timeFormat, tzFormat; | ||
3741 | |||
3742 | if (match) { | ||
3743 | getParsingFlags(config).iso = true; | ||
3744 | |||
3745 | for (i = 0, l = isoDates.length; i < l; i++) { | ||
3746 | if (isoDates[i][1].exec(match[1])) { | ||
3747 | dateFormat = isoDates[i][0]; | ||
3748 | allowTime = isoDates[i][2] !== false; | ||
3749 | break; | ||
3750 | } | ||
3751 | } | ||
3752 | if (dateFormat == null) { | ||
3753 | config._isValid = false; | ||
3754 | return; | ||
3755 | } | ||
3756 | if (match[3]) { | ||
3757 | for (i = 0, l = isoTimes.length; i < l; i++) { | ||
3758 | if (isoTimes[i][1].exec(match[3])) { | ||
3759 | // match[2] should be 'T' or space | ||
3760 | timeFormat = (match[2] || ' ') + isoTimes[i][0]; | ||
3761 | break; | ||
3762 | } | ||
3763 | } | ||
3764 | if (timeFormat == null) { | ||
3765 | config._isValid = false; | ||
3766 | return; | ||
3767 | } | ||
3768 | } | ||
3769 | if (!allowTime && timeFormat != null) { | ||
3770 | config._isValid = false; | ||
3771 | return; | ||
3772 | } | ||
3773 | if (match[4]) { | ||
3774 | if (tzRegex.exec(match[4])) { | ||
3775 | tzFormat = 'Z'; | ||
3776 | } else { | ||
3777 | config._isValid = false; | ||
3778 | return; | ||
3779 | } | ||
3780 | } | ||
3781 | config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); | ||
3782 | configFromStringAndFormat(config); | ||
3783 | } else { | ||
3784 | config._isValid = false; | ||
3785 | } | ||
3786 | } | ||
3787 | |||
3788 | // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 | ||
3789 | 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}))$/; | ||
3790 | |||
3791 | // date and time from ref 2822 format | ||
3792 | function configFromRFC2822(config) { | ||
3793 | var string, match, dayFormat, | ||
3794 | dateFormat, timeFormat, tzFormat; | ||
3795 | var timezones = { | ||
3796 | ' GMT': ' +0000', | ||
3797 | ' EDT': ' -0400', | ||
3798 | ' EST': ' -0500', | ||
3799 | ' CDT': ' -0500', | ||
3800 | ' CST': ' -0600', | ||
3801 | ' MDT': ' -0600', | ||
3802 | ' MST': ' -0700', | ||
3803 | ' PDT': ' -0700', | ||
3804 | ' PST': ' -0800' | ||
3805 | }; | ||
3806 | var military = 'YXWVUTSRQPONZABCDEFGHIKLM'; | ||
3807 | var timezone, timezoneIndex; | ||
3808 | |||
3809 | string = config._i | ||
3810 | .replace(/\([^\)]*\)|[\n\t]/g, ' ') // Remove comments and folding whitespace | ||
3811 | .replace(/(\s\s+)/g, ' ') // Replace multiple-spaces with a single space | ||
3812 | .replace(/^\s|\s$/g, ''); // Remove leading and trailing spaces | ||
3813 | match = basicRfcRegex.exec(string); | ||
3814 | |||
3815 | if (match) { | ||
3816 | dayFormat = match[1] ? 'ddd' + ((match[1].length === 5) ? ', ' : ' ') : ''; | ||
3817 | dateFormat = 'D MMM ' + ((match[2].length > 10) ? 'YYYY ' : 'YY '); | ||
3818 | timeFormat = 'HH:mm' + (match[4] ? ':ss' : ''); | ||
3819 | |||
3820 | // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. | ||
3821 | if (match[1]) { // day of week given | ||
3822 | var momentDate = new Date(match[2]); | ||
3823 | var momentDay = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][momentDate.getDay()]; | ||
3824 | |||
3825 | if (match[1].substr(0,3) !== momentDay) { | ||
3826 | getParsingFlags(config).weekdayMismatch = true; | ||
3827 | config._isValid = false; | ||
3828 | return; | ||
3829 | } | ||
3830 | } | ||
3831 | |||
3832 | switch (match[5].length) { | ||
3833 | case 2: // military | ||
3834 | if (timezoneIndex === 0) { | ||
3835 | timezone = ' +0000'; | ||
3836 | } else { | ||
3837 | timezoneIndex = military.indexOf(match[5][1].toUpperCase()) - 12; | ||
3838 | timezone = ((timezoneIndex < 0) ? ' -' : ' +') + | ||
3839 | (('' + timezoneIndex).replace(/^-?/, '0')).match(/..$/)[0] + '00'; | ||
3840 | } | ||
3841 | break; | ||
3842 | case 4: // Zone | ||
3843 | timezone = timezones[match[5]]; | ||
3844 | break; | ||
3845 | default: // UT or +/-9999 | ||
3846 | timezone = timezones[' GMT']; | ||
3847 | } | ||
3848 | match[5] = timezone; | ||
3849 | config._i = match.splice(1).join(''); | ||
3850 | tzFormat = ' ZZ'; | ||
3851 | config._f = dayFormat + dateFormat + timeFormat + tzFormat; | ||
3852 | configFromStringAndFormat(config); | ||
3853 | getParsingFlags(config).rfc2822 = true; | ||
3854 | } else { | ||
3855 | config._isValid = false; | ||
3856 | } | ||
3857 | } | ||
3858 | |||
3859 | // date from iso format or fallback | ||
3860 | function configFromString(config) { | ||
3861 | var matched = aspNetJsonRegex.exec(config._i); | ||
3862 | |||
3863 | if (matched !== null) { | ||
3864 | config._d = new Date(+matched[1]); | ||
3865 | return; | ||
3866 | } | ||
3867 | |||
3868 | configFromISO(config); | ||
3869 | if (config._isValid === false) { | ||
3870 | delete config._isValid; | ||
3871 | } else { | ||
3872 | return; | ||
3873 | } | ||
3874 | |||
3875 | configFromRFC2822(config); | ||
3876 | if (config._isValid === false) { | ||
3877 | delete config._isValid; | ||
3878 | } else { | ||
3879 | return; | ||
3880 | } | ||
3881 | |||
3882 | // Final attempt, use Input Fallback | ||
3883 | hooks.createFromInputFallback(config); | ||
3884 | } | ||
3885 | |||
3886 | hooks.createFromInputFallback = deprecate( | ||
3887 | 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + | ||
3888 | 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + | ||
3889 | 'discouraged and will be removed in an upcoming major release. Please refer to ' + | ||
3890 | 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', | ||
3891 | function (config) { | ||
3892 | config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); | ||
3893 | } | ||
3894 | ); | ||
3895 | |||
3896 | // Pick the first defined of two or three arguments. | ||
3897 | function defaults(a, b, c) { | ||
3898 | if (a != null) { | ||
3899 | return a; | ||
3900 | } | ||
3901 | if (b != null) { | ||
3902 | return b; | ||
3903 | } | ||
3904 | return c; | ||
3905 | } | ||
3906 | |||
3907 | function currentDateArray(config) { | ||
3908 | // hooks is actually the exported moment object | ||
3909 | var nowValue = new Date(hooks.now()); | ||
3910 | if (config._useUTC) { | ||
3911 | return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; | ||
3912 | } | ||
3913 | return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; | ||
3914 | } | ||
3915 | |||
3916 | // convert an array to a date. | ||
3917 | // the array should mirror the parameters below | ||
3918 | // note: all values past the year are optional and will default to the lowest possible value. | ||
3919 | // [year, month, day , hour, minute, second, millisecond] | ||
3920 | function configFromArray (config) { | ||
3921 | var i, date, input = [], currentDate, yearToUse; | ||
3922 | |||
3923 | if (config._d) { | ||
3924 | return; | ||
3925 | } | ||
3926 | |||
3927 | currentDate = currentDateArray(config); | ||
3928 | |||
3929 | //compute day of the year from weeks and weekdays | ||
3930 | if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { | ||
3931 | dayOfYearFromWeekInfo(config); | ||
3932 | } | ||
3933 | |||
3934 | //if the day of the year is set, figure out what it is | ||
3935 | if (config._dayOfYear != null) { | ||
3936 | yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); | ||
3937 | |||
3938 | if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { | ||
3939 | getParsingFlags(config)._overflowDayOfYear = true; | ||
3940 | } | ||
3941 | |||
3942 | date = createUTCDate(yearToUse, 0, config._dayOfYear); | ||
3943 | config._a[MONTH] = date.getUTCMonth(); | ||
3944 | config._a[DATE] = date.getUTCDate(); | ||
3945 | } | ||
3946 | |||
3947 | // Default to current date. | ||
3948 | // * if no year, month, day of month are given, default to today | ||
3949 | // * if day of month is given, default month and year | ||
3950 | // * if month is given, default only year | ||
3951 | // * if year is given, don't default anything | ||
3952 | for (i = 0; i < 3 && config._a[i] == null; ++i) { | ||
3953 | config._a[i] = input[i] = currentDate[i]; | ||
3954 | } | ||
3955 | |||
3956 | // Zero out whatever was not defaulted, including time | ||
3957 | for (; i < 7; i++) { | ||
3958 | config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; | ||
3959 | } | ||
3960 | |||
3961 | // Check for 24:00:00.000 | ||
3962 | if (config._a[HOUR] === 24 && | ||
3963 | config._a[MINUTE] === 0 && | ||
3964 | config._a[SECOND] === 0 && | ||
3965 | config._a[MILLISECOND] === 0) { | ||
3966 | config._nextDay = true; | ||
3967 | config._a[HOUR] = 0; | ||
3968 | } | ||
3969 | |||
3970 | config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); | ||
3971 | // Apply timezone offset from input. The actual utcOffset can be changed | ||
3972 | // with parseZone. | ||
3973 | if (config._tzm != null) { | ||
3974 | config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); | ||
3975 | } | ||
3976 | |||
3977 | if (config._nextDay) { | ||
3978 | config._a[HOUR] = 24; | ||
3979 | } | ||
3980 | } | ||
3981 | |||
3982 | function dayOfYearFromWeekInfo(config) { | ||
3983 | var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; | ||
3984 | |||
3985 | w = config._w; | ||
3986 | if (w.GG != null || w.W != null || w.E != null) { | ||
3987 | dow = 1; | ||
3988 | doy = 4; | ||
3989 | |||
3990 | // TODO: We need to take the current isoWeekYear, but that depends on | ||
3991 | // how we interpret now (local, utc, fixed offset). So create | ||
3992 | // a now version of current config (take local/utc/offset flags, and | ||
3993 | // create now). | ||
3994 | weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); | ||
3995 | week = defaults(w.W, 1); | ||
3996 | weekday = defaults(w.E, 1); | ||
3997 | if (weekday < 1 || weekday > 7) { | ||
3998 | weekdayOverflow = true; | ||
3999 | } | ||
4000 | } else { | ||
4001 | dow = config._locale._week.dow; | ||
4002 | doy = config._locale._week.doy; | ||
4003 | |||
4004 | var curWeek = weekOfYear(createLocal(), dow, doy); | ||
4005 | |||
4006 | weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); | ||
4007 | |||
4008 | // Default to current week. | ||
4009 | week = defaults(w.w, curWeek.week); | ||
4010 | |||
4011 | if (w.d != null) { | ||
4012 | // weekday -- low day numbers are considered next week | ||
4013 | weekday = w.d; | ||
4014 | if (weekday < 0 || weekday > 6) { | ||
4015 | weekdayOverflow = true; | ||
4016 | } | ||
4017 | } else if (w.e != null) { | ||
4018 | // local weekday -- counting starts from begining of week | ||
4019 | weekday = w.e + dow; | ||
4020 | if (w.e < 0 || w.e > 6) { | ||
4021 | weekdayOverflow = true; | ||
4022 | } | ||
4023 | } else { | ||
4024 | // default to begining of week | ||
4025 | weekday = dow; | ||
4026 | } | ||
4027 | } | ||
4028 | if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { | ||
4029 | getParsingFlags(config)._overflowWeeks = true; | ||
4030 | } else if (weekdayOverflow != null) { | ||
4031 | getParsingFlags(config)._overflowWeekday = true; | ||
4032 | } else { | ||
4033 | temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); | ||
4034 | config._a[YEAR] = temp.year; | ||
4035 | config._dayOfYear = temp.dayOfYear; | ||
4036 | } | ||
4037 | } | ||
4038 | |||
4039 | // constant that refers to the ISO standard | ||
4040 | hooks.ISO_8601 = function () {}; | ||
4041 | |||
4042 | // constant that refers to the RFC 2822 form | ||
4043 | hooks.RFC_2822 = function () {}; | ||
4044 | |||
4045 | // date from string and format string | ||
4046 | function configFromStringAndFormat(config) { | ||
4047 | // TODO: Move this to another part of the creation flow to prevent circular deps | ||
4048 | if (config._f === hooks.ISO_8601) { | ||
4049 | configFromISO(config); | ||
4050 | return; | ||
4051 | } | ||
4052 | if (config._f === hooks.RFC_2822) { | ||
4053 | configFromRFC2822(config); | ||
4054 | return; | ||
4055 | } | ||
4056 | config._a = []; | ||
4057 | getParsingFlags(config).empty = true; | ||
4058 | |||
4059 | // This array is used to make a Date, either with `new Date` or `Date.UTC` | ||
4060 | var string = '' + config._i, | ||
4061 | i, parsedInput, tokens, token, skipped, | ||
4062 | stringLength = string.length, | ||
4063 | totalParsedInputLength = 0; | ||
4064 | |||
4065 | tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; | ||
4066 | |||
4067 | for (i = 0; i < tokens.length; i++) { | ||
4068 | token = tokens[i]; | ||
4069 | parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; | ||
4070 | // console.log('token', token, 'parsedInput', parsedInput, | ||
4071 | // 'regex', getParseRegexForToken(token, config)); | ||
4072 | if (parsedInput) { | ||
4073 | skipped = string.substr(0, string.indexOf(parsedInput)); | ||
4074 | if (skipped.length > 0) { | ||
4075 | getParsingFlags(config).unusedInput.push(skipped); | ||
4076 | } | ||
4077 | string = string.slice(string.indexOf(parsedInput) + parsedInput.length); | ||
4078 | totalParsedInputLength += parsedInput.length; | ||
4079 | } | ||
4080 | // don't parse if it's not a known token | ||
4081 | if (formatTokenFunctions[token]) { | ||
4082 | if (parsedInput) { | ||
4083 | getParsingFlags(config).empty = false; | ||
4084 | } | ||
4085 | else { | ||
4086 | getParsingFlags(config).unusedTokens.push(token); | ||
4087 | } | ||
4088 | addTimeToArrayFromToken(token, parsedInput, config); | ||
4089 | } | ||
4090 | else if (config._strict && !parsedInput) { | ||
4091 | getParsingFlags(config).unusedTokens.push(token); | ||
4092 | } | ||
4093 | } | ||
4094 | |||
4095 | // add remaining unparsed input length to the string | ||
4096 | getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; | ||
4097 | if (string.length > 0) { | ||
4098 | getParsingFlags(config).unusedInput.push(string); | ||
4099 | } | ||
4100 | |||
4101 | // clear _12h flag if hour is <= 12 | ||
4102 | if (config._a[HOUR] <= 12 && | ||
4103 | getParsingFlags(config).bigHour === true && | ||
4104 | config._a[HOUR] > 0) { | ||
4105 | getParsingFlags(config).bigHour = undefined; | ||
4106 | } | ||
4107 | |||
4108 | getParsingFlags(config).parsedDateParts = config._a.slice(0); | ||
4109 | getParsingFlags(config).meridiem = config._meridiem; | ||
4110 | // handle meridiem | ||
4111 | config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); | ||
4112 | |||
4113 | configFromArray(config); | ||
4114 | checkOverflow(config); | ||
4115 | } | ||
4116 | |||
4117 | |||
4118 | function meridiemFixWrap (locale, hour, meridiem) { | ||
4119 | var isPm; | ||
4120 | |||
4121 | if (meridiem == null) { | ||
4122 | // nothing to do | ||
4123 | return hour; | ||
4124 | } | ||
4125 | if (locale.meridiemHour != null) { | ||
4126 | return locale.meridiemHour(hour, meridiem); | ||
4127 | } else if (locale.isPM != null) { | ||
4128 | // Fallback | ||
4129 | isPm = locale.isPM(meridiem); | ||
4130 | if (isPm && hour < 12) { | ||
4131 | hour += 12; | ||
4132 | } | ||
4133 | if (!isPm && hour === 12) { | ||
4134 | hour = 0; | ||
4135 | } | ||
4136 | return hour; | ||
4137 | } else { | ||
4138 | // this is not supposed to happen | ||
4139 | return hour; | ||
4140 | } | ||
4141 | } | ||
4142 | |||
4143 | // date from string and array of format strings | ||
4144 | function configFromStringAndArray(config) { | ||
4145 | var tempConfig, | ||
4146 | bestMoment, | ||
4147 | |||
4148 | scoreToBeat, | ||
4149 | i, | ||
4150 | currentScore; | ||
4151 | |||
4152 | if (config._f.length === 0) { | ||
4153 | getParsingFlags(config).invalidFormat = true; | ||
4154 | config._d = new Date(NaN); | ||
4155 | return; | ||
4156 | } | ||
4157 | |||
4158 | for (i = 0; i < config._f.length; i++) { | ||
4159 | currentScore = 0; | ||
4160 | tempConfig = copyConfig({}, config); | ||
4161 | if (config._useUTC != null) { | ||
4162 | tempConfig._useUTC = config._useUTC; | ||
4163 | } | ||
4164 | tempConfig._f = config._f[i]; | ||
4165 | configFromStringAndFormat(tempConfig); | ||
4166 | |||
4167 | if (!isValid(tempConfig)) { | ||
4168 | continue; | ||
4169 | } | ||
4170 | |||
4171 | // if there is any input that was not parsed add a penalty for that format | ||
4172 | currentScore += getParsingFlags(tempConfig).charsLeftOver; | ||
4173 | |||
4174 | //or tokens | ||
4175 | currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; | ||
4176 | |||
4177 | getParsingFlags(tempConfig).score = currentScore; | ||
4178 | |||
4179 | if (scoreToBeat == null || currentScore < scoreToBeat) { | ||
4180 | scoreToBeat = currentScore; | ||
4181 | bestMoment = tempConfig; | ||
4182 | } | ||
4183 | } | ||
4184 | |||
4185 | extend(config, bestMoment || tempConfig); | ||
4186 | } | ||
4187 | |||
4188 | function configFromObject(config) { | ||
4189 | if (config._d) { | ||
4190 | return; | ||
4191 | } | ||
4192 | |||
4193 | var i = normalizeObjectUnits(config._i); | ||
4194 | config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { | ||
4195 | return obj && parseInt(obj, 10); | ||
4196 | }); | ||
4197 | |||
4198 | configFromArray(config); | ||
4199 | } | ||
4200 | |||
4201 | function createFromConfig (config) { | ||
4202 | var res = new Moment(checkOverflow(prepareConfig(config))); | ||
4203 | if (res._nextDay) { | ||
4204 | // Adding is smart enough around DST | ||
4205 | res.add(1, 'd'); | ||
4206 | res._nextDay = undefined; | ||
4207 | } | ||
4208 | |||
4209 | return res; | ||
4210 | } | ||
4211 | |||
4212 | function prepareConfig (config) { | ||
4213 | var input = config._i, | ||
4214 | format = config._f; | ||
4215 | |||
4216 | config._locale = config._locale || getLocale(config._l); | ||
4217 | |||
4218 | if (input === null || (format === undefined && input === '')) { | ||
4219 | return createInvalid({nullInput: true}); | ||
4220 | } | ||
4221 | |||
4222 | if (typeof input === 'string') { | ||
4223 | config._i = input = config._locale.preparse(input); | ||
4224 | } | ||
4225 | |||
4226 | if (isMoment(input)) { | ||
4227 | return new Moment(checkOverflow(input)); | ||
4228 | } else if (isDate(input)) { | ||
4229 | config._d = input; | ||
4230 | } else if (isArray(format)) { | ||
4231 | configFromStringAndArray(config); | ||
4232 | } else if (format) { | ||
4233 | configFromStringAndFormat(config); | ||
4234 | } else { | ||
4235 | configFromInput(config); | ||
4236 | } | ||
4237 | |||
4238 | if (!isValid(config)) { | ||
4239 | config._d = null; | ||
4240 | } | ||
4241 | |||
4242 | return config; | ||
4243 | } | ||
4244 | |||
4245 | function configFromInput(config) { | ||
4246 | var input = config._i; | ||
4247 | if (isUndefined(input)) { | ||
4248 | config._d = new Date(hooks.now()); | ||
4249 | } else if (isDate(input)) { | ||
4250 | config._d = new Date(input.valueOf()); | ||
4251 | } else if (typeof input === 'string') { | ||
4252 | configFromString(config); | ||
4253 | } else if (isArray(input)) { | ||
4254 | config._a = map(input.slice(0), function (obj) { | ||
4255 | return parseInt(obj, 10); | ||
4256 | }); | ||
4257 | configFromArray(config); | ||
4258 | } else if (isObject(input)) { | ||
4259 | configFromObject(config); | ||
4260 | } else if (isNumber(input)) { | ||
4261 | // from milliseconds | ||
4262 | config._d = new Date(input); | ||
4263 | } else { | ||
4264 | hooks.createFromInputFallback(config); | ||
4265 | } | ||
4266 | } | ||
4267 | |||
4268 | function createLocalOrUTC (input, format, locale, strict, isUTC) { | ||
4269 | var c = {}; | ||
4270 | |||
4271 | if (locale === true || locale === false) { | ||
4272 | strict = locale; | ||
4273 | locale = undefined; | ||
4274 | } | ||
4275 | |||
4276 | if ((isObject(input) && isObjectEmpty(input)) || | ||
4277 | (isArray(input) && input.length === 0)) { | ||
4278 | input = undefined; | ||
4279 | } | ||
4280 | // object construction must be done this way. | ||
4281 | // https://github.com/moment/moment/issues/1423 | ||
4282 | c._isAMomentObject = true; | ||
4283 | c._useUTC = c._isUTC = isUTC; | ||
4284 | c._l = locale; | ||
4285 | c._i = input; | ||
4286 | c._f = format; | ||
4287 | c._strict = strict; | ||
4288 | |||
4289 | return createFromConfig(c); | ||
4290 | } | ||
4291 | |||
4292 | function createLocal (input, format, locale, strict) { | ||
4293 | return createLocalOrUTC(input, format, locale, strict, false); | ||
4294 | } | ||
4295 | |||
4296 | var prototypeMin = deprecate( | ||
4297 | 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', | ||
4298 | function () { | ||
4299 | var other = createLocal.apply(null, arguments); | ||
4300 | if (this.isValid() && other.isValid()) { | ||
4301 | return other < this ? this : other; | ||
4302 | } else { | ||
4303 | return createInvalid(); | ||
4304 | } | ||
4305 | } | ||
4306 | ); | ||
4307 | |||
4308 | var prototypeMax = deprecate( | ||
4309 | 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', | ||
4310 | function () { | ||
4311 | var other = createLocal.apply(null, arguments); | ||
4312 | if (this.isValid() && other.isValid()) { | ||
4313 | return other > this ? this : other; | ||
4314 | } else { | ||
4315 | return createInvalid(); | ||
4316 | } | ||
4317 | } | ||
4318 | ); | ||
4319 | |||
4320 | // Pick a moment m from moments so that m[fn](other) is true for all | ||
4321 | // other. This relies on the function fn to be transitive. | ||
4322 | // | ||
4323 | // moments should either be an array of moment objects or an array, whose | ||
4324 | // first element is an array of moment objects. | ||
4325 | function pickBy(fn, moments) { | ||
4326 | var res, i; | ||
4327 | if (moments.length === 1 && isArray(moments[0])) { | ||
4328 | moments = moments[0]; | ||
4329 | } | ||
4330 | if (!moments.length) { | ||
4331 | return createLocal(); | ||
4332 | } | ||
4333 | res = moments[0]; | ||
4334 | for (i = 1; i < moments.length; ++i) { | ||
4335 | if (!moments[i].isValid() || moments[i][fn](res)) { | ||
4336 | res = moments[i]; | ||
4337 | } | ||
4338 | } | ||
4339 | return res; | ||
4340 | } | ||
4341 | |||
4342 | // TODO: Use [].sort instead? | ||
4343 | function min () { | ||
4344 | var args = [].slice.call(arguments, 0); | ||
4345 | |||
4346 | return pickBy('isBefore', args); | ||
4347 | } | ||
4348 | |||
4349 | function max () { | ||
4350 | var args = [].slice.call(arguments, 0); | ||
4351 | |||
4352 | return pickBy('isAfter', args); | ||
4353 | } | ||
4354 | |||
4355 | var now = function () { | ||
4356 | return Date.now ? Date.now() : +(new Date()); | ||
4357 | }; | ||
4358 | |||
4359 | var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; | ||
4360 | |||
4361 | function isDurationValid(m) { | ||
4362 | for (var key in m) { | ||
4363 | if (!(ordering.indexOf(key) !== -1 && (m[key] == null || !isNaN(m[key])))) { | ||
4364 | return false; | ||
4365 | } | ||
4366 | } | ||
4367 | |||
4368 | var unitHasDecimal = false; | ||
4369 | for (var i = 0; i < ordering.length; ++i) { | ||
4370 | if (m[ordering[i]]) { | ||
4371 | if (unitHasDecimal) { | ||
4372 | return false; // only allow non-integers for smallest unit | ||
4373 | } | ||
4374 | if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { | ||
4375 | unitHasDecimal = true; | ||
4376 | } | ||
4377 | } | ||
4378 | } | ||
4379 | |||
4380 | return true; | ||
4381 | } | ||
4382 | |||
4383 | function isValid$1() { | ||
4384 | return this._isValid; | ||
4385 | } | ||
4386 | |||
4387 | function createInvalid$1() { | ||
4388 | return createDuration(NaN); | ||
4389 | } | ||
4390 | |||
4391 | function Duration (duration) { | ||
4392 | var normalizedInput = normalizeObjectUnits(duration), | ||
4393 | years = normalizedInput.year || 0, | ||
4394 | quarters = normalizedInput.quarter || 0, | ||
4395 | months = normalizedInput.month || 0, | ||
4396 | weeks = normalizedInput.week || 0, | ||
4397 | days = normalizedInput.day || 0, | ||
4398 | hours = normalizedInput.hour || 0, | ||
4399 | minutes = normalizedInput.minute || 0, | ||
4400 | seconds = normalizedInput.second || 0, | ||
4401 | milliseconds = normalizedInput.millisecond || 0; | ||
4402 | |||
4403 | this._isValid = isDurationValid(normalizedInput); | ||
4404 | |||
4405 | // representation for dateAddRemove | ||
4406 | this._milliseconds = +milliseconds + | ||
4407 | seconds * 1e3 + // 1000 | ||
4408 | minutes * 6e4 + // 1000 * 60 | ||
4409 | hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 | ||
4410 | // Because of dateAddRemove treats 24 hours as different from a | ||
4411 | // day when working around DST, we need to store them separately | ||
4412 | this._days = +days + | ||
4413 | weeks * 7; | ||
4414 | // It is impossible translate months into days without knowing | ||
4415 | // which months you are are talking about, so we have to store | ||
4416 | // it separately. | ||
4417 | this._months = +months + | ||
4418 | quarters * 3 + | ||
4419 | years * 12; | ||
4420 | |||
4421 | this._data = {}; | ||
4422 | |||
4423 | this._locale = getLocale(); | ||
4424 | |||
4425 | this._bubble(); | ||
4426 | } | ||
4427 | |||
4428 | function isDuration (obj) { | ||
4429 | return obj instanceof Duration; | ||
4430 | } | ||
4431 | |||
4432 | function absRound (number) { | ||
4433 | if (number < 0) { | ||
4434 | return Math.round(-1 * number) * -1; | ||
4435 | } else { | ||
4436 | return Math.round(number); | ||
4437 | } | ||
4438 | } | ||
4439 | |||
4440 | // FORMATTING | ||
4441 | |||
4442 | function offset (token, separator) { | ||
4443 | addFormatToken(token, 0, 0, function () { | ||
4444 | var offset = this.utcOffset(); | ||
4445 | var sign = '+'; | ||
4446 | if (offset < 0) { | ||
4447 | offset = -offset; | ||
4448 | sign = '-'; | ||
4449 | } | ||
4450 | return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); | ||
4451 | }); | ||
4452 | } | ||
4453 | |||
4454 | offset('Z', ':'); | ||
4455 | offset('ZZ', ''); | ||
4456 | |||
4457 | // PARSING | ||
4458 | |||
4459 | addRegexToken('Z', matchShortOffset); | ||
4460 | addRegexToken('ZZ', matchShortOffset); | ||
4461 | addParseToken(['Z', 'ZZ'], function (input, array, config) { | ||
4462 | config._useUTC = true; | ||
4463 | config._tzm = offsetFromString(matchShortOffset, input); | ||
4464 | }); | ||
4465 | |||
4466 | // HELPERS | ||
4467 | |||
4468 | // timezone chunker | ||
4469 | // '+10:00' > ['10', '00'] | ||
4470 | // '-1530' > ['-15', '30'] | ||
4471 | var chunkOffset = /([\+\-]|\d\d)/gi; | ||
4472 | |||
4473 | function offsetFromString(matcher, string) { | ||
4474 | var matches = (string || '').match(matcher); | ||
4475 | |||
4476 | if (matches === null) { | ||
4477 | return null; | ||
4478 | } | ||
4479 | |||
4480 | var chunk = matches[matches.length - 1] || []; | ||
4481 | var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; | ||
4482 | var minutes = +(parts[1] * 60) + toInt(parts[2]); | ||
4483 | |||
4484 | return minutes === 0 ? | ||
4485 | 0 : | ||
4486 | parts[0] === '+' ? minutes : -minutes; | ||
4487 | } | ||
4488 | |||
4489 | // Return a moment from input, that is local/utc/zone equivalent to model. | ||
4490 | function cloneWithOffset(input, model) { | ||
4491 | var res, diff; | ||
4492 | if (model._isUTC) { | ||
4493 | res = model.clone(); | ||
4494 | diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); | ||
4495 | // Use low-level api, because this fn is low-level api. | ||
4496 | res._d.setTime(res._d.valueOf() + diff); | ||
4497 | hooks.updateOffset(res, false); | ||
4498 | return res; | ||
4499 | } else { | ||
4500 | return createLocal(input).local(); | ||
4501 | } | ||
4502 | } | ||
4503 | |||
4504 | function getDateOffset (m) { | ||
4505 | // On Firefox.24 Date#getTimezoneOffset returns a floating point. | ||
4506 | // https://github.com/moment/moment/pull/1871 | ||
4507 | return -Math.round(m._d.getTimezoneOffset() / 15) * 15; | ||
4508 | } | ||
4509 | |||
4510 | // HOOKS | ||
4511 | |||
4512 | // This function will be called whenever a moment is mutated. | ||
4513 | // It is intended to keep the offset in sync with the timezone. | ||
4514 | hooks.updateOffset = function () {}; | ||
4515 | |||
4516 | // MOMENTS | ||
4517 | |||
4518 | // keepLocalTime = true means only change the timezone, without | ||
4519 | // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> | ||
4520 | // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset | ||
4521 | // +0200, so we adjust the time as needed, to be valid. | ||
4522 | // | ||
4523 | // Keeping the time actually adds/subtracts (one hour) | ||
4524 | // from the actual represented time. That is why we call updateOffset | ||
4525 | // a second time. In case it wants us to change the offset again | ||
4526 | // _changeInProgress == true case, then we have to adjust, because | ||
4527 | // there is no such time in the given timezone. | ||
4528 | function getSetOffset (input, keepLocalTime, keepMinutes) { | ||
4529 | var offset = this._offset || 0, | ||
4530 | localAdjust; | ||
4531 | if (!this.isValid()) { | ||
4532 | return input != null ? this : NaN; | ||
4533 | } | ||
4534 | if (input != null) { | ||
4535 | if (typeof input === 'string') { | ||
4536 | input = offsetFromString(matchShortOffset, input); | ||
4537 | if (input === null) { | ||
4538 | return this; | ||
4539 | } | ||
4540 | } else if (Math.abs(input) < 16 && !keepMinutes) { | ||
4541 | input = input * 60; | ||
4542 | } | ||
4543 | if (!this._isUTC && keepLocalTime) { | ||
4544 | localAdjust = getDateOffset(this); | ||
4545 | } | ||
4546 | this._offset = input; | ||
4547 | this._isUTC = true; | ||
4548 | if (localAdjust != null) { | ||
4549 | this.add(localAdjust, 'm'); | ||
4550 | } | ||
4551 | if (offset !== input) { | ||
4552 | if (!keepLocalTime || this._changeInProgress) { | ||
4553 | addSubtract(this, createDuration(input - offset, 'm'), 1, false); | ||
4554 | } else if (!this._changeInProgress) { | ||
4555 | this._changeInProgress = true; | ||
4556 | hooks.updateOffset(this, true); | ||
4557 | this._changeInProgress = null; | ||
4558 | } | ||
4559 | } | ||
4560 | return this; | ||
4561 | } else { | ||
4562 | return this._isUTC ? offset : getDateOffset(this); | ||
4563 | } | ||
4564 | } | ||
4565 | |||
4566 | function getSetZone (input, keepLocalTime) { | ||
4567 | if (input != null) { | ||
4568 | if (typeof input !== 'string') { | ||
4569 | input = -input; | ||
4570 | } | ||
4571 | |||
4572 | this.utcOffset(input, keepLocalTime); | ||
4573 | |||
4574 | return this; | ||
4575 | } else { | ||
4576 | return -this.utcOffset(); | ||
4577 | } | ||
4578 | } | ||
4579 | |||
4580 | function setOffsetToUTC (keepLocalTime) { | ||
4581 | return this.utcOffset(0, keepLocalTime); | ||
4582 | } | ||
4583 | |||
4584 | function setOffsetToLocal (keepLocalTime) { | ||
4585 | if (this._isUTC) { | ||
4586 | this.utcOffset(0, keepLocalTime); | ||
4587 | this._isUTC = false; | ||
4588 | |||
4589 | if (keepLocalTime) { | ||
4590 | this.subtract(getDateOffset(this), 'm'); | ||
4591 | } | ||
4592 | } | ||
4593 | return this; | ||
4594 | } | ||
4595 | |||
4596 | function setOffsetToParsedOffset () { | ||
4597 | if (this._tzm != null) { | ||
4598 | this.utcOffset(this._tzm, false, true); | ||
4599 | } else if (typeof this._i === 'string') { | ||
4600 | var tZone = offsetFromString(matchOffset, this._i); | ||
4601 | if (tZone != null) { | ||
4602 | this.utcOffset(tZone); | ||
4603 | } | ||
4604 | else { | ||
4605 | this.utcOffset(0, true); | ||
4606 | } | ||
4607 | } | ||
4608 | return this; | ||
4609 | } | ||
4610 | |||
4611 | function hasAlignedHourOffset (input) { | ||
4612 | if (!this.isValid()) { | ||
4613 | return false; | ||
4614 | } | ||
4615 | input = input ? createLocal(input).utcOffset() : 0; | ||
4616 | |||
4617 | return (this.utcOffset() - input) % 60 === 0; | ||
4618 | } | ||
4619 | |||
4620 | function isDaylightSavingTime () { | ||
4621 | return ( | ||
4622 | this.utcOffset() > this.clone().month(0).utcOffset() || | ||
4623 | this.utcOffset() > this.clone().month(5).utcOffset() | ||
4624 | ); | ||
4625 | } | ||
4626 | |||
4627 | function isDaylightSavingTimeShifted () { | ||
4628 | if (!isUndefined(this._isDSTShifted)) { | ||
4629 | return this._isDSTShifted; | ||
4630 | } | ||
4631 | |||
4632 | var c = {}; | ||
4633 | |||
4634 | copyConfig(c, this); | ||
4635 | c = prepareConfig(c); | ||
4636 | |||
4637 | if (c._a) { | ||
4638 | var other = c._isUTC ? createUTC(c._a) : createLocal(c._a); | ||
4639 | this._isDSTShifted = this.isValid() && | ||
4640 | compareArrays(c._a, other.toArray()) > 0; | ||
4641 | } else { | ||
4642 | this._isDSTShifted = false; | ||
4643 | } | ||
4644 | |||
4645 | return this._isDSTShifted; | ||
4646 | } | ||
4647 | |||
4648 | function isLocal () { | ||
4649 | return this.isValid() ? !this._isUTC : false; | ||
4650 | } | ||
4651 | |||
4652 | function isUtcOffset () { | ||
4653 | return this.isValid() ? this._isUTC : false; | ||
4654 | } | ||
4655 | |||
4656 | function isUtc () { | ||
4657 | return this.isValid() ? this._isUTC && this._offset === 0 : false; | ||
4658 | } | ||
4659 | |||
4660 | // ASP.NET json date format regex | ||
4661 | var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; | ||
4662 | |||
4663 | // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html | ||
4664 | // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere | ||
4665 | // and further modified to allow for strings containing both week and day | ||
4666 | 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)?)?$/; | ||
4667 | |||
4668 | function createDuration (input, key) { | ||
4669 | var duration = input, | ||
4670 | // matching against regexp is expensive, do it on demand | ||
4671 | match = null, | ||
4672 | sign, | ||
4673 | ret, | ||
4674 | diffRes; | ||
4675 | |||
4676 | if (isDuration(input)) { | ||
4677 | duration = { | ||
4678 | ms : input._milliseconds, | ||
4679 | d : input._days, | ||
4680 | M : input._months | ||
4681 | }; | ||
4682 | } else if (isNumber(input)) { | ||
4683 | duration = {}; | ||
4684 | if (key) { | ||
4685 | duration[key] = input; | ||
4686 | } else { | ||
4687 | duration.milliseconds = input; | ||
4688 | } | ||
4689 | } else if (!!(match = aspNetRegex.exec(input))) { | ||
4690 | sign = (match[1] === '-') ? -1 : 1; | ||
4691 | duration = { | ||
4692 | y : 0, | ||
4693 | d : toInt(match[DATE]) * sign, | ||
4694 | h : toInt(match[HOUR]) * sign, | ||
4695 | m : toInt(match[MINUTE]) * sign, | ||
4696 | s : toInt(match[SECOND]) * sign, | ||
4697 | ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match | ||
4698 | }; | ||
4699 | } else if (!!(match = isoRegex.exec(input))) { | ||
4700 | sign = (match[1] === '-') ? -1 : 1; | ||
4701 | duration = { | ||
4702 | y : parseIso(match[2], sign), | ||
4703 | M : parseIso(match[3], sign), | ||
4704 | w : parseIso(match[4], sign), | ||
4705 | d : parseIso(match[5], sign), | ||
4706 | h : parseIso(match[6], sign), | ||
4707 | m : parseIso(match[7], sign), | ||
4708 | s : parseIso(match[8], sign) | ||
4709 | }; | ||
4710 | } else if (duration == null) {// checks for null or undefined | ||
4711 | duration = {}; | ||
4712 | } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { | ||
4713 | diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); | ||
4714 | |||
4715 | duration = {}; | ||
4716 | duration.ms = diffRes.milliseconds; | ||
4717 | duration.M = diffRes.months; | ||
4718 | } | ||
4719 | |||
4720 | ret = new Duration(duration); | ||
4721 | |||
4722 | if (isDuration(input) && hasOwnProp(input, '_locale')) { | ||
4723 | ret._locale = input._locale; | ||
4724 | } | ||
4725 | |||
4726 | return ret; | ||
4727 | } | ||
4728 | |||
4729 | createDuration.fn = Duration.prototype; | ||
4730 | createDuration.invalid = createInvalid$1; | ||
4731 | |||
4732 | function parseIso (inp, sign) { | ||
4733 | // We'd normally use ~~inp for this, but unfortunately it also | ||
4734 | // converts floats to ints. | ||
4735 | // inp may be undefined, so careful calling replace on it. | ||
4736 | var res = inp && parseFloat(inp.replace(',', '.')); | ||
4737 | // apply sign while we're at it | ||
4738 | return (isNaN(res) ? 0 : res) * sign; | ||
4739 | } | ||
4740 | |||
4741 | function positiveMomentsDifference(base, other) { | ||
4742 | var res = {milliseconds: 0, months: 0}; | ||
4743 | |||
4744 | res.months = other.month() - base.month() + | ||
4745 | (other.year() - base.year()) * 12; | ||
4746 | if (base.clone().add(res.months, 'M').isAfter(other)) { | ||
4747 | --res.months; | ||
4748 | } | ||
4749 | |||
4750 | res.milliseconds = +other - +(base.clone().add(res.months, 'M')); | ||
4751 | |||
4752 | return res; | ||
4753 | } | ||
4754 | |||
4755 | function momentsDifference(base, other) { | ||
4756 | var res; | ||
4757 | if (!(base.isValid() && other.isValid())) { | ||
4758 | return {milliseconds: 0, months: 0}; | ||
4759 | } | ||
4760 | |||
4761 | other = cloneWithOffset(other, base); | ||
4762 | if (base.isBefore(other)) { | ||
4763 | res = positiveMomentsDifference(base, other); | ||
4764 | } else { | ||
4765 | res = positiveMomentsDifference(other, base); | ||
4766 | res.milliseconds = -res.milliseconds; | ||
4767 | res.months = -res.months; | ||
4768 | } | ||
4769 | |||
4770 | return res; | ||
4771 | } | ||
4772 | |||
4773 | // TODO: remove 'name' arg after deprecation is removed | ||
4774 | function createAdder(direction, name) { | ||
4775 | return function (val, period) { | ||
4776 | var dur, tmp; | ||
4777 | //invert the arguments, but complain about it | ||
4778 | if (period !== null && !isNaN(+period)) { | ||
4779 | deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + | ||
4780 | 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); | ||
4781 | tmp = val; val = period; period = tmp; | ||
4782 | } | ||
4783 | |||
4784 | val = typeof val === 'string' ? +val : val; | ||
4785 | dur = createDuration(val, period); | ||
4786 | addSubtract(this, dur, direction); | ||
4787 | return this; | ||
4788 | }; | ||
4789 | } | ||
4790 | |||
4791 | function addSubtract (mom, duration, isAdding, updateOffset) { | ||
4792 | var milliseconds = duration._milliseconds, | ||
4793 | days = absRound(duration._days), | ||
4794 | months = absRound(duration._months); | ||
4795 | |||
4796 | if (!mom.isValid()) { | ||
4797 | // No op | ||
4798 | return; | ||
4799 | } | ||
4800 | |||
4801 | updateOffset = updateOffset == null ? true : updateOffset; | ||
4802 | |||
4803 | if (milliseconds) { | ||
4804 | mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); | ||
4805 | } | ||
4806 | if (days) { | ||
4807 | set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); | ||
4808 | } | ||
4809 | if (months) { | ||
4810 | setMonth(mom, get(mom, 'Month') + months * isAdding); | ||
4811 | } | ||
4812 | if (updateOffset) { | ||
4813 | hooks.updateOffset(mom, days || months); | ||
4814 | } | ||
4815 | } | ||
4816 | |||
4817 | var add = createAdder(1, 'add'); | ||
4818 | var subtract = createAdder(-1, 'subtract'); | ||
4819 | |||
4820 | function getCalendarFormat(myMoment, now) { | ||
4821 | var diff = myMoment.diff(now, 'days', true); | ||
4822 | return diff < -6 ? 'sameElse' : | ||
4823 | diff < -1 ? 'lastWeek' : | ||
4824 | diff < 0 ? 'lastDay' : | ||
4825 | diff < 1 ? 'sameDay' : | ||
4826 | diff < 2 ? 'nextDay' : | ||
4827 | diff < 7 ? 'nextWeek' : 'sameElse'; | ||
4828 | } | ||
4829 | |||
4830 | function calendar$1 (time, formats) { | ||
4831 | // We want to compare the start of today, vs this. | ||
4832 | // Getting start-of-today depends on whether we're local/utc/offset or not. | ||
4833 | var now = time || createLocal(), | ||
4834 | sod = cloneWithOffset(now, this).startOf('day'), | ||
4835 | format = hooks.calendarFormat(this, sod) || 'sameElse'; | ||
4836 | |||
4837 | var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); | ||
4838 | |||
4839 | return this.format(output || this.localeData().calendar(format, this, createLocal(now))); | ||
4840 | } | ||
4841 | |||
4842 | function clone () { | ||
4843 | return new Moment(this); | ||
4844 | } | ||
4845 | |||
4846 | function isAfter (input, units) { | ||
4847 | var localInput = isMoment(input) ? input : createLocal(input); | ||
4848 | if (!(this.isValid() && localInput.isValid())) { | ||
4849 | return false; | ||
4850 | } | ||
4851 | units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); | ||
4852 | if (units === 'millisecond') { | ||
4853 | return this.valueOf() > localInput.valueOf(); | ||
4854 | } else { | ||
4855 | return localInput.valueOf() < this.clone().startOf(units).valueOf(); | ||
4856 | } | ||
4857 | } | ||
4858 | |||
4859 | function isBefore (input, units) { | ||
4860 | var localInput = isMoment(input) ? input : createLocal(input); | ||
4861 | if (!(this.isValid() && localInput.isValid())) { | ||
4862 | return false; | ||
4863 | } | ||
4864 | units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); | ||
4865 | if (units === 'millisecond') { | ||
4866 | return this.valueOf() < localInput.valueOf(); | ||
4867 | } else { | ||
4868 | return this.clone().endOf(units).valueOf() < localInput.valueOf(); | ||
4869 | } | ||
4870 | } | ||
4871 | |||
4872 | function isBetween (from, to, units, inclusivity) { | ||
4873 | inclusivity = inclusivity || '()'; | ||
4874 | return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && | ||
4875 | (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); | ||
4876 | } | ||
4877 | |||
4878 | function isSame (input, units) { | ||
4879 | var localInput = isMoment(input) ? input : createLocal(input), | ||
4880 | inputMs; | ||
4881 | if (!(this.isValid() && localInput.isValid())) { | ||
4882 | return false; | ||
4883 | } | ||
4884 | units = normalizeUnits(units || 'millisecond'); | ||
4885 | if (units === 'millisecond') { | ||
4886 | return this.valueOf() === localInput.valueOf(); | ||
4887 | } else { | ||
4888 | inputMs = localInput.valueOf(); | ||
4889 | return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); | ||
4890 | } | ||
4891 | } | ||
4892 | |||
4893 | function isSameOrAfter (input, units) { | ||
4894 | return this.isSame(input, units) || this.isAfter(input,units); | ||
4895 | } | ||
4896 | |||
4897 | function isSameOrBefore (input, units) { | ||
4898 | return this.isSame(input, units) || this.isBefore(input,units); | ||
4899 | } | ||
4900 | |||
4901 | function diff (input, units, asFloat) { | ||
4902 | var that, | ||
4903 | zoneDelta, | ||
4904 | delta, output; | ||
4905 | |||
4906 | if (!this.isValid()) { | ||
4907 | return NaN; | ||
4908 | } | ||
4909 | |||
4910 | that = cloneWithOffset(input, this); | ||
4911 | |||
4912 | if (!that.isValid()) { | ||
4913 | return NaN; | ||
4914 | } | ||
4915 | |||
4916 | zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; | ||
4917 | |||
4918 | units = normalizeUnits(units); | ||
4919 | |||
4920 | if (units === 'year' || units === 'month' || units === 'quarter') { | ||
4921 | output = monthDiff(this, that); | ||
4922 | if (units === 'quarter') { | ||
4923 | output = output / 3; | ||
4924 | } else if (units === 'year') { | ||
4925 | output = output / 12; | ||
4926 | } | ||
4927 | } else { | ||
4928 | delta = this - that; | ||
4929 | output = units === 'second' ? delta / 1e3 : // 1000 | ||
4930 | units === 'minute' ? delta / 6e4 : // 1000 * 60 | ||
4931 | units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 | ||
4932 | units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst | ||
4933 | units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst | ||
4934 | delta; | ||
4935 | } | ||
4936 | return asFloat ? output : absFloor(output); | ||
4937 | } | ||
4938 | |||
4939 | function monthDiff (a, b) { | ||
4940 | // difference in months | ||
4941 | var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), | ||
4942 | // b is in (anchor - 1 month, anchor + 1 month) | ||
4943 | anchor = a.clone().add(wholeMonthDiff, 'months'), | ||
4944 | anchor2, adjust; | ||
4945 | |||
4946 | if (b - anchor < 0) { | ||
4947 | anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); | ||
4948 | // linear across the month | ||
4949 | adjust = (b - anchor) / (anchor - anchor2); | ||
4950 | } else { | ||
4951 | anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); | ||
4952 | // linear across the month | ||
4953 | adjust = (b - anchor) / (anchor2 - anchor); | ||
4954 | } | ||
4955 | |||
4956 | //check for negative zero, return zero if negative zero | ||
4957 | return -(wholeMonthDiff + adjust) || 0; | ||
4958 | } | ||
4959 | |||
4960 | hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; | ||
4961 | hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; | ||
4962 | |||
4963 | function toString () { | ||
4964 | return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); | ||
4965 | } | ||
4966 | |||
4967 | function toISOString() { | ||
4968 | if (!this.isValid()) { | ||
4969 | return null; | ||
4970 | } | ||
4971 | var m = this.clone().utc(); | ||
4972 | if (m.year() < 0 || m.year() > 9999) { | ||
4973 | return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); | ||
4974 | } | ||
4975 | if (isFunction(Date.prototype.toISOString)) { | ||
4976 | // native implementation is ~50x faster, use it when we can | ||
4977 | return this.toDate().toISOString(); | ||
4978 | } | ||
4979 | return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); | ||
4980 | } | ||
4981 | |||
4982 | /** | ||
4983 | * Return a human readable representation of a moment that can | ||
4984 | * also be evaluated to get a new moment which is the same | ||
4985 | * | ||
4986 | * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | ||
4987 | */ | ||
4988 | function inspect () { | ||
4989 | if (!this.isValid()) { | ||
4990 | return 'moment.invalid(/* ' + this._i + ' */)'; | ||
4991 | } | ||
4992 | var func = 'moment'; | ||
4993 | var zone = ''; | ||
4994 | if (!this.isLocal()) { | ||
4995 | func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; | ||
4996 | zone = 'Z'; | ||
4997 | } | ||
4998 | var prefix = '[' + func + '("]'; | ||
4999 | var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY'; | ||
5000 | var datetime = '-MM-DD[T]HH:mm:ss.SSS'; | ||
5001 | var suffix = zone + '[")]'; | ||
5002 | |||
5003 | return this.format(prefix + year + datetime + suffix); | ||
5004 | } | ||
5005 | |||
5006 | function format (inputString) { | ||
5007 | if (!inputString) { | ||
5008 | inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; | ||
5009 | } | ||
5010 | var output = formatMoment(this, inputString); | ||
5011 | return this.localeData().postformat(output); | ||
5012 | } | ||
5013 | |||
5014 | function from (time, withoutSuffix) { | ||
5015 | if (this.isValid() && | ||
5016 | ((isMoment(time) && time.isValid()) || | ||
5017 | createLocal(time).isValid())) { | ||
5018 | return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); | ||
5019 | } else { | ||
5020 | return this.localeData().invalidDate(); | ||
5021 | } | ||
5022 | } | ||
5023 | |||
5024 | function fromNow (withoutSuffix) { | ||
5025 | return this.from(createLocal(), withoutSuffix); | ||
5026 | } | ||
5027 | |||
5028 | function to (time, withoutSuffix) { | ||
5029 | if (this.isValid() && | ||
5030 | ((isMoment(time) && time.isValid()) || | ||
5031 | createLocal(time).isValid())) { | ||
5032 | return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); | ||
5033 | } else { | ||
5034 | return this.localeData().invalidDate(); | ||
5035 | } | ||
5036 | } | ||
5037 | |||
5038 | function toNow (withoutSuffix) { | ||
5039 | return this.to(createLocal(), withoutSuffix); | ||
5040 | } | ||
5041 | |||
5042 | // If passed a locale key, it will set the locale for this | ||
5043 | // instance. Otherwise, it will return the locale configuration | ||
5044 | // variables for this instance. | ||
5045 | function locale (key) { | ||
5046 | var newLocaleData; | ||
5047 | |||
5048 | if (key === undefined) { | ||
5049 | return this._locale._abbr; | ||
5050 | } else { | ||
5051 | newLocaleData = getLocale(key); | ||
5052 | if (newLocaleData != null) { | ||
5053 | this._locale = newLocaleData; | ||
5054 | } | ||
5055 | return this; | ||
5056 | } | ||
5057 | } | ||
5058 | |||
5059 | var lang = deprecate( | ||
5060 | 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', | ||
5061 | function (key) { | ||
5062 | if (key === undefined) { | ||
5063 | return this.localeData(); | ||
5064 | } else { | ||
5065 | return this.locale(key); | ||
5066 | } | ||
5067 | } | ||
5068 | ); | ||
5069 | |||
5070 | function localeData () { | ||
5071 | return this._locale; | ||
5072 | } | ||
5073 | |||
5074 | function startOf (units) { | ||
5075 | units = normalizeUnits(units); | ||
5076 | // the following switch intentionally omits break keywords | ||
5077 | // to utilize falling through the cases. | ||
5078 | switch (units) { | ||
5079 | case 'year': | ||
5080 | this.month(0); | ||
5081 | /* falls through */ | ||
5082 | case 'quarter': | ||
5083 | case 'month': | ||
5084 | this.date(1); | ||
5085 | /* falls through */ | ||
5086 | case 'week': | ||
5087 | case 'isoWeek': | ||
5088 | case 'day': | ||
5089 | case 'date': | ||
5090 | this.hours(0); | ||
5091 | /* falls through */ | ||
5092 | case 'hour': | ||
5093 | this.minutes(0); | ||
5094 | /* falls through */ | ||
5095 | case 'minute': | ||
5096 | this.seconds(0); | ||
5097 | /* falls through */ | ||
5098 | case 'second': | ||
5099 | this.milliseconds(0); | ||
5100 | } | ||
5101 | |||
5102 | // weeks are a special case | ||
5103 | if (units === 'week') { | ||
5104 | this.weekday(0); | ||
5105 | } | ||
5106 | if (units === 'isoWeek') { | ||
5107 | this.isoWeekday(1); | ||
5108 | } | ||
5109 | |||
5110 | // quarters are also special | ||
5111 | if (units === 'quarter') { | ||
5112 | this.month(Math.floor(this.month() / 3) * 3); | ||
5113 | } | ||
5114 | |||
5115 | return this; | ||
5116 | } | ||
5117 | |||
5118 | function endOf (units) { | ||
5119 | units = normalizeUnits(units); | ||
5120 | if (units === undefined || units === 'millisecond') { | ||
5121 | return this; | ||
5122 | } | ||
5123 | |||
5124 | // 'date' is an alias for 'day', so it should be considered as such. | ||
5125 | if (units === 'date') { | ||
5126 | units = 'day'; | ||
5127 | } | ||
5128 | |||
5129 | return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); | ||
5130 | } | ||
5131 | |||
5132 | function valueOf () { | ||
5133 | return this._d.valueOf() - ((this._offset || 0) * 60000); | ||
5134 | } | ||
5135 | |||
5136 | function unix () { | ||
5137 | return Math.floor(this.valueOf() / 1000); | ||
5138 | } | ||
5139 | |||
5140 | function toDate () { | ||
5141 | return new Date(this.valueOf()); | ||
5142 | } | ||
5143 | |||
5144 | function toArray () { | ||
5145 | var m = this; | ||
5146 | return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; | ||
5147 | } | ||
5148 | |||
5149 | function toObject () { | ||
5150 | var m = this; | ||
5151 | return { | ||
5152 | years: m.year(), | ||
5153 | months: m.month(), | ||
5154 | date: m.date(), | ||
5155 | hours: m.hours(), | ||
5156 | minutes: m.minutes(), | ||
5157 | seconds: m.seconds(), | ||
5158 | milliseconds: m.milliseconds() | ||
5159 | }; | ||
5160 | } | ||
5161 | |||
5162 | function toJSON () { | ||
5163 | // new Date(NaN).toJSON() === null | ||
5164 | return this.isValid() ? this.toISOString() : null; | ||
5165 | } | ||
5166 | |||
5167 | function isValid$2 () { | ||
5168 | return isValid(this); | ||
5169 | } | ||
5170 | |||
5171 | function parsingFlags () { | ||
5172 | return extend({}, getParsingFlags(this)); | ||
5173 | } | ||
5174 | |||
5175 | function invalidAt () { | ||
5176 | return getParsingFlags(this).overflow; | ||
5177 | } | ||
5178 | |||
5179 | function creationData() { | ||
5180 | return { | ||
5181 | input: this._i, | ||
5182 | format: this._f, | ||
5183 | locale: this._locale, | ||
5184 | isUTC: this._isUTC, | ||
5185 | strict: this._strict | ||
5186 | }; | ||
5187 | } | ||
5188 | |||
5189 | // FORMATTING | ||
5190 | |||
5191 | addFormatToken(0, ['gg', 2], 0, function () { | ||
5192 | return this.weekYear() % 100; | ||
5193 | }); | ||
5194 | |||
5195 | addFormatToken(0, ['GG', 2], 0, function () { | ||
5196 | return this.isoWeekYear() % 100; | ||
5197 | }); | ||
5198 | |||
5199 | function addWeekYearFormatToken (token, getter) { | ||
5200 | addFormatToken(0, [token, token.length], 0, getter); | ||
5201 | } | ||
5202 | |||
5203 | addWeekYearFormatToken('gggg', 'weekYear'); | ||
5204 | addWeekYearFormatToken('ggggg', 'weekYear'); | ||
5205 | addWeekYearFormatToken('GGGG', 'isoWeekYear'); | ||
5206 | addWeekYearFormatToken('GGGGG', 'isoWeekYear'); | ||
5207 | |||
5208 | // ALIASES | ||
5209 | |||
5210 | addUnitAlias('weekYear', 'gg'); | ||
5211 | addUnitAlias('isoWeekYear', 'GG'); | ||
5212 | |||
5213 | // PRIORITY | ||
5214 | |||
5215 | addUnitPriority('weekYear', 1); | ||
5216 | addUnitPriority('isoWeekYear', 1); | ||
5217 | |||
5218 | |||
5219 | // PARSING | ||
5220 | |||
5221 | addRegexToken('G', matchSigned); | ||
5222 | addRegexToken('g', matchSigned); | ||
5223 | addRegexToken('GG', match1to2, match2); | ||
5224 | addRegexToken('gg', match1to2, match2); | ||
5225 | addRegexToken('GGGG', match1to4, match4); | ||
5226 | addRegexToken('gggg', match1to4, match4); | ||
5227 | addRegexToken('GGGGG', match1to6, match6); | ||
5228 | addRegexToken('ggggg', match1to6, match6); | ||
5229 | |||
5230 | addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { | ||
5231 | week[token.substr(0, 2)] = toInt(input); | ||
5232 | }); | ||
5233 | |||
5234 | addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { | ||
5235 | week[token] = hooks.parseTwoDigitYear(input); | ||
5236 | }); | ||
5237 | |||
5238 | // MOMENTS | ||
5239 | |||
5240 | function getSetWeekYear (input) { | ||
5241 | return getSetWeekYearHelper.call(this, | ||
5242 | input, | ||
5243 | this.week(), | ||
5244 | this.weekday(), | ||
5245 | this.localeData()._week.dow, | ||
5246 | this.localeData()._week.doy); | ||
5247 | } | ||
5248 | |||
5249 | function getSetISOWeekYear (input) { | ||
5250 | return getSetWeekYearHelper.call(this, | ||
5251 | input, this.isoWeek(), this.isoWeekday(), 1, 4); | ||
5252 | } | ||
5253 | |||
5254 | function getISOWeeksInYear () { | ||
5255 | return weeksInYear(this.year(), 1, 4); | ||
5256 | } | ||
5257 | |||
5258 | function getWeeksInYear () { | ||
5259 | var weekInfo = this.localeData()._week; | ||
5260 | return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); | ||
5261 | } | ||
5262 | |||
5263 | function getSetWeekYearHelper(input, week, weekday, dow, doy) { | ||
5264 | var weeksTarget; | ||
5265 | if (input == null) { | ||
5266 | return weekOfYear(this, dow, doy).year; | ||
5267 | } else { | ||
5268 | weeksTarget = weeksInYear(input, dow, doy); | ||
5269 | if (week > weeksTarget) { | ||
5270 | week = weeksTarget; | ||
5271 | } | ||
5272 | return setWeekAll.call(this, input, week, weekday, dow, doy); | ||
5273 | } | ||
5274 | } | ||
5275 | |||
5276 | function setWeekAll(weekYear, week, weekday, dow, doy) { | ||
5277 | var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), | ||
5278 | date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); | ||
5279 | |||
5280 | this.year(date.getUTCFullYear()); | ||
5281 | this.month(date.getUTCMonth()); | ||
5282 | this.date(date.getUTCDate()); | ||
5283 | return this; | ||
5284 | } | ||
5285 | |||
5286 | // FORMATTING | ||
5287 | |||
5288 | addFormatToken('Q', 0, 'Qo', 'quarter'); | ||
5289 | |||
5290 | // ALIASES | ||
5291 | |||
5292 | addUnitAlias('quarter', 'Q'); | ||
5293 | |||
5294 | // PRIORITY | ||
5295 | |||
5296 | addUnitPriority('quarter', 7); | ||
5297 | |||
5298 | // PARSING | ||
5299 | |||
5300 | addRegexToken('Q', match1); | ||
5301 | addParseToken('Q', function (input, array) { | ||
5302 | array[MONTH] = (toInt(input) - 1) * 3; | ||
5303 | }); | ||
5304 | |||
5305 | // MOMENTS | ||
5306 | |||
5307 | function getSetQuarter (input) { | ||
5308 | return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); | ||
5309 | } | ||
5310 | |||
5311 | // FORMATTING | ||
5312 | |||
5313 | addFormatToken('D', ['DD', 2], 'Do', 'date'); | ||
5314 | |||
5315 | // ALIASES | ||
5316 | |||
5317 | addUnitAlias('date', 'D'); | ||
5318 | |||
5319 | // PRIOROITY | ||
5320 | addUnitPriority('date', 9); | ||
5321 | |||
5322 | // PARSING | ||
5323 | |||
5324 | addRegexToken('D', match1to2); | ||
5325 | addRegexToken('DD', match1to2, match2); | ||
5326 | addRegexToken('Do', function (isStrict, locale) { | ||
5327 | // TODO: Remove "ordinalParse" fallback in next major release. | ||
5328 | return isStrict ? | ||
5329 | (locale._dayOfMonthOrdinalParse || locale._ordinalParse) : | ||
5330 | locale._dayOfMonthOrdinalParseLenient; | ||
5331 | }); | ||
5332 | |||
5333 | addParseToken(['D', 'DD'], DATE); | ||
5334 | addParseToken('Do', function (input, array) { | ||
5335 | array[DATE] = toInt(input.match(match1to2)[0], 10); | ||
5336 | }); | ||
5337 | |||
5338 | // MOMENTS | ||
5339 | |||
5340 | var getSetDayOfMonth = makeGetSet('Date', true); | ||
5341 | |||
5342 | // FORMATTING | ||
5343 | |||
5344 | addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); | ||
5345 | |||
5346 | // ALIASES | ||
5347 | |||
5348 | addUnitAlias('dayOfYear', 'DDD'); | ||
5349 | |||
5350 | // PRIORITY | ||
5351 | addUnitPriority('dayOfYear', 4); | ||
5352 | |||
5353 | // PARSING | ||
5354 | |||
5355 | addRegexToken('DDD', match1to3); | ||
5356 | addRegexToken('DDDD', match3); | ||
5357 | addParseToken(['DDD', 'DDDD'], function (input, array, config) { | ||
5358 | config._dayOfYear = toInt(input); | ||
5359 | }); | ||
5360 | |||
5361 | // HELPERS | ||
5362 | |||
5363 | // MOMENTS | ||
5364 | |||
5365 | function getSetDayOfYear (input) { | ||
5366 | var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; | ||
5367 | return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); | ||
5368 | } | ||
5369 | |||
5370 | // FORMATTING | ||
5371 | |||
5372 | addFormatToken('m', ['mm', 2], 0, 'minute'); | ||
5373 | |||
5374 | // ALIASES | ||
5375 | |||
5376 | addUnitAlias('minute', 'm'); | ||
5377 | |||
5378 | // PRIORITY | ||
5379 | |||
5380 | addUnitPriority('minute', 14); | ||
5381 | |||
5382 | // PARSING | ||
5383 | |||
5384 | addRegexToken('m', match1to2); | ||
5385 | addRegexToken('mm', match1to2, match2); | ||
5386 | addParseToken(['m', 'mm'], MINUTE); | ||
5387 | |||
5388 | // MOMENTS | ||
5389 | |||
5390 | var getSetMinute = makeGetSet('Minutes', false); | ||
5391 | |||
5392 | // FORMATTING | ||
5393 | |||
5394 | addFormatToken('s', ['ss', 2], 0, 'second'); | ||
5395 | |||
5396 | // ALIASES | ||
5397 | |||
5398 | addUnitAlias('second', 's'); | ||
5399 | |||
5400 | // PRIORITY | ||
5401 | |||
5402 | addUnitPriority('second', 15); | ||
5403 | |||
5404 | // PARSING | ||
5405 | |||
5406 | addRegexToken('s', match1to2); | ||
5407 | addRegexToken('ss', match1to2, match2); | ||
5408 | addParseToken(['s', 'ss'], SECOND); | ||
5409 | |||
5410 | // MOMENTS | ||
5411 | |||
5412 | var getSetSecond = makeGetSet('Seconds', false); | ||
5413 | |||
5414 | // FORMATTING | ||
5415 | |||
5416 | addFormatToken('S', 0, 0, function () { | ||
5417 | return ~~(this.millisecond() / 100); | ||
5418 | }); | ||
5419 | |||
5420 | addFormatToken(0, ['SS', 2], 0, function () { | ||
5421 | return ~~(this.millisecond() / 10); | ||
5422 | }); | ||
5423 | |||
5424 | addFormatToken(0, ['SSS', 3], 0, 'millisecond'); | ||
5425 | addFormatToken(0, ['SSSS', 4], 0, function () { | ||
5426 | return this.millisecond() * 10; | ||
5427 | }); | ||
5428 | addFormatToken(0, ['SSSSS', 5], 0, function () { | ||
5429 | return this.millisecond() * 100; | ||
5430 | }); | ||
5431 | addFormatToken(0, ['SSSSSS', 6], 0, function () { | ||
5432 | return this.millisecond() * 1000; | ||
5433 | }); | ||
5434 | addFormatToken(0, ['SSSSSSS', 7], 0, function () { | ||
5435 | return this.millisecond() * 10000; | ||
5436 | }); | ||
5437 | addFormatToken(0, ['SSSSSSSS', 8], 0, function () { | ||
5438 | return this.millisecond() * 100000; | ||
5439 | }); | ||
5440 | addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { | ||
5441 | return this.millisecond() * 1000000; | ||
5442 | }); | ||
5443 | |||
5444 | |||
5445 | // ALIASES | ||
5446 | |||
5447 | addUnitAlias('millisecond', 'ms'); | ||
5448 | |||
5449 | // PRIORITY | ||
5450 | |||
5451 | addUnitPriority('millisecond', 16); | ||
5452 | |||
5453 | // PARSING | ||
5454 | |||
5455 | addRegexToken('S', match1to3, match1); | ||
5456 | addRegexToken('SS', match1to3, match2); | ||
5457 | addRegexToken('SSS', match1to3, match3); | ||
5458 | |||
5459 | var token; | ||
5460 | for (token = 'SSSS'; token.length <= 9; token += 'S') { | ||
5461 | addRegexToken(token, matchUnsigned); | ||
5462 | } | ||
5463 | |||
5464 | function parseMs(input, array) { | ||
5465 | array[MILLISECOND] = toInt(('0.' + input) * 1000); | ||
5466 | } | ||
5467 | |||
5468 | for (token = 'S'; token.length <= 9; token += 'S') { | ||
5469 | addParseToken(token, parseMs); | ||
5470 | } | ||
5471 | // MOMENTS | ||
5472 | |||
5473 | var getSetMillisecond = makeGetSet('Milliseconds', false); | ||
5474 | |||
5475 | // FORMATTING | ||
5476 | |||
5477 | addFormatToken('z', 0, 0, 'zoneAbbr'); | ||
5478 | addFormatToken('zz', 0, 0, 'zoneName'); | ||
5479 | |||
5480 | // MOMENTS | ||
5481 | |||
5482 | function getZoneAbbr () { | ||
5483 | return this._isUTC ? 'UTC' : ''; | ||
5484 | } | ||
5485 | |||
5486 | function getZoneName () { | ||
5487 | return this._isUTC ? 'Coordinated Universal Time' : ''; | ||
5488 | } | ||
5489 | |||
5490 | var proto = Moment.prototype; | ||
5491 | |||
5492 | proto.add = add; | ||
5493 | proto.calendar = calendar$1; | ||
5494 | proto.clone = clone; | ||
5495 | proto.diff = diff; | ||
5496 | proto.endOf = endOf; | ||
5497 | proto.format = format; | ||
5498 | proto.from = from; | ||
5499 | proto.fromNow = fromNow; | ||
5500 | proto.to = to; | ||
5501 | proto.toNow = toNow; | ||
5502 | proto.get = stringGet; | ||
5503 | proto.invalidAt = invalidAt; | ||
5504 | proto.isAfter = isAfter; | ||
5505 | proto.isBefore = isBefore; | ||
5506 | proto.isBetween = isBetween; | ||
5507 | proto.isSame = isSame; | ||
5508 | proto.isSameOrAfter = isSameOrAfter; | ||
5509 | proto.isSameOrBefore = isSameOrBefore; | ||
5510 | proto.isValid = isValid$2; | ||
5511 | proto.lang = lang; | ||
5512 | proto.locale = locale; | ||
5513 | proto.localeData = localeData; | ||
5514 | proto.max = prototypeMax; | ||
5515 | proto.min = prototypeMin; | ||
5516 | proto.parsingFlags = parsingFlags; | ||
5517 | proto.set = stringSet; | ||
5518 | proto.startOf = startOf; | ||
5519 | proto.subtract = subtract; | ||
5520 | proto.toArray = toArray; | ||
5521 | proto.toObject = toObject; | ||
5522 | proto.toDate = toDate; | ||
5523 | proto.toISOString = toISOString; | ||
5524 | proto.inspect = inspect; | ||
5525 | proto.toJSON = toJSON; | ||
5526 | proto.toString = toString; | ||
5527 | proto.unix = unix; | ||
5528 | proto.valueOf = valueOf; | ||
5529 | proto.creationData = creationData; | ||
5530 | |||
5531 | // Year | ||
5532 | proto.year = getSetYear; | ||
5533 | proto.isLeapYear = getIsLeapYear; | ||
5534 | |||
5535 | // Week Year | ||
5536 | proto.weekYear = getSetWeekYear; | ||
5537 | proto.isoWeekYear = getSetISOWeekYear; | ||
5538 | |||
5539 | // Quarter | ||
5540 | proto.quarter = proto.quarters = getSetQuarter; | ||
5541 | |||
5542 | // Month | ||
5543 | proto.month = getSetMonth; | ||
5544 | proto.daysInMonth = getDaysInMonth; | ||
5545 | |||
5546 | // Week | ||
5547 | proto.week = proto.weeks = getSetWeek; | ||
5548 | proto.isoWeek = proto.isoWeeks = getSetISOWeek; | ||
5549 | proto.weeksInYear = getWeeksInYear; | ||
5550 | proto.isoWeeksInYear = getISOWeeksInYear; | ||
5551 | |||
5552 | // Day | ||
5553 | proto.date = getSetDayOfMonth; | ||
5554 | proto.day = proto.days = getSetDayOfWeek; | ||
5555 | proto.weekday = getSetLocaleDayOfWeek; | ||
5556 | proto.isoWeekday = getSetISODayOfWeek; | ||
5557 | proto.dayOfYear = getSetDayOfYear; | ||
5558 | |||
5559 | // Hour | ||
5560 | proto.hour = proto.hours = getSetHour; | ||
5561 | |||
5562 | // Minute | ||
5563 | proto.minute = proto.minutes = getSetMinute; | ||
5564 | |||
5565 | // Second | ||
5566 | proto.second = proto.seconds = getSetSecond; | ||
5567 | |||
5568 | // Millisecond | ||
5569 | proto.millisecond = proto.milliseconds = getSetMillisecond; | ||
5570 | |||
5571 | // Offset | ||
5572 | proto.utcOffset = getSetOffset; | ||
5573 | proto.utc = setOffsetToUTC; | ||
5574 | proto.local = setOffsetToLocal; | ||
5575 | proto.parseZone = setOffsetToParsedOffset; | ||
5576 | proto.hasAlignedHourOffset = hasAlignedHourOffset; | ||
5577 | proto.isDST = isDaylightSavingTime; | ||
5578 | proto.isLocal = isLocal; | ||
5579 | proto.isUtcOffset = isUtcOffset; | ||
5580 | proto.isUtc = isUtc; | ||
5581 | proto.isUTC = isUtc; | ||
5582 | |||
5583 | // Timezone | ||
5584 | proto.zoneAbbr = getZoneAbbr; | ||
5585 | proto.zoneName = getZoneName; | ||
5586 | |||
5587 | // Deprecations | ||
5588 | proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); | ||
5589 | proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); | ||
5590 | proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); | ||
5591 | proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); | ||
5592 | proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); | ||
5593 | |||
5594 | function createUnix (input) { | ||
5595 | return createLocal(input * 1000); | ||
5596 | } | ||
5597 | |||
5598 | function createInZone () { | ||
5599 | return createLocal.apply(null, arguments).parseZone(); | ||
5600 | } | ||
5601 | |||
5602 | function preParsePostFormat (string) { | ||
5603 | return string; | ||
5604 | } | ||
5605 | |||
5606 | var proto$1 = Locale.prototype; | ||
5607 | |||
5608 | proto$1.calendar = calendar; | ||
5609 | proto$1.longDateFormat = longDateFormat; | ||
5610 | proto$1.invalidDate = invalidDate; | ||
5611 | proto$1.ordinal = ordinal; | ||
5612 | proto$1.preparse = preParsePostFormat; | ||
5613 | proto$1.postformat = preParsePostFormat; | ||
5614 | proto$1.relativeTime = relativeTime; | ||
5615 | proto$1.pastFuture = pastFuture; | ||
5616 | proto$1.set = set; | ||
5617 | |||
5618 | // Month | ||
5619 | proto$1.months = localeMonths; | ||
5620 | proto$1.monthsShort = localeMonthsShort; | ||
5621 | proto$1.monthsParse = localeMonthsParse; | ||
5622 | proto$1.monthsRegex = monthsRegex; | ||
5623 | proto$1.monthsShortRegex = monthsShortRegex; | ||
5624 | |||
5625 | // Week | ||
5626 | proto$1.week = localeWeek; | ||
5627 | proto$1.firstDayOfYear = localeFirstDayOfYear; | ||
5628 | proto$1.firstDayOfWeek = localeFirstDayOfWeek; | ||
5629 | |||
5630 | // Day of Week | ||
5631 | proto$1.weekdays = localeWeekdays; | ||
5632 | proto$1.weekdaysMin = localeWeekdaysMin; | ||
5633 | proto$1.weekdaysShort = localeWeekdaysShort; | ||
5634 | proto$1.weekdaysParse = localeWeekdaysParse; | ||
5635 | |||
5636 | proto$1.weekdaysRegex = weekdaysRegex; | ||
5637 | proto$1.weekdaysShortRegex = weekdaysShortRegex; | ||
5638 | proto$1.weekdaysMinRegex = weekdaysMinRegex; | ||
5639 | |||
5640 | // Hours | ||
5641 | proto$1.isPM = localeIsPM; | ||
5642 | proto$1.meridiem = localeMeridiem; | ||
5643 | |||
5644 | function get$1 (format, index, field, setter) { | ||
5645 | var locale = getLocale(); | ||
5646 | var utc = createUTC().set(setter, index); | ||
5647 | return locale[field](utc, format); | ||
5648 | } | ||
5649 | |||
5650 | function listMonthsImpl (format, index, field) { | ||
5651 | if (isNumber(format)) { | ||
5652 | index = format; | ||
5653 | format = undefined; | ||
5654 | } | ||
5655 | |||
5656 | format = format || ''; | ||
5657 | |||
5658 | if (index != null) { | ||
5659 | return get$1(format, index, field, 'month'); | ||
5660 | } | ||
5661 | |||
5662 | var i; | ||
5663 | var out = []; | ||
5664 | for (i = 0; i < 12; i++) { | ||
5665 | out[i] = get$1(format, i, field, 'month'); | ||
5666 | } | ||
5667 | return out; | ||
5668 | } | ||
5669 | |||
5670 | // () | ||
5671 | // (5) | ||
5672 | // (fmt, 5) | ||
5673 | // (fmt) | ||
5674 | // (true) | ||
5675 | // (true, 5) | ||
5676 | // (true, fmt, 5) | ||
5677 | // (true, fmt) | ||
5678 | function listWeekdaysImpl (localeSorted, format, index, field) { | ||
5679 | if (typeof localeSorted === 'boolean') { | ||
5680 | if (isNumber(format)) { | ||
5681 | index = format; | ||
5682 | format = undefined; | ||
5683 | } | ||
5684 | |||
5685 | format = format || ''; | ||
5686 | } else { | ||
5687 | format = localeSorted; | ||
5688 | index = format; | ||
5689 | localeSorted = false; | ||
5690 | |||
5691 | if (isNumber(format)) { | ||
5692 | index = format; | ||
5693 | format = undefined; | ||
5694 | } | ||
5695 | |||
5696 | format = format || ''; | ||
5697 | } | ||
5698 | |||
5699 | var locale = getLocale(), | ||
5700 | shift = localeSorted ? locale._week.dow : 0; | ||
5701 | |||
5702 | if (index != null) { | ||
5703 | return get$1(format, (index + shift) % 7, field, 'day'); | ||
5704 | } | ||
5705 | |||
5706 | var i; | ||
5707 | var out = []; | ||
5708 | for (i = 0; i < 7; i++) { | ||
5709 | out[i] = get$1(format, (i + shift) % 7, field, 'day'); | ||
5710 | } | ||
5711 | return out; | ||
5712 | } | ||
5713 | |||
5714 | function listMonths (format, index) { | ||
5715 | return listMonthsImpl(format, index, 'months'); | ||
5716 | } | ||
5717 | |||
5718 | function listMonthsShort (format, index) { | ||
5719 | return listMonthsImpl(format, index, 'monthsShort'); | ||
5720 | } | ||
5721 | |||
5722 | function listWeekdays (localeSorted, format, index) { | ||
5723 | return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); | ||
5724 | } | ||
5725 | |||
5726 | function listWeekdaysShort (localeSorted, format, index) { | ||
5727 | return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); | ||
5728 | } | ||
5729 | |||
5730 | function listWeekdaysMin (localeSorted, format, index) { | ||
5731 | return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); | ||
5732 | } | ||
5733 | |||
5734 | getSetGlobalLocale('en', { | ||
5735 | dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, | ||
5736 | ordinal : function (number) { | ||
5737 | var b = number % 10, | ||
5738 | output = (toInt(number % 100 / 10) === 1) ? 'th' : | ||
5739 | (b === 1) ? 'st' : | ||
5740 | (b === 2) ? 'nd' : | ||
5741 | (b === 3) ? 'rd' : 'th'; | ||
5742 | return number + output; | ||
5743 | } | ||
5744 | }); | ||
5745 | |||
5746 | // Side effect imports | ||
5747 | hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale); | ||
5748 | hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale); | ||
5749 | |||
5750 | var mathAbs = Math.abs; | ||
5751 | |||
5752 | function abs () { | ||
5753 | var data = this._data; | ||
5754 | |||
5755 | this._milliseconds = mathAbs(this._milliseconds); | ||
5756 | this._days = mathAbs(this._days); | ||
5757 | this._months = mathAbs(this._months); | ||
5758 | |||
5759 | data.milliseconds = mathAbs(data.milliseconds); | ||
5760 | data.seconds = mathAbs(data.seconds); | ||
5761 | data.minutes = mathAbs(data.minutes); | ||
5762 | data.hours = mathAbs(data.hours); | ||
5763 | data.months = mathAbs(data.months); | ||
5764 | data.years = mathAbs(data.years); | ||
5765 | |||
5766 | return this; | ||
5767 | } | ||
5768 | |||
5769 | function addSubtract$1 (duration, input, value, direction) { | ||
5770 | var other = createDuration(input, value); | ||
5771 | |||
5772 | duration._milliseconds += direction * other._milliseconds; | ||
5773 | duration._days += direction * other._days; | ||
5774 | duration._months += direction * other._months; | ||
5775 | |||
5776 | return duration._bubble(); | ||
5777 | } | ||
5778 | |||
5779 | // supports only 2.0-style add(1, 's') or add(duration) | ||
5780 | function add$1 (input, value) { | ||
5781 | return addSubtract$1(this, input, value, 1); | ||
5782 | } | ||
5783 | |||
5784 | // supports only 2.0-style subtract(1, 's') or subtract(duration) | ||
5785 | function subtract$1 (input, value) { | ||
5786 | return addSubtract$1(this, input, value, -1); | ||
5787 | } | ||
5788 | |||
5789 | function absCeil (number) { | ||
5790 | if (number < 0) { | ||
5791 | return Math.floor(number); | ||
5792 | } else { | ||
5793 | return Math.ceil(number); | ||
5794 | } | ||
5795 | } | ||
5796 | |||
5797 | function bubble () { | ||
5798 | var milliseconds = this._milliseconds; | ||
5799 | var days = this._days; | ||
5800 | var months = this._months; | ||
5801 | var data = this._data; | ||
5802 | var seconds, minutes, hours, years, monthsFromDays; | ||
5803 | |||
5804 | // if we have a mix of positive and negative values, bubble down first | ||
5805 | // check: https://github.com/moment/moment/issues/2166 | ||
5806 | if (!((milliseconds >= 0 && days >= 0 && months >= 0) || | ||
5807 | (milliseconds <= 0 && days <= 0 && months <= 0))) { | ||
5808 | milliseconds += absCeil(monthsToDays(months) + days) * 864e5; | ||
5809 | days = 0; | ||
5810 | months = 0; | ||
5811 | } | ||
5812 | |||
5813 | // The following code bubbles up values, see the tests for | ||
5814 | // examples of what that means. | ||
5815 | data.milliseconds = milliseconds % 1000; | ||
5816 | |||
5817 | seconds = absFloor(milliseconds / 1000); | ||
5818 | data.seconds = seconds % 60; | ||
5819 | |||
5820 | minutes = absFloor(seconds / 60); | ||
5821 | data.minutes = minutes % 60; | ||
5822 | |||
5823 | hours = absFloor(minutes / 60); | ||
5824 | data.hours = hours % 24; | ||
5825 | |||
5826 | days += absFloor(hours / 24); | ||
5827 | |||
5828 | // convert days to months | ||
5829 | monthsFromDays = absFloor(daysToMonths(days)); | ||
5830 | months += monthsFromDays; | ||
5831 | days -= absCeil(monthsToDays(monthsFromDays)); | ||
5832 | |||
5833 | // 12 months -> 1 year | ||
5834 | years = absFloor(months / 12); | ||
5835 | months %= 12; | ||
5836 | |||
5837 | data.days = days; | ||
5838 | data.months = months; | ||
5839 | data.years = years; | ||
5840 | |||
5841 | return this; | ||
5842 | } | ||
5843 | |||
5844 | function daysToMonths (days) { | ||
5845 | // 400 years have 146097 days (taking into account leap year rules) | ||
5846 | // 400 years have 12 months === 4800 | ||
5847 | return days * 4800 / 146097; | ||
5848 | } | ||
5849 | |||
5850 | function monthsToDays (months) { | ||
5851 | // the reverse of daysToMonths | ||
5852 | return months * 146097 / 4800; | ||
5853 | } | ||
5854 | |||
5855 | function as (units) { | ||
5856 | if (!this.isValid()) { | ||
5857 | return NaN; | ||
5858 | } | ||
5859 | var days; | ||
5860 | var months; | ||
5861 | var milliseconds = this._milliseconds; | ||
5862 | |||
5863 | units = normalizeUnits(units); | ||
5864 | |||
5865 | if (units === 'month' || units === 'year') { | ||
5866 | days = this._days + milliseconds / 864e5; | ||
5867 | months = this._months + daysToMonths(days); | ||
5868 | return units === 'month' ? months : months / 12; | ||
5869 | } else { | ||
5870 | // handle milliseconds separately because of floating point math errors (issue #1867) | ||
5871 | days = this._days + Math.round(monthsToDays(this._months)); | ||
5872 | switch (units) { | ||
5873 | case 'week' : return days / 7 + milliseconds / 6048e5; | ||
5874 | case 'day' : return days + milliseconds / 864e5; | ||
5875 | case 'hour' : return days * 24 + milliseconds / 36e5; | ||
5876 | case 'minute' : return days * 1440 + milliseconds / 6e4; | ||
5877 | case 'second' : return days * 86400 + milliseconds / 1000; | ||
5878 | // Math.floor prevents floating point math errors here | ||
5879 | case 'millisecond': return Math.floor(days * 864e5) + milliseconds; | ||
5880 | default: throw new Error('Unknown unit ' + units); | ||
5881 | } | ||
5882 | } | ||
5883 | } | ||
5884 | |||
5885 | // TODO: Use this.as('ms')? | ||
5886 | function valueOf$1 () { | ||
5887 | if (!this.isValid()) { | ||
5888 | return NaN; | ||
5889 | } | ||
5890 | return ( | ||
5891 | this._milliseconds + | ||
5892 | this._days * 864e5 + | ||
5893 | (this._months % 12) * 2592e6 + | ||
5894 | toInt(this._months / 12) * 31536e6 | ||
5895 | ); | ||
5896 | } | ||
5897 | |||
5898 | function makeAs (alias) { | ||
5899 | return function () { | ||
5900 | return this.as(alias); | ||
5901 | }; | ||
5902 | } | ||
5903 | |||
5904 | var asMilliseconds = makeAs('ms'); | ||
5905 | var asSeconds = makeAs('s'); | ||
5906 | var asMinutes = makeAs('m'); | ||
5907 | var asHours = makeAs('h'); | ||
5908 | var asDays = makeAs('d'); | ||
5909 | var asWeeks = makeAs('w'); | ||
5910 | var asMonths = makeAs('M'); | ||
5911 | var asYears = makeAs('y'); | ||
5912 | |||
5913 | function get$2 (units) { | ||
5914 | units = normalizeUnits(units); | ||
5915 | return this.isValid() ? this[units + 's']() : NaN; | ||
5916 | } | ||
5917 | |||
5918 | function makeGetter(name) { | ||
5919 | return function () { | ||
5920 | return this.isValid() ? this._data[name] : NaN; | ||
5921 | }; | ||
5922 | } | ||
5923 | |||
5924 | var milliseconds = makeGetter('milliseconds'); | ||
5925 | var seconds = makeGetter('seconds'); | ||
5926 | var minutes = makeGetter('minutes'); | ||
5927 | var hours = makeGetter('hours'); | ||
5928 | var days = makeGetter('days'); | ||
5929 | var months = makeGetter('months'); | ||
5930 | var years = makeGetter('years'); | ||
5931 | |||
5932 | function weeks () { | ||
5933 | return absFloor(this.days() / 7); | ||
5934 | } | ||
5935 | |||
5936 | var round = Math.round; | ||
5937 | var thresholds = { | ||
5938 | ss: 44, // a few seconds to seconds | ||
5939 | s : 45, // seconds to minute | ||
5940 | m : 45, // minutes to hour | ||
5941 | h : 22, // hours to day | ||
5942 | d : 26, // days to month | ||
5943 | M : 11 // months to year | ||
5944 | }; | ||
5945 | |||
5946 | // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize | ||
5947 | function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { | ||
5948 | return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); | ||
5949 | } | ||
5950 | |||
5951 | function relativeTime$1 (posNegDuration, withoutSuffix, locale) { | ||
5952 | var duration = createDuration(posNegDuration).abs(); | ||
5953 | var seconds = round(duration.as('s')); | ||
5954 | var minutes = round(duration.as('m')); | ||
5955 | var hours = round(duration.as('h')); | ||
5956 | var days = round(duration.as('d')); | ||
5957 | var months = round(duration.as('M')); | ||
5958 | var years = round(duration.as('y')); | ||
5959 | |||
5960 | var a = seconds <= thresholds.ss && ['s', seconds] || | ||
5961 | seconds < thresholds.s && ['ss', seconds] || | ||
5962 | minutes <= 1 && ['m'] || | ||
5963 | minutes < thresholds.m && ['mm', minutes] || | ||
5964 | hours <= 1 && ['h'] || | ||
5965 | hours < thresholds.h && ['hh', hours] || | ||
5966 | days <= 1 && ['d'] || | ||
5967 | days < thresholds.d && ['dd', days] || | ||
5968 | months <= 1 && ['M'] || | ||
5969 | months < thresholds.M && ['MM', months] || | ||
5970 | years <= 1 && ['y'] || ['yy', years]; | ||
5971 | |||
5972 | a[2] = withoutSuffix; | ||
5973 | a[3] = +posNegDuration > 0; | ||
5974 | a[4] = locale; | ||
5975 | return substituteTimeAgo.apply(null, a); | ||
5976 | } | ||
5977 | |||
5978 | // This function allows you to set the rounding function for relative time strings | ||
5979 | function getSetRelativeTimeRounding (roundingFunction) { | ||
5980 | if (roundingFunction === undefined) { | ||
5981 | return round; | ||
5982 | } | ||
5983 | if (typeof(roundingFunction) === 'function') { | ||
5984 | round = roundingFunction; | ||
5985 | return true; | ||
5986 | } | ||
5987 | return false; | ||
5988 | } | ||
5989 | |||
5990 | // This function allows you to set a threshold for relative time strings | ||
5991 | function getSetRelativeTimeThreshold (threshold, limit) { | ||
5992 | if (thresholds[threshold] === undefined) { | ||
5993 | return false; | ||
5994 | } | ||
5995 | if (limit === undefined) { | ||
5996 | return thresholds[threshold]; | ||
5997 | } | ||
5998 | thresholds[threshold] = limit; | ||
5999 | if (threshold === 's') { | ||
6000 | thresholds.ss = limit - 1; | ||
6001 | } | ||
6002 | return true; | ||
6003 | } | ||
6004 | |||
6005 | function humanize (withSuffix) { | ||
6006 | if (!this.isValid()) { | ||
6007 | return this.localeData().invalidDate(); | ||
6008 | } | ||
6009 | |||
6010 | var locale = this.localeData(); | ||
6011 | var output = relativeTime$1(this, !withSuffix, locale); | ||
6012 | |||
6013 | if (withSuffix) { | ||
6014 | output = locale.pastFuture(+this, output); | ||
6015 | } | ||
6016 | |||
6017 | return locale.postformat(output); | ||
6018 | } | ||
6019 | |||
6020 | var abs$1 = Math.abs; | ||
6021 | |||
6022 | function toISOString$1() { | ||
6023 | // for ISO strings we do not use the normal bubbling rules: | ||
6024 | // * milliseconds bubble up until they become hours | ||
6025 | // * days do not bubble at all | ||
6026 | // * months bubble up until they become years | ||
6027 | // This is because there is no context-free conversion between hours and days | ||
6028 | // (think of clock changes) | ||
6029 | // and also not between days and months (28-31 days per month) | ||
6030 | if (!this.isValid()) { | ||
6031 | return this.localeData().invalidDate(); | ||
6032 | } | ||
6033 | |||
6034 | var seconds = abs$1(this._milliseconds) / 1000; | ||
6035 | var days = abs$1(this._days); | ||
6036 | var months = abs$1(this._months); | ||
6037 | var minutes, hours, years; | ||
6038 | |||
6039 | // 3600 seconds -> 60 minutes -> 1 hour | ||
6040 | minutes = absFloor(seconds / 60); | ||
6041 | hours = absFloor(minutes / 60); | ||
6042 | seconds %= 60; | ||
6043 | minutes %= 60; | ||
6044 | |||
6045 | // 12 months -> 1 year | ||
6046 | years = absFloor(months / 12); | ||
6047 | months %= 12; | ||
6048 | |||
6049 | |||
6050 | // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js | ||
6051 | var Y = years; | ||
6052 | var M = months; | ||
6053 | var D = days; | ||
6054 | var h = hours; | ||
6055 | var m = minutes; | ||
6056 | var s = seconds; | ||
6057 | var total = this.asSeconds(); | ||
6058 | |||
6059 | if (!total) { | ||
6060 | // this is the same as C#'s (Noda) and python (isodate)... | ||
6061 | // but not other JS (goog.date) | ||
6062 | return 'P0D'; | ||
6063 | } | ||
6064 | |||
6065 | return (total < 0 ? '-' : '') + | ||
6066 | 'P' + | ||
6067 | (Y ? Y + 'Y' : '') + | ||
6068 | (M ? M + 'M' : '') + | ||
6069 | (D ? D + 'D' : '') + | ||
6070 | ((h || m || s) ? 'T' : '') + | ||
6071 | (h ? h + 'H' : '') + | ||
6072 | (m ? m + 'M' : '') + | ||
6073 | (s ? s + 'S' : ''); | ||
6074 | } | ||
6075 | |||
6076 | var proto$2 = Duration.prototype; | ||
6077 | |||
6078 | proto$2.isValid = isValid$1; | ||
6079 | proto$2.abs = abs; | ||
6080 | proto$2.add = add$1; | ||
6081 | proto$2.subtract = subtract$1; | ||
6082 | proto$2.as = as; | ||
6083 | proto$2.asMilliseconds = asMilliseconds; | ||
6084 | proto$2.asSeconds = asSeconds; | ||
6085 | proto$2.asMinutes = asMinutes; | ||
6086 | proto$2.asHours = asHours; | ||
6087 | proto$2.asDays = asDays; | ||
6088 | proto$2.asWeeks = asWeeks; | ||
6089 | proto$2.asMonths = asMonths; | ||
6090 | proto$2.asYears = asYears; | ||
6091 | proto$2.valueOf = valueOf$1; | ||
6092 | proto$2._bubble = bubble; | ||
6093 | proto$2.get = get$2; | ||
6094 | proto$2.milliseconds = milliseconds; | ||
6095 | proto$2.seconds = seconds; | ||
6096 | proto$2.minutes = minutes; | ||
6097 | proto$2.hours = hours; | ||
6098 | proto$2.days = days; | ||
6099 | proto$2.weeks = weeks; | ||
6100 | proto$2.months = months; | ||
6101 | proto$2.years = years; | ||
6102 | proto$2.humanize = humanize; | ||
6103 | proto$2.toISOString = toISOString$1; | ||
6104 | proto$2.toString = toISOString$1; | ||
6105 | proto$2.toJSON = toISOString$1; | ||
6106 | proto$2.locale = locale; | ||
6107 | proto$2.localeData = localeData; | ||
6108 | |||
6109 | // Deprecations | ||
6110 | proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1); | ||
6111 | proto$2.lang = lang; | ||
6112 | |||
6113 | // Side effect imports | ||
6114 | |||
6115 | // FORMATTING | ||
6116 | |||
6117 | addFormatToken('X', 0, 0, 'unix'); | ||
6118 | addFormatToken('x', 0, 0, 'valueOf'); | ||
6119 | |||
6120 | // PARSING | ||
6121 | |||
6122 | addRegexToken('x', matchSigned); | ||
6123 | addRegexToken('X', matchTimestamp); | ||
6124 | addParseToken('X', function (input, array, config) { | ||
6125 | config._d = new Date(parseFloat(input, 10) * 1000); | ||
6126 | }); | ||
6127 | addParseToken('x', function (input, array, config) { | ||
6128 | config._d = new Date(toInt(input)); | ||
6129 | }); | ||
6130 | |||
6131 | // Side effect imports | ||
6132 | |||
6133 | |||
6134 | hooks.version = '2.18.1'; | ||
6135 | |||
6136 | setHookCallback(createLocal); | ||
6137 | |||
6138 | hooks.fn = proto; | ||
6139 | hooks.min = min; | ||
6140 | hooks.max = max; | ||
6141 | hooks.now = now; | ||
6142 | hooks.utc = createUTC; | ||
6143 | hooks.unix = createUnix; | ||
6144 | hooks.months = listMonths; | ||
6145 | hooks.isDate = isDate; | ||
6146 | hooks.locale = getSetGlobalLocale; | ||
6147 | hooks.invalid = createInvalid; | ||
6148 | hooks.duration = createDuration; | ||
6149 | hooks.isMoment = isMoment; | ||
6150 | hooks.weekdays = listWeekdays; | ||
6151 | hooks.parseZone = createInZone; | ||
6152 | hooks.localeData = getLocale; | ||
6153 | hooks.isDuration = isDuration; | ||
6154 | hooks.monthsShort = listMonthsShort; | ||
6155 | hooks.weekdaysMin = listWeekdaysMin; | ||
6156 | hooks.defineLocale = defineLocale; | ||
6157 | hooks.updateLocale = updateLocale; | ||
6158 | hooks.locales = listLocales; | ||
6159 | hooks.weekdaysShort = listWeekdaysShort; | ||
6160 | hooks.normalizeUnits = normalizeUnits; | ||
6161 | hooks.relativeTimeRounding = getSetRelativeTimeRounding; | ||
6162 | hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; | ||
6163 | hooks.calendarFormat = getCalendarFormat; | ||
6164 | hooks.prototype = proto; | ||
6165 | |||
6166 | return hooks; | ||
6167 | |||
6168 | }))); | ||
6169 | |||
6170 | |||
6171 | /***/ }), | ||
6172 | /* 19 */ | ||
6173 | /***/ (function(module, exports, __webpack_require__) { | ||
6174 | |||
6175 | "use strict"; | ||
6176 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6177 | * Copyright 2013-present, Facebook, Inc. | ||
6178 | * All rights reserved. | ||
6179 | * | ||
6180 | * This source code is licensed under the BSD-style license found in the | ||
6181 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6182 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6183 | * | ||
6184 | */ | ||
6185 | |||
6186 | |||
6187 | |||
6188 | var _assign = __webpack_require__(4); | ||
6189 | |||
6190 | var PooledClass = __webpack_require__(30); | ||
6191 | |||
6192 | var emptyFunction = __webpack_require__(10); | ||
6193 | var warning = __webpack_require__(2); | ||
6194 | |||
6195 | var didWarnForAddedNewProperty = false; | ||
6196 | var isProxySupported = typeof Proxy === 'function'; | ||
6197 | |||
6198 | var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances']; | ||
6199 | |||
6200 | /** | ||
6201 | * @interface Event | ||
6202 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
6203 | */ | ||
6204 | var EventInterface = { | ||
6205 | type: null, | ||
6206 | target: null, | ||
6207 | // currentTarget is set when dispatching; no use in copying it here | ||
6208 | currentTarget: emptyFunction.thatReturnsNull, | ||
6209 | eventPhase: null, | ||
6210 | bubbles: null, | ||
6211 | cancelable: null, | ||
6212 | timeStamp: function (event) { | ||
6213 | return event.timeStamp || Date.now(); | ||
6214 | }, | ||
6215 | defaultPrevented: null, | ||
6216 | isTrusted: null | ||
6217 | }; | ||
6218 | |||
6219 | /** | ||
6220 | * Synthetic events are dispatched by event plugins, typically in response to a | ||
6221 | * top-level event delegation handler. | ||
6222 | * | ||
6223 | * These systems should generally use pooling to reduce the frequency of garbage | ||
6224 | * collection. The system should check `isPersistent` to determine whether the | ||
6225 | * event should be released into the pool after being dispatched. Users that | ||
6226 | * need a persisted event should invoke `persist`. | ||
6227 | * | ||
6228 | * Synthetic events (and subclasses) implement the DOM Level 3 Events API by | ||
6229 | * normalizing browser quirks. Subclasses do not necessarily have to implement a | ||
6230 | * DOM interface; custom application-specific events can also subclass this. | ||
6231 | * | ||
6232 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
6233 | * @param {*} targetInst Marker identifying the event target. | ||
6234 | * @param {object} nativeEvent Native browser event. | ||
6235 | * @param {DOMEventTarget} nativeEventTarget Target node. | ||
6236 | */ | ||
6237 | function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { | ||
6238 | if (process.env.NODE_ENV !== 'production') { | ||
6239 | // these have a getter/setter for warnings | ||
6240 | delete this.nativeEvent; | ||
6241 | delete this.preventDefault; | ||
6242 | delete this.stopPropagation; | ||
6243 | } | ||
6244 | |||
6245 | this.dispatchConfig = dispatchConfig; | ||
6246 | this._targetInst = targetInst; | ||
6247 | this.nativeEvent = nativeEvent; | ||
6248 | |||
6249 | var Interface = this.constructor.Interface; | ||
6250 | for (var propName in Interface) { | ||
6251 | if (!Interface.hasOwnProperty(propName)) { | ||
6252 | continue; | ||
6253 | } | ||
6254 | if (process.env.NODE_ENV !== 'production') { | ||
6255 | delete this[propName]; // this has a getter/setter for warnings | ||
6256 | } | ||
6257 | var normalize = Interface[propName]; | ||
6258 | if (normalize) { | ||
6259 | this[propName] = normalize(nativeEvent); | ||
6260 | } else { | ||
6261 | if (propName === 'target') { | ||
6262 | this.target = nativeEventTarget; | ||
6263 | } else { | ||
6264 | this[propName] = nativeEvent[propName]; | ||
6265 | } | ||
6266 | } | ||
6267 | } | ||
6268 | |||
6269 | var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; | ||
6270 | if (defaultPrevented) { | ||
6271 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | ||
6272 | } else { | ||
6273 | this.isDefaultPrevented = emptyFunction.thatReturnsFalse; | ||
6274 | } | ||
6275 | this.isPropagationStopped = emptyFunction.thatReturnsFalse; | ||
6276 | return this; | ||
6277 | } | ||
6278 | |||
6279 | _assign(SyntheticEvent.prototype, { | ||
6280 | |||
6281 | preventDefault: function () { | ||
6282 | this.defaultPrevented = true; | ||
6283 | var event = this.nativeEvent; | ||
6284 | if (!event) { | ||
6285 | return; | ||
6286 | } | ||
6287 | |||
6288 | if (event.preventDefault) { | ||
6289 | event.preventDefault(); | ||
6290 | } else if (typeof event.returnValue !== 'unknown') { | ||
6291 | // eslint-disable-line valid-typeof | ||
6292 | event.returnValue = false; | ||
6293 | } | ||
6294 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | ||
6295 | }, | ||
6296 | |||
6297 | stopPropagation: function () { | ||
6298 | var event = this.nativeEvent; | ||
6299 | if (!event) { | ||
6300 | return; | ||
6301 | } | ||
6302 | |||
6303 | if (event.stopPropagation) { | ||
6304 | event.stopPropagation(); | ||
6305 | } else if (typeof event.cancelBubble !== 'unknown') { | ||
6306 | // eslint-disable-line valid-typeof | ||
6307 | // The ChangeEventPlugin registers a "propertychange" event for | ||
6308 | // IE. This event does not support bubbling or cancelling, and | ||
6309 | // any references to cancelBubble throw "Member not found". A | ||
6310 | // typeof check of "unknown" circumvents this issue (and is also | ||
6311 | // IE specific). | ||
6312 | event.cancelBubble = true; | ||
6313 | } | ||
6314 | |||
6315 | this.isPropagationStopped = emptyFunction.thatReturnsTrue; | ||
6316 | }, | ||
6317 | |||
6318 | /** | ||
6319 | * We release all dispatched `SyntheticEvent`s after each event loop, adding | ||
6320 | * them back into the pool. This allows a way to hold onto a reference that | ||
6321 | * won't be added back into the pool. | ||
6322 | */ | ||
6323 | persist: function () { | ||
6324 | this.isPersistent = emptyFunction.thatReturnsTrue; | ||
6325 | }, | ||
6326 | |||
6327 | /** | ||
6328 | * Checks if this event should be released back into the pool. | ||
6329 | * | ||
6330 | * @return {boolean} True if this should not be released, false otherwise. | ||
6331 | */ | ||
6332 | isPersistent: emptyFunction.thatReturnsFalse, | ||
6333 | |||
6334 | /** | ||
6335 | * `PooledClass` looks for `destructor` on each instance it releases. | ||
6336 | */ | ||
6337 | destructor: function () { | ||
6338 | var Interface = this.constructor.Interface; | ||
6339 | for (var propName in Interface) { | ||
6340 | if (process.env.NODE_ENV !== 'production') { | ||
6341 | Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); | ||
6342 | } else { | ||
6343 | this[propName] = null; | ||
6344 | } | ||
6345 | } | ||
6346 | for (var i = 0; i < shouldBeReleasedProperties.length; i++) { | ||
6347 | this[shouldBeReleasedProperties[i]] = null; | ||
6348 | } | ||
6349 | if (process.env.NODE_ENV !== 'production') { | ||
6350 | Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); | ||
6351 | Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction)); | ||
6352 | Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction)); | ||
6353 | } | ||
6354 | } | ||
6355 | |||
6356 | }); | ||
6357 | |||
6358 | SyntheticEvent.Interface = EventInterface; | ||
6359 | |||
6360 | if (process.env.NODE_ENV !== 'production') { | ||
6361 | if (isProxySupported) { | ||
6362 | /*eslint-disable no-func-assign */ | ||
6363 | SyntheticEvent = new Proxy(SyntheticEvent, { | ||
6364 | construct: function (target, args) { | ||
6365 | return this.apply(target, Object.create(target.prototype), args); | ||
6366 | }, | ||
6367 | apply: function (constructor, that, args) { | ||
6368 | return new Proxy(constructor.apply(that, args), { | ||
6369 | set: function (target, prop, value) { | ||
6370 | if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) { | ||
6371 | 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; | ||
6372 | didWarnForAddedNewProperty = true; | ||
6373 | } | ||
6374 | target[prop] = value; | ||
6375 | return true; | ||
6376 | } | ||
6377 | }); | ||
6378 | } | ||
6379 | }); | ||
6380 | /*eslint-enable no-func-assign */ | ||
6381 | } | ||
6382 | } | ||
6383 | /** | ||
6384 | * Helper to reduce boilerplate when creating subclasses. | ||
6385 | * | ||
6386 | * @param {function} Class | ||
6387 | * @param {?object} Interface | ||
6388 | */ | ||
6389 | SyntheticEvent.augmentClass = function (Class, Interface) { | ||
6390 | var Super = this; | ||
6391 | |||
6392 | var E = function () {}; | ||
6393 | E.prototype = Super.prototype; | ||
6394 | var prototype = new E(); | ||
6395 | |||
6396 | _assign(prototype, Class.prototype); | ||
6397 | Class.prototype = prototype; | ||
6398 | Class.prototype.constructor = Class; | ||
6399 | |||
6400 | Class.Interface = _assign({}, Super.Interface, Interface); | ||
6401 | Class.augmentClass = Super.augmentClass; | ||
6402 | |||
6403 | PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); | ||
6404 | }; | ||
6405 | |||
6406 | PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler); | ||
6407 | |||
6408 | module.exports = SyntheticEvent; | ||
6409 | |||
6410 | /** | ||
6411 | * Helper to nullify syntheticEvent instance properties when destructing | ||
6412 | * | ||
6413 | * @param {object} SyntheticEvent | ||
6414 | * @param {String} propName | ||
6415 | * @return {object} defineProperty object | ||
6416 | */ | ||
6417 | function getPooledWarningPropertyDefinition(propName, getVal) { | ||
6418 | var isFunction = typeof getVal === 'function'; | ||
6419 | return { | ||
6420 | configurable: true, | ||
6421 | set: set, | ||
6422 | get: get | ||
6423 | }; | ||
6424 | |||
6425 | function set(val) { | ||
6426 | var action = isFunction ? 'setting the method' : 'setting the property'; | ||
6427 | warn(action, 'This is effectively a no-op'); | ||
6428 | return val; | ||
6429 | } | ||
6430 | |||
6431 | function get() { | ||
6432 | var action = isFunction ? 'accessing the method' : 'accessing the property'; | ||
6433 | var result = isFunction ? 'This is a no-op function' : 'This is set to null'; | ||
6434 | warn(action, result); | ||
6435 | return getVal; | ||
6436 | } | ||
6437 | |||
6438 | function warn(action, result) { | ||
6439 | var warningCondition = false; | ||
6440 | 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; | ||
6441 | } | ||
6442 | } | ||
6443 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
6444 | |||
6445 | /***/ }), | ||
6446 | /* 20 */ | ||
6447 | /***/ (function(module, exports) { | ||
6448 | |||
6449 | // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 | ||
6450 | var global = module.exports = typeof window != 'undefined' && window.Math == Math | ||
6451 | ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); | ||
6452 | if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef | ||
6453 | |||
6454 | /***/ }), | ||
6455 | /* 21 */ | ||
6456 | /***/ (function(module, exports, __webpack_require__) { | ||
6457 | |||
6458 | "use strict"; | ||
6459 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6460 | * Copyright 2013-present, Facebook, Inc. | ||
6461 | * All rights reserved. | ||
6462 | * | ||
6463 | * This source code is licensed under the BSD-style license found in the | ||
6464 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6465 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6466 | * | ||
6467 | */ | ||
6468 | |||
6469 | |||
6470 | |||
6471 | var _prodInvariant = __webpack_require__(3); | ||
6472 | |||
6473 | var invariant = __webpack_require__(1); | ||
6474 | |||
6475 | function checkMask(value, bitmask) { | ||
6476 | return (value & bitmask) === bitmask; | ||
6477 | } | ||
6478 | |||
6479 | var DOMPropertyInjection = { | ||
6480 | /** | ||
6481 | * Mapping from normalized, camelcased property names to a configuration that | ||
6482 | * specifies how the associated DOM property should be accessed or rendered. | ||
6483 | */ | ||
6484 | MUST_USE_PROPERTY: 0x1, | ||
6485 | HAS_BOOLEAN_VALUE: 0x4, | ||
6486 | HAS_NUMERIC_VALUE: 0x8, | ||
6487 | HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8, | ||
6488 | HAS_OVERLOADED_BOOLEAN_VALUE: 0x20, | ||
6489 | |||
6490 | /** | ||
6491 | * Inject some specialized knowledge about the DOM. This takes a config object | ||
6492 | * with the following properties: | ||
6493 | * | ||
6494 | * isCustomAttribute: function that given an attribute name will return true | ||
6495 | * if it can be inserted into the DOM verbatim. Useful for data-* or aria-* | ||
6496 | * attributes where it's impossible to enumerate all of the possible | ||
6497 | * attribute names, | ||
6498 | * | ||
6499 | * Properties: object mapping DOM property name to one of the | ||
6500 | * DOMPropertyInjection constants or null. If your attribute isn't in here, | ||
6501 | * it won't get written to the DOM. | ||
6502 | * | ||
6503 | * DOMAttributeNames: object mapping React attribute name to the DOM | ||
6504 | * attribute name. Attribute names not specified use the **lowercase** | ||
6505 | * normalized name. | ||
6506 | * | ||
6507 | * DOMAttributeNamespaces: object mapping React attribute name to the DOM | ||
6508 | * attribute namespace URL. (Attribute names not specified use no namespace.) | ||
6509 | * | ||
6510 | * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. | ||
6511 | * Property names not specified use the normalized name. | ||
6512 | * | ||
6513 | * DOMMutationMethods: Properties that require special mutation methods. If | ||
6514 | * `value` is undefined, the mutation method should unset the property. | ||
6515 | * | ||
6516 | * @param {object} domPropertyConfig the config as described above. | ||
6517 | */ | ||
6518 | injectDOMPropertyConfig: function (domPropertyConfig) { | ||
6519 | var Injection = DOMPropertyInjection; | ||
6520 | var Properties = domPropertyConfig.Properties || {}; | ||
6521 | var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {}; | ||
6522 | var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; | ||
6523 | var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; | ||
6524 | var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; | ||
6525 | |||
6526 | if (domPropertyConfig.isCustomAttribute) { | ||
6527 | DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute); | ||
6528 | } | ||
6529 | |||
6530 | for (var propName in Properties) { | ||
6531 | !!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; | ||
6532 | |||
6533 | var lowerCased = propName.toLowerCase(); | ||
6534 | var propConfig = Properties[propName]; | ||
6535 | |||
6536 | var propertyInfo = { | ||
6537 | attributeName: lowerCased, | ||
6538 | attributeNamespace: null, | ||
6539 | propertyName: propName, | ||
6540 | mutationMethod: null, | ||
6541 | |||
6542 | mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), | ||
6543 | hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), | ||
6544 | hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), | ||
6545 | hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE), | ||
6546 | hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE) | ||
6547 | }; | ||
6548 | !(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; | ||
6549 | |||
6550 | if (process.env.NODE_ENV !== 'production') { | ||
6551 | DOMProperty.getPossibleStandardName[lowerCased] = propName; | ||
6552 | } | ||
6553 | |||
6554 | if (DOMAttributeNames.hasOwnProperty(propName)) { | ||
6555 | var attributeName = DOMAttributeNames[propName]; | ||
6556 | propertyInfo.attributeName = attributeName; | ||
6557 | if (process.env.NODE_ENV !== 'production') { | ||
6558 | DOMProperty.getPossibleStandardName[attributeName] = propName; | ||
6559 | } | ||
6560 | } | ||
6561 | |||
6562 | if (DOMAttributeNamespaces.hasOwnProperty(propName)) { | ||
6563 | propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; | ||
6564 | } | ||
6565 | |||
6566 | if (DOMPropertyNames.hasOwnProperty(propName)) { | ||
6567 | propertyInfo.propertyName = DOMPropertyNames[propName]; | ||
6568 | } | ||
6569 | |||
6570 | if (DOMMutationMethods.hasOwnProperty(propName)) { | ||
6571 | propertyInfo.mutationMethod = DOMMutationMethods[propName]; | ||
6572 | } | ||
6573 | |||
6574 | DOMProperty.properties[propName] = propertyInfo; | ||
6575 | } | ||
6576 | } | ||
6577 | }; | ||
6578 | |||
6579 | /* eslint-disable max-len */ | ||
6580 | 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'; | ||
6581 | /* eslint-enable max-len */ | ||
6582 | |||
6583 | /** | ||
6584 | * DOMProperty exports lookup objects that can be used like functions: | ||
6585 | * | ||
6586 | * > DOMProperty.isValid['id'] | ||
6587 | * true | ||
6588 | * > DOMProperty.isValid['foobar'] | ||
6589 | * undefined | ||
6590 | * | ||
6591 | * Although this may be confusing, it performs better in general. | ||
6592 | * | ||
6593 | * @see http://jsperf.com/key-exists | ||
6594 | * @see http://jsperf.com/key-missing | ||
6595 | */ | ||
6596 | var DOMProperty = { | ||
6597 | |||
6598 | ID_ATTRIBUTE_NAME: 'data-reactid', | ||
6599 | ROOT_ATTRIBUTE_NAME: 'data-reactroot', | ||
6600 | |||
6601 | ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR, | ||
6602 | ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040', | ||
6603 | |||
6604 | /** | ||
6605 | * Map from property "standard name" to an object with info about how to set | ||
6606 | * the property in the DOM. Each object contains: | ||
6607 | * | ||
6608 | * attributeName: | ||
6609 | * Used when rendering markup or with `*Attribute()`. | ||
6610 | * attributeNamespace | ||
6611 | * propertyName: | ||
6612 | * Used on DOM node instances. (This includes properties that mutate due to | ||
6613 | * external factors.) | ||
6614 | * mutationMethod: | ||
6615 | * If non-null, used instead of the property or `setAttribute()` after | ||
6616 | * initial render. | ||
6617 | * mustUseProperty: | ||
6618 | * Whether the property must be accessed and mutated as an object property. | ||
6619 | * hasBooleanValue: | ||
6620 | * Whether the property should be removed when set to a falsey value. | ||
6621 | * hasNumericValue: | ||
6622 | * Whether the property must be numeric or parse as a numeric and should be | ||
6623 | * removed when set to a falsey value. | ||
6624 | * hasPositiveNumericValue: | ||
6625 | * Whether the property must be positive numeric or parse as a positive | ||
6626 | * numeric and should be removed when set to a falsey value. | ||
6627 | * hasOverloadedBooleanValue: | ||
6628 | * Whether the property can be used as a flag as well as with a value. | ||
6629 | * Removed when strictly equal to false; present without a value when | ||
6630 | * strictly equal to true; present with a value otherwise. | ||
6631 | */ | ||
6632 | properties: {}, | ||
6633 | |||
6634 | /** | ||
6635 | * Mapping from lowercase property names to the properly cased version, used | ||
6636 | * to warn in the case of missing properties. Available only in __DEV__. | ||
6637 | * | ||
6638 | * autofocus is predefined, because adding it to the property whitelist | ||
6639 | * causes unintended side effects. | ||
6640 | * | ||
6641 | * @type {Object} | ||
6642 | */ | ||
6643 | getPossibleStandardName: process.env.NODE_ENV !== 'production' ? { autofocus: 'autoFocus' } : null, | ||
6644 | |||
6645 | /** | ||
6646 | * All of the isCustomAttribute() functions that have been injected. | ||
6647 | */ | ||
6648 | _isCustomAttributeFunctions: [], | ||
6649 | |||
6650 | /** | ||
6651 | * Checks whether a property name is a custom attribute. | ||
6652 | * @method | ||
6653 | */ | ||
6654 | isCustomAttribute: function (attributeName) { | ||
6655 | for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) { | ||
6656 | var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i]; | ||
6657 | if (isCustomAttributeFn(attributeName)) { | ||
6658 | return true; | ||
6659 | } | ||
6660 | } | ||
6661 | return false; | ||
6662 | }, | ||
6663 | |||
6664 | injection: DOMPropertyInjection | ||
6665 | }; | ||
6666 | |||
6667 | module.exports = DOMProperty; | ||
6668 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
6669 | |||
6670 | /***/ }), | ||
6671 | /* 22 */ | ||
6672 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
6673 | |||
6674 | "use strict"; | ||
6675 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src___ = __webpack_require__(158); | ||
6676 | /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__src___["a"]; }); | ||
6677 | |||
6678 | |||
6679 | /***/ }), | ||
6680 | /* 23 */ | ||
6681 | /***/ (function(module, exports, __webpack_require__) { | ||
6682 | |||
6683 | "use strict"; | ||
6684 | |||
6685 | |||
6686 | exports.__esModule = true; | ||
6687 | |||
6688 | var _defineProperty = __webpack_require__(92); | ||
6689 | |||
6690 | var _defineProperty2 = _interopRequireDefault(_defineProperty); | ||
6691 | |||
6692 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
6693 | |||
6694 | exports.default = function () { | ||
6695 | function defineProperties(target, props) { | ||
6696 | for (var i = 0; i < props.length; i++) { | ||
6697 | var descriptor = props[i]; | ||
6698 | descriptor.enumerable = descriptor.enumerable || false; | ||
6699 | descriptor.configurable = true; | ||
6700 | if ("value" in descriptor) descriptor.writable = true; | ||
6701 | (0, _defineProperty2.default)(target, descriptor.key, descriptor); | ||
6702 | } | ||
6703 | } | ||
6704 | |||
6705 | return function (Constructor, protoProps, staticProps) { | ||
6706 | if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
6707 | if (staticProps) defineProperties(Constructor, staticProps); | ||
6708 | return Constructor; | ||
6709 | }; | ||
6710 | }(); | ||
6711 | |||
6712 | /***/ }), | ||
6713 | /* 24 */ | ||
6714 | /***/ (function(module, exports) { | ||
6715 | |||
6716 | var core = module.exports = {version: '2.4.0'}; | ||
6717 | if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef | ||
6718 | |||
6719 | /***/ }), | ||
6720 | /* 25 */ | ||
6721 | /***/ (function(module, exports, __webpack_require__) { | ||
6722 | |||
6723 | // Thank's IE8 for his funny defineProperty | ||
6724 | module.exports = !__webpack_require__(41)(function(){ | ||
6725 | return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; | ||
6726 | }); | ||
6727 | |||
6728 | /***/ }), | ||
6729 | /* 26 */ | ||
6730 | /***/ (function(module, exports) { | ||
6731 | |||
6732 | var hasOwnProperty = {}.hasOwnProperty; | ||
6733 | module.exports = function(it, key){ | ||
6734 | return hasOwnProperty.call(it, key); | ||
6735 | }; | ||
6736 | |||
6737 | /***/ }), | ||
6738 | /* 27 */ | ||
6739 | /***/ (function(module, exports, __webpack_require__) { | ||
6740 | |||
6741 | var anObject = __webpack_require__(40) | ||
6742 | , IE8_DOM_DEFINE = __webpack_require__(100) | ||
6743 | , toPrimitive = __webpack_require__(70) | ||
6744 | , dP = Object.defineProperty; | ||
6745 | |||
6746 | exports.f = __webpack_require__(25) ? Object.defineProperty : function defineProperty(O, P, Attributes){ | ||
6747 | anObject(O); | ||
6748 | P = toPrimitive(P, true); | ||
6749 | anObject(Attributes); | ||
6750 | if(IE8_DOM_DEFINE)try { | ||
6751 | return dP(O, P, Attributes); | ||
6752 | } catch(e){ /* empty */ } | ||
6753 | if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); | ||
6754 | if('value' in Attributes)O[P] = Attributes.value; | ||
6755 | return O; | ||
6756 | }; | ||
6757 | |||
6758 | /***/ }), | ||
6759 | /* 28 */ | ||
6760 | /***/ (function(module, exports, __webpack_require__) { | ||
6761 | |||
6762 | // to indexed object, toObject with fallback for non-array-like ES3 strings | ||
6763 | var IObject = __webpack_require__(101) | ||
6764 | , defined = __webpack_require__(60); | ||
6765 | module.exports = function(it){ | ||
6766 | return IObject(defined(it)); | ||
6767 | }; | ||
6768 | |||
6769 | /***/ }), | ||
6770 | /* 29 */ | ||
6771 | /***/ (function(module, exports) { | ||
6772 | |||
6773 | // removed by extract-text-webpack-plugin | ||
6774 | |||
6775 | /***/ }), | ||
6776 | /* 30 */ | ||
6777 | /***/ (function(module, exports, __webpack_require__) { | ||
6778 | |||
6779 | "use strict"; | ||
6780 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6781 | * Copyright 2013-present, Facebook, Inc. | ||
6782 | * All rights reserved. | ||
6783 | * | ||
6784 | * This source code is licensed under the BSD-style license found in the | ||
6785 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6786 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6787 | * | ||
6788 | * | ||
6789 | */ | ||
6790 | |||
6791 | |||
6792 | |||
6793 | var _prodInvariant = __webpack_require__(3); | ||
6794 | |||
6795 | var invariant = __webpack_require__(1); | ||
6796 | |||
6797 | /** | ||
6798 | * Static poolers. Several custom versions for each potential number of | ||
6799 | * arguments. A completely generic pooler is easy to implement, but would | ||
6800 | * require accessing the `arguments` object. In each of these, `this` refers to | ||
6801 | * the Class itself, not an instance. If any others are needed, simply add them | ||
6802 | * here, or in their own files. | ||
6803 | */ | ||
6804 | var oneArgumentPooler = function (copyFieldsFrom) { | ||
6805 | var Klass = this; | ||
6806 | if (Klass.instancePool.length) { | ||
6807 | var instance = Klass.instancePool.pop(); | ||
6808 | Klass.call(instance, copyFieldsFrom); | ||
6809 | return instance; | ||
6810 | } else { | ||
6811 | return new Klass(copyFieldsFrom); | ||
6812 | } | ||
6813 | }; | ||
6814 | |||
6815 | var twoArgumentPooler = function (a1, a2) { | ||
6816 | var Klass = this; | ||
6817 | if (Klass.instancePool.length) { | ||
6818 | var instance = Klass.instancePool.pop(); | ||
6819 | Klass.call(instance, a1, a2); | ||
6820 | return instance; | ||
6821 | } else { | ||
6822 | return new Klass(a1, a2); | ||
6823 | } | ||
6824 | }; | ||
6825 | |||
6826 | var threeArgumentPooler = function (a1, a2, a3) { | ||
6827 | var Klass = this; | ||
6828 | if (Klass.instancePool.length) { | ||
6829 | var instance = Klass.instancePool.pop(); | ||
6830 | Klass.call(instance, a1, a2, a3); | ||
6831 | return instance; | ||
6832 | } else { | ||
6833 | return new Klass(a1, a2, a3); | ||
6834 | } | ||
6835 | }; | ||
6836 | |||
6837 | var fourArgumentPooler = function (a1, a2, a3, a4) { | ||
6838 | var Klass = this; | ||
6839 | if (Klass.instancePool.length) { | ||
6840 | var instance = Klass.instancePool.pop(); | ||
6841 | Klass.call(instance, a1, a2, a3, a4); | ||
6842 | return instance; | ||
6843 | } else { | ||
6844 | return new Klass(a1, a2, a3, a4); | ||
6845 | } | ||
6846 | }; | ||
6847 | |||
6848 | var standardReleaser = function (instance) { | ||
6849 | var Klass = this; | ||
6850 | !(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; | ||
6851 | instance.destructor(); | ||
6852 | if (Klass.instancePool.length < Klass.poolSize) { | ||
6853 | Klass.instancePool.push(instance); | ||
6854 | } | ||
6855 | }; | ||
6856 | |||
6857 | var DEFAULT_POOL_SIZE = 10; | ||
6858 | var DEFAULT_POOLER = oneArgumentPooler; | ||
6859 | |||
6860 | /** | ||
6861 | * Augments `CopyConstructor` to be a poolable class, augmenting only the class | ||
6862 | * itself (statically) not adding any prototypical fields. Any CopyConstructor | ||
6863 | * you give this may have a `poolSize` property, and will look for a | ||
6864 | * prototypical `destructor` on instances. | ||
6865 | * | ||
6866 | * @param {Function} CopyConstructor Constructor that can be used to reset. | ||
6867 | * @param {Function} pooler Customizable pooler. | ||
6868 | */ | ||
6869 | var addPoolingTo = function (CopyConstructor, pooler) { | ||
6870 | // Casting as any so that flow ignores the actual implementation and trusts | ||
6871 | // it to match the type we declared | ||
6872 | var NewKlass = CopyConstructor; | ||
6873 | NewKlass.instancePool = []; | ||
6874 | NewKlass.getPooled = pooler || DEFAULT_POOLER; | ||
6875 | if (!NewKlass.poolSize) { | ||
6876 | NewKlass.poolSize = DEFAULT_POOL_SIZE; | ||
6877 | } | ||
6878 | NewKlass.release = standardReleaser; | ||
6879 | return NewKlass; | ||
6880 | }; | ||
6881 | |||
6882 | var PooledClass = { | ||
6883 | addPoolingTo: addPoolingTo, | ||
6884 | oneArgumentPooler: oneArgumentPooler, | ||
6885 | twoArgumentPooler: twoArgumentPooler, | ||
6886 | threeArgumentPooler: threeArgumentPooler, | ||
6887 | fourArgumentPooler: fourArgumentPooler | ||
6888 | }; | ||
6889 | |||
6890 | module.exports = PooledClass; | ||
6891 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
6892 | |||
6893 | /***/ }), | ||
6894 | /* 31 */ | ||
6895 | /***/ (function(module, exports, __webpack_require__) { | ||
6896 | |||
6897 | "use strict"; | ||
6898 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6899 | * Copyright 2014-present, Facebook, Inc. | ||
6900 | * All rights reserved. | ||
6901 | * | ||
6902 | * This source code is licensed under the BSD-style license found in the | ||
6903 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6904 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6905 | * | ||
6906 | */ | ||
6907 | |||
6908 | |||
6909 | |||
6910 | var _assign = __webpack_require__(4); | ||
6911 | |||
6912 | var ReactCurrentOwner = __webpack_require__(17); | ||
6913 | |||
6914 | var warning = __webpack_require__(2); | ||
6915 | var canDefineProperty = __webpack_require__(59); | ||
6916 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
6917 | |||
6918 | var REACT_ELEMENT_TYPE = __webpack_require__(139); | ||
6919 | |||
6920 | var RESERVED_PROPS = { | ||
6921 | key: true, | ||
6922 | ref: true, | ||
6923 | __self: true, | ||
6924 | __source: true | ||
6925 | }; | ||
6926 | |||
6927 | var specialPropKeyWarningShown, specialPropRefWarningShown; | ||
6928 | |||
6929 | function hasValidRef(config) { | ||
6930 | if (process.env.NODE_ENV !== 'production') { | ||
6931 | if (hasOwnProperty.call(config, 'ref')) { | ||
6932 | var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; | ||
6933 | if (getter && getter.isReactWarning) { | ||
6934 | return false; | ||
6935 | } | ||
6936 | } | ||
6937 | } | ||
6938 | return config.ref !== undefined; | ||
6939 | } | ||
6940 | |||
6941 | function hasValidKey(config) { | ||
6942 | if (process.env.NODE_ENV !== 'production') { | ||
6943 | if (hasOwnProperty.call(config, 'key')) { | ||
6944 | var getter = Object.getOwnPropertyDescriptor(config, 'key').get; | ||
6945 | if (getter && getter.isReactWarning) { | ||
6946 | return false; | ||
6947 | } | ||
6948 | } | ||
6949 | } | ||
6950 | return config.key !== undefined; | ||
6951 | } | ||
6952 | |||
6953 | function defineKeyPropWarningGetter(props, displayName) { | ||
6954 | var warnAboutAccessingKey = function () { | ||
6955 | if (!specialPropKeyWarningShown) { | ||
6956 | specialPropKeyWarningShown = true; | ||
6957 | 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; | ||
6958 | } | ||
6959 | }; | ||
6960 | warnAboutAccessingKey.isReactWarning = true; | ||
6961 | Object.defineProperty(props, 'key', { | ||
6962 | get: warnAboutAccessingKey, | ||
6963 | configurable: true | ||
6964 | }); | ||
6965 | } | ||
6966 | |||
6967 | function defineRefPropWarningGetter(props, displayName) { | ||
6968 | var warnAboutAccessingRef = function () { | ||
6969 | if (!specialPropRefWarningShown) { | ||
6970 | specialPropRefWarningShown = true; | ||
6971 | 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; | ||
6972 | } | ||
6973 | }; | ||
6974 | warnAboutAccessingRef.isReactWarning = true; | ||
6975 | Object.defineProperty(props, 'ref', { | ||
6976 | get: warnAboutAccessingRef, | ||
6977 | configurable: true | ||
6978 | }); | ||
6979 | } | ||
6980 | |||
6981 | /** | ||
6982 | * Factory method to create a new React element. This no longer adheres to | ||
6983 | * the class pattern, so do not use new to call it. Also, no instanceof check | ||
6984 | * will work. Instead test $$typeof field against Symbol.for('react.element') to check | ||
6985 | * if something is a React Element. | ||
6986 | * | ||
6987 | * @param {*} type | ||
6988 | * @param {*} key | ||
6989 | * @param {string|object} ref | ||
6990 | * @param {*} self A *temporary* helper to detect places where `this` is | ||
6991 | * different from the `owner` when React.createElement is called, so that we | ||
6992 | * can warn. We want to get rid of owner and replace string `ref`s with arrow | ||
6993 | * functions, and as long as `this` and owner are the same, there will be no | ||
6994 | * change in behavior. | ||
6995 | * @param {*} source An annotation object (added by a transpiler or otherwise) | ||
6996 | * indicating filename, line number, and/or other information. | ||
6997 | * @param {*} owner | ||
6998 | * @param {*} props | ||
6999 | * @internal | ||
7000 | */ | ||
7001 | var ReactElement = function (type, key, ref, self, source, owner, props) { | ||
7002 | var element = { | ||
7003 | // This tag allow us to uniquely identify this as a React Element | ||
7004 | $$typeof: REACT_ELEMENT_TYPE, | ||
7005 | |||
7006 | // Built-in properties that belong on the element | ||
7007 | type: type, | ||
7008 | key: key, | ||
7009 | ref: ref, | ||
7010 | props: props, | ||
7011 | |||
7012 | // Record the component responsible for creating this element. | ||
7013 | _owner: owner | ||
7014 | }; | ||
7015 | |||
7016 | if (process.env.NODE_ENV !== 'production') { | ||
7017 | // The validation flag is currently mutative. We put it on | ||
7018 | // an external backing store so that we can freeze the whole object. | ||
7019 | // This can be replaced with a WeakMap once they are implemented in | ||
7020 | // commonly used development environments. | ||
7021 | element._store = {}; | ||
7022 | |||
7023 | // To make comparing ReactElements easier for testing purposes, we make | ||
7024 | // the validation flag non-enumerable (where possible, which should | ||
7025 | // include every environment we run tests in), so the test framework | ||
7026 | // ignores it. | ||
7027 | if (canDefineProperty) { | ||
7028 | Object.defineProperty(element._store, 'validated', { | ||
7029 | configurable: false, | ||
7030 | enumerable: false, | ||
7031 | writable: true, | ||
7032 | value: false | ||
7033 | }); | ||
7034 | // self and source are DEV only properties. | ||
7035 | Object.defineProperty(element, '_self', { | ||
7036 | configurable: false, | ||
7037 | enumerable: false, | ||
7038 | writable: false, | ||
7039 | value: self | ||
7040 | }); | ||
7041 | // Two elements created in two different places should be considered | ||
7042 | // equal for testing purposes and therefore we hide it from enumeration. | ||
7043 | Object.defineProperty(element, '_source', { | ||
7044 | configurable: false, | ||
7045 | enumerable: false, | ||
7046 | writable: false, | ||
7047 | value: source | ||
7048 | }); | ||
7049 | } else { | ||
7050 | element._store.validated = false; | ||
7051 | element._self = self; | ||
7052 | element._source = source; | ||
7053 | } | ||
7054 | if (Object.freeze) { | ||
7055 | Object.freeze(element.props); | ||
7056 | Object.freeze(element); | ||
7057 | } | ||
7058 | } | ||
7059 | |||
7060 | return element; | ||
7061 | }; | ||
7062 | |||
7063 | /** | ||
7064 | * Create and return a new ReactElement of the given type. | ||
7065 | * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement | ||
7066 | */ | ||
7067 | ReactElement.createElement = function (type, config, children) { | ||
7068 | var propName; | ||
7069 | |||
7070 | // Reserved names are extracted | ||
7071 | var props = {}; | ||
7072 | |||
7073 | var key = null; | ||
7074 | var ref = null; | ||
7075 | var self = null; | ||
7076 | var source = null; | ||
7077 | |||
7078 | if (config != null) { | ||
7079 | if (hasValidRef(config)) { | ||
7080 | ref = config.ref; | ||
7081 | } | ||
7082 | if (hasValidKey(config)) { | ||
7083 | key = '' + config.key; | ||
7084 | } | ||
7085 | |||
7086 | self = config.__self === undefined ? null : config.__self; | ||
7087 | source = config.__source === undefined ? null : config.__source; | ||
7088 | // Remaining properties are added to a new props object | ||
7089 | for (propName in config) { | ||
7090 | if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | ||
7091 | props[propName] = config[propName]; | ||
7092 | } | ||
7093 | } | ||
7094 | } | ||
7095 | |||
7096 | // Children can be more than one argument, and those are transferred onto | ||
7097 | // the newly allocated props object. | ||
7098 | var childrenLength = arguments.length - 2; | ||
7099 | if (childrenLength === 1) { | ||
7100 | props.children = children; | ||
7101 | } else if (childrenLength > 1) { | ||
7102 | var childArray = Array(childrenLength); | ||
7103 | for (var i = 0; i < childrenLength; i++) { | ||
7104 | childArray[i] = arguments[i + 2]; | ||
7105 | } | ||
7106 | if (process.env.NODE_ENV !== 'production') { | ||
7107 | if (Object.freeze) { | ||
7108 | Object.freeze(childArray); | ||
7109 | } | ||
7110 | } | ||
7111 | props.children = childArray; | ||
7112 | } | ||
7113 | |||
7114 | // Resolve default props | ||
7115 | if (type && type.defaultProps) { | ||
7116 | var defaultProps = type.defaultProps; | ||
7117 | for (propName in defaultProps) { | ||
7118 | if (props[propName] === undefined) { | ||
7119 | props[propName] = defaultProps[propName]; | ||
7120 | } | ||
7121 | } | ||
7122 | } | ||
7123 | if (process.env.NODE_ENV !== 'production') { | ||
7124 | if (key || ref) { | ||
7125 | if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { | ||
7126 | var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; | ||
7127 | if (key) { | ||
7128 | defineKeyPropWarningGetter(props, displayName); | ||
7129 | } | ||
7130 | if (ref) { | ||
7131 | defineRefPropWarningGetter(props, displayName); | ||
7132 | } | ||
7133 | } | ||
7134 | } | ||
7135 | } | ||
7136 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); | ||
7137 | }; | ||
7138 | |||
7139 | /** | ||
7140 | * Return a function that produces ReactElements of a given type. | ||
7141 | * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory | ||
7142 | */ | ||
7143 | ReactElement.createFactory = function (type) { | ||
7144 | var factory = ReactElement.createElement.bind(null, type); | ||
7145 | // Expose the type on the factory and the prototype so that it can be | ||
7146 | // easily accessed on elements. E.g. `<Foo />.type === Foo`. | ||
7147 | // This should not be named `constructor` since this may not be the function | ||
7148 | // that created the element, and it may not even be a constructor. | ||
7149 | // Legacy hook TODO: Warn if this is accessed | ||
7150 | factory.type = type; | ||
7151 | return factory; | ||
7152 | }; | ||
7153 | |||
7154 | ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { | ||
7155 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); | ||
7156 | |||
7157 | return newElement; | ||
7158 | }; | ||
7159 | |||
7160 | /** | ||
7161 | * Clone and return a new ReactElement using element as the starting point. | ||
7162 | * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement | ||
7163 | */ | ||
7164 | ReactElement.cloneElement = function (element, config, children) { | ||
7165 | var propName; | ||
7166 | |||
7167 | // Original props are copied | ||
7168 | var props = _assign({}, element.props); | ||
7169 | |||
7170 | // Reserved names are extracted | ||
7171 | var key = element.key; | ||
7172 | var ref = element.ref; | ||
7173 | // Self is preserved since the owner is preserved. | ||
7174 | var self = element._self; | ||
7175 | // Source is preserved since cloneElement is unlikely to be targeted by a | ||
7176 | // transpiler, and the original source is probably a better indicator of the | ||
7177 | // true owner. | ||
7178 | var source = element._source; | ||
7179 | |||
7180 | // Owner will be preserved, unless ref is overridden | ||
7181 | var owner = element._owner; | ||
7182 | |||
7183 | if (config != null) { | ||
7184 | if (hasValidRef(config)) { | ||
7185 | // Silently steal the ref from the parent. | ||
7186 | ref = config.ref; | ||
7187 | owner = ReactCurrentOwner.current; | ||
7188 | } | ||
7189 | if (hasValidKey(config)) { | ||
7190 | key = '' + config.key; | ||
7191 | } | ||
7192 | |||
7193 | // Remaining properties override existing props | ||
7194 | var defaultProps; | ||
7195 | if (element.type && element.type.defaultProps) { | ||
7196 | defaultProps = element.type.defaultProps; | ||
7197 | } | ||
7198 | for (propName in config) { | ||
7199 | if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | ||
7200 | if (config[propName] === undefined && defaultProps !== undefined) { | ||
7201 | // Resolve default props | ||
7202 | props[propName] = defaultProps[propName]; | ||
7203 | } else { | ||
7204 | props[propName] = config[propName]; | ||
7205 | } | ||
7206 | } | ||
7207 | } | ||
7208 | } | ||
7209 | |||
7210 | // Children can be more than one argument, and those are transferred onto | ||
7211 | // the newly allocated props object. | ||
7212 | var childrenLength = arguments.length - 2; | ||
7213 | if (childrenLength === 1) { | ||
7214 | props.children = children; | ||
7215 | } else if (childrenLength > 1) { | ||
7216 | var childArray = Array(childrenLength); | ||
7217 | for (var i = 0; i < childrenLength; i++) { | ||
7218 | childArray[i] = arguments[i + 2]; | ||
7219 | } | ||
7220 | props.children = childArray; | ||
7221 | } | ||
7222 | |||
7223 | return ReactElement(element.type, key, ref, self, source, owner, props); | ||
7224 | }; | ||
7225 | |||
7226 | /** | ||
7227 | * Verifies the object is a ReactElement. | ||
7228 | * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement | ||
7229 | * @param {?object} object | ||
7230 | * @return {boolean} True if `object` is a valid component. | ||
7231 | * @final | ||
7232 | */ | ||
7233 | ReactElement.isValidElement = function (object) { | ||
7234 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | ||
7235 | }; | ||
7236 | |||
7237 | module.exports = ReactElement; | ||
7238 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
7239 | |||
7240 | /***/ }), | ||
7241 | /* 32 */ | ||
7242 | /***/ (function(module, exports, __webpack_require__) { | ||
7243 | |||
7244 | "use strict"; | ||
7245 | /** | ||
7246 | * Copyright (c) 2013-present, Facebook, Inc. | ||
7247 | * All rights reserved. | ||
7248 | * | ||
7249 | * This source code is licensed under the BSD-style license found in the | ||
7250 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7251 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7252 | * | ||
7253 | * | ||
7254 | */ | ||
7255 | |||
7256 | |||
7257 | /** | ||
7258 | * WARNING: DO NOT manually require this module. | ||
7259 | * This is a replacement for `invariant(...)` used by the error code system | ||
7260 | * and will _only_ be required by the corresponding babel pass. | ||
7261 | * It always throws. | ||
7262 | */ | ||
7263 | |||
7264 | function reactProdInvariant(code) { | ||
7265 | var argCount = arguments.length - 1; | ||
7266 | |||
7267 | var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; | ||
7268 | |||
7269 | for (var argIdx = 0; argIdx < argCount; argIdx++) { | ||
7270 | message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); | ||
7271 | } | ||
7272 | |||
7273 | message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; | ||
7274 | |||
7275 | var error = new Error(message); | ||
7276 | error.name = 'Invariant Violation'; | ||
7277 | error.framesToPop = 1; // we don't care about reactProdInvariant's own frame | ||
7278 | |||
7279 | throw error; | ||
7280 | } | ||
7281 | |||
7282 | module.exports = reactProdInvariant; | ||
7283 | |||
7284 | /***/ }), | ||
7285 | /* 33 */ | ||
7286 | /***/ (function(module, exports, __webpack_require__) { | ||
7287 | |||
7288 | var global = __webpack_require__(20) | ||
7289 | , core = __webpack_require__(24) | ||
7290 | , ctx = __webpack_require__(98) | ||
7291 | , hide = __webpack_require__(34) | ||
7292 | , PROTOTYPE = 'prototype'; | ||
7293 | |||
7294 | var $export = function(type, name, source){ | ||
7295 | var IS_FORCED = type & $export.F | ||
7296 | , IS_GLOBAL = type & $export.G | ||
7297 | , IS_STATIC = type & $export.S | ||
7298 | , IS_PROTO = type & $export.P | ||
7299 | , IS_BIND = type & $export.B | ||
7300 | , IS_WRAP = type & $export.W | ||
7301 | , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) | ||
7302 | , expProto = exports[PROTOTYPE] | ||
7303 | , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] | ||
7304 | , key, own, out; | ||
7305 | if(IS_GLOBAL)source = name; | ||
7306 | for(key in source){ | ||
7307 | // contains in native | ||
7308 | own = !IS_FORCED && target && target[key] !== undefined; | ||
7309 | if(own && key in exports)continue; | ||
7310 | // export native or passed | ||
7311 | out = own ? target[key] : source[key]; | ||
7312 | // prevent global pollution for namespaces | ||
7313 | exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] | ||
7314 | // bind timers to global for call from export context | ||
7315 | : IS_BIND && own ? ctx(out, global) | ||
7316 | // wrap global constructors for prevent change them in library | ||
7317 | : IS_WRAP && target[key] == out ? (function(C){ | ||
7318 | var F = function(a, b, c){ | ||
7319 | if(this instanceof C){ | ||
7320 | switch(arguments.length){ | ||
7321 | case 0: return new C; | ||
7322 | case 1: return new C(a); | ||
7323 | case 2: return new C(a, b); | ||
7324 | } return new C(a, b, c); | ||
7325 | } return C.apply(this, arguments); | ||
7326 | }; | ||
7327 | F[PROTOTYPE] = C[PROTOTYPE]; | ||
7328 | return F; | ||
7329 | // make static versions for prototype methods | ||
7330 | })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; | ||
7331 | // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% | ||
7332 | if(IS_PROTO){ | ||
7333 | (exports.virtual || (exports.virtual = {}))[key] = out; | ||
7334 | // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% | ||
7335 | if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out); | ||
7336 | } | ||
7337 | } | ||
7338 | }; | ||
7339 | // type bitmap | ||
7340 | $export.F = 1; // forced | ||
7341 | $export.G = 2; // global | ||
7342 | $export.S = 4; // static | ||
7343 | $export.P = 8; // proto | ||
7344 | $export.B = 16; // bind | ||
7345 | $export.W = 32; // wrap | ||
7346 | $export.U = 64; // safe | ||
7347 | $export.R = 128; // real proto method for `library` | ||
7348 | module.exports = $export; | ||
7349 | |||
7350 | /***/ }), | ||
7351 | /* 34 */ | ||
7352 | /***/ (function(module, exports, __webpack_require__) { | ||
7353 | |||
7354 | var dP = __webpack_require__(27) | ||
7355 | , createDesc = __webpack_require__(51); | ||
7356 | module.exports = __webpack_require__(25) ? function(object, key, value){ | ||
7357 | return dP.f(object, key, createDesc(1, value)); | ||
7358 | } : function(object, key, value){ | ||
7359 | object[key] = value; | ||
7360 | return object; | ||
7361 | }; | ||
7362 | |||
7363 | /***/ }), | ||
7364 | /* 35 */ | ||
7365 | /***/ (function(module, exports, __webpack_require__) { | ||
7366 | |||
7367 | var store = __webpack_require__(68)('wks') | ||
7368 | , uid = __webpack_require__(52) | ||
7369 | , Symbol = __webpack_require__(20).Symbol | ||
7370 | , USE_SYMBOL = typeof Symbol == 'function'; | ||
7371 | |||
7372 | var $exports = module.exports = function(name){ | ||
7373 | return store[name] || (store[name] = | ||
7374 | USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); | ||
7375 | }; | ||
7376 | |||
7377 | $exports.store = store; | ||
7378 | |||
7379 | /***/ }), | ||
7380 | /* 36 */ | ||
7381 | /***/ (function(module, exports, __webpack_require__) { | ||
7382 | |||
7383 | "use strict"; | ||
7384 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
7385 | * Copyright (c) 2013-present, Facebook, Inc. | ||
7386 | * All rights reserved. | ||
7387 | * | ||
7388 | * This source code is licensed under the BSD-style license found in the | ||
7389 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7390 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7391 | * | ||
7392 | */ | ||
7393 | |||
7394 | |||
7395 | |||
7396 | var emptyObject = {}; | ||
7397 | |||
7398 | if (process.env.NODE_ENV !== 'production') { | ||
7399 | Object.freeze(emptyObject); | ||
7400 | } | ||
7401 | |||
7402 | module.exports = emptyObject; | ||
7403 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
7404 | |||
7405 | /***/ }), | ||
7406 | /* 37 */ | ||
7407 | /***/ (function(module, exports, __webpack_require__) { | ||
7408 | |||
7409 | "use strict"; | ||
7410 | /** | ||
7411 | * Copyright 2015-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 | |||
7421 | |||
7422 | var DOMNamespaces = __webpack_require__(76); | ||
7423 | var setInnerHTML = __webpack_require__(58); | ||
7424 | |||
7425 | var createMicrosoftUnsafeLocalFunction = __webpack_require__(83); | ||
7426 | var setTextContent = __webpack_require__(137); | ||
7427 | |||
7428 | var ELEMENT_NODE_TYPE = 1; | ||
7429 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11; | ||
7430 | |||
7431 | /** | ||
7432 | * In IE (8-11) and Edge, appending nodes with no children is dramatically | ||
7433 | * faster than appending a full subtree, so we essentially queue up the | ||
7434 | * .appendChild calls here and apply them so each node is added to its parent | ||
7435 | * before any children are added. | ||
7436 | * | ||
7437 | * In other browsers, doing so is slower or neutral compared to the other order | ||
7438 | * (in Firefox, twice as slow) so we only do this inversion in IE. | ||
7439 | * | ||
7440 | * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode. | ||
7441 | */ | ||
7442 | var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent); | ||
7443 | |||
7444 | function insertTreeChildren(tree) { | ||
7445 | if (!enableLazy) { | ||
7446 | return; | ||
7447 | } | ||
7448 | var node = tree.node; | ||
7449 | var children = tree.children; | ||
7450 | if (children.length) { | ||
7451 | for (var i = 0; i < children.length; i++) { | ||
7452 | insertTreeBefore(node, children[i], null); | ||
7453 | } | ||
7454 | } else if (tree.html != null) { | ||
7455 | setInnerHTML(node, tree.html); | ||
7456 | } else if (tree.text != null) { | ||
7457 | setTextContent(node, tree.text); | ||
7458 | } | ||
7459 | } | ||
7460 | |||
7461 | var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) { | ||
7462 | // DocumentFragments aren't actually part of the DOM after insertion so | ||
7463 | // appending children won't update the DOM. We need to ensure the fragment | ||
7464 | // is properly populated first, breaking out of our lazy approach for just | ||
7465 | // this level. Also, some <object> plugins (like Flash Player) will read | ||
7466 | // <param> nodes immediately upon insertion into the DOM, so <object> | ||
7467 | // must also be populated prior to insertion into the DOM. | ||
7468 | 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)) { | ||
7469 | insertTreeChildren(tree); | ||
7470 | parentNode.insertBefore(tree.node, referenceNode); | ||
7471 | } else { | ||
7472 | parentNode.insertBefore(tree.node, referenceNode); | ||
7473 | insertTreeChildren(tree); | ||
7474 | } | ||
7475 | }); | ||
7476 | |||
7477 | function replaceChildWithTree(oldNode, newTree) { | ||
7478 | oldNode.parentNode.replaceChild(newTree.node, oldNode); | ||
7479 | insertTreeChildren(newTree); | ||
7480 | } | ||
7481 | |||
7482 | function queueChild(parentTree, childTree) { | ||
7483 | if (enableLazy) { | ||
7484 | parentTree.children.push(childTree); | ||
7485 | } else { | ||
7486 | parentTree.node.appendChild(childTree.node); | ||
7487 | } | ||
7488 | } | ||
7489 | |||
7490 | function queueHTML(tree, html) { | ||
7491 | if (enableLazy) { | ||
7492 | tree.html = html; | ||
7493 | } else { | ||
7494 | setInnerHTML(tree.node, html); | ||
7495 | } | ||
7496 | } | ||
7497 | |||
7498 | function queueText(tree, text) { | ||
7499 | if (enableLazy) { | ||
7500 | tree.text = text; | ||
7501 | } else { | ||
7502 | setTextContent(tree.node, text); | ||
7503 | } | ||
7504 | } | ||
7505 | |||
7506 | function toString() { | ||
7507 | return this.node.nodeName; | ||
7508 | } | ||
7509 | |||
7510 | function DOMLazyTree(node) { | ||
7511 | return { | ||
7512 | node: node, | ||
7513 | children: [], | ||
7514 | html: null, | ||
7515 | text: null, | ||
7516 | toString: toString | ||
7517 | }; | ||
7518 | } | ||
7519 | |||
7520 | DOMLazyTree.insertTreeBefore = insertTreeBefore; | ||
7521 | DOMLazyTree.replaceChildWithTree = replaceChildWithTree; | ||
7522 | DOMLazyTree.queueChild = queueChild; | ||
7523 | DOMLazyTree.queueHTML = queueHTML; | ||
7524 | DOMLazyTree.queueText = queueText; | ||
7525 | |||
7526 | module.exports = DOMLazyTree; | ||
7527 | |||
7528 | /***/ }), | ||
7529 | /* 38 */ | ||
7530 | /***/ (function(module, exports, __webpack_require__) { | ||
7531 | |||
7532 | "use strict"; | ||
7533 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
7534 | * Copyright 2013-present, Facebook, Inc. | ||
7535 | * All rights reserved. | ||
7536 | * | ||
7537 | * This source code is licensed under the BSD-style license found in the | ||
7538 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7539 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7540 | * | ||
7541 | */ | ||
7542 | |||
7543 | |||
7544 | |||
7545 | var ReactRef = __webpack_require__(284); | ||
7546 | var ReactInstrumentation = __webpack_require__(12); | ||
7547 | |||
7548 | var warning = __webpack_require__(2); | ||
7549 | |||
7550 | /** | ||
7551 | * Helper to call ReactRef.attachRefs with this composite component, split out | ||
7552 | * to avoid allocations in the transaction mount-ready queue. | ||
7553 | */ | ||
7554 | function attachRefs() { | ||
7555 | ReactRef.attachRefs(this, this._currentElement); | ||
7556 | } | ||
7557 | |||
7558 | var ReactReconciler = { | ||
7559 | |||
7560 | /** | ||
7561 | * Initializes the component, renders markup, and registers event listeners. | ||
7562 | * | ||
7563 | * @param {ReactComponent} internalInstance | ||
7564 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
7565 | * @param {?object} the containing host component instance | ||
7566 | * @param {?object} info about the host container | ||
7567 | * @return {?string} Rendered markup to be inserted into the DOM. | ||
7568 | * @final | ||
7569 | * @internal | ||
7570 | */ | ||
7571 | mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots | ||
7572 | ) { | ||
7573 | if (process.env.NODE_ENV !== 'production') { | ||
7574 | if (internalInstance._debugID !== 0) { | ||
7575 | ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID); | ||
7576 | } | ||
7577 | } | ||
7578 | var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID); | ||
7579 | if (internalInstance._currentElement && internalInstance._currentElement.ref != null) { | ||
7580 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance); | ||
7581 | } | ||
7582 | if (process.env.NODE_ENV !== 'production') { | ||
7583 | if (internalInstance._debugID !== 0) { | ||
7584 | ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID); | ||
7585 | } | ||
7586 | } | ||
7587 | return markup; | ||
7588 | }, | ||
7589 | |||
7590 | /** | ||
7591 | * Returns a value that can be passed to | ||
7592 | * ReactComponentEnvironment.replaceNodeWithMarkup. | ||
7593 | */ | ||
7594 | getHostNode: function (internalInstance) { | ||
7595 | return internalInstance.getHostNode(); | ||
7596 | }, | ||
7597 | |||
7598 | /** | ||
7599 | * Releases any resources allocated by `mountComponent`. | ||
7600 | * | ||
7601 | * @final | ||
7602 | * @internal | ||
7603 | */ | ||
7604 | unmountComponent: function (internalInstance, safely) { | ||
7605 | if (process.env.NODE_ENV !== 'production') { | ||
7606 | if (internalInstance._debugID !== 0) { | ||
7607 | ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID); | ||
7608 | } | ||
7609 | } | ||
7610 | ReactRef.detachRefs(internalInstance, internalInstance._currentElement); | ||
7611 | internalInstance.unmountComponent(safely); | ||
7612 | if (process.env.NODE_ENV !== 'production') { | ||
7613 | if (internalInstance._debugID !== 0) { | ||
7614 | ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID); | ||
7615 | } | ||
7616 | } | ||
7617 | }, | ||
7618 | |||
7619 | /** | ||
7620 | * Update a component using a new element. | ||
7621 | * | ||
7622 | * @param {ReactComponent} internalInstance | ||
7623 | * @param {ReactElement} nextElement | ||
7624 | * @param {ReactReconcileTransaction} transaction | ||
7625 | * @param {object} context | ||
7626 | * @internal | ||
7627 | */ | ||
7628 | receiveComponent: function (internalInstance, nextElement, transaction, context) { | ||
7629 | var prevElement = internalInstance._currentElement; | ||
7630 | |||
7631 | if (nextElement === prevElement && context === internalInstance._context) { | ||
7632 | // Since elements are immutable after the owner is rendered, | ||
7633 | // we can do a cheap identity compare here to determine if this is a | ||
7634 | // superfluous reconcile. It's possible for state to be mutable but such | ||
7635 | // change should trigger an update of the owner which would recreate | ||
7636 | // the element. We explicitly check for the existence of an owner since | ||
7637 | // it's possible for an element created outside a composite to be | ||
7638 | // deeply mutated and reused. | ||
7639 | |||
7640 | // TODO: Bailing out early is just a perf optimization right? | ||
7641 | // TODO: Removing the return statement should affect correctness? | ||
7642 | return; | ||
7643 | } | ||
7644 | |||
7645 | if (process.env.NODE_ENV !== 'production') { | ||
7646 | if (internalInstance._debugID !== 0) { | ||
7647 | ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement); | ||
7648 | } | ||
7649 | } | ||
7650 | |||
7651 | var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement); | ||
7652 | |||
7653 | if (refsChanged) { | ||
7654 | ReactRef.detachRefs(internalInstance, prevElement); | ||
7655 | } | ||
7656 | |||
7657 | internalInstance.receiveComponent(nextElement, transaction, context); | ||
7658 | |||
7659 | if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) { | ||
7660 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance); | ||
7661 | } | ||
7662 | |||
7663 | if (process.env.NODE_ENV !== 'production') { | ||
7664 | if (internalInstance._debugID !== 0) { | ||
7665 | ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); | ||
7666 | } | ||
7667 | } | ||
7668 | }, | ||
7669 | |||
7670 | /** | ||
7671 | * Flush any dirty changes in a component. | ||
7672 | * | ||
7673 | * @param {ReactComponent} internalInstance | ||
7674 | * @param {ReactReconcileTransaction} transaction | ||
7675 | * @internal | ||
7676 | */ | ||
7677 | performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) { | ||
7678 | if (internalInstance._updateBatchNumber !== updateBatchNumber) { | ||
7679 | // The component's enqueued batch number should always be the current | ||
7680 | // batch or the following one. | ||
7681 | 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; | ||
7682 | return; | ||
7683 | } | ||
7684 | if (process.env.NODE_ENV !== 'production') { | ||
7685 | if (internalInstance._debugID !== 0) { | ||
7686 | ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement); | ||
7687 | } | ||
7688 | } | ||
7689 | internalInstance.performUpdateIfNecessary(transaction); | ||
7690 | if (process.env.NODE_ENV !== 'production') { | ||
7691 | if (internalInstance._debugID !== 0) { | ||
7692 | ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); | ||
7693 | } | ||
7694 | } | ||
7695 | } | ||
7696 | |||
7697 | }; | ||
7698 | |||
7699 | module.exports = ReactReconciler; | ||
7700 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
7701 | |||
7702 | /***/ }), | ||
7703 | /* 39 */ | ||
7704 | /***/ (function(module, exports, __webpack_require__) { | ||
7705 | |||
7706 | "use strict"; | ||
7707 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
7708 | * Copyright 2013-present, Facebook, Inc. | ||
7709 | * All rights reserved. | ||
7710 | * | ||
7711 | * This source code is licensed under the BSD-style license found in the | ||
7712 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7713 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7714 | * | ||
7715 | */ | ||
7716 | |||
7717 | |||
7718 | |||
7719 | var _assign = __webpack_require__(4); | ||
7720 | |||
7721 | var ReactChildren = __webpack_require__(314); | ||
7722 | var ReactComponent = __webpack_require__(90); | ||
7723 | var ReactPureComponent = __webpack_require__(319); | ||
7724 | var ReactClass = __webpack_require__(315); | ||
7725 | var ReactDOMFactories = __webpack_require__(316); | ||
7726 | var ReactElement = __webpack_require__(31); | ||
7727 | var ReactPropTypes = __webpack_require__(317); | ||
7728 | var ReactVersion = __webpack_require__(320); | ||
7729 | |||
7730 | var onlyChild = __webpack_require__(323); | ||
7731 | var warning = __webpack_require__(2); | ||
7732 | |||
7733 | var createElement = ReactElement.createElement; | ||
7734 | var createFactory = ReactElement.createFactory; | ||
7735 | var cloneElement = ReactElement.cloneElement; | ||
7736 | |||
7737 | if (process.env.NODE_ENV !== 'production') { | ||
7738 | var canDefineProperty = __webpack_require__(59); | ||
7739 | var ReactElementValidator = __webpack_require__(140); | ||
7740 | var didWarnPropTypesDeprecated = false; | ||
7741 | createElement = ReactElementValidator.createElement; | ||
7742 | createFactory = ReactElementValidator.createFactory; | ||
7743 | cloneElement = ReactElementValidator.cloneElement; | ||
7744 | } | ||
7745 | |||
7746 | var __spread = _assign; | ||
7747 | |||
7748 | if (process.env.NODE_ENV !== 'production') { | ||
7749 | var warned = false; | ||
7750 | __spread = function () { | ||
7751 | 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; | ||
7752 | warned = true; | ||
7753 | return _assign.apply(null, arguments); | ||
7754 | }; | ||
7755 | } | ||
7756 | |||
7757 | var React = { | ||
7758 | |||
7759 | // Modern | ||
7760 | |||
7761 | Children: { | ||
7762 | map: ReactChildren.map, | ||
7763 | forEach: ReactChildren.forEach, | ||
7764 | count: ReactChildren.count, | ||
7765 | toArray: ReactChildren.toArray, | ||
7766 | only: onlyChild | ||
7767 | }, | ||
7768 | |||
7769 | Component: ReactComponent, | ||
7770 | PureComponent: ReactPureComponent, | ||
7771 | |||
7772 | createElement: createElement, | ||
7773 | cloneElement: cloneElement, | ||
7774 | isValidElement: ReactElement.isValidElement, | ||
7775 | |||
7776 | // Classic | ||
7777 | |||
7778 | PropTypes: ReactPropTypes, | ||
7779 | createClass: ReactClass.createClass, | ||
7780 | createFactory: createFactory, | ||
7781 | createMixin: function (mixin) { | ||
7782 | // Currently a noop. Will be used to validate and trace mixins. | ||
7783 | return mixin; | ||
7784 | }, | ||
7785 | |||
7786 | // This looks DOM specific but these are actually isomorphic helpers | ||
7787 | // since they are just generating DOM strings. | ||
7788 | DOM: ReactDOMFactories, | ||
7789 | |||
7790 | version: ReactVersion, | ||
7791 | |||
7792 | // Deprecated hook for JSX spread, don't use this for anything. | ||
7793 | __spread: __spread | ||
7794 | }; | ||
7795 | |||
7796 | // TODO: Fix tests so that this deprecation warning doesn't cause failures. | ||
7797 | if (process.env.NODE_ENV !== 'production') { | ||
7798 | if (canDefineProperty) { | ||
7799 | Object.defineProperty(React, 'PropTypes', { | ||
7800 | get: function () { | ||
7801 | 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; | ||
7802 | didWarnPropTypesDeprecated = true; | ||
7803 | return ReactPropTypes; | ||
7804 | } | ||
7805 | }); | ||
7806 | } | ||
7807 | } | ||
7808 | |||
7809 | module.exports = React; | ||
7810 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
7811 | |||
7812 | /***/ }), | ||
7813 | /* 40 */ | ||
7814 | /***/ (function(module, exports, __webpack_require__) { | ||
7815 | |||
7816 | var isObject = __webpack_require__(42); | ||
7817 | module.exports = function(it){ | ||
7818 | if(!isObject(it))throw TypeError(it + ' is not an object!'); | ||
7819 | return it; | ||
7820 | }; | ||
7821 | |||
7822 | /***/ }), | ||
7823 | /* 41 */ | ||
7824 | /***/ (function(module, exports) { | ||
7825 | |||
7826 | module.exports = function(exec){ | ||
7827 | try { | ||
7828 | return !!exec(); | ||
7829 | } catch(e){ | ||
7830 | return true; | ||
7831 | } | ||
7832 | }; | ||
7833 | |||
7834 | /***/ }), | ||
7835 | /* 42 */ | ||
7836 | /***/ (function(module, exports) { | ||
7837 | |||
7838 | module.exports = function(it){ | ||
7839 | return typeof it === 'object' ? it !== null : typeof it === 'function'; | ||
7840 | }; | ||
7841 | |||
7842 | /***/ }), | ||
7843 | /* 43 */ | ||
7844 | /***/ (function(module, exports, __webpack_require__) { | ||
7845 | |||
7846 | // 19.1.2.14 / 15.2.3.14 Object.keys(O) | ||
7847 | var $keys = __webpack_require__(105) | ||
7848 | , enumBugKeys = __webpack_require__(61); | ||
7849 | |||
7850 | module.exports = Object.keys || function keys(O){ | ||
7851 | return $keys(O, enumBugKeys); | ||
7852 | }; | ||
7853 | |||
7854 | /***/ }), | ||
7855 | /* 44 */ | ||
7856 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
7857 | |||
7858 | "use strict"; | ||
7859 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__propertyUtils__ = __webpack_require__(211); | ||
7860 | 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; }; | ||
7861 | |||
7862 | |||
7863 | |||
7864 | var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; | ||
7865 | |||
7866 | var getComputedStyleX = void 0; | ||
7867 | |||
7868 | function force(x, y) { | ||
7869 | return x + y; | ||
7870 | } | ||
7871 | |||
7872 | function css(el, name, v) { | ||
7873 | var value = v; | ||
7874 | if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { | ||
7875 | for (var i in name) { | ||
7876 | if (name.hasOwnProperty(i)) { | ||
7877 | css(el, i, name[i]); | ||
7878 | } | ||
7879 | } | ||
7880 | return undefined; | ||
7881 | } | ||
7882 | if (typeof value !== 'undefined') { | ||
7883 | if (typeof value === 'number') { | ||
7884 | value = value + 'px'; | ||
7885 | } | ||
7886 | el.style[name] = value; | ||
7887 | return undefined; | ||
7888 | } | ||
7889 | return getComputedStyleX(el, name); | ||
7890 | } | ||
7891 | |||
7892 | function getClientPosition(elem) { | ||
7893 | var box = void 0; | ||
7894 | var x = void 0; | ||
7895 | var y = void 0; | ||
7896 | var doc = elem.ownerDocument; | ||
7897 | var body = doc.body; | ||
7898 | var docElem = doc && doc.documentElement; | ||
7899 | // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式 | ||
7900 | box = elem.getBoundingClientRect(); | ||
7901 | |||
7902 | // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop | ||
7903 | // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确 | ||
7904 | // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin | ||
7905 | |||
7906 | x = box.left; | ||
7907 | y = box.top; | ||
7908 | |||
7909 | // In IE, most of the time, 2 extra pixels are added to the top and left | ||
7910 | // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and | ||
7911 | // IE6 standards mode, this border can be overridden by setting the | ||
7912 | // document element's border to zero -- thus, we cannot rely on the | ||
7913 | // offset always being 2 pixels. | ||
7914 | |||
7915 | // In quirks mode, the offset can be determined by querying the body's | ||
7916 | // clientLeft/clientTop, but in standards mode, it is found by querying | ||
7917 | // the document element's clientLeft/clientTop. Since we already called | ||
7918 | // getClientBoundingRect we have already forced a reflow, so it is not | ||
7919 | // too expensive just to query them all. | ||
7920 | |||
7921 | // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的 | ||
7922 | // 窗口边框标准是设 documentElement ,quirks 时设置 body | ||
7923 | // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去 | ||
7924 | // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置 | ||
7925 | // 标准 ie 下 docElem.clientTop 就是 border-top | ||
7926 | // ie7 html 即窗口边框改变不了。永远为 2 | ||
7927 | // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0 | ||
7928 | |||
7929 | x -= docElem.clientLeft || body.clientLeft || 0; | ||
7930 | y -= docElem.clientTop || body.clientTop || 0; | ||
7931 | |||
7932 | return { | ||
7933 | left: x, | ||
7934 | top: y | ||
7935 | }; | ||
7936 | } | ||
7937 | |||
7938 | function getScroll(w, top) { | ||
7939 | var ret = w['page' + (top ? 'Y' : 'X') + 'Offset']; | ||
7940 | var method = 'scroll' + (top ? 'Top' : 'Left'); | ||
7941 | if (typeof ret !== 'number') { | ||
7942 | var d = w.document; | ||
7943 | // ie6,7,8 standard mode | ||
7944 | ret = d.documentElement[method]; | ||
7945 | if (typeof ret !== 'number') { | ||
7946 | // quirks mode | ||
7947 | ret = d.body[method]; | ||
7948 | } | ||
7949 | } | ||
7950 | return ret; | ||
7951 | } | ||
7952 | |||
7953 | function getScrollLeft(w) { | ||
7954 | return getScroll(w); | ||
7955 | } | ||
7956 | |||
7957 | function getScrollTop(w) { | ||
7958 | return getScroll(w, true); | ||
7959 | } | ||
7960 | |||
7961 | function getOffset(el) { | ||
7962 | var pos = getClientPosition(el); | ||
7963 | var doc = el.ownerDocument; | ||
7964 | var w = doc.defaultView || doc.parentWindow; | ||
7965 | pos.left += getScrollLeft(w); | ||
7966 | pos.top += getScrollTop(w); | ||
7967 | return pos; | ||
7968 | } | ||
7969 | |||
7970 | /** | ||
7971 | * A crude way of determining if an object is a window | ||
7972 | * @member util | ||
7973 | */ | ||
7974 | function isWindow(obj) { | ||
7975 | // must use == for ie8 | ||
7976 | /* eslint eqeqeq:0 */ | ||
7977 | return obj !== null && obj !== undefined && obj == obj.window; | ||
7978 | } | ||
7979 | |||
7980 | function getDocument(node) { | ||
7981 | if (isWindow(node)) { | ||
7982 | return node.document; | ||
7983 | } | ||
7984 | if (node.nodeType === 9) { | ||
7985 | return node; | ||
7986 | } | ||
7987 | return node.ownerDocument; | ||
7988 | } | ||
7989 | |||
7990 | function _getComputedStyle(elem, name, cs) { | ||
7991 | var computedStyle = cs; | ||
7992 | var val = ''; | ||
7993 | var d = getDocument(elem); | ||
7994 | computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null); | ||
7995 | |||
7996 | // https://github.com/kissyteam/kissy/issues/61 | ||
7997 | if (computedStyle) { | ||
7998 | val = computedStyle.getPropertyValue(name) || computedStyle[name]; | ||
7999 | } | ||
8000 | |||
8001 | return val; | ||
8002 | } | ||
8003 | |||
8004 | var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i'); | ||
8005 | var RE_POS = /^(top|right|bottom|left)$/; | ||
8006 | var CURRENT_STYLE = 'currentStyle'; | ||
8007 | var RUNTIME_STYLE = 'runtimeStyle'; | ||
8008 | var LEFT = 'left'; | ||
8009 | var PX = 'px'; | ||
8010 | |||
8011 | function _getComputedStyleIE(elem, name) { | ||
8012 | // currentStyle maybe null | ||
8013 | // http://msdn.microsoft.com/en-us/library/ms535231.aspx | ||
8014 | var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; | ||
8015 | |||
8016 | // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值 | ||
8017 | // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19 | ||
8018 | // 在 ie 下不对,需要直接用 offset 方式 | ||
8019 | // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了 | ||
8020 | |||
8021 | // From the awesome hack by Dean Edwards | ||
8022 | // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | ||
8023 | // If we're not dealing with a regular pixel number | ||
8024 | // but a number that has a weird ending, we need to convert it to pixels | ||
8025 | // exclude left right for relativity | ||
8026 | if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { | ||
8027 | // Remember the original values | ||
8028 | var style = elem.style; | ||
8029 | var left = style[LEFT]; | ||
8030 | var rsLeft = elem[RUNTIME_STYLE][LEFT]; | ||
8031 | |||
8032 | // prevent flashing of content | ||
8033 | elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; | ||
8034 | |||
8035 | // Put in the new values to get a computed value out | ||
8036 | style[LEFT] = name === 'fontSize' ? '1em' : ret || 0; | ||
8037 | ret = style.pixelLeft + PX; | ||
8038 | |||
8039 | // Revert the changed values | ||
8040 | style[LEFT] = left; | ||
8041 | |||
8042 | elem[RUNTIME_STYLE][LEFT] = rsLeft; | ||
8043 | } | ||
8044 | return ret === '' ? 'auto' : ret; | ||
8045 | } | ||
8046 | |||
8047 | if (typeof window !== 'undefined') { | ||
8048 | getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; | ||
8049 | } | ||
8050 | |||
8051 | function getOffsetDirection(dir, option) { | ||
8052 | if (dir === 'left') { | ||
8053 | return option.useCssRight ? 'right' : dir; | ||
8054 | } | ||
8055 | return option.useCssBottom ? 'bottom' : dir; | ||
8056 | } | ||
8057 | |||
8058 | function oppositeOffsetDirection(dir) { | ||
8059 | if (dir === 'left') { | ||
8060 | return 'right'; | ||
8061 | } else if (dir === 'right') { | ||
8062 | return 'left'; | ||
8063 | } else if (dir === 'top') { | ||
8064 | return 'bottom'; | ||
8065 | } else if (dir === 'bottom') { | ||
8066 | return 'top'; | ||
8067 | } | ||
8068 | } | ||
8069 | |||
8070 | // 设置 elem 相对 elem.ownerDocument 的坐标 | ||
8071 | function setLeftTop(elem, offset, option) { | ||
8072 | // set position first, in-case top/left are set even on static elem | ||
8073 | if (css(elem, 'position') === 'static') { | ||
8074 | elem.style.position = 'relative'; | ||
8075 | } | ||
8076 | var presetH = -999; | ||
8077 | var presetV = -999; | ||
8078 | var horizontalProperty = getOffsetDirection('left', option); | ||
8079 | var verticalProperty = getOffsetDirection('top', option); | ||
8080 | var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty); | ||
8081 | var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty); | ||
8082 | |||
8083 | if (horizontalProperty !== 'left') { | ||
8084 | presetH = 999; | ||
8085 | } | ||
8086 | |||
8087 | if (verticalProperty !== 'top') { | ||
8088 | presetV = 999; | ||
8089 | } | ||
8090 | var originalTransition = ''; | ||
8091 | var originalOffset = getOffset(elem); | ||
8092 | if ('left' in offset || 'top' in offset) { | ||
8093 | originalTransition = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__propertyUtils__["a" /* getTransitionProperty */])(elem) || ''; | ||
8094 | __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__propertyUtils__["b" /* setTransitionProperty */])(elem, 'none'); | ||
8095 | } | ||
8096 | if ('left' in offset) { | ||
8097 | elem.style[oppositeHorizontalProperty] = ''; | ||
8098 | elem.style[horizontalProperty] = presetH + 'px'; | ||
8099 | } | ||
8100 | if ('top' in offset) { | ||
8101 | elem.style[oppositeVerticalProperty] = ''; | ||
8102 | elem.style[verticalProperty] = presetV + 'px'; | ||
8103 | } | ||
8104 | var old = getOffset(elem); | ||
8105 | var originalStyle = {}; | ||
8106 | for (var key in offset) { | ||
8107 | if (offset.hasOwnProperty(key)) { | ||
8108 | var dir = getOffsetDirection(key, option); | ||
8109 | var preset = key === 'left' ? presetH : presetV; | ||
8110 | var off = originalOffset[key] - old[key]; | ||
8111 | if (dir === key) { | ||
8112 | originalStyle[dir] = preset + off; | ||
8113 | } else { | ||
8114 | originalStyle[dir] = preset - off; | ||
8115 | } | ||
8116 | } | ||
8117 | } | ||
8118 | css(elem, originalStyle); | ||
8119 | // force relayout | ||
8120 | force(elem.offsetTop, elem.offsetLeft); | ||
8121 | if ('left' in offset || 'top' in offset) { | ||
8122 | __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__propertyUtils__["b" /* setTransitionProperty */])(elem, originalTransition); | ||
8123 | } | ||
8124 | var ret = {}; | ||
8125 | for (var _key in offset) { | ||
8126 | if (offset.hasOwnProperty(_key)) { | ||
8127 | var _dir = getOffsetDirection(_key, option); | ||
8128 | var _off = offset[_key] - originalOffset[_key]; | ||
8129 | if (_key === _dir) { | ||
8130 | ret[_dir] = originalStyle[_dir] + _off; | ||
8131 | } else { | ||
8132 | ret[_dir] = originalStyle[_dir] - _off; | ||
8133 | } | ||
8134 | } | ||
8135 | } | ||
8136 | css(elem, ret); | ||
8137 | } | ||
8138 | |||
8139 | function setTransform(elem, offset) { | ||
8140 | var originalOffset = getOffset(elem); | ||
8141 | var originalXY = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__propertyUtils__["c" /* getTransformXY */])(elem); | ||
8142 | var resultXY = { x: originalXY.x, y: originalXY.y }; | ||
8143 | if ('left' in offset) { | ||
8144 | resultXY.x = originalXY.x + offset.left - originalOffset.left; | ||
8145 | } | ||
8146 | if ('top' in offset) { | ||
8147 | resultXY.y = originalXY.y + offset.top - originalOffset.top; | ||
8148 | } | ||
8149 | __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__propertyUtils__["d" /* setTransformXY */])(elem, resultXY); | ||
8150 | } | ||
8151 | |||
8152 | function setOffset(elem, offset, option) { | ||
8153 | if (option.useCssRight || option.useCssBottom) { | ||
8154 | setLeftTop(elem, offset, option); | ||
8155 | } else if (option.useCssTransform && __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__propertyUtils__["e" /* getTransformName */])() in document.body.style) { | ||
8156 | setTransform(elem, offset, option); | ||
8157 | } else { | ||
8158 | setLeftTop(elem, offset, option); | ||
8159 | } | ||
8160 | } | ||
8161 | |||
8162 | function each(arr, fn) { | ||
8163 | for (var i = 0; i < arr.length; i++) { | ||
8164 | fn(arr[i]); | ||
8165 | } | ||
8166 | } | ||
8167 | |||
8168 | function isBorderBoxFn(elem) { | ||
8169 | return getComputedStyleX(elem, 'boxSizing') === 'border-box'; | ||
8170 | } | ||
8171 | |||
8172 | var BOX_MODELS = ['margin', 'border', 'padding']; | ||
8173 | var CONTENT_INDEX = -1; | ||
8174 | var PADDING_INDEX = 2; | ||
8175 | var BORDER_INDEX = 1; | ||
8176 | var MARGIN_INDEX = 0; | ||
8177 | |||
8178 | function swap(elem, options, callback) { | ||
8179 | var old = {}; | ||
8180 | var style = elem.style; | ||
8181 | var name = void 0; | ||
8182 | |||
8183 | // Remember the old values, and insert the new ones | ||
8184 | for (name in options) { | ||
8185 | if (options.hasOwnProperty(name)) { | ||
8186 | old[name] = style[name]; | ||
8187 | style[name] = options[name]; | ||
8188 | } | ||
8189 | } | ||
8190 | |||
8191 | callback.call(elem); | ||
8192 | |||
8193 | // Revert the old values | ||
8194 | for (name in options) { | ||
8195 | if (options.hasOwnProperty(name)) { | ||
8196 | style[name] = old[name]; | ||
8197 | } | ||
8198 | } | ||
8199 | } | ||
8200 | |||
8201 | function getPBMWidth(elem, props, which) { | ||
8202 | var value = 0; | ||
8203 | var prop = void 0; | ||
8204 | var j = void 0; | ||
8205 | var i = void 0; | ||
8206 | for (j = 0; j < props.length; j++) { | ||
8207 | prop = props[j]; | ||
8208 | if (prop) { | ||
8209 | for (i = 0; i < which.length; i++) { | ||
8210 | var cssProp = void 0; | ||
8211 | if (prop === 'border') { | ||
8212 | cssProp = '' + prop + which[i] + 'Width'; | ||
8213 | } else { | ||
8214 | cssProp = prop + which[i]; | ||
8215 | } | ||
8216 | value += parseFloat(getComputedStyleX(elem, cssProp)) || 0; | ||
8217 | } | ||
8218 | } | ||
8219 | } | ||
8220 | return value; | ||
8221 | } | ||
8222 | |||
8223 | var domUtils = {}; | ||
8224 | |||
8225 | each(['Width', 'Height'], function (name) { | ||
8226 | domUtils['doc' + name] = function (refWin) { | ||
8227 | var d = refWin.document; | ||
8228 | return Math.max( | ||
8229 | // firefox chrome documentElement.scrollHeight< body.scrollHeight | ||
8230 | // ie standard mode : documentElement.scrollHeight> body.scrollHeight | ||
8231 | d.documentElement['scroll' + name], | ||
8232 | // quirks : documentElement.scrollHeight 最大等于可视窗口多一点? | ||
8233 | d.body['scroll' + name], domUtils['viewport' + name](d)); | ||
8234 | }; | ||
8235 | |||
8236 | domUtils['viewport' + name] = function (win) { | ||
8237 | // pc browser includes scrollbar in window.innerWidth | ||
8238 | var prop = 'client' + name; | ||
8239 | var doc = win.document; | ||
8240 | var body = doc.body; | ||
8241 | var documentElement = doc.documentElement; | ||
8242 | var documentElementProp = documentElement[prop]; | ||
8243 | // 标准模式取 documentElement | ||
8244 | // backcompat 取 body | ||
8245 | return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp; | ||
8246 | }; | ||
8247 | }); | ||
8248 | |||
8249 | /* | ||
8250 | 得到元素的大小信息 | ||
8251 | @param elem | ||
8252 | @param name | ||
8253 | @param {String} [extra] 'padding' : (css width) + padding | ||
8254 | 'border' : (css width) + padding + border | ||
8255 | 'margin' : (css width) + padding + border + margin | ||
8256 | */ | ||
8257 | function getWH(elem, name, ex) { | ||
8258 | var extra = ex; | ||
8259 | if (isWindow(elem)) { | ||
8260 | return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); | ||
8261 | } else if (elem.nodeType === 9) { | ||
8262 | return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem); | ||
8263 | } | ||
8264 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; | ||
8265 | var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight; | ||
8266 | var computedStyle = getComputedStyleX(elem); | ||
8267 | var isBorderBox = isBorderBoxFn(elem, computedStyle); | ||
8268 | var cssBoxValue = 0; | ||
8269 | if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) { | ||
8270 | borderBoxValue = undefined; | ||
8271 | // Fall back to computed then un computed css if necessary | ||
8272 | cssBoxValue = getComputedStyleX(elem, name); | ||
8273 | if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) { | ||
8274 | cssBoxValue = elem.style[name] || 0; | ||
8275 | } | ||
8276 | // Normalize '', auto, and prepare for extra | ||
8277 | cssBoxValue = parseFloat(cssBoxValue) || 0; | ||
8278 | } | ||
8279 | if (extra === undefined) { | ||
8280 | extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; | ||
8281 | } | ||
8282 | var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox; | ||
8283 | var val = borderBoxValue || cssBoxValue; | ||
8284 | if (extra === CONTENT_INDEX) { | ||
8285 | if (borderBoxValueOrIsBorderBox) { | ||
8286 | return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle); | ||
8287 | } | ||
8288 | return cssBoxValue; | ||
8289 | } else if (borderBoxValueOrIsBorderBox) { | ||
8290 | if (extra === BORDER_INDEX) { | ||
8291 | return val; | ||
8292 | } | ||
8293 | return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle)); | ||
8294 | } | ||
8295 | return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle); | ||
8296 | } | ||
8297 | |||
8298 | var cssShow = { | ||
8299 | position: 'absolute', | ||
8300 | visibility: 'hidden', | ||
8301 | display: 'block' | ||
8302 | }; | ||
8303 | |||
8304 | // fix #119 : https://github.com/kissyteam/kissy/issues/119 | ||
8305 | function getWHIgnoreDisplay() { | ||
8306 | for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) { | ||
8307 | args[_key2] = arguments[_key2]; | ||
8308 | } | ||
8309 | |||
8310 | var val = void 0; | ||
8311 | var elem = args[0]; | ||
8312 | // in case elem is window | ||
8313 | // elem.offsetWidth === undefined | ||
8314 | if (elem.offsetWidth !== 0) { | ||
8315 | val = getWH.apply(undefined, args); | ||
8316 | } else { | ||
8317 | swap(elem, cssShow, function () { | ||
8318 | val = getWH.apply(undefined, args); | ||
8319 | }); | ||
8320 | } | ||
8321 | return val; | ||
8322 | } | ||
8323 | |||
8324 | each(['width', 'height'], function (name) { | ||
8325 | var first = name.charAt(0).toUpperCase() + name.slice(1); | ||
8326 | domUtils['outer' + first] = function (el, includeMargin) { | ||
8327 | return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); | ||
8328 | }; | ||
8329 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; | ||
8330 | |||
8331 | domUtils[name] = function (elem, v) { | ||
8332 | var val = v; | ||
8333 | if (val !== undefined) { | ||
8334 | if (elem) { | ||
8335 | var computedStyle = getComputedStyleX(elem); | ||
8336 | var isBorderBox = isBorderBoxFn(elem); | ||
8337 | if (isBorderBox) { | ||
8338 | val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle); | ||
8339 | } | ||
8340 | return css(elem, name, val); | ||
8341 | } | ||
8342 | return undefined; | ||
8343 | } | ||
8344 | return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); | ||
8345 | }; | ||
8346 | }); | ||
8347 | |||
8348 | function mix(to, from) { | ||
8349 | for (var i in from) { | ||
8350 | if (from.hasOwnProperty(i)) { | ||
8351 | to[i] = from[i]; | ||
8352 | } | ||
8353 | } | ||
8354 | return to; | ||
8355 | } | ||
8356 | |||
8357 | var utils = { | ||
8358 | getWindow: function getWindow(node) { | ||
8359 | if (node && node.document && node.setTimeout) { | ||
8360 | return node; | ||
8361 | } | ||
8362 | var doc = node.ownerDocument || node; | ||
8363 | return doc.defaultView || doc.parentWindow; | ||
8364 | }, | ||
8365 | |||
8366 | getDocument: getDocument, | ||
8367 | offset: function offset(el, value, option) { | ||
8368 | if (typeof value !== 'undefined') { | ||
8369 | setOffset(el, value, option || {}); | ||
8370 | } else { | ||
8371 | return getOffset(el); | ||
8372 | } | ||
8373 | }, | ||
8374 | |||
8375 | isWindow: isWindow, | ||
8376 | each: each, | ||
8377 | css: css, | ||
8378 | clone: function clone(obj) { | ||
8379 | var i = void 0; | ||
8380 | var ret = {}; | ||
8381 | for (i in obj) { | ||
8382 | if (obj.hasOwnProperty(i)) { | ||
8383 | ret[i] = obj[i]; | ||
8384 | } | ||
8385 | } | ||
8386 | var overflow = obj.overflow; | ||
8387 | if (overflow) { | ||
8388 | for (i in obj) { | ||
8389 | if (obj.hasOwnProperty(i)) { | ||
8390 | ret.overflow[i] = obj.overflow[i]; | ||
8391 | } | ||
8392 | } | ||
8393 | } | ||
8394 | return ret; | ||
8395 | }, | ||
8396 | |||
8397 | mix: mix, | ||
8398 | getWindowScrollLeft: function getWindowScrollLeft(w) { | ||
8399 | return getScrollLeft(w); | ||
8400 | }, | ||
8401 | getWindowScrollTop: function getWindowScrollTop(w) { | ||
8402 | return getScrollTop(w); | ||
8403 | }, | ||
8404 | merge: function merge() { | ||
8405 | var ret = {}; | ||
8406 | |||
8407 | for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) { | ||
8408 | args[_key3] = arguments[_key3]; | ||
8409 | } | ||
8410 | |||
8411 | for (var i = 0; i < args.length; i++) { | ||
8412 | utils.mix(ret, args[i]); | ||
8413 | } | ||
8414 | return ret; | ||
8415 | }, | ||
8416 | |||
8417 | viewportWidth: 0, | ||
8418 | viewportHeight: 0 | ||
8419 | }; | ||
8420 | |||
8421 | mix(utils, domUtils); | ||
8422 | |||
8423 | /* harmony default export */ __webpack_exports__["a"] = (utils); | ||
8424 | |||
8425 | /***/ }), | ||
8426 | /* 45 */ | ||
8427 | /***/ (function(module, exports, __webpack_require__) { | ||
8428 | |||
8429 | "use strict"; | ||
8430 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
8431 | * Copyright 2013-present, Facebook, Inc. | ||
8432 | * All rights reserved. | ||
8433 | * | ||
8434 | * This source code is licensed under the BSD-style license found in the | ||
8435 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8436 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8437 | * | ||
8438 | */ | ||
8439 | |||
8440 | |||
8441 | |||
8442 | var _prodInvariant = __webpack_require__(3); | ||
8443 | |||
8444 | var EventPluginRegistry = __webpack_require__(53); | ||
8445 | var EventPluginUtils = __webpack_require__(77); | ||
8446 | var ReactErrorUtils = __webpack_require__(81); | ||
8447 | |||
8448 | var accumulateInto = __webpack_require__(131); | ||
8449 | var forEachAccumulated = __webpack_require__(132); | ||
8450 | var invariant = __webpack_require__(1); | ||
8451 | |||
8452 | /** | ||
8453 | * Internal store for event listeners | ||
8454 | */ | ||
8455 | var listenerBank = {}; | ||
8456 | |||
8457 | /** | ||
8458 | * Internal queue of events that have accumulated their dispatches and are | ||
8459 | * waiting to have their dispatches executed. | ||
8460 | */ | ||
8461 | var eventQueue = null; | ||
8462 | |||
8463 | /** | ||
8464 | * Dispatches an event and releases it back into the pool, unless persistent. | ||
8465 | * | ||
8466 | * @param {?object} event Synthetic event to be dispatched. | ||
8467 | * @param {boolean} simulated If the event is simulated (changes exn behavior) | ||
8468 | * @private | ||
8469 | */ | ||
8470 | var executeDispatchesAndRelease = function (event, simulated) { | ||
8471 | if (event) { | ||
8472 | EventPluginUtils.executeDispatchesInOrder(event, simulated); | ||
8473 | |||
8474 | if (!event.isPersistent()) { | ||
8475 | event.constructor.release(event); | ||
8476 | } | ||
8477 | } | ||
8478 | }; | ||
8479 | var executeDispatchesAndReleaseSimulated = function (e) { | ||
8480 | return executeDispatchesAndRelease(e, true); | ||
8481 | }; | ||
8482 | var executeDispatchesAndReleaseTopLevel = function (e) { | ||
8483 | return executeDispatchesAndRelease(e, false); | ||
8484 | }; | ||
8485 | |||
8486 | var getDictionaryKey = function (inst) { | ||
8487 | // Prevents V8 performance issue: | ||
8488 | // https://github.com/facebook/react/pull/7232 | ||
8489 | return '.' + inst._rootNodeID; | ||
8490 | }; | ||
8491 | |||
8492 | function isInteractive(tag) { | ||
8493 | return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; | ||
8494 | } | ||
8495 | |||
8496 | function shouldPreventMouseEvent(name, type, props) { | ||
8497 | switch (name) { | ||
8498 | case 'onClick': | ||
8499 | case 'onClickCapture': | ||
8500 | case 'onDoubleClick': | ||
8501 | case 'onDoubleClickCapture': | ||
8502 | case 'onMouseDown': | ||
8503 | case 'onMouseDownCapture': | ||
8504 | case 'onMouseMove': | ||
8505 | case 'onMouseMoveCapture': | ||
8506 | case 'onMouseUp': | ||
8507 | case 'onMouseUpCapture': | ||
8508 | return !!(props.disabled && isInteractive(type)); | ||
8509 | default: | ||
8510 | return false; | ||
8511 | } | ||
8512 | } | ||
8513 | |||
8514 | /** | ||
8515 | * This is a unified interface for event plugins to be installed and configured. | ||
8516 | * | ||
8517 | * Event plugins can implement the following properties: | ||
8518 | * | ||
8519 | * `extractEvents` {function(string, DOMEventTarget, string, object): *} | ||
8520 | * Required. When a top-level event is fired, this method is expected to | ||
8521 | * extract synthetic events that will in turn be queued and dispatched. | ||
8522 | * | ||
8523 | * `eventTypes` {object} | ||
8524 | * Optional, plugins that fire events must publish a mapping of registration | ||
8525 | * names that are used to register listeners. Values of this mapping must | ||
8526 | * be objects that contain `registrationName` or `phasedRegistrationNames`. | ||
8527 | * | ||
8528 | * `executeDispatch` {function(object, function, string)} | ||
8529 | * Optional, allows plugins to override how an event gets dispatched. By | ||
8530 | * default, the listener is simply invoked. | ||
8531 | * | ||
8532 | * Each plugin that is injected into `EventsPluginHub` is immediately operable. | ||
8533 | * | ||
8534 | * @public | ||
8535 | */ | ||
8536 | var EventPluginHub = { | ||
8537 | |||
8538 | /** | ||
8539 | * Methods for injecting dependencies. | ||
8540 | */ | ||
8541 | injection: { | ||
8542 | |||
8543 | /** | ||
8544 | * @param {array} InjectedEventPluginOrder | ||
8545 | * @public | ||
8546 | */ | ||
8547 | injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder, | ||
8548 | |||
8549 | /** | ||
8550 | * @param {object} injectedNamesToPlugins Map from names to plugin modules. | ||
8551 | */ | ||
8552 | injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName | ||
8553 | |||
8554 | }, | ||
8555 | |||
8556 | /** | ||
8557 | * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent. | ||
8558 | * | ||
8559 | * @param {object} inst The instance, which is the source of events. | ||
8560 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
8561 | * @param {function} listener The callback to store. | ||
8562 | */ | ||
8563 | putListener: function (inst, registrationName, listener) { | ||
8564 | !(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; | ||
8565 | |||
8566 | var key = getDictionaryKey(inst); | ||
8567 | var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); | ||
8568 | bankForRegistrationName[key] = listener; | ||
8569 | |||
8570 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | ||
8571 | if (PluginModule && PluginModule.didPutListener) { | ||
8572 | PluginModule.didPutListener(inst, registrationName, listener); | ||
8573 | } | ||
8574 | }, | ||
8575 | |||
8576 | /** | ||
8577 | * @param {object} inst The instance, which is the source of events. | ||
8578 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
8579 | * @return {?function} The stored callback. | ||
8580 | */ | ||
8581 | getListener: function (inst, registrationName) { | ||
8582 | // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not | ||
8583 | // live here; needs to be moved to a better place soon | ||
8584 | var bankForRegistrationName = listenerBank[registrationName]; | ||
8585 | if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) { | ||
8586 | return null; | ||
8587 | } | ||
8588 | var key = getDictionaryKey(inst); | ||
8589 | return bankForRegistrationName && bankForRegistrationName[key]; | ||
8590 | }, | ||
8591 | |||
8592 | /** | ||
8593 | * Deletes a listener from the registration bank. | ||
8594 | * | ||
8595 | * @param {object} inst The instance, which is the source of events. | ||
8596 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
8597 | */ | ||
8598 | deleteListener: function (inst, registrationName) { | ||
8599 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | ||
8600 | if (PluginModule && PluginModule.willDeleteListener) { | ||
8601 | PluginModule.willDeleteListener(inst, registrationName); | ||
8602 | } | ||
8603 | |||
8604 | var bankForRegistrationName = listenerBank[registrationName]; | ||
8605 | // TODO: This should never be null -- when is it? | ||
8606 | if (bankForRegistrationName) { | ||
8607 | var key = getDictionaryKey(inst); | ||
8608 | delete bankForRegistrationName[key]; | ||
8609 | } | ||
8610 | }, | ||
8611 | |||
8612 | /** | ||
8613 | * Deletes all listeners for the DOM element with the supplied ID. | ||
8614 | * | ||
8615 | * @param {object} inst The instance, which is the source of events. | ||
8616 | */ | ||
8617 | deleteAllListeners: function (inst) { | ||
8618 | var key = getDictionaryKey(inst); | ||
8619 | for (var registrationName in listenerBank) { | ||
8620 | if (!listenerBank.hasOwnProperty(registrationName)) { | ||
8621 | continue; | ||
8622 | } | ||
8623 | |||
8624 | if (!listenerBank[registrationName][key]) { | ||
8625 | continue; | ||
8626 | } | ||
8627 | |||
8628 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | ||
8629 | if (PluginModule && PluginModule.willDeleteListener) { | ||
8630 | PluginModule.willDeleteListener(inst, registrationName); | ||
8631 | } | ||
8632 | |||
8633 | delete listenerBank[registrationName][key]; | ||
8634 | } | ||
8635 | }, | ||
8636 | |||
8637 | /** | ||
8638 | * Allows registered plugins an opportunity to extract events from top-level | ||
8639 | * native browser events. | ||
8640 | * | ||
8641 | * @return {*} An accumulation of synthetic events. | ||
8642 | * @internal | ||
8643 | */ | ||
8644 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
8645 | var events; | ||
8646 | var plugins = EventPluginRegistry.plugins; | ||
8647 | for (var i = 0; i < plugins.length; i++) { | ||
8648 | // Not every plugin in the ordering may be loaded at runtime. | ||
8649 | var possiblePlugin = plugins[i]; | ||
8650 | if (possiblePlugin) { | ||
8651 | var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); | ||
8652 | if (extractedEvents) { | ||
8653 | events = accumulateInto(events, extractedEvents); | ||
8654 | } | ||
8655 | } | ||
8656 | } | ||
8657 | return events; | ||
8658 | }, | ||
8659 | |||
8660 | /** | ||
8661 | * Enqueues a synthetic event that should be dispatched when | ||
8662 | * `processEventQueue` is invoked. | ||
8663 | * | ||
8664 | * @param {*} events An accumulation of synthetic events. | ||
8665 | * @internal | ||
8666 | */ | ||
8667 | enqueueEvents: function (events) { | ||
8668 | if (events) { | ||
8669 | eventQueue = accumulateInto(eventQueue, events); | ||
8670 | } | ||
8671 | }, | ||
8672 | |||
8673 | /** | ||
8674 | * Dispatches all synthetic events on the event queue. | ||
8675 | * | ||
8676 | * @internal | ||
8677 | */ | ||
8678 | processEventQueue: function (simulated) { | ||
8679 | // Set `eventQueue` to null before processing it so that we can tell if more | ||
8680 | // events get enqueued while processing. | ||
8681 | var processingEventQueue = eventQueue; | ||
8682 | eventQueue = null; | ||
8683 | if (simulated) { | ||
8684 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated); | ||
8685 | } else { | ||
8686 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); | ||
8687 | } | ||
8688 | !!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; | ||
8689 | // This would be a good time to rethrow if any of the event handlers threw. | ||
8690 | ReactErrorUtils.rethrowCaughtError(); | ||
8691 | }, | ||
8692 | |||
8693 | /** | ||
8694 | * These are needed for tests only. Do not use! | ||
8695 | */ | ||
8696 | __purge: function () { | ||
8697 | listenerBank = {}; | ||
8698 | }, | ||
8699 | |||
8700 | __getListenerBank: function () { | ||
8701 | return listenerBank; | ||
8702 | } | ||
8703 | |||
8704 | }; | ||
8705 | |||
8706 | module.exports = EventPluginHub; | ||
8707 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
8708 | |||
8709 | /***/ }), | ||
8710 | /* 46 */ | ||
8711 | /***/ (function(module, exports, __webpack_require__) { | ||
8712 | |||
8713 | "use strict"; | ||
8714 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
8715 | * Copyright 2013-present, Facebook, Inc. | ||
8716 | * All rights reserved. | ||
8717 | * | ||
8718 | * This source code is licensed under the BSD-style license found in the | ||
8719 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8720 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8721 | * | ||
8722 | */ | ||
8723 | |||
8724 | |||
8725 | |||
8726 | var EventPluginHub = __webpack_require__(45); | ||
8727 | var EventPluginUtils = __webpack_require__(77); | ||
8728 | |||
8729 | var accumulateInto = __webpack_require__(131); | ||
8730 | var forEachAccumulated = __webpack_require__(132); | ||
8731 | var warning = __webpack_require__(2); | ||
8732 | |||
8733 | var getListener = EventPluginHub.getListener; | ||
8734 | |||
8735 | /** | ||
8736 | * Some event types have a notion of different registration names for different | ||
8737 | * "phases" of propagation. This finds listeners by a given phase. | ||
8738 | */ | ||
8739 | function listenerAtPhase(inst, event, propagationPhase) { | ||
8740 | var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; | ||
8741 | return getListener(inst, registrationName); | ||
8742 | } | ||
8743 | |||
8744 | /** | ||
8745 | * Tags a `SyntheticEvent` with dispatched listeners. Creating this function | ||
8746 | * here, allows us to not have to bind or create functions for each event. | ||
8747 | * Mutating the event's members allows us to not have to create a wrapping | ||
8748 | * "dispatch" object that pairs the event with the listener. | ||
8749 | */ | ||
8750 | function accumulateDirectionalDispatches(inst, phase, event) { | ||
8751 | if (process.env.NODE_ENV !== 'production') { | ||
8752 | process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0; | ||
8753 | } | ||
8754 | var listener = listenerAtPhase(inst, event, phase); | ||
8755 | if (listener) { | ||
8756 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | ||
8757 | event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); | ||
8758 | } | ||
8759 | } | ||
8760 | |||
8761 | /** | ||
8762 | * Collect dispatches (must be entirely collected before dispatching - see unit | ||
8763 | * tests). Lazily allocate the array to conserve memory. We must loop through | ||
8764 | * each event and perform the traversal for each one. We cannot perform a | ||
8765 | * single traversal for the entire collection of events because each event may | ||
8766 | * have a different target. | ||
8767 | */ | ||
8768 | function accumulateTwoPhaseDispatchesSingle(event) { | ||
8769 | if (event && event.dispatchConfig.phasedRegistrationNames) { | ||
8770 | EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); | ||
8771 | } | ||
8772 | } | ||
8773 | |||
8774 | /** | ||
8775 | * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. | ||
8776 | */ | ||
8777 | function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { | ||
8778 | if (event && event.dispatchConfig.phasedRegistrationNames) { | ||
8779 | var targetInst = event._targetInst; | ||
8780 | var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null; | ||
8781 | EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); | ||
8782 | } | ||
8783 | } | ||
8784 | |||
8785 | /** | ||
8786 | * Accumulates without regard to direction, does not look for phased | ||
8787 | * registration names. Same as `accumulateDirectDispatchesSingle` but without | ||
8788 | * requiring that the `dispatchMarker` be the same as the dispatched ID. | ||
8789 | */ | ||
8790 | function accumulateDispatches(inst, ignoredDirection, event) { | ||
8791 | if (event && event.dispatchConfig.registrationName) { | ||
8792 | var registrationName = event.dispatchConfig.registrationName; | ||
8793 | var listener = getListener(inst, registrationName); | ||
8794 | if (listener) { | ||
8795 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | ||
8796 | event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); | ||
8797 | } | ||
8798 | } | ||
8799 | } | ||
8800 | |||
8801 | /** | ||
8802 | * Accumulates dispatches on an `SyntheticEvent`, but only for the | ||
8803 | * `dispatchMarker`. | ||
8804 | * @param {SyntheticEvent} event | ||
8805 | */ | ||
8806 | function accumulateDirectDispatchesSingle(event) { | ||
8807 | if (event && event.dispatchConfig.registrationName) { | ||
8808 | accumulateDispatches(event._targetInst, null, event); | ||
8809 | } | ||
8810 | } | ||
8811 | |||
8812 | function accumulateTwoPhaseDispatches(events) { | ||
8813 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); | ||
8814 | } | ||
8815 | |||
8816 | function accumulateTwoPhaseDispatchesSkipTarget(events) { | ||
8817 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); | ||
8818 | } | ||
8819 | |||
8820 | function accumulateEnterLeaveDispatches(leave, enter, from, to) { | ||
8821 | EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter); | ||
8822 | } | ||
8823 | |||
8824 | function accumulateDirectDispatches(events) { | ||
8825 | forEachAccumulated(events, accumulateDirectDispatchesSingle); | ||
8826 | } | ||
8827 | |||
8828 | /** | ||
8829 | * A small set of propagation patterns, each of which will accept a small amount | ||
8830 | * of information, and generate a set of "dispatch ready event objects" - which | ||
8831 | * are sets of events that have already been annotated with a set of dispatched | ||
8832 | * listener functions/ids. The API is designed this way to discourage these | ||
8833 | * propagation strategies from actually executing the dispatches, since we | ||
8834 | * always want to collect the entire set of dispatches before executing event a | ||
8835 | * single one. | ||
8836 | * | ||
8837 | * @constructor EventPropagators | ||
8838 | */ | ||
8839 | var EventPropagators = { | ||
8840 | accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, | ||
8841 | accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, | ||
8842 | accumulateDirectDispatches: accumulateDirectDispatches, | ||
8843 | accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches | ||
8844 | }; | ||
8845 | |||
8846 | module.exports = EventPropagators; | ||
8847 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
8848 | |||
8849 | /***/ }), | ||
8850 | /* 47 */ | ||
8851 | /***/ (function(module, exports, __webpack_require__) { | ||
8852 | |||
8853 | "use strict"; | ||
8854 | /** | ||
8855 | * Copyright 2013-present, Facebook, Inc. | ||
8856 | * All rights reserved. | ||
8857 | * | ||
8858 | * This source code is licensed under the BSD-style license found in the | ||
8859 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8860 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8861 | * | ||
8862 | */ | ||
8863 | |||
8864 | |||
8865 | |||
8866 | /** | ||
8867 | * `ReactInstanceMap` maintains a mapping from a public facing stateful | ||
8868 | * instance (key) and the internal representation (value). This allows public | ||
8869 | * methods to accept the user facing instance as an argument and map them back | ||
8870 | * to internal methods. | ||
8871 | */ | ||
8872 | |||
8873 | // TODO: Replace this with ES6: var ReactInstanceMap = new Map(); | ||
8874 | |||
8875 | var ReactInstanceMap = { | ||
8876 | |||
8877 | /** | ||
8878 | * This API should be called `delete` but we'd have to make sure to always | ||
8879 | * transform these to strings for IE support. When this transform is fully | ||
8880 | * supported we can rename it. | ||
8881 | */ | ||
8882 | remove: function (key) { | ||
8883 | key._reactInternalInstance = undefined; | ||
8884 | }, | ||
8885 | |||
8886 | get: function (key) { | ||
8887 | return key._reactInternalInstance; | ||
8888 | }, | ||
8889 | |||
8890 | has: function (key) { | ||
8891 | return key._reactInternalInstance !== undefined; | ||
8892 | }, | ||
8893 | |||
8894 | set: function (key, value) { | ||
8895 | key._reactInternalInstance = value; | ||
8896 | } | ||
8897 | |||
8898 | }; | ||
8899 | |||
8900 | module.exports = ReactInstanceMap; | ||
8901 | |||
8902 | /***/ }), | ||
8903 | /* 48 */ | ||
8904 | /***/ (function(module, exports, __webpack_require__) { | ||
8905 | |||
8906 | "use strict"; | ||
8907 | /** | ||
8908 | * Copyright 2013-present, Facebook, Inc. | ||
8909 | * All rights reserved. | ||
8910 | * | ||
8911 | * This source code is licensed under the BSD-style license found in the | ||
8912 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8913 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8914 | * | ||
8915 | */ | ||
8916 | |||
8917 | |||
8918 | |||
8919 | var SyntheticEvent = __webpack_require__(19); | ||
8920 | |||
8921 | var getEventTarget = __webpack_require__(86); | ||
8922 | |||
8923 | /** | ||
8924 | * @interface UIEvent | ||
8925 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
8926 | */ | ||
8927 | var UIEventInterface = { | ||
8928 | view: function (event) { | ||
8929 | if (event.view) { | ||
8930 | return event.view; | ||
8931 | } | ||
8932 | |||
8933 | var target = getEventTarget(event); | ||
8934 | if (target.window === target) { | ||
8935 | // target is a window object | ||
8936 | return target; | ||
8937 | } | ||
8938 | |||
8939 | var doc = target.ownerDocument; | ||
8940 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. | ||
8941 | if (doc) { | ||
8942 | return doc.defaultView || doc.parentWindow; | ||
8943 | } else { | ||
8944 | return window; | ||
8945 | } | ||
8946 | }, | ||
8947 | detail: function (event) { | ||
8948 | return event.detail || 0; | ||
8949 | } | ||
8950 | }; | ||
8951 | |||
8952 | /** | ||
8953 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
8954 | * @param {string} dispatchMarker Marker identifying the event target. | ||
8955 | * @param {object} nativeEvent Native browser event. | ||
8956 | * @extends {SyntheticEvent} | ||
8957 | */ | ||
8958 | function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
8959 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
8960 | } | ||
8961 | |||
8962 | SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); | ||
8963 | |||
8964 | module.exports = SyntheticUIEvent; | ||
8965 | |||
8966 | /***/ }), | ||
8967 | /* 49 */ | ||
8968 | /***/ (function(module, exports, __webpack_require__) { | ||
8969 | |||
8970 | "use strict"; | ||
8971 | |||
8972 | |||
8973 | exports.__esModule = true; | ||
8974 | |||
8975 | var _assign = __webpack_require__(160); | ||
8976 | |||
8977 | var _assign2 = _interopRequireDefault(_assign); | ||
8978 | |||
8979 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
8980 | |||
8981 | exports.default = _assign2.default || function (target) { | ||
8982 | for (var i = 1; i < arguments.length; i++) { | ||
8983 | var source = arguments[i]; | ||
8984 | |||
8985 | for (var key in source) { | ||
8986 | if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
8987 | target[key] = source[key]; | ||
8988 | } | ||
8989 | } | ||
8990 | } | ||
8991 | |||
8992 | return target; | ||
8993 | }; | ||
8994 | |||
8995 | /***/ }), | ||
8996 | /* 50 */ | ||
8997 | /***/ (function(module, exports) { | ||
8998 | |||
8999 | exports.f = {}.propertyIsEnumerable; | ||
9000 | |||
9001 | /***/ }), | ||
9002 | /* 51 */ | ||
9003 | /***/ (function(module, exports) { | ||
9004 | |||
9005 | module.exports = function(bitmap, value){ | ||
9006 | return { | ||
9007 | enumerable : !(bitmap & 1), | ||
9008 | configurable: !(bitmap & 2), | ||
9009 | writable : !(bitmap & 4), | ||
9010 | value : value | ||
9011 | }; | ||
9012 | }; | ||
9013 | |||
9014 | /***/ }), | ||
9015 | /* 52 */ | ||
9016 | /***/ (function(module, exports) { | ||
9017 | |||
9018 | var id = 0 | ||
9019 | , px = Math.random(); | ||
9020 | module.exports = function(key){ | ||
9021 | return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); | ||
9022 | }; | ||
9023 | |||
9024 | /***/ }), | ||
9025 | /* 53 */ | ||
9026 | /***/ (function(module, exports, __webpack_require__) { | ||
9027 | |||
9028 | "use strict"; | ||
9029 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
9030 | * Copyright 2013-present, Facebook, Inc. | ||
9031 | * All rights reserved. | ||
9032 | * | ||
9033 | * This source code is licensed under the BSD-style license found in the | ||
9034 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9035 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9036 | * | ||
9037 | * | ||
9038 | */ | ||
9039 | |||
9040 | |||
9041 | |||
9042 | var _prodInvariant = __webpack_require__(3); | ||
9043 | |||
9044 | var invariant = __webpack_require__(1); | ||
9045 | |||
9046 | /** | ||
9047 | * Injectable ordering of event plugins. | ||
9048 | */ | ||
9049 | var eventPluginOrder = null; | ||
9050 | |||
9051 | /** | ||
9052 | * Injectable mapping from names to event plugin modules. | ||
9053 | */ | ||
9054 | var namesToPlugins = {}; | ||
9055 | |||
9056 | /** | ||
9057 | * Recomputes the plugin list using the injected plugins and plugin ordering. | ||
9058 | * | ||
9059 | * @private | ||
9060 | */ | ||
9061 | function recomputePluginOrdering() { | ||
9062 | if (!eventPluginOrder) { | ||
9063 | // Wait until an `eventPluginOrder` is injected. | ||
9064 | return; | ||
9065 | } | ||
9066 | for (var pluginName in namesToPlugins) { | ||
9067 | var pluginModule = namesToPlugins[pluginName]; | ||
9068 | var pluginIndex = eventPluginOrder.indexOf(pluginName); | ||
9069 | !(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; | ||
9070 | if (EventPluginRegistry.plugins[pluginIndex]) { | ||
9071 | continue; | ||
9072 | } | ||
9073 | !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; | ||
9074 | EventPluginRegistry.plugins[pluginIndex] = pluginModule; | ||
9075 | var publishedEvents = pluginModule.eventTypes; | ||
9076 | for (var eventName in publishedEvents) { | ||
9077 | !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; | ||
9078 | } | ||
9079 | } | ||
9080 | } | ||
9081 | |||
9082 | /** | ||
9083 | * Publishes an event so that it can be dispatched by the supplied plugin. | ||
9084 | * | ||
9085 | * @param {object} dispatchConfig Dispatch configuration for the event. | ||
9086 | * @param {object} PluginModule Plugin publishing the event. | ||
9087 | * @return {boolean} True if the event was successfully published. | ||
9088 | * @private | ||
9089 | */ | ||
9090 | function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { | ||
9091 | !!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; | ||
9092 | EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; | ||
9093 | |||
9094 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; | ||
9095 | if (phasedRegistrationNames) { | ||
9096 | for (var phaseName in phasedRegistrationNames) { | ||
9097 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) { | ||
9098 | var phasedRegistrationName = phasedRegistrationNames[phaseName]; | ||
9099 | publishRegistrationName(phasedRegistrationName, pluginModule, eventName); | ||
9100 | } | ||
9101 | } | ||
9102 | return true; | ||
9103 | } else if (dispatchConfig.registrationName) { | ||
9104 | publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); | ||
9105 | return true; | ||
9106 | } | ||
9107 | return false; | ||
9108 | } | ||
9109 | |||
9110 | /** | ||
9111 | * Publishes a registration name that is used to identify dispatched events and | ||
9112 | * can be used with `EventPluginHub.putListener` to register listeners. | ||
9113 | * | ||
9114 | * @param {string} registrationName Registration name to add. | ||
9115 | * @param {object} PluginModule Plugin publishing the event. | ||
9116 | * @private | ||
9117 | */ | ||
9118 | function publishRegistrationName(registrationName, pluginModule, eventName) { | ||
9119 | !!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; | ||
9120 | EventPluginRegistry.registrationNameModules[registrationName] = pluginModule; | ||
9121 | EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; | ||
9122 | |||
9123 | if (process.env.NODE_ENV !== 'production') { | ||
9124 | var lowerCasedName = registrationName.toLowerCase(); | ||
9125 | EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName; | ||
9126 | |||
9127 | if (registrationName === 'onDoubleClick') { | ||
9128 | EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName; | ||
9129 | } | ||
9130 | } | ||
9131 | } | ||
9132 | |||
9133 | /** | ||
9134 | * Registers plugins so that they can extract and dispatch events. | ||
9135 | * | ||
9136 | * @see {EventPluginHub} | ||
9137 | */ | ||
9138 | var EventPluginRegistry = { | ||
9139 | |||
9140 | /** | ||
9141 | * Ordered list of injected plugins. | ||
9142 | */ | ||
9143 | plugins: [], | ||
9144 | |||
9145 | /** | ||
9146 | * Mapping from event name to dispatch config | ||
9147 | */ | ||
9148 | eventNameDispatchConfigs: {}, | ||
9149 | |||
9150 | /** | ||
9151 | * Mapping from registration name to plugin module | ||
9152 | */ | ||
9153 | registrationNameModules: {}, | ||
9154 | |||
9155 | /** | ||
9156 | * Mapping from registration name to event name | ||
9157 | */ | ||
9158 | registrationNameDependencies: {}, | ||
9159 | |||
9160 | /** | ||
9161 | * Mapping from lowercase registration names to the properly cased version, | ||
9162 | * used to warn in the case of missing event handlers. Available | ||
9163 | * only in __DEV__. | ||
9164 | * @type {Object} | ||
9165 | */ | ||
9166 | possibleRegistrationNames: process.env.NODE_ENV !== 'production' ? {} : null, | ||
9167 | // Trust the developer to only use possibleRegistrationNames in __DEV__ | ||
9168 | |||
9169 | /** | ||
9170 | * Injects an ordering of plugins (by plugin name). This allows the ordering | ||
9171 | * to be decoupled from injection of the actual plugins so that ordering is | ||
9172 | * always deterministic regardless of packaging, on-the-fly injection, etc. | ||
9173 | * | ||
9174 | * @param {array} InjectedEventPluginOrder | ||
9175 | * @internal | ||
9176 | * @see {EventPluginHub.injection.injectEventPluginOrder} | ||
9177 | */ | ||
9178 | injectEventPluginOrder: function (injectedEventPluginOrder) { | ||
9179 | !!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; | ||
9180 | // Clone the ordering so it cannot be dynamically mutated. | ||
9181 | eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); | ||
9182 | recomputePluginOrdering(); | ||
9183 | }, | ||
9184 | |||
9185 | /** | ||
9186 | * Injects plugins to be used by `EventPluginHub`. The plugin names must be | ||
9187 | * in the ordering injected by `injectEventPluginOrder`. | ||
9188 | * | ||
9189 | * Plugins can be injected as part of page initialization or on-the-fly. | ||
9190 | * | ||
9191 | * @param {object} injectedNamesToPlugins Map from names to plugin modules. | ||
9192 | * @internal | ||
9193 | * @see {EventPluginHub.injection.injectEventPluginsByName} | ||
9194 | */ | ||
9195 | injectEventPluginsByName: function (injectedNamesToPlugins) { | ||
9196 | var isOrderingDirty = false; | ||
9197 | for (var pluginName in injectedNamesToPlugins) { | ||
9198 | if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { | ||
9199 | continue; | ||
9200 | } | ||
9201 | var pluginModule = injectedNamesToPlugins[pluginName]; | ||
9202 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { | ||
9203 | !!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; | ||
9204 | namesToPlugins[pluginName] = pluginModule; | ||
9205 | isOrderingDirty = true; | ||
9206 | } | ||
9207 | } | ||
9208 | if (isOrderingDirty) { | ||
9209 | recomputePluginOrdering(); | ||
9210 | } | ||
9211 | }, | ||
9212 | |||
9213 | /** | ||
9214 | * Looks up the plugin for the supplied event. | ||
9215 | * | ||
9216 | * @param {object} event A synthetic event. | ||
9217 | * @return {?object} The plugin that created the supplied event. | ||
9218 | * @internal | ||
9219 | */ | ||
9220 | getPluginModuleForEvent: function (event) { | ||
9221 | var dispatchConfig = event.dispatchConfig; | ||
9222 | if (dispatchConfig.registrationName) { | ||
9223 | return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null; | ||
9224 | } | ||
9225 | if (dispatchConfig.phasedRegistrationNames !== undefined) { | ||
9226 | // pulling phasedRegistrationNames out of dispatchConfig helps Flow see | ||
9227 | // that it is not undefined. | ||
9228 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; | ||
9229 | |||
9230 | for (var phase in phasedRegistrationNames) { | ||
9231 | if (!phasedRegistrationNames.hasOwnProperty(phase)) { | ||
9232 | continue; | ||
9233 | } | ||
9234 | var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]]; | ||
9235 | if (pluginModule) { | ||
9236 | return pluginModule; | ||
9237 | } | ||
9238 | } | ||
9239 | } | ||
9240 | return null; | ||
9241 | }, | ||
9242 | |||
9243 | /** | ||
9244 | * Exposed for unit testing. | ||
9245 | * @private | ||
9246 | */ | ||
9247 | _resetEventPlugins: function () { | ||
9248 | eventPluginOrder = null; | ||
9249 | for (var pluginName in namesToPlugins) { | ||
9250 | if (namesToPlugins.hasOwnProperty(pluginName)) { | ||
9251 | delete namesToPlugins[pluginName]; | ||
9252 | } | ||
9253 | } | ||
9254 | EventPluginRegistry.plugins.length = 0; | ||
9255 | |||
9256 | var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs; | ||
9257 | for (var eventName in eventNameDispatchConfigs) { | ||
9258 | if (eventNameDispatchConfigs.hasOwnProperty(eventName)) { | ||
9259 | delete eventNameDispatchConfigs[eventName]; | ||
9260 | } | ||
9261 | } | ||
9262 | |||
9263 | var registrationNameModules = EventPluginRegistry.registrationNameModules; | ||
9264 | for (var registrationName in registrationNameModules) { | ||
9265 | if (registrationNameModules.hasOwnProperty(registrationName)) { | ||
9266 | delete registrationNameModules[registrationName]; | ||
9267 | } | ||
9268 | } | ||
9269 | |||
9270 | if (process.env.NODE_ENV !== 'production') { | ||
9271 | var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames; | ||
9272 | for (var lowerCasedName in possibleRegistrationNames) { | ||
9273 | if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) { | ||
9274 | delete possibleRegistrationNames[lowerCasedName]; | ||
9275 | } | ||
9276 | } | ||
9277 | } | ||
9278 | } | ||
9279 | |||
9280 | }; | ||
9281 | |||
9282 | module.exports = EventPluginRegistry; | ||
9283 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
9284 | |||
9285 | /***/ }), | ||
9286 | /* 54 */ | ||
9287 | /***/ (function(module, exports, __webpack_require__) { | ||
9288 | |||
9289 | "use strict"; | ||
9290 | /** | ||
9291 | * Copyright 2013-present, Facebook, Inc. | ||
9292 | * All rights reserved. | ||
9293 | * | ||
9294 | * This source code is licensed under the BSD-style license found in the | ||
9295 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9296 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9297 | * | ||
9298 | */ | ||
9299 | |||
9300 | |||
9301 | |||
9302 | var _assign = __webpack_require__(4); | ||
9303 | |||
9304 | var EventPluginRegistry = __webpack_require__(53); | ||
9305 | var ReactEventEmitterMixin = __webpack_require__(274); | ||
9306 | var ViewportMetrics = __webpack_require__(130); | ||
9307 | |||
9308 | var getVendorPrefixedEventName = __webpack_require__(309); | ||
9309 | var isEventSupported = __webpack_require__(87); | ||
9310 | |||
9311 | /** | ||
9312 | * Summary of `ReactBrowserEventEmitter` event handling: | ||
9313 | * | ||
9314 | * - Top-level delegation is used to trap most native browser events. This | ||
9315 | * may only occur in the main thread and is the responsibility of | ||
9316 | * ReactEventListener, which is injected and can therefore support pluggable | ||
9317 | * event sources. This is the only work that occurs in the main thread. | ||
9318 | * | ||
9319 | * - We normalize and de-duplicate events to account for browser quirks. This | ||
9320 | * may be done in the worker thread. | ||
9321 | * | ||
9322 | * - Forward these native events (with the associated top-level type used to | ||
9323 | * trap it) to `EventPluginHub`, which in turn will ask plugins if they want | ||
9324 | * to extract any synthetic events. | ||
9325 | * | ||
9326 | * - The `EventPluginHub` will then process each event by annotating them with | ||
9327 | * "dispatches", a sequence of listeners and IDs that care about that event. | ||
9328 | * | ||
9329 | * - The `EventPluginHub` then dispatches the events. | ||
9330 | * | ||
9331 | * Overview of React and the event system: | ||
9332 | * | ||
9333 | * +------------+ . | ||
9334 | * | DOM | . | ||
9335 | * +------------+ . | ||
9336 | * | . | ||
9337 | * v . | ||
9338 | * +------------+ . | ||
9339 | * | ReactEvent | . | ||
9340 | * | Listener | . | ||
9341 | * +------------+ . +-----------+ | ||
9342 | * | . +--------+|SimpleEvent| | ||
9343 | * | . | |Plugin | | ||
9344 | * +-----|------+ . v +-----------+ | ||
9345 | * | | | . +--------------+ +------------+ | ||
9346 | * | +-----------.--->|EventPluginHub| | Event | | ||
9347 | * | | . | | +-----------+ | Propagators| | ||
9348 | * | ReactEvent | . | | |TapEvent | |------------| | ||
9349 | * | Emitter | . | |<---+|Plugin | |other plugin| | ||
9350 | * | | . | | +-----------+ | utilities | | ||
9351 | * | +-----------.--->| | +------------+ | ||
9352 | * | | | . +--------------+ | ||
9353 | * +-----|------+ . ^ +-----------+ | ||
9354 | * | . | |Enter/Leave| | ||
9355 | * + . +-------+|Plugin | | ||
9356 | * +-------------+ . +-----------+ | ||
9357 | * | application | . | ||
9358 | * |-------------| . | ||
9359 | * | | . | ||
9360 | * | | . | ||
9361 | * +-------------+ . | ||
9362 | * . | ||
9363 | * React Core . General Purpose Event Plugin System | ||
9364 | */ | ||
9365 | |||
9366 | var hasEventPageXY; | ||
9367 | var alreadyListeningTo = {}; | ||
9368 | var isMonitoringScrollValue = false; | ||
9369 | var reactTopListenersCounter = 0; | ||
9370 | |||
9371 | // For events like 'submit' which don't consistently bubble (which we trap at a | ||
9372 | // lower node than `document`), binding at `document` would cause duplicate | ||
9373 | // events so we don't include them here | ||
9374 | var topEventMapping = { | ||
9375 | topAbort: 'abort', | ||
9376 | topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend', | ||
9377 | topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration', | ||
9378 | topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart', | ||
9379 | topBlur: 'blur', | ||
9380 | topCanPlay: 'canplay', | ||
9381 | topCanPlayThrough: 'canplaythrough', | ||
9382 | topChange: 'change', | ||
9383 | topClick: 'click', | ||
9384 | topCompositionEnd: 'compositionend', | ||
9385 | topCompositionStart: 'compositionstart', | ||
9386 | topCompositionUpdate: 'compositionupdate', | ||
9387 | topContextMenu: 'contextmenu', | ||
9388 | topCopy: 'copy', | ||
9389 | topCut: 'cut', | ||
9390 | topDoubleClick: 'dblclick', | ||
9391 | topDrag: 'drag', | ||
9392 | topDragEnd: 'dragend', | ||
9393 | topDragEnter: 'dragenter', | ||
9394 | topDragExit: 'dragexit', | ||
9395 | topDragLeave: 'dragleave', | ||
9396 | topDragOver: 'dragover', | ||
9397 | topDragStart: 'dragstart', | ||
9398 | topDrop: 'drop', | ||
9399 | topDurationChange: 'durationchange', | ||
9400 | topEmptied: 'emptied', | ||
9401 | topEncrypted: 'encrypted', | ||
9402 | topEnded: 'ended', | ||
9403 | topError: 'error', | ||
9404 | topFocus: 'focus', | ||
9405 | topInput: 'input', | ||
9406 | topKeyDown: 'keydown', | ||
9407 | topKeyPress: 'keypress', | ||
9408 | topKeyUp: 'keyup', | ||
9409 | topLoadedData: 'loadeddata', | ||
9410 | topLoadedMetadata: 'loadedmetadata', | ||
9411 | topLoadStart: 'loadstart', | ||
9412 | topMouseDown: 'mousedown', | ||
9413 | topMouseMove: 'mousemove', | ||
9414 | topMouseOut: 'mouseout', | ||
9415 | topMouseOver: 'mouseover', | ||
9416 | topMouseUp: 'mouseup', | ||
9417 | topPaste: 'paste', | ||
9418 | topPause: 'pause', | ||
9419 | topPlay: 'play', | ||
9420 | topPlaying: 'playing', | ||
9421 | topProgress: 'progress', | ||
9422 | topRateChange: 'ratechange', | ||
9423 | topScroll: 'scroll', | ||
9424 | topSeeked: 'seeked', | ||
9425 | topSeeking: 'seeking', | ||
9426 | topSelectionChange: 'selectionchange', | ||
9427 | topStalled: 'stalled', | ||
9428 | topSuspend: 'suspend', | ||
9429 | topTextInput: 'textInput', | ||
9430 | topTimeUpdate: 'timeupdate', | ||
9431 | topTouchCancel: 'touchcancel', | ||
9432 | topTouchEnd: 'touchend', | ||
9433 | topTouchMove: 'touchmove', | ||
9434 | topTouchStart: 'touchstart', | ||
9435 | topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend', | ||
9436 | topVolumeChange: 'volumechange', | ||
9437 | topWaiting: 'waiting', | ||
9438 | topWheel: 'wheel' | ||
9439 | }; | ||
9440 | |||
9441 | /** | ||
9442 | * To ensure no conflicts with other potential React instances on the page | ||
9443 | */ | ||
9444 | var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2); | ||
9445 | |||
9446 | function getListeningForDocument(mountAt) { | ||
9447 | // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` | ||
9448 | // directly. | ||
9449 | if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { | ||
9450 | mountAt[topListenersIDKey] = reactTopListenersCounter++; | ||
9451 | alreadyListeningTo[mountAt[topListenersIDKey]] = {}; | ||
9452 | } | ||
9453 | return alreadyListeningTo[mountAt[topListenersIDKey]]; | ||
9454 | } | ||
9455 | |||
9456 | /** | ||
9457 | * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For | ||
9458 | * example: | ||
9459 | * | ||
9460 | * EventPluginHub.putListener('myID', 'onClick', myFunction); | ||
9461 | * | ||
9462 | * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. | ||
9463 | * | ||
9464 | * @internal | ||
9465 | */ | ||
9466 | var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, { | ||
9467 | |||
9468 | /** | ||
9469 | * Injectable event backend | ||
9470 | */ | ||
9471 | ReactEventListener: null, | ||
9472 | |||
9473 | injection: { | ||
9474 | /** | ||
9475 | * @param {object} ReactEventListener | ||
9476 | */ | ||
9477 | injectReactEventListener: function (ReactEventListener) { | ||
9478 | ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel); | ||
9479 | ReactBrowserEventEmitter.ReactEventListener = ReactEventListener; | ||
9480 | } | ||
9481 | }, | ||
9482 | |||
9483 | /** | ||
9484 | * Sets whether or not any created callbacks should be enabled. | ||
9485 | * | ||
9486 | * @param {boolean} enabled True if callbacks should be enabled. | ||
9487 | */ | ||
9488 | setEnabled: function (enabled) { | ||
9489 | if (ReactBrowserEventEmitter.ReactEventListener) { | ||
9490 | ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled); | ||
9491 | } | ||
9492 | }, | ||
9493 | |||
9494 | /** | ||
9495 | * @return {boolean} True if callbacks are enabled. | ||
9496 | */ | ||
9497 | isEnabled: function () { | ||
9498 | return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled()); | ||
9499 | }, | ||
9500 | |||
9501 | /** | ||
9502 | * We listen for bubbled touch events on the document object. | ||
9503 | * | ||
9504 | * Firefox v8.01 (and possibly others) exhibited strange behavior when | ||
9505 | * mounting `onmousemove` events at some node that was not the document | ||
9506 | * element. The symptoms were that if your mouse is not moving over something | ||
9507 | * contained within that mount point (for example on the background) the | ||
9508 | * top-level listeners for `onmousemove` won't be called. However, if you | ||
9509 | * register the `mousemove` on the document object, then it will of course | ||
9510 | * catch all `mousemove`s. This along with iOS quirks, justifies restricting | ||
9511 | * top-level listeners to the document object only, at least for these | ||
9512 | * movement types of events and possibly all events. | ||
9513 | * | ||
9514 | * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html | ||
9515 | * | ||
9516 | * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but | ||
9517 | * they bubble to document. | ||
9518 | * | ||
9519 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
9520 | * @param {object} contentDocumentHandle Document which owns the container | ||
9521 | */ | ||
9522 | listenTo: function (registrationName, contentDocumentHandle) { | ||
9523 | var mountAt = contentDocumentHandle; | ||
9524 | var isListening = getListeningForDocument(mountAt); | ||
9525 | var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName]; | ||
9526 | |||
9527 | for (var i = 0; i < dependencies.length; i++) { | ||
9528 | var dependency = dependencies[i]; | ||
9529 | if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { | ||
9530 | if (dependency === 'topWheel') { | ||
9531 | if (isEventSupported('wheel')) { | ||
9532 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt); | ||
9533 | } else if (isEventSupported('mousewheel')) { | ||
9534 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt); | ||
9535 | } else { | ||
9536 | // Firefox needs to capture a different mouse scroll event. | ||
9537 | // @see http://www.quirksmode.org/dom/events/tests/scroll.html | ||
9538 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt); | ||
9539 | } | ||
9540 | } else if (dependency === 'topScroll') { | ||
9541 | |||
9542 | if (isEventSupported('scroll', true)) { | ||
9543 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt); | ||
9544 | } else { | ||
9545 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE); | ||
9546 | } | ||
9547 | } else if (dependency === 'topFocus' || dependency === 'topBlur') { | ||
9548 | |||
9549 | if (isEventSupported('focus', true)) { | ||
9550 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt); | ||
9551 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt); | ||
9552 | } else if (isEventSupported('focusin')) { | ||
9553 | // IE has `focusin` and `focusout` events which bubble. | ||
9554 | // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html | ||
9555 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt); | ||
9556 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt); | ||
9557 | } | ||
9558 | |||
9559 | // to make sure blur and focus event listeners are only attached once | ||
9560 | isListening.topBlur = true; | ||
9561 | isListening.topFocus = true; | ||
9562 | } else if (topEventMapping.hasOwnProperty(dependency)) { | ||
9563 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt); | ||
9564 | } | ||
9565 | |||
9566 | isListening[dependency] = true; | ||
9567 | } | ||
9568 | } | ||
9569 | }, | ||
9570 | |||
9571 | trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { | ||
9572 | return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle); | ||
9573 | }, | ||
9574 | |||
9575 | trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { | ||
9576 | return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle); | ||
9577 | }, | ||
9578 | |||
9579 | /** | ||
9580 | * Protect against document.createEvent() returning null | ||
9581 | * Some popup blocker extensions appear to do this: | ||
9582 | * https://github.com/facebook/react/issues/6887 | ||
9583 | */ | ||
9584 | supportsEventPageXY: function () { | ||
9585 | if (!document.createEvent) { | ||
9586 | return false; | ||
9587 | } | ||
9588 | var ev = document.createEvent('MouseEvent'); | ||
9589 | return ev != null && 'pageX' in ev; | ||
9590 | }, | ||
9591 | |||
9592 | /** | ||
9593 | * Listens to window scroll and resize events. We cache scroll values so that | ||
9594 | * application code can access them without triggering reflows. | ||
9595 | * | ||
9596 | * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when | ||
9597 | * pageX/pageY isn't supported (legacy browsers). | ||
9598 | * | ||
9599 | * NOTE: Scroll events do not bubble. | ||
9600 | * | ||
9601 | * @see http://www.quirksmode.org/dom/events/scroll.html | ||
9602 | */ | ||
9603 | ensureScrollValueMonitoring: function () { | ||
9604 | if (hasEventPageXY === undefined) { | ||
9605 | hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY(); | ||
9606 | } | ||
9607 | if (!hasEventPageXY && !isMonitoringScrollValue) { | ||
9608 | var refresh = ViewportMetrics.refreshScrollValues; | ||
9609 | ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh); | ||
9610 | isMonitoringScrollValue = true; | ||
9611 | } | ||
9612 | } | ||
9613 | |||
9614 | }); | ||
9615 | |||
9616 | module.exports = ReactBrowserEventEmitter; | ||
9617 | |||
9618 | /***/ }), | ||
9619 | /* 55 */ | ||
9620 | /***/ (function(module, exports, __webpack_require__) { | ||
9621 | |||
9622 | "use strict"; | ||
9623 | /** | ||
9624 | * Copyright 2013-present, Facebook, Inc. | ||
9625 | * All rights reserved. | ||
9626 | * | ||
9627 | * This source code is licensed under the BSD-style license found in the | ||
9628 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9629 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9630 | * | ||
9631 | */ | ||
9632 | |||
9633 | |||
9634 | |||
9635 | var SyntheticUIEvent = __webpack_require__(48); | ||
9636 | var ViewportMetrics = __webpack_require__(130); | ||
9637 | |||
9638 | var getEventModifierState = __webpack_require__(85); | ||
9639 | |||
9640 | /** | ||
9641 | * @interface MouseEvent | ||
9642 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
9643 | */ | ||
9644 | var MouseEventInterface = { | ||
9645 | screenX: null, | ||
9646 | screenY: null, | ||
9647 | clientX: null, | ||
9648 | clientY: null, | ||
9649 | ctrlKey: null, | ||
9650 | shiftKey: null, | ||
9651 | altKey: null, | ||
9652 | metaKey: null, | ||
9653 | getModifierState: getEventModifierState, | ||
9654 | button: function (event) { | ||
9655 | // Webkit, Firefox, IE9+ | ||
9656 | // which: 1 2 3 | ||
9657 | // button: 0 1 2 (standard) | ||
9658 | var button = event.button; | ||
9659 | if ('which' in event) { | ||
9660 | return button; | ||
9661 | } | ||
9662 | // IE<9 | ||
9663 | // which: undefined | ||
9664 | // button: 0 0 0 | ||
9665 | // button: 1 4 2 (onmouseup) | ||
9666 | return button === 2 ? 2 : button === 4 ? 1 : 0; | ||
9667 | }, | ||
9668 | buttons: null, | ||
9669 | relatedTarget: function (event) { | ||
9670 | return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); | ||
9671 | }, | ||
9672 | // "Proprietary" Interface. | ||
9673 | pageX: function (event) { | ||
9674 | return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft; | ||
9675 | }, | ||
9676 | pageY: function (event) { | ||
9677 | return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; | ||
9678 | } | ||
9679 | }; | ||
9680 | |||
9681 | /** | ||
9682 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
9683 | * @param {string} dispatchMarker Marker identifying the event target. | ||
9684 | * @param {object} nativeEvent Native browser event. | ||
9685 | * @extends {SyntheticUIEvent} | ||
9686 | */ | ||
9687 | function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
9688 | return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
9689 | } | ||
9690 | |||
9691 | SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); | ||
9692 | |||
9693 | module.exports = SyntheticMouseEvent; | ||
9694 | |||
9695 | /***/ }), | ||
9696 | /* 56 */ | ||
9697 | /***/ (function(module, exports, __webpack_require__) { | ||
9698 | |||
9699 | "use strict"; | ||
9700 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
9701 | * Copyright 2013-present, Facebook, Inc. | ||
9702 | * All rights reserved. | ||
9703 | * | ||
9704 | * This source code is licensed under the BSD-style license found in the | ||
9705 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9706 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9707 | * | ||
9708 | * | ||
9709 | */ | ||
9710 | |||
9711 | |||
9712 | |||
9713 | var _prodInvariant = __webpack_require__(3); | ||
9714 | |||
9715 | var invariant = __webpack_require__(1); | ||
9716 | |||
9717 | var OBSERVED_ERROR = {}; | ||
9718 | |||
9719 | /** | ||
9720 | * `Transaction` creates a black box that is able to wrap any method such that | ||
9721 | * certain invariants are maintained before and after the method is invoked | ||
9722 | * (Even if an exception is thrown while invoking the wrapped method). Whoever | ||
9723 | * instantiates a transaction can provide enforcers of the invariants at | ||
9724 | * creation time. The `Transaction` class itself will supply one additional | ||
9725 | * automatic invariant for you - the invariant that any transaction instance | ||
9726 | * should not be run while it is already being run. You would typically create a | ||
9727 | * single instance of a `Transaction` for reuse multiple times, that potentially | ||
9728 | * is used to wrap several different methods. Wrappers are extremely simple - | ||
9729 | * they only require implementing two methods. | ||
9730 | * | ||
9731 | * <pre> | ||
9732 | * wrappers (injected at creation time) | ||
9733 | * + + | ||
9734 | * | | | ||
9735 | * +-----------------|--------|--------------+ | ||
9736 | * | v | | | ||
9737 | * | +---------------+ | | | ||
9738 | * | +--| wrapper1 |---|----+ | | ||
9739 | * | | +---------------+ v | | | ||
9740 | * | | +-------------+ | | | ||
9741 | * | | +----| wrapper2 |--------+ | | ||
9742 | * | | | +-------------+ | | | | ||
9743 | * | | | | | | | ||
9744 | * | v v v v | wrapper | ||
9745 | * | +---+ +---+ +---------+ +---+ +---+ | invariants | ||
9746 | * perform(anyMethod) | | | | | | | | | | | | maintained | ||
9747 | * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|--------> | ||
9748 | * | | | | | | | | | | | | | ||
9749 | * | | | | | | | | | | | | | ||
9750 | * | | | | | | | | | | | | | ||
9751 | * | +---+ +---+ +---------+ +---+ +---+ | | ||
9752 | * | initialize close | | ||
9753 | * +-----------------------------------------+ | ||
9754 | * </pre> | ||
9755 | * | ||
9756 | * Use cases: | ||
9757 | * - Preserving the input selection ranges before/after reconciliation. | ||
9758 | * Restoring selection even in the event of an unexpected error. | ||
9759 | * - Deactivating events while rearranging the DOM, preventing blurs/focuses, | ||
9760 | * while guaranteeing that afterwards, the event system is reactivated. | ||
9761 | * - Flushing a queue of collected DOM mutations to the main UI thread after a | ||
9762 | * reconciliation takes place in a worker thread. | ||
9763 | * - Invoking any collected `componentDidUpdate` callbacks after rendering new | ||
9764 | * content. | ||
9765 | * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue | ||
9766 | * to preserve the `scrollTop` (an automatic scroll aware DOM). | ||
9767 | * - (Future use case): Layout calculations before and after DOM updates. | ||
9768 | * | ||
9769 | * Transactional plugin API: | ||
9770 | * - A module that has an `initialize` method that returns any precomputation. | ||
9771 | * - and a `close` method that accepts the precomputation. `close` is invoked | ||
9772 | * when the wrapped process is completed, or has failed. | ||
9773 | * | ||
9774 | * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules | ||
9775 | * that implement `initialize` and `close`. | ||
9776 | * @return {Transaction} Single transaction for reuse in thread. | ||
9777 | * | ||
9778 | * @class Transaction | ||
9779 | */ | ||
9780 | var TransactionImpl = { | ||
9781 | /** | ||
9782 | * Sets up this instance so that it is prepared for collecting metrics. Does | ||
9783 | * so such that this setup method may be used on an instance that is already | ||
9784 | * initialized, in a way that does not consume additional memory upon reuse. | ||
9785 | * That can be useful if you decide to make your subclass of this mixin a | ||
9786 | * "PooledClass". | ||
9787 | */ | ||
9788 | reinitializeTransaction: function () { | ||
9789 | this.transactionWrappers = this.getTransactionWrappers(); | ||
9790 | if (this.wrapperInitData) { | ||
9791 | this.wrapperInitData.length = 0; | ||
9792 | } else { | ||
9793 | this.wrapperInitData = []; | ||
9794 | } | ||
9795 | this._isInTransaction = false; | ||
9796 | }, | ||
9797 | |||
9798 | _isInTransaction: false, | ||
9799 | |||
9800 | /** | ||
9801 | * @abstract | ||
9802 | * @return {Array<TransactionWrapper>} Array of transaction wrappers. | ||
9803 | */ | ||
9804 | getTransactionWrappers: null, | ||
9805 | |||
9806 | isInTransaction: function () { | ||
9807 | return !!this._isInTransaction; | ||
9808 | }, | ||
9809 | |||
9810 | /** | ||
9811 | * Executes the function within a safety window. Use this for the top level | ||
9812 | * methods that result in large amounts of computation/mutations that would | ||
9813 | * need to be safety checked. The optional arguments helps prevent the need | ||
9814 | * to bind in many cases. | ||
9815 | * | ||
9816 | * @param {function} method Member of scope to call. | ||
9817 | * @param {Object} scope Scope to invoke from. | ||
9818 | * @param {Object?=} a Argument to pass to the method. | ||
9819 | * @param {Object?=} b Argument to pass to the method. | ||
9820 | * @param {Object?=} c Argument to pass to the method. | ||
9821 | * @param {Object?=} d Argument to pass to the method. | ||
9822 | * @param {Object?=} e Argument to pass to the method. | ||
9823 | * @param {Object?=} f Argument to pass to the method. | ||
9824 | * | ||
9825 | * @return {*} Return value from `method`. | ||
9826 | */ | ||
9827 | perform: function (method, scope, a, b, c, d, e, f) { | ||
9828 | !!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; | ||
9829 | var errorThrown; | ||
9830 | var ret; | ||
9831 | try { | ||
9832 | this._isInTransaction = true; | ||
9833 | // Catching errors makes debugging more difficult, so we start with | ||
9834 | // errorThrown set to true before setting it to false after calling | ||
9835 | // close -- if it's still set to true in the finally block, it means | ||
9836 | // one of these calls threw. | ||
9837 | errorThrown = true; | ||
9838 | this.initializeAll(0); | ||
9839 | ret = method.call(scope, a, b, c, d, e, f); | ||
9840 | errorThrown = false; | ||
9841 | } finally { | ||
9842 | try { | ||
9843 | if (errorThrown) { | ||
9844 | // If `method` throws, prefer to show that stack trace over any thrown | ||
9845 | // by invoking `closeAll`. | ||
9846 | try { | ||
9847 | this.closeAll(0); | ||
9848 | } catch (err) {} | ||
9849 | } else { | ||
9850 | // Since `method` didn't throw, we don't want to silence the exception | ||
9851 | // here. | ||
9852 | this.closeAll(0); | ||
9853 | } | ||
9854 | } finally { | ||
9855 | this._isInTransaction = false; | ||
9856 | } | ||
9857 | } | ||
9858 | return ret; | ||
9859 | }, | ||
9860 | |||
9861 | initializeAll: function (startIndex) { | ||
9862 | var transactionWrappers = this.transactionWrappers; | ||
9863 | for (var i = startIndex; i < transactionWrappers.length; i++) { | ||
9864 | var wrapper = transactionWrappers[i]; | ||
9865 | try { | ||
9866 | // Catching errors makes debugging more difficult, so we start with the | ||
9867 | // OBSERVED_ERROR state before overwriting it with the real return value | ||
9868 | // of initialize -- if it's still set to OBSERVED_ERROR in the finally | ||
9869 | // block, it means wrapper.initialize threw. | ||
9870 | this.wrapperInitData[i] = OBSERVED_ERROR; | ||
9871 | this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null; | ||
9872 | } finally { | ||
9873 | if (this.wrapperInitData[i] === OBSERVED_ERROR) { | ||
9874 | // The initializer for wrapper i threw an error; initialize the | ||
9875 | // remaining wrappers but silence any exceptions from them to ensure | ||
9876 | // that the first error is the one to bubble up. | ||
9877 | try { | ||
9878 | this.initializeAll(i + 1); | ||
9879 | } catch (err) {} | ||
9880 | } | ||
9881 | } | ||
9882 | } | ||
9883 | }, | ||
9884 | |||
9885 | /** | ||
9886 | * Invokes each of `this.transactionWrappers.close[i]` functions, passing into | ||
9887 | * them the respective return values of `this.transactionWrappers.init[i]` | ||
9888 | * (`close`rs that correspond to initializers that failed will not be | ||
9889 | * invoked). | ||
9890 | */ | ||
9891 | closeAll: function (startIndex) { | ||
9892 | !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0; | ||
9893 | var transactionWrappers = this.transactionWrappers; | ||
9894 | for (var i = startIndex; i < transactionWrappers.length; i++) { | ||
9895 | var wrapper = transactionWrappers[i]; | ||
9896 | var initData = this.wrapperInitData[i]; | ||
9897 | var errorThrown; | ||
9898 | try { | ||
9899 | // Catching errors makes debugging more difficult, so we start with | ||
9900 | // errorThrown set to true before setting it to false after calling | ||
9901 | // close -- if it's still set to true in the finally block, it means | ||
9902 | // wrapper.close threw. | ||
9903 | errorThrown = true; | ||
9904 | if (initData !== OBSERVED_ERROR && wrapper.close) { | ||
9905 | wrapper.close.call(this, initData); | ||
9906 | } | ||
9907 | errorThrown = false; | ||
9908 | } finally { | ||
9909 | if (errorThrown) { | ||
9910 | // The closer for wrapper i threw an error; close the remaining | ||
9911 | // wrappers but silence any exceptions from them to ensure that the | ||
9912 | // first error is the one to bubble up. | ||
9913 | try { | ||
9914 | this.closeAll(i + 1); | ||
9915 | } catch (e) {} | ||
9916 | } | ||
9917 | } | ||
9918 | } | ||
9919 | this.wrapperInitData.length = 0; | ||
9920 | } | ||
9921 | }; | ||
9922 | |||
9923 | module.exports = TransactionImpl; | ||
9924 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
9925 | |||
9926 | /***/ }), | ||
9927 | /* 57 */ | ||
9928 | /***/ (function(module, exports, __webpack_require__) { | ||
9929 | |||
9930 | "use strict"; | ||
9931 | /** | ||
9932 | * Copyright 2016-present, Facebook, Inc. | ||
9933 | * All rights reserved. | ||
9934 | * | ||
9935 | * This source code is licensed under the BSD-style license found in the | ||
9936 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9937 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9938 | * | ||
9939 | * Based on the escape-html library, which is used under the MIT License below: | ||
9940 | * | ||
9941 | * Copyright (c) 2012-2013 TJ Holowaychuk | ||
9942 | * Copyright (c) 2015 Andreas Lubbe | ||
9943 | * Copyright (c) 2015 Tiancheng "Timothy" Gu | ||
9944 | * | ||
9945 | * Permission is hereby granted, free of charge, to any person obtaining | ||
9946 | * a copy of this software and associated documentation files (the | ||
9947 | * 'Software'), to deal in the Software without restriction, including | ||
9948 | * without limitation the rights to use, copy, modify, merge, publish, | ||
9949 | * distribute, sublicense, and/or sell copies of the Software, and to | ||
9950 | * permit persons to whom the Software is furnished to do so, subject to | ||
9951 | * the following conditions: | ||
9952 | * | ||
9953 | * The above copyright notice and this permission notice shall be | ||
9954 | * included in all copies or substantial portions of the Software. | ||
9955 | * | ||
9956 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||
9957 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
9958 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
9959 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
9960 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
9961 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
9962 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
9963 | * | ||
9964 | */ | ||
9965 | |||
9966 | |||
9967 | |||
9968 | // code copied and modified from escape-html | ||
9969 | /** | ||
9970 | * Module variables. | ||
9971 | * @private | ||
9972 | */ | ||
9973 | |||
9974 | var matchHtmlRegExp = /["'&<>]/; | ||
9975 | |||
9976 | /** | ||
9977 | * Escape special characters in the given string of html. | ||
9978 | * | ||
9979 | * @param {string} string The string to escape for inserting into HTML | ||
9980 | * @return {string} | ||
9981 | * @public | ||
9982 | */ | ||
9983 | |||
9984 | function escapeHtml(string) { | ||
9985 | var str = '' + string; | ||
9986 | var match = matchHtmlRegExp.exec(str); | ||
9987 | |||
9988 | if (!match) { | ||
9989 | return str; | ||
9990 | } | ||
9991 | |||
9992 | var escape; | ||
9993 | var html = ''; | ||
9994 | var index = 0; | ||
9995 | var lastIndex = 0; | ||
9996 | |||
9997 | for (index = match.index; index < str.length; index++) { | ||
9998 | switch (str.charCodeAt(index)) { | ||
9999 | case 34: | ||
10000 | // " | ||
10001 | escape = '"'; | ||
10002 | break; | ||
10003 | case 38: | ||
10004 | // & | ||
10005 | escape = '&'; | ||
10006 | break; | ||
10007 | case 39: | ||
10008 | // ' | ||
10009 | escape = '''; // modified from escape-html; used to be ''' | ||
10010 | break; | ||
10011 | case 60: | ||
10012 | // < | ||
10013 | escape = '<'; | ||
10014 | break; | ||
10015 | case 62: | ||
10016 | // > | ||
10017 | escape = '>'; | ||
10018 | break; | ||
10019 | default: | ||
10020 | continue; | ||
10021 | } | ||
10022 | |||
10023 | if (lastIndex !== index) { | ||
10024 | html += str.substring(lastIndex, index); | ||
10025 | } | ||
10026 | |||
10027 | lastIndex = index + 1; | ||
10028 | html += escape; | ||
10029 | } | ||
10030 | |||
10031 | return lastIndex !== index ? html + str.substring(lastIndex, index) : html; | ||
10032 | } | ||
10033 | // end code copied and modified from escape-html | ||
10034 | |||
10035 | |||
10036 | /** | ||
10037 | * Escapes text to prevent scripting attacks. | ||
10038 | * | ||
10039 | * @param {*} text Text value to escape. | ||
10040 | * @return {string} An escaped string. | ||
10041 | */ | ||
10042 | function escapeTextContentForBrowser(text) { | ||
10043 | if (typeof text === 'boolean' || typeof text === 'number') { | ||
10044 | // this shortcircuit helps perf for types that we know will never have | ||
10045 | // special characters, especially given that this function is used often | ||
10046 | // for numeric dom ids. | ||
10047 | return '' + text; | ||
10048 | } | ||
10049 | return escapeHtml(text); | ||
10050 | } | ||
10051 | |||
10052 | module.exports = escapeTextContentForBrowser; | ||
10053 | |||
10054 | /***/ }), | ||
10055 | /* 58 */ | ||
10056 | /***/ (function(module, exports, __webpack_require__) { | ||
10057 | |||
10058 | "use strict"; | ||
10059 | /** | ||
10060 | * Copyright 2013-present, Facebook, Inc. | ||
10061 | * All rights reserved. | ||
10062 | * | ||
10063 | * This source code is licensed under the BSD-style license found in the | ||
10064 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10065 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10066 | * | ||
10067 | */ | ||
10068 | |||
10069 | |||
10070 | |||
10071 | var ExecutionEnvironment = __webpack_require__(7); | ||
10072 | var DOMNamespaces = __webpack_require__(76); | ||
10073 | |||
10074 | var WHITESPACE_TEST = /^[ \r\n\t\f]/; | ||
10075 | var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; | ||
10076 | |||
10077 | var createMicrosoftUnsafeLocalFunction = __webpack_require__(83); | ||
10078 | |||
10079 | // SVG temp container for IE lacking innerHTML | ||
10080 | var reusableSVGContainer; | ||
10081 | |||
10082 | /** | ||
10083 | * Set the innerHTML property of a node, ensuring that whitespace is preserved | ||
10084 | * even in IE8. | ||
10085 | * | ||
10086 | * @param {DOMElement} node | ||
10087 | * @param {string} html | ||
10088 | * @internal | ||
10089 | */ | ||
10090 | var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) { | ||
10091 | // IE does not have innerHTML for SVG nodes, so instead we inject the | ||
10092 | // new markup in a temp node and then move the child nodes across into | ||
10093 | // the target node | ||
10094 | if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) { | ||
10095 | reusableSVGContainer = reusableSVGContainer || document.createElement('div'); | ||
10096 | reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>'; | ||
10097 | var svgNode = reusableSVGContainer.firstChild; | ||
10098 | while (svgNode.firstChild) { | ||
10099 | node.appendChild(svgNode.firstChild); | ||
10100 | } | ||
10101 | } else { | ||
10102 | node.innerHTML = html; | ||
10103 | } | ||
10104 | }); | ||
10105 | |||
10106 | if (ExecutionEnvironment.canUseDOM) { | ||
10107 | // IE8: When updating a just created node with innerHTML only leading | ||
10108 | // whitespace is removed. When updating an existing node with innerHTML | ||
10109 | // whitespace in root TextNodes is also collapsed. | ||
10110 | // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html | ||
10111 | |||
10112 | // Feature detection; only IE8 is known to behave improperly like this. | ||
10113 | var testElement = document.createElement('div'); | ||
10114 | testElement.innerHTML = ' '; | ||
10115 | if (testElement.innerHTML === '') { | ||
10116 | setInnerHTML = function (node, html) { | ||
10117 | // Magic theory: IE8 supposedly differentiates between added and updated | ||
10118 | // nodes when processing innerHTML, innerHTML on updated nodes suffers | ||
10119 | // from worse whitespace behavior. Re-adding a node like this triggers | ||
10120 | // the initial and more favorable whitespace behavior. | ||
10121 | // TODO: What to do on a detached node? | ||
10122 | if (node.parentNode) { | ||
10123 | node.parentNode.replaceChild(node, node); | ||
10124 | } | ||
10125 | |||
10126 | // We also implement a workaround for non-visible tags disappearing into | ||
10127 | // thin air on IE8, this only happens if there is no visible text | ||
10128 | // in-front of the non-visible tags. Piggyback on the whitespace fix | ||
10129 | // and simply check if any non-visible tags appear in the source. | ||
10130 | if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) { | ||
10131 | // Recover leading whitespace by temporarily prepending any character. | ||
10132 | // \uFEFF has the potential advantage of being zero-width/invisible. | ||
10133 | // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode | ||
10134 | // in hopes that this is preserved even if "\uFEFF" is transformed to | ||
10135 | // the actual Unicode character (by Babel, for example). | ||
10136 | // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216 | ||
10137 | node.innerHTML = String.fromCharCode(0xFEFF) + html; | ||
10138 | |||
10139 | // deleteData leaves an empty `TextNode` which offsets the index of all | ||
10140 | // children. Definitely want to avoid this. | ||
10141 | var textNode = node.firstChild; | ||
10142 | if (textNode.data.length === 1) { | ||
10143 | node.removeChild(textNode); | ||
10144 | } else { | ||
10145 | textNode.deleteData(0, 1); | ||
10146 | } | ||
10147 | } else { | ||
10148 | node.innerHTML = html; | ||
10149 | } | ||
10150 | }; | ||
10151 | } | ||
10152 | testElement = null; | ||
10153 | } | ||
10154 | |||
10155 | module.exports = setInnerHTML; | ||
10156 | |||
10157 | /***/ }), | ||
10158 | /* 59 */ | ||
10159 | /***/ (function(module, exports, __webpack_require__) { | ||
10160 | |||
10161 | "use strict"; | ||
10162 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
10163 | * Copyright 2013-present, Facebook, Inc. | ||
10164 | * All rights reserved. | ||
10165 | * | ||
10166 | * This source code is licensed under the BSD-style license found in the | ||
10167 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10168 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10169 | * | ||
10170 | * | ||
10171 | */ | ||
10172 | |||
10173 | |||
10174 | |||
10175 | var canDefineProperty = false; | ||
10176 | if (process.env.NODE_ENV !== 'production') { | ||
10177 | try { | ||
10178 | // $FlowFixMe https://github.com/facebook/flow/issues/285 | ||
10179 | Object.defineProperty({}, 'x', { get: function () {} }); | ||
10180 | canDefineProperty = true; | ||
10181 | } catch (x) { | ||
10182 | // IE will fail on defineProperty | ||
10183 | } | ||
10184 | } | ||
10185 | |||
10186 | module.exports = canDefineProperty; | ||
10187 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
10188 | |||
10189 | /***/ }), | ||
10190 | /* 60 */ | ||
10191 | /***/ (function(module, exports) { | ||
10192 | |||
10193 | // 7.2.1 RequireObjectCoercible(argument) | ||
10194 | module.exports = function(it){ | ||
10195 | if(it == undefined)throw TypeError("Can't call method on " + it); | ||
10196 | return it; | ||
10197 | }; | ||
10198 | |||
10199 | /***/ }), | ||
10200 | /* 61 */ | ||
10201 | /***/ (function(module, exports) { | ||
10202 | |||
10203 | // IE 8- don't enum bug keys | ||
10204 | module.exports = ( | ||
10205 | 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' | ||
10206 | ).split(','); | ||
10207 | |||
10208 | /***/ }), | ||
10209 | /* 62 */ | ||
10210 | /***/ (function(module, exports) { | ||
10211 | |||
10212 | module.exports = {}; | ||
10213 | |||
10214 | /***/ }), | ||
10215 | /* 63 */ | ||
10216 | /***/ (function(module, exports) { | ||
10217 | |||
10218 | module.exports = true; | ||
10219 | |||
10220 | /***/ }), | ||
10221 | /* 64 */ | ||
10222 | /***/ (function(module, exports, __webpack_require__) { | ||
10223 | |||
10224 | // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) | ||
10225 | var anObject = __webpack_require__(40) | ||
10226 | , dPs = __webpack_require__(184) | ||
10227 | , enumBugKeys = __webpack_require__(61) | ||
10228 | , IE_PROTO = __webpack_require__(67)('IE_PROTO') | ||
10229 | , Empty = function(){ /* empty */ } | ||
10230 | , PROTOTYPE = 'prototype'; | ||
10231 | |||
10232 | // Create object with fake `null` prototype: use iframe Object with cleared prototype | ||
10233 | var createDict = function(){ | ||
10234 | // Thrash, waste and sodomy: IE GC bug | ||
10235 | var iframe = __webpack_require__(99)('iframe') | ||
10236 | , i = enumBugKeys.length | ||
10237 | , lt = '<' | ||
10238 | , gt = '>' | ||
10239 | , iframeDocument; | ||
10240 | iframe.style.display = 'none'; | ||
10241 | __webpack_require__(177).appendChild(iframe); | ||
10242 | iframe.src = 'javascript:'; // eslint-disable-line no-script-url | ||
10243 | // createDict = iframe.contentWindow.Object; | ||
10244 | // html.removeChild(iframe); | ||
10245 | iframeDocument = iframe.contentWindow.document; | ||
10246 | iframeDocument.open(); | ||
10247 | iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); | ||
10248 | iframeDocument.close(); | ||
10249 | createDict = iframeDocument.F; | ||
10250 | while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]]; | ||
10251 | return createDict(); | ||
10252 | }; | ||
10253 | |||
10254 | module.exports = Object.create || function create(O, Properties){ | ||
10255 | var result; | ||
10256 | if(O !== null){ | ||
10257 | Empty[PROTOTYPE] = anObject(O); | ||
10258 | result = new Empty; | ||
10259 | Empty[PROTOTYPE] = null; | ||
10260 | // add "__proto__" for Object.getPrototypeOf polyfill | ||
10261 | result[IE_PROTO] = O; | ||
10262 | } else result = createDict(); | ||
10263 | return Properties === undefined ? result : dPs(result, Properties); | ||
10264 | }; | ||
10265 | |||
10266 | |||
10267 | /***/ }), | ||
10268 | /* 65 */ | ||
10269 | /***/ (function(module, exports) { | ||
10270 | |||
10271 | exports.f = Object.getOwnPropertySymbols; | ||
10272 | |||
10273 | /***/ }), | ||
10274 | /* 66 */ | ||
10275 | /***/ (function(module, exports, __webpack_require__) { | ||
10276 | |||
10277 | var def = __webpack_require__(27).f | ||
10278 | , has = __webpack_require__(26) | ||
10279 | , TAG = __webpack_require__(35)('toStringTag'); | ||
10280 | |||
10281 | module.exports = function(it, tag, stat){ | ||
10282 | if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); | ||
10283 | }; | ||
10284 | |||
10285 | /***/ }), | ||
10286 | /* 67 */ | ||
10287 | /***/ (function(module, exports, __webpack_require__) { | ||
10288 | |||
10289 | var shared = __webpack_require__(68)('keys') | ||
10290 | , uid = __webpack_require__(52); | ||
10291 | module.exports = function(key){ | ||
10292 | return shared[key] || (shared[key] = uid(key)); | ||
10293 | }; | ||
10294 | |||
10295 | /***/ }), | ||
10296 | /* 68 */ | ||
10297 | /***/ (function(module, exports, __webpack_require__) { | ||
10298 | |||
10299 | var global = __webpack_require__(20) | ||
10300 | , SHARED = '__core-js_shared__' | ||
10301 | , store = global[SHARED] || (global[SHARED] = {}); | ||
10302 | module.exports = function(key){ | ||
10303 | return store[key] || (store[key] = {}); | ||
10304 | }; | ||
10305 | |||
10306 | /***/ }), | ||
10307 | /* 69 */ | ||
10308 | /***/ (function(module, exports) { | ||
10309 | |||
10310 | // 7.1.4 ToInteger | ||
10311 | var ceil = Math.ceil | ||
10312 | , floor = Math.floor; | ||
10313 | module.exports = function(it){ | ||
10314 | return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); | ||
10315 | }; | ||
10316 | |||
10317 | /***/ }), | ||
10318 | /* 70 */ | ||
10319 | /***/ (function(module, exports, __webpack_require__) { | ||
10320 | |||
10321 | // 7.1.1 ToPrimitive(input [, PreferredType]) | ||
10322 | var isObject = __webpack_require__(42); | ||
10323 | // instead of the ES6 spec version, we didn't implement @@toPrimitive case | ||
10324 | // and the second argument - flag - preferred type is a string | ||
10325 | module.exports = function(it, S){ | ||
10326 | if(!isObject(it))return it; | ||
10327 | var fn, val; | ||
10328 | if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; | ||
10329 | if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; | ||
10330 | if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; | ||
10331 | throw TypeError("Can't convert object to primitive value"); | ||
10332 | }; | ||
10333 | |||
10334 | /***/ }), | ||
10335 | /* 71 */ | ||
10336 | /***/ (function(module, exports, __webpack_require__) { | ||
10337 | |||
10338 | var global = __webpack_require__(20) | ||
10339 | , core = __webpack_require__(24) | ||
10340 | , LIBRARY = __webpack_require__(63) | ||
10341 | , wksExt = __webpack_require__(72) | ||
10342 | , defineProperty = __webpack_require__(27).f; | ||
10343 | module.exports = function(name){ | ||
10344 | var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); | ||
10345 | if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)}); | ||
10346 | }; | ||
10347 | |||
10348 | /***/ }), | ||
10349 | /* 72 */ | ||
10350 | /***/ (function(module, exports, __webpack_require__) { | ||
10351 | |||
10352 | exports.f = __webpack_require__(35); | ||
10353 | |||
10354 | /***/ }), | ||
10355 | /* 73 */ | ||
10356 | /***/ (function(module, exports, __webpack_require__) { | ||
10357 | |||
10358 | "use strict"; | ||
10359 | /** | ||
10360 | * Copyright (c) 2013-present, Facebook, Inc. | ||
10361 | * All rights reserved. | ||
10362 | * | ||
10363 | * This source code is licensed under the BSD-style license found in the | ||
10364 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10365 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10366 | * | ||
10367 | * @typechecks | ||
10368 | * | ||
10369 | */ | ||
10370 | |||
10371 | /*eslint-disable no-self-compare */ | ||
10372 | |||
10373 | |||
10374 | |||
10375 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
10376 | |||
10377 | /** | ||
10378 | * inlined Object.is polyfill to avoid requiring consumers ship their own | ||
10379 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | ||
10380 | */ | ||
10381 | function is(x, y) { | ||
10382 | // SameValue algorithm | ||
10383 | if (x === y) { | ||
10384 | // Steps 1-5, 7-10 | ||
10385 | // Steps 6.b-6.e: +0 != -0 | ||
10386 | // Added the nonzero y check to make Flow happy, but it is redundant | ||
10387 | return x !== 0 || y !== 0 || 1 / x === 1 / y; | ||
10388 | } else { | ||
10389 | // Step 6.a: NaN == NaN | ||
10390 | return x !== x && y !== y; | ||
10391 | } | ||
10392 | } | ||
10393 | |||
10394 | /** | ||
10395 | * Performs equality by iterating through keys on an object and returning false | ||
10396 | * when any key has values which are not strictly equal between the arguments. | ||
10397 | * Returns true when the values of all keys are strictly equal. | ||
10398 | */ | ||
10399 | function shallowEqual(objA, objB) { | ||
10400 | if (is(objA, objB)) { | ||
10401 | return true; | ||
10402 | } | ||
10403 | |||
10404 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { | ||
10405 | return false; | ||
10406 | } | ||
10407 | |||
10408 | var keysA = Object.keys(objA); | ||
10409 | var keysB = Object.keys(objB); | ||
10410 | |||
10411 | if (keysA.length !== keysB.length) { | ||
10412 | return false; | ||
10413 | } | ||
10414 | |||
10415 | // Test for A's keys different from B. | ||
10416 | for (var i = 0; i < keysA.length; i++) { | ||
10417 | if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { | ||
10418 | return false; | ||
10419 | } | ||
10420 | } | ||
10421 | |||
10422 | return true; | ||
10423 | } | ||
10424 | |||
10425 | module.exports = shallowEqual; | ||
10426 | |||
10427 | /***/ }), | ||
10428 | /* 74 */ | ||
10429 | /***/ (function(module, exports, __webpack_require__) { | ||
10430 | |||
10431 | "use strict"; | ||
10432 | /** | ||
10433 | * Copyright 2013-present, Facebook, Inc. | ||
10434 | * All rights reserved. | ||
10435 | * | ||
10436 | * This source code is licensed under the BSD-style license found in the | ||
10437 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10438 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10439 | */ | ||
10440 | |||
10441 | |||
10442 | |||
10443 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | ||
10444 | |||
10445 | module.exports = ReactPropTypesSecret; | ||
10446 | |||
10447 | |||
10448 | /***/ }), | ||
10449 | /* 75 */ | ||
10450 | /***/ (function(module, exports, __webpack_require__) { | ||
10451 | |||
10452 | "use strict"; | ||
10453 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
10454 | * Copyright 2013-present, Facebook, Inc. | ||
10455 | * All rights reserved. | ||
10456 | * | ||
10457 | * This source code is licensed under the BSD-style license found in the | ||
10458 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10459 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10460 | * | ||
10461 | */ | ||
10462 | |||
10463 | |||
10464 | |||
10465 | var DOMLazyTree = __webpack_require__(37); | ||
10466 | var Danger = __webpack_require__(247); | ||
10467 | var ReactDOMComponentTree = __webpack_require__(6); | ||
10468 | var ReactInstrumentation = __webpack_require__(12); | ||
10469 | |||
10470 | var createMicrosoftUnsafeLocalFunction = __webpack_require__(83); | ||
10471 | var setInnerHTML = __webpack_require__(58); | ||
10472 | var setTextContent = __webpack_require__(137); | ||
10473 | |||
10474 | function getNodeAfter(parentNode, node) { | ||
10475 | // Special case for text components, which return [open, close] comments | ||
10476 | // from getHostNode. | ||
10477 | if (Array.isArray(node)) { | ||
10478 | node = node[1]; | ||
10479 | } | ||
10480 | return node ? node.nextSibling : parentNode.firstChild; | ||
10481 | } | ||
10482 | |||
10483 | /** | ||
10484 | * Inserts `childNode` as a child of `parentNode` at the `index`. | ||
10485 | * | ||
10486 | * @param {DOMElement} parentNode Parent node in which to insert. | ||
10487 | * @param {DOMElement} childNode Child node to insert. | ||
10488 | * @param {number} index Index at which to insert the child. | ||
10489 | * @internal | ||
10490 | */ | ||
10491 | var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) { | ||
10492 | // We rely exclusively on `insertBefore(node, null)` instead of also using | ||
10493 | // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so | ||
10494 | // we are careful to use `null`.) | ||
10495 | parentNode.insertBefore(childNode, referenceNode); | ||
10496 | }); | ||
10497 | |||
10498 | function insertLazyTreeChildAt(parentNode, childTree, referenceNode) { | ||
10499 | DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode); | ||
10500 | } | ||
10501 | |||
10502 | function moveChild(parentNode, childNode, referenceNode) { | ||
10503 | if (Array.isArray(childNode)) { | ||
10504 | moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode); | ||
10505 | } else { | ||
10506 | insertChildAt(parentNode, childNode, referenceNode); | ||
10507 | } | ||
10508 | } | ||
10509 | |||
10510 | function removeChild(parentNode, childNode) { | ||
10511 | if (Array.isArray(childNode)) { | ||
10512 | var closingComment = childNode[1]; | ||
10513 | childNode = childNode[0]; | ||
10514 | removeDelimitedText(parentNode, childNode, closingComment); | ||
10515 | parentNode.removeChild(closingComment); | ||
10516 | } | ||
10517 | parentNode.removeChild(childNode); | ||
10518 | } | ||
10519 | |||
10520 | function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) { | ||
10521 | var node = openingComment; | ||
10522 | while (true) { | ||
10523 | var nextNode = node.nextSibling; | ||
10524 | insertChildAt(parentNode, node, referenceNode); | ||
10525 | if (node === closingComment) { | ||
10526 | break; | ||
10527 | } | ||
10528 | node = nextNode; | ||
10529 | } | ||
10530 | } | ||
10531 | |||
10532 | function removeDelimitedText(parentNode, startNode, closingComment) { | ||
10533 | while (true) { | ||
10534 | var node = startNode.nextSibling; | ||
10535 | if (node === closingComment) { | ||
10536 | // The closing comment is removed by ReactMultiChild. | ||
10537 | break; | ||
10538 | } else { | ||
10539 | parentNode.removeChild(node); | ||
10540 | } | ||
10541 | } | ||
10542 | } | ||
10543 | |||
10544 | function replaceDelimitedText(openingComment, closingComment, stringText) { | ||
10545 | var parentNode = openingComment.parentNode; | ||
10546 | var nodeAfterComment = openingComment.nextSibling; | ||
10547 | if (nodeAfterComment === closingComment) { | ||
10548 | // There are no text nodes between the opening and closing comments; insert | ||
10549 | // a new one if stringText isn't empty. | ||
10550 | if (stringText) { | ||
10551 | insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment); | ||
10552 | } | ||
10553 | } else { | ||
10554 | if (stringText) { | ||
10555 | // Set the text content of the first node after the opening comment, and | ||
10556 | // remove all following nodes up until the closing comment. | ||
10557 | setTextContent(nodeAfterComment, stringText); | ||
10558 | removeDelimitedText(parentNode, nodeAfterComment, closingComment); | ||
10559 | } else { | ||
10560 | removeDelimitedText(parentNode, openingComment, closingComment); | ||
10561 | } | ||
10562 | } | ||
10563 | |||
10564 | if (process.env.NODE_ENV !== 'production') { | ||
10565 | ReactInstrumentation.debugTool.onHostOperation({ | ||
10566 | instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID, | ||
10567 | type: 'replace text', | ||
10568 | payload: stringText | ||
10569 | }); | ||
10570 | } | ||
10571 | } | ||
10572 | |||
10573 | var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup; | ||
10574 | if (process.env.NODE_ENV !== 'production') { | ||
10575 | dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) { | ||
10576 | Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup); | ||
10577 | if (prevInstance._debugID !== 0) { | ||
10578 | ReactInstrumentation.debugTool.onHostOperation({ | ||
10579 | instanceID: prevInstance._debugID, | ||
10580 | type: 'replace with', | ||
10581 | payload: markup.toString() | ||
10582 | }); | ||
10583 | } else { | ||
10584 | var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node); | ||
10585 | if (nextInstance._debugID !== 0) { | ||
10586 | ReactInstrumentation.debugTool.onHostOperation({ | ||
10587 | instanceID: nextInstance._debugID, | ||
10588 | type: 'mount', | ||
10589 | payload: markup.toString() | ||
10590 | }); | ||
10591 | } | ||
10592 | } | ||
10593 | }; | ||
10594 | } | ||
10595 | |||
10596 | /** | ||
10597 | * Operations for updating with DOM children. | ||
10598 | */ | ||
10599 | var DOMChildrenOperations = { | ||
10600 | |||
10601 | dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup, | ||
10602 | |||
10603 | replaceDelimitedText: replaceDelimitedText, | ||
10604 | |||
10605 | /** | ||
10606 | * Updates a component's children by processing a series of updates. The | ||
10607 | * update configurations are each expected to have a `parentNode` property. | ||
10608 | * | ||
10609 | * @param {array<object>} updates List of update configurations. | ||
10610 | * @internal | ||
10611 | */ | ||
10612 | processUpdates: function (parentNode, updates) { | ||
10613 | if (process.env.NODE_ENV !== 'production') { | ||
10614 | var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID; | ||
10615 | } | ||
10616 | |||
10617 | for (var k = 0; k < updates.length; k++) { | ||
10618 | var update = updates[k]; | ||
10619 | switch (update.type) { | ||
10620 | case 'INSERT_MARKUP': | ||
10621 | insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode)); | ||
10622 | if (process.env.NODE_ENV !== 'production') { | ||
10623 | ReactInstrumentation.debugTool.onHostOperation({ | ||
10624 | instanceID: parentNodeDebugID, | ||
10625 | type: 'insert child', | ||
10626 | payload: { toIndex: update.toIndex, content: update.content.toString() } | ||
10627 | }); | ||
10628 | } | ||
10629 | break; | ||
10630 | case 'MOVE_EXISTING': | ||
10631 | moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode)); | ||
10632 | if (process.env.NODE_ENV !== 'production') { | ||
10633 | ReactInstrumentation.debugTool.onHostOperation({ | ||
10634 | instanceID: parentNodeDebugID, | ||
10635 | type: 'move child', | ||
10636 | payload: { fromIndex: update.fromIndex, toIndex: update.toIndex } | ||
10637 | }); | ||
10638 | } | ||
10639 | break; | ||
10640 | case 'SET_MARKUP': | ||
10641 | setInnerHTML(parentNode, update.content); | ||
10642 | if (process.env.NODE_ENV !== 'production') { | ||
10643 | ReactInstrumentation.debugTool.onHostOperation({ | ||
10644 | instanceID: parentNodeDebugID, | ||
10645 | type: 'replace children', | ||
10646 | payload: update.content.toString() | ||
10647 | }); | ||
10648 | } | ||
10649 | break; | ||
10650 | case 'TEXT_CONTENT': | ||
10651 | setTextContent(parentNode, update.content); | ||
10652 | if (process.env.NODE_ENV !== 'production') { | ||
10653 | ReactInstrumentation.debugTool.onHostOperation({ | ||
10654 | instanceID: parentNodeDebugID, | ||
10655 | type: 'replace text', | ||
10656 | payload: update.content.toString() | ||
10657 | }); | ||
10658 | } | ||
10659 | break; | ||
10660 | case 'REMOVE_NODE': | ||
10661 | removeChild(parentNode, update.fromNode); | ||
10662 | if (process.env.NODE_ENV !== 'production') { | ||
10663 | ReactInstrumentation.debugTool.onHostOperation({ | ||
10664 | instanceID: parentNodeDebugID, | ||
10665 | type: 'remove child', | ||
10666 | payload: { fromIndex: update.fromIndex } | ||
10667 | }); | ||
10668 | } | ||
10669 | break; | ||
10670 | } | ||
10671 | } | ||
10672 | } | ||
10673 | |||
10674 | }; | ||
10675 | |||
10676 | module.exports = DOMChildrenOperations; | ||
10677 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
10678 | |||
10679 | /***/ }), | ||
10680 | /* 76 */ | ||
10681 | /***/ (function(module, exports, __webpack_require__) { | ||
10682 | |||
10683 | "use strict"; | ||
10684 | /** | ||
10685 | * Copyright 2013-present, Facebook, Inc. | ||
10686 | * All rights reserved. | ||
10687 | * | ||
10688 | * This source code is licensed under the BSD-style license found in the | ||
10689 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10690 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10691 | * | ||
10692 | */ | ||
10693 | |||
10694 | |||
10695 | |||
10696 | var DOMNamespaces = { | ||
10697 | html: 'http://www.w3.org/1999/xhtml', | ||
10698 | mathml: 'http://www.w3.org/1998/Math/MathML', | ||
10699 | svg: 'http://www.w3.org/2000/svg' | ||
10700 | }; | ||
10701 | |||
10702 | module.exports = DOMNamespaces; | ||
10703 | |||
10704 | /***/ }), | ||
10705 | /* 77 */ | ||
10706 | /***/ (function(module, exports, __webpack_require__) { | ||
10707 | |||
10708 | "use strict"; | ||
10709 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
10710 | * Copyright 2013-present, Facebook, Inc. | ||
10711 | * All rights reserved. | ||
10712 | * | ||
10713 | * This source code is licensed under the BSD-style license found in the | ||
10714 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10715 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10716 | * | ||
10717 | */ | ||
10718 | |||
10719 | |||
10720 | |||
10721 | var _prodInvariant = __webpack_require__(3); | ||
10722 | |||
10723 | var ReactErrorUtils = __webpack_require__(81); | ||
10724 | |||
10725 | var invariant = __webpack_require__(1); | ||
10726 | var warning = __webpack_require__(2); | ||
10727 | |||
10728 | /** | ||
10729 | * Injected dependencies: | ||
10730 | */ | ||
10731 | |||
10732 | /** | ||
10733 | * - `ComponentTree`: [required] Module that can convert between React instances | ||
10734 | * and actual node references. | ||
10735 | */ | ||
10736 | var ComponentTree; | ||
10737 | var TreeTraversal; | ||
10738 | var injection = { | ||
10739 | injectComponentTree: function (Injected) { | ||
10740 | ComponentTree = Injected; | ||
10741 | if (process.env.NODE_ENV !== 'production') { | ||
10742 | process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0; | ||
10743 | } | ||
10744 | }, | ||
10745 | injectTreeTraversal: function (Injected) { | ||
10746 | TreeTraversal = Injected; | ||
10747 | if (process.env.NODE_ENV !== 'production') { | ||
10748 | process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0; | ||
10749 | } | ||
10750 | } | ||
10751 | }; | ||
10752 | |||
10753 | function isEndish(topLevelType) { | ||
10754 | return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel'; | ||
10755 | } | ||
10756 | |||
10757 | function isMoveish(topLevelType) { | ||
10758 | return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove'; | ||
10759 | } | ||
10760 | function isStartish(topLevelType) { | ||
10761 | return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart'; | ||
10762 | } | ||
10763 | |||
10764 | var validateEventDispatches; | ||
10765 | if (process.env.NODE_ENV !== 'production') { | ||
10766 | validateEventDispatches = function (event) { | ||
10767 | var dispatchListeners = event._dispatchListeners; | ||
10768 | var dispatchInstances = event._dispatchInstances; | ||
10769 | |||
10770 | var listenersIsArr = Array.isArray(dispatchListeners); | ||
10771 | var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; | ||
10772 | |||
10773 | var instancesIsArr = Array.isArray(dispatchInstances); | ||
10774 | var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; | ||
10775 | |||
10776 | process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0; | ||
10777 | }; | ||
10778 | } | ||
10779 | |||
10780 | /** | ||
10781 | * Dispatch the event to the listener. | ||
10782 | * @param {SyntheticEvent} event SyntheticEvent to handle | ||
10783 | * @param {boolean} simulated If the event is simulated (changes exn behavior) | ||
10784 | * @param {function} listener Application-level callback | ||
10785 | * @param {*} inst Internal component instance | ||
10786 | */ | ||
10787 | function executeDispatch(event, simulated, listener, inst) { | ||
10788 | var type = event.type || 'unknown-event'; | ||
10789 | event.currentTarget = EventPluginUtils.getNodeFromInstance(inst); | ||
10790 | if (simulated) { | ||
10791 | ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event); | ||
10792 | } else { | ||
10793 | ReactErrorUtils.invokeGuardedCallback(type, listener, event); | ||
10794 | } | ||
10795 | event.currentTarget = null; | ||
10796 | } | ||
10797 | |||
10798 | /** | ||
10799 | * Standard/simple iteration through an event's collected dispatches. | ||
10800 | */ | ||
10801 | function executeDispatchesInOrder(event, simulated) { | ||
10802 | var dispatchListeners = event._dispatchListeners; | ||
10803 | var dispatchInstances = event._dispatchInstances; | ||
10804 | if (process.env.NODE_ENV !== 'production') { | ||
10805 | validateEventDispatches(event); | ||
10806 | } | ||
10807 | if (Array.isArray(dispatchListeners)) { | ||
10808 | for (var i = 0; i < dispatchListeners.length; i++) { | ||
10809 | if (event.isPropagationStopped()) { | ||
10810 | break; | ||
10811 | } | ||
10812 | // Listeners and Instances are two parallel arrays that are always in sync. | ||
10813 | executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]); | ||
10814 | } | ||
10815 | } else if (dispatchListeners) { | ||
10816 | executeDispatch(event, simulated, dispatchListeners, dispatchInstances); | ||
10817 | } | ||
10818 | event._dispatchListeners = null; | ||
10819 | event._dispatchInstances = null; | ||
10820 | } | ||
10821 | |||
10822 | /** | ||
10823 | * Standard/simple iteration through an event's collected dispatches, but stops | ||
10824 | * at the first dispatch execution returning true, and returns that id. | ||
10825 | * | ||
10826 | * @return {?string} id of the first dispatch execution who's listener returns | ||
10827 | * true, or null if no listener returned true. | ||
10828 | */ | ||
10829 | function executeDispatchesInOrderStopAtTrueImpl(event) { | ||
10830 | var dispatchListeners = event._dispatchListeners; | ||
10831 | var dispatchInstances = event._dispatchInstances; | ||
10832 | if (process.env.NODE_ENV !== 'production') { | ||
10833 | validateEventDispatches(event); | ||
10834 | } | ||
10835 | if (Array.isArray(dispatchListeners)) { | ||
10836 | for (var i = 0; i < dispatchListeners.length; i++) { | ||
10837 | if (event.isPropagationStopped()) { | ||
10838 | break; | ||
10839 | } | ||
10840 | // Listeners and Instances are two parallel arrays that are always in sync. | ||
10841 | if (dispatchListeners[i](event, dispatchInstances[i])) { | ||
10842 | return dispatchInstances[i]; | ||
10843 | } | ||
10844 | } | ||
10845 | } else if (dispatchListeners) { | ||
10846 | if (dispatchListeners(event, dispatchInstances)) { | ||
10847 | return dispatchInstances; | ||
10848 | } | ||
10849 | } | ||
10850 | return null; | ||
10851 | } | ||
10852 | |||
10853 | /** | ||
10854 | * @see executeDispatchesInOrderStopAtTrueImpl | ||
10855 | */ | ||
10856 | function executeDispatchesInOrderStopAtTrue(event) { | ||
10857 | var ret = executeDispatchesInOrderStopAtTrueImpl(event); | ||
10858 | event._dispatchInstances = null; | ||
10859 | event._dispatchListeners = null; | ||
10860 | return ret; | ||
10861 | } | ||
10862 | |||
10863 | /** | ||
10864 | * Execution of a "direct" dispatch - there must be at most one dispatch | ||
10865 | * accumulated on the event or it is considered an error. It doesn't really make | ||
10866 | * sense for an event with multiple dispatches (bubbled) to keep track of the | ||
10867 | * return values at each dispatch execution, but it does tend to make sense when | ||
10868 | * dealing with "direct" dispatches. | ||
10869 | * | ||
10870 | * @return {*} The return value of executing the single dispatch. | ||
10871 | */ | ||
10872 | function executeDirectDispatch(event) { | ||
10873 | if (process.env.NODE_ENV !== 'production') { | ||
10874 | validateEventDispatches(event); | ||
10875 | } | ||
10876 | var dispatchListener = event._dispatchListeners; | ||
10877 | var dispatchInstance = event._dispatchInstances; | ||
10878 | !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0; | ||
10879 | event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null; | ||
10880 | var res = dispatchListener ? dispatchListener(event) : null; | ||
10881 | event.currentTarget = null; | ||
10882 | event._dispatchListeners = null; | ||
10883 | event._dispatchInstances = null; | ||
10884 | return res; | ||
10885 | } | ||
10886 | |||
10887 | /** | ||
10888 | * @param {SyntheticEvent} event | ||
10889 | * @return {boolean} True iff number of dispatches accumulated is greater than 0. | ||
10890 | */ | ||
10891 | function hasDispatches(event) { | ||
10892 | return !!event._dispatchListeners; | ||
10893 | } | ||
10894 | |||
10895 | /** | ||
10896 | * General utilities that are useful in creating custom Event Plugins. | ||
10897 | */ | ||
10898 | var EventPluginUtils = { | ||
10899 | isEndish: isEndish, | ||
10900 | isMoveish: isMoveish, | ||
10901 | isStartish: isStartish, | ||
10902 | |||
10903 | executeDirectDispatch: executeDirectDispatch, | ||
10904 | executeDispatchesInOrder: executeDispatchesInOrder, | ||
10905 | executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, | ||
10906 | hasDispatches: hasDispatches, | ||
10907 | |||
10908 | getInstanceFromNode: function (node) { | ||
10909 | return ComponentTree.getInstanceFromNode(node); | ||
10910 | }, | ||
10911 | getNodeFromInstance: function (node) { | ||
10912 | return ComponentTree.getNodeFromInstance(node); | ||
10913 | }, | ||
10914 | isAncestor: function (a, b) { | ||
10915 | return TreeTraversal.isAncestor(a, b); | ||
10916 | }, | ||
10917 | getLowestCommonAncestor: function (a, b) { | ||
10918 | return TreeTraversal.getLowestCommonAncestor(a, b); | ||
10919 | }, | ||
10920 | getParentInstance: function (inst) { | ||
10921 | return TreeTraversal.getParentInstance(inst); | ||
10922 | }, | ||
10923 | traverseTwoPhase: function (target, fn, arg) { | ||
10924 | return TreeTraversal.traverseTwoPhase(target, fn, arg); | ||
10925 | }, | ||
10926 | traverseEnterLeave: function (from, to, fn, argFrom, argTo) { | ||
10927 | return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo); | ||
10928 | }, | ||
10929 | |||
10930 | injection: injection | ||
10931 | }; | ||
10932 | |||
10933 | module.exports = EventPluginUtils; | ||
10934 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
10935 | |||
10936 | /***/ }), | ||
10937 | /* 78 */ | ||
10938 | /***/ (function(module, exports, __webpack_require__) { | ||
10939 | |||
10940 | "use strict"; | ||
10941 | /** | ||
10942 | * Copyright 2013-present, Facebook, Inc. | ||
10943 | * All rights reserved. | ||
10944 | * | ||
10945 | * This source code is licensed under the BSD-style license found in the | ||
10946 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10947 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10948 | * | ||
10949 | * | ||
10950 | */ | ||
10951 | |||
10952 | |||
10953 | |||
10954 | /** | ||
10955 | * Escape and wrap key so it is safe to use as a reactid | ||
10956 | * | ||
10957 | * @param {string} key to be escaped. | ||
10958 | * @return {string} the escaped key. | ||
10959 | */ | ||
10960 | |||
10961 | function escape(key) { | ||
10962 | var escapeRegex = /[=:]/g; | ||
10963 | var escaperLookup = { | ||
10964 | '=': '=0', | ||
10965 | ':': '=2' | ||
10966 | }; | ||
10967 | var escapedString = ('' + key).replace(escapeRegex, function (match) { | ||
10968 | return escaperLookup[match]; | ||
10969 | }); | ||
10970 | |||
10971 | return '$' + escapedString; | ||
10972 | } | ||
10973 | |||
10974 | /** | ||
10975 | * Unescape and unwrap key for human-readable display | ||
10976 | * | ||
10977 | * @param {string} key to unescape. | ||
10978 | * @return {string} the unescaped key. | ||
10979 | */ | ||
10980 | function unescape(key) { | ||
10981 | var unescapeRegex = /(=0|=2)/g; | ||
10982 | var unescaperLookup = { | ||
10983 | '=0': '=', | ||
10984 | '=2': ':' | ||
10985 | }; | ||
10986 | var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1); | ||
10987 | |||
10988 | return ('' + keySubstring).replace(unescapeRegex, function (match) { | ||
10989 | return unescaperLookup[match]; | ||
10990 | }); | ||
10991 | } | ||
10992 | |||
10993 | var KeyEscapeUtils = { | ||
10994 | escape: escape, | ||
10995 | unescape: unescape | ||
10996 | }; | ||
10997 | |||
10998 | module.exports = KeyEscapeUtils; | ||
10999 | |||
11000 | /***/ }), | ||
11001 | /* 79 */ | ||
11002 | /***/ (function(module, exports, __webpack_require__) { | ||
11003 | |||
11004 | "use strict"; | ||
11005 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
11006 | * Copyright 2013-present, Facebook, Inc. | ||
11007 | * All rights reserved. | ||
11008 | * | ||
11009 | * This source code is licensed under the BSD-style license found in the | ||
11010 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11011 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11012 | * | ||
11013 | */ | ||
11014 | |||
11015 | |||
11016 | |||
11017 | var _prodInvariant = __webpack_require__(3); | ||
11018 | |||
11019 | var ReactPropTypesSecret = __webpack_require__(129); | ||
11020 | var propTypesFactory = __webpack_require__(113); | ||
11021 | |||
11022 | var React = __webpack_require__(39); | ||
11023 | var PropTypes = propTypesFactory(React.isValidElement); | ||
11024 | |||
11025 | var invariant = __webpack_require__(1); | ||
11026 | var warning = __webpack_require__(2); | ||
11027 | |||
11028 | var hasReadOnlyValue = { | ||
11029 | 'button': true, | ||
11030 | 'checkbox': true, | ||
11031 | 'image': true, | ||
11032 | 'hidden': true, | ||
11033 | 'radio': true, | ||
11034 | 'reset': true, | ||
11035 | 'submit': true | ||
11036 | }; | ||
11037 | |||
11038 | function _assertSingleLink(inputProps) { | ||
11039 | !(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; | ||
11040 | } | ||
11041 | function _assertValueLink(inputProps) { | ||
11042 | _assertSingleLink(inputProps); | ||
11043 | !(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; | ||
11044 | } | ||
11045 | |||
11046 | function _assertCheckedLink(inputProps) { | ||
11047 | _assertSingleLink(inputProps); | ||
11048 | !(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; | ||
11049 | } | ||
11050 | |||
11051 | var propTypes = { | ||
11052 | value: function (props, propName, componentName) { | ||
11053 | if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) { | ||
11054 | return null; | ||
11055 | } | ||
11056 | 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`.'); | ||
11057 | }, | ||
11058 | checked: function (props, propName, componentName) { | ||
11059 | if (!props[propName] || props.onChange || props.readOnly || props.disabled) { | ||
11060 | return null; | ||
11061 | } | ||
11062 | 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`.'); | ||
11063 | }, | ||
11064 | onChange: PropTypes.func | ||
11065 | }; | ||
11066 | |||
11067 | var loggedTypeFailures = {}; | ||
11068 | function getDeclarationErrorAddendum(owner) { | ||
11069 | if (owner) { | ||
11070 | var name = owner.getName(); | ||
11071 | if (name) { | ||
11072 | return ' Check the render method of `' + name + '`.'; | ||
11073 | } | ||
11074 | } | ||
11075 | return ''; | ||
11076 | } | ||
11077 | |||
11078 | /** | ||
11079 | * Provide a linked `value` attribute for controlled forms. You should not use | ||
11080 | * this outside of the ReactDOM controlled form components. | ||
11081 | */ | ||
11082 | var LinkedValueUtils = { | ||
11083 | checkPropTypes: function (tagName, props, owner) { | ||
11084 | for (var propName in propTypes) { | ||
11085 | if (propTypes.hasOwnProperty(propName)) { | ||
11086 | var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret); | ||
11087 | } | ||
11088 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
11089 | // Only monitor this failure once because there tends to be a lot of the | ||
11090 | // same error. | ||
11091 | loggedTypeFailures[error.message] = true; | ||
11092 | |||
11093 | var addendum = getDeclarationErrorAddendum(owner); | ||
11094 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0; | ||
11095 | } | ||
11096 | } | ||
11097 | }, | ||
11098 | |||
11099 | /** | ||
11100 | * @param {object} inputProps Props for form component | ||
11101 | * @return {*} current value of the input either from value prop or link. | ||
11102 | */ | ||
11103 | getValue: function (inputProps) { | ||
11104 | if (inputProps.valueLink) { | ||
11105 | _assertValueLink(inputProps); | ||
11106 | return inputProps.valueLink.value; | ||
11107 | } | ||
11108 | return inputProps.value; | ||
11109 | }, | ||
11110 | |||
11111 | /** | ||
11112 | * @param {object} inputProps Props for form component | ||
11113 | * @return {*} current checked status of the input either from checked prop | ||
11114 | * or link. | ||
11115 | */ | ||
11116 | getChecked: function (inputProps) { | ||
11117 | if (inputProps.checkedLink) { | ||
11118 | _assertCheckedLink(inputProps); | ||
11119 | return inputProps.checkedLink.value; | ||
11120 | } | ||
11121 | return inputProps.checked; | ||
11122 | }, | ||
11123 | |||
11124 | /** | ||
11125 | * @param {object} inputProps Props for form component | ||
11126 | * @param {SyntheticEvent} event change event to handle | ||
11127 | */ | ||
11128 | executeOnChange: function (inputProps, event) { | ||
11129 | if (inputProps.valueLink) { | ||
11130 | _assertValueLink(inputProps); | ||
11131 | return inputProps.valueLink.requestChange(event.target.value); | ||
11132 | } else if (inputProps.checkedLink) { | ||
11133 | _assertCheckedLink(inputProps); | ||
11134 | return inputProps.checkedLink.requestChange(event.target.checked); | ||
11135 | } else if (inputProps.onChange) { | ||
11136 | return inputProps.onChange.call(undefined, event); | ||
11137 | } | ||
11138 | } | ||
11139 | }; | ||
11140 | |||
11141 | module.exports = LinkedValueUtils; | ||
11142 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
11143 | |||
11144 | /***/ }), | ||
11145 | /* 80 */ | ||
11146 | /***/ (function(module, exports, __webpack_require__) { | ||
11147 | |||
11148 | "use strict"; | ||
11149 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
11150 | * Copyright 2014-present, Facebook, Inc. | ||
11151 | * All rights reserved. | ||
11152 | * | ||
11153 | * This source code is licensed under the BSD-style license found in the | ||
11154 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11155 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11156 | * | ||
11157 | * | ||
11158 | */ | ||
11159 | |||
11160 | |||
11161 | |||
11162 | var _prodInvariant = __webpack_require__(3); | ||
11163 | |||
11164 | var invariant = __webpack_require__(1); | ||
11165 | |||
11166 | var injected = false; | ||
11167 | |||
11168 | var ReactComponentEnvironment = { | ||
11169 | |||
11170 | /** | ||
11171 | * Optionally injectable hook for swapping out mount images in the middle of | ||
11172 | * the tree. | ||
11173 | */ | ||
11174 | replaceNodeWithMarkup: null, | ||
11175 | |||
11176 | /** | ||
11177 | * Optionally injectable hook for processing a queue of child updates. Will | ||
11178 | * later move into MultiChildComponents. | ||
11179 | */ | ||
11180 | processChildrenUpdates: null, | ||
11181 | |||
11182 | injection: { | ||
11183 | injectEnvironment: function (environment) { | ||
11184 | !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0; | ||
11185 | ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup; | ||
11186 | ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates; | ||
11187 | injected = true; | ||
11188 | } | ||
11189 | } | ||
11190 | |||
11191 | }; | ||
11192 | |||
11193 | module.exports = ReactComponentEnvironment; | ||
11194 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
11195 | |||
11196 | /***/ }), | ||
11197 | /* 81 */ | ||
11198 | /***/ (function(module, exports, __webpack_require__) { | ||
11199 | |||
11200 | "use strict"; | ||
11201 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
11202 | * Copyright 2013-present, Facebook, Inc. | ||
11203 | * All rights reserved. | ||
11204 | * | ||
11205 | * This source code is licensed under the BSD-style license found in the | ||
11206 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11207 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11208 | * | ||
11209 | * | ||
11210 | */ | ||
11211 | |||
11212 | |||
11213 | |||
11214 | var caughtError = null; | ||
11215 | |||
11216 | /** | ||
11217 | * Call a function while guarding against errors that happens within it. | ||
11218 | * | ||
11219 | * @param {String} name of the guard to use for logging or debugging | ||
11220 | * @param {Function} func The function to invoke | ||
11221 | * @param {*} a First argument | ||
11222 | * @param {*} b Second argument | ||
11223 | */ | ||
11224 | function invokeGuardedCallback(name, func, a) { | ||
11225 | try { | ||
11226 | func(a); | ||
11227 | } catch (x) { | ||
11228 | if (caughtError === null) { | ||
11229 | caughtError = x; | ||
11230 | } | ||
11231 | } | ||
11232 | } | ||
11233 | |||
11234 | var ReactErrorUtils = { | ||
11235 | invokeGuardedCallback: invokeGuardedCallback, | ||
11236 | |||
11237 | /** | ||
11238 | * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event | ||
11239 | * handler are sure to be rethrown by rethrowCaughtError. | ||
11240 | */ | ||
11241 | invokeGuardedCallbackWithCatch: invokeGuardedCallback, | ||
11242 | |||
11243 | /** | ||
11244 | * During execution of guarded functions we will capture the first error which | ||
11245 | * we will rethrow to be handled by the top level error handler. | ||
11246 | */ | ||
11247 | rethrowCaughtError: function () { | ||
11248 | if (caughtError) { | ||
11249 | var error = caughtError; | ||
11250 | caughtError = null; | ||
11251 | throw error; | ||
11252 | } | ||
11253 | } | ||
11254 | }; | ||
11255 | |||
11256 | if (process.env.NODE_ENV !== 'production') { | ||
11257 | /** | ||
11258 | * To help development we can get better devtools integration by simulating a | ||
11259 | * real browser event. | ||
11260 | */ | ||
11261 | if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { | ||
11262 | var fakeNode = document.createElement('react'); | ||
11263 | ReactErrorUtils.invokeGuardedCallback = function (name, func, a) { | ||
11264 | var boundFunc = func.bind(null, a); | ||
11265 | var evtType = 'react-' + name; | ||
11266 | fakeNode.addEventListener(evtType, boundFunc, false); | ||
11267 | var evt = document.createEvent('Event'); | ||
11268 | evt.initEvent(evtType, false, false); | ||
11269 | fakeNode.dispatchEvent(evt); | ||
11270 | fakeNode.removeEventListener(evtType, boundFunc, false); | ||
11271 | }; | ||
11272 | } | ||
11273 | } | ||
11274 | |||
11275 | module.exports = ReactErrorUtils; | ||
11276 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
11277 | |||
11278 | /***/ }), | ||
11279 | /* 82 */ | ||
11280 | /***/ (function(module, exports, __webpack_require__) { | ||
11281 | |||
11282 | "use strict"; | ||
11283 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
11284 | * Copyright 2015-present, Facebook, Inc. | ||
11285 | * All rights reserved. | ||
11286 | * | ||
11287 | * This source code is licensed under the BSD-style license found in the | ||
11288 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11289 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11290 | * | ||
11291 | */ | ||
11292 | |||
11293 | |||
11294 | |||
11295 | var _prodInvariant = __webpack_require__(3); | ||
11296 | |||
11297 | var ReactCurrentOwner = __webpack_require__(17); | ||
11298 | var ReactInstanceMap = __webpack_require__(47); | ||
11299 | var ReactInstrumentation = __webpack_require__(12); | ||
11300 | var ReactUpdates = __webpack_require__(16); | ||
11301 | |||
11302 | var invariant = __webpack_require__(1); | ||
11303 | var warning = __webpack_require__(2); | ||
11304 | |||
11305 | function enqueueUpdate(internalInstance) { | ||
11306 | ReactUpdates.enqueueUpdate(internalInstance); | ||
11307 | } | ||
11308 | |||
11309 | function formatUnexpectedArgument(arg) { | ||
11310 | var type = typeof arg; | ||
11311 | if (type !== 'object') { | ||
11312 | return type; | ||
11313 | } | ||
11314 | var displayName = arg.constructor && arg.constructor.name || type; | ||
11315 | var keys = Object.keys(arg); | ||
11316 | if (keys.length > 0 && keys.length < 20) { | ||
11317 | return displayName + ' (keys: ' + keys.join(', ') + ')'; | ||
11318 | } | ||
11319 | return displayName; | ||
11320 | } | ||
11321 | |||
11322 | function getInternalInstanceReadyForUpdate(publicInstance, callerName) { | ||
11323 | var internalInstance = ReactInstanceMap.get(publicInstance); | ||
11324 | if (!internalInstance) { | ||
11325 | if (process.env.NODE_ENV !== 'production') { | ||
11326 | var ctor = publicInstance.constructor; | ||
11327 | // Only warn when we have a callerName. Otherwise we should be silent. | ||
11328 | // We're probably calling from enqueueCallback. We don't want to warn | ||
11329 | // there because we already warned for the corresponding lifecycle method. | ||
11330 | 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; | ||
11331 | } | ||
11332 | return null; | ||
11333 | } | ||
11334 | |||
11335 | if (process.env.NODE_ENV !== 'production') { | ||
11336 | 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; | ||
11337 | } | ||
11338 | |||
11339 | return internalInstance; | ||
11340 | } | ||
11341 | |||
11342 | /** | ||
11343 | * ReactUpdateQueue allows for state updates to be scheduled into a later | ||
11344 | * reconciliation step. | ||
11345 | */ | ||
11346 | var ReactUpdateQueue = { | ||
11347 | |||
11348 | /** | ||
11349 | * Checks whether or not this composite component is mounted. | ||
11350 | * @param {ReactClass} publicInstance The instance we want to test. | ||
11351 | * @return {boolean} True if mounted, false otherwise. | ||
11352 | * @protected | ||
11353 | * @final | ||
11354 | */ | ||
11355 | isMounted: function (publicInstance) { | ||
11356 | if (process.env.NODE_ENV !== 'production') { | ||
11357 | var owner = ReactCurrentOwner.current; | ||
11358 | if (owner !== null) { | ||
11359 | 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; | ||
11360 | owner._warnedAboutRefsInRender = true; | ||
11361 | } | ||
11362 | } | ||
11363 | var internalInstance = ReactInstanceMap.get(publicInstance); | ||
11364 | if (internalInstance) { | ||
11365 | // During componentWillMount and render this will still be null but after | ||
11366 | // that will always render to something. At least for now. So we can use | ||
11367 | // this hack. | ||
11368 | return !!internalInstance._renderedComponent; | ||
11369 | } else { | ||
11370 | return false; | ||
11371 | } | ||
11372 | }, | ||
11373 | |||
11374 | /** | ||
11375 | * Enqueue a callback that will be executed after all the pending updates | ||
11376 | * have processed. | ||
11377 | * | ||
11378 | * @param {ReactClass} publicInstance The instance to use as `this` context. | ||
11379 | * @param {?function} callback Called after state is updated. | ||
11380 | * @param {string} callerName Name of the calling function in the public API. | ||
11381 | * @internal | ||
11382 | */ | ||
11383 | enqueueCallback: function (publicInstance, callback, callerName) { | ||
11384 | ReactUpdateQueue.validateCallback(callback, callerName); | ||
11385 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); | ||
11386 | |||
11387 | // Previously we would throw an error if we didn't have an internal | ||
11388 | // instance. Since we want to make it a no-op instead, we mirror the same | ||
11389 | // behavior we have in other enqueue* methods. | ||
11390 | // We also need to ignore callbacks in componentWillMount. See | ||
11391 | // enqueueUpdates. | ||
11392 | if (!internalInstance) { | ||
11393 | return null; | ||
11394 | } | ||
11395 | |||
11396 | if (internalInstance._pendingCallbacks) { | ||
11397 | internalInstance._pendingCallbacks.push(callback); | ||
11398 | } else { | ||
11399 | internalInstance._pendingCallbacks = [callback]; | ||
11400 | } | ||
11401 | // TODO: The callback here is ignored when setState is called from | ||
11402 | // componentWillMount. Either fix it or disallow doing so completely in | ||
11403 | // favor of getInitialState. Alternatively, we can disallow | ||
11404 | // componentWillMount during server-side rendering. | ||
11405 | enqueueUpdate(internalInstance); | ||
11406 | }, | ||
11407 | |||
11408 | enqueueCallbackInternal: function (internalInstance, callback) { | ||
11409 | if (internalInstance._pendingCallbacks) { | ||
11410 | internalInstance._pendingCallbacks.push(callback); | ||
11411 | } else { | ||
11412 | internalInstance._pendingCallbacks = [callback]; | ||
11413 | } | ||
11414 | enqueueUpdate(internalInstance); | ||
11415 | }, | ||
11416 | |||
11417 | /** | ||
11418 | * Forces an update. This should only be invoked when it is known with | ||
11419 | * certainty that we are **not** in a DOM transaction. | ||
11420 | * | ||
11421 | * You may want to call this when you know that some deeper aspect of the | ||
11422 | * component's state has changed but `setState` was not called. | ||
11423 | * | ||
11424 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
11425 | * `componentWillUpdate` and `componentDidUpdate`. | ||
11426 | * | ||
11427 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
11428 | * @internal | ||
11429 | */ | ||
11430 | enqueueForceUpdate: function (publicInstance) { | ||
11431 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate'); | ||
11432 | |||
11433 | if (!internalInstance) { | ||
11434 | return; | ||
11435 | } | ||
11436 | |||
11437 | internalInstance._pendingForceUpdate = true; | ||
11438 | |||
11439 | enqueueUpdate(internalInstance); | ||
11440 | }, | ||
11441 | |||
11442 | /** | ||
11443 | * Replaces all of the state. Always use this or `setState` to mutate state. | ||
11444 | * You should treat `this.state` as immutable. | ||
11445 | * | ||
11446 | * There is no guarantee that `this.state` will be immediately updated, so | ||
11447 | * accessing `this.state` after calling this method may return the old value. | ||
11448 | * | ||
11449 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
11450 | * @param {object} completeState Next state. | ||
11451 | * @internal | ||
11452 | */ | ||
11453 | enqueueReplaceState: function (publicInstance, completeState, callback) { | ||
11454 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState'); | ||
11455 | |||
11456 | if (!internalInstance) { | ||
11457 | return; | ||
11458 | } | ||
11459 | |||
11460 | internalInstance._pendingStateQueue = [completeState]; | ||
11461 | internalInstance._pendingReplaceState = true; | ||
11462 | |||
11463 | // Future-proof 15.5 | ||
11464 | if (callback !== undefined && callback !== null) { | ||
11465 | ReactUpdateQueue.validateCallback(callback, 'replaceState'); | ||
11466 | if (internalInstance._pendingCallbacks) { | ||
11467 | internalInstance._pendingCallbacks.push(callback); | ||
11468 | } else { | ||
11469 | internalInstance._pendingCallbacks = [callback]; | ||
11470 | } | ||
11471 | } | ||
11472 | |||
11473 | enqueueUpdate(internalInstance); | ||
11474 | }, | ||
11475 | |||
11476 | /** | ||
11477 | * Sets a subset of the state. This only exists because _pendingState is | ||
11478 | * internal. This provides a merging strategy that is not available to deep | ||
11479 | * properties which is confusing. TODO: Expose pendingState or don't use it | ||
11480 | * during the merge. | ||
11481 | * | ||
11482 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
11483 | * @param {object} partialState Next partial state to be merged with state. | ||
11484 | * @internal | ||
11485 | */ | ||
11486 | enqueueSetState: function (publicInstance, partialState) { | ||
11487 | if (process.env.NODE_ENV !== 'production') { | ||
11488 | ReactInstrumentation.debugTool.onSetState(); | ||
11489 | process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0; | ||
11490 | } | ||
11491 | |||
11492 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState'); | ||
11493 | |||
11494 | if (!internalInstance) { | ||
11495 | return; | ||
11496 | } | ||
11497 | |||
11498 | var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []); | ||
11499 | queue.push(partialState); | ||
11500 | |||
11501 | enqueueUpdate(internalInstance); | ||
11502 | }, | ||
11503 | |||
11504 | enqueueElementInternal: function (internalInstance, nextElement, nextContext) { | ||
11505 | internalInstance._pendingElement = nextElement; | ||
11506 | // TODO: introduce _pendingContext instead of setting it directly. | ||
11507 | internalInstance._context = nextContext; | ||
11508 | enqueueUpdate(internalInstance); | ||
11509 | }, | ||
11510 | |||
11511 | validateCallback: function (callback, callerName) { | ||
11512 | !(!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; | ||
11513 | } | ||
11514 | |||
11515 | }; | ||
11516 | |||
11517 | module.exports = ReactUpdateQueue; | ||
11518 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
11519 | |||
11520 | /***/ }), | ||
11521 | /* 83 */ | ||
11522 | /***/ (function(module, exports, __webpack_require__) { | ||
11523 | |||
11524 | "use strict"; | ||
11525 | /** | ||
11526 | * Copyright 2013-present, Facebook, Inc. | ||
11527 | * All rights reserved. | ||
11528 | * | ||
11529 | * This source code is licensed under the BSD-style license found in the | ||
11530 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11531 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11532 | * | ||
11533 | */ | ||
11534 | |||
11535 | /* globals MSApp */ | ||
11536 | |||
11537 | |||
11538 | |||
11539 | /** | ||
11540 | * Create a function which has 'unsafe' privileges (required by windows8 apps) | ||
11541 | */ | ||
11542 | |||
11543 | var createMicrosoftUnsafeLocalFunction = function (func) { | ||
11544 | if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { | ||
11545 | return function (arg0, arg1, arg2, arg3) { | ||
11546 | MSApp.execUnsafeLocalFunction(function () { | ||
11547 | return func(arg0, arg1, arg2, arg3); | ||
11548 | }); | ||
11549 | }; | ||
11550 | } else { | ||
11551 | return func; | ||
11552 | } | ||
11553 | }; | ||
11554 | |||
11555 | module.exports = createMicrosoftUnsafeLocalFunction; | ||
11556 | |||
11557 | /***/ }), | ||
11558 | /* 84 */ | ||
11559 | /***/ (function(module, exports, __webpack_require__) { | ||
11560 | |||
11561 | "use strict"; | ||
11562 | /** | ||
11563 | * Copyright 2013-present, Facebook, Inc. | ||
11564 | * All rights reserved. | ||
11565 | * | ||
11566 | * This source code is licensed under the BSD-style license found in the | ||
11567 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11568 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11569 | * | ||
11570 | */ | ||
11571 | |||
11572 | |||
11573 | |||
11574 | /** | ||
11575 | * `charCode` represents the actual "character code" and is safe to use with | ||
11576 | * `String.fromCharCode`. As such, only keys that correspond to printable | ||
11577 | * characters produce a valid `charCode`, the only exception to this is Enter. | ||
11578 | * The Tab-key is considered non-printable and does not have a `charCode`, | ||
11579 | * presumably because it does not produce a tab-character in browsers. | ||
11580 | * | ||
11581 | * @param {object} nativeEvent Native browser event. | ||
11582 | * @return {number} Normalized `charCode` property. | ||
11583 | */ | ||
11584 | |||
11585 | function getEventCharCode(nativeEvent) { | ||
11586 | var charCode; | ||
11587 | var keyCode = nativeEvent.keyCode; | ||
11588 | |||
11589 | if ('charCode' in nativeEvent) { | ||
11590 | charCode = nativeEvent.charCode; | ||
11591 | |||
11592 | // FF does not set `charCode` for the Enter-key, check against `keyCode`. | ||
11593 | if (charCode === 0 && keyCode === 13) { | ||
11594 | charCode = 13; | ||
11595 | } | ||
11596 | } else { | ||
11597 | // IE8 does not implement `charCode`, but `keyCode` has the correct value. | ||
11598 | charCode = keyCode; | ||
11599 | } | ||
11600 | |||
11601 | // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. | ||
11602 | // Must not discard the (non-)printable Enter-key. | ||
11603 | if (charCode >= 32 || charCode === 13) { | ||
11604 | return charCode; | ||
11605 | } | ||
11606 | |||
11607 | return 0; | ||
11608 | } | ||
11609 | |||
11610 | module.exports = getEventCharCode; | ||
11611 | |||
11612 | /***/ }), | ||
11613 | /* 85 */ | ||
11614 | /***/ (function(module, exports, __webpack_require__) { | ||
11615 | |||
11616 | "use strict"; | ||
11617 | /** | ||
11618 | * Copyright 2013-present, Facebook, Inc. | ||
11619 | * All rights reserved. | ||
11620 | * | ||
11621 | * This source code is licensed under the BSD-style license found in the | ||
11622 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11623 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11624 | * | ||
11625 | */ | ||
11626 | |||
11627 | |||
11628 | |||
11629 | /** | ||
11630 | * Translation from modifier key to the associated property in the event. | ||
11631 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers | ||
11632 | */ | ||
11633 | |||
11634 | var modifierKeyToProp = { | ||
11635 | 'Alt': 'altKey', | ||
11636 | 'Control': 'ctrlKey', | ||
11637 | 'Meta': 'metaKey', | ||
11638 | 'Shift': 'shiftKey' | ||
11639 | }; | ||
11640 | |||
11641 | // IE8 does not implement getModifierState so we simply map it to the only | ||
11642 | // modifier keys exposed by the event itself, does not support Lock-keys. | ||
11643 | // Currently, all major browsers except Chrome seems to support Lock-keys. | ||
11644 | function modifierStateGetter(keyArg) { | ||
11645 | var syntheticEvent = this; | ||
11646 | var nativeEvent = syntheticEvent.nativeEvent; | ||
11647 | if (nativeEvent.getModifierState) { | ||
11648 | return nativeEvent.getModifierState(keyArg); | ||
11649 | } | ||
11650 | var keyProp = modifierKeyToProp[keyArg]; | ||
11651 | return keyProp ? !!nativeEvent[keyProp] : false; | ||
11652 | } | ||
11653 | |||
11654 | function getEventModifierState(nativeEvent) { | ||
11655 | return modifierStateGetter; | ||
11656 | } | ||
11657 | |||
11658 | module.exports = getEventModifierState; | ||
11659 | |||
11660 | /***/ }), | ||
11661 | /* 86 */ | ||
11662 | /***/ (function(module, exports, __webpack_require__) { | ||
11663 | |||
11664 | "use strict"; | ||
11665 | /** | ||
11666 | * Copyright 2013-present, Facebook, Inc. | ||
11667 | * All rights reserved. | ||
11668 | * | ||
11669 | * This source code is licensed under the BSD-style license found in the | ||
11670 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11671 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11672 | * | ||
11673 | */ | ||
11674 | |||
11675 | |||
11676 | |||
11677 | /** | ||
11678 | * Gets the target node from a native browser event by accounting for | ||
11679 | * inconsistencies in browser DOM APIs. | ||
11680 | * | ||
11681 | * @param {object} nativeEvent Native browser event. | ||
11682 | * @return {DOMEventTarget} Target node. | ||
11683 | */ | ||
11684 | |||
11685 | function getEventTarget(nativeEvent) { | ||
11686 | var target = nativeEvent.target || nativeEvent.srcElement || window; | ||
11687 | |||
11688 | // Normalize SVG <use> element events #4963 | ||
11689 | if (target.correspondingUseElement) { | ||
11690 | target = target.correspondingUseElement; | ||
11691 | } | ||
11692 | |||
11693 | // Safari may fire events on text nodes (Node.TEXT_NODE is 3). | ||
11694 | // @see http://www.quirksmode.org/js/events_properties.html | ||
11695 | return target.nodeType === 3 ? target.parentNode : target; | ||
11696 | } | ||
11697 | |||
11698 | module.exports = getEventTarget; | ||
11699 | |||
11700 | /***/ }), | ||
11701 | /* 87 */ | ||
11702 | /***/ (function(module, exports, __webpack_require__) { | ||
11703 | |||
11704 | "use strict"; | ||
11705 | /** | ||
11706 | * Copyright 2013-present, Facebook, Inc. | ||
11707 | * All rights reserved. | ||
11708 | * | ||
11709 | * This source code is licensed under the BSD-style license found in the | ||
11710 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11711 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11712 | * | ||
11713 | */ | ||
11714 | |||
11715 | |||
11716 | |||
11717 | var ExecutionEnvironment = __webpack_require__(7); | ||
11718 | |||
11719 | var useHasFeature; | ||
11720 | if (ExecutionEnvironment.canUseDOM) { | ||
11721 | useHasFeature = document.implementation && document.implementation.hasFeature && | ||
11722 | // always returns true in newer browsers as per the standard. | ||
11723 | // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature | ||
11724 | document.implementation.hasFeature('', '') !== true; | ||
11725 | } | ||
11726 | |||
11727 | /** | ||
11728 | * Checks if an event is supported in the current execution environment. | ||
11729 | * | ||
11730 | * NOTE: This will not work correctly for non-generic events such as `change`, | ||
11731 | * `reset`, `load`, `error`, and `select`. | ||
11732 | * | ||
11733 | * Borrows from Modernizr. | ||
11734 | * | ||
11735 | * @param {string} eventNameSuffix Event name, e.g. "click". | ||
11736 | * @param {?boolean} capture Check if the capture phase is supported. | ||
11737 | * @return {boolean} True if the event is supported. | ||
11738 | * @internal | ||
11739 | * @license Modernizr 3.0.0pre (Custom Build) | MIT | ||
11740 | */ | ||
11741 | function isEventSupported(eventNameSuffix, capture) { | ||
11742 | if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { | ||
11743 | return false; | ||
11744 | } | ||
11745 | |||
11746 | var eventName = 'on' + eventNameSuffix; | ||
11747 | var isSupported = eventName in document; | ||
11748 | |||
11749 | if (!isSupported) { | ||
11750 | var element = document.createElement('div'); | ||
11751 | element.setAttribute(eventName, 'return;'); | ||
11752 | isSupported = typeof element[eventName] === 'function'; | ||
11753 | } | ||
11754 | |||
11755 | if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { | ||
11756 | // This is the only way to test support for the `wheel` event in IE9+. | ||
11757 | isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); | ||
11758 | } | ||
11759 | |||
11760 | return isSupported; | ||
11761 | } | ||
11762 | |||
11763 | module.exports = isEventSupported; | ||
11764 | |||
11765 | /***/ }), | ||
11766 | /* 88 */ | ||
11767 | /***/ (function(module, exports, __webpack_require__) { | ||
11768 | |||
11769 | "use strict"; | ||
11770 | /** | ||
11771 | * Copyright 2013-present, Facebook, Inc. | ||
11772 | * All rights reserved. | ||
11773 | * | ||
11774 | * This source code is licensed under the BSD-style license found in the | ||
11775 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11776 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11777 | * | ||
11778 | */ | ||
11779 | |||
11780 | |||
11781 | |||
11782 | /** | ||
11783 | * Given a `prevElement` and `nextElement`, determines if the existing | ||
11784 | * instance should be updated as opposed to being destroyed or replaced by a new | ||
11785 | * instance. Both arguments are elements. This ensures that this logic can | ||
11786 | * operate on stateless trees without any backing instance. | ||
11787 | * | ||
11788 | * @param {?object} prevElement | ||
11789 | * @param {?object} nextElement | ||
11790 | * @return {boolean} True if the existing instance should be updated. | ||
11791 | * @protected | ||
11792 | */ | ||
11793 | |||
11794 | function shouldUpdateReactComponent(prevElement, nextElement) { | ||
11795 | var prevEmpty = prevElement === null || prevElement === false; | ||
11796 | var nextEmpty = nextElement === null || nextElement === false; | ||
11797 | if (prevEmpty || nextEmpty) { | ||
11798 | return prevEmpty === nextEmpty; | ||
11799 | } | ||
11800 | |||
11801 | var prevType = typeof prevElement; | ||
11802 | var nextType = typeof nextElement; | ||
11803 | if (prevType === 'string' || prevType === 'number') { | ||
11804 | return nextType === 'string' || nextType === 'number'; | ||
11805 | } else { | ||
11806 | return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key; | ||
11807 | } | ||
11808 | } | ||
11809 | |||
11810 | module.exports = shouldUpdateReactComponent; | ||
11811 | |||
11812 | /***/ }), | ||
11813 | /* 89 */ | ||
11814 | /***/ (function(module, exports, __webpack_require__) { | ||
11815 | |||
11816 | "use strict"; | ||
11817 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
11818 | * Copyright 2015-present, Facebook, Inc. | ||
11819 | * All rights reserved. | ||
11820 | * | ||
11821 | * This source code is licensed under the BSD-style license found in the | ||
11822 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11823 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11824 | * | ||
11825 | */ | ||
11826 | |||
11827 | |||
11828 | |||
11829 | var _assign = __webpack_require__(4); | ||
11830 | |||
11831 | var emptyFunction = __webpack_require__(10); | ||
11832 | var warning = __webpack_require__(2); | ||
11833 | |||
11834 | var validateDOMNesting = emptyFunction; | ||
11835 | |||
11836 | if (process.env.NODE_ENV !== 'production') { | ||
11837 | // This validation code was written based on the HTML5 parsing spec: | ||
11838 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | ||
11839 | // | ||
11840 | // Note: this does not catch all invalid nesting, nor does it try to (as it's | ||
11841 | // not clear what practical benefit doing so provides); instead, we warn only | ||
11842 | // for cases where the parser will give a parse tree differing from what React | ||
11843 | // intended. For example, <b><div></div></b> is invalid but we don't warn | ||
11844 | // because it still parses correctly; we do warn for other cases like nested | ||
11845 | // <p> tags where the beginning of the second element implicitly closes the | ||
11846 | // first, causing a confusing mess. | ||
11847 | |||
11848 | // https://html.spec.whatwg.org/multipage/syntax.html#special | ||
11849 | 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']; | ||
11850 | |||
11851 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | ||
11852 | var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', | ||
11853 | |||
11854 | // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point | ||
11855 | // TODO: Distinguish by namespace here -- for <title>, including it here | ||
11856 | // errs on the side of fewer warnings | ||
11857 | 'foreignObject', 'desc', 'title']; | ||
11858 | |||
11859 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope | ||
11860 | var buttonScopeTags = inScopeTags.concat(['button']); | ||
11861 | |||
11862 | // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags | ||
11863 | var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; | ||
11864 | |||
11865 | var emptyAncestorInfo = { | ||
11866 | current: null, | ||
11867 | |||
11868 | formTag: null, | ||
11869 | aTagInScope: null, | ||
11870 | buttonTagInScope: null, | ||
11871 | nobrTagInScope: null, | ||
11872 | pTagInButtonScope: null, | ||
11873 | |||
11874 | listItemTagAutoclosing: null, | ||
11875 | dlItemTagAutoclosing: null | ||
11876 | }; | ||
11877 | |||
11878 | var updatedAncestorInfo = function (oldInfo, tag, instance) { | ||
11879 | var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo); | ||
11880 | var info = { tag: tag, instance: instance }; | ||
11881 | |||
11882 | if (inScopeTags.indexOf(tag) !== -1) { | ||
11883 | ancestorInfo.aTagInScope = null; | ||
11884 | ancestorInfo.buttonTagInScope = null; | ||
11885 | ancestorInfo.nobrTagInScope = null; | ||
11886 | } | ||
11887 | if (buttonScopeTags.indexOf(tag) !== -1) { | ||
11888 | ancestorInfo.pTagInButtonScope = null; | ||
11889 | } | ||
11890 | |||
11891 | // See rules for 'li', 'dd', 'dt' start tags in | ||
11892 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody | ||
11893 | if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { | ||
11894 | ancestorInfo.listItemTagAutoclosing = null; | ||
11895 | ancestorInfo.dlItemTagAutoclosing = null; | ||
11896 | } | ||
11897 | |||
11898 | ancestorInfo.current = info; | ||
11899 | |||
11900 | if (tag === 'form') { | ||
11901 | ancestorInfo.formTag = info; | ||
11902 | } | ||
11903 | if (tag === 'a') { | ||
11904 | ancestorInfo.aTagInScope = info; | ||
11905 | } | ||
11906 | if (tag === 'button') { | ||
11907 | ancestorInfo.buttonTagInScope = info; | ||
11908 | } | ||
11909 | if (tag === 'nobr') { | ||
11910 | ancestorInfo.nobrTagInScope = info; | ||
11911 | } | ||
11912 | if (tag === 'p') { | ||
11913 | ancestorInfo.pTagInButtonScope = info; | ||
11914 | } | ||
11915 | if (tag === 'li') { | ||
11916 | ancestorInfo.listItemTagAutoclosing = info; | ||
11917 | } | ||
11918 | if (tag === 'dd' || tag === 'dt') { | ||
11919 | ancestorInfo.dlItemTagAutoclosing = info; | ||
11920 | } | ||
11921 | |||
11922 | return ancestorInfo; | ||
11923 | }; | ||
11924 | |||
11925 | /** | ||
11926 | * Returns whether | ||
11927 | */ | ||
11928 | var isTagValidWithParent = function (tag, parentTag) { | ||
11929 | // First, let's check if we're in an unusual parsing mode... | ||
11930 | switch (parentTag) { | ||
11931 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect | ||
11932 | case 'select': | ||
11933 | return tag === 'option' || tag === 'optgroup' || tag === '#text'; | ||
11934 | case 'optgroup': | ||
11935 | return tag === 'option' || tag === '#text'; | ||
11936 | // Strictly speaking, seeing an <option> doesn't mean we're in a <select> | ||
11937 | // but | ||
11938 | case 'option': | ||
11939 | return tag === '#text'; | ||
11940 | |||
11941 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd | ||
11942 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption | ||
11943 | // No special behavior since these rules fall back to "in body" mode for | ||
11944 | // all except special table nodes which cause bad parsing behavior anyway. | ||
11945 | |||
11946 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr | ||
11947 | case 'tr': | ||
11948 | return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
11949 | |||
11950 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody | ||
11951 | case 'tbody': | ||
11952 | case 'thead': | ||
11953 | case 'tfoot': | ||
11954 | return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
11955 | |||
11956 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup | ||
11957 | case 'colgroup': | ||
11958 | return tag === 'col' || tag === 'template'; | ||
11959 | |||
11960 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable | ||
11961 | case 'table': | ||
11962 | return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
11963 | |||
11964 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead | ||
11965 | case 'head': | ||
11966 | return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
11967 | |||
11968 | // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element | ||
11969 | case 'html': | ||
11970 | return tag === 'head' || tag === 'body'; | ||
11971 | case '#document': | ||
11972 | return tag === 'html'; | ||
11973 | } | ||
11974 | |||
11975 | // Probably in the "in body" parsing mode, so we outlaw only tag combos | ||
11976 | // where the parsing rules cause implicit opens or closes to be added. | ||
11977 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody | ||
11978 | switch (tag) { | ||
11979 | case 'h1': | ||
11980 | case 'h2': | ||
11981 | case 'h3': | ||
11982 | case 'h4': | ||
11983 | case 'h5': | ||
11984 | case 'h6': | ||
11985 | return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; | ||
11986 | |||
11987 | case 'rp': | ||
11988 | case 'rt': | ||
11989 | return impliedEndTags.indexOf(parentTag) === -1; | ||
11990 | |||
11991 | case 'body': | ||
11992 | case 'caption': | ||
11993 | case 'col': | ||
11994 | case 'colgroup': | ||
11995 | case 'frame': | ||
11996 | case 'head': | ||
11997 | case 'html': | ||
11998 | case 'tbody': | ||
11999 | case 'td': | ||
12000 | case 'tfoot': | ||
12001 | case 'th': | ||
12002 | case 'thead': | ||
12003 | case 'tr': | ||
12004 | // These tags are only valid with a few parents that have special child | ||
12005 | // parsing rules -- if we're down here, then none of those matched and | ||
12006 | // so we allow it only if we don't know what the parent is, as all other | ||
12007 | // cases are invalid. | ||
12008 | return parentTag == null; | ||
12009 | } | ||
12010 | |||
12011 | return true; | ||
12012 | }; | ||
12013 | |||
12014 | /** | ||
12015 | * Returns whether | ||
12016 | */ | ||
12017 | var findInvalidAncestorForTag = function (tag, ancestorInfo) { | ||
12018 | switch (tag) { | ||
12019 | case 'address': | ||
12020 | case 'article': | ||
12021 | case 'aside': | ||
12022 | case 'blockquote': | ||
12023 | case 'center': | ||
12024 | case 'details': | ||
12025 | case 'dialog': | ||
12026 | case 'dir': | ||
12027 | case 'div': | ||
12028 | case 'dl': | ||
12029 | case 'fieldset': | ||
12030 | case 'figcaption': | ||
12031 | case 'figure': | ||
12032 | case 'footer': | ||
12033 | case 'header': | ||
12034 | case 'hgroup': | ||
12035 | case 'main': | ||
12036 | case 'menu': | ||
12037 | case 'nav': | ||
12038 | case 'ol': | ||
12039 | case 'p': | ||
12040 | case 'section': | ||
12041 | case 'summary': | ||
12042 | case 'ul': | ||
12043 | case 'pre': | ||
12044 | case 'listing': | ||
12045 | case 'table': | ||
12046 | case 'hr': | ||
12047 | case 'xmp': | ||
12048 | case 'h1': | ||
12049 | case 'h2': | ||
12050 | case 'h3': | ||
12051 | case 'h4': | ||
12052 | case 'h5': | ||
12053 | case 'h6': | ||
12054 | return ancestorInfo.pTagInButtonScope; | ||
12055 | |||
12056 | case 'form': | ||
12057 | return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; | ||
12058 | |||
12059 | case 'li': | ||
12060 | return ancestorInfo.listItemTagAutoclosing; | ||
12061 | |||
12062 | case 'dd': | ||
12063 | case 'dt': | ||
12064 | return ancestorInfo.dlItemTagAutoclosing; | ||
12065 | |||
12066 | case 'button': | ||
12067 | return ancestorInfo.buttonTagInScope; | ||
12068 | |||
12069 | case 'a': | ||
12070 | // Spec says something about storing a list of markers, but it sounds | ||
12071 | // equivalent to this check. | ||
12072 | return ancestorInfo.aTagInScope; | ||
12073 | |||
12074 | case 'nobr': | ||
12075 | return ancestorInfo.nobrTagInScope; | ||
12076 | } | ||
12077 | |||
12078 | return null; | ||
12079 | }; | ||
12080 | |||
12081 | /** | ||
12082 | * Given a ReactCompositeComponent instance, return a list of its recursive | ||
12083 | * owners, starting at the root and ending with the instance itself. | ||
12084 | */ | ||
12085 | var findOwnerStack = function (instance) { | ||
12086 | if (!instance) { | ||
12087 | return []; | ||
12088 | } | ||
12089 | |||
12090 | var stack = []; | ||
12091 | do { | ||
12092 | stack.push(instance); | ||
12093 | } while (instance = instance._currentElement._owner); | ||
12094 | stack.reverse(); | ||
12095 | return stack; | ||
12096 | }; | ||
12097 | |||
12098 | var didWarn = {}; | ||
12099 | |||
12100 | validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) { | ||
12101 | ancestorInfo = ancestorInfo || emptyAncestorInfo; | ||
12102 | var parentInfo = ancestorInfo.current; | ||
12103 | var parentTag = parentInfo && parentInfo.tag; | ||
12104 | |||
12105 | if (childText != null) { | ||
12106 | process.env.NODE_ENV !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0; | ||
12107 | childTag = '#text'; | ||
12108 | } | ||
12109 | |||
12110 | var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; | ||
12111 | var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); | ||
12112 | var problematic = invalidParent || invalidAncestor; | ||
12113 | |||
12114 | if (problematic) { | ||
12115 | var ancestorTag = problematic.tag; | ||
12116 | var ancestorInstance = problematic.instance; | ||
12117 | |||
12118 | var childOwner = childInstance && childInstance._currentElement._owner; | ||
12119 | var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner; | ||
12120 | |||
12121 | var childOwners = findOwnerStack(childOwner); | ||
12122 | var ancestorOwners = findOwnerStack(ancestorOwner); | ||
12123 | |||
12124 | var minStackLen = Math.min(childOwners.length, ancestorOwners.length); | ||
12125 | var i; | ||
12126 | |||
12127 | var deepestCommon = -1; | ||
12128 | for (i = 0; i < minStackLen; i++) { | ||
12129 | if (childOwners[i] === ancestorOwners[i]) { | ||
12130 | deepestCommon = i; | ||
12131 | } else { | ||
12132 | break; | ||
12133 | } | ||
12134 | } | ||
12135 | |||
12136 | var UNKNOWN = '(unknown)'; | ||
12137 | var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) { | ||
12138 | return inst.getName() || UNKNOWN; | ||
12139 | }); | ||
12140 | var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) { | ||
12141 | return inst.getName() || UNKNOWN; | ||
12142 | }); | ||
12143 | var ownerInfo = [].concat( | ||
12144 | // If the parent and child instances have a common owner ancestor, start | ||
12145 | // with that -- otherwise we just start with the parent's owners. | ||
12146 | deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag, | ||
12147 | // If we're warning about an invalid (non-parent) ancestry, add '...' | ||
12148 | invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > '); | ||
12149 | |||
12150 | var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo; | ||
12151 | if (didWarn[warnKey]) { | ||
12152 | return; | ||
12153 | } | ||
12154 | didWarn[warnKey] = true; | ||
12155 | |||
12156 | var tagDisplayName = childTag; | ||
12157 | var whitespaceInfo = ''; | ||
12158 | if (childTag === '#text') { | ||
12159 | if (/\S/.test(childText)) { | ||
12160 | tagDisplayName = 'Text nodes'; | ||
12161 | } else { | ||
12162 | tagDisplayName = 'Whitespace text nodes'; | ||
12163 | whitespaceInfo = ' Make sure you don\'t have any extra whitespace between tags on ' + 'each line of your source code.'; | ||
12164 | } | ||
12165 | } else { | ||
12166 | tagDisplayName = '<' + childTag + '>'; | ||
12167 | } | ||
12168 | |||
12169 | if (invalidParent) { | ||
12170 | var info = ''; | ||
12171 | if (ancestorTag === 'table' && childTag === 'tr') { | ||
12172 | info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.'; | ||
12173 | } | ||
12174 | 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; | ||
12175 | } else { | ||
12176 | process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0; | ||
12177 | } | ||
12178 | } | ||
12179 | }; | ||
12180 | |||
12181 | validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo; | ||
12182 | |||
12183 | // For testing | ||
12184 | validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) { | ||
12185 | ancestorInfo = ancestorInfo || emptyAncestorInfo; | ||
12186 | var parentInfo = ancestorInfo.current; | ||
12187 | var parentTag = parentInfo && parentInfo.tag; | ||
12188 | return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo); | ||
12189 | }; | ||
12190 | } | ||
12191 | |||
12192 | module.exports = validateDOMNesting; | ||
12193 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
12194 | |||
12195 | /***/ }), | ||
12196 | /* 90 */ | ||
12197 | /***/ (function(module, exports, __webpack_require__) { | ||
12198 | |||
12199 | "use strict"; | ||
12200 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
12201 | * Copyright 2013-present, Facebook, Inc. | ||
12202 | * All rights reserved. | ||
12203 | * | ||
12204 | * This source code is licensed under the BSD-style license found in the | ||
12205 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12206 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12207 | * | ||
12208 | */ | ||
12209 | |||
12210 | |||
12211 | |||
12212 | var _prodInvariant = __webpack_require__(32); | ||
12213 | |||
12214 | var ReactNoopUpdateQueue = __webpack_require__(91); | ||
12215 | |||
12216 | var canDefineProperty = __webpack_require__(59); | ||
12217 | var emptyObject = __webpack_require__(36); | ||
12218 | var invariant = __webpack_require__(1); | ||
12219 | var warning = __webpack_require__(2); | ||
12220 | |||
12221 | /** | ||
12222 | * Base class helpers for the updating state of a component. | ||
12223 | */ | ||
12224 | function ReactComponent(props, context, updater) { | ||
12225 | this.props = props; | ||
12226 | this.context = context; | ||
12227 | this.refs = emptyObject; | ||
12228 | // We initialize the default updater but the real one gets injected by the | ||
12229 | // renderer. | ||
12230 | this.updater = updater || ReactNoopUpdateQueue; | ||
12231 | } | ||
12232 | |||
12233 | ReactComponent.prototype.isReactComponent = {}; | ||
12234 | |||
12235 | /** | ||
12236 | * Sets a subset of the state. Always use this to mutate | ||
12237 | * state. You should treat `this.state` as immutable. | ||
12238 | * | ||
12239 | * There is no guarantee that `this.state` will be immediately updated, so | ||
12240 | * accessing `this.state` after calling this method may return the old value. | ||
12241 | * | ||
12242 | * There is no guarantee that calls to `setState` will run synchronously, | ||
12243 | * as they may eventually be batched together. You can provide an optional | ||
12244 | * callback that will be executed when the call to setState is actually | ||
12245 | * completed. | ||
12246 | * | ||
12247 | * When a function is provided to setState, it will be called at some point in | ||
12248 | * the future (not synchronously). It will be called with the up to date | ||
12249 | * component arguments (state, props, context). These values can be different | ||
12250 | * from this.* because your function may be called after receiveProps but before | ||
12251 | * shouldComponentUpdate, and this new state, props, and context will not yet be | ||
12252 | * assigned to this. | ||
12253 | * | ||
12254 | * @param {object|function} partialState Next partial state or function to | ||
12255 | * produce next partial state to be merged with current state. | ||
12256 | * @param {?function} callback Called after state is updated. | ||
12257 | * @final | ||
12258 | * @protected | ||
12259 | */ | ||
12260 | ReactComponent.prototype.setState = function (partialState, callback) { | ||
12261 | !(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; | ||
12262 | this.updater.enqueueSetState(this, partialState); | ||
12263 | if (callback) { | ||
12264 | this.updater.enqueueCallback(this, callback, 'setState'); | ||
12265 | } | ||
12266 | }; | ||
12267 | |||
12268 | /** | ||
12269 | * Forces an update. This should only be invoked when it is known with | ||
12270 | * certainty that we are **not** in a DOM transaction. | ||
12271 | * | ||
12272 | * You may want to call this when you know that some deeper aspect of the | ||
12273 | * component's state has changed but `setState` was not called. | ||
12274 | * | ||
12275 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
12276 | * `componentWillUpdate` and `componentDidUpdate`. | ||
12277 | * | ||
12278 | * @param {?function} callback Called after update is complete. | ||
12279 | * @final | ||
12280 | * @protected | ||
12281 | */ | ||
12282 | ReactComponent.prototype.forceUpdate = function (callback) { | ||
12283 | this.updater.enqueueForceUpdate(this); | ||
12284 | if (callback) { | ||
12285 | this.updater.enqueueCallback(this, callback, 'forceUpdate'); | ||
12286 | } | ||
12287 | }; | ||
12288 | |||
12289 | /** | ||
12290 | * Deprecated APIs. These APIs used to exist on classic React classes but since | ||
12291 | * we would like to deprecate them, we're not going to move them over to this | ||
12292 | * modern base class. Instead, we define a getter that warns if it's accessed. | ||
12293 | */ | ||
12294 | if (process.env.NODE_ENV !== 'production') { | ||
12295 | var deprecatedAPIs = { | ||
12296 | isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], | ||
12297 | replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] | ||
12298 | }; | ||
12299 | var defineDeprecationWarning = function (methodName, info) { | ||
12300 | if (canDefineProperty) { | ||
12301 | Object.defineProperty(ReactComponent.prototype, methodName, { | ||
12302 | get: function () { | ||
12303 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0; | ||
12304 | return undefined; | ||
12305 | } | ||
12306 | }); | ||
12307 | } | ||
12308 | }; | ||
12309 | for (var fnName in deprecatedAPIs) { | ||
12310 | if (deprecatedAPIs.hasOwnProperty(fnName)) { | ||
12311 | defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); | ||
12312 | } | ||
12313 | } | ||
12314 | } | ||
12315 | |||
12316 | module.exports = ReactComponent; | ||
12317 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
12318 | |||
12319 | /***/ }), | ||
12320 | /* 91 */ | ||
12321 | /***/ (function(module, exports, __webpack_require__) { | ||
12322 | |||
12323 | "use strict"; | ||
12324 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
12325 | * Copyright 2015-present, Facebook, Inc. | ||
12326 | * All rights reserved. | ||
12327 | * | ||
12328 | * This source code is licensed under the BSD-style license found in the | ||
12329 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12330 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12331 | * | ||
12332 | */ | ||
12333 | |||
12334 | |||
12335 | |||
12336 | var warning = __webpack_require__(2); | ||
12337 | |||
12338 | function warnNoop(publicInstance, callerName) { | ||
12339 | if (process.env.NODE_ENV !== 'production') { | ||
12340 | var constructor = publicInstance.constructor; | ||
12341 | 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; | ||
12342 | } | ||
12343 | } | ||
12344 | |||
12345 | /** | ||
12346 | * This is the abstract API for an update queue. | ||
12347 | */ | ||
12348 | var ReactNoopUpdateQueue = { | ||
12349 | |||
12350 | /** | ||
12351 | * Checks whether or not this composite component is mounted. | ||
12352 | * @param {ReactClass} publicInstance The instance we want to test. | ||
12353 | * @return {boolean} True if mounted, false otherwise. | ||
12354 | * @protected | ||
12355 | * @final | ||
12356 | */ | ||
12357 | isMounted: function (publicInstance) { | ||
12358 | return false; | ||
12359 | }, | ||
12360 | |||
12361 | /** | ||
12362 | * Enqueue a callback that will be executed after all the pending updates | ||
12363 | * have processed. | ||
12364 | * | ||
12365 | * @param {ReactClass} publicInstance The instance to use as `this` context. | ||
12366 | * @param {?function} callback Called after state is updated. | ||
12367 | * @internal | ||
12368 | */ | ||
12369 | enqueueCallback: function (publicInstance, callback) {}, | ||
12370 | |||
12371 | /** | ||
12372 | * Forces an update. This should only be invoked when it is known with | ||
12373 | * certainty that we are **not** in a DOM transaction. | ||
12374 | * | ||
12375 | * You may want to call this when you know that some deeper aspect of the | ||
12376 | * component's state has changed but `setState` was not called. | ||
12377 | * | ||
12378 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
12379 | * `componentWillUpdate` and `componentDidUpdate`. | ||
12380 | * | ||
12381 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
12382 | * @internal | ||
12383 | */ | ||
12384 | enqueueForceUpdate: function (publicInstance) { | ||
12385 | warnNoop(publicInstance, 'forceUpdate'); | ||
12386 | }, | ||
12387 | |||
12388 | /** | ||
12389 | * Replaces all of the state. Always use this or `setState` to mutate state. | ||
12390 | * You should treat `this.state` as immutable. | ||
12391 | * | ||
12392 | * There is no guarantee that `this.state` will be immediately updated, so | ||
12393 | * accessing `this.state` after calling this method may return the old value. | ||
12394 | * | ||
12395 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
12396 | * @param {object} completeState Next state. | ||
12397 | * @internal | ||
12398 | */ | ||
12399 | enqueueReplaceState: function (publicInstance, completeState) { | ||
12400 | warnNoop(publicInstance, 'replaceState'); | ||
12401 | }, | ||
12402 | |||
12403 | /** | ||
12404 | * Sets a subset of the state. This only exists because _pendingState is | ||
12405 | * internal. This provides a merging strategy that is not available to deep | ||
12406 | * properties which is confusing. TODO: Expose pendingState or don't use it | ||
12407 | * during the merge. | ||
12408 | * | ||
12409 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
12410 | * @param {object} partialState Next partial state to be merged with state. | ||
12411 | * @internal | ||
12412 | */ | ||
12413 | enqueueSetState: function (publicInstance, partialState) { | ||
12414 | warnNoop(publicInstance, 'setState'); | ||
12415 | } | ||
12416 | }; | ||
12417 | |||
12418 | module.exports = ReactNoopUpdateQueue; | ||
12419 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
12420 | |||
12421 | /***/ }), | ||
12422 | /* 92 */ | ||
12423 | /***/ (function(module, exports, __webpack_require__) { | ||
12424 | |||
12425 | module.exports = { "default": __webpack_require__(169), __esModule: true }; | ||
12426 | |||
12427 | /***/ }), | ||
12428 | /* 93 */ | ||
12429 | /***/ (function(module, exports, __webpack_require__) { | ||
12430 | |||
12431 | "use strict"; | ||
12432 | |||
12433 | |||
12434 | exports.__esModule = true; | ||
12435 | |||
12436 | var _defineProperty = __webpack_require__(92); | ||
12437 | |||
12438 | var _defineProperty2 = _interopRequireDefault(_defineProperty); | ||
12439 | |||
12440 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
12441 | |||
12442 | exports.default = function (obj, key, value) { | ||
12443 | if (key in obj) { | ||
12444 | (0, _defineProperty2.default)(obj, key, { | ||
12445 | value: value, | ||
12446 | enumerable: true, | ||
12447 | configurable: true, | ||
12448 | writable: true | ||
12449 | }); | ||
12450 | } else { | ||
12451 | obj[key] = value; | ||
12452 | } | ||
12453 | |||
12454 | return obj; | ||
12455 | }; | ||
12456 | |||
12457 | /***/ }), | ||
12458 | /* 94 */ | ||
12459 | /***/ (function(module, exports, __webpack_require__) { | ||
12460 | |||
12461 | "use strict"; | ||
12462 | |||
12463 | |||
12464 | exports.__esModule = true; | ||
12465 | |||
12466 | var _iterator = __webpack_require__(164); | ||
12467 | |||
12468 | var _iterator2 = _interopRequireDefault(_iterator); | ||
12469 | |||
12470 | var _symbol = __webpack_require__(163); | ||
12471 | |||
12472 | var _symbol2 = _interopRequireDefault(_symbol); | ||
12473 | |||
12474 | 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; }; | ||
12475 | |||
12476 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
12477 | |||
12478 | exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) { | ||
12479 | return typeof obj === "undefined" ? "undefined" : _typeof(obj); | ||
12480 | } : function (obj) { | ||
12481 | return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj); | ||
12482 | }; | ||
12483 | |||
12484 | /***/ }), | ||
12485 | /* 95 */ | ||
12486 | /***/ (function(module, exports, __webpack_require__) { | ||
12487 | |||
12488 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! | ||
12489 | Copyright (c) 2016 Jed Watson. | ||
12490 | Licensed under the MIT License (MIT), see | ||
12491 | http://jedwatson.github.io/classnames | ||
12492 | */ | ||
12493 | /* global define */ | ||
12494 | |||
12495 | (function () { | ||
12496 | 'use strict'; | ||
12497 | |||
12498 | var hasOwn = {}.hasOwnProperty; | ||
12499 | |||
12500 | function classNames () { | ||
12501 | var classes = []; | ||
12502 | |||
12503 | for (var i = 0; i < arguments.length; i++) { | ||
12504 | var arg = arguments[i]; | ||
12505 | if (!arg) continue; | ||
12506 | |||
12507 | var argType = typeof arg; | ||
12508 | |||
12509 | if (argType === 'string' || argType === 'number') { | ||
12510 | classes.push(arg); | ||
12511 | } else if (Array.isArray(arg)) { | ||
12512 | classes.push(classNames.apply(null, arg)); | ||
12513 | } else if (argType === 'object') { | ||
12514 | for (var key in arg) { | ||
12515 | if (hasOwn.call(arg, key) && arg[key]) { | ||
12516 | classes.push(key); | ||
12517 | } | ||
12518 | } | ||
12519 | } | ||
12520 | } | ||
12521 | |||
12522 | return classes.join(' '); | ||
12523 | } | ||
12524 | |||
12525 | if (typeof module !== 'undefined' && module.exports) { | ||
12526 | module.exports = classNames; | ||
12527 | } else if (true) { | ||
12528 | // register as 'classnames', consistent with npm package name | ||
12529 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { | ||
12530 | return classNames; | ||
12531 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | ||
12532 | __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
12533 | } else { | ||
12534 | window.classNames = classNames; | ||
12535 | } | ||
12536 | }()); | ||
12537 | |||
12538 | |||
12539 | /***/ }), | ||
12540 | /* 96 */ | ||
12541 | /***/ (function(module, exports) { | ||
12542 | |||
12543 | module.exports = function(arr, obj){ | ||
12544 | if (arr.indexOf) return arr.indexOf(obj); | ||
12545 | for (var i = 0; i < arr.length; ++i) { | ||
12546 | if (arr[i] === obj) return i; | ||
12547 | } | ||
12548 | return -1; | ||
12549 | }; | ||
12550 | |||
12551 | /***/ }), | ||
12552 | /* 97 */ | ||
12553 | /***/ (function(module, exports) { | ||
12554 | |||
12555 | var toString = {}.toString; | ||
12556 | |||
12557 | module.exports = function(it){ | ||
12558 | return toString.call(it).slice(8, -1); | ||
12559 | }; | ||
12560 | |||
12561 | /***/ }), | ||
12562 | /* 98 */ | ||
12563 | /***/ (function(module, exports, __webpack_require__) { | ||
12564 | |||
12565 | // optional / simple context binding | ||
12566 | var aFunction = __webpack_require__(173); | ||
12567 | module.exports = function(fn, that, length){ | ||
12568 | aFunction(fn); | ||
12569 | if(that === undefined)return fn; | ||
12570 | switch(length){ | ||
12571 | case 1: return function(a){ | ||
12572 | return fn.call(that, a); | ||
12573 | }; | ||
12574 | case 2: return function(a, b){ | ||
12575 | return fn.call(that, a, b); | ||
12576 | }; | ||
12577 | case 3: return function(a, b, c){ | ||
12578 | return fn.call(that, a, b, c); | ||
12579 | }; | ||
12580 | } | ||
12581 | return function(/* ...args */){ | ||
12582 | return fn.apply(that, arguments); | ||
12583 | }; | ||
12584 | }; | ||
12585 | |||
12586 | /***/ }), | ||
12587 | /* 99 */ | ||
12588 | /***/ (function(module, exports, __webpack_require__) { | ||
12589 | |||
12590 | var isObject = __webpack_require__(42) | ||
12591 | , document = __webpack_require__(20).document | ||
12592 | // in old IE typeof document.createElement is 'object' | ||
12593 | , is = isObject(document) && isObject(document.createElement); | ||
12594 | module.exports = function(it){ | ||
12595 | return is ? document.createElement(it) : {}; | ||
12596 | }; | ||
12597 | |||
12598 | /***/ }), | ||
12599 | /* 100 */ | ||
12600 | /***/ (function(module, exports, __webpack_require__) { | ||
12601 | |||
12602 | module.exports = !__webpack_require__(25) && !__webpack_require__(41)(function(){ | ||
12603 | return Object.defineProperty(__webpack_require__(99)('div'), 'a', {get: function(){ return 7; }}).a != 7; | ||
12604 | }); | ||
12605 | |||
12606 | /***/ }), | ||
12607 | /* 101 */ | ||
12608 | /***/ (function(module, exports, __webpack_require__) { | ||
12609 | |||
12610 | // fallback for non-array-like ES3 and non-enumerable old V8 strings | ||
12611 | var cof = __webpack_require__(97); | ||
12612 | module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ | ||
12613 | return cof(it) == 'String' ? it.split('') : Object(it); | ||
12614 | }; | ||
12615 | |||
12616 | /***/ }), | ||
12617 | /* 102 */ | ||
12618 | /***/ (function(module, exports, __webpack_require__) { | ||
12619 | |||
12620 | "use strict"; | ||
12621 | |||
12622 | var LIBRARY = __webpack_require__(63) | ||
12623 | , $export = __webpack_require__(33) | ||
12624 | , redefine = __webpack_require__(106) | ||
12625 | , hide = __webpack_require__(34) | ||
12626 | , has = __webpack_require__(26) | ||
12627 | , Iterators = __webpack_require__(62) | ||
12628 | , $iterCreate = __webpack_require__(179) | ||
12629 | , setToStringTag = __webpack_require__(66) | ||
12630 | , getPrototypeOf = __webpack_require__(186) | ||
12631 | , ITERATOR = __webpack_require__(35)('iterator') | ||
12632 | , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` | ||
12633 | , FF_ITERATOR = '@@iterator' | ||
12634 | , KEYS = 'keys' | ||
12635 | , VALUES = 'values'; | ||
12636 | |||
12637 | var returnThis = function(){ return this; }; | ||
12638 | |||
12639 | module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ | ||
12640 | $iterCreate(Constructor, NAME, next); | ||
12641 | var getMethod = function(kind){ | ||
12642 | if(!BUGGY && kind in proto)return proto[kind]; | ||
12643 | switch(kind){ | ||
12644 | case KEYS: return function keys(){ return new Constructor(this, kind); }; | ||
12645 | case VALUES: return function values(){ return new Constructor(this, kind); }; | ||
12646 | } return function entries(){ return new Constructor(this, kind); }; | ||
12647 | }; | ||
12648 | var TAG = NAME + ' Iterator' | ||
12649 | , DEF_VALUES = DEFAULT == VALUES | ||
12650 | , VALUES_BUG = false | ||
12651 | , proto = Base.prototype | ||
12652 | , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] | ||
12653 | , $default = $native || getMethod(DEFAULT) | ||
12654 | , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined | ||
12655 | , $anyNative = NAME == 'Array' ? proto.entries || $native : $native | ||
12656 | , methods, key, IteratorPrototype; | ||
12657 | // Fix native | ||
12658 | if($anyNative){ | ||
12659 | IteratorPrototype = getPrototypeOf($anyNative.call(new Base)); | ||
12660 | if(IteratorPrototype !== Object.prototype){ | ||
12661 | // Set @@toStringTag to native iterators | ||
12662 | setToStringTag(IteratorPrototype, TAG, true); | ||
12663 | // fix for some old engines | ||
12664 | if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); | ||
12665 | } | ||
12666 | } | ||
12667 | // fix Array#{values, @@iterator}.name in V8 / FF | ||
12668 | if(DEF_VALUES && $native && $native.name !== VALUES){ | ||
12669 | VALUES_BUG = true; | ||
12670 | $default = function values(){ return $native.call(this); }; | ||
12671 | } | ||
12672 | // Define iterator | ||
12673 | if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ | ||
12674 | hide(proto, ITERATOR, $default); | ||
12675 | } | ||
12676 | // Plug for library | ||
12677 | Iterators[NAME] = $default; | ||
12678 | Iterators[TAG] = returnThis; | ||
12679 | if(DEFAULT){ | ||
12680 | methods = { | ||
12681 | values: DEF_VALUES ? $default : getMethod(VALUES), | ||
12682 | keys: IS_SET ? $default : getMethod(KEYS), | ||
12683 | entries: $entries | ||
12684 | }; | ||
12685 | if(FORCED)for(key in methods){ | ||
12686 | if(!(key in proto))redefine(proto, key, methods[key]); | ||
12687 | } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); | ||
12688 | } | ||
12689 | return methods; | ||
12690 | }; | ||
12691 | |||
12692 | /***/ }), | ||
12693 | /* 103 */ | ||
12694 | /***/ (function(module, exports, __webpack_require__) { | ||
12695 | |||
12696 | var pIE = __webpack_require__(50) | ||
12697 | , createDesc = __webpack_require__(51) | ||
12698 | , toIObject = __webpack_require__(28) | ||
12699 | , toPrimitive = __webpack_require__(70) | ||
12700 | , has = __webpack_require__(26) | ||
12701 | , IE8_DOM_DEFINE = __webpack_require__(100) | ||
12702 | , gOPD = Object.getOwnPropertyDescriptor; | ||
12703 | |||
12704 | exports.f = __webpack_require__(25) ? gOPD : function getOwnPropertyDescriptor(O, P){ | ||
12705 | O = toIObject(O); | ||
12706 | P = toPrimitive(P, true); | ||
12707 | if(IE8_DOM_DEFINE)try { | ||
12708 | return gOPD(O, P); | ||
12709 | } catch(e){ /* empty */ } | ||
12710 | if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]); | ||
12711 | }; | ||
12712 | |||
12713 | /***/ }), | ||
12714 | /* 104 */ | ||
12715 | /***/ (function(module, exports, __webpack_require__) { | ||
12716 | |||
12717 | // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) | ||
12718 | var $keys = __webpack_require__(105) | ||
12719 | , hiddenKeys = __webpack_require__(61).concat('length', 'prototype'); | ||
12720 | |||
12721 | exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){ | ||
12722 | return $keys(O, hiddenKeys); | ||
12723 | }; | ||
12724 | |||
12725 | /***/ }), | ||
12726 | /* 105 */ | ||
12727 | /***/ (function(module, exports, __webpack_require__) { | ||
12728 | |||
12729 | var has = __webpack_require__(26) | ||
12730 | , toIObject = __webpack_require__(28) | ||
12731 | , arrayIndexOf = __webpack_require__(175)(false) | ||
12732 | , IE_PROTO = __webpack_require__(67)('IE_PROTO'); | ||
12733 | |||
12734 | module.exports = function(object, names){ | ||
12735 | var O = toIObject(object) | ||
12736 | , i = 0 | ||
12737 | , result = [] | ||
12738 | , key; | ||
12739 | for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); | ||
12740 | // Don't enum bug & hidden keys | ||
12741 | while(names.length > i)if(has(O, key = names[i++])){ | ||
12742 | ~arrayIndexOf(result, key) || result.push(key); | ||
12743 | } | ||
12744 | return result; | ||
12745 | }; | ||
12746 | |||
12747 | /***/ }), | ||
12748 | /* 106 */ | ||
12749 | /***/ (function(module, exports, __webpack_require__) { | ||
12750 | |||
12751 | module.exports = __webpack_require__(34); | ||
12752 | |||
12753 | /***/ }), | ||
12754 | /* 107 */ | ||
12755 | /***/ (function(module, exports, __webpack_require__) { | ||
12756 | |||
12757 | // 7.1.13 ToObject(argument) | ||
12758 | var defined = __webpack_require__(60); | ||
12759 | module.exports = function(it){ | ||
12760 | return Object(defined(it)); | ||
12761 | }; | ||
12762 | |||
12763 | /***/ }), | ||
12764 | /* 108 */ | ||
12765 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
12766 | |||
12767 | "use strict"; | ||
12768 | /** | ||
12769 | * 获取 node 上的 align 对齐点 相对于页面的坐标 | ||
12770 | */ | ||
12771 | |||
12772 | function getAlignOffset(region, align) { | ||
12773 | var V = align.charAt(0); | ||
12774 | var H = align.charAt(1); | ||
12775 | var w = region.width; | ||
12776 | var h = region.height; | ||
12777 | var x = void 0; | ||
12778 | var y = void 0; | ||
12779 | |||
12780 | x = region.left; | ||
12781 | y = region.top; | ||
12782 | |||
12783 | if (V === 'c') { | ||
12784 | y += h / 2; | ||
12785 | } else if (V === 'b') { | ||
12786 | y += h; | ||
12787 | } | ||
12788 | |||
12789 | if (H === 'c') { | ||
12790 | x += w / 2; | ||
12791 | } else if (H === 'r') { | ||
12792 | x += w; | ||
12793 | } | ||
12794 | |||
12795 | return { | ||
12796 | left: x, | ||
12797 | top: y | ||
12798 | }; | ||
12799 | } | ||
12800 | |||
12801 | /* harmony default export */ __webpack_exports__["a"] = (getAlignOffset); | ||
12802 | |||
12803 | /***/ }), | ||
12804 | /* 109 */ | ||
12805 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
12806 | |||
12807 | "use strict"; | ||
12808 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__(44); | ||
12809 | |||
12810 | |||
12811 | /** | ||
12812 | * 得到会导致元素显示不全的祖先元素 | ||
12813 | */ | ||
12814 | |||
12815 | function getOffsetParent(element) { | ||
12816 | if (__WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].isWindow(element) || element.nodeType === 9) { | ||
12817 | return null; | ||
12818 | } | ||
12819 | // ie 这个也不是完全可行 | ||
12820 | /* | ||
12821 | <div style="width: 50px;height: 100px;overflow: hidden"> | ||
12822 | <div style="width: 50px;height: 100px;position: relative;" id="d6"> | ||
12823 | 元素 6 高 100px 宽 50px<br/> | ||
12824 | </div> | ||
12825 | </div> | ||
12826 | */ | ||
12827 | // element.offsetParent does the right thing in ie7 and below. Return parent with layout! | ||
12828 | // In other browsers it only includes elements with position absolute, relative or | ||
12829 | // fixed, not elements with overflow set to auto or scroll. | ||
12830 | // if (UA.ie && ieMode < 8) { | ||
12831 | // return element.offsetParent; | ||
12832 | // } | ||
12833 | // 统一的 offsetParent 方法 | ||
12834 | var doc = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].getDocument(element); | ||
12835 | var body = doc.body; | ||
12836 | var parent = void 0; | ||
12837 | var positionStyle = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].css(element, 'position'); | ||
12838 | var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute'; | ||
12839 | |||
12840 | if (!skipStatic) { | ||
12841 | return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode; | ||
12842 | } | ||
12843 | |||
12844 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) { | ||
12845 | positionStyle = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].css(parent, 'position'); | ||
12846 | if (positionStyle !== 'static') { | ||
12847 | return parent; | ||
12848 | } | ||
12849 | } | ||
12850 | return null; | ||
12851 | } | ||
12852 | |||
12853 | /* harmony default export */ __webpack_exports__["a"] = (getOffsetParent); | ||
12854 | |||
12855 | /***/ }), | ||
12856 | /* 110 */ | ||
12857 | /***/ (function(module, exports, __webpack_require__) { | ||
12858 | |||
12859 | "use strict"; | ||
12860 | /* WEBPACK VAR INJECTION */(function(process) { | ||
12861 | |||
12862 | /** | ||
12863 | * Copyright (c) 2013-present, Facebook, Inc. | ||
12864 | * | ||
12865 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
12866 | * you may not use this file except in compliance with the License. | ||
12867 | * You may obtain a copy of the License at | ||
12868 | * | ||
12869 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
12870 | * | ||
12871 | * Unless required by applicable law or agreed to in writing, software | ||
12872 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
12873 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12874 | * See the License for the specific language governing permissions and | ||
12875 | * limitations under the License. | ||
12876 | * | ||
12877 | * @typechecks | ||
12878 | */ | ||
12879 | |||
12880 | var emptyFunction = __webpack_require__(10); | ||
12881 | |||
12882 | /** | ||
12883 | * Upstream version of event listener. Does not take into account specific | ||
12884 | * nature of platform. | ||
12885 | */ | ||
12886 | var EventListener = { | ||
12887 | /** | ||
12888 | * Listen to DOM events during the bubble phase. | ||
12889 | * | ||
12890 | * @param {DOMEventTarget} target DOM element to register listener on. | ||
12891 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. | ||
12892 | * @param {function} callback Callback function. | ||
12893 | * @return {object} Object with a `remove` method. | ||
12894 | */ | ||
12895 | listen: function listen(target, eventType, callback) { | ||
12896 | if (target.addEventListener) { | ||
12897 | target.addEventListener(eventType, callback, false); | ||
12898 | return { | ||
12899 | remove: function remove() { | ||
12900 | target.removeEventListener(eventType, callback, false); | ||
12901 | } | ||
12902 | }; | ||
12903 | } else if (target.attachEvent) { | ||
12904 | target.attachEvent('on' + eventType, callback); | ||
12905 | return { | ||
12906 | remove: function remove() { | ||
12907 | target.detachEvent('on' + eventType, callback); | ||
12908 | } | ||
12909 | }; | ||
12910 | } | ||
12911 | }, | ||
12912 | |||
12913 | /** | ||
12914 | * Listen to DOM events during the capture phase. | ||
12915 | * | ||
12916 | * @param {DOMEventTarget} target DOM element to register listener on. | ||
12917 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. | ||
12918 | * @param {function} callback Callback function. | ||
12919 | * @return {object} Object with a `remove` method. | ||
12920 | */ | ||
12921 | capture: function capture(target, eventType, callback) { | ||
12922 | if (target.addEventListener) { | ||
12923 | target.addEventListener(eventType, callback, true); | ||
12924 | return { | ||
12925 | remove: function remove() { | ||
12926 | target.removeEventListener(eventType, callback, true); | ||
12927 | } | ||
12928 | }; | ||
12929 | } else { | ||
12930 | if (process.env.NODE_ENV !== 'production') { | ||
12931 | 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.'); | ||
12932 | } | ||
12933 | return { | ||
12934 | remove: emptyFunction | ||
12935 | }; | ||
12936 | } | ||
12937 | }, | ||
12938 | |||
12939 | registerDefault: function registerDefault() {} | ||
12940 | }; | ||
12941 | |||
12942 | module.exports = EventListener; | ||
12943 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
12944 | |||
12945 | /***/ }), | ||
12946 | /* 111 */ | ||
12947 | /***/ (function(module, exports, __webpack_require__) { | ||
12948 | |||
12949 | "use strict"; | ||
12950 | /** | ||
12951 | * Copyright (c) 2013-present, Facebook, Inc. | ||
12952 | * All rights reserved. | ||
12953 | * | ||
12954 | * This source code is licensed under the BSD-style license found in the | ||
12955 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12956 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12957 | * | ||
12958 | */ | ||
12959 | |||
12960 | |||
12961 | |||
12962 | /** | ||
12963 | * @param {DOMElement} node input/textarea to focus | ||
12964 | */ | ||
12965 | |||
12966 | function focusNode(node) { | ||
12967 | // IE8 can throw "Can't move focus to the control because it is invisible, | ||
12968 | // not enabled, or of a type that does not accept the focus." for all kinds of | ||
12969 | // reasons that are too expensive and fragile to test. | ||
12970 | try { | ||
12971 | node.focus(); | ||
12972 | } catch (e) {} | ||
12973 | } | ||
12974 | |||
12975 | module.exports = focusNode; | ||
12976 | |||
12977 | /***/ }), | ||
12978 | /* 112 */ | ||
12979 | /***/ (function(module, exports, __webpack_require__) { | ||
12980 | |||
12981 | "use strict"; | ||
12982 | |||
12983 | |||
12984 | /** | ||
12985 | * Copyright (c) 2013-present, Facebook, Inc. | ||
12986 | * All rights reserved. | ||
12987 | * | ||
12988 | * This source code is licensed under the BSD-style license found in the | ||
12989 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12990 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12991 | * | ||
12992 | * @typechecks | ||
12993 | */ | ||
12994 | |||
12995 | /* eslint-disable fb-www/typeof-undefined */ | ||
12996 | |||
12997 | /** | ||
12998 | * Same as document.activeElement but wraps in a try-catch block. In IE it is | ||
12999 | * not safe to call document.activeElement if there is nothing focused. | ||
13000 | * | ||
13001 | * The activeElement will be null only if the document or document body is not | ||
13002 | * yet defined. | ||
13003 | * | ||
13004 | * @param {?DOMDocument} doc Defaults to current document. | ||
13005 | * @return {?DOMElement} | ||
13006 | */ | ||
13007 | function getActiveElement(doc) /*?DOMElement*/{ | ||
13008 | doc = doc || (typeof document !== 'undefined' ? document : undefined); | ||
13009 | if (typeof doc === 'undefined') { | ||
13010 | return null; | ||
13011 | } | ||
13012 | try { | ||
13013 | return doc.activeElement || doc.body; | ||
13014 | } catch (e) { | ||
13015 | return doc.body; | ||
13016 | } | ||
13017 | } | ||
13018 | |||
13019 | module.exports = getActiveElement; | ||
13020 | |||
13021 | /***/ }), | ||
13022 | /* 113 */ | ||
13023 | /***/ (function(module, exports, __webpack_require__) { | ||
13024 | |||
13025 | "use strict"; | ||
13026 | /** | ||
13027 | * Copyright 2013-present, Facebook, Inc. | ||
13028 | * All rights reserved. | ||
13029 | * | ||
13030 | * This source code is licensed under the BSD-style license found in the | ||
13031 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13032 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13033 | */ | ||
13034 | |||
13035 | |||
13036 | |||
13037 | // React 15.5 references this module, and assumes PropTypes are still callable in production. | ||
13038 | // Therefore we re-export development-only version with all the PropTypes checks here. | ||
13039 | // However if one is migrating to the `prop-types` npm library, they will go through the | ||
13040 | // `index.js` entry point, and it will branch depending on the environment. | ||
13041 | var factory = __webpack_require__(114); | ||
13042 | module.exports = function(isValidElement) { | ||
13043 | // It is still allowed in 15.5. | ||
13044 | var throwOnDirectAccess = false; | ||
13045 | return factory(isValidElement, throwOnDirectAccess); | ||
13046 | }; | ||
13047 | |||
13048 | |||
13049 | /***/ }), | ||
13050 | /* 114 */ | ||
13051 | /***/ (function(module, exports, __webpack_require__) { | ||
13052 | |||
13053 | "use strict"; | ||
13054 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13055 | * Copyright 2013-present, Facebook, Inc. | ||
13056 | * All rights reserved. | ||
13057 | * | ||
13058 | * This source code is licensed under the BSD-style license found in the | ||
13059 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13060 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13061 | */ | ||
13062 | |||
13063 | |||
13064 | |||
13065 | var emptyFunction = __webpack_require__(10); | ||
13066 | var invariant = __webpack_require__(1); | ||
13067 | var warning = __webpack_require__(2); | ||
13068 | |||
13069 | var ReactPropTypesSecret = __webpack_require__(74); | ||
13070 | var checkPropTypes = __webpack_require__(226); | ||
13071 | |||
13072 | module.exports = function(isValidElement, throwOnDirectAccess) { | ||
13073 | /* global Symbol */ | ||
13074 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | ||
13075 | var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | ||
13076 | |||
13077 | /** | ||
13078 | * Returns the iterator method function contained on the iterable object. | ||
13079 | * | ||
13080 | * Be sure to invoke the function with the iterable as context: | ||
13081 | * | ||
13082 | * var iteratorFn = getIteratorFn(myIterable); | ||
13083 | * if (iteratorFn) { | ||
13084 | * var iterator = iteratorFn.call(myIterable); | ||
13085 | * ... | ||
13086 | * } | ||
13087 | * | ||
13088 | * @param {?object} maybeIterable | ||
13089 | * @return {?function} | ||
13090 | */ | ||
13091 | function getIteratorFn(maybeIterable) { | ||
13092 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | ||
13093 | if (typeof iteratorFn === 'function') { | ||
13094 | return iteratorFn; | ||
13095 | } | ||
13096 | } | ||
13097 | |||
13098 | /** | ||
13099 | * Collection of methods that allow declaration and validation of props that are | ||
13100 | * supplied to React components. Example usage: | ||
13101 | * | ||
13102 | * var Props = require('ReactPropTypes'); | ||
13103 | * var MyArticle = React.createClass({ | ||
13104 | * propTypes: { | ||
13105 | * // An optional string prop named "description". | ||
13106 | * description: Props.string, | ||
13107 | * | ||
13108 | * // A required enum prop named "category". | ||
13109 | * category: Props.oneOf(['News','Photos']).isRequired, | ||
13110 | * | ||
13111 | * // A prop named "dialog" that requires an instance of Dialog. | ||
13112 | * dialog: Props.instanceOf(Dialog).isRequired | ||
13113 | * }, | ||
13114 | * render: function() { ... } | ||
13115 | * }); | ||
13116 | * | ||
13117 | * A more formal specification of how these methods are used: | ||
13118 | * | ||
13119 | * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) | ||
13120 | * decl := ReactPropTypes.{type}(.isRequired)? | ||
13121 | * | ||
13122 | * Each and every declaration produces a function with the same signature. This | ||
13123 | * allows the creation of custom validation functions. For example: | ||
13124 | * | ||
13125 | * var MyLink = React.createClass({ | ||
13126 | * propTypes: { | ||
13127 | * // An optional string or URI prop named "href". | ||
13128 | * href: function(props, propName, componentName) { | ||
13129 | * var propValue = props[propName]; | ||
13130 | * if (propValue != null && typeof propValue !== 'string' && | ||
13131 | * !(propValue instanceof URI)) { | ||
13132 | * return new Error( | ||
13133 | * 'Expected a string or an URI for ' + propName + ' in ' + | ||
13134 | * componentName | ||
13135 | * ); | ||
13136 | * } | ||
13137 | * } | ||
13138 | * }, | ||
13139 | * render: function() {...} | ||
13140 | * }); | ||
13141 | * | ||
13142 | * @internal | ||
13143 | */ | ||
13144 | |||
13145 | var ANONYMOUS = '<<anonymous>>'; | ||
13146 | |||
13147 | // Important! | ||
13148 | // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. | ||
13149 | var ReactPropTypes = { | ||
13150 | array: createPrimitiveTypeChecker('array'), | ||
13151 | bool: createPrimitiveTypeChecker('boolean'), | ||
13152 | func: createPrimitiveTypeChecker('function'), | ||
13153 | number: createPrimitiveTypeChecker('number'), | ||
13154 | object: createPrimitiveTypeChecker('object'), | ||
13155 | string: createPrimitiveTypeChecker('string'), | ||
13156 | symbol: createPrimitiveTypeChecker('symbol'), | ||
13157 | |||
13158 | any: createAnyTypeChecker(), | ||
13159 | arrayOf: createArrayOfTypeChecker, | ||
13160 | element: createElementTypeChecker(), | ||
13161 | instanceOf: createInstanceTypeChecker, | ||
13162 | node: createNodeChecker(), | ||
13163 | objectOf: createObjectOfTypeChecker, | ||
13164 | oneOf: createEnumTypeChecker, | ||
13165 | oneOfType: createUnionTypeChecker, | ||
13166 | shape: createShapeTypeChecker | ||
13167 | }; | ||
13168 | |||
13169 | /** | ||
13170 | * inlined Object.is polyfill to avoid requiring consumers ship their own | ||
13171 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | ||
13172 | */ | ||
13173 | /*eslint-disable no-self-compare*/ | ||
13174 | function is(x, y) { | ||
13175 | // SameValue algorithm | ||
13176 | if (x === y) { | ||
13177 | // Steps 1-5, 7-10 | ||
13178 | // Steps 6.b-6.e: +0 != -0 | ||
13179 | return x !== 0 || 1 / x === 1 / y; | ||
13180 | } else { | ||
13181 | // Step 6.a: NaN == NaN | ||
13182 | return x !== x && y !== y; | ||
13183 | } | ||
13184 | } | ||
13185 | /*eslint-enable no-self-compare*/ | ||
13186 | |||
13187 | /** | ||
13188 | * We use an Error-like object for backward compatibility as people may call | ||
13189 | * PropTypes directly and inspect their output. However, we don't use real | ||
13190 | * Errors anymore. We don't inspect their stack anyway, and creating them | ||
13191 | * is prohibitively expensive if they are created too often, such as what | ||
13192 | * happens in oneOfType() for any type before the one that matched. | ||
13193 | */ | ||
13194 | function PropTypeError(message) { | ||
13195 | this.message = message; | ||
13196 | this.stack = ''; | ||
13197 | } | ||
13198 | // Make `instanceof Error` still work for returned errors. | ||
13199 | PropTypeError.prototype = Error.prototype; | ||
13200 | |||
13201 | function createChainableTypeChecker(validate) { | ||
13202 | if (process.env.NODE_ENV !== 'production') { | ||
13203 | var manualPropTypeCallCache = {}; | ||
13204 | var manualPropTypeWarningCount = 0; | ||
13205 | } | ||
13206 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { | ||
13207 | componentName = componentName || ANONYMOUS; | ||
13208 | propFullName = propFullName || propName; | ||
13209 | |||
13210 | if (secret !== ReactPropTypesSecret) { | ||
13211 | if (throwOnDirectAccess) { | ||
13212 | // New behavior only for users of `prop-types` package | ||
13213 | invariant( | ||
13214 | false, | ||
13215 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | ||
13216 | 'Use `PropTypes.checkPropTypes()` to call them. ' + | ||
13217 | 'Read more at http://fb.me/use-check-prop-types' | ||
13218 | ); | ||
13219 | } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { | ||
13220 | // Old behavior for people using React.PropTypes | ||
13221 | var cacheKey = componentName + ':' + propName; | ||
13222 | if ( | ||
13223 | !manualPropTypeCallCache[cacheKey] && | ||
13224 | // Avoid spamming the console because they are often not actionable except for lib authors | ||
13225 | manualPropTypeWarningCount < 3 | ||
13226 | ) { | ||
13227 | warning( | ||
13228 | false, | ||
13229 | 'You are manually calling a React.PropTypes validation ' + | ||
13230 | 'function for the `%s` prop on `%s`. This is deprecated ' + | ||
13231 | 'and will throw in the standalone `prop-types` package. ' + | ||
13232 | 'You may be seeing this warning due to a third-party PropTypes ' + | ||
13233 | 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', | ||
13234 | propFullName, | ||
13235 | componentName | ||
13236 | ); | ||
13237 | manualPropTypeCallCache[cacheKey] = true; | ||
13238 | manualPropTypeWarningCount++; | ||
13239 | } | ||
13240 | } | ||
13241 | } | ||
13242 | if (props[propName] == null) { | ||
13243 | if (isRequired) { | ||
13244 | if (props[propName] === null) { | ||
13245 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); | ||
13246 | } | ||
13247 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); | ||
13248 | } | ||
13249 | return null; | ||
13250 | } else { | ||
13251 | return validate(props, propName, componentName, location, propFullName); | ||
13252 | } | ||
13253 | } | ||
13254 | |||
13255 | var chainedCheckType = checkType.bind(null, false); | ||
13256 | chainedCheckType.isRequired = checkType.bind(null, true); | ||
13257 | |||
13258 | return chainedCheckType; | ||
13259 | } | ||
13260 | |||
13261 | function createPrimitiveTypeChecker(expectedType) { | ||
13262 | function validate(props, propName, componentName, location, propFullName, secret) { | ||
13263 | var propValue = props[propName]; | ||
13264 | var propType = getPropType(propValue); | ||
13265 | if (propType !== expectedType) { | ||
13266 | // `propValue` being instance of, say, date/regexp, pass the 'object' | ||
13267 | // check, but we can offer a more precise error message here rather than | ||
13268 | // 'of type `object`'. | ||
13269 | var preciseType = getPreciseType(propValue); | ||
13270 | |||
13271 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); | ||
13272 | } | ||
13273 | return null; | ||
13274 | } | ||
13275 | return createChainableTypeChecker(validate); | ||
13276 | } | ||
13277 | |||
13278 | function createAnyTypeChecker() { | ||
13279 | return createChainableTypeChecker(emptyFunction.thatReturnsNull); | ||
13280 | } | ||
13281 | |||
13282 | function createArrayOfTypeChecker(typeChecker) { | ||
13283 | function validate(props, propName, componentName, location, propFullName) { | ||
13284 | if (typeof typeChecker !== 'function') { | ||
13285 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); | ||
13286 | } | ||
13287 | var propValue = props[propName]; | ||
13288 | if (!Array.isArray(propValue)) { | ||
13289 | var propType = getPropType(propValue); | ||
13290 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); | ||
13291 | } | ||
13292 | for (var i = 0; i < propValue.length; i++) { | ||
13293 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); | ||
13294 | if (error instanceof Error) { | ||
13295 | return error; | ||
13296 | } | ||
13297 | } | ||
13298 | return null; | ||
13299 | } | ||
13300 | return createChainableTypeChecker(validate); | ||
13301 | } | ||
13302 | |||
13303 | function createElementTypeChecker() { | ||
13304 | function validate(props, propName, componentName, location, propFullName) { | ||
13305 | var propValue = props[propName]; | ||
13306 | if (!isValidElement(propValue)) { | ||
13307 | var propType = getPropType(propValue); | ||
13308 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); | ||
13309 | } | ||
13310 | return null; | ||
13311 | } | ||
13312 | return createChainableTypeChecker(validate); | ||
13313 | } | ||
13314 | |||
13315 | function createInstanceTypeChecker(expectedClass) { | ||
13316 | function validate(props, propName, componentName, location, propFullName) { | ||
13317 | if (!(props[propName] instanceof expectedClass)) { | ||
13318 | var expectedClassName = expectedClass.name || ANONYMOUS; | ||
13319 | var actualClassName = getClassName(props[propName]); | ||
13320 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); | ||
13321 | } | ||
13322 | return null; | ||
13323 | } | ||
13324 | return createChainableTypeChecker(validate); | ||
13325 | } | ||
13326 | |||
13327 | function createEnumTypeChecker(expectedValues) { | ||
13328 | if (!Array.isArray(expectedValues)) { | ||
13329 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; | ||
13330 | return emptyFunction.thatReturnsNull; | ||
13331 | } | ||
13332 | |||
13333 | function validate(props, propName, componentName, location, propFullName) { | ||
13334 | var propValue = props[propName]; | ||
13335 | for (var i = 0; i < expectedValues.length; i++) { | ||
13336 | if (is(propValue, expectedValues[i])) { | ||
13337 | return null; | ||
13338 | } | ||
13339 | } | ||
13340 | |||
13341 | var valuesString = JSON.stringify(expectedValues); | ||
13342 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); | ||
13343 | } | ||
13344 | return createChainableTypeChecker(validate); | ||
13345 | } | ||
13346 | |||
13347 | function createObjectOfTypeChecker(typeChecker) { | ||
13348 | function validate(props, propName, componentName, location, propFullName) { | ||
13349 | if (typeof typeChecker !== 'function') { | ||
13350 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); | ||
13351 | } | ||
13352 | var propValue = props[propName]; | ||
13353 | var propType = getPropType(propValue); | ||
13354 | if (propType !== 'object') { | ||
13355 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); | ||
13356 | } | ||
13357 | for (var key in propValue) { | ||
13358 | if (propValue.hasOwnProperty(key)) { | ||
13359 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); | ||
13360 | if (error instanceof Error) { | ||
13361 | return error; | ||
13362 | } | ||
13363 | } | ||
13364 | } | ||
13365 | return null; | ||
13366 | } | ||
13367 | return createChainableTypeChecker(validate); | ||
13368 | } | ||
13369 | |||
13370 | function createUnionTypeChecker(arrayOfTypeCheckers) { | ||
13371 | if (!Array.isArray(arrayOfTypeCheckers)) { | ||
13372 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; | ||
13373 | return emptyFunction.thatReturnsNull; | ||
13374 | } | ||
13375 | |||
13376 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
13377 | var checker = arrayOfTypeCheckers[i]; | ||
13378 | if (typeof checker !== 'function') { | ||
13379 | warning( | ||
13380 | false, | ||
13381 | 'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' + | ||
13382 | 'received %s at index %s.', | ||
13383 | getPostfixForTypeWarning(checker), | ||
13384 | i | ||
13385 | ); | ||
13386 | return emptyFunction.thatReturnsNull; | ||
13387 | } | ||
13388 | } | ||
13389 | |||
13390 | function validate(props, propName, componentName, location, propFullName) { | ||
13391 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
13392 | var checker = arrayOfTypeCheckers[i]; | ||
13393 | if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { | ||
13394 | return null; | ||
13395 | } | ||
13396 | } | ||
13397 | |||
13398 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); | ||
13399 | } | ||
13400 | return createChainableTypeChecker(validate); | ||
13401 | } | ||
13402 | |||
13403 | function createNodeChecker() { | ||
13404 | function validate(props, propName, componentName, location, propFullName) { | ||
13405 | if (!isNode(props[propName])) { | ||
13406 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); | ||
13407 | } | ||
13408 | return null; | ||
13409 | } | ||
13410 | return createChainableTypeChecker(validate); | ||
13411 | } | ||
13412 | |||
13413 | function createShapeTypeChecker(shapeTypes) { | ||
13414 | function validate(props, propName, componentName, location, propFullName) { | ||
13415 | var propValue = props[propName]; | ||
13416 | var propType = getPropType(propValue); | ||
13417 | if (propType !== 'object') { | ||
13418 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); | ||
13419 | } | ||
13420 | for (var key in shapeTypes) { | ||
13421 | var checker = shapeTypes[key]; | ||
13422 | if (!checker) { | ||
13423 | continue; | ||
13424 | } | ||
13425 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); | ||
13426 | if (error) { | ||
13427 | return error; | ||
13428 | } | ||
13429 | } | ||
13430 | return null; | ||
13431 | } | ||
13432 | return createChainableTypeChecker(validate); | ||
13433 | } | ||
13434 | |||
13435 | function isNode(propValue) { | ||
13436 | switch (typeof propValue) { | ||
13437 | case 'number': | ||
13438 | case 'string': | ||
13439 | case 'undefined': | ||
13440 | return true; | ||
13441 | case 'boolean': | ||
13442 | return !propValue; | ||
13443 | case 'object': | ||
13444 | if (Array.isArray(propValue)) { | ||
13445 | return propValue.every(isNode); | ||
13446 | } | ||
13447 | if (propValue === null || isValidElement(propValue)) { | ||
13448 | return true; | ||
13449 | } | ||
13450 | |||
13451 | var iteratorFn = getIteratorFn(propValue); | ||
13452 | if (iteratorFn) { | ||
13453 | var iterator = iteratorFn.call(propValue); | ||
13454 | var step; | ||
13455 | if (iteratorFn !== propValue.entries) { | ||
13456 | while (!(step = iterator.next()).done) { | ||
13457 | if (!isNode(step.value)) { | ||
13458 | return false; | ||
13459 | } | ||
13460 | } | ||
13461 | } else { | ||
13462 | // Iterator will provide entry [k,v] tuples rather than values. | ||
13463 | while (!(step = iterator.next()).done) { | ||
13464 | var entry = step.value; | ||
13465 | if (entry) { | ||
13466 | if (!isNode(entry[1])) { | ||
13467 | return false; | ||
13468 | } | ||
13469 | } | ||
13470 | } | ||
13471 | } | ||
13472 | } else { | ||
13473 | return false; | ||
13474 | } | ||
13475 | |||
13476 | return true; | ||
13477 | default: | ||
13478 | return false; | ||
13479 | } | ||
13480 | } | ||
13481 | |||
13482 | function isSymbol(propType, propValue) { | ||
13483 | // Native Symbol. | ||
13484 | if (propType === 'symbol') { | ||
13485 | return true; | ||
13486 | } | ||
13487 | |||
13488 | // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' | ||
13489 | if (propValue['@@toStringTag'] === 'Symbol') { | ||
13490 | return true; | ||
13491 | } | ||
13492 | |||
13493 | // Fallback for non-spec compliant Symbols which are polyfilled. | ||
13494 | if (typeof Symbol === 'function' && propValue instanceof Symbol) { | ||
13495 | return true; | ||
13496 | } | ||
13497 | |||
13498 | return false; | ||
13499 | } | ||
13500 | |||
13501 | // Equivalent of `typeof` but with special handling for array and regexp. | ||
13502 | function getPropType(propValue) { | ||
13503 | var propType = typeof propValue; | ||
13504 | if (Array.isArray(propValue)) { | ||
13505 | return 'array'; | ||
13506 | } | ||
13507 | if (propValue instanceof RegExp) { | ||
13508 | // Old webkits (at least until Android 4.0) return 'function' rather than | ||
13509 | // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ | ||
13510 | // passes PropTypes.object. | ||
13511 | return 'object'; | ||
13512 | } | ||
13513 | if (isSymbol(propType, propValue)) { | ||
13514 | return 'symbol'; | ||
13515 | } | ||
13516 | return propType; | ||
13517 | } | ||
13518 | |||
13519 | // This handles more types than `getPropType`. Only used for error messages. | ||
13520 | // See `createPrimitiveTypeChecker`. | ||
13521 | function getPreciseType(propValue) { | ||
13522 | if (typeof propValue === 'undefined' || propValue === null) { | ||
13523 | return '' + propValue; | ||
13524 | } | ||
13525 | var propType = getPropType(propValue); | ||
13526 | if (propType === 'object') { | ||
13527 | if (propValue instanceof Date) { | ||
13528 | return 'date'; | ||
13529 | } else if (propValue instanceof RegExp) { | ||
13530 | return 'regexp'; | ||
13531 | } | ||
13532 | } | ||
13533 | return propType; | ||
13534 | } | ||
13535 | |||
13536 | // Returns a string that is postfixed to a warning about an invalid type. | ||
13537 | // For example, "undefined" or "of type array" | ||
13538 | function getPostfixForTypeWarning(value) { | ||
13539 | var type = getPreciseType(value); | ||
13540 | switch (type) { | ||
13541 | case 'array': | ||
13542 | case 'object': | ||
13543 | return 'an ' + type; | ||
13544 | case 'boolean': | ||
13545 | case 'date': | ||
13546 | case 'regexp': | ||
13547 | return 'a ' + type; | ||
13548 | default: | ||
13549 | return type; | ||
13550 | } | ||
13551 | } | ||
13552 | |||
13553 | // Returns class name of the object, if any. | ||
13554 | function getClassName(propValue) { | ||
13555 | if (!propValue.constructor || !propValue.constructor.name) { | ||
13556 | return ANONYMOUS; | ||
13557 | } | ||
13558 | return propValue.constructor.name; | ||
13559 | } | ||
13560 | |||
13561 | ReactPropTypes.checkPropTypes = checkPropTypes; | ||
13562 | ReactPropTypes.PropTypes = ReactPropTypes; | ||
13563 | |||
13564 | return ReactPropTypes; | ||
13565 | }; | ||
13566 | |||
13567 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
13568 | |||
13569 | /***/ }), | ||
13570 | /* 115 */ | ||
13571 | /***/ (function(module, exports, __webpack_require__) { | ||
13572 | |||
13573 | "use strict"; | ||
13574 | |||
13575 | |||
13576 | Object.defineProperty(exports, "__esModule", { | ||
13577 | value: true | ||
13578 | }); | ||
13579 | var util = { | ||
13580 | isAppearSupported: function isAppearSupported(props) { | ||
13581 | return props.transitionName && props.transitionAppear || props.animation.appear; | ||
13582 | }, | ||
13583 | isEnterSupported: function isEnterSupported(props) { | ||
13584 | return props.transitionName && props.transitionEnter || props.animation.enter; | ||
13585 | }, | ||
13586 | isLeaveSupported: function isLeaveSupported(props) { | ||
13587 | return props.transitionName && props.transitionLeave || props.animation.leave; | ||
13588 | }, | ||
13589 | allowAppearCallback: function allowAppearCallback(props) { | ||
13590 | return props.transitionAppear || props.animation.appear; | ||
13591 | }, | ||
13592 | allowEnterCallback: function allowEnterCallback(props) { | ||
13593 | return props.transitionEnter || props.animation.enter; | ||
13594 | }, | ||
13595 | allowLeaveCallback: function allowLeaveCallback(props) { | ||
13596 | return props.transitionLeave || props.animation.leave; | ||
13597 | } | ||
13598 | }; | ||
13599 | exports["default"] = util; | ||
13600 | module.exports = exports['default']; | ||
13601 | |||
13602 | /***/ }), | ||
13603 | /* 116 */ | ||
13604 | /***/ (function(module, exports, __webpack_require__) { | ||
13605 | |||
13606 | "use strict"; | ||
13607 | |||
13608 | |||
13609 | Object.defineProperty(exports, "__esModule", { | ||
13610 | value: true | ||
13611 | }); | ||
13612 | |||
13613 | var _objectWithoutProperties2 = __webpack_require__(165); | ||
13614 | |||
13615 | var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); | ||
13616 | |||
13617 | var _classCallCheck2 = __webpack_require__(13); | ||
13618 | |||
13619 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
13620 | |||
13621 | var _possibleConstructorReturn2 = __webpack_require__(15); | ||
13622 | |||
13623 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
13624 | |||
13625 | var _inherits2 = __webpack_require__(14); | ||
13626 | |||
13627 | var _inherits3 = _interopRequireDefault(_inherits2); | ||
13628 | |||
13629 | var _react = __webpack_require__(5); | ||
13630 | |||
13631 | var _react2 = _interopRequireDefault(_react); | ||
13632 | |||
13633 | var _propTypes = __webpack_require__(11); | ||
13634 | |||
13635 | var _propTypes2 = _interopRequireDefault(_propTypes); | ||
13636 | |||
13637 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
13638 | |||
13639 | var LazyRenderBox = function (_Component) { | ||
13640 | (0, _inherits3["default"])(LazyRenderBox, _Component); | ||
13641 | |||
13642 | function LazyRenderBox() { | ||
13643 | (0, _classCallCheck3["default"])(this, LazyRenderBox); | ||
13644 | return (0, _possibleConstructorReturn3["default"])(this, _Component.apply(this, arguments)); | ||
13645 | } | ||
13646 | |||
13647 | LazyRenderBox.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { | ||
13648 | return nextProps.hiddenClassName || nextProps.visible; | ||
13649 | }; | ||
13650 | |||
13651 | LazyRenderBox.prototype.render = function render() { | ||
13652 | var _props = this.props, | ||
13653 | hiddenClassName = _props.hiddenClassName, | ||
13654 | visible = _props.visible, | ||
13655 | props = (0, _objectWithoutProperties3["default"])(_props, ['hiddenClassName', 'visible']); | ||
13656 | |||
13657 | |||
13658 | if (hiddenClassName || _react2["default"].Children.count(props.children) > 1) { | ||
13659 | if (!visible && hiddenClassName) { | ||
13660 | props.className += ' ' + hiddenClassName; | ||
13661 | } | ||
13662 | return _react2["default"].createElement('div', props); | ||
13663 | } | ||
13664 | |||
13665 | return _react2["default"].Children.only(props.children); | ||
13666 | }; | ||
13667 | |||
13668 | return LazyRenderBox; | ||
13669 | }(_react.Component); | ||
13670 | |||
13671 | LazyRenderBox.propTypes = { | ||
13672 | children: _propTypes2["default"].any, | ||
13673 | className: _propTypes2["default"].string, | ||
13674 | visible: _propTypes2["default"].bool, | ||
13675 | hiddenClassName: _propTypes2["default"].string | ||
13676 | }; | ||
13677 | exports["default"] = LazyRenderBox; | ||
13678 | module.exports = exports['default']; | ||
13679 | |||
13680 | /***/ }), | ||
13681 | /* 117 */ | ||
13682 | /***/ (function(module, exports, __webpack_require__) { | ||
13683 | |||
13684 | "use strict"; | ||
13685 | |||
13686 | |||
13687 | Object.defineProperty(exports, "__esModule", { | ||
13688 | value: true | ||
13689 | }); | ||
13690 | exports['default'] = addEventListenerWrap; | ||
13691 | |||
13692 | var _addDomEventListener = __webpack_require__(152); | ||
13693 | |||
13694 | var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener); | ||
13695 | |||
13696 | var _reactDom = __webpack_require__(8); | ||
13697 | |||
13698 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
13699 | |||
13700 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
13701 | |||
13702 | function addEventListenerWrap(target, eventType, cb) { | ||
13703 | /* eslint camelcase: 2 */ | ||
13704 | var callback = _reactDom2['default'].unstable_batchedUpdates ? function run(e) { | ||
13705 | _reactDom2['default'].unstable_batchedUpdates(cb, e); | ||
13706 | } : cb; | ||
13707 | return (0, _addDomEventListener2['default'])(target, eventType, callback); | ||
13708 | } | ||
13709 | module.exports = exports['default']; | ||
13710 | |||
13711 | /***/ }), | ||
13712 | /* 118 */ | ||
13713 | /***/ (function(module, exports, __webpack_require__) { | ||
13714 | |||
13715 | "use strict"; | ||
13716 | /** | ||
13717 | * Copyright 2013-present, Facebook, Inc. | ||
13718 | * All rights reserved. | ||
13719 | * | ||
13720 | * This source code is licensed under the BSD-style license found in the | ||
13721 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13722 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13723 | * | ||
13724 | */ | ||
13725 | |||
13726 | |||
13727 | |||
13728 | /** | ||
13729 | * CSS properties which accept numbers but are not in units of "px". | ||
13730 | */ | ||
13731 | |||
13732 | var isUnitlessNumber = { | ||
13733 | animationIterationCount: true, | ||
13734 | borderImageOutset: true, | ||
13735 | borderImageSlice: true, | ||
13736 | borderImageWidth: true, | ||
13737 | boxFlex: true, | ||
13738 | boxFlexGroup: true, | ||
13739 | boxOrdinalGroup: true, | ||
13740 | columnCount: true, | ||
13741 | flex: true, | ||
13742 | flexGrow: true, | ||
13743 | flexPositive: true, | ||
13744 | flexShrink: true, | ||
13745 | flexNegative: true, | ||
13746 | flexOrder: true, | ||
13747 | gridRow: true, | ||
13748 | gridColumn: true, | ||
13749 | fontWeight: true, | ||
13750 | lineClamp: true, | ||
13751 | lineHeight: true, | ||
13752 | opacity: true, | ||
13753 | order: true, | ||
13754 | orphans: true, | ||
13755 | tabSize: true, | ||
13756 | widows: true, | ||
13757 | zIndex: true, | ||
13758 | zoom: true, | ||
13759 | |||
13760 | // SVG-related properties | ||
13761 | fillOpacity: true, | ||
13762 | floodOpacity: true, | ||
13763 | stopOpacity: true, | ||
13764 | strokeDasharray: true, | ||
13765 | strokeDashoffset: true, | ||
13766 | strokeMiterlimit: true, | ||
13767 | strokeOpacity: true, | ||
13768 | strokeWidth: true | ||
13769 | }; | ||
13770 | |||
13771 | /** | ||
13772 | * @param {string} prefix vendor-specific prefix, eg: Webkit | ||
13773 | * @param {string} key style name, eg: transitionDuration | ||
13774 | * @return {string} style name prefixed with `prefix`, properly camelCased, eg: | ||
13775 | * WebkitTransitionDuration | ||
13776 | */ | ||
13777 | function prefixKey(prefix, key) { | ||
13778 | return prefix + key.charAt(0).toUpperCase() + key.substring(1); | ||
13779 | } | ||
13780 | |||
13781 | /** | ||
13782 | * Support style names that may come passed in prefixed by adding permutations | ||
13783 | * of vendor prefixes. | ||
13784 | */ | ||
13785 | var prefixes = ['Webkit', 'ms', 'Moz', 'O']; | ||
13786 | |||
13787 | // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an | ||
13788 | // infinite loop, because it iterates over the newly added props too. | ||
13789 | Object.keys(isUnitlessNumber).forEach(function (prop) { | ||
13790 | prefixes.forEach(function (prefix) { | ||
13791 | isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; | ||
13792 | }); | ||
13793 | }); | ||
13794 | |||
13795 | /** | ||
13796 | * Most style properties can be unset by doing .style[prop] = '' but IE8 | ||
13797 | * doesn't like doing that with shorthand properties so for the properties that | ||
13798 | * IE8 breaks on, which are listed here, we instead unset each of the | ||
13799 | * individual properties. See http://bugs.jquery.com/ticket/12385. | ||
13800 | * The 4-value 'clock' properties like margin, padding, border-width seem to | ||
13801 | * behave without any problems. Curiously, list-style works too without any | ||
13802 | * special prodding. | ||
13803 | */ | ||
13804 | var shorthandPropertyExpansions = { | ||
13805 | background: { | ||
13806 | backgroundAttachment: true, | ||
13807 | backgroundColor: true, | ||
13808 | backgroundImage: true, | ||
13809 | backgroundPositionX: true, | ||
13810 | backgroundPositionY: true, | ||
13811 | backgroundRepeat: true | ||
13812 | }, | ||
13813 | backgroundPosition: { | ||
13814 | backgroundPositionX: true, | ||
13815 | backgroundPositionY: true | ||
13816 | }, | ||
13817 | border: { | ||
13818 | borderWidth: true, | ||
13819 | borderStyle: true, | ||
13820 | borderColor: true | ||
13821 | }, | ||
13822 | borderBottom: { | ||
13823 | borderBottomWidth: true, | ||
13824 | borderBottomStyle: true, | ||
13825 | borderBottomColor: true | ||
13826 | }, | ||
13827 | borderLeft: { | ||
13828 | borderLeftWidth: true, | ||
13829 | borderLeftStyle: true, | ||
13830 | borderLeftColor: true | ||
13831 | }, | ||
13832 | borderRight: { | ||
13833 | borderRightWidth: true, | ||
13834 | borderRightStyle: true, | ||
13835 | borderRightColor: true | ||
13836 | }, | ||
13837 | borderTop: { | ||
13838 | borderTopWidth: true, | ||
13839 | borderTopStyle: true, | ||
13840 | borderTopColor: true | ||
13841 | }, | ||
13842 | font: { | ||
13843 | fontStyle: true, | ||
13844 | fontVariant: true, | ||
13845 | fontWeight: true, | ||
13846 | fontSize: true, | ||
13847 | lineHeight: true, | ||
13848 | fontFamily: true | ||
13849 | }, | ||
13850 | outline: { | ||
13851 | outlineWidth: true, | ||
13852 | outlineStyle: true, | ||
13853 | outlineColor: true | ||
13854 | } | ||
13855 | }; | ||
13856 | |||
13857 | var CSSProperty = { | ||
13858 | isUnitlessNumber: isUnitlessNumber, | ||
13859 | shorthandPropertyExpansions: shorthandPropertyExpansions | ||
13860 | }; | ||
13861 | |||
13862 | module.exports = CSSProperty; | ||
13863 | |||
13864 | /***/ }), | ||
13865 | /* 119 */ | ||
13866 | /***/ (function(module, exports, __webpack_require__) { | ||
13867 | |||
13868 | "use strict"; | ||
13869 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13870 | * Copyright 2013-present, Facebook, Inc. | ||
13871 | * All rights reserved. | ||
13872 | * | ||
13873 | * This source code is licensed under the BSD-style license found in the | ||
13874 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13875 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13876 | * | ||
13877 | * | ||
13878 | */ | ||
13879 | |||
13880 | |||
13881 | |||
13882 | var _prodInvariant = __webpack_require__(3); | ||
13883 | |||
13884 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
13885 | |||
13886 | var PooledClass = __webpack_require__(30); | ||
13887 | |||
13888 | var invariant = __webpack_require__(1); | ||
13889 | |||
13890 | /** | ||
13891 | * A specialized pseudo-event module to help keep track of components waiting to | ||
13892 | * be notified when their DOM representations are available for use. | ||
13893 | * | ||
13894 | * This implements `PooledClass`, so you should never need to instantiate this. | ||
13895 | * Instead, use `CallbackQueue.getPooled()`. | ||
13896 | * | ||
13897 | * @class ReactMountReady | ||
13898 | * @implements PooledClass | ||
13899 | * @internal | ||
13900 | */ | ||
13901 | |||
13902 | var CallbackQueue = function () { | ||
13903 | function CallbackQueue(arg) { | ||
13904 | _classCallCheck(this, CallbackQueue); | ||
13905 | |||
13906 | this._callbacks = null; | ||
13907 | this._contexts = null; | ||
13908 | this._arg = arg; | ||
13909 | } | ||
13910 | |||
13911 | /** | ||
13912 | * Enqueues a callback to be invoked when `notifyAll` is invoked. | ||
13913 | * | ||
13914 | * @param {function} callback Invoked when `notifyAll` is invoked. | ||
13915 | * @param {?object} context Context to call `callback` with. | ||
13916 | * @internal | ||
13917 | */ | ||
13918 | |||
13919 | |||
13920 | CallbackQueue.prototype.enqueue = function enqueue(callback, context) { | ||
13921 | this._callbacks = this._callbacks || []; | ||
13922 | this._callbacks.push(callback); | ||
13923 | this._contexts = this._contexts || []; | ||
13924 | this._contexts.push(context); | ||
13925 | }; | ||
13926 | |||
13927 | /** | ||
13928 | * Invokes all enqueued callbacks and clears the queue. This is invoked after | ||
13929 | * the DOM representation of a component has been created or updated. | ||
13930 | * | ||
13931 | * @internal | ||
13932 | */ | ||
13933 | |||
13934 | |||
13935 | CallbackQueue.prototype.notifyAll = function notifyAll() { | ||
13936 | var callbacks = this._callbacks; | ||
13937 | var contexts = this._contexts; | ||
13938 | var arg = this._arg; | ||
13939 | if (callbacks && contexts) { | ||
13940 | !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0; | ||
13941 | this._callbacks = null; | ||
13942 | this._contexts = null; | ||
13943 | for (var i = 0; i < callbacks.length; i++) { | ||
13944 | callbacks[i].call(contexts[i], arg); | ||
13945 | } | ||
13946 | callbacks.length = 0; | ||
13947 | contexts.length = 0; | ||
13948 | } | ||
13949 | }; | ||
13950 | |||
13951 | CallbackQueue.prototype.checkpoint = function checkpoint() { | ||
13952 | return this._callbacks ? this._callbacks.length : 0; | ||
13953 | }; | ||
13954 | |||
13955 | CallbackQueue.prototype.rollback = function rollback(len) { | ||
13956 | if (this._callbacks && this._contexts) { | ||
13957 | this._callbacks.length = len; | ||
13958 | this._contexts.length = len; | ||
13959 | } | ||
13960 | }; | ||
13961 | |||
13962 | /** | ||
13963 | * Resets the internal queue. | ||
13964 | * | ||
13965 | * @internal | ||
13966 | */ | ||
13967 | |||
13968 | |||
13969 | CallbackQueue.prototype.reset = function reset() { | ||
13970 | this._callbacks = null; | ||
13971 | this._contexts = null; | ||
13972 | }; | ||
13973 | |||
13974 | /** | ||
13975 | * `PooledClass` looks for this. | ||
13976 | */ | ||
13977 | |||
13978 | |||
13979 | CallbackQueue.prototype.destructor = function destructor() { | ||
13980 | this.reset(); | ||
13981 | }; | ||
13982 | |||
13983 | return CallbackQueue; | ||
13984 | }(); | ||
13985 | |||
13986 | module.exports = PooledClass.addPoolingTo(CallbackQueue); | ||
13987 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
13988 | |||
13989 | /***/ }), | ||
13990 | /* 120 */ | ||
13991 | /***/ (function(module, exports, __webpack_require__) { | ||
13992 | |||
13993 | "use strict"; | ||
13994 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13995 | * Copyright 2013-present, Facebook, Inc. | ||
13996 | * All rights reserved. | ||
13997 | * | ||
13998 | * This source code is licensed under the BSD-style license found in the | ||
13999 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14000 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14001 | * | ||
14002 | */ | ||
14003 | |||
14004 | |||
14005 | |||
14006 | var DOMProperty = __webpack_require__(21); | ||
14007 | var ReactDOMComponentTree = __webpack_require__(6); | ||
14008 | var ReactInstrumentation = __webpack_require__(12); | ||
14009 | |||
14010 | var quoteAttributeValueForBrowser = __webpack_require__(310); | ||
14011 | var warning = __webpack_require__(2); | ||
14012 | |||
14013 | var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); | ||
14014 | var illegalAttributeNameCache = {}; | ||
14015 | var validatedAttributeNameCache = {}; | ||
14016 | |||
14017 | function isAttributeNameSafe(attributeName) { | ||
14018 | if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { | ||
14019 | return true; | ||
14020 | } | ||
14021 | if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { | ||
14022 | return false; | ||
14023 | } | ||
14024 | if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { | ||
14025 | validatedAttributeNameCache[attributeName] = true; | ||
14026 | return true; | ||
14027 | } | ||
14028 | illegalAttributeNameCache[attributeName] = true; | ||
14029 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0; | ||
14030 | return false; | ||
14031 | } | ||
14032 | |||
14033 | function shouldIgnoreValue(propertyInfo, value) { | ||
14034 | return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false; | ||
14035 | } | ||
14036 | |||
14037 | /** | ||
14038 | * Operations for dealing with DOM properties. | ||
14039 | */ | ||
14040 | var DOMPropertyOperations = { | ||
14041 | |||
14042 | /** | ||
14043 | * Creates markup for the ID property. | ||
14044 | * | ||
14045 | * @param {string} id Unescaped ID. | ||
14046 | * @return {string} Markup string. | ||
14047 | */ | ||
14048 | createMarkupForID: function (id) { | ||
14049 | return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id); | ||
14050 | }, | ||
14051 | |||
14052 | setAttributeForID: function (node, id) { | ||
14053 | node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id); | ||
14054 | }, | ||
14055 | |||
14056 | createMarkupForRoot: function () { | ||
14057 | return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""'; | ||
14058 | }, | ||
14059 | |||
14060 | setAttributeForRoot: function (node) { | ||
14061 | node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, ''); | ||
14062 | }, | ||
14063 | |||
14064 | /** | ||
14065 | * Creates markup for a property. | ||
14066 | * | ||
14067 | * @param {string} name | ||
14068 | * @param {*} value | ||
14069 | * @return {?string} Markup string, or null if the property was invalid. | ||
14070 | */ | ||
14071 | createMarkupForProperty: function (name, value) { | ||
14072 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
14073 | if (propertyInfo) { | ||
14074 | if (shouldIgnoreValue(propertyInfo, value)) { | ||
14075 | return ''; | ||
14076 | } | ||
14077 | var attributeName = propertyInfo.attributeName; | ||
14078 | if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | ||
14079 | return attributeName + '=""'; | ||
14080 | } | ||
14081 | return attributeName + '=' + quoteAttributeValueForBrowser(value); | ||
14082 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
14083 | if (value == null) { | ||
14084 | return ''; | ||
14085 | } | ||
14086 | return name + '=' + quoteAttributeValueForBrowser(value); | ||
14087 | } | ||
14088 | return null; | ||
14089 | }, | ||
14090 | |||
14091 | /** | ||
14092 | * Creates markup for a custom property. | ||
14093 | * | ||
14094 | * @param {string} name | ||
14095 | * @param {*} value | ||
14096 | * @return {string} Markup string, or empty string if the property was invalid. | ||
14097 | */ | ||
14098 | createMarkupForCustomAttribute: function (name, value) { | ||
14099 | if (!isAttributeNameSafe(name) || value == null) { | ||
14100 | return ''; | ||
14101 | } | ||
14102 | return name + '=' + quoteAttributeValueForBrowser(value); | ||
14103 | }, | ||
14104 | |||
14105 | /** | ||
14106 | * Sets the value for a property on a node. | ||
14107 | * | ||
14108 | * @param {DOMElement} node | ||
14109 | * @param {string} name | ||
14110 | * @param {*} value | ||
14111 | */ | ||
14112 | setValueForProperty: function (node, name, value) { | ||
14113 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
14114 | if (propertyInfo) { | ||
14115 | var mutationMethod = propertyInfo.mutationMethod; | ||
14116 | if (mutationMethod) { | ||
14117 | mutationMethod(node, value); | ||
14118 | } else if (shouldIgnoreValue(propertyInfo, value)) { | ||
14119 | this.deleteValueForProperty(node, name); | ||
14120 | return; | ||
14121 | } else if (propertyInfo.mustUseProperty) { | ||
14122 | // Contrary to `setAttribute`, object properties are properly | ||
14123 | // `toString`ed by IE8/9. | ||
14124 | node[propertyInfo.propertyName] = value; | ||
14125 | } else { | ||
14126 | var attributeName = propertyInfo.attributeName; | ||
14127 | var namespace = propertyInfo.attributeNamespace; | ||
14128 | // `setAttribute` with objects becomes only `[object]` in IE8/9, | ||
14129 | // ('' + value) makes it output the correct toString()-value. | ||
14130 | if (namespace) { | ||
14131 | node.setAttributeNS(namespace, attributeName, '' + value); | ||
14132 | } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | ||
14133 | node.setAttribute(attributeName, ''); | ||
14134 | } else { | ||
14135 | node.setAttribute(attributeName, '' + value); | ||
14136 | } | ||
14137 | } | ||
14138 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
14139 | DOMPropertyOperations.setValueForAttribute(node, name, value); | ||
14140 | return; | ||
14141 | } | ||
14142 | |||
14143 | if (process.env.NODE_ENV !== 'production') { | ||
14144 | var payload = {}; | ||
14145 | payload[name] = value; | ||
14146 | ReactInstrumentation.debugTool.onHostOperation({ | ||
14147 | instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | ||
14148 | type: 'update attribute', | ||
14149 | payload: payload | ||
14150 | }); | ||
14151 | } | ||
14152 | }, | ||
14153 | |||
14154 | setValueForAttribute: function (node, name, value) { | ||
14155 | if (!isAttributeNameSafe(name)) { | ||
14156 | return; | ||
14157 | } | ||
14158 | if (value == null) { | ||
14159 | node.removeAttribute(name); | ||
14160 | } else { | ||
14161 | node.setAttribute(name, '' + value); | ||
14162 | } | ||
14163 | |||
14164 | if (process.env.NODE_ENV !== 'production') { | ||
14165 | var payload = {}; | ||
14166 | payload[name] = value; | ||
14167 | ReactInstrumentation.debugTool.onHostOperation({ | ||
14168 | instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | ||
14169 | type: 'update attribute', | ||
14170 | payload: payload | ||
14171 | }); | ||
14172 | } | ||
14173 | }, | ||
14174 | |||
14175 | /** | ||
14176 | * Deletes an attributes from a node. | ||
14177 | * | ||
14178 | * @param {DOMElement} node | ||
14179 | * @param {string} name | ||
14180 | */ | ||
14181 | deleteValueForAttribute: function (node, name) { | ||
14182 | node.removeAttribute(name); | ||
14183 | if (process.env.NODE_ENV !== 'production') { | ||
14184 | ReactInstrumentation.debugTool.onHostOperation({ | ||
14185 | instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | ||
14186 | type: 'remove attribute', | ||
14187 | payload: name | ||
14188 | }); | ||
14189 | } | ||
14190 | }, | ||
14191 | |||
14192 | /** | ||
14193 | * Deletes the value for a property on a node. | ||
14194 | * | ||
14195 | * @param {DOMElement} node | ||
14196 | * @param {string} name | ||
14197 | */ | ||
14198 | deleteValueForProperty: function (node, name) { | ||
14199 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
14200 | if (propertyInfo) { | ||
14201 | var mutationMethod = propertyInfo.mutationMethod; | ||
14202 | if (mutationMethod) { | ||
14203 | mutationMethod(node, undefined); | ||
14204 | } else if (propertyInfo.mustUseProperty) { | ||
14205 | var propName = propertyInfo.propertyName; | ||
14206 | if (propertyInfo.hasBooleanValue) { | ||
14207 | node[propName] = false; | ||
14208 | } else { | ||
14209 | node[propName] = ''; | ||
14210 | } | ||
14211 | } else { | ||
14212 | node.removeAttribute(propertyInfo.attributeName); | ||
14213 | } | ||
14214 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
14215 | node.removeAttribute(name); | ||
14216 | } | ||
14217 | |||
14218 | if (process.env.NODE_ENV !== 'production') { | ||
14219 | ReactInstrumentation.debugTool.onHostOperation({ | ||
14220 | instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | ||
14221 | type: 'remove attribute', | ||
14222 | payload: name | ||
14223 | }); | ||
14224 | } | ||
14225 | } | ||
14226 | |||
14227 | }; | ||
14228 | |||
14229 | module.exports = DOMPropertyOperations; | ||
14230 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
14231 | |||
14232 | /***/ }), | ||
14233 | /* 121 */ | ||
14234 | /***/ (function(module, exports, __webpack_require__) { | ||
14235 | |||
14236 | "use strict"; | ||
14237 | /** | ||
14238 | * Copyright 2015-present, Facebook, Inc. | ||
14239 | * All rights reserved. | ||
14240 | * | ||
14241 | * This source code is licensed under the BSD-style license found in the | ||
14242 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14243 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14244 | * | ||
14245 | */ | ||
14246 | |||
14247 | |||
14248 | |||
14249 | var ReactDOMComponentFlags = { | ||
14250 | hasCachedChildNodes: 1 << 0 | ||
14251 | }; | ||
14252 | |||
14253 | module.exports = ReactDOMComponentFlags; | ||
14254 | |||
14255 | /***/ }), | ||
14256 | /* 122 */ | ||
14257 | /***/ (function(module, exports, __webpack_require__) { | ||
14258 | |||
14259 | "use strict"; | ||
14260 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
14261 | * Copyright 2013-present, Facebook, Inc. | ||
14262 | * All rights reserved. | ||
14263 | * | ||
14264 | * This source code is licensed under the BSD-style license found in the | ||
14265 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14266 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14267 | * | ||
14268 | */ | ||
14269 | |||
14270 | |||
14271 | |||
14272 | var _assign = __webpack_require__(4); | ||
14273 | |||
14274 | var LinkedValueUtils = __webpack_require__(79); | ||
14275 | var ReactDOMComponentTree = __webpack_require__(6); | ||
14276 | var ReactUpdates = __webpack_require__(16); | ||
14277 | |||
14278 | var warning = __webpack_require__(2); | ||
14279 | |||
14280 | var didWarnValueLink = false; | ||
14281 | var didWarnValueDefaultValue = false; | ||
14282 | |||
14283 | function updateOptionsIfPendingUpdateAndMounted() { | ||
14284 | if (this._rootNodeID && this._wrapperState.pendingUpdate) { | ||
14285 | this._wrapperState.pendingUpdate = false; | ||
14286 | |||
14287 | var props = this._currentElement.props; | ||
14288 | var value = LinkedValueUtils.getValue(props); | ||
14289 | |||
14290 | if (value != null) { | ||
14291 | updateOptions(this, Boolean(props.multiple), value); | ||
14292 | } | ||
14293 | } | ||
14294 | } | ||
14295 | |||
14296 | function getDeclarationErrorAddendum(owner) { | ||
14297 | if (owner) { | ||
14298 | var name = owner.getName(); | ||
14299 | if (name) { | ||
14300 | return ' Check the render method of `' + name + '`.'; | ||
14301 | } | ||
14302 | } | ||
14303 | return ''; | ||
14304 | } | ||
14305 | |||
14306 | var valuePropNames = ['value', 'defaultValue']; | ||
14307 | |||
14308 | /** | ||
14309 | * Validation function for `value` and `defaultValue`. | ||
14310 | * @private | ||
14311 | */ | ||
14312 | function checkSelectPropTypes(inst, props) { | ||
14313 | var owner = inst._currentElement._owner; | ||
14314 | LinkedValueUtils.checkPropTypes('select', props, owner); | ||
14315 | |||
14316 | if (props.valueLink !== undefined && !didWarnValueLink) { | ||
14317 | process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0; | ||
14318 | didWarnValueLink = true; | ||
14319 | } | ||
14320 | |||
14321 | for (var i = 0; i < valuePropNames.length; i++) { | ||
14322 | var propName = valuePropNames[i]; | ||
14323 | if (props[propName] == null) { | ||
14324 | continue; | ||
14325 | } | ||
14326 | var isArray = Array.isArray(props[propName]); | ||
14327 | if (props.multiple && !isArray) { | ||
14328 | 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; | ||
14329 | } else if (!props.multiple && isArray) { | ||
14330 | 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; | ||
14331 | } | ||
14332 | } | ||
14333 | } | ||
14334 | |||
14335 | /** | ||
14336 | * @param {ReactDOMComponent} inst | ||
14337 | * @param {boolean} multiple | ||
14338 | * @param {*} propValue A stringable (with `multiple`, a list of stringables). | ||
14339 | * @private | ||
14340 | */ | ||
14341 | function updateOptions(inst, multiple, propValue) { | ||
14342 | var selectedValue, i; | ||
14343 | var options = ReactDOMComponentTree.getNodeFromInstance(inst).options; | ||
14344 | |||
14345 | if (multiple) { | ||
14346 | selectedValue = {}; | ||
14347 | for (i = 0; i < propValue.length; i++) { | ||
14348 | selectedValue['' + propValue[i]] = true; | ||
14349 | } | ||
14350 | for (i = 0; i < options.length; i++) { | ||
14351 | var selected = selectedValue.hasOwnProperty(options[i].value); | ||
14352 | if (options[i].selected !== selected) { | ||
14353 | options[i].selected = selected; | ||
14354 | } | ||
14355 | } | ||
14356 | } else { | ||
14357 | // Do not set `select.value` as exact behavior isn't consistent across all | ||
14358 | // browsers for all cases. | ||
14359 | selectedValue = '' + propValue; | ||
14360 | for (i = 0; i < options.length; i++) { | ||
14361 | if (options[i].value === selectedValue) { | ||
14362 | options[i].selected = true; | ||
14363 | return; | ||
14364 | } | ||
14365 | } | ||
14366 | if (options.length) { | ||
14367 | options[0].selected = true; | ||
14368 | } | ||
14369 | } | ||
14370 | } | ||
14371 | |||
14372 | /** | ||
14373 | * Implements a <select> host component that allows optionally setting the | ||
14374 | * props `value` and `defaultValue`. If `multiple` is false, the prop must be a | ||
14375 | * stringable. If `multiple` is true, the prop must be an array of stringables. | ||
14376 | * | ||
14377 | * If `value` is not supplied (or null/undefined), user actions that change the | ||
14378 | * selected option will trigger updates to the rendered options. | ||
14379 | * | ||
14380 | * If it is supplied (and not null/undefined), the rendered options will not | ||
14381 | * update in response to user actions. Instead, the `value` prop must change in | ||
14382 | * order for the rendered options to update. | ||
14383 | * | ||
14384 | * If `defaultValue` is provided, any options with the supplied values will be | ||
14385 | * selected. | ||
14386 | */ | ||
14387 | var ReactDOMSelect = { | ||
14388 | getHostProps: function (inst, props) { | ||
14389 | return _assign({}, props, { | ||
14390 | onChange: inst._wrapperState.onChange, | ||
14391 | value: undefined | ||
14392 | }); | ||
14393 | }, | ||
14394 | |||
14395 | mountWrapper: function (inst, props) { | ||
14396 | if (process.env.NODE_ENV !== 'production') { | ||
14397 | checkSelectPropTypes(inst, props); | ||
14398 | } | ||
14399 | |||
14400 | var value = LinkedValueUtils.getValue(props); | ||
14401 | inst._wrapperState = { | ||
14402 | pendingUpdate: false, | ||
14403 | initialValue: value != null ? value : props.defaultValue, | ||
14404 | listeners: null, | ||
14405 | onChange: _handleChange.bind(inst), | ||
14406 | wasMultiple: Boolean(props.multiple) | ||
14407 | }; | ||
14408 | |||
14409 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { | ||
14410 | 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; | ||
14411 | didWarnValueDefaultValue = true; | ||
14412 | } | ||
14413 | }, | ||
14414 | |||
14415 | getSelectValueContext: function (inst) { | ||
14416 | // ReactDOMOption looks at this initial value so the initial generated | ||
14417 | // markup has correct `selected` attributes | ||
14418 | return inst._wrapperState.initialValue; | ||
14419 | }, | ||
14420 | |||
14421 | postUpdateWrapper: function (inst) { | ||
14422 | var props = inst._currentElement.props; | ||
14423 | |||
14424 | // After the initial mount, we control selected-ness manually so don't pass | ||
14425 | // this value down | ||
14426 | inst._wrapperState.initialValue = undefined; | ||
14427 | |||
14428 | var wasMultiple = inst._wrapperState.wasMultiple; | ||
14429 | inst._wrapperState.wasMultiple = Boolean(props.multiple); | ||
14430 | |||
14431 | var value = LinkedValueUtils.getValue(props); | ||
14432 | if (value != null) { | ||
14433 | inst._wrapperState.pendingUpdate = false; | ||
14434 | updateOptions(inst, Boolean(props.multiple), value); | ||
14435 | } else if (wasMultiple !== Boolean(props.multiple)) { | ||
14436 | // For simplicity, reapply `defaultValue` if `multiple` is toggled. | ||
14437 | if (props.defaultValue != null) { | ||
14438 | updateOptions(inst, Boolean(props.multiple), props.defaultValue); | ||
14439 | } else { | ||
14440 | // Revert the select back to its default unselected state. | ||
14441 | updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : ''); | ||
14442 | } | ||
14443 | } | ||
14444 | } | ||
14445 | }; | ||
14446 | |||
14447 | function _handleChange(event) { | ||
14448 | var props = this._currentElement.props; | ||
14449 | var returnValue = LinkedValueUtils.executeOnChange(props, event); | ||
14450 | |||
14451 | if (this._rootNodeID) { | ||
14452 | this._wrapperState.pendingUpdate = true; | ||
14453 | } | ||
14454 | ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); | ||
14455 | return returnValue; | ||
14456 | } | ||
14457 | |||
14458 | module.exports = ReactDOMSelect; | ||
14459 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
14460 | |||
14461 | /***/ }), | ||
14462 | /* 123 */ | ||
14463 | /***/ (function(module, exports, __webpack_require__) { | ||
14464 | |||
14465 | "use strict"; | ||
14466 | /** | ||
14467 | * Copyright 2014-present, Facebook, Inc. | ||
14468 | * All rights reserved. | ||
14469 | * | ||
14470 | * This source code is licensed under the BSD-style license found in the | ||
14471 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14472 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14473 | * | ||
14474 | */ | ||
14475 | |||
14476 | |||
14477 | |||
14478 | var emptyComponentFactory; | ||
14479 | |||
14480 | var ReactEmptyComponentInjection = { | ||
14481 | injectEmptyComponentFactory: function (factory) { | ||
14482 | emptyComponentFactory = factory; | ||
14483 | } | ||
14484 | }; | ||
14485 | |||
14486 | var ReactEmptyComponent = { | ||
14487 | create: function (instantiate) { | ||
14488 | return emptyComponentFactory(instantiate); | ||
14489 | } | ||
14490 | }; | ||
14491 | |||
14492 | ReactEmptyComponent.injection = ReactEmptyComponentInjection; | ||
14493 | |||
14494 | module.exports = ReactEmptyComponent; | ||
14495 | |||
14496 | /***/ }), | ||
14497 | /* 124 */ | ||
14498 | /***/ (function(module, exports, __webpack_require__) { | ||
14499 | |||
14500 | "use strict"; | ||
14501 | /** | ||
14502 | * Copyright 2013-present, Facebook, Inc. | ||
14503 | * All rights reserved. | ||
14504 | * | ||
14505 | * This source code is licensed under the BSD-style license found in the | ||
14506 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14507 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14508 | * | ||
14509 | * | ||
14510 | */ | ||
14511 | |||
14512 | |||
14513 | |||
14514 | var ReactFeatureFlags = { | ||
14515 | // When true, call console.time() before and .timeEnd() after each top-level | ||
14516 | // render (both initial renders and updates). Useful when looking at prod-mode | ||
14517 | // timeline profiles in Chrome, for example. | ||
14518 | logTopLevelRenders: false | ||
14519 | }; | ||
14520 | |||
14521 | module.exports = ReactFeatureFlags; | ||
14522 | |||
14523 | /***/ }), | ||
14524 | /* 125 */ | ||
14525 | /***/ (function(module, exports, __webpack_require__) { | ||
14526 | |||
14527 | "use strict"; | ||
14528 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
14529 | * Copyright 2014-present, Facebook, Inc. | ||
14530 | * All rights reserved. | ||
14531 | * | ||
14532 | * This source code is licensed under the BSD-style license found in the | ||
14533 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14534 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14535 | * | ||
14536 | */ | ||
14537 | |||
14538 | |||
14539 | |||
14540 | var _prodInvariant = __webpack_require__(3); | ||
14541 | |||
14542 | var invariant = __webpack_require__(1); | ||
14543 | |||
14544 | var genericComponentClass = null; | ||
14545 | var textComponentClass = null; | ||
14546 | |||
14547 | var ReactHostComponentInjection = { | ||
14548 | // This accepts a class that receives the tag string. This is a catch all | ||
14549 | // that can render any kind of tag. | ||
14550 | injectGenericComponentClass: function (componentClass) { | ||
14551 | genericComponentClass = componentClass; | ||
14552 | }, | ||
14553 | // This accepts a text component class that takes the text string to be | ||
14554 | // rendered as props. | ||
14555 | injectTextComponentClass: function (componentClass) { | ||
14556 | textComponentClass = componentClass; | ||
14557 | } | ||
14558 | }; | ||
14559 | |||
14560 | /** | ||
14561 | * Get a host internal component class for a specific tag. | ||
14562 | * | ||
14563 | * @param {ReactElement} element The element to create. | ||
14564 | * @return {function} The internal class constructor function. | ||
14565 | */ | ||
14566 | function createInternalComponent(element) { | ||
14567 | !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; | ||
14568 | return new genericComponentClass(element); | ||
14569 | } | ||
14570 | |||
14571 | /** | ||
14572 | * @param {ReactText} text | ||
14573 | * @return {ReactComponent} | ||
14574 | */ | ||
14575 | function createInstanceForText(text) { | ||
14576 | return new textComponentClass(text); | ||
14577 | } | ||
14578 | |||
14579 | /** | ||
14580 | * @param {ReactComponent} component | ||
14581 | * @return {boolean} | ||
14582 | */ | ||
14583 | function isTextComponent(component) { | ||
14584 | return component instanceof textComponentClass; | ||
14585 | } | ||
14586 | |||
14587 | var ReactHostComponent = { | ||
14588 | createInternalComponent: createInternalComponent, | ||
14589 | createInstanceForText: createInstanceForText, | ||
14590 | isTextComponent: isTextComponent, | ||
14591 | injection: ReactHostComponentInjection | ||
14592 | }; | ||
14593 | |||
14594 | module.exports = ReactHostComponent; | ||
14595 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
14596 | |||
14597 | /***/ }), | ||
14598 | /* 126 */ | ||
14599 | /***/ (function(module, exports, __webpack_require__) { | ||
14600 | |||
14601 | "use strict"; | ||
14602 | /** | ||
14603 | * Copyright 2013-present, Facebook, Inc. | ||
14604 | * All rights reserved. | ||
14605 | * | ||
14606 | * This source code is licensed under the BSD-style license found in the | ||
14607 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14608 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14609 | * | ||
14610 | */ | ||
14611 | |||
14612 | |||
14613 | |||
14614 | var ReactDOMSelection = __webpack_require__(265); | ||
14615 | |||
14616 | var containsNode = __webpack_require__(214); | ||
14617 | var focusNode = __webpack_require__(111); | ||
14618 | var getActiveElement = __webpack_require__(112); | ||
14619 | |||
14620 | function isInDocument(node) { | ||
14621 | return containsNode(document.documentElement, node); | ||
14622 | } | ||
14623 | |||
14624 | /** | ||
14625 | * @ReactInputSelection: React input selection module. Based on Selection.js, | ||
14626 | * but modified to be suitable for react and has a couple of bug fixes (doesn't | ||
14627 | * assume buttons have range selections allowed). | ||
14628 | * Input selection module for React. | ||
14629 | */ | ||
14630 | var ReactInputSelection = { | ||
14631 | |||
14632 | hasSelectionCapabilities: function (elem) { | ||
14633 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); | ||
14634 | return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true'); | ||
14635 | }, | ||
14636 | |||
14637 | getSelectionInformation: function () { | ||
14638 | var focusedElem = getActiveElement(); | ||
14639 | return { | ||
14640 | focusedElem: focusedElem, | ||
14641 | selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null | ||
14642 | }; | ||
14643 | }, | ||
14644 | |||
14645 | /** | ||
14646 | * @restoreSelection: If any selection information was potentially lost, | ||
14647 | * restore it. This is useful when performing operations that could remove dom | ||
14648 | * nodes and place them back in, resulting in focus being lost. | ||
14649 | */ | ||
14650 | restoreSelection: function (priorSelectionInformation) { | ||
14651 | var curFocusedElem = getActiveElement(); | ||
14652 | var priorFocusedElem = priorSelectionInformation.focusedElem; | ||
14653 | var priorSelectionRange = priorSelectionInformation.selectionRange; | ||
14654 | if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { | ||
14655 | if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) { | ||
14656 | ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange); | ||
14657 | } | ||
14658 | focusNode(priorFocusedElem); | ||
14659 | } | ||
14660 | }, | ||
14661 | |||
14662 | /** | ||
14663 | * @getSelection: Gets the selection bounds of a focused textarea, input or | ||
14664 | * contentEditable node. | ||
14665 | * -@input: Look up selection bounds of this input | ||
14666 | * -@return {start: selectionStart, end: selectionEnd} | ||
14667 | */ | ||
14668 | getSelection: function (input) { | ||
14669 | var selection; | ||
14670 | |||
14671 | if ('selectionStart' in input) { | ||
14672 | // Modern browser with input or textarea. | ||
14673 | selection = { | ||
14674 | start: input.selectionStart, | ||
14675 | end: input.selectionEnd | ||
14676 | }; | ||
14677 | } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { | ||
14678 | // IE8 input. | ||
14679 | var range = document.selection.createRange(); | ||
14680 | // There can only be one selection per document in IE, so it must | ||
14681 | // be in our element. | ||
14682 | if (range.parentElement() === input) { | ||
14683 | selection = { | ||
14684 | start: -range.moveStart('character', -input.value.length), | ||
14685 | end: -range.moveEnd('character', -input.value.length) | ||
14686 | }; | ||
14687 | } | ||
14688 | } else { | ||
14689 | // Content editable or old IE textarea. | ||
14690 | selection = ReactDOMSelection.getOffsets(input); | ||
14691 | } | ||
14692 | |||
14693 | return selection || { start: 0, end: 0 }; | ||
14694 | }, | ||
14695 | |||
14696 | /** | ||
14697 | * @setSelection: Sets the selection bounds of a textarea or input and focuses | ||
14698 | * the input. | ||
14699 | * -@input Set selection bounds of this input or textarea | ||
14700 | * -@offsets Object of same form that is returned from get* | ||
14701 | */ | ||
14702 | setSelection: function (input, offsets) { | ||
14703 | var start = offsets.start; | ||
14704 | var end = offsets.end; | ||
14705 | if (end === undefined) { | ||
14706 | end = start; | ||
14707 | } | ||
14708 | |||
14709 | if ('selectionStart' in input) { | ||
14710 | input.selectionStart = start; | ||
14711 | input.selectionEnd = Math.min(end, input.value.length); | ||
14712 | } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { | ||
14713 | var range = input.createTextRange(); | ||
14714 | range.collapse(true); | ||
14715 | range.moveStart('character', start); | ||
14716 | range.moveEnd('character', end - start); | ||
14717 | range.select(); | ||
14718 | } else { | ||
14719 | ReactDOMSelection.setOffsets(input, offsets); | ||
14720 | } | ||
14721 | } | ||
14722 | }; | ||
14723 | |||
14724 | module.exports = ReactInputSelection; | ||
14725 | |||
14726 | /***/ }), | ||
14727 | /* 127 */ | ||
14728 | /***/ (function(module, exports, __webpack_require__) { | ||
14729 | |||
14730 | "use strict"; | ||
14731 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
14732 | * Copyright 2013-present, Facebook, Inc. | ||
14733 | * All rights reserved. | ||
14734 | * | ||
14735 | * This source code is licensed under the BSD-style license found in the | ||
14736 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14737 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14738 | * | ||
14739 | */ | ||
14740 | |||
14741 | |||
14742 | |||
14743 | var _prodInvariant = __webpack_require__(3); | ||
14744 | |||
14745 | var DOMLazyTree = __webpack_require__(37); | ||
14746 | var DOMProperty = __webpack_require__(21); | ||
14747 | var React = __webpack_require__(39); | ||
14748 | var ReactBrowserEventEmitter = __webpack_require__(54); | ||
14749 | var ReactCurrentOwner = __webpack_require__(17); | ||
14750 | var ReactDOMComponentTree = __webpack_require__(6); | ||
14751 | var ReactDOMContainerInfo = __webpack_require__(257); | ||
14752 | var ReactDOMFeatureFlags = __webpack_require__(259); | ||
14753 | var ReactFeatureFlags = __webpack_require__(124); | ||
14754 | var ReactInstanceMap = __webpack_require__(47); | ||
14755 | var ReactInstrumentation = __webpack_require__(12); | ||
14756 | var ReactMarkupChecksum = __webpack_require__(279); | ||
14757 | var ReactReconciler = __webpack_require__(38); | ||
14758 | var ReactUpdateQueue = __webpack_require__(82); | ||
14759 | var ReactUpdates = __webpack_require__(16); | ||
14760 | |||
14761 | var emptyObject = __webpack_require__(36); | ||
14762 | var instantiateReactComponent = __webpack_require__(135); | ||
14763 | var invariant = __webpack_require__(1); | ||
14764 | var setInnerHTML = __webpack_require__(58); | ||
14765 | var shouldUpdateReactComponent = __webpack_require__(88); | ||
14766 | var warning = __webpack_require__(2); | ||
14767 | |||
14768 | var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; | ||
14769 | var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME; | ||
14770 | |||
14771 | var ELEMENT_NODE_TYPE = 1; | ||
14772 | var DOC_NODE_TYPE = 9; | ||
14773 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11; | ||
14774 | |||
14775 | var instancesByReactRootID = {}; | ||
14776 | |||
14777 | /** | ||
14778 | * Finds the index of the first character | ||
14779 | * that's not common between the two given strings. | ||
14780 | * | ||
14781 | * @return {number} the index of the character where the strings diverge | ||
14782 | */ | ||
14783 | function firstDifferenceIndex(string1, string2) { | ||
14784 | var minLen = Math.min(string1.length, string2.length); | ||
14785 | for (var i = 0; i < minLen; i++) { | ||
14786 | if (string1.charAt(i) !== string2.charAt(i)) { | ||
14787 | return i; | ||
14788 | } | ||
14789 | } | ||
14790 | return string1.length === string2.length ? -1 : minLen; | ||
14791 | } | ||
14792 | |||
14793 | /** | ||
14794 | * @param {DOMElement|DOMDocument} container DOM element that may contain | ||
14795 | * a React component | ||
14796 | * @return {?*} DOM element that may have the reactRoot ID, or null. | ||
14797 | */ | ||
14798 | function getReactRootElementInContainer(container) { | ||
14799 | if (!container) { | ||
14800 | return null; | ||
14801 | } | ||
14802 | |||
14803 | if (container.nodeType === DOC_NODE_TYPE) { | ||
14804 | return container.documentElement; | ||
14805 | } else { | ||
14806 | return container.firstChild; | ||
14807 | } | ||
14808 | } | ||
14809 | |||
14810 | function internalGetID(node) { | ||
14811 | // If node is something like a window, document, or text node, none of | ||
14812 | // which support attributes or a .getAttribute method, gracefully return | ||
14813 | // the empty string, as if the attribute were missing. | ||
14814 | return node.getAttribute && node.getAttribute(ATTR_NAME) || ''; | ||
14815 | } | ||
14816 | |||
14817 | /** | ||
14818 | * Mounts this component and inserts it into the DOM. | ||
14819 | * | ||
14820 | * @param {ReactComponent} componentInstance The instance to mount. | ||
14821 | * @param {DOMElement} container DOM element to mount into. | ||
14822 | * @param {ReactReconcileTransaction} transaction | ||
14823 | * @param {boolean} shouldReuseMarkup If true, do not insert markup | ||
14824 | */ | ||
14825 | function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) { | ||
14826 | var markerName; | ||
14827 | if (ReactFeatureFlags.logTopLevelRenders) { | ||
14828 | var wrappedElement = wrapperInstance._currentElement.props.child; | ||
14829 | var type = wrappedElement.type; | ||
14830 | markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name); | ||
14831 | console.time(markerName); | ||
14832 | } | ||
14833 | |||
14834 | var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */ | ||
14835 | ); | ||
14836 | |||
14837 | if (markerName) { | ||
14838 | console.timeEnd(markerName); | ||
14839 | } | ||
14840 | |||
14841 | wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance; | ||
14842 | ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction); | ||
14843 | } | ||
14844 | |||
14845 | /** | ||
14846 | * Batched mount. | ||
14847 | * | ||
14848 | * @param {ReactComponent} componentInstance The instance to mount. | ||
14849 | * @param {DOMElement} container DOM element to mount into. | ||
14850 | * @param {boolean} shouldReuseMarkup If true, do not insert markup | ||
14851 | */ | ||
14852 | function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) { | ||
14853 | var transaction = ReactUpdates.ReactReconcileTransaction.getPooled( | ||
14854 | /* useCreateElement */ | ||
14855 | !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement); | ||
14856 | transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context); | ||
14857 | ReactUpdates.ReactReconcileTransaction.release(transaction); | ||
14858 | } | ||
14859 | |||
14860 | /** | ||
14861 | * Unmounts a component and removes it from the DOM. | ||
14862 | * | ||
14863 | * @param {ReactComponent} instance React component instance. | ||
14864 | * @param {DOMElement} container DOM element to unmount from. | ||
14865 | * @final | ||
14866 | * @internal | ||
14867 | * @see {ReactMount.unmountComponentAtNode} | ||
14868 | */ | ||
14869 | function unmountComponentFromNode(instance, container, safely) { | ||
14870 | if (process.env.NODE_ENV !== 'production') { | ||
14871 | ReactInstrumentation.debugTool.onBeginFlush(); | ||
14872 | } | ||
14873 | ReactReconciler.unmountComponent(instance, safely); | ||
14874 | if (process.env.NODE_ENV !== 'production') { | ||
14875 | ReactInstrumentation.debugTool.onEndFlush(); | ||
14876 | } | ||
14877 | |||
14878 | if (container.nodeType === DOC_NODE_TYPE) { | ||
14879 | container = container.documentElement; | ||
14880 | } | ||
14881 | |||
14882 | // http://jsperf.com/emptying-a-node | ||
14883 | while (container.lastChild) { | ||
14884 | container.removeChild(container.lastChild); | ||
14885 | } | ||
14886 | } | ||
14887 | |||
14888 | /** | ||
14889 | * True if the supplied DOM node has a direct React-rendered child that is | ||
14890 | * not a React root element. Useful for warning in `render`, | ||
14891 | * `unmountComponentAtNode`, etc. | ||
14892 | * | ||
14893 | * @param {?DOMElement} node The candidate DOM node. | ||
14894 | * @return {boolean} True if the DOM element contains a direct child that was | ||
14895 | * rendered by React but is not a root element. | ||
14896 | * @internal | ||
14897 | */ | ||
14898 | function hasNonRootReactChild(container) { | ||
14899 | var rootEl = getReactRootElementInContainer(container); | ||
14900 | if (rootEl) { | ||
14901 | var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl); | ||
14902 | return !!(inst && inst._hostParent); | ||
14903 | } | ||
14904 | } | ||
14905 | |||
14906 | /** | ||
14907 | * True if the supplied DOM node is a React DOM element and | ||
14908 | * it has been rendered by another copy of React. | ||
14909 | * | ||
14910 | * @param {?DOMElement} node The candidate DOM node. | ||
14911 | * @return {boolean} True if the DOM has been rendered by another copy of React | ||
14912 | * @internal | ||
14913 | */ | ||
14914 | function nodeIsRenderedByOtherInstance(container) { | ||
14915 | var rootEl = getReactRootElementInContainer(container); | ||
14916 | return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl)); | ||
14917 | } | ||
14918 | |||
14919 | /** | ||
14920 | * True if the supplied DOM node is a valid node element. | ||
14921 | * | ||
14922 | * @param {?DOMElement} node The candidate DOM node. | ||
14923 | * @return {boolean} True if the DOM is a valid DOM node. | ||
14924 | * @internal | ||
14925 | */ | ||
14926 | function isValidContainer(node) { | ||
14927 | return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)); | ||
14928 | } | ||
14929 | |||
14930 | /** | ||
14931 | * True if the supplied DOM node is a valid React node element. | ||
14932 | * | ||
14933 | * @param {?DOMElement} node The candidate DOM node. | ||
14934 | * @return {boolean} True if the DOM is a valid React DOM node. | ||
14935 | * @internal | ||
14936 | */ | ||
14937 | function isReactNode(node) { | ||
14938 | return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME)); | ||
14939 | } | ||
14940 | |||
14941 | function getHostRootInstanceInContainer(container) { | ||
14942 | var rootEl = getReactRootElementInContainer(container); | ||
14943 | var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl); | ||
14944 | return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null; | ||
14945 | } | ||
14946 | |||
14947 | function getTopLevelWrapperInContainer(container) { | ||
14948 | var root = getHostRootInstanceInContainer(container); | ||
14949 | return root ? root._hostContainerInfo._topLevelWrapper : null; | ||
14950 | } | ||
14951 | |||
14952 | /** | ||
14953 | * Temporary (?) hack so that we can store all top-level pending updates on | ||
14954 | * composites instead of having to worry about different types of components | ||
14955 | * here. | ||
14956 | */ | ||
14957 | var topLevelRootCounter = 1; | ||
14958 | var TopLevelWrapper = function () { | ||
14959 | this.rootID = topLevelRootCounter++; | ||
14960 | }; | ||
14961 | TopLevelWrapper.prototype.isReactComponent = {}; | ||
14962 | if (process.env.NODE_ENV !== 'production') { | ||
14963 | TopLevelWrapper.displayName = 'TopLevelWrapper'; | ||
14964 | } | ||
14965 | TopLevelWrapper.prototype.render = function () { | ||
14966 | return this.props.child; | ||
14967 | }; | ||
14968 | TopLevelWrapper.isReactTopLevelWrapper = true; | ||
14969 | |||
14970 | /** | ||
14971 | * Mounting is the process of initializing a React component by creating its | ||
14972 | * representative DOM elements and inserting them into a supplied `container`. | ||
14973 | * Any prior content inside `container` is destroyed in the process. | ||
14974 | * | ||
14975 | * ReactMount.render( | ||
14976 | * component, | ||
14977 | * document.getElementById('container') | ||
14978 | * ); | ||
14979 | * | ||
14980 | * <div id="container"> <-- Supplied `container`. | ||
14981 | * <div data-reactid=".3"> <-- Rendered reactRoot of React | ||
14982 | * // ... component. | ||
14983 | * </div> | ||
14984 | * </div> | ||
14985 | * | ||
14986 | * Inside of `container`, the first element rendered is the "reactRoot". | ||
14987 | */ | ||
14988 | var ReactMount = { | ||
14989 | |||
14990 | TopLevelWrapper: TopLevelWrapper, | ||
14991 | |||
14992 | /** | ||
14993 | * Used by devtools. The keys are not important. | ||
14994 | */ | ||
14995 | _instancesByReactRootID: instancesByReactRootID, | ||
14996 | |||
14997 | /** | ||
14998 | * This is a hook provided to support rendering React components while | ||
14999 | * ensuring that the apparent scroll position of its `container` does not | ||
15000 | * change. | ||
15001 | * | ||
15002 | * @param {DOMElement} container The `container` being rendered into. | ||
15003 | * @param {function} renderCallback This must be called once to do the render. | ||
15004 | */ | ||
15005 | scrollMonitor: function (container, renderCallback) { | ||
15006 | renderCallback(); | ||
15007 | }, | ||
15008 | |||
15009 | /** | ||
15010 | * Take a component that's already mounted into the DOM and replace its props | ||
15011 | * @param {ReactComponent} prevComponent component instance already in the DOM | ||
15012 | * @param {ReactElement} nextElement component instance to render | ||
15013 | * @param {DOMElement} container container to render into | ||
15014 | * @param {?function} callback function triggered on completion | ||
15015 | */ | ||
15016 | _updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) { | ||
15017 | ReactMount.scrollMonitor(container, function () { | ||
15018 | ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext); | ||
15019 | if (callback) { | ||
15020 | ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback); | ||
15021 | } | ||
15022 | }); | ||
15023 | |||
15024 | return prevComponent; | ||
15025 | }, | ||
15026 | |||
15027 | /** | ||
15028 | * Render a new component into the DOM. Hooked by hooks! | ||
15029 | * | ||
15030 | * @param {ReactElement} nextElement element to render | ||
15031 | * @param {DOMElement} container container to render into | ||
15032 | * @param {boolean} shouldReuseMarkup if we should skip the markup insertion | ||
15033 | * @return {ReactComponent} nextComponent | ||
15034 | */ | ||
15035 | _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) { | ||
15036 | // Various parts of our code (such as ReactCompositeComponent's | ||
15037 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
15038 | // verify that that's the case. | ||
15039 | 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; | ||
15040 | |||
15041 | !isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0; | ||
15042 | |||
15043 | ReactBrowserEventEmitter.ensureScrollValueMonitoring(); | ||
15044 | var componentInstance = instantiateReactComponent(nextElement, false); | ||
15045 | |||
15046 | // The initial render is synchronous but any updates that happen during | ||
15047 | // rendering, in componentWillMount or componentDidMount, will be batched | ||
15048 | // according to the current batching strategy. | ||
15049 | |||
15050 | ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context); | ||
15051 | |||
15052 | var wrapperID = componentInstance._instance.rootID; | ||
15053 | instancesByReactRootID[wrapperID] = componentInstance; | ||
15054 | |||
15055 | return componentInstance; | ||
15056 | }, | ||
15057 | |||
15058 | /** | ||
15059 | * Renders a React component into the DOM in the supplied `container`. | ||
15060 | * | ||
15061 | * If the React component was previously rendered into `container`, this will | ||
15062 | * perform an update on it and only mutate the DOM as necessary to reflect the | ||
15063 | * latest React component. | ||
15064 | * | ||
15065 | * @param {ReactComponent} parentComponent The conceptual parent of this render tree. | ||
15066 | * @param {ReactElement} nextElement Component element to render. | ||
15067 | * @param {DOMElement} container DOM element to render into. | ||
15068 | * @param {?function} callback function triggered on completion | ||
15069 | * @return {ReactComponent} Component instance rendered in `container`. | ||
15070 | */ | ||
15071 | renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { | ||
15072 | !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0; | ||
15073 | return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback); | ||
15074 | }, | ||
15075 | |||
15076 | _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { | ||
15077 | ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render'); | ||
15078 | !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 />.' : | ||
15079 | // Check if it quacks like an element | ||
15080 | 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; | ||
15081 | |||
15082 | 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; | ||
15083 | |||
15084 | var nextWrappedElement = React.createElement(TopLevelWrapper, { child: nextElement }); | ||
15085 | |||
15086 | var nextContext; | ||
15087 | if (parentComponent) { | ||
15088 | var parentInst = ReactInstanceMap.get(parentComponent); | ||
15089 | nextContext = parentInst._processChildContext(parentInst._context); | ||
15090 | } else { | ||
15091 | nextContext = emptyObject; | ||
15092 | } | ||
15093 | |||
15094 | var prevComponent = getTopLevelWrapperInContainer(container); | ||
15095 | |||
15096 | if (prevComponent) { | ||
15097 | var prevWrappedElement = prevComponent._currentElement; | ||
15098 | var prevElement = prevWrappedElement.props.child; | ||
15099 | if (shouldUpdateReactComponent(prevElement, nextElement)) { | ||
15100 | var publicInst = prevComponent._renderedComponent.getPublicInstance(); | ||
15101 | var updatedCallback = callback && function () { | ||
15102 | callback.call(publicInst); | ||
15103 | }; | ||
15104 | ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback); | ||
15105 | return publicInst; | ||
15106 | } else { | ||
15107 | ReactMount.unmountComponentAtNode(container); | ||
15108 | } | ||
15109 | } | ||
15110 | |||
15111 | var reactRootElement = getReactRootElementInContainer(container); | ||
15112 | var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement); | ||
15113 | var containerHasNonRootReactChild = hasNonRootReactChild(container); | ||
15114 | |||
15115 | if (process.env.NODE_ENV !== 'production') { | ||
15116 | 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; | ||
15117 | |||
15118 | if (!containerHasReactMarkup || reactRootElement.nextSibling) { | ||
15119 | var rootElementSibling = reactRootElement; | ||
15120 | while (rootElementSibling) { | ||
15121 | if (internalGetID(rootElementSibling)) { | ||
15122 | 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; | ||
15123 | break; | ||
15124 | } | ||
15125 | rootElementSibling = rootElementSibling.nextSibling; | ||
15126 | } | ||
15127 | } | ||
15128 | } | ||
15129 | |||
15130 | var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild; | ||
15131 | var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance(); | ||
15132 | if (callback) { | ||
15133 | callback.call(component); | ||
15134 | } | ||
15135 | return component; | ||
15136 | }, | ||
15137 | |||
15138 | /** | ||
15139 | * Renders a React component into the DOM in the supplied `container`. | ||
15140 | * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render | ||
15141 | * | ||
15142 | * If the React component was previously rendered into `container`, this will | ||
15143 | * perform an update on it and only mutate the DOM as necessary to reflect the | ||
15144 | * latest React component. | ||
15145 | * | ||
15146 | * @param {ReactElement} nextElement Component element to render. | ||
15147 | * @param {DOMElement} container DOM element to render into. | ||
15148 | * @param {?function} callback function triggered on completion | ||
15149 | * @return {ReactComponent} Component instance rendered in `container`. | ||
15150 | */ | ||
15151 | render: function (nextElement, container, callback) { | ||
15152 | return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback); | ||
15153 | }, | ||
15154 | |||
15155 | /** | ||
15156 | * Unmounts and destroys the React component rendered in the `container`. | ||
15157 | * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode | ||
15158 | * | ||
15159 | * @param {DOMElement} container DOM element containing a React component. | ||
15160 | * @return {boolean} True if a component was found in and unmounted from | ||
15161 | * `container` | ||
15162 | */ | ||
15163 | unmountComponentAtNode: function (container) { | ||
15164 | // Various parts of our code (such as ReactCompositeComponent's | ||
15165 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
15166 | // verify that that's the case. (Strictly speaking, unmounting won't cause a | ||
15167 | // render but we still don't expect to be in a render call here.) | ||
15168 | 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; | ||
15169 | |||
15170 | !isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0; | ||
15171 | |||
15172 | if (process.env.NODE_ENV !== 'production') { | ||
15173 | 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; | ||
15174 | } | ||
15175 | |||
15176 | var prevComponent = getTopLevelWrapperInContainer(container); | ||
15177 | if (!prevComponent) { | ||
15178 | // Check if the node being unmounted was rendered by React, but isn't a | ||
15179 | // root node. | ||
15180 | var containerHasNonRootReactChild = hasNonRootReactChild(container); | ||
15181 | |||
15182 | // Check if the container itself is a React root node. | ||
15183 | var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME); | ||
15184 | |||
15185 | if (process.env.NODE_ENV !== 'production') { | ||
15186 | 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; | ||
15187 | } | ||
15188 | |||
15189 | return false; | ||
15190 | } | ||
15191 | delete instancesByReactRootID[prevComponent._instance.rootID]; | ||
15192 | ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false); | ||
15193 | return true; | ||
15194 | }, | ||
15195 | |||
15196 | _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) { | ||
15197 | !isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0; | ||
15198 | |||
15199 | if (shouldReuseMarkup) { | ||
15200 | var rootElement = getReactRootElementInContainer(container); | ||
15201 | if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) { | ||
15202 | ReactDOMComponentTree.precacheNode(instance, rootElement); | ||
15203 | return; | ||
15204 | } else { | ||
15205 | var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
15206 | rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
15207 | |||
15208 | var rootMarkup = rootElement.outerHTML; | ||
15209 | rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum); | ||
15210 | |||
15211 | var normalizedMarkup = markup; | ||
15212 | if (process.env.NODE_ENV !== 'production') { | ||
15213 | // because rootMarkup is retrieved from the DOM, various normalizations | ||
15214 | // will have occurred which will not be present in `markup`. Here, | ||
15215 | // insert markup into a <div> or <iframe> depending on the container | ||
15216 | // type to perform the same normalizations before comparing. | ||
15217 | var normalizer; | ||
15218 | if (container.nodeType === ELEMENT_NODE_TYPE) { | ||
15219 | normalizer = document.createElement('div'); | ||
15220 | normalizer.innerHTML = markup; | ||
15221 | normalizedMarkup = normalizer.innerHTML; | ||
15222 | } else { | ||
15223 | normalizer = document.createElement('iframe'); | ||
15224 | document.body.appendChild(normalizer); | ||
15225 | normalizer.contentDocument.write(markup); | ||
15226 | normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML; | ||
15227 | document.body.removeChild(normalizer); | ||
15228 | } | ||
15229 | } | ||
15230 | |||
15231 | var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup); | ||
15232 | var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20); | ||
15233 | |||
15234 | !(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; | ||
15235 | |||
15236 | if (process.env.NODE_ENV !== 'production') { | ||
15237 | 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; | ||
15238 | } | ||
15239 | } | ||
15240 | } | ||
15241 | |||
15242 | !(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; | ||
15243 | |||
15244 | if (transaction.useCreateElement) { | ||
15245 | while (container.lastChild) { | ||
15246 | container.removeChild(container.lastChild); | ||
15247 | } | ||
15248 | DOMLazyTree.insertTreeBefore(container, markup, null); | ||
15249 | } else { | ||
15250 | setInnerHTML(container, markup); | ||
15251 | ReactDOMComponentTree.precacheNode(instance, container.firstChild); | ||
15252 | } | ||
15253 | |||
15254 | if (process.env.NODE_ENV !== 'production') { | ||
15255 | var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild); | ||
15256 | if (hostNode._debugID !== 0) { | ||
15257 | ReactInstrumentation.debugTool.onHostOperation({ | ||
15258 | instanceID: hostNode._debugID, | ||
15259 | type: 'mount', | ||
15260 | payload: markup.toString() | ||
15261 | }); | ||
15262 | } | ||
15263 | } | ||
15264 | } | ||
15265 | }; | ||
15266 | |||
15267 | module.exports = ReactMount; | ||
15268 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
15269 | |||
15270 | /***/ }), | ||
15271 | /* 128 */ | ||
15272 | /***/ (function(module, exports, __webpack_require__) { | ||
15273 | |||
15274 | "use strict"; | ||
15275 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
15276 | * Copyright 2013-present, Facebook, Inc. | ||
15277 | * All rights reserved. | ||
15278 | * | ||
15279 | * This source code is licensed under the BSD-style license found in the | ||
15280 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15281 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15282 | * | ||
15283 | * | ||
15284 | */ | ||
15285 | |||
15286 | |||
15287 | |||
15288 | var _prodInvariant = __webpack_require__(3); | ||
15289 | |||
15290 | var React = __webpack_require__(39); | ||
15291 | |||
15292 | var invariant = __webpack_require__(1); | ||
15293 | |||
15294 | var ReactNodeTypes = { | ||
15295 | HOST: 0, | ||
15296 | COMPOSITE: 1, | ||
15297 | EMPTY: 2, | ||
15298 | |||
15299 | getType: function (node) { | ||
15300 | if (node === null || node === false) { | ||
15301 | return ReactNodeTypes.EMPTY; | ||
15302 | } else if (React.isValidElement(node)) { | ||
15303 | if (typeof node.type === 'function') { | ||
15304 | return ReactNodeTypes.COMPOSITE; | ||
15305 | } else { | ||
15306 | return ReactNodeTypes.HOST; | ||
15307 | } | ||
15308 | } | ||
15309 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0; | ||
15310 | } | ||
15311 | }; | ||
15312 | |||
15313 | module.exports = ReactNodeTypes; | ||
15314 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
15315 | |||
15316 | /***/ }), | ||
15317 | /* 129 */ | ||
15318 | /***/ (function(module, exports, __webpack_require__) { | ||
15319 | |||
15320 | "use strict"; | ||
15321 | /** | ||
15322 | * Copyright 2013-present, Facebook, Inc. | ||
15323 | * All rights reserved. | ||
15324 | * | ||
15325 | * This source code is licensed under the BSD-style license found in the | ||
15326 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15327 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15328 | * | ||
15329 | * | ||
15330 | */ | ||
15331 | |||
15332 | |||
15333 | |||
15334 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | ||
15335 | |||
15336 | module.exports = ReactPropTypesSecret; | ||
15337 | |||
15338 | /***/ }), | ||
15339 | /* 130 */ | ||
15340 | /***/ (function(module, exports, __webpack_require__) { | ||
15341 | |||
15342 | "use strict"; | ||
15343 | /** | ||
15344 | * Copyright 2013-present, Facebook, Inc. | ||
15345 | * All rights reserved. | ||
15346 | * | ||
15347 | * This source code is licensed under the BSD-style license found in the | ||
15348 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15349 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15350 | * | ||
15351 | */ | ||
15352 | |||
15353 | |||
15354 | |||
15355 | var ViewportMetrics = { | ||
15356 | |||
15357 | currentScrollLeft: 0, | ||
15358 | |||
15359 | currentScrollTop: 0, | ||
15360 | |||
15361 | refreshScrollValues: function (scrollPosition) { | ||
15362 | ViewportMetrics.currentScrollLeft = scrollPosition.x; | ||
15363 | ViewportMetrics.currentScrollTop = scrollPosition.y; | ||
15364 | } | ||
15365 | |||
15366 | }; | ||
15367 | |||
15368 | module.exports = ViewportMetrics; | ||
15369 | |||
15370 | /***/ }), | ||
15371 | /* 131 */ | ||
15372 | /***/ (function(module, exports, __webpack_require__) { | ||
15373 | |||
15374 | "use strict"; | ||
15375 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
15376 | * Copyright 2014-present, Facebook, Inc. | ||
15377 | * All rights reserved. | ||
15378 | * | ||
15379 | * This source code is licensed under the BSD-style license found in the | ||
15380 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15381 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15382 | * | ||
15383 | * | ||
15384 | */ | ||
15385 | |||
15386 | |||
15387 | |||
15388 | var _prodInvariant = __webpack_require__(3); | ||
15389 | |||
15390 | var invariant = __webpack_require__(1); | ||
15391 | |||
15392 | /** | ||
15393 | * Accumulates items that must not be null or undefined into the first one. This | ||
15394 | * is used to conserve memory by avoiding array allocations, and thus sacrifices | ||
15395 | * API cleanness. Since `current` can be null before being passed in and not | ||
15396 | * null after this function, make sure to assign it back to `current`: | ||
15397 | * | ||
15398 | * `a = accumulateInto(a, b);` | ||
15399 | * | ||
15400 | * This API should be sparingly used. Try `accumulate` for something cleaner. | ||
15401 | * | ||
15402 | * @return {*|array<*>} An accumulation of items. | ||
15403 | */ | ||
15404 | |||
15405 | function accumulateInto(current, next) { | ||
15406 | !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0; | ||
15407 | |||
15408 | if (current == null) { | ||
15409 | return next; | ||
15410 | } | ||
15411 | |||
15412 | // Both are not empty. Warning: Never call x.concat(y) when you are not | ||
15413 | // certain that x is an Array (x could be a string with concat method). | ||
15414 | if (Array.isArray(current)) { | ||
15415 | if (Array.isArray(next)) { | ||
15416 | current.push.apply(current, next); | ||
15417 | return current; | ||
15418 | } | ||
15419 | current.push(next); | ||
15420 | return current; | ||
15421 | } | ||
15422 | |||
15423 | if (Array.isArray(next)) { | ||
15424 | // A bit too dangerous to mutate `next`. | ||
15425 | return [current].concat(next); | ||
15426 | } | ||
15427 | |||
15428 | return [current, next]; | ||
15429 | } | ||
15430 | |||
15431 | module.exports = accumulateInto; | ||
15432 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
15433 | |||
15434 | /***/ }), | ||
15435 | /* 132 */ | ||
15436 | /***/ (function(module, exports, __webpack_require__) { | ||
15437 | |||
15438 | "use strict"; | ||
15439 | /** | ||
15440 | * Copyright 2013-present, Facebook, Inc. | ||
15441 | * All rights reserved. | ||
15442 | * | ||
15443 | * This source code is licensed under the BSD-style license found in the | ||
15444 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15445 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15446 | * | ||
15447 | * | ||
15448 | */ | ||
15449 | |||
15450 | |||
15451 | |||
15452 | /** | ||
15453 | * @param {array} arr an "accumulation" of items which is either an Array or | ||
15454 | * a single item. Useful when paired with the `accumulate` module. This is a | ||
15455 | * simple utility that allows us to reason about a collection of items, but | ||
15456 | * handling the case when there is exactly one item (and we do not need to | ||
15457 | * allocate an array). | ||
15458 | */ | ||
15459 | |||
15460 | function forEachAccumulated(arr, cb, scope) { | ||
15461 | if (Array.isArray(arr)) { | ||
15462 | arr.forEach(cb, scope); | ||
15463 | } else if (arr) { | ||
15464 | cb.call(scope, arr); | ||
15465 | } | ||
15466 | } | ||
15467 | |||
15468 | module.exports = forEachAccumulated; | ||
15469 | |||
15470 | /***/ }), | ||
15471 | /* 133 */ | ||
15472 | /***/ (function(module, exports, __webpack_require__) { | ||
15473 | |||
15474 | "use strict"; | ||
15475 | /** | ||
15476 | * Copyright 2013-present, Facebook, Inc. | ||
15477 | * All rights reserved. | ||
15478 | * | ||
15479 | * This source code is licensed under the BSD-style license found in the | ||
15480 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15481 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15482 | * | ||
15483 | */ | ||
15484 | |||
15485 | |||
15486 | |||
15487 | var ReactNodeTypes = __webpack_require__(128); | ||
15488 | |||
15489 | function getHostComponentFromComposite(inst) { | ||
15490 | var type; | ||
15491 | |||
15492 | while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) { | ||
15493 | inst = inst._renderedComponent; | ||
15494 | } | ||
15495 | |||
15496 | if (type === ReactNodeTypes.HOST) { | ||
15497 | return inst._renderedComponent; | ||
15498 | } else if (type === ReactNodeTypes.EMPTY) { | ||
15499 | return null; | ||
15500 | } | ||
15501 | } | ||
15502 | |||
15503 | module.exports = getHostComponentFromComposite; | ||
15504 | |||
15505 | /***/ }), | ||
15506 | /* 134 */ | ||
15507 | /***/ (function(module, exports, __webpack_require__) { | ||
15508 | |||
15509 | "use strict"; | ||
15510 | /** | ||
15511 | * Copyright 2013-present, Facebook, Inc. | ||
15512 | * All rights reserved. | ||
15513 | * | ||
15514 | * This source code is licensed under the BSD-style license found in the | ||
15515 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15516 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15517 | * | ||
15518 | */ | ||
15519 | |||
15520 | |||
15521 | |||
15522 | var ExecutionEnvironment = __webpack_require__(7); | ||
15523 | |||
15524 | var contentKey = null; | ||
15525 | |||
15526 | /** | ||
15527 | * Gets the key used to access text content on a DOM node. | ||
15528 | * | ||
15529 | * @return {?string} Key used to access text content. | ||
15530 | * @internal | ||
15531 | */ | ||
15532 | function getTextContentAccessor() { | ||
15533 | if (!contentKey && ExecutionEnvironment.canUseDOM) { | ||
15534 | // Prefer textContent to innerText because many browsers support both but | ||
15535 | // SVG <text> elements don't support innerText even when <div> does. | ||
15536 | contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; | ||
15537 | } | ||
15538 | return contentKey; | ||
15539 | } | ||
15540 | |||
15541 | module.exports = getTextContentAccessor; | ||
15542 | |||
15543 | /***/ }), | ||
15544 | /* 135 */ | ||
15545 | /***/ (function(module, exports, __webpack_require__) { | ||
15546 | |||
15547 | "use strict"; | ||
15548 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
15549 | * Copyright 2013-present, Facebook, Inc. | ||
15550 | * All rights reserved. | ||
15551 | * | ||
15552 | * This source code is licensed under the BSD-style license found in the | ||
15553 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15554 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15555 | * | ||
15556 | */ | ||
15557 | |||
15558 | |||
15559 | |||
15560 | var _prodInvariant = __webpack_require__(3), | ||
15561 | _assign = __webpack_require__(4); | ||
15562 | |||
15563 | var ReactCompositeComponent = __webpack_require__(254); | ||
15564 | var ReactEmptyComponent = __webpack_require__(123); | ||
15565 | var ReactHostComponent = __webpack_require__(125); | ||
15566 | |||
15567 | var getNextDebugID = __webpack_require__(322); | ||
15568 | var invariant = __webpack_require__(1); | ||
15569 | var warning = __webpack_require__(2); | ||
15570 | |||
15571 | // To avoid a cyclic dependency, we create the final class in this module | ||
15572 | var ReactCompositeComponentWrapper = function (element) { | ||
15573 | this.construct(element); | ||
15574 | }; | ||
15575 | |||
15576 | function getDeclarationErrorAddendum(owner) { | ||
15577 | if (owner) { | ||
15578 | var name = owner.getName(); | ||
15579 | if (name) { | ||
15580 | return ' Check the render method of `' + name + '`.'; | ||
15581 | } | ||
15582 | } | ||
15583 | return ''; | ||
15584 | } | ||
15585 | |||
15586 | /** | ||
15587 | * Check if the type reference is a known internal type. I.e. not a user | ||
15588 | * provided composite type. | ||
15589 | * | ||
15590 | * @param {function} type | ||
15591 | * @return {boolean} Returns true if this is a valid internal type. | ||
15592 | */ | ||
15593 | function isInternalComponentType(type) { | ||
15594 | return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function'; | ||
15595 | } | ||
15596 | |||
15597 | /** | ||
15598 | * Given a ReactNode, create an instance that will actually be mounted. | ||
15599 | * | ||
15600 | * @param {ReactNode} node | ||
15601 | * @param {boolean} shouldHaveDebugID | ||
15602 | * @return {object} A new instance of the element's constructor. | ||
15603 | * @protected | ||
15604 | */ | ||
15605 | function instantiateReactComponent(node, shouldHaveDebugID) { | ||
15606 | var instance; | ||
15607 | |||
15608 | if (node === null || node === false) { | ||
15609 | instance = ReactEmptyComponent.create(instantiateReactComponent); | ||
15610 | } else if (typeof node === 'object') { | ||
15611 | var element = node; | ||
15612 | var type = element.type; | ||
15613 | if (typeof type !== 'function' && typeof type !== 'string') { | ||
15614 | var info = ''; | ||
15615 | if (process.env.NODE_ENV !== 'production') { | ||
15616 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { | ||
15617 | info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.'; | ||
15618 | } | ||
15619 | } | ||
15620 | info += getDeclarationErrorAddendum(element._owner); | ||
15621 | 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; | ||
15622 | } | ||
15623 | |||
15624 | // Special case string values | ||
15625 | if (typeof element.type === 'string') { | ||
15626 | instance = ReactHostComponent.createInternalComponent(element); | ||
15627 | } else if (isInternalComponentType(element.type)) { | ||
15628 | // This is temporarily available for custom components that are not string | ||
15629 | // representations. I.e. ART. Once those are updated to use the string | ||
15630 | // representation, we can drop this code path. | ||
15631 | instance = new element.type(element); | ||
15632 | |||
15633 | // We renamed this. Allow the old name for compat. :( | ||
15634 | if (!instance.getHostNode) { | ||
15635 | instance.getHostNode = instance.getNativeNode; | ||
15636 | } | ||
15637 | } else { | ||
15638 | instance = new ReactCompositeComponentWrapper(element); | ||
15639 | } | ||
15640 | } else if (typeof node === 'string' || typeof node === 'number') { | ||
15641 | instance = ReactHostComponent.createInstanceForText(node); | ||
15642 | } else { | ||
15643 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0; | ||
15644 | } | ||
15645 | |||
15646 | if (process.env.NODE_ENV !== 'production') { | ||
15647 | 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; | ||
15648 | } | ||
15649 | |||
15650 | // These two fields are used by the DOM and ART diffing algorithms | ||
15651 | // respectively. Instead of using expandos on components, we should be | ||
15652 | // storing the state needed by the diffing algorithms elsewhere. | ||
15653 | instance._mountIndex = 0; | ||
15654 | instance._mountImage = null; | ||
15655 | |||
15656 | if (process.env.NODE_ENV !== 'production') { | ||
15657 | instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0; | ||
15658 | } | ||
15659 | |||
15660 | // Internal instances should fully constructed at this point, so they should | ||
15661 | // not get any new fields added to them at this point. | ||
15662 | if (process.env.NODE_ENV !== 'production') { | ||
15663 | if (Object.preventExtensions) { | ||
15664 | Object.preventExtensions(instance); | ||
15665 | } | ||
15666 | } | ||
15667 | |||
15668 | return instance; | ||
15669 | } | ||
15670 | |||
15671 | _assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, { | ||
15672 | _instantiateReactComponent: instantiateReactComponent | ||
15673 | }); | ||
15674 | |||
15675 | module.exports = instantiateReactComponent; | ||
15676 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
15677 | |||
15678 | /***/ }), | ||
15679 | /* 136 */ | ||
15680 | /***/ (function(module, exports, __webpack_require__) { | ||
15681 | |||
15682 | "use strict"; | ||
15683 | /** | ||
15684 | * Copyright 2013-present, Facebook, Inc. | ||
15685 | * All rights reserved. | ||
15686 | * | ||
15687 | * This source code is licensed under the BSD-style license found in the | ||
15688 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15689 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15690 | * | ||
15691 | * | ||
15692 | */ | ||
15693 | |||
15694 | |||
15695 | |||
15696 | /** | ||
15697 | * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary | ||
15698 | */ | ||
15699 | |||
15700 | var supportedInputTypes = { | ||
15701 | 'color': true, | ||
15702 | 'date': true, | ||
15703 | 'datetime': true, | ||
15704 | 'datetime-local': true, | ||
15705 | 'email': true, | ||
15706 | 'month': true, | ||
15707 | 'number': true, | ||
15708 | 'password': true, | ||
15709 | 'range': true, | ||
15710 | 'search': true, | ||
15711 | 'tel': true, | ||
15712 | 'text': true, | ||
15713 | 'time': true, | ||
15714 | 'url': true, | ||
15715 | 'week': true | ||
15716 | }; | ||
15717 | |||
15718 | function isTextInputElement(elem) { | ||
15719 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); | ||
15720 | |||
15721 | if (nodeName === 'input') { | ||
15722 | return !!supportedInputTypes[elem.type]; | ||
15723 | } | ||
15724 | |||
15725 | if (nodeName === 'textarea') { | ||
15726 | return true; | ||
15727 | } | ||
15728 | |||
15729 | return false; | ||
15730 | } | ||
15731 | |||
15732 | module.exports = isTextInputElement; | ||
15733 | |||
15734 | /***/ }), | ||
15735 | /* 137 */ | ||
15736 | /***/ (function(module, exports, __webpack_require__) { | ||
15737 | |||
15738 | "use strict"; | ||
15739 | /** | ||
15740 | * Copyright 2013-present, Facebook, Inc. | ||
15741 | * All rights reserved. | ||
15742 | * | ||
15743 | * This source code is licensed under the BSD-style license found in the | ||
15744 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15745 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15746 | * | ||
15747 | */ | ||
15748 | |||
15749 | |||
15750 | |||
15751 | var ExecutionEnvironment = __webpack_require__(7); | ||
15752 | var escapeTextContentForBrowser = __webpack_require__(57); | ||
15753 | var setInnerHTML = __webpack_require__(58); | ||
15754 | |||
15755 | /** | ||
15756 | * Set the textContent property of a node, ensuring that whitespace is preserved | ||
15757 | * even in IE8. innerText is a poor substitute for textContent and, among many | ||
15758 | * issues, inserts <br> instead of the literal newline chars. innerHTML behaves | ||
15759 | * as it should. | ||
15760 | * | ||
15761 | * @param {DOMElement} node | ||
15762 | * @param {string} text | ||
15763 | * @internal | ||
15764 | */ | ||
15765 | var setTextContent = function (node, text) { | ||
15766 | if (text) { | ||
15767 | var firstChild = node.firstChild; | ||
15768 | |||
15769 | if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) { | ||
15770 | firstChild.nodeValue = text; | ||
15771 | return; | ||
15772 | } | ||
15773 | } | ||
15774 | node.textContent = text; | ||
15775 | }; | ||
15776 | |||
15777 | if (ExecutionEnvironment.canUseDOM) { | ||
15778 | if (!('textContent' in document.documentElement)) { | ||
15779 | setTextContent = function (node, text) { | ||
15780 | if (node.nodeType === 3) { | ||
15781 | node.nodeValue = text; | ||
15782 | return; | ||
15783 | } | ||
15784 | setInnerHTML(node, escapeTextContentForBrowser(text)); | ||
15785 | }; | ||
15786 | } | ||
15787 | } | ||
15788 | |||
15789 | module.exports = setTextContent; | ||
15790 | |||
15791 | /***/ }), | ||
15792 | /* 138 */ | ||
15793 | /***/ (function(module, exports, __webpack_require__) { | ||
15794 | |||
15795 | "use strict"; | ||
15796 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
15797 | * Copyright 2013-present, Facebook, Inc. | ||
15798 | * All rights reserved. | ||
15799 | * | ||
15800 | * This source code is licensed under the BSD-style license found in the | ||
15801 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15802 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15803 | * | ||
15804 | */ | ||
15805 | |||
15806 | |||
15807 | |||
15808 | var _prodInvariant = __webpack_require__(3); | ||
15809 | |||
15810 | var ReactCurrentOwner = __webpack_require__(17); | ||
15811 | var REACT_ELEMENT_TYPE = __webpack_require__(273); | ||
15812 | |||
15813 | var getIteratorFn = __webpack_require__(307); | ||
15814 | var invariant = __webpack_require__(1); | ||
15815 | var KeyEscapeUtils = __webpack_require__(78); | ||
15816 | var warning = __webpack_require__(2); | ||
15817 | |||
15818 | var SEPARATOR = '.'; | ||
15819 | var SUBSEPARATOR = ':'; | ||
15820 | |||
15821 | /** | ||
15822 | * This is inlined from ReactElement since this file is shared between | ||
15823 | * isomorphic and renderers. We could extract this to a | ||
15824 | * | ||
15825 | */ | ||
15826 | |||
15827 | /** | ||
15828 | * TODO: Test that a single child and an array with one item have the same key | ||
15829 | * pattern. | ||
15830 | */ | ||
15831 | |||
15832 | var didWarnAboutMaps = false; | ||
15833 | |||
15834 | /** | ||
15835 | * Generate a key string that identifies a component within a set. | ||
15836 | * | ||
15837 | * @param {*} component A component that could contain a manual key. | ||
15838 | * @param {number} index Index that is used if a manual key is not provided. | ||
15839 | * @return {string} | ||
15840 | */ | ||
15841 | function getComponentKey(component, index) { | ||
15842 | // Do some typechecking here since we call this blindly. We want to ensure | ||
15843 | // that we don't block potential future ES APIs. | ||
15844 | if (component && typeof component === 'object' && component.key != null) { | ||
15845 | // Explicit key | ||
15846 | return KeyEscapeUtils.escape(component.key); | ||
15847 | } | ||
15848 | // Implicit key determined by the index in the set | ||
15849 | return index.toString(36); | ||
15850 | } | ||
15851 | |||
15852 | /** | ||
15853 | * @param {?*} children Children tree container. | ||
15854 | * @param {!string} nameSoFar Name of the key path so far. | ||
15855 | * @param {!function} callback Callback to invoke with each child found. | ||
15856 | * @param {?*} traverseContext Used to pass information throughout the traversal | ||
15857 | * process. | ||
15858 | * @return {!number} The number of children in this subtree. | ||
15859 | */ | ||
15860 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { | ||
15861 | var type = typeof children; | ||
15862 | |||
15863 | if (type === 'undefined' || type === 'boolean') { | ||
15864 | // All of the above are perceived as null. | ||
15865 | children = null; | ||
15866 | } | ||
15867 | |||
15868 | if (children === null || type === 'string' || type === 'number' || | ||
15869 | // The following is inlined from ReactElement. This means we can optimize | ||
15870 | // some checks. React Fiber also inlines this logic for similar purposes. | ||
15871 | type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { | ||
15872 | callback(traverseContext, children, | ||
15873 | // If it's the only child, treat the name as if it was wrapped in an array | ||
15874 | // so that it's consistent if the number of children grows. | ||
15875 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); | ||
15876 | return 1; | ||
15877 | } | ||
15878 | |||
15879 | var child; | ||
15880 | var nextName; | ||
15881 | var subtreeCount = 0; // Count of children found in the current subtree. | ||
15882 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; | ||
15883 | |||
15884 | if (Array.isArray(children)) { | ||
15885 | for (var i = 0; i < children.length; i++) { | ||
15886 | child = children[i]; | ||
15887 | nextName = nextNamePrefix + getComponentKey(child, i); | ||
15888 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
15889 | } | ||
15890 | } else { | ||
15891 | var iteratorFn = getIteratorFn(children); | ||
15892 | if (iteratorFn) { | ||
15893 | var iterator = iteratorFn.call(children); | ||
15894 | var step; | ||
15895 | if (iteratorFn !== children.entries) { | ||
15896 | var ii = 0; | ||
15897 | while (!(step = iterator.next()).done) { | ||
15898 | child = step.value; | ||
15899 | nextName = nextNamePrefix + getComponentKey(child, ii++); | ||
15900 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
15901 | } | ||
15902 | } else { | ||
15903 | if (process.env.NODE_ENV !== 'production') { | ||
15904 | var mapsAsChildrenAddendum = ''; | ||
15905 | if (ReactCurrentOwner.current) { | ||
15906 | var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); | ||
15907 | if (mapsAsChildrenOwnerName) { | ||
15908 | mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; | ||
15909 | } | ||
15910 | } | ||
15911 | 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; | ||
15912 | didWarnAboutMaps = true; | ||
15913 | } | ||
15914 | // Iterator will provide entry [k,v] tuples rather than values. | ||
15915 | while (!(step = iterator.next()).done) { | ||
15916 | var entry = step.value; | ||
15917 | if (entry) { | ||
15918 | child = entry[1]; | ||
15919 | nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); | ||
15920 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
15921 | } | ||
15922 | } | ||
15923 | } | ||
15924 | } else if (type === 'object') { | ||
15925 | var addendum = ''; | ||
15926 | if (process.env.NODE_ENV !== 'production') { | ||
15927 | 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.'; | ||
15928 | if (children._isReactElement) { | ||
15929 | 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.'; | ||
15930 | } | ||
15931 | if (ReactCurrentOwner.current) { | ||
15932 | var name = ReactCurrentOwner.current.getName(); | ||
15933 | if (name) { | ||
15934 | addendum += ' Check the render method of `' + name + '`.'; | ||
15935 | } | ||
15936 | } | ||
15937 | } | ||
15938 | var childrenString = String(children); | ||
15939 | 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; | ||
15940 | } | ||
15941 | } | ||
15942 | |||
15943 | return subtreeCount; | ||
15944 | } | ||
15945 | |||
15946 | /** | ||
15947 | * Traverses children that are typically specified as `props.children`, but | ||
15948 | * might also be specified through attributes: | ||
15949 | * | ||
15950 | * - `traverseAllChildren(this.props.children, ...)` | ||
15951 | * - `traverseAllChildren(this.props.leftPanelChildren, ...)` | ||
15952 | * | ||
15953 | * The `traverseContext` is an optional argument that is passed through the | ||
15954 | * entire traversal. It can be used to store accumulations or anything else that | ||
15955 | * the callback might find relevant. | ||
15956 | * | ||
15957 | * @param {?*} children Children tree object. | ||
15958 | * @param {!function} callback To invoke upon traversing each child. | ||
15959 | * @param {?*} traverseContext Context for traversal. | ||
15960 | * @return {!number} The number of children in this subtree. | ||
15961 | */ | ||
15962 | function traverseAllChildren(children, callback, traverseContext) { | ||
15963 | if (children == null) { | ||
15964 | return 0; | ||
15965 | } | ||
15966 | |||
15967 | return traverseAllChildrenImpl(children, '', callback, traverseContext); | ||
15968 | } | ||
15969 | |||
15970 | module.exports = traverseAllChildren; | ||
15971 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
15972 | |||
15973 | /***/ }), | ||
15974 | /* 139 */ | ||
15975 | /***/ (function(module, exports, __webpack_require__) { | ||
15976 | |||
15977 | "use strict"; | ||
15978 | /** | ||
15979 | * Copyright 2014-present, Facebook, Inc. | ||
15980 | * All rights reserved. | ||
15981 | * | ||
15982 | * This source code is licensed under the BSD-style license found in the | ||
15983 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15984 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15985 | * | ||
15986 | * | ||
15987 | */ | ||
15988 | |||
15989 | |||
15990 | |||
15991 | // The Symbol used to tag the ReactElement type. If there is no native Symbol | ||
15992 | // nor polyfill, then a plain number is used for performance. | ||
15993 | |||
15994 | var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; | ||
15995 | |||
15996 | module.exports = REACT_ELEMENT_TYPE; | ||
15997 | |||
15998 | /***/ }), | ||
15999 | /* 140 */ | ||
16000 | /***/ (function(module, exports, __webpack_require__) { | ||
16001 | |||
16002 | "use strict"; | ||
16003 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16004 | * Copyright 2014-present, Facebook, Inc. | ||
16005 | * All rights reserved. | ||
16006 | * | ||
16007 | * This source code is licensed under the BSD-style license found in the | ||
16008 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16009 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16010 | * | ||
16011 | */ | ||
16012 | |||
16013 | /** | ||
16014 | * ReactElementValidator provides a wrapper around a element factory | ||
16015 | * which validates the props passed to the element. This is intended to be | ||
16016 | * used only in DEV and could be replaced by a static type checker for languages | ||
16017 | * that support it. | ||
16018 | */ | ||
16019 | |||
16020 | |||
16021 | |||
16022 | var ReactCurrentOwner = __webpack_require__(17); | ||
16023 | var ReactComponentTreeHook = __webpack_require__(9); | ||
16024 | var ReactElement = __webpack_require__(31); | ||
16025 | |||
16026 | var checkReactTypeSpec = __webpack_require__(321); | ||
16027 | |||
16028 | var canDefineProperty = __webpack_require__(59); | ||
16029 | var getIteratorFn = __webpack_require__(142); | ||
16030 | var warning = __webpack_require__(2); | ||
16031 | |||
16032 | function getDeclarationErrorAddendum() { | ||
16033 | if (ReactCurrentOwner.current) { | ||
16034 | var name = ReactCurrentOwner.current.getName(); | ||
16035 | if (name) { | ||
16036 | return ' Check the render method of `' + name + '`.'; | ||
16037 | } | ||
16038 | } | ||
16039 | return ''; | ||
16040 | } | ||
16041 | |||
16042 | function getSourceInfoErrorAddendum(elementProps) { | ||
16043 | if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) { | ||
16044 | var source = elementProps.__source; | ||
16045 | var fileName = source.fileName.replace(/^.*[\\\/]/, ''); | ||
16046 | var lineNumber = source.lineNumber; | ||
16047 | return ' Check your code at ' + fileName + ':' + lineNumber + '.'; | ||
16048 | } | ||
16049 | return ''; | ||
16050 | } | ||
16051 | |||
16052 | /** | ||
16053 | * Warn if there's no key explicitly set on dynamic arrays of children or | ||
16054 | * object keys are not valid. This allows us to keep track of children between | ||
16055 | * updates. | ||
16056 | */ | ||
16057 | var ownerHasKeyUseWarning = {}; | ||
16058 | |||
16059 | function getCurrentComponentErrorInfo(parentType) { | ||
16060 | var info = getDeclarationErrorAddendum(); | ||
16061 | |||
16062 | if (!info) { | ||
16063 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; | ||
16064 | if (parentName) { | ||
16065 | info = ' Check the top-level render call using <' + parentName + '>.'; | ||
16066 | } | ||
16067 | } | ||
16068 | return info; | ||
16069 | } | ||
16070 | |||
16071 | /** | ||
16072 | * Warn if the element doesn't have an explicit key assigned to it. | ||
16073 | * This element is in an array. The array could grow and shrink or be | ||
16074 | * reordered. All children that haven't already been validated are required to | ||
16075 | * have a "key" property assigned to it. Error statuses are cached so a warning | ||
16076 | * will only be shown once. | ||
16077 | * | ||
16078 | * @internal | ||
16079 | * @param {ReactElement} element Element that requires a key. | ||
16080 | * @param {*} parentType element's parent's type. | ||
16081 | */ | ||
16082 | function validateExplicitKey(element, parentType) { | ||
16083 | if (!element._store || element._store.validated || element.key != null) { | ||
16084 | return; | ||
16085 | } | ||
16086 | element._store.validated = true; | ||
16087 | |||
16088 | var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {}); | ||
16089 | |||
16090 | var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); | ||
16091 | if (memoizer[currentComponentErrorInfo]) { | ||
16092 | return; | ||
16093 | } | ||
16094 | memoizer[currentComponentErrorInfo] = true; | ||
16095 | |||
16096 | // Usually the current owner is the offender, but if it accepts children as a | ||
16097 | // property, it may be the creator of the child that's responsible for | ||
16098 | // assigning it a key. | ||
16099 | var childOwner = ''; | ||
16100 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) { | ||
16101 | // Give the component that originally created this child. | ||
16102 | childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; | ||
16103 | } | ||
16104 | |||
16105 | 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; | ||
16106 | } | ||
16107 | |||
16108 | /** | ||
16109 | * Ensure that every element either is passed in a static location, in an | ||
16110 | * array with an explicit keys property defined, or in an object literal | ||
16111 | * with valid key property. | ||
16112 | * | ||
16113 | * @internal | ||
16114 | * @param {ReactNode} node Statically passed child of any type. | ||
16115 | * @param {*} parentType node's parent's type. | ||
16116 | */ | ||
16117 | function validateChildKeys(node, parentType) { | ||
16118 | if (typeof node !== 'object') { | ||
16119 | return; | ||
16120 | } | ||
16121 | if (Array.isArray(node)) { | ||
16122 | for (var i = 0; i < node.length; i++) { | ||
16123 | var child = node[i]; | ||
16124 | if (ReactElement.isValidElement(child)) { | ||
16125 | validateExplicitKey(child, parentType); | ||
16126 | } | ||
16127 | } | ||
16128 | } else if (ReactElement.isValidElement(node)) { | ||
16129 | // This element was passed in a valid location. | ||
16130 | if (node._store) { | ||
16131 | node._store.validated = true; | ||
16132 | } | ||
16133 | } else if (node) { | ||
16134 | var iteratorFn = getIteratorFn(node); | ||
16135 | // Entry iterators provide implicit keys. | ||
16136 | if (iteratorFn) { | ||
16137 | if (iteratorFn !== node.entries) { | ||
16138 | var iterator = iteratorFn.call(node); | ||
16139 | var step; | ||
16140 | while (!(step = iterator.next()).done) { | ||
16141 | if (ReactElement.isValidElement(step.value)) { | ||
16142 | validateExplicitKey(step.value, parentType); | ||
16143 | } | ||
16144 | } | ||
16145 | } | ||
16146 | } | ||
16147 | } | ||
16148 | } | ||
16149 | |||
16150 | /** | ||
16151 | * Given an element, validate that its props follow the propTypes definition, | ||
16152 | * provided by the type. | ||
16153 | * | ||
16154 | * @param {ReactElement} element | ||
16155 | */ | ||
16156 | function validatePropTypes(element) { | ||
16157 | var componentClass = element.type; | ||
16158 | if (typeof componentClass !== 'function') { | ||
16159 | return; | ||
16160 | } | ||
16161 | var name = componentClass.displayName || componentClass.name; | ||
16162 | if (componentClass.propTypes) { | ||
16163 | checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null); | ||
16164 | } | ||
16165 | if (typeof componentClass.getDefaultProps === 'function') { | ||
16166 | 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; | ||
16167 | } | ||
16168 | } | ||
16169 | |||
16170 | var ReactElementValidator = { | ||
16171 | |||
16172 | createElement: function (type, props, children) { | ||
16173 | var validType = typeof type === 'string' || typeof type === 'function'; | ||
16174 | // We warn in this case but don't throw. We expect the element creation to | ||
16175 | // succeed and there will likely be errors in render. | ||
16176 | if (!validType) { | ||
16177 | if (typeof type !== 'function' && typeof type !== 'string') { | ||
16178 | var info = ''; | ||
16179 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { | ||
16180 | info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.'; | ||
16181 | } | ||
16182 | |||
16183 | var sourceInfo = getSourceInfoErrorAddendum(props); | ||
16184 | if (sourceInfo) { | ||
16185 | info += sourceInfo; | ||
16186 | } else { | ||
16187 | info += getDeclarationErrorAddendum(); | ||
16188 | } | ||
16189 | |||
16190 | info += ReactComponentTreeHook.getCurrentStackAddendum(); | ||
16191 | |||
16192 | 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; | ||
16193 | } | ||
16194 | } | ||
16195 | |||
16196 | var element = ReactElement.createElement.apply(this, arguments); | ||
16197 | |||
16198 | // The result can be nullish if a mock or a custom function is used. | ||
16199 | // TODO: Drop this when these are no longer allowed as the type argument. | ||
16200 | if (element == null) { | ||
16201 | return element; | ||
16202 | } | ||
16203 | |||
16204 | // Skip key warning if the type isn't valid since our key validation logic | ||
16205 | // doesn't expect a non-string/function type and can throw confusing errors. | ||
16206 | // We don't want exception behavior to differ between dev and prod. | ||
16207 | // (Rendering will throw with a helpful message and as soon as the type is | ||
16208 | // fixed, the key warnings will appear.) | ||
16209 | if (validType) { | ||
16210 | for (var i = 2; i < arguments.length; i++) { | ||
16211 | validateChildKeys(arguments[i], type); | ||
16212 | } | ||
16213 | } | ||
16214 | |||
16215 | validatePropTypes(element); | ||
16216 | |||
16217 | return element; | ||
16218 | }, | ||
16219 | |||
16220 | createFactory: function (type) { | ||
16221 | var validatedFactory = ReactElementValidator.createElement.bind(null, type); | ||
16222 | // Legacy hook TODO: Warn if this is accessed | ||
16223 | validatedFactory.type = type; | ||
16224 | |||
16225 | if (process.env.NODE_ENV !== 'production') { | ||
16226 | if (canDefineProperty) { | ||
16227 | Object.defineProperty(validatedFactory, 'type', { | ||
16228 | enumerable: false, | ||
16229 | get: function () { | ||
16230 | process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0; | ||
16231 | Object.defineProperty(this, 'type', { | ||
16232 | value: type | ||
16233 | }); | ||
16234 | return type; | ||
16235 | } | ||
16236 | }); | ||
16237 | } | ||
16238 | } | ||
16239 | |||
16240 | return validatedFactory; | ||
16241 | }, | ||
16242 | |||
16243 | cloneElement: function (element, props, children) { | ||
16244 | var newElement = ReactElement.cloneElement.apply(this, arguments); | ||
16245 | for (var i = 2; i < arguments.length; i++) { | ||
16246 | validateChildKeys(arguments[i], newElement.type); | ||
16247 | } | ||
16248 | validatePropTypes(newElement); | ||
16249 | return newElement; | ||
16250 | } | ||
16251 | |||
16252 | }; | ||
16253 | |||
16254 | module.exports = ReactElementValidator; | ||
16255 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
16256 | |||
16257 | /***/ }), | ||
16258 | /* 141 */ | ||
16259 | /***/ (function(module, exports, __webpack_require__) { | ||
16260 | |||
16261 | "use strict"; | ||
16262 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16263 | * Copyright 2013-present, Facebook, Inc. | ||
16264 | * All rights reserved. | ||
16265 | * | ||
16266 | * This source code is licensed under the BSD-style license found in the | ||
16267 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16268 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16269 | * | ||
16270 | * | ||
16271 | */ | ||
16272 | |||
16273 | |||
16274 | |||
16275 | var ReactPropTypeLocationNames = {}; | ||
16276 | |||
16277 | if (process.env.NODE_ENV !== 'production') { | ||
16278 | ReactPropTypeLocationNames = { | ||
16279 | prop: 'prop', | ||
16280 | context: 'context', | ||
16281 | childContext: 'child context' | ||
16282 | }; | ||
16283 | } | ||
16284 | |||
16285 | module.exports = ReactPropTypeLocationNames; | ||
16286 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
16287 | |||
16288 | /***/ }), | ||
16289 | /* 142 */ | ||
16290 | /***/ (function(module, exports, __webpack_require__) { | ||
16291 | |||
16292 | "use strict"; | ||
16293 | /** | ||
16294 | * Copyright 2013-present, Facebook, Inc. | ||
16295 | * All rights reserved. | ||
16296 | * | ||
16297 | * This source code is licensed under the BSD-style license found in the | ||
16298 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16299 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16300 | * | ||
16301 | * | ||
16302 | */ | ||
16303 | |||
16304 | |||
16305 | |||
16306 | /* global Symbol */ | ||
16307 | |||
16308 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | ||
16309 | var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | ||
16310 | |||
16311 | /** | ||
16312 | * Returns the iterator method function contained on the iterable object. | ||
16313 | * | ||
16314 | * Be sure to invoke the function with the iterable as context: | ||
16315 | * | ||
16316 | * var iteratorFn = getIteratorFn(myIterable); | ||
16317 | * if (iteratorFn) { | ||
16318 | * var iterator = iteratorFn.call(myIterable); | ||
16319 | * ... | ||
16320 | * } | ||
16321 | * | ||
16322 | * @param {?object} maybeIterable | ||
16323 | * @return {?function} | ||
16324 | */ | ||
16325 | function getIteratorFn(maybeIterable) { | ||
16326 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | ||
16327 | if (typeof iteratorFn === 'function') { | ||
16328 | return iteratorFn; | ||
16329 | } | ||
16330 | } | ||
16331 | |||
16332 | module.exports = getIteratorFn; | ||
16333 | |||
16334 | /***/ }), | ||
16335 | /* 143 */, | ||
16336 | /* 144 */, | ||
16337 | /* 145 */, | ||
16338 | /* 146 */, | ||
16339 | /* 147 */, | ||
16340 | /* 148 */, | ||
16341 | /* 149 */, | ||
16342 | /* 150 */ | ||
16343 | /***/ (function(module, exports, __webpack_require__) { | ||
16344 | |||
16345 | "use strict"; | ||
16346 | |||
16347 | |||
16348 | Object.defineProperty(exports, "__esModule", { | ||
16349 | value: true | ||
16350 | }); | ||
16351 | /** | ||
16352 | * @ignore | ||
16353 | * base event object for custom and dom event. | ||
16354 | * @author yiminghe@gmail.com | ||
16355 | */ | ||
16356 | |||
16357 | function returnFalse() { | ||
16358 | return false; | ||
16359 | } | ||
16360 | |||
16361 | function returnTrue() { | ||
16362 | return true; | ||
16363 | } | ||
16364 | |||
16365 | function EventBaseObject() { | ||
16366 | this.timeStamp = Date.now(); | ||
16367 | this.target = undefined; | ||
16368 | this.currentTarget = undefined; | ||
16369 | } | ||
16370 | |||
16371 | EventBaseObject.prototype = { | ||
16372 | isEventObject: 1, | ||
16373 | |||
16374 | constructor: EventBaseObject, | ||
16375 | |||
16376 | isDefaultPrevented: returnFalse, | ||
16377 | |||
16378 | isPropagationStopped: returnFalse, | ||
16379 | |||
16380 | isImmediatePropagationStopped: returnFalse, | ||
16381 | |||
16382 | preventDefault: function preventDefault() { | ||
16383 | this.isDefaultPrevented = returnTrue; | ||
16384 | }, | ||
16385 | stopPropagation: function stopPropagation() { | ||
16386 | this.isPropagationStopped = returnTrue; | ||
16387 | }, | ||
16388 | stopImmediatePropagation: function stopImmediatePropagation() { | ||
16389 | this.isImmediatePropagationStopped = returnTrue; | ||
16390 | // fixed 1.2 | ||
16391 | // call stopPropagation implicitly | ||
16392 | this.stopPropagation(); | ||
16393 | }, | ||
16394 | halt: function halt(immediate) { | ||
16395 | if (immediate) { | ||
16396 | this.stopImmediatePropagation(); | ||
16397 | } else { | ||
16398 | this.stopPropagation(); | ||
16399 | } | ||
16400 | this.preventDefault(); | ||
16401 | } | ||
16402 | }; | ||
16403 | |||
16404 | exports["default"] = EventBaseObject; | ||
16405 | module.exports = exports['default']; | ||
16406 | |||
16407 | /***/ }), | ||
16408 | /* 151 */ | ||
16409 | /***/ (function(module, exports, __webpack_require__) { | ||
16410 | |||
16411 | "use strict"; | ||
16412 | |||
16413 | |||
16414 | Object.defineProperty(exports, "__esModule", { | ||
16415 | value: true | ||
16416 | }); | ||
16417 | |||
16418 | var _EventBaseObject = __webpack_require__(150); | ||
16419 | |||
16420 | var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject); | ||
16421 | |||
16422 | var _objectAssign = __webpack_require__(4); | ||
16423 | |||
16424 | var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
16425 | |||
16426 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
16427 | |||
16428 | /** | ||
16429 | * @ignore | ||
16430 | * event object for dom | ||
16431 | * @author yiminghe@gmail.com | ||
16432 | */ | ||
16433 | |||
16434 | var TRUE = true; | ||
16435 | var FALSE = false; | ||
16436 | var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type']; | ||
16437 | |||
16438 | function isNullOrUndefined(w) { | ||
16439 | return w === null || w === undefined; | ||
16440 | } | ||
16441 | |||
16442 | var eventNormalizers = [{ | ||
16443 | reg: /^key/, | ||
16444 | props: ['char', 'charCode', 'key', 'keyCode', 'which'], | ||
16445 | fix: function fix(event, nativeEvent) { | ||
16446 | if (isNullOrUndefined(event.which)) { | ||
16447 | event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode; | ||
16448 | } | ||
16449 | |||
16450 | // add metaKey to non-Mac browsers (use ctrl for PC 's and Meta for Macs) | ||
16451 | if (event.metaKey === undefined) { | ||
16452 | event.metaKey = event.ctrlKey; | ||
16453 | } | ||
16454 | } | ||
16455 | }, { | ||
16456 | reg: /^touch/, | ||
16457 | props: ['touches', 'changedTouches', 'targetTouches'] | ||
16458 | }, { | ||
16459 | reg: /^hashchange$/, | ||
16460 | props: ['newURL', 'oldURL'] | ||
16461 | }, { | ||
16462 | reg: /^gesturechange$/i, | ||
16463 | props: ['rotation', 'scale'] | ||
16464 | }, { | ||
16465 | reg: /^(mousewheel|DOMMouseScroll)$/, | ||
16466 | props: [], | ||
16467 | fix: function fix(event, nativeEvent) { | ||
16468 | var deltaX = void 0; | ||
16469 | var deltaY = void 0; | ||
16470 | var delta = void 0; | ||
16471 | var wheelDelta = nativeEvent.wheelDelta; | ||
16472 | var axis = nativeEvent.axis; | ||
16473 | var wheelDeltaY = nativeEvent.wheelDeltaY; | ||
16474 | var wheelDeltaX = nativeEvent.wheelDeltaX; | ||
16475 | var detail = nativeEvent.detail; | ||
16476 | |||
16477 | // ie/webkit | ||
16478 | if (wheelDelta) { | ||
16479 | delta = wheelDelta / 120; | ||
16480 | } | ||
16481 | |||
16482 | // gecko | ||
16483 | if (detail) { | ||
16484 | // press control e.detail == 1 else e.detail == 3 | ||
16485 | delta = 0 - (detail % 3 === 0 ? detail / 3 : detail); | ||
16486 | } | ||
16487 | |||
16488 | // Gecko | ||
16489 | if (axis !== undefined) { | ||
16490 | if (axis === event.HORIZONTAL_AXIS) { | ||
16491 | deltaY = 0; | ||
16492 | deltaX = 0 - delta; | ||
16493 | } else if (axis === event.VERTICAL_AXIS) { | ||
16494 | deltaX = 0; | ||
16495 | deltaY = delta; | ||
16496 | } | ||
16497 | } | ||
16498 | |||
16499 | // Webkit | ||
16500 | if (wheelDeltaY !== undefined) { | ||
16501 | deltaY = wheelDeltaY / 120; | ||
16502 | } | ||
16503 | if (wheelDeltaX !== undefined) { | ||
16504 | deltaX = -1 * wheelDeltaX / 120; | ||
16505 | } | ||
16506 | |||
16507 | // 默认 deltaY (ie) | ||
16508 | if (!deltaX && !deltaY) { | ||
16509 | deltaY = delta; | ||
16510 | } | ||
16511 | |||
16512 | if (deltaX !== undefined) { | ||
16513 | /** | ||
16514 | * deltaX of mousewheel event | ||
16515 | * @property deltaX | ||
16516 | * @member Event.DomEvent.Object | ||
16517 | */ | ||
16518 | event.deltaX = deltaX; | ||
16519 | } | ||
16520 | |||
16521 | if (deltaY !== undefined) { | ||
16522 | /** | ||
16523 | * deltaY of mousewheel event | ||
16524 | * @property deltaY | ||
16525 | * @member Event.DomEvent.Object | ||
16526 | */ | ||
16527 | event.deltaY = deltaY; | ||
16528 | } | ||
16529 | |||
16530 | if (delta !== undefined) { | ||
16531 | /** | ||
16532 | * delta of mousewheel event | ||
16533 | * @property delta | ||
16534 | * @member Event.DomEvent.Object | ||
16535 | */ | ||
16536 | event.delta = delta; | ||
16537 | } | ||
16538 | } | ||
16539 | }, { | ||
16540 | reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i, | ||
16541 | props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'], | ||
16542 | fix: function fix(event, nativeEvent) { | ||
16543 | var eventDoc = void 0; | ||
16544 | var doc = void 0; | ||
16545 | var body = void 0; | ||
16546 | var target = event.target; | ||
16547 | var button = nativeEvent.button; | ||
16548 | |||
16549 | // Calculate pageX/Y if missing and clientX/Y available | ||
16550 | if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) { | ||
16551 | eventDoc = target.ownerDocument || document; | ||
16552 | doc = eventDoc.documentElement; | ||
16553 | body = eventDoc.body; | ||
16554 | event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); | ||
16555 | event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); | ||
16556 | } | ||
16557 | |||
16558 | // which for click: 1 === left; 2 === middle; 3 === right | ||
16559 | // do not use button | ||
16560 | if (!event.which && button !== undefined) { | ||
16561 | if (button & 1) { | ||
16562 | event.which = 1; | ||
16563 | } else if (button & 2) { | ||
16564 | event.which = 3; | ||
16565 | } else if (button & 4) { | ||
16566 | event.which = 2; | ||
16567 | } else { | ||
16568 | event.which = 0; | ||
16569 | } | ||
16570 | } | ||
16571 | |||
16572 | // add relatedTarget, if necessary | ||
16573 | if (!event.relatedTarget && event.fromElement) { | ||
16574 | event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement; | ||
16575 | } | ||
16576 | |||
16577 | return event; | ||
16578 | } | ||
16579 | }]; | ||
16580 | |||
16581 | function retTrue() { | ||
16582 | return TRUE; | ||
16583 | } | ||
16584 | |||
16585 | function retFalse() { | ||
16586 | return FALSE; | ||
16587 | } | ||
16588 | |||
16589 | function DomEventObject(nativeEvent) { | ||
16590 | var type = nativeEvent.type; | ||
16591 | |||
16592 | var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean'; | ||
16593 | |||
16594 | _EventBaseObject2["default"].call(this); | ||
16595 | |||
16596 | this.nativeEvent = nativeEvent; | ||
16597 | |||
16598 | // in case dom event has been mark as default prevented by lower dom node | ||
16599 | var isDefaultPrevented = retFalse; | ||
16600 | if ('defaultPrevented' in nativeEvent) { | ||
16601 | isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse; | ||
16602 | } else if ('getPreventDefault' in nativeEvent) { | ||
16603 | // https://bugzilla.mozilla.org/show_bug.cgi?id=691151 | ||
16604 | isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse; | ||
16605 | } else if ('returnValue' in nativeEvent) { | ||
16606 | isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse; | ||
16607 | } | ||
16608 | |||
16609 | this.isDefaultPrevented = isDefaultPrevented; | ||
16610 | |||
16611 | var fixFns = []; | ||
16612 | var fixFn = void 0; | ||
16613 | var l = void 0; | ||
16614 | var prop = void 0; | ||
16615 | var props = commonProps.concat(); | ||
16616 | |||
16617 | eventNormalizers.forEach(function (normalizer) { | ||
16618 | if (type.match(normalizer.reg)) { | ||
16619 | props = props.concat(normalizer.props); | ||
16620 | if (normalizer.fix) { | ||
16621 | fixFns.push(normalizer.fix); | ||
16622 | } | ||
16623 | } | ||
16624 | }); | ||
16625 | |||
16626 | l = props.length; | ||
16627 | |||
16628 | // clone properties of the original event object | ||
16629 | while (l) { | ||
16630 | prop = props[--l]; | ||
16631 | this[prop] = nativeEvent[prop]; | ||
16632 | } | ||
16633 | |||
16634 | // fix target property, if necessary | ||
16635 | if (!this.target && isNative) { | ||
16636 | this.target = nativeEvent.srcElement || document; // srcElement might not be defined either | ||
16637 | } | ||
16638 | |||
16639 | // check if target is a text node (safari) | ||
16640 | if (this.target && this.target.nodeType === 3) { | ||
16641 | this.target = this.target.parentNode; | ||
16642 | } | ||
16643 | |||
16644 | l = fixFns.length; | ||
16645 | |||
16646 | while (l) { | ||
16647 | fixFn = fixFns[--l]; | ||
16648 | fixFn(this, nativeEvent); | ||
16649 | } | ||
16650 | |||
16651 | this.timeStamp = nativeEvent.timeStamp || Date.now(); | ||
16652 | } | ||
16653 | |||
16654 | var EventBaseObjectProto = _EventBaseObject2["default"].prototype; | ||
16655 | |||
16656 | (0, _objectAssign2["default"])(DomEventObject.prototype, EventBaseObjectProto, { | ||
16657 | constructor: DomEventObject, | ||
16658 | |||
16659 | preventDefault: function preventDefault() { | ||
16660 | var e = this.nativeEvent; | ||
16661 | |||
16662 | // if preventDefault exists run it on the original event | ||
16663 | if (e.preventDefault) { | ||
16664 | e.preventDefault(); | ||
16665 | } else { | ||
16666 | // otherwise set the returnValue property of the original event to FALSE (IE) | ||
16667 | e.returnValue = FALSE; | ||
16668 | } | ||
16669 | |||
16670 | EventBaseObjectProto.preventDefault.call(this); | ||
16671 | }, | ||
16672 | stopPropagation: function stopPropagation() { | ||
16673 | var e = this.nativeEvent; | ||
16674 | |||
16675 | // if stopPropagation exists run it on the original event | ||
16676 | if (e.stopPropagation) { | ||
16677 | e.stopPropagation(); | ||
16678 | } else { | ||
16679 | // otherwise set the cancelBubble property of the original event to TRUE (IE) | ||
16680 | e.cancelBubble = TRUE; | ||
16681 | } | ||
16682 | |||
16683 | EventBaseObjectProto.stopPropagation.call(this); | ||
16684 | } | ||
16685 | }); | ||
16686 | |||
16687 | exports["default"] = DomEventObject; | ||
16688 | module.exports = exports['default']; | ||
16689 | |||
16690 | /***/ }), | ||
16691 | /* 152 */ | ||
16692 | /***/ (function(module, exports, __webpack_require__) { | ||
16693 | |||
16694 | "use strict"; | ||
16695 | |||
16696 | |||
16697 | Object.defineProperty(exports, "__esModule", { | ||
16698 | value: true | ||
16699 | }); | ||
16700 | exports["default"] = addEventListener; | ||
16701 | |||
16702 | var _EventObject = __webpack_require__(151); | ||
16703 | |||
16704 | var _EventObject2 = _interopRequireDefault(_EventObject); | ||
16705 | |||
16706 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
16707 | |||
16708 | function addEventListener(target, eventType, callback) { | ||
16709 | function wrapCallback(e) { | ||
16710 | var ne = new _EventObject2["default"](e); | ||
16711 | callback.call(target, ne); | ||
16712 | } | ||
16713 | |||
16714 | if (target.addEventListener) { | ||
16715 | target.addEventListener(eventType, wrapCallback, false); | ||
16716 | return { | ||
16717 | remove: function remove() { | ||
16718 | target.removeEventListener(eventType, wrapCallback, false); | ||
16719 | } | ||
16720 | }; | ||
16721 | } else if (target.attachEvent) { | ||
16722 | target.attachEvent('on' + eventType, wrapCallback); | ||
16723 | return { | ||
16724 | remove: function remove() { | ||
16725 | target.detachEvent('on' + eventType, wrapCallback); | ||
16726 | } | ||
16727 | }; | ||
16728 | } | ||
16729 | } | ||
16730 | module.exports = exports['default']; | ||
16731 | |||
16732 | /***/ }), | ||
16733 | /* 153 */ | ||
16734 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
16735 | |||
16736 | "use strict"; | ||
16737 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__ = __webpack_require__(13); | ||
16738 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__); | ||
16739 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass__ = __webpack_require__(23); | ||
16740 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass__); | ||
16741 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn__ = __webpack_require__(15); | ||
16742 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn__); | ||
16743 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits__ = __webpack_require__(14); | ||
16744 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits__); | ||
16745 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react__ = __webpack_require__(5); | ||
16746 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_react__); | ||
16747 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_prop_types__ = __webpack_require__(11); | ||
16748 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_prop_types__); | ||
16749 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Select__ = __webpack_require__(156); | ||
16750 | |||
16751 | |||
16752 | |||
16753 | |||
16754 | |||
16755 | |||
16756 | |||
16757 | |||
16758 | var formatOption = function formatOption(option, disabledOptions) { | ||
16759 | var value = '' + option; | ||
16760 | if (option < 10) { | ||
16761 | value = '0' + option; | ||
16762 | } | ||
16763 | |||
16764 | var disabled = false; | ||
16765 | if (disabledOptions && disabledOptions.indexOf(option) >= 0) { | ||
16766 | disabled = true; | ||
16767 | } | ||
16768 | |||
16769 | return { | ||
16770 | value: value, | ||
16771 | disabled: disabled | ||
16772 | }; | ||
16773 | }; | ||
16774 | |||
16775 | var Combobox = function (_Component) { | ||
16776 | __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits___default()(Combobox, _Component); | ||
16777 | |||
16778 | function Combobox() { | ||
16779 | var _ref; | ||
16780 | |||
16781 | var _temp, _this, _ret; | ||
16782 | |||
16783 | __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default()(this, Combobox); | ||
16784 | |||
16785 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
16786 | args[_key] = arguments[_key]; | ||
16787 | } | ||
16788 | |||
16789 | return _ret = (_temp = (_this = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn___default()(this, (_ref = Combobox.__proto__ || Object.getPrototypeOf(Combobox)).call.apply(_ref, [this].concat(args))), _this), _this.onItemChange = function (type, itemValue) { | ||
16790 | var _this$props = _this.props, | ||
16791 | onChange = _this$props.onChange, | ||
16792 | defaultOpenValue = _this$props.defaultOpenValue, | ||
16793 | use12Hours = _this$props.use12Hours; | ||
16794 | |||
16795 | var value = (_this.props.value || defaultOpenValue).clone(); | ||
16796 | |||
16797 | if (type === 'hour') { | ||
16798 | if (use12Hours) { | ||
16799 | if (_this.isAM()) { | ||
16800 | value.hour(+itemValue % 12); | ||
16801 | } else { | ||
16802 | value.hour(+itemValue % 12 + 12); | ||
16803 | } | ||
16804 | } else { | ||
16805 | value.hour(+itemValue); | ||
16806 | } | ||
16807 | } else if (type === 'minute') { | ||
16808 | value.minute(+itemValue); | ||
16809 | } else if (type === 'ampm') { | ||
16810 | var ampm = itemValue.toUpperCase(); | ||
16811 | if (use12Hours) { | ||
16812 | if (ampm === 'PM' && value.hour() < 12) { | ||
16813 | value.hour(value.hour() % 12 + 12); | ||
16814 | } | ||
16815 | |||
16816 | if (ampm === 'AM') { | ||
16817 | if (value.hour() >= 12) { | ||
16818 | value.hour(value.hour() - 12); | ||
16819 | } | ||
16820 | } | ||
16821 | } | ||
16822 | } else { | ||
16823 | value.second(+itemValue); | ||
16824 | } | ||
16825 | onChange(value); | ||
16826 | }, _this.onEnterSelectPanel = function (range) { | ||
16827 | _this.props.onCurrentSelectPanelChange(range); | ||
16828 | }, _temp), __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn___default()(_this, _ret); | ||
16829 | } | ||
16830 | |||
16831 | __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass___default()(Combobox, [{ | ||
16832 | key: 'getHourSelect', | ||
16833 | value: function getHourSelect(hour) { | ||
16834 | var _props = this.props, | ||
16835 | prefixCls = _props.prefixCls, | ||
16836 | hourOptions = _props.hourOptions, | ||
16837 | disabledHours = _props.disabledHours, | ||
16838 | showHour = _props.showHour, | ||
16839 | use12Hours = _props.use12Hours; | ||
16840 | |||
16841 | if (!showHour) { | ||
16842 | return null; | ||
16843 | } | ||
16844 | var disabledOptions = disabledHours(); | ||
16845 | var hourOptionsAdj = void 0; | ||
16846 | var hourAdj = void 0; | ||
16847 | if (use12Hours) { | ||
16848 | hourOptionsAdj = [12].concat(hourOptions.filter(function (h) { | ||
16849 | return h < 12 && h > 0; | ||
16850 | })); | ||
16851 | hourAdj = hour % 12 || 12; | ||
16852 | } else { | ||
16853 | hourOptionsAdj = hourOptions; | ||
16854 | hourAdj = hour; | ||
16855 | } | ||
16856 | |||
16857 | return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_6__Select__["a" /* default */], { | ||
16858 | prefixCls: prefixCls, | ||
16859 | options: hourOptionsAdj.map(function (option) { | ||
16860 | return formatOption(option, disabledOptions); | ||
16861 | }), | ||
16862 | selectedIndex: hourOptionsAdj.indexOf(hourAdj), | ||
16863 | type: 'hour', | ||
16864 | onSelect: this.onItemChange, | ||
16865 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'hour') | ||
16866 | }); | ||
16867 | } | ||
16868 | }, { | ||
16869 | key: 'getMinuteSelect', | ||
16870 | value: function getMinuteSelect(minute) { | ||
16871 | var _props2 = this.props, | ||
16872 | prefixCls = _props2.prefixCls, | ||
16873 | minuteOptions = _props2.minuteOptions, | ||
16874 | disabledMinutes = _props2.disabledMinutes, | ||
16875 | defaultOpenValue = _props2.defaultOpenValue, | ||
16876 | showMinute = _props2.showMinute; | ||
16877 | |||
16878 | if (!showMinute) { | ||
16879 | return null; | ||
16880 | } | ||
16881 | var value = this.props.value || defaultOpenValue; | ||
16882 | var disabledOptions = disabledMinutes(value.hour()); | ||
16883 | |||
16884 | return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_6__Select__["a" /* default */], { | ||
16885 | prefixCls: prefixCls, | ||
16886 | options: minuteOptions.map(function (option) { | ||
16887 | return formatOption(option, disabledOptions); | ||
16888 | }), | ||
16889 | selectedIndex: minuteOptions.indexOf(minute), | ||
16890 | type: 'minute', | ||
16891 | onSelect: this.onItemChange, | ||
16892 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'minute') | ||
16893 | }); | ||
16894 | } | ||
16895 | }, { | ||
16896 | key: 'getSecondSelect', | ||
16897 | value: function getSecondSelect(second) { | ||
16898 | var _props3 = this.props, | ||
16899 | prefixCls = _props3.prefixCls, | ||
16900 | secondOptions = _props3.secondOptions, | ||
16901 | disabledSeconds = _props3.disabledSeconds, | ||
16902 | showSecond = _props3.showSecond, | ||
16903 | defaultOpenValue = _props3.defaultOpenValue; | ||
16904 | |||
16905 | if (!showSecond) { | ||
16906 | return null; | ||
16907 | } | ||
16908 | var value = this.props.value || defaultOpenValue; | ||
16909 | var disabledOptions = disabledSeconds(value.hour(), value.minute()); | ||
16910 | |||
16911 | return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_6__Select__["a" /* default */], { | ||
16912 | prefixCls: prefixCls, | ||
16913 | options: secondOptions.map(function (option) { | ||
16914 | return formatOption(option, disabledOptions); | ||
16915 | }), | ||
16916 | selectedIndex: secondOptions.indexOf(second), | ||
16917 | type: 'second', | ||
16918 | onSelect: this.onItemChange, | ||
16919 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'second') | ||
16920 | }); | ||
16921 | } | ||
16922 | }, { | ||
16923 | key: 'getAMPMSelect', | ||
16924 | value: function getAMPMSelect() { | ||
16925 | var _props4 = this.props, | ||
16926 | prefixCls = _props4.prefixCls, | ||
16927 | use12Hours = _props4.use12Hours, | ||
16928 | format = _props4.format; | ||
16929 | |||
16930 | if (!use12Hours) { | ||
16931 | return null; | ||
16932 | } | ||
16933 | |||
16934 | var AMPMOptions = ['am', 'pm'] // If format has A char, then we should uppercase AM/PM | ||
16935 | .map(function (c) { | ||
16936 | return format.match(/\sA/) ? c.toUpperCase() : c; | ||
16937 | }).map(function (c) { | ||
16938 | return { value: c }; | ||
16939 | }); | ||
16940 | |||
16941 | var selected = this.isAM() ? 0 : 1; | ||
16942 | |||
16943 | return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_6__Select__["a" /* default */], { | ||
16944 | prefixCls: prefixCls, | ||
16945 | options: AMPMOptions, | ||
16946 | selectedIndex: selected, | ||
16947 | type: 'ampm', | ||
16948 | onSelect: this.onItemChange, | ||
16949 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'ampm') | ||
16950 | }); | ||
16951 | } | ||
16952 | }, { | ||
16953 | key: 'isAM', | ||
16954 | value: function isAM() { | ||
16955 | var value = this.props.value || this.props.defaultOpenValue; | ||
16956 | return value.hour() >= 0 && value.hour() < 12; | ||
16957 | } | ||
16958 | }, { | ||
16959 | key: 'render', | ||
16960 | value: function render() { | ||
16961 | var _props5 = this.props, | ||
16962 | prefixCls = _props5.prefixCls, | ||
16963 | defaultOpenValue = _props5.defaultOpenValue; | ||
16964 | |||
16965 | var value = this.props.value || defaultOpenValue; | ||
16966 | return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement( | ||
16967 | 'div', | ||
16968 | { className: prefixCls + '-combobox' }, | ||
16969 | this.getHourSelect(value.hour()), | ||
16970 | this.getMinuteSelect(value.minute()), | ||
16971 | this.getSecondSelect(value.second()), | ||
16972 | this.getAMPMSelect(value.hour()) | ||
16973 | ); | ||
16974 | } | ||
16975 | }]); | ||
16976 | |||
16977 | return Combobox; | ||
16978 | }(__WEBPACK_IMPORTED_MODULE_4_react__["Component"]); | ||
16979 | |||
16980 | Combobox.propTypes = { | ||
16981 | format: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
16982 | defaultOpenValue: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.object, | ||
16983 | prefixCls: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
16984 | value: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.object, | ||
16985 | onChange: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
16986 | showHour: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool, | ||
16987 | showMinute: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool, | ||
16988 | showSecond: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool, | ||
16989 | hourOptions: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.array, | ||
16990 | minuteOptions: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.array, | ||
16991 | secondOptions: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.array, | ||
16992 | disabledHours: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
16993 | disabledMinutes: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
16994 | disabledSeconds: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
16995 | onCurrentSelectPanelChange: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
16996 | use12Hours: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool | ||
16997 | }; | ||
16998 | |||
16999 | |||
17000 | /* harmony default export */ __webpack_exports__["a"] = (Combobox); | ||
17001 | |||
17002 | /***/ }), | ||
17003 | /* 154 */ | ||
17004 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
17005 | |||
17006 | "use strict"; | ||
17007 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__ = __webpack_require__(13); | ||
17008 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__); | ||
17009 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass__ = __webpack_require__(23); | ||
17010 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass__); | ||
17011 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn__ = __webpack_require__(15); | ||
17012 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn__); | ||
17013 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits__ = __webpack_require__(14); | ||
17014 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits__); | ||
17015 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react__ = __webpack_require__(5); | ||
17016 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_react__); | ||
17017 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_prop_types__ = __webpack_require__(11); | ||
17018 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_prop_types__); | ||
17019 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_moment__ = __webpack_require__(18); | ||
17020 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_moment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_moment__); | ||
17021 | |||
17022 | |||
17023 | |||
17024 | |||
17025 | |||
17026 | |||
17027 | |||
17028 | |||
17029 | var Header = function (_Component) { | ||
17030 | __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits___default()(Header, _Component); | ||
17031 | |||
17032 | function Header(props) { | ||
17033 | __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default()(this, Header); | ||
17034 | |||
17035 | var _this = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn___default()(this, (Header.__proto__ || Object.getPrototypeOf(Header)).call(this, props)); | ||
17036 | |||
17037 | _initialiseProps.call(_this); | ||
17038 | |||
17039 | var value = props.value, | ||
17040 | format = props.format; | ||
17041 | |||
17042 | _this.state = { | ||
17043 | str: value && value.format(format) || '', | ||
17044 | invalid: false | ||
17045 | }; | ||
17046 | return _this; | ||
17047 | } | ||
17048 | |||
17049 | __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass___default()(Header, [{ | ||
17050 | key: 'componentWillReceiveProps', | ||
17051 | value: function componentWillReceiveProps(nextProps) { | ||
17052 | var value = nextProps.value, | ||
17053 | format = nextProps.format; | ||
17054 | |||
17055 | this.setState({ | ||
17056 | str: value && value.format(format) || '', | ||
17057 | invalid: false | ||
17058 | }); | ||
17059 | } | ||
17060 | }, { | ||
17061 | key: 'getClearButton', | ||
17062 | value: function getClearButton() { | ||
17063 | var _props = this.props, | ||
17064 | prefixCls = _props.prefixCls, | ||
17065 | allowEmpty = _props.allowEmpty; | ||
17066 | |||
17067 | if (!allowEmpty) { | ||
17068 | return null; | ||
17069 | } | ||
17070 | return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement('a', { | ||
17071 | className: prefixCls + '-clear-btn', | ||
17072 | role: 'button', | ||
17073 | title: this.props.clearText, | ||
17074 | onMouseDown: this.onClear | ||
17075 | }); | ||
17076 | } | ||
17077 | }, { | ||
17078 | key: 'getProtoValue', | ||
17079 | value: function getProtoValue() { | ||
17080 | return this.props.value || this.props.defaultOpenValue; | ||
17081 | } | ||
17082 | }, { | ||
17083 | key: 'getInput', | ||
17084 | value: function getInput() { | ||
17085 | var _props2 = this.props, | ||
17086 | prefixCls = _props2.prefixCls, | ||
17087 | placeholder = _props2.placeholder; | ||
17088 | var _state = this.state, | ||
17089 | invalid = _state.invalid, | ||
17090 | str = _state.str; | ||
17091 | |||
17092 | var invalidClass = invalid ? prefixCls + '-input-invalid' : ''; | ||
17093 | return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement('input', { | ||
17094 | className: prefixCls + '-input ' + invalidClass, | ||
17095 | ref: 'input', | ||
17096 | onKeyDown: this.onKeyDown, | ||
17097 | value: str, | ||
17098 | placeholder: placeholder, | ||
17099 | onChange: this.onInputChange | ||
17100 | }); | ||
17101 | } | ||
17102 | }, { | ||
17103 | key: 'render', | ||
17104 | value: function render() { | ||
17105 | var prefixCls = this.props.prefixCls; | ||
17106 | |||
17107 | return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement( | ||
17108 | 'div', | ||
17109 | { className: prefixCls + '-input-wrap' }, | ||
17110 | this.getInput(), | ||
17111 | this.getClearButton() | ||
17112 | ); | ||
17113 | } | ||
17114 | }]); | ||
17115 | |||
17116 | return Header; | ||
17117 | }(__WEBPACK_IMPORTED_MODULE_4_react__["Component"]); | ||
17118 | |||
17119 | Header.propTypes = { | ||
17120 | format: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17121 | prefixCls: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17122 | disabledDate: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17123 | placeholder: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17124 | clearText: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17125 | value: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.object, | ||
17126 | hourOptions: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.array, | ||
17127 | minuteOptions: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.array, | ||
17128 | secondOptions: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.array, | ||
17129 | disabledHours: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17130 | disabledMinutes: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17131 | disabledSeconds: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17132 | onChange: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17133 | onClear: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17134 | onEsc: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17135 | allowEmpty: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool, | ||
17136 | defaultOpenValue: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.object, | ||
17137 | currentSelectPanel: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string | ||
17138 | }; | ||
17139 | |||
17140 | var _initialiseProps = function _initialiseProps() { | ||
17141 | var _this2 = this; | ||
17142 | |||
17143 | this.onInputChange = function (event) { | ||
17144 | var str = event.target.value; | ||
17145 | _this2.setState({ | ||
17146 | str: str | ||
17147 | }); | ||
17148 | var _props3 = _this2.props, | ||
17149 | format = _props3.format, | ||
17150 | hourOptions = _props3.hourOptions, | ||
17151 | minuteOptions = _props3.minuteOptions, | ||
17152 | secondOptions = _props3.secondOptions, | ||
17153 | disabledHours = _props3.disabledHours, | ||
17154 | disabledMinutes = _props3.disabledMinutes, | ||
17155 | disabledSeconds = _props3.disabledSeconds, | ||
17156 | onChange = _props3.onChange, | ||
17157 | allowEmpty = _props3.allowEmpty; | ||
17158 | |||
17159 | |||
17160 | if (str) { | ||
17161 | var originalValue = _this2.props.value; | ||
17162 | var value = _this2.getProtoValue().clone(); | ||
17163 | var parsed = __WEBPACK_IMPORTED_MODULE_6_moment___default()(str, format, true); | ||
17164 | if (!parsed.isValid()) { | ||
17165 | _this2.setState({ | ||
17166 | invalid: true | ||
17167 | }); | ||
17168 | return; | ||
17169 | } | ||
17170 | value.hour(parsed.hour()).minute(parsed.minute()).second(parsed.second()); | ||
17171 | |||
17172 | // if time value not allowed, response warning. | ||
17173 | if (hourOptions.indexOf(value.hour()) < 0 || minuteOptions.indexOf(value.minute()) < 0 || secondOptions.indexOf(value.second()) < 0) { | ||
17174 | _this2.setState({ | ||
17175 | invalid: true | ||
17176 | }); | ||
17177 | return; | ||
17178 | } | ||
17179 | |||
17180 | // if time value is disabled, response warning. | ||
17181 | var disabledHourOptions = disabledHours(); | ||
17182 | var disabledMinuteOptions = disabledMinutes(value.hour()); | ||
17183 | var disabledSecondOptions = disabledSeconds(value.hour(), value.minute()); | ||
17184 | if (disabledHourOptions && disabledHourOptions.indexOf(value.hour()) >= 0 || disabledMinuteOptions && disabledMinuteOptions.indexOf(value.minute()) >= 0 || disabledSecondOptions && disabledSecondOptions.indexOf(value.second()) >= 0) { | ||
17185 | _this2.setState({ | ||
17186 | invalid: true | ||
17187 | }); | ||
17188 | return; | ||
17189 | } | ||
17190 | |||
17191 | if (originalValue) { | ||
17192 | if (originalValue.hour() !== value.hour() || originalValue.minute() !== value.minute() || originalValue.second() !== value.second()) { | ||
17193 | // keep other fields for rc-calendar | ||
17194 | var changedValue = originalValue.clone(); | ||
17195 | changedValue.hour(value.hour()); | ||
17196 | changedValue.minute(value.minute()); | ||
17197 | changedValue.second(value.second()); | ||
17198 | onChange(changedValue); | ||
17199 | } | ||
17200 | } else if (originalValue !== value) { | ||
17201 | onChange(value); | ||
17202 | } | ||
17203 | } else if (allowEmpty) { | ||
17204 | onChange(null); | ||
17205 | } else { | ||
17206 | _this2.setState({ | ||
17207 | invalid: true | ||
17208 | }); | ||
17209 | return; | ||
17210 | } | ||
17211 | |||
17212 | _this2.setState({ | ||
17213 | invalid: false | ||
17214 | }); | ||
17215 | }; | ||
17216 | |||
17217 | this.onKeyDown = function (e) { | ||
17218 | if (e.keyCode === 27) { | ||
17219 | _this2.props.onEsc(); | ||
17220 | } | ||
17221 | }; | ||
17222 | |||
17223 | this.onClear = function () { | ||
17224 | _this2.setState({ str: '' }); | ||
17225 | _this2.props.onClear(); | ||
17226 | }; | ||
17227 | }; | ||
17228 | |||
17229 | /* harmony default export */ __webpack_exports__["a"] = (Header); | ||
17230 | |||
17231 | /***/ }), | ||
17232 | /* 155 */ | ||
17233 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
17234 | |||
17235 | "use strict"; | ||
17236 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty__ = __webpack_require__(93); | ||
17237 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty__); | ||
17238 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__ = __webpack_require__(13); | ||
17239 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__); | ||
17240 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__ = __webpack_require__(23); | ||
17241 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__); | ||
17242 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn__ = __webpack_require__(15); | ||
17243 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn__); | ||
17244 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits__ = __webpack_require__(14); | ||
17245 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits__); | ||
17246 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_react__ = __webpack_require__(5); | ||
17247 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_react__); | ||
17248 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_prop_types__ = __webpack_require__(11); | ||
17249 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_prop_types__); | ||
17250 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Header__ = __webpack_require__(154); | ||
17251 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Combobox__ = __webpack_require__(153); | ||
17252 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_moment__ = __webpack_require__(18); | ||
17253 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_moment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9_moment__); | ||
17254 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_classnames__ = __webpack_require__(95); | ||
17255 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10_classnames__); | ||
17256 | |||
17257 | |||
17258 | |||
17259 | |||
17260 | |||
17261 | |||
17262 | |||
17263 | |||
17264 | |||
17265 | |||
17266 | |||
17267 | |||
17268 | function noop() {} | ||
17269 | |||
17270 | function generateOptions(length, disabledOptions, hideDisabledOptions) { | ||
17271 | var arr = []; | ||
17272 | for (var value = 0; value < length; value++) { | ||
17273 | if (!disabledOptions || disabledOptions.indexOf(value) < 0 || !hideDisabledOptions) { | ||
17274 | arr.push(value); | ||
17275 | } | ||
17276 | } | ||
17277 | return arr; | ||
17278 | } | ||
17279 | |||
17280 | var Panel = function (_Component) { | ||
17281 | __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits___default()(Panel, _Component); | ||
17282 | |||
17283 | function Panel(props) { | ||
17284 | __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default()(this, Panel); | ||
17285 | |||
17286 | var _this = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn___default()(this, (Panel.__proto__ || Object.getPrototypeOf(Panel)).call(this, props)); | ||
17287 | |||
17288 | _this.onChange = function (newValue) { | ||
17289 | _this.setState({ value: newValue }); | ||
17290 | _this.props.onChange(newValue); | ||
17291 | }; | ||
17292 | |||
17293 | _this.onCurrentSelectPanelChange = function (currentSelectPanel) { | ||
17294 | _this.setState({ currentSelectPanel: currentSelectPanel }); | ||
17295 | }; | ||
17296 | |||
17297 | _this.state = { | ||
17298 | value: props.value, | ||
17299 | selectionRange: [] | ||
17300 | }; | ||
17301 | return _this; | ||
17302 | } | ||
17303 | |||
17304 | __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default()(Panel, [{ | ||
17305 | key: 'componentWillReceiveProps', | ||
17306 | value: function componentWillReceiveProps(nextProps) { | ||
17307 | var value = nextProps.value; | ||
17308 | if (value) { | ||
17309 | this.setState({ | ||
17310 | value: value | ||
17311 | }); | ||
17312 | } | ||
17313 | } | ||
17314 | }, { | ||
17315 | key: 'close', | ||
17316 | |||
17317 | |||
17318 | // https://github.com/ant-design/ant-design/issues/5829 | ||
17319 | value: function close() { | ||
17320 | this.props.onEsc(); | ||
17321 | } | ||
17322 | }, { | ||
17323 | key: 'render', | ||
17324 | value: function render() { | ||
17325 | var _classNames; | ||
17326 | |||
17327 | var _props = this.props, | ||
17328 | prefixCls = _props.prefixCls, | ||
17329 | className = _props.className, | ||
17330 | placeholder = _props.placeholder, | ||
17331 | disabledHours = _props.disabledHours, | ||
17332 | disabledMinutes = _props.disabledMinutes, | ||
17333 | disabledSeconds = _props.disabledSeconds, | ||
17334 | hideDisabledOptions = _props.hideDisabledOptions, | ||
17335 | allowEmpty = _props.allowEmpty, | ||
17336 | showHour = _props.showHour, | ||
17337 | showMinute = _props.showMinute, | ||
17338 | showSecond = _props.showSecond, | ||
17339 | format = _props.format, | ||
17340 | defaultOpenValue = _props.defaultOpenValue, | ||
17341 | clearText = _props.clearText, | ||
17342 | onEsc = _props.onEsc, | ||
17343 | addon = _props.addon, | ||
17344 | use12Hours = _props.use12Hours, | ||
17345 | onClear = _props.onClear; | ||
17346 | var _state = this.state, | ||
17347 | value = _state.value, | ||
17348 | currentSelectPanel = _state.currentSelectPanel; | ||
17349 | |||
17350 | var disabledHourOptions = disabledHours(); | ||
17351 | var disabledMinuteOptions = disabledMinutes(value ? value.hour() : null); | ||
17352 | var disabledSecondOptions = disabledSeconds(value ? value.hour() : null, value ? value.minute() : null); | ||
17353 | var hourOptions = generateOptions(24, disabledHourOptions, hideDisabledOptions); | ||
17354 | var minuteOptions = generateOptions(60, disabledMinuteOptions, hideDisabledOptions); | ||
17355 | var secondOptions = generateOptions(60, disabledSecondOptions, hideDisabledOptions); | ||
17356 | |||
17357 | return __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement( | ||
17358 | 'div', | ||
17359 | { className: __WEBPACK_IMPORTED_MODULE_10_classnames___default()((_classNames = {}, __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty___default()(_classNames, prefixCls + '-inner', true), __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty___default()(_classNames, className, !!className), _classNames)) }, | ||
17360 | __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_7__Header__["a" /* default */], { | ||
17361 | clearText: clearText, | ||
17362 | prefixCls: prefixCls, | ||
17363 | defaultOpenValue: defaultOpenValue, | ||
17364 | value: value, | ||
17365 | currentSelectPanel: currentSelectPanel, | ||
17366 | onEsc: onEsc, | ||
17367 | format: format, | ||
17368 | placeholder: placeholder, | ||
17369 | hourOptions: hourOptions, | ||
17370 | minuteOptions: minuteOptions, | ||
17371 | secondOptions: secondOptions, | ||
17372 | disabledHours: disabledHours, | ||
17373 | disabledMinutes: disabledMinutes, | ||
17374 | disabledSeconds: disabledSeconds, | ||
17375 | onChange: this.onChange, | ||
17376 | onClear: onClear, | ||
17377 | allowEmpty: allowEmpty | ||
17378 | }), | ||
17379 | __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_8__Combobox__["a" /* default */], { | ||
17380 | prefixCls: prefixCls, | ||
17381 | value: value, | ||
17382 | defaultOpenValue: defaultOpenValue, | ||
17383 | format: format, | ||
17384 | onChange: this.onChange, | ||
17385 | showHour: showHour, | ||
17386 | showMinute: showMinute, | ||
17387 | showSecond: showSecond, | ||
17388 | hourOptions: hourOptions, | ||
17389 | minuteOptions: minuteOptions, | ||
17390 | secondOptions: secondOptions, | ||
17391 | disabledHours: disabledHours, | ||
17392 | disabledMinutes: disabledMinutes, | ||
17393 | disabledSeconds: disabledSeconds, | ||
17394 | onCurrentSelectPanelChange: this.onCurrentSelectPanelChange, | ||
17395 | use12Hours: use12Hours | ||
17396 | }), | ||
17397 | addon(this) | ||
17398 | ); | ||
17399 | } | ||
17400 | }]); | ||
17401 | |||
17402 | return Panel; | ||
17403 | }(__WEBPACK_IMPORTED_MODULE_5_react__["Component"]); | ||
17404 | |||
17405 | Panel.propTypes = { | ||
17406 | clearText: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string, | ||
17407 | prefixCls: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string, | ||
17408 | className: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string, | ||
17409 | defaultOpenValue: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.object, | ||
17410 | value: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.object, | ||
17411 | placeholder: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string, | ||
17412 | format: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string, | ||
17413 | disabledHours: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func, | ||
17414 | disabledMinutes: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func, | ||
17415 | disabledSeconds: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func, | ||
17416 | hideDisabledOptions: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.bool, | ||
17417 | onChange: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func, | ||
17418 | onEsc: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func, | ||
17419 | allowEmpty: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.bool, | ||
17420 | showHour: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.bool, | ||
17421 | showMinute: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.bool, | ||
17422 | showSecond: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.bool, | ||
17423 | onClear: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func, | ||
17424 | use12Hours: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.bool, | ||
17425 | addon: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func | ||
17426 | }; | ||
17427 | Panel.defaultProps = { | ||
17428 | prefixCls: 'rc-time-picker-panel', | ||
17429 | onChange: noop, | ||
17430 | onClear: noop, | ||
17431 | disabledHours: noop, | ||
17432 | disabledMinutes: noop, | ||
17433 | disabledSeconds: noop, | ||
17434 | defaultOpenValue: __WEBPACK_IMPORTED_MODULE_9_moment___default()(), | ||
17435 | use12Hours: false, | ||
17436 | addon: noop | ||
17437 | }; | ||
17438 | |||
17439 | |||
17440 | /* harmony default export */ __webpack_exports__["a"] = (Panel); | ||
17441 | |||
17442 | /***/ }), | ||
17443 | /* 156 */ | ||
17444 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
17445 | |||
17446 | "use strict"; | ||
17447 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty__ = __webpack_require__(93); | ||
17448 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty__); | ||
17449 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__ = __webpack_require__(13); | ||
17450 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__); | ||
17451 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__ = __webpack_require__(23); | ||
17452 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__); | ||
17453 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn__ = __webpack_require__(15); | ||
17454 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn__); | ||
17455 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits__ = __webpack_require__(14); | ||
17456 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits__); | ||
17457 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_react__ = __webpack_require__(5); | ||
17458 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_react__); | ||
17459 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_prop_types__ = __webpack_require__(11); | ||
17460 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_prop_types__); | ||
17461 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_react_dom__ = __webpack_require__(8); | ||
17462 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_react_dom__); | ||
17463 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_classnames__ = __webpack_require__(95); | ||
17464 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_classnames__); | ||
17465 | |||
17466 | |||
17467 | |||
17468 | |||
17469 | |||
17470 | |||
17471 | |||
17472 | |||
17473 | |||
17474 | |||
17475 | var scrollTo = function scrollTo(element, to, duration) { | ||
17476 | var requestAnimationFrame = window.requestAnimationFrame || function requestAnimationFrameTimeout() { | ||
17477 | return setTimeout(arguments[0], 10); | ||
17478 | }; | ||
17479 | // jump to target if duration zero | ||
17480 | if (duration <= 0) { | ||
17481 | element.scrollTop = to; | ||
17482 | return; | ||
17483 | } | ||
17484 | var difference = to - element.scrollTop; | ||
17485 | var perTick = difference / duration * 10; | ||
17486 | |||
17487 | requestAnimationFrame(function () { | ||
17488 | element.scrollTop = element.scrollTop + perTick; | ||
17489 | if (element.scrollTop === to) return; | ||
17490 | scrollTo(element, to, duration - 10); | ||
17491 | }); | ||
17492 | }; | ||
17493 | |||
17494 | var Select = function (_Component) { | ||
17495 | __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits___default()(Select, _Component); | ||
17496 | |||
17497 | function Select() { | ||
17498 | var _ref; | ||
17499 | |||
17500 | var _temp, _this, _ret; | ||
17501 | |||
17502 | __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default()(this, Select); | ||
17503 | |||
17504 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
17505 | args[_key] = arguments[_key]; | ||
17506 | } | ||
17507 | |||
17508 | return _ret = (_temp = (_this = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn___default()(this, (_ref = Select.__proto__ || Object.getPrototypeOf(Select)).call.apply(_ref, [this].concat(args))), _this), _this.state = { | ||
17509 | active: false | ||
17510 | }, _this.onSelect = function (value) { | ||
17511 | var _this$props = _this.props, | ||
17512 | onSelect = _this$props.onSelect, | ||
17513 | type = _this$props.type; | ||
17514 | |||
17515 | onSelect(type, value); | ||
17516 | }, _this.handleMouseEnter = function (e) { | ||
17517 | _this.setState({ active: true }); | ||
17518 | _this.props.onMouseEnter(e); | ||
17519 | }, _this.handleMouseLeave = function () { | ||
17520 | _this.setState({ active: false }); | ||
17521 | }, _temp), __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn___default()(_this, _ret); | ||
17522 | } | ||
17523 | |||
17524 | __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default()(Select, [{ | ||
17525 | key: 'componentDidMount', | ||
17526 | value: function componentDidMount() { | ||
17527 | // jump to selected option | ||
17528 | this.scrollToSelected(0); | ||
17529 | } | ||
17530 | }, { | ||
17531 | key: 'componentDidUpdate', | ||
17532 | value: function componentDidUpdate(prevProps) { | ||
17533 | // smooth scroll to selected option | ||
17534 | if (prevProps.selectedIndex !== this.props.selectedIndex) { | ||
17535 | this.scrollToSelected(120); | ||
17536 | } | ||
17537 | } | ||
17538 | }, { | ||
17539 | key: 'getOptions', | ||
17540 | value: function getOptions() { | ||
17541 | var _this2 = this; | ||
17542 | |||
17543 | var _props = this.props, | ||
17544 | options = _props.options, | ||
17545 | selectedIndex = _props.selectedIndex, | ||
17546 | prefixCls = _props.prefixCls; | ||
17547 | |||
17548 | return options.map(function (item, index) { | ||
17549 | var _classnames; | ||
17550 | |||
17551 | var cls = __WEBPACK_IMPORTED_MODULE_8_classnames___default()((_classnames = {}, __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty___default()(_classnames, prefixCls + '-select-option-selected', selectedIndex === index), __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty___default()(_classnames, prefixCls + '-select-option-disabled', item.disabled), _classnames)); | ||
17552 | var onclick = null; | ||
17553 | if (!item.disabled) { | ||
17554 | onclick = _this2.onSelect.bind(_this2, item.value); | ||
17555 | } | ||
17556 | return __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement( | ||
17557 | 'li', | ||
17558 | { | ||
17559 | className: cls, | ||
17560 | key: index, | ||
17561 | onClick: onclick, | ||
17562 | disabled: item.disabled | ||
17563 | }, | ||
17564 | item.value | ||
17565 | ); | ||
17566 | }); | ||
17567 | } | ||
17568 | }, { | ||
17569 | key: 'scrollToSelected', | ||
17570 | value: function scrollToSelected(duration) { | ||
17571 | // move to selected item | ||
17572 | var select = __WEBPACK_IMPORTED_MODULE_7_react_dom___default.a.findDOMNode(this); | ||
17573 | var list = __WEBPACK_IMPORTED_MODULE_7_react_dom___default.a.findDOMNode(this.refs.list); | ||
17574 | if (!list) { | ||
17575 | return; | ||
17576 | } | ||
17577 | var index = this.props.selectedIndex; | ||
17578 | if (index < 0) { | ||
17579 | index = 0; | ||
17580 | } | ||
17581 | var topOption = list.children[index]; | ||
17582 | var to = topOption.offsetTop; | ||
17583 | scrollTo(select, to, duration); | ||
17584 | } | ||
17585 | }, { | ||
17586 | key: 'render', | ||
17587 | value: function render() { | ||
17588 | var _classnames2; | ||
17589 | |||
17590 | if (this.props.options.length === 0) { | ||
17591 | return null; | ||
17592 | } | ||
17593 | |||
17594 | var prefixCls = this.props.prefixCls; | ||
17595 | |||
17596 | var cls = __WEBPACK_IMPORTED_MODULE_8_classnames___default()((_classnames2 = {}, __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty___default()(_classnames2, prefixCls + '-select', 1), __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_defineProperty___default()(_classnames2, prefixCls + '-select-active', this.state.active), _classnames2)); | ||
17597 | |||
17598 | return __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement( | ||
17599 | 'div', | ||
17600 | { | ||
17601 | className: cls, | ||
17602 | onMouseEnter: this.handleMouseEnter, | ||
17603 | onMouseLeave: this.handleMouseLeave | ||
17604 | }, | ||
17605 | __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement( | ||
17606 | 'ul', | ||
17607 | { ref: 'list' }, | ||
17608 | this.getOptions() | ||
17609 | ) | ||
17610 | ); | ||
17611 | } | ||
17612 | }]); | ||
17613 | |||
17614 | return Select; | ||
17615 | }(__WEBPACK_IMPORTED_MODULE_5_react__["Component"]); | ||
17616 | |||
17617 | Select.propTypes = { | ||
17618 | prefixCls: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string, | ||
17619 | options: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.array, | ||
17620 | selectedIndex: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.number, | ||
17621 | type: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string, | ||
17622 | onSelect: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func, | ||
17623 | onMouseEnter: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func | ||
17624 | }; | ||
17625 | |||
17626 | |||
17627 | /* harmony default export */ __webpack_exports__["a"] = (Select); | ||
17628 | |||
17629 | /***/ }), | ||
17630 | /* 157 */ | ||
17631 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
17632 | |||
17633 | "use strict"; | ||
17634 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__ = __webpack_require__(13); | ||
17635 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__); | ||
17636 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass__ = __webpack_require__(23); | ||
17637 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass__); | ||
17638 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn__ = __webpack_require__(15); | ||
17639 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn__); | ||
17640 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits__ = __webpack_require__(14); | ||
17641 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits__); | ||
17642 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react__ = __webpack_require__(5); | ||
17643 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_react__); | ||
17644 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_prop_types__ = __webpack_require__(11); | ||
17645 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_prop_types__); | ||
17646 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_rc_trigger__ = __webpack_require__(238); | ||
17647 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_rc_trigger___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_rc_trigger__); | ||
17648 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Panel__ = __webpack_require__(155); | ||
17649 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__placements__ = __webpack_require__(159); | ||
17650 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_moment__ = __webpack_require__(18); | ||
17651 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_moment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9_moment__); | ||
17652 | |||
17653 | |||
17654 | |||
17655 | |||
17656 | |||
17657 | |||
17658 | |||
17659 | |||
17660 | |||
17661 | |||
17662 | |||
17663 | function noop() {} | ||
17664 | |||
17665 | function refFn(field, component) { | ||
17666 | this[field] = component; | ||
17667 | } | ||
17668 | |||
17669 | var Picker = function (_Component) { | ||
17670 | __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits___default()(Picker, _Component); | ||
17671 | |||
17672 | function Picker(props) { | ||
17673 | __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default()(this, Picker); | ||
17674 | |||
17675 | var _this = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn___default()(this, (Picker.__proto__ || Object.getPrototypeOf(Picker)).call(this, props)); | ||
17676 | |||
17677 | _initialiseProps.call(_this); | ||
17678 | |||
17679 | _this.saveInputRef = refFn.bind(_this, 'picker'); | ||
17680 | _this.savePanelRef = refFn.bind(_this, 'panelInstance'); | ||
17681 | var defaultOpen = props.defaultOpen, | ||
17682 | defaultValue = props.defaultValue, | ||
17683 | _props$open = props.open, | ||
17684 | open = _props$open === undefined ? defaultOpen : _props$open, | ||
17685 | _props$value = props.value, | ||
17686 | value = _props$value === undefined ? defaultValue : _props$value; | ||
17687 | |||
17688 | _this.state = { | ||
17689 | open: open, | ||
17690 | value: value | ||
17691 | }; | ||
17692 | return _this; | ||
17693 | } | ||
17694 | |||
17695 | __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass___default()(Picker, [{ | ||
17696 | key: 'componentWillReceiveProps', | ||
17697 | value: function componentWillReceiveProps(nextProps) { | ||
17698 | var value = nextProps.value, | ||
17699 | open = nextProps.open; | ||
17700 | |||
17701 | if ('value' in nextProps) { | ||
17702 | this.setState({ | ||
17703 | value: value | ||
17704 | }); | ||
17705 | } | ||
17706 | if (open !== undefined) { | ||
17707 | this.setState({ open: open }); | ||
17708 | } | ||
17709 | } | ||
17710 | }, { | ||
17711 | key: 'setValue', | ||
17712 | value: function setValue(value) { | ||
17713 | if (!('value' in this.props)) { | ||
17714 | this.setState({ | ||
17715 | value: value | ||
17716 | }); | ||
17717 | } | ||
17718 | this.props.onChange(value); | ||
17719 | } | ||
17720 | }, { | ||
17721 | key: 'getFormat', | ||
17722 | value: function getFormat() { | ||
17723 | var _props = this.props, | ||
17724 | format = _props.format, | ||
17725 | showHour = _props.showHour, | ||
17726 | showMinute = _props.showMinute, | ||
17727 | showSecond = _props.showSecond, | ||
17728 | use12Hours = _props.use12Hours; | ||
17729 | |||
17730 | if (format) { | ||
17731 | return format; | ||
17732 | } | ||
17733 | |||
17734 | if (use12Hours) { | ||
17735 | var fmtString = [showHour ? 'h' : '', showMinute ? 'mm' : '', showSecond ? 'ss' : ''].filter(function (item) { | ||
17736 | return !!item; | ||
17737 | }).join(':'); | ||
17738 | |||
17739 | return fmtString.concat(' a'); | ||
17740 | } | ||
17741 | |||
17742 | return [showHour ? 'HH' : '', showMinute ? 'mm' : '', showSecond ? 'ss' : ''].filter(function (item) { | ||
17743 | return !!item; | ||
17744 | }).join(':'); | ||
17745 | } | ||
17746 | }, { | ||
17747 | key: 'getPanelElement', | ||
17748 | value: function getPanelElement() { | ||
17749 | var _props2 = this.props, | ||
17750 | prefixCls = _props2.prefixCls, | ||
17751 | placeholder = _props2.placeholder, | ||
17752 | disabledHours = _props2.disabledHours, | ||
17753 | disabledMinutes = _props2.disabledMinutes, | ||
17754 | disabledSeconds = _props2.disabledSeconds, | ||
17755 | hideDisabledOptions = _props2.hideDisabledOptions, | ||
17756 | allowEmpty = _props2.allowEmpty, | ||
17757 | showHour = _props2.showHour, | ||
17758 | showMinute = _props2.showMinute, | ||
17759 | showSecond = _props2.showSecond, | ||
17760 | defaultOpenValue = _props2.defaultOpenValue, | ||
17761 | clearText = _props2.clearText, | ||
17762 | addon = _props2.addon, | ||
17763 | use12Hours = _props2.use12Hours; | ||
17764 | |||
17765 | return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_7__Panel__["a" /* default */], { | ||
17766 | clearText: clearText, | ||
17767 | prefixCls: prefixCls + '-panel', | ||
17768 | ref: this.savePanelRef, | ||
17769 | value: this.state.value, | ||
17770 | onChange: this.onPanelChange, | ||
17771 | onClear: this.onPanelClear, | ||
17772 | defaultOpenValue: defaultOpenValue, | ||
17773 | showHour: showHour, | ||
17774 | showMinute: showMinute, | ||
17775 | showSecond: showSecond, | ||
17776 | onEsc: this.onEsc, | ||
17777 | allowEmpty: allowEmpty, | ||
17778 | format: this.getFormat(), | ||
17779 | placeholder: placeholder, | ||
17780 | disabledHours: disabledHours, | ||
17781 | disabledMinutes: disabledMinutes, | ||
17782 | disabledSeconds: disabledSeconds, | ||
17783 | hideDisabledOptions: hideDisabledOptions, | ||
17784 | use12Hours: use12Hours, | ||
17785 | addon: addon | ||
17786 | }); | ||
17787 | } | ||
17788 | }, { | ||
17789 | key: 'getPopupClassName', | ||
17790 | value: function getPopupClassName() { | ||
17791 | var _props3 = this.props, | ||
17792 | showHour = _props3.showHour, | ||
17793 | showMinute = _props3.showMinute, | ||
17794 | showSecond = _props3.showSecond, | ||
17795 | use12Hours = _props3.use12Hours, | ||
17796 | prefixCls = _props3.prefixCls; | ||
17797 | |||
17798 | var popupClassName = this.props.popupClassName; | ||
17799 | // Keep it for old compatibility | ||
17800 | if ((!showHour || !showMinute || !showSecond) && !use12Hours) { | ||
17801 | popupClassName += ' ' + prefixCls + '-panel-narrow'; | ||
17802 | } | ||
17803 | var selectColumnCount = 0; | ||
17804 | if (showHour) { | ||
17805 | selectColumnCount += 1; | ||
17806 | } | ||
17807 | if (showMinute) { | ||
17808 | selectColumnCount += 1; | ||
17809 | } | ||
17810 | if (showSecond) { | ||
17811 | selectColumnCount += 1; | ||
17812 | } | ||
17813 | if (use12Hours) { | ||
17814 | selectColumnCount += 1; | ||
17815 | } | ||
17816 | popupClassName += ' ' + prefixCls + '-panel-column-' + selectColumnCount; | ||
17817 | return popupClassName; | ||
17818 | } | ||
17819 | }, { | ||
17820 | key: 'setOpen', | ||
17821 | value: function setOpen(open) { | ||
17822 | var _props4 = this.props, | ||
17823 | onOpen = _props4.onOpen, | ||
17824 | onClose = _props4.onClose; | ||
17825 | |||
17826 | if (this.state.open !== open) { | ||
17827 | if (!('open' in this.props)) { | ||
17828 | this.setState({ open: open }); | ||
17829 | } | ||
17830 | if (open) { | ||
17831 | onOpen({ open: open }); | ||
17832 | } else { | ||
17833 | onClose({ open: open }); | ||
17834 | } | ||
17835 | } | ||
17836 | } | ||
17837 | }, { | ||
17838 | key: 'focus', | ||
17839 | value: function focus() { | ||
17840 | this.picker.focus(); | ||
17841 | } | ||
17842 | }, { | ||
17843 | key: 'render', | ||
17844 | value: function render() { | ||
17845 | var _props5 = this.props, | ||
17846 | prefixCls = _props5.prefixCls, | ||
17847 | placeholder = _props5.placeholder, | ||
17848 | placement = _props5.placement, | ||
17849 | align = _props5.align, | ||
17850 | disabled = _props5.disabled, | ||
17851 | transitionName = _props5.transitionName, | ||
17852 | style = _props5.style, | ||
17853 | className = _props5.className, | ||
17854 | getPopupContainer = _props5.getPopupContainer, | ||
17855 | name = _props5.name, | ||
17856 | autoComplete = _props5.autoComplete; | ||
17857 | var _state = this.state, | ||
17858 | open = _state.open, | ||
17859 | value = _state.value; | ||
17860 | |||
17861 | var popupClassName = this.getPopupClassName(); | ||
17862 | return __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement( | ||
17863 | __WEBPACK_IMPORTED_MODULE_6_rc_trigger___default.a, | ||
17864 | { | ||
17865 | prefixCls: prefixCls + '-panel', | ||
17866 | popupClassName: popupClassName, | ||
17867 | popup: this.getPanelElement(), | ||
17868 | popupAlign: align, | ||
17869 | builtinPlacements: __WEBPACK_IMPORTED_MODULE_8__placements__["a" /* default */], | ||
17870 | popupPlacement: placement, | ||
17871 | action: disabled ? [] : ['click'], | ||
17872 | destroyPopupOnHide: true, | ||
17873 | getPopupContainer: getPopupContainer, | ||
17874 | popupTransitionName: transitionName, | ||
17875 | popupVisible: open, | ||
17876 | onPopupVisibleChange: this.onVisibleChange | ||
17877 | }, | ||
17878 | __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement( | ||
17879 | 'span', | ||
17880 | { className: prefixCls + ' ' + className, style: style }, | ||
17881 | __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement('input', { | ||
17882 | className: prefixCls + '-input', | ||
17883 | ref: this.saveInputRef, | ||
17884 | type: 'text', | ||
17885 | placeholder: placeholder, | ||
17886 | name: name, | ||
17887 | readOnly: true, | ||
17888 | onKeyDown: this.onKeyDown, | ||
17889 | disabled: disabled, value: value && value.format(this.getFormat()) || '', | ||
17890 | autoComplete: autoComplete | ||
17891 | }), | ||
17892 | __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement('span', { className: prefixCls + '-icon' }) | ||
17893 | ) | ||
17894 | ); | ||
17895 | } | ||
17896 | }]); | ||
17897 | |||
17898 | return Picker; | ||
17899 | }(__WEBPACK_IMPORTED_MODULE_4_react__["Component"]); | ||
17900 | |||
17901 | Picker.propTypes = { | ||
17902 | prefixCls: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17903 | clearText: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17904 | value: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.object, | ||
17905 | defaultOpenValue: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.object, | ||
17906 | disabled: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool, | ||
17907 | allowEmpty: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool, | ||
17908 | defaultValue: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.object, | ||
17909 | open: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool, | ||
17910 | defaultOpen: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool, | ||
17911 | align: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.object, | ||
17912 | placement: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.any, | ||
17913 | transitionName: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17914 | getPopupContainer: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17915 | placeholder: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17916 | format: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17917 | showHour: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool, | ||
17918 | showMinute: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool, | ||
17919 | showSecond: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool, | ||
17920 | style: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.object, | ||
17921 | className: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17922 | popupClassName: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17923 | disabledHours: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17924 | disabledMinutes: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17925 | disabledSeconds: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17926 | hideDisabledOptions: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool, | ||
17927 | onChange: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17928 | onOpen: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17929 | onClose: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17930 | addon: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func, | ||
17931 | name: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17932 | autoComplete: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string, | ||
17933 | use12Hours: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool | ||
17934 | }; | ||
17935 | Picker.defaultProps = { | ||
17936 | clearText: 'clear', | ||
17937 | prefixCls: 'rc-time-picker', | ||
17938 | defaultOpen: false, | ||
17939 | style: {}, | ||
17940 | className: '', | ||
17941 | popupClassName: '', | ||
17942 | align: {}, | ||
17943 | defaultOpenValue: __WEBPACK_IMPORTED_MODULE_9_moment___default()(), | ||
17944 | allowEmpty: true, | ||
17945 | showHour: true, | ||
17946 | showMinute: true, | ||
17947 | showSecond: true, | ||
17948 | disabledHours: noop, | ||
17949 | disabledMinutes: noop, | ||
17950 | disabledSeconds: noop, | ||
17951 | hideDisabledOptions: false, | ||
17952 | placement: 'bottomLeft', | ||
17953 | onChange: noop, | ||
17954 | onOpen: noop, | ||
17955 | onClose: noop, | ||
17956 | addon: noop, | ||
17957 | use12Hours: false | ||
17958 | }; | ||
17959 | |||
17960 | var _initialiseProps = function _initialiseProps() { | ||
17961 | var _this2 = this; | ||
17962 | |||
17963 | this.onPanelChange = function (value) { | ||
17964 | _this2.setValue(value); | ||
17965 | }; | ||
17966 | |||
17967 | this.onPanelClear = function () { | ||
17968 | _this2.setValue(null); | ||
17969 | _this2.setOpen(false); | ||
17970 | }; | ||
17971 | |||
17972 | this.onVisibleChange = function (open) { | ||
17973 | _this2.setOpen(open); | ||
17974 | }; | ||
17975 | |||
17976 | this.onEsc = function () { | ||
17977 | _this2.setOpen(false); | ||
17978 | _this2.focus(); | ||
17979 | }; | ||
17980 | |||
17981 | this.onKeyDown = function (e) { | ||
17982 | if (e.keyCode === 40) { | ||
17983 | _this2.setOpen(true); | ||
17984 | } | ||
17985 | }; | ||
17986 | }; | ||
17987 | |||
17988 | /* harmony default export */ __webpack_exports__["a"] = (Picker); | ||
17989 | |||
17990 | /***/ }), | ||
17991 | /* 158 */ | ||
17992 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
17993 | |||
17994 | "use strict"; | ||
17995 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__TimePicker__ = __webpack_require__(157); | ||
17996 | /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__TimePicker__["a"]; }); | ||
17997 | |||
17998 | |||
17999 | /***/ }), | ||
18000 | /* 159 */ | ||
18001 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
18002 | |||
18003 | "use strict"; | ||
18004 | var autoAdjustOverflow = { | ||
18005 | adjustX: 1, | ||
18006 | adjustY: 1 | ||
18007 | }; | ||
18008 | |||
18009 | var targetOffset = [0, 0]; | ||
18010 | |||
18011 | var placements = { | ||
18012 | bottomLeft: { | ||
18013 | points: ['tl', 'tl'], | ||
18014 | overflow: autoAdjustOverflow, | ||
18015 | offset: [0, -3], | ||
18016 | targetOffset: targetOffset | ||
18017 | }, | ||
18018 | bottomRight: { | ||
18019 | points: ['tr', 'tr'], | ||
18020 | overflow: autoAdjustOverflow, | ||
18021 | offset: [0, -3], | ||
18022 | targetOffset: targetOffset | ||
18023 | }, | ||
18024 | topRight: { | ||
18025 | points: ['br', 'br'], | ||
18026 | overflow: autoAdjustOverflow, | ||
18027 | offset: [0, 3], | ||
18028 | targetOffset: targetOffset | ||
18029 | }, | ||
18030 | topLeft: { | ||
18031 | points: ['bl', 'bl'], | ||
18032 | overflow: autoAdjustOverflow, | ||
18033 | offset: [0, 3], | ||
18034 | targetOffset: targetOffset | ||
18035 | } | ||
18036 | }; | ||
18037 | |||
18038 | /* harmony default export */ __webpack_exports__["a"] = (placements); | ||
18039 | |||
18040 | /***/ }), | ||
18041 | /* 160 */ | ||
18042 | /***/ (function(module, exports, __webpack_require__) { | ||
18043 | |||
18044 | module.exports = { "default": __webpack_require__(167), __esModule: true }; | ||
18045 | |||
18046 | /***/ }), | ||
18047 | /* 161 */ | ||
18048 | /***/ (function(module, exports, __webpack_require__) { | ||
18049 | |||
18050 | module.exports = { "default": __webpack_require__(168), __esModule: true }; | ||
18051 | |||
18052 | /***/ }), | ||
18053 | /* 162 */ | ||
18054 | /***/ (function(module, exports, __webpack_require__) { | ||
18055 | |||
18056 | module.exports = { "default": __webpack_require__(170), __esModule: true }; | ||
18057 | |||
18058 | /***/ }), | ||
18059 | /* 163 */ | ||
18060 | /***/ (function(module, exports, __webpack_require__) { | ||
18061 | |||
18062 | module.exports = { "default": __webpack_require__(171), __esModule: true }; | ||
18063 | |||
18064 | /***/ }), | ||
18065 | /* 164 */ | ||
18066 | /***/ (function(module, exports, __webpack_require__) { | ||
18067 | |||
18068 | module.exports = { "default": __webpack_require__(172), __esModule: true }; | ||
18069 | |||
18070 | /***/ }), | ||
18071 | /* 165 */ | ||
18072 | /***/ (function(module, exports, __webpack_require__) { | ||
18073 | |||
18074 | "use strict"; | ||
18075 | |||
18076 | |||
18077 | exports.__esModule = true; | ||
18078 | |||
18079 | exports.default = function (obj, keys) { | ||
18080 | var target = {}; | ||
18081 | |||
18082 | for (var i in obj) { | ||
18083 | if (keys.indexOf(i) >= 0) continue; | ||
18084 | if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; | ||
18085 | target[i] = obj[i]; | ||
18086 | } | ||
18087 | |||
18088 | return target; | ||
18089 | }; | ||
18090 | |||
18091 | /***/ }), | ||
18092 | /* 166 */ | ||
18093 | /***/ (function(module, exports, __webpack_require__) { | ||
18094 | |||
18095 | /** | ||
18096 | * Module dependencies. | ||
18097 | */ | ||
18098 | |||
18099 | try { | ||
18100 | var index = __webpack_require__(96); | ||
18101 | } catch (err) { | ||
18102 | var index = __webpack_require__(96); | ||
18103 | } | ||
18104 | |||
18105 | /** | ||
18106 | * Whitespace regexp. | ||
18107 | */ | ||
18108 | |||
18109 | var re = /\s+/; | ||
18110 | |||
18111 | /** | ||
18112 | * toString reference. | ||
18113 | */ | ||
18114 | |||
18115 | var toString = Object.prototype.toString; | ||
18116 | |||
18117 | /** | ||
18118 | * Wrap `el` in a `ClassList`. | ||
18119 | * | ||
18120 | * @param {Element} el | ||
18121 | * @return {ClassList} | ||
18122 | * @api public | ||
18123 | */ | ||
18124 | |||
18125 | module.exports = function(el){ | ||
18126 | return new ClassList(el); | ||
18127 | }; | ||
18128 | |||
18129 | /** | ||
18130 | * Initialize a new ClassList for `el`. | ||
18131 | * | ||
18132 | * @param {Element} el | ||
18133 | * @api private | ||
18134 | */ | ||
18135 | |||
18136 | function ClassList(el) { | ||
18137 | if (!el || !el.nodeType) { | ||
18138 | throw new Error('A DOM element reference is required'); | ||
18139 | } | ||
18140 | this.el = el; | ||
18141 | this.list = el.classList; | ||
18142 | } | ||
18143 | |||
18144 | /** | ||
18145 | * Add class `name` if not already present. | ||
18146 | * | ||
18147 | * @param {String} name | ||
18148 | * @return {ClassList} | ||
18149 | * @api public | ||
18150 | */ | ||
18151 | |||
18152 | ClassList.prototype.add = function(name){ | ||
18153 | // classList | ||
18154 | if (this.list) { | ||
18155 | this.list.add(name); | ||
18156 | return this; | ||
18157 | } | ||
18158 | |||
18159 | // fallback | ||
18160 | var arr = this.array(); | ||
18161 | var i = index(arr, name); | ||
18162 | if (!~i) arr.push(name); | ||
18163 | this.el.className = arr.join(' '); | ||
18164 | return this; | ||
18165 | }; | ||
18166 | |||
18167 | /** | ||
18168 | * Remove class `name` when present, or | ||
18169 | * pass a regular expression to remove | ||
18170 | * any which match. | ||
18171 | * | ||
18172 | * @param {String|RegExp} name | ||
18173 | * @return {ClassList} | ||
18174 | * @api public | ||
18175 | */ | ||
18176 | |||
18177 | ClassList.prototype.remove = function(name){ | ||
18178 | if ('[object RegExp]' == toString.call(name)) { | ||
18179 | return this.removeMatching(name); | ||
18180 | } | ||
18181 | |||
18182 | // classList | ||
18183 | if (this.list) { | ||
18184 | this.list.remove(name); | ||
18185 | return this; | ||
18186 | } | ||
18187 | |||
18188 | // fallback | ||
18189 | var arr = this.array(); | ||
18190 | var i = index(arr, name); | ||
18191 | if (~i) arr.splice(i, 1); | ||
18192 | this.el.className = arr.join(' '); | ||
18193 | return this; | ||
18194 | }; | ||
18195 | |||
18196 | /** | ||
18197 | * Remove all classes matching `re`. | ||
18198 | * | ||
18199 | * @param {RegExp} re | ||
18200 | * @return {ClassList} | ||
18201 | * @api private | ||
18202 | */ | ||
18203 | |||
18204 | ClassList.prototype.removeMatching = function(re){ | ||
18205 | var arr = this.array(); | ||
18206 | for (var i = 0; i < arr.length; i++) { | ||
18207 | if (re.test(arr[i])) { | ||
18208 | this.remove(arr[i]); | ||
18209 | } | ||
18210 | } | ||
18211 | return this; | ||
18212 | }; | ||
18213 | |||
18214 | /** | ||
18215 | * Toggle class `name`, can force state via `force`. | ||
18216 | * | ||
18217 | * For browsers that support classList, but do not support `force` yet, | ||
18218 | * the mistake will be detected and corrected. | ||
18219 | * | ||
18220 | * @param {String} name | ||
18221 | * @param {Boolean} force | ||
18222 | * @return {ClassList} | ||
18223 | * @api public | ||
18224 | */ | ||
18225 | |||
18226 | ClassList.prototype.toggle = function(name, force){ | ||
18227 | // classList | ||
18228 | if (this.list) { | ||
18229 | if ("undefined" !== typeof force) { | ||
18230 | if (force !== this.list.toggle(name, force)) { | ||
18231 | this.list.toggle(name); // toggle again to correct | ||
18232 | } | ||
18233 | } else { | ||
18234 | this.list.toggle(name); | ||
18235 | } | ||
18236 | return this; | ||
18237 | } | ||
18238 | |||
18239 | // fallback | ||
18240 | if ("undefined" !== typeof force) { | ||
18241 | if (!force) { | ||
18242 | this.remove(name); | ||
18243 | } else { | ||
18244 | this.add(name); | ||
18245 | } | ||
18246 | } else { | ||
18247 | if (this.has(name)) { | ||
18248 | this.remove(name); | ||
18249 | } else { | ||
18250 | this.add(name); | ||
18251 | } | ||
18252 | } | ||
18253 | |||
18254 | return this; | ||
18255 | }; | ||
18256 | |||
18257 | /** | ||
18258 | * Return an array of classes. | ||
18259 | * | ||
18260 | * @return {Array} | ||
18261 | * @api public | ||
18262 | */ | ||
18263 | |||
18264 | ClassList.prototype.array = function(){ | ||
18265 | var className = this.el.getAttribute('class') || ''; | ||
18266 | var str = className.replace(/^\s+|\s+$/g, ''); | ||
18267 | var arr = str.split(re); | ||
18268 | if ('' === arr[0]) arr.shift(); | ||
18269 | return arr; | ||
18270 | }; | ||
18271 | |||
18272 | /** | ||
18273 | * Check if class `name` is present. | ||
18274 | * | ||
18275 | * @param {String} name | ||
18276 | * @return {ClassList} | ||
18277 | * @api public | ||
18278 | */ | ||
18279 | |||
18280 | ClassList.prototype.has = | ||
18281 | ClassList.prototype.contains = function(name){ | ||
18282 | return this.list | ||
18283 | ? this.list.contains(name) | ||
18284 | : !! ~index(this.array(), name); | ||
18285 | }; | ||
18286 | |||
18287 | |||
18288 | /***/ }), | ||
18289 | /* 167 */ | ||
18290 | /***/ (function(module, exports, __webpack_require__) { | ||
18291 | |||
18292 | __webpack_require__(192); | ||
18293 | module.exports = __webpack_require__(24).Object.assign; | ||
18294 | |||
18295 | /***/ }), | ||
18296 | /* 168 */ | ||
18297 | /***/ (function(module, exports, __webpack_require__) { | ||
18298 | |||
18299 | __webpack_require__(193); | ||
18300 | var $Object = __webpack_require__(24).Object; | ||
18301 | module.exports = function create(P, D){ | ||
18302 | return $Object.create(P, D); | ||
18303 | }; | ||
18304 | |||
18305 | /***/ }), | ||
18306 | /* 169 */ | ||
18307 | /***/ (function(module, exports, __webpack_require__) { | ||
18308 | |||
18309 | __webpack_require__(194); | ||
18310 | var $Object = __webpack_require__(24).Object; | ||
18311 | module.exports = function defineProperty(it, key, desc){ | ||
18312 | return $Object.defineProperty(it, key, desc); | ||
18313 | }; | ||
18314 | |||
18315 | /***/ }), | ||
18316 | /* 170 */ | ||
18317 | /***/ (function(module, exports, __webpack_require__) { | ||
18318 | |||
18319 | __webpack_require__(195); | ||
18320 | module.exports = __webpack_require__(24).Object.setPrototypeOf; | ||
18321 | |||
18322 | /***/ }), | ||
18323 | /* 171 */ | ||
18324 | /***/ (function(module, exports, __webpack_require__) { | ||
18325 | |||
18326 | __webpack_require__(198); | ||
18327 | __webpack_require__(196); | ||
18328 | __webpack_require__(199); | ||
18329 | __webpack_require__(200); | ||
18330 | module.exports = __webpack_require__(24).Symbol; | ||
18331 | |||
18332 | /***/ }), | ||
18333 | /* 172 */ | ||
18334 | /***/ (function(module, exports, __webpack_require__) { | ||
18335 | |||
18336 | __webpack_require__(197); | ||
18337 | __webpack_require__(201); | ||
18338 | module.exports = __webpack_require__(72).f('iterator'); | ||
18339 | |||
18340 | /***/ }), | ||
18341 | /* 173 */ | ||
18342 | /***/ (function(module, exports) { | ||
18343 | |||
18344 | module.exports = function(it){ | ||
18345 | if(typeof it != 'function')throw TypeError(it + ' is not a function!'); | ||
18346 | return it; | ||
18347 | }; | ||
18348 | |||
18349 | /***/ }), | ||
18350 | /* 174 */ | ||
18351 | /***/ (function(module, exports) { | ||
18352 | |||
18353 | module.exports = function(){ /* empty */ }; | ||
18354 | |||
18355 | /***/ }), | ||
18356 | /* 175 */ | ||
18357 | /***/ (function(module, exports, __webpack_require__) { | ||
18358 | |||
18359 | // false -> Array#indexOf | ||
18360 | // true -> Array#includes | ||
18361 | var toIObject = __webpack_require__(28) | ||
18362 | , toLength = __webpack_require__(190) | ||
18363 | , toIndex = __webpack_require__(189); | ||
18364 | module.exports = function(IS_INCLUDES){ | ||
18365 | return function($this, el, fromIndex){ | ||
18366 | var O = toIObject($this) | ||
18367 | , length = toLength(O.length) | ||
18368 | , index = toIndex(fromIndex, length) | ||
18369 | , value; | ||
18370 | // Array#includes uses SameValueZero equality algorithm | ||
18371 | if(IS_INCLUDES && el != el)while(length > index){ | ||
18372 | value = O[index++]; | ||
18373 | if(value != value)return true; | ||
18374 | // Array#toIndex ignores holes, Array#includes - not | ||
18375 | } else for(;length > index; index++)if(IS_INCLUDES || index in O){ | ||
18376 | if(O[index] === el)return IS_INCLUDES || index || 0; | ||
18377 | } return !IS_INCLUDES && -1; | ||
18378 | }; | ||
18379 | }; | ||
18380 | |||
18381 | /***/ }), | ||
18382 | /* 176 */ | ||
18383 | /***/ (function(module, exports, __webpack_require__) { | ||
18384 | |||
18385 | // all enumerable object keys, includes symbols | ||
18386 | var getKeys = __webpack_require__(43) | ||
18387 | , gOPS = __webpack_require__(65) | ||
18388 | , pIE = __webpack_require__(50); | ||
18389 | module.exports = function(it){ | ||
18390 | var result = getKeys(it) | ||
18391 | , getSymbols = gOPS.f; | ||
18392 | if(getSymbols){ | ||
18393 | var symbols = getSymbols(it) | ||
18394 | , isEnum = pIE.f | ||
18395 | , i = 0 | ||
18396 | , key; | ||
18397 | while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key); | ||
18398 | } return result; | ||
18399 | }; | ||
18400 | |||
18401 | /***/ }), | ||
18402 | /* 177 */ | ||
18403 | /***/ (function(module, exports, __webpack_require__) { | ||
18404 | |||
18405 | module.exports = __webpack_require__(20).document && document.documentElement; | ||
18406 | |||
18407 | /***/ }), | ||
18408 | /* 178 */ | ||
18409 | /***/ (function(module, exports, __webpack_require__) { | ||
18410 | |||
18411 | // 7.2.2 IsArray(argument) | ||
18412 | var cof = __webpack_require__(97); | ||
18413 | module.exports = Array.isArray || function isArray(arg){ | ||
18414 | return cof(arg) == 'Array'; | ||
18415 | }; | ||
18416 | |||
18417 | /***/ }), | ||
18418 | /* 179 */ | ||
18419 | /***/ (function(module, exports, __webpack_require__) { | ||
18420 | |||
18421 | "use strict"; | ||
18422 | |||
18423 | var create = __webpack_require__(64) | ||
18424 | , descriptor = __webpack_require__(51) | ||
18425 | , setToStringTag = __webpack_require__(66) | ||
18426 | , IteratorPrototype = {}; | ||
18427 | |||
18428 | // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() | ||
18429 | __webpack_require__(34)(IteratorPrototype, __webpack_require__(35)('iterator'), function(){ return this; }); | ||
18430 | |||
18431 | module.exports = function(Constructor, NAME, next){ | ||
18432 | Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); | ||
18433 | setToStringTag(Constructor, NAME + ' Iterator'); | ||
18434 | }; | ||
18435 | |||
18436 | /***/ }), | ||
18437 | /* 180 */ | ||
18438 | /***/ (function(module, exports) { | ||
18439 | |||
18440 | module.exports = function(done, value){ | ||
18441 | return {value: value, done: !!done}; | ||
18442 | }; | ||
18443 | |||
18444 | /***/ }), | ||
18445 | /* 181 */ | ||
18446 | /***/ (function(module, exports, __webpack_require__) { | ||
18447 | |||
18448 | var getKeys = __webpack_require__(43) | ||
18449 | , toIObject = __webpack_require__(28); | ||
18450 | module.exports = function(object, el){ | ||
18451 | var O = toIObject(object) | ||
18452 | , keys = getKeys(O) | ||
18453 | , length = keys.length | ||
18454 | , index = 0 | ||
18455 | , key; | ||
18456 | while(length > index)if(O[key = keys[index++]] === el)return key; | ||
18457 | }; | ||
18458 | |||
18459 | /***/ }), | ||
18460 | /* 182 */ | ||
18461 | /***/ (function(module, exports, __webpack_require__) { | ||
18462 | |||
18463 | var META = __webpack_require__(52)('meta') | ||
18464 | , isObject = __webpack_require__(42) | ||
18465 | , has = __webpack_require__(26) | ||
18466 | , setDesc = __webpack_require__(27).f | ||
18467 | , id = 0; | ||
18468 | var isExtensible = Object.isExtensible || function(){ | ||
18469 | return true; | ||
18470 | }; | ||
18471 | var FREEZE = !__webpack_require__(41)(function(){ | ||
18472 | return isExtensible(Object.preventExtensions({})); | ||
18473 | }); | ||
18474 | var setMeta = function(it){ | ||
18475 | setDesc(it, META, {value: { | ||
18476 | i: 'O' + ++id, // object ID | ||
18477 | w: {} // weak collections IDs | ||
18478 | }}); | ||
18479 | }; | ||
18480 | var fastKey = function(it, create){ | ||
18481 | // return primitive with prefix | ||
18482 | if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; | ||
18483 | if(!has(it, META)){ | ||
18484 | // can't set metadata to uncaught frozen object | ||
18485 | if(!isExtensible(it))return 'F'; | ||
18486 | // not necessary to add metadata | ||
18487 | if(!create)return 'E'; | ||
18488 | // add missing metadata | ||
18489 | setMeta(it); | ||
18490 | // return object ID | ||
18491 | } return it[META].i; | ||
18492 | }; | ||
18493 | var getWeak = function(it, create){ | ||
18494 | if(!has(it, META)){ | ||
18495 | // can't set metadata to uncaught frozen object | ||
18496 | if(!isExtensible(it))return true; | ||
18497 | // not necessary to add metadata | ||
18498 | if(!create)return false; | ||
18499 | // add missing metadata | ||
18500 | setMeta(it); | ||
18501 | // return hash weak collections IDs | ||
18502 | } return it[META].w; | ||
18503 | }; | ||
18504 | // add metadata on freeze-family methods calling | ||
18505 | var onFreeze = function(it){ | ||
18506 | if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it); | ||
18507 | return it; | ||
18508 | }; | ||
18509 | var meta = module.exports = { | ||
18510 | KEY: META, | ||
18511 | NEED: false, | ||
18512 | fastKey: fastKey, | ||
18513 | getWeak: getWeak, | ||
18514 | onFreeze: onFreeze | ||
18515 | }; | ||
18516 | |||
18517 | /***/ }), | ||
18518 | /* 183 */ | ||
18519 | /***/ (function(module, exports, __webpack_require__) { | ||
18520 | |||
18521 | "use strict"; | ||
18522 | |||
18523 | // 19.1.2.1 Object.assign(target, source, ...) | ||
18524 | var getKeys = __webpack_require__(43) | ||
18525 | , gOPS = __webpack_require__(65) | ||
18526 | , pIE = __webpack_require__(50) | ||
18527 | , toObject = __webpack_require__(107) | ||
18528 | , IObject = __webpack_require__(101) | ||
18529 | , $assign = Object.assign; | ||
18530 | |||
18531 | // should work with symbols and should have deterministic property order (V8 bug) | ||
18532 | module.exports = !$assign || __webpack_require__(41)(function(){ | ||
18533 | var A = {} | ||
18534 | , B = {} | ||
18535 | , S = Symbol() | ||
18536 | , K = 'abcdefghijklmnopqrst'; | ||
18537 | A[S] = 7; | ||
18538 | K.split('').forEach(function(k){ B[k] = k; }); | ||
18539 | return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; | ||
18540 | }) ? function assign(target, source){ // eslint-disable-line no-unused-vars | ||
18541 | var T = toObject(target) | ||
18542 | , aLen = arguments.length | ||
18543 | , index = 1 | ||
18544 | , getSymbols = gOPS.f | ||
18545 | , isEnum = pIE.f; | ||
18546 | while(aLen > index){ | ||
18547 | var S = IObject(arguments[index++]) | ||
18548 | , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) | ||
18549 | , length = keys.length | ||
18550 | , j = 0 | ||
18551 | , key; | ||
18552 | while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; | ||
18553 | } return T; | ||
18554 | } : $assign; | ||
18555 | |||
18556 | /***/ }), | ||
18557 | /* 184 */ | ||
18558 | /***/ (function(module, exports, __webpack_require__) { | ||
18559 | |||
18560 | var dP = __webpack_require__(27) | ||
18561 | , anObject = __webpack_require__(40) | ||
18562 | , getKeys = __webpack_require__(43); | ||
18563 | |||
18564 | module.exports = __webpack_require__(25) ? Object.defineProperties : function defineProperties(O, Properties){ | ||
18565 | anObject(O); | ||
18566 | var keys = getKeys(Properties) | ||
18567 | , length = keys.length | ||
18568 | , i = 0 | ||
18569 | , P; | ||
18570 | while(length > i)dP.f(O, P = keys[i++], Properties[P]); | ||
18571 | return O; | ||
18572 | }; | ||
18573 | |||
18574 | /***/ }), | ||
18575 | /* 185 */ | ||
18576 | /***/ (function(module, exports, __webpack_require__) { | ||
18577 | |||
18578 | // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window | ||
18579 | var toIObject = __webpack_require__(28) | ||
18580 | , gOPN = __webpack_require__(104).f | ||
18581 | , toString = {}.toString; | ||
18582 | |||
18583 | var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames | ||
18584 | ? Object.getOwnPropertyNames(window) : []; | ||
18585 | |||
18586 | var getWindowNames = function(it){ | ||
18587 | try { | ||
18588 | return gOPN(it); | ||
18589 | } catch(e){ | ||
18590 | return windowNames.slice(); | ||
18591 | } | ||
18592 | }; | ||
18593 | |||
18594 | module.exports.f = function getOwnPropertyNames(it){ | ||
18595 | return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); | ||
18596 | }; | ||
18597 | |||
18598 | |||
18599 | /***/ }), | ||
18600 | /* 186 */ | ||
18601 | /***/ (function(module, exports, __webpack_require__) { | ||
18602 | |||
18603 | // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) | ||
18604 | var has = __webpack_require__(26) | ||
18605 | , toObject = __webpack_require__(107) | ||
18606 | , IE_PROTO = __webpack_require__(67)('IE_PROTO') | ||
18607 | , ObjectProto = Object.prototype; | ||
18608 | |||
18609 | module.exports = Object.getPrototypeOf || function(O){ | ||
18610 | O = toObject(O); | ||
18611 | if(has(O, IE_PROTO))return O[IE_PROTO]; | ||
18612 | if(typeof O.constructor == 'function' && O instanceof O.constructor){ | ||
18613 | return O.constructor.prototype; | ||
18614 | } return O instanceof Object ? ObjectProto : null; | ||
18615 | }; | ||
18616 | |||
18617 | /***/ }), | ||
18618 | /* 187 */ | ||
18619 | /***/ (function(module, exports, __webpack_require__) { | ||
18620 | |||
18621 | // Works with __proto__ only. Old v8 can't work with null proto objects. | ||
18622 | /* eslint-disable no-proto */ | ||
18623 | var isObject = __webpack_require__(42) | ||
18624 | , anObject = __webpack_require__(40); | ||
18625 | var check = function(O, proto){ | ||
18626 | anObject(O); | ||
18627 | if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!"); | ||
18628 | }; | ||
18629 | module.exports = { | ||
18630 | set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line | ||
18631 | function(test, buggy, set){ | ||
18632 | try { | ||
18633 | set = __webpack_require__(98)(Function.call, __webpack_require__(103).f(Object.prototype, '__proto__').set, 2); | ||
18634 | set(test, []); | ||
18635 | buggy = !(test instanceof Array); | ||
18636 | } catch(e){ buggy = true; } | ||
18637 | return function setPrototypeOf(O, proto){ | ||
18638 | check(O, proto); | ||
18639 | if(buggy)O.__proto__ = proto; | ||
18640 | else set(O, proto); | ||
18641 | return O; | ||
18642 | }; | ||
18643 | }({}, false) : undefined), | ||
18644 | check: check | ||
18645 | }; | ||
18646 | |||
18647 | /***/ }), | ||
18648 | /* 188 */ | ||
18649 | /***/ (function(module, exports, __webpack_require__) { | ||
18650 | |||
18651 | var toInteger = __webpack_require__(69) | ||
18652 | , defined = __webpack_require__(60); | ||
18653 | // true -> String#at | ||
18654 | // false -> String#codePointAt | ||
18655 | module.exports = function(TO_STRING){ | ||
18656 | return function(that, pos){ | ||
18657 | var s = String(defined(that)) | ||
18658 | , i = toInteger(pos) | ||
18659 | , l = s.length | ||
18660 | , a, b; | ||
18661 | if(i < 0 || i >= l)return TO_STRING ? '' : undefined; | ||
18662 | a = s.charCodeAt(i); | ||
18663 | return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff | ||
18664 | ? TO_STRING ? s.charAt(i) : a | ||
18665 | : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; | ||
18666 | }; | ||
18667 | }; | ||
18668 | |||
18669 | /***/ }), | ||
18670 | /* 189 */ | ||
18671 | /***/ (function(module, exports, __webpack_require__) { | ||
18672 | |||
18673 | var toInteger = __webpack_require__(69) | ||
18674 | , max = Math.max | ||
18675 | , min = Math.min; | ||
18676 | module.exports = function(index, length){ | ||
18677 | index = toInteger(index); | ||
18678 | return index < 0 ? max(index + length, 0) : min(index, length); | ||
18679 | }; | ||
18680 | |||
18681 | /***/ }), | ||
18682 | /* 190 */ | ||
18683 | /***/ (function(module, exports, __webpack_require__) { | ||
18684 | |||
18685 | // 7.1.15 ToLength | ||
18686 | var toInteger = __webpack_require__(69) | ||
18687 | , min = Math.min; | ||
18688 | module.exports = function(it){ | ||
18689 | return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 | ||
18690 | }; | ||
18691 | |||
18692 | /***/ }), | ||
18693 | /* 191 */ | ||
18694 | /***/ (function(module, exports, __webpack_require__) { | ||
18695 | |||
18696 | "use strict"; | ||
18697 | |||
18698 | var addToUnscopables = __webpack_require__(174) | ||
18699 | , step = __webpack_require__(180) | ||
18700 | , Iterators = __webpack_require__(62) | ||
18701 | , toIObject = __webpack_require__(28); | ||
18702 | |||
18703 | // 22.1.3.4 Array.prototype.entries() | ||
18704 | // 22.1.3.13 Array.prototype.keys() | ||
18705 | // 22.1.3.29 Array.prototype.values() | ||
18706 | // 22.1.3.30 Array.prototype[@@iterator]() | ||
18707 | module.exports = __webpack_require__(102)(Array, 'Array', function(iterated, kind){ | ||
18708 | this._t = toIObject(iterated); // target | ||
18709 | this._i = 0; // next index | ||
18710 | this._k = kind; // kind | ||
18711 | // 22.1.5.2.1 %ArrayIteratorPrototype%.next() | ||
18712 | }, function(){ | ||
18713 | var O = this._t | ||
18714 | , kind = this._k | ||
18715 | , index = this._i++; | ||
18716 | if(!O || index >= O.length){ | ||
18717 | this._t = undefined; | ||
18718 | return step(1); | ||
18719 | } | ||
18720 | if(kind == 'keys' )return step(0, index); | ||
18721 | if(kind == 'values')return step(0, O[index]); | ||
18722 | return step(0, [index, O[index]]); | ||
18723 | }, 'values'); | ||
18724 | |||
18725 | // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) | ||
18726 | Iterators.Arguments = Iterators.Array; | ||
18727 | |||
18728 | addToUnscopables('keys'); | ||
18729 | addToUnscopables('values'); | ||
18730 | addToUnscopables('entries'); | ||
18731 | |||
18732 | /***/ }), | ||
18733 | /* 192 */ | ||
18734 | /***/ (function(module, exports, __webpack_require__) { | ||
18735 | |||
18736 | // 19.1.3.1 Object.assign(target, source) | ||
18737 | var $export = __webpack_require__(33); | ||
18738 | |||
18739 | $export($export.S + $export.F, 'Object', {assign: __webpack_require__(183)}); | ||
18740 | |||
18741 | /***/ }), | ||
18742 | /* 193 */ | ||
18743 | /***/ (function(module, exports, __webpack_require__) { | ||
18744 | |||
18745 | var $export = __webpack_require__(33) | ||
18746 | // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) | ||
18747 | $export($export.S, 'Object', {create: __webpack_require__(64)}); | ||
18748 | |||
18749 | /***/ }), | ||
18750 | /* 194 */ | ||
18751 | /***/ (function(module, exports, __webpack_require__) { | ||
18752 | |||
18753 | var $export = __webpack_require__(33); | ||
18754 | // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) | ||
18755 | $export($export.S + $export.F * !__webpack_require__(25), 'Object', {defineProperty: __webpack_require__(27).f}); | ||
18756 | |||
18757 | /***/ }), | ||
18758 | /* 195 */ | ||
18759 | /***/ (function(module, exports, __webpack_require__) { | ||
18760 | |||
18761 | // 19.1.3.19 Object.setPrototypeOf(O, proto) | ||
18762 | var $export = __webpack_require__(33); | ||
18763 | $export($export.S, 'Object', {setPrototypeOf: __webpack_require__(187).set}); | ||
18764 | |||
18765 | /***/ }), | ||
18766 | /* 196 */ | ||
18767 | /***/ (function(module, exports) { | ||
18768 | |||
18769 | |||
18770 | |||
18771 | /***/ }), | ||
18772 | /* 197 */ | ||
18773 | /***/ (function(module, exports, __webpack_require__) { | ||
18774 | |||
18775 | "use strict"; | ||
18776 | |||
18777 | var $at = __webpack_require__(188)(true); | ||
18778 | |||
18779 | // 21.1.3.27 String.prototype[@@iterator]() | ||
18780 | __webpack_require__(102)(String, 'String', function(iterated){ | ||
18781 | this._t = String(iterated); // target | ||
18782 | this._i = 0; // next index | ||
18783 | // 21.1.5.2.1 %StringIteratorPrototype%.next() | ||
18784 | }, function(){ | ||
18785 | var O = this._t | ||
18786 | , index = this._i | ||
18787 | , point; | ||
18788 | if(index >= O.length)return {value: undefined, done: true}; | ||
18789 | point = $at(O, index); | ||
18790 | this._i += point.length; | ||
18791 | return {value: point, done: false}; | ||
18792 | }); | ||
18793 | |||
18794 | /***/ }), | ||
18795 | /* 198 */ | ||
18796 | /***/ (function(module, exports, __webpack_require__) { | ||
18797 | |||
18798 | "use strict"; | ||
18799 | |||
18800 | // ECMAScript 6 symbols shim | ||
18801 | var global = __webpack_require__(20) | ||
18802 | , has = __webpack_require__(26) | ||
18803 | , DESCRIPTORS = __webpack_require__(25) | ||
18804 | , $export = __webpack_require__(33) | ||
18805 | , redefine = __webpack_require__(106) | ||
18806 | , META = __webpack_require__(182).KEY | ||
18807 | , $fails = __webpack_require__(41) | ||
18808 | , shared = __webpack_require__(68) | ||
18809 | , setToStringTag = __webpack_require__(66) | ||
18810 | , uid = __webpack_require__(52) | ||
18811 | , wks = __webpack_require__(35) | ||
18812 | , wksExt = __webpack_require__(72) | ||
18813 | , wksDefine = __webpack_require__(71) | ||
18814 | , keyOf = __webpack_require__(181) | ||
18815 | , enumKeys = __webpack_require__(176) | ||
18816 | , isArray = __webpack_require__(178) | ||
18817 | , anObject = __webpack_require__(40) | ||
18818 | , toIObject = __webpack_require__(28) | ||
18819 | , toPrimitive = __webpack_require__(70) | ||
18820 | , createDesc = __webpack_require__(51) | ||
18821 | , _create = __webpack_require__(64) | ||
18822 | , gOPNExt = __webpack_require__(185) | ||
18823 | , $GOPD = __webpack_require__(103) | ||
18824 | , $DP = __webpack_require__(27) | ||
18825 | , $keys = __webpack_require__(43) | ||
18826 | , gOPD = $GOPD.f | ||
18827 | , dP = $DP.f | ||
18828 | , gOPN = gOPNExt.f | ||
18829 | , $Symbol = global.Symbol | ||
18830 | , $JSON = global.JSON | ||
18831 | , _stringify = $JSON && $JSON.stringify | ||
18832 | , PROTOTYPE = 'prototype' | ||
18833 | , HIDDEN = wks('_hidden') | ||
18834 | , TO_PRIMITIVE = wks('toPrimitive') | ||
18835 | , isEnum = {}.propertyIsEnumerable | ||
18836 | , SymbolRegistry = shared('symbol-registry') | ||
18837 | , AllSymbols = shared('symbols') | ||
18838 | , OPSymbols = shared('op-symbols') | ||
18839 | , ObjectProto = Object[PROTOTYPE] | ||
18840 | , USE_NATIVE = typeof $Symbol == 'function' | ||
18841 | , QObject = global.QObject; | ||
18842 | // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 | ||
18843 | var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; | ||
18844 | |||
18845 | // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 | ||
18846 | var setSymbolDesc = DESCRIPTORS && $fails(function(){ | ||
18847 | return _create(dP({}, 'a', { | ||
18848 | get: function(){ return dP(this, 'a', {value: 7}).a; } | ||
18849 | })).a != 7; | ||
18850 | }) ? function(it, key, D){ | ||
18851 | var protoDesc = gOPD(ObjectProto, key); | ||
18852 | if(protoDesc)delete ObjectProto[key]; | ||
18853 | dP(it, key, D); | ||
18854 | if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc); | ||
18855 | } : dP; | ||
18856 | |||
18857 | var wrap = function(tag){ | ||
18858 | var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); | ||
18859 | sym._k = tag; | ||
18860 | return sym; | ||
18861 | }; | ||
18862 | |||
18863 | var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){ | ||
18864 | return typeof it == 'symbol'; | ||
18865 | } : function(it){ | ||
18866 | return it instanceof $Symbol; | ||
18867 | }; | ||
18868 | |||
18869 | var $defineProperty = function defineProperty(it, key, D){ | ||
18870 | if(it === ObjectProto)$defineProperty(OPSymbols, key, D); | ||
18871 | anObject(it); | ||
18872 | key = toPrimitive(key, true); | ||
18873 | anObject(D); | ||
18874 | if(has(AllSymbols, key)){ | ||
18875 | if(!D.enumerable){ | ||
18876 | if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {})); | ||
18877 | it[HIDDEN][key] = true; | ||
18878 | } else { | ||
18879 | if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; | ||
18880 | D = _create(D, {enumerable: createDesc(0, false)}); | ||
18881 | } return setSymbolDesc(it, key, D); | ||
18882 | } return dP(it, key, D); | ||
18883 | }; | ||
18884 | var $defineProperties = function defineProperties(it, P){ | ||
18885 | anObject(it); | ||
18886 | var keys = enumKeys(P = toIObject(P)) | ||
18887 | , i = 0 | ||
18888 | , l = keys.length | ||
18889 | , key; | ||
18890 | while(l > i)$defineProperty(it, key = keys[i++], P[key]); | ||
18891 | return it; | ||
18892 | }; | ||
18893 | var $create = function create(it, P){ | ||
18894 | return P === undefined ? _create(it) : $defineProperties(_create(it), P); | ||
18895 | }; | ||
18896 | var $propertyIsEnumerable = function propertyIsEnumerable(key){ | ||
18897 | var E = isEnum.call(this, key = toPrimitive(key, true)); | ||
18898 | if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false; | ||
18899 | return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; | ||
18900 | }; | ||
18901 | var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ | ||
18902 | it = toIObject(it); | ||
18903 | key = toPrimitive(key, true); | ||
18904 | if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return; | ||
18905 | var D = gOPD(it, key); | ||
18906 | if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; | ||
18907 | return D; | ||
18908 | }; | ||
18909 | var $getOwnPropertyNames = function getOwnPropertyNames(it){ | ||
18910 | var names = gOPN(toIObject(it)) | ||
18911 | , result = [] | ||
18912 | , i = 0 | ||
18913 | , key; | ||
18914 | while(names.length > i){ | ||
18915 | if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key); | ||
18916 | } return result; | ||
18917 | }; | ||
18918 | var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ | ||
18919 | var IS_OP = it === ObjectProto | ||
18920 | , names = gOPN(IS_OP ? OPSymbols : toIObject(it)) | ||
18921 | , result = [] | ||
18922 | , i = 0 | ||
18923 | , key; | ||
18924 | while(names.length > i){ | ||
18925 | if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]); | ||
18926 | } return result; | ||
18927 | }; | ||
18928 | |||
18929 | // 19.4.1.1 Symbol([description]) | ||
18930 | if(!USE_NATIVE){ | ||
18931 | $Symbol = function Symbol(){ | ||
18932 | if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!'); | ||
18933 | var tag = uid(arguments.length > 0 ? arguments[0] : undefined); | ||
18934 | var $set = function(value){ | ||
18935 | if(this === ObjectProto)$set.call(OPSymbols, value); | ||
18936 | if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; | ||
18937 | setSymbolDesc(this, tag, createDesc(1, value)); | ||
18938 | }; | ||
18939 | if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set}); | ||
18940 | return wrap(tag); | ||
18941 | }; | ||
18942 | redefine($Symbol[PROTOTYPE], 'toString', function toString(){ | ||
18943 | return this._k; | ||
18944 | }); | ||
18945 | |||
18946 | $GOPD.f = $getOwnPropertyDescriptor; | ||
18947 | $DP.f = $defineProperty; | ||
18948 | __webpack_require__(104).f = gOPNExt.f = $getOwnPropertyNames; | ||
18949 | __webpack_require__(50).f = $propertyIsEnumerable; | ||
18950 | __webpack_require__(65).f = $getOwnPropertySymbols; | ||
18951 | |||
18952 | if(DESCRIPTORS && !__webpack_require__(63)){ | ||
18953 | redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); | ||
18954 | } | ||
18955 | |||
18956 | wksExt.f = function(name){ | ||
18957 | return wrap(wks(name)); | ||
18958 | } | ||
18959 | } | ||
18960 | |||
18961 | $export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol}); | ||
18962 | |||
18963 | for(var symbols = ( | ||
18964 | // 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 | ||
18965 | 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' | ||
18966 | ).split(','), i = 0; symbols.length > i; )wks(symbols[i++]); | ||
18967 | |||
18968 | for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]); | ||
18969 | |||
18970 | $export($export.S + $export.F * !USE_NATIVE, 'Symbol', { | ||
18971 | // 19.4.2.1 Symbol.for(key) | ||
18972 | 'for': function(key){ | ||
18973 | return has(SymbolRegistry, key += '') | ||
18974 | ? SymbolRegistry[key] | ||
18975 | : SymbolRegistry[key] = $Symbol(key); | ||
18976 | }, | ||
18977 | // 19.4.2.5 Symbol.keyFor(sym) | ||
18978 | keyFor: function keyFor(key){ | ||
18979 | if(isSymbol(key))return keyOf(SymbolRegistry, key); | ||
18980 | throw TypeError(key + ' is not a symbol!'); | ||
18981 | }, | ||
18982 | useSetter: function(){ setter = true; }, | ||
18983 | useSimple: function(){ setter = false; } | ||
18984 | }); | ||
18985 | |||
18986 | $export($export.S + $export.F * !USE_NATIVE, 'Object', { | ||
18987 | // 19.1.2.2 Object.create(O [, Properties]) | ||
18988 | create: $create, | ||
18989 | // 19.1.2.4 Object.defineProperty(O, P, Attributes) | ||
18990 | defineProperty: $defineProperty, | ||
18991 | // 19.1.2.3 Object.defineProperties(O, Properties) | ||
18992 | defineProperties: $defineProperties, | ||
18993 | // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) | ||
18994 | getOwnPropertyDescriptor: $getOwnPropertyDescriptor, | ||
18995 | // 19.1.2.7 Object.getOwnPropertyNames(O) | ||
18996 | getOwnPropertyNames: $getOwnPropertyNames, | ||
18997 | // 19.1.2.8 Object.getOwnPropertySymbols(O) | ||
18998 | getOwnPropertySymbols: $getOwnPropertySymbols | ||
18999 | }); | ||
19000 | |||
19001 | // 24.3.2 JSON.stringify(value [, replacer [, space]]) | ||
19002 | $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){ | ||
19003 | var S = $Symbol(); | ||
19004 | // MS Edge converts symbol values to JSON as {} | ||
19005 | // WebKit converts symbol values to JSON as null | ||
19006 | // V8 throws on boxed symbols | ||
19007 | return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; | ||
19008 | })), 'JSON', { | ||
19009 | stringify: function stringify(it){ | ||
19010 | if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined | ||
19011 | var args = [it] | ||
19012 | , i = 1 | ||
19013 | , replacer, $replacer; | ||
19014 | while(arguments.length > i)args.push(arguments[i++]); | ||
19015 | replacer = args[1]; | ||
19016 | if(typeof replacer == 'function')$replacer = replacer; | ||
19017 | if($replacer || !isArray(replacer))replacer = function(key, value){ | ||
19018 | if($replacer)value = $replacer.call(this, key, value); | ||
19019 | if(!isSymbol(value))return value; | ||
19020 | }; | ||
19021 | args[1] = replacer; | ||
19022 | return _stringify.apply($JSON, args); | ||
19023 | } | ||
19024 | }); | ||
19025 | |||
19026 | // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) | ||
19027 | $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(34)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); | ||
19028 | // 19.4.3.5 Symbol.prototype[@@toStringTag] | ||
19029 | setToStringTag($Symbol, 'Symbol'); | ||
19030 | // 20.2.1.9 Math[@@toStringTag] | ||
19031 | setToStringTag(Math, 'Math', true); | ||
19032 | // 24.3.3 JSON[@@toStringTag] | ||
19033 | setToStringTag(global.JSON, 'JSON', true); | ||
19034 | |||
19035 | /***/ }), | ||
19036 | /* 199 */ | ||
19037 | /***/ (function(module, exports, __webpack_require__) { | ||
19038 | |||
19039 | __webpack_require__(71)('asyncIterator'); | ||
19040 | |||
19041 | /***/ }), | ||
19042 | /* 200 */ | ||
19043 | /***/ (function(module, exports, __webpack_require__) { | ||
19044 | |||
19045 | __webpack_require__(71)('observable'); | ||
19046 | |||
19047 | /***/ }), | ||
19048 | /* 201 */ | ||
19049 | /***/ (function(module, exports, __webpack_require__) { | ||
19050 | |||
19051 | __webpack_require__(191); | ||
19052 | var global = __webpack_require__(20) | ||
19053 | , hide = __webpack_require__(34) | ||
19054 | , Iterators = __webpack_require__(62) | ||
19055 | , TO_STRING_TAG = __webpack_require__(35)('toStringTag'); | ||
19056 | |||
19057 | for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ | ||
19058 | var NAME = collections[i] | ||
19059 | , Collection = global[NAME] | ||
19060 | , proto = Collection && Collection.prototype; | ||
19061 | if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); | ||
19062 | Iterators[NAME] = Iterators.Array; | ||
19063 | } | ||
19064 | |||
19065 | /***/ }), | ||
19066 | /* 202 */ | ||
19067 | /***/ (function(module, exports, __webpack_require__) { | ||
19068 | |||
19069 | "use strict"; | ||
19070 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
19071 | * Copyright 2013-present, Facebook, Inc. | ||
19072 | * All rights reserved. | ||
19073 | * | ||
19074 | * This source code is licensed under the BSD-style license found in the | ||
19075 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19076 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19077 | * | ||
19078 | */ | ||
19079 | |||
19080 | |||
19081 | |||
19082 | var _assign = __webpack_require__(4); | ||
19083 | |||
19084 | var emptyObject = __webpack_require__(36); | ||
19085 | var _invariant = __webpack_require__(1); | ||
19086 | |||
19087 | if (process.env.NODE_ENV !== 'production') { | ||
19088 | var warning = __webpack_require__(2); | ||
19089 | } | ||
19090 | |||
19091 | var MIXINS_KEY = 'mixins'; | ||
19092 | |||
19093 | // Helper function to allow the creation of anonymous functions which do not | ||
19094 | // have .name set to the name of the variable being assigned to. | ||
19095 | function identity(fn) { | ||
19096 | return fn; | ||
19097 | } | ||
19098 | |||
19099 | var ReactPropTypeLocationNames; | ||
19100 | if (process.env.NODE_ENV !== 'production') { | ||
19101 | ReactPropTypeLocationNames = { | ||
19102 | prop: 'prop', | ||
19103 | context: 'context', | ||
19104 | childContext: 'child context', | ||
19105 | }; | ||
19106 | } else { | ||
19107 | ReactPropTypeLocationNames = {}; | ||
19108 | } | ||
19109 | |||
19110 | function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) { | ||
19111 | /** | ||
19112 | * Policies that describe methods in `ReactClassInterface`. | ||
19113 | */ | ||
19114 | |||
19115 | |||
19116 | var injectedMixins = []; | ||
19117 | |||
19118 | /** | ||
19119 | * Composite components are higher-level components that compose other composite | ||
19120 | * or host components. | ||
19121 | * | ||
19122 | * To create a new type of `ReactClass`, pass a specification of | ||
19123 | * your new class to `React.createClass`. The only requirement of your class | ||
19124 | * specification is that you implement a `render` method. | ||
19125 | * | ||
19126 | * var MyComponent = React.createClass({ | ||
19127 | * render: function() { | ||
19128 | * return <div>Hello World</div>; | ||
19129 | * } | ||
19130 | * }); | ||
19131 | * | ||
19132 | * The class specification supports a specific protocol of methods that have | ||
19133 | * special meaning (e.g. `render`). See `ReactClassInterface` for | ||
19134 | * more the comprehensive protocol. Any other properties and methods in the | ||
19135 | * class specification will be available on the prototype. | ||
19136 | * | ||
19137 | * @interface ReactClassInterface | ||
19138 | * @internal | ||
19139 | */ | ||
19140 | var ReactClassInterface = { | ||
19141 | |||
19142 | /** | ||
19143 | * An array of Mixin objects to include when defining your component. | ||
19144 | * | ||
19145 | * @type {array} | ||
19146 | * @optional | ||
19147 | */ | ||
19148 | mixins: 'DEFINE_MANY', | ||
19149 | |||
19150 | /** | ||
19151 | * An object containing properties and methods that should be defined on | ||
19152 | * the component's constructor instead of its prototype (static methods). | ||
19153 | * | ||
19154 | * @type {object} | ||
19155 | * @optional | ||
19156 | */ | ||
19157 | statics: 'DEFINE_MANY', | ||
19158 | |||
19159 | /** | ||
19160 | * Definition of prop types for this component. | ||
19161 | * | ||
19162 | * @type {object} | ||
19163 | * @optional | ||
19164 | */ | ||
19165 | propTypes: 'DEFINE_MANY', | ||
19166 | |||
19167 | /** | ||
19168 | * Definition of context types for this component. | ||
19169 | * | ||
19170 | * @type {object} | ||
19171 | * @optional | ||
19172 | */ | ||
19173 | contextTypes: 'DEFINE_MANY', | ||
19174 | |||
19175 | /** | ||
19176 | * Definition of context types this component sets for its children. | ||
19177 | * | ||
19178 | * @type {object} | ||
19179 | * @optional | ||
19180 | */ | ||
19181 | childContextTypes: 'DEFINE_MANY', | ||
19182 | |||
19183 | // ==== Definition methods ==== | ||
19184 | |||
19185 | /** | ||
19186 | * Invoked when the component is mounted. Values in the mapping will be set on | ||
19187 | * `this.props` if that prop is not specified (i.e. using an `in` check). | ||
19188 | * | ||
19189 | * This method is invoked before `getInitialState` and therefore cannot rely | ||
19190 | * on `this.state` or use `this.setState`. | ||
19191 | * | ||
19192 | * @return {object} | ||
19193 | * @optional | ||
19194 | */ | ||
19195 | getDefaultProps: 'DEFINE_MANY_MERGED', | ||
19196 | |||
19197 | /** | ||
19198 | * Invoked once before the component is mounted. The return value will be used | ||
19199 | * as the initial value of `this.state`. | ||
19200 | * | ||
19201 | * getInitialState: function() { | ||
19202 | * return { | ||
19203 | * isOn: false, | ||
19204 | * fooBaz: new BazFoo() | ||
19205 | * } | ||
19206 | * } | ||
19207 | * | ||
19208 | * @return {object} | ||
19209 | * @optional | ||
19210 | */ | ||
19211 | getInitialState: 'DEFINE_MANY_MERGED', | ||
19212 | |||
19213 | /** | ||
19214 | * @return {object} | ||
19215 | * @optional | ||
19216 | */ | ||
19217 | getChildContext: 'DEFINE_MANY_MERGED', | ||
19218 | |||
19219 | /** | ||
19220 | * Uses props from `this.props` and state from `this.state` to render the | ||
19221 | * structure of the component. | ||
19222 | * | ||
19223 | * No guarantees are made about when or how often this method is invoked, so | ||
19224 | * it must not have side effects. | ||
19225 | * | ||
19226 | * render: function() { | ||
19227 | * var name = this.props.name; | ||
19228 | * return <div>Hello, {name}!</div>; | ||
19229 | * } | ||
19230 | * | ||
19231 | * @return {ReactComponent} | ||
19232 | * @nosideeffects | ||
19233 | * @required | ||
19234 | */ | ||
19235 | render: 'DEFINE_ONCE', | ||
19236 | |||
19237 | // ==== Delegate methods ==== | ||
19238 | |||
19239 | /** | ||
19240 | * Invoked when the component is initially created and about to be mounted. | ||
19241 | * This may have side effects, but any external subscriptions or data created | ||
19242 | * by this method must be cleaned up in `componentWillUnmount`. | ||
19243 | * | ||
19244 | * @optional | ||
19245 | */ | ||
19246 | componentWillMount: 'DEFINE_MANY', | ||
19247 | |||
19248 | /** | ||
19249 | * Invoked when the component has been mounted and has a DOM representation. | ||
19250 | * However, there is no guarantee that the DOM node is in the document. | ||
19251 | * | ||
19252 | * Use this as an opportunity to operate on the DOM when the component has | ||
19253 | * been mounted (initialized and rendered) for the first time. | ||
19254 | * | ||
19255 | * @param {DOMElement} rootNode DOM element representing the component. | ||
19256 | * @optional | ||
19257 | */ | ||
19258 | componentDidMount: 'DEFINE_MANY', | ||
19259 | |||
19260 | /** | ||
19261 | * Invoked before the component receives new props. | ||
19262 | * | ||
19263 | * Use this as an opportunity to react to a prop transition by updating the | ||
19264 | * state using `this.setState`. Current props are accessed via `this.props`. | ||
19265 | * | ||
19266 | * componentWillReceiveProps: function(nextProps, nextContext) { | ||
19267 | * this.setState({ | ||
19268 | * likesIncreasing: nextProps.likeCount > this.props.likeCount | ||
19269 | * }); | ||
19270 | * } | ||
19271 | * | ||
19272 | * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop | ||
19273 | * transition may cause a state change, but the opposite is not true. If you | ||
19274 | * need it, you are probably looking for `componentWillUpdate`. | ||
19275 | * | ||
19276 | * @param {object} nextProps | ||
19277 | * @optional | ||
19278 | */ | ||
19279 | componentWillReceiveProps: 'DEFINE_MANY', | ||
19280 | |||
19281 | /** | ||
19282 | * Invoked while deciding if the component should be updated as a result of | ||
19283 | * receiving new props, state and/or context. | ||
19284 | * | ||
19285 | * Use this as an opportunity to `return false` when you're certain that the | ||
19286 | * transition to the new props/state/context will not require a component | ||
19287 | * update. | ||
19288 | * | ||
19289 | * shouldComponentUpdate: function(nextProps, nextState, nextContext) { | ||
19290 | * return !equal(nextProps, this.props) || | ||
19291 | * !equal(nextState, this.state) || | ||
19292 | * !equal(nextContext, this.context); | ||
19293 | * } | ||
19294 | * | ||
19295 | * @param {object} nextProps | ||
19296 | * @param {?object} nextState | ||
19297 | * @param {?object} nextContext | ||
19298 | * @return {boolean} True if the component should update. | ||
19299 | * @optional | ||
19300 | */ | ||
19301 | shouldComponentUpdate: 'DEFINE_ONCE', | ||
19302 | |||
19303 | /** | ||
19304 | * Invoked when the component is about to update due to a transition from | ||
19305 | * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` | ||
19306 | * and `nextContext`. | ||
19307 | * | ||
19308 | * Use this as an opportunity to perform preparation before an update occurs. | ||
19309 | * | ||
19310 | * NOTE: You **cannot** use `this.setState()` in this method. | ||
19311 | * | ||
19312 | * @param {object} nextProps | ||
19313 | * @param {?object} nextState | ||
19314 | * @param {?object} nextContext | ||
19315 | * @param {ReactReconcileTransaction} transaction | ||
19316 | * @optional | ||
19317 | */ | ||
19318 | componentWillUpdate: 'DEFINE_MANY', | ||
19319 | |||
19320 | /** | ||
19321 | * Invoked when the component's DOM representation has been updated. | ||
19322 | * | ||
19323 | * Use this as an opportunity to operate on the DOM when the component has | ||
19324 | * been updated. | ||
19325 | * | ||
19326 | * @param {object} prevProps | ||
19327 | * @param {?object} prevState | ||
19328 | * @param {?object} prevContext | ||
19329 | * @param {DOMElement} rootNode DOM element representing the component. | ||
19330 | * @optional | ||
19331 | */ | ||
19332 | componentDidUpdate: 'DEFINE_MANY', | ||
19333 | |||
19334 | /** | ||
19335 | * Invoked when the component is about to be removed from its parent and have | ||
19336 | * its DOM representation destroyed. | ||
19337 | * | ||
19338 | * Use this as an opportunity to deallocate any external resources. | ||
19339 | * | ||
19340 | * NOTE: There is no `componentDidUnmount` since your component will have been | ||
19341 | * destroyed by that point. | ||
19342 | * | ||
19343 | * @optional | ||
19344 | */ | ||
19345 | componentWillUnmount: 'DEFINE_MANY', | ||
19346 | |||
19347 | // ==== Advanced methods ==== | ||
19348 | |||
19349 | /** | ||
19350 | * Updates the component's currently mounted DOM representation. | ||
19351 | * | ||
19352 | * By default, this implements React's rendering and reconciliation algorithm. | ||
19353 | * Sophisticated clients may wish to override this. | ||
19354 | * | ||
19355 | * @param {ReactReconcileTransaction} transaction | ||
19356 | * @internal | ||
19357 | * @overridable | ||
19358 | */ | ||
19359 | updateComponent: 'OVERRIDE_BASE' | ||
19360 | |||
19361 | }; | ||
19362 | |||
19363 | /** | ||
19364 | * Mapping from class specification keys to special processing functions. | ||
19365 | * | ||
19366 | * Although these are declared like instance properties in the specification | ||
19367 | * when defining classes using `React.createClass`, they are actually static | ||
19368 | * and are accessible on the constructor instead of the prototype. Despite | ||
19369 | * being static, they must be defined outside of the "statics" key under | ||
19370 | * which all other static methods are defined. | ||
19371 | */ | ||
19372 | var RESERVED_SPEC_KEYS = { | ||
19373 | displayName: function (Constructor, displayName) { | ||
19374 | Constructor.displayName = displayName; | ||
19375 | }, | ||
19376 | mixins: function (Constructor, mixins) { | ||
19377 | if (mixins) { | ||
19378 | for (var i = 0; i < mixins.length; i++) { | ||
19379 | mixSpecIntoComponent(Constructor, mixins[i]); | ||
19380 | } | ||
19381 | } | ||
19382 | }, | ||
19383 | childContextTypes: function (Constructor, childContextTypes) { | ||
19384 | if (process.env.NODE_ENV !== 'production') { | ||
19385 | validateTypeDef(Constructor, childContextTypes, 'childContext'); | ||
19386 | } | ||
19387 | Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes); | ||
19388 | }, | ||
19389 | contextTypes: function (Constructor, contextTypes) { | ||
19390 | if (process.env.NODE_ENV !== 'production') { | ||
19391 | validateTypeDef(Constructor, contextTypes, 'context'); | ||
19392 | } | ||
19393 | Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes); | ||
19394 | }, | ||
19395 | /** | ||
19396 | * Special case getDefaultProps which should move into statics but requires | ||
19397 | * automatic merging. | ||
19398 | */ | ||
19399 | getDefaultProps: function (Constructor, getDefaultProps) { | ||
19400 | if (Constructor.getDefaultProps) { | ||
19401 | Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); | ||
19402 | } else { | ||
19403 | Constructor.getDefaultProps = getDefaultProps; | ||
19404 | } | ||
19405 | }, | ||
19406 | propTypes: function (Constructor, propTypes) { | ||
19407 | if (process.env.NODE_ENV !== 'production') { | ||
19408 | validateTypeDef(Constructor, propTypes, 'prop'); | ||
19409 | } | ||
19410 | Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); | ||
19411 | }, | ||
19412 | statics: function (Constructor, statics) { | ||
19413 | mixStaticSpecIntoComponent(Constructor, statics); | ||
19414 | }, | ||
19415 | autobind: function () {} }; | ||
19416 | |||
19417 | function validateTypeDef(Constructor, typeDef, location) { | ||
19418 | for (var propName in typeDef) { | ||
19419 | if (typeDef.hasOwnProperty(propName)) { | ||
19420 | // use a warning instead of an _invariant so components | ||
19421 | // don't show up in prod but only in __DEV__ | ||
19422 | 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; | ||
19423 | } | ||
19424 | } | ||
19425 | } | ||
19426 | |||
19427 | function validateMethodOverride(isAlreadyDefined, name) { | ||
19428 | var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; | ||
19429 | |||
19430 | // Disallow overriding of base class methods unless explicitly allowed. | ||
19431 | if (ReactClassMixin.hasOwnProperty(name)) { | ||
19432 | _invariant(specPolicy === 'OVERRIDE_BASE', 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name); | ||
19433 | } | ||
19434 | |||
19435 | // Disallow defining methods more than once unless explicitly allowed. | ||
19436 | if (isAlreadyDefined) { | ||
19437 | _invariant(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name); | ||
19438 | } | ||
19439 | } | ||
19440 | |||
19441 | /** | ||
19442 | * Mixin helper which handles policy validation and reserved | ||
19443 | * specification keys when building React classes. | ||
19444 | */ | ||
19445 | function mixSpecIntoComponent(Constructor, spec) { | ||
19446 | if (!spec) { | ||
19447 | if (process.env.NODE_ENV !== 'production') { | ||
19448 | var typeofSpec = typeof spec; | ||
19449 | var isMixinValid = typeofSpec === 'object' && spec !== null; | ||
19450 | |||
19451 | 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; | ||
19452 | } | ||
19453 | |||
19454 | return; | ||
19455 | } | ||
19456 | |||
19457 | _invariant(typeof spec !== 'function', 'ReactClass: You\'re attempting to ' + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.'); | ||
19458 | _invariant(!isValidElement(spec), 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.'); | ||
19459 | |||
19460 | var proto = Constructor.prototype; | ||
19461 | var autoBindPairs = proto.__reactAutoBindPairs; | ||
19462 | |||
19463 | // By handling mixins before any other properties, we ensure the same | ||
19464 | // chaining order is applied to methods with DEFINE_MANY policy, whether | ||
19465 | // mixins are listed before or after these methods in the spec. | ||
19466 | if (spec.hasOwnProperty(MIXINS_KEY)) { | ||
19467 | RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); | ||
19468 | } | ||
19469 | |||
19470 | for (var name in spec) { | ||
19471 | if (!spec.hasOwnProperty(name)) { | ||
19472 | continue; | ||
19473 | } | ||
19474 | |||
19475 | if (name === MIXINS_KEY) { | ||
19476 | // We have already handled mixins in a special case above. | ||
19477 | continue; | ||
19478 | } | ||
19479 | |||
19480 | var property = spec[name]; | ||
19481 | var isAlreadyDefined = proto.hasOwnProperty(name); | ||
19482 | validateMethodOverride(isAlreadyDefined, name); | ||
19483 | |||
19484 | if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { | ||
19485 | RESERVED_SPEC_KEYS[name](Constructor, property); | ||
19486 | } else { | ||
19487 | // Setup methods on prototype: | ||
19488 | // The following member methods should not be automatically bound: | ||
19489 | // 1. Expected ReactClass methods (in the "interface"). | ||
19490 | // 2. Overridden methods (that were mixed in). | ||
19491 | var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); | ||
19492 | var isFunction = typeof property === 'function'; | ||
19493 | var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; | ||
19494 | |||
19495 | if (shouldAutoBind) { | ||
19496 | autoBindPairs.push(name, property); | ||
19497 | proto[name] = property; | ||
19498 | } else { | ||
19499 | if (isAlreadyDefined) { | ||
19500 | var specPolicy = ReactClassInterface[name]; | ||
19501 | |||
19502 | // These cases should already be caught by validateMethodOverride. | ||
19503 | _invariant(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY'), 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name); | ||
19504 | |||
19505 | // For methods which are defined more than once, call the existing | ||
19506 | // methods before calling the new property, merging if appropriate. | ||
19507 | if (specPolicy === 'DEFINE_MANY_MERGED') { | ||
19508 | proto[name] = createMergedResultFunction(proto[name], property); | ||
19509 | } else if (specPolicy === 'DEFINE_MANY') { | ||
19510 | proto[name] = createChainedFunction(proto[name], property); | ||
19511 | } | ||
19512 | } else { | ||
19513 | proto[name] = property; | ||
19514 | if (process.env.NODE_ENV !== 'production') { | ||
19515 | // Add verbose displayName to the function, which helps when looking | ||
19516 | // at profiling tools. | ||
19517 | if (typeof property === 'function' && spec.displayName) { | ||
19518 | proto[name].displayName = spec.displayName + '_' + name; | ||
19519 | } | ||
19520 | } | ||
19521 | } | ||
19522 | } | ||
19523 | } | ||
19524 | } | ||
19525 | } | ||
19526 | |||
19527 | function mixStaticSpecIntoComponent(Constructor, statics) { | ||
19528 | if (!statics) { | ||
19529 | return; | ||
19530 | } | ||
19531 | for (var name in statics) { | ||
19532 | var property = statics[name]; | ||
19533 | if (!statics.hasOwnProperty(name)) { | ||
19534 | continue; | ||
19535 | } | ||
19536 | |||
19537 | var isReserved = name in RESERVED_SPEC_KEYS; | ||
19538 | _invariant(!isReserved, '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); | ||
19539 | |||
19540 | var isInherited = name in Constructor; | ||
19541 | _invariant(!isInherited, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name); | ||
19542 | Constructor[name] = property; | ||
19543 | } | ||
19544 | } | ||
19545 | |||
19546 | /** | ||
19547 | * Merge two objects, but throw if both contain the same key. | ||
19548 | * | ||
19549 | * @param {object} one The first object, which is mutated. | ||
19550 | * @param {object} two The second object | ||
19551 | * @return {object} one after it has been mutated to contain everything in two. | ||
19552 | */ | ||
19553 | function mergeIntoWithNoDuplicateKeys(one, two) { | ||
19554 | _invariant(one && two && typeof one === 'object' && typeof two === 'object', 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'); | ||
19555 | |||
19556 | for (var key in two) { | ||
19557 | if (two.hasOwnProperty(key)) { | ||
19558 | _invariant(one[key] === undefined, '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); | ||
19559 | one[key] = two[key]; | ||
19560 | } | ||
19561 | } | ||
19562 | return one; | ||
19563 | } | ||
19564 | |||
19565 | /** | ||
19566 | * Creates a function that invokes two functions and merges their return values. | ||
19567 | * | ||
19568 | * @param {function} one Function to invoke first. | ||
19569 | * @param {function} two Function to invoke second. | ||
19570 | * @return {function} Function that invokes the two argument functions. | ||
19571 | * @private | ||
19572 | */ | ||
19573 | function createMergedResultFunction(one, two) { | ||
19574 | return function mergedResult() { | ||
19575 | var a = one.apply(this, arguments); | ||
19576 | var b = two.apply(this, arguments); | ||
19577 | if (a == null) { | ||
19578 | return b; | ||
19579 | } else if (b == null) { | ||
19580 | return a; | ||
19581 | } | ||
19582 | var c = {}; | ||
19583 | mergeIntoWithNoDuplicateKeys(c, a); | ||
19584 | mergeIntoWithNoDuplicateKeys(c, b); | ||
19585 | return c; | ||
19586 | }; | ||
19587 | } | ||
19588 | |||
19589 | /** | ||
19590 | * Creates a function that invokes two functions and ignores their return vales. | ||
19591 | * | ||
19592 | * @param {function} one Function to invoke first. | ||
19593 | * @param {function} two Function to invoke second. | ||
19594 | * @return {function} Function that invokes the two argument functions. | ||
19595 | * @private | ||
19596 | */ | ||
19597 | function createChainedFunction(one, two) { | ||
19598 | return function chainedFunction() { | ||
19599 | one.apply(this, arguments); | ||
19600 | two.apply(this, arguments); | ||
19601 | }; | ||
19602 | } | ||
19603 | |||
19604 | /** | ||
19605 | * Binds a method to the component. | ||
19606 | * | ||
19607 | * @param {object} component Component whose method is going to be bound. | ||
19608 | * @param {function} method Method to be bound. | ||
19609 | * @return {function} The bound method. | ||
19610 | */ | ||
19611 | function bindAutoBindMethod(component, method) { | ||
19612 | var boundMethod = method.bind(component); | ||
19613 | if (process.env.NODE_ENV !== 'production') { | ||
19614 | boundMethod.__reactBoundContext = component; | ||
19615 | boundMethod.__reactBoundMethod = method; | ||
19616 | boundMethod.__reactBoundArguments = null; | ||
19617 | var componentName = component.constructor.displayName; | ||
19618 | var _bind = boundMethod.bind; | ||
19619 | boundMethod.bind = function (newThis) { | ||
19620 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
19621 | args[_key - 1] = arguments[_key]; | ||
19622 | } | ||
19623 | |||
19624 | // User is trying to bind() an autobound method; we effectively will | ||
19625 | // ignore the value of "this" that the user is trying to use, so | ||
19626 | // let's warn. | ||
19627 | if (newThis !== component && newThis !== null) { | ||
19628 | process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0; | ||
19629 | } else if (!args.length) { | ||
19630 | 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; | ||
19631 | return boundMethod; | ||
19632 | } | ||
19633 | var reboundMethod = _bind.apply(boundMethod, arguments); | ||
19634 | reboundMethod.__reactBoundContext = component; | ||
19635 | reboundMethod.__reactBoundMethod = method; | ||
19636 | reboundMethod.__reactBoundArguments = args; | ||
19637 | return reboundMethod; | ||
19638 | }; | ||
19639 | } | ||
19640 | return boundMethod; | ||
19641 | } | ||
19642 | |||
19643 | /** | ||
19644 | * Binds all auto-bound methods in a component. | ||
19645 | * | ||
19646 | * @param {object} component Component whose method is going to be bound. | ||
19647 | */ | ||
19648 | function bindAutoBindMethods(component) { | ||
19649 | var pairs = component.__reactAutoBindPairs; | ||
19650 | for (var i = 0; i < pairs.length; i += 2) { | ||
19651 | var autoBindKey = pairs[i]; | ||
19652 | var method = pairs[i + 1]; | ||
19653 | component[autoBindKey] = bindAutoBindMethod(component, method); | ||
19654 | } | ||
19655 | } | ||
19656 | |||
19657 | var IsMountedMixin = { | ||
19658 | componentDidMount: function () { | ||
19659 | this.__isMounted = true; | ||
19660 | }, | ||
19661 | componentWillUnmount: function () { | ||
19662 | this.__isMounted = false; | ||
19663 | } | ||
19664 | }; | ||
19665 | |||
19666 | /** | ||
19667 | * Add more to the ReactClass base class. These are all legacy features and | ||
19668 | * therefore not already part of the modern ReactComponent. | ||
19669 | */ | ||
19670 | var ReactClassMixin = { | ||
19671 | |||
19672 | /** | ||
19673 | * TODO: This will be deprecated because state should always keep a consistent | ||
19674 | * type signature and the only use case for this, is to avoid that. | ||
19675 | */ | ||
19676 | replaceState: function (newState, callback) { | ||
19677 | this.updater.enqueueReplaceState(this, newState, callback); | ||
19678 | }, | ||
19679 | |||
19680 | /** | ||
19681 | * Checks whether or not this composite component is mounted. | ||
19682 | * @return {boolean} True if mounted, false otherwise. | ||
19683 | * @protected | ||
19684 | * @final | ||
19685 | */ | ||
19686 | isMounted: function () { | ||
19687 | if (process.env.NODE_ENV !== 'production') { | ||
19688 | process.env.NODE_ENV !== 'production' ? warning(this.__didWarnIsMounted, '%s: isMounted is deprecated. Instead, make sure to clean up ' + 'subscriptions and pending requests in componentWillUnmount to ' + 'prevent memory leaks.', this.constructor && this.constructor.displayName || this.name || 'Component') : void 0; | ||
19689 | this.__didWarnIsMounted = true; | ||
19690 | } | ||
19691 | return !!this.__isMounted; | ||
19692 | } | ||
19693 | }; | ||
19694 | |||
19695 | var ReactClassComponent = function () {}; | ||
19696 | _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); | ||
19697 | |||
19698 | /** | ||
19699 | * Creates a composite component class given a class specification. | ||
19700 | * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass | ||
19701 | * | ||
19702 | * @param {object} spec Class specification (which must define `render`). | ||
19703 | * @return {function} Component constructor function. | ||
19704 | * @public | ||
19705 | */ | ||
19706 | function createClass(spec) { | ||
19707 | // To keep our warnings more understandable, we'll use a little hack here to | ||
19708 | // ensure that Constructor.name !== 'Constructor'. This makes sure we don't | ||
19709 | // unnecessarily identify a class without displayName as 'Constructor'. | ||
19710 | var Constructor = identity(function (props, context, updater) { | ||
19711 | // This constructor gets overridden by mocks. The argument is used | ||
19712 | // by mocks to assert on what gets mounted. | ||
19713 | |||
19714 | if (process.env.NODE_ENV !== 'production') { | ||
19715 | 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; | ||
19716 | } | ||
19717 | |||
19718 | // Wire up auto-binding | ||
19719 | if (this.__reactAutoBindPairs.length) { | ||
19720 | bindAutoBindMethods(this); | ||
19721 | } | ||
19722 | |||
19723 | this.props = props; | ||
19724 | this.context = context; | ||
19725 | this.refs = emptyObject; | ||
19726 | this.updater = updater || ReactNoopUpdateQueue; | ||
19727 | |||
19728 | this.state = null; | ||
19729 | |||
19730 | // ReactClasses doesn't have constructors. Instead, they use the | ||
19731 | // getInitialState and componentWillMount methods for initialization. | ||
19732 | |||
19733 | var initialState = this.getInitialState ? this.getInitialState() : null; | ||
19734 | if (process.env.NODE_ENV !== 'production') { | ||
19735 | // We allow auto-mocks to proceed as if they're returning null. | ||
19736 | if (initialState === undefined && this.getInitialState._isMockFunction) { | ||
19737 | // This is probably bad practice. Consider warning here and | ||
19738 | // deprecating this convenience. | ||
19739 | initialState = null; | ||
19740 | } | ||
19741 | } | ||
19742 | _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent'); | ||
19743 | |||
19744 | this.state = initialState; | ||
19745 | }); | ||
19746 | Constructor.prototype = new ReactClassComponent(); | ||
19747 | Constructor.prototype.constructor = Constructor; | ||
19748 | Constructor.prototype.__reactAutoBindPairs = []; | ||
19749 | |||
19750 | injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); | ||
19751 | |||
19752 | mixSpecIntoComponent(Constructor, IsMountedMixin); | ||
19753 | mixSpecIntoComponent(Constructor, spec); | ||
19754 | |||
19755 | // Initialize the defaultProps property after all mixins have been merged. | ||
19756 | if (Constructor.getDefaultProps) { | ||
19757 | Constructor.defaultProps = Constructor.getDefaultProps(); | ||
19758 | } | ||
19759 | |||
19760 | if (process.env.NODE_ENV !== 'production') { | ||
19761 | // This is a tag to indicate that the use of these method names is ok, | ||
19762 | // since it's used with createClass. If it's not, then it's likely a | ||
19763 | // mistake so we'll warn you to use the static property, property | ||
19764 | // initializer or constructor respectively. | ||
19765 | if (Constructor.getDefaultProps) { | ||
19766 | Constructor.getDefaultProps.isReactClassApproved = {}; | ||
19767 | } | ||
19768 | if (Constructor.prototype.getInitialState) { | ||
19769 | Constructor.prototype.getInitialState.isReactClassApproved = {}; | ||
19770 | } | ||
19771 | } | ||
19772 | |||
19773 | _invariant(Constructor.prototype.render, 'createClass(...): Class specification must implement a `render` method.'); | ||
19774 | |||
19775 | if (process.env.NODE_ENV !== 'production') { | ||
19776 | 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; | ||
19777 | 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; | ||
19778 | } | ||
19779 | |||
19780 | // Reduce time spent doing lookups by setting these on the prototype. | ||
19781 | for (var methodName in ReactClassInterface) { | ||
19782 | if (!Constructor.prototype[methodName]) { | ||
19783 | Constructor.prototype[methodName] = null; | ||
19784 | } | ||
19785 | } | ||
19786 | |||
19787 | return Constructor; | ||
19788 | } | ||
19789 | |||
19790 | return createClass; | ||
19791 | } | ||
19792 | |||
19793 | module.exports = factory; | ||
19794 | |||
19795 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
19796 | |||
19797 | /***/ }), | ||
19798 | /* 203 */ | ||
19799 | /***/ (function(module, exports, __webpack_require__) { | ||
19800 | |||
19801 | "use strict"; | ||
19802 | /** | ||
19803 | * Copyright 2013-present, Facebook, Inc. | ||
19804 | * All rights reserved. | ||
19805 | * | ||
19806 | * This source code is licensed under the BSD-style license found in the | ||
19807 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19808 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19809 | * | ||
19810 | */ | ||
19811 | |||
19812 | |||
19813 | |||
19814 | var React = __webpack_require__(5); | ||
19815 | var factory = __webpack_require__(202); | ||
19816 | |||
19817 | // Hack to grab NoopUpdateQueue from isomorphic React | ||
19818 | var ReactNoopUpdateQueue = new React.Component().updater; | ||
19819 | |||
19820 | module.exports = factory( | ||
19821 | React.Component, | ||
19822 | React.isValidElement, | ||
19823 | ReactNoopUpdateQueue | ||
19824 | ); | ||
19825 | |||
19826 | |||
19827 | /***/ }), | ||
19828 | /* 204 */ | ||
19829 | /***/ (function(module, exports, __webpack_require__) { | ||
19830 | |||
19831 | "use strict"; | ||
19832 | |||
19833 | |||
19834 | Object.defineProperty(exports, "__esModule", { | ||
19835 | value: true | ||
19836 | }); | ||
19837 | var EVENT_NAME_MAP = { | ||
19838 | transitionend: { | ||
19839 | transition: 'transitionend', | ||
19840 | WebkitTransition: 'webkitTransitionEnd', | ||
19841 | MozTransition: 'mozTransitionEnd', | ||
19842 | OTransition: 'oTransitionEnd', | ||
19843 | msTransition: 'MSTransitionEnd' | ||
19844 | }, | ||
19845 | |||
19846 | animationend: { | ||
19847 | animation: 'animationend', | ||
19848 | WebkitAnimation: 'webkitAnimationEnd', | ||
19849 | MozAnimation: 'mozAnimationEnd', | ||
19850 | OAnimation: 'oAnimationEnd', | ||
19851 | msAnimation: 'MSAnimationEnd' | ||
19852 | } | ||
19853 | }; | ||
19854 | |||
19855 | var endEvents = []; | ||
19856 | |||
19857 | function detectEvents() { | ||
19858 | var testEl = document.createElement('div'); | ||
19859 | var style = testEl.style; | ||
19860 | |||
19861 | if (!('AnimationEvent' in window)) { | ||
19862 | delete EVENT_NAME_MAP.animationend.animation; | ||
19863 | } | ||
19864 | |||
19865 | if (!('TransitionEvent' in window)) { | ||
19866 | delete EVENT_NAME_MAP.transitionend.transition; | ||
19867 | } | ||
19868 | |||
19869 | for (var baseEventName in EVENT_NAME_MAP) { | ||
19870 | if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) { | ||
19871 | var baseEvents = EVENT_NAME_MAP[baseEventName]; | ||
19872 | for (var styleName in baseEvents) { | ||
19873 | if (styleName in style) { | ||
19874 | endEvents.push(baseEvents[styleName]); | ||
19875 | break; | ||
19876 | } | ||
19877 | } | ||
19878 | } | ||
19879 | } | ||
19880 | } | ||
19881 | |||
19882 | if (typeof window !== 'undefined' && typeof document !== 'undefined') { | ||
19883 | detectEvents(); | ||
19884 | } | ||
19885 | |||
19886 | function addEventListener(node, eventName, eventListener) { | ||
19887 | node.addEventListener(eventName, eventListener, false); | ||
19888 | } | ||
19889 | |||
19890 | function removeEventListener(node, eventName, eventListener) { | ||
19891 | node.removeEventListener(eventName, eventListener, false); | ||
19892 | } | ||
19893 | |||
19894 | var TransitionEvents = { | ||
19895 | addEndEventListener: function addEndEventListener(node, eventListener) { | ||
19896 | if (endEvents.length === 0) { | ||
19897 | window.setTimeout(eventListener, 0); | ||
19898 | return; | ||
19899 | } | ||
19900 | endEvents.forEach(function (endEvent) { | ||
19901 | addEventListener(node, endEvent, eventListener); | ||
19902 | }); | ||
19903 | }, | ||
19904 | |||
19905 | |||
19906 | endEvents: endEvents, | ||
19907 | |||
19908 | removeEndEventListener: function removeEndEventListener(node, eventListener) { | ||
19909 | if (endEvents.length === 0) { | ||
19910 | return; | ||
19911 | } | ||
19912 | endEvents.forEach(function (endEvent) { | ||
19913 | removeEventListener(node, endEvent, eventListener); | ||
19914 | }); | ||
19915 | } | ||
19916 | }; | ||
19917 | |||
19918 | exports["default"] = TransitionEvents; | ||
19919 | module.exports = exports['default']; | ||
19920 | |||
19921 | /***/ }), | ||
19922 | /* 205 */ | ||
19923 | /***/ (function(module, exports, __webpack_require__) { | ||
19924 | |||
19925 | "use strict"; | ||
19926 | |||
19927 | |||
19928 | Object.defineProperty(exports, "__esModule", { | ||
19929 | value: true | ||
19930 | }); | ||
19931 | |||
19932 | 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; }; | ||
19933 | |||
19934 | var _Event = __webpack_require__(204); | ||
19935 | |||
19936 | var _Event2 = _interopRequireDefault(_Event); | ||
19937 | |||
19938 | var _componentClasses = __webpack_require__(166); | ||
19939 | |||
19940 | var _componentClasses2 = _interopRequireDefault(_componentClasses); | ||
19941 | |||
19942 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
19943 | |||
19944 | var isCssAnimationSupported = _Event2["default"].endEvents.length !== 0; | ||
19945 | |||
19946 | |||
19947 | var capitalPrefixes = ['Webkit', 'Moz', 'O', | ||
19948 | // ms is special .... ! | ||
19949 | 'ms']; | ||
19950 | var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', '']; | ||
19951 | |||
19952 | function getStyleProperty(node, name) { | ||
19953 | // old ff need null, https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle | ||
19954 | var style = window.getComputedStyle(node, null); | ||
19955 | var ret = ''; | ||
19956 | for (var i = 0; i < prefixes.length; i++) { | ||
19957 | ret = style.getPropertyValue(prefixes[i] + name); | ||
19958 | if (ret) { | ||
19959 | break; | ||
19960 | } | ||
19961 | } | ||
19962 | return ret; | ||
19963 | } | ||
19964 | |||
19965 | function fixBrowserByTimeout(node) { | ||
19966 | if (isCssAnimationSupported) { | ||
19967 | var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0; | ||
19968 | var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0; | ||
19969 | var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0; | ||
19970 | var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0; | ||
19971 | var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay); | ||
19972 | // sometimes, browser bug | ||
19973 | node.rcEndAnimTimeout = setTimeout(function () { | ||
19974 | node.rcEndAnimTimeout = null; | ||
19975 | if (node.rcEndListener) { | ||
19976 | node.rcEndListener(); | ||
19977 | } | ||
19978 | }, time * 1000 + 200); | ||
19979 | } | ||
19980 | } | ||
19981 | |||
19982 | function clearBrowserBugTimeout(node) { | ||
19983 | if (node.rcEndAnimTimeout) { | ||
19984 | clearTimeout(node.rcEndAnimTimeout); | ||
19985 | node.rcEndAnimTimeout = null; | ||
19986 | } | ||
19987 | } | ||
19988 | |||
19989 | var cssAnimation = function cssAnimation(node, transitionName, endCallback) { | ||
19990 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object'; | ||
19991 | var className = nameIsObj ? transitionName.name : transitionName; | ||
19992 | var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active'; | ||
19993 | var end = endCallback; | ||
19994 | var start = void 0; | ||
19995 | var active = void 0; | ||
19996 | var nodeClasses = (0, _componentClasses2["default"])(node); | ||
19997 | |||
19998 | if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') { | ||
19999 | end = endCallback.end; | ||
20000 | start = endCallback.start; | ||
20001 | active = endCallback.active; | ||
20002 | } | ||
20003 | |||
20004 | if (node.rcEndListener) { | ||
20005 | node.rcEndListener(); | ||
20006 | } | ||
20007 | |||
20008 | node.rcEndListener = function (e) { | ||
20009 | if (e && e.target !== node) { | ||
20010 | return; | ||
20011 | } | ||
20012 | |||
20013 | if (node.rcAnimTimeout) { | ||
20014 | clearTimeout(node.rcAnimTimeout); | ||
20015 | node.rcAnimTimeout = null; | ||
20016 | } | ||
20017 | |||
20018 | clearBrowserBugTimeout(node); | ||
20019 | |||
20020 | nodeClasses.remove(className); | ||
20021 | nodeClasses.remove(activeClassName); | ||
20022 | |||
20023 | _Event2["default"].removeEndEventListener(node, node.rcEndListener); | ||
20024 | node.rcEndListener = null; | ||
20025 | |||
20026 | // Usually this optional end is used for informing an owner of | ||
20027 | // a leave animation and telling it to remove the child. | ||
20028 | if (end) { | ||
20029 | end(); | ||
20030 | } | ||
20031 | }; | ||
20032 | |||
20033 | _Event2["default"].addEndEventListener(node, node.rcEndListener); | ||
20034 | |||
20035 | if (start) { | ||
20036 | start(); | ||
20037 | } | ||
20038 | nodeClasses.add(className); | ||
20039 | |||
20040 | node.rcAnimTimeout = setTimeout(function () { | ||
20041 | node.rcAnimTimeout = null; | ||
20042 | nodeClasses.add(activeClassName); | ||
20043 | if (active) { | ||
20044 | setTimeout(active, 0); | ||
20045 | } | ||
20046 | fixBrowserByTimeout(node); | ||
20047 | // 30ms for firefox | ||
20048 | }, 30); | ||
20049 | |||
20050 | return { | ||
20051 | stop: function stop() { | ||
20052 | if (node.rcEndListener) { | ||
20053 | node.rcEndListener(); | ||
20054 | } | ||
20055 | } | ||
20056 | }; | ||
20057 | }; | ||
20058 | |||
20059 | cssAnimation.style = function (node, style, callback) { | ||
20060 | if (node.rcEndListener) { | ||
20061 | node.rcEndListener(); | ||
20062 | } | ||
20063 | |||
20064 | node.rcEndListener = function (e) { | ||
20065 | if (e && e.target !== node) { | ||
20066 | return; | ||
20067 | } | ||
20068 | |||
20069 | if (node.rcAnimTimeout) { | ||
20070 | clearTimeout(node.rcAnimTimeout); | ||
20071 | node.rcAnimTimeout = null; | ||
20072 | } | ||
20073 | |||
20074 | clearBrowserBugTimeout(node); | ||
20075 | |||
20076 | _Event2["default"].removeEndEventListener(node, node.rcEndListener); | ||
20077 | node.rcEndListener = null; | ||
20078 | |||
20079 | // Usually this optional callback is used for informing an owner of | ||
20080 | // a leave animation and telling it to remove the child. | ||
20081 | if (callback) { | ||
20082 | callback(); | ||
20083 | } | ||
20084 | }; | ||
20085 | |||
20086 | _Event2["default"].addEndEventListener(node, node.rcEndListener); | ||
20087 | |||
20088 | node.rcAnimTimeout = setTimeout(function () { | ||
20089 | for (var s in style) { | ||
20090 | if (style.hasOwnProperty(s)) { | ||
20091 | node.style[s] = style[s]; | ||
20092 | } | ||
20093 | } | ||
20094 | node.rcAnimTimeout = null; | ||
20095 | fixBrowserByTimeout(node); | ||
20096 | }, 0); | ||
20097 | }; | ||
20098 | |||
20099 | cssAnimation.setTransition = function (node, p, value) { | ||
20100 | var property = p; | ||
20101 | var v = value; | ||
20102 | if (value === undefined) { | ||
20103 | v = property; | ||
20104 | property = ''; | ||
20105 | } | ||
20106 | property = property || ''; | ||
20107 | capitalPrefixes.forEach(function (prefix) { | ||
20108 | node.style[prefix + 'Transition' + property] = v; | ||
20109 | }); | ||
20110 | }; | ||
20111 | |||
20112 | cssAnimation.isCssAnimationSupported = isCssAnimationSupported; | ||
20113 | |||
20114 | exports["default"] = cssAnimation; | ||
20115 | module.exports = exports['default']; | ||
20116 | |||
20117 | /***/ }), | ||
20118 | /* 206 */ | ||
20119 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
20120 | |||
20121 | "use strict"; | ||
20122 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__(44); | ||
20123 | |||
20124 | |||
20125 | function adjustForViewport(elFuturePos, elRegion, xRect, yRect, overflow) { | ||
20126 | var pos = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].clone(elFuturePos); | ||
20127 | var size = { | ||
20128 | width: elRegion.width, | ||
20129 | height: elRegion.height | ||
20130 | }; | ||
20131 | |||
20132 | if (overflow.adjustX && pos.left < xRect.left) { | ||
20133 | pos.left = xRect.left; | ||
20134 | } | ||
20135 | |||
20136 | // Left edge inside and right edge outside viewport, try to resize it. | ||
20137 | if (overflow.resizeWidth && pos.left >= xRect.left && pos.left + size.width > xRect.right) { | ||
20138 | size.width -= pos.left + size.width - xRect.right; | ||
20139 | } | ||
20140 | |||
20141 | // Right edge outside viewport, try to move it. | ||
20142 | if (overflow.adjustX && pos.left + size.width > xRect.right) { | ||
20143 | // 保证左边界和可视区域左边界对齐 | ||
20144 | pos.left = Math.max(xRect.right - size.width, xRect.left); | ||
20145 | } | ||
20146 | |||
20147 | // Top edge outside viewport, try to move it. | ||
20148 | if (overflow.adjustY && pos.top < yRect.top) { | ||
20149 | pos.top = yRect.top; | ||
20150 | } | ||
20151 | |||
20152 | // Top edge inside and bottom edge outside viewport, try to resize it. | ||
20153 | if (overflow.resizeHeight && pos.top >= yRect.top && pos.top + size.height > yRect.bottom) { | ||
20154 | size.height -= pos.top + size.height - yRect.bottom; | ||
20155 | } | ||
20156 | |||
20157 | // Bottom edge outside viewport, try to move it. | ||
20158 | if (overflow.adjustY && pos.top + size.height > yRect.bottom) { | ||
20159 | // 保证上边界和可视区域上边界对齐 | ||
20160 | pos.top = Math.max(yRect.bottom - size.height, yRect.top); | ||
20161 | } | ||
20162 | |||
20163 | return __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].mix(pos, size); | ||
20164 | } | ||
20165 | |||
20166 | /* harmony default export */ __webpack_exports__["a"] = (adjustForViewport); | ||
20167 | |||
20168 | /***/ }), | ||
20169 | /* 207 */ | ||
20170 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
20171 | |||
20172 | "use strict"; | ||
20173 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getAlignOffset__ = __webpack_require__(108); | ||
20174 | |||
20175 | |||
20176 | function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) { | ||
20177 | var xy = void 0; | ||
20178 | var diff = void 0; | ||
20179 | var p1 = void 0; | ||
20180 | var p2 = void 0; | ||
20181 | |||
20182 | xy = { | ||
20183 | left: elRegion.left, | ||
20184 | top: elRegion.top | ||
20185 | }; | ||
20186 | |||
20187 | p1 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__getAlignOffset__["a" /* default */])(refNodeRegion, points[1]); | ||
20188 | p2 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__getAlignOffset__["a" /* default */])(elRegion, points[0]); | ||
20189 | |||
20190 | diff = [p2.left - p1.left, p2.top - p1.top]; | ||
20191 | |||
20192 | return { | ||
20193 | left: xy.left - diff[0] + offset[0] - targetOffset[0], | ||
20194 | top: xy.top - diff[1] + offset[1] - targetOffset[1] | ||
20195 | }; | ||
20196 | } | ||
20197 | |||
20198 | /* harmony default export */ __webpack_exports__["a"] = (getElFuturePos); | ||
20199 | |||
20200 | /***/ }), | ||
20201 | /* 208 */ | ||
20202 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
20203 | |||
20204 | "use strict"; | ||
20205 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__(44); | ||
20206 | |||
20207 | |||
20208 | function getRegion(node) { | ||
20209 | var offset = void 0; | ||
20210 | var w = void 0; | ||
20211 | var h = void 0; | ||
20212 | if (!__WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].isWindow(node) && node.nodeType !== 9) { | ||
20213 | offset = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].offset(node); | ||
20214 | w = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].outerWidth(node); | ||
20215 | h = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].outerHeight(node); | ||
20216 | } else { | ||
20217 | var win = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].getWindow(node); | ||
20218 | offset = { | ||
20219 | left: __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].getWindowScrollLeft(win), | ||
20220 | top: __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].getWindowScrollTop(win) | ||
20221 | }; | ||
20222 | w = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].viewportWidth(win); | ||
20223 | h = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].viewportHeight(win); | ||
20224 | } | ||
20225 | offset.width = w; | ||
20226 | offset.height = h; | ||
20227 | return offset; | ||
20228 | } | ||
20229 | |||
20230 | /* harmony default export */ __webpack_exports__["a"] = (getRegion); | ||
20231 | |||
20232 | /***/ }), | ||
20233 | /* 209 */ | ||
20234 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
20235 | |||
20236 | "use strict"; | ||
20237 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__(44); | ||
20238 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getOffsetParent__ = __webpack_require__(109); | ||
20239 | |||
20240 | |||
20241 | |||
20242 | /** | ||
20243 | * 获得元素的显示部分的区域 | ||
20244 | */ | ||
20245 | function getVisibleRectForElement(element) { | ||
20246 | var visibleRect = { | ||
20247 | left: 0, | ||
20248 | right: Infinity, | ||
20249 | top: 0, | ||
20250 | bottom: Infinity | ||
20251 | }; | ||
20252 | var el = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__getOffsetParent__["a" /* default */])(element); | ||
20253 | var scrollX = void 0; | ||
20254 | var scrollY = void 0; | ||
20255 | var winSize = void 0; | ||
20256 | var doc = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].getDocument(element); | ||
20257 | var win = doc.defaultView || doc.parentWindow; | ||
20258 | var body = doc.body; | ||
20259 | var documentElement = doc.documentElement; | ||
20260 | |||
20261 | // Determine the size of the visible rect by climbing the dom accounting for | ||
20262 | // all scrollable containers. | ||
20263 | while (el) { | ||
20264 | // clientWidth is zero for inline block elements in ie. | ||
20265 | if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) && | ||
20266 | // body may have overflow set on it, yet we still get the entire | ||
20267 | // viewport. In some browsers, el.offsetParent may be | ||
20268 | // document.documentElement, so check for that too. | ||
20269 | el !== body && el !== documentElement && __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].css(el, 'overflow') !== 'visible') { | ||
20270 | var pos = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].offset(el); | ||
20271 | // add border | ||
20272 | pos.left += el.clientLeft; | ||
20273 | pos.top += el.clientTop; | ||
20274 | visibleRect.top = Math.max(visibleRect.top, pos.top); | ||
20275 | visibleRect.right = Math.min(visibleRect.right, | ||
20276 | // consider area without scrollBar | ||
20277 | pos.left + el.clientWidth); | ||
20278 | visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight); | ||
20279 | visibleRect.left = Math.max(visibleRect.left, pos.left); | ||
20280 | } else if (el === body || el === documentElement) { | ||
20281 | break; | ||
20282 | } | ||
20283 | el = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__getOffsetParent__["a" /* default */])(el); | ||
20284 | } | ||
20285 | |||
20286 | // Clip by window's viewport. | ||
20287 | scrollX = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].getWindowScrollLeft(win); | ||
20288 | scrollY = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].getWindowScrollTop(win); | ||
20289 | visibleRect.left = Math.max(visibleRect.left, scrollX); | ||
20290 | visibleRect.top = Math.max(visibleRect.top, scrollY); | ||
20291 | winSize = { | ||
20292 | width: __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].viewportWidth(win), | ||
20293 | height: __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].viewportHeight(win) | ||
20294 | }; | ||
20295 | visibleRect.right = Math.min(visibleRect.right, scrollX + winSize.width); | ||
20296 | visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + winSize.height); | ||
20297 | return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null; | ||
20298 | } | ||
20299 | |||
20300 | /* harmony default export */ __webpack_exports__["a"] = (getVisibleRectForElement); | ||
20301 | |||
20302 | /***/ }), | ||
20303 | /* 210 */ | ||
20304 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
20305 | |||
20306 | "use strict"; | ||
20307 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
20308 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__(44); | ||
20309 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getOffsetParent__ = __webpack_require__(109); | ||
20310 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getVisibleRectForElement__ = __webpack_require__(209); | ||
20311 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__adjustForViewport__ = __webpack_require__(206); | ||
20312 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__getRegion__ = __webpack_require__(208); | ||
20313 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__getElFuturePos__ = __webpack_require__(207); | ||
20314 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__getAlignOffset__ = __webpack_require__(108); | ||
20315 | 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; } | ||
20316 | |||
20317 | /** | ||
20318 | * align dom node flexibly | ||
20319 | * @author yiminghe@gmail.com | ||
20320 | */ | ||
20321 | |||
20322 | |||
20323 | |||
20324 | |||
20325 | |||
20326 | |||
20327 | |||
20328 | |||
20329 | |||
20330 | // http://yiminghe.iteye.com/blog/1124720 | ||
20331 | |||
20332 | function isFailX(elFuturePos, elRegion, visibleRect) { | ||
20333 | return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right; | ||
20334 | } | ||
20335 | |||
20336 | function isFailY(elFuturePos, elRegion, visibleRect) { | ||
20337 | return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom; | ||
20338 | } | ||
20339 | |||
20340 | function isCompleteFailX(elFuturePos, elRegion, visibleRect) { | ||
20341 | return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left; | ||
20342 | } | ||
20343 | |||
20344 | function isCompleteFailY(elFuturePos, elRegion, visibleRect) { | ||
20345 | return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top; | ||
20346 | } | ||
20347 | |||
20348 | function isOutOfVisibleRect(target) { | ||
20349 | var visibleRect = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__getVisibleRectForElement__["a" /* default */])(target); | ||
20350 | var targetRegion = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__getRegion__["a" /* default */])(target); | ||
20351 | |||
20352 | return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom; | ||
20353 | } | ||
20354 | |||
20355 | function flip(points, reg, map) { | ||
20356 | var ret = []; | ||
20357 | __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].each(points, function (p) { | ||
20358 | ret.push(p.replace(reg, function (m) { | ||
20359 | return map[m]; | ||
20360 | })); | ||
20361 | }); | ||
20362 | return ret; | ||
20363 | } | ||
20364 | |||
20365 | function flipOffset(offset, index) { | ||
20366 | offset[index] = -offset[index]; | ||
20367 | return offset; | ||
20368 | } | ||
20369 | |||
20370 | function convertOffset(str, offsetLen) { | ||
20371 | var n = void 0; | ||
20372 | if (/%$/.test(str)) { | ||
20373 | n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen; | ||
20374 | } else { | ||
20375 | n = parseInt(str, 10); | ||
20376 | } | ||
20377 | return n || 0; | ||
20378 | } | ||
20379 | |||
20380 | function ySize(region) { | ||
20381 | return region.bottom - region.top; | ||
20382 | } | ||
20383 | |||
20384 | function xSize(region) { | ||
20385 | return region.right - region.left; | ||
20386 | } | ||
20387 | |||
20388 | function normalizeOffset(offset, el) { | ||
20389 | offset[0] = convertOffset(offset[0], el.width); | ||
20390 | offset[1] = convertOffset(offset[1], el.height); | ||
20391 | } | ||
20392 | |||
20393 | function domAlign(el, refNode, align) { | ||
20394 | var points = align.points; | ||
20395 | var offset = align.offset || [0, 0]; | ||
20396 | var targetOffset = align.targetOffset || [0, 0]; | ||
20397 | var overflow = align.overflow; | ||
20398 | var target = align.target || refNode; | ||
20399 | var source = align.source || el; | ||
20400 | offset = [].concat(offset); | ||
20401 | targetOffset = [].concat(targetOffset); | ||
20402 | overflow = overflow || {}; | ||
20403 | var newOverflowCfg = {}; | ||
20404 | var fail = 0; | ||
20405 | // 当前节点可以被放置的显示区域 | ||
20406 | var visibleRect = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__getVisibleRectForElement__["a" /* default */])(source); | ||
20407 | // 当前节点所占的区域, left/top/width/height | ||
20408 | var elRegion = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__getRegion__["a" /* default */])(source); | ||
20409 | // 参照节点所占的区域, left/top/width/height | ||
20410 | var refNodeRegion = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__getRegion__["a" /* default */])(target); | ||
20411 | // 将 offset 转换成数值,支持百分比 | ||
20412 | normalizeOffset(offset, elRegion); | ||
20413 | normalizeOffset(targetOffset, refNodeRegion); | ||
20414 | // 当前节点将要被放置的位置 | ||
20415 | var elFuturePos = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__getElFuturePos__["a" /* default */])(elRegion, refNodeRegion, points, offset, targetOffset); | ||
20416 | // 当前节点将要所处的区域 | ||
20417 | var newElRegion = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].merge(elRegion, elFuturePos); | ||
20418 | |||
20419 | var isTargetNotOutOfVisible = !isOutOfVisibleRect(target); | ||
20420 | var refNodeOffset = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].merge(refNodeRegion, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__getAlignOffset__["a" /* default */])(refNodeRegion, points[1])); | ||
20421 | |||
20422 | var Xregion = void 0; | ||
20423 | var YRegion = void 0; | ||
20424 | var xRefPoint = points[0].charAt(1); | ||
20425 | // TODO if visibleRect.xx < refNodeOffset.left ?? | ||
20426 | if (xRefPoint === 'c') { | ||
20427 | Xregion = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].merge(visibleRect, { | ||
20428 | left: refNodeOffset.left - elRegion.width / 2 | ||
20429 | }); | ||
20430 | } else { | ||
20431 | Xregion = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].merge(visibleRect, _defineProperty({}, xRefPoint === 'l' ? 'left' : 'right', refNodeOffset.left)); | ||
20432 | } | ||
20433 | |||
20434 | var yRefPoint = points[0].charAt(0); | ||
20435 | if (yRefPoint === 'c') { | ||
20436 | YRegion = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].merge(visibleRect, { | ||
20437 | top: refNodeOffset.top - elRegion.height / 2 | ||
20438 | }); | ||
20439 | } else { | ||
20440 | YRegion = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].merge(visibleRect, _defineProperty({}, yRefPoint === 't' ? 'top' : 'bottom', refNodeOffset.top)); | ||
20441 | } | ||
20442 | |||
20443 | var realXRegion = Xregion; | ||
20444 | var realYRegion = YRegion; | ||
20445 | // 如果可视区域不能完全放置当前节点时允许调整 | ||
20446 | if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTargetNotOutOfVisible) { | ||
20447 | if (overflow.adjustX) { | ||
20448 | // 如果横向不能放下 | ||
20449 | if (isFailX(elFuturePos, elRegion, visibleRect)) { | ||
20450 | // 对齐位置反下 | ||
20451 | var newPoints = flip(points, /[lr]/ig, { | ||
20452 | l: 'r', | ||
20453 | r: 'l' | ||
20454 | }); | ||
20455 | // 偏移量也反下 | ||
20456 | var newOffset = flipOffset(offset, 0); | ||
20457 | var newTargetOffset = flipOffset(targetOffset, 0); | ||
20458 | var newElFuturePos = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__getElFuturePos__["a" /* default */])(elRegion, refNodeRegion, newPoints, newOffset, newTargetOffset); | ||
20459 | |||
20460 | var XregionReversal = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].merge(visibleRect, _defineProperty({}, newPoints[0].charAt(1) === 'l' ? 'left' : 'right', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__getAlignOffset__["a" /* default */])(refNodeRegion, newPoints[1]).left)); | ||
20461 | var canXFlip = xSize(XregionReversal) > xSize(Xregion); | ||
20462 | if (canXFlip && !isCompleteFailX(newElFuturePos, elRegion, visibleRect)) { | ||
20463 | fail = 1; | ||
20464 | points = newPoints; | ||
20465 | offset = newOffset; | ||
20466 | targetOffset = newTargetOffset; | ||
20467 | realXRegion = XregionReversal; | ||
20468 | } | ||
20469 | } | ||
20470 | } | ||
20471 | |||
20472 | if (overflow.adjustY) { | ||
20473 | // 如果纵向不能放下 | ||
20474 | if (isFailY(elFuturePos, elRegion, visibleRect)) { | ||
20475 | // 对齐位置反下 | ||
20476 | var _newPoints = flip(points, /[tb]/ig, { | ||
20477 | t: 'b', | ||
20478 | b: 't' | ||
20479 | }); | ||
20480 | // 偏移量也反下 | ||
20481 | var _newOffset = flipOffset(offset, 1); | ||
20482 | var _newTargetOffset = flipOffset(targetOffset, 1); | ||
20483 | var _newElFuturePos = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__getElFuturePos__["a" /* default */])(elRegion, refNodeRegion, _newPoints, _newOffset, _newTargetOffset); | ||
20484 | |||
20485 | var YRegionReversal = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].merge(visibleRect, _defineProperty({}, _newPoints[0].charAt(0) === 't' ? 'top' : 'bottom', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__getAlignOffset__["a" /* default */])(refNodeRegion, _newPoints[1]).top)); | ||
20486 | var canYFlip = ySize(YRegionReversal) > ySize(YRegion); | ||
20487 | |||
20488 | if (canYFlip && !isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) { | ||
20489 | fail = 1; | ||
20490 | points = _newPoints; | ||
20491 | offset = _newOffset; | ||
20492 | targetOffset = _newTargetOffset; | ||
20493 | realYRegion = YRegionReversal; | ||
20494 | } | ||
20495 | } | ||
20496 | } | ||
20497 | |||
20498 | // 如果失败,重新计算当前节点将要被放置的位置 | ||
20499 | if (fail) { | ||
20500 | elFuturePos = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__getElFuturePos__["a" /* default */])(elRegion, refNodeRegion, points, offset, targetOffset); | ||
20501 | __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].mix(newElRegion, elFuturePos); | ||
20502 | } | ||
20503 | |||
20504 | newOverflowCfg.resizeHeight = overflow.resizeHeight; | ||
20505 | newOverflowCfg.resizeWidth = overflow.resizeWidth; | ||
20506 | // 检查反下后的位置是否可以放下了 | ||
20507 | // 如果仍然放不下只有指定了可以调整当前方向才调整 | ||
20508 | newOverflowCfg.adjustX = overflow.adjustX && isFailX(elFuturePos, elRegion, realXRegion); | ||
20509 | |||
20510 | newOverflowCfg.adjustY = overflow.adjustY && isFailY(elFuturePos, elRegion, realYRegion); | ||
20511 | |||
20512 | // 确实要调整,甚至可能会调整高度宽度 | ||
20513 | if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) { | ||
20514 | newElRegion = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__adjustForViewport__["a" /* default */])(elFuturePos, elRegion, realXRegion, realYRegion, newOverflowCfg); | ||
20515 | } | ||
20516 | } | ||
20517 | |||
20518 | // need judge to in case set fixed with in css on height auto element | ||
20519 | if (newElRegion.width !== elRegion.width) { | ||
20520 | __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].css(source, 'width', __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].width(source) + newElRegion.width - elRegion.width); | ||
20521 | } | ||
20522 | |||
20523 | if (newElRegion.height !== elRegion.height) { | ||
20524 | __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].css(source, 'height', __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].height(source) + newElRegion.height - elRegion.height); | ||
20525 | } | ||
20526 | |||
20527 | // https://github.com/kissyteam/kissy/issues/190 | ||
20528 | // 相对于屏幕位置没变,而 left/top 变了 | ||
20529 | // 例如 <div 'relative'><el absolute></div> | ||
20530 | __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* default */].offset(source, { | ||
20531 | left: newElRegion.left, | ||
20532 | top: newElRegion.top | ||
20533 | }, { | ||
20534 | useCssRight: align.useCssRight, | ||
20535 | useCssBottom: align.useCssBottom, | ||
20536 | useCssTransform: align.useCssTransform | ||
20537 | }); | ||
20538 | |||
20539 | return { | ||
20540 | points: points, | ||
20541 | offset: offset, | ||
20542 | targetOffset: targetOffset, | ||
20543 | overflow: newOverflowCfg | ||
20544 | }; | ||
20545 | } | ||
20546 | |||
20547 | domAlign.__getOffsetParent = __WEBPACK_IMPORTED_MODULE_1__getOffsetParent__["a" /* default */]; | ||
20548 | |||
20549 | domAlign.__getVisibleRectForElement = __WEBPACK_IMPORTED_MODULE_2__getVisibleRectForElement__["a" /* default */]; | ||
20550 | |||
20551 | /* harmony default export */ __webpack_exports__["default"] = (domAlign); | ||
20552 | /** | ||
20553 | * 2012-04-26 yiminghe@gmail.com | ||
20554 | * - 优化智能对齐算法 | ||
20555 | * - 慎用 resizeXX | ||
20556 | * | ||
20557 | * 2011-07-13 yiminghe@gmail.com note: | ||
20558 | * - 增加智能对齐,以及大小调整选项 | ||
20559 | **/ | ||
20560 | |||
20561 | /***/ }), | ||
20562 | /* 211 */ | ||
20563 | /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
20564 | |||
20565 | "use strict"; | ||
20566 | /* harmony export (immutable) */ __webpack_exports__["e"] = getTransformName; | ||
20567 | /* harmony export (immutable) */ __webpack_exports__["b"] = setTransitionProperty; | ||
20568 | /* harmony export (immutable) */ __webpack_exports__["a"] = getTransitionProperty; | ||
20569 | /* harmony export (immutable) */ __webpack_exports__["c"] = getTransformXY; | ||
20570 | /* harmony export (immutable) */ __webpack_exports__["d"] = setTransformXY; | ||
20571 | var vendorPrefix = void 0; | ||
20572 | |||
20573 | var jsCssMap = { | ||
20574 | Webkit: '-webkit-', | ||
20575 | Moz: '-moz-', | ||
20576 | // IE did it wrong again ... | ||
20577 | ms: '-ms-', | ||
20578 | O: '-o-' | ||
20579 | }; | ||
20580 | |||
20581 | function getVendorPrefix() { | ||
20582 | if (vendorPrefix !== undefined) { | ||
20583 | return vendorPrefix; | ||
20584 | } | ||
20585 | vendorPrefix = ''; | ||
20586 | var style = document.createElement('p').style; | ||
20587 | var testProp = 'Transform'; | ||
20588 | for (var key in jsCssMap) { | ||
20589 | if (key + testProp in style) { | ||
20590 | vendorPrefix = key; | ||
20591 | } | ||
20592 | } | ||
20593 | return vendorPrefix; | ||
20594 | } | ||
20595 | |||
20596 | function getTransitionName() { | ||
20597 | return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty'; | ||
20598 | } | ||
20599 | |||
20600 | function getTransformName() { | ||
20601 | return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform'; | ||
20602 | } | ||
20603 | |||
20604 | function setTransitionProperty(node, value) { | ||
20605 | var name = getTransitionName(); | ||
20606 | if (name) { | ||
20607 | node.style[name] = value; | ||
20608 | if (name !== 'transitionProperty') { | ||
20609 | node.style.transitionProperty = value; | ||
20610 | } | ||
20611 | } | ||
20612 | } | ||
20613 | |||
20614 | function setTransform(node, value) { | ||
20615 | var name = getTransformName(); | ||
20616 | if (name) { | ||
20617 | node.style[name] = value; | ||
20618 | if (name !== 'transform') { | ||
20619 | node.style.transform = value; | ||
20620 | } | ||
20621 | } | ||
20622 | } | ||
20623 | |||
20624 | function getTransitionProperty(node) { | ||
20625 | return node.style.transitionProperty || node.style[getTransitionName()]; | ||
20626 | } | ||
20627 | |||
20628 | function getTransformXY(node) { | ||
20629 | var style = window.getComputedStyle(node, null); | ||
20630 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName()); | ||
20631 | if (transform && transform !== 'none') { | ||
20632 | var matrix = transform.replace(/[^0-9\-.,]/g, '').split(','); | ||
20633 | return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) }; | ||
20634 | } | ||
20635 | return { | ||
20636 | x: 0, | ||
20637 | y: 0 | ||
20638 | }; | ||
20639 | } | ||
20640 | |||
20641 | var matrix2d = /matrix\((.*)\)/; | ||
20642 | var matrix3d = /matrix3d\((.*)\)/; | ||
20643 | |||
20644 | function setTransformXY(node, xy) { | ||
20645 | var style = window.getComputedStyle(node, null); | ||
20646 | var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName()); | ||
20647 | if (transform && transform !== 'none') { | ||
20648 | var arr = void 0; | ||
20649 | var match2d = transform.match(matrix2d); | ||
20650 | if (match2d) { | ||
20651 | match2d = match2d[1]; | ||
20652 | arr = match2d.split(',').map(function (item) { | ||
20653 | return parseFloat(item, 10); | ||
20654 | }); | ||
20655 | arr[4] = xy.x; | ||
20656 | arr[5] = xy.y; | ||
20657 | setTransform(node, 'matrix(' + arr.join(',') + ')'); | ||
20658 | } else { | ||
20659 | var match3d = transform.match(matrix3d)[1]; | ||
20660 | arr = match3d.split(',').map(function (item) { | ||
20661 | return parseFloat(item, 10); | ||
20662 | }); | ||
20663 | arr[12] = xy.x; | ||
20664 | arr[13] = xy.y; | ||
20665 | setTransform(node, 'matrix3d(' + arr.join(',') + ')'); | ||
20666 | } | ||
20667 | } else { | ||
20668 | setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)'); | ||
20669 | } | ||
20670 | } | ||
20671 | |||
20672 | /***/ }), | ||
20673 | /* 212 */ | ||
20674 | /***/ (function(module, exports, __webpack_require__) { | ||
20675 | |||
20676 | "use strict"; | ||
20677 | |||
20678 | |||
20679 | /** | ||
20680 | * Copyright (c) 2013-present, Facebook, Inc. | ||
20681 | * All rights reserved. | ||
20682 | * | ||
20683 | * This source code is licensed under the BSD-style license found in the | ||
20684 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20685 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20686 | * | ||
20687 | * @typechecks | ||
20688 | */ | ||
20689 | |||
20690 | var _hyphenPattern = /-(.)/g; | ||
20691 | |||
20692 | /** | ||
20693 | * Camelcases a hyphenated string, for example: | ||
20694 | * | ||
20695 | * > camelize('background-color') | ||
20696 | * < "backgroundColor" | ||
20697 | * | ||
20698 | * @param {string} string | ||
20699 | * @return {string} | ||
20700 | */ | ||
20701 | function camelize(string) { | ||
20702 | return string.replace(_hyphenPattern, function (_, character) { | ||
20703 | return character.toUpperCase(); | ||
20704 | }); | ||
20705 | } | ||
20706 | |||
20707 | module.exports = camelize; | ||
20708 | |||
20709 | /***/ }), | ||
20710 | /* 213 */ | ||
20711 | /***/ (function(module, exports, __webpack_require__) { | ||
20712 | |||
20713 | "use strict"; | ||
20714 | /** | ||
20715 | * Copyright (c) 2013-present, Facebook, Inc. | ||
20716 | * All rights reserved. | ||
20717 | * | ||
20718 | * This source code is licensed under the BSD-style license found in the | ||
20719 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20720 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20721 | * | ||
20722 | * @typechecks | ||
20723 | */ | ||
20724 | |||
20725 | |||
20726 | |||
20727 | var camelize = __webpack_require__(212); | ||
20728 | |||
20729 | var msPattern = /^-ms-/; | ||
20730 | |||
20731 | /** | ||
20732 | * Camelcases a hyphenated CSS property name, for example: | ||
20733 | * | ||
20734 | * > camelizeStyleName('background-color') | ||
20735 | * < "backgroundColor" | ||
20736 | * > camelizeStyleName('-moz-transition') | ||
20737 | * < "MozTransition" | ||
20738 | * > camelizeStyleName('-ms-transition') | ||
20739 | * < "msTransition" | ||
20740 | * | ||
20741 | * As Andi Smith suggests | ||
20742 | * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix | ||
20743 | * is converted to lowercase `ms`. | ||
20744 | * | ||
20745 | * @param {string} string | ||
20746 | * @return {string} | ||
20747 | */ | ||
20748 | function camelizeStyleName(string) { | ||
20749 | return camelize(string.replace(msPattern, 'ms-')); | ||
20750 | } | ||
20751 | |||
20752 | module.exports = camelizeStyleName; | ||
20753 | |||
20754 | /***/ }), | ||
20755 | /* 214 */ | ||
20756 | /***/ (function(module, exports, __webpack_require__) { | ||
20757 | |||
20758 | "use strict"; | ||
20759 | |||
20760 | |||
20761 | /** | ||
20762 | * Copyright (c) 2013-present, Facebook, Inc. | ||
20763 | * All rights reserved. | ||
20764 | * | ||
20765 | * This source code is licensed under the BSD-style license found in the | ||
20766 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20767 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20768 | * | ||
20769 | * | ||
20770 | */ | ||
20771 | |||
20772 | var isTextNode = __webpack_require__(222); | ||
20773 | |||
20774 | /*eslint-disable no-bitwise */ | ||
20775 | |||
20776 | /** | ||
20777 | * Checks if a given DOM node contains or is another DOM node. | ||
20778 | */ | ||
20779 | function containsNode(outerNode, innerNode) { | ||
20780 | if (!outerNode || !innerNode) { | ||
20781 | return false; | ||
20782 | } else if (outerNode === innerNode) { | ||
20783 | return true; | ||
20784 | } else if (isTextNode(outerNode)) { | ||
20785 | return false; | ||
20786 | } else if (isTextNode(innerNode)) { | ||
20787 | return containsNode(outerNode, innerNode.parentNode); | ||
20788 | } else if ('contains' in outerNode) { | ||
20789 | return outerNode.contains(innerNode); | ||
20790 | } else if (outerNode.compareDocumentPosition) { | ||
20791 | return !!(outerNode.compareDocumentPosition(innerNode) & 16); | ||
20792 | } else { | ||
20793 | return false; | ||
20794 | } | ||
20795 | } | ||
20796 | |||
20797 | module.exports = containsNode; | ||
20798 | |||
20799 | /***/ }), | ||
20800 | /* 215 */ | ||
20801 | /***/ (function(module, exports, __webpack_require__) { | ||
20802 | |||
20803 | "use strict"; | ||
20804 | /* WEBPACK VAR INJECTION */(function(process) { | ||
20805 | |||
20806 | /** | ||
20807 | * Copyright (c) 2013-present, Facebook, Inc. | ||
20808 | * All rights reserved. | ||
20809 | * | ||
20810 | * This source code is licensed under the BSD-style license found in the | ||
20811 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20812 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20813 | * | ||
20814 | * @typechecks | ||
20815 | */ | ||
20816 | |||
20817 | var invariant = __webpack_require__(1); | ||
20818 | |||
20819 | /** | ||
20820 | * Convert array-like objects to arrays. | ||
20821 | * | ||
20822 | * This API assumes the caller knows the contents of the data type. For less | ||
20823 | * well defined inputs use createArrayFromMixed. | ||
20824 | * | ||
20825 | * @param {object|function|filelist} obj | ||
20826 | * @return {array} | ||
20827 | */ | ||
20828 | function toArray(obj) { | ||
20829 | var length = obj.length; | ||
20830 | |||
20831 | // Some browsers builtin objects can report typeof 'function' (e.g. NodeList | ||
20832 | // in old versions of Safari). | ||
20833 | !(!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; | ||
20834 | |||
20835 | !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0; | ||
20836 | |||
20837 | !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0; | ||
20838 | |||
20839 | !(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; | ||
20840 | |||
20841 | // Old IE doesn't give collections access to hasOwnProperty. Assume inputs | ||
20842 | // without method will throw during the slice call and skip straight to the | ||
20843 | // fallback. | ||
20844 | if (obj.hasOwnProperty) { | ||
20845 | try { | ||
20846 | return Array.prototype.slice.call(obj); | ||
20847 | } catch (e) { | ||
20848 | // IE < 9 does not support Array#slice on collections objects | ||
20849 | } | ||
20850 | } | ||
20851 | |||
20852 | // Fall back to copying key by key. This assumes all keys have a value, | ||
20853 | // so will not preserve sparsely populated inputs. | ||
20854 | var ret = Array(length); | ||
20855 | for (var ii = 0; ii < length; ii++) { | ||
20856 | ret[ii] = obj[ii]; | ||
20857 | } | ||
20858 | return ret; | ||
20859 | } | ||
20860 | |||
20861 | /** | ||
20862 | * Perform a heuristic test to determine if an object is "array-like". | ||
20863 | * | ||
20864 | * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" | ||
20865 | * Joshu replied: "Mu." | ||
20866 | * | ||
20867 | * This function determines if its argument has "array nature": it returns | ||
20868 | * true if the argument is an actual array, an `arguments' object, or an | ||
20869 | * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). | ||
20870 | * | ||
20871 | * It will return false for other array-like objects like Filelist. | ||
20872 | * | ||
20873 | * @param {*} obj | ||
20874 | * @return {boolean} | ||
20875 | */ | ||
20876 | function hasArrayNature(obj) { | ||
20877 | return ( | ||
20878 | // not null/false | ||
20879 | !!obj && ( | ||
20880 | // arrays are objects, NodeLists are functions in Safari | ||
20881 | typeof obj == 'object' || typeof obj == 'function') && | ||
20882 | // quacks like an array | ||
20883 | 'length' in obj && | ||
20884 | // not window | ||
20885 | !('setInterval' in obj) && | ||
20886 | // no DOM node should be considered an array-like | ||
20887 | // a 'select' element has 'length' and 'item' properties on IE8 | ||
20888 | typeof obj.nodeType != 'number' && ( | ||
20889 | // a real array | ||
20890 | Array.isArray(obj) || | ||
20891 | // arguments | ||
20892 | 'callee' in obj || | ||
20893 | // HTMLCollection/NodeList | ||
20894 | 'item' in obj) | ||
20895 | ); | ||
20896 | } | ||
20897 | |||
20898 | /** | ||
20899 | * Ensure that the argument is an array by wrapping it in an array if it is not. | ||
20900 | * Creates a copy of the argument if it is already an array. | ||
20901 | * | ||
20902 | * This is mostly useful idiomatically: | ||
20903 | * | ||
20904 | * var createArrayFromMixed = require('createArrayFromMixed'); | ||
20905 | * | ||
20906 | * function takesOneOrMoreThings(things) { | ||
20907 | * things = createArrayFromMixed(things); | ||
20908 | * ... | ||
20909 | * } | ||
20910 | * | ||
20911 | * This allows you to treat `things' as an array, but accept scalars in the API. | ||
20912 | * | ||
20913 | * If you need to convert an array-like object, like `arguments`, into an array | ||
20914 | * use toArray instead. | ||
20915 | * | ||
20916 | * @param {*} obj | ||
20917 | * @return {array} | ||
20918 | */ | ||
20919 | function createArrayFromMixed(obj) { | ||
20920 | if (!hasArrayNature(obj)) { | ||
20921 | return [obj]; | ||
20922 | } else if (Array.isArray(obj)) { | ||
20923 | return obj.slice(); | ||
20924 | } else { | ||
20925 | return toArray(obj); | ||
20926 | } | ||
20927 | } | ||
20928 | |||
20929 | module.exports = createArrayFromMixed; | ||
20930 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
20931 | |||
20932 | /***/ }), | ||
20933 | /* 216 */ | ||
20934 | /***/ (function(module, exports, __webpack_require__) { | ||
20935 | |||
20936 | "use strict"; | ||
20937 | /* WEBPACK VAR INJECTION */(function(process) { | ||
20938 | |||
20939 | /** | ||
20940 | * Copyright (c) 2013-present, Facebook, Inc. | ||
20941 | * All rights reserved. | ||
20942 | * | ||
20943 | * This source code is licensed under the BSD-style license found in the | ||
20944 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20945 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20946 | * | ||
20947 | * @typechecks | ||
20948 | */ | ||
20949 | |||
20950 | /*eslint-disable fb-www/unsafe-html*/ | ||
20951 | |||
20952 | var ExecutionEnvironment = __webpack_require__(7); | ||
20953 | |||
20954 | var createArrayFromMixed = __webpack_require__(215); | ||
20955 | var getMarkupWrap = __webpack_require__(217); | ||
20956 | var invariant = __webpack_require__(1); | ||
20957 | |||
20958 | /** | ||
20959 | * Dummy container used to render all markup. | ||
20960 | */ | ||
20961 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; | ||
20962 | |||
20963 | /** | ||
20964 | * Pattern used by `getNodeName`. | ||
20965 | */ | ||
20966 | var nodeNamePattern = /^\s*<(\w+)/; | ||
20967 | |||
20968 | /** | ||
20969 | * Extracts the `nodeName` of the first element in a string of markup. | ||
20970 | * | ||
20971 | * @param {string} markup String of markup. | ||
20972 | * @return {?string} Node name of the supplied markup. | ||
20973 | */ | ||
20974 | function getNodeName(markup) { | ||
20975 | var nodeNameMatch = markup.match(nodeNamePattern); | ||
20976 | return nodeNameMatch && nodeNameMatch[1].toLowerCase(); | ||
20977 | } | ||
20978 | |||
20979 | /** | ||
20980 | * Creates an array containing the nodes rendered from the supplied markup. The | ||
20981 | * optionally supplied `handleScript` function will be invoked once for each | ||
20982 | * <script> element that is rendered. If no `handleScript` function is supplied, | ||
20983 | * an exception is thrown if any <script> elements are rendered. | ||
20984 | * | ||
20985 | * @param {string} markup A string of valid HTML markup. | ||
20986 | * @param {?function} handleScript Invoked once for each rendered <script>. | ||
20987 | * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes. | ||
20988 | */ | ||
20989 | function createNodesFromMarkup(markup, handleScript) { | ||
20990 | var node = dummyNode; | ||
20991 | !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0; | ||
20992 | var nodeName = getNodeName(markup); | ||
20993 | |||
20994 | var wrap = nodeName && getMarkupWrap(nodeName); | ||
20995 | if (wrap) { | ||
20996 | node.innerHTML = wrap[1] + markup + wrap[2]; | ||
20997 | |||
20998 | var wrapDepth = wrap[0]; | ||
20999 | while (wrapDepth--) { | ||
21000 | node = node.lastChild; | ||
21001 | } | ||
21002 | } else { | ||
21003 | node.innerHTML = markup; | ||
21004 | } | ||
21005 | |||
21006 | var scripts = node.getElementsByTagName('script'); | ||
21007 | if (scripts.length) { | ||
21008 | !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0; | ||
21009 | createArrayFromMixed(scripts).forEach(handleScript); | ||
21010 | } | ||
21011 | |||
21012 | var nodes = Array.from(node.childNodes); | ||
21013 | while (node.lastChild) { | ||
21014 | node.removeChild(node.lastChild); | ||
21015 | } | ||
21016 | return nodes; | ||
21017 | } | ||
21018 | |||
21019 | module.exports = createNodesFromMarkup; | ||
21020 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
21021 | |||
21022 | /***/ }), | ||
21023 | /* 217 */ | ||
21024 | /***/ (function(module, exports, __webpack_require__) { | ||
21025 | |||
21026 | "use strict"; | ||
21027 | /* WEBPACK VAR INJECTION */(function(process) { | ||
21028 | |||
21029 | /** | ||
21030 | * Copyright (c) 2013-present, Facebook, Inc. | ||
21031 | * All rights reserved. | ||
21032 | * | ||
21033 | * This source code is licensed under the BSD-style license found in the | ||
21034 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21035 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21036 | * | ||
21037 | */ | ||
21038 | |||
21039 | /*eslint-disable fb-www/unsafe-html */ | ||
21040 | |||
21041 | var ExecutionEnvironment = __webpack_require__(7); | ||
21042 | |||
21043 | var invariant = __webpack_require__(1); | ||
21044 | |||
21045 | /** | ||
21046 | * Dummy container used to detect which wraps are necessary. | ||
21047 | */ | ||
21048 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; | ||
21049 | |||
21050 | /** | ||
21051 | * Some browsers cannot use `innerHTML` to render certain elements standalone, | ||
21052 | * so we wrap them, render the wrapped nodes, then extract the desired node. | ||
21053 | * | ||
21054 | * In IE8, certain elements cannot render alone, so wrap all elements ('*'). | ||
21055 | */ | ||
21056 | |||
21057 | var shouldWrap = {}; | ||
21058 | |||
21059 | var selectWrap = [1, '<select multiple="true">', '</select>']; | ||
21060 | var tableWrap = [1, '<table>', '</table>']; | ||
21061 | var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>']; | ||
21062 | |||
21063 | var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>']; | ||
21064 | |||
21065 | var markupWrap = { | ||
21066 | '*': [1, '?<div>', '</div>'], | ||
21067 | |||
21068 | 'area': [1, '<map>', '</map>'], | ||
21069 | 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'], | ||
21070 | 'legend': [1, '<fieldset>', '</fieldset>'], | ||
21071 | 'param': [1, '<object>', '</object>'], | ||
21072 | 'tr': [2, '<table><tbody>', '</tbody></table>'], | ||
21073 | |||
21074 | 'optgroup': selectWrap, | ||
21075 | 'option': selectWrap, | ||
21076 | |||
21077 | 'caption': tableWrap, | ||
21078 | 'colgroup': tableWrap, | ||
21079 | 'tbody': tableWrap, | ||
21080 | 'tfoot': tableWrap, | ||
21081 | 'thead': tableWrap, | ||
21082 | |||
21083 | 'td': trWrap, | ||
21084 | 'th': trWrap | ||
21085 | }; | ||
21086 | |||
21087 | // Initialize the SVG elements since we know they'll always need to be wrapped | ||
21088 | // consistently. If they are created inside a <div> they will be initialized in | ||
21089 | // the wrong namespace (and will not display). | ||
21090 | var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan']; | ||
21091 | svgElements.forEach(function (nodeName) { | ||
21092 | markupWrap[nodeName] = svgWrap; | ||
21093 | shouldWrap[nodeName] = true; | ||
21094 | }); | ||
21095 | |||
21096 | /** | ||
21097 | * Gets the markup wrap configuration for the supplied `nodeName`. | ||
21098 | * | ||
21099 | * NOTE: This lazily detects which wraps are necessary for the current browser. | ||
21100 | * | ||
21101 | * @param {string} nodeName Lowercase `nodeName`. | ||
21102 | * @return {?array} Markup wrap configuration, if applicable. | ||
21103 | */ | ||
21104 | function getMarkupWrap(nodeName) { | ||
21105 | !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0; | ||
21106 | if (!markupWrap.hasOwnProperty(nodeName)) { | ||
21107 | nodeName = '*'; | ||
21108 | } | ||
21109 | if (!shouldWrap.hasOwnProperty(nodeName)) { | ||
21110 | if (nodeName === '*') { | ||
21111 | dummyNode.innerHTML = '<link />'; | ||
21112 | } else { | ||
21113 | dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>'; | ||
21114 | } | ||
21115 | shouldWrap[nodeName] = !dummyNode.firstChild; | ||
21116 | } | ||
21117 | return shouldWrap[nodeName] ? markupWrap[nodeName] : null; | ||
21118 | } | ||
21119 | |||
21120 | module.exports = getMarkupWrap; | ||
21121 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
21122 | |||
21123 | /***/ }), | ||
21124 | /* 218 */ | ||
21125 | /***/ (function(module, exports, __webpack_require__) { | ||
21126 | |||
21127 | "use strict"; | ||
21128 | /** | ||
21129 | * Copyright (c) 2013-present, Facebook, Inc. | ||
21130 | * All rights reserved. | ||
21131 | * | ||
21132 | * This source code is licensed under the BSD-style license found in the | ||
21133 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21134 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21135 | * | ||
21136 | * @typechecks | ||
21137 | */ | ||
21138 | |||
21139 | |||
21140 | |||
21141 | /** | ||
21142 | * Gets the scroll position of the supplied element or window. | ||
21143 | * | ||
21144 | * The return values are unbounded, unlike `getScrollPosition`. This means they | ||
21145 | * may be negative or exceed the element boundaries (which is possible using | ||
21146 | * inertial scrolling). | ||
21147 | * | ||
21148 | * @param {DOMWindow|DOMElement} scrollable | ||
21149 | * @return {object} Map with `x` and `y` keys. | ||
21150 | */ | ||
21151 | |||
21152 | function getUnboundedScrollPosition(scrollable) { | ||
21153 | if (scrollable.Window && scrollable instanceof scrollable.Window) { | ||
21154 | return { | ||
21155 | x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft, | ||
21156 | y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop | ||
21157 | }; | ||
21158 | } | ||
21159 | return { | ||
21160 | x: scrollable.scrollLeft, | ||
21161 | y: scrollable.scrollTop | ||
21162 | }; | ||
21163 | } | ||
21164 | |||
21165 | module.exports = getUnboundedScrollPosition; | ||
21166 | |||
21167 | /***/ }), | ||
21168 | /* 219 */ | ||
21169 | /***/ (function(module, exports, __webpack_require__) { | ||
21170 | |||
21171 | "use strict"; | ||
21172 | |||
21173 | |||
21174 | /** | ||
21175 | * Copyright (c) 2013-present, Facebook, Inc. | ||
21176 | * All rights reserved. | ||
21177 | * | ||
21178 | * This source code is licensed under the BSD-style license found in the | ||
21179 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21180 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21181 | * | ||
21182 | * @typechecks | ||
21183 | */ | ||
21184 | |||
21185 | var _uppercasePattern = /([A-Z])/g; | ||
21186 | |||
21187 | /** | ||
21188 | * Hyphenates a camelcased string, for example: | ||
21189 | * | ||
21190 | * > hyphenate('backgroundColor') | ||
21191 | * < "background-color" | ||
21192 | * | ||
21193 | * For CSS style names, use `hyphenateStyleName` instead which works properly | ||
21194 | * with all vendor prefixes, including `ms`. | ||
21195 | * | ||
21196 | * @param {string} string | ||
21197 | * @return {string} | ||
21198 | */ | ||
21199 | function hyphenate(string) { | ||
21200 | return string.replace(_uppercasePattern, '-$1').toLowerCase(); | ||
21201 | } | ||
21202 | |||
21203 | module.exports = hyphenate; | ||
21204 | |||
21205 | /***/ }), | ||
21206 | /* 220 */ | ||
21207 | /***/ (function(module, exports, __webpack_require__) { | ||
21208 | |||
21209 | "use strict"; | ||
21210 | /** | ||
21211 | * Copyright (c) 2013-present, Facebook, Inc. | ||
21212 | * All rights reserved. | ||
21213 | * | ||
21214 | * This source code is licensed under the BSD-style license found in the | ||
21215 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21216 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21217 | * | ||
21218 | * @typechecks | ||
21219 | */ | ||
21220 | |||
21221 | |||
21222 | |||
21223 | var hyphenate = __webpack_require__(219); | ||
21224 | |||
21225 | var msPattern = /^ms-/; | ||
21226 | |||
21227 | /** | ||
21228 | * Hyphenates a camelcased CSS property name, for example: | ||
21229 | * | ||
21230 | * > hyphenateStyleName('backgroundColor') | ||
21231 | * < "background-color" | ||
21232 | * > hyphenateStyleName('MozTransition') | ||
21233 | * < "-moz-transition" | ||
21234 | * > hyphenateStyleName('msTransition') | ||
21235 | * < "-ms-transition" | ||
21236 | * | ||
21237 | * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix | ||
21238 | * is converted to `-ms-`. | ||
21239 | * | ||
21240 | * @param {string} string | ||
21241 | * @return {string} | ||
21242 | */ | ||
21243 | function hyphenateStyleName(string) { | ||
21244 | return hyphenate(string).replace(msPattern, '-ms-'); | ||
21245 | } | ||
21246 | |||
21247 | module.exports = hyphenateStyleName; | ||
21248 | |||
21249 | /***/ }), | ||
21250 | /* 221 */ | ||
21251 | /***/ (function(module, exports, __webpack_require__) { | ||
21252 | |||
21253 | "use strict"; | ||
21254 | |||
21255 | |||
21256 | /** | ||
21257 | * Copyright (c) 2013-present, Facebook, Inc. | ||
21258 | * All rights reserved. | ||
21259 | * | ||
21260 | * This source code is licensed under the BSD-style license found in the | ||
21261 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21262 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21263 | * | ||
21264 | * @typechecks | ||
21265 | */ | ||
21266 | |||
21267 | /** | ||
21268 | * @param {*} object The object to check. | ||
21269 | * @return {boolean} Whether or not the object is a DOM node. | ||
21270 | */ | ||
21271 | function isNode(object) { | ||
21272 | var doc = object ? object.ownerDocument || object : document; | ||
21273 | var defaultView = doc.defaultView || window; | ||
21274 | return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); | ||
21275 | } | ||
21276 | |||
21277 | module.exports = isNode; | ||
21278 | |||
21279 | /***/ }), | ||
21280 | /* 222 */ | ||
21281 | /***/ (function(module, exports, __webpack_require__) { | ||
21282 | |||
21283 | "use strict"; | ||
21284 | |||
21285 | |||
21286 | /** | ||
21287 | * Copyright (c) 2013-present, Facebook, Inc. | ||
21288 | * All rights reserved. | ||
21289 | * | ||
21290 | * This source code is licensed under the BSD-style license found in the | ||
21291 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21292 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21293 | * | ||
21294 | * @typechecks | ||
21295 | */ | ||
21296 | |||
21297 | var isNode = __webpack_require__(221); | ||
21298 | |||
21299 | /** | ||
21300 | * @param {*} object The object to check. | ||
21301 | * @return {boolean} Whether or not the object is a DOM text node. | ||
21302 | */ | ||
21303 | function isTextNode(object) { | ||
21304 | return isNode(object) && object.nodeType == 3; | ||
21305 | } | ||
21306 | |||
21307 | module.exports = isTextNode; | ||
21308 | |||
21309 | /***/ }), | ||
21310 | /* 223 */ | ||
21311 | /***/ (function(module, exports, __webpack_require__) { | ||
21312 | |||
21313 | "use strict"; | ||
21314 | /** | ||
21315 | * Copyright (c) 2013-present, Facebook, Inc. | ||
21316 | * All rights reserved. | ||
21317 | * | ||
21318 | * This source code is licensed under the BSD-style license found in the | ||
21319 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21320 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21321 | * | ||
21322 | * | ||
21323 | * @typechecks static-only | ||
21324 | */ | ||
21325 | |||
21326 | |||
21327 | |||
21328 | /** | ||
21329 | * Memoizes the return value of a function that accepts one string argument. | ||
21330 | */ | ||
21331 | |||
21332 | function memoizeStringOnly(callback) { | ||
21333 | var cache = {}; | ||
21334 | return function (string) { | ||
21335 | if (!cache.hasOwnProperty(string)) { | ||
21336 | cache[string] = callback.call(this, string); | ||
21337 | } | ||
21338 | return cache[string]; | ||
21339 | }; | ||
21340 | } | ||
21341 | |||
21342 | module.exports = memoizeStringOnly; | ||
21343 | |||
21344 | /***/ }), | ||
21345 | /* 224 */ | ||
21346 | /***/ (function(module, exports, __webpack_require__) { | ||
21347 | |||
21348 | "use strict"; | ||
21349 | /** | ||
21350 | * Copyright (c) 2013-present, Facebook, Inc. | ||
21351 | * All rights reserved. | ||
21352 | * | ||
21353 | * This source code is licensed under the BSD-style license found in the | ||
21354 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21355 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21356 | * | ||
21357 | * @typechecks | ||
21358 | */ | ||
21359 | |||
21360 | |||
21361 | |||
21362 | var ExecutionEnvironment = __webpack_require__(7); | ||
21363 | |||
21364 | var performance; | ||
21365 | |||
21366 | if (ExecutionEnvironment.canUseDOM) { | ||
21367 | performance = window.performance || window.msPerformance || window.webkitPerformance; | ||
21368 | } | ||
21369 | |||
21370 | module.exports = performance || {}; | ||
21371 | |||
21372 | /***/ }), | ||
21373 | /* 225 */ | ||
21374 | /***/ (function(module, exports, __webpack_require__) { | ||
21375 | |||
21376 | "use strict"; | ||
21377 | |||
21378 | |||
21379 | /** | ||
21380 | * Copyright (c) 2013-present, Facebook, Inc. | ||
21381 | * All rights reserved. | ||
21382 | * | ||
21383 | * This source code is licensed under the BSD-style license found in the | ||
21384 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21385 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21386 | * | ||
21387 | * @typechecks | ||
21388 | */ | ||
21389 | |||
21390 | var performance = __webpack_require__(224); | ||
21391 | |||
21392 | var performanceNow; | ||
21393 | |||
21394 | /** | ||
21395 | * Detect if we can use `window.performance.now()` and gracefully fallback to | ||
21396 | * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now | ||
21397 | * because of Facebook's testing infrastructure. | ||
21398 | */ | ||
21399 | if (performance.now) { | ||
21400 | performanceNow = function performanceNow() { | ||
21401 | return performance.now(); | ||
21402 | }; | ||
21403 | } else { | ||
21404 | performanceNow = function performanceNow() { | ||
21405 | return Date.now(); | ||
21406 | }; | ||
21407 | } | ||
21408 | |||
21409 | module.exports = performanceNow; | ||
21410 | |||
21411 | /***/ }), | ||
21412 | /* 226 */ | ||
21413 | /***/ (function(module, exports, __webpack_require__) { | ||
21414 | |||
21415 | "use strict"; | ||
21416 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
21417 | * Copyright 2013-present, Facebook, Inc. | ||
21418 | * All rights reserved. | ||
21419 | * | ||
21420 | * This source code is licensed under the BSD-style license found in the | ||
21421 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21422 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21423 | */ | ||
21424 | |||
21425 | |||
21426 | |||
21427 | if (process.env.NODE_ENV !== 'production') { | ||
21428 | var invariant = __webpack_require__(1); | ||
21429 | var warning = __webpack_require__(2); | ||
21430 | var ReactPropTypesSecret = __webpack_require__(74); | ||
21431 | var loggedTypeFailures = {}; | ||
21432 | } | ||
21433 | |||
21434 | /** | ||
21435 | * Assert that the values match with the type specs. | ||
21436 | * Error messages are memorized and will only be shown once. | ||
21437 | * | ||
21438 | * @param {object} typeSpecs Map of name to a ReactPropType | ||
21439 | * @param {object} values Runtime values that need to be type-checked | ||
21440 | * @param {string} location e.g. "prop", "context", "child context" | ||
21441 | * @param {string} componentName Name of the component for error messages. | ||
21442 | * @param {?Function} getStack Returns the component stack. | ||
21443 | * @private | ||
21444 | */ | ||
21445 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) { | ||
21446 | if (process.env.NODE_ENV !== 'production') { | ||
21447 | for (var typeSpecName in typeSpecs) { | ||
21448 | if (typeSpecs.hasOwnProperty(typeSpecName)) { | ||
21449 | var error; | ||
21450 | // Prop type validation may throw. In case they do, we don't want to | ||
21451 | // fail the render phase where it didn't fail before. So we log it. | ||
21452 | // After these have been cleaned up, we'll let them throw. | ||
21453 | try { | ||
21454 | // This is intentionally an invariant that gets caught. It's the same | ||
21455 | // behavior as without this statement except with a better message. | ||
21456 | 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); | ||
21457 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); | ||
21458 | } catch (ex) { | ||
21459 | error = ex; | ||
21460 | } | ||
21461 | 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); | ||
21462 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
21463 | // Only monitor this failure once because there tends to be a lot of the | ||
21464 | // same error. | ||
21465 | loggedTypeFailures[error.message] = true; | ||
21466 | |||
21467 | var stack = getStack ? getStack() : ''; | ||
21468 | |||
21469 | warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); | ||
21470 | } | ||
21471 | } | ||
21472 | } | ||
21473 | } | ||
21474 | } | ||
21475 | |||
21476 | module.exports = checkPropTypes; | ||
21477 | |||
21478 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
21479 | |||
21480 | /***/ }), | ||
21481 | /* 227 */ | ||
21482 | /***/ (function(module, exports, __webpack_require__) { | ||
21483 | |||
21484 | "use strict"; | ||
21485 | /** | ||
21486 | * Copyright 2013-present, Facebook, Inc. | ||
21487 | * All rights reserved. | ||
21488 | * | ||
21489 | * This source code is licensed under the BSD-style license found in the | ||
21490 | * LICENSE file in the root directory of this source tree. An additional grant | ||
21491 | * of patent rights can be found in the PATENTS file in the same directory. | ||
21492 | */ | ||
21493 | |||
21494 | |||
21495 | |||
21496 | var emptyFunction = __webpack_require__(10); | ||
21497 | var invariant = __webpack_require__(1); | ||
21498 | var ReactPropTypesSecret = __webpack_require__(74); | ||
21499 | |||
21500 | module.exports = function() { | ||
21501 | function shim(props, propName, componentName, location, propFullName, secret) { | ||
21502 | if (secret === ReactPropTypesSecret) { | ||
21503 | // It is still safe when called from React. | ||
21504 | return; | ||
21505 | } | ||
21506 | invariant( | ||
21507 | false, | ||
21508 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | ||
21509 | 'Use PropTypes.checkPropTypes() to call them. ' + | ||
21510 | 'Read more at http://fb.me/use-check-prop-types' | ||
21511 | ); | ||
21512 | }; | ||
21513 | shim.isRequired = shim; | ||
21514 | function getShim() { | ||
21515 | return shim; | ||
21516 | }; | ||
21517 | // Important! | ||
21518 | // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. | ||
21519 | var ReactPropTypes = { | ||
21520 | array: shim, | ||
21521 | bool: shim, | ||
21522 | func: shim, | ||
21523 | number: shim, | ||
21524 | object: shim, | ||
21525 | string: shim, | ||
21526 | symbol: shim, | ||
21527 | |||
21528 | any: shim, | ||
21529 | arrayOf: getShim, | ||
21530 | element: shim, | ||
21531 | instanceOf: getShim, | ||
21532 | node: shim, | ||
21533 | objectOf: getShim, | ||
21534 | oneOf: getShim, | ||
21535 | oneOfType: getShim, | ||
21536 | shape: getShim | ||
21537 | }; | ||
21538 | |||
21539 | ReactPropTypes.checkPropTypes = emptyFunction; | ||
21540 | ReactPropTypes.PropTypes = ReactPropTypes; | ||
21541 | |||
21542 | return ReactPropTypes; | ||
21543 | }; | ||
21544 | |||
21545 | |||
21546 | /***/ }), | ||
21547 | /* 228 */ | ||
21548 | /***/ (function(module, exports, __webpack_require__) { | ||
21549 | |||
21550 | "use strict"; | ||
21551 | |||
21552 | |||
21553 | Object.defineProperty(exports, "__esModule", { | ||
21554 | value: true | ||
21555 | }); | ||
21556 | |||
21557 | var _react = __webpack_require__(5); | ||
21558 | |||
21559 | var _react2 = _interopRequireDefault(_react); | ||
21560 | |||
21561 | var _propTypes = __webpack_require__(11); | ||
21562 | |||
21563 | var _propTypes2 = _interopRequireDefault(_propTypes); | ||
21564 | |||
21565 | var _reactDom = __webpack_require__(8); | ||
21566 | |||
21567 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
21568 | |||
21569 | var _domAlign = __webpack_require__(210); | ||
21570 | |||
21571 | var _domAlign2 = _interopRequireDefault(_domAlign); | ||
21572 | |||
21573 | var _addEventListener = __webpack_require__(117); | ||
21574 | |||
21575 | var _addEventListener2 = _interopRequireDefault(_addEventListener); | ||
21576 | |||
21577 | var _isWindow = __webpack_require__(230); | ||
21578 | |||
21579 | var _isWindow2 = _interopRequireDefault(_isWindow); | ||
21580 | |||
21581 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
21582 | |||
21583 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
21584 | |||
21585 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
21586 | |||
21587 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
21588 | |||
21589 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } | ||
21590 | |||
21591 | function buffer(fn, ms) { | ||
21592 | var timer = void 0; | ||
21593 | |||
21594 | function clear() { | ||
21595 | if (timer) { | ||
21596 | clearTimeout(timer); | ||
21597 | timer = null; | ||
21598 | } | ||
21599 | } | ||
21600 | |||
21601 | function bufferFn() { | ||
21602 | clear(); | ||
21603 | timer = setTimeout(fn, ms); | ||
21604 | } | ||
21605 | |||
21606 | bufferFn.clear = clear; | ||
21607 | |||
21608 | return bufferFn; | ||
21609 | } | ||
21610 | |||
21611 | var Align = function (_Component) { | ||
21612 | _inherits(Align, _Component); | ||
21613 | |||
21614 | function Align() { | ||
21615 | var _temp, _this, _ret; | ||
21616 | |||
21617 | _classCallCheck(this, Align); | ||
21618 | |||
21619 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
21620 | args[_key] = arguments[_key]; | ||
21621 | } | ||
21622 | |||
21623 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.forceAlign = function () { | ||
21624 | var props = _this.props; | ||
21625 | if (!props.disabled) { | ||
21626 | var source = _reactDom2["default"].findDOMNode(_this); | ||
21627 | props.onAlign(source, (0, _domAlign2["default"])(source, props.target(), props.align)); | ||
21628 | } | ||
21629 | }, _temp), _possibleConstructorReturn(_this, _ret); | ||
21630 | } | ||
21631 | |||
21632 | Align.prototype.componentDidMount = function componentDidMount() { | ||
21633 | var props = this.props; | ||
21634 | // if parent ref not attached .... use document.getElementById | ||
21635 | this.forceAlign(); | ||
21636 | if (!props.disabled && props.monitorWindowResize) { | ||
21637 | this.startMonitorWindowResize(); | ||
21638 | } | ||
21639 | }; | ||
21640 | |||
21641 | Align.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
21642 | var reAlign = false; | ||
21643 | var props = this.props; | ||
21644 | |||
21645 | if (!props.disabled) { | ||
21646 | if (prevProps.disabled || prevProps.align !== props.align) { | ||
21647 | reAlign = true; | ||
21648 | } else { | ||
21649 | var lastTarget = prevProps.target(); | ||
21650 | var currentTarget = props.target(); | ||
21651 | if ((0, _isWindow2["default"])(lastTarget) && (0, _isWindow2["default"])(currentTarget)) { | ||
21652 | reAlign = false; | ||
21653 | } else if (lastTarget !== currentTarget) { | ||
21654 | reAlign = true; | ||
21655 | } | ||
21656 | } | ||
21657 | } | ||
21658 | |||
21659 | if (reAlign) { | ||
21660 | this.forceAlign(); | ||
21661 | } | ||
21662 | |||
21663 | if (props.monitorWindowResize && !props.disabled) { | ||
21664 | this.startMonitorWindowResize(); | ||
21665 | } else { | ||
21666 | this.stopMonitorWindowResize(); | ||
21667 | } | ||
21668 | }; | ||
21669 | |||
21670 | Align.prototype.componentWillUnmount = function componentWillUnmount() { | ||
21671 | this.stopMonitorWindowResize(); | ||
21672 | }; | ||
21673 | |||
21674 | Align.prototype.startMonitorWindowResize = function startMonitorWindowResize() { | ||
21675 | if (!this.resizeHandler) { | ||
21676 | this.bufferMonitor = buffer(this.forceAlign, this.props.monitorBufferTime); | ||
21677 | this.resizeHandler = (0, _addEventListener2["default"])(window, 'resize', this.bufferMonitor); | ||
21678 | } | ||
21679 | }; | ||
21680 | |||
21681 | Align.prototype.stopMonitorWindowResize = function stopMonitorWindowResize() { | ||
21682 | if (this.resizeHandler) { | ||
21683 | this.bufferMonitor.clear(); | ||
21684 | this.resizeHandler.remove(); | ||
21685 | this.resizeHandler = null; | ||
21686 | } | ||
21687 | }; | ||
21688 | |||
21689 | Align.prototype.render = function render() { | ||
21690 | var _props = this.props, | ||
21691 | childrenProps = _props.childrenProps, | ||
21692 | children = _props.children; | ||
21693 | |||
21694 | var child = _react2["default"].Children.only(children); | ||
21695 | if (childrenProps) { | ||
21696 | var newProps = {}; | ||
21697 | for (var prop in childrenProps) { | ||
21698 | if (childrenProps.hasOwnProperty(prop)) { | ||
21699 | newProps[prop] = this.props[childrenProps[prop]]; | ||
21700 | } | ||
21701 | } | ||
21702 | return _react2["default"].cloneElement(child, newProps); | ||
21703 | } | ||
21704 | return child; | ||
21705 | }; | ||
21706 | |||
21707 | return Align; | ||
21708 | }(_react.Component); | ||
21709 | |||
21710 | Align.propTypes = { | ||
21711 | childrenProps: _propTypes2["default"].object, | ||
21712 | align: _propTypes2["default"].object.isRequired, | ||
21713 | target: _propTypes2["default"].func, | ||
21714 | onAlign: _propTypes2["default"].func, | ||
21715 | monitorBufferTime: _propTypes2["default"].number, | ||
21716 | monitorWindowResize: _propTypes2["default"].bool, | ||
21717 | disabled: _propTypes2["default"].bool, | ||
21718 | children: _propTypes2["default"].any | ||
21719 | }; | ||
21720 | Align.defaultProps = { | ||
21721 | target: function target() { | ||
21722 | return window; | ||
21723 | }, | ||
21724 | onAlign: function onAlign() {}, | ||
21725 | monitorBufferTime: 50, | ||
21726 | monitorWindowResize: false, | ||
21727 | disabled: false | ||
21728 | }; | ||
21729 | exports["default"] = Align; | ||
21730 | module.exports = exports['default']; | ||
21731 | |||
21732 | /***/ }), | ||
21733 | /* 229 */ | ||
21734 | /***/ (function(module, exports, __webpack_require__) { | ||
21735 | |||
21736 | "use strict"; | ||
21737 | |||
21738 | |||
21739 | Object.defineProperty(exports, "__esModule", { | ||
21740 | value: true | ||
21741 | }); | ||
21742 | |||
21743 | var _Align = __webpack_require__(228); | ||
21744 | |||
21745 | var _Align2 = _interopRequireDefault(_Align); | ||
21746 | |||
21747 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
21748 | |||
21749 | exports["default"] = _Align2["default"]; // export this package's api | ||
21750 | |||
21751 | module.exports = exports['default']; | ||
21752 | |||
21753 | /***/ }), | ||
21754 | /* 230 */ | ||
21755 | /***/ (function(module, exports, __webpack_require__) { | ||
21756 | |||
21757 | "use strict"; | ||
21758 | |||
21759 | |||
21760 | Object.defineProperty(exports, "__esModule", { | ||
21761 | value: true | ||
21762 | }); | ||
21763 | exports["default"] = isWindow; | ||
21764 | function isWindow(obj) { | ||
21765 | /* eslint no-eq-null: 0 */ | ||
21766 | /* eslint eqeqeq: 0 */ | ||
21767 | return obj != null && obj == obj.window; | ||
21768 | } | ||
21769 | module.exports = exports['default']; | ||
21770 | |||
21771 | /***/ }), | ||
21772 | /* 231 */ | ||
21773 | /***/ (function(module, exports, __webpack_require__) { | ||
21774 | |||
21775 | "use strict"; | ||
21776 | |||
21777 | |||
21778 | Object.defineProperty(exports, "__esModule", { | ||
21779 | value: true | ||
21780 | }); | ||
21781 | |||
21782 | 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; }; | ||
21783 | |||
21784 | var _react = __webpack_require__(5); | ||
21785 | |||
21786 | var _react2 = _interopRequireDefault(_react); | ||
21787 | |||
21788 | var _propTypes = __webpack_require__(11); | ||
21789 | |||
21790 | var _propTypes2 = _interopRequireDefault(_propTypes); | ||
21791 | |||
21792 | var _ChildrenUtils = __webpack_require__(233); | ||
21793 | |||
21794 | var _AnimateChild = __webpack_require__(232); | ||
21795 | |||
21796 | var _AnimateChild2 = _interopRequireDefault(_AnimateChild); | ||
21797 | |||
21798 | var _util = __webpack_require__(115); | ||
21799 | |||
21800 | var _util2 = _interopRequireDefault(_util); | ||
21801 | |||
21802 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
21803 | |||
21804 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
21805 | |||
21806 | 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; } | ||
21807 | |||
21808 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
21809 | |||
21810 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
21811 | |||
21812 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } | ||
21813 | |||
21814 | var defaultKey = 'rc_animate_' + Date.now(); | ||
21815 | |||
21816 | |||
21817 | function getChildrenFromProps(props) { | ||
21818 | var children = props.children; | ||
21819 | if (_react2["default"].isValidElement(children)) { | ||
21820 | if (!children.key) { | ||
21821 | return _react2["default"].cloneElement(children, { | ||
21822 | key: defaultKey | ||
21823 | }); | ||
21824 | } | ||
21825 | } | ||
21826 | return children; | ||
21827 | } | ||
21828 | |||
21829 | function noop() {} | ||
21830 | |||
21831 | var Animate = function (_React$Component) { | ||
21832 | _inherits(Animate, _React$Component); | ||
21833 | |||
21834 | function Animate(props) { | ||
21835 | _classCallCheck(this, Animate); | ||
21836 | |||
21837 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); | ||
21838 | |||
21839 | _initialiseProps.call(_this); | ||
21840 | |||
21841 | _this.currentlyAnimatingKeys = {}; | ||
21842 | _this.keysToEnter = []; | ||
21843 | _this.keysToLeave = []; | ||
21844 | |||
21845 | _this.state = { | ||
21846 | children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(_this.props)) | ||
21847 | }; | ||
21848 | return _this; | ||
21849 | } | ||
21850 | |||
21851 | Animate.prototype.componentDidMount = function componentDidMount() { | ||
21852 | var _this2 = this; | ||
21853 | |||
21854 | var showProp = this.props.showProp; | ||
21855 | var children = this.state.children; | ||
21856 | if (showProp) { | ||
21857 | children = children.filter(function (child) { | ||
21858 | return !!child.props[showProp]; | ||
21859 | }); | ||
21860 | } | ||
21861 | children.forEach(function (child) { | ||
21862 | if (child) { | ||
21863 | _this2.performAppear(child.key); | ||
21864 | } | ||
21865 | }); | ||
21866 | }; | ||
21867 | |||
21868 | Animate.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
21869 | var _this3 = this; | ||
21870 | |||
21871 | this.nextProps = nextProps; | ||
21872 | var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps)); | ||
21873 | var props = this.props; | ||
21874 | // exclusive needs immediate response | ||
21875 | if (props.exclusive) { | ||
21876 | Object.keys(this.currentlyAnimatingKeys).forEach(function (key) { | ||
21877 | _this3.stop(key); | ||
21878 | }); | ||
21879 | } | ||
21880 | var showProp = props.showProp; | ||
21881 | var currentlyAnimatingKeys = this.currentlyAnimatingKeys; | ||
21882 | // last props children if exclusive | ||
21883 | var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children; | ||
21884 | // in case destroy in showProp mode | ||
21885 | var newChildren = []; | ||
21886 | if (showProp) { | ||
21887 | currentChildren.forEach(function (currentChild) { | ||
21888 | var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key); | ||
21889 | var newChild = void 0; | ||
21890 | if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) { | ||
21891 | newChild = _react2["default"].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true)); | ||
21892 | } else { | ||
21893 | newChild = nextChild; | ||
21894 | } | ||
21895 | if (newChild) { | ||
21896 | newChildren.push(newChild); | ||
21897 | } | ||
21898 | }); | ||
21899 | nextChildren.forEach(function (nextChild) { | ||
21900 | if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) { | ||
21901 | newChildren.push(nextChild); | ||
21902 | } | ||
21903 | }); | ||
21904 | } else { | ||
21905 | newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren); | ||
21906 | } | ||
21907 | |||
21908 | // need render to avoid update | ||
21909 | this.setState({ | ||
21910 | children: newChildren | ||
21911 | }); | ||
21912 | |||
21913 | nextChildren.forEach(function (child) { | ||
21914 | var key = child && child.key; | ||
21915 | if (child && currentlyAnimatingKeys[key]) { | ||
21916 | return; | ||
21917 | } | ||
21918 | var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); | ||
21919 | if (showProp) { | ||
21920 | var showInNext = child.props[showProp]; | ||
21921 | if (hasPrev) { | ||
21922 | var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); | ||
21923 | if (!showInNow && showInNext) { | ||
21924 | _this3.keysToEnter.push(key); | ||
21925 | } | ||
21926 | } else if (showInNext) { | ||
21927 | _this3.keysToEnter.push(key); | ||
21928 | } | ||
21929 | } else if (!hasPrev) { | ||
21930 | _this3.keysToEnter.push(key); | ||
21931 | } | ||
21932 | }); | ||
21933 | |||
21934 | currentChildren.forEach(function (child) { | ||
21935 | var key = child && child.key; | ||
21936 | if (child && currentlyAnimatingKeys[key]) { | ||
21937 | return; | ||
21938 | } | ||
21939 | var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key); | ||
21940 | if (showProp) { | ||
21941 | var showInNow = child.props[showProp]; | ||
21942 | if (hasNext) { | ||
21943 | var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp); | ||
21944 | if (!showInNext && showInNow) { | ||
21945 | _this3.keysToLeave.push(key); | ||
21946 | } | ||
21947 | } else if (showInNow) { | ||
21948 | _this3.keysToLeave.push(key); | ||
21949 | } | ||
21950 | } else if (!hasNext) { | ||
21951 | _this3.keysToLeave.push(key); | ||
21952 | } | ||
21953 | }); | ||
21954 | }; | ||
21955 | |||
21956 | Animate.prototype.componentDidUpdate = function componentDidUpdate() { | ||
21957 | var keysToEnter = this.keysToEnter; | ||
21958 | this.keysToEnter = []; | ||
21959 | keysToEnter.forEach(this.performEnter); | ||
21960 | var keysToLeave = this.keysToLeave; | ||
21961 | this.keysToLeave = []; | ||
21962 | keysToLeave.forEach(this.performLeave); | ||
21963 | }; | ||
21964 | |||
21965 | Animate.prototype.isValidChildByKey = function isValidChildByKey(currentChildren, key) { | ||
21966 | var showProp = this.props.showProp; | ||
21967 | if (showProp) { | ||
21968 | return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); | ||
21969 | } | ||
21970 | return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); | ||
21971 | }; | ||
21972 | |||
21973 | Animate.prototype.stop = function stop(key) { | ||
21974 | delete this.currentlyAnimatingKeys[key]; | ||
21975 | var component = this.refs[key]; | ||
21976 | if (component) { | ||
21977 | component.stop(); | ||
21978 | } | ||
21979 | }; | ||
21980 | |||
21981 | Animate.prototype.render = function render() { | ||
21982 | var props = this.props; | ||
21983 | this.nextProps = props; | ||
21984 | var stateChildren = this.state.children; | ||
21985 | var children = null; | ||
21986 | if (stateChildren) { | ||
21987 | children = stateChildren.map(function (child) { | ||
21988 | if (child === null || child === undefined) { | ||
21989 | return child; | ||
21990 | } | ||
21991 | if (!child.key) { | ||
21992 | throw new Error('must set key for <rc-animate> children'); | ||
21993 | } | ||
21994 | return _react2["default"].createElement( | ||
21995 | _AnimateChild2["default"], | ||
21996 | { | ||
21997 | key: child.key, | ||
21998 | ref: child.key, | ||
21999 | animation: props.animation, | ||
22000 | transitionName: props.transitionName, | ||
22001 | transitionEnter: props.transitionEnter, | ||
22002 | transitionAppear: props.transitionAppear, | ||
22003 | transitionLeave: props.transitionLeave | ||
22004 | }, | ||
22005 | child | ||
22006 | ); | ||
22007 | }); | ||
22008 | } | ||
22009 | var Component = props.component; | ||
22010 | if (Component) { | ||
22011 | var passedProps = props; | ||
22012 | if (typeof Component === 'string') { | ||
22013 | passedProps = _extends({ | ||
22014 | className: props.className, | ||
22015 | style: props.style | ||
22016 | }, props.componentProps); | ||
22017 | } | ||
22018 | return _react2["default"].createElement( | ||
22019 | Component, | ||
22020 | passedProps, | ||
22021 | children | ||
22022 | ); | ||
22023 | } | ||
22024 | return children[0] || null; | ||
22025 | }; | ||
22026 | |||
22027 | return Animate; | ||
22028 | }(_react2["default"].Component); | ||
22029 | |||
22030 | Animate.propTypes = { | ||
22031 | component: _propTypes2["default"].any, | ||
22032 | componentProps: _propTypes2["default"].object, | ||
22033 | animation: _propTypes2["default"].object, | ||
22034 | transitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]), | ||
22035 | transitionEnter: _propTypes2["default"].bool, | ||
22036 | transitionAppear: _propTypes2["default"].bool, | ||
22037 | exclusive: _propTypes2["default"].bool, | ||
22038 | transitionLeave: _propTypes2["default"].bool, | ||
22039 | onEnd: _propTypes2["default"].func, | ||
22040 | onEnter: _propTypes2["default"].func, | ||
22041 | onLeave: _propTypes2["default"].func, | ||
22042 | onAppear: _propTypes2["default"].func, | ||
22043 | showProp: _propTypes2["default"].string | ||
22044 | }; | ||
22045 | Animate.defaultProps = { | ||
22046 | animation: {}, | ||
22047 | component: 'span', | ||
22048 | componentProps: {}, | ||
22049 | transitionEnter: true, | ||
22050 | transitionLeave: true, | ||
22051 | transitionAppear: false, | ||
22052 | onEnd: noop, | ||
22053 | onEnter: noop, | ||
22054 | onLeave: noop, | ||
22055 | onAppear: noop | ||
22056 | }; | ||
22057 | |||
22058 | var _initialiseProps = function _initialiseProps() { | ||
22059 | var _this4 = this; | ||
22060 | |||
22061 | this.performEnter = function (key) { | ||
22062 | // may already remove by exclusive | ||
22063 | if (_this4.refs[key]) { | ||
22064 | _this4.currentlyAnimatingKeys[key] = true; | ||
22065 | _this4.refs[key].componentWillEnter(_this4.handleDoneAdding.bind(_this4, key, 'enter')); | ||
22066 | } | ||
22067 | }; | ||
22068 | |||
22069 | this.performAppear = function (key) { | ||
22070 | if (_this4.refs[key]) { | ||
22071 | _this4.currentlyAnimatingKeys[key] = true; | ||
22072 | _this4.refs[key].componentWillAppear(_this4.handleDoneAdding.bind(_this4, key, 'appear')); | ||
22073 | } | ||
22074 | }; | ||
22075 | |||
22076 | this.handleDoneAdding = function (key, type) { | ||
22077 | var props = _this4.props; | ||
22078 | delete _this4.currentlyAnimatingKeys[key]; | ||
22079 | // if update on exclusive mode, skip check | ||
22080 | if (props.exclusive && props !== _this4.nextProps) { | ||
22081 | return; | ||
22082 | } | ||
22083 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); | ||
22084 | if (!_this4.isValidChildByKey(currentChildren, key)) { | ||
22085 | // exclusive will not need this | ||
22086 | _this4.performLeave(key); | ||
22087 | } else { | ||
22088 | if (type === 'appear') { | ||
22089 | if (_util2["default"].allowAppearCallback(props)) { | ||
22090 | props.onAppear(key); | ||
22091 | props.onEnd(key, true); | ||
22092 | } | ||
22093 | } else { | ||
22094 | if (_util2["default"].allowEnterCallback(props)) { | ||
22095 | props.onEnter(key); | ||
22096 | props.onEnd(key, true); | ||
22097 | } | ||
22098 | } | ||
22099 | } | ||
22100 | }; | ||
22101 | |||
22102 | this.performLeave = function (key) { | ||
22103 | // may already remove by exclusive | ||
22104 | if (_this4.refs[key]) { | ||
22105 | _this4.currentlyAnimatingKeys[key] = true; | ||
22106 | _this4.refs[key].componentWillLeave(_this4.handleDoneLeaving.bind(_this4, key)); | ||
22107 | } | ||
22108 | }; | ||
22109 | |||
22110 | this.handleDoneLeaving = function (key) { | ||
22111 | var props = _this4.props; | ||
22112 | delete _this4.currentlyAnimatingKeys[key]; | ||
22113 | // if update on exclusive mode, skip check | ||
22114 | if (props.exclusive && props !== _this4.nextProps) { | ||
22115 | return; | ||
22116 | } | ||
22117 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); | ||
22118 | // in case state change is too fast | ||
22119 | if (_this4.isValidChildByKey(currentChildren, key)) { | ||
22120 | _this4.performEnter(key); | ||
22121 | } else { | ||
22122 | var end = function end() { | ||
22123 | if (_util2["default"].allowLeaveCallback(props)) { | ||
22124 | props.onLeave(key); | ||
22125 | props.onEnd(key, false); | ||
22126 | } | ||
22127 | }; | ||
22128 | if (!(0, _ChildrenUtils.isSameChildren)(_this4.state.children, currentChildren, props.showProp)) { | ||
22129 | _this4.setState({ | ||
22130 | children: currentChildren | ||
22131 | }, end); | ||
22132 | } else { | ||
22133 | end(); | ||
22134 | } | ||
22135 | } | ||
22136 | }; | ||
22137 | }; | ||
22138 | |||
22139 | exports["default"] = Animate; | ||
22140 | module.exports = exports['default']; | ||
22141 | |||
22142 | /***/ }), | ||
22143 | /* 232 */ | ||
22144 | /***/ (function(module, exports, __webpack_require__) { | ||
22145 | |||
22146 | "use strict"; | ||
22147 | |||
22148 | |||
22149 | Object.defineProperty(exports, "__esModule", { | ||
22150 | value: true | ||
22151 | }); | ||
22152 | |||
22153 | 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; }; | ||
22154 | |||
22155 | var _react = __webpack_require__(5); | ||
22156 | |||
22157 | var _react2 = _interopRequireDefault(_react); | ||
22158 | |||
22159 | var _reactDom = __webpack_require__(8); | ||
22160 | |||
22161 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
22162 | |||
22163 | var _propTypes = __webpack_require__(11); | ||
22164 | |||
22165 | var _propTypes2 = _interopRequireDefault(_propTypes); | ||
22166 | |||
22167 | var _cssAnimation = __webpack_require__(205); | ||
22168 | |||
22169 | var _cssAnimation2 = _interopRequireDefault(_cssAnimation); | ||
22170 | |||
22171 | var _util = __webpack_require__(115); | ||
22172 | |||
22173 | var _util2 = _interopRequireDefault(_util); | ||
22174 | |||
22175 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
22176 | |||
22177 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } | ||
22178 | |||
22179 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
22180 | |||
22181 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
22182 | |||
22183 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } | ||
22184 | |||
22185 | var transitionMap = { | ||
22186 | enter: 'transitionEnter', | ||
22187 | appear: 'transitionAppear', | ||
22188 | leave: 'transitionLeave' | ||
22189 | }; | ||
22190 | |||
22191 | var AnimateChild = function (_React$Component) { | ||
22192 | _inherits(AnimateChild, _React$Component); | ||
22193 | |||
22194 | function AnimateChild() { | ||
22195 | _classCallCheck(this, AnimateChild); | ||
22196 | |||
22197 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
22198 | } | ||
22199 | |||
22200 | AnimateChild.prototype.componentWillUnmount = function componentWillUnmount() { | ||
22201 | this.stop(); | ||
22202 | }; | ||
22203 | |||
22204 | AnimateChild.prototype.componentWillEnter = function componentWillEnter(done) { | ||
22205 | if (_util2["default"].isEnterSupported(this.props)) { | ||
22206 | this.transition('enter', done); | ||
22207 | } else { | ||
22208 | done(); | ||
22209 | } | ||
22210 | }; | ||
22211 | |||
22212 | AnimateChild.prototype.componentWillAppear = function componentWillAppear(done) { | ||
22213 | if (_util2["default"].isAppearSupported(this.props)) { | ||
22214 | this.transition('appear', done); | ||
22215 | } else { | ||
22216 | done(); | ||
22217 | } | ||
22218 | }; | ||
22219 | |||
22220 | AnimateChild.prototype.componentWillLeave = function componentWillLeave(done) { | ||
22221 | if (_util2["default"].isLeaveSupported(this.props)) { | ||
22222 | this.transition('leave', done); | ||
22223 | } else { | ||
22224 | // always sync, do not interupt with react component life cycle | ||
22225 | // update hidden -> animate hidden -> | ||
22226 | // didUpdate -> animate leave -> unmount (if animate is none) | ||
22227 | done(); | ||
22228 | } | ||
22229 | }; | ||
22230 | |||
22231 | AnimateChild.prototype.transition = function transition(animationType, finishCallback) { | ||
22232 | var _this2 = this; | ||
22233 | |||
22234 | var node = _reactDom2["default"].findDOMNode(this); | ||
22235 | var props = this.props; | ||
22236 | var transitionName = props.transitionName; | ||
22237 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object'; | ||
22238 | this.stop(); | ||
22239 | var end = function end() { | ||
22240 | _this2.stopper = null; | ||
22241 | finishCallback(); | ||
22242 | }; | ||
22243 | if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) { | ||
22244 | var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType; | ||
22245 | var activeName = name + '-active'; | ||
22246 | if (nameIsObj && transitionName[animationType + 'Active']) { | ||
22247 | activeName = transitionName[animationType + 'Active']; | ||
22248 | } | ||
22249 | this.stopper = (0, _cssAnimation2["default"])(node, { | ||
22250 | name: name, | ||
22251 | active: activeName | ||
22252 | }, end); | ||
22253 | } else { | ||
22254 | this.stopper = props.animation[animationType](node, end); | ||
22255 | } | ||
22256 | }; | ||
22257 | |||
22258 | AnimateChild.prototype.stop = function stop() { | ||
22259 | var stopper = this.stopper; | ||
22260 | if (stopper) { | ||
22261 | this.stopper = null; | ||
22262 | stopper.stop(); | ||
22263 | } | ||
22264 | }; | ||
22265 | |||
22266 | AnimateChild.prototype.render = function render() { | ||
22267 | return this.props.children; | ||
22268 | }; | ||
22269 | |||
22270 | return AnimateChild; | ||
22271 | }(_react2["default"].Component); | ||
22272 | |||
22273 | AnimateChild.propTypes = { | ||
22274 | children: _propTypes2["default"].any | ||
22275 | }; | ||
22276 | exports["default"] = AnimateChild; | ||
22277 | module.exports = exports['default']; | ||
22278 | |||
22279 | /***/ }), | ||
22280 | /* 233 */ | ||
22281 | /***/ (function(module, exports, __webpack_require__) { | ||
22282 | |||
22283 | "use strict"; | ||
22284 | |||
22285 | |||
22286 | Object.defineProperty(exports, "__esModule", { | ||
22287 | value: true | ||
22288 | }); | ||
22289 | exports.toArrayChildren = toArrayChildren; | ||
22290 | exports.findChildInChildrenByKey = findChildInChildrenByKey; | ||
22291 | exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey; | ||
22292 | exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey; | ||
22293 | exports.isSameChildren = isSameChildren; | ||
22294 | exports.mergeChildren = mergeChildren; | ||
22295 | |||
22296 | var _react = __webpack_require__(5); | ||
22297 | |||
22298 | var _react2 = _interopRequireDefault(_react); | ||
22299 | |||
22300 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
22301 | |||
22302 | function toArrayChildren(children) { | ||
22303 | var ret = []; | ||
22304 | _react2["default"].Children.forEach(children, function (child) { | ||
22305 | ret.push(child); | ||
22306 | }); | ||
22307 | return ret; | ||
22308 | } | ||
22309 | |||
22310 | function findChildInChildrenByKey(children, key) { | ||
22311 | var ret = null; | ||
22312 | if (children) { | ||
22313 | children.forEach(function (child) { | ||
22314 | if (ret) { | ||
22315 | return; | ||
22316 | } | ||
22317 | if (child && child.key === key) { | ||
22318 | ret = child; | ||
22319 | } | ||
22320 | }); | ||
22321 | } | ||
22322 | return ret; | ||
22323 | } | ||
22324 | |||
22325 | function findShownChildInChildrenByKey(children, key, showProp) { | ||
22326 | var ret = null; | ||
22327 | if (children) { | ||
22328 | children.forEach(function (child) { | ||
22329 | if (child && child.key === key && child.props[showProp]) { | ||
22330 | if (ret) { | ||
22331 | throw new Error('two child with same key for <rc-animate> children'); | ||
22332 | } | ||
22333 | ret = child; | ||
22334 | } | ||
22335 | }); | ||
22336 | } | ||
22337 | return ret; | ||
22338 | } | ||
22339 | |||
22340 | function findHiddenChildInChildrenByKey(children, key, showProp) { | ||
22341 | var found = 0; | ||
22342 | if (children) { | ||
22343 | children.forEach(function (child) { | ||
22344 | if (found) { | ||
22345 | return; | ||
22346 | } | ||
22347 | found = child && child.key === key && !child.props[showProp]; | ||
22348 | }); | ||
22349 | } | ||
22350 | return found; | ||
22351 | } | ||
22352 | |||
22353 | function isSameChildren(c1, c2, showProp) { | ||
22354 | var same = c1.length === c2.length; | ||
22355 | if (same) { | ||
22356 | c1.forEach(function (child, index) { | ||
22357 | var child2 = c2[index]; | ||
22358 | if (child && child2) { | ||
22359 | if (child && !child2 || !child && child2) { | ||
22360 | same = false; | ||
22361 | } else if (child.key !== child2.key) { | ||
22362 | same = false; | ||
22363 | } else if (showProp && child.props[showProp] !== child2.props[showProp]) { | ||
22364 | same = false; | ||
22365 | } | ||
22366 | } | ||
22367 | }); | ||
22368 | } | ||
22369 | return same; | ||
22370 | } | ||
22371 | |||
22372 | function mergeChildren(prev, next) { | ||
22373 | var ret = []; | ||
22374 | |||
22375 | // For each key of `next`, the list of keys to insert before that key in | ||
22376 | // the combined list | ||
22377 | var nextChildrenPending = {}; | ||
22378 | var pendingChildren = []; | ||
22379 | prev.forEach(function (child) { | ||
22380 | if (child && findChildInChildrenByKey(next, child.key)) { | ||
22381 | if (pendingChildren.length) { | ||
22382 | nextChildrenPending[child.key] = pendingChildren; | ||
22383 | pendingChildren = []; | ||
22384 | } | ||
22385 | } else { | ||
22386 | pendingChildren.push(child); | ||
22387 | } | ||
22388 | }); | ||
22389 | |||
22390 | next.forEach(function (child) { | ||
22391 | if (child && nextChildrenPending.hasOwnProperty(child.key)) { | ||
22392 | ret = ret.concat(nextChildrenPending[child.key]); | ||
22393 | } | ||
22394 | ret.push(child); | ||
22395 | }); | ||
22396 | |||
22397 | ret = ret.concat(pendingChildren); | ||
22398 | |||
22399 | return ret; | ||
22400 | } | ||
22401 | |||
22402 | /***/ }), | ||
22403 | /* 234 */ | ||
22404 | /***/ (function(module, exports, __webpack_require__) { | ||
22405 | |||
22406 | "use strict"; | ||
22407 | |||
22408 | |||
22409 | // export this package's api | ||
22410 | module.exports = __webpack_require__(231); | ||
22411 | |||
22412 | /***/ }), | ||
22413 | /* 235 */ | ||
22414 | /***/ (function(module, exports, __webpack_require__) { | ||
22415 | |||
22416 | "use strict"; | ||
22417 | |||
22418 | |||
22419 | Object.defineProperty(exports, "__esModule", { | ||
22420 | value: true | ||
22421 | }); | ||
22422 | |||
22423 | var _extends2 = __webpack_require__(49); | ||
22424 | |||
22425 | var _extends3 = _interopRequireDefault(_extends2); | ||
22426 | |||
22427 | var _classCallCheck2 = __webpack_require__(13); | ||
22428 | |||
22429 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
22430 | |||
22431 | var _possibleConstructorReturn2 = __webpack_require__(15); | ||
22432 | |||
22433 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
22434 | |||
22435 | var _inherits2 = __webpack_require__(14); | ||
22436 | |||
22437 | var _inherits3 = _interopRequireDefault(_inherits2); | ||
22438 | |||
22439 | var _react = __webpack_require__(5); | ||
22440 | |||
22441 | var _react2 = _interopRequireDefault(_react); | ||
22442 | |||
22443 | var _propTypes = __webpack_require__(11); | ||
22444 | |||
22445 | var _propTypes2 = _interopRequireDefault(_propTypes); | ||
22446 | |||
22447 | var _reactDom = __webpack_require__(8); | ||
22448 | |||
22449 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
22450 | |||
22451 | var _rcAlign = __webpack_require__(229); | ||
22452 | |||
22453 | var _rcAlign2 = _interopRequireDefault(_rcAlign); | ||
22454 | |||
22455 | var _rcAnimate = __webpack_require__(234); | ||
22456 | |||
22457 | var _rcAnimate2 = _interopRequireDefault(_rcAnimate); | ||
22458 | |||
22459 | var _PopupInner = __webpack_require__(236); | ||
22460 | |||
22461 | var _PopupInner2 = _interopRequireDefault(_PopupInner); | ||
22462 | |||
22463 | var _LazyRenderBox = __webpack_require__(116); | ||
22464 | |||
22465 | var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox); | ||
22466 | |||
22467 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
22468 | |||
22469 | var Popup = function (_Component) { | ||
22470 | (0, _inherits3["default"])(Popup, _Component); | ||
22471 | |||
22472 | function Popup() { | ||
22473 | var _temp, _this, _ret; | ||
22474 | |||
22475 | (0, _classCallCheck3["default"])(this, Popup); | ||
22476 | |||
22477 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
22478 | args[_key] = arguments[_key]; | ||
22479 | } | ||
22480 | |||
22481 | return _ret = (_temp = (_this = (0, _possibleConstructorReturn3["default"])(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onAlign = function (popupDomNode, align) { | ||
22482 | var props = _this.props; | ||
22483 | var alignClassName = props.getClassNameFromAlign(props.align); | ||
22484 | var currentAlignClassName = props.getClassNameFromAlign(align); | ||
22485 | if (alignClassName !== currentAlignClassName) { | ||
22486 | _this.currentAlignClassName = currentAlignClassName; | ||
22487 | popupDomNode.className = _this.getClassName(currentAlignClassName); | ||
22488 | } | ||
22489 | props.onAlign(popupDomNode, align); | ||
22490 | }, _this.getTarget = function () { | ||
22491 | return _this.props.getRootDomNode(); | ||
22492 | }, _this.saveAlign = function (align) { | ||
22493 | _this.alignInstance = align; | ||
22494 | }, _temp), (0, _possibleConstructorReturn3["default"])(_this, _ret); | ||
22495 | } | ||
22496 | |||
22497 | Popup.prototype.componentDidMount = function componentDidMount() { | ||
22498 | this.rootNode = this.getPopupDomNode(); | ||
22499 | }; | ||
22500 | |||
22501 | Popup.prototype.getPopupDomNode = function getPopupDomNode() { | ||
22502 | return _reactDom2["default"].findDOMNode(this.refs.popup); | ||
22503 | }; | ||
22504 | |||
22505 | Popup.prototype.getMaskTransitionName = function getMaskTransitionName() { | ||
22506 | var props = this.props; | ||
22507 | var transitionName = props.maskTransitionName; | ||
22508 | var animation = props.maskAnimation; | ||
22509 | if (!transitionName && animation) { | ||
22510 | transitionName = props.prefixCls + '-' + animation; | ||
22511 | } | ||
22512 | return transitionName; | ||
22513 | }; | ||
22514 | |||
22515 | Popup.prototype.getTransitionName = function getTransitionName() { | ||
22516 | var props = this.props; | ||
22517 | var transitionName = props.transitionName; | ||
22518 | if (!transitionName && props.animation) { | ||
22519 | transitionName = props.prefixCls + '-' + props.animation; | ||
22520 | } | ||
22521 | return transitionName; | ||
22522 | }; | ||
22523 | |||
22524 | Popup.prototype.getClassName = function getClassName(currentAlignClassName) { | ||
22525 | return this.props.prefixCls + ' ' + this.props.className + ' ' + currentAlignClassName; | ||
22526 | }; | ||
22527 | |||
22528 | Popup.prototype.getPopupElement = function getPopupElement() { | ||
22529 | var props = this.props; | ||
22530 | var align = props.align, | ||
22531 | style = props.style, | ||
22532 | visible = props.visible, | ||
22533 | prefixCls = props.prefixCls, | ||
22534 | destroyPopupOnHide = props.destroyPopupOnHide; | ||
22535 | |||
22536 | var className = this.getClassName(this.currentAlignClassName || props.getClassNameFromAlign(align)); | ||
22537 | var hiddenClassName = prefixCls + '-hidden'; | ||
22538 | if (!visible) { | ||
22539 | this.currentAlignClassName = null; | ||
22540 | } | ||
22541 | var newStyle = (0, _extends3["default"])({}, style, this.getZIndexStyle()); | ||
22542 | var popupInnerProps = { | ||
22543 | className: className, | ||
22544 | prefixCls: prefixCls, | ||
22545 | ref: 'popup', | ||
22546 | onMouseEnter: props.onMouseEnter, | ||
22547 | onMouseLeave: props.onMouseLeave, | ||
22548 | style: newStyle | ||
22549 | }; | ||
22550 | if (destroyPopupOnHide) { | ||
22551 | return _react2["default"].createElement( | ||
22552 | _rcAnimate2["default"], | ||
22553 | { | ||
22554 | component: '', | ||
22555 | exclusive: true, | ||
22556 | transitionAppear: true, | ||
22557 | transitionName: this.getTransitionName() | ||
22558 | }, | ||
22559 | visible ? _react2["default"].createElement( | ||
22560 | _rcAlign2["default"], | ||
22561 | { | ||
22562 | target: this.getTarget, | ||
22563 | key: 'popup', | ||
22564 | ref: this.saveAlign, | ||
22565 | monitorWindowResize: true, | ||
22566 | align: align, | ||
22567 | onAlign: this.onAlign | ||
22568 | }, | ||
22569 | _react2["default"].createElement( | ||
22570 | _PopupInner2["default"], | ||
22571 | (0, _extends3["default"])({ | ||
22572 | visible: true | ||
22573 | }, popupInnerProps), | ||
22574 | props.children | ||
22575 | ) | ||
22576 | ) : null | ||
22577 | ); | ||
22578 | } | ||
22579 | return _react2["default"].createElement( | ||
22580 | _rcAnimate2["default"], | ||
22581 | { | ||
22582 | component: '', | ||
22583 | exclusive: true, | ||
22584 | transitionAppear: true, | ||
22585 | transitionName: this.getTransitionName(), | ||
22586 | showProp: 'xVisible' | ||
22587 | }, | ||
22588 | _react2["default"].createElement( | ||
22589 | _rcAlign2["default"], | ||
22590 | { | ||
22591 | target: this.getTarget, | ||
22592 | key: 'popup', | ||
22593 | ref: this.saveAlign, | ||
22594 | monitorWindowResize: true, | ||
22595 | xVisible: visible, | ||
22596 | childrenProps: { visible: 'xVisible' }, | ||
22597 | disabled: !visible, | ||
22598 | align: align, | ||
22599 | onAlign: this.onAlign | ||
22600 | }, | ||
22601 | _react2["default"].createElement( | ||
22602 | _PopupInner2["default"], | ||
22603 | (0, _extends3["default"])({ | ||
22604 | hiddenClassName: hiddenClassName | ||
22605 | }, popupInnerProps), | ||
22606 | props.children | ||
22607 | ) | ||
22608 | ) | ||
22609 | ); | ||
22610 | }; | ||
22611 | |||
22612 | Popup.prototype.getZIndexStyle = function getZIndexStyle() { | ||
22613 | var style = {}; | ||
22614 | var props = this.props; | ||
22615 | if (props.zIndex !== undefined) { | ||
22616 | style.zIndex = props.zIndex; | ||
22617 | } | ||
22618 | return style; | ||
22619 | }; | ||
22620 | |||
22621 | Popup.prototype.getMaskElement = function getMaskElement() { | ||
22622 | var props = this.props; | ||
22623 | var maskElement = void 0; | ||
22624 | if (props.mask) { | ||
22625 | var maskTransition = this.getMaskTransitionName(); | ||
22626 | maskElement = _react2["default"].createElement(_LazyRenderBox2["default"], { | ||
22627 | style: this.getZIndexStyle(), | ||
22628 | key: 'mask', | ||
22629 | className: props.prefixCls + '-mask', | ||
22630 | hiddenClassName: props.prefixCls + '-mask-hidden', | ||
22631 | visible: props.visible | ||
22632 | }); | ||
22633 | if (maskTransition) { | ||
22634 | maskElement = _react2["default"].createElement( | ||
22635 | _rcAnimate2["default"], | ||
22636 | { | ||
22637 | key: 'mask', | ||
22638 | showProp: 'visible', | ||
22639 | transitionAppear: true, | ||
22640 | component: '', | ||
22641 | transitionName: maskTransition | ||
22642 | }, | ||
22643 | maskElement | ||
22644 | ); | ||
22645 | } | ||
22646 | } | ||
22647 | return maskElement; | ||
22648 | }; | ||
22649 | |||
22650 | Popup.prototype.render = function render() { | ||
22651 | return _react2["default"].createElement( | ||
22652 | 'div', | ||
22653 | null, | ||
22654 | this.getMaskElement(), | ||
22655 | this.getPopupElement() | ||
22656 | ); | ||
22657 | }; | ||
22658 | |||
22659 | return Popup; | ||
22660 | }(_react.Component); | ||
22661 | |||
22662 | Popup.propTypes = { | ||
22663 | visible: _propTypes2["default"].bool, | ||
22664 | style: _propTypes2["default"].object, | ||
22665 | getClassNameFromAlign: _propTypes2["default"].func, | ||
22666 | onAlign: _propTypes2["default"].func, | ||
22667 | getRootDomNode: _propTypes2["default"].func, | ||
22668 | onMouseEnter: _propTypes2["default"].func, | ||
22669 | align: _propTypes2["default"].any, | ||
22670 | destroyPopupOnHide: _propTypes2["default"].bool, | ||
22671 | className: _propTypes2["default"].string, | ||
22672 | prefixCls: _propTypes2["default"].string, | ||
22673 | onMouseLeave: _propTypes2["default"].func | ||
22674 | }; | ||
22675 | exports["default"] = Popup; | ||
22676 | module.exports = exports['default']; | ||
22677 | |||
22678 | /***/ }), | ||
22679 | /* 236 */ | ||
22680 | /***/ (function(module, exports, __webpack_require__) { | ||
22681 | |||
22682 | "use strict"; | ||
22683 | |||
22684 | |||
22685 | Object.defineProperty(exports, "__esModule", { | ||
22686 | value: true | ||
22687 | }); | ||
22688 | |||
22689 | var _classCallCheck2 = __webpack_require__(13); | ||
22690 | |||
22691 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
22692 | |||
22693 | var _possibleConstructorReturn2 = __webpack_require__(15); | ||
22694 | |||
22695 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
22696 | |||
22697 | var _inherits2 = __webpack_require__(14); | ||
22698 | |||
22699 | var _inherits3 = _interopRequireDefault(_inherits2); | ||
22700 | |||
22701 | var _react = __webpack_require__(5); | ||
22702 | |||
22703 | var _react2 = _interopRequireDefault(_react); | ||
22704 | |||
22705 | var _propTypes = __webpack_require__(11); | ||
22706 | |||
22707 | var _propTypes2 = _interopRequireDefault(_propTypes); | ||
22708 | |||
22709 | var _LazyRenderBox = __webpack_require__(116); | ||
22710 | |||
22711 | var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox); | ||
22712 | |||
22713 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
22714 | |||
22715 | var PopupInner = function (_Component) { | ||
22716 | (0, _inherits3["default"])(PopupInner, _Component); | ||
22717 | |||
22718 | function PopupInner() { | ||
22719 | (0, _classCallCheck3["default"])(this, PopupInner); | ||
22720 | return (0, _possibleConstructorReturn3["default"])(this, _Component.apply(this, arguments)); | ||
22721 | } | ||
22722 | |||
22723 | PopupInner.prototype.render = function render() { | ||
22724 | var props = this.props; | ||
22725 | var className = props.className; | ||
22726 | if (!props.visible) { | ||
22727 | className += ' ' + props.hiddenClassName; | ||
22728 | } | ||
22729 | return _react2["default"].createElement( | ||
22730 | 'div', | ||
22731 | { | ||
22732 | className: className, | ||
22733 | onMouseEnter: props.onMouseEnter, | ||
22734 | onMouseLeave: props.onMouseLeave, | ||
22735 | style: props.style | ||
22736 | }, | ||
22737 | _react2["default"].createElement( | ||
22738 | _LazyRenderBox2["default"], | ||
22739 | { className: props.prefixCls + '-content', visible: props.visible }, | ||
22740 | props.children | ||
22741 | ) | ||
22742 | ); | ||
22743 | }; | ||
22744 | |||
22745 | return PopupInner; | ||
22746 | }(_react.Component); | ||
22747 | |||
22748 | PopupInner.propTypes = { | ||
22749 | hiddenClassName: _propTypes2["default"].string, | ||
22750 | className: _propTypes2["default"].string, | ||
22751 | prefixCls: _propTypes2["default"].string, | ||
22752 | onMouseEnter: _propTypes2["default"].func, | ||
22753 | onMouseLeave: _propTypes2["default"].func, | ||
22754 | children: _propTypes2["default"].any | ||
22755 | }; | ||
22756 | exports["default"] = PopupInner; | ||
22757 | module.exports = exports['default']; | ||
22758 | |||
22759 | /***/ }), | ||
22760 | /* 237 */ | ||
22761 | /***/ (function(module, exports, __webpack_require__) { | ||
22762 | |||
22763 | "use strict"; | ||
22764 | |||
22765 | |||
22766 | Object.defineProperty(exports, "__esModule", { | ||
22767 | value: true | ||
22768 | }); | ||
22769 | |||
22770 | var _extends2 = __webpack_require__(49); | ||
22771 | |||
22772 | var _extends3 = _interopRequireDefault(_extends2); | ||
22773 | |||
22774 | var _react = __webpack_require__(5); | ||
22775 | |||
22776 | var _react2 = _interopRequireDefault(_react); | ||
22777 | |||
22778 | var _propTypes = __webpack_require__(11); | ||
22779 | |||
22780 | var _propTypes2 = _interopRequireDefault(_propTypes); | ||
22781 | |||
22782 | var _reactDom = __webpack_require__(8); | ||
22783 | |||
22784 | var _createReactClass = __webpack_require__(203); | ||
22785 | |||
22786 | var _createReactClass2 = _interopRequireDefault(_createReactClass); | ||
22787 | |||
22788 | var _contains = __webpack_require__(240); | ||
22789 | |||
22790 | var _contains2 = _interopRequireDefault(_contains); | ||
22791 | |||
22792 | var _addEventListener = __webpack_require__(117); | ||
22793 | |||
22794 | var _addEventListener2 = _interopRequireDefault(_addEventListener); | ||
22795 | |||
22796 | var _Popup = __webpack_require__(235); | ||
22797 | |||
22798 | var _Popup2 = _interopRequireDefault(_Popup); | ||
22799 | |||
22800 | var _utils = __webpack_require__(239); | ||
22801 | |||
22802 | var _getContainerRenderMixin = __webpack_require__(241); | ||
22803 | |||
22804 | var _getContainerRenderMixin2 = _interopRequireDefault(_getContainerRenderMixin); | ||
22805 | |||
22806 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
22807 | |||
22808 | function noop() {} | ||
22809 | |||
22810 | function returnEmptyString() { | ||
22811 | return ''; | ||
22812 | } | ||
22813 | |||
22814 | function returnDocument() { | ||
22815 | return window.document; | ||
22816 | } | ||
22817 | |||
22818 | var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur']; | ||
22819 | |||
22820 | var Trigger = (0, _createReactClass2["default"])({ | ||
22821 | displayName: 'Trigger', | ||
22822 | propTypes: { | ||
22823 | children: _propTypes2["default"].any, | ||
22824 | action: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].arrayOf(_propTypes2["default"].string)]), | ||
22825 | showAction: _propTypes2["default"].any, | ||
22826 | hideAction: _propTypes2["default"].any, | ||
22827 | getPopupClassNameFromAlign: _propTypes2["default"].any, | ||
22828 | onPopupVisibleChange: _propTypes2["default"].func, | ||
22829 | afterPopupVisibleChange: _propTypes2["default"].func, | ||
22830 | popup: _propTypes2["default"].oneOfType([_propTypes2["default"].node, _propTypes2["default"].func]).isRequired, | ||
22831 | popupStyle: _propTypes2["default"].object, | ||
22832 | prefixCls: _propTypes2["default"].string, | ||
22833 | popupClassName: _propTypes2["default"].string, | ||
22834 | popupPlacement: _propTypes2["default"].string, | ||
22835 | builtinPlacements: _propTypes2["default"].object, | ||
22836 | popupTransitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]), | ||
22837 | popupAnimation: _propTypes2["default"].any, | ||
22838 | mouseEnterDelay: _propTypes2["default"].number, | ||
22839 | mouseLeaveDelay: _propTypes2["default"].number, | ||
22840 | zIndex: _propTypes2["default"].number, | ||
22841 | focusDelay: _propTypes2["default"].number, | ||
22842 | blurDelay: _propTypes2["default"].number, | ||
22843 | getPopupContainer: _propTypes2["default"].func, | ||
22844 | getDocument: _propTypes2["default"].func, | ||
22845 | destroyPopupOnHide: _propTypes2["default"].bool, | ||
22846 | mask: _propTypes2["default"].bool, | ||
22847 | maskClosable: _propTypes2["default"].bool, | ||
22848 | onPopupAlign: _propTypes2["default"].func, | ||
22849 | popupAlign: _propTypes2["default"].object, | ||
22850 | popupVisible: _propTypes2["default"].bool, | ||
22851 | maskTransitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]), | ||
22852 | maskAnimation: _propTypes2["default"].string | ||
22853 | }, | ||
22854 | |||
22855 | mixins: [(0, _getContainerRenderMixin2["default"])({ | ||
22856 | autoMount: false, | ||
22857 | |||
22858 | isVisible: function isVisible(instance) { | ||
22859 | return instance.state.popupVisible; | ||
22860 | }, | ||
22861 | getContainer: function getContainer(instance) { | ||
22862 | var props = instance.props; | ||
22863 | |||
22864 | var popupContainer = document.createElement('div'); | ||
22865 | // Make sure default popup container will never cause scrollbar appearing | ||
22866 | // https://github.com/react-component/trigger/issues/41 | ||
22867 | popupContainer.style.position = 'absolute'; | ||
22868 | popupContainer.style.top = '0'; | ||
22869 | popupContainer.style.left = '0'; | ||
22870 | popupContainer.style.width = '100%'; | ||
22871 | var mountNode = props.getPopupContainer ? props.getPopupContainer((0, _reactDom.findDOMNode)(instance)) : props.getDocument().body; | ||
22872 | mountNode.appendChild(popupContainer); | ||
22873 | return popupContainer; | ||
22874 | } | ||
22875 | })], | ||
22876 | |||
22877 | getDefaultProps: function getDefaultProps() { | ||
22878 | return { | ||
22879 | prefixCls: 'rc-trigger-popup', | ||
22880 | getPopupClassNameFromAlign: returnEmptyString, | ||
22881 | getDocument: returnDocument, | ||
22882 | onPopupVisibleChange: noop, | ||
22883 | afterPopupVisibleChange: noop, | ||
22884 | onPopupAlign: noop, | ||
22885 | popupClassName: '', | ||
22886 | mouseEnterDelay: 0, | ||
22887 | mouseLeaveDelay: 0.1, | ||
22888 | focusDelay: 0, | ||
22889 | blurDelay: 0.15, | ||
22890 | popupStyle: {}, | ||
22891 | destroyPopupOnHide: false, | ||
22892 | popupAlign: {}, | ||
22893 | defaultPopupVisible: false, | ||
22894 | mask: false, | ||
22895 | maskClosable: true, | ||
22896 | action: [], | ||
22897 | showAction: [], | ||
22898 | hideAction: [] | ||
22899 | }; | ||
22900 | }, | ||
22901 | getInitialState: function getInitialState() { | ||
22902 | var props = this.props; | ||
22903 | var popupVisible = void 0; | ||
22904 | if ('popupVisible' in props) { | ||
22905 | popupVisible = !!props.popupVisible; | ||
22906 | } else { | ||
22907 | popupVisible = !!props.defaultPopupVisible; | ||
22908 | } | ||
22909 | return { | ||
22910 | popupVisible: popupVisible | ||
22911 | }; | ||
22912 | }, | ||
22913 | componentWillMount: function componentWillMount() { | ||
22914 | var _this = this; | ||
22915 | |||
22916 | ALL_HANDLERS.forEach(function (h) { | ||
22917 | _this['fire' + h] = function (e) { | ||
22918 | _this.fireEvents(h, e); | ||
22919 | }; | ||
22920 | }); | ||
22921 | }, | ||
22922 | componentDidMount: function componentDidMount() { | ||
22923 | this.componentDidUpdate({}, { | ||
22924 | popupVisible: this.state.popupVisible | ||
22925 | }); | ||
22926 | }, | ||
22927 | componentWillReceiveProps: function componentWillReceiveProps(_ref) { | ||
22928 | var popupVisible = _ref.popupVisible; | ||
22929 | |||
22930 | if (popupVisible !== undefined) { | ||
22931 | this.setState({ | ||
22932 | popupVisible: popupVisible | ||
22933 | }); | ||
22934 | } | ||
22935 | }, | ||
22936 | componentDidUpdate: function componentDidUpdate(_, prevState) { | ||
22937 | var props = this.props; | ||
22938 | var state = this.state; | ||
22939 | this.renderComponent(null, function () { | ||
22940 | if (prevState.popupVisible !== state.popupVisible) { | ||
22941 | props.afterPopupVisibleChange(state.popupVisible); | ||
22942 | } | ||
22943 | }); | ||
22944 | |||
22945 | // We must listen to `mousedown` or `touchstart`, edge case: | ||
22946 | // https://github.com/ant-design/ant-design/issues/5804 | ||
22947 | // https://github.com/react-component/calendar/issues/250 | ||
22948 | // https://github.com/react-component/trigger/issues/50 | ||
22949 | if (state.popupVisible) { | ||
22950 | var currentDocument = void 0; | ||
22951 | if (!this.clickOutsideHandler && this.isClickToHide()) { | ||
22952 | currentDocument = props.getDocument(); | ||
22953 | this.clickOutsideHandler = (0, _addEventListener2["default"])(currentDocument, 'mousedown', this.onDocumentClick); | ||
22954 | } | ||
22955 | // always hide on mobile | ||
22956 | if (!this.touchOutsideHandler) { | ||
22957 | currentDocument = currentDocument || props.getDocument(); | ||
22958 | this.touchOutsideHandler = (0, _addEventListener2["default"])(currentDocument, 'touchstart', this.onDocumentClick); | ||
22959 | } | ||
22960 | return; | ||
22961 | } | ||
22962 | |||
22963 | this.clearOutsideHandler(); | ||
22964 | }, | ||
22965 | componentWillUnmount: function componentWillUnmount() { | ||
22966 | this.clearDelayTimer(); | ||
22967 | this.clearOutsideHandler(); | ||
22968 | }, | ||
22969 | onMouseEnter: function onMouseEnter(e) { | ||
22970 | this.fireEvents('onMouseEnter', e); | ||
22971 | this.delaySetPopupVisible(true, this.props.mouseEnterDelay); | ||
22972 | }, | ||
22973 | onMouseLeave: function onMouseLeave(e) { | ||
22974 | this.fireEvents('onMouseLeave', e); | ||
22975 | this.delaySetPopupVisible(false, this.props.mouseLeaveDelay); | ||
22976 | }, | ||
22977 | onPopupMouseEnter: function onPopupMouseEnter() { | ||
22978 | this.clearDelayTimer(); | ||
22979 | }, | ||
22980 | onPopupMouseLeave: function onPopupMouseLeave(e) { | ||
22981 | // https://github.com/react-component/trigger/pull/13 | ||
22982 | // react bug? | ||
22983 | if (e.relatedTarget && !e.relatedTarget.setTimeout && this._component && (0, _contains2["default"])(this._component.getPopupDomNode(), e.relatedTarget)) { | ||
22984 | return; | ||
22985 | } | ||
22986 | this.delaySetPopupVisible(false, this.props.mouseLeaveDelay); | ||
22987 | }, | ||
22988 | onFocus: function onFocus(e) { | ||
22989 | this.fireEvents('onFocus', e); | ||
22990 | // incase focusin and focusout | ||
22991 | this.clearDelayTimer(); | ||
22992 | if (this.isFocusToShow()) { | ||
22993 | this.focusTime = Date.now(); | ||
22994 | this.delaySetPopupVisible(true, this.props.focusDelay); | ||
22995 | } | ||
22996 | }, | ||
22997 | onMouseDown: function onMouseDown(e) { | ||
22998 | this.fireEvents('onMouseDown', e); | ||
22999 | this.preClickTime = Date.now(); | ||
23000 | }, | ||
23001 | onTouchStart: function onTouchStart(e) { | ||
23002 | this.fireEvents('onTouchStart', e); | ||
23003 | this.preTouchTime = Date.now(); | ||
23004 | }, | ||
23005 | onBlur: function onBlur(e) { | ||
23006 | this.fireEvents('onBlur', e); | ||
23007 | this.clearDelayTimer(); | ||
23008 | if (this.isBlurToHide()) { | ||
23009 | this.delaySetPopupVisible(false, this.props.blurDelay); | ||
23010 | } | ||
23011 | }, | ||
23012 | onClick: function onClick(event) { | ||
23013 | this.fireEvents('onClick', event); | ||
23014 | // focus will trigger click | ||
23015 | if (this.focusTime) { | ||
23016 | var preTime = void 0; | ||
23017 | if (this.preClickTime && this.preTouchTime) { | ||
23018 | preTime = Math.min(this.preClickTime, this.preTouchTime); | ||
23019 | } else if (this.preClickTime) { | ||
23020 | preTime = this.preClickTime; | ||
23021 | } else if (this.preTouchTime) { | ||
23022 | preTime = this.preTouchTime; | ||
23023 | } | ||
23024 | if (Math.abs(preTime - this.focusTime) < 20) { | ||
23025 | return; | ||
23026 | } | ||
23027 | this.focusTime = 0; | ||
23028 | } | ||
23029 | this.preClickTime = 0; | ||
23030 | this.preTouchTime = 0; | ||
23031 | event.preventDefault(); | ||
23032 | var nextVisible = !this.state.popupVisible; | ||
23033 | if (this.isClickToHide() && !nextVisible || nextVisible && this.isClickToShow()) { | ||
23034 | this.setPopupVisible(!this.state.popupVisible); | ||
23035 | } | ||
23036 | }, | ||
23037 | onDocumentClick: function onDocumentClick(event) { | ||
23038 | if (this.props.mask && !this.props.maskClosable) { | ||
23039 | return; | ||
23040 | } | ||
23041 | var target = event.target; | ||
23042 | var root = (0, _reactDom.findDOMNode)(this); | ||
23043 | var popupNode = this.getPopupDomNode(); | ||
23044 | if (!(0, _contains2["default"])(root, target) && !(0, _contains2["default"])(popupNode, target)) { | ||
23045 | this.close(); | ||
23046 | } | ||
23047 | }, | ||
23048 | getPopupDomNode: function getPopupDomNode() { | ||
23049 | // for test | ||
23050 | if (this._component && this._component.getPopupDomNode) { | ||
23051 | return this._component.getPopupDomNode(); | ||
23052 | } | ||
23053 | return null; | ||
23054 | }, | ||
23055 | getRootDomNode: function getRootDomNode() { | ||
23056 | return (0, _reactDom.findDOMNode)(this); | ||
23057 | }, | ||
23058 | getPopupClassNameFromAlign: function getPopupClassNameFromAlign(align) { | ||
23059 | var className = []; | ||
23060 | var props = this.props; | ||
23061 | var popupPlacement = props.popupPlacement, | ||
23062 | builtinPlacements = props.builtinPlacements, | ||
23063 | prefixCls = props.prefixCls; | ||
23064 | |||
23065 | if (popupPlacement && builtinPlacements) { | ||
23066 | className.push((0, _utils.getPopupClassNameFromAlign)(builtinPlacements, prefixCls, align)); | ||
23067 | } | ||
23068 | if (props.getPopupClassNameFromAlign) { | ||
23069 | className.push(props.getPopupClassNameFromAlign(align)); | ||
23070 | } | ||
23071 | return className.join(' '); | ||
23072 | }, | ||
23073 | getPopupAlign: function getPopupAlign() { | ||
23074 | var props = this.props; | ||
23075 | var popupPlacement = props.popupPlacement, | ||
23076 | popupAlign = props.popupAlign, | ||
23077 | builtinPlacements = props.builtinPlacements; | ||
23078 | |||
23079 | if (popupPlacement && builtinPlacements) { | ||
23080 | return (0, _utils.getAlignFromPlacement)(builtinPlacements, popupPlacement, popupAlign); | ||
23081 | } | ||
23082 | return popupAlign; | ||
23083 | }, | ||
23084 | getComponent: function getComponent() { | ||
23085 | var props = this.props, | ||
23086 | state = this.state; | ||
23087 | |||
23088 | var mouseProps = {}; | ||
23089 | if (this.isMouseEnterToShow()) { | ||
23090 | mouseProps.onMouseEnter = this.onPopupMouseEnter; | ||
23091 | } | ||
23092 | if (this.isMouseLeaveToHide()) { | ||
23093 | mouseProps.onMouseLeave = this.onPopupMouseLeave; | ||
23094 | } | ||
23095 | return _react2["default"].createElement( | ||
23096 | _Popup2["default"], | ||
23097 | (0, _extends3["default"])({ | ||
23098 | prefixCls: props.prefixCls, | ||
23099 | destroyPopupOnHide: props.destroyPopupOnHide, | ||
23100 | visible: state.popupVisible, | ||
23101 | className: props.popupClassName, | ||
23102 | action: props.action, | ||
23103 | align: this.getPopupAlign(), | ||
23104 | onAlign: props.onPopupAlign, | ||
23105 | animation: props.popupAnimation, | ||
23106 | getClassNameFromAlign: this.getPopupClassNameFromAlign | ||
23107 | }, mouseProps, { | ||
23108 | getRootDomNode: this.getRootDomNode, | ||
23109 | style: props.popupStyle, | ||
23110 | mask: props.mask, | ||
23111 | zIndex: props.zIndex, | ||
23112 | transitionName: props.popupTransitionName, | ||
23113 | maskAnimation: props.maskAnimation, | ||
23114 | maskTransitionName: props.maskTransitionName | ||
23115 | }), | ||
23116 | typeof props.popup === 'function' ? props.popup() : props.popup | ||
23117 | ); | ||
23118 | }, | ||
23119 | setPopupVisible: function setPopupVisible(popupVisible) { | ||
23120 | this.clearDelayTimer(); | ||
23121 | if (this.state.popupVisible !== popupVisible) { | ||
23122 | if (!('popupVisible' in this.props)) { | ||
23123 | this.setState({ | ||
23124 | popupVisible: popupVisible | ||
23125 | }); | ||
23126 | } | ||
23127 | this.props.onPopupVisibleChange(popupVisible); | ||
23128 | } | ||
23129 | }, | ||
23130 | delaySetPopupVisible: function delaySetPopupVisible(visible, delayS) { | ||
23131 | var _this2 = this; | ||
23132 | |||
23133 | var delay = delayS * 1000; | ||
23134 | this.clearDelayTimer(); | ||
23135 | if (delay) { | ||
23136 | this.delayTimer = setTimeout(function () { | ||
23137 | _this2.setPopupVisible(visible); | ||
23138 | _this2.clearDelayTimer(); | ||
23139 | }, delay); | ||
23140 | } else { | ||
23141 | this.setPopupVisible(visible); | ||
23142 | } | ||
23143 | }, | ||
23144 | clearDelayTimer: function clearDelayTimer() { | ||
23145 | if (this.delayTimer) { | ||
23146 | clearTimeout(this.delayTimer); | ||
23147 | this.delayTimer = null; | ||
23148 | } | ||
23149 | }, | ||
23150 | clearOutsideHandler: function clearOutsideHandler() { | ||
23151 | if (this.clickOutsideHandler) { | ||
23152 | this.clickOutsideHandler.remove(); | ||
23153 | this.clickOutsideHandler = null; | ||
23154 | } | ||
23155 | |||
23156 | if (this.touchOutsideHandler) { | ||
23157 | this.touchOutsideHandler.remove(); | ||
23158 | this.touchOutsideHandler = null; | ||
23159 | } | ||
23160 | }, | ||
23161 | createTwoChains: function createTwoChains(event) { | ||
23162 | var childPros = this.props.children.props; | ||
23163 | var props = this.props; | ||
23164 | if (childPros[event] && props[event]) { | ||
23165 | return this['fire' + event]; | ||
23166 | } | ||
23167 | return childPros[event] || props[event]; | ||
23168 | }, | ||
23169 | isClickToShow: function isClickToShow() { | ||
23170 | var _props = this.props, | ||
23171 | action = _props.action, | ||
23172 | showAction = _props.showAction; | ||
23173 | |||
23174 | return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1; | ||
23175 | }, | ||
23176 | isClickToHide: function isClickToHide() { | ||
23177 | var _props2 = this.props, | ||
23178 | action = _props2.action, | ||
23179 | hideAction = _props2.hideAction; | ||
23180 | |||
23181 | return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1; | ||
23182 | }, | ||
23183 | isMouseEnterToShow: function isMouseEnterToShow() { | ||
23184 | var _props3 = this.props, | ||
23185 | action = _props3.action, | ||
23186 | showAction = _props3.showAction; | ||
23187 | |||
23188 | return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1; | ||
23189 | }, | ||
23190 | isMouseLeaveToHide: function isMouseLeaveToHide() { | ||
23191 | var _props4 = this.props, | ||
23192 | action = _props4.action, | ||
23193 | hideAction = _props4.hideAction; | ||
23194 | |||
23195 | return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1; | ||
23196 | }, | ||
23197 | isFocusToShow: function isFocusToShow() { | ||
23198 | var _props5 = this.props, | ||
23199 | action = _props5.action, | ||
23200 | showAction = _props5.showAction; | ||
23201 | |||
23202 | return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1; | ||
23203 | }, | ||
23204 | isBlurToHide: function isBlurToHide() { | ||
23205 | var _props6 = this.props, | ||
23206 | action = _props6.action, | ||
23207 | hideAction = _props6.hideAction; | ||
23208 | |||
23209 | return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1; | ||
23210 | }, | ||
23211 | forcePopupAlign: function forcePopupAlign() { | ||
23212 | if (this.state.popupVisible && this._component && this._component.alignInstance) { | ||
23213 | this._component.alignInstance.forceAlign(); | ||
23214 | } | ||
23215 | }, | ||
23216 | fireEvents: function fireEvents(type, e) { | ||
23217 | var childCallback = this.props.children.props[type]; | ||
23218 | if (childCallback) { | ||
23219 | childCallback(e); | ||
23220 | } | ||
23221 | var callback = this.props[type]; | ||
23222 | if (callback) { | ||
23223 | callback(e); | ||
23224 | } | ||
23225 | }, | ||
23226 | close: function close() { | ||
23227 | this.setPopupVisible(false); | ||
23228 | }, | ||
23229 | render: function render() { | ||
23230 | var props = this.props; | ||
23231 | var children = props.children; | ||
23232 | var child = _react2["default"].Children.only(children); | ||
23233 | var newChildProps = {}; | ||
23234 | if (this.isClickToHide() || this.isClickToShow()) { | ||
23235 | newChildProps.onClick = this.onClick; | ||
23236 | newChildProps.onMouseDown = this.onMouseDown; | ||
23237 | newChildProps.onTouchStart = this.onTouchStart; | ||
23238 | } else { | ||
23239 | newChildProps.onClick = this.createTwoChains('onClick'); | ||
23240 | newChildProps.onMouseDown = this.createTwoChains('onMouseDown'); | ||
23241 | newChildProps.onTouchStart = this.createTwoChains('onTouchStart'); | ||
23242 | } | ||
23243 | if (this.isMouseEnterToShow()) { | ||
23244 | newChildProps.onMouseEnter = this.onMouseEnter; | ||
23245 | } else { | ||
23246 | newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter'); | ||
23247 | } | ||
23248 | if (this.isMouseLeaveToHide()) { | ||
23249 | newChildProps.onMouseLeave = this.onMouseLeave; | ||
23250 | } else { | ||
23251 | newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave'); | ||
23252 | } | ||
23253 | if (this.isFocusToShow() || this.isBlurToHide()) { | ||
23254 | newChildProps.onFocus = this.onFocus; | ||
23255 | newChildProps.onBlur = this.onBlur; | ||
23256 | } else { | ||
23257 | newChildProps.onFocus = this.createTwoChains('onFocus'); | ||
23258 | newChildProps.onBlur = this.createTwoChains('onBlur'); | ||
23259 | } | ||
23260 | |||
23261 | return _react2["default"].cloneElement(child, newChildProps); | ||
23262 | } | ||
23263 | }); | ||
23264 | |||
23265 | exports["default"] = Trigger; | ||
23266 | module.exports = exports['default']; | ||
23267 | |||
23268 | /***/ }), | ||
23269 | /* 238 */ | ||
23270 | /***/ (function(module, exports, __webpack_require__) { | ||
23271 | |||
23272 | "use strict"; | ||
23273 | |||
23274 | |||
23275 | module.exports = __webpack_require__(237); | ||
23276 | |||
23277 | /***/ }), | ||
23278 | /* 239 */ | ||
23279 | /***/ (function(module, exports, __webpack_require__) { | ||
23280 | |||
23281 | "use strict"; | ||
23282 | |||
23283 | |||
23284 | Object.defineProperty(exports, "__esModule", { | ||
23285 | value: true | ||
23286 | }); | ||
23287 | |||
23288 | var _extends2 = __webpack_require__(49); | ||
23289 | |||
23290 | var _extends3 = _interopRequireDefault(_extends2); | ||
23291 | |||
23292 | exports.getAlignFromPlacement = getAlignFromPlacement; | ||
23293 | exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign; | ||
23294 | |||
23295 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
23296 | |||
23297 | function isPointsEq(a1, a2) { | ||
23298 | return a1[0] === a2[0] && a1[1] === a2[1]; | ||
23299 | } | ||
23300 | |||
23301 | function getAlignFromPlacement(builtinPlacements, placementStr, align) { | ||
23302 | var baseAlign = builtinPlacements[placementStr] || {}; | ||
23303 | return (0, _extends3["default"])({}, baseAlign, align); | ||
23304 | } | ||
23305 | |||
23306 | function getPopupClassNameFromAlign(builtinPlacements, prefixCls, align) { | ||
23307 | var points = align.points; | ||
23308 | for (var placement in builtinPlacements) { | ||
23309 | if (builtinPlacements.hasOwnProperty(placement)) { | ||
23310 | if (isPointsEq(builtinPlacements[placement].points, points)) { | ||
23311 | return prefixCls + '-placement-' + placement; | ||
23312 | } | ||
23313 | } | ||
23314 | } | ||
23315 | return ''; | ||
23316 | } | ||
23317 | |||
23318 | /***/ }), | ||
23319 | /* 240 */ | ||
23320 | /***/ (function(module, exports, __webpack_require__) { | ||
23321 | |||
23322 | "use strict"; | ||
23323 | |||
23324 | |||
23325 | Object.defineProperty(exports, "__esModule", { | ||
23326 | value: true | ||
23327 | }); | ||
23328 | exports["default"] = contains; | ||
23329 | function contains(root, n) { | ||
23330 | var node = n; | ||
23331 | while (node) { | ||
23332 | if (node === root) { | ||
23333 | return true; | ||
23334 | } | ||
23335 | node = node.parentNode; | ||
23336 | } | ||
23337 | |||
23338 | return false; | ||
23339 | } | ||
23340 | module.exports = exports['default']; | ||
23341 | |||
23342 | /***/ }), | ||
23343 | /* 241 */ | ||
23344 | /***/ (function(module, exports, __webpack_require__) { | ||
23345 | |||
23346 | "use strict"; | ||
23347 | |||
23348 | |||
23349 | Object.defineProperty(exports, "__esModule", { | ||
23350 | value: true | ||
23351 | }); | ||
23352 | |||
23353 | var _extends2 = __webpack_require__(49); | ||
23354 | |||
23355 | var _extends3 = _interopRequireDefault(_extends2); | ||
23356 | |||
23357 | exports['default'] = getContainerRenderMixin; | ||
23358 | |||
23359 | var _reactDom = __webpack_require__(8); | ||
23360 | |||
23361 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
23362 | |||
23363 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
23364 | |||
23365 | function defaultGetContainer() { | ||
23366 | var container = document.createElement('div'); | ||
23367 | document.body.appendChild(container); | ||
23368 | return container; | ||
23369 | } | ||
23370 | |||
23371 | function getContainerRenderMixin(config) { | ||
23372 | var _config$autoMount = config.autoMount, | ||
23373 | autoMount = _config$autoMount === undefined ? true : _config$autoMount, | ||
23374 | _config$autoDestroy = config.autoDestroy, | ||
23375 | autoDestroy = _config$autoDestroy === undefined ? true : _config$autoDestroy, | ||
23376 | isVisible = config.isVisible, | ||
23377 | getComponent = config.getComponent, | ||
23378 | _config$getContainer = config.getContainer, | ||
23379 | getContainer = _config$getContainer === undefined ? defaultGetContainer : _config$getContainer; | ||
23380 | |||
23381 | |||
23382 | var mixin = void 0; | ||
23383 | |||
23384 | function _renderComponent(instance, componentArg, ready) { | ||
23385 | if (!isVisible || instance._component || isVisible(instance)) { | ||
23386 | if (!instance._container) { | ||
23387 | instance._container = getContainer(instance); | ||
23388 | } | ||
23389 | var component = void 0; | ||
23390 | if (instance.getComponent) { | ||
23391 | component = instance.getComponent(componentArg); | ||
23392 | } else { | ||
23393 | component = getComponent(instance, componentArg); | ||
23394 | } | ||
23395 | _reactDom2['default'].unstable_renderSubtreeIntoContainer(instance, component, instance._container, function callback() { | ||
23396 | instance._component = this; | ||
23397 | if (ready) { | ||
23398 | ready.call(this); | ||
23399 | } | ||
23400 | }); | ||
23401 | } | ||
23402 | } | ||
23403 | |||
23404 | if (autoMount) { | ||
23405 | mixin = (0, _extends3['default'])({}, mixin, { | ||
23406 | componentDidMount: function componentDidMount() { | ||
23407 | _renderComponent(this); | ||
23408 | }, | ||
23409 | componentDidUpdate: function componentDidUpdate() { | ||
23410 | _renderComponent(this); | ||
23411 | } | ||
23412 | }); | ||
23413 | } | ||
23414 | |||
23415 | if (!autoMount || !autoDestroy) { | ||
23416 | mixin = (0, _extends3['default'])({}, mixin, { | ||
23417 | renderComponent: function renderComponent(componentArg, ready) { | ||
23418 | _renderComponent(this, componentArg, ready); | ||
23419 | } | ||
23420 | }); | ||
23421 | } | ||
23422 | |||
23423 | function _removeContainer(instance) { | ||
23424 | if (instance._container) { | ||
23425 | var container = instance._container; | ||
23426 | _reactDom2['default'].unmountComponentAtNode(container); | ||
23427 | container.parentNode.removeChild(container); | ||
23428 | instance._container = null; | ||
23429 | } | ||
23430 | } | ||
23431 | |||
23432 | if (autoDestroy) { | ||
23433 | mixin = (0, _extends3['default'])({}, mixin, { | ||
23434 | componentWillUnmount: function componentWillUnmount() { | ||
23435 | _removeContainer(this); | ||
23436 | } | ||
23437 | }); | ||
23438 | } else { | ||
23439 | mixin = (0, _extends3['default'])({}, mixin, { | ||
23440 | removeContainer: function removeContainer() { | ||
23441 | _removeContainer(this); | ||
23442 | } | ||
23443 | }); | ||
23444 | } | ||
23445 | |||
23446 | return mixin; | ||
23447 | } | ||
23448 | module.exports = exports['default']; | ||
23449 | |||
23450 | /***/ }), | ||
23451 | /* 242 */ | ||
23452 | /***/ (function(module, exports, __webpack_require__) { | ||
23453 | |||
23454 | "use strict"; | ||
23455 | /** | ||
23456 | * Copyright 2013-present, Facebook, Inc. | ||
23457 | * All rights reserved. | ||
23458 | * | ||
23459 | * This source code is licensed under the BSD-style license found in the | ||
23460 | * LICENSE file in the root directory of this source tree. An additional grant | ||
23461 | * of patent rights can be found in the PATENTS file in the same directory. | ||
23462 | * | ||
23463 | */ | ||
23464 | |||
23465 | |||
23466 | |||
23467 | var ARIADOMPropertyConfig = { | ||
23468 | Properties: { | ||
23469 | // Global States and Properties | ||
23470 | 'aria-current': 0, // state | ||
23471 | 'aria-details': 0, | ||
23472 | 'aria-disabled': 0, // state | ||
23473 | 'aria-hidden': 0, // state | ||
23474 | 'aria-invalid': 0, // state | ||
23475 | 'aria-keyshortcuts': 0, | ||
23476 | 'aria-label': 0, | ||
23477 | 'aria-roledescription': 0, | ||
23478 | // Widget Attributes | ||
23479 | 'aria-autocomplete': 0, | ||
23480 | 'aria-checked': 0, | ||
23481 | 'aria-expanded': 0, | ||
23482 | 'aria-haspopup': 0, | ||
23483 | 'aria-level': 0, | ||
23484 | 'aria-modal': 0, | ||
23485 | 'aria-multiline': 0, | ||
23486 | 'aria-multiselectable': 0, | ||
23487 | 'aria-orientation': 0, | ||
23488 | 'aria-placeholder': 0, | ||
23489 | 'aria-pressed': 0, | ||
23490 | 'aria-readonly': 0, | ||
23491 | 'aria-required': 0, | ||
23492 | 'aria-selected': 0, | ||
23493 | 'aria-sort': 0, | ||
23494 | 'aria-valuemax': 0, | ||
23495 | 'aria-valuemin': 0, | ||
23496 | 'aria-valuenow': 0, | ||
23497 | 'aria-valuetext': 0, | ||
23498 | // Live Region Attributes | ||
23499 | 'aria-atomic': 0, | ||
23500 | 'aria-busy': 0, | ||
23501 | 'aria-live': 0, | ||
23502 | 'aria-relevant': 0, | ||
23503 | // Drag-and-Drop Attributes | ||
23504 | 'aria-dropeffect': 0, | ||
23505 | 'aria-grabbed': 0, | ||
23506 | // Relationship Attributes | ||
23507 | 'aria-activedescendant': 0, | ||
23508 | 'aria-colcount': 0, | ||
23509 | 'aria-colindex': 0, | ||
23510 | 'aria-colspan': 0, | ||
23511 | 'aria-controls': 0, | ||
23512 | 'aria-describedby': 0, | ||
23513 | 'aria-errormessage': 0, | ||
23514 | 'aria-flowto': 0, | ||
23515 | 'aria-labelledby': 0, | ||
23516 | 'aria-owns': 0, | ||
23517 | 'aria-posinset': 0, | ||
23518 | 'aria-rowcount': 0, | ||
23519 | 'aria-rowindex': 0, | ||
23520 | 'aria-rowspan': 0, | ||
23521 | 'aria-setsize': 0 | ||
23522 | }, | ||
23523 | DOMAttributeNames: {}, | ||
23524 | DOMPropertyNames: {} | ||
23525 | }; | ||
23526 | |||
23527 | module.exports = ARIADOMPropertyConfig; | ||
23528 | |||
23529 | /***/ }), | ||
23530 | /* 243 */ | ||
23531 | /***/ (function(module, exports, __webpack_require__) { | ||
23532 | |||
23533 | "use strict"; | ||
23534 | /** | ||
23535 | * Copyright 2013-present, Facebook, Inc. | ||
23536 | * All rights reserved. | ||
23537 | * | ||
23538 | * This source code is licensed under the BSD-style license found in the | ||
23539 | * LICENSE file in the root directory of this source tree. An additional grant | ||
23540 | * of patent rights can be found in the PATENTS file in the same directory. | ||
23541 | * | ||
23542 | */ | ||
23543 | |||
23544 | |||
23545 | |||
23546 | var ReactDOMComponentTree = __webpack_require__(6); | ||
23547 | |||
23548 | var focusNode = __webpack_require__(111); | ||
23549 | |||
23550 | var AutoFocusUtils = { | ||
23551 | focusDOMComponent: function () { | ||
23552 | focusNode(ReactDOMComponentTree.getNodeFromInstance(this)); | ||
23553 | } | ||
23554 | }; | ||
23555 | |||
23556 | module.exports = AutoFocusUtils; | ||
23557 | |||
23558 | /***/ }), | ||
23559 | /* 244 */ | ||
23560 | /***/ (function(module, exports, __webpack_require__) { | ||
23561 | |||
23562 | "use strict"; | ||
23563 | /** | ||
23564 | * Copyright 2013-present Facebook, Inc. | ||
23565 | * All rights reserved. | ||
23566 | * | ||
23567 | * This source code is licensed under the BSD-style license found in the | ||
23568 | * LICENSE file in the root directory of this source tree. An additional grant | ||
23569 | * of patent rights can be found in the PATENTS file in the same directory. | ||
23570 | * | ||
23571 | */ | ||
23572 | |||
23573 | |||
23574 | |||
23575 | var EventPropagators = __webpack_require__(46); | ||
23576 | var ExecutionEnvironment = __webpack_require__(7); | ||
23577 | var FallbackCompositionState = __webpack_require__(250); | ||
23578 | var SyntheticCompositionEvent = __webpack_require__(293); | ||
23579 | var SyntheticInputEvent = __webpack_require__(296); | ||
23580 | |||
23581 | var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space | ||
23582 | var START_KEYCODE = 229; | ||
23583 | |||
23584 | var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; | ||
23585 | |||
23586 | var documentMode = null; | ||
23587 | if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { | ||
23588 | documentMode = document.documentMode; | ||
23589 | } | ||
23590 | |||
23591 | // Webkit offers a very useful `textInput` event that can be used to | ||
23592 | // directly represent `beforeInput`. The IE `textinput` event is not as | ||
23593 | // useful, so we don't use it. | ||
23594 | var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto(); | ||
23595 | |||
23596 | // In IE9+, we have access to composition events, but the data supplied | ||
23597 | // by the native compositionend event may be incorrect. Japanese ideographic | ||
23598 | // spaces, for instance (\u3000) are not recorded correctly. | ||
23599 | var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); | ||
23600 | |||
23601 | /** | ||
23602 | * Opera <= 12 includes TextEvent in window, but does not fire | ||
23603 | * text input events. Rely on keypress instead. | ||
23604 | */ | ||
23605 | function isPresto() { | ||
23606 | var opera = window.opera; | ||
23607 | return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; | ||
23608 | } | ||
23609 | |||
23610 | var SPACEBAR_CODE = 32; | ||
23611 | var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); | ||
23612 | |||
23613 | // Events and their corresponding property names. | ||
23614 | var eventTypes = { | ||
23615 | beforeInput: { | ||
23616 | phasedRegistrationNames: { | ||
23617 | bubbled: 'onBeforeInput', | ||
23618 | captured: 'onBeforeInputCapture' | ||
23619 | }, | ||
23620 | dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste'] | ||
23621 | }, | ||
23622 | compositionEnd: { | ||
23623 | phasedRegistrationNames: { | ||
23624 | bubbled: 'onCompositionEnd', | ||
23625 | captured: 'onCompositionEndCapture' | ||
23626 | }, | ||
23627 | dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] | ||
23628 | }, | ||
23629 | compositionStart: { | ||
23630 | phasedRegistrationNames: { | ||
23631 | bubbled: 'onCompositionStart', | ||
23632 | captured: 'onCompositionStartCapture' | ||
23633 | }, | ||
23634 | dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] | ||
23635 | }, | ||
23636 | compositionUpdate: { | ||
23637 | phasedRegistrationNames: { | ||
23638 | bubbled: 'onCompositionUpdate', | ||
23639 | captured: 'onCompositionUpdateCapture' | ||
23640 | }, | ||
23641 | dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] | ||
23642 | } | ||
23643 | }; | ||
23644 | |||
23645 | // Track whether we've ever handled a keypress on the space key. | ||
23646 | var hasSpaceKeypress = false; | ||
23647 | |||
23648 | /** | ||
23649 | * Return whether a native keypress event is assumed to be a command. | ||
23650 | * This is required because Firefox fires `keypress` events for key commands | ||
23651 | * (cut, copy, select-all, etc.) even though no character is inserted. | ||
23652 | */ | ||
23653 | function isKeypressCommand(nativeEvent) { | ||
23654 | return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && | ||
23655 | // ctrlKey && altKey is equivalent to AltGr, and is not a command. | ||
23656 | !(nativeEvent.ctrlKey && nativeEvent.altKey); | ||
23657 | } | ||
23658 | |||
23659 | /** | ||
23660 | * Translate native top level events into event types. | ||
23661 | * | ||
23662 | * @param {string} topLevelType | ||
23663 | * @return {object} | ||
23664 | */ | ||
23665 | function getCompositionEventType(topLevelType) { | ||
23666 | switch (topLevelType) { | ||
23667 | case 'topCompositionStart': | ||
23668 | return eventTypes.compositionStart; | ||
23669 | case 'topCompositionEnd': | ||
23670 | return eventTypes.compositionEnd; | ||
23671 | case 'topCompositionUpdate': | ||
23672 | return eventTypes.compositionUpdate; | ||
23673 | } | ||
23674 | } | ||
23675 | |||
23676 | /** | ||
23677 | * Does our fallback best-guess model think this event signifies that | ||
23678 | * composition has begun? | ||
23679 | * | ||
23680 | * @param {string} topLevelType | ||
23681 | * @param {object} nativeEvent | ||
23682 | * @return {boolean} | ||
23683 | */ | ||
23684 | function isFallbackCompositionStart(topLevelType, nativeEvent) { | ||
23685 | return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE; | ||
23686 | } | ||
23687 | |||
23688 | /** | ||
23689 | * Does our fallback mode think that this event is the end of composition? | ||
23690 | * | ||
23691 | * @param {string} topLevelType | ||
23692 | * @param {object} nativeEvent | ||
23693 | * @return {boolean} | ||
23694 | */ | ||
23695 | function isFallbackCompositionEnd(topLevelType, nativeEvent) { | ||
23696 | switch (topLevelType) { | ||
23697 | case 'topKeyUp': | ||
23698 | // Command keys insert or clear IME input. | ||
23699 | return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; | ||
23700 | case 'topKeyDown': | ||
23701 | // Expect IME keyCode on each keydown. If we get any other | ||
23702 | // code we must have exited earlier. | ||
23703 | return nativeEvent.keyCode !== START_KEYCODE; | ||
23704 | case 'topKeyPress': | ||
23705 | case 'topMouseDown': | ||
23706 | case 'topBlur': | ||
23707 | // Events are not possible without cancelling IME. | ||
23708 | return true; | ||
23709 | default: | ||
23710 | return false; | ||
23711 | } | ||
23712 | } | ||
23713 | |||
23714 | /** | ||
23715 | * Google Input Tools provides composition data via a CustomEvent, | ||
23716 | * with the `data` property populated in the `detail` object. If this | ||
23717 | * is available on the event object, use it. If not, this is a plain | ||
23718 | * composition event and we have nothing special to extract. | ||
23719 | * | ||
23720 | * @param {object} nativeEvent | ||
23721 | * @return {?string} | ||
23722 | */ | ||
23723 | function getDataFromCustomEvent(nativeEvent) { | ||
23724 | var detail = nativeEvent.detail; | ||
23725 | if (typeof detail === 'object' && 'data' in detail) { | ||
23726 | return detail.data; | ||
23727 | } | ||
23728 | return null; | ||
23729 | } | ||
23730 | |||
23731 | // Track the current IME composition fallback object, if any. | ||
23732 | var currentComposition = null; | ||
23733 | |||
23734 | /** | ||
23735 | * @return {?object} A SyntheticCompositionEvent. | ||
23736 | */ | ||
23737 | function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
23738 | var eventType; | ||
23739 | var fallbackData; | ||
23740 | |||
23741 | if (canUseCompositionEvent) { | ||
23742 | eventType = getCompositionEventType(topLevelType); | ||
23743 | } else if (!currentComposition) { | ||
23744 | if (isFallbackCompositionStart(topLevelType, nativeEvent)) { | ||
23745 | eventType = eventTypes.compositionStart; | ||
23746 | } | ||
23747 | } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { | ||
23748 | eventType = eventTypes.compositionEnd; | ||
23749 | } | ||
23750 | |||
23751 | if (!eventType) { | ||
23752 | return null; | ||
23753 | } | ||
23754 | |||
23755 | if (useFallbackCompositionData) { | ||
23756 | // The current composition is stored statically and must not be | ||
23757 | // overwritten while composition continues. | ||
23758 | if (!currentComposition && eventType === eventTypes.compositionStart) { | ||
23759 | currentComposition = FallbackCompositionState.getPooled(nativeEventTarget); | ||
23760 | } else if (eventType === eventTypes.compositionEnd) { | ||
23761 | if (currentComposition) { | ||
23762 | fallbackData = currentComposition.getData(); | ||
23763 | } | ||
23764 | } | ||
23765 | } | ||
23766 | |||
23767 | var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); | ||
23768 | |||
23769 | if (fallbackData) { | ||
23770 | // Inject data generated from fallback path into the synthetic event. | ||
23771 | // This matches the property of native CompositionEventInterface. | ||
23772 | event.data = fallbackData; | ||
23773 | } else { | ||
23774 | var customData = getDataFromCustomEvent(nativeEvent); | ||
23775 | if (customData !== null) { | ||
23776 | event.data = customData; | ||
23777 | } | ||
23778 | } | ||
23779 | |||
23780 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
23781 | return event; | ||
23782 | } | ||
23783 | |||
23784 | /** | ||
23785 | * @param {string} topLevelType Record from `EventConstants`. | ||
23786 | * @param {object} nativeEvent Native browser event. | ||
23787 | * @return {?string} The string corresponding to this `beforeInput` event. | ||
23788 | */ | ||
23789 | function getNativeBeforeInputChars(topLevelType, nativeEvent) { | ||
23790 | switch (topLevelType) { | ||
23791 | case 'topCompositionEnd': | ||
23792 | return getDataFromCustomEvent(nativeEvent); | ||
23793 | case 'topKeyPress': | ||
23794 | /** | ||
23795 | * If native `textInput` events are available, our goal is to make | ||
23796 | * use of them. However, there is a special case: the spacebar key. | ||
23797 | * In Webkit, preventing default on a spacebar `textInput` event | ||
23798 | * cancels character insertion, but it *also* causes the browser | ||
23799 | * to fall back to its default spacebar behavior of scrolling the | ||
23800 | * page. | ||
23801 | * | ||
23802 | * Tracking at: | ||
23803 | * https://code.google.com/p/chromium/issues/detail?id=355103 | ||
23804 | * | ||
23805 | * To avoid this issue, use the keypress event as if no `textInput` | ||
23806 | * event is available. | ||
23807 | */ | ||
23808 | var which = nativeEvent.which; | ||
23809 | if (which !== SPACEBAR_CODE) { | ||
23810 | return null; | ||
23811 | } | ||
23812 | |||
23813 | hasSpaceKeypress = true; | ||
23814 | return SPACEBAR_CHAR; | ||
23815 | |||
23816 | case 'topTextInput': | ||
23817 | // Record the characters to be added to the DOM. | ||
23818 | var chars = nativeEvent.data; | ||
23819 | |||
23820 | // If it's a spacebar character, assume that we have already handled | ||
23821 | // it at the keypress level and bail immediately. Android Chrome | ||
23822 | // doesn't give us keycodes, so we need to blacklist it. | ||
23823 | if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { | ||
23824 | return null; | ||
23825 | } | ||
23826 | |||
23827 | return chars; | ||
23828 | |||
23829 | default: | ||
23830 | // For other native event types, do nothing. | ||
23831 | return null; | ||
23832 | } | ||
23833 | } | ||
23834 | |||
23835 | /** | ||
23836 | * For browsers that do not provide the `textInput` event, extract the | ||
23837 | * appropriate string to use for SyntheticInputEvent. | ||
23838 | * | ||
23839 | * @param {string} topLevelType Record from `EventConstants`. | ||
23840 | * @param {object} nativeEvent Native browser event. | ||
23841 | * @return {?string} The fallback string for this `beforeInput` event. | ||
23842 | */ | ||
23843 | function getFallbackBeforeInputChars(topLevelType, nativeEvent) { | ||
23844 | // If we are currently composing (IME) and using a fallback to do so, | ||
23845 | // try to extract the composed characters from the fallback object. | ||
23846 | // If composition event is available, we extract a string only at | ||
23847 | // compositionevent, otherwise extract it at fallback events. | ||
23848 | if (currentComposition) { | ||
23849 | if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) { | ||
23850 | var chars = currentComposition.getData(); | ||
23851 | FallbackCompositionState.release(currentComposition); | ||
23852 | currentComposition = null; | ||
23853 | return chars; | ||
23854 | } | ||
23855 | return null; | ||
23856 | } | ||
23857 | |||
23858 | switch (topLevelType) { | ||
23859 | case 'topPaste': | ||
23860 | // If a paste event occurs after a keypress, throw out the input | ||
23861 | // chars. Paste events should not lead to BeforeInput events. | ||
23862 | return null; | ||
23863 | case 'topKeyPress': | ||
23864 | /** | ||
23865 | * As of v27, Firefox may fire keypress events even when no character | ||
23866 | * will be inserted. A few possibilities: | ||
23867 | * | ||
23868 | * - `which` is `0`. Arrow keys, Esc key, etc. | ||
23869 | * | ||
23870 | * - `which` is the pressed key code, but no char is available. | ||
23871 | * Ex: 'AltGr + d` in Polish. There is no modified character for | ||
23872 | * this key combination and no character is inserted into the | ||
23873 | * document, but FF fires the keypress for char code `100` anyway. | ||
23874 | * No `input` event will occur. | ||
23875 | * | ||
23876 | * - `which` is the pressed key code, but a command combination is | ||
23877 | * being used. Ex: `Cmd+C`. No character is inserted, and no | ||
23878 | * `input` event will occur. | ||
23879 | */ | ||
23880 | if (nativeEvent.which && !isKeypressCommand(nativeEvent)) { | ||
23881 | return String.fromCharCode(nativeEvent.which); | ||
23882 | } | ||
23883 | return null; | ||
23884 | case 'topCompositionEnd': | ||
23885 | return useFallbackCompositionData ? null : nativeEvent.data; | ||
23886 | default: | ||
23887 | return null; | ||
23888 | } | ||
23889 | } | ||
23890 | |||
23891 | /** | ||
23892 | * Extract a SyntheticInputEvent for `beforeInput`, based on either native | ||
23893 | * `textInput` or fallback behavior. | ||
23894 | * | ||
23895 | * @return {?object} A SyntheticInputEvent. | ||
23896 | */ | ||
23897 | function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
23898 | var chars; | ||
23899 | |||
23900 | if (canUseTextInputEvent) { | ||
23901 | chars = getNativeBeforeInputChars(topLevelType, nativeEvent); | ||
23902 | } else { | ||
23903 | chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); | ||
23904 | } | ||
23905 | |||
23906 | // If no characters are being inserted, no BeforeInput event should | ||
23907 | // be fired. | ||
23908 | if (!chars) { | ||
23909 | return null; | ||
23910 | } | ||
23911 | |||
23912 | var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget); | ||
23913 | |||
23914 | event.data = chars; | ||
23915 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
23916 | return event; | ||
23917 | } | ||
23918 | |||
23919 | /** | ||
23920 | * Create an `onBeforeInput` event to match | ||
23921 | * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. | ||
23922 | * | ||
23923 | * This event plugin is based on the native `textInput` event | ||
23924 | * available in Chrome, Safari, Opera, and IE. This event fires after | ||
23925 | * `onKeyPress` and `onCompositionEnd`, but before `onInput`. | ||
23926 | * | ||
23927 | * `beforeInput` is spec'd but not implemented in any browsers, and | ||
23928 | * the `input` event does not provide any useful information about what has | ||
23929 | * actually been added, contrary to the spec. Thus, `textInput` is the best | ||
23930 | * available event to identify the characters that have actually been inserted | ||
23931 | * into the target node. | ||
23932 | * | ||
23933 | * This plugin is also responsible for emitting `composition` events, thus | ||
23934 | * allowing us to share composition fallback code for both `beforeInput` and | ||
23935 | * `composition` event types. | ||
23936 | */ | ||
23937 | var BeforeInputEventPlugin = { | ||
23938 | |||
23939 | eventTypes: eventTypes, | ||
23940 | |||
23941 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
23942 | return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)]; | ||
23943 | } | ||
23944 | }; | ||
23945 | |||
23946 | module.exports = BeforeInputEventPlugin; | ||
23947 | |||
23948 | /***/ }), | ||
23949 | /* 245 */ | ||
23950 | /***/ (function(module, exports, __webpack_require__) { | ||
23951 | |||
23952 | "use strict"; | ||
23953 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
23954 | * Copyright 2013-present, Facebook, Inc. | ||
23955 | * All rights reserved. | ||
23956 | * | ||
23957 | * This source code is licensed under the BSD-style license found in the | ||
23958 | * LICENSE file in the root directory of this source tree. An additional grant | ||
23959 | * of patent rights can be found in the PATENTS file in the same directory. | ||
23960 | * | ||
23961 | */ | ||
23962 | |||
23963 | |||
23964 | |||
23965 | var CSSProperty = __webpack_require__(118); | ||
23966 | var ExecutionEnvironment = __webpack_require__(7); | ||
23967 | var ReactInstrumentation = __webpack_require__(12); | ||
23968 | |||
23969 | var camelizeStyleName = __webpack_require__(213); | ||
23970 | var dangerousStyleValue = __webpack_require__(303); | ||
23971 | var hyphenateStyleName = __webpack_require__(220); | ||
23972 | var memoizeStringOnly = __webpack_require__(223); | ||
23973 | var warning = __webpack_require__(2); | ||
23974 | |||
23975 | var processStyleName = memoizeStringOnly(function (styleName) { | ||
23976 | return hyphenateStyleName(styleName); | ||
23977 | }); | ||
23978 | |||
23979 | var hasShorthandPropertyBug = false; | ||
23980 | var styleFloatAccessor = 'cssFloat'; | ||
23981 | if (ExecutionEnvironment.canUseDOM) { | ||
23982 | var tempStyle = document.createElement('div').style; | ||
23983 | try { | ||
23984 | // IE8 throws "Invalid argument." if resetting shorthand style properties. | ||
23985 | tempStyle.font = ''; | ||
23986 | } catch (e) { | ||
23987 | hasShorthandPropertyBug = true; | ||
23988 | } | ||
23989 | // IE8 only supports accessing cssFloat (standard) as styleFloat | ||
23990 | if (document.documentElement.style.cssFloat === undefined) { | ||
23991 | styleFloatAccessor = 'styleFloat'; | ||
23992 | } | ||
23993 | } | ||
23994 | |||
23995 | if (process.env.NODE_ENV !== 'production') { | ||
23996 | // 'msTransform' is correct, but the other prefixes should be capitalized | ||
23997 | var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/; | ||
23998 | |||
23999 | // style values shouldn't contain a semicolon | ||
24000 | var badStyleValueWithSemicolonPattern = /;\s*$/; | ||
24001 | |||
24002 | var warnedStyleNames = {}; | ||
24003 | var warnedStyleValues = {}; | ||
24004 | var warnedForNaNValue = false; | ||
24005 | |||
24006 | var warnHyphenatedStyleName = function (name, owner) { | ||
24007 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { | ||
24008 | return; | ||
24009 | } | ||
24010 | |||
24011 | warnedStyleNames[name] = true; | ||
24012 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0; | ||
24013 | }; | ||
24014 | |||
24015 | var warnBadVendoredStyleName = function (name, owner) { | ||
24016 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { | ||
24017 | return; | ||
24018 | } | ||
24019 | |||
24020 | warnedStyleNames[name] = true; | ||
24021 | 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; | ||
24022 | }; | ||
24023 | |||
24024 | var warnStyleValueWithSemicolon = function (name, value, owner) { | ||
24025 | if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { | ||
24026 | return; | ||
24027 | } | ||
24028 | |||
24029 | warnedStyleValues[value] = true; | ||
24030 | 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; | ||
24031 | }; | ||
24032 | |||
24033 | var warnStyleValueIsNaN = function (name, value, owner) { | ||
24034 | if (warnedForNaNValue) { | ||
24035 | return; | ||
24036 | } | ||
24037 | |||
24038 | warnedForNaNValue = true; | ||
24039 | process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0; | ||
24040 | }; | ||
24041 | |||
24042 | var checkRenderMessage = function (owner) { | ||
24043 | if (owner) { | ||
24044 | var name = owner.getName(); | ||
24045 | if (name) { | ||
24046 | return ' Check the render method of `' + name + '`.'; | ||
24047 | } | ||
24048 | } | ||
24049 | return ''; | ||
24050 | }; | ||
24051 | |||
24052 | /** | ||
24053 | * @param {string} name | ||
24054 | * @param {*} value | ||
24055 | * @param {ReactDOMComponent} component | ||
24056 | */ | ||
24057 | var warnValidStyle = function (name, value, component) { | ||
24058 | var owner; | ||
24059 | if (component) { | ||
24060 | owner = component._currentElement._owner; | ||
24061 | } | ||
24062 | if (name.indexOf('-') > -1) { | ||
24063 | warnHyphenatedStyleName(name, owner); | ||
24064 | } else if (badVendoredStyleNamePattern.test(name)) { | ||
24065 | warnBadVendoredStyleName(name, owner); | ||
24066 | } else if (badStyleValueWithSemicolonPattern.test(value)) { | ||
24067 | warnStyleValueWithSemicolon(name, value, owner); | ||
24068 | } | ||
24069 | |||
24070 | if (typeof value === 'number' && isNaN(value)) { | ||
24071 | warnStyleValueIsNaN(name, value, owner); | ||
24072 | } | ||
24073 | }; | ||
24074 | } | ||
24075 | |||
24076 | /** | ||
24077 | * Operations for dealing with CSS properties. | ||
24078 | */ | ||
24079 | var CSSPropertyOperations = { | ||
24080 | |||
24081 | /** | ||
24082 | * Serializes a mapping of style properties for use as inline styles: | ||
24083 | * | ||
24084 | * > createMarkupForStyles({width: '200px', height: 0}) | ||
24085 | * "width:200px;height:0;" | ||
24086 | * | ||
24087 | * Undefined values are ignored so that declarative programming is easier. | ||
24088 | * The result should be HTML-escaped before insertion into the DOM. | ||
24089 | * | ||
24090 | * @param {object} styles | ||
24091 | * @param {ReactDOMComponent} component | ||
24092 | * @return {?string} | ||
24093 | */ | ||
24094 | createMarkupForStyles: function (styles, component) { | ||
24095 | var serialized = ''; | ||
24096 | for (var styleName in styles) { | ||
24097 | if (!styles.hasOwnProperty(styleName)) { | ||
24098 | continue; | ||
24099 | } | ||
24100 | var styleValue = styles[styleName]; | ||
24101 | if (process.env.NODE_ENV !== 'production') { | ||
24102 | warnValidStyle(styleName, styleValue, component); | ||
24103 | } | ||
24104 | if (styleValue != null) { | ||
24105 | serialized += processStyleName(styleName) + ':'; | ||
24106 | serialized += dangerousStyleValue(styleName, styleValue, component) + ';'; | ||
24107 | } | ||
24108 | } | ||
24109 | return serialized || null; | ||
24110 | }, | ||
24111 | |||
24112 | /** | ||
24113 | * Sets the value for multiple styles on a node. If a value is specified as | ||
24114 | * '' (empty string), the corresponding style property will be unset. | ||
24115 | * | ||
24116 | * @param {DOMElement} node | ||
24117 | * @param {object} styles | ||
24118 | * @param {ReactDOMComponent} component | ||
24119 | */ | ||
24120 | setValueForStyles: function (node, styles, component) { | ||
24121 | if (process.env.NODE_ENV !== 'production') { | ||
24122 | ReactInstrumentation.debugTool.onHostOperation({ | ||
24123 | instanceID: component._debugID, | ||
24124 | type: 'update styles', | ||
24125 | payload: styles | ||
24126 | }); | ||
24127 | } | ||
24128 | |||
24129 | var style = node.style; | ||
24130 | for (var styleName in styles) { | ||
24131 | if (!styles.hasOwnProperty(styleName)) { | ||
24132 | continue; | ||
24133 | } | ||
24134 | if (process.env.NODE_ENV !== 'production') { | ||
24135 | warnValidStyle(styleName, styles[styleName], component); | ||
24136 | } | ||
24137 | var styleValue = dangerousStyleValue(styleName, styles[styleName], component); | ||
24138 | if (styleName === 'float' || styleName === 'cssFloat') { | ||
24139 | styleName = styleFloatAccessor; | ||
24140 | } | ||
24141 | if (styleValue) { | ||
24142 | style[styleName] = styleValue; | ||
24143 | } else { | ||
24144 | var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName]; | ||
24145 | if (expansion) { | ||
24146 | // Shorthand property that IE8 won't like unsetting, so unset each | ||
24147 | // component to placate it | ||
24148 | for (var individualStyleName in expansion) { | ||
24149 | style[individualStyleName] = ''; | ||
24150 | } | ||
24151 | } else { | ||
24152 | style[styleName] = ''; | ||
24153 | } | ||
24154 | } | ||
24155 | } | ||
24156 | } | ||
24157 | |||
24158 | }; | ||
24159 | |||
24160 | module.exports = CSSPropertyOperations; | ||
24161 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
24162 | |||
24163 | /***/ }), | ||
24164 | /* 246 */ | ||
24165 | /***/ (function(module, exports, __webpack_require__) { | ||
24166 | |||
24167 | "use strict"; | ||
24168 | /** | ||
24169 | * Copyright 2013-present, Facebook, Inc. | ||
24170 | * All rights reserved. | ||
24171 | * | ||
24172 | * This source code is licensed under the BSD-style license found in the | ||
24173 | * LICENSE file in the root directory of this source tree. An additional grant | ||
24174 | * of patent rights can be found in the PATENTS file in the same directory. | ||
24175 | * | ||
24176 | */ | ||
24177 | |||
24178 | |||
24179 | |||
24180 | var EventPluginHub = __webpack_require__(45); | ||
24181 | var EventPropagators = __webpack_require__(46); | ||
24182 | var ExecutionEnvironment = __webpack_require__(7); | ||
24183 | var ReactDOMComponentTree = __webpack_require__(6); | ||
24184 | var ReactUpdates = __webpack_require__(16); | ||
24185 | var SyntheticEvent = __webpack_require__(19); | ||
24186 | |||
24187 | var getEventTarget = __webpack_require__(86); | ||
24188 | var isEventSupported = __webpack_require__(87); | ||
24189 | var isTextInputElement = __webpack_require__(136); | ||
24190 | |||
24191 | var eventTypes = { | ||
24192 | change: { | ||
24193 | phasedRegistrationNames: { | ||
24194 | bubbled: 'onChange', | ||
24195 | captured: 'onChangeCapture' | ||
24196 | }, | ||
24197 | dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange'] | ||
24198 | } | ||
24199 | }; | ||
24200 | |||
24201 | /** | ||
24202 | * For IE shims | ||
24203 | */ | ||
24204 | var activeElement = null; | ||
24205 | var activeElementInst = null; | ||
24206 | var activeElementValue = null; | ||
24207 | var activeElementValueProp = null; | ||
24208 | |||
24209 | /** | ||
24210 | * SECTION: handle `change` event | ||
24211 | */ | ||
24212 | function shouldUseChangeEvent(elem) { | ||
24213 | var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); | ||
24214 | return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; | ||
24215 | } | ||
24216 | |||
24217 | var doesChangeEventBubble = false; | ||
24218 | if (ExecutionEnvironment.canUseDOM) { | ||
24219 | // See `handleChange` comment below | ||
24220 | doesChangeEventBubble = isEventSupported('change') && (!document.documentMode || document.documentMode > 8); | ||
24221 | } | ||
24222 | |||
24223 | function manualDispatchChangeEvent(nativeEvent) { | ||
24224 | var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent)); | ||
24225 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
24226 | |||
24227 | // If change and propertychange bubbled, we'd just bind to it like all the | ||
24228 | // other events and have it go through ReactBrowserEventEmitter. Since it | ||
24229 | // doesn't, we manually listen for the events and so we have to enqueue and | ||
24230 | // process the abstract event manually. | ||
24231 | // | ||
24232 | // Batching is necessary here in order to ensure that all event handlers run | ||
24233 | // before the next rerender (including event handlers attached to ancestor | ||
24234 | // elements instead of directly on the input). Without this, controlled | ||
24235 | // components don't work properly in conjunction with event bubbling because | ||
24236 | // the component is rerendered and the value reverted before all the event | ||
24237 | // handlers can run. See https://github.com/facebook/react/issues/708. | ||
24238 | ReactUpdates.batchedUpdates(runEventInBatch, event); | ||
24239 | } | ||
24240 | |||
24241 | function runEventInBatch(event) { | ||
24242 | EventPluginHub.enqueueEvents(event); | ||
24243 | EventPluginHub.processEventQueue(false); | ||
24244 | } | ||
24245 | |||
24246 | function startWatchingForChangeEventIE8(target, targetInst) { | ||
24247 | activeElement = target; | ||
24248 | activeElementInst = targetInst; | ||
24249 | activeElement.attachEvent('onchange', manualDispatchChangeEvent); | ||
24250 | } | ||
24251 | |||
24252 | function stopWatchingForChangeEventIE8() { | ||
24253 | if (!activeElement) { | ||
24254 | return; | ||
24255 | } | ||
24256 | activeElement.detachEvent('onchange', manualDispatchChangeEvent); | ||
24257 | activeElement = null; | ||
24258 | activeElementInst = null; | ||
24259 | } | ||
24260 | |||
24261 | function getTargetInstForChangeEvent(topLevelType, targetInst) { | ||
24262 | if (topLevelType === 'topChange') { | ||
24263 | return targetInst; | ||
24264 | } | ||
24265 | } | ||
24266 | function handleEventsForChangeEventIE8(topLevelType, target, targetInst) { | ||
24267 | if (topLevelType === 'topFocus') { | ||
24268 | // stopWatching() should be a noop here but we call it just in case we | ||
24269 | // missed a blur event somehow. | ||
24270 | stopWatchingForChangeEventIE8(); | ||
24271 | startWatchingForChangeEventIE8(target, targetInst); | ||
24272 | } else if (topLevelType === 'topBlur') { | ||
24273 | stopWatchingForChangeEventIE8(); | ||
24274 | } | ||
24275 | } | ||
24276 | |||
24277 | /** | ||
24278 | * SECTION: handle `input` event | ||
24279 | */ | ||
24280 | var isInputEventSupported = false; | ||
24281 | if (ExecutionEnvironment.canUseDOM) { | ||
24282 | // IE9 claims to support the input event but fails to trigger it when | ||
24283 | // deleting text, so we ignore its input events. | ||
24284 | // IE10+ fire input events to often, such when a placeholder | ||
24285 | // changes or when an input with a placeholder is focused. | ||
24286 | isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 11); | ||
24287 | } | ||
24288 | |||
24289 | /** | ||
24290 | * (For IE <=11) Replacement getter/setter for the `value` property that gets | ||
24291 | * set on the active element. | ||
24292 | */ | ||
24293 | var newValueProp = { | ||
24294 | get: function () { | ||
24295 | return activeElementValueProp.get.call(this); | ||
24296 | }, | ||
24297 | set: function (val) { | ||
24298 | // Cast to a string so we can do equality checks. | ||
24299 | activeElementValue = '' + val; | ||
24300 | activeElementValueProp.set.call(this, val); | ||
24301 | } | ||
24302 | }; | ||
24303 | |||
24304 | /** | ||
24305 | * (For IE <=11) Starts tracking propertychange events on the passed-in element | ||
24306 | * and override the value property so that we can distinguish user events from | ||
24307 | * value changes in JS. | ||
24308 | */ | ||
24309 | function startWatchingForValueChange(target, targetInst) { | ||
24310 | activeElement = target; | ||
24311 | activeElementInst = targetInst; | ||
24312 | activeElementValue = target.value; | ||
24313 | activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value'); | ||
24314 | |||
24315 | // Not guarded in a canDefineProperty check: IE8 supports defineProperty only | ||
24316 | // on DOM elements | ||
24317 | Object.defineProperty(activeElement, 'value', newValueProp); | ||
24318 | if (activeElement.attachEvent) { | ||
24319 | activeElement.attachEvent('onpropertychange', handlePropertyChange); | ||
24320 | } else { | ||
24321 | activeElement.addEventListener('propertychange', handlePropertyChange, false); | ||
24322 | } | ||
24323 | } | ||
24324 | |||
24325 | /** | ||
24326 | * (For IE <=11) Removes the event listeners from the currently-tracked element, | ||
24327 | * if any exists. | ||
24328 | */ | ||
24329 | function stopWatchingForValueChange() { | ||
24330 | if (!activeElement) { | ||
24331 | return; | ||
24332 | } | ||
24333 | |||
24334 | // delete restores the original property definition | ||
24335 | delete activeElement.value; | ||
24336 | |||
24337 | if (activeElement.detachEvent) { | ||
24338 | activeElement.detachEvent('onpropertychange', handlePropertyChange); | ||
24339 | } else { | ||
24340 | activeElement.removeEventListener('propertychange', handlePropertyChange, false); | ||
24341 | } | ||
24342 | |||
24343 | activeElement = null; | ||
24344 | activeElementInst = null; | ||
24345 | activeElementValue = null; | ||
24346 | activeElementValueProp = null; | ||
24347 | } | ||
24348 | |||
24349 | /** | ||
24350 | * (For IE <=11) Handles a propertychange event, sending a `change` event if | ||
24351 | * the value of the active element has changed. | ||
24352 | */ | ||
24353 | function handlePropertyChange(nativeEvent) { | ||
24354 | if (nativeEvent.propertyName !== 'value') { | ||
24355 | return; | ||
24356 | } | ||
24357 | var value = nativeEvent.srcElement.value; | ||
24358 | if (value === activeElementValue) { | ||
24359 | return; | ||
24360 | } | ||
24361 | activeElementValue = value; | ||
24362 | |||
24363 | manualDispatchChangeEvent(nativeEvent); | ||
24364 | } | ||
24365 | |||
24366 | /** | ||
24367 | * If a `change` event should be fired, returns the target's ID. | ||
24368 | */ | ||
24369 | function getTargetInstForInputEvent(topLevelType, targetInst) { | ||
24370 | if (topLevelType === 'topInput') { | ||
24371 | // In modern browsers (i.e., not IE8 or IE9), the input event is exactly | ||
24372 | // what we want so fall through here and trigger an abstract event | ||
24373 | return targetInst; | ||
24374 | } | ||
24375 | } | ||
24376 | |||
24377 | function handleEventsForInputEventIE(topLevelType, target, targetInst) { | ||
24378 | if (topLevelType === 'topFocus') { | ||
24379 | // In IE8, we can capture almost all .value changes by adding a | ||
24380 | // propertychange handler and looking for events with propertyName | ||
24381 | // equal to 'value' | ||
24382 | // In IE9-11, propertychange fires for most input events but is buggy and | ||
24383 | // doesn't fire when text is deleted, but conveniently, selectionchange | ||
24384 | // appears to fire in all of the remaining cases so we catch those and | ||
24385 | // forward the event if the value has changed | ||
24386 | // In either case, we don't want to call the event handler if the value | ||
24387 | // is changed from JS so we redefine a setter for `.value` that updates | ||
24388 | // our activeElementValue variable, allowing us to ignore those changes | ||
24389 | // | ||
24390 | // stopWatching() should be a noop here but we call it just in case we | ||
24391 | // missed a blur event somehow. | ||
24392 | stopWatchingForValueChange(); | ||
24393 | startWatchingForValueChange(target, targetInst); | ||
24394 | } else if (topLevelType === 'topBlur') { | ||
24395 | stopWatchingForValueChange(); | ||
24396 | } | ||
24397 | } | ||
24398 | |||
24399 | // For IE8 and IE9. | ||
24400 | function getTargetInstForInputEventIE(topLevelType, targetInst) { | ||
24401 | if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') { | ||
24402 | // On the selectionchange event, the target is just document which isn't | ||
24403 | // helpful for us so just check activeElement instead. | ||
24404 | // | ||
24405 | // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire | ||
24406 | // propertychange on the first input event after setting `value` from a | ||
24407 | // script and fires only keydown, keypress, keyup. Catching keyup usually | ||
24408 | // gets it and catching keydown lets us fire an event for the first | ||
24409 | // keystroke if user does a key repeat (it'll be a little delayed: right | ||
24410 | // before the second keystroke). Other input methods (e.g., paste) seem to | ||
24411 | // fire selectionchange normally. | ||
24412 | if (activeElement && activeElement.value !== activeElementValue) { | ||
24413 | activeElementValue = activeElement.value; | ||
24414 | return activeElementInst; | ||
24415 | } | ||
24416 | } | ||
24417 | } | ||
24418 | |||
24419 | /** | ||
24420 | * SECTION: handle `click` event | ||
24421 | */ | ||
24422 | function shouldUseClickEvent(elem) { | ||
24423 | // Use the `click` event to detect changes to checkbox and radio inputs. | ||
24424 | // This approach works across all browsers, whereas `change` does not fire | ||
24425 | // until `blur` in IE8. | ||
24426 | return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); | ||
24427 | } | ||
24428 | |||
24429 | function getTargetInstForClickEvent(topLevelType, targetInst) { | ||
24430 | if (topLevelType === 'topClick') { | ||
24431 | return targetInst; | ||
24432 | } | ||
24433 | } | ||
24434 | |||
24435 | function handleControlledInputBlur(inst, node) { | ||
24436 | // TODO: In IE, inst is occasionally null. Why? | ||
24437 | if (inst == null) { | ||
24438 | return; | ||
24439 | } | ||
24440 | |||
24441 | // Fiber and ReactDOM keep wrapper state in separate places | ||
24442 | var state = inst._wrapperState || node._wrapperState; | ||
24443 | |||
24444 | if (!state || !state.controlled || node.type !== 'number') { | ||
24445 | return; | ||
24446 | } | ||
24447 | |||
24448 | // If controlled, assign the value attribute to the current value on blur | ||
24449 | var value = '' + node.value; | ||
24450 | if (node.getAttribute('value') !== value) { | ||
24451 | node.setAttribute('value', value); | ||
24452 | } | ||
24453 | } | ||
24454 | |||
24455 | /** | ||
24456 | * This plugin creates an `onChange` event that normalizes change events | ||
24457 | * across form elements. This event fires at a time when it's possible to | ||
24458 | * change the element's value without seeing a flicker. | ||
24459 | * | ||
24460 | * Supported elements are: | ||
24461 | * - input (see `isTextInputElement`) | ||
24462 | * - textarea | ||
24463 | * - select | ||
24464 | */ | ||
24465 | var ChangeEventPlugin = { | ||
24466 | |||
24467 | eventTypes: eventTypes, | ||
24468 | |||
24469 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
24470 | var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window; | ||
24471 | |||
24472 | var getTargetInstFunc, handleEventFunc; | ||
24473 | if (shouldUseChangeEvent(targetNode)) { | ||
24474 | if (doesChangeEventBubble) { | ||
24475 | getTargetInstFunc = getTargetInstForChangeEvent; | ||
24476 | } else { | ||
24477 | handleEventFunc = handleEventsForChangeEventIE8; | ||
24478 | } | ||
24479 | } else if (isTextInputElement(targetNode)) { | ||
24480 | if (isInputEventSupported) { | ||
24481 | getTargetInstFunc = getTargetInstForInputEvent; | ||
24482 | } else { | ||
24483 | getTargetInstFunc = getTargetInstForInputEventIE; | ||
24484 | handleEventFunc = handleEventsForInputEventIE; | ||
24485 | } | ||
24486 | } else if (shouldUseClickEvent(targetNode)) { | ||
24487 | getTargetInstFunc = getTargetInstForClickEvent; | ||
24488 | } | ||
24489 | |||
24490 | if (getTargetInstFunc) { | ||
24491 | var inst = getTargetInstFunc(topLevelType, targetInst); | ||
24492 | if (inst) { | ||
24493 | var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget); | ||
24494 | event.type = 'change'; | ||
24495 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
24496 | return event; | ||
24497 | } | ||
24498 | } | ||
24499 | |||
24500 | if (handleEventFunc) { | ||
24501 | handleEventFunc(topLevelType, targetNode, targetInst); | ||
24502 | } | ||
24503 | |||
24504 | // When blurring, set the value attribute for number inputs | ||
24505 | if (topLevelType === 'topBlur') { | ||
24506 | handleControlledInputBlur(targetInst, targetNode); | ||
24507 | } | ||
24508 | } | ||
24509 | |||
24510 | }; | ||
24511 | |||
24512 | module.exports = ChangeEventPlugin; | ||
24513 | |||
24514 | /***/ }), | ||
24515 | /* 247 */ | ||
24516 | /***/ (function(module, exports, __webpack_require__) { | ||
24517 | |||
24518 | "use strict"; | ||
24519 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
24520 | * Copyright 2013-present, Facebook, Inc. | ||
24521 | * All rights reserved. | ||
24522 | * | ||
24523 | * This source code is licensed under the BSD-style license found in the | ||
24524 | * LICENSE file in the root directory of this source tree. An additional grant | ||
24525 | * of patent rights can be found in the PATENTS file in the same directory. | ||
24526 | * | ||
24527 | */ | ||
24528 | |||
24529 | |||
24530 | |||
24531 | var _prodInvariant = __webpack_require__(3); | ||
24532 | |||
24533 | var DOMLazyTree = __webpack_require__(37); | ||
24534 | var ExecutionEnvironment = __webpack_require__(7); | ||
24535 | |||
24536 | var createNodesFromMarkup = __webpack_require__(216); | ||
24537 | var emptyFunction = __webpack_require__(10); | ||
24538 | var invariant = __webpack_require__(1); | ||
24539 | |||
24540 | var Danger = { | ||
24541 | |||
24542 | /** | ||
24543 | * Replaces a node with a string of markup at its current position within its | ||
24544 | * parent. The markup must render into a single root node. | ||
24545 | * | ||
24546 | * @param {DOMElement} oldChild Child node to replace. | ||
24547 | * @param {string} markup Markup to render in place of the child node. | ||
24548 | * @internal | ||
24549 | */ | ||
24550 | dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) { | ||
24551 | !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; | ||
24552 | !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0; | ||
24553 | !(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; | ||
24554 | |||
24555 | if (typeof markup === 'string') { | ||
24556 | var newChild = createNodesFromMarkup(markup, emptyFunction)[0]; | ||
24557 | oldChild.parentNode.replaceChild(newChild, oldChild); | ||
24558 | } else { | ||
24559 | DOMLazyTree.replaceChildWithTree(oldChild, markup); | ||
24560 | } | ||
24561 | } | ||
24562 | |||
24563 | }; | ||
24564 | |||
24565 | module.exports = Danger; | ||
24566 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
24567 | |||
24568 | /***/ }), | ||
24569 | /* 248 */ | ||
24570 | /***/ (function(module, exports, __webpack_require__) { | ||
24571 | |||
24572 | "use strict"; | ||
24573 | /** | ||
24574 | * Copyright 2013-present, Facebook, Inc. | ||
24575 | * All rights reserved. | ||
24576 | * | ||
24577 | * This source code is licensed under the BSD-style license found in the | ||
24578 | * LICENSE file in the root directory of this source tree. An additional grant | ||
24579 | * of patent rights can be found in the PATENTS file in the same directory. | ||
24580 | * | ||
24581 | */ | ||
24582 | |||
24583 | |||
24584 | |||
24585 | /** | ||
24586 | * Module that is injectable into `EventPluginHub`, that specifies a | ||
24587 | * deterministic ordering of `EventPlugin`s. A convenient way to reason about | ||
24588 | * plugins, without having to package every one of them. This is better than | ||
24589 | * having plugins be ordered in the same order that they are injected because | ||
24590 | * that ordering would be influenced by the packaging order. | ||
24591 | * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that | ||
24592 | * preventing default on events is convenient in `SimpleEventPlugin` handlers. | ||
24593 | */ | ||
24594 | |||
24595 | var DefaultEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin']; | ||
24596 | |||
24597 | module.exports = DefaultEventPluginOrder; | ||
24598 | |||
24599 | /***/ }), | ||
24600 | /* 249 */ | ||
24601 | /***/ (function(module, exports, __webpack_require__) { | ||
24602 | |||
24603 | "use strict"; | ||
24604 | /** | ||
24605 | * Copyright 2013-present, Facebook, Inc. | ||
24606 | * All rights reserved. | ||
24607 | * | ||
24608 | * This source code is licensed under the BSD-style license found in the | ||
24609 | * LICENSE file in the root directory of this source tree. An additional grant | ||
24610 | * of patent rights can be found in the PATENTS file in the same directory. | ||
24611 | * | ||
24612 | */ | ||
24613 | |||
24614 | |||
24615 | |||
24616 | var EventPropagators = __webpack_require__(46); | ||
24617 | var ReactDOMComponentTree = __webpack_require__(6); | ||
24618 | var SyntheticMouseEvent = __webpack_require__(55); | ||
24619 | |||
24620 | var eventTypes = { | ||
24621 | mouseEnter: { | ||
24622 | registrationName: 'onMouseEnter', | ||
24623 | dependencies: ['topMouseOut', 'topMouseOver'] | ||
24624 | }, | ||
24625 | mouseLeave: { | ||
24626 | registrationName: 'onMouseLeave', | ||
24627 | dependencies: ['topMouseOut', 'topMouseOver'] | ||
24628 | } | ||
24629 | }; | ||
24630 | |||
24631 | var EnterLeaveEventPlugin = { | ||
24632 | |||
24633 | eventTypes: eventTypes, | ||
24634 | |||
24635 | /** | ||
24636 | * For almost every interaction we care about, there will be both a top-level | ||
24637 | * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that | ||
24638 | * we do not extract duplicate events. However, moving the mouse into the | ||
24639 | * browser from outside will not fire a `mouseout` event. In this case, we use | ||
24640 | * the `mouseover` top-level event. | ||
24641 | */ | ||
24642 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
24643 | if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { | ||
24644 | return null; | ||
24645 | } | ||
24646 | if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') { | ||
24647 | // Must not be a mouse in or mouse out - ignoring. | ||
24648 | return null; | ||
24649 | } | ||
24650 | |||
24651 | var win; | ||
24652 | if (nativeEventTarget.window === nativeEventTarget) { | ||
24653 | // `nativeEventTarget` is probably a window object. | ||
24654 | win = nativeEventTarget; | ||
24655 | } else { | ||
24656 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. | ||
24657 | var doc = nativeEventTarget.ownerDocument; | ||
24658 | if (doc) { | ||
24659 | win = doc.defaultView || doc.parentWindow; | ||
24660 | } else { | ||
24661 | win = window; | ||
24662 | } | ||
24663 | } | ||
24664 | |||
24665 | var from; | ||
24666 | var to; | ||
24667 | if (topLevelType === 'topMouseOut') { | ||
24668 | from = targetInst; | ||
24669 | var related = nativeEvent.relatedTarget || nativeEvent.toElement; | ||
24670 | to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null; | ||
24671 | } else { | ||
24672 | // Moving to a node from outside the window. | ||
24673 | from = null; | ||
24674 | to = targetInst; | ||
24675 | } | ||
24676 | |||
24677 | if (from === to) { | ||
24678 | // Nothing pertains to our managed components. | ||
24679 | return null; | ||
24680 | } | ||
24681 | |||
24682 | var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from); | ||
24683 | var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to); | ||
24684 | |||
24685 | var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget); | ||
24686 | leave.type = 'mouseleave'; | ||
24687 | leave.target = fromNode; | ||
24688 | leave.relatedTarget = toNode; | ||
24689 | |||
24690 | var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget); | ||
24691 | enter.type = 'mouseenter'; | ||
24692 | enter.target = toNode; | ||
24693 | enter.relatedTarget = fromNode; | ||
24694 | |||
24695 | EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to); | ||
24696 | |||
24697 | return [leave, enter]; | ||
24698 | } | ||
24699 | |||
24700 | }; | ||
24701 | |||
24702 | module.exports = EnterLeaveEventPlugin; | ||
24703 | |||
24704 | /***/ }), | ||
24705 | /* 250 */ | ||
24706 | /***/ (function(module, exports, __webpack_require__) { | ||
24707 | |||
24708 | "use strict"; | ||
24709 | /** | ||
24710 | * Copyright 2013-present, Facebook, Inc. | ||
24711 | * All rights reserved. | ||
24712 | * | ||
24713 | * This source code is licensed under the BSD-style license found in the | ||
24714 | * LICENSE file in the root directory of this source tree. An additional grant | ||
24715 | * of patent rights can be found in the PATENTS file in the same directory. | ||
24716 | * | ||
24717 | */ | ||
24718 | |||
24719 | |||
24720 | |||
24721 | var _assign = __webpack_require__(4); | ||
24722 | |||
24723 | var PooledClass = __webpack_require__(30); | ||
24724 | |||
24725 | var getTextContentAccessor = __webpack_require__(134); | ||
24726 | |||
24727 | /** | ||
24728 | * This helper class stores information about text content of a target node, | ||
24729 | * allowing comparison of content before and after a given event. | ||
24730 | * | ||
24731 | * Identify the node where selection currently begins, then observe | ||
24732 | * both its text content and its current position in the DOM. Since the | ||
24733 | * browser may natively replace the target node during composition, we can | ||
24734 | * use its position to find its replacement. | ||
24735 | * | ||
24736 | * @param {DOMEventTarget} root | ||
24737 | */ | ||
24738 | function FallbackCompositionState(root) { | ||
24739 | this._root = root; | ||
24740 | this._startText = this.getText(); | ||
24741 | this._fallbackText = null; | ||
24742 | } | ||
24743 | |||
24744 | _assign(FallbackCompositionState.prototype, { | ||
24745 | destructor: function () { | ||
24746 | this._root = null; | ||
24747 | this._startText = null; | ||
24748 | this._fallbackText = null; | ||
24749 | }, | ||
24750 | |||
24751 | /** | ||
24752 | * Get current text of input. | ||
24753 | * | ||
24754 | * @return {string} | ||
24755 | */ | ||
24756 | getText: function () { | ||
24757 | if ('value' in this._root) { | ||
24758 | return this._root.value; | ||
24759 | } | ||
24760 | return this._root[getTextContentAccessor()]; | ||
24761 | }, | ||
24762 | |||
24763 | /** | ||
24764 | * Determine the differing substring between the initially stored | ||
24765 | * text content and the current content. | ||
24766 | * | ||
24767 | * @return {string} | ||
24768 | */ | ||
24769 | getData: function () { | ||
24770 | if (this._fallbackText) { | ||
24771 | return this._fallbackText; | ||
24772 | } | ||
24773 | |||
24774 | var start; | ||
24775 | var startValue = this._startText; | ||
24776 | var startLength = startValue.length; | ||
24777 | var end; | ||
24778 | var endValue = this.getText(); | ||
24779 | var endLength = endValue.length; | ||
24780 | |||
24781 | for (start = 0; start < startLength; start++) { | ||
24782 | if (startValue[start] !== endValue[start]) { | ||
24783 | break; | ||
24784 | } | ||
24785 | } | ||
24786 | |||
24787 | var minEnd = startLength - start; | ||
24788 | for (end = 1; end <= minEnd; end++) { | ||
24789 | if (startValue[startLength - end] !== endValue[endLength - end]) { | ||
24790 | break; | ||
24791 | } | ||
24792 | } | ||
24793 | |||
24794 | var sliceTail = end > 1 ? 1 - end : undefined; | ||
24795 | this._fallbackText = endValue.slice(start, sliceTail); | ||
24796 | return this._fallbackText; | ||
24797 | } | ||
24798 | }); | ||
24799 | |||
24800 | PooledClass.addPoolingTo(FallbackCompositionState); | ||
24801 | |||
24802 | module.exports = FallbackCompositionState; | ||
24803 | |||
24804 | /***/ }), | ||
24805 | /* 251 */ | ||
24806 | /***/ (function(module, exports, __webpack_require__) { | ||
24807 | |||
24808 | "use strict"; | ||
24809 | /** | ||
24810 | * Copyright 2013-present, Facebook, Inc. | ||
24811 | * All rights reserved. | ||
24812 | * | ||
24813 | * This source code is licensed under the BSD-style license found in the | ||
24814 | * LICENSE file in the root directory of this source tree. An additional grant | ||
24815 | * of patent rights can be found in the PATENTS file in the same directory. | ||
24816 | * | ||
24817 | */ | ||
24818 | |||
24819 | |||
24820 | |||
24821 | var DOMProperty = __webpack_require__(21); | ||
24822 | |||
24823 | var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; | ||
24824 | var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; | ||
24825 | var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE; | ||
24826 | var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE; | ||
24827 | var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE; | ||
24828 | |||
24829 | var HTMLDOMPropertyConfig = { | ||
24830 | isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')), | ||
24831 | Properties: { | ||
24832 | /** | ||
24833 | * Standard Properties | ||
24834 | */ | ||
24835 | accept: 0, | ||
24836 | acceptCharset: 0, | ||
24837 | accessKey: 0, | ||
24838 | action: 0, | ||
24839 | allowFullScreen: HAS_BOOLEAN_VALUE, | ||
24840 | allowTransparency: 0, | ||
24841 | alt: 0, | ||
24842 | // specifies target context for links with `preload` type | ||
24843 | as: 0, | ||
24844 | async: HAS_BOOLEAN_VALUE, | ||
24845 | autoComplete: 0, | ||
24846 | // autoFocus is polyfilled/normalized by AutoFocusUtils | ||
24847 | // autoFocus: HAS_BOOLEAN_VALUE, | ||
24848 | autoPlay: HAS_BOOLEAN_VALUE, | ||
24849 | capture: HAS_BOOLEAN_VALUE, | ||
24850 | cellPadding: 0, | ||
24851 | cellSpacing: 0, | ||
24852 | charSet: 0, | ||
24853 | challenge: 0, | ||
24854 | checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
24855 | cite: 0, | ||
24856 | classID: 0, | ||
24857 | className: 0, | ||
24858 | cols: HAS_POSITIVE_NUMERIC_VALUE, | ||
24859 | colSpan: 0, | ||
24860 | content: 0, | ||
24861 | contentEditable: 0, | ||
24862 | contextMenu: 0, | ||
24863 | controls: HAS_BOOLEAN_VALUE, | ||
24864 | coords: 0, | ||
24865 | crossOrigin: 0, | ||
24866 | data: 0, // For `<object />` acts as `src`. | ||
24867 | dateTime: 0, | ||
24868 | 'default': HAS_BOOLEAN_VALUE, | ||
24869 | defer: HAS_BOOLEAN_VALUE, | ||
24870 | dir: 0, | ||
24871 | disabled: HAS_BOOLEAN_VALUE, | ||
24872 | download: HAS_OVERLOADED_BOOLEAN_VALUE, | ||
24873 | draggable: 0, | ||
24874 | encType: 0, | ||
24875 | form: 0, | ||
24876 | formAction: 0, | ||
24877 | formEncType: 0, | ||
24878 | formMethod: 0, | ||
24879 | formNoValidate: HAS_BOOLEAN_VALUE, | ||
24880 | formTarget: 0, | ||
24881 | frameBorder: 0, | ||
24882 | headers: 0, | ||
24883 | height: 0, | ||
24884 | hidden: HAS_BOOLEAN_VALUE, | ||
24885 | high: 0, | ||
24886 | href: 0, | ||
24887 | hrefLang: 0, | ||
24888 | htmlFor: 0, | ||
24889 | httpEquiv: 0, | ||
24890 | icon: 0, | ||
24891 | id: 0, | ||
24892 | inputMode: 0, | ||
24893 | integrity: 0, | ||
24894 | is: 0, | ||
24895 | keyParams: 0, | ||
24896 | keyType: 0, | ||
24897 | kind: 0, | ||
24898 | label: 0, | ||
24899 | lang: 0, | ||
24900 | list: 0, | ||
24901 | loop: HAS_BOOLEAN_VALUE, | ||
24902 | low: 0, | ||
24903 | manifest: 0, | ||
24904 | marginHeight: 0, | ||
24905 | marginWidth: 0, | ||
24906 | max: 0, | ||
24907 | maxLength: 0, | ||
24908 | media: 0, | ||
24909 | mediaGroup: 0, | ||
24910 | method: 0, | ||
24911 | min: 0, | ||
24912 | minLength: 0, | ||
24913 | // Caution; `option.selected` is not updated if `select.multiple` is | ||
24914 | // disabled with `removeAttribute`. | ||
24915 | multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
24916 | muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
24917 | name: 0, | ||
24918 | nonce: 0, | ||
24919 | noValidate: HAS_BOOLEAN_VALUE, | ||
24920 | open: HAS_BOOLEAN_VALUE, | ||
24921 | optimum: 0, | ||
24922 | pattern: 0, | ||
24923 | placeholder: 0, | ||
24924 | playsInline: HAS_BOOLEAN_VALUE, | ||
24925 | poster: 0, | ||
24926 | preload: 0, | ||
24927 | profile: 0, | ||
24928 | radioGroup: 0, | ||
24929 | readOnly: HAS_BOOLEAN_VALUE, | ||
24930 | referrerPolicy: 0, | ||
24931 | rel: 0, | ||
24932 | required: HAS_BOOLEAN_VALUE, | ||
24933 | reversed: HAS_BOOLEAN_VALUE, | ||
24934 | role: 0, | ||
24935 | rows: HAS_POSITIVE_NUMERIC_VALUE, | ||
24936 | rowSpan: HAS_NUMERIC_VALUE, | ||
24937 | sandbox: 0, | ||
24938 | scope: 0, | ||
24939 | scoped: HAS_BOOLEAN_VALUE, | ||
24940 | scrolling: 0, | ||
24941 | seamless: HAS_BOOLEAN_VALUE, | ||
24942 | selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
24943 | shape: 0, | ||
24944 | size: HAS_POSITIVE_NUMERIC_VALUE, | ||
24945 | sizes: 0, | ||
24946 | span: HAS_POSITIVE_NUMERIC_VALUE, | ||
24947 | spellCheck: 0, | ||
24948 | src: 0, | ||
24949 | srcDoc: 0, | ||
24950 | srcLang: 0, | ||
24951 | srcSet: 0, | ||
24952 | start: HAS_NUMERIC_VALUE, | ||
24953 | step: 0, | ||
24954 | style: 0, | ||
24955 | summary: 0, | ||
24956 | tabIndex: 0, | ||
24957 | target: 0, | ||
24958 | title: 0, | ||
24959 | // Setting .type throws on non-<input> tags | ||
24960 | type: 0, | ||
24961 | useMap: 0, | ||
24962 | value: 0, | ||
24963 | width: 0, | ||
24964 | wmode: 0, | ||
24965 | wrap: 0, | ||
24966 | |||
24967 | /** | ||
24968 | * RDFa Properties | ||
24969 | */ | ||
24970 | about: 0, | ||
24971 | datatype: 0, | ||
24972 | inlist: 0, | ||
24973 | prefix: 0, | ||
24974 | // property is also supported for OpenGraph in meta tags. | ||
24975 | property: 0, | ||
24976 | resource: 0, | ||
24977 | 'typeof': 0, | ||
24978 | vocab: 0, | ||
24979 | |||
24980 | /** | ||
24981 | * Non-standard Properties | ||
24982 | */ | ||
24983 | // autoCapitalize and autoCorrect are supported in Mobile Safari for | ||
24984 | // keyboard hints. | ||
24985 | autoCapitalize: 0, | ||
24986 | autoCorrect: 0, | ||
24987 | // autoSave allows WebKit/Blink to persist values of input fields on page reloads | ||
24988 | autoSave: 0, | ||
24989 | // color is for Safari mask-icon link | ||
24990 | color: 0, | ||
24991 | // itemProp, itemScope, itemType are for | ||
24992 | // Microdata support. See http://schema.org/docs/gs.html | ||
24993 | itemProp: 0, | ||
24994 | itemScope: HAS_BOOLEAN_VALUE, | ||
24995 | itemType: 0, | ||
24996 | // itemID and itemRef are for Microdata support as well but | ||
24997 | // only specified in the WHATWG spec document. See | ||
24998 | // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api | ||
24999 | itemID: 0, | ||
25000 | itemRef: 0, | ||
25001 | // results show looking glass icon and recent searches on input | ||
25002 | // search fields in WebKit/Blink | ||
25003 | results: 0, | ||
25004 | // IE-only attribute that specifies security restrictions on an iframe | ||
25005 | // as an alternative to the sandbox attribute on IE<10 | ||
25006 | security: 0, | ||
25007 | // IE-only attribute that controls focus behavior | ||
25008 | unselectable: 0 | ||
25009 | }, | ||
25010 | DOMAttributeNames: { | ||
25011 | acceptCharset: 'accept-charset', | ||
25012 | className: 'class', | ||
25013 | htmlFor: 'for', | ||
25014 | httpEquiv: 'http-equiv' | ||
25015 | }, | ||
25016 | DOMPropertyNames: {}, | ||
25017 | DOMMutationMethods: { | ||
25018 | value: function (node, value) { | ||
25019 | if (value == null) { | ||
25020 | return node.removeAttribute('value'); | ||
25021 | } | ||
25022 | |||
25023 | // Number inputs get special treatment due to some edge cases in | ||
25024 | // Chrome. Let everything else assign the value attribute as normal. | ||
25025 | // https://github.com/facebook/react/issues/7253#issuecomment-236074326 | ||
25026 | if (node.type !== 'number' || node.hasAttribute('value') === false) { | ||
25027 | node.setAttribute('value', '' + value); | ||
25028 | } else if (node.validity && !node.validity.badInput && node.ownerDocument.activeElement !== node) { | ||
25029 | // Don't assign an attribute if validation reports bad | ||
25030 | // input. Chrome will clear the value. Additionally, don't | ||
25031 | // operate on inputs that have focus, otherwise Chrome might | ||
25032 | // strip off trailing decimal places and cause the user's | ||
25033 | // cursor position to jump to the beginning of the input. | ||
25034 | // | ||
25035 | // In ReactDOMInput, we have an onBlur event that will trigger | ||
25036 | // this function again when focus is lost. | ||
25037 | node.setAttribute('value', '' + value); | ||
25038 | } | ||
25039 | } | ||
25040 | } | ||
25041 | }; | ||
25042 | |||
25043 | module.exports = HTMLDOMPropertyConfig; | ||
25044 | |||
25045 | /***/ }), | ||
25046 | /* 252 */ | ||
25047 | /***/ (function(module, exports, __webpack_require__) { | ||
25048 | |||
25049 | "use strict"; | ||
25050 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
25051 | * Copyright 2014-present, Facebook, Inc. | ||
25052 | * All rights reserved. | ||
25053 | * | ||
25054 | * This source code is licensed under the BSD-style license found in the | ||
25055 | * LICENSE file in the root directory of this source tree. An additional grant | ||
25056 | * of patent rights can be found in the PATENTS file in the same directory. | ||
25057 | * | ||
25058 | */ | ||
25059 | |||
25060 | |||
25061 | |||
25062 | var ReactReconciler = __webpack_require__(38); | ||
25063 | |||
25064 | var instantiateReactComponent = __webpack_require__(135); | ||
25065 | var KeyEscapeUtils = __webpack_require__(78); | ||
25066 | var shouldUpdateReactComponent = __webpack_require__(88); | ||
25067 | var traverseAllChildren = __webpack_require__(138); | ||
25068 | var warning = __webpack_require__(2); | ||
25069 | |||
25070 | var ReactComponentTreeHook; | ||
25071 | |||
25072 | if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { | ||
25073 | // Temporary hack. | ||
25074 | // Inline requires don't work well with Jest: | ||
25075 | // https://github.com/facebook/react/issues/7240 | ||
25076 | // Remove the inline requires when we don't need them anymore: | ||
25077 | // https://github.com/facebook/react/pull/7178 | ||
25078 | ReactComponentTreeHook = __webpack_require__(9); | ||
25079 | } | ||
25080 | |||
25081 | function instantiateChild(childInstances, child, name, selfDebugID) { | ||
25082 | // We found a component instance. | ||
25083 | var keyUnique = childInstances[name] === undefined; | ||
25084 | if (process.env.NODE_ENV !== 'production') { | ||
25085 | if (!ReactComponentTreeHook) { | ||
25086 | ReactComponentTreeHook = __webpack_require__(9); | ||
25087 | } | ||
25088 | if (!keyUnique) { | ||
25089 | 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; | ||
25090 | } | ||
25091 | } | ||
25092 | if (child != null && keyUnique) { | ||
25093 | childInstances[name] = instantiateReactComponent(child, true); | ||
25094 | } | ||
25095 | } | ||
25096 | |||
25097 | /** | ||
25098 | * ReactChildReconciler provides helpers for initializing or updating a set of | ||
25099 | * children. Its output is suitable for passing it onto ReactMultiChild which | ||
25100 | * does diffed reordering and insertion. | ||
25101 | */ | ||
25102 | var ReactChildReconciler = { | ||
25103 | /** | ||
25104 | * Generates a "mount image" for each of the supplied children. In the case | ||
25105 | * of `ReactDOMComponent`, a mount image is a string of markup. | ||
25106 | * | ||
25107 | * @param {?object} nestedChildNodes Nested child maps. | ||
25108 | * @return {?object} A set of child instances. | ||
25109 | * @internal | ||
25110 | */ | ||
25111 | instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // 0 in production and for roots | ||
25112 | ) { | ||
25113 | if (nestedChildNodes == null) { | ||
25114 | return null; | ||
25115 | } | ||
25116 | var childInstances = {}; | ||
25117 | |||
25118 | if (process.env.NODE_ENV !== 'production') { | ||
25119 | traverseAllChildren(nestedChildNodes, function (childInsts, child, name) { | ||
25120 | return instantiateChild(childInsts, child, name, selfDebugID); | ||
25121 | }, childInstances); | ||
25122 | } else { | ||
25123 | traverseAllChildren(nestedChildNodes, instantiateChild, childInstances); | ||
25124 | } | ||
25125 | return childInstances; | ||
25126 | }, | ||
25127 | |||
25128 | /** | ||
25129 | * Updates the rendered children and returns a new set of children. | ||
25130 | * | ||
25131 | * @param {?object} prevChildren Previously initialized set of children. | ||
25132 | * @param {?object} nextChildren Flat child element maps. | ||
25133 | * @param {ReactReconcileTransaction} transaction | ||
25134 | * @param {object} context | ||
25135 | * @return {?object} A new set of child instances. | ||
25136 | * @internal | ||
25137 | */ | ||
25138 | updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID // 0 in production and for roots | ||
25139 | ) { | ||
25140 | // We currently don't have a way to track moves here but if we use iterators | ||
25141 | // instead of for..in we can zip the iterators and check if an item has | ||
25142 | // moved. | ||
25143 | // TODO: If nothing has changed, return the prevChildren object so that we | ||
25144 | // can quickly bailout if nothing has changed. | ||
25145 | if (!nextChildren && !prevChildren) { | ||
25146 | return; | ||
25147 | } | ||
25148 | var name; | ||
25149 | var prevChild; | ||
25150 | for (name in nextChildren) { | ||
25151 | if (!nextChildren.hasOwnProperty(name)) { | ||
25152 | continue; | ||
25153 | } | ||
25154 | prevChild = prevChildren && prevChildren[name]; | ||
25155 | var prevElement = prevChild && prevChild._currentElement; | ||
25156 | var nextElement = nextChildren[name]; | ||
25157 | if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) { | ||
25158 | ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context); | ||
25159 | nextChildren[name] = prevChild; | ||
25160 | } else { | ||
25161 | if (prevChild) { | ||
25162 | removedNodes[name] = ReactReconciler.getHostNode(prevChild); | ||
25163 | ReactReconciler.unmountComponent(prevChild, false); | ||
25164 | } | ||
25165 | // The child must be instantiated before it's mounted. | ||
25166 | var nextChildInstance = instantiateReactComponent(nextElement, true); | ||
25167 | nextChildren[name] = nextChildInstance; | ||
25168 | // Creating mount image now ensures refs are resolved in right order | ||
25169 | // (see https://github.com/facebook/react/pull/7101 for explanation). | ||
25170 | var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID); | ||
25171 | mountImages.push(nextChildMountImage); | ||
25172 | } | ||
25173 | } | ||
25174 | // Unmount children that are no longer present. | ||
25175 | for (name in prevChildren) { | ||
25176 | if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { | ||
25177 | prevChild = prevChildren[name]; | ||
25178 | removedNodes[name] = ReactReconciler.getHostNode(prevChild); | ||
25179 | ReactReconciler.unmountComponent(prevChild, false); | ||
25180 | } | ||
25181 | } | ||
25182 | }, | ||
25183 | |||
25184 | /** | ||
25185 | * Unmounts all rendered children. This should be used to clean up children | ||
25186 | * when this component is unmounted. | ||
25187 | * | ||
25188 | * @param {?object} renderedChildren Previously initialized set of children. | ||
25189 | * @internal | ||
25190 | */ | ||
25191 | unmountChildren: function (renderedChildren, safely) { | ||
25192 | for (var name in renderedChildren) { | ||
25193 | if (renderedChildren.hasOwnProperty(name)) { | ||
25194 | var renderedChild = renderedChildren[name]; | ||
25195 | ReactReconciler.unmountComponent(renderedChild, safely); | ||
25196 | } | ||
25197 | } | ||
25198 | } | ||
25199 | |||
25200 | }; | ||
25201 | |||
25202 | module.exports = ReactChildReconciler; | ||
25203 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
25204 | |||
25205 | /***/ }), | ||
25206 | /* 253 */ | ||
25207 | /***/ (function(module, exports, __webpack_require__) { | ||
25208 | |||
25209 | "use strict"; | ||
25210 | /** | ||
25211 | * Copyright 2013-present, Facebook, Inc. | ||
25212 | * All rights reserved. | ||
25213 | * | ||
25214 | * This source code is licensed under the BSD-style license found in the | ||
25215 | * LICENSE file in the root directory of this source tree. An additional grant | ||
25216 | * of patent rights can be found in the PATENTS file in the same directory. | ||
25217 | * | ||
25218 | */ | ||
25219 | |||
25220 | |||
25221 | |||
25222 | var DOMChildrenOperations = __webpack_require__(75); | ||
25223 | var ReactDOMIDOperations = __webpack_require__(260); | ||
25224 | |||
25225 | /** | ||
25226 | * Abstracts away all functionality of the reconciler that requires knowledge of | ||
25227 | * the browser context. TODO: These callers should be refactored to avoid the | ||
25228 | * need for this injection. | ||
25229 | */ | ||
25230 | var ReactComponentBrowserEnvironment = { | ||
25231 | |||
25232 | processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates, | ||
25233 | |||
25234 | replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup | ||
25235 | |||
25236 | }; | ||
25237 | |||
25238 | module.exports = ReactComponentBrowserEnvironment; | ||
25239 | |||
25240 | /***/ }), | ||
25241 | /* 254 */ | ||
25242 | /***/ (function(module, exports, __webpack_require__) { | ||
25243 | |||
25244 | "use strict"; | ||
25245 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
25246 | * Copyright 2013-present, Facebook, Inc. | ||
25247 | * All rights reserved. | ||
25248 | * | ||
25249 | * This source code is licensed under the BSD-style license found in the | ||
25250 | * LICENSE file in the root directory of this source tree. An additional grant | ||
25251 | * of patent rights can be found in the PATENTS file in the same directory. | ||
25252 | * | ||
25253 | */ | ||
25254 | |||
25255 | |||
25256 | |||
25257 | var _prodInvariant = __webpack_require__(3), | ||
25258 | _assign = __webpack_require__(4); | ||
25259 | |||
25260 | var React = __webpack_require__(39); | ||
25261 | var ReactComponentEnvironment = __webpack_require__(80); | ||
25262 | var ReactCurrentOwner = __webpack_require__(17); | ||
25263 | var ReactErrorUtils = __webpack_require__(81); | ||
25264 | var ReactInstanceMap = __webpack_require__(47); | ||
25265 | var ReactInstrumentation = __webpack_require__(12); | ||
25266 | var ReactNodeTypes = __webpack_require__(128); | ||
25267 | var ReactReconciler = __webpack_require__(38); | ||
25268 | |||
25269 | if (process.env.NODE_ENV !== 'production') { | ||
25270 | var checkReactTypeSpec = __webpack_require__(302); | ||
25271 | } | ||
25272 | |||
25273 | var emptyObject = __webpack_require__(36); | ||
25274 | var invariant = __webpack_require__(1); | ||
25275 | var shallowEqual = __webpack_require__(73); | ||
25276 | var shouldUpdateReactComponent = __webpack_require__(88); | ||
25277 | var warning = __webpack_require__(2); | ||
25278 | |||
25279 | var CompositeTypes = { | ||
25280 | ImpureClass: 0, | ||
25281 | PureClass: 1, | ||
25282 | StatelessFunctional: 2 | ||
25283 | }; | ||
25284 | |||
25285 | function StatelessComponent(Component) {} | ||
25286 | StatelessComponent.prototype.render = function () { | ||
25287 | var Component = ReactInstanceMap.get(this)._currentElement.type; | ||
25288 | var element = Component(this.props, this.context, this.updater); | ||
25289 | warnIfInvalidElement(Component, element); | ||
25290 | return element; | ||
25291 | }; | ||
25292 | |||
25293 | function warnIfInvalidElement(Component, element) { | ||
25294 | if (process.env.NODE_ENV !== 'production') { | ||
25295 | 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; | ||
25296 | process.env.NODE_ENV !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0; | ||
25297 | } | ||
25298 | } | ||
25299 | |||
25300 | function shouldConstruct(Component) { | ||
25301 | return !!(Component.prototype && Component.prototype.isReactComponent); | ||
25302 | } | ||
25303 | |||
25304 | function isPureComponent(Component) { | ||
25305 | return !!(Component.prototype && Component.prototype.isPureReactComponent); | ||
25306 | } | ||
25307 | |||
25308 | // Separated into a function to contain deoptimizations caused by try/finally. | ||
25309 | function measureLifeCyclePerf(fn, debugID, timerType) { | ||
25310 | if (debugID === 0) { | ||
25311 | // Top-level wrappers (see ReactMount) and empty components (see | ||
25312 | // ReactDOMEmptyComponent) are invisible to hooks and devtools. | ||
25313 | // Both are implementation details that should go away in the future. | ||
25314 | return fn(); | ||
25315 | } | ||
25316 | |||
25317 | ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType); | ||
25318 | try { | ||
25319 | return fn(); | ||
25320 | } finally { | ||
25321 | ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType); | ||
25322 | } | ||
25323 | } | ||
25324 | |||
25325 | /** | ||
25326 | * ------------------ The Life-Cycle of a Composite Component ------------------ | ||
25327 | * | ||
25328 | * - constructor: Initialization of state. The instance is now retained. | ||
25329 | * - componentWillMount | ||
25330 | * - render | ||
25331 | * - [children's constructors] | ||
25332 | * - [children's componentWillMount and render] | ||
25333 | * - [children's componentDidMount] | ||
25334 | * - componentDidMount | ||
25335 | * | ||
25336 | * Update Phases: | ||
25337 | * - componentWillReceiveProps (only called if parent updated) | ||
25338 | * - shouldComponentUpdate | ||
25339 | * - componentWillUpdate | ||
25340 | * - render | ||
25341 | * - [children's constructors or receive props phases] | ||
25342 | * - componentDidUpdate | ||
25343 | * | ||
25344 | * - componentWillUnmount | ||
25345 | * - [children's componentWillUnmount] | ||
25346 | * - [children destroyed] | ||
25347 | * - (destroyed): The instance is now blank, released by React and ready for GC. | ||
25348 | * | ||
25349 | * ----------------------------------------------------------------------------- | ||
25350 | */ | ||
25351 | |||
25352 | /** | ||
25353 | * An incrementing ID assigned to each component when it is mounted. This is | ||
25354 | * used to enforce the order in which `ReactUpdates` updates dirty components. | ||
25355 | * | ||
25356 | * @private | ||
25357 | */ | ||
25358 | var nextMountID = 1; | ||
25359 | |||
25360 | /** | ||
25361 | * @lends {ReactCompositeComponent.prototype} | ||
25362 | */ | ||
25363 | var ReactCompositeComponent = { | ||
25364 | |||
25365 | /** | ||
25366 | * Base constructor for all composite component. | ||
25367 | * | ||
25368 | * @param {ReactElement} element | ||
25369 | * @final | ||
25370 | * @internal | ||
25371 | */ | ||
25372 | construct: function (element) { | ||
25373 | this._currentElement = element; | ||
25374 | this._rootNodeID = 0; | ||
25375 | this._compositeType = null; | ||
25376 | this._instance = null; | ||
25377 | this._hostParent = null; | ||
25378 | this._hostContainerInfo = null; | ||
25379 | |||
25380 | // See ReactUpdateQueue | ||
25381 | this._updateBatchNumber = null; | ||
25382 | this._pendingElement = null; | ||
25383 | this._pendingStateQueue = null; | ||
25384 | this._pendingReplaceState = false; | ||
25385 | this._pendingForceUpdate = false; | ||
25386 | |||
25387 | this._renderedNodeType = null; | ||
25388 | this._renderedComponent = null; | ||
25389 | this._context = null; | ||
25390 | this._mountOrder = 0; | ||
25391 | this._topLevelWrapper = null; | ||
25392 | |||
25393 | // See ReactUpdates and ReactUpdateQueue. | ||
25394 | this._pendingCallbacks = null; | ||
25395 | |||
25396 | // ComponentWillUnmount shall only be called once | ||
25397 | this._calledComponentWillUnmount = false; | ||
25398 | |||
25399 | if (process.env.NODE_ENV !== 'production') { | ||
25400 | this._warnedAboutRefsInRender = false; | ||
25401 | } | ||
25402 | }, | ||
25403 | |||
25404 | /** | ||
25405 | * Initializes the component, renders markup, and registers event listeners. | ||
25406 | * | ||
25407 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
25408 | * @param {?object} hostParent | ||
25409 | * @param {?object} hostContainerInfo | ||
25410 | * @param {?object} context | ||
25411 | * @return {?string} Rendered markup to be inserted into the DOM. | ||
25412 | * @final | ||
25413 | * @internal | ||
25414 | */ | ||
25415 | mountComponent: function (transaction, hostParent, hostContainerInfo, context) { | ||
25416 | var _this = this; | ||
25417 | |||
25418 | this._context = context; | ||
25419 | this._mountOrder = nextMountID++; | ||
25420 | this._hostParent = hostParent; | ||
25421 | this._hostContainerInfo = hostContainerInfo; | ||
25422 | |||
25423 | var publicProps = this._currentElement.props; | ||
25424 | var publicContext = this._processContext(context); | ||
25425 | |||
25426 | var Component = this._currentElement.type; | ||
25427 | |||
25428 | var updateQueue = transaction.getUpdateQueue(); | ||
25429 | |||
25430 | // Initialize the public class | ||
25431 | var doConstruct = shouldConstruct(Component); | ||
25432 | var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue); | ||
25433 | var renderedElement; | ||
25434 | |||
25435 | // Support functional components | ||
25436 | if (!doConstruct && (inst == null || inst.render == null)) { | ||
25437 | renderedElement = inst; | ||
25438 | warnIfInvalidElement(Component, renderedElement); | ||
25439 | !(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; | ||
25440 | inst = new StatelessComponent(Component); | ||
25441 | this._compositeType = CompositeTypes.StatelessFunctional; | ||
25442 | } else { | ||
25443 | if (isPureComponent(Component)) { | ||
25444 | this._compositeType = CompositeTypes.PureClass; | ||
25445 | } else { | ||
25446 | this._compositeType = CompositeTypes.ImpureClass; | ||
25447 | } | ||
25448 | } | ||
25449 | |||
25450 | if (process.env.NODE_ENV !== 'production') { | ||
25451 | // This will throw later in _renderValidatedComponent, but add an early | ||
25452 | // warning now to help debugging | ||
25453 | if (inst.render == null) { | ||
25454 | 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; | ||
25455 | } | ||
25456 | |||
25457 | var propsMutated = inst.props !== publicProps; | ||
25458 | var componentName = Component.displayName || Component.name || 'Component'; | ||
25459 | |||
25460 | 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; | ||
25461 | } | ||
25462 | |||
25463 | // These should be set up in the constructor, but as a convenience for | ||
25464 | // simpler class abstractions, we set them up after the fact. | ||
25465 | inst.props = publicProps; | ||
25466 | inst.context = publicContext; | ||
25467 | inst.refs = emptyObject; | ||
25468 | inst.updater = updateQueue; | ||
25469 | |||
25470 | this._instance = inst; | ||
25471 | |||
25472 | // Store a reference from the instance back to the internal representation | ||
25473 | ReactInstanceMap.set(inst, this); | ||
25474 | |||
25475 | if (process.env.NODE_ENV !== 'production') { | ||
25476 | // Since plain JS classes are defined without any special initialization | ||
25477 | // logic, we can not catch common errors early. Therefore, we have to | ||
25478 | // catch them here, at initialization time, instead. | ||
25479 | 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; | ||
25480 | 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; | ||
25481 | 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; | ||
25482 | 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; | ||
25483 | 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; | ||
25484 | 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; | ||
25485 | 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; | ||
25486 | } | ||
25487 | |||
25488 | var initialState = inst.state; | ||
25489 | if (initialState === undefined) { | ||
25490 | inst.state = initialState = null; | ||
25491 | } | ||
25492 | !(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; | ||
25493 | |||
25494 | this._pendingStateQueue = null; | ||
25495 | this._pendingReplaceState = false; | ||
25496 | this._pendingForceUpdate = false; | ||
25497 | |||
25498 | var markup; | ||
25499 | if (inst.unstable_handleError) { | ||
25500 | markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context); | ||
25501 | } else { | ||
25502 | markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); | ||
25503 | } | ||
25504 | |||
25505 | if (inst.componentDidMount) { | ||
25506 | if (process.env.NODE_ENV !== 'production') { | ||
25507 | transaction.getReactMountReady().enqueue(function () { | ||
25508 | measureLifeCyclePerf(function () { | ||
25509 | return inst.componentDidMount(); | ||
25510 | }, _this._debugID, 'componentDidMount'); | ||
25511 | }); | ||
25512 | } else { | ||
25513 | transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); | ||
25514 | } | ||
25515 | } | ||
25516 | |||
25517 | return markup; | ||
25518 | }, | ||
25519 | |||
25520 | _constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) { | ||
25521 | if (process.env.NODE_ENV !== 'production') { | ||
25522 | ReactCurrentOwner.current = this; | ||
25523 | try { | ||
25524 | return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue); | ||
25525 | } finally { | ||
25526 | ReactCurrentOwner.current = null; | ||
25527 | } | ||
25528 | } else { | ||
25529 | return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue); | ||
25530 | } | ||
25531 | }, | ||
25532 | |||
25533 | _constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) { | ||
25534 | var Component = this._currentElement.type; | ||
25535 | |||
25536 | if (doConstruct) { | ||
25537 | if (process.env.NODE_ENV !== 'production') { | ||
25538 | return measureLifeCyclePerf(function () { | ||
25539 | return new Component(publicProps, publicContext, updateQueue); | ||
25540 | }, this._debugID, 'ctor'); | ||
25541 | } else { | ||
25542 | return new Component(publicProps, publicContext, updateQueue); | ||
25543 | } | ||
25544 | } | ||
25545 | |||
25546 | // This can still be an instance in case of factory components | ||
25547 | // but we'll count this as time spent rendering as the more common case. | ||
25548 | if (process.env.NODE_ENV !== 'production') { | ||
25549 | return measureLifeCyclePerf(function () { | ||
25550 | return Component(publicProps, publicContext, updateQueue); | ||
25551 | }, this._debugID, 'render'); | ||
25552 | } else { | ||
25553 | return Component(publicProps, publicContext, updateQueue); | ||
25554 | } | ||
25555 | }, | ||
25556 | |||
25557 | performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) { | ||
25558 | var markup; | ||
25559 | var checkpoint = transaction.checkpoint(); | ||
25560 | try { | ||
25561 | markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); | ||
25562 | } catch (e) { | ||
25563 | // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint | ||
25564 | transaction.rollback(checkpoint); | ||
25565 | this._instance.unstable_handleError(e); | ||
25566 | if (this._pendingStateQueue) { | ||
25567 | this._instance.state = this._processPendingState(this._instance.props, this._instance.context); | ||
25568 | } | ||
25569 | checkpoint = transaction.checkpoint(); | ||
25570 | |||
25571 | this._renderedComponent.unmountComponent(true); | ||
25572 | transaction.rollback(checkpoint); | ||
25573 | |||
25574 | // Try again - we've informed the component about the error, so they can render an error message this time. | ||
25575 | // If this throws again, the error will bubble up (and can be caught by a higher error boundary). | ||
25576 | markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); | ||
25577 | } | ||
25578 | return markup; | ||
25579 | }, | ||
25580 | |||
25581 | performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) { | ||
25582 | var inst = this._instance; | ||
25583 | |||
25584 | var debugID = 0; | ||
25585 | if (process.env.NODE_ENV !== 'production') { | ||
25586 | debugID = this._debugID; | ||
25587 | } | ||
25588 | |||
25589 | if (inst.componentWillMount) { | ||
25590 | if (process.env.NODE_ENV !== 'production') { | ||
25591 | measureLifeCyclePerf(function () { | ||
25592 | return inst.componentWillMount(); | ||
25593 | }, debugID, 'componentWillMount'); | ||
25594 | } else { | ||
25595 | inst.componentWillMount(); | ||
25596 | } | ||
25597 | // When mounting, calls to `setState` by `componentWillMount` will set | ||
25598 | // `this._pendingStateQueue` without triggering a re-render. | ||
25599 | if (this._pendingStateQueue) { | ||
25600 | inst.state = this._processPendingState(inst.props, inst.context); | ||
25601 | } | ||
25602 | } | ||
25603 | |||
25604 | // If not a stateless component, we now render | ||
25605 | if (renderedElement === undefined) { | ||
25606 | renderedElement = this._renderValidatedComponent(); | ||
25607 | } | ||
25608 | |||
25609 | var nodeType = ReactNodeTypes.getType(renderedElement); | ||
25610 | this._renderedNodeType = nodeType; | ||
25611 | var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */ | ||
25612 | ); | ||
25613 | this._renderedComponent = child; | ||
25614 | |||
25615 | var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID); | ||
25616 | |||
25617 | if (process.env.NODE_ENV !== 'production') { | ||
25618 | if (debugID !== 0) { | ||
25619 | var childDebugIDs = child._debugID !== 0 ? [child._debugID] : []; | ||
25620 | ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs); | ||
25621 | } | ||
25622 | } | ||
25623 | |||
25624 | return markup; | ||
25625 | }, | ||
25626 | |||
25627 | getHostNode: function () { | ||
25628 | return ReactReconciler.getHostNode(this._renderedComponent); | ||
25629 | }, | ||
25630 | |||
25631 | /** | ||
25632 | * Releases any resources allocated by `mountComponent`. | ||
25633 | * | ||
25634 | * @final | ||
25635 | * @internal | ||
25636 | */ | ||
25637 | unmountComponent: function (safely) { | ||
25638 | if (!this._renderedComponent) { | ||
25639 | return; | ||
25640 | } | ||
25641 | |||
25642 | var inst = this._instance; | ||
25643 | |||
25644 | if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) { | ||
25645 | inst._calledComponentWillUnmount = true; | ||
25646 | |||
25647 | if (safely) { | ||
25648 | var name = this.getName() + '.componentWillUnmount()'; | ||
25649 | ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst)); | ||
25650 | } else { | ||
25651 | if (process.env.NODE_ENV !== 'production') { | ||
25652 | measureLifeCyclePerf(function () { | ||
25653 | return inst.componentWillUnmount(); | ||
25654 | }, this._debugID, 'componentWillUnmount'); | ||
25655 | } else { | ||
25656 | inst.componentWillUnmount(); | ||
25657 | } | ||
25658 | } | ||
25659 | } | ||
25660 | |||
25661 | if (this._renderedComponent) { | ||
25662 | ReactReconciler.unmountComponent(this._renderedComponent, safely); | ||
25663 | this._renderedNodeType = null; | ||
25664 | this._renderedComponent = null; | ||
25665 | this._instance = null; | ||
25666 | } | ||
25667 | |||
25668 | // Reset pending fields | ||
25669 | // Even if this component is scheduled for another update in ReactUpdates, | ||
25670 | // it would still be ignored because these fields are reset. | ||
25671 | this._pendingStateQueue = null; | ||
25672 | this._pendingReplaceState = false; | ||
25673 | this._pendingForceUpdate = false; | ||
25674 | this._pendingCallbacks = null; | ||
25675 | this._pendingElement = null; | ||
25676 | |||
25677 | // These fields do not really need to be reset since this object is no | ||
25678 | // longer accessible. | ||
25679 | this._context = null; | ||
25680 | this._rootNodeID = 0; | ||
25681 | this._topLevelWrapper = null; | ||
25682 | |||
25683 | // Delete the reference from the instance to this internal representation | ||
25684 | // which allow the internals to be properly cleaned up even if the user | ||
25685 | // leaks a reference to the public instance. | ||
25686 | ReactInstanceMap.remove(inst); | ||
25687 | |||
25688 | // Some existing components rely on inst.props even after they've been | ||
25689 | // destroyed (in event handlers). | ||
25690 | // TODO: inst.props = null; | ||
25691 | // TODO: inst.state = null; | ||
25692 | // TODO: inst.context = null; | ||
25693 | }, | ||
25694 | |||
25695 | /** | ||
25696 | * Filters the context object to only contain keys specified in | ||
25697 | * `contextTypes` | ||
25698 | * | ||
25699 | * @param {object} context | ||
25700 | * @return {?object} | ||
25701 | * @private | ||
25702 | */ | ||
25703 | _maskContext: function (context) { | ||
25704 | var Component = this._currentElement.type; | ||
25705 | var contextTypes = Component.contextTypes; | ||
25706 | if (!contextTypes) { | ||
25707 | return emptyObject; | ||
25708 | } | ||
25709 | var maskedContext = {}; | ||
25710 | for (var contextName in contextTypes) { | ||
25711 | maskedContext[contextName] = context[contextName]; | ||
25712 | } | ||
25713 | return maskedContext; | ||
25714 | }, | ||
25715 | |||
25716 | /** | ||
25717 | * Filters the context object to only contain keys specified in | ||
25718 | * `contextTypes`, and asserts that they are valid. | ||
25719 | * | ||
25720 | * @param {object} context | ||
25721 | * @return {?object} | ||
25722 | * @private | ||
25723 | */ | ||
25724 | _processContext: function (context) { | ||
25725 | var maskedContext = this._maskContext(context); | ||
25726 | if (process.env.NODE_ENV !== 'production') { | ||
25727 | var Component = this._currentElement.type; | ||
25728 | if (Component.contextTypes) { | ||
25729 | this._checkContextTypes(Component.contextTypes, maskedContext, 'context'); | ||
25730 | } | ||
25731 | } | ||
25732 | return maskedContext; | ||
25733 | }, | ||
25734 | |||
25735 | /** | ||
25736 | * @param {object} currentContext | ||
25737 | * @return {object} | ||
25738 | * @private | ||
25739 | */ | ||
25740 | _processChildContext: function (currentContext) { | ||
25741 | var Component = this._currentElement.type; | ||
25742 | var inst = this._instance; | ||
25743 | var childContext; | ||
25744 | |||
25745 | if (inst.getChildContext) { | ||
25746 | if (process.env.NODE_ENV !== 'production') { | ||
25747 | ReactInstrumentation.debugTool.onBeginProcessingChildContext(); | ||
25748 | try { | ||
25749 | childContext = inst.getChildContext(); | ||
25750 | } finally { | ||
25751 | ReactInstrumentation.debugTool.onEndProcessingChildContext(); | ||
25752 | } | ||
25753 | } else { | ||
25754 | childContext = inst.getChildContext(); | ||
25755 | } | ||
25756 | } | ||
25757 | |||
25758 | if (childContext) { | ||
25759 | !(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; | ||
25760 | if (process.env.NODE_ENV !== 'production') { | ||
25761 | this._checkContextTypes(Component.childContextTypes, childContext, 'child context'); | ||
25762 | } | ||
25763 | for (var name in childContext) { | ||
25764 | !(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; | ||
25765 | } | ||
25766 | return _assign({}, currentContext, childContext); | ||
25767 | } | ||
25768 | return currentContext; | ||
25769 | }, | ||
25770 | |||
25771 | /** | ||
25772 | * Assert that the context types are valid | ||
25773 | * | ||
25774 | * @param {object} typeSpecs Map of context field to a ReactPropType | ||
25775 | * @param {object} values Runtime values that need to be type-checked | ||
25776 | * @param {string} location e.g. "prop", "context", "child context" | ||
25777 | * @private | ||
25778 | */ | ||
25779 | _checkContextTypes: function (typeSpecs, values, location) { | ||
25780 | if (process.env.NODE_ENV !== 'production') { | ||
25781 | checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID); | ||
25782 | } | ||
25783 | }, | ||
25784 | |||
25785 | receiveComponent: function (nextElement, transaction, nextContext) { | ||
25786 | var prevElement = this._currentElement; | ||
25787 | var prevContext = this._context; | ||
25788 | |||
25789 | this._pendingElement = null; | ||
25790 | |||
25791 | this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext); | ||
25792 | }, | ||
25793 | |||
25794 | /** | ||
25795 | * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate` | ||
25796 | * is set, update the component. | ||
25797 | * | ||
25798 | * @param {ReactReconcileTransaction} transaction | ||
25799 | * @internal | ||
25800 | */ | ||
25801 | performUpdateIfNecessary: function (transaction) { | ||
25802 | if (this._pendingElement != null) { | ||
25803 | ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context); | ||
25804 | } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) { | ||
25805 | this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context); | ||
25806 | } else { | ||
25807 | this._updateBatchNumber = null; | ||
25808 | } | ||
25809 | }, | ||
25810 | |||
25811 | /** | ||
25812 | * Perform an update to a mounted component. The componentWillReceiveProps and | ||
25813 | * shouldComponentUpdate methods are called, then (assuming the update isn't | ||
25814 | * skipped) the remaining update lifecycle methods are called and the DOM | ||
25815 | * representation is updated. | ||
25816 | * | ||
25817 | * By default, this implements React's rendering and reconciliation algorithm. | ||
25818 | * Sophisticated clients may wish to override this. | ||
25819 | * | ||
25820 | * @param {ReactReconcileTransaction} transaction | ||
25821 | * @param {ReactElement} prevParentElement | ||
25822 | * @param {ReactElement} nextParentElement | ||
25823 | * @internal | ||
25824 | * @overridable | ||
25825 | */ | ||
25826 | updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) { | ||
25827 | var inst = this._instance; | ||
25828 | !(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; | ||
25829 | |||
25830 | var willReceive = false; | ||
25831 | var nextContext; | ||
25832 | |||
25833 | // Determine if the context has changed or not | ||
25834 | if (this._context === nextUnmaskedContext) { | ||
25835 | nextContext = inst.context; | ||
25836 | } else { | ||
25837 | nextContext = this._processContext(nextUnmaskedContext); | ||
25838 | willReceive = true; | ||
25839 | } | ||
25840 | |||
25841 | var prevProps = prevParentElement.props; | ||
25842 | var nextProps = nextParentElement.props; | ||
25843 | |||
25844 | // Not a simple state update but a props update | ||
25845 | if (prevParentElement !== nextParentElement) { | ||
25846 | willReceive = true; | ||
25847 | } | ||
25848 | |||
25849 | // An update here will schedule an update but immediately set | ||
25850 | // _pendingStateQueue which will ensure that any state updates gets | ||
25851 | // immediately reconciled instead of waiting for the next batch. | ||
25852 | if (willReceive && inst.componentWillReceiveProps) { | ||
25853 | if (process.env.NODE_ENV !== 'production') { | ||
25854 | measureLifeCyclePerf(function () { | ||
25855 | return inst.componentWillReceiveProps(nextProps, nextContext); | ||
25856 | }, this._debugID, 'componentWillReceiveProps'); | ||
25857 | } else { | ||
25858 | inst.componentWillReceiveProps(nextProps, nextContext); | ||
25859 | } | ||
25860 | } | ||
25861 | |||
25862 | var nextState = this._processPendingState(nextProps, nextContext); | ||
25863 | var shouldUpdate = true; | ||
25864 | |||
25865 | if (!this._pendingForceUpdate) { | ||
25866 | if (inst.shouldComponentUpdate) { | ||
25867 | if (process.env.NODE_ENV !== 'production') { | ||
25868 | shouldUpdate = measureLifeCyclePerf(function () { | ||
25869 | return inst.shouldComponentUpdate(nextProps, nextState, nextContext); | ||
25870 | }, this._debugID, 'shouldComponentUpdate'); | ||
25871 | } else { | ||
25872 | shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext); | ||
25873 | } | ||
25874 | } else { | ||
25875 | if (this._compositeType === CompositeTypes.PureClass) { | ||
25876 | shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState); | ||
25877 | } | ||
25878 | } | ||
25879 | } | ||
25880 | |||
25881 | if (process.env.NODE_ENV !== 'production') { | ||
25882 | 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; | ||
25883 | } | ||
25884 | |||
25885 | this._updateBatchNumber = null; | ||
25886 | if (shouldUpdate) { | ||
25887 | this._pendingForceUpdate = false; | ||
25888 | // Will set `this.props`, `this.state` and `this.context`. | ||
25889 | this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext); | ||
25890 | } else { | ||
25891 | // If it's determined that a component should not update, we still want | ||
25892 | // to set props and state but we shortcut the rest of the update. | ||
25893 | this._currentElement = nextParentElement; | ||
25894 | this._context = nextUnmaskedContext; | ||
25895 | inst.props = nextProps; | ||
25896 | inst.state = nextState; | ||
25897 | inst.context = nextContext; | ||
25898 | } | ||
25899 | }, | ||
25900 | |||
25901 | _processPendingState: function (props, context) { | ||
25902 | var inst = this._instance; | ||
25903 | var queue = this._pendingStateQueue; | ||
25904 | var replace = this._pendingReplaceState; | ||
25905 | this._pendingReplaceState = false; | ||
25906 | this._pendingStateQueue = null; | ||
25907 | |||
25908 | if (!queue) { | ||
25909 | return inst.state; | ||
25910 | } | ||
25911 | |||
25912 | if (replace && queue.length === 1) { | ||
25913 | return queue[0]; | ||
25914 | } | ||
25915 | |||
25916 | var nextState = _assign({}, replace ? queue[0] : inst.state); | ||
25917 | for (var i = replace ? 1 : 0; i < queue.length; i++) { | ||
25918 | var partial = queue[i]; | ||
25919 | _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial); | ||
25920 | } | ||
25921 | |||
25922 | return nextState; | ||
25923 | }, | ||
25924 | |||
25925 | /** | ||
25926 | * Merges new props and state, notifies delegate methods of update and | ||
25927 | * performs update. | ||
25928 | * | ||
25929 | * @param {ReactElement} nextElement Next element | ||
25930 | * @param {object} nextProps Next public object to set as properties. | ||
25931 | * @param {?object} nextState Next object to set as state. | ||
25932 | * @param {?object} nextContext Next public object to set as context. | ||
25933 | * @param {ReactReconcileTransaction} transaction | ||
25934 | * @param {?object} unmaskedContext | ||
25935 | * @private | ||
25936 | */ | ||
25937 | _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) { | ||
25938 | var _this2 = this; | ||
25939 | |||
25940 | var inst = this._instance; | ||
25941 | |||
25942 | var hasComponentDidUpdate = Boolean(inst.componentDidUpdate); | ||
25943 | var prevProps; | ||
25944 | var prevState; | ||
25945 | var prevContext; | ||
25946 | if (hasComponentDidUpdate) { | ||
25947 | prevProps = inst.props; | ||
25948 | prevState = inst.state; | ||
25949 | prevContext = inst.context; | ||
25950 | } | ||
25951 | |||
25952 | if (inst.componentWillUpdate) { | ||
25953 | if (process.env.NODE_ENV !== 'production') { | ||
25954 | measureLifeCyclePerf(function () { | ||
25955 | return inst.componentWillUpdate(nextProps, nextState, nextContext); | ||
25956 | }, this._debugID, 'componentWillUpdate'); | ||
25957 | } else { | ||
25958 | inst.componentWillUpdate(nextProps, nextState, nextContext); | ||
25959 | } | ||
25960 | } | ||
25961 | |||
25962 | this._currentElement = nextElement; | ||
25963 | this._context = unmaskedContext; | ||
25964 | inst.props = nextProps; | ||
25965 | inst.state = nextState; | ||
25966 | inst.context = nextContext; | ||
25967 | |||
25968 | this._updateRenderedComponent(transaction, unmaskedContext); | ||
25969 | |||
25970 | if (hasComponentDidUpdate) { | ||
25971 | if (process.env.NODE_ENV !== 'production') { | ||
25972 | transaction.getReactMountReady().enqueue(function () { | ||
25973 | measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), _this2._debugID, 'componentDidUpdate'); | ||
25974 | }); | ||
25975 | } else { | ||
25976 | transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst); | ||
25977 | } | ||
25978 | } | ||
25979 | }, | ||
25980 | |||
25981 | /** | ||
25982 | * Call the component's `render` method and update the DOM accordingly. | ||
25983 | * | ||
25984 | * @param {ReactReconcileTransaction} transaction | ||
25985 | * @internal | ||
25986 | */ | ||
25987 | _updateRenderedComponent: function (transaction, context) { | ||
25988 | var prevComponentInstance = this._renderedComponent; | ||
25989 | var prevRenderedElement = prevComponentInstance._currentElement; | ||
25990 | var nextRenderedElement = this._renderValidatedComponent(); | ||
25991 | |||
25992 | var debugID = 0; | ||
25993 | if (process.env.NODE_ENV !== 'production') { | ||
25994 | debugID = this._debugID; | ||
25995 | } | ||
25996 | |||
25997 | if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { | ||
25998 | ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context)); | ||
25999 | } else { | ||
26000 | var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance); | ||
26001 | ReactReconciler.unmountComponent(prevComponentInstance, false); | ||
26002 | |||
26003 | var nodeType = ReactNodeTypes.getType(nextRenderedElement); | ||
26004 | this._renderedNodeType = nodeType; | ||
26005 | var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */ | ||
26006 | ); | ||
26007 | this._renderedComponent = child; | ||
26008 | |||
26009 | var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID); | ||
26010 | |||
26011 | if (process.env.NODE_ENV !== 'production') { | ||
26012 | if (debugID !== 0) { | ||
26013 | var childDebugIDs = child._debugID !== 0 ? [child._debugID] : []; | ||
26014 | ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs); | ||
26015 | } | ||
26016 | } | ||
26017 | |||
26018 | this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance); | ||
26019 | } | ||
26020 | }, | ||
26021 | |||
26022 | /** | ||
26023 | * Overridden in shallow rendering. | ||
26024 | * | ||
26025 | * @protected | ||
26026 | */ | ||
26027 | _replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) { | ||
26028 | ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance); | ||
26029 | }, | ||
26030 | |||
26031 | /** | ||
26032 | * @protected | ||
26033 | */ | ||
26034 | _renderValidatedComponentWithoutOwnerOrContext: function () { | ||
26035 | var inst = this._instance; | ||
26036 | var renderedElement; | ||
26037 | |||
26038 | if (process.env.NODE_ENV !== 'production') { | ||
26039 | renderedElement = measureLifeCyclePerf(function () { | ||
26040 | return inst.render(); | ||
26041 | }, this._debugID, 'render'); | ||
26042 | } else { | ||
26043 | renderedElement = inst.render(); | ||
26044 | } | ||
26045 | |||
26046 | if (process.env.NODE_ENV !== 'production') { | ||
26047 | // We allow auto-mocks to proceed as if they're returning null. | ||
26048 | if (renderedElement === undefined && inst.render._isMockFunction) { | ||
26049 | // This is probably bad practice. Consider warning here and | ||
26050 | // deprecating this convenience. | ||
26051 | renderedElement = null; | ||
26052 | } | ||
26053 | } | ||
26054 | |||
26055 | return renderedElement; | ||
26056 | }, | ||
26057 | |||
26058 | /** | ||
26059 | * @private | ||
26060 | */ | ||
26061 | _renderValidatedComponent: function () { | ||
26062 | var renderedElement; | ||
26063 | if (process.env.NODE_ENV !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) { | ||
26064 | ReactCurrentOwner.current = this; | ||
26065 | try { | ||
26066 | renderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); | ||
26067 | } finally { | ||
26068 | ReactCurrentOwner.current = null; | ||
26069 | } | ||
26070 | } else { | ||
26071 | renderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); | ||
26072 | } | ||
26073 | !( | ||
26074 | // TODO: An `isValidNode` function would probably be more appropriate | ||
26075 | 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; | ||
26076 | |||
26077 | return renderedElement; | ||
26078 | }, | ||
26079 | |||
26080 | /** | ||
26081 | * Lazily allocates the refs object and stores `component` as `ref`. | ||
26082 | * | ||
26083 | * @param {string} ref Reference name. | ||
26084 | * @param {component} component Component to store as `ref`. | ||
26085 | * @final | ||
26086 | * @private | ||
26087 | */ | ||
26088 | attachRef: function (ref, component) { | ||
26089 | var inst = this.getPublicInstance(); | ||
26090 | !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0; | ||
26091 | var publicComponentInstance = component.getPublicInstance(); | ||
26092 | if (process.env.NODE_ENV !== 'production') { | ||
26093 | var componentName = component && component.getName ? component.getName() : 'a component'; | ||
26094 | 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; | ||
26095 | } | ||
26096 | var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs; | ||
26097 | refs[ref] = publicComponentInstance; | ||
26098 | }, | ||
26099 | |||
26100 | /** | ||
26101 | * Detaches a reference name. | ||
26102 | * | ||
26103 | * @param {string} ref Name to dereference. | ||
26104 | * @final | ||
26105 | * @private | ||
26106 | */ | ||
26107 | detachRef: function (ref) { | ||
26108 | var refs = this.getPublicInstance().refs; | ||
26109 | delete refs[ref]; | ||
26110 | }, | ||
26111 | |||
26112 | /** | ||
26113 | * Get a text description of the component that can be used to identify it | ||
26114 | * in error messages. | ||
26115 | * @return {string} The name or null. | ||
26116 | * @internal | ||
26117 | */ | ||
26118 | getName: function () { | ||
26119 | var type = this._currentElement.type; | ||
26120 | var constructor = this._instance && this._instance.constructor; | ||
26121 | return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null; | ||
26122 | }, | ||
26123 | |||
26124 | /** | ||
26125 | * Get the publicly accessible representation of this component - i.e. what | ||
26126 | * is exposed by refs and returned by render. Can be null for stateless | ||
26127 | * components. | ||
26128 | * | ||
26129 | * @return {ReactComponent} the public component instance. | ||
26130 | * @internal | ||
26131 | */ | ||
26132 | getPublicInstance: function () { | ||
26133 | var inst = this._instance; | ||
26134 | if (this._compositeType === CompositeTypes.StatelessFunctional) { | ||
26135 | return null; | ||
26136 | } | ||
26137 | return inst; | ||
26138 | }, | ||
26139 | |||
26140 | // Stub | ||
26141 | _instantiateReactComponent: null | ||
26142 | |||
26143 | }; | ||
26144 | |||
26145 | module.exports = ReactCompositeComponent; | ||
26146 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
26147 | |||
26148 | /***/ }), | ||
26149 | /* 255 */ | ||
26150 | /***/ (function(module, exports, __webpack_require__) { | ||
26151 | |||
26152 | "use strict"; | ||
26153 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
26154 | * Copyright 2013-present, Facebook, Inc. | ||
26155 | * All rights reserved. | ||
26156 | * | ||
26157 | * This source code is licensed under the BSD-style license found in the | ||
26158 | * LICENSE file in the root directory of this source tree. An additional grant | ||
26159 | * of patent rights can be found in the PATENTS file in the same directory. | ||
26160 | * | ||
26161 | */ | ||
26162 | |||
26163 | /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ | ||
26164 | |||
26165 | |||
26166 | |||
26167 | var ReactDOMComponentTree = __webpack_require__(6); | ||
26168 | var ReactDefaultInjection = __webpack_require__(272); | ||
26169 | var ReactMount = __webpack_require__(127); | ||
26170 | var ReactReconciler = __webpack_require__(38); | ||
26171 | var ReactUpdates = __webpack_require__(16); | ||
26172 | var ReactVersion = __webpack_require__(287); | ||
26173 | |||
26174 | var findDOMNode = __webpack_require__(304); | ||
26175 | var getHostComponentFromComposite = __webpack_require__(133); | ||
26176 | var renderSubtreeIntoContainer = __webpack_require__(311); | ||
26177 | var warning = __webpack_require__(2); | ||
26178 | |||
26179 | ReactDefaultInjection.inject(); | ||
26180 | |||
26181 | var ReactDOM = { | ||
26182 | findDOMNode: findDOMNode, | ||
26183 | render: ReactMount.render, | ||
26184 | unmountComponentAtNode: ReactMount.unmountComponentAtNode, | ||
26185 | version: ReactVersion, | ||
26186 | |||
26187 | /* eslint-disable camelcase */ | ||
26188 | unstable_batchedUpdates: ReactUpdates.batchedUpdates, | ||
26189 | unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer | ||
26190 | }; | ||
26191 | |||
26192 | // Inject the runtime into a devtools global hook regardless of browser. | ||
26193 | // Allows for debugging when the hook is injected on the page. | ||
26194 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { | ||
26195 | __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ | ||
26196 | ComponentTree: { | ||
26197 | getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode, | ||
26198 | getNodeFromInstance: function (inst) { | ||
26199 | // inst is an internal instance (but could be a composite) | ||
26200 | if (inst._renderedComponent) { | ||
26201 | inst = getHostComponentFromComposite(inst); | ||
26202 | } | ||
26203 | if (inst) { | ||
26204 | return ReactDOMComponentTree.getNodeFromInstance(inst); | ||
26205 | } else { | ||
26206 | return null; | ||
26207 | } | ||
26208 | } | ||
26209 | }, | ||
26210 | Mount: ReactMount, | ||
26211 | Reconciler: ReactReconciler | ||
26212 | }); | ||
26213 | } | ||
26214 | |||
26215 | if (process.env.NODE_ENV !== 'production') { | ||
26216 | var ExecutionEnvironment = __webpack_require__(7); | ||
26217 | if (ExecutionEnvironment.canUseDOM && window.top === window.self) { | ||
26218 | |||
26219 | // First check if devtools is not installed | ||
26220 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { | ||
26221 | // If we're in Chrome or Firefox, provide a download link if not installed. | ||
26222 | if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { | ||
26223 | // Firefox does not have the issue with devtools loaded over file:// | ||
26224 | var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1; | ||
26225 | 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'); | ||
26226 | } | ||
26227 | } | ||
26228 | |||
26229 | var testFunc = function testFn() {}; | ||
26230 | 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; | ||
26231 | |||
26232 | // If we're in IE8, check to see if we are in compatibility mode and provide | ||
26233 | // information on preventing compatibility mode | ||
26234 | var ieCompatibilityMode = document.documentMode && document.documentMode < 8; | ||
26235 | |||
26236 | 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; | ||
26237 | |||
26238 | var expectedFeatures = [ | ||
26239 | // shims | ||
26240 | Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.trim]; | ||
26241 | |||
26242 | for (var i = 0; i < expectedFeatures.length; i++) { | ||
26243 | if (!expectedFeatures[i]) { | ||
26244 | 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; | ||
26245 | break; | ||
26246 | } | ||
26247 | } | ||
26248 | } | ||
26249 | } | ||
26250 | |||
26251 | if (process.env.NODE_ENV !== 'production') { | ||
26252 | var ReactInstrumentation = __webpack_require__(12); | ||
26253 | var ReactDOMUnknownPropertyHook = __webpack_require__(269); | ||
26254 | var ReactDOMNullInputValuePropHook = __webpack_require__(263); | ||
26255 | var ReactDOMInvalidARIAHook = __webpack_require__(262); | ||
26256 | |||
26257 | ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook); | ||
26258 | ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook); | ||
26259 | ReactInstrumentation.debugTool.addHook(ReactDOMInvalidARIAHook); | ||
26260 | } | ||
26261 | |||
26262 | module.exports = ReactDOM; | ||
26263 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
26264 | |||
26265 | /***/ }), | ||
26266 | /* 256 */ | ||
26267 | /***/ (function(module, exports, __webpack_require__) { | ||
26268 | |||
26269 | "use strict"; | ||
26270 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
26271 | * Copyright 2013-present, Facebook, Inc. | ||
26272 | * All rights reserved. | ||
26273 | * | ||
26274 | * This source code is licensed under the BSD-style license found in the | ||
26275 | * LICENSE file in the root directory of this source tree. An additional grant | ||
26276 | * of patent rights can be found in the PATENTS file in the same directory. | ||
26277 | * | ||
26278 | */ | ||
26279 | |||
26280 | /* global hasOwnProperty:true */ | ||
26281 | |||
26282 | |||
26283 | |||
26284 | var _prodInvariant = __webpack_require__(3), | ||
26285 | _assign = __webpack_require__(4); | ||
26286 | |||
26287 | var AutoFocusUtils = __webpack_require__(243); | ||
26288 | var CSSPropertyOperations = __webpack_require__(245); | ||
26289 | var DOMLazyTree = __webpack_require__(37); | ||
26290 | var DOMNamespaces = __webpack_require__(76); | ||
26291 | var DOMProperty = __webpack_require__(21); | ||
26292 | var DOMPropertyOperations = __webpack_require__(120); | ||
26293 | var EventPluginHub = __webpack_require__(45); | ||
26294 | var EventPluginRegistry = __webpack_require__(53); | ||
26295 | var ReactBrowserEventEmitter = __webpack_require__(54); | ||
26296 | var ReactDOMComponentFlags = __webpack_require__(121); | ||
26297 | var ReactDOMComponentTree = __webpack_require__(6); | ||
26298 | var ReactDOMInput = __webpack_require__(261); | ||
26299 | var ReactDOMOption = __webpack_require__(264); | ||
26300 | var ReactDOMSelect = __webpack_require__(122); | ||
26301 | var ReactDOMTextarea = __webpack_require__(267); | ||
26302 | var ReactInstrumentation = __webpack_require__(12); | ||
26303 | var ReactMultiChild = __webpack_require__(280); | ||
26304 | var ReactServerRenderingTransaction = __webpack_require__(285); | ||
26305 | |||
26306 | var emptyFunction = __webpack_require__(10); | ||
26307 | var escapeTextContentForBrowser = __webpack_require__(57); | ||
26308 | var invariant = __webpack_require__(1); | ||
26309 | var isEventSupported = __webpack_require__(87); | ||
26310 | var shallowEqual = __webpack_require__(73); | ||
26311 | var validateDOMNesting = __webpack_require__(89); | ||
26312 | var warning = __webpack_require__(2); | ||
26313 | |||
26314 | var Flags = ReactDOMComponentFlags; | ||
26315 | var deleteListener = EventPluginHub.deleteListener; | ||
26316 | var getNode = ReactDOMComponentTree.getNodeFromInstance; | ||
26317 | var listenTo = ReactBrowserEventEmitter.listenTo; | ||
26318 | var registrationNameModules = EventPluginRegistry.registrationNameModules; | ||
26319 | |||
26320 | // For quickly matching children type, to test if can be treated as content. | ||
26321 | var CONTENT_TYPES = { 'string': true, 'number': true }; | ||
26322 | |||
26323 | var STYLE = 'style'; | ||
26324 | var HTML = '__html'; | ||
26325 | var RESERVED_PROPS = { | ||
26326 | children: null, | ||
26327 | dangerouslySetInnerHTML: null, | ||
26328 | suppressContentEditableWarning: null | ||
26329 | }; | ||
26330 | |||
26331 | // Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE). | ||
26332 | var DOC_FRAGMENT_TYPE = 11; | ||
26333 | |||
26334 | function getDeclarationErrorAddendum(internalInstance) { | ||
26335 | if (internalInstance) { | ||
26336 | var owner = internalInstance._currentElement._owner || null; | ||
26337 | if (owner) { | ||
26338 | var name = owner.getName(); | ||
26339 | if (name) { | ||
26340 | return ' This DOM node was rendered by `' + name + '`.'; | ||
26341 | } | ||
26342 | } | ||
26343 | } | ||
26344 | return ''; | ||
26345 | } | ||
26346 | |||
26347 | function friendlyStringify(obj) { | ||
26348 | if (typeof obj === 'object') { | ||
26349 | if (Array.isArray(obj)) { | ||
26350 | return '[' + obj.map(friendlyStringify).join(', ') + ']'; | ||
26351 | } else { | ||
26352 | var pairs = []; | ||
26353 | for (var key in obj) { | ||
26354 | if (Object.prototype.hasOwnProperty.call(obj, key)) { | ||
26355 | var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key); | ||
26356 | pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key])); | ||
26357 | } | ||
26358 | } | ||
26359 | return '{' + pairs.join(', ') + '}'; | ||
26360 | } | ||
26361 | } else if (typeof obj === 'string') { | ||
26362 | return JSON.stringify(obj); | ||
26363 | } else if (typeof obj === 'function') { | ||
26364 | return '[function object]'; | ||
26365 | } | ||
26366 | // Differs from JSON.stringify in that undefined because undefined and that | ||
26367 | // inf and nan don't become null | ||
26368 | return String(obj); | ||
26369 | } | ||
26370 | |||
26371 | var styleMutationWarning = {}; | ||
26372 | |||
26373 | function checkAndWarnForMutatedStyle(style1, style2, component) { | ||
26374 | if (style1 == null || style2 == null) { | ||
26375 | return; | ||
26376 | } | ||
26377 | if (shallowEqual(style1, style2)) { | ||
26378 | return; | ||
26379 | } | ||
26380 | |||
26381 | var componentName = component._tag; | ||
26382 | var owner = component._currentElement._owner; | ||
26383 | var ownerName; | ||
26384 | if (owner) { | ||
26385 | ownerName = owner.getName(); | ||
26386 | } | ||
26387 | |||
26388 | var hash = ownerName + '|' + componentName; | ||
26389 | |||
26390 | if (styleMutationWarning.hasOwnProperty(hash)) { | ||
26391 | return; | ||
26392 | } | ||
26393 | |||
26394 | styleMutationWarning[hash] = true; | ||
26395 | |||
26396 | 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; | ||
26397 | } | ||
26398 | |||
26399 | /** | ||
26400 | * @param {object} component | ||
26401 | * @param {?object} props | ||
26402 | */ | ||
26403 | function assertValidProps(component, props) { | ||
26404 | if (!props) { | ||
26405 | return; | ||
26406 | } | ||
26407 | // Note the use of `==` which checks for null or undefined. | ||
26408 | if (voidElementTags[component._tag]) { | ||
26409 | !(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; | ||
26410 | } | ||
26411 | if (props.dangerouslySetInnerHTML != null) { | ||
26412 | !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : _prodInvariant('60') : void 0; | ||
26413 | !(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; | ||
26414 | } | ||
26415 | if (process.env.NODE_ENV !== 'production') { | ||
26416 | 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; | ||
26417 | 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; | ||
26418 | 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; | ||
26419 | } | ||
26420 | !(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; | ||
26421 | } | ||
26422 | |||
26423 | function enqueuePutListener(inst, registrationName, listener, transaction) { | ||
26424 | if (transaction instanceof ReactServerRenderingTransaction) { | ||
26425 | return; | ||
26426 | } | ||
26427 | if (process.env.NODE_ENV !== 'production') { | ||
26428 | // IE8 has no API for event capturing and the `onScroll` event doesn't | ||
26429 | // bubble. | ||
26430 | process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0; | ||
26431 | } | ||
26432 | var containerInfo = inst._hostContainerInfo; | ||
26433 | var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE; | ||
26434 | var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument; | ||
26435 | listenTo(registrationName, doc); | ||
26436 | transaction.getReactMountReady().enqueue(putListener, { | ||
26437 | inst: inst, | ||
26438 | registrationName: registrationName, | ||
26439 | listener: listener | ||
26440 | }); | ||
26441 | } | ||
26442 | |||
26443 | function putListener() { | ||
26444 | var listenerToPut = this; | ||
26445 | EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener); | ||
26446 | } | ||
26447 | |||
26448 | function inputPostMount() { | ||
26449 | var inst = this; | ||
26450 | ReactDOMInput.postMountWrapper(inst); | ||
26451 | } | ||
26452 | |||
26453 | function textareaPostMount() { | ||
26454 | var inst = this; | ||
26455 | ReactDOMTextarea.postMountWrapper(inst); | ||
26456 | } | ||
26457 | |||
26458 | function optionPostMount() { | ||
26459 | var inst = this; | ||
26460 | ReactDOMOption.postMountWrapper(inst); | ||
26461 | } | ||
26462 | |||
26463 | var setAndValidateContentChildDev = emptyFunction; | ||
26464 | if (process.env.NODE_ENV !== 'production') { | ||
26465 | setAndValidateContentChildDev = function (content) { | ||
26466 | var hasExistingContent = this._contentDebugID != null; | ||
26467 | var debugID = this._debugID; | ||
26468 | // This ID represents the inlined child that has no backing instance: | ||
26469 | var contentDebugID = -debugID; | ||
26470 | |||
26471 | if (content == null) { | ||
26472 | if (hasExistingContent) { | ||
26473 | ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID); | ||
26474 | } | ||
26475 | this._contentDebugID = null; | ||
26476 | return; | ||
26477 | } | ||
26478 | |||
26479 | validateDOMNesting(null, String(content), this, this._ancestorInfo); | ||
26480 | this._contentDebugID = contentDebugID; | ||
26481 | if (hasExistingContent) { | ||
26482 | ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content); | ||
26483 | ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID); | ||
26484 | } else { | ||
26485 | ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID); | ||
26486 | ReactInstrumentation.debugTool.onMountComponent(contentDebugID); | ||
26487 | ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]); | ||
26488 | } | ||
26489 | }; | ||
26490 | } | ||
26491 | |||
26492 | // There are so many media events, it makes sense to just | ||
26493 | // maintain a list rather than create a `trapBubbledEvent` for each | ||
26494 | var mediaEvents = { | ||
26495 | topAbort: 'abort', | ||
26496 | topCanPlay: 'canplay', | ||
26497 | topCanPlayThrough: 'canplaythrough', | ||
26498 | topDurationChange: 'durationchange', | ||
26499 | topEmptied: 'emptied', | ||
26500 | topEncrypted: 'encrypted', | ||
26501 | topEnded: 'ended', | ||
26502 | topError: 'error', | ||
26503 | topLoadedData: 'loadeddata', | ||
26504 | topLoadedMetadata: 'loadedmetadata', | ||
26505 | topLoadStart: 'loadstart', | ||
26506 | topPause: 'pause', | ||
26507 | topPlay: 'play', | ||
26508 | topPlaying: 'playing', | ||
26509 | topProgress: 'progress', | ||
26510 | topRateChange: 'ratechange', | ||
26511 | topSeeked: 'seeked', | ||
26512 | topSeeking: 'seeking', | ||
26513 | topStalled: 'stalled', | ||
26514 | topSuspend: 'suspend', | ||
26515 | topTimeUpdate: 'timeupdate', | ||
26516 | topVolumeChange: 'volumechange', | ||
26517 | topWaiting: 'waiting' | ||
26518 | }; | ||
26519 | |||
26520 | function trapBubbledEventsLocal() { | ||
26521 | var inst = this; | ||
26522 | // If a component renders to null or if another component fatals and causes | ||
26523 | // the state of the tree to be corrupted, `node` here can be null. | ||
26524 | !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : _prodInvariant('63') : void 0; | ||
26525 | var node = getNode(inst); | ||
26526 | !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : _prodInvariant('64') : void 0; | ||
26527 | |||
26528 | switch (inst._tag) { | ||
26529 | case 'iframe': | ||
26530 | case 'object': | ||
26531 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)]; | ||
26532 | break; | ||
26533 | case 'video': | ||
26534 | case 'audio': | ||
26535 | |||
26536 | inst._wrapperState.listeners = []; | ||
26537 | // Create listener for each media event | ||
26538 | for (var event in mediaEvents) { | ||
26539 | if (mediaEvents.hasOwnProperty(event)) { | ||
26540 | inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(event, mediaEvents[event], node)); | ||
26541 | } | ||
26542 | } | ||
26543 | break; | ||
26544 | case 'source': | ||
26545 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node)]; | ||
26546 | break; | ||
26547 | case 'img': | ||
26548 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node), ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)]; | ||
26549 | break; | ||
26550 | case 'form': | ||
26551 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topReset', 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent('topSubmit', 'submit', node)]; | ||
26552 | break; | ||
26553 | case 'input': | ||
26554 | case 'select': | ||
26555 | case 'textarea': | ||
26556 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topInvalid', 'invalid', node)]; | ||
26557 | break; | ||
26558 | } | ||
26559 | } | ||
26560 | |||
26561 | function postUpdateSelectWrapper() { | ||
26562 | ReactDOMSelect.postUpdateWrapper(this); | ||
26563 | } | ||
26564 | |||
26565 | // For HTML, certain tags should omit their close tag. We keep a whitelist for | ||
26566 | // those special-case tags. | ||
26567 | |||
26568 | var omittedCloseTags = { | ||
26569 | 'area': true, | ||
26570 | 'base': true, | ||
26571 | 'br': true, | ||
26572 | 'col': true, | ||
26573 | 'embed': true, | ||
26574 | 'hr': true, | ||
26575 | 'img': true, | ||
26576 | 'input': true, | ||
26577 | 'keygen': true, | ||
26578 | 'link': true, | ||
26579 | 'meta': true, | ||
26580 | 'param': true, | ||
26581 | 'source': true, | ||
26582 | 'track': true, | ||
26583 | 'wbr': true | ||
26584 | }; | ||
26585 | |||
26586 | var newlineEatingTags = { | ||
26587 | 'listing': true, | ||
26588 | 'pre': true, | ||
26589 | 'textarea': true | ||
26590 | }; | ||
26591 | |||
26592 | // For HTML, certain tags cannot have children. This has the same purpose as | ||
26593 | // `omittedCloseTags` except that `menuitem` should still have its closing tag. | ||
26594 | |||
26595 | var voidElementTags = _assign({ | ||
26596 | 'menuitem': true | ||
26597 | }, omittedCloseTags); | ||
26598 | |||
26599 | // We accept any tag to be rendered but since this gets injected into arbitrary | ||
26600 | // HTML, we want to make sure that it's a safe tag. | ||
26601 | // http://www.w3.org/TR/REC-xml/#NT-Name | ||
26602 | |||
26603 | var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset | ||
26604 | var validatedTagCache = {}; | ||
26605 | var hasOwnProperty = {}.hasOwnProperty; | ||
26606 | |||
26607 | function validateDangerousTag(tag) { | ||
26608 | if (!hasOwnProperty.call(validatedTagCache, tag)) { | ||
26609 | !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : _prodInvariant('65', tag) : void 0; | ||
26610 | validatedTagCache[tag] = true; | ||
26611 | } | ||
26612 | } | ||
26613 | |||
26614 | function isCustomComponent(tagName, props) { | ||
26615 | return tagName.indexOf('-') >= 0 || props.is != null; | ||
26616 | } | ||
26617 | |||
26618 | var globalIdCounter = 1; | ||
26619 | |||
26620 | /** | ||
26621 | * Creates a new React class that is idempotent and capable of containing other | ||
26622 | * React components. It accepts event listeners and DOM properties that are | ||
26623 | * valid according to `DOMProperty`. | ||
26624 | * | ||
26625 | * - Event listeners: `onClick`, `onMouseDown`, etc. | ||
26626 | * - DOM properties: `className`, `name`, `title`, etc. | ||
26627 | * | ||
26628 | * The `style` property functions differently from the DOM API. It accepts an | ||
26629 | * object mapping of style properties to values. | ||
26630 | * | ||
26631 | * @constructor ReactDOMComponent | ||
26632 | * @extends ReactMultiChild | ||
26633 | */ | ||
26634 | function ReactDOMComponent(element) { | ||
26635 | var tag = element.type; | ||
26636 | validateDangerousTag(tag); | ||
26637 | this._currentElement = element; | ||
26638 | this._tag = tag.toLowerCase(); | ||
26639 | this._namespaceURI = null; | ||
26640 | this._renderedChildren = null; | ||
26641 | this._previousStyle = null; | ||
26642 | this._previousStyleCopy = null; | ||
26643 | this._hostNode = null; | ||
26644 | this._hostParent = null; | ||
26645 | this._rootNodeID = 0; | ||
26646 | this._domID = 0; | ||
26647 | this._hostContainerInfo = null; | ||
26648 | this._wrapperState = null; | ||
26649 | this._topLevelWrapper = null; | ||
26650 | this._flags = 0; | ||
26651 | if (process.env.NODE_ENV !== 'production') { | ||
26652 | this._ancestorInfo = null; | ||
26653 | setAndValidateContentChildDev.call(this, null); | ||
26654 | } | ||
26655 | } | ||
26656 | |||
26657 | ReactDOMComponent.displayName = 'ReactDOMComponent'; | ||
26658 | |||
26659 | ReactDOMComponent.Mixin = { | ||
26660 | |||
26661 | /** | ||
26662 | * Generates root tag markup then recurses. This method has side effects and | ||
26663 | * is not idempotent. | ||
26664 | * | ||
26665 | * @internal | ||
26666 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
26667 | * @param {?ReactDOMComponent} the parent component instance | ||
26668 | * @param {?object} info about the host container | ||
26669 | * @param {object} context | ||
26670 | * @return {string} The computed markup. | ||
26671 | */ | ||
26672 | mountComponent: function (transaction, hostParent, hostContainerInfo, context) { | ||
26673 | this._rootNodeID = globalIdCounter++; | ||
26674 | this._domID = hostContainerInfo._idCounter++; | ||
26675 | this._hostParent = hostParent; | ||
26676 | this._hostContainerInfo = hostContainerInfo; | ||
26677 | |||
26678 | var props = this._currentElement.props; | ||
26679 | |||
26680 | switch (this._tag) { | ||
26681 | case 'audio': | ||
26682 | case 'form': | ||
26683 | case 'iframe': | ||
26684 | case 'img': | ||
26685 | case 'link': | ||
26686 | case 'object': | ||
26687 | case 'source': | ||
26688 | case 'video': | ||
26689 | this._wrapperState = { | ||
26690 | listeners: null | ||
26691 | }; | ||
26692 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); | ||
26693 | break; | ||
26694 | case 'input': | ||
26695 | ReactDOMInput.mountWrapper(this, props, hostParent); | ||
26696 | props = ReactDOMInput.getHostProps(this, props); | ||
26697 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); | ||
26698 | break; | ||
26699 | case 'option': | ||
26700 | ReactDOMOption.mountWrapper(this, props, hostParent); | ||
26701 | props = ReactDOMOption.getHostProps(this, props); | ||
26702 | break; | ||
26703 | case 'select': | ||
26704 | ReactDOMSelect.mountWrapper(this, props, hostParent); | ||
26705 | props = ReactDOMSelect.getHostProps(this, props); | ||
26706 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); | ||
26707 | break; | ||
26708 | case 'textarea': | ||
26709 | ReactDOMTextarea.mountWrapper(this, props, hostParent); | ||
26710 | props = ReactDOMTextarea.getHostProps(this, props); | ||
26711 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); | ||
26712 | break; | ||
26713 | } | ||
26714 | |||
26715 | assertValidProps(this, props); | ||
26716 | |||
26717 | // We create tags in the namespace of their parent container, except HTML | ||
26718 | // tags get no namespace. | ||
26719 | var namespaceURI; | ||
26720 | var parentTag; | ||
26721 | if (hostParent != null) { | ||
26722 | namespaceURI = hostParent._namespaceURI; | ||
26723 | parentTag = hostParent._tag; | ||
26724 | } else if (hostContainerInfo._tag) { | ||
26725 | namespaceURI = hostContainerInfo._namespaceURI; | ||
26726 | parentTag = hostContainerInfo._tag; | ||
26727 | } | ||
26728 | if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') { | ||
26729 | namespaceURI = DOMNamespaces.html; | ||
26730 | } | ||
26731 | if (namespaceURI === DOMNamespaces.html) { | ||
26732 | if (this._tag === 'svg') { | ||
26733 | namespaceURI = DOMNamespaces.svg; | ||
26734 | } else if (this._tag === 'math') { | ||
26735 | namespaceURI = DOMNamespaces.mathml; | ||
26736 | } | ||
26737 | } | ||
26738 | this._namespaceURI = namespaceURI; | ||
26739 | |||
26740 | if (process.env.NODE_ENV !== 'production') { | ||
26741 | var parentInfo; | ||
26742 | if (hostParent != null) { | ||
26743 | parentInfo = hostParent._ancestorInfo; | ||
26744 | } else if (hostContainerInfo._tag) { | ||
26745 | parentInfo = hostContainerInfo._ancestorInfo; | ||
26746 | } | ||
26747 | if (parentInfo) { | ||
26748 | // parentInfo should always be present except for the top-level | ||
26749 | // component when server rendering | ||
26750 | validateDOMNesting(this._tag, null, this, parentInfo); | ||
26751 | } | ||
26752 | this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this); | ||
26753 | } | ||
26754 | |||
26755 | var mountImage; | ||
26756 | if (transaction.useCreateElement) { | ||
26757 | var ownerDocument = hostContainerInfo._ownerDocument; | ||
26758 | var el; | ||
26759 | if (namespaceURI === DOMNamespaces.html) { | ||
26760 | if (this._tag === 'script') { | ||
26761 | // Create the script via .innerHTML so its "parser-inserted" flag is | ||
26762 | // set to true and it does not execute | ||
26763 | var div = ownerDocument.createElement('div'); | ||
26764 | var type = this._currentElement.type; | ||
26765 | div.innerHTML = '<' + type + '></' + type + '>'; | ||
26766 | el = div.removeChild(div.firstChild); | ||
26767 | } else if (props.is) { | ||
26768 | el = ownerDocument.createElement(this._currentElement.type, props.is); | ||
26769 | } else { | ||
26770 | // Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug. | ||
26771 | // See discussion in https://github.com/facebook/react/pull/6896 | ||
26772 | // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240 | ||
26773 | el = ownerDocument.createElement(this._currentElement.type); | ||
26774 | } | ||
26775 | } else { | ||
26776 | el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type); | ||
26777 | } | ||
26778 | ReactDOMComponentTree.precacheNode(this, el); | ||
26779 | this._flags |= Flags.hasCachedChildNodes; | ||
26780 | if (!this._hostParent) { | ||
26781 | DOMPropertyOperations.setAttributeForRoot(el); | ||
26782 | } | ||
26783 | this._updateDOMProperties(null, props, transaction); | ||
26784 | var lazyTree = DOMLazyTree(el); | ||
26785 | this._createInitialChildren(transaction, props, context, lazyTree); | ||
26786 | mountImage = lazyTree; | ||
26787 | } else { | ||
26788 | var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props); | ||
26789 | var tagContent = this._createContentMarkup(transaction, props, context); | ||
26790 | if (!tagContent && omittedCloseTags[this._tag]) { | ||
26791 | mountImage = tagOpen + '/>'; | ||
26792 | } else { | ||
26793 | mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>'; | ||
26794 | } | ||
26795 | } | ||
26796 | |||
26797 | switch (this._tag) { | ||
26798 | case 'input': | ||
26799 | transaction.getReactMountReady().enqueue(inputPostMount, this); | ||
26800 | if (props.autoFocus) { | ||
26801 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); | ||
26802 | } | ||
26803 | break; | ||
26804 | case 'textarea': | ||
26805 | transaction.getReactMountReady().enqueue(textareaPostMount, this); | ||
26806 | if (props.autoFocus) { | ||
26807 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); | ||
26808 | } | ||
26809 | break; | ||
26810 | case 'select': | ||
26811 | if (props.autoFocus) { | ||
26812 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); | ||
26813 | } | ||
26814 | break; | ||
26815 | case 'button': | ||
26816 | if (props.autoFocus) { | ||
26817 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); | ||
26818 | } | ||
26819 | break; | ||
26820 | case 'option': | ||
26821 | transaction.getReactMountReady().enqueue(optionPostMount, this); | ||
26822 | break; | ||
26823 | } | ||
26824 | |||
26825 | return mountImage; | ||
26826 | }, | ||
26827 | |||
26828 | /** | ||
26829 | * Creates markup for the open tag and all attributes. | ||
26830 | * | ||
26831 | * This method has side effects because events get registered. | ||
26832 | * | ||
26833 | * Iterating over object properties is faster than iterating over arrays. | ||
26834 | * @see http://jsperf.com/obj-vs-arr-iteration | ||
26835 | * | ||
26836 | * @private | ||
26837 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
26838 | * @param {object} props | ||
26839 | * @return {string} Markup of opening tag. | ||
26840 | */ | ||
26841 | _createOpenTagMarkupAndPutListeners: function (transaction, props) { | ||
26842 | var ret = '<' + this._currentElement.type; | ||
26843 | |||
26844 | for (var propKey in props) { | ||
26845 | if (!props.hasOwnProperty(propKey)) { | ||
26846 | continue; | ||
26847 | } | ||
26848 | var propValue = props[propKey]; | ||
26849 | if (propValue == null) { | ||
26850 | continue; | ||
26851 | } | ||
26852 | if (registrationNameModules.hasOwnProperty(propKey)) { | ||
26853 | if (propValue) { | ||
26854 | enqueuePutListener(this, propKey, propValue, transaction); | ||
26855 | } | ||
26856 | } else { | ||
26857 | if (propKey === STYLE) { | ||
26858 | if (propValue) { | ||
26859 | if (process.env.NODE_ENV !== 'production') { | ||
26860 | // See `_updateDOMProperties`. style block | ||
26861 | this._previousStyle = propValue; | ||
26862 | } | ||
26863 | propValue = this._previousStyleCopy = _assign({}, props.style); | ||
26864 | } | ||
26865 | propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this); | ||
26866 | } | ||
26867 | var markup = null; | ||
26868 | if (this._tag != null && isCustomComponent(this._tag, props)) { | ||
26869 | if (!RESERVED_PROPS.hasOwnProperty(propKey)) { | ||
26870 | markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue); | ||
26871 | } | ||
26872 | } else { | ||
26873 | markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue); | ||
26874 | } | ||
26875 | if (markup) { | ||
26876 | ret += ' ' + markup; | ||
26877 | } | ||
26878 | } | ||
26879 | } | ||
26880 | |||
26881 | // For static pages, no need to put React ID and checksum. Saves lots of | ||
26882 | // bytes. | ||
26883 | if (transaction.renderToStaticMarkup) { | ||
26884 | return ret; | ||
26885 | } | ||
26886 | |||
26887 | if (!this._hostParent) { | ||
26888 | ret += ' ' + DOMPropertyOperations.createMarkupForRoot(); | ||
26889 | } | ||
26890 | ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID); | ||
26891 | return ret; | ||
26892 | }, | ||
26893 | |||
26894 | /** | ||
26895 | * Creates markup for the content between the tags. | ||
26896 | * | ||
26897 | * @private | ||
26898 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
26899 | * @param {object} props | ||
26900 | * @param {object} context | ||
26901 | * @return {string} Content markup. | ||
26902 | */ | ||
26903 | _createContentMarkup: function (transaction, props, context) { | ||
26904 | var ret = ''; | ||
26905 | |||
26906 | // Intentional use of != to avoid catching zero/false. | ||
26907 | var innerHTML = props.dangerouslySetInnerHTML; | ||
26908 | if (innerHTML != null) { | ||
26909 | if (innerHTML.__html != null) { | ||
26910 | ret = innerHTML.__html; | ||
26911 | } | ||
26912 | } else { | ||
26913 | var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; | ||
26914 | var childrenToUse = contentToUse != null ? null : props.children; | ||
26915 | if (contentToUse != null) { | ||
26916 | // TODO: Validate that text is allowed as a child of this node | ||
26917 | ret = escapeTextContentForBrowser(contentToUse); | ||
26918 | if (process.env.NODE_ENV !== 'production') { | ||
26919 | setAndValidateContentChildDev.call(this, contentToUse); | ||
26920 | } | ||
26921 | } else if (childrenToUse != null) { | ||
26922 | var mountImages = this.mountChildren(childrenToUse, transaction, context); | ||
26923 | ret = mountImages.join(''); | ||
26924 | } | ||
26925 | } | ||
26926 | if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') { | ||
26927 | // text/html ignores the first character in these tags if it's a newline | ||
26928 | // Prefer to break application/xml over text/html (for now) by adding | ||
26929 | // a newline specifically to get eaten by the parser. (Alternately for | ||
26930 | // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first | ||
26931 | // \r is normalized out by HTMLTextAreaElement#value.) | ||
26932 | // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre> | ||
26933 | // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions> | ||
26934 | // See: <http://www.w3.org/TR/html5/syntax.html#newlines> | ||
26935 | // See: Parsing of "textarea" "listing" and "pre" elements | ||
26936 | // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody> | ||
26937 | return '\n' + ret; | ||
26938 | } else { | ||
26939 | return ret; | ||
26940 | } | ||
26941 | }, | ||
26942 | |||
26943 | _createInitialChildren: function (transaction, props, context, lazyTree) { | ||
26944 | // Intentional use of != to avoid catching zero/false. | ||
26945 | var innerHTML = props.dangerouslySetInnerHTML; | ||
26946 | if (innerHTML != null) { | ||
26947 | if (innerHTML.__html != null) { | ||
26948 | DOMLazyTree.queueHTML(lazyTree, innerHTML.__html); | ||
26949 | } | ||
26950 | } else { | ||
26951 | var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; | ||
26952 | var childrenToUse = contentToUse != null ? null : props.children; | ||
26953 | // TODO: Validate that text is allowed as a child of this node | ||
26954 | if (contentToUse != null) { | ||
26955 | // Avoid setting textContent when the text is empty. In IE11 setting | ||
26956 | // textContent on a text area will cause the placeholder to not | ||
26957 | // show within the textarea until it has been focused and blurred again. | ||
26958 | // https://github.com/facebook/react/issues/6731#issuecomment-254874553 | ||
26959 | if (contentToUse !== '') { | ||
26960 | if (process.env.NODE_ENV !== 'production') { | ||
26961 | setAndValidateContentChildDev.call(this, contentToUse); | ||
26962 | } | ||
26963 | DOMLazyTree.queueText(lazyTree, contentToUse); | ||
26964 | } | ||
26965 | } else if (childrenToUse != null) { | ||
26966 | var mountImages = this.mountChildren(childrenToUse, transaction, context); | ||
26967 | for (var i = 0; i < mountImages.length; i++) { | ||
26968 | DOMLazyTree.queueChild(lazyTree, mountImages[i]); | ||
26969 | } | ||
26970 | } | ||
26971 | } | ||
26972 | }, | ||
26973 | |||
26974 | /** | ||
26975 | * Receives a next element and updates the component. | ||
26976 | * | ||
26977 | * @internal | ||
26978 | * @param {ReactElement} nextElement | ||
26979 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
26980 | * @param {object} context | ||
26981 | */ | ||
26982 | receiveComponent: function (nextElement, transaction, context) { | ||
26983 | var prevElement = this._currentElement; | ||
26984 | this._currentElement = nextElement; | ||
26985 | this.updateComponent(transaction, prevElement, nextElement, context); | ||
26986 | }, | ||
26987 | |||
26988 | /** | ||
26989 | * Updates a DOM component after it has already been allocated and | ||
26990 | * attached to the DOM. Reconciles the root DOM node, then recurses. | ||
26991 | * | ||
26992 | * @param {ReactReconcileTransaction} transaction | ||
26993 | * @param {ReactElement} prevElement | ||
26994 | * @param {ReactElement} nextElement | ||
26995 | * @internal | ||
26996 | * @overridable | ||
26997 | */ | ||
26998 | updateComponent: function (transaction, prevElement, nextElement, context) { | ||
26999 | var lastProps = prevElement.props; | ||
27000 | var nextProps = this._currentElement.props; | ||
27001 | |||
27002 | switch (this._tag) { | ||
27003 | case 'input': | ||
27004 | lastProps = ReactDOMInput.getHostProps(this, lastProps); | ||
27005 | nextProps = ReactDOMInput.getHostProps(this, nextProps); | ||
27006 | break; | ||
27007 | case 'option': | ||
27008 | lastProps = ReactDOMOption.getHostProps(this, lastProps); | ||
27009 | nextProps = ReactDOMOption.getHostProps(this, nextProps); | ||
27010 | break; | ||
27011 | case 'select': | ||
27012 | lastProps = ReactDOMSelect.getHostProps(this, lastProps); | ||
27013 | nextProps = ReactDOMSelect.getHostProps(this, nextProps); | ||
27014 | break; | ||
27015 | case 'textarea': | ||
27016 | lastProps = ReactDOMTextarea.getHostProps(this, lastProps); | ||
27017 | nextProps = ReactDOMTextarea.getHostProps(this, nextProps); | ||
27018 | break; | ||
27019 | } | ||
27020 | |||
27021 | assertValidProps(this, nextProps); | ||
27022 | this._updateDOMProperties(lastProps, nextProps, transaction); | ||
27023 | this._updateDOMChildren(lastProps, nextProps, transaction, context); | ||
27024 | |||
27025 | switch (this._tag) { | ||
27026 | case 'input': | ||
27027 | // Update the wrapper around inputs *after* updating props. This has to | ||
27028 | // happen after `_updateDOMProperties`. Otherwise HTML5 input validations | ||
27029 | // raise warnings and prevent the new value from being assigned. | ||
27030 | ReactDOMInput.updateWrapper(this); | ||
27031 | break; | ||
27032 | case 'textarea': | ||
27033 | ReactDOMTextarea.updateWrapper(this); | ||
27034 | break; | ||
27035 | case 'select': | ||
27036 | // <select> value update needs to occur after <option> children | ||
27037 | // reconciliation | ||
27038 | transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this); | ||
27039 | break; | ||
27040 | } | ||
27041 | }, | ||
27042 | |||
27043 | /** | ||
27044 | * Reconciles the properties by detecting differences in property values and | ||
27045 | * updating the DOM as necessary. This function is probably the single most | ||
27046 | * critical path for performance optimization. | ||
27047 | * | ||
27048 | * TODO: Benchmark whether checking for changed values in memory actually | ||
27049 | * improves performance (especially statically positioned elements). | ||
27050 | * TODO: Benchmark the effects of putting this at the top since 99% of props | ||
27051 | * do not change for a given reconciliation. | ||
27052 | * TODO: Benchmark areas that can be improved with caching. | ||
27053 | * | ||
27054 | * @private | ||
27055 | * @param {object} lastProps | ||
27056 | * @param {object} nextProps | ||
27057 | * @param {?DOMElement} node | ||
27058 | */ | ||
27059 | _updateDOMProperties: function (lastProps, nextProps, transaction) { | ||
27060 | var propKey; | ||
27061 | var styleName; | ||
27062 | var styleUpdates; | ||
27063 | for (propKey in lastProps) { | ||
27064 | if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) { | ||
27065 | continue; | ||
27066 | } | ||
27067 | if (propKey === STYLE) { | ||
27068 | var lastStyle = this._previousStyleCopy; | ||
27069 | for (styleName in lastStyle) { | ||
27070 | if (lastStyle.hasOwnProperty(styleName)) { | ||
27071 | styleUpdates = styleUpdates || {}; | ||
27072 | styleUpdates[styleName] = ''; | ||
27073 | } | ||
27074 | } | ||
27075 | this._previousStyleCopy = null; | ||
27076 | } else if (registrationNameModules.hasOwnProperty(propKey)) { | ||
27077 | if (lastProps[propKey]) { | ||
27078 | // Only call deleteListener if there was a listener previously or | ||
27079 | // else willDeleteListener gets called when there wasn't actually a | ||
27080 | // listener (e.g., onClick={null}) | ||
27081 | deleteListener(this, propKey); | ||
27082 | } | ||
27083 | } else if (isCustomComponent(this._tag, lastProps)) { | ||
27084 | if (!RESERVED_PROPS.hasOwnProperty(propKey)) { | ||
27085 | DOMPropertyOperations.deleteValueForAttribute(getNode(this), propKey); | ||
27086 | } | ||
27087 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { | ||
27088 | DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey); | ||
27089 | } | ||
27090 | } | ||
27091 | for (propKey in nextProps) { | ||
27092 | var nextProp = nextProps[propKey]; | ||
27093 | var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined; | ||
27094 | if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) { | ||
27095 | continue; | ||
27096 | } | ||
27097 | if (propKey === STYLE) { | ||
27098 | if (nextProp) { | ||
27099 | if (process.env.NODE_ENV !== 'production') { | ||
27100 | checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this); | ||
27101 | this._previousStyle = nextProp; | ||
27102 | } | ||
27103 | nextProp = this._previousStyleCopy = _assign({}, nextProp); | ||
27104 | } else { | ||
27105 | this._previousStyleCopy = null; | ||
27106 | } | ||
27107 | if (lastProp) { | ||
27108 | // Unset styles on `lastProp` but not on `nextProp`. | ||
27109 | for (styleName in lastProp) { | ||
27110 | if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) { | ||
27111 | styleUpdates = styleUpdates || {}; | ||
27112 | styleUpdates[styleName] = ''; | ||
27113 | } | ||
27114 | } | ||
27115 | // Update styles that changed since `lastProp`. | ||
27116 | for (styleName in nextProp) { | ||
27117 | if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { | ||
27118 | styleUpdates = styleUpdates || {}; | ||
27119 | styleUpdates[styleName] = nextProp[styleName]; | ||
27120 | } | ||
27121 | } | ||
27122 | } else { | ||
27123 | // Relies on `updateStylesByID` not mutating `styleUpdates`. | ||
27124 | styleUpdates = nextProp; | ||
27125 | } | ||
27126 | } else if (registrationNameModules.hasOwnProperty(propKey)) { | ||
27127 | if (nextProp) { | ||
27128 | enqueuePutListener(this, propKey, nextProp, transaction); | ||
27129 | } else if (lastProp) { | ||
27130 | deleteListener(this, propKey); | ||
27131 | } | ||
27132 | } else if (isCustomComponent(this._tag, nextProps)) { | ||
27133 | if (!RESERVED_PROPS.hasOwnProperty(propKey)) { | ||
27134 | DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp); | ||
27135 | } | ||
27136 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { | ||
27137 | var node = getNode(this); | ||
27138 | // If we're updating to null or undefined, we should remove the property | ||
27139 | // from the DOM node instead of inadvertently setting to a string. This | ||
27140 | // brings us in line with the same behavior we have on initial render. | ||
27141 | if (nextProp != null) { | ||
27142 | DOMPropertyOperations.setValueForProperty(node, propKey, nextProp); | ||
27143 | } else { | ||
27144 | DOMPropertyOperations.deleteValueForProperty(node, propKey); | ||
27145 | } | ||
27146 | } | ||
27147 | } | ||
27148 | if (styleUpdates) { | ||
27149 | CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this); | ||
27150 | } | ||
27151 | }, | ||
27152 | |||
27153 | /** | ||
27154 | * Reconciles the children with the various properties that affect the | ||
27155 | * children content. | ||
27156 | * | ||
27157 | * @param {object} lastProps | ||
27158 | * @param {object} nextProps | ||
27159 | * @param {ReactReconcileTransaction} transaction | ||
27160 | * @param {object} context | ||
27161 | */ | ||
27162 | _updateDOMChildren: function (lastProps, nextProps, transaction, context) { | ||
27163 | var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null; | ||
27164 | var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null; | ||
27165 | |||
27166 | var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html; | ||
27167 | var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html; | ||
27168 | |||
27169 | // Note the use of `!=` which checks for null or undefined. | ||
27170 | var lastChildren = lastContent != null ? null : lastProps.children; | ||
27171 | var nextChildren = nextContent != null ? null : nextProps.children; | ||
27172 | |||
27173 | // If we're switching from children to content/html or vice versa, remove | ||
27174 | // the old content | ||
27175 | var lastHasContentOrHtml = lastContent != null || lastHtml != null; | ||
27176 | var nextHasContentOrHtml = nextContent != null || nextHtml != null; | ||
27177 | if (lastChildren != null && nextChildren == null) { | ||
27178 | this.updateChildren(null, transaction, context); | ||
27179 | } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { | ||
27180 | this.updateTextContent(''); | ||
27181 | if (process.env.NODE_ENV !== 'production') { | ||
27182 | ReactInstrumentation.debugTool.onSetChildren(this._debugID, []); | ||
27183 | } | ||
27184 | } | ||
27185 | |||
27186 | if (nextContent != null) { | ||
27187 | if (lastContent !== nextContent) { | ||
27188 | this.updateTextContent('' + nextContent); | ||
27189 | if (process.env.NODE_ENV !== 'production') { | ||
27190 | setAndValidateContentChildDev.call(this, nextContent); | ||
27191 | } | ||
27192 | } | ||
27193 | } else if (nextHtml != null) { | ||
27194 | if (lastHtml !== nextHtml) { | ||
27195 | this.updateMarkup('' + nextHtml); | ||
27196 | } | ||
27197 | if (process.env.NODE_ENV !== 'production') { | ||
27198 | ReactInstrumentation.debugTool.onSetChildren(this._debugID, []); | ||
27199 | } | ||
27200 | } else if (nextChildren != null) { | ||
27201 | if (process.env.NODE_ENV !== 'production') { | ||
27202 | setAndValidateContentChildDev.call(this, null); | ||
27203 | } | ||
27204 | |||
27205 | this.updateChildren(nextChildren, transaction, context); | ||
27206 | } | ||
27207 | }, | ||
27208 | |||
27209 | getHostNode: function () { | ||
27210 | return getNode(this); | ||
27211 | }, | ||
27212 | |||
27213 | /** | ||
27214 | * Destroys all event registrations for this instance. Does not remove from | ||
27215 | * the DOM. That must be done by the parent. | ||
27216 | * | ||
27217 | * @internal | ||
27218 | */ | ||
27219 | unmountComponent: function (safely) { | ||
27220 | switch (this._tag) { | ||
27221 | case 'audio': | ||
27222 | case 'form': | ||
27223 | case 'iframe': | ||
27224 | case 'img': | ||
27225 | case 'link': | ||
27226 | case 'object': | ||
27227 | case 'source': | ||
27228 | case 'video': | ||
27229 | var listeners = this._wrapperState.listeners; | ||
27230 | if (listeners) { | ||
27231 | for (var i = 0; i < listeners.length; i++) { | ||
27232 | listeners[i].remove(); | ||
27233 | } | ||
27234 | } | ||
27235 | break; | ||
27236 | case 'html': | ||
27237 | case 'head': | ||
27238 | case 'body': | ||
27239 | /** | ||
27240 | * Components like <html> <head> and <body> can't be removed or added | ||
27241 | * easily in a cross-browser way, however it's valuable to be able to | ||
27242 | * take advantage of React's reconciliation for styling and <title> | ||
27243 | * management. So we just document it and throw in dangerous cases. | ||
27244 | */ | ||
27245 | 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; | ||
27246 | break; | ||
27247 | } | ||
27248 | |||
27249 | this.unmountChildren(safely); | ||
27250 | ReactDOMComponentTree.uncacheNode(this); | ||
27251 | EventPluginHub.deleteAllListeners(this); | ||
27252 | this._rootNodeID = 0; | ||
27253 | this._domID = 0; | ||
27254 | this._wrapperState = null; | ||
27255 | |||
27256 | if (process.env.NODE_ENV !== 'production') { | ||
27257 | setAndValidateContentChildDev.call(this, null); | ||
27258 | } | ||
27259 | }, | ||
27260 | |||
27261 | getPublicInstance: function () { | ||
27262 | return getNode(this); | ||
27263 | } | ||
27264 | |||
27265 | }; | ||
27266 | |||
27267 | _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin); | ||
27268 | |||
27269 | module.exports = ReactDOMComponent; | ||
27270 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
27271 | |||
27272 | /***/ }), | ||
27273 | /* 257 */ | ||
27274 | /***/ (function(module, exports, __webpack_require__) { | ||
27275 | |||
27276 | "use strict"; | ||
27277 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
27278 | * Copyright 2013-present, Facebook, Inc. | ||
27279 | * All rights reserved. | ||
27280 | * | ||
27281 | * This source code is licensed under the BSD-style license found in the | ||
27282 | * LICENSE file in the root directory of this source tree. An additional grant | ||
27283 | * of patent rights can be found in the PATENTS file in the same directory. | ||
27284 | * | ||
27285 | */ | ||
27286 | |||
27287 | |||
27288 | |||
27289 | var validateDOMNesting = __webpack_require__(89); | ||
27290 | |||
27291 | var DOC_NODE_TYPE = 9; | ||
27292 | |||
27293 | function ReactDOMContainerInfo(topLevelWrapper, node) { | ||
27294 | var info = { | ||
27295 | _topLevelWrapper: topLevelWrapper, | ||
27296 | _idCounter: 1, | ||
27297 | _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null, | ||
27298 | _node: node, | ||
27299 | _tag: node ? node.nodeName.toLowerCase() : null, | ||
27300 | _namespaceURI: node ? node.namespaceURI : null | ||
27301 | }; | ||
27302 | if (process.env.NODE_ENV !== 'production') { | ||
27303 | info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null; | ||
27304 | } | ||
27305 | return info; | ||
27306 | } | ||
27307 | |||
27308 | module.exports = ReactDOMContainerInfo; | ||
27309 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
27310 | |||
27311 | /***/ }), | ||
27312 | /* 258 */ | ||
27313 | /***/ (function(module, exports, __webpack_require__) { | ||
27314 | |||
27315 | "use strict"; | ||
27316 | /** | ||
27317 | * Copyright 2014-present, Facebook, Inc. | ||
27318 | * All rights reserved. | ||
27319 | * | ||
27320 | * This source code is licensed under the BSD-style license found in the | ||
27321 | * LICENSE file in the root directory of this source tree. An additional grant | ||
27322 | * of patent rights can be found in the PATENTS file in the same directory. | ||
27323 | * | ||
27324 | */ | ||
27325 | |||
27326 | |||
27327 | |||
27328 | var _assign = __webpack_require__(4); | ||
27329 | |||
27330 | var DOMLazyTree = __webpack_require__(37); | ||
27331 | var ReactDOMComponentTree = __webpack_require__(6); | ||
27332 | |||
27333 | var ReactDOMEmptyComponent = function (instantiate) { | ||
27334 | // ReactCompositeComponent uses this: | ||
27335 | this._currentElement = null; | ||
27336 | // ReactDOMComponentTree uses these: | ||
27337 | this._hostNode = null; | ||
27338 | this._hostParent = null; | ||
27339 | this._hostContainerInfo = null; | ||
27340 | this._domID = 0; | ||
27341 | }; | ||
27342 | _assign(ReactDOMEmptyComponent.prototype, { | ||
27343 | mountComponent: function (transaction, hostParent, hostContainerInfo, context) { | ||
27344 | var domID = hostContainerInfo._idCounter++; | ||
27345 | this._domID = domID; | ||
27346 | this._hostParent = hostParent; | ||
27347 | this._hostContainerInfo = hostContainerInfo; | ||
27348 | |||
27349 | var nodeValue = ' react-empty: ' + this._domID + ' '; | ||
27350 | if (transaction.useCreateElement) { | ||
27351 | var ownerDocument = hostContainerInfo._ownerDocument; | ||
27352 | var node = ownerDocument.createComment(nodeValue); | ||
27353 | ReactDOMComponentTree.precacheNode(this, node); | ||
27354 | return DOMLazyTree(node); | ||
27355 | } else { | ||
27356 | if (transaction.renderToStaticMarkup) { | ||
27357 | // Normally we'd insert a comment node, but since this is a situation | ||
27358 | // where React won't take over (static pages), we can simply return | ||
27359 | // nothing. | ||
27360 | return ''; | ||
27361 | } | ||
27362 | return '<!--' + nodeValue + '-->'; | ||
27363 | } | ||
27364 | }, | ||
27365 | receiveComponent: function () {}, | ||
27366 | getHostNode: function () { | ||
27367 | return ReactDOMComponentTree.getNodeFromInstance(this); | ||
27368 | }, | ||
27369 | unmountComponent: function () { | ||
27370 | ReactDOMComponentTree.uncacheNode(this); | ||
27371 | } | ||
27372 | }); | ||
27373 | |||
27374 | module.exports = ReactDOMEmptyComponent; | ||
27375 | |||
27376 | /***/ }), | ||
27377 | /* 259 */ | ||
27378 | /***/ (function(module, exports, __webpack_require__) { | ||
27379 | |||
27380 | "use strict"; | ||
27381 | /** | ||
27382 | * Copyright 2013-present, Facebook, Inc. | ||
27383 | * All rights reserved. | ||
27384 | * | ||
27385 | * This source code is licensed under the BSD-style license found in the | ||
27386 | * LICENSE file in the root directory of this source tree. An additional grant | ||
27387 | * of patent rights can be found in the PATENTS file in the same directory. | ||
27388 | * | ||
27389 | */ | ||
27390 | |||
27391 | |||
27392 | |||
27393 | var ReactDOMFeatureFlags = { | ||
27394 | useCreateElement: true, | ||
27395 | useFiber: false | ||
27396 | }; | ||
27397 | |||
27398 | module.exports = ReactDOMFeatureFlags; | ||
27399 | |||
27400 | /***/ }), | ||
27401 | /* 260 */ | ||
27402 | /***/ (function(module, exports, __webpack_require__) { | ||
27403 | |||
27404 | "use strict"; | ||
27405 | /** | ||
27406 | * Copyright 2013-present, Facebook, Inc. | ||
27407 | * All rights reserved. | ||
27408 | * | ||
27409 | * This source code is licensed under the BSD-style license found in the | ||
27410 | * LICENSE file in the root directory of this source tree. An additional grant | ||
27411 | * of patent rights can be found in the PATENTS file in the same directory. | ||
27412 | * | ||
27413 | */ | ||
27414 | |||
27415 | |||
27416 | |||
27417 | var DOMChildrenOperations = __webpack_require__(75); | ||
27418 | var ReactDOMComponentTree = __webpack_require__(6); | ||
27419 | |||
27420 | /** | ||
27421 | * Operations used to process updates to DOM nodes. | ||
27422 | */ | ||
27423 | var ReactDOMIDOperations = { | ||
27424 | |||
27425 | /** | ||
27426 | * Updates a component's children by processing a series of updates. | ||
27427 | * | ||
27428 | * @param {array<object>} updates List of update configurations. | ||
27429 | * @internal | ||
27430 | */ | ||
27431 | dangerouslyProcessChildrenUpdates: function (parentInst, updates) { | ||
27432 | var node = ReactDOMComponentTree.getNodeFromInstance(parentInst); | ||
27433 | DOMChildrenOperations.processUpdates(node, updates); | ||
27434 | } | ||
27435 | }; | ||
27436 | |||
27437 | module.exports = ReactDOMIDOperations; | ||
27438 | |||
27439 | /***/ }), | ||
27440 | /* 261 */ | ||
27441 | /***/ (function(module, exports, __webpack_require__) { | ||
27442 | |||
27443 | "use strict"; | ||
27444 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
27445 | * Copyright 2013-present, Facebook, Inc. | ||
27446 | * All rights reserved. | ||
27447 | * | ||
27448 | * This source code is licensed under the BSD-style license found in the | ||
27449 | * LICENSE file in the root directory of this source tree. An additional grant | ||
27450 | * of patent rights can be found in the PATENTS file in the same directory. | ||
27451 | * | ||
27452 | */ | ||
27453 | |||
27454 | |||
27455 | |||
27456 | var _prodInvariant = __webpack_require__(3), | ||
27457 | _assign = __webpack_require__(4); | ||
27458 | |||
27459 | var DOMPropertyOperations = __webpack_require__(120); | ||
27460 | var LinkedValueUtils = __webpack_require__(79); | ||
27461 | var ReactDOMComponentTree = __webpack_require__(6); | ||
27462 | var ReactUpdates = __webpack_require__(16); | ||
27463 | |||
27464 | var invariant = __webpack_require__(1); | ||
27465 | var warning = __webpack_require__(2); | ||
27466 | |||
27467 | var didWarnValueLink = false; | ||
27468 | var didWarnCheckedLink = false; | ||
27469 | var didWarnValueDefaultValue = false; | ||
27470 | var didWarnCheckedDefaultChecked = false; | ||
27471 | var didWarnControlledToUncontrolled = false; | ||
27472 | var didWarnUncontrolledToControlled = false; | ||
27473 | |||
27474 | function forceUpdateIfMounted() { | ||
27475 | if (this._rootNodeID) { | ||
27476 | // DOM component is still mounted; update | ||
27477 | ReactDOMInput.updateWrapper(this); | ||
27478 | } | ||
27479 | } | ||
27480 | |||
27481 | function isControlled(props) { | ||
27482 | var usesChecked = props.type === 'checkbox' || props.type === 'radio'; | ||
27483 | return usesChecked ? props.checked != null : props.value != null; | ||
27484 | } | ||
27485 | |||
27486 | /** | ||
27487 | * Implements an <input> host component that allows setting these optional | ||
27488 | * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. | ||
27489 | * | ||
27490 | * If `checked` or `value` are not supplied (or null/undefined), user actions | ||
27491 | * that affect the checked state or value will trigger updates to the element. | ||
27492 | * | ||
27493 | * If they are supplied (and not null/undefined), the rendered element will not | ||
27494 | * trigger updates to the element. Instead, the props must change in order for | ||
27495 | * the rendered element to be updated. | ||
27496 | * | ||
27497 | * The rendered element will be initialized as unchecked (or `defaultChecked`) | ||
27498 | * with an empty value (or `defaultValue`). | ||
27499 | * | ||
27500 | * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html | ||
27501 | */ | ||
27502 | var ReactDOMInput = { | ||
27503 | getHostProps: function (inst, props) { | ||
27504 | var value = LinkedValueUtils.getValue(props); | ||
27505 | var checked = LinkedValueUtils.getChecked(props); | ||
27506 | |||
27507 | var hostProps = _assign({ | ||
27508 | // Make sure we set .type before any other properties (setting .value | ||
27509 | // before .type means .value is lost in IE11 and below) | ||
27510 | type: undefined, | ||
27511 | // Make sure we set .step before .value (setting .value before .step | ||
27512 | // means .value is rounded on mount, based upon step precision) | ||
27513 | step: undefined, | ||
27514 | // Make sure we set .min & .max before .value (to ensure proper order | ||
27515 | // in corner cases such as min or max deriving from value, e.g. Issue #7170) | ||
27516 | min: undefined, | ||
27517 | max: undefined | ||
27518 | }, props, { | ||
27519 | defaultChecked: undefined, | ||
27520 | defaultValue: undefined, | ||
27521 | value: value != null ? value : inst._wrapperState.initialValue, | ||
27522 | checked: checked != null ? checked : inst._wrapperState.initialChecked, | ||
27523 | onChange: inst._wrapperState.onChange | ||
27524 | }); | ||
27525 | |||
27526 | return hostProps; | ||
27527 | }, | ||
27528 | |||
27529 | mountWrapper: function (inst, props) { | ||
27530 | if (process.env.NODE_ENV !== 'production') { | ||
27531 | LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner); | ||
27532 | |||
27533 | var owner = inst._currentElement._owner; | ||
27534 | |||
27535 | if (props.valueLink !== undefined && !didWarnValueLink) { | ||
27536 | process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0; | ||
27537 | didWarnValueLink = true; | ||
27538 | } | ||
27539 | if (props.checkedLink !== undefined && !didWarnCheckedLink) { | ||
27540 | process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0; | ||
27541 | didWarnCheckedLink = true; | ||
27542 | } | ||
27543 | if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { | ||
27544 | 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; | ||
27545 | didWarnCheckedDefaultChecked = true; | ||
27546 | } | ||
27547 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { | ||
27548 | 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; | ||
27549 | didWarnValueDefaultValue = true; | ||
27550 | } | ||
27551 | } | ||
27552 | |||
27553 | var defaultValue = props.defaultValue; | ||
27554 | inst._wrapperState = { | ||
27555 | initialChecked: props.checked != null ? props.checked : props.defaultChecked, | ||
27556 | initialValue: props.value != null ? props.value : defaultValue, | ||
27557 | listeners: null, | ||
27558 | onChange: _handleChange.bind(inst), | ||
27559 | controlled: isControlled(props) | ||
27560 | }; | ||
27561 | }, | ||
27562 | |||
27563 | updateWrapper: function (inst) { | ||
27564 | var props = inst._currentElement.props; | ||
27565 | |||
27566 | if (process.env.NODE_ENV !== 'production') { | ||
27567 | var controlled = isControlled(props); | ||
27568 | var owner = inst._currentElement._owner; | ||
27569 | |||
27570 | if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) { | ||
27571 | 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; | ||
27572 | didWarnUncontrolledToControlled = true; | ||
27573 | } | ||
27574 | if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) { | ||
27575 | 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; | ||
27576 | didWarnControlledToUncontrolled = true; | ||
27577 | } | ||
27578 | } | ||
27579 | |||
27580 | // TODO: Shouldn't this be getChecked(props)? | ||
27581 | var checked = props.checked; | ||
27582 | if (checked != null) { | ||
27583 | DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false); | ||
27584 | } | ||
27585 | |||
27586 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
27587 | var value = LinkedValueUtils.getValue(props); | ||
27588 | if (value != null) { | ||
27589 | if (value === 0 && node.value === '') { | ||
27590 | node.value = '0'; | ||
27591 | // Note: IE9 reports a number inputs as 'text', so check props instead. | ||
27592 | } else if (props.type === 'number') { | ||
27593 | // Simulate `input.valueAsNumber`. IE9 does not support it | ||
27594 | var valueAsNumber = parseFloat(node.value, 10) || 0; | ||
27595 | |||
27596 | // eslint-disable-next-line | ||
27597 | if (value != valueAsNumber) { | ||
27598 | // Cast `value` to a string to ensure the value is set correctly. While | ||
27599 | // browsers typically do this as necessary, jsdom doesn't. | ||
27600 | node.value = '' + value; | ||
27601 | } | ||
27602 | // eslint-disable-next-line | ||
27603 | } else if (value != node.value) { | ||
27604 | // Cast `value` to a string to ensure the value is set correctly. While | ||
27605 | // browsers typically do this as necessary, jsdom doesn't. | ||
27606 | node.value = '' + value; | ||
27607 | } | ||
27608 | } else { | ||
27609 | if (props.value == null && props.defaultValue != null) { | ||
27610 | // In Chrome, assigning defaultValue to certain input types triggers input validation. | ||
27611 | // For number inputs, the display value loses trailing decimal points. For email inputs, | ||
27612 | // Chrome raises "The specified value <x> is not a valid email address". | ||
27613 | // | ||
27614 | // Here we check to see if the defaultValue has actually changed, avoiding these problems | ||
27615 | // when the user is inputting text | ||
27616 | // | ||
27617 | // https://github.com/facebook/react/issues/7253 | ||
27618 | if (node.defaultValue !== '' + props.defaultValue) { | ||
27619 | node.defaultValue = '' + props.defaultValue; | ||
27620 | } | ||
27621 | } | ||
27622 | if (props.checked == null && props.defaultChecked != null) { | ||
27623 | node.defaultChecked = !!props.defaultChecked; | ||
27624 | } | ||
27625 | } | ||
27626 | }, | ||
27627 | |||
27628 | postMountWrapper: function (inst) { | ||
27629 | var props = inst._currentElement.props; | ||
27630 | |||
27631 | // This is in postMount because we need access to the DOM node, which is not | ||
27632 | // available until after the component has mounted. | ||
27633 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
27634 | |||
27635 | // Detach value from defaultValue. We won't do anything if we're working on | ||
27636 | // submit or reset inputs as those values & defaultValues are linked. They | ||
27637 | // are not resetable nodes so this operation doesn't matter and actually | ||
27638 | // removes browser-default values (eg "Submit Query") when no value is | ||
27639 | // provided. | ||
27640 | |||
27641 | switch (props.type) { | ||
27642 | case 'submit': | ||
27643 | case 'reset': | ||
27644 | break; | ||
27645 | case 'color': | ||
27646 | case 'date': | ||
27647 | case 'datetime': | ||
27648 | case 'datetime-local': | ||
27649 | case 'month': | ||
27650 | case 'time': | ||
27651 | case 'week': | ||
27652 | // This fixes the no-show issue on iOS Safari and Android Chrome: | ||
27653 | // https://github.com/facebook/react/issues/7233 | ||
27654 | node.value = ''; | ||
27655 | node.value = node.defaultValue; | ||
27656 | break; | ||
27657 | default: | ||
27658 | node.value = node.value; | ||
27659 | break; | ||
27660 | } | ||
27661 | |||
27662 | // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug | ||
27663 | // this is needed to work around a chrome bug where setting defaultChecked | ||
27664 | // will sometimes influence the value of checked (even after detachment). | ||
27665 | // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 | ||
27666 | // We need to temporarily unset name to avoid disrupting radio button groups. | ||
27667 | var name = node.name; | ||
27668 | if (name !== '') { | ||
27669 | node.name = ''; | ||
27670 | } | ||
27671 | node.defaultChecked = !node.defaultChecked; | ||
27672 | node.defaultChecked = !node.defaultChecked; | ||
27673 | if (name !== '') { | ||
27674 | node.name = name; | ||
27675 | } | ||
27676 | } | ||
27677 | }; | ||
27678 | |||
27679 | function _handleChange(event) { | ||
27680 | var props = this._currentElement.props; | ||
27681 | |||
27682 | var returnValue = LinkedValueUtils.executeOnChange(props, event); | ||
27683 | |||
27684 | // Here we use asap to wait until all updates have propagated, which | ||
27685 | // is important when using controlled components within layers: | ||
27686 | // https://github.com/facebook/react/issues/1698 | ||
27687 | ReactUpdates.asap(forceUpdateIfMounted, this); | ||
27688 | |||
27689 | var name = props.name; | ||
27690 | if (props.type === 'radio' && name != null) { | ||
27691 | var rootNode = ReactDOMComponentTree.getNodeFromInstance(this); | ||
27692 | var queryRoot = rootNode; | ||
27693 | |||
27694 | while (queryRoot.parentNode) { | ||
27695 | queryRoot = queryRoot.parentNode; | ||
27696 | } | ||
27697 | |||
27698 | // If `rootNode.form` was non-null, then we could try `form.elements`, | ||
27699 | // but that sometimes behaves strangely in IE8. We could also try using | ||
27700 | // `form.getElementsByName`, but that will only return direct children | ||
27701 | // and won't include inputs that use the HTML5 `form=` attribute. Since | ||
27702 | // the input might not even be in a form, let's just use the global | ||
27703 | // `querySelectorAll` to ensure we don't miss anything. | ||
27704 | var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); | ||
27705 | |||
27706 | for (var i = 0; i < group.length; i++) { | ||
27707 | var otherNode = group[i]; | ||
27708 | if (otherNode === rootNode || otherNode.form !== rootNode.form) { | ||
27709 | continue; | ||
27710 | } | ||
27711 | // This will throw if radio buttons rendered by different copies of React | ||
27712 | // and the same name are rendered into the same form (same as #1939). | ||
27713 | // That's probably okay; we don't support it just as we don't support | ||
27714 | // mixing React radio buttons with non-React ones. | ||
27715 | var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode); | ||
27716 | !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; | ||
27717 | // If this is a controlled radio button group, forcing the input that | ||
27718 | // was previously checked to update will cause it to be come re-checked | ||
27719 | // as appropriate. | ||
27720 | ReactUpdates.asap(forceUpdateIfMounted, otherInstance); | ||
27721 | } | ||
27722 | } | ||
27723 | |||
27724 | return returnValue; | ||
27725 | } | ||
27726 | |||
27727 | module.exports = ReactDOMInput; | ||
27728 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
27729 | |||
27730 | /***/ }), | ||
27731 | /* 262 */ | ||
27732 | /***/ (function(module, exports, __webpack_require__) { | ||
27733 | |||
27734 | "use strict"; | ||
27735 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
27736 | * Copyright 2013-present, Facebook, Inc. | ||
27737 | * All rights reserved. | ||
27738 | * | ||
27739 | * This source code is licensed under the BSD-style license found in the | ||
27740 | * LICENSE file in the root directory of this source tree. An additional grant | ||
27741 | * of patent rights can be found in the PATENTS file in the same directory. | ||
27742 | * | ||
27743 | */ | ||
27744 | |||
27745 | |||
27746 | |||
27747 | var DOMProperty = __webpack_require__(21); | ||
27748 | var ReactComponentTreeHook = __webpack_require__(9); | ||
27749 | |||
27750 | var warning = __webpack_require__(2); | ||
27751 | |||
27752 | var warnedProperties = {}; | ||
27753 | var rARIA = new RegExp('^(aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); | ||
27754 | |||
27755 | function validateProperty(tagName, name, debugID) { | ||
27756 | if (warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { | ||
27757 | return true; | ||
27758 | } | ||
27759 | |||
27760 | if (rARIA.test(name)) { | ||
27761 | var lowerCasedName = name.toLowerCase(); | ||
27762 | var standardName = DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null; | ||
27763 | |||
27764 | // If this is an aria-* attribute, but is not listed in the known DOM | ||
27765 | // DOM properties, then it is an invalid aria-* attribute. | ||
27766 | if (standardName == null) { | ||
27767 | warnedProperties[name] = true; | ||
27768 | return false; | ||
27769 | } | ||
27770 | // aria-* attributes should be lowercase; suggest the lowercase version. | ||
27771 | if (name !== standardName) { | ||
27772 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown ARIA attribute %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; | ||
27773 | warnedProperties[name] = true; | ||
27774 | return true; | ||
27775 | } | ||
27776 | } | ||
27777 | |||
27778 | return true; | ||
27779 | } | ||
27780 | |||
27781 | function warnInvalidARIAProps(debugID, element) { | ||
27782 | var invalidProps = []; | ||
27783 | |||
27784 | for (var key in element.props) { | ||
27785 | var isValid = validateProperty(element.type, key, debugID); | ||
27786 | if (!isValid) { | ||
27787 | invalidProps.push(key); | ||
27788 | } | ||
27789 | } | ||
27790 | |||
27791 | var unknownPropString = invalidProps.map(function (prop) { | ||
27792 | return '`' + prop + '`'; | ||
27793 | }).join(', '); | ||
27794 | |||
27795 | if (invalidProps.length === 1) { | ||
27796 | 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; | ||
27797 | } else if (invalidProps.length > 1) { | ||
27798 | 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; | ||
27799 | } | ||
27800 | } | ||
27801 | |||
27802 | function handleElement(debugID, element) { | ||
27803 | if (element == null || typeof element.type !== 'string') { | ||
27804 | return; | ||
27805 | } | ||
27806 | if (element.type.indexOf('-') >= 0 || element.props.is) { | ||
27807 | return; | ||
27808 | } | ||
27809 | |||
27810 | warnInvalidARIAProps(debugID, element); | ||
27811 | } | ||
27812 | |||
27813 | var ReactDOMInvalidARIAHook = { | ||
27814 | onBeforeMountComponent: function (debugID, element) { | ||
27815 | if (process.env.NODE_ENV !== 'production') { | ||
27816 | handleElement(debugID, element); | ||
27817 | } | ||
27818 | }, | ||
27819 | onBeforeUpdateComponent: function (debugID, element) { | ||
27820 | if (process.env.NODE_ENV !== 'production') { | ||
27821 | handleElement(debugID, element); | ||
27822 | } | ||
27823 | } | ||
27824 | }; | ||
27825 | |||
27826 | module.exports = ReactDOMInvalidARIAHook; | ||
27827 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
27828 | |||
27829 | /***/ }), | ||
27830 | /* 263 */ | ||
27831 | /***/ (function(module, exports, __webpack_require__) { | ||
27832 | |||
27833 | "use strict"; | ||
27834 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
27835 | * Copyright 2013-present, Facebook, Inc. | ||
27836 | * All rights reserved. | ||
27837 | * | ||
27838 | * This source code is licensed under the BSD-style license found in the | ||
27839 | * LICENSE file in the root directory of this source tree. An additional grant | ||
27840 | * of patent rights can be found in the PATENTS file in the same directory. | ||
27841 | * | ||
27842 | */ | ||
27843 | |||
27844 | |||
27845 | |||
27846 | var ReactComponentTreeHook = __webpack_require__(9); | ||
27847 | |||
27848 | var warning = __webpack_require__(2); | ||
27849 | |||
27850 | var didWarnValueNull = false; | ||
27851 | |||
27852 | function handleElement(debugID, element) { | ||
27853 | if (element == null) { | ||
27854 | return; | ||
27855 | } | ||
27856 | if (element.type !== 'input' && element.type !== 'textarea' && element.type !== 'select') { | ||
27857 | return; | ||
27858 | } | ||
27859 | if (element.props != null && element.props.value === null && !didWarnValueNull) { | ||
27860 | 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; | ||
27861 | |||
27862 | didWarnValueNull = true; | ||
27863 | } | ||
27864 | } | ||
27865 | |||
27866 | var ReactDOMNullInputValuePropHook = { | ||
27867 | onBeforeMountComponent: function (debugID, element) { | ||
27868 | handleElement(debugID, element); | ||
27869 | }, | ||
27870 | onBeforeUpdateComponent: function (debugID, element) { | ||
27871 | handleElement(debugID, element); | ||
27872 | } | ||
27873 | }; | ||
27874 | |||
27875 | module.exports = ReactDOMNullInputValuePropHook; | ||
27876 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
27877 | |||
27878 | /***/ }), | ||
27879 | /* 264 */ | ||
27880 | /***/ (function(module, exports, __webpack_require__) { | ||
27881 | |||
27882 | "use strict"; | ||
27883 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
27884 | * Copyright 2013-present, Facebook, Inc. | ||
27885 | * All rights reserved. | ||
27886 | * | ||
27887 | * This source code is licensed under the BSD-style license found in the | ||
27888 | * LICENSE file in the root directory of this source tree. An additional grant | ||
27889 | * of patent rights can be found in the PATENTS file in the same directory. | ||
27890 | * | ||
27891 | */ | ||
27892 | |||
27893 | |||
27894 | |||
27895 | var _assign = __webpack_require__(4); | ||
27896 | |||
27897 | var React = __webpack_require__(39); | ||
27898 | var ReactDOMComponentTree = __webpack_require__(6); | ||
27899 | var ReactDOMSelect = __webpack_require__(122); | ||
27900 | |||
27901 | var warning = __webpack_require__(2); | ||
27902 | var didWarnInvalidOptionChildren = false; | ||
27903 | |||
27904 | function flattenChildren(children) { | ||
27905 | var content = ''; | ||
27906 | |||
27907 | // Flatten children and warn if they aren't strings or numbers; | ||
27908 | // invalid types are ignored. | ||
27909 | React.Children.forEach(children, function (child) { | ||
27910 | if (child == null) { | ||
27911 | return; | ||
27912 | } | ||
27913 | if (typeof child === 'string' || typeof child === 'number') { | ||
27914 | content += child; | ||
27915 | } else if (!didWarnInvalidOptionChildren) { | ||
27916 | didWarnInvalidOptionChildren = true; | ||
27917 | process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0; | ||
27918 | } | ||
27919 | }); | ||
27920 | |||
27921 | return content; | ||
27922 | } | ||
27923 | |||
27924 | /** | ||
27925 | * Implements an <option> host component that warns when `selected` is set. | ||
27926 | */ | ||
27927 | var ReactDOMOption = { | ||
27928 | mountWrapper: function (inst, props, hostParent) { | ||
27929 | // TODO (yungsters): Remove support for `selected` in <option>. | ||
27930 | if (process.env.NODE_ENV !== 'production') { | ||
27931 | 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; | ||
27932 | } | ||
27933 | |||
27934 | // Look up whether this option is 'selected' | ||
27935 | var selectValue = null; | ||
27936 | if (hostParent != null) { | ||
27937 | var selectParent = hostParent; | ||
27938 | |||
27939 | if (selectParent._tag === 'optgroup') { | ||
27940 | selectParent = selectParent._hostParent; | ||
27941 | } | ||
27942 | |||
27943 | if (selectParent != null && selectParent._tag === 'select') { | ||
27944 | selectValue = ReactDOMSelect.getSelectValueContext(selectParent); | ||
27945 | } | ||
27946 | } | ||
27947 | |||
27948 | // If the value is null (e.g., no specified value or after initial mount) | ||
27949 | // or missing (e.g., for <datalist>), we don't change props.selected | ||
27950 | var selected = null; | ||
27951 | if (selectValue != null) { | ||
27952 | var value; | ||
27953 | if (props.value != null) { | ||
27954 | value = props.value + ''; | ||
27955 | } else { | ||
27956 | value = flattenChildren(props.children); | ||
27957 | } | ||
27958 | selected = false; | ||
27959 | if (Array.isArray(selectValue)) { | ||
27960 | // multiple | ||
27961 | for (var i = 0; i < selectValue.length; i++) { | ||
27962 | if ('' + selectValue[i] === value) { | ||
27963 | selected = true; | ||
27964 | break; | ||
27965 | } | ||
27966 | } | ||
27967 | } else { | ||
27968 | selected = '' + selectValue === value; | ||
27969 | } | ||
27970 | } | ||
27971 | |||
27972 | inst._wrapperState = { selected: selected }; | ||
27973 | }, | ||
27974 | |||
27975 | postMountWrapper: function (inst) { | ||
27976 | // value="" should make a value attribute (#6219) | ||
27977 | var props = inst._currentElement.props; | ||
27978 | if (props.value != null) { | ||
27979 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
27980 | node.setAttribute('value', props.value); | ||
27981 | } | ||
27982 | }, | ||
27983 | |||
27984 | getHostProps: function (inst, props) { | ||
27985 | var hostProps = _assign({ selected: undefined, children: undefined }, props); | ||
27986 | |||
27987 | // Read state only from initial mount because <select> updates value | ||
27988 | // manually; we need the initial state only for server rendering | ||
27989 | if (inst._wrapperState.selected != null) { | ||
27990 | hostProps.selected = inst._wrapperState.selected; | ||
27991 | } | ||
27992 | |||
27993 | var content = flattenChildren(props.children); | ||
27994 | |||
27995 | if (content) { | ||
27996 | hostProps.children = content; | ||
27997 | } | ||
27998 | |||
27999 | return hostProps; | ||
28000 | } | ||
28001 | |||
28002 | }; | ||
28003 | |||
28004 | module.exports = ReactDOMOption; | ||
28005 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
28006 | |||
28007 | /***/ }), | ||
28008 | /* 265 */ | ||
28009 | /***/ (function(module, exports, __webpack_require__) { | ||
28010 | |||
28011 | "use strict"; | ||
28012 | /** | ||
28013 | * Copyright 2013-present, Facebook, Inc. | ||
28014 | * All rights reserved. | ||
28015 | * | ||
28016 | * This source code is licensed under the BSD-style license found in the | ||
28017 | * LICENSE file in the root directory of this source tree. An additional grant | ||
28018 | * of patent rights can be found in the PATENTS file in the same directory. | ||
28019 | * | ||
28020 | */ | ||
28021 | |||
28022 | |||
28023 | |||
28024 | var ExecutionEnvironment = __webpack_require__(7); | ||
28025 | |||
28026 | var getNodeForCharacterOffset = __webpack_require__(308); | ||
28027 | var getTextContentAccessor = __webpack_require__(134); | ||
28028 | |||
28029 | /** | ||
28030 | * While `isCollapsed` is available on the Selection object and `collapsed` | ||
28031 | * is available on the Range object, IE11 sometimes gets them wrong. | ||
28032 | * If the anchor/focus nodes and offsets are the same, the range is collapsed. | ||
28033 | */ | ||
28034 | function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) { | ||
28035 | return anchorNode === focusNode && anchorOffset === focusOffset; | ||
28036 | } | ||
28037 | |||
28038 | /** | ||
28039 | * Get the appropriate anchor and focus node/offset pairs for IE. | ||
28040 | * | ||
28041 | * The catch here is that IE's selection API doesn't provide information | ||
28042 | * about whether the selection is forward or backward, so we have to | ||
28043 | * behave as though it's always forward. | ||
28044 | * | ||
28045 | * IE text differs from modern selection in that it behaves as though | ||
28046 | * block elements end with a new line. This means character offsets will | ||
28047 | * differ between the two APIs. | ||
28048 | * | ||
28049 | * @param {DOMElement} node | ||
28050 | * @return {object} | ||
28051 | */ | ||
28052 | function getIEOffsets(node) { | ||
28053 | var selection = document.selection; | ||
28054 | var selectedRange = selection.createRange(); | ||
28055 | var selectedLength = selectedRange.text.length; | ||
28056 | |||
28057 | // Duplicate selection so we can move range without breaking user selection. | ||
28058 | var fromStart = selectedRange.duplicate(); | ||
28059 | fromStart.moveToElementText(node); | ||
28060 | fromStart.setEndPoint('EndToStart', selectedRange); | ||
28061 | |||
28062 | var startOffset = fromStart.text.length; | ||
28063 | var endOffset = startOffset + selectedLength; | ||
28064 | |||
28065 | return { | ||
28066 | start: startOffset, | ||
28067 | end: endOffset | ||
28068 | }; | ||
28069 | } | ||
28070 | |||
28071 | /** | ||
28072 | * @param {DOMElement} node | ||
28073 | * @return {?object} | ||
28074 | */ | ||
28075 | function getModernOffsets(node) { | ||
28076 | var selection = window.getSelection && window.getSelection(); | ||
28077 | |||
28078 | if (!selection || selection.rangeCount === 0) { | ||
28079 | return null; | ||
28080 | } | ||
28081 | |||
28082 | var anchorNode = selection.anchorNode; | ||
28083 | var anchorOffset = selection.anchorOffset; | ||
28084 | var focusNode = selection.focusNode; | ||
28085 | var focusOffset = selection.focusOffset; | ||
28086 | |||
28087 | var currentRange = selection.getRangeAt(0); | ||
28088 | |||
28089 | // In Firefox, range.startContainer and range.endContainer can be "anonymous | ||
28090 | // divs", e.g. the up/down buttons on an <input type="number">. Anonymous | ||
28091 | // divs do not seem to expose properties, triggering a "Permission denied | ||
28092 | // error" if any of its properties are accessed. The only seemingly possible | ||
28093 | // way to avoid erroring is to access a property that typically works for | ||
28094 | // non-anonymous divs and catch any error that may otherwise arise. See | ||
28095 | // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 | ||
28096 | try { | ||
28097 | /* eslint-disable no-unused-expressions */ | ||
28098 | currentRange.startContainer.nodeType; | ||
28099 | currentRange.endContainer.nodeType; | ||
28100 | /* eslint-enable no-unused-expressions */ | ||
28101 | } catch (e) { | ||
28102 | return null; | ||
28103 | } | ||
28104 | |||
28105 | // If the node and offset values are the same, the selection is collapsed. | ||
28106 | // `Selection.isCollapsed` is available natively, but IE sometimes gets | ||
28107 | // this value wrong. | ||
28108 | var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset); | ||
28109 | |||
28110 | var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length; | ||
28111 | |||
28112 | var tempRange = currentRange.cloneRange(); | ||
28113 | tempRange.selectNodeContents(node); | ||
28114 | tempRange.setEnd(currentRange.startContainer, currentRange.startOffset); | ||
28115 | |||
28116 | var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset); | ||
28117 | |||
28118 | var start = isTempRangeCollapsed ? 0 : tempRange.toString().length; | ||
28119 | var end = start + rangeLength; | ||
28120 | |||
28121 | // Detect whether the selection is backward. | ||
28122 | var detectionRange = document.createRange(); | ||
28123 | detectionRange.setStart(anchorNode, anchorOffset); | ||
28124 | detectionRange.setEnd(focusNode, focusOffset); | ||
28125 | var isBackward = detectionRange.collapsed; | ||
28126 | |||
28127 | return { | ||
28128 | start: isBackward ? end : start, | ||
28129 | end: isBackward ? start : end | ||
28130 | }; | ||
28131 | } | ||
28132 | |||
28133 | /** | ||
28134 | * @param {DOMElement|DOMTextNode} node | ||
28135 | * @param {object} offsets | ||
28136 | */ | ||
28137 | function setIEOffsets(node, offsets) { | ||
28138 | var range = document.selection.createRange().duplicate(); | ||
28139 | var start, end; | ||
28140 | |||
28141 | if (offsets.end === undefined) { | ||
28142 | start = offsets.start; | ||
28143 | end = start; | ||
28144 | } else if (offsets.start > offsets.end) { | ||
28145 | start = offsets.end; | ||
28146 | end = offsets.start; | ||
28147 | } else { | ||
28148 | start = offsets.start; | ||
28149 | end = offsets.end; | ||
28150 | } | ||
28151 | |||
28152 | range.moveToElementText(node); | ||
28153 | range.moveStart('character', start); | ||
28154 | range.setEndPoint('EndToStart', range); | ||
28155 | range.moveEnd('character', end - start); | ||
28156 | range.select(); | ||
28157 | } | ||
28158 | |||
28159 | /** | ||
28160 | * In modern non-IE browsers, we can support both forward and backward | ||
28161 | * selections. | ||
28162 | * | ||
28163 | * Note: IE10+ supports the Selection object, but it does not support | ||
28164 | * the `extend` method, which means that even in modern IE, it's not possible | ||
28165 | * to programmatically create a backward selection. Thus, for all IE | ||
28166 | * versions, we use the old IE API to create our selections. | ||
28167 | * | ||
28168 | * @param {DOMElement|DOMTextNode} node | ||
28169 | * @param {object} offsets | ||
28170 | */ | ||
28171 | function setModernOffsets(node, offsets) { | ||
28172 | if (!window.getSelection) { | ||
28173 | return; | ||
28174 | } | ||
28175 | |||
28176 | var selection = window.getSelection(); | ||
28177 | var length = node[getTextContentAccessor()].length; | ||
28178 | var start = Math.min(offsets.start, length); | ||
28179 | var end = offsets.end === undefined ? start : Math.min(offsets.end, length); | ||
28180 | |||
28181 | // IE 11 uses modern selection, but doesn't support the extend method. | ||
28182 | // Flip backward selections, so we can set with a single range. | ||
28183 | if (!selection.extend && start > end) { | ||
28184 | var temp = end; | ||
28185 | end = start; | ||
28186 | start = temp; | ||
28187 | } | ||
28188 | |||
28189 | var startMarker = getNodeForCharacterOffset(node, start); | ||
28190 | var endMarker = getNodeForCharacterOffset(node, end); | ||
28191 | |||
28192 | if (startMarker && endMarker) { | ||
28193 | var range = document.createRange(); | ||
28194 | range.setStart(startMarker.node, startMarker.offset); | ||
28195 | selection.removeAllRanges(); | ||
28196 | |||
28197 | if (start > end) { | ||
28198 | selection.addRange(range); | ||
28199 | selection.extend(endMarker.node, endMarker.offset); | ||
28200 | } else { | ||
28201 | range.setEnd(endMarker.node, endMarker.offset); | ||
28202 | selection.addRange(range); | ||
28203 | } | ||
28204 | } | ||
28205 | } | ||
28206 | |||
28207 | var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window); | ||
28208 | |||
28209 | var ReactDOMSelection = { | ||
28210 | /** | ||
28211 | * @param {DOMElement} node | ||
28212 | */ | ||
28213 | getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets, | ||
28214 | |||
28215 | /** | ||
28216 | * @param {DOMElement|DOMTextNode} node | ||
28217 | * @param {object} offsets | ||
28218 | */ | ||
28219 | setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets | ||
28220 | }; | ||
28221 | |||
28222 | module.exports = ReactDOMSelection; | ||
28223 | |||
28224 | /***/ }), | ||
28225 | /* 266 */ | ||
28226 | /***/ (function(module, exports, __webpack_require__) { | ||
28227 | |||
28228 | "use strict"; | ||
28229 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
28230 | * Copyright 2013-present, Facebook, Inc. | ||
28231 | * All rights reserved. | ||
28232 | * | ||
28233 | * This source code is licensed under the BSD-style license found in the | ||
28234 | * LICENSE file in the root directory of this source tree. An additional grant | ||
28235 | * of patent rights can be found in the PATENTS file in the same directory. | ||
28236 | * | ||
28237 | */ | ||
28238 | |||
28239 | |||
28240 | |||
28241 | var _prodInvariant = __webpack_require__(3), | ||
28242 | _assign = __webpack_require__(4); | ||
28243 | |||
28244 | var DOMChildrenOperations = __webpack_require__(75); | ||
28245 | var DOMLazyTree = __webpack_require__(37); | ||
28246 | var ReactDOMComponentTree = __webpack_require__(6); | ||
28247 | |||
28248 | var escapeTextContentForBrowser = __webpack_require__(57); | ||
28249 | var invariant = __webpack_require__(1); | ||
28250 | var validateDOMNesting = __webpack_require__(89); | ||
28251 | |||
28252 | /** | ||
28253 | * Text nodes violate a couple assumptions that React makes about components: | ||
28254 | * | ||
28255 | * - When mounting text into the DOM, adjacent text nodes are merged. | ||
28256 | * - Text nodes cannot be assigned a React root ID. | ||
28257 | * | ||
28258 | * This component is used to wrap strings between comment nodes so that they | ||
28259 | * can undergo the same reconciliation that is applied to elements. | ||
28260 | * | ||
28261 | * TODO: Investigate representing React components in the DOM with text nodes. | ||
28262 | * | ||
28263 | * @class ReactDOMTextComponent | ||
28264 | * @extends ReactComponent | ||
28265 | * @internal | ||
28266 | */ | ||
28267 | var ReactDOMTextComponent = function (text) { | ||
28268 | // TODO: This is really a ReactText (ReactNode), not a ReactElement | ||
28269 | this._currentElement = text; | ||
28270 | this._stringText = '' + text; | ||
28271 | // ReactDOMComponentTree uses these: | ||
28272 | this._hostNode = null; | ||
28273 | this._hostParent = null; | ||
28274 | |||
28275 | // Properties | ||
28276 | this._domID = 0; | ||
28277 | this._mountIndex = 0; | ||
28278 | this._closingComment = null; | ||
28279 | this._commentNodes = null; | ||
28280 | }; | ||
28281 | |||
28282 | _assign(ReactDOMTextComponent.prototype, { | ||
28283 | |||
28284 | /** | ||
28285 | * Creates the markup for this text node. This node is not intended to have | ||
28286 | * any features besides containing text content. | ||
28287 | * | ||
28288 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
28289 | * @return {string} Markup for this text node. | ||
28290 | * @internal | ||
28291 | */ | ||
28292 | mountComponent: function (transaction, hostParent, hostContainerInfo, context) { | ||
28293 | if (process.env.NODE_ENV !== 'production') { | ||
28294 | var parentInfo; | ||
28295 | if (hostParent != null) { | ||
28296 | parentInfo = hostParent._ancestorInfo; | ||
28297 | } else if (hostContainerInfo != null) { | ||
28298 | parentInfo = hostContainerInfo._ancestorInfo; | ||
28299 | } | ||
28300 | if (parentInfo) { | ||
28301 | // parentInfo should always be present except for the top-level | ||
28302 | // component when server rendering | ||
28303 | validateDOMNesting(null, this._stringText, this, parentInfo); | ||
28304 | } | ||
28305 | } | ||
28306 | |||
28307 | var domID = hostContainerInfo._idCounter++; | ||
28308 | var openingValue = ' react-text: ' + domID + ' '; | ||
28309 | var closingValue = ' /react-text '; | ||
28310 | this._domID = domID; | ||
28311 | this._hostParent = hostParent; | ||
28312 | if (transaction.useCreateElement) { | ||
28313 | var ownerDocument = hostContainerInfo._ownerDocument; | ||
28314 | var openingComment = ownerDocument.createComment(openingValue); | ||
28315 | var closingComment = ownerDocument.createComment(closingValue); | ||
28316 | var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment()); | ||
28317 | DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment)); | ||
28318 | if (this._stringText) { | ||
28319 | DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText))); | ||
28320 | } | ||
28321 | DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment)); | ||
28322 | ReactDOMComponentTree.precacheNode(this, openingComment); | ||
28323 | this._closingComment = closingComment; | ||
28324 | return lazyTree; | ||
28325 | } else { | ||
28326 | var escapedText = escapeTextContentForBrowser(this._stringText); | ||
28327 | |||
28328 | if (transaction.renderToStaticMarkup) { | ||
28329 | // Normally we'd wrap this between comment nodes for the reasons stated | ||
28330 | // above, but since this is a situation where React won't take over | ||
28331 | // (static pages), we can simply return the text as it is. | ||
28332 | return escapedText; | ||
28333 | } | ||
28334 | |||
28335 | return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->'; | ||
28336 | } | ||
28337 | }, | ||
28338 | |||
28339 | /** | ||
28340 | * Updates this component by updating the text content. | ||
28341 | * | ||
28342 | * @param {ReactText} nextText The next text content | ||
28343 | * @param {ReactReconcileTransaction} transaction | ||
28344 | * @internal | ||
28345 | */ | ||
28346 | receiveComponent: function (nextText, transaction) { | ||
28347 | if (nextText !== this._currentElement) { | ||
28348 | this._currentElement = nextText; | ||
28349 | var nextStringText = '' + nextText; | ||
28350 | if (nextStringText !== this._stringText) { | ||
28351 | // TODO: Save this as pending props and use performUpdateIfNecessary | ||
28352 | // and/or updateComponent to do the actual update for consistency with | ||
28353 | // other component types? | ||
28354 | this._stringText = nextStringText; | ||
28355 | var commentNodes = this.getHostNode(); | ||
28356 | DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText); | ||
28357 | } | ||
28358 | } | ||
28359 | }, | ||
28360 | |||
28361 | getHostNode: function () { | ||
28362 | var hostNode = this._commentNodes; | ||
28363 | if (hostNode) { | ||
28364 | return hostNode; | ||
28365 | } | ||
28366 | if (!this._closingComment) { | ||
28367 | var openingComment = ReactDOMComponentTree.getNodeFromInstance(this); | ||
28368 | var node = openingComment.nextSibling; | ||
28369 | while (true) { | ||
28370 | !(node != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0; | ||
28371 | if (node.nodeType === 8 && node.nodeValue === ' /react-text ') { | ||
28372 | this._closingComment = node; | ||
28373 | break; | ||
28374 | } | ||
28375 | node = node.nextSibling; | ||
28376 | } | ||
28377 | } | ||
28378 | hostNode = [this._hostNode, this._closingComment]; | ||
28379 | this._commentNodes = hostNode; | ||
28380 | return hostNode; | ||
28381 | }, | ||
28382 | |||
28383 | unmountComponent: function () { | ||
28384 | this._closingComment = null; | ||
28385 | this._commentNodes = null; | ||
28386 | ReactDOMComponentTree.uncacheNode(this); | ||
28387 | } | ||
28388 | |||
28389 | }); | ||
28390 | |||
28391 | module.exports = ReactDOMTextComponent; | ||
28392 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
28393 | |||
28394 | /***/ }), | ||
28395 | /* 267 */ | ||
28396 | /***/ (function(module, exports, __webpack_require__) { | ||
28397 | |||
28398 | "use strict"; | ||
28399 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
28400 | * Copyright 2013-present, Facebook, Inc. | ||
28401 | * All rights reserved. | ||
28402 | * | ||
28403 | * This source code is licensed under the BSD-style license found in the | ||
28404 | * LICENSE file in the root directory of this source tree. An additional grant | ||
28405 | * of patent rights can be found in the PATENTS file in the same directory. | ||
28406 | * | ||
28407 | */ | ||
28408 | |||
28409 | |||
28410 | |||
28411 | var _prodInvariant = __webpack_require__(3), | ||
28412 | _assign = __webpack_require__(4); | ||
28413 | |||
28414 | var LinkedValueUtils = __webpack_require__(79); | ||
28415 | var ReactDOMComponentTree = __webpack_require__(6); | ||
28416 | var ReactUpdates = __webpack_require__(16); | ||
28417 | |||
28418 | var invariant = __webpack_require__(1); | ||
28419 | var warning = __webpack_require__(2); | ||
28420 | |||
28421 | var didWarnValueLink = false; | ||
28422 | var didWarnValDefaultVal = false; | ||
28423 | |||
28424 | function forceUpdateIfMounted() { | ||
28425 | if (this._rootNodeID) { | ||
28426 | // DOM component is still mounted; update | ||
28427 | ReactDOMTextarea.updateWrapper(this); | ||
28428 | } | ||
28429 | } | ||
28430 | |||
28431 | /** | ||
28432 | * Implements a <textarea> host component that allows setting `value`, and | ||
28433 | * `defaultValue`. This differs from the traditional DOM API because value is | ||
28434 | * usually set as PCDATA children. | ||
28435 | * | ||
28436 | * If `value` is not supplied (or null/undefined), user actions that affect the | ||
28437 | * value will trigger updates to the element. | ||
28438 | * | ||
28439 | * If `value` is supplied (and not null/undefined), the rendered element will | ||
28440 | * not trigger updates to the element. Instead, the `value` prop must change in | ||
28441 | * order for the rendered element to be updated. | ||
28442 | * | ||
28443 | * The rendered element will be initialized with an empty value, the prop | ||
28444 | * `defaultValue` if specified, or the children content (deprecated). | ||
28445 | */ | ||
28446 | var ReactDOMTextarea = { | ||
28447 | getHostProps: function (inst, props) { | ||
28448 | !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0; | ||
28449 | |||
28450 | // Always set children to the same thing. In IE9, the selection range will | ||
28451 | // get reset if `textContent` is mutated. We could add a check in setTextContent | ||
28452 | // to only set the value if/when the value differs from the node value (which would | ||
28453 | // completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution. | ||
28454 | // The value can be a boolean or object so that's why it's forced to be a string. | ||
28455 | var hostProps = _assign({}, props, { | ||
28456 | value: undefined, | ||
28457 | defaultValue: undefined, | ||
28458 | children: '' + inst._wrapperState.initialValue, | ||
28459 | onChange: inst._wrapperState.onChange | ||
28460 | }); | ||
28461 | |||
28462 | return hostProps; | ||
28463 | }, | ||
28464 | |||
28465 | mountWrapper: function (inst, props) { | ||
28466 | if (process.env.NODE_ENV !== 'production') { | ||
28467 | LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner); | ||
28468 | if (props.valueLink !== undefined && !didWarnValueLink) { | ||
28469 | process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0; | ||
28470 | didWarnValueLink = true; | ||
28471 | } | ||
28472 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) { | ||
28473 | 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; | ||
28474 | didWarnValDefaultVal = true; | ||
28475 | } | ||
28476 | } | ||
28477 | |||
28478 | var value = LinkedValueUtils.getValue(props); | ||
28479 | var initialValue = value; | ||
28480 | |||
28481 | // Only bother fetching default value if we're going to use it | ||
28482 | if (value == null) { | ||
28483 | var defaultValue = props.defaultValue; | ||
28484 | // TODO (yungsters): Remove support for children content in <textarea>. | ||
28485 | var children = props.children; | ||
28486 | if (children != null) { | ||
28487 | if (process.env.NODE_ENV !== 'production') { | ||
28488 | process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0; | ||
28489 | } | ||
28490 | !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0; | ||
28491 | if (Array.isArray(children)) { | ||
28492 | !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0; | ||
28493 | children = children[0]; | ||
28494 | } | ||
28495 | |||
28496 | defaultValue = '' + children; | ||
28497 | } | ||
28498 | if (defaultValue == null) { | ||
28499 | defaultValue = ''; | ||
28500 | } | ||
28501 | initialValue = defaultValue; | ||
28502 | } | ||
28503 | |||
28504 | inst._wrapperState = { | ||
28505 | initialValue: '' + initialValue, | ||
28506 | listeners: null, | ||
28507 | onChange: _handleChange.bind(inst) | ||
28508 | }; | ||
28509 | }, | ||
28510 | |||
28511 | updateWrapper: function (inst) { | ||
28512 | var props = inst._currentElement.props; | ||
28513 | |||
28514 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
28515 | var value = LinkedValueUtils.getValue(props); | ||
28516 | if (value != null) { | ||
28517 | // Cast `value` to a string to ensure the value is set correctly. While | ||
28518 | // browsers typically do this as necessary, jsdom doesn't. | ||
28519 | var newValue = '' + value; | ||
28520 | |||
28521 | // To avoid side effects (such as losing text selection), only set value if changed | ||
28522 | if (newValue !== node.value) { | ||
28523 | node.value = newValue; | ||
28524 | } | ||
28525 | if (props.defaultValue == null) { | ||
28526 | node.defaultValue = newValue; | ||
28527 | } | ||
28528 | } | ||
28529 | if (props.defaultValue != null) { | ||
28530 | node.defaultValue = props.defaultValue; | ||
28531 | } | ||
28532 | }, | ||
28533 | |||
28534 | postMountWrapper: function (inst) { | ||
28535 | // This is in postMount because we need access to the DOM node, which is not | ||
28536 | // available until after the component has mounted. | ||
28537 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
28538 | var textContent = node.textContent; | ||
28539 | |||
28540 | // Only set node.value if textContent is equal to the expected | ||
28541 | // initial value. In IE10/IE11 there is a bug where the placeholder attribute | ||
28542 | // will populate textContent as well. | ||
28543 | // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/ | ||
28544 | if (textContent === inst._wrapperState.initialValue) { | ||
28545 | node.value = textContent; | ||
28546 | } | ||
28547 | } | ||
28548 | }; | ||
28549 | |||
28550 | function _handleChange(event) { | ||
28551 | var props = this._currentElement.props; | ||
28552 | var returnValue = LinkedValueUtils.executeOnChange(props, event); | ||
28553 | ReactUpdates.asap(forceUpdateIfMounted, this); | ||
28554 | return returnValue; | ||
28555 | } | ||
28556 | |||
28557 | module.exports = ReactDOMTextarea; | ||
28558 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
28559 | |||
28560 | /***/ }), | ||
28561 | /* 268 */ | ||
28562 | /***/ (function(module, exports, __webpack_require__) { | ||
28563 | |||
28564 | "use strict"; | ||
28565 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
28566 | * Copyright 2015-present, Facebook, Inc. | ||
28567 | * All rights reserved. | ||
28568 | * | ||
28569 | * This source code is licensed under the BSD-style license found in the | ||
28570 | * LICENSE file in the root directory of this source tree. An additional grant | ||
28571 | * of patent rights can be found in the PATENTS file in the same directory. | ||
28572 | * | ||
28573 | */ | ||
28574 | |||
28575 | |||
28576 | |||
28577 | var _prodInvariant = __webpack_require__(3); | ||
28578 | |||
28579 | var invariant = __webpack_require__(1); | ||
28580 | |||
28581 | /** | ||
28582 | * Return the lowest common ancestor of A and B, or null if they are in | ||
28583 | * different trees. | ||
28584 | */ | ||
28585 | function getLowestCommonAncestor(instA, instB) { | ||
28586 | !('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; | ||
28587 | !('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; | ||
28588 | |||
28589 | var depthA = 0; | ||
28590 | for (var tempA = instA; tempA; tempA = tempA._hostParent) { | ||
28591 | depthA++; | ||
28592 | } | ||
28593 | var depthB = 0; | ||
28594 | for (var tempB = instB; tempB; tempB = tempB._hostParent) { | ||
28595 | depthB++; | ||
28596 | } | ||
28597 | |||
28598 | // If A is deeper, crawl up. | ||
28599 | while (depthA - depthB > 0) { | ||
28600 | instA = instA._hostParent; | ||
28601 | depthA--; | ||
28602 | } | ||
28603 | |||
28604 | // If B is deeper, crawl up. | ||
28605 | while (depthB - depthA > 0) { | ||
28606 | instB = instB._hostParent; | ||
28607 | depthB--; | ||
28608 | } | ||
28609 | |||
28610 | // Walk in lockstep until we find a match. | ||
28611 | var depth = depthA; | ||
28612 | while (depth--) { | ||
28613 | if (instA === instB) { | ||
28614 | return instA; | ||
28615 | } | ||
28616 | instA = instA._hostParent; | ||
28617 | instB = instB._hostParent; | ||
28618 | } | ||
28619 | return null; | ||
28620 | } | ||
28621 | |||
28622 | /** | ||
28623 | * Return if A is an ancestor of B. | ||
28624 | */ | ||
28625 | function isAncestor(instA, instB) { | ||
28626 | !('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0; | ||
28627 | !('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0; | ||
28628 | |||
28629 | while (instB) { | ||
28630 | if (instB === instA) { | ||
28631 | return true; | ||
28632 | } | ||
28633 | instB = instB._hostParent; | ||
28634 | } | ||
28635 | return false; | ||
28636 | } | ||
28637 | |||
28638 | /** | ||
28639 | * Return the parent instance of the passed-in instance. | ||
28640 | */ | ||
28641 | function getParentInstance(inst) { | ||
28642 | !('_hostNode' in inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0; | ||
28643 | |||
28644 | return inst._hostParent; | ||
28645 | } | ||
28646 | |||
28647 | /** | ||
28648 | * Simulates the traversal of a two-phase, capture/bubble event dispatch. | ||
28649 | */ | ||
28650 | function traverseTwoPhase(inst, fn, arg) { | ||
28651 | var path = []; | ||
28652 | while (inst) { | ||
28653 | path.push(inst); | ||
28654 | inst = inst._hostParent; | ||
28655 | } | ||
28656 | var i; | ||
28657 | for (i = path.length; i-- > 0;) { | ||
28658 | fn(path[i], 'captured', arg); | ||
28659 | } | ||
28660 | for (i = 0; i < path.length; i++) { | ||
28661 | fn(path[i], 'bubbled', arg); | ||
28662 | } | ||
28663 | } | ||
28664 | |||
28665 | /** | ||
28666 | * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that | ||
28667 | * should would receive a `mouseEnter` or `mouseLeave` event. | ||
28668 | * | ||
28669 | * Does not invoke the callback on the nearest common ancestor because nothing | ||
28670 | * "entered" or "left" that element. | ||
28671 | */ | ||
28672 | function traverseEnterLeave(from, to, fn, argFrom, argTo) { | ||
28673 | var common = from && to ? getLowestCommonAncestor(from, to) : null; | ||
28674 | var pathFrom = []; | ||
28675 | while (from && from !== common) { | ||
28676 | pathFrom.push(from); | ||
28677 | from = from._hostParent; | ||
28678 | } | ||
28679 | var pathTo = []; | ||
28680 | while (to && to !== common) { | ||
28681 | pathTo.push(to); | ||
28682 | to = to._hostParent; | ||
28683 | } | ||
28684 | var i; | ||
28685 | for (i = 0; i < pathFrom.length; i++) { | ||
28686 | fn(pathFrom[i], 'bubbled', argFrom); | ||
28687 | } | ||
28688 | for (i = pathTo.length; i-- > 0;) { | ||
28689 | fn(pathTo[i], 'captured', argTo); | ||
28690 | } | ||
28691 | } | ||
28692 | |||
28693 | module.exports = { | ||
28694 | isAncestor: isAncestor, | ||
28695 | getLowestCommonAncestor: getLowestCommonAncestor, | ||
28696 | getParentInstance: getParentInstance, | ||
28697 | traverseTwoPhase: traverseTwoPhase, | ||
28698 | traverseEnterLeave: traverseEnterLeave | ||
28699 | }; | ||
28700 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
28701 | |||
28702 | /***/ }), | ||
28703 | /* 269 */ | ||
28704 | /***/ (function(module, exports, __webpack_require__) { | ||
28705 | |||
28706 | "use strict"; | ||
28707 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
28708 | * Copyright 2013-present, Facebook, Inc. | ||
28709 | * All rights reserved. | ||
28710 | * | ||
28711 | * This source code is licensed under the BSD-style license found in the | ||
28712 | * LICENSE file in the root directory of this source tree. An additional grant | ||
28713 | * of patent rights can be found in the PATENTS file in the same directory. | ||
28714 | * | ||
28715 | */ | ||
28716 | |||
28717 | |||
28718 | |||
28719 | var DOMProperty = __webpack_require__(21); | ||
28720 | var EventPluginRegistry = __webpack_require__(53); | ||
28721 | var ReactComponentTreeHook = __webpack_require__(9); | ||
28722 | |||
28723 | var warning = __webpack_require__(2); | ||
28724 | |||
28725 | if (process.env.NODE_ENV !== 'production') { | ||
28726 | var reactProps = { | ||
28727 | children: true, | ||
28728 | dangerouslySetInnerHTML: true, | ||
28729 | key: true, | ||
28730 | ref: true, | ||
28731 | |||
28732 | autoFocus: true, | ||
28733 | defaultValue: true, | ||
28734 | valueLink: true, | ||
28735 | defaultChecked: true, | ||
28736 | checkedLink: true, | ||
28737 | innerHTML: true, | ||
28738 | suppressContentEditableWarning: true, | ||
28739 | onFocusIn: true, | ||
28740 | onFocusOut: true | ||
28741 | }; | ||
28742 | var warnedProperties = {}; | ||
28743 | |||
28744 | var validateProperty = function (tagName, name, debugID) { | ||
28745 | if (DOMProperty.properties.hasOwnProperty(name) || DOMProperty.isCustomAttribute(name)) { | ||
28746 | return true; | ||
28747 | } | ||
28748 | if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { | ||
28749 | return true; | ||
28750 | } | ||
28751 | if (EventPluginRegistry.registrationNameModules.hasOwnProperty(name)) { | ||
28752 | return true; | ||
28753 | } | ||
28754 | warnedProperties[name] = true; | ||
28755 | var lowerCasedName = name.toLowerCase(); | ||
28756 | |||
28757 | // data-* attributes should be lowercase; suggest the lowercase version | ||
28758 | var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null; | ||
28759 | |||
28760 | var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry.possibleRegistrationNames[lowerCasedName] : null; | ||
28761 | |||
28762 | if (standardName != null) { | ||
28763 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown DOM property %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; | ||
28764 | return true; | ||
28765 | } else if (registrationName != null) { | ||
28766 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown event handler property %s. Did you mean `%s`?%s', name, registrationName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; | ||
28767 | return true; | ||
28768 | } else { | ||
28769 | // We were unable to guess which prop the user intended. | ||
28770 | // It is likely that the user was just blindly spreading/forwarding props | ||
28771 | // Components should be careful to only render valid props/attributes. | ||
28772 | // Warning will be invoked in warnUnknownProperties to allow grouping. | ||
28773 | return false; | ||
28774 | } | ||
28775 | }; | ||
28776 | } | ||
28777 | |||
28778 | var warnUnknownProperties = function (debugID, element) { | ||
28779 | var unknownProps = []; | ||
28780 | for (var key in element.props) { | ||
28781 | var isValid = validateProperty(element.type, key, debugID); | ||
28782 | if (!isValid) { | ||
28783 | unknownProps.push(key); | ||
28784 | } | ||
28785 | } | ||
28786 | |||
28787 | var unknownPropString = unknownProps.map(function (prop) { | ||
28788 | return '`' + prop + '`'; | ||
28789 | }).join(', '); | ||
28790 | |||
28791 | if (unknownProps.length === 1) { | ||
28792 | 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; | ||
28793 | } else if (unknownProps.length > 1) { | ||
28794 | 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; | ||
28795 | } | ||
28796 | }; | ||
28797 | |||
28798 | function handleElement(debugID, element) { | ||
28799 | if (element == null || typeof element.type !== 'string') { | ||
28800 | return; | ||
28801 | } | ||
28802 | if (element.type.indexOf('-') >= 0 || element.props.is) { | ||
28803 | return; | ||
28804 | } | ||
28805 | warnUnknownProperties(debugID, element); | ||
28806 | } | ||
28807 | |||
28808 | var ReactDOMUnknownPropertyHook = { | ||
28809 | onBeforeMountComponent: function (debugID, element) { | ||
28810 | handleElement(debugID, element); | ||
28811 | }, | ||
28812 | onBeforeUpdateComponent: function (debugID, element) { | ||
28813 | handleElement(debugID, element); | ||
28814 | } | ||
28815 | }; | ||
28816 | |||
28817 | module.exports = ReactDOMUnknownPropertyHook; | ||
28818 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
28819 | |||
28820 | /***/ }), | ||
28821 | /* 270 */ | ||
28822 | /***/ (function(module, exports, __webpack_require__) { | ||
28823 | |||
28824 | "use strict"; | ||
28825 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
28826 | * Copyright 2016-present, Facebook, Inc. | ||
28827 | * All rights reserved. | ||
28828 | * | ||
28829 | * This source code is licensed under the BSD-style license found in the | ||
28830 | * LICENSE file in the root directory of this source tree. An additional grant | ||
28831 | * of patent rights can be found in the PATENTS file in the same directory. | ||
28832 | * | ||
28833 | * | ||
28834 | */ | ||
28835 | |||
28836 | |||
28837 | |||
28838 | var ReactInvalidSetStateWarningHook = __webpack_require__(278); | ||
28839 | var ReactHostOperationHistoryHook = __webpack_require__(276); | ||
28840 | var ReactComponentTreeHook = __webpack_require__(9); | ||
28841 | var ExecutionEnvironment = __webpack_require__(7); | ||
28842 | |||
28843 | var performanceNow = __webpack_require__(225); | ||
28844 | var warning = __webpack_require__(2); | ||
28845 | |||
28846 | var hooks = []; | ||
28847 | var didHookThrowForEvent = {}; | ||
28848 | |||
28849 | function callHook(event, fn, context, arg1, arg2, arg3, arg4, arg5) { | ||
28850 | try { | ||
28851 | fn.call(context, arg1, arg2, arg3, arg4, arg5); | ||
28852 | } catch (e) { | ||
28853 | process.env.NODE_ENV !== 'production' ? warning(didHookThrowForEvent[event], 'Exception thrown by hook while handling %s: %s', event, e + '\n' + e.stack) : void 0; | ||
28854 | didHookThrowForEvent[event] = true; | ||
28855 | } | ||
28856 | } | ||
28857 | |||
28858 | function emitEvent(event, arg1, arg2, arg3, arg4, arg5) { | ||
28859 | for (var i = 0; i < hooks.length; i++) { | ||
28860 | var hook = hooks[i]; | ||
28861 | var fn = hook[event]; | ||
28862 | if (fn) { | ||
28863 | callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5); | ||
28864 | } | ||
28865 | } | ||
28866 | } | ||
28867 | |||
28868 | var isProfiling = false; | ||
28869 | var flushHistory = []; | ||
28870 | var lifeCycleTimerStack = []; | ||
28871 | var currentFlushNesting = 0; | ||
28872 | var currentFlushMeasurements = []; | ||
28873 | var currentFlushStartTime = 0; | ||
28874 | var currentTimerDebugID = null; | ||
28875 | var currentTimerStartTime = 0; | ||
28876 | var currentTimerNestedFlushDuration = 0; | ||
28877 | var currentTimerType = null; | ||
28878 | |||
28879 | var lifeCycleTimerHasWarned = false; | ||
28880 | |||
28881 | function clearHistory() { | ||
28882 | ReactComponentTreeHook.purgeUnmountedComponents(); | ||
28883 | ReactHostOperationHistoryHook.clearHistory(); | ||
28884 | } | ||
28885 | |||
28886 | function getTreeSnapshot(registeredIDs) { | ||
28887 | return registeredIDs.reduce(function (tree, id) { | ||
28888 | var ownerID = ReactComponentTreeHook.getOwnerID(id); | ||
28889 | var parentID = ReactComponentTreeHook.getParentID(id); | ||
28890 | tree[id] = { | ||
28891 | displayName: ReactComponentTreeHook.getDisplayName(id), | ||
28892 | text: ReactComponentTreeHook.getText(id), | ||
28893 | updateCount: ReactComponentTreeHook.getUpdateCount(id), | ||
28894 | childIDs: ReactComponentTreeHook.getChildIDs(id), | ||
28895 | // Text nodes don't have owners but this is close enough. | ||
28896 | ownerID: ownerID || parentID && ReactComponentTreeHook.getOwnerID(parentID) || 0, | ||
28897 | parentID: parentID | ||
28898 | }; | ||
28899 | return tree; | ||
28900 | }, {}); | ||
28901 | } | ||
28902 | |||
28903 | function resetMeasurements() { | ||
28904 | var previousStartTime = currentFlushStartTime; | ||
28905 | var previousMeasurements = currentFlushMeasurements; | ||
28906 | var previousOperations = ReactHostOperationHistoryHook.getHistory(); | ||
28907 | |||
28908 | if (currentFlushNesting === 0) { | ||
28909 | currentFlushStartTime = 0; | ||
28910 | currentFlushMeasurements = []; | ||
28911 | clearHistory(); | ||
28912 | return; | ||
28913 | } | ||
28914 | |||
28915 | if (previousMeasurements.length || previousOperations.length) { | ||
28916 | var registeredIDs = ReactComponentTreeHook.getRegisteredIDs(); | ||
28917 | flushHistory.push({ | ||
28918 | duration: performanceNow() - previousStartTime, | ||
28919 | measurements: previousMeasurements || [], | ||
28920 | operations: previousOperations || [], | ||
28921 | treeSnapshot: getTreeSnapshot(registeredIDs) | ||
28922 | }); | ||
28923 | } | ||
28924 | |||
28925 | clearHistory(); | ||
28926 | currentFlushStartTime = performanceNow(); | ||
28927 | currentFlushMeasurements = []; | ||
28928 | } | ||
28929 | |||
28930 | function checkDebugID(debugID) { | ||
28931 | var allowRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
28932 | |||
28933 | if (allowRoot && debugID === 0) { | ||
28934 | return; | ||
28935 | } | ||
28936 | if (!debugID) { | ||
28937 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDebugTool: debugID may not be empty.') : void 0; | ||
28938 | } | ||
28939 | } | ||
28940 | |||
28941 | function beginLifeCycleTimer(debugID, timerType) { | ||
28942 | if (currentFlushNesting === 0) { | ||
28943 | return; | ||
28944 | } | ||
28945 | if (currentTimerType && !lifeCycleTimerHasWarned) { | ||
28946 | 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; | ||
28947 | lifeCycleTimerHasWarned = true; | ||
28948 | } | ||
28949 | currentTimerStartTime = performanceNow(); | ||
28950 | currentTimerNestedFlushDuration = 0; | ||
28951 | currentTimerDebugID = debugID; | ||
28952 | currentTimerType = timerType; | ||
28953 | } | ||
28954 | |||
28955 | function endLifeCycleTimer(debugID, timerType) { | ||
28956 | if (currentFlushNesting === 0) { | ||
28957 | return; | ||
28958 | } | ||
28959 | if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) { | ||
28960 | 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; | ||
28961 | lifeCycleTimerHasWarned = true; | ||
28962 | } | ||
28963 | if (isProfiling) { | ||
28964 | currentFlushMeasurements.push({ | ||
28965 | timerType: timerType, | ||
28966 | instanceID: debugID, | ||
28967 | duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration | ||
28968 | }); | ||
28969 | } | ||
28970 | currentTimerStartTime = 0; | ||
28971 | currentTimerNestedFlushDuration = 0; | ||
28972 | currentTimerDebugID = null; | ||
28973 | currentTimerType = null; | ||
28974 | } | ||
28975 | |||
28976 | function pauseCurrentLifeCycleTimer() { | ||
28977 | var currentTimer = { | ||
28978 | startTime: currentTimerStartTime, | ||
28979 | nestedFlushStartTime: performanceNow(), | ||
28980 | debugID: currentTimerDebugID, | ||
28981 | timerType: currentTimerType | ||
28982 | }; | ||
28983 | lifeCycleTimerStack.push(currentTimer); | ||
28984 | currentTimerStartTime = 0; | ||
28985 | currentTimerNestedFlushDuration = 0; | ||
28986 | currentTimerDebugID = null; | ||
28987 | currentTimerType = null; | ||
28988 | } | ||
28989 | |||
28990 | function resumeCurrentLifeCycleTimer() { | ||
28991 | var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(), | ||
28992 | startTime = _lifeCycleTimerStack$.startTime, | ||
28993 | nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime, | ||
28994 | debugID = _lifeCycleTimerStack$.debugID, | ||
28995 | timerType = _lifeCycleTimerStack$.timerType; | ||
28996 | |||
28997 | var nestedFlushDuration = performanceNow() - nestedFlushStartTime; | ||
28998 | currentTimerStartTime = startTime; | ||
28999 | currentTimerNestedFlushDuration += nestedFlushDuration; | ||
29000 | currentTimerDebugID = debugID; | ||
29001 | currentTimerType = timerType; | ||
29002 | } | ||
29003 | |||
29004 | var lastMarkTimeStamp = 0; | ||
29005 | var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function'; | ||
29006 | |||
29007 | function shouldMark(debugID) { | ||
29008 | if (!isProfiling || !canUsePerformanceMeasure) { | ||
29009 | return false; | ||
29010 | } | ||
29011 | var element = ReactComponentTreeHook.getElement(debugID); | ||
29012 | if (element == null || typeof element !== 'object') { | ||
29013 | return false; | ||
29014 | } | ||
29015 | var isHostElement = typeof element.type === 'string'; | ||
29016 | if (isHostElement) { | ||
29017 | return false; | ||
29018 | } | ||
29019 | return true; | ||
29020 | } | ||
29021 | |||
29022 | function markBegin(debugID, markType) { | ||
29023 | if (!shouldMark(debugID)) { | ||
29024 | return; | ||
29025 | } | ||
29026 | |||
29027 | var markName = debugID + '::' + markType; | ||
29028 | lastMarkTimeStamp = performanceNow(); | ||
29029 | performance.mark(markName); | ||
29030 | } | ||
29031 | |||
29032 | function markEnd(debugID, markType) { | ||
29033 | if (!shouldMark(debugID)) { | ||
29034 | return; | ||
29035 | } | ||
29036 | |||
29037 | var markName = debugID + '::' + markType; | ||
29038 | var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown'; | ||
29039 | |||
29040 | // Chrome has an issue of dropping markers recorded too fast: | ||
29041 | // https://bugs.chromium.org/p/chromium/issues/detail?id=640652 | ||
29042 | // To work around this, we will not report very small measurements. | ||
29043 | // I determined the magic number by tweaking it back and forth. | ||
29044 | // 0.05ms was enough to prevent the issue, but I set it to 0.1ms to be safe. | ||
29045 | // When the bug is fixed, we can `measure()` unconditionally if we want to. | ||
29046 | var timeStamp = performanceNow(); | ||
29047 | if (timeStamp - lastMarkTimeStamp > 0.1) { | ||
29048 | var measurementName = displayName + ' [' + markType + ']'; | ||
29049 | performance.measure(measurementName, markName); | ||
29050 | } | ||
29051 | |||
29052 | performance.clearMarks(markName); | ||
29053 | performance.clearMeasures(measurementName); | ||
29054 | } | ||
29055 | |||
29056 | var ReactDebugTool = { | ||
29057 | addHook: function (hook) { | ||
29058 | hooks.push(hook); | ||
29059 | }, | ||
29060 | removeHook: function (hook) { | ||
29061 | for (var i = 0; i < hooks.length; i++) { | ||
29062 | if (hooks[i] === hook) { | ||
29063 | hooks.splice(i, 1); | ||
29064 | i--; | ||
29065 | } | ||
29066 | } | ||
29067 | }, | ||
29068 | isProfiling: function () { | ||
29069 | return isProfiling; | ||
29070 | }, | ||
29071 | beginProfiling: function () { | ||
29072 | if (isProfiling) { | ||
29073 | return; | ||
29074 | } | ||
29075 | |||
29076 | isProfiling = true; | ||
29077 | flushHistory.length = 0; | ||
29078 | resetMeasurements(); | ||
29079 | ReactDebugTool.addHook(ReactHostOperationHistoryHook); | ||
29080 | }, | ||
29081 | endProfiling: function () { | ||
29082 | if (!isProfiling) { | ||
29083 | return; | ||
29084 | } | ||
29085 | |||
29086 | isProfiling = false; | ||
29087 | resetMeasurements(); | ||
29088 | ReactDebugTool.removeHook(ReactHostOperationHistoryHook); | ||
29089 | }, | ||
29090 | getFlushHistory: function () { | ||
29091 | return flushHistory; | ||
29092 | }, | ||
29093 | onBeginFlush: function () { | ||
29094 | currentFlushNesting++; | ||
29095 | resetMeasurements(); | ||
29096 | pauseCurrentLifeCycleTimer(); | ||
29097 | emitEvent('onBeginFlush'); | ||
29098 | }, | ||
29099 | onEndFlush: function () { | ||
29100 | resetMeasurements(); | ||
29101 | currentFlushNesting--; | ||
29102 | resumeCurrentLifeCycleTimer(); | ||
29103 | emitEvent('onEndFlush'); | ||
29104 | }, | ||
29105 | onBeginLifeCycleTimer: function (debugID, timerType) { | ||
29106 | checkDebugID(debugID); | ||
29107 | emitEvent('onBeginLifeCycleTimer', debugID, timerType); | ||
29108 | markBegin(debugID, timerType); | ||
29109 | beginLifeCycleTimer(debugID, timerType); | ||
29110 | }, | ||
29111 | onEndLifeCycleTimer: function (debugID, timerType) { | ||
29112 | checkDebugID(debugID); | ||
29113 | endLifeCycleTimer(debugID, timerType); | ||
29114 | markEnd(debugID, timerType); | ||
29115 | emitEvent('onEndLifeCycleTimer', debugID, timerType); | ||
29116 | }, | ||
29117 | onBeginProcessingChildContext: function () { | ||
29118 | emitEvent('onBeginProcessingChildContext'); | ||
29119 | }, | ||
29120 | onEndProcessingChildContext: function () { | ||
29121 | emitEvent('onEndProcessingChildContext'); | ||
29122 | }, | ||
29123 | onHostOperation: function (operation) { | ||
29124 | checkDebugID(operation.instanceID); | ||
29125 | emitEvent('onHostOperation', operation); | ||
29126 | }, | ||
29127 | onSetState: function () { | ||
29128 | emitEvent('onSetState'); | ||
29129 | }, | ||
29130 | onSetChildren: function (debugID, childDebugIDs) { | ||
29131 | checkDebugID(debugID); | ||
29132 | childDebugIDs.forEach(checkDebugID); | ||
29133 | emitEvent('onSetChildren', debugID, childDebugIDs); | ||
29134 | }, | ||
29135 | onBeforeMountComponent: function (debugID, element, parentDebugID) { | ||
29136 | checkDebugID(debugID); | ||
29137 | checkDebugID(parentDebugID, true); | ||
29138 | emitEvent('onBeforeMountComponent', debugID, element, parentDebugID); | ||
29139 | markBegin(debugID, 'mount'); | ||
29140 | }, | ||
29141 | onMountComponent: function (debugID) { | ||
29142 | checkDebugID(debugID); | ||
29143 | markEnd(debugID, 'mount'); | ||
29144 | emitEvent('onMountComponent', debugID); | ||
29145 | }, | ||
29146 | onBeforeUpdateComponent: function (debugID, element) { | ||
29147 | checkDebugID(debugID); | ||
29148 | emitEvent('onBeforeUpdateComponent', debugID, element); | ||
29149 | markBegin(debugID, 'update'); | ||
29150 | }, | ||
29151 | onUpdateComponent: function (debugID) { | ||
29152 | checkDebugID(debugID); | ||
29153 | markEnd(debugID, 'update'); | ||
29154 | emitEvent('onUpdateComponent', debugID); | ||
29155 | }, | ||
29156 | onBeforeUnmountComponent: function (debugID) { | ||
29157 | checkDebugID(debugID); | ||
29158 | emitEvent('onBeforeUnmountComponent', debugID); | ||
29159 | markBegin(debugID, 'unmount'); | ||
29160 | }, | ||
29161 | onUnmountComponent: function (debugID) { | ||
29162 | checkDebugID(debugID); | ||
29163 | markEnd(debugID, 'unmount'); | ||
29164 | emitEvent('onUnmountComponent', debugID); | ||
29165 | }, | ||
29166 | onTestEvent: function () { | ||
29167 | emitEvent('onTestEvent'); | ||
29168 | } | ||
29169 | }; | ||
29170 | |||
29171 | // TODO remove these when RN/www gets updated | ||
29172 | ReactDebugTool.addDevtool = ReactDebugTool.addHook; | ||
29173 | ReactDebugTool.removeDevtool = ReactDebugTool.removeHook; | ||
29174 | |||
29175 | ReactDebugTool.addHook(ReactInvalidSetStateWarningHook); | ||
29176 | ReactDebugTool.addHook(ReactComponentTreeHook); | ||
29177 | var url = ExecutionEnvironment.canUseDOM && window.location.href || ''; | ||
29178 | if (/[?&]react_perf\b/.test(url)) { | ||
29179 | ReactDebugTool.beginProfiling(); | ||
29180 | } | ||
29181 | |||
29182 | module.exports = ReactDebugTool; | ||
29183 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
29184 | |||
29185 | /***/ }), | ||
29186 | /* 271 */ | ||
29187 | /***/ (function(module, exports, __webpack_require__) { | ||
29188 | |||
29189 | "use strict"; | ||
29190 | /** | ||
29191 | * Copyright 2013-present, Facebook, Inc. | ||
29192 | * All rights reserved. | ||
29193 | * | ||
29194 | * This source code is licensed under the BSD-style license found in the | ||
29195 | * LICENSE file in the root directory of this source tree. An additional grant | ||
29196 | * of patent rights can be found in the PATENTS file in the same directory. | ||
29197 | * | ||
29198 | */ | ||
29199 | |||
29200 | |||
29201 | |||
29202 | var _assign = __webpack_require__(4); | ||
29203 | |||
29204 | var ReactUpdates = __webpack_require__(16); | ||
29205 | var Transaction = __webpack_require__(56); | ||
29206 | |||
29207 | var emptyFunction = __webpack_require__(10); | ||
29208 | |||
29209 | var RESET_BATCHED_UPDATES = { | ||
29210 | initialize: emptyFunction, | ||
29211 | close: function () { | ||
29212 | ReactDefaultBatchingStrategy.isBatchingUpdates = false; | ||
29213 | } | ||
29214 | }; | ||
29215 | |||
29216 | var FLUSH_BATCHED_UPDATES = { | ||
29217 | initialize: emptyFunction, | ||
29218 | close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates) | ||
29219 | }; | ||
29220 | |||
29221 | var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES]; | ||
29222 | |||
29223 | function ReactDefaultBatchingStrategyTransaction() { | ||
29224 | this.reinitializeTransaction(); | ||
29225 | } | ||
29226 | |||
29227 | _assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, { | ||
29228 | getTransactionWrappers: function () { | ||
29229 | return TRANSACTION_WRAPPERS; | ||
29230 | } | ||
29231 | }); | ||
29232 | |||
29233 | var transaction = new ReactDefaultBatchingStrategyTransaction(); | ||
29234 | |||
29235 | var ReactDefaultBatchingStrategy = { | ||
29236 | isBatchingUpdates: false, | ||
29237 | |||
29238 | /** | ||
29239 | * Call the provided function in a context within which calls to `setState` | ||
29240 | * and friends are batched such that components aren't updated unnecessarily. | ||
29241 | */ | ||
29242 | batchedUpdates: function (callback, a, b, c, d, e) { | ||
29243 | var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates; | ||
29244 | |||
29245 | ReactDefaultBatchingStrategy.isBatchingUpdates = true; | ||
29246 | |||
29247 | // The code is written this way to avoid extra allocations | ||
29248 | if (alreadyBatchingUpdates) { | ||
29249 | return callback(a, b, c, d, e); | ||
29250 | } else { | ||
29251 | return transaction.perform(callback, null, a, b, c, d, e); | ||
29252 | } | ||
29253 | } | ||
29254 | }; | ||
29255 | |||
29256 | module.exports = ReactDefaultBatchingStrategy; | ||
29257 | |||
29258 | /***/ }), | ||
29259 | /* 272 */ | ||
29260 | /***/ (function(module, exports, __webpack_require__) { | ||
29261 | |||
29262 | "use strict"; | ||
29263 | /** | ||
29264 | * Copyright 2013-present, Facebook, Inc. | ||
29265 | * All rights reserved. | ||
29266 | * | ||
29267 | * This source code is licensed under the BSD-style license found in the | ||
29268 | * LICENSE file in the root directory of this source tree. An additional grant | ||
29269 | * of patent rights can be found in the PATENTS file in the same directory. | ||
29270 | * | ||
29271 | */ | ||
29272 | |||
29273 | |||
29274 | |||
29275 | var ARIADOMPropertyConfig = __webpack_require__(242); | ||
29276 | var BeforeInputEventPlugin = __webpack_require__(244); | ||
29277 | var ChangeEventPlugin = __webpack_require__(246); | ||
29278 | var DefaultEventPluginOrder = __webpack_require__(248); | ||
29279 | var EnterLeaveEventPlugin = __webpack_require__(249); | ||
29280 | var HTMLDOMPropertyConfig = __webpack_require__(251); | ||
29281 | var ReactComponentBrowserEnvironment = __webpack_require__(253); | ||
29282 | var ReactDOMComponent = __webpack_require__(256); | ||
29283 | var ReactDOMComponentTree = __webpack_require__(6); | ||
29284 | var ReactDOMEmptyComponent = __webpack_require__(258); | ||
29285 | var ReactDOMTreeTraversal = __webpack_require__(268); | ||
29286 | var ReactDOMTextComponent = __webpack_require__(266); | ||
29287 | var ReactDefaultBatchingStrategy = __webpack_require__(271); | ||
29288 | var ReactEventListener = __webpack_require__(275); | ||
29289 | var ReactInjection = __webpack_require__(277); | ||
29290 | var ReactReconcileTransaction = __webpack_require__(283); | ||
29291 | var SVGDOMPropertyConfig = __webpack_require__(288); | ||
29292 | var SelectEventPlugin = __webpack_require__(289); | ||
29293 | var SimpleEventPlugin = __webpack_require__(290); | ||
29294 | |||
29295 | var alreadyInjected = false; | ||
29296 | |||
29297 | function inject() { | ||
29298 | if (alreadyInjected) { | ||
29299 | // TODO: This is currently true because these injections are shared between | ||
29300 | // the client and the server package. They should be built independently | ||
29301 | // and not share any injection state. Then this problem will be solved. | ||
29302 | return; | ||
29303 | } | ||
29304 | alreadyInjected = true; | ||
29305 | |||
29306 | ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener); | ||
29307 | |||
29308 | /** | ||
29309 | * Inject modules for resolving DOM hierarchy and plugin ordering. | ||
29310 | */ | ||
29311 | ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder); | ||
29312 | ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree); | ||
29313 | ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal); | ||
29314 | |||
29315 | /** | ||
29316 | * Some important event plugins included by default (without having to require | ||
29317 | * them). | ||
29318 | */ | ||
29319 | ReactInjection.EventPluginHub.injectEventPluginsByName({ | ||
29320 | SimpleEventPlugin: SimpleEventPlugin, | ||
29321 | EnterLeaveEventPlugin: EnterLeaveEventPlugin, | ||
29322 | ChangeEventPlugin: ChangeEventPlugin, | ||
29323 | SelectEventPlugin: SelectEventPlugin, | ||
29324 | BeforeInputEventPlugin: BeforeInputEventPlugin | ||
29325 | }); | ||
29326 | |||
29327 | ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent); | ||
29328 | |||
29329 | ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent); | ||
29330 | |||
29331 | ReactInjection.DOMProperty.injectDOMPropertyConfig(ARIADOMPropertyConfig); | ||
29332 | ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig); | ||
29333 | ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig); | ||
29334 | |||
29335 | ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) { | ||
29336 | return new ReactDOMEmptyComponent(instantiate); | ||
29337 | }); | ||
29338 | |||
29339 | ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction); | ||
29340 | ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy); | ||
29341 | |||
29342 | ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment); | ||
29343 | } | ||
29344 | |||
29345 | module.exports = { | ||
29346 | inject: inject | ||
29347 | }; | ||
29348 | |||
29349 | /***/ }), | ||
29350 | /* 273 */ | ||
29351 | /***/ (function(module, exports, __webpack_require__) { | ||
29352 | |||
29353 | "use strict"; | ||
29354 | /** | ||
29355 | * Copyright 2014-present, Facebook, Inc. | ||
29356 | * All rights reserved. | ||
29357 | * | ||
29358 | * This source code is licensed under the BSD-style license found in the | ||
29359 | * LICENSE file in the root directory of this source tree. An additional grant | ||
29360 | * of patent rights can be found in the PATENTS file in the same directory. | ||
29361 | * | ||
29362 | * | ||
29363 | */ | ||
29364 | |||
29365 | |||
29366 | |||
29367 | // The Symbol used to tag the ReactElement type. If there is no native Symbol | ||
29368 | // nor polyfill, then a plain number is used for performance. | ||
29369 | |||
29370 | var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; | ||
29371 | |||
29372 | module.exports = REACT_ELEMENT_TYPE; | ||
29373 | |||
29374 | /***/ }), | ||
29375 | /* 274 */ | ||
29376 | /***/ (function(module, exports, __webpack_require__) { | ||
29377 | |||
29378 | "use strict"; | ||
29379 | /** | ||
29380 | * Copyright 2013-present, Facebook, Inc. | ||
29381 | * All rights reserved. | ||
29382 | * | ||
29383 | * This source code is licensed under the BSD-style license found in the | ||
29384 | * LICENSE file in the root directory of this source tree. An additional grant | ||
29385 | * of patent rights can be found in the PATENTS file in the same directory. | ||
29386 | * | ||
29387 | */ | ||
29388 | |||
29389 | |||
29390 | |||
29391 | var EventPluginHub = __webpack_require__(45); | ||
29392 | |||
29393 | function runEventQueueInBatch(events) { | ||
29394 | EventPluginHub.enqueueEvents(events); | ||
29395 | EventPluginHub.processEventQueue(false); | ||
29396 | } | ||
29397 | |||
29398 | var ReactEventEmitterMixin = { | ||
29399 | |||
29400 | /** | ||
29401 | * Streams a fired top-level event to `EventPluginHub` where plugins have the | ||
29402 | * opportunity to create `ReactEvent`s to be dispatched. | ||
29403 | */ | ||
29404 | handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
29405 | var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); | ||
29406 | runEventQueueInBatch(events); | ||
29407 | } | ||
29408 | }; | ||
29409 | |||
29410 | module.exports = ReactEventEmitterMixin; | ||
29411 | |||
29412 | /***/ }), | ||
29413 | /* 275 */ | ||
29414 | /***/ (function(module, exports, __webpack_require__) { | ||
29415 | |||
29416 | "use strict"; | ||
29417 | /** | ||
29418 | * Copyright 2013-present, Facebook, Inc. | ||
29419 | * All rights reserved. | ||
29420 | * | ||
29421 | * This source code is licensed under the BSD-style license found in the | ||
29422 | * LICENSE file in the root directory of this source tree. An additional grant | ||
29423 | * of patent rights can be found in the PATENTS file in the same directory. | ||
29424 | * | ||
29425 | */ | ||
29426 | |||
29427 | |||
29428 | |||
29429 | var _assign = __webpack_require__(4); | ||
29430 | |||
29431 | var EventListener = __webpack_require__(110); | ||
29432 | var ExecutionEnvironment = __webpack_require__(7); | ||
29433 | var PooledClass = __webpack_require__(30); | ||
29434 | var ReactDOMComponentTree = __webpack_require__(6); | ||
29435 | var ReactUpdates = __webpack_require__(16); | ||
29436 | |||
29437 | var getEventTarget = __webpack_require__(86); | ||
29438 | var getUnboundedScrollPosition = __webpack_require__(218); | ||
29439 | |||
29440 | /** | ||
29441 | * Find the deepest React component completely containing the root of the | ||
29442 | * passed-in instance (for use when entire React trees are nested within each | ||
29443 | * other). If React trees are not nested, returns null. | ||
29444 | */ | ||
29445 | function findParent(inst) { | ||
29446 | // TODO: It may be a good idea to cache this to prevent unnecessary DOM | ||
29447 | // traversal, but caching is difficult to do correctly without using a | ||
29448 | // mutation observer to listen for all DOM changes. | ||
29449 | while (inst._hostParent) { | ||
29450 | inst = inst._hostParent; | ||
29451 | } | ||
29452 | var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
29453 | var container = rootNode.parentNode; | ||
29454 | return ReactDOMComponentTree.getClosestInstanceFromNode(container); | ||
29455 | } | ||
29456 | |||
29457 | // Used to store ancestor hierarchy in top level callback | ||
29458 | function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) { | ||
29459 | this.topLevelType = topLevelType; | ||
29460 | this.nativeEvent = nativeEvent; | ||
29461 | this.ancestors = []; | ||
29462 | } | ||
29463 | _assign(TopLevelCallbackBookKeeping.prototype, { | ||
29464 | destructor: function () { | ||
29465 | this.topLevelType = null; | ||
29466 | this.nativeEvent = null; | ||
29467 | this.ancestors.length = 0; | ||
29468 | } | ||
29469 | }); | ||
29470 | PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler); | ||
29471 | |||
29472 | function handleTopLevelImpl(bookKeeping) { | ||
29473 | var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent); | ||
29474 | var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget); | ||
29475 | |||
29476 | // Loop through the hierarchy, in case there's any nested components. | ||
29477 | // It's important that we build the array of ancestors before calling any | ||
29478 | // event handlers, because event handlers can modify the DOM, leading to | ||
29479 | // inconsistencies with ReactMount's node cache. See #1105. | ||
29480 | var ancestor = targetInst; | ||
29481 | do { | ||
29482 | bookKeeping.ancestors.push(ancestor); | ||
29483 | ancestor = ancestor && findParent(ancestor); | ||
29484 | } while (ancestor); | ||
29485 | |||
29486 | for (var i = 0; i < bookKeeping.ancestors.length; i++) { | ||
29487 | targetInst = bookKeeping.ancestors[i]; | ||
29488 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); | ||
29489 | } | ||
29490 | } | ||
29491 | |||
29492 | function scrollValueMonitor(cb) { | ||
29493 | var scrollPosition = getUnboundedScrollPosition(window); | ||
29494 | cb(scrollPosition); | ||
29495 | } | ||
29496 | |||
29497 | var ReactEventListener = { | ||
29498 | _enabled: true, | ||
29499 | _handleTopLevel: null, | ||
29500 | |||
29501 | WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null, | ||
29502 | |||
29503 | setHandleTopLevel: function (handleTopLevel) { | ||
29504 | ReactEventListener._handleTopLevel = handleTopLevel; | ||
29505 | }, | ||
29506 | |||
29507 | setEnabled: function (enabled) { | ||
29508 | ReactEventListener._enabled = !!enabled; | ||
29509 | }, | ||
29510 | |||
29511 | isEnabled: function () { | ||
29512 | return ReactEventListener._enabled; | ||
29513 | }, | ||
29514 | |||
29515 | /** | ||
29516 | * Traps top-level events by using event bubbling. | ||
29517 | * | ||
29518 | * @param {string} topLevelType Record from `EventConstants`. | ||
29519 | * @param {string} handlerBaseName Event name (e.g. "click"). | ||
29520 | * @param {object} element Element on which to attach listener. | ||
29521 | * @return {?object} An object with a remove function which will forcefully | ||
29522 | * remove the listener. | ||
29523 | * @internal | ||
29524 | */ | ||
29525 | trapBubbledEvent: function (topLevelType, handlerBaseName, element) { | ||
29526 | if (!element) { | ||
29527 | return null; | ||
29528 | } | ||
29529 | return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); | ||
29530 | }, | ||
29531 | |||
29532 | /** | ||
29533 | * Traps a top-level event by using event capturing. | ||
29534 | * | ||
29535 | * @param {string} topLevelType Record from `EventConstants`. | ||
29536 | * @param {string} handlerBaseName Event name (e.g. "click"). | ||
29537 | * @param {object} element Element on which to attach listener. | ||
29538 | * @return {?object} An object with a remove function which will forcefully | ||
29539 | * remove the listener. | ||
29540 | * @internal | ||
29541 | */ | ||
29542 | trapCapturedEvent: function (topLevelType, handlerBaseName, element) { | ||
29543 | if (!element) { | ||
29544 | return null; | ||
29545 | } | ||
29546 | return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); | ||
29547 | }, | ||
29548 | |||
29549 | monitorScrollValue: function (refresh) { | ||
29550 | var callback = scrollValueMonitor.bind(null, refresh); | ||
29551 | EventListener.listen(window, 'scroll', callback); | ||
29552 | }, | ||
29553 | |||
29554 | dispatchEvent: function (topLevelType, nativeEvent) { | ||
29555 | if (!ReactEventListener._enabled) { | ||
29556 | return; | ||
29557 | } | ||
29558 | |||
29559 | var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent); | ||
29560 | try { | ||
29561 | // Event queue being processed in the same cycle allows | ||
29562 | // `preventDefault`. | ||
29563 | ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping); | ||
29564 | } finally { | ||
29565 | TopLevelCallbackBookKeeping.release(bookKeeping); | ||
29566 | } | ||
29567 | } | ||
29568 | }; | ||
29569 | |||
29570 | module.exports = ReactEventListener; | ||
29571 | |||
29572 | /***/ }), | ||
29573 | /* 276 */ | ||
29574 | /***/ (function(module, exports, __webpack_require__) { | ||
29575 | |||
29576 | "use strict"; | ||
29577 | /** | ||
29578 | * Copyright 2016-present, Facebook, Inc. | ||
29579 | * All rights reserved. | ||
29580 | * | ||
29581 | * This source code is licensed under the BSD-style license found in the | ||
29582 | * LICENSE file in the root directory of this source tree. An additional grant | ||
29583 | * of patent rights can be found in the PATENTS file in the same directory. | ||
29584 | * | ||
29585 | * | ||
29586 | */ | ||
29587 | |||
29588 | |||
29589 | |||
29590 | var history = []; | ||
29591 | |||
29592 | var ReactHostOperationHistoryHook = { | ||
29593 | onHostOperation: function (operation) { | ||
29594 | history.push(operation); | ||
29595 | }, | ||
29596 | clearHistory: function () { | ||
29597 | if (ReactHostOperationHistoryHook._preventClearing) { | ||
29598 | // Should only be used for tests. | ||
29599 | return; | ||
29600 | } | ||
29601 | |||
29602 | history = []; | ||
29603 | }, | ||
29604 | getHistory: function () { | ||
29605 | return history; | ||
29606 | } | ||
29607 | }; | ||
29608 | |||
29609 | module.exports = ReactHostOperationHistoryHook; | ||
29610 | |||
29611 | /***/ }), | ||
29612 | /* 277 */ | ||
29613 | /***/ (function(module, exports, __webpack_require__) { | ||
29614 | |||
29615 | "use strict"; | ||
29616 | /** | ||
29617 | * Copyright 2013-present, Facebook, Inc. | ||
29618 | * All rights reserved. | ||
29619 | * | ||
29620 | * This source code is licensed under the BSD-style license found in the | ||
29621 | * LICENSE file in the root directory of this source tree. An additional grant | ||
29622 | * of patent rights can be found in the PATENTS file in the same directory. | ||
29623 | * | ||
29624 | */ | ||
29625 | |||
29626 | |||
29627 | |||
29628 | var DOMProperty = __webpack_require__(21); | ||
29629 | var EventPluginHub = __webpack_require__(45); | ||
29630 | var EventPluginUtils = __webpack_require__(77); | ||
29631 | var ReactComponentEnvironment = __webpack_require__(80); | ||
29632 | var ReactEmptyComponent = __webpack_require__(123); | ||
29633 | var ReactBrowserEventEmitter = __webpack_require__(54); | ||
29634 | var ReactHostComponent = __webpack_require__(125); | ||
29635 | var ReactUpdates = __webpack_require__(16); | ||
29636 | |||
29637 | var ReactInjection = { | ||
29638 | Component: ReactComponentEnvironment.injection, | ||
29639 | DOMProperty: DOMProperty.injection, | ||
29640 | EmptyComponent: ReactEmptyComponent.injection, | ||
29641 | EventPluginHub: EventPluginHub.injection, | ||
29642 | EventPluginUtils: EventPluginUtils.injection, | ||
29643 | EventEmitter: ReactBrowserEventEmitter.injection, | ||
29644 | HostComponent: ReactHostComponent.injection, | ||
29645 | Updates: ReactUpdates.injection | ||
29646 | }; | ||
29647 | |||
29648 | module.exports = ReactInjection; | ||
29649 | |||
29650 | /***/ }), | ||
29651 | /* 278 */ | ||
29652 | /***/ (function(module, exports, __webpack_require__) { | ||
29653 | |||
29654 | "use strict"; | ||
29655 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
29656 | * Copyright 2016-present, Facebook, Inc. | ||
29657 | * All rights reserved. | ||
29658 | * | ||
29659 | * This source code is licensed under the BSD-style license found in the | ||
29660 | * LICENSE file in the root directory of this source tree. An additional grant | ||
29661 | * of patent rights can be found in the PATENTS file in the same directory. | ||
29662 | * | ||
29663 | * | ||
29664 | */ | ||
29665 | |||
29666 | |||
29667 | |||
29668 | var warning = __webpack_require__(2); | ||
29669 | |||
29670 | if (process.env.NODE_ENV !== 'production') { | ||
29671 | var processingChildContext = false; | ||
29672 | |||
29673 | var warnInvalidSetState = function () { | ||
29674 | process.env.NODE_ENV !== 'production' ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0; | ||
29675 | }; | ||
29676 | } | ||
29677 | |||
29678 | var ReactInvalidSetStateWarningHook = { | ||
29679 | onBeginProcessingChildContext: function () { | ||
29680 | processingChildContext = true; | ||
29681 | }, | ||
29682 | onEndProcessingChildContext: function () { | ||
29683 | processingChildContext = false; | ||
29684 | }, | ||
29685 | onSetState: function () { | ||
29686 | warnInvalidSetState(); | ||
29687 | } | ||
29688 | }; | ||
29689 | |||
29690 | module.exports = ReactInvalidSetStateWarningHook; | ||
29691 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
29692 | |||
29693 | /***/ }), | ||
29694 | /* 279 */ | ||
29695 | /***/ (function(module, exports, __webpack_require__) { | ||
29696 | |||
29697 | "use strict"; | ||
29698 | /** | ||
29699 | * Copyright 2013-present, Facebook, Inc. | ||
29700 | * All rights reserved. | ||
29701 | * | ||
29702 | * This source code is licensed under the BSD-style license found in the | ||
29703 | * LICENSE file in the root directory of this source tree. An additional grant | ||
29704 | * of patent rights can be found in the PATENTS file in the same directory. | ||
29705 | * | ||
29706 | */ | ||
29707 | |||
29708 | |||
29709 | |||
29710 | var adler32 = __webpack_require__(301); | ||
29711 | |||
29712 | var TAG_END = /\/?>/; | ||
29713 | var COMMENT_START = /^<\!\-\-/; | ||
29714 | |||
29715 | var ReactMarkupChecksum = { | ||
29716 | CHECKSUM_ATTR_NAME: 'data-react-checksum', | ||
29717 | |||
29718 | /** | ||
29719 | * @param {string} markup Markup string | ||
29720 | * @return {string} Markup string with checksum attribute attached | ||
29721 | */ | ||
29722 | addChecksumToMarkup: function (markup) { | ||
29723 | var checksum = adler32(markup); | ||
29724 | |||
29725 | // Add checksum (handle both parent tags, comments and self-closing tags) | ||
29726 | if (COMMENT_START.test(markup)) { | ||
29727 | return markup; | ||
29728 | } else { | ||
29729 | return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&'); | ||
29730 | } | ||
29731 | }, | ||
29732 | |||
29733 | /** | ||
29734 | * @param {string} markup to use | ||
29735 | * @param {DOMElement} element root React element | ||
29736 | * @returns {boolean} whether or not the markup is the same | ||
29737 | */ | ||
29738 | canReuseMarkup: function (markup, element) { | ||
29739 | var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
29740 | existingChecksum = existingChecksum && parseInt(existingChecksum, 10); | ||
29741 | var markupChecksum = adler32(markup); | ||
29742 | return markupChecksum === existingChecksum; | ||
29743 | } | ||
29744 | }; | ||
29745 | |||
29746 | module.exports = ReactMarkupChecksum; | ||
29747 | |||
29748 | /***/ }), | ||
29749 | /* 280 */ | ||
29750 | /***/ (function(module, exports, __webpack_require__) { | ||
29751 | |||
29752 | "use strict"; | ||
29753 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
29754 | * Copyright 2013-present, Facebook, Inc. | ||
29755 | * All rights reserved. | ||
29756 | * | ||
29757 | * This source code is licensed under the BSD-style license found in the | ||
29758 | * LICENSE file in the root directory of this source tree. An additional grant | ||
29759 | * of patent rights can be found in the PATENTS file in the same directory. | ||
29760 | * | ||
29761 | */ | ||
29762 | |||
29763 | |||
29764 | |||
29765 | var _prodInvariant = __webpack_require__(3); | ||
29766 | |||
29767 | var ReactComponentEnvironment = __webpack_require__(80); | ||
29768 | var ReactInstanceMap = __webpack_require__(47); | ||
29769 | var ReactInstrumentation = __webpack_require__(12); | ||
29770 | |||
29771 | var ReactCurrentOwner = __webpack_require__(17); | ||
29772 | var ReactReconciler = __webpack_require__(38); | ||
29773 | var ReactChildReconciler = __webpack_require__(252); | ||
29774 | |||
29775 | var emptyFunction = __webpack_require__(10); | ||
29776 | var flattenChildren = __webpack_require__(305); | ||
29777 | var invariant = __webpack_require__(1); | ||
29778 | |||
29779 | /** | ||
29780 | * Make an update for markup to be rendered and inserted at a supplied index. | ||
29781 | * | ||
29782 | * @param {string} markup Markup that renders into an element. | ||
29783 | * @param {number} toIndex Destination index. | ||
29784 | * @private | ||
29785 | */ | ||
29786 | function makeInsertMarkup(markup, afterNode, toIndex) { | ||
29787 | // NOTE: Null values reduce hidden classes. | ||
29788 | return { | ||
29789 | type: 'INSERT_MARKUP', | ||
29790 | content: markup, | ||
29791 | fromIndex: null, | ||
29792 | fromNode: null, | ||
29793 | toIndex: toIndex, | ||
29794 | afterNode: afterNode | ||
29795 | }; | ||
29796 | } | ||
29797 | |||
29798 | /** | ||
29799 | * Make an update for moving an existing element to another index. | ||
29800 | * | ||
29801 | * @param {number} fromIndex Source index of the existing element. | ||
29802 | * @param {number} toIndex Destination index of the element. | ||
29803 | * @private | ||
29804 | */ | ||
29805 | function makeMove(child, afterNode, toIndex) { | ||
29806 | // NOTE: Null values reduce hidden classes. | ||
29807 | return { | ||
29808 | type: 'MOVE_EXISTING', | ||
29809 | content: null, | ||
29810 | fromIndex: child._mountIndex, | ||
29811 | fromNode: ReactReconciler.getHostNode(child), | ||
29812 | toIndex: toIndex, | ||
29813 | afterNode: afterNode | ||
29814 | }; | ||
29815 | } | ||
29816 | |||
29817 | /** | ||
29818 | * Make an update for removing an element at an index. | ||
29819 | * | ||
29820 | * @param {number} fromIndex Index of the element to remove. | ||
29821 | * @private | ||
29822 | */ | ||
29823 | function makeRemove(child, node) { | ||
29824 | // NOTE: Null values reduce hidden classes. | ||
29825 | return { | ||
29826 | type: 'REMOVE_NODE', | ||
29827 | content: null, | ||
29828 | fromIndex: child._mountIndex, | ||
29829 | fromNode: node, | ||
29830 | toIndex: null, | ||
29831 | afterNode: null | ||
29832 | }; | ||
29833 | } | ||
29834 | |||
29835 | /** | ||
29836 | * Make an update for setting the markup of a node. | ||
29837 | * | ||
29838 | * @param {string} markup Markup that renders into an element. | ||
29839 | * @private | ||
29840 | */ | ||
29841 | function makeSetMarkup(markup) { | ||
29842 | // NOTE: Null values reduce hidden classes. | ||
29843 | return { | ||
29844 | type: 'SET_MARKUP', | ||
29845 | content: markup, | ||
29846 | fromIndex: null, | ||
29847 | fromNode: null, | ||
29848 | toIndex: null, | ||
29849 | afterNode: null | ||
29850 | }; | ||
29851 | } | ||
29852 | |||
29853 | /** | ||
29854 | * Make an update for setting the text content. | ||
29855 | * | ||
29856 | * @param {string} textContent Text content to set. | ||
29857 | * @private | ||
29858 | */ | ||
29859 | function makeTextContent(textContent) { | ||
29860 | // NOTE: Null values reduce hidden classes. | ||
29861 | return { | ||
29862 | type: 'TEXT_CONTENT', | ||
29863 | content: textContent, | ||
29864 | fromIndex: null, | ||
29865 | fromNode: null, | ||
29866 | toIndex: null, | ||
29867 | afterNode: null | ||
29868 | }; | ||
29869 | } | ||
29870 | |||
29871 | /** | ||
29872 | * Push an update, if any, onto the queue. Creates a new queue if none is | ||
29873 | * passed and always returns the queue. Mutative. | ||
29874 | */ | ||
29875 | function enqueue(queue, update) { | ||
29876 | if (update) { | ||
29877 | queue = queue || []; | ||
29878 | queue.push(update); | ||
29879 | } | ||
29880 | return queue; | ||
29881 | } | ||
29882 | |||
29883 | /** | ||
29884 | * Processes any enqueued updates. | ||
29885 | * | ||
29886 | * @private | ||
29887 | */ | ||
29888 | function processQueue(inst, updateQueue) { | ||
29889 | ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue); | ||
29890 | } | ||
29891 | |||
29892 | var setChildrenForInstrumentation = emptyFunction; | ||
29893 | if (process.env.NODE_ENV !== 'production') { | ||
29894 | var getDebugID = function (inst) { | ||
29895 | if (!inst._debugID) { | ||
29896 | // Check for ART-like instances. TODO: This is silly/gross. | ||
29897 | var internal; | ||
29898 | if (internal = ReactInstanceMap.get(inst)) { | ||
29899 | inst = internal; | ||
29900 | } | ||
29901 | } | ||
29902 | return inst._debugID; | ||
29903 | }; | ||
29904 | setChildrenForInstrumentation = function (children) { | ||
29905 | var debugID = getDebugID(this); | ||
29906 | // TODO: React Native empty components are also multichild. | ||
29907 | // This means they still get into this method but don't have _debugID. | ||
29908 | if (debugID !== 0) { | ||
29909 | ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) { | ||
29910 | return children[key]._debugID; | ||
29911 | }) : []); | ||
29912 | } | ||
29913 | }; | ||
29914 | } | ||
29915 | |||
29916 | /** | ||
29917 | * ReactMultiChild are capable of reconciling multiple children. | ||
29918 | * | ||
29919 | * @class ReactMultiChild | ||
29920 | * @internal | ||
29921 | */ | ||
29922 | var ReactMultiChild = { | ||
29923 | |||
29924 | /** | ||
29925 | * Provides common functionality for components that must reconcile multiple | ||
29926 | * children. This is used by `ReactDOMComponent` to mount, update, and | ||
29927 | * unmount child components. | ||
29928 | * | ||
29929 | * @lends {ReactMultiChild.prototype} | ||
29930 | */ | ||
29931 | Mixin: { | ||
29932 | |||
29933 | _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) { | ||
29934 | if (process.env.NODE_ENV !== 'production') { | ||
29935 | var selfDebugID = getDebugID(this); | ||
29936 | if (this._currentElement) { | ||
29937 | try { | ||
29938 | ReactCurrentOwner.current = this._currentElement._owner; | ||
29939 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID); | ||
29940 | } finally { | ||
29941 | ReactCurrentOwner.current = null; | ||
29942 | } | ||
29943 | } | ||
29944 | } | ||
29945 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context); | ||
29946 | }, | ||
29947 | |||
29948 | _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) { | ||
29949 | var nextChildren; | ||
29950 | var selfDebugID = 0; | ||
29951 | if (process.env.NODE_ENV !== 'production') { | ||
29952 | selfDebugID = getDebugID(this); | ||
29953 | if (this._currentElement) { | ||
29954 | try { | ||
29955 | ReactCurrentOwner.current = this._currentElement._owner; | ||
29956 | nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID); | ||
29957 | } finally { | ||
29958 | ReactCurrentOwner.current = null; | ||
29959 | } | ||
29960 | ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID); | ||
29961 | return nextChildren; | ||
29962 | } | ||
29963 | } | ||
29964 | nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID); | ||
29965 | ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID); | ||
29966 | return nextChildren; | ||
29967 | }, | ||
29968 | |||
29969 | /** | ||
29970 | * Generates a "mount image" for each of the supplied children. In the case | ||
29971 | * of `ReactDOMComponent`, a mount image is a string of markup. | ||
29972 | * | ||
29973 | * @param {?object} nestedChildren Nested child maps. | ||
29974 | * @return {array} An array of mounted representations. | ||
29975 | * @internal | ||
29976 | */ | ||
29977 | mountChildren: function (nestedChildren, transaction, context) { | ||
29978 | var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context); | ||
29979 | this._renderedChildren = children; | ||
29980 | |||
29981 | var mountImages = []; | ||
29982 | var index = 0; | ||
29983 | for (var name in children) { | ||
29984 | if (children.hasOwnProperty(name)) { | ||
29985 | var child = children[name]; | ||
29986 | var selfDebugID = 0; | ||
29987 | if (process.env.NODE_ENV !== 'production') { | ||
29988 | selfDebugID = getDebugID(this); | ||
29989 | } | ||
29990 | var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID); | ||
29991 | child._mountIndex = index++; | ||
29992 | mountImages.push(mountImage); | ||
29993 | } | ||
29994 | } | ||
29995 | |||
29996 | if (process.env.NODE_ENV !== 'production') { | ||
29997 | setChildrenForInstrumentation.call(this, children); | ||
29998 | } | ||
29999 | |||
30000 | return mountImages; | ||
30001 | }, | ||
30002 | |||
30003 | /** | ||
30004 | * Replaces any rendered children with a text content string. | ||
30005 | * | ||
30006 | * @param {string} nextContent String of content. | ||
30007 | * @internal | ||
30008 | */ | ||
30009 | updateTextContent: function (nextContent) { | ||
30010 | var prevChildren = this._renderedChildren; | ||
30011 | // Remove any rendered children. | ||
30012 | ReactChildReconciler.unmountChildren(prevChildren, false); | ||
30013 | for (var name in prevChildren) { | ||
30014 | if (prevChildren.hasOwnProperty(name)) { | ||
30015 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0; | ||
30016 | } | ||
30017 | } | ||
30018 | // Set new text content. | ||
30019 | var updates = [makeTextContent(nextContent)]; | ||
30020 | processQueue(this, updates); | ||
30021 | }, | ||
30022 | |||
30023 | /** | ||
30024 | * Replaces any rendered children with a markup string. | ||
30025 | * | ||
30026 | * @param {string} nextMarkup String of markup. | ||
30027 | * @internal | ||
30028 | */ | ||
30029 | updateMarkup: function (nextMarkup) { | ||
30030 | var prevChildren = this._renderedChildren; | ||
30031 | // Remove any rendered children. | ||
30032 | ReactChildReconciler.unmountChildren(prevChildren, false); | ||
30033 | for (var name in prevChildren) { | ||
30034 | if (prevChildren.hasOwnProperty(name)) { | ||
30035 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0; | ||
30036 | } | ||
30037 | } | ||
30038 | var updates = [makeSetMarkup(nextMarkup)]; | ||
30039 | processQueue(this, updates); | ||
30040 | }, | ||
30041 | |||
30042 | /** | ||
30043 | * Updates the rendered children with new children. | ||
30044 | * | ||
30045 | * @param {?object} nextNestedChildrenElements Nested child element maps. | ||
30046 | * @param {ReactReconcileTransaction} transaction | ||
30047 | * @internal | ||
30048 | */ | ||
30049 | updateChildren: function (nextNestedChildrenElements, transaction, context) { | ||
30050 | // Hook used by React ART | ||
30051 | this._updateChildren(nextNestedChildrenElements, transaction, context); | ||
30052 | }, | ||
30053 | |||
30054 | /** | ||
30055 | * @param {?object} nextNestedChildrenElements Nested child element maps. | ||
30056 | * @param {ReactReconcileTransaction} transaction | ||
30057 | * @final | ||
30058 | * @protected | ||
30059 | */ | ||
30060 | _updateChildren: function (nextNestedChildrenElements, transaction, context) { | ||
30061 | var prevChildren = this._renderedChildren; | ||
30062 | var removedNodes = {}; | ||
30063 | var mountImages = []; | ||
30064 | var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context); | ||
30065 | if (!nextChildren && !prevChildren) { | ||
30066 | return; | ||
30067 | } | ||
30068 | var updates = null; | ||
30069 | var name; | ||
30070 | // `nextIndex` will increment for each child in `nextChildren`, but | ||
30071 | // `lastIndex` will be the last index visited in `prevChildren`. | ||
30072 | var nextIndex = 0; | ||
30073 | var lastIndex = 0; | ||
30074 | // `nextMountIndex` will increment for each newly mounted child. | ||
30075 | var nextMountIndex = 0; | ||
30076 | var lastPlacedNode = null; | ||
30077 | for (name in nextChildren) { | ||
30078 | if (!nextChildren.hasOwnProperty(name)) { | ||
30079 | continue; | ||
30080 | } | ||
30081 | var prevChild = prevChildren && prevChildren[name]; | ||
30082 | var nextChild = nextChildren[name]; | ||
30083 | if (prevChild === nextChild) { | ||
30084 | updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex)); | ||
30085 | lastIndex = Math.max(prevChild._mountIndex, lastIndex); | ||
30086 | prevChild._mountIndex = nextIndex; | ||
30087 | } else { | ||
30088 | if (prevChild) { | ||
30089 | // Update `lastIndex` before `_mountIndex` gets unset by unmounting. | ||
30090 | lastIndex = Math.max(prevChild._mountIndex, lastIndex); | ||
30091 | // The `removedNodes` loop below will actually remove the child. | ||
30092 | } | ||
30093 | // The child must be instantiated before it's mounted. | ||
30094 | updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context)); | ||
30095 | nextMountIndex++; | ||
30096 | } | ||
30097 | nextIndex++; | ||
30098 | lastPlacedNode = ReactReconciler.getHostNode(nextChild); | ||
30099 | } | ||
30100 | // Remove children that are no longer present. | ||
30101 | for (name in removedNodes) { | ||
30102 | if (removedNodes.hasOwnProperty(name)) { | ||
30103 | updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name])); | ||
30104 | } | ||
30105 | } | ||
30106 | if (updates) { | ||
30107 | processQueue(this, updates); | ||
30108 | } | ||
30109 | this._renderedChildren = nextChildren; | ||
30110 | |||
30111 | if (process.env.NODE_ENV !== 'production') { | ||
30112 | setChildrenForInstrumentation.call(this, nextChildren); | ||
30113 | } | ||
30114 | }, | ||
30115 | |||
30116 | /** | ||
30117 | * Unmounts all rendered children. This should be used to clean up children | ||
30118 | * when this component is unmounted. It does not actually perform any | ||
30119 | * backend operations. | ||
30120 | * | ||
30121 | * @internal | ||
30122 | */ | ||
30123 | unmountChildren: function (safely) { | ||
30124 | var renderedChildren = this._renderedChildren; | ||
30125 | ReactChildReconciler.unmountChildren(renderedChildren, safely); | ||
30126 | this._renderedChildren = null; | ||
30127 | }, | ||
30128 | |||
30129 | /** | ||
30130 | * Moves a child component to the supplied index. | ||
30131 | * | ||
30132 | * @param {ReactComponent} child Component to move. | ||
30133 | * @param {number} toIndex Destination index of the element. | ||
30134 | * @param {number} lastIndex Last index visited of the siblings of `child`. | ||
30135 | * @protected | ||
30136 | */ | ||
30137 | moveChild: function (child, afterNode, toIndex, lastIndex) { | ||
30138 | // If the index of `child` is less than `lastIndex`, then it needs to | ||
30139 | // be moved. Otherwise, we do not need to move it because a child will be | ||
30140 | // inserted or moved before `child`. | ||
30141 | if (child._mountIndex < lastIndex) { | ||
30142 | return makeMove(child, afterNode, toIndex); | ||
30143 | } | ||
30144 | }, | ||
30145 | |||
30146 | /** | ||
30147 | * Creates a child component. | ||
30148 | * | ||
30149 | * @param {ReactComponent} child Component to create. | ||
30150 | * @param {string} mountImage Markup to insert. | ||
30151 | * @protected | ||
30152 | */ | ||
30153 | createChild: function (child, afterNode, mountImage) { | ||
30154 | return makeInsertMarkup(mountImage, afterNode, child._mountIndex); | ||
30155 | }, | ||
30156 | |||
30157 | /** | ||
30158 | * Removes a child component. | ||
30159 | * | ||
30160 | * @param {ReactComponent} child Child to remove. | ||
30161 | * @protected | ||
30162 | */ | ||
30163 | removeChild: function (child, node) { | ||
30164 | return makeRemove(child, node); | ||
30165 | }, | ||
30166 | |||
30167 | /** | ||
30168 | * Mounts a child with the supplied name. | ||
30169 | * | ||
30170 | * NOTE: This is part of `updateChildren` and is here for readability. | ||
30171 | * | ||
30172 | * @param {ReactComponent} child Component to mount. | ||
30173 | * @param {string} name Name of the child. | ||
30174 | * @param {number} index Index at which to insert the child. | ||
30175 | * @param {ReactReconcileTransaction} transaction | ||
30176 | * @private | ||
30177 | */ | ||
30178 | _mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) { | ||
30179 | child._mountIndex = index; | ||
30180 | return this.createChild(child, afterNode, mountImage); | ||
30181 | }, | ||
30182 | |||
30183 | /** | ||
30184 | * Unmounts a rendered child. | ||
30185 | * | ||
30186 | * NOTE: This is part of `updateChildren` and is here for readability. | ||
30187 | * | ||
30188 | * @param {ReactComponent} child Component to unmount. | ||
30189 | * @private | ||
30190 | */ | ||
30191 | _unmountChild: function (child, node) { | ||
30192 | var update = this.removeChild(child, node); | ||
30193 | child._mountIndex = null; | ||
30194 | return update; | ||
30195 | } | ||
30196 | |||
30197 | } | ||
30198 | |||
30199 | }; | ||
30200 | |||
30201 | module.exports = ReactMultiChild; | ||
30202 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
30203 | |||
30204 | /***/ }), | ||
30205 | /* 281 */ | ||
30206 | /***/ (function(module, exports, __webpack_require__) { | ||
30207 | |||
30208 | "use strict"; | ||
30209 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
30210 | * Copyright 2013-present, Facebook, Inc. | ||
30211 | * All rights reserved. | ||
30212 | * | ||
30213 | * This source code is licensed under the BSD-style license found in the | ||
30214 | * LICENSE file in the root directory of this source tree. An additional grant | ||
30215 | * of patent rights can be found in the PATENTS file in the same directory. | ||
30216 | * | ||
30217 | * | ||
30218 | */ | ||
30219 | |||
30220 | |||
30221 | |||
30222 | var _prodInvariant = __webpack_require__(3); | ||
30223 | |||
30224 | var invariant = __webpack_require__(1); | ||
30225 | |||
30226 | /** | ||
30227 | * @param {?object} object | ||
30228 | * @return {boolean} True if `object` is a valid owner. | ||
30229 | * @final | ||
30230 | */ | ||
30231 | function isValidOwner(object) { | ||
30232 | return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function'); | ||
30233 | } | ||
30234 | |||
30235 | /** | ||
30236 | * ReactOwners are capable of storing references to owned components. | ||
30237 | * | ||
30238 | * All components are capable of //being// referenced by owner components, but | ||
30239 | * only ReactOwner components are capable of //referencing// owned components. | ||
30240 | * The named reference is known as a "ref". | ||
30241 | * | ||
30242 | * Refs are available when mounted and updated during reconciliation. | ||
30243 | * | ||
30244 | * var MyComponent = React.createClass({ | ||
30245 | * render: function() { | ||
30246 | * return ( | ||
30247 | * <div onClick={this.handleClick}> | ||
30248 | * <CustomComponent ref="custom" /> | ||
30249 | * </div> | ||
30250 | * ); | ||
30251 | * }, | ||
30252 | * handleClick: function() { | ||
30253 | * this.refs.custom.handleClick(); | ||
30254 | * }, | ||
30255 | * componentDidMount: function() { | ||
30256 | * this.refs.custom.initialize(); | ||
30257 | * } | ||
30258 | * }); | ||
30259 | * | ||
30260 | * Refs should rarely be used. When refs are used, they should only be done to | ||
30261 | * control data that is not handled by React's data flow. | ||
30262 | * | ||
30263 | * @class ReactOwner | ||
30264 | */ | ||
30265 | var ReactOwner = { | ||
30266 | /** | ||
30267 | * Adds a component by ref to an owner component. | ||
30268 | * | ||
30269 | * @param {ReactComponent} component Component to reference. | ||
30270 | * @param {string} ref Name by which to refer to the component. | ||
30271 | * @param {ReactOwner} owner Component on which to record the ref. | ||
30272 | * @final | ||
30273 | * @internal | ||
30274 | */ | ||
30275 | addComponentAsRefTo: function (component, ref, owner) { | ||
30276 | !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; | ||
30277 | owner.attachRef(ref, component); | ||
30278 | }, | ||
30279 | |||
30280 | /** | ||
30281 | * Removes a component by ref from an owner component. | ||
30282 | * | ||
30283 | * @param {ReactComponent} component Component to dereference. | ||
30284 | * @param {string} ref Name of the ref to remove. | ||
30285 | * @param {ReactOwner} owner Component on which the ref is recorded. | ||
30286 | * @final | ||
30287 | * @internal | ||
30288 | */ | ||
30289 | removeComponentAsRefFrom: function (component, ref, owner) { | ||
30290 | !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; | ||
30291 | var ownerPublicInstance = owner.getPublicInstance(); | ||
30292 | // Check that `component`'s owner is still alive and that `component` is still the current ref | ||
30293 | // because we do not want to detach the ref if another component stole it. | ||
30294 | if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) { | ||
30295 | owner.detachRef(ref); | ||
30296 | } | ||
30297 | } | ||
30298 | |||
30299 | }; | ||
30300 | |||
30301 | module.exports = ReactOwner; | ||
30302 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
30303 | |||
30304 | /***/ }), | ||
30305 | /* 282 */ | ||
30306 | /***/ (function(module, exports, __webpack_require__) { | ||
30307 | |||
30308 | "use strict"; | ||
30309 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
30310 | * Copyright 2013-present, Facebook, Inc. | ||
30311 | * All rights reserved. | ||
30312 | * | ||
30313 | * This source code is licensed under the BSD-style license found in the | ||
30314 | * LICENSE file in the root directory of this source tree. An additional grant | ||
30315 | * of patent rights can be found in the PATENTS file in the same directory. | ||
30316 | * | ||
30317 | * | ||
30318 | */ | ||
30319 | |||
30320 | |||
30321 | |||
30322 | var ReactPropTypeLocationNames = {}; | ||
30323 | |||
30324 | if (process.env.NODE_ENV !== 'production') { | ||
30325 | ReactPropTypeLocationNames = { | ||
30326 | prop: 'prop', | ||
30327 | context: 'context', | ||
30328 | childContext: 'child context' | ||
30329 | }; | ||
30330 | } | ||
30331 | |||
30332 | module.exports = ReactPropTypeLocationNames; | ||
30333 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
30334 | |||
30335 | /***/ }), | ||
30336 | /* 283 */ | ||
30337 | /***/ (function(module, exports, __webpack_require__) { | ||
30338 | |||
30339 | "use strict"; | ||
30340 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
30341 | * Copyright 2013-present, Facebook, Inc. | ||
30342 | * All rights reserved. | ||
30343 | * | ||
30344 | * This source code is licensed under the BSD-style license found in the | ||
30345 | * LICENSE file in the root directory of this source tree. An additional grant | ||
30346 | * of patent rights can be found in the PATENTS file in the same directory. | ||
30347 | * | ||
30348 | */ | ||
30349 | |||
30350 | |||
30351 | |||
30352 | var _assign = __webpack_require__(4); | ||
30353 | |||
30354 | var CallbackQueue = __webpack_require__(119); | ||
30355 | var PooledClass = __webpack_require__(30); | ||
30356 | var ReactBrowserEventEmitter = __webpack_require__(54); | ||
30357 | var ReactInputSelection = __webpack_require__(126); | ||
30358 | var ReactInstrumentation = __webpack_require__(12); | ||
30359 | var Transaction = __webpack_require__(56); | ||
30360 | var ReactUpdateQueue = __webpack_require__(82); | ||
30361 | |||
30362 | /** | ||
30363 | * Ensures that, when possible, the selection range (currently selected text | ||
30364 | * input) is not disturbed by performing the transaction. | ||
30365 | */ | ||
30366 | var SELECTION_RESTORATION = { | ||
30367 | /** | ||
30368 | * @return {Selection} Selection information. | ||
30369 | */ | ||
30370 | initialize: ReactInputSelection.getSelectionInformation, | ||
30371 | /** | ||
30372 | * @param {Selection} sel Selection information returned from `initialize`. | ||
30373 | */ | ||
30374 | close: ReactInputSelection.restoreSelection | ||
30375 | }; | ||
30376 | |||
30377 | /** | ||
30378 | * Suppresses events (blur/focus) that could be inadvertently dispatched due to | ||
30379 | * high level DOM manipulations (like temporarily removing a text input from the | ||
30380 | * DOM). | ||
30381 | */ | ||
30382 | var EVENT_SUPPRESSION = { | ||
30383 | /** | ||
30384 | * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before | ||
30385 | * the reconciliation. | ||
30386 | */ | ||
30387 | initialize: function () { | ||
30388 | var currentlyEnabled = ReactBrowserEventEmitter.isEnabled(); | ||
30389 | ReactBrowserEventEmitter.setEnabled(false); | ||
30390 | return currentlyEnabled; | ||
30391 | }, | ||
30392 | |||
30393 | /** | ||
30394 | * @param {boolean} previouslyEnabled Enabled status of | ||
30395 | * `ReactBrowserEventEmitter` before the reconciliation occurred. `close` | ||
30396 | * restores the previous value. | ||
30397 | */ | ||
30398 | close: function (previouslyEnabled) { | ||
30399 | ReactBrowserEventEmitter.setEnabled(previouslyEnabled); | ||
30400 | } | ||
30401 | }; | ||
30402 | |||
30403 | /** | ||
30404 | * Provides a queue for collecting `componentDidMount` and | ||
30405 | * `componentDidUpdate` callbacks during the transaction. | ||
30406 | */ | ||
30407 | var ON_DOM_READY_QUEUEING = { | ||
30408 | /** | ||
30409 | * Initializes the internal `onDOMReady` queue. | ||
30410 | */ | ||
30411 | initialize: function () { | ||
30412 | this.reactMountReady.reset(); | ||
30413 | }, | ||
30414 | |||
30415 | /** | ||
30416 | * After DOM is flushed, invoke all registered `onDOMReady` callbacks. | ||
30417 | */ | ||
30418 | close: function () { | ||
30419 | this.reactMountReady.notifyAll(); | ||
30420 | } | ||
30421 | }; | ||
30422 | |||
30423 | /** | ||
30424 | * Executed within the scope of the `Transaction` instance. Consider these as | ||
30425 | * being member methods, but with an implied ordering while being isolated from | ||
30426 | * each other. | ||
30427 | */ | ||
30428 | var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING]; | ||
30429 | |||
30430 | if (process.env.NODE_ENV !== 'production') { | ||
30431 | TRANSACTION_WRAPPERS.push({ | ||
30432 | initialize: ReactInstrumentation.debugTool.onBeginFlush, | ||
30433 | close: ReactInstrumentation.debugTool.onEndFlush | ||
30434 | }); | ||
30435 | } | ||
30436 | |||
30437 | /** | ||
30438 | * Currently: | ||
30439 | * - The order that these are listed in the transaction is critical: | ||
30440 | * - Suppresses events. | ||
30441 | * - Restores selection range. | ||
30442 | * | ||
30443 | * Future: | ||
30444 | * - Restore document/overflow scroll positions that were unintentionally | ||
30445 | * modified via DOM insertions above the top viewport boundary. | ||
30446 | * - Implement/integrate with customized constraint based layout system and keep | ||
30447 | * track of which dimensions must be remeasured. | ||
30448 | * | ||
30449 | * @class ReactReconcileTransaction | ||
30450 | */ | ||
30451 | function ReactReconcileTransaction(useCreateElement) { | ||
30452 | this.reinitializeTransaction(); | ||
30453 | // Only server-side rendering really needs this option (see | ||
30454 | // `ReactServerRendering`), but server-side uses | ||
30455 | // `ReactServerRenderingTransaction` instead. This option is here so that it's | ||
30456 | // accessible and defaults to false when `ReactDOMComponent` and | ||
30457 | // `ReactDOMTextComponent` checks it in `mountComponent`.` | ||
30458 | this.renderToStaticMarkup = false; | ||
30459 | this.reactMountReady = CallbackQueue.getPooled(null); | ||
30460 | this.useCreateElement = useCreateElement; | ||
30461 | } | ||
30462 | |||
30463 | var Mixin = { | ||
30464 | /** | ||
30465 | * @see Transaction | ||
30466 | * @abstract | ||
30467 | * @final | ||
30468 | * @return {array<object>} List of operation wrap procedures. | ||
30469 | * TODO: convert to array<TransactionWrapper> | ||
30470 | */ | ||
30471 | getTransactionWrappers: function () { | ||
30472 | return TRANSACTION_WRAPPERS; | ||
30473 | }, | ||
30474 | |||
30475 | /** | ||
30476 | * @return {object} The queue to collect `onDOMReady` callbacks with. | ||
30477 | */ | ||
30478 | getReactMountReady: function () { | ||
30479 | return this.reactMountReady; | ||
30480 | }, | ||
30481 | |||
30482 | /** | ||
30483 | * @return {object} The queue to collect React async events. | ||
30484 | */ | ||
30485 | getUpdateQueue: function () { | ||
30486 | return ReactUpdateQueue; | ||
30487 | }, | ||
30488 | |||
30489 | /** | ||
30490 | * Save current transaction state -- if the return value from this method is | ||
30491 | * passed to `rollback`, the transaction will be reset to that state. | ||
30492 | */ | ||
30493 | checkpoint: function () { | ||
30494 | // reactMountReady is the our only stateful wrapper | ||
30495 | return this.reactMountReady.checkpoint(); | ||
30496 | }, | ||
30497 | |||
30498 | rollback: function (checkpoint) { | ||
30499 | this.reactMountReady.rollback(checkpoint); | ||
30500 | }, | ||
30501 | |||
30502 | /** | ||
30503 | * `PooledClass` looks for this, and will invoke this before allowing this | ||
30504 | * instance to be reused. | ||
30505 | */ | ||
30506 | destructor: function () { | ||
30507 | CallbackQueue.release(this.reactMountReady); | ||
30508 | this.reactMountReady = null; | ||
30509 | } | ||
30510 | }; | ||
30511 | |||
30512 | _assign(ReactReconcileTransaction.prototype, Transaction, Mixin); | ||
30513 | |||
30514 | PooledClass.addPoolingTo(ReactReconcileTransaction); | ||
30515 | |||
30516 | module.exports = ReactReconcileTransaction; | ||
30517 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
30518 | |||
30519 | /***/ }), | ||
30520 | /* 284 */ | ||
30521 | /***/ (function(module, exports, __webpack_require__) { | ||
30522 | |||
30523 | "use strict"; | ||
30524 | /** | ||
30525 | * Copyright 2013-present, Facebook, Inc. | ||
30526 | * All rights reserved. | ||
30527 | * | ||
30528 | * This source code is licensed under the BSD-style license found in the | ||
30529 | * LICENSE file in the root directory of this source tree. An additional grant | ||
30530 | * of patent rights can be found in the PATENTS file in the same directory. | ||
30531 | * | ||
30532 | * | ||
30533 | */ | ||
30534 | |||
30535 | |||
30536 | |||
30537 | var ReactOwner = __webpack_require__(281); | ||
30538 | |||
30539 | var ReactRef = {}; | ||
30540 | |||
30541 | function attachRef(ref, component, owner) { | ||
30542 | if (typeof ref === 'function') { | ||
30543 | ref(component.getPublicInstance()); | ||
30544 | } else { | ||
30545 | // Legacy ref | ||
30546 | ReactOwner.addComponentAsRefTo(component, ref, owner); | ||
30547 | } | ||
30548 | } | ||
30549 | |||
30550 | function detachRef(ref, component, owner) { | ||
30551 | if (typeof ref === 'function') { | ||
30552 | ref(null); | ||
30553 | } else { | ||
30554 | // Legacy ref | ||
30555 | ReactOwner.removeComponentAsRefFrom(component, ref, owner); | ||
30556 | } | ||
30557 | } | ||
30558 | |||
30559 | ReactRef.attachRefs = function (instance, element) { | ||
30560 | if (element === null || typeof element !== 'object') { | ||
30561 | return; | ||
30562 | } | ||
30563 | var ref = element.ref; | ||
30564 | if (ref != null) { | ||
30565 | attachRef(ref, instance, element._owner); | ||
30566 | } | ||
30567 | }; | ||
30568 | |||
30569 | ReactRef.shouldUpdateRefs = function (prevElement, nextElement) { | ||
30570 | // If either the owner or a `ref` has changed, make sure the newest owner | ||
30571 | // has stored a reference to `this`, and the previous owner (if different) | ||
30572 | // has forgotten the reference to `this`. We use the element instead | ||
30573 | // of the public this.props because the post processing cannot determine | ||
30574 | // a ref. The ref conceptually lives on the element. | ||
30575 | |||
30576 | // TODO: Should this even be possible? The owner cannot change because | ||
30577 | // it's forbidden by shouldUpdateReactComponent. The ref can change | ||
30578 | // if you swap the keys of but not the refs. Reconsider where this check | ||
30579 | // is made. It probably belongs where the key checking and | ||
30580 | // instantiateReactComponent is done. | ||
30581 | |||
30582 | var prevRef = null; | ||
30583 | var prevOwner = null; | ||
30584 | if (prevElement !== null && typeof prevElement === 'object') { | ||
30585 | prevRef = prevElement.ref; | ||
30586 | prevOwner = prevElement._owner; | ||
30587 | } | ||
30588 | |||
30589 | var nextRef = null; | ||
30590 | var nextOwner = null; | ||
30591 | if (nextElement !== null && typeof nextElement === 'object') { | ||
30592 | nextRef = nextElement.ref; | ||
30593 | nextOwner = nextElement._owner; | ||
30594 | } | ||
30595 | |||
30596 | return prevRef !== nextRef || | ||
30597 | // If owner changes but we have an unchanged function ref, don't update refs | ||
30598 | typeof nextRef === 'string' && nextOwner !== prevOwner; | ||
30599 | }; | ||
30600 | |||
30601 | ReactRef.detachRefs = function (instance, element) { | ||
30602 | if (element === null || typeof element !== 'object') { | ||
30603 | return; | ||
30604 | } | ||
30605 | var ref = element.ref; | ||
30606 | if (ref != null) { | ||
30607 | detachRef(ref, instance, element._owner); | ||
30608 | } | ||
30609 | }; | ||
30610 | |||
30611 | module.exports = ReactRef; | ||
30612 | |||
30613 | /***/ }), | ||
30614 | /* 285 */ | ||
30615 | /***/ (function(module, exports, __webpack_require__) { | ||
30616 | |||
30617 | "use strict"; | ||
30618 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
30619 | * Copyright 2014-present, Facebook, Inc. | ||
30620 | * All rights reserved. | ||
30621 | * | ||
30622 | * This source code is licensed under the BSD-style license found in the | ||
30623 | * LICENSE file in the root directory of this source tree. An additional grant | ||
30624 | * of patent rights can be found in the PATENTS file in the same directory. | ||
30625 | * | ||
30626 | */ | ||
30627 | |||
30628 | |||
30629 | |||
30630 | var _assign = __webpack_require__(4); | ||
30631 | |||
30632 | var PooledClass = __webpack_require__(30); | ||
30633 | var Transaction = __webpack_require__(56); | ||
30634 | var ReactInstrumentation = __webpack_require__(12); | ||
30635 | var ReactServerUpdateQueue = __webpack_require__(286); | ||
30636 | |||
30637 | /** | ||
30638 | * Executed within the scope of the `Transaction` instance. Consider these as | ||
30639 | * being member methods, but with an implied ordering while being isolated from | ||
30640 | * each other. | ||
30641 | */ | ||
30642 | var TRANSACTION_WRAPPERS = []; | ||
30643 | |||
30644 | if (process.env.NODE_ENV !== 'production') { | ||
30645 | TRANSACTION_WRAPPERS.push({ | ||
30646 | initialize: ReactInstrumentation.debugTool.onBeginFlush, | ||
30647 | close: ReactInstrumentation.debugTool.onEndFlush | ||
30648 | }); | ||
30649 | } | ||
30650 | |||
30651 | var noopCallbackQueue = { | ||
30652 | enqueue: function () {} | ||
30653 | }; | ||
30654 | |||
30655 | /** | ||
30656 | * @class ReactServerRenderingTransaction | ||
30657 | * @param {boolean} renderToStaticMarkup | ||
30658 | */ | ||
30659 | function ReactServerRenderingTransaction(renderToStaticMarkup) { | ||
30660 | this.reinitializeTransaction(); | ||
30661 | this.renderToStaticMarkup = renderToStaticMarkup; | ||
30662 | this.useCreateElement = false; | ||
30663 | this.updateQueue = new ReactServerUpdateQueue(this); | ||
30664 | } | ||
30665 | |||
30666 | var Mixin = { | ||
30667 | /** | ||
30668 | * @see Transaction | ||
30669 | * @abstract | ||
30670 | * @final | ||
30671 | * @return {array} Empty list of operation wrap procedures. | ||
30672 | */ | ||
30673 | getTransactionWrappers: function () { | ||
30674 | return TRANSACTION_WRAPPERS; | ||
30675 | }, | ||
30676 | |||
30677 | /** | ||
30678 | * @return {object} The queue to collect `onDOMReady` callbacks with. | ||
30679 | */ | ||
30680 | getReactMountReady: function () { | ||
30681 | return noopCallbackQueue; | ||
30682 | }, | ||
30683 | |||
30684 | /** | ||
30685 | * @return {object} The queue to collect React async events. | ||
30686 | */ | ||
30687 | getUpdateQueue: function () { | ||
30688 | return this.updateQueue; | ||
30689 | }, | ||
30690 | |||
30691 | /** | ||
30692 | * `PooledClass` looks for this, and will invoke this before allowing this | ||
30693 | * instance to be reused. | ||
30694 | */ | ||
30695 | destructor: function () {}, | ||
30696 | |||
30697 | checkpoint: function () {}, | ||
30698 | |||
30699 | rollback: function () {} | ||
30700 | }; | ||
30701 | |||
30702 | _assign(ReactServerRenderingTransaction.prototype, Transaction, Mixin); | ||
30703 | |||
30704 | PooledClass.addPoolingTo(ReactServerRenderingTransaction); | ||
30705 | |||
30706 | module.exports = ReactServerRenderingTransaction; | ||
30707 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
30708 | |||
30709 | /***/ }), | ||
30710 | /* 286 */ | ||
30711 | /***/ (function(module, exports, __webpack_require__) { | ||
30712 | |||
30713 | "use strict"; | ||
30714 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
30715 | * Copyright 2015-present, Facebook, Inc. | ||
30716 | * All rights reserved. | ||
30717 | * | ||
30718 | * This source code is licensed under the BSD-style license found in the | ||
30719 | * LICENSE file in the root directory of this source tree. An additional grant | ||
30720 | * of patent rights can be found in the PATENTS file in the same directory. | ||
30721 | * | ||
30722 | * | ||
30723 | */ | ||
30724 | |||
30725 | |||
30726 | |||
30727 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
30728 | |||
30729 | var ReactUpdateQueue = __webpack_require__(82); | ||
30730 | |||
30731 | var warning = __webpack_require__(2); | ||
30732 | |||
30733 | function warnNoop(publicInstance, callerName) { | ||
30734 | if (process.env.NODE_ENV !== 'production') { | ||
30735 | var constructor = publicInstance.constructor; | ||
30736 | 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; | ||
30737 | } | ||
30738 | } | ||
30739 | |||
30740 | /** | ||
30741 | * This is the update queue used for server rendering. | ||
30742 | * It delegates to ReactUpdateQueue while server rendering is in progress and | ||
30743 | * switches to ReactNoopUpdateQueue after the transaction has completed. | ||
30744 | * @class ReactServerUpdateQueue | ||
30745 | * @param {Transaction} transaction | ||
30746 | */ | ||
30747 | |||
30748 | var ReactServerUpdateQueue = function () { | ||
30749 | function ReactServerUpdateQueue(transaction) { | ||
30750 | _classCallCheck(this, ReactServerUpdateQueue); | ||
30751 | |||
30752 | this.transaction = transaction; | ||
30753 | } | ||
30754 | |||
30755 | /** | ||
30756 | * Checks whether or not this composite component is mounted. | ||
30757 | * @param {ReactClass} publicInstance The instance we want to test. | ||
30758 | * @return {boolean} True if mounted, false otherwise. | ||
30759 | * @protected | ||
30760 | * @final | ||
30761 | */ | ||
30762 | |||
30763 | |||
30764 | ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) { | ||
30765 | return false; | ||
30766 | }; | ||
30767 | |||
30768 | /** | ||
30769 | * Enqueue a callback that will be executed after all the pending updates | ||
30770 | * have processed. | ||
30771 | * | ||
30772 | * @param {ReactClass} publicInstance The instance to use as `this` context. | ||
30773 | * @param {?function} callback Called after state is updated. | ||
30774 | * @internal | ||
30775 | */ | ||
30776 | |||
30777 | |||
30778 | ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) { | ||
30779 | if (this.transaction.isInTransaction()) { | ||
30780 | ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName); | ||
30781 | } | ||
30782 | }; | ||
30783 | |||
30784 | /** | ||
30785 | * Forces an update. This should only be invoked when it is known with | ||
30786 | * certainty that we are **not** in a DOM transaction. | ||
30787 | * | ||
30788 | * You may want to call this when you know that some deeper aspect of the | ||
30789 | * component's state has changed but `setState` was not called. | ||
30790 | * | ||
30791 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
30792 | * `componentWillUpdate` and `componentDidUpdate`. | ||
30793 | * | ||
30794 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
30795 | * @internal | ||
30796 | */ | ||
30797 | |||
30798 | |||
30799 | ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) { | ||
30800 | if (this.transaction.isInTransaction()) { | ||
30801 | ReactUpdateQueue.enqueueForceUpdate(publicInstance); | ||
30802 | } else { | ||
30803 | warnNoop(publicInstance, 'forceUpdate'); | ||
30804 | } | ||
30805 | }; | ||
30806 | |||
30807 | /** | ||
30808 | * Replaces all of the state. Always use this or `setState` to mutate state. | ||
30809 | * You should treat `this.state` as immutable. | ||
30810 | * | ||
30811 | * There is no guarantee that `this.state` will be immediately updated, so | ||
30812 | * accessing `this.state` after calling this method may return the old value. | ||
30813 | * | ||
30814 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
30815 | * @param {object|function} completeState Next state. | ||
30816 | * @internal | ||
30817 | */ | ||
30818 | |||
30819 | |||
30820 | ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) { | ||
30821 | if (this.transaction.isInTransaction()) { | ||
30822 | ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState); | ||
30823 | } else { | ||
30824 | warnNoop(publicInstance, 'replaceState'); | ||
30825 | } | ||
30826 | }; | ||
30827 | |||
30828 | /** | ||
30829 | * Sets a subset of the state. This only exists because _pendingState is | ||
30830 | * internal. This provides a merging strategy that is not available to deep | ||
30831 | * properties which is confusing. TODO: Expose pendingState or don't use it | ||
30832 | * during the merge. | ||
30833 | * | ||
30834 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
30835 | * @param {object|function} partialState Next partial state to be merged with state. | ||
30836 | * @internal | ||
30837 | */ | ||
30838 | |||
30839 | |||
30840 | ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) { | ||
30841 | if (this.transaction.isInTransaction()) { | ||
30842 | ReactUpdateQueue.enqueueSetState(publicInstance, partialState); | ||
30843 | } else { | ||
30844 | warnNoop(publicInstance, 'setState'); | ||
30845 | } | ||
30846 | }; | ||
30847 | |||
30848 | return ReactServerUpdateQueue; | ||
30849 | }(); | ||
30850 | |||
30851 | module.exports = ReactServerUpdateQueue; | ||
30852 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
30853 | |||
30854 | /***/ }), | ||
30855 | /* 287 */ | ||
30856 | /***/ (function(module, exports, __webpack_require__) { | ||
30857 | |||
30858 | "use strict"; | ||
30859 | /** | ||
30860 | * Copyright 2013-present, Facebook, Inc. | ||
30861 | * All rights reserved. | ||
30862 | * | ||
30863 | * This source code is licensed under the BSD-style license found in the | ||
30864 | * LICENSE file in the root directory of this source tree. An additional grant | ||
30865 | * of patent rights can be found in the PATENTS file in the same directory. | ||
30866 | * | ||
30867 | */ | ||
30868 | |||
30869 | |||
30870 | |||
30871 | module.exports = '15.5.4'; | ||
30872 | |||
30873 | /***/ }), | ||
30874 | /* 288 */ | ||
30875 | /***/ (function(module, exports, __webpack_require__) { | ||
30876 | |||
30877 | "use strict"; | ||
30878 | /** | ||
30879 | * Copyright 2013-present, Facebook, Inc. | ||
30880 | * All rights reserved. | ||
30881 | * | ||
30882 | * This source code is licensed under the BSD-style license found in the | ||
30883 | * LICENSE file in the root directory of this source tree. An additional grant | ||
30884 | * of patent rights can be found in the PATENTS file in the same directory. | ||
30885 | * | ||
30886 | */ | ||
30887 | |||
30888 | |||
30889 | |||
30890 | var NS = { | ||
30891 | xlink: 'http://www.w3.org/1999/xlink', | ||
30892 | xml: 'http://www.w3.org/XML/1998/namespace' | ||
30893 | }; | ||
30894 | |||
30895 | // We use attributes for everything SVG so let's avoid some duplication and run | ||
30896 | // code instead. | ||
30897 | // The following are all specified in the HTML config already so we exclude here. | ||
30898 | // - class (as className) | ||
30899 | // - color | ||
30900 | // - height | ||
30901 | // - id | ||
30902 | // - lang | ||
30903 | // - max | ||
30904 | // - media | ||
30905 | // - method | ||
30906 | // - min | ||
30907 | // - name | ||
30908 | // - style | ||
30909 | // - target | ||
30910 | // - type | ||
30911 | // - width | ||
30912 | var ATTRS = { | ||
30913 | accentHeight: 'accent-height', | ||
30914 | accumulate: 0, | ||
30915 | additive: 0, | ||
30916 | alignmentBaseline: 'alignment-baseline', | ||
30917 | allowReorder: 'allowReorder', | ||
30918 | alphabetic: 0, | ||
30919 | amplitude: 0, | ||
30920 | arabicForm: 'arabic-form', | ||
30921 | ascent: 0, | ||
30922 | attributeName: 'attributeName', | ||
30923 | attributeType: 'attributeType', | ||
30924 | autoReverse: 'autoReverse', | ||
30925 | azimuth: 0, | ||
30926 | baseFrequency: 'baseFrequency', | ||
30927 | baseProfile: 'baseProfile', | ||
30928 | baselineShift: 'baseline-shift', | ||
30929 | bbox: 0, | ||
30930 | begin: 0, | ||
30931 | bias: 0, | ||
30932 | by: 0, | ||
30933 | calcMode: 'calcMode', | ||
30934 | capHeight: 'cap-height', | ||
30935 | clip: 0, | ||
30936 | clipPath: 'clip-path', | ||
30937 | clipRule: 'clip-rule', | ||
30938 | clipPathUnits: 'clipPathUnits', | ||
30939 | colorInterpolation: 'color-interpolation', | ||
30940 | colorInterpolationFilters: 'color-interpolation-filters', | ||
30941 | colorProfile: 'color-profile', | ||
30942 | colorRendering: 'color-rendering', | ||
30943 | contentScriptType: 'contentScriptType', | ||
30944 | contentStyleType: 'contentStyleType', | ||
30945 | cursor: 0, | ||
30946 | cx: 0, | ||
30947 | cy: 0, | ||
30948 | d: 0, | ||
30949 | decelerate: 0, | ||
30950 | descent: 0, | ||
30951 | diffuseConstant: 'diffuseConstant', | ||
30952 | direction: 0, | ||
30953 | display: 0, | ||
30954 | divisor: 0, | ||
30955 | dominantBaseline: 'dominant-baseline', | ||
30956 | dur: 0, | ||
30957 | dx: 0, | ||
30958 | dy: 0, | ||
30959 | edgeMode: 'edgeMode', | ||
30960 | elevation: 0, | ||
30961 | enableBackground: 'enable-background', | ||
30962 | end: 0, | ||
30963 | exponent: 0, | ||
30964 | externalResourcesRequired: 'externalResourcesRequired', | ||
30965 | fill: 0, | ||
30966 | fillOpacity: 'fill-opacity', | ||
30967 | fillRule: 'fill-rule', | ||
30968 | filter: 0, | ||
30969 | filterRes: 'filterRes', | ||
30970 | filterUnits: 'filterUnits', | ||
30971 | floodColor: 'flood-color', | ||
30972 | floodOpacity: 'flood-opacity', | ||
30973 | focusable: 0, | ||
30974 | fontFamily: 'font-family', | ||
30975 | fontSize: 'font-size', | ||
30976 | fontSizeAdjust: 'font-size-adjust', | ||
30977 | fontStretch: 'font-stretch', | ||
30978 | fontStyle: 'font-style', | ||
30979 | fontVariant: 'font-variant', | ||
30980 | fontWeight: 'font-weight', | ||
30981 | format: 0, | ||
30982 | from: 0, | ||
30983 | fx: 0, | ||
30984 | fy: 0, | ||
30985 | g1: 0, | ||
30986 | g2: 0, | ||
30987 | glyphName: 'glyph-name', | ||
30988 | glyphOrientationHorizontal: 'glyph-orientation-horizontal', | ||
30989 | glyphOrientationVertical: 'glyph-orientation-vertical', | ||
30990 | glyphRef: 'glyphRef', | ||
30991 | gradientTransform: 'gradientTransform', | ||
30992 | gradientUnits: 'gradientUnits', | ||
30993 | hanging: 0, | ||
30994 | horizAdvX: 'horiz-adv-x', | ||
30995 | horizOriginX: 'horiz-origin-x', | ||
30996 | ideographic: 0, | ||
30997 | imageRendering: 'image-rendering', | ||
30998 | 'in': 0, | ||
30999 | in2: 0, | ||
31000 | intercept: 0, | ||
31001 | k: 0, | ||
31002 | k1: 0, | ||
31003 | k2: 0, | ||
31004 | k3: 0, | ||
31005 | k4: 0, | ||
31006 | kernelMatrix: 'kernelMatrix', | ||
31007 | kernelUnitLength: 'kernelUnitLength', | ||
31008 | kerning: 0, | ||
31009 | keyPoints: 'keyPoints', | ||
31010 | keySplines: 'keySplines', | ||
31011 | keyTimes: 'keyTimes', | ||
31012 | lengthAdjust: 'lengthAdjust', | ||
31013 | letterSpacing: 'letter-spacing', | ||
31014 | lightingColor: 'lighting-color', | ||
31015 | limitingConeAngle: 'limitingConeAngle', | ||
31016 | local: 0, | ||
31017 | markerEnd: 'marker-end', | ||
31018 | markerMid: 'marker-mid', | ||
31019 | markerStart: 'marker-start', | ||
31020 | markerHeight: 'markerHeight', | ||
31021 | markerUnits: 'markerUnits', | ||
31022 | markerWidth: 'markerWidth', | ||
31023 | mask: 0, | ||
31024 | maskContentUnits: 'maskContentUnits', | ||
31025 | maskUnits: 'maskUnits', | ||
31026 | mathematical: 0, | ||
31027 | mode: 0, | ||
31028 | numOctaves: 'numOctaves', | ||
31029 | offset: 0, | ||
31030 | opacity: 0, | ||
31031 | operator: 0, | ||
31032 | order: 0, | ||
31033 | orient: 0, | ||
31034 | orientation: 0, | ||
31035 | origin: 0, | ||
31036 | overflow: 0, | ||
31037 | overlinePosition: 'overline-position', | ||
31038 | overlineThickness: 'overline-thickness', | ||
31039 | paintOrder: 'paint-order', | ||
31040 | panose1: 'panose-1', | ||
31041 | pathLength: 'pathLength', | ||
31042 | patternContentUnits: 'patternContentUnits', | ||
31043 | patternTransform: 'patternTransform', | ||
31044 | patternUnits: 'patternUnits', | ||
31045 | pointerEvents: 'pointer-events', | ||
31046 | points: 0, | ||
31047 | pointsAtX: 'pointsAtX', | ||
31048 | pointsAtY: 'pointsAtY', | ||
31049 | pointsAtZ: 'pointsAtZ', | ||
31050 | preserveAlpha: 'preserveAlpha', | ||
31051 | preserveAspectRatio: 'preserveAspectRatio', | ||
31052 | primitiveUnits: 'primitiveUnits', | ||
31053 | r: 0, | ||
31054 | radius: 0, | ||
31055 | refX: 'refX', | ||
31056 | refY: 'refY', | ||
31057 | renderingIntent: 'rendering-intent', | ||
31058 | repeatCount: 'repeatCount', | ||
31059 | repeatDur: 'repeatDur', | ||
31060 | requiredExtensions: 'requiredExtensions', | ||
31061 | requiredFeatures: 'requiredFeatures', | ||
31062 | restart: 0, | ||
31063 | result: 0, | ||
31064 | rotate: 0, | ||
31065 | rx: 0, | ||
31066 | ry: 0, | ||
31067 | scale: 0, | ||
31068 | seed: 0, | ||
31069 | shapeRendering: 'shape-rendering', | ||
31070 | slope: 0, | ||
31071 | spacing: 0, | ||
31072 | specularConstant: 'specularConstant', | ||
31073 | specularExponent: 'specularExponent', | ||
31074 | speed: 0, | ||
31075 | spreadMethod: 'spreadMethod', | ||
31076 | startOffset: 'startOffset', | ||
31077 | stdDeviation: 'stdDeviation', | ||
31078 | stemh: 0, | ||
31079 | stemv: 0, | ||
31080 | stitchTiles: 'stitchTiles', | ||
31081 | stopColor: 'stop-color', | ||
31082 | stopOpacity: 'stop-opacity', | ||
31083 | strikethroughPosition: 'strikethrough-position', | ||
31084 | strikethroughThickness: 'strikethrough-thickness', | ||
31085 | string: 0, | ||
31086 | stroke: 0, | ||
31087 | strokeDasharray: 'stroke-dasharray', | ||
31088 | strokeDashoffset: 'stroke-dashoffset', | ||
31089 | strokeLinecap: 'stroke-linecap', | ||
31090 | strokeLinejoin: 'stroke-linejoin', | ||
31091 | strokeMiterlimit: 'stroke-miterlimit', | ||
31092 | strokeOpacity: 'stroke-opacity', | ||
31093 | strokeWidth: 'stroke-width', | ||
31094 | surfaceScale: 'surfaceScale', | ||
31095 | systemLanguage: 'systemLanguage', | ||
31096 | tableValues: 'tableValues', | ||
31097 | targetX: 'targetX', | ||
31098 | targetY: 'targetY', | ||
31099 | textAnchor: 'text-anchor', | ||
31100 | textDecoration: 'text-decoration', | ||
31101 | textRendering: 'text-rendering', | ||
31102 | textLength: 'textLength', | ||
31103 | to: 0, | ||
31104 | transform: 0, | ||
31105 | u1: 0, | ||
31106 | u2: 0, | ||
31107 | underlinePosition: 'underline-position', | ||
31108 | underlineThickness: 'underline-thickness', | ||
31109 | unicode: 0, | ||
31110 | unicodeBidi: 'unicode-bidi', | ||
31111 | unicodeRange: 'unicode-range', | ||
31112 | unitsPerEm: 'units-per-em', | ||
31113 | vAlphabetic: 'v-alphabetic', | ||
31114 | vHanging: 'v-hanging', | ||
31115 | vIdeographic: 'v-ideographic', | ||
31116 | vMathematical: 'v-mathematical', | ||
31117 | values: 0, | ||
31118 | vectorEffect: 'vector-effect', | ||
31119 | version: 0, | ||
31120 | vertAdvY: 'vert-adv-y', | ||
31121 | vertOriginX: 'vert-origin-x', | ||
31122 | vertOriginY: 'vert-origin-y', | ||
31123 | viewBox: 'viewBox', | ||
31124 | viewTarget: 'viewTarget', | ||
31125 | visibility: 0, | ||
31126 | widths: 0, | ||
31127 | wordSpacing: 'word-spacing', | ||
31128 | writingMode: 'writing-mode', | ||
31129 | x: 0, | ||
31130 | xHeight: 'x-height', | ||
31131 | x1: 0, | ||
31132 | x2: 0, | ||
31133 | xChannelSelector: 'xChannelSelector', | ||
31134 | xlinkActuate: 'xlink:actuate', | ||
31135 | xlinkArcrole: 'xlink:arcrole', | ||
31136 | xlinkHref: 'xlink:href', | ||
31137 | xlinkRole: 'xlink:role', | ||
31138 | xlinkShow: 'xlink:show', | ||
31139 | xlinkTitle: 'xlink:title', | ||
31140 | xlinkType: 'xlink:type', | ||
31141 | xmlBase: 'xml:base', | ||
31142 | xmlns: 0, | ||
31143 | xmlnsXlink: 'xmlns:xlink', | ||
31144 | xmlLang: 'xml:lang', | ||
31145 | xmlSpace: 'xml:space', | ||
31146 | y: 0, | ||
31147 | y1: 0, | ||
31148 | y2: 0, | ||
31149 | yChannelSelector: 'yChannelSelector', | ||
31150 | z: 0, | ||
31151 | zoomAndPan: 'zoomAndPan' | ||
31152 | }; | ||
31153 | |||
31154 | var SVGDOMPropertyConfig = { | ||
31155 | Properties: {}, | ||
31156 | DOMAttributeNamespaces: { | ||
31157 | xlinkActuate: NS.xlink, | ||
31158 | xlinkArcrole: NS.xlink, | ||
31159 | xlinkHref: NS.xlink, | ||
31160 | xlinkRole: NS.xlink, | ||
31161 | xlinkShow: NS.xlink, | ||
31162 | xlinkTitle: NS.xlink, | ||
31163 | xlinkType: NS.xlink, | ||
31164 | xmlBase: NS.xml, | ||
31165 | xmlLang: NS.xml, | ||
31166 | xmlSpace: NS.xml | ||
31167 | }, | ||
31168 | DOMAttributeNames: {} | ||
31169 | }; | ||
31170 | |||
31171 | Object.keys(ATTRS).forEach(function (key) { | ||
31172 | SVGDOMPropertyConfig.Properties[key] = 0; | ||
31173 | if (ATTRS[key]) { | ||
31174 | SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key]; | ||
31175 | } | ||
31176 | }); | ||
31177 | |||
31178 | module.exports = SVGDOMPropertyConfig; | ||
31179 | |||
31180 | /***/ }), | ||
31181 | /* 289 */ | ||
31182 | /***/ (function(module, exports, __webpack_require__) { | ||
31183 | |||
31184 | "use strict"; | ||
31185 | /** | ||
31186 | * Copyright 2013-present, Facebook, Inc. | ||
31187 | * All rights reserved. | ||
31188 | * | ||
31189 | * This source code is licensed under the BSD-style license found in the | ||
31190 | * LICENSE file in the root directory of this source tree. An additional grant | ||
31191 | * of patent rights can be found in the PATENTS file in the same directory. | ||
31192 | * | ||
31193 | */ | ||
31194 | |||
31195 | |||
31196 | |||
31197 | var EventPropagators = __webpack_require__(46); | ||
31198 | var ExecutionEnvironment = __webpack_require__(7); | ||
31199 | var ReactDOMComponentTree = __webpack_require__(6); | ||
31200 | var ReactInputSelection = __webpack_require__(126); | ||
31201 | var SyntheticEvent = __webpack_require__(19); | ||
31202 | |||
31203 | var getActiveElement = __webpack_require__(112); | ||
31204 | var isTextInputElement = __webpack_require__(136); | ||
31205 | var shallowEqual = __webpack_require__(73); | ||
31206 | |||
31207 | var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11; | ||
31208 | |||
31209 | var eventTypes = { | ||
31210 | select: { | ||
31211 | phasedRegistrationNames: { | ||
31212 | bubbled: 'onSelect', | ||
31213 | captured: 'onSelectCapture' | ||
31214 | }, | ||
31215 | dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange'] | ||
31216 | } | ||
31217 | }; | ||
31218 | |||
31219 | var activeElement = null; | ||
31220 | var activeElementInst = null; | ||
31221 | var lastSelection = null; | ||
31222 | var mouseDown = false; | ||
31223 | |||
31224 | // Track whether a listener exists for this plugin. If none exist, we do | ||
31225 | // not extract events. See #3639. | ||
31226 | var hasListener = false; | ||
31227 | |||
31228 | /** | ||
31229 | * Get an object which is a unique representation of the current selection. | ||
31230 | * | ||
31231 | * The return value will not be consistent across nodes or browsers, but | ||
31232 | * two identical selections on the same node will return identical objects. | ||
31233 | * | ||
31234 | * @param {DOMElement} node | ||
31235 | * @return {object} | ||
31236 | */ | ||
31237 | function getSelection(node) { | ||
31238 | if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) { | ||
31239 | return { | ||
31240 | start: node.selectionStart, | ||
31241 | end: node.selectionEnd | ||
31242 | }; | ||
31243 | } else if (window.getSelection) { | ||
31244 | var selection = window.getSelection(); | ||
31245 | return { | ||
31246 | anchorNode: selection.anchorNode, | ||
31247 | anchorOffset: selection.anchorOffset, | ||
31248 | focusNode: selection.focusNode, | ||
31249 | focusOffset: selection.focusOffset | ||
31250 | }; | ||
31251 | } else if (document.selection) { | ||
31252 | var range = document.selection.createRange(); | ||
31253 | return { | ||
31254 | parentElement: range.parentElement(), | ||
31255 | text: range.text, | ||
31256 | top: range.boundingTop, | ||
31257 | left: range.boundingLeft | ||
31258 | }; | ||
31259 | } | ||
31260 | } | ||
31261 | |||
31262 | /** | ||
31263 | * Poll selection to see whether it's changed. | ||
31264 | * | ||
31265 | * @param {object} nativeEvent | ||
31266 | * @return {?SyntheticEvent} | ||
31267 | */ | ||
31268 | function constructSelectEvent(nativeEvent, nativeEventTarget) { | ||
31269 | // Ensure we have the right element, and that the user is not dragging a | ||
31270 | // selection (this matches native `select` event behavior). In HTML5, select | ||
31271 | // fires only on input and textarea thus if there's no focused element we | ||
31272 | // won't dispatch. | ||
31273 | if (mouseDown || activeElement == null || activeElement !== getActiveElement()) { | ||
31274 | return null; | ||
31275 | } | ||
31276 | |||
31277 | // Only fire when selection has actually changed. | ||
31278 | var currentSelection = getSelection(activeElement); | ||
31279 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { | ||
31280 | lastSelection = currentSelection; | ||
31281 | |||
31282 | var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget); | ||
31283 | |||
31284 | syntheticEvent.type = 'select'; | ||
31285 | syntheticEvent.target = activeElement; | ||
31286 | |||
31287 | EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent); | ||
31288 | |||
31289 | return syntheticEvent; | ||
31290 | } | ||
31291 | |||
31292 | return null; | ||
31293 | } | ||
31294 | |||
31295 | /** | ||
31296 | * This plugin creates an `onSelect` event that normalizes select events | ||
31297 | * across form elements. | ||
31298 | * | ||
31299 | * Supported elements are: | ||
31300 | * - input (see `isTextInputElement`) | ||
31301 | * - textarea | ||
31302 | * - contentEditable | ||
31303 | * | ||
31304 | * This differs from native browser implementations in the following ways: | ||
31305 | * - Fires on contentEditable fields as well as inputs. | ||
31306 | * - Fires for collapsed selection. | ||
31307 | * - Fires after user input. | ||
31308 | */ | ||
31309 | var SelectEventPlugin = { | ||
31310 | |||
31311 | eventTypes: eventTypes, | ||
31312 | |||
31313 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
31314 | if (!hasListener) { | ||
31315 | return null; | ||
31316 | } | ||
31317 | |||
31318 | var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window; | ||
31319 | |||
31320 | switch (topLevelType) { | ||
31321 | // Track the input node that has focus. | ||
31322 | case 'topFocus': | ||
31323 | if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { | ||
31324 | activeElement = targetNode; | ||
31325 | activeElementInst = targetInst; | ||
31326 | lastSelection = null; | ||
31327 | } | ||
31328 | break; | ||
31329 | case 'topBlur': | ||
31330 | activeElement = null; | ||
31331 | activeElementInst = null; | ||
31332 | lastSelection = null; | ||
31333 | break; | ||
31334 | |||
31335 | // Don't fire the event while the user is dragging. This matches the | ||
31336 | // semantics of the native select event. | ||
31337 | case 'topMouseDown': | ||
31338 | mouseDown = true; | ||
31339 | break; | ||
31340 | case 'topContextMenu': | ||
31341 | case 'topMouseUp': | ||
31342 | mouseDown = false; | ||
31343 | return constructSelectEvent(nativeEvent, nativeEventTarget); | ||
31344 | |||
31345 | // Chrome and IE fire non-standard event when selection is changed (and | ||
31346 | // sometimes when it hasn't). IE's event fires out of order with respect | ||
31347 | // to key and input events on deletion, so we discard it. | ||
31348 | // | ||
31349 | // Firefox doesn't support selectionchange, so check selection status | ||
31350 | // after each key entry. The selection changes after keydown and before | ||
31351 | // keyup, but we check on keydown as well in the case of holding down a | ||
31352 | // key, when multiple keydown events are fired but only one keyup is. | ||
31353 | // This is also our approach for IE handling, for the reason above. | ||
31354 | case 'topSelectionChange': | ||
31355 | if (skipSelectionChangeEvent) { | ||
31356 | break; | ||
31357 | } | ||
31358 | // falls through | ||
31359 | case 'topKeyDown': | ||
31360 | case 'topKeyUp': | ||
31361 | return constructSelectEvent(nativeEvent, nativeEventTarget); | ||
31362 | } | ||
31363 | |||
31364 | return null; | ||
31365 | }, | ||
31366 | |||
31367 | didPutListener: function (inst, registrationName, listener) { | ||
31368 | if (registrationName === 'onSelect') { | ||
31369 | hasListener = true; | ||
31370 | } | ||
31371 | } | ||
31372 | }; | ||
31373 | |||
31374 | module.exports = SelectEventPlugin; | ||
31375 | |||
31376 | /***/ }), | ||
31377 | /* 290 */ | ||
31378 | /***/ (function(module, exports, __webpack_require__) { | ||
31379 | |||
31380 | "use strict"; | ||
31381 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
31382 | * Copyright 2013-present, Facebook, Inc. | ||
31383 | * All rights reserved. | ||
31384 | * | ||
31385 | * This source code is licensed under the BSD-style license found in the | ||
31386 | * LICENSE file in the root directory of this source tree. An additional grant | ||
31387 | * of patent rights can be found in the PATENTS file in the same directory. | ||
31388 | * | ||
31389 | * | ||
31390 | */ | ||
31391 | |||
31392 | |||
31393 | |||
31394 | var _prodInvariant = __webpack_require__(3); | ||
31395 | |||
31396 | var EventListener = __webpack_require__(110); | ||
31397 | var EventPropagators = __webpack_require__(46); | ||
31398 | var ReactDOMComponentTree = __webpack_require__(6); | ||
31399 | var SyntheticAnimationEvent = __webpack_require__(291); | ||
31400 | var SyntheticClipboardEvent = __webpack_require__(292); | ||
31401 | var SyntheticEvent = __webpack_require__(19); | ||
31402 | var SyntheticFocusEvent = __webpack_require__(295); | ||
31403 | var SyntheticKeyboardEvent = __webpack_require__(297); | ||
31404 | var SyntheticMouseEvent = __webpack_require__(55); | ||
31405 | var SyntheticDragEvent = __webpack_require__(294); | ||
31406 | var SyntheticTouchEvent = __webpack_require__(298); | ||
31407 | var SyntheticTransitionEvent = __webpack_require__(299); | ||
31408 | var SyntheticUIEvent = __webpack_require__(48); | ||
31409 | var SyntheticWheelEvent = __webpack_require__(300); | ||
31410 | |||
31411 | var emptyFunction = __webpack_require__(10); | ||
31412 | var getEventCharCode = __webpack_require__(84); | ||
31413 | var invariant = __webpack_require__(1); | ||
31414 | |||
31415 | /** | ||
31416 | * Turns | ||
31417 | * ['abort', ...] | ||
31418 | * into | ||
31419 | * eventTypes = { | ||
31420 | * 'abort': { | ||
31421 | * phasedRegistrationNames: { | ||
31422 | * bubbled: 'onAbort', | ||
31423 | * captured: 'onAbortCapture', | ||
31424 | * }, | ||
31425 | * dependencies: ['topAbort'], | ||
31426 | * }, | ||
31427 | * ... | ||
31428 | * }; | ||
31429 | * topLevelEventsToDispatchConfig = { | ||
31430 | * 'topAbort': { sameConfig } | ||
31431 | * }; | ||
31432 | */ | ||
31433 | var eventTypes = {}; | ||
31434 | var topLevelEventsToDispatchConfig = {}; | ||
31435 | ['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) { | ||
31436 | var capitalizedEvent = event[0].toUpperCase() + event.slice(1); | ||
31437 | var onEvent = 'on' + capitalizedEvent; | ||
31438 | var topEvent = 'top' + capitalizedEvent; | ||
31439 | |||
31440 | var type = { | ||
31441 | phasedRegistrationNames: { | ||
31442 | bubbled: onEvent, | ||
31443 | captured: onEvent + 'Capture' | ||
31444 | }, | ||
31445 | dependencies: [topEvent] | ||
31446 | }; | ||
31447 | eventTypes[event] = type; | ||
31448 | topLevelEventsToDispatchConfig[topEvent] = type; | ||
31449 | }); | ||
31450 | |||
31451 | var onClickListeners = {}; | ||
31452 | |||
31453 | function getDictionaryKey(inst) { | ||
31454 | // Prevents V8 performance issue: | ||
31455 | // https://github.com/facebook/react/pull/7232 | ||
31456 | return '.' + inst._rootNodeID; | ||
31457 | } | ||
31458 | |||
31459 | function isInteractive(tag) { | ||
31460 | return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; | ||
31461 | } | ||
31462 | |||
31463 | var SimpleEventPlugin = { | ||
31464 | |||
31465 | eventTypes: eventTypes, | ||
31466 | |||
31467 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
31468 | var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; | ||
31469 | if (!dispatchConfig) { | ||
31470 | return null; | ||
31471 | } | ||
31472 | var EventConstructor; | ||
31473 | switch (topLevelType) { | ||
31474 | case 'topAbort': | ||
31475 | case 'topCanPlay': | ||
31476 | case 'topCanPlayThrough': | ||
31477 | case 'topDurationChange': | ||
31478 | case 'topEmptied': | ||
31479 | case 'topEncrypted': | ||
31480 | case 'topEnded': | ||
31481 | case 'topError': | ||
31482 | case 'topInput': | ||
31483 | case 'topInvalid': | ||
31484 | case 'topLoad': | ||
31485 | case 'topLoadedData': | ||
31486 | case 'topLoadedMetadata': | ||
31487 | case 'topLoadStart': | ||
31488 | case 'topPause': | ||
31489 | case 'topPlay': | ||
31490 | case 'topPlaying': | ||
31491 | case 'topProgress': | ||
31492 | case 'topRateChange': | ||
31493 | case 'topReset': | ||
31494 | case 'topSeeked': | ||
31495 | case 'topSeeking': | ||
31496 | case 'topStalled': | ||
31497 | case 'topSubmit': | ||
31498 | case 'topSuspend': | ||
31499 | case 'topTimeUpdate': | ||
31500 | case 'topVolumeChange': | ||
31501 | case 'topWaiting': | ||
31502 | // HTML Events | ||
31503 | // @see http://www.w3.org/TR/html5/index.html#events-0 | ||
31504 | EventConstructor = SyntheticEvent; | ||
31505 | break; | ||
31506 | case 'topKeyPress': | ||
31507 | // Firefox creates a keypress event for function keys too. This removes | ||
31508 | // the unwanted keypress events. Enter is however both printable and | ||
31509 | // non-printable. One would expect Tab to be as well (but it isn't). | ||
31510 | if (getEventCharCode(nativeEvent) === 0) { | ||
31511 | return null; | ||
31512 | } | ||
31513 | /* falls through */ | ||
31514 | case 'topKeyDown': | ||
31515 | case 'topKeyUp': | ||
31516 | EventConstructor = SyntheticKeyboardEvent; | ||
31517 | break; | ||
31518 | case 'topBlur': | ||
31519 | case 'topFocus': | ||
31520 | EventConstructor = SyntheticFocusEvent; | ||
31521 | break; | ||
31522 | case 'topClick': | ||
31523 | // Firefox creates a click event on right mouse clicks. This removes the | ||
31524 | // unwanted click events. | ||
31525 | if (nativeEvent.button === 2) { | ||
31526 | return null; | ||
31527 | } | ||
31528 | /* falls through */ | ||
31529 | case 'topDoubleClick': | ||
31530 | case 'topMouseDown': | ||
31531 | case 'topMouseMove': | ||
31532 | case 'topMouseUp': | ||
31533 | // TODO: Disabled elements should not respond to mouse events | ||
31534 | /* falls through */ | ||
31535 | case 'topMouseOut': | ||
31536 | case 'topMouseOver': | ||
31537 | case 'topContextMenu': | ||
31538 | EventConstructor = SyntheticMouseEvent; | ||
31539 | break; | ||
31540 | case 'topDrag': | ||
31541 | case 'topDragEnd': | ||
31542 | case 'topDragEnter': | ||
31543 | case 'topDragExit': | ||
31544 | case 'topDragLeave': | ||
31545 | case 'topDragOver': | ||
31546 | case 'topDragStart': | ||
31547 | case 'topDrop': | ||
31548 | EventConstructor = SyntheticDragEvent; | ||
31549 | break; | ||
31550 | case 'topTouchCancel': | ||
31551 | case 'topTouchEnd': | ||
31552 | case 'topTouchMove': | ||
31553 | case 'topTouchStart': | ||
31554 | EventConstructor = SyntheticTouchEvent; | ||
31555 | break; | ||
31556 | case 'topAnimationEnd': | ||
31557 | case 'topAnimationIteration': | ||
31558 | case 'topAnimationStart': | ||
31559 | EventConstructor = SyntheticAnimationEvent; | ||
31560 | break; | ||
31561 | case 'topTransitionEnd': | ||
31562 | EventConstructor = SyntheticTransitionEvent; | ||
31563 | break; | ||
31564 | case 'topScroll': | ||
31565 | EventConstructor = SyntheticUIEvent; | ||
31566 | break; | ||
31567 | case 'topWheel': | ||
31568 | EventConstructor = SyntheticWheelEvent; | ||
31569 | break; | ||
31570 | case 'topCopy': | ||
31571 | case 'topCut': | ||
31572 | case 'topPaste': | ||
31573 | EventConstructor = SyntheticClipboardEvent; | ||
31574 | break; | ||
31575 | } | ||
31576 | !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0; | ||
31577 | var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget); | ||
31578 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
31579 | return event; | ||
31580 | }, | ||
31581 | |||
31582 | didPutListener: function (inst, registrationName, listener) { | ||
31583 | // Mobile Safari does not fire properly bubble click events on | ||
31584 | // non-interactive elements, which means delegated click listeners do not | ||
31585 | // fire. The workaround for this bug involves attaching an empty click | ||
31586 | // listener on the target node. | ||
31587 | // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html | ||
31588 | if (registrationName === 'onClick' && !isInteractive(inst._tag)) { | ||
31589 | var key = getDictionaryKey(inst); | ||
31590 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
31591 | if (!onClickListeners[key]) { | ||
31592 | onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction); | ||
31593 | } | ||
31594 | } | ||
31595 | }, | ||
31596 | |||
31597 | willDeleteListener: function (inst, registrationName) { | ||
31598 | if (registrationName === 'onClick' && !isInteractive(inst._tag)) { | ||
31599 | var key = getDictionaryKey(inst); | ||
31600 | onClickListeners[key].remove(); | ||
31601 | delete onClickListeners[key]; | ||
31602 | } | ||
31603 | } | ||
31604 | |||
31605 | }; | ||
31606 | |||
31607 | module.exports = SimpleEventPlugin; | ||
31608 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
31609 | |||
31610 | /***/ }), | ||
31611 | /* 291 */ | ||
31612 | /***/ (function(module, exports, __webpack_require__) { | ||
31613 | |||
31614 | "use strict"; | ||
31615 | /** | ||
31616 | * Copyright 2013-present, Facebook, Inc. | ||
31617 | * All rights reserved. | ||
31618 | * | ||
31619 | * This source code is licensed under the BSD-style license found in the | ||
31620 | * LICENSE file in the root directory of this source tree. An additional grant | ||
31621 | * of patent rights can be found in the PATENTS file in the same directory. | ||
31622 | * | ||
31623 | */ | ||
31624 | |||
31625 | |||
31626 | |||
31627 | var SyntheticEvent = __webpack_require__(19); | ||
31628 | |||
31629 | /** | ||
31630 | * @interface Event | ||
31631 | * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface | ||
31632 | * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent | ||
31633 | */ | ||
31634 | var AnimationEventInterface = { | ||
31635 | animationName: null, | ||
31636 | elapsedTime: null, | ||
31637 | pseudoElement: null | ||
31638 | }; | ||
31639 | |||
31640 | /** | ||
31641 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
31642 | * @param {string} dispatchMarker Marker identifying the event target. | ||
31643 | * @param {object} nativeEvent Native browser event. | ||
31644 | * @extends {SyntheticEvent} | ||
31645 | */ | ||
31646 | function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
31647 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
31648 | } | ||
31649 | |||
31650 | SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface); | ||
31651 | |||
31652 | module.exports = SyntheticAnimationEvent; | ||
31653 | |||
31654 | /***/ }), | ||
31655 | /* 292 */ | ||
31656 | /***/ (function(module, exports, __webpack_require__) { | ||
31657 | |||
31658 | "use strict"; | ||
31659 | /** | ||
31660 | * Copyright 2013-present, Facebook, Inc. | ||
31661 | * All rights reserved. | ||
31662 | * | ||
31663 | * This source code is licensed under the BSD-style license found in the | ||
31664 | * LICENSE file in the root directory of this source tree. An additional grant | ||
31665 | * of patent rights can be found in the PATENTS file in the same directory. | ||
31666 | * | ||
31667 | */ | ||
31668 | |||
31669 | |||
31670 | |||
31671 | var SyntheticEvent = __webpack_require__(19); | ||
31672 | |||
31673 | /** | ||
31674 | * @interface Event | ||
31675 | * @see http://www.w3.org/TR/clipboard-apis/ | ||
31676 | */ | ||
31677 | var ClipboardEventInterface = { | ||
31678 | clipboardData: function (event) { | ||
31679 | return 'clipboardData' in event ? event.clipboardData : window.clipboardData; | ||
31680 | } | ||
31681 | }; | ||
31682 | |||
31683 | /** | ||
31684 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
31685 | * @param {string} dispatchMarker Marker identifying the event target. | ||
31686 | * @param {object} nativeEvent Native browser event. | ||
31687 | * @extends {SyntheticUIEvent} | ||
31688 | */ | ||
31689 | function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
31690 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
31691 | } | ||
31692 | |||
31693 | SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); | ||
31694 | |||
31695 | module.exports = SyntheticClipboardEvent; | ||
31696 | |||
31697 | /***/ }), | ||
31698 | /* 293 */ | ||
31699 | /***/ (function(module, exports, __webpack_require__) { | ||
31700 | |||
31701 | "use strict"; | ||
31702 | /** | ||
31703 | * Copyright 2013-present, Facebook, Inc. | ||
31704 | * All rights reserved. | ||
31705 | * | ||
31706 | * This source code is licensed under the BSD-style license found in the | ||
31707 | * LICENSE file in the root directory of this source tree. An additional grant | ||
31708 | * of patent rights can be found in the PATENTS file in the same directory. | ||
31709 | * | ||
31710 | */ | ||
31711 | |||
31712 | |||
31713 | |||
31714 | var SyntheticEvent = __webpack_require__(19); | ||
31715 | |||
31716 | /** | ||
31717 | * @interface Event | ||
31718 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents | ||
31719 | */ | ||
31720 | var CompositionEventInterface = { | ||
31721 | data: null | ||
31722 | }; | ||
31723 | |||
31724 | /** | ||
31725 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
31726 | * @param {string} dispatchMarker Marker identifying the event target. | ||
31727 | * @param {object} nativeEvent Native browser event. | ||
31728 | * @extends {SyntheticUIEvent} | ||
31729 | */ | ||
31730 | function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
31731 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
31732 | } | ||
31733 | |||
31734 | SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface); | ||
31735 | |||
31736 | module.exports = SyntheticCompositionEvent; | ||
31737 | |||
31738 | /***/ }), | ||
31739 | /* 294 */ | ||
31740 | /***/ (function(module, exports, __webpack_require__) { | ||
31741 | |||
31742 | "use strict"; | ||
31743 | /** | ||
31744 | * Copyright 2013-present, Facebook, Inc. | ||
31745 | * All rights reserved. | ||
31746 | * | ||
31747 | * This source code is licensed under the BSD-style license found in the | ||
31748 | * LICENSE file in the root directory of this source tree. An additional grant | ||
31749 | * of patent rights can be found in the PATENTS file in the same directory. | ||
31750 | * | ||
31751 | */ | ||
31752 | |||
31753 | |||
31754 | |||
31755 | var SyntheticMouseEvent = __webpack_require__(55); | ||
31756 | |||
31757 | /** | ||
31758 | * @interface DragEvent | ||
31759 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
31760 | */ | ||
31761 | var DragEventInterface = { | ||
31762 | dataTransfer: null | ||
31763 | }; | ||
31764 | |||
31765 | /** | ||
31766 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
31767 | * @param {string} dispatchMarker Marker identifying the event target. | ||
31768 | * @param {object} nativeEvent Native browser event. | ||
31769 | * @extends {SyntheticUIEvent} | ||
31770 | */ | ||
31771 | function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
31772 | return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
31773 | } | ||
31774 | |||
31775 | SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); | ||
31776 | |||
31777 | module.exports = SyntheticDragEvent; | ||
31778 | |||
31779 | /***/ }), | ||
31780 | /* 295 */ | ||
31781 | /***/ (function(module, exports, __webpack_require__) { | ||
31782 | |||
31783 | "use strict"; | ||
31784 | /** | ||
31785 | * Copyright 2013-present, Facebook, Inc. | ||
31786 | * All rights reserved. | ||
31787 | * | ||
31788 | * This source code is licensed under the BSD-style license found in the | ||
31789 | * LICENSE file in the root directory of this source tree. An additional grant | ||
31790 | * of patent rights can be found in the PATENTS file in the same directory. | ||
31791 | * | ||
31792 | */ | ||
31793 | |||
31794 | |||
31795 | |||
31796 | var SyntheticUIEvent = __webpack_require__(48); | ||
31797 | |||
31798 | /** | ||
31799 | * @interface FocusEvent | ||
31800 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
31801 | */ | ||
31802 | var FocusEventInterface = { | ||
31803 | relatedTarget: null | ||
31804 | }; | ||
31805 | |||
31806 | /** | ||
31807 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
31808 | * @param {string} dispatchMarker Marker identifying the event target. | ||
31809 | * @param {object} nativeEvent Native browser event. | ||
31810 | * @extends {SyntheticUIEvent} | ||
31811 | */ | ||
31812 | function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
31813 | return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
31814 | } | ||
31815 | |||
31816 | SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); | ||
31817 | |||
31818 | module.exports = SyntheticFocusEvent; | ||
31819 | |||
31820 | /***/ }), | ||
31821 | /* 296 */ | ||
31822 | /***/ (function(module, exports, __webpack_require__) { | ||
31823 | |||
31824 | "use strict"; | ||
31825 | /** | ||
31826 | * Copyright 2013-present, Facebook, Inc. | ||
31827 | * All rights reserved. | ||
31828 | * | ||
31829 | * This source code is licensed under the BSD-style license found in the | ||
31830 | * LICENSE file in the root directory of this source tree. An additional grant | ||
31831 | * of patent rights can be found in the PATENTS file in the same directory. | ||
31832 | * | ||
31833 | */ | ||
31834 | |||
31835 | |||
31836 | |||
31837 | var SyntheticEvent = __webpack_require__(19); | ||
31838 | |||
31839 | /** | ||
31840 | * @interface Event | ||
31841 | * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 | ||
31842 | * /#events-inputevents | ||
31843 | */ | ||
31844 | var InputEventInterface = { | ||
31845 | data: null | ||
31846 | }; | ||
31847 | |||
31848 | /** | ||
31849 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
31850 | * @param {string} dispatchMarker Marker identifying the event target. | ||
31851 | * @param {object} nativeEvent Native browser event. | ||
31852 | * @extends {SyntheticUIEvent} | ||
31853 | */ | ||
31854 | function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
31855 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
31856 | } | ||
31857 | |||
31858 | SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface); | ||
31859 | |||
31860 | module.exports = SyntheticInputEvent; | ||
31861 | |||
31862 | /***/ }), | ||
31863 | /* 297 */ | ||
31864 | /***/ (function(module, exports, __webpack_require__) { | ||
31865 | |||
31866 | "use strict"; | ||
31867 | /** | ||
31868 | * Copyright 2013-present, Facebook, Inc. | ||
31869 | * All rights reserved. | ||
31870 | * | ||
31871 | * This source code is licensed under the BSD-style license found in the | ||
31872 | * LICENSE file in the root directory of this source tree. An additional grant | ||
31873 | * of patent rights can be found in the PATENTS file in the same directory. | ||
31874 | * | ||
31875 | */ | ||
31876 | |||
31877 | |||
31878 | |||
31879 | var SyntheticUIEvent = __webpack_require__(48); | ||
31880 | |||
31881 | var getEventCharCode = __webpack_require__(84); | ||
31882 | var getEventKey = __webpack_require__(306); | ||
31883 | var getEventModifierState = __webpack_require__(85); | ||
31884 | |||
31885 | /** | ||
31886 | * @interface KeyboardEvent | ||
31887 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
31888 | */ | ||
31889 | var KeyboardEventInterface = { | ||
31890 | key: getEventKey, | ||
31891 | location: null, | ||
31892 | ctrlKey: null, | ||
31893 | shiftKey: null, | ||
31894 | altKey: null, | ||
31895 | metaKey: null, | ||
31896 | repeat: null, | ||
31897 | locale: null, | ||
31898 | getModifierState: getEventModifierState, | ||
31899 | // Legacy Interface | ||
31900 | charCode: function (event) { | ||
31901 | // `charCode` is the result of a KeyPress event and represents the value of | ||
31902 | // the actual printable character. | ||
31903 | |||
31904 | // KeyPress is deprecated, but its replacement is not yet final and not | ||
31905 | // implemented in any major browser. Only KeyPress has charCode. | ||
31906 | if (event.type === 'keypress') { | ||
31907 | return getEventCharCode(event); | ||
31908 | } | ||
31909 | return 0; | ||
31910 | }, | ||
31911 | keyCode: function (event) { | ||
31912 | // `keyCode` is the result of a KeyDown/Up event and represents the value of | ||
31913 | // physical keyboard key. | ||
31914 | |||
31915 | // The actual meaning of the value depends on the users' keyboard layout | ||
31916 | // which cannot be detected. Assuming that it is a US keyboard layout | ||
31917 | // provides a surprisingly accurate mapping for US and European users. | ||
31918 | // Due to this, it is left to the user to implement at this time. | ||
31919 | if (event.type === 'keydown' || event.type === 'keyup') { | ||
31920 | return event.keyCode; | ||
31921 | } | ||
31922 | return 0; | ||
31923 | }, | ||
31924 | which: function (event) { | ||
31925 | // `which` is an alias for either `keyCode` or `charCode` depending on the | ||
31926 | // type of the event. | ||
31927 | if (event.type === 'keypress') { | ||
31928 | return getEventCharCode(event); | ||
31929 | } | ||
31930 | if (event.type === 'keydown' || event.type === 'keyup') { | ||
31931 | return event.keyCode; | ||
31932 | } | ||
31933 | return 0; | ||
31934 | } | ||
31935 | }; | ||
31936 | |||
31937 | /** | ||
31938 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
31939 | * @param {string} dispatchMarker Marker identifying the event target. | ||
31940 | * @param {object} nativeEvent Native browser event. | ||
31941 | * @extends {SyntheticUIEvent} | ||
31942 | */ | ||
31943 | function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
31944 | return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
31945 | } | ||
31946 | |||
31947 | SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); | ||
31948 | |||
31949 | module.exports = SyntheticKeyboardEvent; | ||
31950 | |||
31951 | /***/ }), | ||
31952 | /* 298 */ | ||
31953 | /***/ (function(module, exports, __webpack_require__) { | ||
31954 | |||
31955 | "use strict"; | ||
31956 | /** | ||
31957 | * Copyright 2013-present, Facebook, Inc. | ||
31958 | * All rights reserved. | ||
31959 | * | ||
31960 | * This source code is licensed under the BSD-style license found in the | ||
31961 | * LICENSE file in the root directory of this source tree. An additional grant | ||
31962 | * of patent rights can be found in the PATENTS file in the same directory. | ||
31963 | * | ||
31964 | */ | ||
31965 | |||
31966 | |||
31967 | |||
31968 | var SyntheticUIEvent = __webpack_require__(48); | ||
31969 | |||
31970 | var getEventModifierState = __webpack_require__(85); | ||
31971 | |||
31972 | /** | ||
31973 | * @interface TouchEvent | ||
31974 | * @see http://www.w3.org/TR/touch-events/ | ||
31975 | */ | ||
31976 | var TouchEventInterface = { | ||
31977 | touches: null, | ||
31978 | targetTouches: null, | ||
31979 | changedTouches: null, | ||
31980 | altKey: null, | ||
31981 | metaKey: null, | ||
31982 | ctrlKey: null, | ||
31983 | shiftKey: null, | ||
31984 | getModifierState: getEventModifierState | ||
31985 | }; | ||
31986 | |||
31987 | /** | ||
31988 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
31989 | * @param {string} dispatchMarker Marker identifying the event target. | ||
31990 | * @param {object} nativeEvent Native browser event. | ||
31991 | * @extends {SyntheticUIEvent} | ||
31992 | */ | ||
31993 | function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
31994 | return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
31995 | } | ||
31996 | |||
31997 | SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); | ||
31998 | |||
31999 | module.exports = SyntheticTouchEvent; | ||
32000 | |||
32001 | /***/ }), | ||
32002 | /* 299 */ | ||
32003 | /***/ (function(module, exports, __webpack_require__) { | ||
32004 | |||
32005 | "use strict"; | ||
32006 | /** | ||
32007 | * Copyright 2013-present, Facebook, Inc. | ||
32008 | * All rights reserved. | ||
32009 | * | ||
32010 | * This source code is licensed under the BSD-style license found in the | ||
32011 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32012 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32013 | * | ||
32014 | */ | ||
32015 | |||
32016 | |||
32017 | |||
32018 | var SyntheticEvent = __webpack_require__(19); | ||
32019 | |||
32020 | /** | ||
32021 | * @interface Event | ||
32022 | * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- | ||
32023 | * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent | ||
32024 | */ | ||
32025 | var TransitionEventInterface = { | ||
32026 | propertyName: null, | ||
32027 | elapsedTime: null, | ||
32028 | pseudoElement: null | ||
32029 | }; | ||
32030 | |||
32031 | /** | ||
32032 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
32033 | * @param {string} dispatchMarker Marker identifying the event target. | ||
32034 | * @param {object} nativeEvent Native browser event. | ||
32035 | * @extends {SyntheticEvent} | ||
32036 | */ | ||
32037 | function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
32038 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
32039 | } | ||
32040 | |||
32041 | SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface); | ||
32042 | |||
32043 | module.exports = SyntheticTransitionEvent; | ||
32044 | |||
32045 | /***/ }), | ||
32046 | /* 300 */ | ||
32047 | /***/ (function(module, exports, __webpack_require__) { | ||
32048 | |||
32049 | "use strict"; | ||
32050 | /** | ||
32051 | * Copyright 2013-present, Facebook, Inc. | ||
32052 | * All rights reserved. | ||
32053 | * | ||
32054 | * This source code is licensed under the BSD-style license found in the | ||
32055 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32056 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32057 | * | ||
32058 | */ | ||
32059 | |||
32060 | |||
32061 | |||
32062 | var SyntheticMouseEvent = __webpack_require__(55); | ||
32063 | |||
32064 | /** | ||
32065 | * @interface WheelEvent | ||
32066 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
32067 | */ | ||
32068 | var WheelEventInterface = { | ||
32069 | deltaX: function (event) { | ||
32070 | return 'deltaX' in event ? event.deltaX : | ||
32071 | // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). | ||
32072 | 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; | ||
32073 | }, | ||
32074 | deltaY: function (event) { | ||
32075 | return 'deltaY' in event ? event.deltaY : | ||
32076 | // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). | ||
32077 | 'wheelDeltaY' in event ? -event.wheelDeltaY : | ||
32078 | // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). | ||
32079 | 'wheelDelta' in event ? -event.wheelDelta : 0; | ||
32080 | }, | ||
32081 | deltaZ: null, | ||
32082 | |||
32083 | // Browsers without "deltaMode" is reporting in raw wheel delta where one | ||
32084 | // notch on the scroll is always +/- 120, roughly equivalent to pixels. | ||
32085 | // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or | ||
32086 | // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. | ||
32087 | deltaMode: null | ||
32088 | }; | ||
32089 | |||
32090 | /** | ||
32091 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
32092 | * @param {string} dispatchMarker Marker identifying the event target. | ||
32093 | * @param {object} nativeEvent Native browser event. | ||
32094 | * @extends {SyntheticMouseEvent} | ||
32095 | */ | ||
32096 | function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
32097 | return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
32098 | } | ||
32099 | |||
32100 | SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); | ||
32101 | |||
32102 | module.exports = SyntheticWheelEvent; | ||
32103 | |||
32104 | /***/ }), | ||
32105 | /* 301 */ | ||
32106 | /***/ (function(module, exports, __webpack_require__) { | ||
32107 | |||
32108 | "use strict"; | ||
32109 | /** | ||
32110 | * Copyright 2013-present, Facebook, Inc. | ||
32111 | * All rights reserved. | ||
32112 | * | ||
32113 | * This source code is licensed under the BSD-style license found in the | ||
32114 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32115 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32116 | * | ||
32117 | * | ||
32118 | */ | ||
32119 | |||
32120 | |||
32121 | |||
32122 | var MOD = 65521; | ||
32123 | |||
32124 | // adler32 is not cryptographically strong, and is only used to sanity check that | ||
32125 | // markup generated on the server matches the markup generated on the client. | ||
32126 | // This implementation (a modified version of the SheetJS version) has been optimized | ||
32127 | // for our use case, at the expense of conforming to the adler32 specification | ||
32128 | // for non-ascii inputs. | ||
32129 | function adler32(data) { | ||
32130 | var a = 1; | ||
32131 | var b = 0; | ||
32132 | var i = 0; | ||
32133 | var l = data.length; | ||
32134 | var m = l & ~0x3; | ||
32135 | while (i < m) { | ||
32136 | var n = Math.min(i + 4096, m); | ||
32137 | for (; i < n; i += 4) { | ||
32138 | b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3)); | ||
32139 | } | ||
32140 | a %= MOD; | ||
32141 | b %= MOD; | ||
32142 | } | ||
32143 | for (; i < l; i++) { | ||
32144 | b += a += data.charCodeAt(i); | ||
32145 | } | ||
32146 | a %= MOD; | ||
32147 | b %= MOD; | ||
32148 | return a | b << 16; | ||
32149 | } | ||
32150 | |||
32151 | module.exports = adler32; | ||
32152 | |||
32153 | /***/ }), | ||
32154 | /* 302 */ | ||
32155 | /***/ (function(module, exports, __webpack_require__) { | ||
32156 | |||
32157 | "use strict"; | ||
32158 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
32159 | * Copyright 2013-present, Facebook, Inc. | ||
32160 | * All rights reserved. | ||
32161 | * | ||
32162 | * This source code is licensed under the BSD-style license found in the | ||
32163 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32164 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32165 | * | ||
32166 | */ | ||
32167 | |||
32168 | |||
32169 | |||
32170 | var _prodInvariant = __webpack_require__(3); | ||
32171 | |||
32172 | var ReactPropTypeLocationNames = __webpack_require__(282); | ||
32173 | var ReactPropTypesSecret = __webpack_require__(129); | ||
32174 | |||
32175 | var invariant = __webpack_require__(1); | ||
32176 | var warning = __webpack_require__(2); | ||
32177 | |||
32178 | var ReactComponentTreeHook; | ||
32179 | |||
32180 | if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { | ||
32181 | // Temporary hack. | ||
32182 | // Inline requires don't work well with Jest: | ||
32183 | // https://github.com/facebook/react/issues/7240 | ||
32184 | // Remove the inline requires when we don't need them anymore: | ||
32185 | // https://github.com/facebook/react/pull/7178 | ||
32186 | ReactComponentTreeHook = __webpack_require__(9); | ||
32187 | } | ||
32188 | |||
32189 | var loggedTypeFailures = {}; | ||
32190 | |||
32191 | /** | ||
32192 | * Assert that the values match with the type specs. | ||
32193 | * Error messages are memorized and will only be shown once. | ||
32194 | * | ||
32195 | * @param {object} typeSpecs Map of name to a ReactPropType | ||
32196 | * @param {object} values Runtime values that need to be type-checked | ||
32197 | * @param {string} location e.g. "prop", "context", "child context" | ||
32198 | * @param {string} componentName Name of the component for error messages. | ||
32199 | * @param {?object} element The React element that is being type-checked | ||
32200 | * @param {?number} debugID The React component instance that is being type-checked | ||
32201 | * @private | ||
32202 | */ | ||
32203 | function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) { | ||
32204 | for (var typeSpecName in typeSpecs) { | ||
32205 | if (typeSpecs.hasOwnProperty(typeSpecName)) { | ||
32206 | var error; | ||
32207 | // Prop type validation may throw. In case they do, we don't want to | ||
32208 | // fail the render phase where it didn't fail before. So we log it. | ||
32209 | // After these have been cleaned up, we'll let them throw. | ||
32210 | try { | ||
32211 | // This is intentionally an invariant that gets caught. It's the same | ||
32212 | // behavior as without this statement except with a better message. | ||
32213 | !(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; | ||
32214 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); | ||
32215 | } catch (ex) { | ||
32216 | error = ex; | ||
32217 | } | ||
32218 | 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; | ||
32219 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
32220 | // Only monitor this failure once because there tends to be a lot of the | ||
32221 | // same error. | ||
32222 | loggedTypeFailures[error.message] = true; | ||
32223 | |||
32224 | var componentStackInfo = ''; | ||
32225 | |||
32226 | if (process.env.NODE_ENV !== 'production') { | ||
32227 | if (!ReactComponentTreeHook) { | ||
32228 | ReactComponentTreeHook = __webpack_require__(9); | ||
32229 | } | ||
32230 | if (debugID !== null) { | ||
32231 | componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID); | ||
32232 | } else if (element !== null) { | ||
32233 | componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element); | ||
32234 | } | ||
32235 | } | ||
32236 | |||
32237 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0; | ||
32238 | } | ||
32239 | } | ||
32240 | } | ||
32241 | } | ||
32242 | |||
32243 | module.exports = checkReactTypeSpec; | ||
32244 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
32245 | |||
32246 | /***/ }), | ||
32247 | /* 303 */ | ||
32248 | /***/ (function(module, exports, __webpack_require__) { | ||
32249 | |||
32250 | "use strict"; | ||
32251 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
32252 | * Copyright 2013-present, Facebook, Inc. | ||
32253 | * All rights reserved. | ||
32254 | * | ||
32255 | * This source code is licensed under the BSD-style license found in the | ||
32256 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32257 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32258 | * | ||
32259 | */ | ||
32260 | |||
32261 | |||
32262 | |||
32263 | var CSSProperty = __webpack_require__(118); | ||
32264 | var warning = __webpack_require__(2); | ||
32265 | |||
32266 | var isUnitlessNumber = CSSProperty.isUnitlessNumber; | ||
32267 | var styleWarnings = {}; | ||
32268 | |||
32269 | /** | ||
32270 | * Convert a value into the proper css writable value. The style name `name` | ||
32271 | * should be logical (no hyphens), as specified | ||
32272 | * in `CSSProperty.isUnitlessNumber`. | ||
32273 | * | ||
32274 | * @param {string} name CSS property name such as `topMargin`. | ||
32275 | * @param {*} value CSS property value such as `10px`. | ||
32276 | * @param {ReactDOMComponent} component | ||
32277 | * @return {string} Normalized style value with dimensions applied. | ||
32278 | */ | ||
32279 | function dangerousStyleValue(name, value, component) { | ||
32280 | // Note that we've removed escapeTextForBrowser() calls here since the | ||
32281 | // whole string will be escaped when the attribute is injected into | ||
32282 | // the markup. If you provide unsafe user data here they can inject | ||
32283 | // arbitrary CSS which may be problematic (I couldn't repro this): | ||
32284 | // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet | ||
32285 | // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/ | ||
32286 | // This is not an XSS hole but instead a potential CSS injection issue | ||
32287 | // which has lead to a greater discussion about how we're going to | ||
32288 | // trust URLs moving forward. See #2115901 | ||
32289 | |||
32290 | var isEmpty = value == null || typeof value === 'boolean' || value === ''; | ||
32291 | if (isEmpty) { | ||
32292 | return ''; | ||
32293 | } | ||
32294 | |||
32295 | var isNonNumeric = isNaN(value); | ||
32296 | if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) { | ||
32297 | return '' + value; // cast to string | ||
32298 | } | ||
32299 | |||
32300 | if (typeof value === 'string') { | ||
32301 | if (process.env.NODE_ENV !== 'production') { | ||
32302 | // Allow '0' to pass through without warning. 0 is already special and | ||
32303 | // doesn't require units, so we don't need to warn about it. | ||
32304 | if (component && value !== '0') { | ||
32305 | var owner = component._currentElement._owner; | ||
32306 | var ownerName = owner ? owner.getName() : null; | ||
32307 | if (ownerName && !styleWarnings[ownerName]) { | ||
32308 | styleWarnings[ownerName] = {}; | ||
32309 | } | ||
32310 | var warned = false; | ||
32311 | if (ownerName) { | ||
32312 | var warnings = styleWarnings[ownerName]; | ||
32313 | warned = warnings[name]; | ||
32314 | if (!warned) { | ||
32315 | warnings[name] = true; | ||
32316 | } | ||
32317 | } | ||
32318 | if (!warned) { | ||
32319 | 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; | ||
32320 | } | ||
32321 | } | ||
32322 | } | ||
32323 | value = value.trim(); | ||
32324 | } | ||
32325 | return value + 'px'; | ||
32326 | } | ||
32327 | |||
32328 | module.exports = dangerousStyleValue; | ||
32329 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
32330 | |||
32331 | /***/ }), | ||
32332 | /* 304 */ | ||
32333 | /***/ (function(module, exports, __webpack_require__) { | ||
32334 | |||
32335 | "use strict"; | ||
32336 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
32337 | * Copyright 2013-present, Facebook, Inc. | ||
32338 | * All rights reserved. | ||
32339 | * | ||
32340 | * This source code is licensed under the BSD-style license found in the | ||
32341 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32342 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32343 | * | ||
32344 | */ | ||
32345 | |||
32346 | |||
32347 | |||
32348 | var _prodInvariant = __webpack_require__(3); | ||
32349 | |||
32350 | var ReactCurrentOwner = __webpack_require__(17); | ||
32351 | var ReactDOMComponentTree = __webpack_require__(6); | ||
32352 | var ReactInstanceMap = __webpack_require__(47); | ||
32353 | |||
32354 | var getHostComponentFromComposite = __webpack_require__(133); | ||
32355 | var invariant = __webpack_require__(1); | ||
32356 | var warning = __webpack_require__(2); | ||
32357 | |||
32358 | /** | ||
32359 | * Returns the DOM node rendered by this element. | ||
32360 | * | ||
32361 | * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode | ||
32362 | * | ||
32363 | * @param {ReactComponent|DOMElement} componentOrElement | ||
32364 | * @return {?DOMElement} The root node of this element. | ||
32365 | */ | ||
32366 | function findDOMNode(componentOrElement) { | ||
32367 | if (process.env.NODE_ENV !== 'production') { | ||
32368 | var owner = ReactCurrentOwner.current; | ||
32369 | if (owner !== null) { | ||
32370 | 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; | ||
32371 | owner._warnedAboutRefsInRender = true; | ||
32372 | } | ||
32373 | } | ||
32374 | if (componentOrElement == null) { | ||
32375 | return null; | ||
32376 | } | ||
32377 | if (componentOrElement.nodeType === 1) { | ||
32378 | return componentOrElement; | ||
32379 | } | ||
32380 | |||
32381 | var inst = ReactInstanceMap.get(componentOrElement); | ||
32382 | if (inst) { | ||
32383 | inst = getHostComponentFromComposite(inst); | ||
32384 | return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null; | ||
32385 | } | ||
32386 | |||
32387 | if (typeof componentOrElement.render === 'function') { | ||
32388 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0; | ||
32389 | } else { | ||
32390 | 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; | ||
32391 | } | ||
32392 | } | ||
32393 | |||
32394 | module.exports = findDOMNode; | ||
32395 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
32396 | |||
32397 | /***/ }), | ||
32398 | /* 305 */ | ||
32399 | /***/ (function(module, exports, __webpack_require__) { | ||
32400 | |||
32401 | "use strict"; | ||
32402 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
32403 | * Copyright 2013-present, Facebook, Inc. | ||
32404 | * All rights reserved. | ||
32405 | * | ||
32406 | * This source code is licensed under the BSD-style license found in the | ||
32407 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32408 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32409 | * | ||
32410 | * | ||
32411 | */ | ||
32412 | |||
32413 | |||
32414 | |||
32415 | var KeyEscapeUtils = __webpack_require__(78); | ||
32416 | var traverseAllChildren = __webpack_require__(138); | ||
32417 | var warning = __webpack_require__(2); | ||
32418 | |||
32419 | var ReactComponentTreeHook; | ||
32420 | |||
32421 | if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { | ||
32422 | // Temporary hack. | ||
32423 | // Inline requires don't work well with Jest: | ||
32424 | // https://github.com/facebook/react/issues/7240 | ||
32425 | // Remove the inline requires when we don't need them anymore: | ||
32426 | // https://github.com/facebook/react/pull/7178 | ||
32427 | ReactComponentTreeHook = __webpack_require__(9); | ||
32428 | } | ||
32429 | |||
32430 | /** | ||
32431 | * @param {function} traverseContext Context passed through traversal. | ||
32432 | * @param {?ReactComponent} child React child component. | ||
32433 | * @param {!string} name String name of key path to child. | ||
32434 | * @param {number=} selfDebugID Optional debugID of the current internal instance. | ||
32435 | */ | ||
32436 | function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) { | ||
32437 | // We found a component instance. | ||
32438 | if (traverseContext && typeof traverseContext === 'object') { | ||
32439 | var result = traverseContext; | ||
32440 | var keyUnique = result[name] === undefined; | ||
32441 | if (process.env.NODE_ENV !== 'production') { | ||
32442 | if (!ReactComponentTreeHook) { | ||
32443 | ReactComponentTreeHook = __webpack_require__(9); | ||
32444 | } | ||
32445 | if (!keyUnique) { | ||
32446 | 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; | ||
32447 | } | ||
32448 | } | ||
32449 | if (keyUnique && child != null) { | ||
32450 | result[name] = child; | ||
32451 | } | ||
32452 | } | ||
32453 | } | ||
32454 | |||
32455 | /** | ||
32456 | * Flattens children that are typically specified as `props.children`. Any null | ||
32457 | * children will not be included in the resulting object. | ||
32458 | * @return {!object} flattened children keyed by name. | ||
32459 | */ | ||
32460 | function flattenChildren(children, selfDebugID) { | ||
32461 | if (children == null) { | ||
32462 | return children; | ||
32463 | } | ||
32464 | var result = {}; | ||
32465 | |||
32466 | if (process.env.NODE_ENV !== 'production') { | ||
32467 | traverseAllChildren(children, function (traverseContext, child, name) { | ||
32468 | return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID); | ||
32469 | }, result); | ||
32470 | } else { | ||
32471 | traverseAllChildren(children, flattenSingleChildIntoContext, result); | ||
32472 | } | ||
32473 | return result; | ||
32474 | } | ||
32475 | |||
32476 | module.exports = flattenChildren; | ||
32477 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
32478 | |||
32479 | /***/ }), | ||
32480 | /* 306 */ | ||
32481 | /***/ (function(module, exports, __webpack_require__) { | ||
32482 | |||
32483 | "use strict"; | ||
32484 | /** | ||
32485 | * Copyright 2013-present, Facebook, Inc. | ||
32486 | * All rights reserved. | ||
32487 | * | ||
32488 | * This source code is licensed under the BSD-style license found in the | ||
32489 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32490 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32491 | * | ||
32492 | */ | ||
32493 | |||
32494 | |||
32495 | |||
32496 | var getEventCharCode = __webpack_require__(84); | ||
32497 | |||
32498 | /** | ||
32499 | * Normalization of deprecated HTML5 `key` values | ||
32500 | * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names | ||
32501 | */ | ||
32502 | var normalizeKey = { | ||
32503 | 'Esc': 'Escape', | ||
32504 | 'Spacebar': ' ', | ||
32505 | 'Left': 'ArrowLeft', | ||
32506 | 'Up': 'ArrowUp', | ||
32507 | 'Right': 'ArrowRight', | ||
32508 | 'Down': 'ArrowDown', | ||
32509 | 'Del': 'Delete', | ||
32510 | 'Win': 'OS', | ||
32511 | 'Menu': 'ContextMenu', | ||
32512 | 'Apps': 'ContextMenu', | ||
32513 | 'Scroll': 'ScrollLock', | ||
32514 | 'MozPrintableKey': 'Unidentified' | ||
32515 | }; | ||
32516 | |||
32517 | /** | ||
32518 | * Translation from legacy `keyCode` to HTML5 `key` | ||
32519 | * Only special keys supported, all others depend on keyboard layout or browser | ||
32520 | * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names | ||
32521 | */ | ||
32522 | var translateToKey = { | ||
32523 | 8: 'Backspace', | ||
32524 | 9: 'Tab', | ||
32525 | 12: 'Clear', | ||
32526 | 13: 'Enter', | ||
32527 | 16: 'Shift', | ||
32528 | 17: 'Control', | ||
32529 | 18: 'Alt', | ||
32530 | 19: 'Pause', | ||
32531 | 20: 'CapsLock', | ||
32532 | 27: 'Escape', | ||
32533 | 32: ' ', | ||
32534 | 33: 'PageUp', | ||
32535 | 34: 'PageDown', | ||
32536 | 35: 'End', | ||
32537 | 36: 'Home', | ||
32538 | 37: 'ArrowLeft', | ||
32539 | 38: 'ArrowUp', | ||
32540 | 39: 'ArrowRight', | ||
32541 | 40: 'ArrowDown', | ||
32542 | 45: 'Insert', | ||
32543 | 46: 'Delete', | ||
32544 | 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6', | ||
32545 | 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12', | ||
32546 | 144: 'NumLock', | ||
32547 | 145: 'ScrollLock', | ||
32548 | 224: 'Meta' | ||
32549 | }; | ||
32550 | |||
32551 | /** | ||
32552 | * @param {object} nativeEvent Native browser event. | ||
32553 | * @return {string} Normalized `key` property. | ||
32554 | */ | ||
32555 | function getEventKey(nativeEvent) { | ||
32556 | if (nativeEvent.key) { | ||
32557 | // Normalize inconsistent values reported by browsers due to | ||
32558 | // implementations of a working draft specification. | ||
32559 | |||
32560 | // FireFox implements `key` but returns `MozPrintableKey` for all | ||
32561 | // printable characters (normalized to `Unidentified`), ignore it. | ||
32562 | var key = normalizeKey[nativeEvent.key] || nativeEvent.key; | ||
32563 | if (key !== 'Unidentified') { | ||
32564 | return key; | ||
32565 | } | ||
32566 | } | ||
32567 | |||
32568 | // Browser does not implement `key`, polyfill as much of it as we can. | ||
32569 | if (nativeEvent.type === 'keypress') { | ||
32570 | var charCode = getEventCharCode(nativeEvent); | ||
32571 | |||
32572 | // The enter-key is technically both printable and non-printable and can | ||
32573 | // thus be captured by `keypress`, no other non-printable key should. | ||
32574 | return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); | ||
32575 | } | ||
32576 | if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { | ||
32577 | // While user keyboard layout determines the actual meaning of each | ||
32578 | // `keyCode` value, almost all function keys have a universal value. | ||
32579 | return translateToKey[nativeEvent.keyCode] || 'Unidentified'; | ||
32580 | } | ||
32581 | return ''; | ||
32582 | } | ||
32583 | |||
32584 | module.exports = getEventKey; | ||
32585 | |||
32586 | /***/ }), | ||
32587 | /* 307 */ | ||
32588 | /***/ (function(module, exports, __webpack_require__) { | ||
32589 | |||
32590 | "use strict"; | ||
32591 | /** | ||
32592 | * Copyright 2013-present, Facebook, Inc. | ||
32593 | * All rights reserved. | ||
32594 | * | ||
32595 | * This source code is licensed under the BSD-style license found in the | ||
32596 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32597 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32598 | * | ||
32599 | * | ||
32600 | */ | ||
32601 | |||
32602 | |||
32603 | |||
32604 | /* global Symbol */ | ||
32605 | |||
32606 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | ||
32607 | var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | ||
32608 | |||
32609 | /** | ||
32610 | * Returns the iterator method function contained on the iterable object. | ||
32611 | * | ||
32612 | * Be sure to invoke the function with the iterable as context: | ||
32613 | * | ||
32614 | * var iteratorFn = getIteratorFn(myIterable); | ||
32615 | * if (iteratorFn) { | ||
32616 | * var iterator = iteratorFn.call(myIterable); | ||
32617 | * ... | ||
32618 | * } | ||
32619 | * | ||
32620 | * @param {?object} maybeIterable | ||
32621 | * @return {?function} | ||
32622 | */ | ||
32623 | function getIteratorFn(maybeIterable) { | ||
32624 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | ||
32625 | if (typeof iteratorFn === 'function') { | ||
32626 | return iteratorFn; | ||
32627 | } | ||
32628 | } | ||
32629 | |||
32630 | module.exports = getIteratorFn; | ||
32631 | |||
32632 | /***/ }), | ||
32633 | /* 308 */ | ||
32634 | /***/ (function(module, exports, __webpack_require__) { | ||
32635 | |||
32636 | "use strict"; | ||
32637 | /** | ||
32638 | * Copyright 2013-present, Facebook, Inc. | ||
32639 | * All rights reserved. | ||
32640 | * | ||
32641 | * This source code is licensed under the BSD-style license found in the | ||
32642 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32643 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32644 | * | ||
32645 | */ | ||
32646 | |||
32647 | |||
32648 | |||
32649 | /** | ||
32650 | * Given any node return the first leaf node without children. | ||
32651 | * | ||
32652 | * @param {DOMElement|DOMTextNode} node | ||
32653 | * @return {DOMElement|DOMTextNode} | ||
32654 | */ | ||
32655 | |||
32656 | function getLeafNode(node) { | ||
32657 | while (node && node.firstChild) { | ||
32658 | node = node.firstChild; | ||
32659 | } | ||
32660 | return node; | ||
32661 | } | ||
32662 | |||
32663 | /** | ||
32664 | * Get the next sibling within a container. This will walk up the | ||
32665 | * DOM if a node's siblings have been exhausted. | ||
32666 | * | ||
32667 | * @param {DOMElement|DOMTextNode} node | ||
32668 | * @return {?DOMElement|DOMTextNode} | ||
32669 | */ | ||
32670 | function getSiblingNode(node) { | ||
32671 | while (node) { | ||
32672 | if (node.nextSibling) { | ||
32673 | return node.nextSibling; | ||
32674 | } | ||
32675 | node = node.parentNode; | ||
32676 | } | ||
32677 | } | ||
32678 | |||
32679 | /** | ||
32680 | * Get object describing the nodes which contain characters at offset. | ||
32681 | * | ||
32682 | * @param {DOMElement|DOMTextNode} root | ||
32683 | * @param {number} offset | ||
32684 | * @return {?object} | ||
32685 | */ | ||
32686 | function getNodeForCharacterOffset(root, offset) { | ||
32687 | var node = getLeafNode(root); | ||
32688 | var nodeStart = 0; | ||
32689 | var nodeEnd = 0; | ||
32690 | |||
32691 | while (node) { | ||
32692 | if (node.nodeType === 3) { | ||
32693 | nodeEnd = nodeStart + node.textContent.length; | ||
32694 | |||
32695 | if (nodeStart <= offset && nodeEnd >= offset) { | ||
32696 | return { | ||
32697 | node: node, | ||
32698 | offset: offset - nodeStart | ||
32699 | }; | ||
32700 | } | ||
32701 | |||
32702 | nodeStart = nodeEnd; | ||
32703 | } | ||
32704 | |||
32705 | node = getLeafNode(getSiblingNode(node)); | ||
32706 | } | ||
32707 | } | ||
32708 | |||
32709 | module.exports = getNodeForCharacterOffset; | ||
32710 | |||
32711 | /***/ }), | ||
32712 | /* 309 */ | ||
32713 | /***/ (function(module, exports, __webpack_require__) { | ||
32714 | |||
32715 | "use strict"; | ||
32716 | /** | ||
32717 | * Copyright 2013-present, Facebook, Inc. | ||
32718 | * All rights reserved. | ||
32719 | * | ||
32720 | * This source code is licensed under the BSD-style license found in the | ||
32721 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32722 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32723 | * | ||
32724 | */ | ||
32725 | |||
32726 | |||
32727 | |||
32728 | var ExecutionEnvironment = __webpack_require__(7); | ||
32729 | |||
32730 | /** | ||
32731 | * Generate a mapping of standard vendor prefixes using the defined style property and event name. | ||
32732 | * | ||
32733 | * @param {string} styleProp | ||
32734 | * @param {string} eventName | ||
32735 | * @returns {object} | ||
32736 | */ | ||
32737 | function makePrefixMap(styleProp, eventName) { | ||
32738 | var prefixes = {}; | ||
32739 | |||
32740 | prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); | ||
32741 | prefixes['Webkit' + styleProp] = 'webkit' + eventName; | ||
32742 | prefixes['Moz' + styleProp] = 'moz' + eventName; | ||
32743 | prefixes['ms' + styleProp] = 'MS' + eventName; | ||
32744 | prefixes['O' + styleProp] = 'o' + eventName.toLowerCase(); | ||
32745 | |||
32746 | return prefixes; | ||
32747 | } | ||
32748 | |||
32749 | /** | ||
32750 | * A list of event names to a configurable list of vendor prefixes. | ||
32751 | */ | ||
32752 | var vendorPrefixes = { | ||
32753 | animationend: makePrefixMap('Animation', 'AnimationEnd'), | ||
32754 | animationiteration: makePrefixMap('Animation', 'AnimationIteration'), | ||
32755 | animationstart: makePrefixMap('Animation', 'AnimationStart'), | ||
32756 | transitionend: makePrefixMap('Transition', 'TransitionEnd') | ||
32757 | }; | ||
32758 | |||
32759 | /** | ||
32760 | * Event names that have already been detected and prefixed (if applicable). | ||
32761 | */ | ||
32762 | var prefixedEventNames = {}; | ||
32763 | |||
32764 | /** | ||
32765 | * Element to check for prefixes on. | ||
32766 | */ | ||
32767 | var style = {}; | ||
32768 | |||
32769 | /** | ||
32770 | * Bootstrap if a DOM exists. | ||
32771 | */ | ||
32772 | if (ExecutionEnvironment.canUseDOM) { | ||
32773 | style = document.createElement('div').style; | ||
32774 | |||
32775 | // On some platforms, in particular some releases of Android 4.x, | ||
32776 | // the un-prefixed "animation" and "transition" properties are defined on the | ||
32777 | // style object but the events that fire will still be prefixed, so we need | ||
32778 | // to check if the un-prefixed events are usable, and if not remove them from the map. | ||
32779 | if (!('AnimationEvent' in window)) { | ||
32780 | delete vendorPrefixes.animationend.animation; | ||
32781 | delete vendorPrefixes.animationiteration.animation; | ||
32782 | delete vendorPrefixes.animationstart.animation; | ||
32783 | } | ||
32784 | |||
32785 | // Same as above | ||
32786 | if (!('TransitionEvent' in window)) { | ||
32787 | delete vendorPrefixes.transitionend.transition; | ||
32788 | } | ||
32789 | } | ||
32790 | |||
32791 | /** | ||
32792 | * Attempts to determine the correct vendor prefixed event name. | ||
32793 | * | ||
32794 | * @param {string} eventName | ||
32795 | * @returns {string} | ||
32796 | */ | ||
32797 | function getVendorPrefixedEventName(eventName) { | ||
32798 | if (prefixedEventNames[eventName]) { | ||
32799 | return prefixedEventNames[eventName]; | ||
32800 | } else if (!vendorPrefixes[eventName]) { | ||
32801 | return eventName; | ||
32802 | } | ||
32803 | |||
32804 | var prefixMap = vendorPrefixes[eventName]; | ||
32805 | |||
32806 | for (var styleProp in prefixMap) { | ||
32807 | if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { | ||
32808 | return prefixedEventNames[eventName] = prefixMap[styleProp]; | ||
32809 | } | ||
32810 | } | ||
32811 | |||
32812 | return ''; | ||
32813 | } | ||
32814 | |||
32815 | module.exports = getVendorPrefixedEventName; | ||
32816 | |||
32817 | /***/ }), | ||
32818 | /* 310 */ | ||
32819 | /***/ (function(module, exports, __webpack_require__) { | ||
32820 | |||
32821 | "use strict"; | ||
32822 | /** | ||
32823 | * Copyright 2013-present, Facebook, Inc. | ||
32824 | * All rights reserved. | ||
32825 | * | ||
32826 | * This source code is licensed under the BSD-style license found in the | ||
32827 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32828 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32829 | * | ||
32830 | */ | ||
32831 | |||
32832 | |||
32833 | |||
32834 | var escapeTextContentForBrowser = __webpack_require__(57); | ||
32835 | |||
32836 | /** | ||
32837 | * Escapes attribute value to prevent scripting attacks. | ||
32838 | * | ||
32839 | * @param {*} value Value to escape. | ||
32840 | * @return {string} An escaped string. | ||
32841 | */ | ||
32842 | function quoteAttributeValueForBrowser(value) { | ||
32843 | return '"' + escapeTextContentForBrowser(value) + '"'; | ||
32844 | } | ||
32845 | |||
32846 | module.exports = quoteAttributeValueForBrowser; | ||
32847 | |||
32848 | /***/ }), | ||
32849 | /* 311 */ | ||
32850 | /***/ (function(module, exports, __webpack_require__) { | ||
32851 | |||
32852 | "use strict"; | ||
32853 | /** | ||
32854 | * Copyright 2013-present, Facebook, Inc. | ||
32855 | * All rights reserved. | ||
32856 | * | ||
32857 | * This source code is licensed under the BSD-style license found in the | ||
32858 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32859 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32860 | * | ||
32861 | */ | ||
32862 | |||
32863 | |||
32864 | |||
32865 | var ReactMount = __webpack_require__(127); | ||
32866 | |||
32867 | module.exports = ReactMount.renderSubtreeIntoContainer; | ||
32868 | |||
32869 | /***/ }), | ||
32870 | /* 312 */ | ||
32871 | /***/ (function(module, exports, __webpack_require__) { | ||
32872 | |||
32873 | "use strict"; | ||
32874 | /** | ||
32875 | * Copyright 2013-present, Facebook, Inc. | ||
32876 | * All rights reserved. | ||
32877 | * | ||
32878 | * This source code is licensed under the BSD-style license found in the | ||
32879 | * LICENSE file in the root directory of this source tree. An additional grant | ||
32880 | * of patent rights can be found in the PATENTS file in the same directory. | ||
32881 | * | ||
32882 | * | ||
32883 | */ | ||
32884 | |||
32885 | |||
32886 | |||
32887 | /** | ||
32888 | * Escape and wrap key so it is safe to use as a reactid | ||
32889 | * | ||
32890 | * @param {string} key to be escaped. | ||
32891 | * @return {string} the escaped key. | ||
32892 | */ | ||
32893 | |||
32894 | function escape(key) { | ||
32895 | var escapeRegex = /[=:]/g; | ||
32896 | var escaperLookup = { | ||
32897 | '=': '=0', | ||
32898 | ':': '=2' | ||
32899 | }; | ||
32900 | var escapedString = ('' + key).replace(escapeRegex, function (match) { | ||
32901 | return escaperLookup[match]; | ||
32902 | }); | ||
32903 | |||
32904 | return '$' + escapedString; | ||
32905 | } | ||
32906 | |||
32907 | /** | ||
32908 | * Unescape and unwrap key for human-readable display | ||
32909 | * | ||
32910 | * @param {string} key to unescape. | ||
32911 | * @return {string} the unescaped key. | ||
32912 | */ | ||
32913 | function unescape(key) { | ||
32914 | var unescapeRegex = /(=0|=2)/g; | ||
32915 | var unescaperLookup = { | ||
32916 | '=0': '=', | ||
32917 | '=2': ':' | ||
32918 | }; | ||
32919 | var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1); | ||
32920 | |||
32921 | return ('' + keySubstring).replace(unescapeRegex, function (match) { | ||
32922 | return unescaperLookup[match]; | ||
32923 | }); | ||
32924 | } | ||
32925 | |||
32926 | var KeyEscapeUtils = { | ||
32927 | escape: escape, | ||
32928 | unescape: unescape | ||
32929 | }; | ||
32930 | |||
32931 | module.exports = KeyEscapeUtils; | ||
32932 | |||
32933 | /***/ }), | ||
32934 | /* 313 */ | ||
32935 | /***/ (function(module, exports, __webpack_require__) { | ||
32936 | |||
32937 | "use strict"; | ||
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 | |||
32950 | |||
32951 | var _prodInvariant = __webpack_require__(32); | ||
32952 | |||
32953 | var invariant = __webpack_require__(1); | ||
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__(0))) | ||
33050 | |||
33051 | /***/ }), | ||
33052 | /* 314 */ | ||
33053 | /***/ (function(module, exports, __webpack_require__) { | ||
33054 | |||
33055 | "use strict"; | ||
33056 | /** | ||
33057 | * Copyright 2013-present, Facebook, Inc. | ||
33058 | * All rights reserved. | ||
33059 | * | ||
33060 | * This source code is licensed under the BSD-style license found in the | ||
33061 | * LICENSE file in the root directory of this source tree. An additional grant | ||
33062 | * of patent rights can be found in the PATENTS file in the same directory. | ||
33063 | * | ||
33064 | */ | ||
33065 | |||
33066 | |||
33067 | |||
33068 | var PooledClass = __webpack_require__(313); | ||
33069 | var ReactElement = __webpack_require__(31); | ||
33070 | |||
33071 | var emptyFunction = __webpack_require__(10); | ||
33072 | var traverseAllChildren = __webpack_require__(324); | ||
33073 | |||
33074 | var twoArgumentPooler = PooledClass.twoArgumentPooler; | ||
33075 | var fourArgumentPooler = PooledClass.fourArgumentPooler; | ||
33076 | |||
33077 | var userProvidedKeyEscapeRegex = /\/+/g; | ||
33078 | function escapeUserProvidedKey(text) { | ||
33079 | return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/'); | ||
33080 | } | ||
33081 | |||
33082 | /** | ||
33083 | * PooledClass representing the bookkeeping associated with performing a child | ||
33084 | * traversal. Allows avoiding binding callbacks. | ||
33085 | * | ||
33086 | * @constructor ForEachBookKeeping | ||
33087 | * @param {!function} forEachFunction Function to perform traversal with. | ||
33088 | * @param {?*} forEachContext Context to perform context with. | ||
33089 | */ | ||
33090 | function ForEachBookKeeping(forEachFunction, forEachContext) { | ||
33091 | this.func = forEachFunction; | ||
33092 | this.context = forEachContext; | ||
33093 | this.count = 0; | ||
33094 | } | ||
33095 | ForEachBookKeeping.prototype.destructor = function () { | ||
33096 | this.func = null; | ||
33097 | this.context = null; | ||
33098 | this.count = 0; | ||
33099 | }; | ||
33100 | PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler); | ||
33101 | |||
33102 | function forEachSingleChild(bookKeeping, child, name) { | ||
33103 | var func = bookKeeping.func, | ||
33104 | context = bookKeeping.context; | ||
33105 | |||
33106 | func.call(context, child, bookKeeping.count++); | ||
33107 | } | ||
33108 | |||
33109 | /** | ||
33110 | * Iterates through children that are typically specified as `props.children`. | ||
33111 | * | ||
33112 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach | ||
33113 | * | ||
33114 | * The provided forEachFunc(child, index) will be called for each | ||
33115 | * leaf child. | ||
33116 | * | ||
33117 | * @param {?*} children Children tree container. | ||
33118 | * @param {function(*, int)} forEachFunc | ||
33119 | * @param {*} forEachContext Context for forEachContext. | ||
33120 | */ | ||
33121 | function forEachChildren(children, forEachFunc, forEachContext) { | ||
33122 | if (children == null) { | ||
33123 | return children; | ||
33124 | } | ||
33125 | var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext); | ||
33126 | traverseAllChildren(children, forEachSingleChild, traverseContext); | ||
33127 | ForEachBookKeeping.release(traverseContext); | ||
33128 | } | ||
33129 | |||
33130 | /** | ||
33131 | * PooledClass representing the bookkeeping associated with performing a child | ||
33132 | * mapping. Allows avoiding binding callbacks. | ||
33133 | * | ||
33134 | * @constructor MapBookKeeping | ||
33135 | * @param {!*} mapResult Object containing the ordered map of results. | ||
33136 | * @param {!function} mapFunction Function to perform mapping with. | ||
33137 | * @param {?*} mapContext Context to perform mapping with. | ||
33138 | */ | ||
33139 | function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) { | ||
33140 | this.result = mapResult; | ||
33141 | this.keyPrefix = keyPrefix; | ||
33142 | this.func = mapFunction; | ||
33143 | this.context = mapContext; | ||
33144 | this.count = 0; | ||
33145 | } | ||
33146 | MapBookKeeping.prototype.destructor = function () { | ||
33147 | this.result = null; | ||
33148 | this.keyPrefix = null; | ||
33149 | this.func = null; | ||
33150 | this.context = null; | ||
33151 | this.count = 0; | ||
33152 | }; | ||
33153 | PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler); | ||
33154 | |||
33155 | function mapSingleChildIntoContext(bookKeeping, child, childKey) { | ||
33156 | var result = bookKeeping.result, | ||
33157 | keyPrefix = bookKeeping.keyPrefix, | ||
33158 | func = bookKeeping.func, | ||
33159 | context = bookKeeping.context; | ||
33160 | |||
33161 | |||
33162 | var mappedChild = func.call(context, child, bookKeeping.count++); | ||
33163 | if (Array.isArray(mappedChild)) { | ||
33164 | mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument); | ||
33165 | } else if (mappedChild != null) { | ||
33166 | if (ReactElement.isValidElement(mappedChild)) { | ||
33167 | mappedChild = ReactElement.cloneAndReplaceKey(mappedChild, | ||
33168 | // Keep both the (mapped) and old keys if they differ, just as | ||
33169 | // traverseAllChildren used to do for objects as children | ||
33170 | keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey); | ||
33171 | } | ||
33172 | result.push(mappedChild); | ||
33173 | } | ||
33174 | } | ||
33175 | |||
33176 | function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { | ||
33177 | var escapedPrefix = ''; | ||
33178 | if (prefix != null) { | ||
33179 | escapedPrefix = escapeUserProvidedKey(prefix) + '/'; | ||
33180 | } | ||
33181 | var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context); | ||
33182 | traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); | ||
33183 | MapBookKeeping.release(traverseContext); | ||
33184 | } | ||
33185 | |||
33186 | /** | ||
33187 | * Maps children that are typically specified as `props.children`. | ||
33188 | * | ||
33189 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map | ||
33190 | * | ||
33191 | * The provided mapFunction(child, key, index) will be called for each | ||
33192 | * leaf child. | ||
33193 | * | ||
33194 | * @param {?*} children Children tree container. | ||
33195 | * @param {function(*, int)} func The map function. | ||
33196 | * @param {*} context Context for mapFunction. | ||
33197 | * @return {object} Object containing the ordered map of results. | ||
33198 | */ | ||
33199 | function mapChildren(children, func, context) { | ||
33200 | if (children == null) { | ||
33201 | return children; | ||
33202 | } | ||
33203 | var result = []; | ||
33204 | mapIntoWithKeyPrefixInternal(children, result, null, func, context); | ||
33205 | return result; | ||
33206 | } | ||
33207 | |||
33208 | function forEachSingleChildDummy(traverseContext, child, name) { | ||
33209 | return null; | ||
33210 | } | ||
33211 | |||
33212 | /** | ||
33213 | * Count the number of children that are typically specified as | ||
33214 | * `props.children`. | ||
33215 | * | ||
33216 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count | ||
33217 | * | ||
33218 | * @param {?*} children Children tree container. | ||
33219 | * @return {number} The number of children. | ||
33220 | */ | ||
33221 | function countChildren(children, context) { | ||
33222 | return traverseAllChildren(children, forEachSingleChildDummy, null); | ||
33223 | } | ||
33224 | |||
33225 | /** | ||
33226 | * Flatten a children object (typically specified as `props.children`) and | ||
33227 | * return an array with appropriately re-keyed children. | ||
33228 | * | ||
33229 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray | ||
33230 | */ | ||
33231 | function toArray(children) { | ||
33232 | var result = []; | ||
33233 | mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); | ||
33234 | return result; | ||
33235 | } | ||
33236 | |||
33237 | var ReactChildren = { | ||
33238 | forEach: forEachChildren, | ||
33239 | map: mapChildren, | ||
33240 | mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal, | ||
33241 | count: countChildren, | ||
33242 | toArray: toArray | ||
33243 | }; | ||
33244 | |||
33245 | module.exports = ReactChildren; | ||
33246 | |||
33247 | /***/ }), | ||
33248 | /* 315 */ | ||
33249 | /***/ (function(module, exports, __webpack_require__) { | ||
33250 | |||
33251 | "use strict"; | ||
33252 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
33253 | * Copyright 2013-present, Facebook, Inc. | ||
33254 | * All rights reserved. | ||
33255 | * | ||
33256 | * This source code is licensed under the BSD-style license found in the | ||
33257 | * LICENSE file in the root directory of this source tree. An additional grant | ||
33258 | * of patent rights can be found in the PATENTS file in the same directory. | ||
33259 | * | ||
33260 | */ | ||
33261 | |||
33262 | |||
33263 | |||
33264 | var _prodInvariant = __webpack_require__(32), | ||
33265 | _assign = __webpack_require__(4); | ||
33266 | |||
33267 | var ReactComponent = __webpack_require__(90); | ||
33268 | var ReactElement = __webpack_require__(31); | ||
33269 | var ReactPropTypeLocationNames = __webpack_require__(141); | ||
33270 | var ReactNoopUpdateQueue = __webpack_require__(91); | ||
33271 | |||
33272 | var emptyObject = __webpack_require__(36); | ||
33273 | var invariant = __webpack_require__(1); | ||
33274 | var warning = __webpack_require__(2); | ||
33275 | |||
33276 | var MIXINS_KEY = 'mixins'; | ||
33277 | |||
33278 | // Helper function to allow the creation of anonymous functions which do not | ||
33279 | // have .name set to the name of the variable being assigned to. | ||
33280 | function identity(fn) { | ||
33281 | return fn; | ||
33282 | } | ||
33283 | |||
33284 | /** | ||
33285 | * Policies that describe methods in `ReactClassInterface`. | ||
33286 | */ | ||
33287 | |||
33288 | |||
33289 | var injectedMixins = []; | ||
33290 | |||
33291 | /** | ||
33292 | * Composite components are higher-level components that compose other composite | ||
33293 | * or host components. | ||
33294 | * | ||
33295 | * To create a new type of `ReactClass`, pass a specification of | ||
33296 | * your new class to `React.createClass`. The only requirement of your class | ||
33297 | * specification is that you implement a `render` method. | ||
33298 | * | ||
33299 | * var MyComponent = React.createClass({ | ||
33300 | * render: function() { | ||
33301 | * return <div>Hello World</div>; | ||
33302 | * } | ||
33303 | * }); | ||
33304 | * | ||
33305 | * The class specification supports a specific protocol of methods that have | ||
33306 | * special meaning (e.g. `render`). See `ReactClassInterface` for | ||
33307 | * more the comprehensive protocol. Any other properties and methods in the | ||
33308 | * class specification will be available on the prototype. | ||
33309 | * | ||
33310 | * @interface ReactClassInterface | ||
33311 | * @internal | ||
33312 | */ | ||
33313 | var ReactClassInterface = { | ||
33314 | |||
33315 | /** | ||
33316 | * An array of Mixin objects to include when defining your component. | ||
33317 | * | ||
33318 | * @type {array} | ||
33319 | * @optional | ||
33320 | */ | ||
33321 | mixins: 'DEFINE_MANY', | ||
33322 | |||
33323 | /** | ||
33324 | * An object containing properties and methods that should be defined on | ||
33325 | * the component's constructor instead of its prototype (static methods). | ||
33326 | * | ||
33327 | * @type {object} | ||
33328 | * @optional | ||
33329 | */ | ||
33330 | statics: 'DEFINE_MANY', | ||
33331 | |||
33332 | /** | ||
33333 | * Definition of prop types for this component. | ||
33334 | * | ||
33335 | * @type {object} | ||
33336 | * @optional | ||
33337 | */ | ||
33338 | propTypes: 'DEFINE_MANY', | ||
33339 | |||
33340 | /** | ||
33341 | * Definition of context types for this component. | ||
33342 | * | ||
33343 | * @type {object} | ||
33344 | * @optional | ||
33345 | */ | ||
33346 | contextTypes: 'DEFINE_MANY', | ||
33347 | |||
33348 | /** | ||
33349 | * Definition of context types this component sets for its children. | ||
33350 | * | ||
33351 | * @type {object} | ||
33352 | * @optional | ||
33353 | */ | ||
33354 | childContextTypes: 'DEFINE_MANY', | ||
33355 | |||
33356 | // ==== Definition methods ==== | ||
33357 | |||
33358 | /** | ||
33359 | * Invoked when the component is mounted. Values in the mapping will be set on | ||
33360 | * `this.props` if that prop is not specified (i.e. using an `in` check). | ||
33361 | * | ||
33362 | * This method is invoked before `getInitialState` and therefore cannot rely | ||
33363 | * on `this.state` or use `this.setState`. | ||
33364 | * | ||
33365 | * @return {object} | ||
33366 | * @optional | ||
33367 | */ | ||
33368 | getDefaultProps: 'DEFINE_MANY_MERGED', | ||
33369 | |||
33370 | /** | ||
33371 | * Invoked once before the component is mounted. The return value will be used | ||
33372 | * as the initial value of `this.state`. | ||
33373 | * | ||
33374 | * getInitialState: function() { | ||
33375 | * return { | ||
33376 | * isOn: false, | ||
33377 | * fooBaz: new BazFoo() | ||
33378 | * } | ||
33379 | * } | ||
33380 | * | ||
33381 | * @return {object} | ||
33382 | * @optional | ||
33383 | */ | ||
33384 | getInitialState: 'DEFINE_MANY_MERGED', | ||
33385 | |||
33386 | /** | ||
33387 | * @return {object} | ||
33388 | * @optional | ||
33389 | */ | ||
33390 | getChildContext: 'DEFINE_MANY_MERGED', | ||
33391 | |||
33392 | /** | ||
33393 | * Uses props from `this.props` and state from `this.state` to render the | ||
33394 | * structure of the component. | ||
33395 | * | ||
33396 | * No guarantees are made about when or how often this method is invoked, so | ||
33397 | * it must not have side effects. | ||
33398 | * | ||
33399 | * render: function() { | ||
33400 | * var name = this.props.name; | ||
33401 | * return <div>Hello, {name}!</div>; | ||
33402 | * } | ||
33403 | * | ||
33404 | * @return {ReactComponent} | ||
33405 | * @required | ||
33406 | */ | ||
33407 | render: 'DEFINE_ONCE', | ||
33408 | |||
33409 | // ==== Delegate methods ==== | ||
33410 | |||
33411 | /** | ||
33412 | * Invoked when the component is initially created and about to be mounted. | ||
33413 | * This may have side effects, but any external subscriptions or data created | ||
33414 | * by this method must be cleaned up in `componentWillUnmount`. | ||
33415 | * | ||
33416 | * @optional | ||
33417 | */ | ||
33418 | componentWillMount: 'DEFINE_MANY', | ||
33419 | |||
33420 | /** | ||
33421 | * Invoked when the component has been mounted and has a DOM representation. | ||
33422 | * However, there is no guarantee that the DOM node is in the document. | ||
33423 | * | ||
33424 | * Use this as an opportunity to operate on the DOM when the component has | ||
33425 | * been mounted (initialized and rendered) for the first time. | ||
33426 | * | ||
33427 | * @param {DOMElement} rootNode DOM element representing the component. | ||
33428 | * @optional | ||
33429 | */ | ||
33430 | componentDidMount: 'DEFINE_MANY', | ||
33431 | |||
33432 | /** | ||
33433 | * Invoked before the component receives new props. | ||
33434 | * | ||
33435 | * Use this as an opportunity to react to a prop transition by updating the | ||
33436 | * state using `this.setState`. Current props are accessed via `this.props`. | ||
33437 | * | ||
33438 | * componentWillReceiveProps: function(nextProps, nextContext) { | ||
33439 | * this.setState({ | ||
33440 | * likesIncreasing: nextProps.likeCount > this.props.likeCount | ||
33441 | * }); | ||
33442 | * } | ||
33443 | * | ||
33444 | * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop | ||
33445 | * transition may cause a state change, but the opposite is not true. If you | ||
33446 | * need it, you are probably looking for `componentWillUpdate`. | ||
33447 | * | ||
33448 | * @param {object} nextProps | ||
33449 | * @optional | ||
33450 | */ | ||
33451 | componentWillReceiveProps: 'DEFINE_MANY', | ||
33452 | |||
33453 | /** | ||
33454 | * Invoked while deciding if the component should be updated as a result of | ||
33455 | * receiving new props, state and/or context. | ||
33456 | * | ||
33457 | * Use this as an opportunity to `return false` when you're certain that the | ||
33458 | * transition to the new props/state/context will not require a component | ||
33459 | * update. | ||
33460 | * | ||
33461 | * shouldComponentUpdate: function(nextProps, nextState, nextContext) { | ||
33462 | * return !equal(nextProps, this.props) || | ||
33463 | * !equal(nextState, this.state) || | ||
33464 | * !equal(nextContext, this.context); | ||
33465 | * } | ||
33466 | * | ||
33467 | * @param {object} nextProps | ||
33468 | * @param {?object} nextState | ||
33469 | * @param {?object} nextContext | ||
33470 | * @return {boolean} True if the component should update. | ||
33471 | * @optional | ||
33472 | */ | ||
33473 | shouldComponentUpdate: 'DEFINE_ONCE', | ||
33474 | |||
33475 | /** | ||
33476 | * Invoked when the component is about to update due to a transition from | ||
33477 | * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` | ||
33478 | * and `nextContext`. | ||
33479 | * | ||
33480 | * Use this as an opportunity to perform preparation before an update occurs. | ||
33481 | * | ||
33482 | * NOTE: You **cannot** use `this.setState()` in this method. | ||
33483 | * | ||
33484 | * @param {object} nextProps | ||
33485 | * @param {?object} nextState | ||
33486 | * @param {?object} nextContext | ||
33487 | * @param {ReactReconcileTransaction} transaction | ||
33488 | * @optional | ||
33489 | */ | ||
33490 | componentWillUpdate: 'DEFINE_MANY', | ||
33491 | |||
33492 | /** | ||
33493 | * Invoked when the component's DOM representation has been updated. | ||
33494 | * | ||
33495 | * Use this as an opportunity to operate on the DOM when the component has | ||
33496 | * been updated. | ||
33497 | * | ||
33498 | * @param {object} prevProps | ||
33499 | * @param {?object} prevState | ||
33500 | * @param {?object} prevContext | ||
33501 | * @param {DOMElement} rootNode DOM element representing the component. | ||
33502 | * @optional | ||
33503 | */ | ||
33504 | componentDidUpdate: 'DEFINE_MANY', | ||
33505 | |||
33506 | /** | ||
33507 | * Invoked when the component is about to be removed from its parent and have | ||
33508 | * its DOM representation destroyed. | ||
33509 | * | ||
33510 | * Use this as an opportunity to deallocate any external resources. | ||
33511 | * | ||
33512 | * NOTE: There is no `componentDidUnmount` since your component will have been | ||
33513 | * destroyed by that point. | ||
33514 | * | ||
33515 | * @optional | ||
33516 | */ | ||
33517 | componentWillUnmount: 'DEFINE_MANY', | ||
33518 | |||
33519 | // ==== Advanced methods ==== | ||
33520 | |||
33521 | /** | ||
33522 | * Updates the component's currently mounted DOM representation. | ||
33523 | * | ||
33524 | * By default, this implements React's rendering and reconciliation algorithm. | ||
33525 | * Sophisticated clients may wish to override this. | ||
33526 | * | ||
33527 | * @param {ReactReconcileTransaction} transaction | ||
33528 | * @internal | ||
33529 | * @overridable | ||
33530 | */ | ||
33531 | updateComponent: 'OVERRIDE_BASE' | ||
33532 | |||
33533 | }; | ||
33534 | |||
33535 | /** | ||
33536 | * Mapping from class specification keys to special processing functions. | ||
33537 | * | ||
33538 | * Although these are declared like instance properties in the specification | ||
33539 | * when defining classes using `React.createClass`, they are actually static | ||
33540 | * and are accessible on the constructor instead of the prototype. Despite | ||
33541 | * being static, they must be defined outside of the "statics" key under | ||
33542 | * which all other static methods are defined. | ||
33543 | */ | ||
33544 | var RESERVED_SPEC_KEYS = { | ||
33545 | displayName: function (Constructor, displayName) { | ||
33546 | Constructor.displayName = displayName; | ||
33547 | }, | ||
33548 | mixins: function (Constructor, mixins) { | ||
33549 | if (mixins) { | ||
33550 | for (var i = 0; i < mixins.length; i++) { | ||
33551 | mixSpecIntoComponent(Constructor, mixins[i]); | ||
33552 | } | ||
33553 | } | ||
33554 | }, | ||
33555 | childContextTypes: function (Constructor, childContextTypes) { | ||
33556 | if (process.env.NODE_ENV !== 'production') { | ||
33557 | validateTypeDef(Constructor, childContextTypes, 'childContext'); | ||
33558 | } | ||
33559 | Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes); | ||
33560 | }, | ||
33561 | contextTypes: function (Constructor, contextTypes) { | ||
33562 | if (process.env.NODE_ENV !== 'production') { | ||
33563 | validateTypeDef(Constructor, contextTypes, 'context'); | ||
33564 | } | ||
33565 | Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes); | ||
33566 | }, | ||
33567 | /** | ||
33568 | * Special case getDefaultProps which should move into statics but requires | ||
33569 | * automatic merging. | ||
33570 | */ | ||
33571 | getDefaultProps: function (Constructor, getDefaultProps) { | ||
33572 | if (Constructor.getDefaultProps) { | ||
33573 | Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); | ||
33574 | } else { | ||
33575 | Constructor.getDefaultProps = getDefaultProps; | ||
33576 | } | ||
33577 | }, | ||
33578 | propTypes: function (Constructor, propTypes) { | ||
33579 | if (process.env.NODE_ENV !== 'production') { | ||
33580 | validateTypeDef(Constructor, propTypes, 'prop'); | ||
33581 | } | ||
33582 | Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); | ||
33583 | }, | ||
33584 | statics: function (Constructor, statics) { | ||
33585 | mixStaticSpecIntoComponent(Constructor, statics); | ||
33586 | }, | ||
33587 | autobind: function () {} }; | ||
33588 | |||
33589 | function validateTypeDef(Constructor, typeDef, location) { | ||
33590 | for (var propName in typeDef) { | ||
33591 | if (typeDef.hasOwnProperty(propName)) { | ||
33592 | // use a warning instead of an invariant so components | ||
33593 | // don't show up in prod but only in __DEV__ | ||
33594 | 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; | ||
33595 | } | ||
33596 | } | ||
33597 | } | ||
33598 | |||
33599 | function validateMethodOverride(isAlreadyDefined, name) { | ||
33600 | var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; | ||
33601 | |||
33602 | // Disallow overriding of base class methods unless explicitly allowed. | ||
33603 | if (ReactClassMixin.hasOwnProperty(name)) { | ||
33604 | !(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; | ||
33605 | } | ||
33606 | |||
33607 | // Disallow defining methods more than once unless explicitly allowed. | ||
33608 | if (isAlreadyDefined) { | ||
33609 | !(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; | ||
33610 | } | ||
33611 | } | ||
33612 | |||
33613 | /** | ||
33614 | * Mixin helper which handles policy validation and reserved | ||
33615 | * specification keys when building React classes. | ||
33616 | */ | ||
33617 | function mixSpecIntoComponent(Constructor, spec) { | ||
33618 | if (!spec) { | ||
33619 | if (process.env.NODE_ENV !== 'production') { | ||
33620 | var typeofSpec = typeof spec; | ||
33621 | var isMixinValid = typeofSpec === 'object' && spec !== null; | ||
33622 | |||
33623 | 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; | ||
33624 | } | ||
33625 | |||
33626 | return; | ||
33627 | } | ||
33628 | |||
33629 | !(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; | ||
33630 | !!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; | ||
33631 | |||
33632 | var proto = Constructor.prototype; | ||
33633 | var autoBindPairs = proto.__reactAutoBindPairs; | ||
33634 | |||
33635 | // By handling mixins before any other properties, we ensure the same | ||
33636 | // chaining order is applied to methods with DEFINE_MANY policy, whether | ||
33637 | // mixins are listed before or after these methods in the spec. | ||
33638 | if (spec.hasOwnProperty(MIXINS_KEY)) { | ||
33639 | RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); | ||
33640 | } | ||
33641 | |||
33642 | for (var name in spec) { | ||
33643 | if (!spec.hasOwnProperty(name)) { | ||
33644 | continue; | ||
33645 | } | ||
33646 | |||
33647 | if (name === MIXINS_KEY) { | ||
33648 | // We have already handled mixins in a special case above. | ||
33649 | continue; | ||
33650 | } | ||
33651 | |||
33652 | var property = spec[name]; | ||
33653 | var isAlreadyDefined = proto.hasOwnProperty(name); | ||
33654 | validateMethodOverride(isAlreadyDefined, name); | ||
33655 | |||
33656 | if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { | ||
33657 | RESERVED_SPEC_KEYS[name](Constructor, property); | ||
33658 | } else { | ||
33659 | // Setup methods on prototype: | ||
33660 | // The following member methods should not be automatically bound: | ||
33661 | // 1. Expected ReactClass methods (in the "interface"). | ||
33662 | // 2. Overridden methods (that were mixed in). | ||
33663 | var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); | ||
33664 | var isFunction = typeof property === 'function'; | ||
33665 | var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; | ||
33666 | |||
33667 | if (shouldAutoBind) { | ||
33668 | autoBindPairs.push(name, property); | ||
33669 | proto[name] = property; | ||
33670 | } else { | ||
33671 | if (isAlreadyDefined) { | ||
33672 | var specPolicy = ReactClassInterface[name]; | ||
33673 | |||
33674 | // These cases should already be caught by validateMethodOverride. | ||
33675 | !(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; | ||
33676 | |||
33677 | // For methods which are defined more than once, call the existing | ||
33678 | // methods before calling the new property, merging if appropriate. | ||
33679 | if (specPolicy === 'DEFINE_MANY_MERGED') { | ||
33680 | proto[name] = createMergedResultFunction(proto[name], property); | ||
33681 | } else if (specPolicy === 'DEFINE_MANY') { | ||
33682 | proto[name] = createChainedFunction(proto[name], property); | ||
33683 | } | ||
33684 | } else { | ||
33685 | proto[name] = property; | ||
33686 | if (process.env.NODE_ENV !== 'production') { | ||
33687 | // Add verbose displayName to the function, which helps when looking | ||
33688 | // at profiling tools. | ||
33689 | if (typeof property === 'function' && spec.displayName) { | ||
33690 | proto[name].displayName = spec.displayName + '_' + name; | ||
33691 | } | ||
33692 | } | ||
33693 | } | ||
33694 | } | ||
33695 | } | ||
33696 | } | ||
33697 | } | ||
33698 | |||
33699 | function mixStaticSpecIntoComponent(Constructor, statics) { | ||
33700 | if (!statics) { | ||
33701 | return; | ||
33702 | } | ||
33703 | for (var name in statics) { | ||
33704 | var property = statics[name]; | ||
33705 | if (!statics.hasOwnProperty(name)) { | ||
33706 | continue; | ||
33707 | } | ||
33708 | |||
33709 | var isReserved = name in RESERVED_SPEC_KEYS; | ||
33710 | !!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; | ||
33711 | |||
33712 | var isInherited = name in Constructor; | ||
33713 | !!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; | ||
33714 | Constructor[name] = property; | ||
33715 | } | ||
33716 | } | ||
33717 | |||
33718 | /** | ||
33719 | * Merge two objects, but throw if both contain the same key. | ||
33720 | * | ||
33721 | * @param {object} one The first object, which is mutated. | ||
33722 | * @param {object} two The second object | ||
33723 | * @return {object} one after it has been mutated to contain everything in two. | ||
33724 | */ | ||
33725 | function mergeIntoWithNoDuplicateKeys(one, two) { | ||
33726 | !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0; | ||
33727 | |||
33728 | for (var key in two) { | ||
33729 | if (two.hasOwnProperty(key)) { | ||
33730 | !(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; | ||
33731 | one[key] = two[key]; | ||
33732 | } | ||
33733 | } | ||
33734 | return one; | ||
33735 | } | ||
33736 | |||
33737 | /** | ||
33738 | * Creates a function that invokes two functions and merges their return values. | ||
33739 | * | ||
33740 | * @param {function} one Function to invoke first. | ||
33741 | * @param {function} two Function to invoke second. | ||
33742 | * @return {function} Function that invokes the two argument functions. | ||
33743 | * @private | ||
33744 | */ | ||
33745 | function createMergedResultFunction(one, two) { | ||
33746 | return function mergedResult() { | ||
33747 | var a = one.apply(this, arguments); | ||
33748 | var b = two.apply(this, arguments); | ||
33749 | if (a == null) { | ||
33750 | return b; | ||
33751 | } else if (b == null) { | ||
33752 | return a; | ||
33753 | } | ||
33754 | var c = {}; | ||
33755 | mergeIntoWithNoDuplicateKeys(c, a); | ||
33756 | mergeIntoWithNoDuplicateKeys(c, b); | ||
33757 | return c; | ||
33758 | }; | ||
33759 | } | ||
33760 | |||
33761 | /** | ||
33762 | * Creates a function that invokes two functions and ignores their return vales. | ||
33763 | * | ||
33764 | * @param {function} one Function to invoke first. | ||
33765 | * @param {function} two Function to invoke second. | ||
33766 | * @return {function} Function that invokes the two argument functions. | ||
33767 | * @private | ||
33768 | */ | ||
33769 | function createChainedFunction(one, two) { | ||
33770 | return function chainedFunction() { | ||
33771 | one.apply(this, arguments); | ||
33772 | two.apply(this, arguments); | ||
33773 | }; | ||
33774 | } | ||
33775 | |||
33776 | /** | ||
33777 | * Binds a method to the component. | ||
33778 | * | ||
33779 | * @param {object} component Component whose method is going to be bound. | ||
33780 | * @param {function} method Method to be bound. | ||
33781 | * @return {function} The bound method. | ||
33782 | */ | ||
33783 | function bindAutoBindMethod(component, method) { | ||
33784 | var boundMethod = method.bind(component); | ||
33785 | if (process.env.NODE_ENV !== 'production') { | ||
33786 | boundMethod.__reactBoundContext = component; | ||
33787 | boundMethod.__reactBoundMethod = method; | ||
33788 | boundMethod.__reactBoundArguments = null; | ||
33789 | var componentName = component.constructor.displayName; | ||
33790 | var _bind = boundMethod.bind; | ||
33791 | boundMethod.bind = function (newThis) { | ||
33792 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
33793 | args[_key - 1] = arguments[_key]; | ||
33794 | } | ||
33795 | |||
33796 | // User is trying to bind() an autobound method; we effectively will | ||
33797 | // ignore the value of "this" that the user is trying to use, so | ||
33798 | // let's warn. | ||
33799 | if (newThis !== component && newThis !== null) { | ||
33800 | process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0; | ||
33801 | } else if (!args.length) { | ||
33802 | 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; | ||
33803 | return boundMethod; | ||
33804 | } | ||
33805 | var reboundMethod = _bind.apply(boundMethod, arguments); | ||
33806 | reboundMethod.__reactBoundContext = component; | ||
33807 | reboundMethod.__reactBoundMethod = method; | ||
33808 | reboundMethod.__reactBoundArguments = args; | ||
33809 | return reboundMethod; | ||
33810 | }; | ||
33811 | } | ||
33812 | return boundMethod; | ||
33813 | } | ||
33814 | |||
33815 | /** | ||
33816 | * Binds all auto-bound methods in a component. | ||
33817 | * | ||
33818 | * @param {object} component Component whose method is going to be bound. | ||
33819 | */ | ||
33820 | function bindAutoBindMethods(component) { | ||
33821 | var pairs = component.__reactAutoBindPairs; | ||
33822 | for (var i = 0; i < pairs.length; i += 2) { | ||
33823 | var autoBindKey = pairs[i]; | ||
33824 | var method = pairs[i + 1]; | ||
33825 | component[autoBindKey] = bindAutoBindMethod(component, method); | ||
33826 | } | ||
33827 | } | ||
33828 | |||
33829 | /** | ||
33830 | * Add more to the ReactClass base class. These are all legacy features and | ||
33831 | * therefore not already part of the modern ReactComponent. | ||
33832 | */ | ||
33833 | var ReactClassMixin = { | ||
33834 | |||
33835 | /** | ||
33836 | * TODO: This will be deprecated because state should always keep a consistent | ||
33837 | * type signature and the only use case for this, is to avoid that. | ||
33838 | */ | ||
33839 | replaceState: function (newState, callback) { | ||
33840 | this.updater.enqueueReplaceState(this, newState); | ||
33841 | if (callback) { | ||
33842 | this.updater.enqueueCallback(this, callback, 'replaceState'); | ||
33843 | } | ||
33844 | }, | ||
33845 | |||
33846 | /** | ||
33847 | * Checks whether or not this composite component is mounted. | ||
33848 | * @return {boolean} True if mounted, false otherwise. | ||
33849 | * @protected | ||
33850 | * @final | ||
33851 | */ | ||
33852 | isMounted: function () { | ||
33853 | return this.updater.isMounted(this); | ||
33854 | } | ||
33855 | }; | ||
33856 | |||
33857 | var ReactClassComponent = function () {}; | ||
33858 | _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); | ||
33859 | |||
33860 | var didWarnDeprecated = false; | ||
33861 | |||
33862 | /** | ||
33863 | * Module for creating composite components. | ||
33864 | * | ||
33865 | * @class ReactClass | ||
33866 | */ | ||
33867 | var ReactClass = { | ||
33868 | |||
33869 | /** | ||
33870 | * Creates a composite component class given a class specification. | ||
33871 | * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass | ||
33872 | * | ||
33873 | * @param {object} spec Class specification (which must define `render`). | ||
33874 | * @return {function} Component constructor function. | ||
33875 | * @public | ||
33876 | */ | ||
33877 | createClass: function (spec) { | ||
33878 | if (process.env.NODE_ENV !== 'production') { | ||
33879 | 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; | ||
33880 | didWarnDeprecated = true; | ||
33881 | } | ||
33882 | |||
33883 | // To keep our warnings more understandable, we'll use a little hack here to | ||
33884 | // ensure that Constructor.name !== 'Constructor'. This makes sure we don't | ||
33885 | // unnecessarily identify a class without displayName as 'Constructor'. | ||
33886 | var Constructor = identity(function (props, context, updater) { | ||
33887 | // This constructor gets overridden by mocks. The argument is used | ||
33888 | // by mocks to assert on what gets mounted. | ||
33889 | |||
33890 | if (process.env.NODE_ENV !== 'production') { | ||
33891 | 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; | ||
33892 | } | ||
33893 | |||
33894 | // Wire up auto-binding | ||
33895 | if (this.__reactAutoBindPairs.length) { | ||
33896 | bindAutoBindMethods(this); | ||
33897 | } | ||
33898 | |||
33899 | this.props = props; | ||
33900 | this.context = context; | ||
33901 | this.refs = emptyObject; | ||
33902 | this.updater = updater || ReactNoopUpdateQueue; | ||
33903 | |||
33904 | this.state = null; | ||
33905 | |||
33906 | // ReactClasses doesn't have constructors. Instead, they use the | ||
33907 | // getInitialState and componentWillMount methods for initialization. | ||
33908 | |||
33909 | var initialState = this.getInitialState ? this.getInitialState() : null; | ||
33910 | if (process.env.NODE_ENV !== 'production') { | ||
33911 | // We allow auto-mocks to proceed as if they're returning null. | ||
33912 | if (initialState === undefined && this.getInitialState._isMockFunction) { | ||
33913 | // This is probably bad practice. Consider warning here and | ||
33914 | // deprecating this convenience. | ||
33915 | initialState = null; | ||
33916 | } | ||
33917 | } | ||
33918 | !(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; | ||
33919 | |||
33920 | this.state = initialState; | ||
33921 | }); | ||
33922 | Constructor.prototype = new ReactClassComponent(); | ||
33923 | Constructor.prototype.constructor = Constructor; | ||
33924 | Constructor.prototype.__reactAutoBindPairs = []; | ||
33925 | |||
33926 | injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); | ||
33927 | |||
33928 | mixSpecIntoComponent(Constructor, spec); | ||
33929 | |||
33930 | // Initialize the defaultProps property after all mixins have been merged. | ||
33931 | if (Constructor.getDefaultProps) { | ||
33932 | Constructor.defaultProps = Constructor.getDefaultProps(); | ||
33933 | } | ||
33934 | |||
33935 | if (process.env.NODE_ENV !== 'production') { | ||
33936 | // This is a tag to indicate that the use of these method names is ok, | ||
33937 | // since it's used with createClass. If it's not, then it's likely a | ||
33938 | // mistake so we'll warn you to use the static property, property | ||
33939 | // initializer or constructor respectively. | ||
33940 | if (Constructor.getDefaultProps) { | ||
33941 | Constructor.getDefaultProps.isReactClassApproved = {}; | ||
33942 | } | ||
33943 | if (Constructor.prototype.getInitialState) { | ||
33944 | Constructor.prototype.getInitialState.isReactClassApproved = {}; | ||
33945 | } | ||
33946 | } | ||
33947 | |||
33948 | !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0; | ||
33949 | |||
33950 | if (process.env.NODE_ENV !== 'production') { | ||
33951 | 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; | ||
33952 | 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; | ||
33953 | } | ||
33954 | |||
33955 | // Reduce time spent doing lookups by setting these on the prototype. | ||
33956 | for (var methodName in ReactClassInterface) { | ||
33957 | if (!Constructor.prototype[methodName]) { | ||
33958 | Constructor.prototype[methodName] = null; | ||
33959 | } | ||
33960 | } | ||
33961 | |||
33962 | return Constructor; | ||
33963 | }, | ||
33964 | |||
33965 | injection: { | ||
33966 | injectMixin: function (mixin) { | ||
33967 | injectedMixins.push(mixin); | ||
33968 | } | ||
33969 | } | ||
33970 | |||
33971 | }; | ||
33972 | |||
33973 | module.exports = ReactClass; | ||
33974 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
33975 | |||
33976 | /***/ }), | ||
33977 | /* 316 */ | ||
33978 | /***/ (function(module, exports, __webpack_require__) { | ||
33979 | |||
33980 | "use strict"; | ||
33981 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
33982 | * Copyright 2013-present, Facebook, Inc. | ||
33983 | * All rights reserved. | ||
33984 | * | ||
33985 | * This source code is licensed under the BSD-style license found in the | ||
33986 | * LICENSE file in the root directory of this source tree. An additional grant | ||
33987 | * of patent rights can be found in the PATENTS file in the same directory. | ||
33988 | * | ||
33989 | */ | ||
33990 | |||
33991 | |||
33992 | |||
33993 | var ReactElement = __webpack_require__(31); | ||
33994 | |||
33995 | /** | ||
33996 | * Create a factory that creates HTML tag elements. | ||
33997 | * | ||
33998 | * @private | ||
33999 | */ | ||
34000 | var createDOMFactory = ReactElement.createFactory; | ||
34001 | if (process.env.NODE_ENV !== 'production') { | ||
34002 | var ReactElementValidator = __webpack_require__(140); | ||
34003 | createDOMFactory = ReactElementValidator.createFactory; | ||
34004 | } | ||
34005 | |||
34006 | /** | ||
34007 | * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. | ||
34008 | * This is also accessible via `React.DOM`. | ||
34009 | * | ||
34010 | * @public | ||
34011 | */ | ||
34012 | var ReactDOMFactories = { | ||
34013 | a: createDOMFactory('a'), | ||
34014 | abbr: createDOMFactory('abbr'), | ||
34015 | address: createDOMFactory('address'), | ||
34016 | area: createDOMFactory('area'), | ||
34017 | article: createDOMFactory('article'), | ||
34018 | aside: createDOMFactory('aside'), | ||
34019 | audio: createDOMFactory('audio'), | ||
34020 | b: createDOMFactory('b'), | ||
34021 | base: createDOMFactory('base'), | ||
34022 | bdi: createDOMFactory('bdi'), | ||
34023 | bdo: createDOMFactory('bdo'), | ||
34024 | big: createDOMFactory('big'), | ||
34025 | blockquote: createDOMFactory('blockquote'), | ||
34026 | body: createDOMFactory('body'), | ||
34027 | br: createDOMFactory('br'), | ||
34028 | button: createDOMFactory('button'), | ||
34029 | canvas: createDOMFactory('canvas'), | ||
34030 | caption: createDOMFactory('caption'), | ||
34031 | cite: createDOMFactory('cite'), | ||
34032 | code: createDOMFactory('code'), | ||
34033 | col: createDOMFactory('col'), | ||
34034 | colgroup: createDOMFactory('colgroup'), | ||
34035 | data: createDOMFactory('data'), | ||
34036 | datalist: createDOMFactory('datalist'), | ||
34037 | dd: createDOMFactory('dd'), | ||
34038 | del: createDOMFactory('del'), | ||
34039 | details: createDOMFactory('details'), | ||
34040 | dfn: createDOMFactory('dfn'), | ||
34041 | dialog: createDOMFactory('dialog'), | ||
34042 | div: createDOMFactory('div'), | ||
34043 | dl: createDOMFactory('dl'), | ||
34044 | dt: createDOMFactory('dt'), | ||
34045 | em: createDOMFactory('em'), | ||
34046 | embed: createDOMFactory('embed'), | ||
34047 | fieldset: createDOMFactory('fieldset'), | ||
34048 | figcaption: createDOMFactory('figcaption'), | ||
34049 | figure: createDOMFactory('figure'), | ||
34050 | footer: createDOMFactory('footer'), | ||
34051 | form: createDOMFactory('form'), | ||
34052 | h1: createDOMFactory('h1'), | ||
34053 | h2: createDOMFactory('h2'), | ||
34054 | h3: createDOMFactory('h3'), | ||
34055 | h4: createDOMFactory('h4'), | ||
34056 | h5: createDOMFactory('h5'), | ||
34057 | h6: createDOMFactory('h6'), | ||
34058 | head: createDOMFactory('head'), | ||
34059 | header: createDOMFactory('header'), | ||
34060 | hgroup: createDOMFactory('hgroup'), | ||
34061 | hr: createDOMFactory('hr'), | ||
34062 | html: createDOMFactory('html'), | ||
34063 | i: createDOMFactory('i'), | ||
34064 | iframe: createDOMFactory('iframe'), | ||
34065 | img: createDOMFactory('img'), | ||
34066 | input: createDOMFactory('input'), | ||
34067 | ins: createDOMFactory('ins'), | ||
34068 | kbd: createDOMFactory('kbd'), | ||
34069 | keygen: createDOMFactory('keygen'), | ||
34070 | label: createDOMFactory('label'), | ||
34071 | legend: createDOMFactory('legend'), | ||
34072 | li: createDOMFactory('li'), | ||
34073 | link: createDOMFactory('link'), | ||
34074 | main: createDOMFactory('main'), | ||
34075 | map: createDOMFactory('map'), | ||
34076 | mark: createDOMFactory('mark'), | ||
34077 | menu: createDOMFactory('menu'), | ||
34078 | menuitem: createDOMFactory('menuitem'), | ||
34079 | meta: createDOMFactory('meta'), | ||
34080 | meter: createDOMFactory('meter'), | ||
34081 | nav: createDOMFactory('nav'), | ||
34082 | noscript: createDOMFactory('noscript'), | ||
34083 | object: createDOMFactory('object'), | ||
34084 | ol: createDOMFactory('ol'), | ||
34085 | optgroup: createDOMFactory('optgroup'), | ||
34086 | option: createDOMFactory('option'), | ||
34087 | output: createDOMFactory('output'), | ||
34088 | p: createDOMFactory('p'), | ||
34089 | param: createDOMFactory('param'), | ||
34090 | picture: createDOMFactory('picture'), | ||
34091 | pre: createDOMFactory('pre'), | ||
34092 | progress: createDOMFactory('progress'), | ||
34093 | q: createDOMFactory('q'), | ||
34094 | rp: createDOMFactory('rp'), | ||
34095 | rt: createDOMFactory('rt'), | ||
34096 | ruby: createDOMFactory('ruby'), | ||
34097 | s: createDOMFactory('s'), | ||
34098 | samp: createDOMFactory('samp'), | ||
34099 | script: createDOMFactory('script'), | ||
34100 | section: createDOMFactory('section'), | ||
34101 | select: createDOMFactory('select'), | ||
34102 | small: createDOMFactory('small'), | ||
34103 | source: createDOMFactory('source'), | ||
34104 | span: createDOMFactory('span'), | ||
34105 | strong: createDOMFactory('strong'), | ||
34106 | style: createDOMFactory('style'), | ||
34107 | sub: createDOMFactory('sub'), | ||
34108 | summary: createDOMFactory('summary'), | ||
34109 | sup: createDOMFactory('sup'), | ||
34110 | table: createDOMFactory('table'), | ||
34111 | tbody: createDOMFactory('tbody'), | ||
34112 | td: createDOMFactory('td'), | ||
34113 | textarea: createDOMFactory('textarea'), | ||
34114 | tfoot: createDOMFactory('tfoot'), | ||
34115 | th: createDOMFactory('th'), | ||
34116 | thead: createDOMFactory('thead'), | ||
34117 | time: createDOMFactory('time'), | ||
34118 | title: createDOMFactory('title'), | ||
34119 | tr: createDOMFactory('tr'), | ||
34120 | track: createDOMFactory('track'), | ||
34121 | u: createDOMFactory('u'), | ||
34122 | ul: createDOMFactory('ul'), | ||
34123 | 'var': createDOMFactory('var'), | ||
34124 | video: createDOMFactory('video'), | ||
34125 | wbr: createDOMFactory('wbr'), | ||
34126 | |||
34127 | // SVG | ||
34128 | circle: createDOMFactory('circle'), | ||
34129 | clipPath: createDOMFactory('clipPath'), | ||
34130 | defs: createDOMFactory('defs'), | ||
34131 | ellipse: createDOMFactory('ellipse'), | ||
34132 | g: createDOMFactory('g'), | ||
34133 | image: createDOMFactory('image'), | ||
34134 | line: createDOMFactory('line'), | ||
34135 | linearGradient: createDOMFactory('linearGradient'), | ||
34136 | mask: createDOMFactory('mask'), | ||
34137 | path: createDOMFactory('path'), | ||
34138 | pattern: createDOMFactory('pattern'), | ||
34139 | polygon: createDOMFactory('polygon'), | ||
34140 | polyline: createDOMFactory('polyline'), | ||
34141 | radialGradient: createDOMFactory('radialGradient'), | ||
34142 | rect: createDOMFactory('rect'), | ||
34143 | stop: createDOMFactory('stop'), | ||
34144 | svg: createDOMFactory('svg'), | ||
34145 | text: createDOMFactory('text'), | ||
34146 | tspan: createDOMFactory('tspan') | ||
34147 | }; | ||
34148 | |||
34149 | module.exports = ReactDOMFactories; | ||
34150 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
34151 | |||
34152 | /***/ }), | ||
34153 | /* 317 */ | ||
34154 | /***/ (function(module, exports, __webpack_require__) { | ||
34155 | |||
34156 | "use strict"; | ||
34157 | /** | ||
34158 | * Copyright 2013-present, Facebook, Inc. | ||
34159 | * All rights reserved. | ||
34160 | * | ||
34161 | * This source code is licensed under the BSD-style license found in the | ||
34162 | * LICENSE file in the root directory of this source tree. An additional grant | ||
34163 | * of patent rights can be found in the PATENTS file in the same directory. | ||
34164 | * | ||
34165 | */ | ||
34166 | |||
34167 | |||
34168 | |||
34169 | var _require = __webpack_require__(31), | ||
34170 | isValidElement = _require.isValidElement; | ||
34171 | |||
34172 | var factory = __webpack_require__(113); | ||
34173 | |||
34174 | module.exports = factory(isValidElement); | ||
34175 | |||
34176 | /***/ }), | ||
34177 | /* 318 */ | ||
34178 | /***/ (function(module, exports, __webpack_require__) { | ||
34179 | |||
34180 | "use strict"; | ||
34181 | /** | ||
34182 | * Copyright 2013-present, Facebook, Inc. | ||
34183 | * All rights reserved. | ||
34184 | * | ||
34185 | * This source code is licensed under the BSD-style license found in the | ||
34186 | * LICENSE file in the root directory of this source tree. An additional grant | ||
34187 | * of patent rights can be found in the PATENTS file in the same directory. | ||
34188 | * | ||
34189 | * | ||
34190 | */ | ||
34191 | |||
34192 | |||
34193 | |||
34194 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | ||
34195 | |||
34196 | module.exports = ReactPropTypesSecret; | ||
34197 | |||
34198 | /***/ }), | ||
34199 | /* 319 */ | ||
34200 | /***/ (function(module, exports, __webpack_require__) { | ||
34201 | |||
34202 | "use strict"; | ||
34203 | /** | ||
34204 | * Copyright 2013-present, Facebook, Inc. | ||
34205 | * All rights reserved. | ||
34206 | * | ||
34207 | * This source code is licensed under the BSD-style license found in the | ||
34208 | * LICENSE file in the root directory of this source tree. An additional grant | ||
34209 | * of patent rights can be found in the PATENTS file in the same directory. | ||
34210 | * | ||
34211 | */ | ||
34212 | |||
34213 | |||
34214 | |||
34215 | var _assign = __webpack_require__(4); | ||
34216 | |||
34217 | var ReactComponent = __webpack_require__(90); | ||
34218 | var ReactNoopUpdateQueue = __webpack_require__(91); | ||
34219 | |||
34220 | var emptyObject = __webpack_require__(36); | ||
34221 | |||
34222 | /** | ||
34223 | * Base class helpers for the updating state of a component. | ||
34224 | */ | ||
34225 | function ReactPureComponent(props, context, updater) { | ||
34226 | // Duplicated from ReactComponent. | ||
34227 | this.props = props; | ||
34228 | this.context = context; | ||
34229 | this.refs = emptyObject; | ||
34230 | // We initialize the default updater but the real one gets injected by the | ||
34231 | // renderer. | ||
34232 | this.updater = updater || ReactNoopUpdateQueue; | ||
34233 | } | ||
34234 | |||
34235 | function ComponentDummy() {} | ||
34236 | ComponentDummy.prototype = ReactComponent.prototype; | ||
34237 | ReactPureComponent.prototype = new ComponentDummy(); | ||
34238 | ReactPureComponent.prototype.constructor = ReactPureComponent; | ||
34239 | // Avoid an extra prototype jump for these methods. | ||
34240 | _assign(ReactPureComponent.prototype, ReactComponent.prototype); | ||
34241 | ReactPureComponent.prototype.isPureReactComponent = true; | ||
34242 | |||
34243 | module.exports = ReactPureComponent; | ||
34244 | |||
34245 | /***/ }), | ||
34246 | /* 320 */ | ||
34247 | /***/ (function(module, exports, __webpack_require__) { | ||
34248 | |||
34249 | "use strict"; | ||
34250 | /** | ||
34251 | * Copyright 2013-present, Facebook, Inc. | ||
34252 | * All rights reserved. | ||
34253 | * | ||
34254 | * This source code is licensed under the BSD-style license found in the | ||
34255 | * LICENSE file in the root directory of this source tree. An additional grant | ||
34256 | * of patent rights can be found in the PATENTS file in the same directory. | ||
34257 | * | ||
34258 | */ | ||
34259 | |||
34260 | |||
34261 | |||
34262 | module.exports = '15.5.4'; | ||
34263 | |||
34264 | /***/ }), | ||
34265 | /* 321 */ | ||
34266 | /***/ (function(module, exports, __webpack_require__) { | ||
34267 | |||
34268 | "use strict"; | ||
34269 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
34270 | * Copyright 2013-present, Facebook, Inc. | ||
34271 | * All rights reserved. | ||
34272 | * | ||
34273 | * This source code is licensed under the BSD-style license found in the | ||
34274 | * LICENSE file in the root directory of this source tree. An additional grant | ||
34275 | * of patent rights can be found in the PATENTS file in the same directory. | ||
34276 | * | ||
34277 | */ | ||
34278 | |||
34279 | |||
34280 | |||
34281 | var _prodInvariant = __webpack_require__(32); | ||
34282 | |||
34283 | var ReactPropTypeLocationNames = __webpack_require__(141); | ||
34284 | var ReactPropTypesSecret = __webpack_require__(318); | ||
34285 | |||
34286 | var invariant = __webpack_require__(1); | ||
34287 | var warning = __webpack_require__(2); | ||
34288 | |||
34289 | var ReactComponentTreeHook; | ||
34290 | |||
34291 | if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { | ||
34292 | // Temporary hack. | ||
34293 | // Inline requires don't work well with Jest: | ||
34294 | // https://github.com/facebook/react/issues/7240 | ||
34295 | // Remove the inline requires when we don't need them anymore: | ||
34296 | // https://github.com/facebook/react/pull/7178 | ||
34297 | ReactComponentTreeHook = __webpack_require__(9); | ||
34298 | } | ||
34299 | |||
34300 | var loggedTypeFailures = {}; | ||
34301 | |||
34302 | /** | ||
34303 | * Assert that the values match with the type specs. | ||
34304 | * Error messages are memorized and will only be shown once. | ||
34305 | * | ||
34306 | * @param {object} typeSpecs Map of name to a ReactPropType | ||
34307 | * @param {object} values Runtime values that need to be type-checked | ||
34308 | * @param {string} location e.g. "prop", "context", "child context" | ||
34309 | * @param {string} componentName Name of the component for error messages. | ||
34310 | * @param {?object} element The React element that is being type-checked | ||
34311 | * @param {?number} debugID The React component instance that is being type-checked | ||
34312 | * @private | ||
34313 | */ | ||
34314 | function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) { | ||
34315 | for (var typeSpecName in typeSpecs) { | ||
34316 | if (typeSpecs.hasOwnProperty(typeSpecName)) { | ||
34317 | var error; | ||
34318 | // Prop type validation may throw. In case they do, we don't want to | ||
34319 | // fail the render phase where it didn't fail before. So we log it. | ||
34320 | // After these have been cleaned up, we'll let them throw. | ||
34321 | try { | ||
34322 | // This is intentionally an invariant that gets caught. It's the same | ||
34323 | // behavior as without this statement except with a better message. | ||
34324 | !(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; | ||
34325 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); | ||
34326 | } catch (ex) { | ||
34327 | error = ex; | ||
34328 | } | ||
34329 | 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; | ||
34330 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
34331 | // Only monitor this failure once because there tends to be a lot of the | ||
34332 | // same error. | ||
34333 | loggedTypeFailures[error.message] = true; | ||
34334 | |||
34335 | var componentStackInfo = ''; | ||
34336 | |||
34337 | if (process.env.NODE_ENV !== 'production') { | ||
34338 | if (!ReactComponentTreeHook) { | ||
34339 | ReactComponentTreeHook = __webpack_require__(9); | ||
34340 | } | ||
34341 | if (debugID !== null) { | ||
34342 | componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID); | ||
34343 | } else if (element !== null) { | ||
34344 | componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element); | ||
34345 | } | ||
34346 | } | ||
34347 | |||
34348 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0; | ||
34349 | } | ||
34350 | } | ||
34351 | } | ||
34352 | } | ||
34353 | |||
34354 | module.exports = checkReactTypeSpec; | ||
34355 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
34356 | |||
34357 | /***/ }), | ||
34358 | /* 322 */ | ||
34359 | /***/ (function(module, exports, __webpack_require__) { | ||
34360 | |||
34361 | "use strict"; | ||
34362 | /** | ||
34363 | * Copyright 2013-present, Facebook, Inc. | ||
34364 | * All rights reserved. | ||
34365 | * | ||
34366 | * This source code is licensed under the BSD-style license found in the | ||
34367 | * LICENSE file in the root directory of this source tree. An additional grant | ||
34368 | * of patent rights can be found in the PATENTS file in the same directory. | ||
34369 | * | ||
34370 | * | ||
34371 | */ | ||
34372 | |||
34373 | |||
34374 | |||
34375 | var nextDebugID = 1; | ||
34376 | |||
34377 | function getNextDebugID() { | ||
34378 | return nextDebugID++; | ||
34379 | } | ||
34380 | |||
34381 | module.exports = getNextDebugID; | ||
34382 | |||
34383 | /***/ }), | ||
34384 | /* 323 */ | ||
34385 | /***/ (function(module, exports, __webpack_require__) { | ||
34386 | |||
34387 | "use strict"; | ||
34388 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
34389 | * Copyright 2013-present, Facebook, Inc. | ||
34390 | * All rights reserved. | ||
34391 | * | ||
34392 | * This source code is licensed under the BSD-style license found in the | ||
34393 | * LICENSE file in the root directory of this source tree. An additional grant | ||
34394 | * of patent rights can be found in the PATENTS file in the same directory. | ||
34395 | * | ||
34396 | */ | ||
34397 | |||
34398 | |||
34399 | var _prodInvariant = __webpack_require__(32); | ||
34400 | |||
34401 | var ReactElement = __webpack_require__(31); | ||
34402 | |||
34403 | var invariant = __webpack_require__(1); | ||
34404 | |||
34405 | /** | ||
34406 | * Returns the first child in a collection of children and verifies that there | ||
34407 | * is only one child in the collection. | ||
34408 | * | ||
34409 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only | ||
34410 | * | ||
34411 | * The current implementation of this function assumes that a single child gets | ||
34412 | * passed without a wrapper, but the purpose of this helper function is to | ||
34413 | * abstract away the particular structure of children. | ||
34414 | * | ||
34415 | * @param {?object} children Child collection structure. | ||
34416 | * @return {ReactElement} The first and only `ReactElement` contained in the | ||
34417 | * structure. | ||
34418 | */ | ||
34419 | function onlyChild(children) { | ||
34420 | !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; | ||
34421 | return children; | ||
34422 | } | ||
34423 | |||
34424 | module.exports = onlyChild; | ||
34425 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
34426 | |||
34427 | /***/ }), | ||
34428 | /* 324 */ | ||
34429 | /***/ (function(module, exports, __webpack_require__) { | ||
34430 | |||
34431 | "use strict"; | ||
34432 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
34433 | * Copyright 2013-present, Facebook, Inc. | ||
34434 | * All rights reserved. | ||
34435 | * | ||
34436 | * This source code is licensed under the BSD-style license found in the | ||
34437 | * LICENSE file in the root directory of this source tree. An additional grant | ||
34438 | * of patent rights can be found in the PATENTS file in the same directory. | ||
34439 | * | ||
34440 | */ | ||
34441 | |||
34442 | |||
34443 | |||
34444 | var _prodInvariant = __webpack_require__(32); | ||
34445 | |||
34446 | var ReactCurrentOwner = __webpack_require__(17); | ||
34447 | var REACT_ELEMENT_TYPE = __webpack_require__(139); | ||
34448 | |||
34449 | var getIteratorFn = __webpack_require__(142); | ||
34450 | var invariant = __webpack_require__(1); | ||
34451 | var KeyEscapeUtils = __webpack_require__(312); | ||
34452 | var warning = __webpack_require__(2); | ||
34453 | |||
34454 | var SEPARATOR = '.'; | ||
34455 | var SUBSEPARATOR = ':'; | ||
34456 | |||
34457 | /** | ||
34458 | * This is inlined from ReactElement since this file is shared between | ||
34459 | * isomorphic and renderers. We could extract this to a | ||
34460 | * | ||
34461 | */ | ||
34462 | |||
34463 | /** | ||
34464 | * TODO: Test that a single child and an array with one item have the same key | ||
34465 | * pattern. | ||
34466 | */ | ||
34467 | |||
34468 | var didWarnAboutMaps = false; | ||
34469 | |||
34470 | /** | ||
34471 | * Generate a key string that identifies a component within a set. | ||
34472 | * | ||
34473 | * @param {*} component A component that could contain a manual key. | ||
34474 | * @param {number} index Index that is used if a manual key is not provided. | ||
34475 | * @return {string} | ||
34476 | */ | ||
34477 | function getComponentKey(component, index) { | ||
34478 | // Do some typechecking here since we call this blindly. We want to ensure | ||
34479 | // that we don't block potential future ES APIs. | ||
34480 | if (component && typeof component === 'object' && component.key != null) { | ||
34481 | // Explicit key | ||
34482 | return KeyEscapeUtils.escape(component.key); | ||
34483 | } | ||
34484 | // Implicit key determined by the index in the set | ||
34485 | return index.toString(36); | ||
34486 | } | ||
34487 | |||
34488 | /** | ||
34489 | * @param {?*} children Children tree container. | ||
34490 | * @param {!string} nameSoFar Name of the key path so far. | ||
34491 | * @param {!function} callback Callback to invoke with each child found. | ||
34492 | * @param {?*} traverseContext Used to pass information throughout the traversal | ||
34493 | * process. | ||
34494 | * @return {!number} The number of children in this subtree. | ||
34495 | */ | ||
34496 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { | ||
34497 | var type = typeof children; | ||
34498 | |||
34499 | if (type === 'undefined' || type === 'boolean') { | ||
34500 | // All of the above are perceived as null. | ||
34501 | children = null; | ||
34502 | } | ||
34503 | |||
34504 | if (children === null || type === 'string' || type === 'number' || | ||
34505 | // The following is inlined from ReactElement. This means we can optimize | ||
34506 | // some checks. React Fiber also inlines this logic for similar purposes. | ||
34507 | type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { | ||
34508 | callback(traverseContext, children, | ||
34509 | // If it's the only child, treat the name as if it was wrapped in an array | ||
34510 | // so that it's consistent if the number of children grows. | ||
34511 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); | ||
34512 | return 1; | ||
34513 | } | ||
34514 | |||
34515 | var child; | ||
34516 | var nextName; | ||
34517 | var subtreeCount = 0; // Count of children found in the current subtree. | ||
34518 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; | ||
34519 | |||
34520 | if (Array.isArray(children)) { | ||
34521 | for (var i = 0; i < children.length; i++) { | ||
34522 | child = children[i]; | ||
34523 | nextName = nextNamePrefix + getComponentKey(child, i); | ||
34524 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
34525 | } | ||
34526 | } else { | ||
34527 | var iteratorFn = getIteratorFn(children); | ||
34528 | if (iteratorFn) { | ||
34529 | var iterator = iteratorFn.call(children); | ||
34530 | var step; | ||
34531 | if (iteratorFn !== children.entries) { | ||
34532 | var ii = 0; | ||
34533 | while (!(step = iterator.next()).done) { | ||
34534 | child = step.value; | ||
34535 | nextName = nextNamePrefix + getComponentKey(child, ii++); | ||
34536 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
34537 | } | ||
34538 | } else { | ||
34539 | if (process.env.NODE_ENV !== 'production') { | ||
34540 | var mapsAsChildrenAddendum = ''; | ||
34541 | if (ReactCurrentOwner.current) { | ||
34542 | var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); | ||
34543 | if (mapsAsChildrenOwnerName) { | ||
34544 | mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; | ||
34545 | } | ||
34546 | } | ||
34547 | 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; | ||
34548 | didWarnAboutMaps = true; | ||
34549 | } | ||
34550 | // Iterator will provide entry [k,v] tuples rather than values. | ||
34551 | while (!(step = iterator.next()).done) { | ||
34552 | var entry = step.value; | ||
34553 | if (entry) { | ||
34554 | child = entry[1]; | ||
34555 | nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); | ||
34556 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
34557 | } | ||
34558 | } | ||
34559 | } | ||
34560 | } else if (type === 'object') { | ||
34561 | var addendum = ''; | ||
34562 | if (process.env.NODE_ENV !== 'production') { | ||
34563 | 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.'; | ||
34564 | if (children._isReactElement) { | ||
34565 | 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.'; | ||
34566 | } | ||
34567 | if (ReactCurrentOwner.current) { | ||
34568 | var name = ReactCurrentOwner.current.getName(); | ||
34569 | if (name) { | ||
34570 | addendum += ' Check the render method of `' + name + '`.'; | ||
34571 | } | ||
34572 | } | ||
34573 | } | ||
34574 | var childrenString = String(children); | ||
34575 | 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; | ||
34576 | } | ||
34577 | } | ||
34578 | |||
34579 | return subtreeCount; | ||
34580 | } | ||
34581 | |||
34582 | /** | ||
34583 | * Traverses children that are typically specified as `props.children`, but | ||
34584 | * might also be specified through attributes: | ||
34585 | * | ||
34586 | * - `traverseAllChildren(this.props.children, ...)` | ||
34587 | * - `traverseAllChildren(this.props.leftPanelChildren, ...)` | ||
34588 | * | ||
34589 | * The `traverseContext` is an optional argument that is passed through the | ||
34590 | * entire traversal. It can be used to store accumulations or anything else that | ||
34591 | * the callback might find relevant. | ||
34592 | * | ||
34593 | * @param {?*} children Children tree object. | ||
34594 | * @param {!function} callback To invoke upon traversing each child. | ||
34595 | * @param {?*} traverseContext Context for traversal. | ||
34596 | * @return {!number} The number of children in this subtree. | ||
34597 | */ | ||
34598 | function traverseAllChildren(children, callback, traverseContext) { | ||
34599 | if (children == null) { | ||
34600 | return 0; | ||
34601 | } | ||
34602 | |||
34603 | return traverseAllChildrenImpl(children, '', callback, traverseContext); | ||
34604 | } | ||
34605 | |||
34606 | module.exports = traverseAllChildren; | ||
34607 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
34608 | |||
34609 | /***/ }) | ||
34610 | /******/ ]); | ||
34611 | //# sourceMappingURL=common.js.map \ No newline at end of file | ||